Changed official name from Wonx to WonX.

Add MANUAL file.

Added sentences to OMAKE.jpn.

Version 1.0 - from wonx-1.0.tar.gz
This commit is contained in:
Hiroaki Sakai 2000-11-23 17:00:00 +09:00 committed by Godzil
parent 7630141b26
commit f25d7235fb
51 changed files with 992 additions and 782 deletions

View File

@ -1,7 +1,7 @@
/*****************************************************************************/
/* Wonx - WonderWitch on X. */
/* WonX - WonderWitch on X. */
/* */
/* Wonx Copyright (c) 2000 Sakai Hiroaki. */
/* WonX Copyright (c) 2000 Sakai Hiroaki. */
/* All Rights Reserved. */
/*===========================================================================*/
/* This program is free software; you can redistribute it and/or modify */

13
HISTORY
View File

@ -1,3 +1,16 @@
2000/11/23(木)
wonx-1.0 公開
正式名称を Wonx から WonX に変更.
MANUAL ファイルを追加.
OMAKE.jpn に文章追加.
2000/11/23(フレ)
wonx-b05 ク<>

76
MANUAL Normal file
View File

@ -0,0 +1,76 @@
WonX のプログラム構造についての解説です.
改造するときの参考にしてください.(ライセンスはGPLなので改造は自由です)
■ ファイル構成
WonX はオブジェクト指向で書いてあり,クラス単位でファイルを分けてあります.
ファイル自体は一つのクラスにつき3つずつあります.例えば X のウインドウを
管理するための XDisplay クラス用には,以下の3つのファイルがあります.
XDisplay.h ... 外部公開用ヘッダファイルXDisplay クラスを使用したい
ときには,このファイルを include する.
XDisplayP.h ... 外部に公開しないプライベートなヘッダファイル.
一般には include しない.デバッグ時などにメンバを直接
参照したいときに include するためのもの.
XDisplay.c ... メンバ関数などの本体.
クラスのメンバ変数は XDisplayP.h で定義してあるので,メンバを直接参照することは
できません.必ずアクセス用のメンバ関数を通して参照します.値の設定も同様です.
この他にdisp.c や text.c などのファイルがあります.これらは,
WonderWitch の互換関数です.
■ オブジェクトのツリー
オブジェクトは以下のようなツリー構造になっています.
┌─ WWColorMap
├─ WWPalette[16]
├─ WWCharacter[512]
┌─WWDisplay ─┼─ WWSprite[128]
┌─ WonXDisplay ──┤ ├─ WWScreen[2]
│ └─XDisplay └─ WWLCDPanel
│ ┌─ WWInterrupt
├─ WonXSystem ───┼─ WWTimer[3]
│ └─ UNIXTimer
WonX ─┤
├─ WonXText ────── WWText
└─ WonXSerialPort ─── WWSerialPort
WW という接頭語がつくクラスは WonderWitch 依存のものです.主に
WonderSwan の状態情報を格納します.
X という接頭語がつくクラスは X 依存のものUNIX という接頭語がつくクラスは
UNIX 依存のものです.
Wonx という接頭語がつくクラスはそれらを統括するものです.
ツリー構造を理解したかったら,各クラスの *P.h ファイルのメンバの定義と,
*.c ファイルの *_Create() 関数を参照してください.
■ オブジェクトの生成
各クラスには,オブジェクトの生成用に,[クラス名]_Create() という
関数が用意されています.
WonX_Create() が呼ばれると,内部で WonXDisplay_Create(), WonXSystem_Create(),
WonXText_Create(), WonXSerialPort_Create() が呼ばれ,子の WonXDisplay,
WonXSystem, WonXText, WonXSerialPort オブジェクトが生成されます.
WonXDisplay_Create() が呼ばれると,内部で WWDisplay_Create(),
XDisplay_Create() が呼ばれ,... というように続いて,すべてのツリーか
生成されます.
オブジェクトを解放するときも同様なのですがWonX_Destroy() が
呼ばれるタイミングが無いため,あまりちゃんと書いてません.
WonderWitch 用の互換関数では,必ず先頭で,
if (!WonX_IsCreated()) WonX_Create();
のようなことをやっています.つまり,互換関数のどれかが最初に呼ばれたときに,
WonX オブジェクトのツリーが作成されます.
■ メンバ関数
クラスのメンバ関数は,[クラス名]_xxx() という名前になっています.
■ このファイルはここまでです

View File

@ -2,12 +2,12 @@ XINCLUDEDIR = /usr/X11R6/include
INCLUDEDIR = .
XLIBDIR = /usr/X11R6/lib
VERSION = Wonx-b05
PKGNAME = wonx-b05
VERSION = WonX-1.0
PKGNAME = wonx-1.0
SMAC = smac-b02
OBJS = WWCharacter.o WWColorMap.o WWDisplay.o WWLCDPanel.o WWPalette.o WWScreen.o WWSprite.o WWText.o WWInterrupt.o WWTimer.o WWSerialPort.o Wonx.o WonxDisplay.o WonxText.o WonxSystem.o WonxSerialPort.o XDisplay.o UNIXTimer.o bank.o comm.o disp.o text.o key.o sound.o system.o timer.o etc.o
OBJS = WWCharacter.o WWColorMap.o WWDisplay.o WWLCDPanel.o WWPalette.o WWScreen.o WWSprite.o WWText.o WWInterrupt.o WWTimer.o WWSerialPort.o WonX.o WonXDisplay.o WonXText.o WonXSystem.o WonXSerialPort.o XDisplay.o UNIXTimer.o bank.o comm.o disp.o text.o key.o sound.o system.o timer.o etc.o
CC = gcc
@ -48,8 +48,8 @@ package :
mkdir -p $(PKGNAME)
rm -fR $(PKGNAME)/*
mkdir -p $(PKGNAME)/wonx_include
cp COPYING COPYRIGHT HISTORY README OMAKE.jpn Makefile \
makefile_for_smac sys2wonx.pl \
cp COPYING COPYRIGHT HISTORY README MANUAL OMAKE.jpn Makefile \
makefile_for_smac *.pl \
*.h *.c smac*.zip $(PKGNAME)
cp wonx_include/*.h $(PKGNAME)/wonx_include
tar cvzf $(PKGNAME).tar.gz $(PKGNAME)

View File

@ -1,5 +1,77 @@
この文書は,おまけ,ていうか,暇なときに気が向いたまま書き貯めたものです.
■■ WonX 開発秘話
そもそもなんで WonderWitch をはじめたかというと,会社の先輩に紹介されたのだ.
その先輩もどうやらモノづくりの好きな人らしく,モノづくり大好き人間どうし
ということで,そのへんは,
同じ血を感じる (坂井がかってに感じてるだけ)
とでも言うのだろうか,なにかおもしろいネタがあったら振ってほしいと
酒の席で冗談混じりに頼んでいたのだが,そのあとで WonderWitch を紹介された.
実際に購入したのは8月になってからだったのだが,いじってみると
昔のモノ作りの楽しさ,というか,コンピュータをいじる楽しさがぎゅうぎゅうに
詰まったようなもので,すぐにのめりこんだ.
ここで知らない人のためにWonderWitch というものについて,簡単に説明しよう.
バンダイから WonderSwan という携帯用ゲーム機が出ているが,この WonderSwan 上で
動作するプログラムを作るためのキットが WonderWitch である.株式会社 Qute が
開発した.
プログラム作成の手順は簡単でWindows 環境でC言語で作成・コンパイルし
WonderSwan には専用のカートリッジを装着して,専用の転送ケーブルと
転送ソフトを使って WonderSwan 側に転送すると,カートリッジに保存されて,
ゲームができる,といったぐあいである.
プログラム自体はゲームに限らず,アイディア次第でいろいろ書ける.
シリアルポートがあるので,応用範囲はとても広い.
ただC言語とはいっても当然C言語ができれば即プログラムが書けるという
ものではない.画面まわりやキー入力用の独自のサービス関数がいっぱい用意
されていてそれを使って書くことになるのだがWonderSwan のハードウエアは
さすがゲーム機,というか,スプライト機能やパレット機能を持っているので,
昔のMSXの時代は普通だったのだが今となっては特殊なハードウエアである
つまり,スプライトとかパレットとかをちゃんと理解できてないと,
プログラムは書けないし,メモリの制限もあるし,プログラムサイズの制限もあるし,
言語がCになったというだけで実はその中身は
昔の MSX とかでの BASIC プログラミングによく似てる
というのが正しい表現だと思う.
というわけではじめてみた WonderWitch なんだけど,ぼくの場合はもともと
BASIC や MS-C のような制限された環境で書いていたこともあるので,
あまり違和感無くのめり込めた.
ただぼくの場合は,
プログラムの9割は通勤電車の中で書く
という「電車プログラマ」状態なので,コーディングの最中はいいのだが,
デバッグの段階になると,
シリアルカードとシリアルケーブルと WonderSwan を常備して,
電車の中でコンパイルして転送してテストする.
ということになってしまう.(実話)
まあ,ぼくが毎日乗っている電車は,朝は1車両に一人しか乗ってない
ということもザラで,
電車の中で靴を脱いで足を伸ばしてプログラムを書く
ということも可能なくらい(さすがにここまではやってないけど)なので,
これでもべつにいいんだけれど,持ちものはなるべく軽くしたいと思っているので,
なんとかしたいと思っていた.
というわけでWonderWitch の各種関数の互換関数を FreeBSD 用に作成して,
FreeBSD 上でコンパイル・リンク・実行が行えて,最低限のデバッグを
FreeBSD 上でできたらいいな,と思って作りはじめたのが WonX である.
しかし,やっているうちに,
いつのまにか興味が逆転してしまった
WonX 作るのが目的になってしまった.
■■ N.A.D.A.R. 開発秘話
N.A.D.A.R. はそもそもは中学生のときに「TANK」という名前で作った

74
README
View File

@ -1,8 +1,8 @@
Wonx - WonderWitch on X.
WonX - WonderWitch on X.
■ 配布に当たって
Wonx はまだ不完全です.実装されていない機能や,不完全な機能,おかしな
WonX はまだ不完全です.実装されていない機能や,不完全な機能,おかしな
動作をする部分などがいっぱいあります.
バグ情報やアドバイスがあれば,作者の坂井弘亮まで,どんどんメールください.
アドレスは,
@ -14,7 +14,7 @@ http://www.seki.ee.kagu.sut.ac.jp/~sakai/WonderWitch/index.html
で,随時公開していきます.
現在は坂井が一人で製作していますが,ひとりでは細かい点の整合性
(初期化しなかった場合の動作の違いなどWonderWitch と Wonx では
(初期化しなかった場合の動作の違いなどWonderWitch と WonX では
微妙に異なっている)を追いきれないのが現状です.
とくにマニュアルに書いてない部分に関してはWonderWitch ではどのように
動作するのか,ひとりではチェックしきれません.(ていうか面倒)
@ -27,7 +27,7 @@ http://www.seki.ee.kagu.sut.ac.jp/~sakai/WonderWitch/index.html
■ はじめに
WonxWonderWitch 用のプログラムを X アプリケーションとしてコンパイルする
WonXWonderWitch 用のプログラムを X アプリケーションとしてコンパイルする
ための,ライブラリです.以下の特徴があります.
・C言語レベルで互換機能を持っているのでWonderWitch 用のプログラムを
@ -51,7 +51,7 @@ Wonx
従ってWonderWitch での動作を模倣することよりも,デバッグ情報を
出力することや改造のしやすさを優先したような実装をする場合がある.
■ 3分wonx
■ 3分WonX
とりあえず,どんなものか見てみたいことでしょう.そんな人は,
サンプルプログラムをコンパイル・実行してみましょう.
@ -100,25 +100,25 @@ smac
p を押して頻繁に描画の ON, OFF を切替えるのは,描画が非常に遅いため,
ONのままだと画面クリアとかに異常に時間がかかるからです
■ Wonx 概要
■ WonX 概要
WonxWonderWitch の display_control() とか display_status() といった
WonXWonderWitch の display_control() とか display_status() といった
関数(BIOS に対するシステムコール)と代替の関数を持っています.
これらの関数はX上にウインドウを開いてそこで WonderWitch と互換の動作を
するように書いてあります.
Wonx を make するとlibwonx.a というライブラリができます.
WonX を make するとlibwonx.a というライブラリができます.
WonderWitch 用のプログラムをUNIX 上で -lwonx してコンパイルしてやれば,
WonderWitch の display_control() とかのかわりにWonx の display_control() が
WonderWitch の display_control() とかのかわりにWonX の display_control() が
リンクされX 上で動作するようになる,という仕組みです.
■ ヘッダファイルについて
WonxUNIXシステム上にある libc を使用します.つまり,/usr/include の
WonXUNIXシステム上にある libc を使用します.つまり,/usr/include の
下を include します.
またWonderWitch にはsys/types.h などといったヘッダファイルがあります.
よってWonderWitch のヘッダファイル構成をそのまま Wonx に引き継ぐと,
Wonx のヘッダファイルと UNIX のヘッダファイルがコンフリクトする
よってWonderWitch のヘッダファイル構成をそのまま WonX に引き継ぐと,
WonX のヘッダファイルと UNIX のヘッダファイルがコンフリクトする
可能性が出てきます.
(たとえばWonderWitch の sys/types.h と /usr/include/sys/types が
コンフリクトする,などです)
@ -126,7 +126,7 @@ Wonx
コンパイルがうまくとおらないという障害の原因は,ほとんどがこのような,
「ヘッダファイルのコンフリクトもしくは誤認」に起因しています.
対策としてWonx では wonx_include というディレクトリの下にヘッダファイルを
対策としてWonX では wonx_include というディレクトリの下にヘッダファイルを
格納してあります.(本当は sys というディレクトリにしたかったが,
上記の対策のため,このようにした)
WonderWitch 用プログラム中の,
@ -149,25 +149,25 @@ ulong
調整してくださいwonx_include/system_configure.h を修正することにより,
調整できるようになってます.
■ Wonx のコンパイル
■ WonX のコンパイル
まず Wonx をコンパイルしてlibwonx.a を作成する必要があります.
Wonx のコンパイルは,以下の手順で行います.
まず WonX をコンパイルしてlibwonx.a を作成する必要があります.
WonX のコンパイルは,以下の手順で行います.
1. Wonx を展開する.
1. WonX を展開する.
~>% tar xvzf wonx.tar.gz
~>% cd wonx
~/wonx>%
2. Wonx を make する.
2. WonX を make する.
~/wonx>% make
gcc -c WWCharacter.c -O -I. -I/usr/X11R6/include
gcc -c WWColorMap.c -O -I. -I/usr/X11R6/include
...(中略)...
gcc -c wonx.c -O -I. -I/usr/X11R6/include
ar ruc libwonx.a WWCharacter.o WWColorMap.o WWDisplay.o WWLCDPanel.o WWPalette.o WWScreen.o WWSprite.o WonxDisplay.o XDisplay.o disp.o text.o key.o system.o timer.o etc.o wonx.o
ar ruc libwonx.a WWCharacter.o WWColorMap.o WWDisplay.o WWLCDPanel.o WWPalette.o WWScreen.o WWSprite.o WonXDisplay.o XDisplay.o disp.o text.o key.o system.o timer.o etc.o wonx.o
~/wonx>% ls lib*
libwonx.a
~/wonx>%
@ -176,12 +176,12 @@ libwonx.a
■ WonderWitch 用アプリケーションのコンパイル
次にWonx の利用の例として,拙作の SpeedMac という WonderWitch 用の
次にWonX の利用の例として,拙作の SpeedMac という WonderWitch 用の
ゲームをコンパイルしてみます.
(SpeedMac はサンプルプログラムとしてWonx に標準添付してあります)
(SpeedMac はサンプルプログラムとしてWonX に標準添付してあります)
SpeedMac は WonderWitch 用のゲームプログラムです.本来は WonderWitch を
使用してコンパイルしWonderSwan 上でゲームを楽しむためのものです.
今回は例としてSpeedMac に Wonx をリンクしてX 上で動作する SpeedMac の
今回は例としてSpeedMac に WonX をリンクしてX 上で動作する SpeedMac の
実行形式を作成してみます.
1. 展開する.
@ -306,7 +306,7 @@ smac
> smac | grep "character\[10\]"
wonxメッセージを出力する際にgrep でフィルタリングできるように,
WonXメッセージを出力する際にgrep でフィルタリングできるように,
かならず出力メッセージの先頭に,統一性のある文字列を追加しています.
たとえば,関数呼び出し時に表示されるメッセージには,先頭に必ず
"call" という文字列が追加されてますよってgrep -v call を通せば,
@ -334,19 +334,19 @@ wonx
■ 注意しなければならないこと
Wonx は,本来は WonderWitch 用として書かれた(もしくは,書かれる)プログラムを,
WonX は,本来は WonderWitch 用として書かれた(もしくは,書かれる)プログラムを,
UNIX 上でコンパイル・リンクするためのライブラリであり,ハードウエアを
エミュレートするものではありません.
ですからWonderWitch と UNIX 上のC言語のギャップのため気をつけなければ
ならないことがいくつかあります.これらは Wonx の性質上,仕方の無いことです.
ならないことがいくつかあります.これらは WonX の性質上,仕方の無いことです.
以下のことは,意識することと,きれいなプログラムを書くことで,
かなり回避できると思います.(ビットマップ操作などでshort int にすべき
ところでは,省略せずにちゃんと short int と明示するとか)
まあWonx の目的は論理的なバグを早い段階で無くすことにあるので,このへんは
まあWonX の目的は論理的なバグを早い段階で無くすことにあるので,このへんは
そういうものだと割り切って使ってください.
Wonx を使う限り,なるべく機種依存を無くすように心がけましょう.
WonX を使う限り,なるべく機種依存を無くすように心がけましょう.
(とくに int のサイズにあまり依存しないようにしましょう)
[コンパイルの問題]
@ -390,7 +390,7 @@ i386
[割り込みの問題]
WonderWitch にはタイマ割り込みがありますがWonx の動作は非常に遅いため,
WonderWitch にはタイマ割り込みがありますがWonX の動作は非常に遅いため,
WonderWitch の時間単位をそのまま UNIX に持ってきたら,割り込みが
かかりっぱなしになってしまいます.よってタイマ割り込みの時間単位は,
WonderWitch よりもかなり大きめにしてあります.
@ -458,9 +458,9 @@ SAMPLE.C
添付の sout2str.pl を通すことにより,シリアル通信への出力のみ抽出して,
端末への出力のイメージで表示させることができます.
[ソース中の WONX 依存部分のくくりかた]
[ソース中の WonX 依存部分のくくりかた]
WonderWitch 用のプログラムを開発していく際にWONX の場合のみ組み込みたくて,
WonderWitch 用のプログラムを開発していく際にWonX の場合のみ組み込みたくて,
WonderSwan 上で実行するときには取り除きたいコードがあったとします.
(例えば,デバッグ情報の出力のために printf() を入れる場合など)
このようなときのためにwonx_include/types.h で
@ -471,8 +471,8 @@ WonderSwan
ソース中に,
#include "Wonx.h"
#include "WonxDisplay.h"
#include "WonX.h"
#include "WonXDisplay.h"
#include "WWDisplay.h"
#include "WWColorMap.h"
#include "WWPalette.h"
@ -482,7 +482,7 @@ WonderSwan
int i;
WWDisplay ww_display;
ww_display = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay());
ww_display = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay());
WWColorMap_PrintData(WWDisplay_GetColorMap(ww_display), stdout);
@ -501,24 +501,24 @@ for (i = 0; i < 128; i++)
プログラム中に,不安な場所があったら,
#ifdef _WONX_
ww_display = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay());
ww_display = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay());
printf("Before setting:\n");
WWSprite_PrintData(WWDisplay_GetSprite(ww_display, 0), stdout);
#endif
#endif /* _WONX_ */
/* ここにスプライトの設定についての不安なコードがある */
#ifdef _WONX_
printf("After setting:\n");
WWSprite_PrintData(WWDisplay_GetSprite(ww_display, 0), stdout);
#endif
#endif /* _WONX_ */
のようにして不安なコードの前後でダンプデータを取ると,デバッグに
役立つでしょう.
■ 作者
Wonx は,坂井弘亮がその大部分を往復3時間の通勤電車の中で Libretto で書いた,
WonX は,坂井弘亮がその大部分を往復3時間の通勤電車の中で Libretto で書いた,
「電車ソフトウエア」ですGPLで配布します
作者については,添付の OMAKE.jpn を参照してください.

