Added dump of RGB value when dumping palette data.
Fixed a part of the data dump part. Changed the line of perl script from / usr / bin / perl to / usr / local / bin / perl. (On FreeBSD, Japanese perl is in / usr / local / bin) For disp.c, libwwc.c, a function for reading and acquiring bitmap data of characters, The type of bitmap data is not unsigned char *, but instead of short int *, long int * It was modified to an appropriate type. Let the bitmap of the WWCharacter class be union of uchar, ushort, ulong, By accessing with an appropriate type in WWCharacter_GetPixel () The endian dependence of bitmap data is eliminated. (i386, confirmed by SPARC) Fixed how to get the value of WWCharacter_GetPixel () in 16 PACKED color mode. (The bug that the character was displayed inverted horizontally was resolved) Stop for 10 seconds at F11, forcibly end with Ctrl-c or F12, Added iconization with Ctrl-i. (It was a function that was originally, but I forgot that, We modified it somewhat to make it formal support) Move display / non-display change key from p to F10. Manual correction. XDisplay.c: generated with XColorGC_CreateFromRGB () with XDisplay_DrawLCDWindow () Since we did not Destroy () the XColorGC object, we made a bug that caused memory flow Fix. (XColorGC_Destroy (x_color_gc) addition) Add wonx_include / fcntl.h. The contents are / usr / include / fcntl.h, Just include /usr/include/sys/fcntl.h. Format change of serial output message (output to serial port:). (I tried to enclose it with "".) etc.c: wonx_print_character () Fixed. (Add \ ", \ \ and others) Fix sout2str.pl. (Add \ ", \ \ etc .... The above message for serial output It was modified according to format change) Added int2sint.pl, filters.pl, challsrc.sh. Change sys2wonx.pl. in wonx_include / types.h typedef unsigned short WORD; typedef unsigned long DWORD; To typedef unsigned short int WORD; typedef unsigned long int DWORD; change to. Fixed README. Version 2.1 - from wonx-2.1.tar.gz
This commit is contained in:
parent
d3f3c6903d
commit
d1cde9116a
57
HISTORY
57
HISTORY
@ -1,5 +1,62 @@
|
|||||||
|
2001/1/13(土)
|
||||||
|
|
||||||
|
wonx-2.1 公開
|
||||||
|
|
||||||
|
パレットデータのダンプ時に,RGB値もダンプするようにした.
|
||||||
|
データのダンプ部分を一部修正.
|
||||||
|
|
||||||
|
perl スクリプトの行頭を,/usr/bin/perl から /usr/local/bin/perl に変更.
|
||||||
|
(FreeBSD では,日本語 perl は /usr/local/bin に入るので)
|
||||||
|
|
||||||
|
disp.c, libwwc.c の,キャラクタのビットマップデータ読み込み用・取得用関数で,
|
||||||
|
ビットマップデータの型を unsigned char * でなく short int *, long int * などの
|
||||||
|
適切な型に修正した.
|
||||||
|
WWCharacter クラスのビットマップを,uchar, ushort, ulong の union とし,
|
||||||
|
WWCharacter_GetPixel() では適切な型でアクセスすることにより,
|
||||||
|
ビットマップデータのエンディアンの依存性を無くした.(i386, SPARC で確認済)
|
||||||
|
|
||||||
|
WWCharacter_GetPixel() の 16PACKED カラーモード時の値の取得方法を修正した.
|
||||||
|
(キャラクタが左右反転表示されていたバグが解消した)
|
||||||
|
|
||||||
|
F11 で10秒間停止,もしくは Ctrl-c もしくは F12 で強制終了,
|
||||||
|
Ctrl-i でアイコン化の追加.(もともとあった機能だったが,忘れてたのを,
|
||||||
|
多少修正して正式サポートにした)
|
||||||
|
|
||||||
|
表示/非表示の切替えキーを p から F10 に移動.マニュアル修正.
|
||||||
|
|
||||||
|
XDisplay.c:XDisplay_DrawLCDWindow() で,XColorGC_CreateFromRGB() で生成した
|
||||||
|
XColorGC オブジェクトを Destroy() していないので,メモリフローしていたバグを
|
||||||
|
修正.(XColorGC_Destroy(x_color_gc) 追加)
|
||||||
|
|
||||||
|
wonx_include/fcntl.h 追加.内容は,/usr/include/fcntl.h,
|
||||||
|
/usr/include/sys/fcntl.h をインクルードするだけ.
|
||||||
|
|
||||||
|
シリアル出力時のメッセージ(output to serial port : )の書式変更.
|
||||||
|
("" でくくるようにした)
|
||||||
|
etc.c:wonx_print_character() 修正.(\", \\ などを追加)
|
||||||
|
sout2str.pl 修正.(\", \\ などを追加.上記のシリアル出力時のメッセージの
|
||||||
|
書式変更にあわせて修正した)
|
||||||
|
|
||||||
|
int2sint.pl, filters.pl, challsrc.sh 追加.
|
||||||
|
sys2wonx.pl 変更.
|
||||||
|
|
||||||
|
wonx_include/types.h の
|
||||||
|
typedef unsigned short WORD;
|
||||||
|
typedef unsigned long DWORD;
|
||||||
|
を
|
||||||
|
typedef unsigned short int WORD;
|
||||||
|
typedef unsigned long int DWORD;
|
||||||
|
に変更.
|
||||||
|
|
||||||
|
README 修正.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
2001/1/3(水)
|
2001/1/3(水)
|
||||||
|
|
||||||
|
wonx-2.0 公開
|
||||||
|
|
||||||
カラー化対応.GCの管理用に,XColorGC クラスを追加.(XFireworks から流用した)
|
カラー化対応.GCの管理用に,XColorGC クラスを追加.(XFireworks から流用した)
|
||||||
|
|
||||||
カラー化に対応させて,transparent(透過色)の判定処理を WWPalette クラスから
|
カラー化に対応させて,transparent(透過色)の判定処理を WWPalette クラスから
|
||||||
|
|||||||
20
Makefile
20
Makefile
@ -2,8 +2,8 @@ XINCLUDEDIR = /usr/X11R6/include
|
|||||||
INCLUDEDIR = .
|
INCLUDEDIR = .
|
||||||
XLIBDIR = /usr/X11R6/lib
|
XLIBDIR = /usr/X11R6/lib
|
||||||
|
|
||||||
VERSION = WonX-2.0
|
VERSION = WonX-2.1
|
||||||
PKGNAME = wonx-2.0
|
PKGNAME = wonx-2.1
|
||||||
|
|
||||||
SMAC = smac-b02
|
SMAC = smac-b02
|
||||||
WWTERM = wwterm-b05
|
WWTERM = wwterm-b05
|
||||||
@ -41,9 +41,10 @@ smac : libwonx.a
|
|||||||
cp libwonx.a $(SMAC)
|
cp libwonx.a $(SMAC)
|
||||||
mv $(SMAC)/makefile $(SMAC)/makefile.orig
|
mv $(SMAC)/makefile $(SMAC)/makefile.orig
|
||||||
cp makefile_for_smac $(SMAC)/makefile
|
cp makefile_for_smac $(SMAC)/makefile
|
||||||
cp sys2wonx.pl $(SMAC)
|
cp challsrc.sh filters.pl sys2wonx.pl int2sint.pl $(SMAC)
|
||||||
echo "ここで止まったときは,sys2wonx.pl の1行目に適切なperlを指定してください"
|
# ここで止まったときは,filters.pl, sys2wonx.pl, int2sint.pl の
|
||||||
cd $(SMAC) ; ./sys2wonx.pl *.[ch]
|
# 1行目に適切なperlを指定してください"
|
||||||
|
cd $(SMAC) ; ./challsrc.sh *.[ch] makefile
|
||||||
cd $(SMAC) ; $(MAKE)
|
cd $(SMAC) ; $(MAKE)
|
||||||
|
|
||||||
wwterm : libwonx.a
|
wwterm : libwonx.a
|
||||||
@ -52,9 +53,10 @@ wwterm : libwonx.a
|
|||||||
cp libwonx.a $(WWTERM)
|
cp libwonx.a $(WWTERM)
|
||||||
mv $(WWTERM)/makefile $(WWTERM)/makefile.orig
|
mv $(WWTERM)/makefile $(WWTERM)/makefile.orig
|
||||||
cp makefile_for_wwterm $(WWTERM)/makefile
|
cp makefile_for_wwterm $(WWTERM)/makefile
|
||||||
cp sys2wonx.pl $(WWTERM)
|
cp challsrc.sh filters.pl sys2wonx.pl int2sint.pl $(WWTERM)
|
||||||
echo "ここで止まったときは,sys2wonx.pl の1行目に適切なperlを指定してください"
|
# ここで止まったときは,filters.pl, sys2wonx.pl, int2sint.pl の
|
||||||
cd $(WWTERM) ; ./sys2wonx.pl *.[ch]
|
# 1行目に適切なperlを指定してください"
|
||||||
|
cd $(WWTERM) ; ./challsrc.sh *.[ch] makefile
|
||||||
cd $(WWTERM) ; $(MAKE)
|
cd $(WWTERM) ; $(MAKE)
|
||||||
|
|
||||||
package :
|
package :
|
||||||
@ -62,7 +64,7 @@ package :
|
|||||||
rm -fR $(PKGNAME)/*
|
rm -fR $(PKGNAME)/*
|
||||||
mkdir -p $(PKGNAME)/wonx_include
|
mkdir -p $(PKGNAME)/wonx_include
|
||||||
cp COPYING COPYRIGHT HISTORY README MANUAL OMAKE.jpn Makefile \
|
cp COPYING COPYRIGHT HISTORY README MANUAL OMAKE.jpn Makefile \
|
||||||
makefile_for_smac makefile_for_wwterm *.pl \
|
makefile_for_smac makefile_for_wwterm *.sh *.pl \
|
||||||
*.h *.c $(SMAC).zip $(WWTERM).zip $(PKGNAME)
|
*.h *.c $(SMAC).zip $(WWTERM).zip $(PKGNAME)
|
||||||
cp wonx_include/*.h $(PKGNAME)/wonx_include
|
cp wonx_include/*.h $(PKGNAME)/wonx_include
|
||||||
tar cvzf $(PKGNAME).tar.gz $(PKGNAME)
|
tar cvzf $(PKGNAME).tar.gz $(PKGNAME)
|
||||||
|
|||||||
305
README
305
README
@ -2,29 +2,18 @@ WonX - WonderWitch on X.
|
|||||||
|
|
||||||
■ 配布に当たって
|
■ 配布に当たって
|
||||||
|
|
||||||
WonX はまだ不完全です.実装されていない機能や,不完全な機能,おかしな
|
ご意見,ご要望など歓迎します.どしどしお寄せください.
|
||||||
動作をする部分などがいっぱいあります.
|
|
||||||
バグ情報やアドバイスがあれば,作者の坂井弘亮まで,どんどんメールください.
|
バグ情報やアドバイスがあれば,作者の坂井弘亮まで,どんどんメールください.
|
||||||
アドレスは,
|
アドレスは,
|
||||||
sakai@seki.ee.kagu.sut.ac.jp
|
sakai@seki.ee.kagu.sut.ac.jp
|
||||||
hsakai@pfu.co.jp
|
hsakai@pfu.co.jp
|
||||||
です.
|
です.
|
||||||
|
(ただし,返事を書くとは限らないし,要望を反映するとも限りませんので
|
||||||
|
その点はご容赦ください)
|
||||||
また,坂井の気が向く限り,アップデートは随時行っていきます.
|
また,坂井の気が向く限り,アップデートは随時行っていきます.
|
||||||
http://www.seki.ee.kagu.sut.ac.jp/~sakai/WonderWitch/index.html
|
http://www.seki.ee.kagu.sut.ac.jp/~sakai/WonderWitch/index.html
|
||||||
で,随時公開していきます.
|
で,随時公開していきます.
|
||||||
|
|
||||||
現在は坂井が一人で製作していますが,ひとりでは細かい点の整合性
|
|
||||||
(初期化しなかった場合の動作の違いなど.WonderWitch と WonX では
|
|
||||||
微妙に異なっている)を追いきれないのが現状です.
|
|
||||||
とくにマニュアルに書いてない部分に関しては,WonderWitch ではどのように
|
|
||||||
動作するのか,ひとりではチェックしきれません.(ていうか面倒)
|
|
||||||
情報をお待ち(ていうか期待)しています.
|
|
||||||
いっしょに少しずつ,完全なものに仕上げていきましょう.
|
|
||||||
|
|
||||||
ご意見,ご要望なども歓迎します.どしどしお寄せください.
|
|
||||||
(ただし,返事を書くとは限らないし,要望を反映するとも限りませんので
|
|
||||||
その点はご容赦ください)
|
|
||||||
|
|
||||||
■ はじめに
|
■ はじめに
|
||||||
|
|
||||||
WonX は,WonderWitch 用のプログラムを X アプリケーションとしてコンパイルする
|
WonX は,WonderWitch 用のプログラムを X アプリケーションとしてコンパイルする
|
||||||
@ -51,6 +40,33 @@ WonX
|
|||||||
従って,WonderWitch での動作を模倣することよりも,デバッグ情報を
|
従って,WonderWitch での動作を模倣することよりも,デバッグ情報を
|
||||||
出力することや改造のしやすさを優先したような実装をする場合がある.
|
出力することや改造のしやすさを優先したような実装をする場合がある.
|
||||||
|
|
||||||
|
■ 必要なもの
|
||||||
|
|
||||||
|
WonX では,以下のものを使用しています.
|
||||||
|
|
||||||
|
・perl
|
||||||
|
(WonderWitch用ソースコード → WonX用ソースコードの変換用 perl スクリプトを
|
||||||
|
添付しているので,WonderWitch用ソースコードの中に漢字が入っているのならば,
|
||||||
|
日本語 perl が望ましい)
|
||||||
|
添付の perl スクリプトは,すべて #!/usr/local/bin/perl になっているので,
|
||||||
|
日本語 perl が別のところにあるばあいには,修正してから使用してください.
|
||||||
|
日本語 perl が無ければ,まあ,ふつうの perl でもたぶん大丈夫でしょう.
|
||||||
|
・qkc
|
||||||
|
漢字コード変換,改行コード変換に必要.
|
||||||
|
(nkf でもべつにいいんだけど,qkc だと改行コードも変換してくれるので,
|
||||||
|
この文書では qkc を使用しています)
|
||||||
|
qkc は,以下のサイトから入手できます.
|
||||||
|
http://hp.vector.co.jp/authors/VA000501/index.html
|
||||||
|
qkc には,MS-DOS 版,Windows 版,UNIX 版などがありますので,
|
||||||
|
UNIX 版(qkcc100.zip)を入手してください.
|
||||||
|
コンパイルは,make するだけなのでとっても簡単です.
|
||||||
|
・unzip
|
||||||
|
添付の smac-b02.zip, wwterm-b05.zip を解凍するのに必要.
|
||||||
|
|
||||||
|
このマニュアルは,以上のものがすべてインストールされていることを前提として
|
||||||
|
説明を進めます.必要ならばインストールするか,他のアプリケーションで
|
||||||
|
代用してください.
|
||||||
|
|
||||||
■ 3分WonX
|
■ 3分WonX
|
||||||
|
|
||||||
とりあえず,どんなものか見てみたいことでしょう.そんな人は,
|
とりあえず,どんなものか見てみたいことでしょう.そんな人は,
|
||||||
@ -88,16 +104,16 @@ WonX
|
|||||||
~/wonx/smac>% ./smac
|
~/wonx/smac>% ./smac
|
||||||
|
|
||||||
ウインドウが開いて,標準出力にメッセージが出力されます.
|
ウインドウが開いて,標準出力にメッセージが出力されます.
|
||||||
いったん p を押して画面描画を OFF にします.しばらくしたら
|
いったん F10 を押して画面描画を OFF にします.しばらくしたら
|
||||||
(メッセージの内容が変わったら) p を押して再び画面表示を ON にすると,
|
(メッセージの内容が変わったら) F10 を押して再び画面表示を ON にすると,
|
||||||
smac のタイトル画面が表示されます.
|
smac のタイトル画面が表示されます.
|
||||||
ここでスペースを押して,さらにまた p で画面表示を OFF にして,
|
ここでスペースを押して,さらにまた F10 で画面表示を OFF にして,
|
||||||
しばらくしたら(メッセージの内容が変わったら) p で画面表示を ON にします.
|
しばらくしたら(メッセージの内容が変わったら) F10 で画面表示を ON にします.
|
||||||
どうですか? SpeedMac のゲーム画面が表示されているでしょうか?
|
どうですか? SpeedMac のゲーム画面が表示されているでしょうか?
|
||||||
カーソルキーで移動,スペースキーで射撃です.
|
カーソルキーで移動,スペースキーで射撃です.
|
||||||
ただし,キー入力はキー入力用関数が呼ばれたときしか有効ではないので,
|
ただし,キー入力はキー入力用関数が呼ばれたときしか有効ではないので,
|
||||||
キーは反応するまで長めに押してください.
|
キーは反応するまで長めに押してください.
|
||||||
p を押して頻繁に描画の ON, OFF を切替えるのは,描画が非常に遅いため,
|
F10 を押して頻繁に描画の ON, OFF を切替えるのは,描画が非常に遅いため,
|
||||||
ONのままだと画面クリアとかに異常に時間がかかるからです.
|
ONのままだと画面クリアとかに異常に時間がかかるからです.
|
||||||
|
|
||||||
最後に,WonderWitch 用の端末エミュレータ "WWTerm" をコンパイル・実行
|
最後に,WonderWitch 用の端末エミュレータ "WWTerm" をコンパイル・実行
|
||||||
@ -106,7 +122,7 @@ ON
|
|||||||
~/wonx>% make wwterm
|
~/wonx>% make wwterm
|
||||||
(中略)
|
(中略)
|
||||||
~/wonx>% cd wwterm
|
~/wonx>% cd wwterm
|
||||||
~/wonx/smac>% ./terminal
|
~/wonx/wwterm>% ./terminal
|
||||||
|
|
||||||
■ 10分WonX
|
■ 10分WonX
|
||||||
|
|
||||||
@ -125,29 +141,40 @@ ON
|
|||||||
libwonx.a
|
libwonx.a
|
||||||
~/wonx>%
|
~/wonx>%
|
||||||
|
|
||||||
次に,libwonx.a と,wonx_include ディレクトリと,sys2wonx.pl を
|
次に,libwonx.a と,wonx_include ディレクトリと,
|
||||||
あなたの作ったプログラムのディレクトリ(ここでは例として,yoursample とします)
|
challsrc.sh, filters.pl, sys2wonx.pl, int2sint.pl をあなたの作ったプログラムの
|
||||||
にコピーします.
|
ディレクトリ(ここでは例として,yoursample とします)にコピーします.
|
||||||
|
|
||||||
~/wonx>% cp -R libwonx.a wonx_include sys2wonx.pl ../yoursample
|
~/wonx>% cp -R libwonx.a wonx_include ../yoursample
|
||||||
|
~/wonx>% cp challsrc.sh filters.pl sys2wonx.pl int2sint.pl ../yoursample
|
||||||
~/wonx>% cd ../yoursample
|
~/wonx>% cd ../yoursample
|
||||||
~/yoursample>%
|
~/yoursample>%
|
||||||
|
|
||||||
あなたの作ったプログラムのすべてのファイルを,MS-DOS テキスト形式から
|
|
||||||
UNIX のテキスト形式に変換します.(つまり,改行コードを \r\n から \n に
|
|
||||||
変換して,漢字コードを SJIS から EUC に変換します)
|
|
||||||
|
|
||||||
~/yoursample>% cat makefile | qkc -I -O -e -u > makefile.new
|
|
||||||
~/yoursample>% mv makefile.new makefile
|
|
||||||
~/yoursample>% cat sample.c | qkc -I -O -e -u > sample.c.new
|
|
||||||
~/yoursample>% mv sample.c.new sample.c
|
|
||||||
...(以下すべてのファイルについて,同様に繰り返し.中略)...
|
|
||||||
|
|
||||||
*.C というファイル名のファイルがあったら,*.c に変更します.
|
*.C というファイル名のファイルがあったら,*.c に変更します.
|
||||||
(*.C だと C++ のプログラムだと思われてしまうので)
|
(*.C だと C++ のプログラムだと思われてしまうので)
|
||||||
|
|
||||||
~/yoursample>% mv SAMPLE2.C sample2.c
|
~/yoursample>% mv SAMPLE2.C sample2.c
|
||||||
|
|
||||||
|
あなたの作ったプログラムのすべてのファイルに対して,以下のことを行います.
|
||||||
|
・MS-DOS テキスト形式から UNIX のテキスト形式に変換する.
|
||||||
|
(つまり,改行コードを \r\n から \n に変換して,漢字コードを SJIS から
|
||||||
|
EUC に変換します)
|
||||||
|
・プログラム中の #include <sys/disp.h> のようなのを,
|
||||||
|
#include "wonx_include/disp.h" に変更する.(sys2wonx.pl を通す)
|
||||||
|
・デフォルトの int を,short int に変換する.(int2sint.pl を通す)
|
||||||
|
これらのフィルタをまとめて通してくれる filters.pl というスクリプトを
|
||||||
|
添付してあるので,以下のようにして,すべてのソースファイルに対して,
|
||||||
|
必要なフィルタを通してください.
|
||||||
|
|
||||||
|
~/yoursample>% ./filters.pl "qkc -e -u" ./sys2wonx.pl ./int2sint.pl -f *.[ch] [Mm]akefile* MAKEFILE*
|
||||||
|
|
||||||
|
もしくは,以下のようにしてもよいです.
|
||||||
|
|
||||||
|
~/yoursample>% ./challsrc.sh *.[ch] [Mm]akefile* MAKEFILE*
|
||||||
|
|
||||||
|
(注意! filters.pl や challsrc.sh は,ファイルの本体を書き換えてしまうので,
|
||||||
|
変更されると困るようなファイルは必ずバックアップしてください)
|
||||||
|
|
||||||
makefile を以下のように修正する.
|
makefile を以下のように修正する.
|
||||||
・コンパイラには gcc を使用する.
|
・コンパイラには gcc を使用する.
|
||||||
・オブジェクトファイルを *.obj から *.o に変更.
|
・オブジェクトファイルを *.obj から *.o に変更.
|
||||||
@ -161,16 +188,6 @@ makefile
|
|||||||
添付の makefile_for_smac や makefile_for_wwterm を参考にして,makefile を
|
添付の makefile_for_smac や makefile_for_wwterm を参考にして,makefile を
|
||||||
修正してください.
|
修正してください.
|
||||||
|
|
||||||
次に,sys2wonx.pl をかけて,プログラム中の #include <sys/disp.h> のようなのを,
|
|
||||||
#include "wonx_include/disp.h" に変更する.
|
|
||||||
(注意! sys2wonx.pl は,ファイルの本体を書き換えてしまうので,変更されると
|
|
||||||
困るようなファイルは必ずバックアップしてください.
|
|
||||||
#include <sys/disp.h> のような部分が無いファイルの場合だと,読み込んで
|
|
||||||
そのまま出力するので,ファイルの内容自体は変わらないと思いますが,
|
|
||||||
日付は変わってしまいます)
|
|
||||||
|
|
||||||
~/yoursample>% ./sys2wonx.pl *.[ch]
|
|
||||||
|
|
||||||
最後に,make をします.
|
最後に,make をします.
|
||||||
|
|
||||||
~/yoursample>% make
|
~/yoursample>% make
|
||||||
@ -218,8 +235,9 @@ WonderWitch
|
|||||||
(ただし,コンフリクトしないという絶対の自信があるなら,この限りではありません)
|
(ただし,コンフリクトしないという絶対の自信があるなら,この限りではありません)
|
||||||
WonderWitch のプログラムの,#include <sys/*.h> は,すべて
|
WonderWitch のプログラムの,#include <sys/*.h> は,すべて
|
||||||
#include <wonx_include/*.h> に修正する必要がある,ということです.
|
#include <wonx_include/*.h> に修正する必要がある,ということです.
|
||||||
(これをまとめて行うための perl スクリプトを添付してあります.
|
(これをまとめて行うための sys2wonx.pl という perl スクリプトを添付して
|
||||||
sys2wonx.pl *.[ch] を実行すると,ごっそりと書き換えてくれます)
|
あります../filters.pl ./sys2wonx.pl -f *.[ch] を実行すると,ごっそりと
|
||||||
|
書き換えてくれます)
|
||||||
|
|
||||||
また,UNIXシステムによっては,/usr/include/sys/types.h で ushort, ulong を
|
また,UNIXシステムによっては,/usr/include/sys/types.h で ushort, ulong を
|
||||||
定義しているものといないものがあります.よって,コンパイル中に
|
定義しているものといないものがあります.よって,コンパイル中に
|
||||||
@ -276,12 +294,61 @@ SpeedMac
|
|||||||
~/wonx/smac-b02>% cp ../libwonx.a .
|
~/wonx/smac-b02>% cp ../libwonx.a .
|
||||||
~/wonx/smac-b02>%
|
~/wonx/smac-b02>%
|
||||||
|
|
||||||
3. makefile を修正する.
|
3. ソースを修正する.
|
||||||
|
|
||||||
|
~/wonx/smac-b02>% emacs chara.c
|
||||||
|
~/wonx/smac-b02>% emacs dsp.c
|
||||||
|
... (ファイルをひとつひとつ修正する)
|
||||||
|
|
||||||
|
MS-DOS のファイル形式になっているファイルは,UNIXのテキスト形式に
|
||||||
|
変換します.具体的には,以下の変換をします.
|
||||||
|
・改行コードを \r\n から \n にする.
|
||||||
|
・漢字コードを SJIS から EUC にする.
|
||||||
|
qkc というアプリケーションで,上記のことを一度に行うことができます.
|
||||||
|
面倒なかたは,以下のようにすれば,まとめて変換されます.
|
||||||
|
~/wonx/smac-b02>% ./filters.pl "qkc -e -u" -f *.[ch]
|
||||||
|
qkc が無い人は... nkf とかてきとうに使って変換してください.
|
||||||
|
|
||||||
|
また,ソース中の,
|
||||||
|
#include <sys/disp.h>
|
||||||
|
#include <sys/key.h>
|
||||||
|
のような部分を,
|
||||||
|
#include "wonx_include/disp.h"
|
||||||
|
#include "wonx_include/key.h"
|
||||||
|
のように修正します.
|
||||||
|
|
||||||
|
これをまとめてやるための perl スクリプト (sys2wonx.pl) を添付してあるので,
|
||||||
|
面倒なかたは,
|
||||||
|
~/wonx/smac-b02>% cp ../filters.pl ../sys2wonx.pl .
|
||||||
|
~/wonx/smac-b02>% ./filters.pl ./sys2wonx.pl -f *.[ch]
|
||||||
|
のようにしてください.
|
||||||
|
(filters.pl は,引数で指定したファイル自体を書き換えてしまうので注意)
|
||||||
|
|
||||||
|
さらに,WonderWitch では sizeof(int) == sizeof(short int) ですが,
|
||||||
|
UNIX ではふつうは sizeof(int) == sizeof(long int) なので,
|
||||||
|
キャラクタのビットマップなど,int 型のバイトサイズに依存する部分で
|
||||||
|
int を使用している場合には,short int などと明示します.
|
||||||
|
|
||||||
|
これをまとめてやるための perl スクリプト (int2sint.pl) を添付してあるので,
|
||||||
|
面倒なかたは,
|
||||||
|
~/wonx/smac-b02>% cp ../int2sint.pl .
|
||||||
|
~/wonx/smac-b02>% ./filters.pl ./int2sint.pl -f *.[ch]
|
||||||
|
のようにしてください.
|
||||||
|
(filters.pl は,引数で指定したファイル自体を書き換えてしまうので注意)
|
||||||
|
|
||||||
|
日本語 perl は EUC コードでないと正常に動作しないので,
|
||||||
|
sys2wonx.pl や int2sint.pl を使用する場合には,まず先に qkc で漢字コードを
|
||||||
|
EUC に変換してから,sys2wonx.pl や int2sint.pl を使用してください.
|
||||||
|
|
||||||
|
4. makefile を修正する.
|
||||||
|
|
||||||
~/wonx/smac-b02>% emacs makefile
|
~/wonx/smac-b02>% emacs makefile
|
||||||
|
|
||||||
以下のように修正します.
|
以下のように修正します.
|
||||||
|
|
||||||
|
・漢字コードを EUC に,改行コードを \r\n から \n に変換する.
|
||||||
|
(改行コードを変換しないと make が正常に動作しません.qkc を通すと
|
||||||
|
いいでしょう)
|
||||||
・gcc でコンパイルをするように修正する.このときに,コンパイルオプションに,
|
・gcc でコンパイルをするように修正する.このときに,コンパイルオプションに,
|
||||||
-I. -L. -L/usr/X11R6/lib -lwonx -lX11 -lXt
|
-I. -L. -L/usr/X11R6/lib -lwonx -lX11 -lXt
|
||||||
を追加する.
|
を追加する.
|
||||||
@ -295,27 +362,6 @@ SpeedMac
|
|||||||
|
|
||||||
のようにしてコピーしてください.
|
のようにしてコピーしてください.
|
||||||
|
|
||||||
4. ソースを修正する.
|
|
||||||
|
|
||||||
~/wonx/smac-b02>% emacs chara.c
|
|
||||||
~/wonx/smac-b02>% emacs dsp.c
|
|
||||||
... (ファイルをひとつひとつ修正する)
|
|
||||||
|
|
||||||
ソース中の,
|
|
||||||
#include <sys/disp.h>
|
|
||||||
#include <sys/key.h>
|
|
||||||
のような部分を,
|
|
||||||
#include "wonx_include/disp.h"
|
|
||||||
#include "wonx_include/key.h"
|
|
||||||
のように修正します.
|
|
||||||
|
|
||||||
これをまとめてやるための perl スクリプト (sys2wonx.pl) を添付してあるので,
|
|
||||||
面倒なかたは,
|
|
||||||
~/wonx/smac-b02>% cp ../sys2wonx.pl .
|
|
||||||
~/wonx/smac-b02>% ./sys2wonx.pl *.[ch]
|
|
||||||
のようにしてください.
|
|
||||||
(sys2wonx.pl は,引数で指定したファイル自体を書き換えてしまうので注意)
|
|
||||||
|
|
||||||
5. make する.
|
5. make する.
|
||||||
|
|
||||||
~/wonx/smac-b02>% make
|
~/wonx/smac-b02>% make
|
||||||
@ -351,12 +397,16 @@ smac
|
|||||||
・i,j,k,l キーが,WonderSwan のY1~Y4ボタンに対応している.
|
・i,j,k,l キーが,WonderSwan のY1~Y4ボタンに対応している.
|
||||||
・スペースバーと左シフトキーが,A,Bボタンに対応している.
|
・スペースバーと左シフトキーが,A,Bボタンに対応している.
|
||||||
・sキーが,STARTボタンに対応している.
|
・sキーが,STARTボタンに対応している.
|
||||||
・p を押すと,表示/非表示モードを切替える.
|
|
||||||
(非表示だと画面への描画を行わないが高速)
|
|
||||||
・F1 を押すと,LCDカラーマップのデータをダンプ出力する.
|
・F1 を押すと,LCDカラーマップのデータをダンプ出力する.
|
||||||
・F2 を押すと,パレットのデータをダンプ出力する.
|
・F2 を押すと,パレットのデータをダンプ出力する.
|
||||||
・F3 を押すと,キャラクターのデータをダンプ出力する.
|
・F3 を押すと,キャラクターのデータをダンプ出力する.
|
||||||
・F4 を押すと,スプライトのデータをダンプ出力する.
|
・F4 を押すと,スプライトのデータをダンプ出力する.
|
||||||
|
・F10 を押すと,表示/非表示モードを切替える.
|
||||||
|
(非表示だと画面への描画を行わないが高速)
|
||||||
|
・F11 で10秒間停止.(画面写真をとるときなどに利用できる)
|
||||||
|
(F11は短めに押してください.長めに押すと,復帰しなくなるようです)
|
||||||
|
・q もしくは Ctrl-c もしくは F12 で強制終了.
|
||||||
|
・Ctrl-i でアイコン化.
|
||||||
|
|
||||||
デフォルトではなにか関数が呼ばれるたびに画面の再描画を行うため,
|
デフォルトではなにか関数が呼ばれるたびに画面の再描画を行うため,
|
||||||
非常に低速です.
|
非常に低速です.
|
||||||
@ -369,8 +419,8 @@ for (y = 0; y < 32; y++)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
このような場合は,p を押して非表示モードにして,ループ処理が終ったら
|
このような場合は,F10 を押して非表示モードにして,ループ処理が終ったら
|
||||||
再び p を押して表示モードに戻してください.
|
再び F10 を押して表示モードに戻してください.
|
||||||
|
|
||||||
F1 や F2 を押すと,データをダンプ出力するのですが,標準ではその他にも
|
F1 や F2 を押すと,データをダンプ出力するのですが,標準ではその他にも
|
||||||
メッセージが大量に出力されているので,ふつうに F1 を押しただけでは,
|
メッセージが大量に出力されているので,ふつうに F1 を押しただけでは,
|
||||||
@ -383,7 +433,7 @@ smac
|
|||||||
もしもキャラクタ番号10番のキャラクタのデータだけが見たい場合には,
|
もしもキャラクタ番号10番のキャラクタのデータだけが見たい場合には,
|
||||||
以下のように実行してから,F3 キーを押せば良いでしょう.
|
以下のように実行してから,F3 キーを押せば良いでしょう.
|
||||||
|
|
||||||
> smac | grep "character\[10\]"
|
> smac | grep "character\[010\]"
|
||||||
|
|
||||||
WonX は,メッセージを出力する際に,grep でフィルタリングできるように,
|
WonX は,メッセージを出力する際に,grep でフィルタリングできるように,
|
||||||
かならず出力メッセージの先頭に,統一性のある文字列を追加しています.
|
かならず出力メッセージの先頭に,統一性のある文字列を追加しています.
|
||||||
@ -450,24 +500,56 @@ UNIX
|
|||||||
なりませんが,ビットマップの格納場所として使用するようなときには,
|
なりませんが,ビットマップの格納場所として使用するようなときには,
|
||||||
問題になります.
|
問題になります.
|
||||||
一番問題になりやすいのは,キャラクタのビットマップを扱う場合です.
|
一番問題になりやすいのは,キャラクタのビットマップを扱う場合です.
|
||||||
|
(bmpcnv を使用して,ビットマップデータの出力が unsigned int bitmap = {
|
||||||
|
のようになっている場合など)
|
||||||
font_set_colordata()などは,16*8 バイトのキャラクタデータを
|
font_set_colordata()などは,16*8 バイトのキャラクタデータを
|
||||||
short int 型の配列として引数に持ちます.WonderWitch では
|
short int 型の配列として引数に持ちます.WonderWitch では
|
||||||
sizeof(short int) == sizeof(int) なので,WonderWitch 用のプログラム上では,
|
sizeof(short int) == sizeof(int) なので,WonderWitch 用のプログラム上では,
|
||||||
キャラクタデータを short int とせずに,int 型の配列として定義してしまう
|
キャラクタデータを short int とせずに,int 型の配列として定義してしまう
|
||||||
ことが考えられます.(当然 WonderWitch ならば問題は無いが,UNIX 上で
|
ことが考えられます.(当然 WonderWitch ならば問題は無いが,UNIX 上で
|
||||||
実行したら,キャラクタに妙な縞々が入るだろうと思われる)
|
実行したら,キャラクタに妙な縞々が入るだろうと思われる)
|
||||||
このような場合には,UNIX 上でコンパイルするときには,short int に
|
このような場合には,UNIX 上でコンパイルするときには,コンパイラオプションで
|
||||||
修正する必要があります.
|
デフォルトの int は short int になるように指定するか,もしくはソース中の
|
||||||
|
int を short int にじかに修正する必要があります.i386 上で gcc を使用する
|
||||||
|
場合には,このようなコンパイラオプションは無いので,じかにソースを修正する
|
||||||
|
ことになります.
|
||||||
|
int2sint.pl を通すと,明示されていない int はすべて short int に変換しますが,
|
||||||
|
もしもあなたが int2sint.pl が信用できなければ,手で修正してください.ふつうは
|
||||||
|
キャラクタのビットマップデータとそれを扱う部分のみを修正すれば十分でしょう.
|
||||||
|
|
||||||
|
コンパイル時のワーニングもちゃんと確認してください.また,コンパイル時には
|
||||||
|
-Wall オプションをつけましょう.
|
||||||
|
wonx-2.1 からは,キャラクタのビットマップ設定関連(font_set_colordata()など)
|
||||||
|
の関数の引数は,適切な型のポインタに修正したので,コンパイラがワーニングを
|
||||||
|
出していたら,ビットマップデータの型がおかしいかもしれません.
|
||||||
|
|
||||||
|
単なるカウンタやフラグとして使用しているような int は,多くの場合は
|
||||||
|
short int でも long int でも動作は変わりませんが,たとえそうだとしても,
|
||||||
|
WonX を使用して,gcc で -Wall オプションをつけてコンパイルすると,
|
||||||
|
WonderWitch で動作させるときの潜在的なバグ(short int の上下限にまつわる
|
||||||
|
バグなど)を発見できることがあるので,なるべくなら int2sint.pl で int を
|
||||||
|
ごっそり short int にしてしまうことをおすすめします.
|
||||||
|
|
||||||
[エンディアンの問題]
|
[エンディアンの問題]
|
||||||
|
|
||||||
WonderWitch の CPU は x86系です.SPARC などで使用する場合には,
|
WonderWitch の CPU は x86系です.SPARC などで使用する場合には,
|
||||||
エンディアンに注意する必要があります.
|
エンディアンに注意する必要があります.
|
||||||
font_set_colordata()などは,short int 型の配列でキャラクタデータを受け取る
|
font_set_colordata()などは,short int 型の配列でキャラクタデータを受け取る
|
||||||
ので,char * で定義したキャラクタデータを short int * にキャストして
|
ので,unsigned char * で定義したキャラクタデータを short int * にキャストして
|
||||||
font_set_colordata()に渡すなどのことをしていると,画像がひっくり返る
|
font_set_colordata()に渡すなどのことをしていると,画像がひっくり返る
|
||||||
ことが考えられます.
|
ことが考えられます.
|
||||||
i386 系のいわゆる PC-UNIX ならば,おそらく問題は無いでしょう.
|
i386 系のいわゆる PC-UNIX ならば,おそらく問題は無いでしょう.
|
||||||
|
WonX-2.1 から,キャラクタデータに関しては,極力エンディアンに依存しないように
|
||||||
|
修正しました.i386 と SPARC でエンディアンに依存しないことを動作確認
|
||||||
|
しています.しかしそれでも,キャラクタデータを unsigned char * で定義して,
|
||||||
|
ビットマップ読み込み用の関数にキャラクタデータを渡すときに short int * に
|
||||||
|
キャストして渡すような書き方をしていると,依存してしまいます.
|
||||||
|
|
||||||
|
キャラクタデータのビットマップ読み込み用の関数には,適切な型のデータを
|
||||||
|
渡すようにしてください.short int * を渡すべきところに,unsigned char * を
|
||||||
|
渡したりすると,このようなバグの原因になる可能性があります.不適切な
|
||||||
|
ポインタを渡している場合には,コンパイラがワーニングを出すので,
|
||||||
|
コンパイラのワーニングに十分に注意してください.
|
||||||
|
|
||||||
[タイマ割り込みの問題]
|
[タイマ割り込みの問題]
|
||||||
|
|
||||||
@ -563,7 +645,7 @@ gcc -g -o smac $(OBJS) -lwonx -lX11 -lXt -L. -L/usr/X11R6/lib
|
|||||||
make がうまく動作しなかったり,コンパイルできてもプログラム自体が
|
make がうまく動作しなかったり,コンパイルできてもプログラム自体が
|
||||||
誤動作してしまい,しかも原因に気づきにくくなってしまう可能性があります.
|
誤動作してしまい,しかも原因に気づきにくくなってしまう可能性があります.
|
||||||
makefile やソースコードは必ず,
|
makefile やソースコードは必ず,
|
||||||
> cat makefile | qkc -I -O -e -u > makefile.tmp
|
> cat makefile | qkc -e -u > makefile.tmp
|
||||||
> mv makefile.tmp makefile
|
> mv makefile.tmp makefile
|
||||||
などを通して,UNIXのテキストファイルに変換しましょう.
|
などを通して,UNIXのテキストファイルに変換しましょう.
|
||||||
|
|
||||||
@ -703,6 +785,75 @@ WWSprite_PrintData(WWDisplay_GetSprite(ww_display, 0), stdout);
|
|||||||
のようにして不安なコードの前後でダンプデータを取ると,デバッグに
|
のようにして不安なコードの前後でダンプデータを取ると,デバッグに
|
||||||
役立つでしょう.
|
役立つでしょう.
|
||||||
|
|
||||||
|
■ 添付のツールについて
|
||||||
|
|
||||||
|
[sys2wonx.pl]
|
||||||
|
|
||||||
|
#include <sys/disp.h>
|
||||||
|
を,
|
||||||
|
#include "wonx_include/disp.h"
|
||||||
|
のように変換するフィルタです.
|
||||||
|
|
||||||
|
[int2sint.pl]
|
||||||
|
|
||||||
|
short か long か明示されていない int を,short int に変換します.
|
||||||
|
sizeof(int) や uint* も,sizeof(short int), unsigned short int* に
|
||||||
|
変換されます.
|
||||||
|
ただ,ひょっとしたらおかしな変換をしてしまうかも... でもたぶんそのときには
|
||||||
|
コンパイル時にエラーが出るだろうから,いいか.
|
||||||
|
そうだ.perl は行単位に処理するので,
|
||||||
|
long
|
||||||
|
int a;
|
||||||
|
とか,
|
||||||
|
void func(long
|
||||||
|
int a)
|
||||||
|
のような変な書き方をしていると,
|
||||||
|
long
|
||||||
|
short int a;
|
||||||
|
とか,
|
||||||
|
void func(long
|
||||||
|
short int a)
|
||||||
|
に変換されてしまって,きっとエラーになることでしょう.気をつけてください.
|
||||||
|
|
||||||
|
[filters.pl]
|
||||||
|
|
||||||
|
複数のフィルタをまとめて通すための perl スクリプトです.
|
||||||
|
書式は,
|
||||||
|
filters.pl [filters...] -f [files...]
|
||||||
|
です.例えば,
|
||||||
|
> filters.pl sort head -f file1 file2 file3
|
||||||
|
は,
|
||||||
|
> cat file1 | sort | head > file1.tmp
|
||||||
|
> mv file1.tmp file1
|
||||||
|
> cat file2 | sort | head > file2.tmp
|
||||||
|
> mv file2.tmp file2
|
||||||
|
> cat file3 | sort | head > file3.tmp
|
||||||
|
> mv file3.tmp file3
|
||||||
|
をすることと等価です.
|
||||||
|
|
||||||
|
[challsrc.sh]
|
||||||
|
|
||||||
|
WonderWitch用ソース → wonx用ソース への変換をするためのシェルスクリプトです.
|
||||||
|
内容は,単に,
|
||||||
|
./filters.pl "qkc -e -u" ./sys2wonx.pl ./int2sint.pl -f [files]
|
||||||
|
するだけです.
|
||||||
|
日本語 perl を使用する場合には,漢字コードは EUC でないと正常に動作しないので,
|
||||||
|
"qkc -e -u" を通してから ./sys2wonx.pl と ./int2sint.pl を
|
||||||
|
通すような順番になっています.
|
||||||
|
|
||||||
|
[sout2str.pl]
|
||||||
|
|
||||||
|
wonx は,シリアルポートへの出力は,
|
||||||
|
output to serial port : "A"
|
||||||
|
とか,
|
||||||
|
output to serial port : "\n"
|
||||||
|
のように,標準出力に出力します.sout2str.pl は,この "" でくくられた部分
|
||||||
|
のみを抽出して,\n や \t を適切なコードに変換して出力するフィルタです.
|
||||||
|
シリアルポートを使用するプログラム(例: wwterm)を起動するときには,
|
||||||
|
> wwterm | ./sout2str.pl
|
||||||
|
のようにして,sout2str.pl を通して起動することにより,実際のシリアルポート
|
||||||
|
への出力をモニタすることができます.
|
||||||
|
|
||||||
■ 作者
|
■ 作者
|
||||||
|
|
||||||
WonX は,坂井弘亮がその大部分を往復3時間の通勤電車の中で Libretto で書いた,
|
WonX は,坂井弘亮がその大部分を往復3時間の通勤電車の中で Libretto で書いた,
|
||||||
|
|||||||
158
WWCharacter.c
158
WWCharacter.c
@ -6,11 +6,16 @@
|
|||||||
|
|
||||||
#include "WWCharacterP.h"
|
#include "WWCharacterP.h"
|
||||||
#include "WonX.h"
|
#include "WonX.h"
|
||||||
|
#include "etc.h"
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* ¥á¥ó¥Ð´Ø¿ô¤ÎÄêµÁ */
|
/* ¥á¥ó¥Ð´Ø¿ô¤ÎÄêµÁ */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* ナンバーの操作 */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
int WWCharacter_GetNumber(WWCharacter c)
|
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.");
|
||||||
@ -28,26 +33,95 @@ int WWCharacter_SetNumber(WWCharacter c, int n)
|
|||||||
return (c->number = n);
|
return (c->number = n);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char WWCharacter_GetBitmap(WWCharacter c, int n)
|
/*===========================================================================*/
|
||||||
|
/* ビットマップの操作 */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/* char 型として操作するための関数 */
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
unsigned char WWCharacter_GetBitmapAsChar(WWCharacter c, int n)
|
||||||
{
|
{
|
||||||
if (c == NULL) WonX_Error("WWCharacter_GetBitmap", "WWCharacter is NULL.");
|
if (c == NULL)
|
||||||
|
WonX_Error("WWCharacter_GetBitmapAsChar", "WWCharacter is NULL.");
|
||||||
|
|
||||||
if ((n < 0) || (n > 32 - 1))
|
if ((n < 0) || (n > 32 - 1))
|
||||||
WonX_Error("WWCharacter_GetBitmap", "Invalid range.");
|
WonX_Error("WWCharacter_GetBitmapAsChar", "Invalid range.");
|
||||||
|
|
||||||
return (c->bitmap[n]);
|
return (c->bitmap.bitmap_char[n]);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char WWCharacter_SetBitmap(WWCharacter c, int n, unsigned char bitmap)
|
unsigned char WWCharacter_SetBitmapAsChar(WWCharacter c, int n,
|
||||||
|
unsigned char bitmap)
|
||||||
{
|
{
|
||||||
if (c == NULL) WonX_Error("WWCharacter_SetBitmap", "WWCharacter is NULL.");
|
if (c == NULL)
|
||||||
|
WonX_Error("WWCharacter_SetBitmapAsChar", "WWCharacter is NULL.");
|
||||||
|
|
||||||
if ((n < 0) || (n > 32 - 1))
|
if ((n < 0) || (n > 32 - 1))
|
||||||
WonX_Error("WWCharacter_SetBitmap", "Invalid range.");
|
WonX_Error("WWCharacter_SetBitmapAsChar", "Invalid range.");
|
||||||
|
|
||||||
return (c->bitmap[n] = bitmap);
|
return (c->bitmap.bitmap_char[n] = bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/* short int 型として操作するための関数 */
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
unsigned short int WWCharacter_GetBitmapAsShortInt(WWCharacter c, int n)
|
||||||
|
{
|
||||||
|
if (c == NULL)
|
||||||
|
WonX_Error("WWCharacter_GetBitmapAsShortInt", "WWCharacter is NULL.");
|
||||||
|
|
||||||
|
if ((n < 0) || (n > 16 - 1))
|
||||||
|
WonX_Error("WWCharacter_GetBitmapAsShortInt", "Invalid range.");
|
||||||
|
|
||||||
|
return (c->bitmap.bitmap_short_int[n]);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned short int WWCharacter_SetBitmapAsShortInt(WWCharacter c, int n,
|
||||||
|
unsigned short int bitmap)
|
||||||
|
{
|
||||||
|
if (c == NULL)
|
||||||
|
WonX_Error("WWCharacter_SetBitmapAsShortInt", "WWCharacter is NULL.");
|
||||||
|
|
||||||
|
if ((n < 0) || (n > 16 - 1))
|
||||||
|
WonX_Error("WWCharacter_SetBitmapAsShortInt", "Invalid range.");
|
||||||
|
|
||||||
|
return (c->bitmap.bitmap_short_int[n] = bitmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/* long int 型として操作するための関数 */
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
unsigned long int WWCharacter_GetBitmapAsLongInt(WWCharacter c, int n)
|
||||||
|
{
|
||||||
|
if (c == NULL)
|
||||||
|
WonX_Error("WWCharacter_GetBitmapAsLongInt", "WWCharacter is NULL.");
|
||||||
|
|
||||||
|
if ((n < 0) || (n > 8 - 1))
|
||||||
|
WonX_Error("WWCharacter_GetBitmapAsLongInt", "Invalid range.");
|
||||||
|
|
||||||
|
return (c->bitmap.bitmap_long_int[n]);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long int WWCharacter_SetBitmapAsLongInt(WWCharacter c, int n,
|
||||||
|
unsigned long int bitmap)
|
||||||
|
{
|
||||||
|
if (c == NULL)
|
||||||
|
WonX_Error("WWCharacter_SetBitmapAsLongInt", "WWCharacter is NULL.");
|
||||||
|
|
||||||
|
if ((n < 0) || (n > 8 - 1))
|
||||||
|
WonX_Error("WWCharacter_SetBitmapAsLongInt", "Invalid range.");
|
||||||
|
|
||||||
|
return (c->bitmap.bitmap_long_int[n] = bitmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* オブジェクトの生成と削除 */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
WWCharacter WWCharacter_Create(int number)
|
WWCharacter WWCharacter_Create(int number)
|
||||||
{
|
{
|
||||||
WWCharacter character;
|
WWCharacter character;
|
||||||
@ -70,10 +144,16 @@ WWCharacter WWCharacter_Destroy(WWCharacter character)
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* ピクセルの操作 */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
int WWCharacter_GetPixel(WWCharacter character, int x, int y,
|
int WWCharacter_GetPixel(WWCharacter character, int x, int y,
|
||||||
WWDisplay display)
|
WWDisplay display)
|
||||||
{
|
{
|
||||||
unsigned short int pixel;
|
unsigned short int pixel;
|
||||||
|
unsigned short int spixel;
|
||||||
|
unsigned long int lpixel;
|
||||||
|
|
||||||
if (character == NULL)
|
if (character == NULL)
|
||||||
WonX_Error("WWCharacter_GetPixel", "WWCharacter is NULL.");
|
WonX_Error("WWCharacter_GetPixel", "WWCharacter is NULL.");
|
||||||
@ -88,18 +168,38 @@ int WWCharacter_GetPixel(WWCharacter character, int x, int y,
|
|||||||
switch (WWDisplay_GetColorMode(display)) {
|
switch (WWDisplay_GetColorMode(display)) {
|
||||||
case COLOR_MODE_GRAYSCALE:
|
case COLOR_MODE_GRAYSCALE:
|
||||||
case COLOR_MODE_4COLOR:
|
case COLOR_MODE_4COLOR:
|
||||||
pixel = ((character->bitmap[y * 2 + 0] >> (7-x)) & 1) << 0;
|
spixel = (character->bitmap.bitmap_short_int[y] >> (7-x)) & 0x0101;
|
||||||
pixel |= ((character->bitmap[y * 2 + 1] >> (7-x)) & 1) << 1;
|
pixel =
|
||||||
|
((spixel & 0x0001) ? 1 : 0) |
|
||||||
|
((spixel & 0x0100) ? 2 : 0);
|
||||||
|
#if 0
|
||||||
|
pixel = ((character->bitmap.bitmap_char[y * 2 + 0] >> (7-x)) & 1) << 0;
|
||||||
|
pixel |= ((character->bitmap.bitmap_char[y * 2 + 1] >> (7-x)) & 1) << 1;
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case COLOR_MODE_16COLOR:
|
case COLOR_MODE_16COLOR:
|
||||||
|
lpixel = (character->bitmap.bitmap_long_int[y] >> (7-x)) & 0x01010101;
|
||||||
|
pixel =
|
||||||
|
((lpixel & 0x00000001) ? 1 : 0) |
|
||||||
|
((lpixel & 0x00000100) ? 2 : 0) |
|
||||||
|
((lpixel & 0x00010000) ? 4 : 0) |
|
||||||
|
((lpixel & 0x01000000) ? 8 : 0);
|
||||||
|
#if 0
|
||||||
pixel = ((character->bitmap[y * 4 + 0] >> (7-x)) & 1) << 0;
|
pixel = ((character->bitmap[y * 4 + 0] >> (7-x)) & 1) << 0;
|
||||||
pixel |= ((character->bitmap[y * 4 + 1] >> (7-x)) & 1) << 1;
|
pixel |= ((character->bitmap[y * 4 + 1] >> (7-x)) & 1) << 1;
|
||||||
pixel |= ((character->bitmap[y * 4 + 2] >> (7-x)) & 1) << 2;
|
pixel |= ((character->bitmap[y * 4 + 2] >> (7-x)) & 1) << 2;
|
||||||
pixel |= ((character->bitmap[y * 4 + 3] >> (7-x)) & 1) << 3;
|
pixel |= ((character->bitmap[y * 4 + 3] >> (7-x)) & 1) << 3;
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case COLOR_MODE_16PACKED:
|
case COLOR_MODE_16PACKED:
|
||||||
pixel = character->bitmap[y * 4 + (7-x) / 2] >> (((7-x) % 2) * 4);
|
lpixel = character->bitmap.bitmap_long_int[y];
|
||||||
|
lpixel = lpixel >> (3 - (7-x) / 2) * 8;
|
||||||
|
lpixel = lpixel >> ((7-x) % 2) * 4;
|
||||||
|
pixel = lpixel & 0x0f;
|
||||||
|
#if 0
|
||||||
|
pixel = character->bitmap[y * 4 + 3 - (7-x) / 2] >> (((7-x) % 2) * 4);
|
||||||
pixel &= 0x0f;
|
pixel &= 0x0f;
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
WonX_Error("WWCharacter_GetPixel", "Unknown color mode.");
|
WonX_Error("WWCharacter_GetPixel", "Unknown color mode.");
|
||||||
@ -113,7 +213,7 @@ int WWCharacter_ClearAllPixels(WWCharacter character)
|
|||||||
if (character == NULL)
|
if (character == NULL)
|
||||||
WonX_Error("WWCharacter_ClearAllPixels", "WWCharacter is NULL.");
|
WonX_Error("WWCharacter_ClearAllPixels", "WWCharacter is NULL.");
|
||||||
|
|
||||||
memset(character->bitmap, 0, 32);
|
memset(character->bitmap.bitmap_char, 0, 32);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@ -125,14 +225,19 @@ int WWCharacter_CopyAllPixels(WWCharacter dst, WWCharacter src)
|
|||||||
if (src == NULL)
|
if (src == NULL)
|
||||||
WonX_Error("WWCharacter_CopyAllPixel", "src is NULL.");
|
WonX_Error("WWCharacter_CopyAllPixel", "src is NULL.");
|
||||||
|
|
||||||
memcpy(dst->bitmap, src->bitmap, 32);
|
memcpy(dst->bitmap.bitmap_char, src->bitmap.bitmap_char, 32);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* 内部データ出力 */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
int WWCharacter_PrintData(WWCharacter character, WWDisplay display, FILE * f)
|
int WWCharacter_PrintData(WWCharacter character, WWDisplay display, FILE * f)
|
||||||
{
|
{
|
||||||
int i, x, y, n;
|
int i, x, y, n;
|
||||||
|
int pixel;
|
||||||
|
|
||||||
if (character == NULL)
|
if (character == NULL)
|
||||||
WonX_Error("WWCharacter_PrintData", "WWCharacter is NULL.");
|
WonX_Error("WWCharacter_PrintData", "WWCharacter is NULL.");
|
||||||
@ -141,27 +246,28 @@ int WWCharacter_PrintData(WWCharacter character, WWDisplay display, FILE * f)
|
|||||||
|
|
||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
|
|
||||||
fprintf(f, "character[%d] :\tnumber = %d\n",
|
fprintf(f, "character[%03d] :\tnumber = %d\n",
|
||||||
n, WWCharacter_GetNumber(character));
|
n, WWCharacter_GetNumber(character));
|
||||||
|
|
||||||
for (i = 0; i < 32; i += 8) {
|
for (i = 0; i < 32; i += 8) {
|
||||||
fprintf(f, "character[%d] :\tbitmap[%d] =", n, i);
|
fprintf(f, "character[%03d] :\tbitmap[%02d] =", n, i);
|
||||||
fprintf(f, " %02x", (int)WWCharacter_GetBitmap(character, i ));
|
fprintf(f, " %02x", (int)WWCharacter_GetBitmapAsChar(character, i ));
|
||||||
fprintf(f, " %02x", (int)WWCharacter_GetBitmap(character, i+1));
|
fprintf(f, " %02x", (int)WWCharacter_GetBitmapAsChar(character, i+1));
|
||||||
fprintf(f, " %02x", (int)WWCharacter_GetBitmap(character, i+2));
|
fprintf(f, " %02x", (int)WWCharacter_GetBitmapAsChar(character, i+2));
|
||||||
fprintf(f, " %02x", (int)WWCharacter_GetBitmap(character, i+3));
|
fprintf(f, " %02x", (int)WWCharacter_GetBitmapAsChar(character, i+3));
|
||||||
fprintf(f, " %02x", (int)WWCharacter_GetBitmap(character, i+4));
|
fprintf(f, " %02x", (int)WWCharacter_GetBitmapAsChar(character, i+4));
|
||||||
fprintf(f, " %02x", (int)WWCharacter_GetBitmap(character, i+5));
|
fprintf(f, " %02x", (int)WWCharacter_GetBitmapAsChar(character, i+5));
|
||||||
fprintf(f, " %02x", (int)WWCharacter_GetBitmap(character, i+6));
|
fprintf(f, " %02x", (int)WWCharacter_GetBitmapAsChar(character, i+6));
|
||||||
fprintf(f, " %02x", (int)WWCharacter_GetBitmap(character, i+7));
|
fprintf(f, " %02x", (int)WWCharacter_GetBitmapAsChar(character, i+7));
|
||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(f, "character[%d] :\tpixels : 01234567\n", n);
|
fprintf(f, "character[%03d] :\tpixels : 01234567\n", n);
|
||||||
for (y = 0; y < 8; y++) {
|
for (y = 0; y < 8; y++) {
|
||||||
fprintf(f, "character[%d] :\tpixels : %d ", n, y);
|
fprintf(f, "character[%03d] :\tpixels : %01d ", n, y);
|
||||||
for (x = 0; x < 8; x++) {
|
for (x = 0; x < 8; x++) {
|
||||||
fprintf(f, "%d", WWCharacter_GetPixel(character, x, y, display));
|
pixel = WWCharacter_GetPixel(character, x, y, display);
|
||||||
|
fprintf(f, "%c", wonx_dec_to_hex(pixel));
|
||||||
}
|
}
|
||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,19 +25,61 @@ typedef struct _WWCharacter * WWCharacter;
|
|||||||
/* ¥á¥ó¥Ð´Ø¿ô¤ÎÀë¸À */
|
/* ¥á¥ó¥Ð´Ø¿ô¤ÎÀë¸À */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* ナンバーの操作 */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
int WWCharacter_GetNumber(WWCharacter c);
|
int WWCharacter_GetNumber(WWCharacter c);
|
||||||
int WWCharacter_SetNumber(WWCharacter c, int n);
|
int WWCharacter_SetNumber(WWCharacter c, int n);
|
||||||
unsigned char WWCharacter_GetBitmap(WWCharacter c, int n);
|
|
||||||
unsigned char WWCharacter_SetBitmap(WWCharacter c, int n, unsigned char bitmap);
|
/*===========================================================================*/
|
||||||
|
/* ビットマップの操作 */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/* char 型として操作するための関数 */
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
unsigned char WWCharacter_GetBitmapAsChar(WWCharacter c, int n);
|
||||||
|
unsigned char WWCharacter_SetBitmapAsChar(WWCharacter c, int n,
|
||||||
|
unsigned char bitmap);
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/* short int 型として操作するための関数 */
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
unsigned short int WWCharacter_GetBitmapAsShortInt(WWCharacter c, int n);
|
||||||
|
unsigned short int WWCharacter_SetBitmapAsShortInt(WWCharacter c, int n,
|
||||||
|
unsigned short int bitmap);
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/* long int 型として操作するための関数 */
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
unsigned long int WWCharacter_GetBitmapAsLongInt(WWCharacter c, int n);
|
||||||
|
unsigned long int WWCharacter_SetBitmapAsLongInt(WWCharacter c, int n,
|
||||||
|
unsigned long int bitmap);
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* オブジェクトの生成と削除 */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
WWCharacter WWCharacter_Create(int number);
|
WWCharacter WWCharacter_Create(int number);
|
||||||
WWCharacter WWCharacter_Destroy(WWCharacter character);
|
WWCharacter WWCharacter_Destroy(WWCharacter character);
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* ピクセルの操作 */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
int WWCharacter_GetPixel(WWCharacter character, int x, int y,
|
int WWCharacter_GetPixel(WWCharacter character, int x, int y,
|
||||||
WWDisplay display);
|
WWDisplay display);
|
||||||
|
|
||||||
int WWCharacter_ClearAllPixels(WWCharacter character);
|
int WWCharacter_ClearAllPixels(WWCharacter character);
|
||||||
int WWCharacter_CopyAllPixels(WWCharacter dst, WWCharacter src);
|
int WWCharacter_CopyAllPixels(WWCharacter dst, WWCharacter src);
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* 内部データ出力 */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
int WWCharacter_PrintData(WWCharacter character, WWDisplay display, FILE * f);
|
int WWCharacter_PrintData(WWCharacter character, WWDisplay display, FILE * f);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|||||||
@ -15,7 +15,11 @@ typedef struct _WWCharacter {
|
|||||||
int number;
|
int number;
|
||||||
|
|
||||||
/* キャラクタのビットマップ */
|
/* キャラクタのビットマップ */
|
||||||
unsigned char bitmap[32];
|
union {
|
||||||
|
unsigned char bitmap_char[32];
|
||||||
|
unsigned short int bitmap_short_int[16];
|
||||||
|
unsigned long int bitmap_long_int[8];
|
||||||
|
} bitmap;
|
||||||
} _WWCharacter;
|
} _WWCharacter;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|||||||
@ -72,7 +72,7 @@ int WWColorMap_PrintData(WWColorMap c, FILE * f)
|
|||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
|
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
fprintf(f, "colormap :\tcolor[%d] = %d\n",
|
fprintf(f, "colormap :\tcolor[%01d] = %d\n",
|
||||||
i, WWColorMap_GetLCDColor(c, i));
|
i, WWColorMap_GetLCDColor(c, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
20
WWPalette.c
20
WWPalette.c
@ -137,12 +137,13 @@ int WWPalette_PrintData(WWPalette p, WWDisplay display, FILE * f)
|
|||||||
{
|
{
|
||||||
int i, n;
|
int i, n;
|
||||||
int transparent;
|
int transparent;
|
||||||
|
int red, green, blue;
|
||||||
|
|
||||||
n = WWPalette_GetNumber(p);
|
n = WWPalette_GetNumber(p);
|
||||||
|
|
||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
|
|
||||||
fprintf(f, "palette[%d] :\tnumber = %d\n", n, WWPalette_GetNumber(p));
|
fprintf(f, "palette[%02d] :\tnumber = %d\n", n, WWPalette_GetNumber(p));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* WonX-2.0 以降から,透明色の判定は WWDisplay で行うように変更したので,
|
* WonX-2.0 以降から,透明色の判定は WWDisplay で行うように変更したので,
|
||||||
@ -150,18 +151,29 @@ int WWPalette_PrintData(WWPalette p, WWDisplay display, FILE * f)
|
|||||||
*/
|
*/
|
||||||
#if 1
|
#if 1
|
||||||
transparent = WWDisplay_IsTransparent(display, p, 0);
|
transparent = WWDisplay_IsTransparent(display, p, 0);
|
||||||
fprintf(f, "palette[%d] :\ttransparent = %s\n",
|
fprintf(f, "palette[%02d] :\ttransparent = %s\n",
|
||||||
n, wonx_true_false(transparent));
|
n, wonx_true_false(transparent));
|
||||||
#else
|
#else
|
||||||
fprintf(f, "palette[%d] :\ttransparent = %s\n",
|
fprintf(f, "palette[%02d] :\ttransparent = %s\n",
|
||||||
n, wonx_true_false(WWPalette_GetTransparent(p)));
|
n, wonx_true_false(WWPalette_GetTransparent(p)));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
fprintf(f, "palette[%d] :\tcolor[%d] = %d\n",
|
fprintf(f, "palette[%02d] :\tcolor[%01d] = %d\n",
|
||||||
n, i, WWPalette_GetMappedColor(p, i));
|
n, i, WWPalette_GetMappedColor(p, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < 16; i++) {
|
||||||
|
red = WWPalette_GetRed( p, i);
|
||||||
|
green = WWPalette_GetGreen(p, i);
|
||||||
|
blue = WWPalette_GetBlue( p, i);
|
||||||
|
fprintf(f, "palette[%02d] :\tRGB[%02d] = 0x%c%c%c\n",
|
||||||
|
n, i,
|
||||||
|
wonx_dec_to_hex(red),
|
||||||
|
wonx_dec_to_hex(green),
|
||||||
|
wonx_dec_to_hex(blue));
|
||||||
|
}
|
||||||
|
|
||||||
fflush(f);
|
fflush(f);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
|||||||
18
WWSprite.c
18
WWSprite.c
@ -120,21 +120,21 @@ int WWSprite_PrintData(WWSprite s, FILE * f)
|
|||||||
|
|
||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
|
|
||||||
fprintf(f, "sprite[%d] :\tnumber = %d\n", n, WWSprite_GetNumber(s));
|
fprintf(f, "sprite[%03d] :\tnumber = %d\n", n, WWSprite_GetNumber(s));
|
||||||
fprintf(f, "sprite[%d] :\thorizontal = %s\n",
|
fprintf(f, "sprite[%03d] :\thorizontal = %s\n",
|
||||||
n, wonx_true_false(WWSprite_GetHorizontal(s)));
|
n, wonx_true_false(WWSprite_GetHorizontal(s)));
|
||||||
fprintf(f, "sprite[%d] :\tvertical = %s\n",
|
fprintf(f, "sprite[%03d] :\tvertical = %s\n",
|
||||||
n, wonx_true_false(WWSprite_GetVertical( s)));
|
n, wonx_true_false(WWSprite_GetVertical( s)));
|
||||||
fprintf(f, "sprite[%d] :\tpriority = %s\n",
|
fprintf(f, "sprite[%03d] :\tpriority = %s\n",
|
||||||
n, wonx_true_false(WWSprite_GetPriority( s)));
|
n, wonx_true_false(WWSprite_GetPriority( s)));
|
||||||
fprintf(f, "sprite[%d] :\tclipping = %s\n",
|
fprintf(f, "sprite[%03d] :\tclipping = %s\n",
|
||||||
n, wonx_true_false(WWSprite_GetClipping( s)));
|
n, wonx_true_false(WWSprite_GetClipping( s)));
|
||||||
fprintf(f, "sprite[%d] :\tpalette number = %d\n",
|
fprintf(f, "sprite[%03d] :\tpalette number = %d\n",
|
||||||
n, WWPalette_GetNumber(WWSprite_GetPalette(s)));
|
n, WWPalette_GetNumber(WWSprite_GetPalette(s)));
|
||||||
fprintf(f, "sprite[%d] :\tcharacter number = %d\n",
|
fprintf(f, "sprite[%03d] :\tcharacter number = %d\n",
|
||||||
n, WWCharacter_GetNumber(WWSprite_GetCharacter(s)));
|
n, WWCharacter_GetNumber(WWSprite_GetCharacter(s)));
|
||||||
fprintf(f, "sprite[%d] :\tx = %d\n", n, WWSprite_GetX(s));
|
fprintf(f, "sprite[%03d] :\tx = %d\n", n, WWSprite_GetX(s));
|
||||||
fprintf(f, "sprite[%d] :\ty = %d\n", n, WWSprite_GetY(s));
|
fprintf(f, "sprite[%03d] :\ty = %d\n", n, WWSprite_GetY(s));
|
||||||
|
|
||||||
fflush(f);
|
fflush(f);
|
||||||
|
|
||||||
|
|||||||
28
WWText.c
28
WWText.c
@ -73,9 +73,9 @@ int WWText_PutCharacter(WWText ww_text, int x, int y, int character,
|
|||||||
{
|
{
|
||||||
WWCharacter ww_character;
|
WWCharacter ww_character;
|
||||||
int j, k, n;
|
int j, k, n;
|
||||||
unsigned char pixel;
|
|
||||||
int f, b;
|
int f, b;
|
||||||
unsigned char bitmap[2];
|
unsigned short int pixel;
|
||||||
|
unsigned short int bitmap;
|
||||||
|
|
||||||
if ((character < 0) || (character > 127)) {
|
if ((character < 0) || (character > 127)) {
|
||||||
WonX_Warning("WWText_PutCharacter", "Character number is out of range.");
|
WonX_Warning("WWText_PutCharacter", "Character number is out of range.");
|
||||||
@ -122,15 +122,13 @@ int WWText_PutCharacter(WWText ww_text, int x, int y, int character,
|
|||||||
|
|
||||||
n = character * 8;
|
n = character * 8;
|
||||||
for (j = 0; j < 8; j++) {
|
for (j = 0; j < 8; j++) {
|
||||||
bitmap[0] = 0;
|
bitmap = 0;
|
||||||
bitmap[1] = 0;
|
|
||||||
for (k = 0; k < 8; k++) {
|
for (k = 0; k < 8; k++) {
|
||||||
pixel = (fonts[n] & (1 << k)) ? f : b;
|
pixel = (fonts[n] & (1 << k)) ? f : b;
|
||||||
bitmap[0] |= ( pixel & 1) << k;
|
bitmap |= ( pixel & 1) << k;
|
||||||
bitmap[1] |= ((pixel >> 1) & 1) << k;
|
bitmap |= ((pixel >> 1) & 1) << (k + 8);
|
||||||
}
|
}
|
||||||
WWCharacter_SetBitmap(ww_character, j*2 , bitmap[0]);
|
WWCharacter_SetBitmapAsShortInt(ww_character, j, bitmap);
|
||||||
WWCharacter_SetBitmap(ww_character, j*2+1, bitmap[1]);
|
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -155,9 +153,9 @@ WWText WWText_Create(WWScreen screen,
|
|||||||
WWText ww_text;
|
WWText ww_text;
|
||||||
WWCharacter ww_character;
|
WWCharacter ww_character;
|
||||||
int i, j, k, n;
|
int i, j, k, n;
|
||||||
unsigned char pixel;
|
|
||||||
int f, b;
|
int f, b;
|
||||||
unsigned char bitmap[2];
|
unsigned short int pixel;
|
||||||
|
unsigned short int bitmap;
|
||||||
|
|
||||||
ww_text = (WWText)malloc(sizeof(_WWText));
|
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.");
|
||||||
@ -181,15 +179,13 @@ WWText WWText_Create(WWScreen screen,
|
|||||||
for (i = 0; i < 128; i++) {
|
for (i = 0; i < 128; i++) {
|
||||||
ww_character = WWCharacter_Create(i);
|
ww_character = WWCharacter_Create(i);
|
||||||
for (j = 0; j < 8; j++) {
|
for (j = 0; j < 8; j++) {
|
||||||
bitmap[0] = 0;
|
bitmap = 0;
|
||||||
bitmap[1] = 0;
|
|
||||||
for (k = 0; k < 8; k++) {
|
for (k = 0; k < 8; k++) {
|
||||||
pixel = (fonts[n] & (1 << k)) ? f : b;
|
pixel = (fonts[n] & (1 << k)) ? f : b;
|
||||||
bitmap[0] |= ( pixel & 1) << k;
|
bitmap |= ( pixel & 1) << k;
|
||||||
bitmap[1] |= ((pixel >> 1) & 1) << k;
|
bitmap |= ((pixel >> 1) & 1) << (k + 8);
|
||||||
}
|
}
|
||||||
WWCharacter_SetBitmap(ww_character, j*2 , bitmap[0]);
|
WWCharacter_SetBitmapAsShortInt(ww_character, j, bitmap);
|
||||||
WWCharacter_SetBitmap(ww_character, j*2+1, bitmap[1]);
|
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
WWText_SetFont(ww_text, i, ww_character);
|
WWText_SetFont(ww_text, i, ww_character);
|
||||||
|
|||||||
17
Wonx2WonX.pl
17
Wonx2WonX.pl
@ -1,17 +0,0 @@
|
|||||||
#!/usr/bin/perl
|
|
||||||
|
|
||||||
while ($filename = shift(@ARGV)) {
|
|
||||||
open(RFILE, "< $filename");
|
|
||||||
open(WFILE, "> $filename.tmp");
|
|
||||||
while (<RFILE>) {
|
|
||||||
if (/Wonx/) {
|
|
||||||
print $_;
|
|
||||||
s/Wonx/WonX/g;
|
|
||||||
print $_;
|
|
||||||
}
|
|
||||||
print WFILE $_;
|
|
||||||
}
|
|
||||||
close(RFILE);
|
|
||||||
close(WFILE);
|
|
||||||
system("mv $filename.tmp $filename");
|
|
||||||
}
|
|
||||||
54
XDisplay.c
54
XDisplay.c
@ -74,16 +74,16 @@ static void iconify(Widget w, XEvent * event, String * params, Cardinal * num)
|
|||||||
XIconifyWindow(XtDisplay(w), XtWindow(w), DefaultScreen(XtDisplay(w)));
|
XIconifyWindow(XtDisplay(w), XtWindow(w), DefaultScreen(XtDisplay(w)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sleep_3(Widget w, XEvent * event, String * params, Cardinal * num)
|
static void sleep_10(Widget w, XEvent * event, String * params, Cardinal * num)
|
||||||
{
|
{
|
||||||
time_t old_t;
|
time_t old_t;
|
||||||
time_t t;
|
time_t t;
|
||||||
int i;
|
int i;
|
||||||
/* UNIXTimer.c 内部で SIGALRM を使用しているので,sleep() は使用できない */
|
/* UNIXTimer.c 内部で SIGALRM を使用しているので,sleep() は使用できない */
|
||||||
#if 0
|
#if 0
|
||||||
sleep(3);
|
sleep(10);
|
||||||
#else
|
#else
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 10; i++) {
|
||||||
time(&t);
|
time(&t);
|
||||||
old_t = t;
|
old_t = t;
|
||||||
while (t == old_t)
|
while (t == old_t)
|
||||||
@ -96,14 +96,15 @@ static XtActionsRec actions[] = {
|
|||||||
{"quit", quit},
|
{"quit", quit},
|
||||||
{"wm_protocols_proc", wm_protocols_proc},
|
{"wm_protocols_proc", wm_protocols_proc},
|
||||||
{"iconify", iconify},
|
{"iconify", iconify},
|
||||||
{"pause", sleep_3}
|
{"pause", sleep_10}
|
||||||
};
|
};
|
||||||
|
|
||||||
static char * translations =
|
static char * translations =
|
||||||
"<Message>WM_PROTOCOLS: wm_protocols_proc()\n"
|
"<Message>WM_PROTOCOLS: wm_protocols_proc()\n"
|
||||||
"None<Key>p: pause()\n"
|
"None<Key>F11: pause()\n"
|
||||||
"Ctrl<Key>i: iconify()\n"
|
"Ctrl<Key>i: iconify()\n"
|
||||||
"Ctrl<Key>c: quit()\n"
|
"Ctrl<Key>c: quit()\n"
|
||||||
|
"None<Key>F12: quit()\n"
|
||||||
"None<Key>q: quit()";
|
"None<Key>q: quit()";
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
@ -123,6 +124,21 @@ static unsigned long XDisplay_GetPixelFromColorName(XDisplay x_display,
|
|||||||
/* イベントハンドラ */
|
/* イベントハンドラ */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/* ¥¤¥¯¥¹¥Ý¡¼¥º */
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void ExposeHandler(Widget w, XtPointer p, XEvent * event,
|
||||||
|
Boolean * dispatch)
|
||||||
|
{
|
||||||
|
XDisplay x_display = (XDisplay)p;
|
||||||
|
|
||||||
|
XCopyArea(x_display->display, x_display->lcd_pixmap,
|
||||||
|
x_display->lcd_window, x_display->copy_gc,
|
||||||
|
0, 0, x_display->width, x_display->height, 0, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* キーの押下 */
|
/* キーの押下 */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
@ -161,10 +177,16 @@ static void KeyHandler(Widget w, XtPointer p, XEvent * event,
|
|||||||
switch (key_sym) {
|
switch (key_sym) {
|
||||||
|
|
||||||
/* 表示モード変更 */
|
/* 表示モード変更 */
|
||||||
case XK_p :
|
case XK_F10 :
|
||||||
x_display->lcd_draw = !(x_display->lcd_draw);
|
x_display->lcd_draw = !(x_display->lcd_draw);
|
||||||
if (x_display->lcd_draw)
|
|
||||||
|
if (x_display->lcd_draw) {
|
||||||
|
#if 1
|
||||||
WonXDisplay_Flush(WonX_GetWonXDisplay());
|
WonXDisplay_Flush(WonX_GetWonXDisplay());
|
||||||
|
#else
|
||||||
|
ExposeHandler(w, p, event, dispatch);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* データのダンプ操作 */
|
/* データのダンプ操作 */
|
||||||
@ -184,21 +206,6 @@ static void KeyHandler(Widget w, XtPointer p, XEvent * event,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* ¥¤¥¯¥¹¥Ý¡¼¥º */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
static void ExposeHandler(Widget w, XtPointer p, XEvent * event,
|
|
||||||
Boolean * dispatch)
|
|
||||||
{
|
|
||||||
XDisplay x_display = (XDisplay)p;
|
|
||||||
|
|
||||||
XCopyArea(x_display->display, x_display->lcd_pixmap,
|
|
||||||
x_display->lcd_window, x_display->copy_gc,
|
|
||||||
0, 0, x_display->width, x_display->height, 0, 0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* マウスがウインドウを離れたら,キーを初期化する */
|
/* マウスがウインドウを離れたら,キーを初期化する */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
@ -407,7 +414,7 @@ int XDisplay_DrawLCDWindow(XDisplay x_display, WWDisplay ww_display,
|
|||||||
int n[16];
|
int n[16];
|
||||||
XRectangle rectangle;
|
XRectangle rectangle;
|
||||||
XRectangle * rectangles[16];
|
XRectangle * rectangles[16];
|
||||||
int pixel;
|
unsigned short int pixel;
|
||||||
int ww_lcd_width, ww_lcd_height;
|
int ww_lcd_width, ww_lcd_height;
|
||||||
int red, green, blue;
|
int red, green, blue;
|
||||||
XColorGCDatabase database;
|
XColorGCDatabase database;
|
||||||
@ -534,6 +541,7 @@ int XDisplay_DrawLCDWindow(XDisplay x_display, WWDisplay ww_display,
|
|||||||
rectangle.y,
|
rectangle.y,
|
||||||
rectangle.width,
|
rectangle.width,
|
||||||
rectangle.height);
|
rectangle.height);
|
||||||
|
XColorGC_Destroy(x_color_gc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
4
challsrc.sh
Normal file
4
challsrc.sh
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
./filters.pl "qkc -e -u" ./sys2wonx.pl ./int2sint.pl -f $*
|
||||||
|
|
||||||
12
comm.c
12
comm.c
@ -165,9 +165,9 @@ int comm_send_char(unsigned char c)
|
|||||||
if (!UNIXSerialPort_IsOpened(unix_serial_port))
|
if (!UNIXSerialPort_IsOpened(unix_serial_port))
|
||||||
WonX_Error("comm_send_char", "UNIX serial port is not opened.");
|
WonX_Error("comm_send_char", "UNIX serial port is not opened.");
|
||||||
|
|
||||||
printf("output to serial port : ");
|
printf("output to serial port : \"");
|
||||||
comm_output(c);
|
comm_output(c);
|
||||||
printf("\n");
|
printf("\"\n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
@ -292,11 +292,11 @@ int comm_send_string(char * string)
|
|||||||
if (!UNIXSerialPort_IsOpened(unix_serial_port))
|
if (!UNIXSerialPort_IsOpened(unix_serial_port))
|
||||||
WonX_Error("comm_send_string", "UNIX serial port is not opened.");
|
WonX_Error("comm_send_string", "UNIX serial port is not opened.");
|
||||||
|
|
||||||
printf("output to serial port : ");
|
printf("output to serial port : \"");
|
||||||
for (i = 0; string[i]; i++) {
|
for (i = 0; string[i]; i++) {
|
||||||
comm_output(string[i]);
|
comm_output(string[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\"\n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
@ -336,11 +336,11 @@ int comm_send_block(void * buffer, int size)
|
|||||||
if (!UNIXSerialPort_IsOpened(unix_serial_port))
|
if (!UNIXSerialPort_IsOpened(unix_serial_port))
|
||||||
WonX_Error("comm_send_block", "UNIX serial port is not opened.");
|
WonX_Error("comm_send_block", "UNIX serial port is not opened.");
|
||||||
|
|
||||||
printf("output to serial port : ");
|
printf("output to serial port : \"");
|
||||||
for (i = 0; i < size; i++) {
|
for (i = 0; i < size; i++) {
|
||||||
comm_output(((char *)buffer)[i]);
|
comm_output(((char *)buffer)[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\"\n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
|
|||||||
35
disp.c
35
disp.c
@ -137,8 +137,7 @@ unsigned int display_status(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void * data だと,まちがって int * でデータを指定するようなバグが
|
* data は char × 8 で 8 バイト.
|
||||||
* 入る可能性があるので,unsigned char * data にした.
|
|
||||||
*/
|
*/
|
||||||
void font_set_monodata(unsigned int number, unsigned int count,
|
void font_set_monodata(unsigned int number, unsigned int count,
|
||||||
unsigned char * data)
|
unsigned char * data)
|
||||||
@ -146,9 +145,9 @@ void font_set_monodata(unsigned int number, unsigned int count,
|
|||||||
WWCharacter ww_character;
|
WWCharacter ww_character;
|
||||||
WWDisplay ww_display;
|
WWDisplay ww_display;
|
||||||
int i, j, k, n;
|
int i, j, k, n;
|
||||||
unsigned char pixel;
|
|
||||||
int f, b;
|
int f, b;
|
||||||
unsigned char bitmap[2];
|
unsigned short int pixel;
|
||||||
|
unsigned short int bitmap;
|
||||||
|
|
||||||
if (!WonX_IsCreated()) WonX_Create();
|
if (!WonX_IsCreated()) WonX_Create();
|
||||||
|
|
||||||
@ -168,15 +167,13 @@ void font_set_monodata(unsigned int number, unsigned int count,
|
|||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
ww_character = WWDisplay_GetCharacter(ww_display, number + i);
|
ww_character = WWDisplay_GetCharacter(ww_display, number + i);
|
||||||
for (j = 0; j < 8; j++) {
|
for (j = 0; j < 8; j++) {
|
||||||
bitmap[0] = 0;
|
bitmap = 0;
|
||||||
bitmap[1] = 0;
|
|
||||||
for (k = 0; k < 8; k++) {
|
for (k = 0; k < 8; k++) {
|
||||||
pixel = (data[n] & (1 << k)) ? f : b;
|
pixel = (data[n] & (1 << k)) ? f : b;
|
||||||
bitmap[0] |= ( pixel & 1) << k;
|
bitmap |= ( pixel & 1) << k;
|
||||||
bitmap[1] |= ((pixel >> 1) & 1) << k;
|
bitmap |= ((pixel >> 1) & 1) << (k + 8);
|
||||||
}
|
}
|
||||||
WWCharacter_SetBitmap(ww_character, j*2 , bitmap[0]);
|
WWCharacter_SetBitmapAsShortInt(ww_character, j, bitmap);
|
||||||
WWCharacter_SetBitmap(ww_character, j*2+1, bitmap[1]);
|
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,11 +190,10 @@ void font_set_monodata(unsigned int number, unsigned int count,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void * data だと,まちがって int * でデータを指定するようなバグが
|
* data は short int × 8 で 16 バイト.
|
||||||
* 入る可能性があるので,unsigned char * data にした.
|
|
||||||
*/
|
*/
|
||||||
void font_set_colordata(unsigned int number, unsigned int count,
|
void font_set_colordata(unsigned int number, unsigned int count,
|
||||||
unsigned char * data)
|
unsigned short int * data)
|
||||||
{
|
{
|
||||||
WWCharacter ww_character;
|
WWCharacter ww_character;
|
||||||
WWDisplay ww_display;
|
WWDisplay ww_display;
|
||||||
@ -217,8 +213,8 @@ void font_set_colordata(unsigned int number, unsigned int count,
|
|||||||
n = 0;
|
n = 0;
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
ww_character = WWDisplay_GetCharacter(ww_display, number + i);
|
ww_character = WWDisplay_GetCharacter(ww_display, number + i);
|
||||||
for (j = 0; j < 16; j++) {
|
for (j = 0; j < 8; j++) {
|
||||||
WWCharacter_SetBitmap(ww_character, j, data[n]);
|
WWCharacter_SetBitmapAsShortInt(ww_character, j, data[n]);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -235,11 +231,10 @@ void font_set_colordata(unsigned int number, unsigned int count,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void * data だと,まちがって int * でデータを指定するようなバグが
|
* data は short int × 8 で 16 バイト.
|
||||||
* 入る可能性があるので,unsigned char * data にした.
|
|
||||||
*/
|
*/
|
||||||
void font_get_data(unsigned int number, unsigned int count,
|
void font_get_data(unsigned int number, unsigned int count,
|
||||||
unsigned char * data)
|
unsigned short int * data)
|
||||||
{
|
{
|
||||||
/* 関数の仕様がわからんので適当に書くぞ */
|
/* 関数の仕様がわからんので適当に書くぞ */
|
||||||
WWCharacter ww_character;
|
WWCharacter ww_character;
|
||||||
@ -260,8 +255,8 @@ void font_get_data(unsigned int number, unsigned int count,
|
|||||||
n = 0;
|
n = 0;
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
ww_character = WWDisplay_GetCharacter(ww_display, number + i);
|
ww_character = WWDisplay_GetCharacter(ww_display, number + i);
|
||||||
for (j = 0; j < 16; j++) {
|
for (j = 0; j < 8; j++) {
|
||||||
data[n] = WWCharacter_GetBitmap(ww_character, j);
|
data[n] = WWCharacter_GetBitmapAsShortInt(ww_character, j);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
14
etc.c
14
etc.c
@ -22,9 +22,23 @@ int wonx_print_character(FILE * fp, unsigned char c)
|
|||||||
if (c == '\n') fprintf(fp, "\\n");
|
if (c == '\n') fprintf(fp, "\\n");
|
||||||
else if (c == '\r') fprintf(fp, "\\r");
|
else if (c == '\r') fprintf(fp, "\\r");
|
||||||
else if (c == '\t') fprintf(fp, "\\t");
|
else if (c == '\t') fprintf(fp, "\\t");
|
||||||
|
else if (c == '\"') fprintf(fp, "\\\"");
|
||||||
|
else if (c == '\'') fprintf(fp, "\\\'");
|
||||||
|
else if (c == '\\') fprintf(fp, "\\\\");
|
||||||
else if (c == ' ' ) fprintf(fp, "\\s");
|
else if (c == ' ' ) fprintf(fp, "\\s");
|
||||||
else if (isprint(c)) fputc(c, fp);
|
else if (isprint(c)) fputc(c, fp);
|
||||||
else fprintf(fp, "^%02x", (int)c);
|
else fprintf(fp, "^%02x", (int)c);
|
||||||
fflush(fp);
|
fflush(fp);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* 10進→16進文字への変換 */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
char wonx_dec_to_hex(int dec)
|
||||||
|
{
|
||||||
|
static char * dec2hex = "0123456789abcdef";
|
||||||
|
return (dec2hex[dec]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
6
etc.h
6
etc.h
@ -16,4 +16,10 @@ char * wonx_true_false(int b);
|
|||||||
|
|
||||||
int wonx_print_character(FILE * fp, unsigned char c);
|
int wonx_print_character(FILE * fp, unsigned char c);
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* 10進→16進文字への変換 */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
char wonx_dec_to_hex(int dec);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
16
filters.pl
Normal file
16
filters.pl
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/local/bin/perl
|
||||||
|
|
||||||
|
while ($_ = shift(@ARGV)) {
|
||||||
|
if ($_ eq "-f" ) { last; }
|
||||||
|
if ($_ eq "-file") { last; }
|
||||||
|
$filters = "$filters | $_";
|
||||||
|
}
|
||||||
|
|
||||||
|
while ($filename = shift(@ARGV)) {
|
||||||
|
$command = "cat $filename$filters > $filename.tmp";
|
||||||
|
print "$command\n";
|
||||||
|
system($command);
|
||||||
|
$command = "mv $filename.tmp $filename";
|
||||||
|
print "$command\n";
|
||||||
|
system($command);
|
||||||
|
}
|
||||||
19
int2sint.pl
Normal file
19
int2sint.pl
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#!/usr/local/bin/perl
|
||||||
|
|
||||||
|
while (<STDIN>) {
|
||||||
|
s/([\s;\}\/])uint(\s)/$1unsigned int$2/g;
|
||||||
|
s/^uint(\s)/unsigned int$1/g;
|
||||||
|
|
||||||
|
s/([\s;\}\/\(\)])long(\s+)int([\s\)\+\-\*\/])/$1_WONX_LONG_$2_WONX_INT_$3/g;
|
||||||
|
s/([\s;\}\/\(\)])short(\s+)int([\s\)\+\-\*\/])/$1_WONX_SHORT_$2_WONX_INT_$3/g;
|
||||||
|
s/^long(\s+)int([\s\)\+\-\*\/])/_WONX_LONG_$1_WONX_INT_$2/g;
|
||||||
|
s/^short(\s+)int([\s\)\+\-\*\/])/_WONX_SHORT_$1_WONX_INT_$2/g;
|
||||||
|
|
||||||
|
s/([\s;\}\/\(\)])int([\s\)\+\-\*\/])/$1_WONX_SHORT_ _WONX_INT_$2/g;
|
||||||
|
s/^int([\s\)\+\-\*\/])/_WONX_SHORT_ _WONX_INT_$1/g;
|
||||||
|
|
||||||
|
s/_WONX_LONG_/long/g;
|
||||||
|
s/_WONX_SHORT_/short/g;
|
||||||
|
s/_WONX_INT_/int/g;
|
||||||
|
print $_;
|
||||||
|
}
|
||||||
22
libwwc.c
22
libwwc.c
@ -175,7 +175,12 @@ unsigned int wwc_palette_get_color(unsigned int palette_num, unsigned int color_
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wwc_font_set_colordata(unsigned int number, unsigned int count, unsigned char * data)
|
/*
|
||||||
|
* data は long int × 8 で 32 バイト.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void wwc_font_set_colordata(unsigned int number, unsigned int count,
|
||||||
|
unsigned long int * data)
|
||||||
{
|
{
|
||||||
WWCharacter ww_character;
|
WWCharacter ww_character;
|
||||||
WWDisplay ww_display;
|
WWDisplay ww_display;
|
||||||
@ -195,8 +200,8 @@ void wwc_font_set_colordata(unsigned int number, unsigned int count, unsigned ch
|
|||||||
n = 0;
|
n = 0;
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
ww_character = WWDisplay_GetCharacter(ww_display, number + i);
|
ww_character = WWDisplay_GetCharacter(ww_display, number + i);
|
||||||
for (j = 0; j < 32; j++) {
|
for (j = 0; j < 8; j++) {
|
||||||
WWCharacter_SetBitmap(ww_character, j, data[n]);
|
WWCharacter_SetBitmapAsLongInt(ww_character, j, data[n]);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -212,7 +217,12 @@ void wwc_font_set_colordata(unsigned int number, unsigned int count, unsigned ch
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wwc_font_get_colordata(unsigned int number, unsigned int count, unsigned char * data)
|
/*
|
||||||
|
* data は long int × 8 で 32 バイト.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void wwc_font_get_colordata(unsigned int number, unsigned int count,
|
||||||
|
unsigned long int * data)
|
||||||
{
|
{
|
||||||
WWCharacter ww_character;
|
WWCharacter ww_character;
|
||||||
WWDisplay ww_display;
|
WWDisplay ww_display;
|
||||||
@ -232,8 +242,8 @@ void wwc_font_get_colordata(unsigned int number, unsigned int count, unsigned ch
|
|||||||
n = 0;
|
n = 0;
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
ww_character = WWDisplay_GetCharacter(ww_display, number + i);
|
ww_character = WWDisplay_GetCharacter(ww_display, number + i);
|
||||||
for (j = 0; j < 32; j++) {
|
for (j = 0; j < 8; j++) {
|
||||||
data[n] = WWCharacter_GetBitmap(ww_character, j);
|
data[n] = WWCharacter_GetBitmapAsLongInt(ww_character, j);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
16
readline.pl
16
readline.pl
@ -1,16 +0,0 @@
|
|||||||
#!/usr/bin/perl
|
|
||||||
|
|
||||||
use FileHandle;
|
|
||||||
|
|
||||||
$file = @ARGV[0];
|
|
||||||
|
|
||||||
open(FILE, "$file");
|
|
||||||
FILE->autoflush();
|
|
||||||
|
|
||||||
while (<FILE>) {
|
|
||||||
print "$_";
|
|
||||||
STDOUT->autoflush();
|
|
||||||
FILE->autoflush();
|
|
||||||
}
|
|
||||||
|
|
||||||
# End of program
|
|
||||||
15
sout2str.pl
15
sout2str.pl
@ -1,14 +1,17 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/local/bin/perl
|
||||||
|
|
||||||
use FileHandle;
|
use FileHandle;
|
||||||
|
|
||||||
while (<STDIN>) {
|
while (<STDIN>) {
|
||||||
if (/output to serial port : /) {
|
if (/output to serial port : /) {
|
||||||
($string) = /output to serial port : \"(.*)\"\n/;
|
($string) = /output to serial port : \"(.*)\"\n$/;
|
||||||
$string =~ s/\\n/\n/;
|
$string =~ s/\\n/\n/g;
|
||||||
$string =~ s/\\r/\n/;
|
$string =~ s/\\r/\n/g;
|
||||||
$string =~ s/\\t/\t/;
|
$string =~ s/\\t/\t/g;
|
||||||
$string =~ s/\\s/ /;
|
$string =~ s/\\\"/\"/g;
|
||||||
|
$string =~ s/\\\'/\'/g;
|
||||||
|
$string =~ s/\\\\/\\/g;
|
||||||
|
$string =~ s/\\s/ /g;
|
||||||
print "$string";
|
print "$string";
|
||||||
STDOUT->autoflush();
|
STDOUT->autoflush();
|
||||||
}
|
}
|
||||||
|
|||||||
16
sys2wonx.pl
16
sys2wonx.pl
@ -1,14 +1,6 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/local/bin/perl
|
||||||
|
|
||||||
while ($FILENAME = shift(@ARGV)) {
|
while (<STDIN>) {
|
||||||
open (RFILE, "< $FILENAME");
|
s/^(\s*\#\s*include\s*)[\<\"]sys\/(.+\.h)[\>\"]/$1\"wonx_include\/$2\"/i;
|
||||||
open (WFILE, "> $FILENAME.tmp");
|
print $_;
|
||||||
while (<RFILE>) {
|
|
||||||
s/^(\s*\#\s*include\s*)[\<\"]sys\/(.+\.h)[\>\"]/$1\"wonx_include\/$2\"/i;
|
|
||||||
print WFILE $_;
|
|
||||||
}
|
|
||||||
close (RFILE);
|
|
||||||
close (WFILE);
|
|
||||||
|
|
||||||
system("mv $FILENAME.tmp $FILENAME");
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,9 +68,9 @@ unsigned int display_status(void);
|
|||||||
void font_set_monodata(unsigned int number, unsigned int count,
|
void font_set_monodata(unsigned int number, unsigned int count,
|
||||||
unsigned char * data);
|
unsigned char * data);
|
||||||
void font_set_colordata(unsigned int number, unsigned int count,
|
void font_set_colordata(unsigned int number, unsigned int count,
|
||||||
unsigned char * data);
|
unsigned short int * data);
|
||||||
void font_get_data(unsigned int number, unsigned int count,
|
void font_get_data(unsigned int number, unsigned int count,
|
||||||
unsigned char * data);
|
unsigned short int * data);
|
||||||
void font_set_color(unsigned int colors);
|
void font_set_color(unsigned int colors);
|
||||||
unsigned int font_get_color(void);
|
unsigned int font_get_color(void);
|
||||||
void screen_set_char(int screen, int x, int y, int w, int h,
|
void screen_set_char(int screen, int x, int y, int w, int h,
|
||||||
|
|||||||
32
wonx_include/fcntl.h
Normal file
32
wonx_include/fcntl.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#ifndef _WONX_SYS_FCNTL_H_
|
||||||
|
#define _WONX_SYS_FCNTL_H_
|
||||||
|
|
||||||
|
#include "filesys.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* fcntl.h は /usr/include/fcntl.h を読み込めばよいので,
|
||||||
|
* 本当はこのファイルでは,
|
||||||
|
* #include <fcntl.h>
|
||||||
|
* するだけにしたいのだが,これだと -Iwonx_include のようにしてコンパイル
|
||||||
|
* している場合に,自分自身を読み込んでしまう可能性があるので,
|
||||||
|
* #include </usr/include/fcntl.h>
|
||||||
|
* として,自分自身を読み込まないように,/usr/include を明示している.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NetBSD と FreeBSD では,/usr/include/fcntl.h と
|
||||||
|
* /usr/include/sys/fcntl.h はまったく同じである.
|
||||||
|
*
|
||||||
|
* Solaris では,/usr/include/fcntl.h が /usr/include/sys/fcntl.h を
|
||||||
|
* インクルードしている.
|
||||||
|
*
|
||||||
|
* Linux では,/usr/include/fcntl.h が本体になっていて,
|
||||||
|
* /usr/include/sys/fcntl.h は /usr/include/fcntl.h をインクルードするだけの
|
||||||
|
* ファイルになっている.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* 一応両方とも include しておく */
|
||||||
|
#include </usr/include/fcntl.h>
|
||||||
|
#include </usr/include/sys/fcntl.h>
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -1,16 +0,0 @@
|
|||||||
#ifndef _WONX_SYS_FCNTL_H_
|
|
||||||
#define _WONX_SYS_FCNTL_H_
|
|
||||||
|
|
||||||
/*
|
|
||||||
* fcntl.h は /usr/include/fcntl.h を読み込めばよいので,
|
|
||||||
* wonx_include/fcntl.h を作らないほうがよい.(wonx_include/fcntl.h を作ると,
|
|
||||||
* 書き方によってはそっちが読み込まれてしまうかもしれないので)
|
|
||||||
* もしも作るとすれば,このファイルのようなのを作るか?
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "filesys.h"
|
|
||||||
|
|
||||||
/* 自分自身を読み込まないように,/usr/include を明示する */
|
|
||||||
#include </usr/include/fcntl.h>
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -23,8 +23,10 @@ unsigned int wwc_set_color_mode(unsigned int mode);
|
|||||||
unsigned int wwc_get_color_mode(void);
|
unsigned int wwc_get_color_mode(void);
|
||||||
void wwc_palette_set_color(unsigned int palette_num, unsigned int color_num, unsigned int rgb);
|
void wwc_palette_set_color(unsigned int palette_num, unsigned int color_num, unsigned int rgb);
|
||||||
unsigned int wwc_palette_get_color(unsigned int palette_num, unsigned int color_num);
|
unsigned int wwc_palette_get_color(unsigned int palette_num, unsigned int color_num);
|
||||||
void wwc_font_set_colordata(unsigned int number, unsigned int count, unsigned char * data);
|
void wwc_font_set_colordata(unsigned int number, unsigned int count,
|
||||||
void wwc_font_get_colordata(unsigned int number, unsigned int count, unsigned char * data);
|
unsigned long int * data);
|
||||||
|
void wwc_font_get_colordata(unsigned int number, unsigned int count,
|
||||||
|
unsigned long int * data);
|
||||||
unsigned int wwc_get_hardarch(void);
|
unsigned int wwc_get_hardarch(void);
|
||||||
void wwc_clear_font(void);
|
void wwc_clear_font(void);
|
||||||
|
|
||||||
|
|||||||
@ -16,10 +16,10 @@ typedef unsigned short int ushort;
|
|||||||
typedef unsigned long int ulong;
|
typedef unsigned long int ulong;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef unsigned char BYTE;
|
typedef unsigned char BYTE;
|
||||||
typedef unsigned short WORD;
|
typedef unsigned short int WORD;
|
||||||
typedef unsigned long DWORD;
|
typedef unsigned long int DWORD;
|
||||||
typedef int BOOL;
|
typedef int BOOL;
|
||||||
|
|
||||||
#ifndef far
|
#ifndef far
|
||||||
#define far /* None */
|
#define far /* None */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user