diff --git a/COPYRIGHT b/COPYRIGHT index a4d288f..d02c527 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -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 */ diff --git a/HISTORY b/HISTORY index 7f51a15..12d5fdf 100644 --- a/HISTORY +++ b/HISTORY @@ -1,3 +1,16 @@ +2000/11/23(木) + +wonx-1.0 公開 + +正式名称を Wonx から WonX に変更. + +MANUAL ファイルを追加. + +OMAKE.jpn に文章追加. + + + + 2000/11/23(木) wonx-b05 公開 diff --git a/MANUAL b/MANUAL new file mode 100644 index 0000000..f316d63 --- /dev/null +++ b/MANUAL @@ -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() という名前になっています. + +■ このファイルはここまでです diff --git a/Makefile b/Makefile index ae72465..027cbf9 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/OMAKE.jpn b/OMAKE.jpn index 0eed821..b4df3ca 100644 --- a/OMAKE.jpn +++ b/OMAKE.jpn @@ -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」という名前で作った, diff --git a/README b/README index 4f9beda..8f3e70b 100644 --- a/README +++ b/README @@ -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 ■ はじめに -Wonx は,WonderWitch 用のプログラムを X アプリケーションとしてコンパイルする +WonX は,WonderWitch 用のプログラムを X アプリケーションとしてコンパイルする ための,ライブラリです.以下の特徴があります. ・C言語レベルで互換機能を持っているので,WonderWitch 用のプログラムを @@ -51,7 +51,7 @@ Wonx 従って,WonderWitch での動作を模倣することよりも,デバッグ情報を 出力することや改造のしやすさを優先したような実装をする場合がある. -■ 3分wonx +■ 3分WonX とりあえず,どんなものか見てみたいことでしょう.そんな人は, サンプルプログラムをコンパイル・実行してみましょう. @@ -100,25 +100,25 @@ smac p を押して頻繁に描画の ON, OFF を切替えるのは,描画が非常に遅いため, ONのままだと画面クリアとかに異常に時間がかかるからです. -■ Wonx 概要 +■ WonX 概要 -Wonx は,WonderWitch の display_control() とか display_status() といった +WonX は,WonderWitch の 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 上で動作するようになる,という仕組みです. ■ ヘッダファイルについて -Wonx は,UNIXシステム上にある libc を使用します.つまり,/usr/include の +WonX は,UNIXシステム上にある 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 を参照してください. diff --git a/UNIXTimer.c b/UNIXTimer.c index f788bc6..133e3b3 100644 --- a/UNIXTimer.c +++ b/UNIXTimer.c @@ -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); diff --git a/UNIXTimerP.h b/UNIXTimerP.h index 23e6695..9b54edb 100644 --- a/UNIXTimerP.h +++ b/UNIXTimerP.h @@ -19,7 +19,7 @@ typedef struct _UNIXTimer { * タイマの一時停止.停止中にタイマの時間が来た場合には, * 時間が来たことだけ記憶しておき,一時停止の解除時にコールバック関数が * 呼び出される. - * Wonx では X サーバとの通信中にタイマ割り込みが入って,さらに X サーバとの + * WonX では X サーバとの通信中にタイマ割り込みが入って,さらに X サーバとの * 通信が発生したりすると,通信の整合性がとれなくなるような気がするので, * それを防ぐために,一部の関数内部ではタイマ割り込みを停止させる. */ diff --git a/WWCharacter.c b/WWCharacter.c index 37832aa..8b469b6 100644 --- a/WWCharacter.c +++ b/WWCharacter.c @@ -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); diff --git a/WWColorMap.c b/WWColorMap.c index fb2bba3..4acf0ad 100644 --- a/WWColorMap.c +++ b/WWColorMap.c @@ -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); diff --git a/WWDisplay.c b/WWDisplay.c index e7bb5a8..ae4baf5 100644 --- a/WWDisplay.c +++ b/WWDisplay.c @@ -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)); diff --git a/WWInterrupt.c b/WWInterrupt.c index 9bf6f10..d4f4d6f 100644 --- a/WWInterrupt.c +++ b/WWInterrupt.c @@ -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); diff --git a/WWLCDPanel.c b/WWLCDPanel.c index cfe9132..0c3d7b1 100644 --- a/WWLCDPanel.c +++ b/WWLCDPanel.c @@ -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); diff --git a/WWPalette.c b/WWPalette.c index 06f3252..145beac 100644 --- a/WWPalette.c +++ b/WWPalette.c @@ -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); diff --git a/WWScreen.c b/WWScreen.c index c645dd0..82cbf5f 100644 --- a/WWScreen.c +++ b/WWScreen.c @@ -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); diff --git a/WWSerialPort.c b/WWSerialPort.c index 2d9076e..95722fe 100644 --- a/WWSerialPort.c +++ b/WWSerialPort.c @@ -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); diff --git a/WWSprite.c b/WWSprite.c index 7728c2c..e68e586 100644 --- a/WWSprite.c +++ b/WWSprite.c @@ -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); diff --git a/WWText.c b/WWText.c index 5fe7e9b..d2ec660 100644 --- a/WWText.c +++ b/WWText.c @@ -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)) diff --git a/WWTimer.c b/WWTimer.c index 44f31f1..440a873 100644 --- a/WWTimer.c +++ b/WWTimer.c @@ -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); diff --git a/Wonx.c b/WonX.c similarity index 56% rename from Wonx.c rename to WonX.c index c945282..7ebaddc 100644 --- a/Wonx.c +++ b/WonX.c @@ -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); } diff --git a/Wonx.h b/WonX.h similarity index 50% rename from Wonx.h rename to WonX.h index 4b3ce73..32ff75e 100644 --- a/Wonx.h +++ b/WonX.h @@ -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 diff --git a/WonxDisplay.c b/WonXDisplay.c similarity index 72% rename from WonxDisplay.c rename to WonXDisplay.c index 08d91f3..da117f4 100644 --- a/WonxDisplay.c +++ b/WonXDisplay.c @@ -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); } diff --git a/WonxDisplay.h b/WonXDisplay.h similarity index 74% rename from WonxDisplay.h rename to WonXDisplay.h index 830a538..2e01c53 100644 --- a/WonxDisplay.h +++ b/WonXDisplay.h @@ -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); /*****************************************************************************/ /* ここまで */ diff --git a/WonxDisplayP.h b/WonXDisplayP.h similarity index 88% rename from WonxDisplayP.h rename to WonXDisplayP.h index 89b2361..746af72 100644 --- a/WonxDisplayP.h +++ b/WonXDisplayP.h @@ -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; /*****************************************************************************/ /* ここまで */ diff --git a/WonxP.h b/WonXP.h similarity index 79% rename from WonxP.h rename to WonXP.h index da8ec42..b815649 100644 --- a/WonxP.h +++ b/WonXP.h @@ -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; /*****************************************************************************/ /* ここまで */ diff --git a/WonxSerialPort.c b/WonXSerialPort.c similarity index 69% rename from WonxSerialPort.c rename to WonXSerialPort.c index 70a8fde..21adfde 100644 --- a/WonxSerialPort.c +++ b/WonXSerialPort.c @@ -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); diff --git a/WonxSerialPort.h b/WonXSerialPort.h similarity index 78% rename from WonxSerialPort.h rename to WonXSerialPort.h index aafae70..c206793 100644 --- a/WonxSerialPort.h +++ b/WonXSerialPort.h @@ -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); /*****************************************************************************/ /* ここまで */ diff --git a/WonxSerialPortP.h b/WonXSerialPortP.h similarity index 86% rename from WonxSerialPortP.h rename to WonXSerialPortP.h index fedc89c..a9b1692 100644 --- a/WonxSerialPortP.h +++ b/WonXSerialPortP.h @@ -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; /*****************************************************************************/ /* ここまで */ diff --git a/WonXSystem.c b/WonXSystem.c new file mode 100644 index 0000000..30edeaa --- /dev/null +++ b/WonXSystem.c @@ -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. */ +/*****************************************************************************/ diff --git a/WonxSystem.h b/WonXSystem.h similarity index 60% rename from WonxSystem.h rename to WonXSystem.h index 0c70367..9ac6d78 100644 --- a/WonxSystem.h +++ b/WonXSystem.h @@ -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); /*****************************************************************************/ /* ここまで */ diff --git a/WonxSystemP.h b/WonXSystemP.h similarity index 90% rename from WonxSystemP.h rename to WonXSystemP.h index 8a38850..4d2dbb3 100644 --- a/WonxSystemP.h +++ b/WonXSystemP.h @@ -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; /*****************************************************************************/ /* ここまで */ diff --git a/WonxText.c b/WonXText.c similarity index 66% rename from WonxText.c rename to WonXText.c index cdc75b6..464f72b 100644 --- a/WonxText.c +++ b/WonXText.c @@ -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); diff --git a/WonxText.h b/WonXText.h similarity index 77% rename from WonxText.h rename to WonXText.h index 26873bc..99b3f81 100644 --- a/WonxText.h +++ b/WonXText.h @@ -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); /*****************************************************************************/ /* ここまで */ diff --git a/WonxTextP.h b/WonXTextP.h similarity index 88% rename from WonxTextP.h rename to WonXTextP.h index 92659a3..f639cd2 100644 --- a/WonxTextP.h +++ b/WonXTextP.h @@ -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; /*****************************************************************************/ /* ここまで */ diff --git a/Wonx2WonX.pl b/Wonx2WonX.pl new file mode 100644 index 0000000..053f9cd --- /dev/null +++ b/Wonx2WonX.pl @@ -0,0 +1,17 @@ +#!/usr/bin/perl + +while ($filename = shift(@ARGV)) { + open(RFILE, "< $filename"); + open(WFILE, "> $filename.tmp"); + while () { + if (/Wonx/) { + print $_; + s/Wonx/WonX/g; + print $_; + } + print WFILE $_; + } + close(RFILE); + close(WFILE); + system("mv $filename.tmp $filename"); +} diff --git a/WonxSystem.c b/WonxSystem.c deleted file mode 100644 index cccb9c4..0000000 --- a/WonxSystem.c +++ /dev/null @@ -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. */ -/*****************************************************************************/ diff --git a/XDisplay.c b/XDisplay.c index 39bdd50..4e3bfe8 100644 --- a/XDisplay.c +++ b/XDisplay.c @@ -8,7 +8,7 @@ #include #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); diff --git a/bank.c b/bank.c index db4501a..3e09a16 100644 --- a/bank.c +++ b/bank.c @@ -7,7 +7,7 @@ #include "wonx_include/bank.h" -#include "Wonx.h" +#include "WonX.h" /*****************************************************************************/ /* 互換関数の定義 */ diff --git a/comm.c b/comm.c index 6617387..44bc1b5 100644 --- a/comm.c +++ b/comm.c @@ -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); } diff --git a/disp.c b/disp.c index 304e7da..561b3d0 100644 --- a/disp.c +++ b/disp.c @@ -7,7 +7,7 @@ #include "wonx_include/disp.h" -#include "Wonx.h" +#include "WonX.h" /*****************************************************************************/ /* 互換関数の定義 */ @@ -38,15 +38,15 @@ void display_control(unsigned int flags) { 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 : display_control() : flags = 0x%04x\n", (int)flags); fflush(stdout); - ww_display = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()); + ww_display = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()); WWScreen_SetEnable(WWDisplay_GetScreen(ww_display, SCREEN1), (flags & DCM_SCR1) ? 1 : 0); @@ -67,12 +67,12 @@ void display_control(unsigned int flags) WWDisplay_SetBorder(ww_display, (flags & DCM_BORDER_COLOR) >> 7); - WonxDisplay_Flush(Wonx_GetWonxDisplay()); + WonXDisplay_Flush(WonX_GetWonXDisplay()); printf("call : display_control() : return value = none\n"); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return; } @@ -82,14 +82,14 @@ unsigned int display_status(void) WWDisplay ww_display; unsigned short 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 : display_status() : \n"); fflush(stdout); - ww_display = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()); + ww_display = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()); ret = 0; @@ -117,13 +117,13 @@ unsigned int display_status(void) ret |= WWDisplay_GetBorder(ww_display) << 7; - WonxDisplay_Sync(Wonx_GetWonxDisplay()); + WonXDisplay_Sync(WonX_GetWonXDisplay()); printf("call : display_status() : return value = %u\n", (int)ret); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return (ret); } @@ -140,15 +140,15 @@ void font_set_monodata(unsigned int number, unsigned int count, int f, b; 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 : font_set_monodata() : number = %u, count = %u, data = %p\n", (int)number, (int)count, (void *)data); fflush(stdout); - ww_display = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()); + ww_display = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()); f = WWDisplay_GetForegroundColor(ww_display); b = WWDisplay_GetBackgroundColor(ww_display); @@ -165,13 +165,13 @@ void font_set_monodata(unsigned int number, unsigned int count, } } - WonxDisplay_Flush(Wonx_GetWonxDisplay()); + WonXDisplay_Flush(WonX_GetWonXDisplay()); printf("call : font_set_monodata() : return value = none\n"); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return; } @@ -186,10 +186,10 @@ void font_set_colordata(unsigned int number, unsigned int count, WWCharacter c; int i, x, y, n, p; - if (!Wonx_IsCreated()) Wonx_Create(); + if (!WonX_IsCreated()) WonX_Create(); /* タイマを一時停止する */ - UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); printf("call : font_set_colordata() : number = %u, count = %u, data = %p\n", (int)number, (int)count, (void *)data); fflush(stdout); @@ -197,7 +197,7 @@ void font_set_colordata(unsigned int number, unsigned int count, n = 0; for (i = 0; i < count; i++) { - c = WWDisplay_GetCharacter(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()), + c = WWDisplay_GetCharacter(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()), number + i); for (y = 0; y < 8; y++) { for (x = 0; x < 8; x++) { @@ -213,13 +213,13 @@ void font_set_colordata(unsigned int number, unsigned int count, } } - WonxDisplay_Flush(Wonx_GetWonxDisplay()); + WonXDisplay_Flush(WonX_GetWonXDisplay()); printf("call : font_set_colordata() : return value = none\n"); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return; } @@ -235,10 +235,10 @@ void font_get_data(unsigned int number, unsigned int count, WWCharacter c; int i, x, y, n, p; - if (!Wonx_IsCreated()) Wonx_Create(); + if (!WonX_IsCreated()) WonX_Create(); /* タイマを一時停止する */ - UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); printf("call : font_get_data() : number = %u, count = %u, data = %p\n", (int)number, (int)count, (void *)data); fflush(stdout); @@ -246,7 +246,7 @@ void font_get_data(unsigned int number, unsigned int count, n = 0; for (i = 0; i < count; i++) { - c = WWDisplay_GetCharacter(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()), + c = WWDisplay_GetCharacter(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()), number + i); for (y = 0; y < 8; y++) { data[n ] = 0; @@ -262,13 +262,13 @@ void font_get_data(unsigned int number, unsigned int count, } } - WonxDisplay_Sync(Wonx_GetWonxDisplay()); + WonXDisplay_Sync(WonX_GetWonXDisplay()); printf("call : font_get_data() : return value = none\n"); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return; } @@ -277,24 +277,24 @@ void font_set_color(unsigned int colors) { WWDisplay dis; - if (!Wonx_IsCreated()) Wonx_Create(); + if (!WonX_IsCreated()) WonX_Create(); /* タイマを一時停止する */ - UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); printf("call : font_set_color() : colors = 0x%04x\n", (int)colors); fflush(stdout); - dis = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()); + dis = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()); WWDisplay_SetForegroundColor(dis, colors & 0x03); WWDisplay_SetBackgroundColor(dis, (colors >> 2) & 0x03); - WonxDisplay_Flush(Wonx_GetWonxDisplay()); + WonXDisplay_Flush(WonX_GetWonXDisplay()); printf("call : font_set_color() : return value = none\n"); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return; } @@ -304,25 +304,25 @@ unsigned int font_get_color(void) unsigned short int ret; WWDisplay dis; - if (!Wonx_IsCreated()) Wonx_Create(); + if (!WonX_IsCreated()) WonX_Create(); /* タイマを一時停止する */ - UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); printf("call : font_get_color() : \n"); fflush(stdout); - dis = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()); + dis = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()); ret = 0; ret |= WWDisplay_GetForegroundColor(dis); ret |= WWDisplay_GetBackgroundColor(dis) << 2; - WonxDisplay_Sync(Wonx_GetWonxDisplay()); + WonXDisplay_Sync(WonX_GetWonXDisplay()); printf("call : font_get_color() : return value = 0x%04x\n", (int)ret); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return (ret); } @@ -339,7 +339,7 @@ static void _screen_set_char1(int screen, int x, int y, WWPalette p; WWCharacter c; - display = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()); + display = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()); s = WWDisplay_GetScreen(display, screen); @@ -368,10 +368,10 @@ void screen_set_char(int screen, int x, int y, int w, int h, { int i, j; - if (!Wonx_IsCreated()) Wonx_Create(); + if (!WonX_IsCreated()) WonX_Create(); /* タイマを一時停止する */ - UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); printf("call : screen_set_char() : screen = %d, x = %d, y = %d, w = %d, h = %d, data = %p\n", screen, x, y, w, h, (void *)data); @@ -384,13 +384,13 @@ void screen_set_char(int screen, int x, int y, int w, int h, } } - WonxDisplay_Flush(Wonx_GetWonxDisplay()); + WonXDisplay_Flush(WonX_GetWonXDisplay()); printf("call : screen_set_char() : return value = none\n"); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return; } @@ -406,7 +406,7 @@ static unsigned int _screen_get_char1(int screen, int x, int y) WWCharacter c; unsigned short int ret; - s = WWDisplay_GetScreen(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()), + s = WWDisplay_GetScreen(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()), screen); horizontal = WWScreen_GetHorizontal(s, x, y); @@ -434,10 +434,10 @@ void screen_get_char(int screen, int x, int y, int w, int h, { int i, j; - if (!Wonx_IsCreated()) Wonx_Create(); + if (!WonX_IsCreated()) WonX_Create(); /* タイマを一時停止する */ - UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); printf("call : screen_get_char() : screen = %d, x = %d, y = %d, w = %d, h = %d, data = %p\n", screen, x, y, w, h, (void *)data); @@ -450,13 +450,13 @@ void screen_get_char(int screen, int x, int y, int w, int h, } } - WonxDisplay_Sync(Wonx_GetWonxDisplay()); + WonXDisplay_Sync(WonX_GetWonXDisplay()); printf("call : screen_get_char() : return value = none\n"); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return; } @@ -465,10 +465,10 @@ unsigned int screen_get_char1(int screen, int x, int y) { unsigned short 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 : screen_get_char1() : screen = %d, x = %d, y = %d\n", screen, x, y); @@ -476,13 +476,13 @@ unsigned int screen_get_char1(int screen, int x, int y) ret = _screen_get_char1(screen, x, y); - WonxDisplay_Sync(Wonx_GetWonxDisplay()); + WonXDisplay_Sync(WonX_GetWonXDisplay()); printf("call : screen_get_char1() : return value = 0x%04x\n", (int)ret); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return (ret); } @@ -492,10 +492,10 @@ void screen_fill_char(int screen, int x, int y, int w, int h, { int i, j; - if (!Wonx_IsCreated()) Wonx_Create(); + if (!WonX_IsCreated()) WonX_Create(); /* タイマを一時停止する */ - UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); printf("call : screen_fill_char() : screen = %d, x = %d, y = %d, w = %d, h = %d, data = 0x%04x\n", screen, x, y, w, h, (int)data); @@ -507,12 +507,12 @@ void screen_fill_char(int screen, int x, int y, int w, int h, } } - WonxDisplay_Flush(Wonx_GetWonxDisplay()); + WonXDisplay_Flush(WonX_GetWonXDisplay()); printf("call : screen_fill_char() : return value = none\n"); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return; } @@ -523,10 +523,10 @@ void screen_fill_attr(int screen, int x, int y, int w, int h, int i, j; unsigned short 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 : screen_fill_attr() : screen = %d, x = %d, y = %d, w = %d, h = %d, data = 0x%04x, mask = 0x%04x\n", screen, x, y, w, h, (int)data, (int)mask); fflush(stdout); @@ -540,39 +540,39 @@ void screen_fill_attr(int screen, int x, int y, int w, int h, } } - WonxDisplay_Flush(Wonx_GetWonxDisplay()); + WonXDisplay_Flush(WonX_GetWonXDisplay()); printf("call : screen_fill_attr() : return value = none\n"); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return; } void sprite_set_range(unsigned int start, unsigned int number) { - if (!Wonx_IsCreated()) Wonx_Create(); + if (!WonX_IsCreated()) WonX_Create(); /* タイマを一時停止する */ - UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); printf("call : sprite_set_range() : start = %u, number = %u\n", (int)start, (int)number); fflush(stdout); - WWDisplay_SetSpriteStart(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()), + WWDisplay_SetSpriteStart(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()), start); - WWDisplay_SetSpriteCount(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()), + WWDisplay_SetSpriteCount(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()), number); - WonxDisplay_Flush(Wonx_GetWonxDisplay()); + WonXDisplay_Flush(WonX_GetWonXDisplay()); printf("call : sprite_set_range() : return value = none\n"); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return; } @@ -583,7 +583,7 @@ static void _sprite_set_char(unsigned int sprite_num, unsigned int data) WWPalette p; WWCharacter c; - s = WWDisplay_GetSprite(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()), + s = WWDisplay_GetSprite(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()), sprite_num); WWSprite_SetHorizontal(s, (data >> 15) ? 1 : 0); @@ -592,10 +592,10 @@ static void _sprite_set_char(unsigned int sprite_num, unsigned int data) WWSprite_SetClipping( s, (data >> 12) ? 1 : 0); /* 8を引いた値でパレット番号が指定されるので,8を足してやる */ - p = WWDisplay_GetPalette(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()), + p = WWDisplay_GetPalette(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()), ((data >> 9) & 0x07) + 8); - c = WWDisplay_GetCharacter(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()), + c = WWDisplay_GetCharacter(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()), data & 0x1ff); WWSprite_SetPalette(s, p); @@ -606,23 +606,23 @@ static void _sprite_set_char(unsigned int sprite_num, unsigned int data) void sprite_set_char(unsigned int sprite_num, unsigned int data) { - if (!Wonx_IsCreated()) Wonx_Create(); + if (!WonX_IsCreated()) WonX_Create(); /* タイマを一時停止する */ - UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); printf("call : sprite_set_char() : number = %u, data = 0x%04x\n", (int)sprite_num, (int)data); fflush(stdout); _sprite_set_char(sprite_num, data); - WonxDisplay_Flush(Wonx_GetWonxDisplay()); + WonXDisplay_Flush(WonX_GetWonXDisplay()); printf("call : sprite_set_char() : return value = none\n"); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return; } @@ -634,7 +634,7 @@ static unsigned int _sprite_get_char(unsigned int sprite_num) WWCharacter c; unsigned short int ret; - s = WWDisplay_GetSprite(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()), + s = WWDisplay_GetSprite(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()), sprite_num); ret = 0; @@ -658,23 +658,23 @@ unsigned int sprite_get_char(unsigned int sprite_num) { unsigned short 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 : sprite_get_char() : number = %u\n", (int)sprite_num); fflush(stdout); ret = _sprite_get_char(sprite_num); - WonxDisplay_Sync(Wonx_GetWonxDisplay()); + WonXDisplay_Sync(WonX_GetWonXDisplay()); printf("call : sprite_get_char() : return value = 0x%04x\n", (int)ret); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return (ret); } @@ -683,7 +683,7 @@ static void _sprite_set_location(unsigned int sprite_num, int x, int y) { WWSprite s; - s = WWDisplay_GetSprite(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()), + s = WWDisplay_GetSprite(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()), sprite_num); WWSprite_SetPosition(s, x, y); @@ -692,10 +692,10 @@ static void _sprite_set_location(unsigned int sprite_num, int x, int y) void sprite_set_location(unsigned int sprite_num, int x, int y) { - if (!Wonx_IsCreated()) Wonx_Create(); + if (!WonX_IsCreated()) WonX_Create(); /* タイマを一時停止する */ - UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); printf("call : sprite_set_location() : number = %u, x = %d, y = %d\n", (int)sprite_num, x, y); @@ -703,13 +703,13 @@ void sprite_set_location(unsigned int sprite_num, int x, int y) _sprite_set_location(sprite_num, x, y); - WonxDisplay_Flush(Wonx_GetWonxDisplay()); + WonXDisplay_Flush(WonX_GetWonXDisplay()); printf("call : sprite_set_location() : return value = none\n"); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return; } @@ -719,7 +719,7 @@ static unsigned int _sprite_get_location(unsigned int sprite_num) WWSprite s; unsigned short int ret; - s = WWDisplay_GetSprite(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()), + s = WWDisplay_GetSprite(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()), sprite_num); ret = (WWSprite_GetY(s) << 8) | WWSprite_GetX(s); @@ -731,23 +731,23 @@ unsigned int sprite_get_location(unsigned int sprite_num) { unsigned short 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 : sprite_get_location() : number = %u\n", (int)sprite_num); fflush(stdout); ret = _sprite_get_location(sprite_num); - WonxDisplay_Sync(Wonx_GetWonxDisplay()); + WonXDisplay_Sync(WonX_GetWonXDisplay()); printf("call : sprite_get_location() : return value = 0x%04x\n", (int)ret); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return (ret); } @@ -764,10 +764,10 @@ static void _sprite_set_char_location(unsigned int sprite_num, void sprite_set_char_location(unsigned int sprite_num, unsigned int data, int x, int y) { - if (!Wonx_IsCreated()) Wonx_Create(); + if (!WonX_IsCreated()) WonX_Create(); /* タイマを一時停止する */ - UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); printf("call : sprite_set_char_location() : number = %u, data = 0x%04x, x = %d, y = %d\n", (int)sprite_num, (int)data, x, y); @@ -775,13 +775,13 @@ void sprite_set_char_location(unsigned int sprite_num, _sprite_set_char_location(sprite_num, data, x, y); - WonxDisplay_Flush(Wonx_GetWonxDisplay()); + WonXDisplay_Flush(WonX_GetWonXDisplay()); printf("call : sprite_set_char_location() : return value = none\n"); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return; } @@ -790,10 +790,10 @@ unsigned long int sprite_get_char_location(unsigned int sprite_num) { unsigned long 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 : sprite_get_char_location() : number = %u\n", (int)sprite_num); fflush(stdout); @@ -802,14 +802,14 @@ unsigned long int sprite_get_char_location(unsigned int sprite_num) ret |= ((unsigned long int)_sprite_get_char(sprite_num)); ret |= (unsigned long int)_sprite_get_location(sprite_num) << 16; - WonxDisplay_Sync(Wonx_GetWonxDisplay()); + WonXDisplay_Sync(WonX_GetWonXDisplay()); printf("call : sprite_get_char_location() : return value = 0x%08x\n", (int)ret); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return (ret); } @@ -823,10 +823,10 @@ void sprite_set_data(unsigned int sprite_num, unsigned int count, { 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 : sprite_set_data() : number = %u, count = %u, data = %p\n", (int)sprite_num, (int)count, (void *)data); @@ -839,13 +839,13 @@ void sprite_set_data(unsigned int sprite_num, unsigned int count, data[i] & 0xff); } - WonxDisplay_Flush(Wonx_GetWonxDisplay()); + WonXDisplay_Flush(WonX_GetWonXDisplay()); printf("call : sprite_set_data() : return value = none\n"); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return; } @@ -854,27 +854,27 @@ void screen_set_scroll(int screen, int x, int y) { WWScreen s; - if (!Wonx_IsCreated()) Wonx_Create(); + if (!WonX_IsCreated()) WonX_Create(); /* タイマを一時停止する */ - UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); printf("call : screen_set_scroll() : screen = %d, x = %d, y = %d\n", screen, x, y); fflush(stdout); - s = WWDisplay_GetScreen(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()), + s = WWDisplay_GetScreen(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()), screen); WWScreen_SetRollX(s, x); WWScreen_SetRollY(s, y); - WonxDisplay_Flush(Wonx_GetWonxDisplay()); + WonXDisplay_Flush(WonX_GetWonXDisplay()); printf("call : screen_set_scroll() : return value = none\n"); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return; } @@ -884,27 +884,27 @@ unsigned int screen_get_scroll(int screen) unsigned short int ret; WWScreen s; - if (!Wonx_IsCreated()) Wonx_Create(); + if (!WonX_IsCreated()) WonX_Create(); /* タイマを一時停止する */ - UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); printf("call : screen_get_scroll() : screen = %d\n", screen); fflush(stdout); - s = WWDisplay_GetScreen(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()), + s = WWDisplay_GetScreen(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()), screen); ret = 0; ret |= WWScreen_GetRollX(s); ret |= WWScreen_GetRollY(s) << 8; - WonxDisplay_Sync(Wonx_GetWonxDisplay()); + WonXDisplay_Sync(WonX_GetWonXDisplay()); printf("call : screen_get_scroll() : return value = %u\n", (int)ret); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return (ret); } @@ -913,28 +913,28 @@ void screen2_set_window(int x, int y, int w, int h) { WWScreen s; - if (!Wonx_IsCreated()) Wonx_Create(); + if (!WonX_IsCreated()) WonX_Create(); /* タイマを一時停止する */ - UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); printf("call : screen2_set_window() : x = %d, y = %d, width = %d, height = %d\n", x, y, w, h); fflush(stdout); - s = WWDisplay_GetScreen(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()), + s = WWDisplay_GetScreen(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()), SCREEN2); WWScreen_SetDrawX(s, x); WWScreen_SetDrawY(s, y); WWScreen_SetDrawWidth( s, w); WWScreen_SetDrawHeight(s, h); - WonxDisplay_Flush(Wonx_GetWonxDisplay()); + WonXDisplay_Flush(WonX_GetWonXDisplay()); printf("call : screen2_set_window() : return value = none\n"); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return; } @@ -946,14 +946,14 @@ unsigned long int screen2_get_window(void) unsigned short int wh; unsigned long 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 : screen2_get_window() : \n"); fflush(stdout); - s = WWDisplay_GetScreen(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()), + s = WWDisplay_GetScreen(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()), SCREEN2); xy = @@ -964,13 +964,13 @@ unsigned long int screen2_get_window(void) ((unsigned short int)WWScreen_GetDrawWidth(s) & 0x00ff); ret = ((unsigned long int)wh) << 16 | xy; - WonxDisplay_Sync(Wonx_GetWonxDisplay()); + WonXDisplay_Sync(WonX_GetWonXDisplay()); printf("call : screen2_get_window() : return value = 0x%08x\n", (int)ret); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return (ret); } @@ -979,29 +979,29 @@ void sprite_set_window(int x, int y, int w, int h) { WWDisplay d; - if (!Wonx_IsCreated()) Wonx_Create(); + if (!WonX_IsCreated()) WonX_Create(); /* タイマを一時停止する */ - UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); printf("call : sprite_set_window() : x = %d, y = %d, w = %d, h = %d\n", x, y, w, h); fflush(stdout); - d = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()); + d = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()); WWDisplay_SetSpriteWindowX(d, x); WWDisplay_SetSpriteWindowY(d, y); WWDisplay_SetSpriteWindowWidth(d, w); WWDisplay_SetSpriteWindowHeight(d, h); - WonxDisplay_Flush(Wonx_GetWonxDisplay()); + WonXDisplay_Flush(WonX_GetWonXDisplay()); printf("call : sprite_set_window() : return value = none\n"); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return; } @@ -1013,15 +1013,15 @@ unsigned long int sprite_get_window(void) unsigned short int wh; unsigned long 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 : sprite_get_window() : \n"); fflush(stdout); - d = WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()); + d = WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()); xy = (((unsigned short int)WWDisplay_GetSpriteWindowY(d) << 8) & 0xff00) | @@ -1031,13 +1031,13 @@ unsigned long int sprite_get_window(void) ((unsigned short int)WWDisplay_GetSpriteWindowWidth(d) & 0x00ff); ret = ((unsigned long int)wh) << 16 | xy; - WonxDisplay_Sync(Wonx_GetWonxDisplay()); + WonXDisplay_Sync(WonX_GetWonXDisplay()); printf("call : sprite_get_window() : return value = 0x%08x\n", (int)ret); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return (ret); } @@ -1047,10 +1047,10 @@ void palette_set_color(unsigned int palette_num, unsigned int colors) int mapped_colors[4]; WWPalette palette; - if (!Wonx_IsCreated()) Wonx_Create(); + if (!WonX_IsCreated()) WonX_Create(); /* タイマを一時停止する */ - UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); printf("call : palette_set_color() : number = %u, colors = 0x%04x\n", (int)palette_num, (int)colors); fflush(stdout); @@ -1061,18 +1061,18 @@ void palette_set_color(unsigned int palette_num, unsigned int colors) mapped_colors[3] = (colors >> 12) & 0x07; palette = - WWDisplay_GetPalette(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()), + WWDisplay_GetPalette(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()), palette_num); WWPalette_SetMappedColors(palette, mapped_colors); - WonxDisplay_Flush(Wonx_GetWonxDisplay()); + WonXDisplay_Flush(WonX_GetWonXDisplay()); printf("call : palette_set_color() : return value = none\n"); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return; } @@ -1083,16 +1083,16 @@ unsigned int palette_get_color(unsigned int palette_num) WWPalette palette; unsigned short 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 : palette_get_color() : number = %u\n", (int)palette_num); fflush(stdout); palette = - WWDisplay_GetPalette(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay()), + WWDisplay_GetPalette(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay()), palette_num); WWPalette_GetMappedColors(palette, mapped_colors); @@ -1102,13 +1102,13 @@ unsigned int palette_get_color(unsigned int palette_num) ret |= (mapped_colors[2] & 0x07) << 8; ret |= (mapped_colors[3] & 0x07) << 12; - WonxDisplay_Sync(Wonx_GetWonxDisplay()); + WonXDisplay_Sync(WonX_GetWonXDisplay()); printf("call : palette_get_color() : return value = %u\n", (int)ret); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return (ret); } @@ -1118,10 +1118,10 @@ void lcd_set_color(unsigned int colors0, unsigned int colors1) WWColorMap color_map; int lcd_colors[8]; - if (!Wonx_IsCreated()) Wonx_Create(); + if (!WonX_IsCreated()) WonX_Create(); /* タイマを一時停止する */ - UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); printf("call : lcd_set_color() : colors0 = 0x%04x, colors1 = 0x%04x\n", (int)colors0, (int)colors1); fflush(stdout); @@ -1136,16 +1136,16 @@ void lcd_set_color(unsigned int colors0, unsigned int colors1) lcd_colors[7] = (colors1 >> 12) & 0x0f; color_map = - WWDisplay_GetColorMap(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay())); + WWDisplay_GetColorMap(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay())); WWColorMap_SetLCDColors(color_map, lcd_colors); - WonxDisplay_Flush(Wonx_GetWonxDisplay()); + WonXDisplay_Flush(WonX_GetWonXDisplay()); printf("call : lcd_set_color() : return value = none\n"); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return; } @@ -1156,15 +1156,15 @@ unsigned long int lcd_get_color(void) int lcd_colors[8]; unsigned long 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 : lcd_get_color() : \n"); fflush(stdout); color_map = - WWDisplay_GetColorMap(WonxDisplay_GetWWDisplay(Wonx_GetWonxDisplay())); + WWDisplay_GetColorMap(WonXDisplay_GetWWDisplay(WonX_GetWonXDisplay())); WWColorMap_GetLCDColors(color_map, lcd_colors); ret = 0; @@ -1177,115 +1177,115 @@ unsigned long int lcd_get_color(void) ret |= ((unsigned long int)lcd_colors[2] & 0x0f) << 8; ret |= ((unsigned long int)lcd_colors[3] & 0x0f) << 12; - WonxDisplay_Sync(Wonx_GetWonxDisplay()); + WonXDisplay_Sync(WonX_GetWonXDisplay()); printf("call : lcd_get_color() : return value = 0x%08x\n", (int)ret); fflush(stdout); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return (ret); } void lcd_set_segments(unsigned int segments) { - if (!Wonx_IsCreated()) Wonx_Create(); + if (!WonX_IsCreated()) WonX_Create(); /* タイマを一時停止する */ - UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); /* セグメント表示は未サポートか? */ - WonxDisplay_Flush(Wonx_GetWonxDisplay()); + WonXDisplay_Flush(WonX_GetWonXDisplay()); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return; } unsigned int lcd_get_segments(void) { - if (!Wonx_IsCreated()) Wonx_Create(); + if (!WonX_IsCreated()) WonX_Create(); /* タイマを一時停止する */ - UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); /* セグメント表示は未サポートか? */ - WonxDisplay_Sync(Wonx_GetWonxDisplay()); + WonXDisplay_Sync(WonX_GetWonXDisplay()); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return (0); } void lcd_set_sleep(unsigned int slp) { - if (!Wonx_IsCreated()) Wonx_Create(); + if (!WonX_IsCreated()) WonX_Create(); /* タイマを一時停止する */ - UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); /* ? */ - WonxDisplay_Sync(Wonx_GetWonxDisplay()); + WonXDisplay_Sync(WonX_GetWonXDisplay()); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return; } unsigned int lcd_get_sleep(void) { - if (!Wonx_IsCreated()) Wonx_Create(); + if (!WonX_IsCreated()) WonX_Create(); /* タイマを一時停止する */ - UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); /* ? */ - WonxDisplay_Sync(Wonx_GetWonxDisplay()); + WonXDisplay_Sync(WonX_GetWonXDisplay()); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return (0); } void screen_set_vram(int screen, int location_id) { - if (!Wonx_IsCreated()) Wonx_Create(); + if (!WonX_IsCreated()) WonX_Create(); /* タイマを一時停止する */ - UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); /* 未サポート */ - WonxDisplay_Sync(Wonx_GetWonxDisplay()); + WonXDisplay_Sync(WonX_GetWonXDisplay()); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return; } void sprite_set_vram(int location_id) { - if (!Wonx_IsCreated()) Wonx_Create(); + if (!WonX_IsCreated()) WonX_Create(); /* タイマを一時停止する */ - UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); /* 未サポート */ - WonxDisplay_Sync(Wonx_GetWonxDisplay()); + WonXDisplay_Sync(WonX_GetWonXDisplay()); /* タイマをもとに戻す */ - UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem())); + UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem())); return; } diff --git a/etc.c b/etc.c index 757580f..bb4e62e 100644 --- a/etc.c +++ b/etc.c @@ -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); diff --git a/etc.h b/etc.h index e3ca5e5..e13781c 100644 --- a/etc.h +++ b/etc.h @@ -5,7 +5,7 @@ /* エラー処理 */ /*===========================================================================*/ -int Wonx_Error(char * funcname, char * message); +int WonX_Error(char * funcname, char * message); /*===========================================================================*/ /* "true", "false" の文字列を返す */ diff --git a/key.c b/key.c index 670d0bb..821dd7f 100644 --- a/key.c +++ b/key.c @@ -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); } diff --git a/readline.pl b/readline.pl new file mode 100644 index 0000000..8f4d994 --- /dev/null +++ b/readline.pl @@ -0,0 +1,16 @@ +#!/usr/bin/perl + +use FileHandle; + +$file = @ARGV[0]; + +open(FILE, "$file"); +FILE->autoflush(); + +while () { + print "$_"; + STDOUT->autoflush(); + FILE->autoflush(); +} + +# End of program diff --git a/sample1.c b/sample1.c index b0cca64..001c12e 100644 --- a/sample1.c +++ b/sample1.c @@ -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. "); diff --git a/sound.c b/sound.c index 3393fd2..990f3f8 100644 --- a/sound.c +++ b/sound.c @@ -7,7 +7,7 @@ #include "wonx_include/sound.h" -#include "Wonx.h" +#include "WonX.h" /*****************************************************************************/ /* 互換関数の定義 */ diff --git a/sout2str.pl b/sout2str.pl new file mode 100644 index 0000000..002c79e --- /dev/null +++ b/sout2str.pl @@ -0,0 +1,16 @@ +#!/usr/bin/perl + +use FileHandle; + +while () { + 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 diff --git a/system.c b/system.c index 9406b7f..3438dda 100644 --- a/system.c +++ b/system.c @@ -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; } diff --git a/text.c b/text.c index 4f7d395..6d9c40a 100644 --- a/text.c +++ b/text.c @@ -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); } diff --git a/timer.c b/timer.c index fcbb4a7..582d319 100644 --- a/timer.c +++ b/timer.c @@ -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); } diff --git a/wonx_configure.h b/wonx_configure.h index 571d4ca..e749ddb 100644 --- a/wonx_configure.h +++ b/wonx_configure.h @@ -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秒単位) */