View File

@ -170,7 +170,7 @@ int UNIXTimer_Pause(UNIXTimer unix_timer)
int UNIXTimer_Unpause(UNIXTimer unix_timer)
{
if (unix_timer->pause == 0)
Wonx_Error("UNIXTimer_Unpause", "Duplicated unpause.");
WonX_Error("UNIXTimer_Unpause", "Duplicated unpause.");
if (unix_timer->pause == 1) {
if (unix_timer->interrupt_in_pause > 0) {
@ -259,7 +259,7 @@ UNIXTimer UNIXTimer_Create(int auto_preset, int interval, void * parameter,
unix_timer = (UNIXTimer)malloc(sizeof(_UNIXTimer));
if (unix_timer == NULL)
Wonx_Error("UNIXTimer_Create", "Cannot allocate memory.");
WonX_Error("UNIXTimer_Create", "Cannot allocate memory.");
unix_timer->timer_on = 0;
unix_timer->pause = 0;
@ -291,7 +291,7 @@ UNIXTimer UNIXTimer_Create(int auto_preset, int interval, void * parameter,
UNIXTimer UNIXTimer_Destroy(UNIXTimer unix_timer)
{
if (unix_timer == NULL)
Wonx_Error("UNIXTimer_Destroy", "Object is not created.");
WonX_Error("UNIXTimer_Destroy", "Object is not created.");
UNIXTimer_OFF(unix_timer);

View File

@ -19,7 +19,7 @@ typedef struct _UNIXTimer {
*
*
*
* Wonx X X
* WonX X X
*
*
*/

View File

@ -11,7 +11,7 @@
int WWCharacter_GetNumber(WWCharacter c)
{
if (c == NULL) Wonx_Error("WWCharacter_GetNumber()", "WWCharacter is NULL.");
if (c == NULL) WonX_Error("WWCharacter_GetNumber()", "WWCharacter is NULL.");
return (c->number);
}
@ -19,7 +19,7 @@ int WWCharacter_GetNumber(WWCharacter c)
int WWCharacter_SetNumber(WWCharacter c, int n)
{
if ((n < 0) || (n >= 512))
Wonx_Error("WWCharacter_SetNumber()", "Invalid range.");
WonX_Error("WWCharacter_SetNumber()", "Invalid range.");
return (c->number = n);
}
@ -30,7 +30,7 @@ WWCharacter WWCharacter_Create(int number, unsigned char * bitmap)
character = (WWCharacter)malloc(sizeof(_WWCharacter));
if (character == NULL)
Wonx_Error("WWCharacter_Create", "Cannot allocate memory.");
WonX_Error("WWCharacter_Create", "Cannot allocate memory.");
WWCharacter_SetNumber(character, number);
WWCharacter_SetBitmap(character, bitmap);
@ -41,7 +41,7 @@ WWCharacter WWCharacter_Create(int number, unsigned char * bitmap)
WWCharacter WWCharacter_Destroy(WWCharacter character)
{
if (character == NULL)
Wonx_Error("WWCharacter_Destroy()", "WWCharacter is NULL.");
WonX_Error("WWCharacter_Destroy()", "WWCharacter is NULL.");
free(character);
return (NULL);
}
@ -56,7 +56,7 @@ int WWCharacter_SetBitmap(WWCharacter character, unsigned char * bitmap)
int i;
if (character == NULL)
Wonx_Error("WWCharacter_SetBitmap()", "WWCharacter is NULL.");
WonX_Error("WWCharacter_SetBitmap()", "WWCharacter is NULL.");
for (i = 0; i < 16; i++) {
if (bitmap == NULL) {
@ -72,12 +72,12 @@ int WWCharacter_SetBitmap(WWCharacter character, unsigned char * bitmap)
int WWCharacter_GetPixel(WWCharacter character, int x, int y)
{
if (character == NULL)
Wonx_Error("WWCharacter_GetPixel()", "WWCharacter is NULL.");
WonX_Error("WWCharacter_GetPixel()", "WWCharacter is NULL.");
if ((x < 0) || (x > 7))
Wonx_Error("WWCharacter_GetPixel()", "x is invalid value.");
WonX_Error("WWCharacter_GetPixel()", "x is invalid value.");
if ((y < 0) || (y > 7))
Wonx_Error("WWCharacter_GetPixel()", "y is invalid value.");
WonX_Error("WWCharacter_GetPixel()", "y is invalid value.");
/* ビットマップは2ビットでぴとつのピクセルに対応する */
/* 2ビットの値がpalette の色に対応する. */
@ -91,14 +91,14 @@ int WWCharacter_SetPixel(WWCharacter character, int x, int y, int pixel)
{
unsigned char p;
if (character == NULL)
Wonx_Error("WWCharacter_SetPixel()", "WWCharacter is NULL.");
WonX_Error("WWCharacter_SetPixel()", "WWCharacter is NULL.");
if ((x < 0) || (x > 7))
Wonx_Error("WWCharacter_SetPixel()", "x is invalid value.");
WonX_Error("WWCharacter_SetPixel()", "x is invalid value.");
if ((y < 0) || (y > 7))
Wonx_Error("WWCharacter_SetPixel()", "y is invalid value.");
WonX_Error("WWCharacter_SetPixel()", "y is invalid value.");
if ((pixel < 0) || (pixel > 3))
Wonx_Error("WWCharacter_SetPixel()", "Invalid pixel.");
WonX_Error("WWCharacter_SetPixel()", "Invalid pixel.");
p = ((unsigned char)pixel) & 0x03;
p = p << ((x % 4) * 2);

View File

@ -15,7 +15,7 @@ WWColorMap WWColorMap_Create(int * lcd_colors)
color_map = (WWColorMap)malloc(sizeof(_WWColorMap));
if (color_map == NULL)
Wonx_Error("WWColorMap_Create", "Cannot allocate memory");
WonX_Error("WWColorMap_Create", "Cannot allocate memory");
WWColorMap_SetLCDColors(color_map, lcd_colors);

View File

@ -97,7 +97,7 @@ WWDisplay WWDisplay_Create(int lcd_panel_width, int lcd_panel_height,
display = (WWDisplay)malloc(sizeof(_WWDisplay));
if (display == NULL)
Wonx_Error("WWDisplay_Create", "Cannot allocate memory.");
WonX_Error("WWDisplay_Create", "Cannot allocate memory.");
WWDisplay_SetColorMap(display, WWColorMap_Create(NULL));

View File

@ -45,7 +45,7 @@ static WWInterruptVector WWInterruptVector_Create(int number)
vector = (WWInterruptVector)malloc(sizeof(_WWInterruptVector));
if (vector == NULL)
Wonx_Error("WWInterruptVector_Create", "Cannot allocate memory.");
WonX_Error("WWInterruptVector_Create", "Cannot allocate memory.");
WWInterruptVector_SetNumber(vector, number);
WWInterruptVector_SetCallback(vector, NULL);
@ -58,7 +58,7 @@ static WWInterruptVector WWInterruptVector_Create(int number)
static WWInterruptVector WWInterruptVector_Destroy(WWInterruptVector vector)
{
if (vector == NULL)
Wonx_Error("WWInterruptVector_Destroy", "Object is not created.");
WonX_Error("WWInterruptVector_Destroy", "Object is not created.");
free(vector);
return (NULL);
}
@ -71,7 +71,7 @@ static WWInterruptVector WWInterrupt_GetVector(WWInterrupt interrupt,
int number)
{
if ((number < 0) || (number > 7))
Wonx_Error("WWInterrupt_SetVector", "Invalid interrupt number.");
WonX_Error("WWInterrupt_SetVector", "Invalid interrupt number.");
return (interrupt->vector[number]);
}
@ -80,7 +80,7 @@ static WWInterruptVector WWInterrupt_SetVector(WWInterrupt interrupt,
WWInterruptVector vector)
{
if ((number < 0) || (number > 7))
Wonx_Error("WWInterrupt_SetVector", "Invalid interrupt number.");
WonX_Error("WWInterrupt_SetVector", "Invalid interrupt number.");
return (interrupt->vector[number] = vector);
}
@ -313,7 +313,7 @@ WWInterrupt WWInterrupt_Create()
interrupt = (WWInterrupt)malloc(sizeof(_WWInterrupt));
if (interrupt == NULL)
Wonx_Error("WWInterrupt_Create", "Cannot allocate memory.");
WonX_Error("WWInterrupt_Create", "Cannot allocate memory.");
for (i = 0; i < 8; i++)
WWInterrupt_SetVector(interrupt, i, WWInterruptVector_Create(i));
@ -331,7 +331,7 @@ WWInterrupt WWInterrupt_Destroy(WWInterrupt interrupt)
WWInterruptVector vector;
if (interrupt == NULL)
Wonx_Error("WWInterrupt_Destroy", "Object is not created.");
WonX_Error("WWInterrupt_Destroy", "Object is not created.");
for (i = 0; i < 8; i++) {
vector = WWInterrupt_GetVector(interrupt, i);

View File

@ -93,7 +93,7 @@ WWLCDPanel WWLCDPanel_Create(int width, int height)
lcd_panel = (WWLCDPanel)malloc(sizeof(_WWLCDPanel));
if (lcd_panel == NULL)
Wonx_Error("WWLCDPanel_Create", "Cannot allocate memory.");
WonX_Error("WWLCDPanel_Create", "Cannot allocate memory.");
WWLCDPanel_SetWidth( lcd_panel, width);
WWLCDPanel_SetHeight(lcd_panel, height);

View File

@ -22,7 +22,7 @@ WWPalette WWPalette_Create(int number, int * mapped_colors, int transparent)
palette = (WWPalette)malloc(sizeof(_WWPalette));
if (palette == NULL)
Wonx_Error("WWPalette_Create", "Cannot allocate memory");
WonX_Error("WWPalette_Create", "Cannot allocate memory");
WWPalette_SetNumber(palette, number);
WWPalette_SetTransparent(palette, transparent);

View File

@ -41,7 +41,7 @@ static WWScreenCharacter WWScreenCharacter_Create(int horizontal, int vertical,
screen_character = (WWScreenCharacter)malloc(sizeof(_WWScreenCharacter));
if (screen_character == NULL)
Wonx_Error("WWScreenCharacter", "Cannot allocate memory.");
WonX_Error("WWScreenCharacter", "Cannot allocate memory.");
WWScreenCharacter_SetHorizontal(screen_character, horizontal);
WWScreenCharacter_SetVertical(screen_character, vertical);
@ -201,7 +201,7 @@ WWScreen WWScreen_Create(int number,
screen = (WWScreen)malloc(sizeof(_WWScreen));
if (screen == NULL)
Wonx_Error("WWScreen_Create", "Cannot allocate memory.");
WonX_Error("WWScreen_Create", "Cannot allocate memory.");
WWScreen_SetNumber(screen, number);
WWScreen_SetWidth( screen, width);

View File

@ -51,7 +51,7 @@ WWSerialPort WWSerialPort_Create()
ww_serial_port = (WWSerialPort)malloc(sizeof(_WWSerialPort));
if (ww_serial_port == NULL)
Wonx_Error("WWSerialPort_Create", "Cannot allocate memory.");
WonX_Error("WWSerialPort_Create", "Cannot allocate memory.");
WWSerialPort_OFF(ww_serial_port);
WWSerialPort_SetBaudrate38400(ww_serial_port);
@ -68,7 +68,7 @@ WWSerialPort WWSerialPort_Create()
WWSerialPort WWSerialPort_Destroy(WWSerialPort ww_serial_port)
{
if (ww_serial_port == NULL)
Wonx_Error("WWSerialPort_Destroy", "Object is not created.");
WonX_Error("WWSerialPort_Destroy", "Object is not created.");
free(ww_serial_port);

View File

@ -64,7 +64,7 @@ WWSprite WWSprite_Create(int number, int x, int y,
sprite = (WWSprite)malloc(sizeof(_WWSprite));
if (sprite == NULL)
Wonx_Error("WWSprite_Create", "Cannot allocate memory.");
WonX_Error("WWSprite_Create", "Cannot allocate memory.");
WWSprite_SetNumber(sprite, number);
WWSprite_SetHorizontal(sprite, horizontal);

View File

@ -55,7 +55,7 @@ int WWText_SetTextWindow(WWText ww_text, int x, int y,
c = WWText_GetBase(ww_text);
for (ty = 0; ty < WWText_GetHeight(ww_text); ty++) {
for (tx = 0; tx < WWText_GetWidth(ww_text); tx++) {
if (c >= 512) Wonx_Error("WWText_SetTextWindow", "Over character.");
if (c >= 512) WonX_Error("WWText_SetTextWindow", "Over character.");
ww_character = WWDisplay_GetCharacter(ww_display, c);
WWCharacter_SetBitmap(ww_character, NULL);
WWScreen_SetCharacter(WWText_GetScreen(ww_text),
@ -125,7 +125,7 @@ WWText WWText_Create(WWScreen screen,
int i;
ww_text = (WWText)malloc(sizeof(_WWText));
if (ww_text == NULL) Wonx_Error("WWText_Create", "Cannot allocate memory.");
if (ww_text == NULL) WonX_Error("WWText_Create", "Cannot allocate memory.");
WWText_SetScreen(ww_text, screen);
WWText_SetX(ww_text, 0);
@ -145,7 +145,7 @@ WWText WWText_Destroy(WWText ww_text)
{
int i;
if (ww_text == NULL) Wonx_Error("WWText_Destroy", "Object is not created.");
if (ww_text == NULL) WonX_Error("WWText_Destroy", "Object is not created.");
for (i = 0; i < 128; i++) {
if (WWText_GetFont(ww_text, i))

View File

@ -81,7 +81,7 @@ WWTimer WWTimer_Create(int auto_preset, int preset)
ww_timer = (WWTimer)malloc(sizeof(_WWTimer));
if (ww_timer == NULL)
Wonx_Error("WWTimer_Create", "Cannot allocate memory.");
WonX_Error("WWTimer_Create", "Cannot allocate memory.");
WWTimer_OFF(ww_timer);
WWTimer_SetAutoPreset(ww_timer, auto_preset);
@ -98,7 +98,7 @@ WWTimer WWTimer_Create(int auto_preset, int preset)
WWTimer WWTimer_Destroy(WWTimer ww_timer)
{
if (ww_timer == NULL)
Wonx_Error("WWTimer_Destroy", "Object is not created.");
WonX_Error("WWTimer_Destroy", "Object is not created.");
free(ww_timer);

View File

@ -1,4 +1,4 @@
#include "WonxP.h"
#include "WonXP.h"
#include "etc.h"
#include "wonx_include/disp.h"
@ -10,58 +10,58 @@
/* ディスプレイの確保 */
/*****************************************************************************/
static Wonx wonx = NULL;
static WonX wonx = NULL;
int Wonx_IsCreated(void)
int WonX_IsCreated(void)
{
return (wonx != NULL);
}
void Wonx_Create(void)
void WonX_Create(void)
{
WWScreen screen;
WWPalette palette;
wonx = (Wonx)malloc(sizeof(_Wonx));
if (wonx == NULL) Wonx_Error("Wonx_Create", "Cannot allocate memory.");
wonx = (WonX)malloc(sizeof(_WonX));
if (wonx == NULL) WonX_Error("WonX_Create", "Cannot allocate memory.");
wonx->wonx_display =
WonxDisplay_Create(LCD_PIXEL_WIDTH * 2, LCD_PIXEL_HEIGHT * 2,
WonXDisplay_Create(LCD_PIXEL_WIDTH * 2, LCD_PIXEL_HEIGHT * 2,
LCD_PIXEL_WIDTH, LCD_PIXEL_HEIGHT,
SCREEN_CHAR_WIDTH, SCREEN_CHAR_HEIGHT);
screen =
WWDisplay_GetScreen(WonxDisplay_GetWWDisplay(wonx->wonx_display), SCREEN2);
WWDisplay_GetScreen(WonXDisplay_GetWWDisplay(wonx->wonx_display), SCREEN2);
/* デフォルトのテキスト表示用パレットは0 */
palette =
WWDisplay_GetPalette(WonxDisplay_GetWWDisplay(wonx->wonx_display), 0);
WWDisplay_GetPalette(WonXDisplay_GetWWDisplay(wonx->wonx_display), 0);
wonx->wonx_text =
WonxText_Create(screen, 0, 0, TEXT_SCREEN_WIDTH, TEXT_SCREEN_HEIGHT,
WonXText_Create(screen, 0, 0, TEXT_SCREEN_WIDTH, TEXT_SCREEN_HEIGHT,
palette);
wonx->wonx_system = WonxSystem_Create();
wonx->wonx_system = WonXSystem_Create();
wonx->wonx_serial_port = WonxSerialPort_Create();
wonx->wonx_serial_port = WonXSerialPort_Create();
return;
}
WonxDisplay Wonx_GetWonxDisplay(void)
WonXDisplay WonX_GetWonXDisplay(void)
{
return (wonx->wonx_display);
}
WonxText Wonx_GetWonxText(void)
WonXText WonX_GetWonXText(void)
{
return (wonx->wonx_text);
}
WonxSystem Wonx_GetWonxSystem(void)
WonXSystem WonX_GetWonXSystem(void)
{
return (wonx->wonx_system);
}
WonxSerialPort Wonx_GetWonxSerialPort(void)
WonXSerialPort WonX_GetWonXSerialPort(void)
{
return (wonx->wonx_serial_port);
}

View File

@ -1,20 +1,20 @@
#ifndef _wonx_h_INCLUDED_
#define _wonx_h_INCLUDED_
#include "WonxDisplay.h"
#include "WonxText.h"
#include "WonxSystem.h"
#include "WonxSerialPort.h"
#include "WonXDisplay.h"
#include "WonXText.h"
#include "WonXSystem.h"
#include "WonXSerialPort.h"
/*****************************************************************************/
/* ディスプレイの確保 */
/*****************************************************************************/
int Wonx_IsCreated(void);
void Wonx_Create(void);
WonxDisplay Wonx_GetWonxDisplay(void);
WonxText Wonx_GetWonxText(void);
WonxSystem Wonx_GetWonxSystem(void);
WonxSerialPort Wonx_GetWonxSerialPort(void);
int WonX_IsCreated(void);
void WonX_Create(void);
WonXDisplay WonX_GetWonXDisplay(void);
WonXText WonX_GetWonXText(void);
WonXSystem WonX_GetWonXSystem(void);
WonXSerialPort WonX_GetWonXSerialPort(void);
#endif

View File

@ -2,57 +2,57 @@
/* ここから */
/*****************************************************************************/
#include "WonxDisplayP.h"
#include "WonXDisplayP.h"
#include "etc.h"
/*****************************************************************************/
/* メンバ関数の定義 */
/*****************************************************************************/
XDisplay WonxDisplay_GetXDisplay(WonxDisplay wonx_display)
XDisplay WonXDisplay_GetXDisplay(WonXDisplay wonx_display)
{ return (wonx_display->x_display); }
WWDisplay WonxDisplay_GetWWDisplay(WonxDisplay wonx_display)
WWDisplay WonXDisplay_GetWWDisplay(WonXDisplay wonx_display)
{ return (wonx_display->ww_display); }
static XDisplay WonxDisplay_SetXDisplay(WonxDisplay wonx_d, XDisplay xd)
static XDisplay WonXDisplay_SetXDisplay(WonXDisplay wonx_d, XDisplay xd)
{ return (wonx_d->x_display = xd); }
static WWDisplay WonxDisplay_SetWWDisplay(WonxDisplay wonx_d, WWDisplay wd)
static WWDisplay WonXDisplay_SetWWDisplay(WonXDisplay wonx_d, WWDisplay wd)
{ return (wonx_d->ww_display = wd); }
WonxDisplay WonxDisplay_Create(int x_width, int x_height,
WonXDisplay WonXDisplay_Create(int x_width, int x_height,
int ww_lcd_panel_width, int ww_lcd_panel_height,
int ww_screen_width, int ww_screen_height)
{
WonxDisplay wonx_display;
WonXDisplay wonx_display;
WWDisplay ww_display;
XDisplay x_display;
wonx_display = (WonxDisplay)malloc(sizeof(_WonxDisplay));
wonx_display = (WonXDisplay)malloc(sizeof(_WonXDisplay));
if (wonx_display == NULL)
Wonx_Error("WonxDisplay_Create", "Cannot allocate memory.");
WonX_Error("WonXDisplay_Create", "Cannot allocate memory.");
ww_display = WWDisplay_Create(ww_lcd_panel_width, ww_lcd_panel_height,
ww_screen_width, ww_screen_height);
if (ww_display == NULL)
Wonx_Error("WonxDisplay_Create", "Cannot create WonderWitch display.");
WonxDisplay_SetWWDisplay(wonx_display, ww_display);
WonX_Error("WonXDisplay_Create", "Cannot create WonderWitch display.");
WonXDisplay_SetWWDisplay(wonx_display, ww_display);
x_display = XDisplay_Create(x_width, x_height);
if (x_display == NULL)
Wonx_Error("WonxDisplay_Create", "Cannot create X display.");
WonxDisplay_SetXDisplay(wonx_display, x_display);
WonX_Error("WonXDisplay_Create", "Cannot create X display.");
WonXDisplay_SetXDisplay(wonx_display, x_display);
return (wonx_display);
}
int WonxDisplay_Sync(WonxDisplay wonx_display)
int WonXDisplay_Sync(WonXDisplay wonx_display)
{
int i;
XDisplay x_display;
WWDisplay ww_display;
x_display = WonxDisplay_GetXDisplay(wonx_display);
ww_display = WonxDisplay_GetWWDisplay(wonx_display);
x_display = WonXDisplay_GetXDisplay(wonx_display);
ww_display = WonXDisplay_GetWWDisplay(wonx_display);
if (XDisplay_GetColorMapPrint(x_display)) {
WWColorMap_PrintData(WWDisplay_GetColorMap(ww_display), stdout);
@ -85,14 +85,14 @@ int WonxDisplay_Sync(WonxDisplay wonx_display)
return (0);
}
int WonxDisplay_Flush(WonxDisplay wonx_display)
int WonXDisplay_Flush(WonXDisplay wonx_display)
{
XDisplay x_display;
WWDisplay ww_display;
WWLCDPanel ww_lcd_panel;
x_display = WonxDisplay_GetXDisplay(wonx_display);
ww_display = WonxDisplay_GetWWDisplay(wonx_display);
x_display = WonXDisplay_GetXDisplay(wonx_display);
ww_display = WonXDisplay_GetWWDisplay(wonx_display);
if (XDisplay_GetLCDDraw(x_display)) {
WWDisplay_DrawLCDPanel(ww_display);
@ -100,7 +100,7 @@ int WonxDisplay_Flush(WonxDisplay wonx_display)
XDisplay_DrawLCDWindow(x_display, ww_lcd_panel);
}
WonxDisplay_Sync(wonx_display);
WonXDisplay_Sync(wonx_display);
return (0);
}

View File

@ -1,5 +1,5 @@
#ifndef _WonxDisplay_h_INCLUDED_
#define _WonxDisplay_h_INCLUDED_
#ifndef _WonXDisplay_h_INCLUDED_
#define _WonXDisplay_h_INCLUDED_
/*****************************************************************************/
/* ここから */
@ -12,15 +12,15 @@
/* クラスの定義 */
/*****************************************************************************/
typedef struct _WonxDisplay * WonxDisplay;
typedef struct _WonXDisplay * WonXDisplay;
XDisplay WonxDisplay_GetXDisplay(WonxDisplay wonx_display);
WWDisplay WonxDisplay_GetWWDisplay(WonxDisplay wonx_display);
WonxDisplay WonxDisplay_Create(int x_width, int x_height,
XDisplay WonXDisplay_GetXDisplay(WonXDisplay wonx_display);
WWDisplay WonXDisplay_GetWWDisplay(WonXDisplay wonx_display);
WonXDisplay WonXDisplay_Create(int x_width, int x_height,
int ww_lcd_panel_width, int ww_lcd_panel_height,
int ww_screen_width, int ww_screen_height);
int WonxDisplay_Sync(WonxDisplay wonx_display);
int WonxDisplay_Flush(WonxDisplay wonx_display);
int WonXDisplay_Sync(WonXDisplay wonx_display);
int WonXDisplay_Flush(WonXDisplay wonx_display);
/*****************************************************************************/
/* ここまで */

View File

@ -1,20 +1,20 @@
#ifndef _WonxDisplayP_h_INCLUDED_
#define _WonxDisplayP_h_INCLUDED_
#ifndef _WonXDisplayP_h_INCLUDED_
#define _WonXDisplayP_h_INCLUDED_
/*****************************************************************************/
/* ここから */
/*****************************************************************************/
#include "WonxDisplay.h"
#include "WonXDisplay.h"
/*****************************************************************************/
/* クラスの定義 */
/*****************************************************************************/
typedef struct _WonxDisplay {
typedef struct _WonXDisplay {
XDisplay x_display;
WWDisplay ww_display;
} _WonxDisplay;
} _WonXDisplay;
/*****************************************************************************/
/* ここまで */

View File

@ -1,24 +1,24 @@
#ifndef _WonxP_h_INCLUDED_
#define _WonxP_h_INCLUDED_
#ifndef _WonXP_h_INCLUDED_
#define _WonXP_h_INCLUDED_
/*****************************************************************************/
/* ここから */
/*****************************************************************************/
#include "Wonx.h"
#include "WonX.h"
/*****************************************************************************/
/* クラスの定義 */
/*****************************************************************************/
typedef struct _Wonx {
WonxDisplay wonx_display;
WonxText wonx_text;
WonxSystem wonx_system;
WonxSerialPort wonx_serial_port;
} _Wonx;
typedef struct _WonX {
WonXDisplay wonx_display;
WonXText wonx_text;
WonXSystem wonx_system;
WonXSerialPort wonx_serial_port;
} _WonX;
typedef struct _Wonx * Wonx;
typedef struct _WonX * WonX;
/*****************************************************************************/
/* ここまで */

View File

@ -2,47 +2,47 @@
/* ここから */
/*****************************************************************************/
#include "WonxSerialPortP.h"
#include "WonXSerialPortP.h"
#include "etc.h"
/*****************************************************************************/
/* メンバ関数の定義 */
/*****************************************************************************/
WWSerialPort WonxSerialPort_GetWWSerialPort(WonxSerialPort wonx_serial_port)
WWSerialPort WonXSerialPort_GetWWSerialPort(WonXSerialPort wonx_serial_port)
{ return (wonx_serial_port->ww_serial_port); }
WWSerialPort WonxSerialPort_SetWWSerialPort(WonxSerialPort wonx_serial_port,
WWSerialPort WonXSerialPort_SetWWSerialPort(WonXSerialPort wonx_serial_port,
WWSerialPort ww_serial_port)
{ return (wonx_serial_port->ww_serial_port = ww_serial_port); }
WonxSerialPort WonxSerialPort_Create()
WonXSerialPort WonXSerialPort_Create()
{
WonxSerialPort wonx_serial_port;
WonXSerialPort wonx_serial_port;
WWSerialPort ww_serial_port;
wonx_serial_port = (WonxSerialPort)malloc(sizeof(_WonxSerialPort));
wonx_serial_port = (WonXSerialPort)malloc(sizeof(_WonXSerialPort));
if (wonx_serial_port == NULL)
Wonx_Error("WonxSerialPort_Create", "Cannot allocate memory.");
WonX_Error("WonXSerialPort_Create", "Cannot allocate memory.");
ww_serial_port = WWSerialPort_Create();
if (ww_serial_port == NULL)
Wonx_Error("WonxSerialPort_Create",
WonX_Error("WonXSerialPort_Create",
"Cannot create WonderWitch serial port.");
WonxSerialPort_SetWWSerialPort(wonx_serial_port, ww_serial_port);
WonXSerialPort_SetWWSerialPort(wonx_serial_port, ww_serial_port);
return (wonx_serial_port);
}
WonxSerialPort WonxSerialPort_Destroy(WonxSerialPort wonx_serial_port)
WonXSerialPort WonXSerialPort_Destroy(WonXSerialPort wonx_serial_port)
{
WWSerialPort ww_serial_port;
if (wonx_serial_port == NULL)
Wonx_Error("WonxSerialPort_Destroy", "Object is not created.");
WonX_Error("WonXSerialPort_Destroy", "Object is not created.");
ww_serial_port = WonxSerialPort_GetWWSerialPort(wonx_serial_port);
ww_serial_port = WonXSerialPort_GetWWSerialPort(wonx_serial_port);
if (ww_serial_port)
WonxSerialPort_SetWWSerialPort(wonx_serial_port,
WonXSerialPort_SetWWSerialPort(wonx_serial_port,
WWSerialPort_Destroy(ww_serial_port));
free(wonx_serial_port);

View File

@ -1,5 +1,5 @@
#ifndef _WonxSerialPort_h_INCLUDED_
#define _WonxSerialPort_h_INCLUDED_
#ifndef _WonXSerialPort_h_INCLUDED_
#define _WonXSerialPort_h_INCLUDED_
/*****************************************************************************/
/* ここから */
@ -11,18 +11,18 @@
/* クラスの定義 */
/*****************************************************************************/
typedef struct _WonxSerialPort * WonxSerialPort;
typedef struct _WonXSerialPort * WonXSerialPort;
/*****************************************************************************/
/* メンバ関数の定義 */
/*****************************************************************************/
WWSerialPort WonxSerialPort_GetWWSerialPort(WonxSerialPort wonx_serial_port);
WWSerialPort WonxSerialPort_SetWWSerialPort(WonxSerialPort wonx_serial_port,
WWSerialPort WonXSerialPort_GetWWSerialPort(WonXSerialPort wonx_serial_port);
WWSerialPort WonXSerialPort_SetWWSerialPort(WonXSerialPort wonx_serial_port,
WWSerialPort ww_serial_port);
WonxSerialPort WonxSerialPort_Create();
WonxSerialPort WonxSerialPort_Destroy(WonxSerialPort wonx_serial_port);
WonXSerialPort WonXSerialPort_Create();
WonXSerialPort WonXSerialPort_Destroy(WonXSerialPort wonx_serial_port);
/*****************************************************************************/
/* ここまで */

View File

@ -1,19 +1,19 @@
#ifndef _WonxSerialPortP_h_INCLUDED_
#define _WonxSerialPortP_h_INCLUDED_
#ifndef _WonXSerialPortP_h_INCLUDED_
#define _WonXSerialPortP_h_INCLUDED_
/*****************************************************************************/
/* ここから */
/*****************************************************************************/
#include "WonxSerialPort.h"
#include "WonXSerialPort.h"
/*****************************************************************************/
/* クラスの定義 */
/*****************************************************************************/
typedef struct _WonxSerialPort {
typedef struct _WonXSerialPort {
WWSerialPort ww_serial_port;
} _WonxSerialPort;
} _WonXSerialPort;
/*****************************************************************************/
/* ここまで */

171
WonXSystem.c Normal file
View File

@ -0,0 +1,171 @@
/*****************************************************************************/
/* ここから */
/*****************************************************************************/
#include "wonx_configure.h"
#include "WonXSystemP.h"
#include "etc.h"
/*****************************************************************************/
/* メンバ関数の定義 */
/*****************************************************************************/
WWInterrupt WonXSystem_GetWWInterrupt(WonXSystem wonx_system)
{ return (wonx_system->ww_interrupt); }
WWInterrupt WonXSystem_SetWWInterrupt(WonXSystem wonx_system,
WWInterrupt ww_interrupt)
{ return (wonx_system->ww_interrupt = ww_interrupt); }
WWTimer WonXSystem_GetWWTimer(WonXSystem wonx_system, int type)
{ return (wonx_system->ww_timer[type]); }
WWTimer WonXSystem_SetWWTimer(WonXSystem wonx_system, int type, WWTimer t)
{ return (wonx_system->ww_timer[type] = t); }
WWTimer WonXSystem_GetWWVBlankTimer(WonXSystem wonx_system)
{ return (WonXSystem_GetWWTimer(wonx_system, 0)); }
WWTimer WonXSystem_SetWWVBlankTimer(WonXSystem wonx_system, WWTimer t)
{ return (WonXSystem_SetWWTimer(wonx_system, 0, t)); }
WWTimer WonXSystem_GetWWVBlankCountUpTimer(WonXSystem wonx_system)
{ return (WonXSystem_GetWWTimer(wonx_system, 1)); }
WWTimer WonXSystem_SetWWVBlankCountUpTimer(WonXSystem wonx_system, WWTimer t)
{ return (WonXSystem_SetWWTimer(wonx_system, 1, t)); }
WWTimer WonXSystem_GetWWHBlankCountUpTimer(WonXSystem wonx_system)
{ return (WonXSystem_GetWWTimer(wonx_system, 2)); }
WWTimer WonXSystem_SetWWHBlankCountUpTimer(WonXSystem wonx_system, WWTimer t)
{ return (WonXSystem_SetWWTimer(wonx_system, 2, t)); }
UNIXTimer WonXSystem_GetUNIXTimer(WonXSystem wonx_system)
{ return (wonx_system->unix_timer); }
UNIXTimer WonXSystem_SetUNIXTimer(WonXSystem wonx_system,
UNIXTimer unix_timer)
{ return (wonx_system->unix_timer = unix_timer); }
static int WonXTimer_Callback(WonXSystem wonx_system)
{
WWTimer ww_timer;
WWInterrupt ww_interrupt;
ww_interrupt = WonXSystem_GetWWInterrupt(wonx_system);
ww_timer = WonXSystem_GetWWVBlankTimer(wonx_system);
if (WWTimer_IsON(ww_timer)) {
if (WWTimer_Count(ww_timer))
WWInterrupt_ExecuteVBlankCallback(ww_interrupt);
}
ww_timer = WonXSystem_GetWWVBlankCountUpTimer(wonx_system);
if (WWTimer_IsON(ww_timer)) {
if (WWTimer_Count(ww_timer))
WWInterrupt_ExecuteTimerCountUpCallback(ww_interrupt);
}
ww_timer = WonXSystem_GetWWHBlankCountUpTimer(wonx_system);
if (WWTimer_IsON(ww_timer)) {
if (WWTimer_Count(ww_timer))
WWInterrupt_ExecuteHBlankCountUpCallback(ww_interrupt);
}
return (0);
}
WonXSystem WonXSystem_Create()
{
WonXSystem wonx_system;
WWInterrupt ww_interrupt;
WWTimer ww_timer;
UNIXTimer unix_timer;
wonx_system = (WonXSystem)malloc(sizeof(_WonXSystem));
if (wonx_system == NULL)
WonX_Error("WonXSystem_Create", "Cannot allocate memory.");
ww_interrupt = WWInterrupt_Create();
if (ww_interrupt == NULL)
WonX_Error("WonXSystem_Create", "Cannot create WonderWitch interrupt.");
WonXSystem_SetWWInterrupt(wonx_system, ww_interrupt);
ww_timer = WWTimer_Create(1, WONX_VBLANK_INTERVAL);
if (ww_timer == NULL)
WonX_Error("WonXSystem_Create", "Cannot create WonderWitch VBlank timer.");
WonXSystem_SetWWVBlankTimer(wonx_system, ww_timer);
ww_timer = WWTimer_Create(0, WONX_VBLANK_INTERVAL);
if (ww_timer == NULL)
WonX_Error("WonXSystem_Create",
"Cannot create WonderWitch VBlank count up timer.");
WonXSystem_SetWWVBlankCountUpTimer(wonx_system, ww_timer);
ww_timer = WWTimer_Create(0, WONX_HBLANK_INTERVAL);
if (ww_timer == NULL)
WonX_Error("WonXSystem_Create",
"Cannot create WonderWitch HBlank count up timer.");
WonXSystem_SetWWHBlankCountUpTimer(wonx_system, ww_timer);
WWTimer_Reset(WonXSystem_GetWWVBlankTimer( wonx_system));
WWTimer_Reset(WonXSystem_GetWWVBlankCountUpTimer(wonx_system));
WWTimer_Reset(WonXSystem_GetWWHBlankCountUpTimer(wonx_system));
WWTimer_ON( WonXSystem_GetWWVBlankTimer( wonx_system));
WWTimer_OFF(WonXSystem_GetWWVBlankCountUpTimer(wonx_system));
WWTimer_OFF(WonXSystem_GetWWHBlankCountUpTimer(wonx_system));
unix_timer = UNIXTimer_Create(1, WONX_TIMER_INTERVAL, wonx_system,
(UNIXTimerCallBack)WonXTimer_Callback);
if (unix_timer == NULL)
WonX_Error("WonXSystem_Create", "Cannot create UNIX timer.");
WonXSystem_SetUNIXTimer(wonx_system, unix_timer);
UNIXTimer_ON(unix_timer);
return (wonx_system);
}
WonXSystem WonXSystem_Destroy(WonXSystem wonx_system)
{
WWInterrupt wi;
WWTimer wt;
UNIXTimer unix_timer;
if (wonx_system == NULL)
WonX_Error("WonXSystem_Destroy", "Object is not created.");
unix_timer = WonXSystem_GetUNIXTimer(wonx_system);
if (unix_timer)
UNIXTimer_OFF(unix_timer);
wt = WonXSystem_GetWWVBlankTimer(wonx_system);
if (wt) WWTimer_OFF(wt);
wt = WonXSystem_GetWWVBlankCountUpTimer(wonx_system);
if (wt) WWTimer_OFF(wt);
wt = WonXSystem_GetWWHBlankCountUpTimer(wonx_system);
if (wt) WWTimer_OFF(wt);
if (unix_timer)
WonXSystem_SetUNIXTimer(wonx_system, UNIXTimer_Destroy(unix_timer));
wt = WonXSystem_GetWWVBlankTimer(wonx_system);
if (wt) WonXSystem_SetWWVBlankTimer(wonx_system, WWTimer_Destroy(wt));
wt = WonXSystem_GetWWVBlankCountUpTimer(wonx_system);
if (wt) WonXSystem_SetWWVBlankCountUpTimer(wonx_system, WWTimer_Destroy(wt));
wt = WonXSystem_GetWWHBlankCountUpTimer(wonx_system);
if (wt) WonXSystem_SetWWHBlankCountUpTimer(wonx_system, WWTimer_Destroy(wt));
wi = WonXSystem_GetWWInterrupt(wonx_system);
if (wi) WonXSystem_SetWWInterrupt(wonx_system, WWInterrupt_Destroy(wi));
free(wonx_system);
return (NULL);
}
/*****************************************************************************/
/* ここまで */
/*****************************************************************************/
/*****************************************************************************/
/* End of File. */
/*****************************************************************************/

View File

@ -1,5 +1,5 @@
#ifndef _WonxSystem_h_INCLUDED_
#define _WonxSystem_h_INCLUDED_
#ifndef _WonXSystem_h_INCLUDED_
#define _WonXSystem_h_INCLUDED_
/*****************************************************************************/
/* ここから */
@ -13,34 +13,34 @@
/* クラスの定義 */
/*****************************************************************************/
typedef struct _WonxSystem * WonxSystem;
typedef struct _WonXSystem * WonXSystem;
/*****************************************************************************/
/* メンバ関数の定義 */
/*****************************************************************************/
WWInterrupt WonxSystem_GetWWInterrupt(WonxSystem wonx_system);
WWInterrupt WonxSystem_SetWWInterrupt(WonxSystem wonx_system,
WWInterrupt WonXSystem_GetWWInterrupt(WonXSystem wonx_system);
WWInterrupt WonXSystem_SetWWInterrupt(WonXSystem wonx_system,
WWInterrupt ww_interrupt);
WWTimer WonxSystem_GetWWTimer(WonxSystem wonx_system, int type);
WWTimer WonxSystem_SetWWTimer(WonxSystem wonx_system, int type, WWTimer t);
WWTimer WonXSystem_GetWWTimer(WonXSystem wonx_system, int type);
WWTimer WonXSystem_SetWWTimer(WonXSystem wonx_system, int type, WWTimer t);
WWTimer WonxSystem_GetWWVBlankTimer(WonxSystem wonx_system);
WWTimer WonxSystem_SetWWVBlankTimer(WonxSystem wonx_system, WWTimer t);
WWTimer WonXSystem_GetWWVBlankTimer(WonXSystem wonx_system);
WWTimer WonXSystem_SetWWVBlankTimer(WonXSystem wonx_system, WWTimer t);
WWTimer WonxSystem_GetWWVBlankCountUpTimer(WonxSystem wonx_system);
WWTimer WonxSystem_SetWWVBlankCountUpTimer(WonxSystem wonx_system, WWTimer t);
WWTimer WonXSystem_GetWWVBlankCountUpTimer(WonXSystem wonx_system);
WWTimer WonXSystem_SetWWVBlankCountUpTimer(WonXSystem wonx_system, WWTimer t);
WWTimer WonxSystem_GetWWHBlankCountUpTimer(WonxSystem wonx_system);
WWTimer WonxSystem_SetWWHBlankCountUpTimer(WonxSystem wonx_system, WWTimer t);
WWTimer WonXSystem_GetWWHBlankCountUpTimer(WonXSystem wonx_system);
WWTimer WonXSystem_SetWWHBlankCountUpTimer(WonXSystem wonx_system, WWTimer t);
UNIXTimer WonxSystem_GetUNIXTimer(WonxSystem wonx_system);
UNIXTimer WonxSystem_SetUNIXTimer(WonxSystem wonx_system,
UNIXTimer WonXSystem_GetUNIXTimer(WonXSystem wonx_system);
UNIXTimer WonXSystem_SetUNIXTimer(WonXSystem wonx_system,
UNIXTimer unix_timer);
WonxSystem WonxSystem_Create();
WonxSystem WonxSystem_Destroy(WonxSystem wonx_system);
WonXSystem WonXSystem_Create();
WonXSystem WonXSystem_Destroy(WonXSystem wonx_system);
/*****************************************************************************/
/* ここまで */

View File

@ -1,17 +1,17 @@
#ifndef _WonxSystemP_h_INCLUDED_
#define _WonxSystemP_h_INCLUDED_
#ifndef _WonXSystemP_h_INCLUDED_
#define _WonXSystemP_h_INCLUDED_
/*****************************************************************************/
/* ここから */
/*****************************************************************************/
#include "WonxSystem.h"
#include "WonXSystem.h"
/*****************************************************************************/
/* クラスの定義 */
/*****************************************************************************/
typedef struct _WonxSystem {
typedef struct _WonXSystem {
WWInterrupt ww_interrupt;
@ -24,7 +24,7 @@ typedef struct _WonxSystem {
UNIXTimer unix_timer;
} _WonxSystem;
} _WonXSystem;
/*****************************************************************************/
/* ここまで */

View File

@ -2,44 +2,44 @@
/* ここから */
/*****************************************************************************/
#include "WonxTextP.h"
#include "WonXTextP.h"
#include "etc.h"
/*****************************************************************************/
/* メンバ関数の定義 */
/*****************************************************************************/
WWText WonxText_GetWWText(WonxText wonx_text)
WWText WonXText_GetWWText(WonXText wonx_text)
{ return (wonx_text->ww_text); }
WWText WonxText_SetWWText(WonxText wonx_text, WWText ww_text)
WWText WonXText_SetWWText(WonXText wonx_text, WWText ww_text)
{ return (wonx_text->ww_text = ww_text); }
WonxText WonxText_Create(WWScreen screen, int x, int y, int width, int height,
WonXText WonXText_Create(WWScreen screen, int x, int y, int width, int height,
WWPalette palette)
{
WonxText wonx_text;
WonXText wonx_text;
WWText ww_text;
wonx_text = (WonxText)malloc(sizeof(_WonxText));
wonx_text = (WonXText)malloc(sizeof(_WonXText));
if (wonx_text == NULL)
Wonx_Error("WonxText_Create", "Cannot allocate memory.");
WonX_Error("WonXText_Create", "Cannot allocate memory.");
ww_text = WWText_Create(screen, x, y, width, height, palette);
if (ww_text == NULL)
Wonx_Error("WonxText_Create", "Cannot create WonderWitch text.");
WonxText_SetWWText(wonx_text, ww_text);
WonX_Error("WonXText_Create", "Cannot create WonderWitch text.");
WonXText_SetWWText(wonx_text, ww_text);
return (wonx_text);
}
WonxText WonxText_Destroy(WonxText wonx_text)
WonXText WonXText_Destroy(WonXText wonx_text)
{
if (wonx_text == NULL)
Wonx_Error("WonxText_Destroy", "Object is not created.");
WonX_Error("WonXText_Destroy", "Object is not created.");
if (WonxText_GetWWText(wonx_text))
WonxText_SetWWText(wonx_text,
WWText_Destroy(WonxText_GetWWText(wonx_text)));
if (WonXText_GetWWText(wonx_text))
WonXText_SetWWText(wonx_text,
WWText_Destroy(WonXText_GetWWText(wonx_text)));
free(wonx_text);

View File

@ -1,5 +1,5 @@
#ifndef _WonxText_h_INCLUDED_
#define _WonxText_h_INCLUDED_
#ifndef _WonXText_h_INCLUDED_
#define _WonXText_h_INCLUDED_
/*****************************************************************************/
/* ここから */
@ -13,13 +13,13 @@
/* クラスの定義 */
/*****************************************************************************/
typedef struct _WonxText * WonxText;
typedef struct _WonXText * WonXText;
WWText WonxText_GetWWText(WonxText wonx_text);
WWText WonxText_SetWWText(WonxText wonx_text, WWText ww_text);
WonxText WonxText_Create(WWScreen screen, int x, int y, int width, int height,
WWText WonXText_GetWWText(WonXText wonx_text);
WWText WonXText_SetWWText(WonXText wonx_text, WWText ww_text);
WonXText WonXText_Create(WWScreen screen, int x, int y, int width, int height,
WWPalette palette);
WonxText WonxText_Destroy(WonxText wonx_text);
WonXText WonXText_Destroy(WonXText wonx_text);
/*****************************************************************************/
/* ここまで */

View File

@ -1,19 +1,19 @@
#ifndef _WonxTextP_h_INCLUDED_
#define _WonxTextP_h_INCLUDED_
#ifndef _WonXTextP_h_INCLUDED_
#define _WonXTextP_h_INCLUDED_
/*****************************************************************************/
/* ここから */
/*****************************************************************************/
#include "WonxText.h"
#include "WonXText.h"
/*****************************************************************************/
/* クラスの定義 */
/*****************************************************************************/
typedef struct _WonxText {
typedef struct _WonXText {
WWText ww_text;
} _WonxText;
} _WonXText;
/*****************************************************************************/
/* ここまで */

17
Wonx2WonX.pl Normal file
View File

@ -0,0 +1,17 @@
#!/usr/bin/perl
while ($filename = shift(@ARGV)) {
open(RFILE, "< $filename");
open(WFILE, "> $filename.tmp");
while (<RFILE>) {
if (/Wonx/) {
print $_;
s/Wonx/WonX/g;
print $_;
}
print WFILE $_;
}
close(RFILE);
close(WFILE);
system("mv $filename.tmp $filename");
}

View File

@ -1,171 +0,0 @@
/*****************************************************************************/
/* ここから */
/*****************************************************************************/
#include "wonx_configure.h"
#include "WonxSystemP.h"
#include "etc.h"
/*****************************************************************************/
/* メンバ関数の定義 */
/*****************************************************************************/
WWInterrupt WonxSystem_GetWWInterrupt(WonxSystem wonx_system)
{ return (wonx_system->ww_interrupt); }
WWInterrupt WonxSystem_SetWWInterrupt(WonxSystem wonx_system,
WWInterrupt ww_interrupt)
{ return (wonx_system->ww_interrupt = ww_interrupt); }
WWTimer WonxSystem_GetWWTimer(WonxSystem wonx_system, int type)
{ return (wonx_system->ww_timer[type]); }
WWTimer WonxSystem_SetWWTimer(WonxSystem wonx_system, int type, WWTimer t)
{ return (wonx_system->ww_timer[type] = t); }
WWTimer WonxSystem_GetWWVBlankTimer(WonxSystem wonx_system)
{ return (WonxSystem_GetWWTimer(wonx_system, 0)); }
WWTimer WonxSystem_SetWWVBlankTimer(WonxSystem wonx_system, WWTimer t)
{ return (WonxSystem_SetWWTimer(wonx_system, 0, t)); }
WWTimer WonxSystem_GetWWVBlankCountUpTimer(WonxSystem wonx_system)
{ return (WonxSystem_GetWWTimer(wonx_system, 1)); }
WWTimer WonxSystem_SetWWVBlankCountUpTimer(WonxSystem wonx_system, WWTimer t)
{ return (WonxSystem_SetWWTimer(wonx_system, 1, t)); }
WWTimer WonxSystem_GetWWHBlankCountUpTimer(WonxSystem wonx_system)
{ return (WonxSystem_GetWWTimer(wonx_system, 2)); }
WWTimer WonxSystem_SetWWHBlankCountUpTimer(WonxSystem wonx_system, WWTimer t)
{ return (WonxSystem_SetWWTimer(wonx_system, 2, t)); }
UNIXTimer WonxSystem_GetUNIXTimer(WonxSystem wonx_system)
{ return (wonx_system->unix_timer); }
UNIXTimer WonxSystem_SetUNIXTimer(WonxSystem wonx_system,
UNIXTimer unix_timer)
{ return (wonx_system->unix_timer = unix_timer); }
static int WonxTimer_Callback(WonxSystem wonx_system)
{
WWTimer ww_timer;
WWInterrupt ww_interrupt;
ww_interrupt = WonxSystem_GetWWInterrupt(wonx_system);
ww_timer = WonxSystem_GetWWVBlankTimer(wonx_system);
if (WWTimer_IsON(ww_timer)) {
if (WWTimer_Count(ww_timer))
WWInterrupt_ExecuteVBlankCallback(ww_interrupt);
}
ww_timer = WonxSystem_GetWWVBlankCountUpTimer(wonx_system);
if (WWTimer_IsON(ww_timer)) {
if (WWTimer_Count(ww_timer))
WWInterrupt_ExecuteTimerCountUpCallback(ww_interrupt);
}
ww_timer = WonxSystem_GetWWHBlankCountUpTimer(wonx_system);
if (WWTimer_IsON(ww_timer)) {
if (WWTimer_Count(ww_timer))
WWInterrupt_ExecuteHBlankCountUpCallback(ww_interrupt);
}
return (0);
}
WonxSystem WonxSystem_Create()
{
WonxSystem wonx_system;
WWInterrupt ww_interrupt;
WWTimer ww_timer;
UNIXTimer unix_timer;
wonx_system = (WonxSystem)malloc(sizeof(_WonxSystem));
if (wonx_system == NULL)
Wonx_Error("WonxSystem_Create", "Cannot allocate memory.");
ww_interrupt = WWInterrupt_Create();
if (ww_interrupt == NULL)
Wonx_Error("WonxSystem_Create", "Cannot create WonderWitch interrupt.");
WonxSystem_SetWWInterrupt(wonx_system, ww_interrupt);
ww_timer = WWTimer_Create(1, WONX_VBLANK_INTERVAL);
if (ww_timer == NULL)
Wonx_Error("WonxSystem_Create", "Cannot create WonderWitch VBlank timer.");
WonxSystem_SetWWVBlankTimer(wonx_system, ww_timer);
ww_timer = WWTimer_Create(0, WONX_VBLANK_INTERVAL);
if (ww_timer == NULL)
Wonx_Error("WonxSystem_Create",
"Cannot create WonderWitch VBlank count up timer.");
WonxSystem_SetWWVBlankCountUpTimer(wonx_system, ww_timer);
ww_timer = WWTimer_Create(0, WONX_HBLANK_INTERVAL);
if (ww_timer == NULL)
Wonx_Error("WonxSystem_Create",
"Cannot create WonderWitch HBlank count up timer.");
WonxSystem_SetWWHBlankCountUpTimer(wonx_system, ww_timer);
WWTimer_Reset(WonxSystem_GetWWVBlankTimer( wonx_system));
WWTimer_Reset(WonxSystem_GetWWVBlankCountUpTimer(wonx_system));
WWTimer_Reset(WonxSystem_GetWWHBlankCountUpTimer(wonx_system));
WWTimer_ON( WonxSystem_GetWWVBlankTimer( wonx_system));
WWTimer_OFF(WonxSystem_GetWWVBlankCountUpTimer(wonx_system));
WWTimer_OFF(WonxSystem_GetWWHBlankCountUpTimer(wonx_system));
unix_timer = UNIXTimer_Create(1, WONX_TIMER_INTERVAL, wonx_system,
(UNIXTimerCallBack)WonxTimer_Callback);
if (unix_timer == NULL)
Wonx_Error("WonxSystem_Create", "Cannot create UNIX timer.");
WonxSystem_SetUNIXTimer(wonx_system, unix_timer);
UNIXTimer_ON(unix_timer);
return (wonx_system);
}
WonxSystem WonxSystem_Destroy(WonxSystem wonx_system)
{
WWInterrupt wi;
WWTimer wt;
UNIXTimer unix_timer;
if (wonx_system == NULL)
Wonx_Error("WonxSystem_Destroy", "Object is not created.");
unix_timer = WonxSystem_GetUNIXTimer(wonx_system);
if (unix_timer)
UNIXTimer_OFF(unix_timer);
wt = WonxSystem_GetWWVBlankTimer(wonx_system);
if (wt) WWTimer_OFF(wt);
wt = WonxSystem_GetWWVBlankCountUpTimer(wonx_system);
if (wt) WWTimer_OFF(wt);
wt = WonxSystem_GetWWHBlankCountUpTimer(wonx_system);
if (wt) WWTimer_OFF(wt);
if (unix_timer)
WonxSystem_SetUNIXTimer(wonx_system, UNIXTimer_Destroy(unix_timer));
wt = WonxSystem_GetWWVBlankTimer(wonx_system);
if (wt) WonxSystem_SetWWVBlankTimer(wonx_system, WWTimer_Destroy(wt));
wt = WonxSystem_GetWWVBlankCountUpTimer(wonx_system);
if (wt) WonxSystem_SetWWVBlankCountUpTimer(wonx_system, WWTimer_Destroy(wt));
wt = WonxSystem_GetWWHBlankCountUpTimer(wonx_system);
if (wt) WonxSystem_SetWWHBlankCountUpTimer(wonx_system, WWTimer_Destroy(wt));
wi = WonxSystem_GetWWInterrupt(wonx_system);
if (wi) WonxSystem_SetWWInterrupt(wonx_system, WWInterrupt_Destroy(wi));
free(wonx_system);
return (NULL);
}
/*****************************************************************************/
/* ここまで */
/*****************************************************************************/
/*****************************************************************************/
/* End of File. */
/*****************************************************************************/

View File

@ -8,7 +8,7 @@
#include <unistd.h>
#include "XDisplayP.h"
#include "Wonx.h"
#include "WonX.h"
#include "etc.h"
/*****************************************************************************/
@ -149,7 +149,7 @@ static void KeyHandler(Widget w, XtPointer p, XEvent * event,
default : press = 0; break;
}
/* Wonx ÁŕşîÍŃ */
/* WonX ÁŕşîÍŃ */
if (event->type == KeyPress) {
switch (key_sym) {
@ -158,7 +158,7 @@ static void KeyHandler(Widget w, XtPointer p, XEvent * event,
case XK_p :
x_display->lcd_draw = !(x_display->lcd_draw);
if (x_display->lcd_draw)
WonxDisplay_Flush(Wonx_GetWonxDisplay());
WonXDisplay_Flush(WonX_GetWonXDisplay());
break;
/* ¥Ç¡¼¥¿¤Î¥À¥ó¥×Áàºî */
@ -227,17 +227,17 @@ XDisplay XDisplay_Create(int width, int height)
x_display = (XDisplay)malloc(sizeof(_XDisplay));
if (x_display == NULL)
Wonx_Error("XDisplay_Create", "Cannot allocate memory.");
WonX_Error("XDisplay_Create", "Cannot allocate memory.");
x_display->width = width;
x_display->height = height;
x_display->toplevel = XtAppInitialize(&(x_display->app_context),
"Wonx",
"WonX",
NULL, 0, &argc, argv, NULL, NULL, 0);
XtVaSetValues(x_display->toplevel, XtNinput, True, NULL);
XtVaSetValues(x_display->toplevel, XtNtitle, "Wonx", NULL);
XtVaSetValues(x_display->toplevel, XtNtitle, "WonX", NULL);
XtVaSetValues(x_display->toplevel, XtNwidth , x_display->width , NULL);
XtVaSetValues(x_display->toplevel, XtNminWidth , x_display->width , NULL);
XtVaSetValues(x_display->toplevel, XtNmaxWidth , x_display->width , NULL);
@ -406,7 +406,7 @@ int XDisplay_DrawLCDWindow(XDisplay x_display, WWLCDPanel ww_lcd_panel)
rectangles[pixel] = (XRectangle *)malloc(sizeof(XRectangle) * num);
}
if (rectangles == NULL)
Wonx_Error("XDisplay_DrawLCDWindow", "Cannot allocate memory.");
WonX_Error("XDisplay_DrawLCDWindow", "Cannot allocate memory.");
ww_lcd_width = WWLCDPanel_GetWidth( ww_lcd_panel);
ww_lcd_height = WWLCDPanel_GetHeight(ww_lcd_panel);

2
bank.c
View File

@ -7,7 +7,7 @@
#include "wonx_include/bank.h"
#include "Wonx.h"
#include "WonX.h"
/*****************************************************************************/
/* 高垂簇眶の年盗 */

162
comm.c
View File

@ -13,7 +13,7 @@
#include "wonx_include/comm.h"
#include "wonx_configure.h"
#include "Wonx.h"
#include "WonX.h"
#include "etc.h"
/*****************************************************************************/
@ -40,28 +40,28 @@ void comm_open(void)
{
WWSerialPort ww_serial_port;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : comm_open() : \n");
fflush(stdout);
ww_serial_port = WonxSerialPort_GetWWSerialPort(Wonx_GetWonxSerialPort());
ww_serial_port = WonXSerialPort_GetWWSerialPort(WonX_GetWonXSerialPort());
if (WWSerialPort_IsON(ww_serial_port))
Wonx_Error("comm_open", "Serial port has already opened.");
WonX_Error("comm_open", "Serial port has already opened.");
WWSerialPort_ON(ww_serial_port);
WonxDisplay_Sync(Wonx_GetWonxDisplay());
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : comm_open() : return value = none\n");
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return;
}
@ -70,28 +70,28 @@ void comm_close(void)
{
WWSerialPort ww_serial_port;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : comm_close() : \n");
fflush(stdout);
ww_serial_port = WonxSerialPort_GetWWSerialPort(Wonx_GetWonxSerialPort());
ww_serial_port = WonXSerialPort_GetWWSerialPort(WonX_GetWonXSerialPort());
if (!WWSerialPort_IsON(ww_serial_port))
Wonx_Error("comm_close", "Serial port is not opened.");
WonX_Error("comm_close", "Serial port is not opened.");
WWSerialPort_OFF(ww_serial_port);
WonxDisplay_Sync(Wonx_GetWonxDisplay());
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : comm_close() : return value = none\n");
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return;
}
@ -155,18 +155,18 @@ int comm_send_char(unsigned char c)
WWSerialPort ww_serial_port;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : comm_send_char() : character = 0x%02x\n", (int)c);
fflush(stdout);
ww_serial_port = WonxSerialPort_GetWWSerialPort(Wonx_GetWonxSerialPort());
ww_serial_port = WonXSerialPort_GetWWSerialPort(WonX_GetWonXSerialPort());
if (!WWSerialPort_IsON(ww_serial_port))
Wonx_Error("comm_send_char", "Serial port is not opened.");
WonX_Error("comm_send_char", "Serial port is not opened.");
printf("output to serial port : ");
comm_output(c);
@ -174,13 +174,13 @@ int comm_send_char(unsigned char c)
fflush(stdout);
ret = 0;
WonxDisplay_Sync(Wonx_GetWonxDisplay());
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : comm_send_char() : return value = %d\n", ret);
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return (ret);
}
@ -191,31 +191,31 @@ int comm_receive_char(void)
int c;
int ret;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : comm_receive_char() : \n");
fflush(stdout);
ww_serial_port = WonxSerialPort_GetWWSerialPort(Wonx_GetWonxSerialPort());
ww_serial_port = WonXSerialPort_GetWWSerialPort(WonX_GetWonXSerialPort());
if (!WWSerialPort_IsON(ww_serial_port))
Wonx_Error("comm_receive_char", "Serial port is not opened.");
WonX_Error("comm_receive_char", "Serial port is not opened.");
c = comm_input(WWSerialPort_GetReceiveTimeout(ww_serial_port));
if (c == -1) ret = ERR_SIO_TIMEOUT;
else ret = c;
WonxDisplay_Sync(Wonx_GetWonxDisplay());
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : comm_receive_char() : return value = %d\n", ret);
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return (ret);
}
@ -226,31 +226,31 @@ int comm_receive_with_timeout(int timeout)
int c;
int ret;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : comm_receive_with_timeout() : timeout = %d\n", timeout);
fflush(stdout);
ww_serial_port = WonxSerialPort_GetWWSerialPort(Wonx_GetWonxSerialPort());
ww_serial_port = WonXSerialPort_GetWWSerialPort(WonX_GetWonXSerialPort());
if (!WWSerialPort_IsON(ww_serial_port))
Wonx_Error("comm_receive_with_timeout", "Serial port is not opened.");
WonX_Error("comm_receive_with_timeout", "Serial port is not opened.");
c = comm_input(timeout);
if (c == -1) ret = ERR_SIO_TIMEOUT;
else ret = c;
WonxDisplay_Sync(Wonx_GetWonxDisplay());
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : comm_receive_with_timeout() : return value = %d\n", ret);
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return (ret);
}
@ -261,18 +261,18 @@ int comm_send_string(char * string)
int ret;
int i;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : comm_send_string() : string = %s\n", string);
fflush(stdout);
ww_serial_port = WonxSerialPort_GetWWSerialPort(Wonx_GetWonxSerialPort());
ww_serial_port = WonXSerialPort_GetWWSerialPort(WonX_GetWonXSerialPort());
if (!WWSerialPort_IsON(ww_serial_port))
Wonx_Error("comm_send_string", "Serial port is not opened.");
WonX_Error("comm_send_string", "Serial port is not opened.");
printf("output to serial port : ");
for (i = 0; string[i]; i++) {
@ -282,13 +282,13 @@ int comm_send_string(char * string)
fflush(stdout);
ret = 0;
WonxDisplay_Sync(Wonx_GetWonxDisplay());
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : comm_send_string() : return value = %d\n", ret);
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return (ret);
}
@ -299,18 +299,18 @@ int comm_send_block(void * buffer, int size)
int ret;
int i;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : comm_send_block() : buffer = %p, size = %d\n", buffer, size);
fflush(stdout);
ww_serial_port = WonxSerialPort_GetWWSerialPort(Wonx_GetWonxSerialPort());
ww_serial_port = WonXSerialPort_GetWWSerialPort(WonX_GetWonXSerialPort());
if (!WWSerialPort_IsON(ww_serial_port))
Wonx_Error("comm_send_block", "Serial port is not opened.");
WonX_Error("comm_send_block", "Serial port is not opened.");
printf("output to serial port : ");
for (i = 0; i < size; i++) {
@ -320,13 +320,13 @@ int comm_send_block(void * buffer, int size)
fflush(stdout);
ret = 0;
WonxDisplay_Sync(Wonx_GetWonxDisplay());
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : comm_send_block() : return value = %d\n", ret);
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return (ret);
}
@ -338,19 +338,19 @@ int comm_receive_block(void * buffer, int size)
int c;
int i;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : comm_receive_block() : buffer = %p, size = %d\n",
buffer, size);
fflush(stdout);
ww_serial_port = WonxSerialPort_GetWWSerialPort(Wonx_GetWonxSerialPort());
ww_serial_port = WonXSerialPort_GetWWSerialPort(WonX_GetWonXSerialPort());
if (!WWSerialPort_IsON(ww_serial_port))
Wonx_Error("comm_receive_block", "Serial port is not opened.");
WonX_Error("comm_receive_block", "Serial port is not opened.");
ret = 0;
for (i = 0; i < size; i++) {
@ -362,13 +362,13 @@ int comm_receive_block(void * buffer, int size)
((char *)buffer)[i] = c;
}
WonxDisplay_Sync(Wonx_GetWonxDisplay());
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : comm_receive_block() : return value = %d\n", ret);
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return (ret);
}
@ -377,26 +377,26 @@ void comm_set_timeout(int recv_timeout, int send_timeout)
{
WWSerialPort ww_serial_port;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : comm_set_timeout() : receive_timeout = %d, send_timeout = %d\n", recv_timeout, send_timeout);
fflush(stdout);
ww_serial_port = WonxSerialPort_GetWWSerialPort(Wonx_GetWonxSerialPort());
ww_serial_port = WonXSerialPort_GetWWSerialPort(WonX_GetWonXSerialPort());
WWSerialPort_SetReceiveTimeout(ww_serial_port, recv_timeout);
WWSerialPort_SetSendTimeout( ww_serial_port, send_timeout);
WonxDisplay_Sync(Wonx_GetWonxDisplay());
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : comm_set_timeout() : return value = none\n");
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return;
}
@ -405,29 +405,29 @@ void comm_set_baudrate(int baudrate)
{
WWSerialPort ww_serial_port;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : comm_set_baudrate() : baudrate = %d\n", baudrate);
fflush(stdout);
ww_serial_port = WonxSerialPort_GetWWSerialPort(Wonx_GetWonxSerialPort());
ww_serial_port = WonXSerialPort_GetWWSerialPort(WonX_GetWonXSerialPort());
switch (baudrate) {
case COMM_SPEED_9600: WWSerialPort_SetBaudrate9600( ww_serial_port); break;
case COMM_SPEED_38400: WWSerialPort_SetBaudrate38400(ww_serial_port); break;
default: Wonx_Error("comm_set_baudrate", "Invalid baudrate");
default: WonX_Error("comm_set_baudrate", "Invalid baudrate");
}
WonxDisplay_Sync(Wonx_GetWonxDisplay());
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : comm_set_baudrate() : return value = none\n");
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return;
}
@ -437,29 +437,29 @@ int comm_get_baudrate(void)
WWSerialPort ww_serial_port;
int ret = 0;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : comm_get_baudrate() : \n");
fflush(stdout);
ww_serial_port = WonxSerialPort_GetWWSerialPort(Wonx_GetWonxSerialPort());
ww_serial_port = WonXSerialPort_GetWWSerialPort(WonX_GetWonXSerialPort());
if (WWSerialPort_IsBaudrate9600(ww_serial_port))
ret = COMM_SPEED_9600;
else if (WWSerialPort_IsBaudrate38400(ww_serial_port))
ret = COMM_SPEED_38400;
else Wonx_Error("comm_get_baudrate", "Invalid baudrate");
else WonX_Error("comm_get_baudrate", "Invalid baudrate");
WonxDisplay_Sync(Wonx_GetWonxDisplay());
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : comm_get_baudrate() : return value = %d\n", ret);
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return (ret);
}
@ -468,25 +468,25 @@ void comm_set_cancel_key(unsigned int pattern)
{
WWSerialPort ww_serial_port;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : comm_set_cancel_key() : pattern = %u\n", (int)pattern);
fflush(stdout);
ww_serial_port = WonxSerialPort_GetWWSerialPort(Wonx_GetWonxSerialPort());
ww_serial_port = WonXSerialPort_GetWWSerialPort(WonX_GetWonXSerialPort());
WWSerialPort_SetCancelKey(ww_serial_port, pattern);
WonxDisplay_Sync(Wonx_GetWonxDisplay());
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : comm_set_cancel_key() : return value = none\n");
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return;
}
@ -496,26 +496,26 @@ unsigned int comm_get_cancel_key(void)
WWSerialPort ww_serial_port;
unsigned int ret;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : comm_get_cancel_key() : \n");
fflush(stdout);
ww_serial_port = WonxSerialPort_GetWWSerialPort(Wonx_GetWonxSerialPort());
ww_serial_port = WonXSerialPort_GetWWSerialPort(WonX_GetWonXSerialPort());
/* ここに処理を書く */
ret = WWSerialPort_GetCancelKey(ww_serial_port);
WonxDisplay_Sync(Wonx_GetWonxDisplay());
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : comm_get_cancel_key() : return value = %u\n", (int)ret);
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return (ret);
}
@ -525,28 +525,28 @@ int comm_xmodem(void * xmodem)
WWSerialPort ww_serial_port;
int ret;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : comm_xmodem() : xmodem = %p\n", xmodem);
fflush(stdout);
ww_serial_port = WonxSerialPort_GetWWSerialPort(Wonx_GetWonxSerialPort());
ww_serial_port = WonXSerialPort_GetWWSerialPort(WonX_GetWonXSerialPort());
/* 未サポート */
printf("call : comm_xmodem() : not supported.\n");
fflush(stdout);
ret = 0;
WonxDisplay_Sync(Wonx_GetWonxDisplay());
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : comm_xmodem() : return value = %d\n", ret);
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return (ret);
}

344
disp.c

File diff suppressed because it is too large Load Diff

2
etc.c
View File

@ -7,7 +7,7 @@
/* エラー処理 */
/*===========================================================================*/
int Wonx_Error(char * funcname, char * message)
int WonX_Error(char * funcname, char * message)
{
fprintf(stderr, "%s(): %s\n", funcname, message);
exit (1);

2
etc.h
View File

@ -5,7 +5,7 @@
/* エラー処理 */
/*===========================================================================*/
int Wonx_Error(char * funcname, char * message);
int WonX_Error(char * funcname, char * message);
/*===========================================================================*/
/* "true", "false" の文字列を返す */

58
key.c
View File

@ -7,7 +7,7 @@
#include "wonx_include/key.h"
#include "Wonx.h"
#include "WonX.h"
/*****************************************************************************/
/* 互換関数の定義 */
@ -34,25 +34,25 @@ int key_press_check(void)
XDisplay x_display;
int ret;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : key_press_check() : "); fflush(stdout);
x_display = WonxDisplay_GetXDisplay(Wonx_GetWonxDisplay());
x_display = WonXDisplay_GetXDisplay(WonX_GetWonXDisplay());
XDisplay_Sync(x_display);
ret = XDisplay_GetKeyPress(x_display);
WonxDisplay_Sync(Wonx_GetWonxDisplay());
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : key_press_check() : return value = 0x%04x\n", (int)ret);
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return (ret);
}
@ -62,25 +62,25 @@ int key_hit_check(void)
XDisplay x_display;
int ret;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : key_hit_check() : "); fflush(stdout);
x_display = WonxDisplay_GetXDisplay(Wonx_GetWonxDisplay());
x_display = WonXDisplay_GetXDisplay(WonX_GetWonXDisplay());
XDisplay_Sync(x_display);
ret = XDisplay_GetKeyPress(x_display);
WonxDisplay_Sync(Wonx_GetWonxDisplay());
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : key_hit_check() : return value = 0x%04x\n", (int)ret);
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return (ret);
}
@ -90,14 +90,14 @@ int key_wait(void)
XDisplay x_display;
int ret;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : key_wait() : "); fflush(stdout);
x_display = WonxDisplay_GetXDisplay(Wonx_GetWonxDisplay());
x_display = WonXDisplay_GetXDisplay(WonX_GetWonXDisplay());
/*
* !
@ -109,33 +109,33 @@ int key_wait(void)
ret = XDisplay_GetKeyPress(x_display);
} while (ret == 0);
WonxDisplay_Sync(Wonx_GetWonxDisplay());
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : key_wait() : return value = 0x%04x\n", (int)ret);
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return (ret);
}
void key_set_repeat(int rate, int delay)
{
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : key_set_repeat() : rate = %d, delay = %d, ", rate, delay);
fflush(stdout);
WonxDisplay_Sync(Wonx_GetWonxDisplay());
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : key_set_repeat() : return value = none\n"); fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return;
}
@ -144,22 +144,22 @@ int key_get_repeat(void)
{
int ret;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : key_get_repeat() : "); fflush(stdout);
ret = 0;
WonxDisplay_Sync(Wonx_GetWonxDisplay());
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : key_get_repeat() : return value = 0x%04x\n", (int)ret);
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return (ret);
}
@ -169,26 +169,26 @@ int key_hit_check_with_repeat(void)
XDisplay x_display;
int ret;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : key_hit_check_with_repeat() : "); fflush(stdout);
x_display = WonxDisplay_GetXDisplay(Wonx_GetWonxDisplay());
x_display = WonXDisplay_GetXDisplay(WonX_GetWonXDisplay());
XDisplay_Sync(x_display);
ret = XDisplay_GetKeyPress(x_display);
WonxDisplay_Sync(Wonx_GetWonxDisplay());
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : key_hit_check_with_repeat() : return value = 0x%04x\n",
(int)ret);
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return (ret);
}

16
readline.pl Normal file
View File

@ -0,0 +1,16 @@
#!/usr/bin/perl
use FileHandle;
$file = @ARGV[0];
open(FILE, "$file");
FILE->autoflush();
while (<FILE>) {
print "$_";
STDOUT->autoflush();
FILE->autoflush();
}
# End of program

View File

@ -4,15 +4,15 @@
main()
{
text_screen_init();
text_put_string(0, 1, " Wonx - WonderWitch on X. ");
text_put_string(0, 1, " WonX - WonderWitch on X. ");
text_put_string(0, 3, " This is test program ");
text_put_string(0, 4, " for Wonx. ");
text_put_string(0, 6, " Wonx is an emulator for ");
text_put_string(0, 4, " for WonX. ");
text_put_string(0, 6, " WonX is an emulator for ");
text_put_string(0, 7, " WonderWitch on X. It is ");
text_put_string(0, 8, " linked to program for ");
text_put_string(0, 9, " WonderWitch and behave as ");
text_put_string(0, 10, " WonderWitch. ");
text_put_string(0, 12, " Wonx Copyright (c) 2000 ");
text_put_string(0, 12, " WonX Copyright (c) 2000 ");
text_put_string(0, 13, " Sakai Hiroaki. ");
text_put_string(0, 14, " All Rights Reserved. ");
text_put_string(0, 16, " Hit space key to exit. ");

View File

@ -7,7 +7,7 @@
#include "wonx_include/sound.h"
#include "Wonx.h"
#include "WonX.h"
/*****************************************************************************/
/* 高垂簇眶の年盗 */

16
sout2str.pl Normal file
View File

@ -0,0 +1,16 @@
#!/usr/bin/perl
use FileHandle;
while (<STDIN>) {
if (/output to serial port : /) {
($string) = /output to serial port : (.*)/;
$string =~ s/\\n/\n/;
$string =~ s/\\r/\n/;
$string =~ s/\\t/\t/;
print "$string";
STDOUT->autoflush();
}
}
# End of program

View File

@ -7,7 +7,7 @@
#include "wonx_include/system.h"
#include "Wonx.h"
#include "WonX.h"
/*****************************************************************************/
/* 互換関数の定義 */
@ -34,15 +34,15 @@ void sys_interrupt_set_hook(int type, intvector_t * vector,
{
WWInterrupt ww_interrupt;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : sys_interrupt_set_hook() : type = %d, vector = %p, old_vector = %p\n", type, vector, old_vector);
fflush(stdout);
ww_interrupt = WonxSystem_GetWWInterrupt(Wonx_GetWonxSystem());
ww_interrupt = WonXSystem_GetWWInterrupt(WonX_GetWonXSystem());
old_vector->callback = WWInterrupt_GetCallback(ww_interrupt, type);
old_vector->cs = WWInterrupt_GetCS(ww_interrupt, type);
@ -56,7 +56,7 @@ void sys_interrupt_set_hook(int type, intvector_t * vector,
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return;
}
@ -65,15 +65,15 @@ void sys_interrupt_reset_hook(int type, intvector_t * old_vector)
{
WWInterrupt ww_interrupt;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : sys_interrupt_reset_hook() : type = %d, old_vector = %p\n", type, old_vector);
fflush(stdout);
ww_interrupt = WonxSystem_GetWWInterrupt(Wonx_GetWonxSystem());
ww_interrupt = WonXSystem_GetWWInterrupt(WonX_GetWonXSystem());
WWInterrupt_SetCallback(ww_interrupt, type, old_vector->callback);
WWInterrupt_SetCS(ww_interrupt, type, old_vector->cs);
@ -83,7 +83,7 @@ void sys_interrupt_reset_hook(int type, intvector_t * old_vector)
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return;
}

122
text.c
View File

@ -8,7 +8,7 @@
#include "wonx_include/text.h"
#include "Wonx.h"
#include "WonX.h"
#include "WWText.h"
/*****************************************************************************/
@ -36,8 +36,8 @@ static void _text_window_init(int x, int y, int w, int h, unsigned int base)
WWText ww_text;
WWDisplay ww_display;
ww_text = WonxText_GetWWText(Wonx_GetWonxText());
ww_display = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay());
ww_text = WonXText_GetWWText(WonX_GetWonXText());
ww_display = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay());
WWText_SetTextWindow(ww_text, x, y, w, h, base, ww_display);
@ -52,25 +52,25 @@ void text_screen_init(void)
WWDisplay ww_display;
WWLCDPanel ww_lcd_panel;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : text_screen_init() : \n");
fflush(stdout);
ww_display = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay());
ww_display = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay());
ww_lcd_panel = WWDisplay_GetLCDPanel(ww_display);
_text_window_init(0, 0, TEXT_SCREEN_WIDTH, TEXT_SCREEN_HEIGHT, 8);
WonxDisplay_Flush(Wonx_GetWonxDisplay());
WonXDisplay_Flush(WonX_GetWonXDisplay());
printf("call : text_screen_init() : return value = none\n"); fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return;
}
@ -79,24 +79,24 @@ void text_window_init(int x, int y, int w, int h, unsigned int base)
{
WWDisplay ww_display;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : text_window_init() : x = %d, y = %d, width = %d, height = %d, base = %u\n", x, y, w, h, (int)base);
fflush(stdout);
ww_display = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay());
ww_display = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay());
_text_window_init(x, y, w, h, base);
WonxDisplay_Flush(Wonx_GetWonxDisplay());
WonXDisplay_Flush(WonX_GetWonXDisplay());
printf("call : text_window_init() : return value = none\n"); fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return;
}
@ -115,8 +115,8 @@ static void _text_put_char(int x, int y, unsigned int c)
WWText ww_text;
WWDisplay ww_display;
ww_text = WonxText_GetWWText(Wonx_GetWonxText());
ww_display = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay());
ww_text = WonXText_GetWWText(WonX_GetWonXText());
ww_display = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay());
WWText_PutCharacter(ww_text, x, y, c, ww_display);
@ -125,22 +125,22 @@ static void _text_put_char(int x, int y, unsigned int c)
void text_put_char(int x, int y, unsigned int c)
{
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : text_put_char() : x = %d, y = %d, character = %u\n", x, y, (int)c);
fflush(stdout);
_text_put_char(x, y, c);
WonxDisplay_Flush(Wonx_GetWonxDisplay());
WonXDisplay_Flush(WonX_GetWonXDisplay());
printf("call : text_put_char() : return value = none\n"); fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return;
}
@ -151,8 +151,8 @@ static int _text_put_string(int x, int y, char * string)
WWText ww_text;
WWDisplay ww_display;
ww_text = WonxText_GetWWText(Wonx_GetWonxText());
ww_display = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay());
ww_text = WonXText_GetWWText(WonX_GetWonXText());
ww_display = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay());
len = strlen(string);
ret = 0;
@ -168,23 +168,23 @@ int text_put_string(int x, int y, char * string)
{
int ret;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : text_put_string() : x = %d, y = %d, string = %s\n", x, y, string);
fflush(stdout);
ret = _text_put_string(x, y, string);
WonxDisplay_Flush(Wonx_GetWonxDisplay());
WonXDisplay_Flush(WonX_GetWonXDisplay());
printf("call : text_put_string() : return value = %d\n", ret);
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return (ret);
}
@ -195,16 +195,16 @@ int text_put_substring(int x, int y, char * s, int length)
WWText ww_text;
WWDisplay ww_display;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : text_put_substring() : x = %d, y = %d, string = %s, length = %d\n", x, y, s, length);
fflush(stdout);
ww_text = WonxText_GetWWText(Wonx_GetWonxText());
ww_display = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay());
ww_text = WonXText_GetWWText(WonX_GetWonXText());
ww_display = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay());
ret = 0;
for (i = 0; i < length; i++) {
@ -212,13 +212,13 @@ int text_put_substring(int x, int y, char * s, int length)
ret++;
}
WonxDisplay_Flush(Wonx_GetWonxDisplay());
WonXDisplay_Flush(WonX_GetWonXDisplay());
printf("call : text_put_substring() : return value = %d\n", ret);
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return (ret);
}
@ -228,10 +228,10 @@ void text_put_numeric(int x, int y, int length, int format, int number)
char buf[20];
char f[20];
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : text_put_numeric() : x = %d, y = %d, length = %d, format = %04x, number = %d\n", x, y, length, format, number);
fflush(stdout);
@ -248,13 +248,13 @@ void text_put_numeric(int x, int y, int length, int format, int number)
sprintf(buf, f, number);
_text_put_string(x, y, buf);
WonxDisplay_Flush(Wonx_GetWonxDisplay());
WonXDisplay_Flush(WonX_GetWonXDisplay());
printf("call : text_put_numeric() : return value = none\n");
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return;
}
@ -267,10 +267,10 @@ void text_fill_char(int x, int y, int length, int c)
{
int i;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : text_fill_char() : x = %d, y = %d, length = %d, character = %d\n", x, y, length, c);
fflush(stdout);
@ -279,13 +279,13 @@ void text_fill_char(int x, int y, int length, int c)
_text_put_char(x + i, y, c);
}
WonxDisplay_Flush(Wonx_GetWonxDisplay());
WonXDisplay_Flush(WonX_GetWonXDisplay());
printf("call : text_fill_char() : return value = none\n");
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return;
}
@ -295,26 +295,26 @@ void text_set_palette(int palette_num)
WWText ww_text;
WWDisplay ww_display;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : text_set_palette() : palette = %d\n", palette_num);
fflush(stdout);
ww_text = WonxText_GetWWText(Wonx_GetWonxText());
ww_display = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay());
ww_text = WonXText_GetWWText(WonX_GetWonXText());
ww_display = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay());
WWText_SetPalette(ww_text, WWDisplay_GetPalette(ww_display, palette_num));
WonxDisplay_Flush(Wonx_GetWonxDisplay());
WonXDisplay_Flush(WonX_GetWonXDisplay());
printf("call : text_set_palette() : return value = none\n");
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return;
}
@ -324,25 +324,25 @@ int text_get_palette(void)
WWText ww_text;
int num;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : text_get_palette() : \n");
fflush(stdout);
ww_text = WonxText_GetWWText(Wonx_GetWonxText());
ww_text = WonXText_GetWWText(WonX_GetWonXText());
num = WWPalette_GetNumber(WWText_GetPalette(ww_text));
WonxDisplay_Sync(Wonx_GetWonxDisplay());
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : text_get_palette() : return value = %d\n", num);
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return (num);
}
@ -364,26 +364,26 @@ void text_set_screen(int screen)
WWText ww_text;
WWDisplay ww_display;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : text_set_screen() : screen = %d\n", screen);
fflush(stdout);
ww_text = WonxText_GetWWText(Wonx_GetWonxText());
ww_display = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay());
ww_text = WonXText_GetWWText(WonX_GetWonXText());
ww_display = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay());
WWText_SetScreen(ww_text, WWDisplay_GetScreen(ww_display, screen));
WonxDisplay_Flush(Wonx_GetWonxDisplay());
WonXDisplay_Flush(WonX_GetWonXDisplay());
printf("call : text_set_screen() : return value = none\n");
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return;
}
@ -393,25 +393,25 @@ int text_get_screen(void)
WWText ww_text;
int n;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : text_get_screen() : \n");
fflush(stdout);
ww_text = WonxText_GetWWText(Wonx_GetWonxText());
ww_text = WonXText_GetWWText(WonX_GetWonXText());
n = WWScreen_GetNumber(WWText_GetScreen(ww_text));
WonxDisplay_Flush(Wonx_GetWonxDisplay());
WonXDisplay_Flush(WonX_GetWonXDisplay());
printf("call : text_set_screen() : return value = %d\n", n);
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return (n);
}

42
timer.c
View File

@ -9,7 +9,7 @@
#include "wonx_include/timer.h"
#include "wonx_configure.h"
#include "Wonx.h"
#include "WonX.h"
#include "etc.h"
/* int tm_year; year - 1900 */
@ -82,7 +82,7 @@ unsigned int rtc_get_datetime(int type)
case RTC_HOUR : ret = get_hour( tblock); break;
case RTC_MIN : ret = get_minute(tblock); break;
case RTC_SEC : ret = get_second(tblock); break;
default : Wonx_Error("rtc_get_datetime", "Unknown parameter.");
default : WonX_Error("rtc_get_datetime", "Unknown parameter.");
}
printf("call : rtc_get_datetime() : return value = %d\n", (int)ret);
@ -162,10 +162,10 @@ void timer_enable(int type, unsigned int auto_preset, unsigned int count)
{
WWTimer ww_timer;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : timer_enable() : type = %d, auto_preset = %u, count = %u\n",
type, (int)auto_preset, (int)count);
@ -180,11 +180,11 @@ void timer_enable(int type, unsigned int auto_preset, unsigned int count)
switch (type) {
case TIMER_VBLANK:
ww_timer = WonxSystem_GetWWVBlankCountUpTimer(Wonx_GetWonxSystem());
ww_timer = WonXSystem_GetWWVBlankCountUpTimer(WonX_GetWonXSystem());
WWTimer_SetPresetCounter(ww_timer, count * WONX_VBLANK_INTERVAL);
break;
case TIMER_HBLANK:
ww_timer = WonxSystem_GetWWHBlankCountUpTimer(Wonx_GetWonxSystem());
ww_timer = WonXSystem_GetWWHBlankCountUpTimer(WonX_GetWonXSystem());
WWTimer_SetPresetCounter(ww_timer, count * WONX_HBLANK_INTERVAL);
break;
default:
@ -193,13 +193,13 @@ void timer_enable(int type, unsigned int auto_preset, unsigned int count)
* NULL
*/
ww_timer = NULL;
Wonx_Error("timer_enable", "Invalid timer type.");
WonX_Error("timer_enable", "Invalid timer type.");
}
switch (auto_preset) {
case TIMER_ONESHOT: WWTimer_SetAutoPresetOFF(ww_timer); break;
case TIMER_AUTOPRESET: WWTimer_SetAutoPresetON( ww_timer); break;
default: Wonx_Error("timer_enable", "Invalid auto preset type.");
default: WonX_Error("timer_enable", "Invalid auto preset type.");
}
WWTimer_Reset(ww_timer);
@ -209,7 +209,7 @@ void timer_enable(int type, unsigned int auto_preset, unsigned int count)
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return;
}
@ -218,20 +218,20 @@ void timer_disable(int type)
{
WWTimer ww_timer;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : timer_disable() : type = %d\n", type);
fflush(stdout);
switch (type) {
case TIMER_VBLANK:
ww_timer = WonxSystem_GetWWVBlankCountUpTimer(Wonx_GetWonxSystem());
ww_timer = WonXSystem_GetWWVBlankCountUpTimer(WonX_GetWonXSystem());
break;
case TIMER_HBLANK:
ww_timer = WonxSystem_GetWWHBlankCountUpTimer(Wonx_GetWonxSystem());
ww_timer = WonXSystem_GetWWHBlankCountUpTimer(WonX_GetWonXSystem());
break;
default:
/*
@ -239,7 +239,7 @@ void timer_disable(int type)
* NULL
*/
ww_timer = NULL;
Wonx_Error("timer_disable", "Invalid timer type.");
WonX_Error("timer_disable", "Invalid timer type.");
}
WWTimer_OFF(ww_timer);
@ -248,7 +248,7 @@ void timer_disable(int type)
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return;
}
@ -258,20 +258,20 @@ unsigned int timer_get_count(int type)
WWTimer ww_timer;
unsigned int ret = 0;
if (!Wonx_IsCreated()) Wonx_Create();
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : timer_get_count() : type = %d\n", type);
fflush(stdout);
switch (type) {
case TIMER_VBLANK:
ww_timer = WonxSystem_GetWWVBlankCountUpTimer(Wonx_GetWonxSystem());
ww_timer = WonXSystem_GetWWVBlankCountUpTimer(WonX_GetWonXSystem());
break;
case TIMER_HBLANK:
ww_timer = WonxSystem_GetWWHBlankCountUpTimer(Wonx_GetWonxSystem());
ww_timer = WonXSystem_GetWWHBlankCountUpTimer(WonX_GetWonXSystem());
break;
default:
/*
@ -279,7 +279,7 @@ unsigned int timer_get_count(int type)
* NULL
*/
ww_timer = NULL;
Wonx_Error("timer_get_count", "Invalid timer type.");
WonX_Error("timer_get_count", "Invalid timer type.");
}
ret = WWTimer_GetCounter(ww_timer);
@ -288,7 +288,7 @@ unsigned int timer_get_count(int type)
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return (ret);
}

View File

@ -3,7 +3,7 @@
#ifndef _WONX_winx_configure_h_INCLUDED_
#define _WONX_wonx_configure_h_INCLUDED_
/* Wonx でのタイマ割り込みの周期(単位はミリ秒) */
/* WonX でのタイマ割り込みの周期(単位はミリ秒) */
#define WONX_TIMER_INTERVAL 100 /* 0.1 秒 */
/* HBLANK, VBLANK 割り込みのデフォルトのインターバル(0.1秒単位) */