#include <guigui01.h> unsigned char cmdusage[] = { 0x86, 0x50, 0x01, 'i', 'n', 0x0c, 9, 0x01, 'p', 'u', 't', '-', 'f', 'i', 'l', 'e', 0x40 }; void sethex(char *s, int i, int n) { int j; for (j = n - 1; j >= 0; j--) { s[j] = '0' + (i & 0xf); i >>= 4; if (s[j] > '9') { s[j] += 'A' - '0' - 10; } } return; } void G01Main() { unsigned char buf[16], s[8]; int i, j, k; g01_setcmdlin(cmdusage); g01_getcmdlin_fopen_s_0_4(0); /* 0はreadモード, 4はslot番号, 0は引数番号 */ g01_putstr0(" offset +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F 0123456789ABCDEF\n"); g01_putstr0("---------------------------------------------------------------------------\n"); for (i = 0;; i += 0x10) { j = jg01_fread1(4, 16, buf); if (j == 0) { break; } sethex(s, i, 8); g01_putstr1(8, s); /* g01_putstr1()は文字数を指定できる。だからs[8]=0;がいらない。 */ g01_putstr0(" "); for (k = 0; k < 16; k++) { if (k < j) { sethex(s, buf[k], 2); g01_putstr1(2, s); g01_putc(' '); } else { g01_putstr0(" "); } } g01_putc(' '); for (k = 0; k < 16; k++) { if (k < j) { if (0x20 <= buf[k] && buf[k] <= 0x7e) { g01_putc(buf[k]); } else { g01_putc('.'); } } } g01_putc('\n'); } }
>efg01 ex0021.g01 usage>ex0021.g01 [in:]input-file >efg01 ex0021.g01 make.bat offset +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F 0123456789ABCDEF --------------------------------------------------------------------------- 00000000 2E 2E 5C 7A 5F 74 6F 6F 6C 73 5C 6D 61 6B 65 2E ..\z_tools\make. 00000010 65 78 65 20 25 31 20 25 32 20 25 33 20 25 34 20 exe %1 %2 %3 %4 00000020 25 35 20 25 36 20 25 37 20 25 38 20 25 39 %5 %6 %7 %8 %9
0x0c | ファイルパス型引数 |
0x1c | 整数型引数 |
0x2c | フラグ型引数 |
0x3c | 文字列型引数 |
unsigned char cmdusage[] = { 0x86, 0x50, 0x01, 'i', 'n', 0x0c, 6, 0x01, 'p', 'u', 't', '-', 0x02, 0x40 };
unsigned char cmdusage[] = { 0x86, 0x50, 0x88, 0x40 };
void sethex(char *s, int i, int n) { int j; for (j = n - 1; j >= 0; j--) { s[j] = 0x10 + (i & 0xf); i >>= 4; } return; }
g01_putstr0(" offset +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F 0123456789ABCDEF\n"); g01_putstr0("---------------------------------------------------------------------------\n");
g01_putstr0(" offset "); for (k = 0x10; k < 16 + 0x10; k++) { g01_putstr0(" +"); g01_putc(k); } g01_putstr0(" "); for (k = 0x10; k < 16 + 0x10; k++) { g01_putc(k); } g01_putstr0("\n---------------------------------------------------------------------------\n");
>efg01 ex0022.g01 hoge.txt File read open error: hoge.txt
@c:\tolset\z_tools\efg01.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
prompt>e nask
prompt>e アプリのパス
#include <guigui01.h> unsigned char cmdusage[] = { 0x86, 0x50, 0x88, 0x40 }; void G01Main() { char *b = g01_bss1a1; /* mallocを使わなくてもこれで2MBのバッファがもらえる */ g01_setcmdlin(cmdusage); g01_getcmdlin_fopen_s_0_4(0); jg01_fread0_4(2 * 1024 * 1024, b); /* 最大2MB, 終端に0がつく */ g01_putstr0(b); return; }
>e ex0023 usage>ex0023 [in:]input-file >e ex0023 make.bat ..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 >e ex0023 Makefile TARGET = ex0023 MODE = g01 OBJS = ex0023.obj INCPATH = ../z_tools/guigui01/ include ../z_tools/com_mak.txt
#include <guigui01.h> unsigned char cmdusage[] = { 0x86, 0x51, 0x13, 's', 'j', 'i', 's', 0x20, 0x88, 0x40 }; void G01Main() { unsigned char *b = g01_bss1a1, *p, sjis = 0; g01_setcmdlin(cmdusage); sjis = g01_getcmdlin_flag_o(0); g01_getcmdlin_fopen_s_0_4(1); jg01_fread0_4(2 * 1024 * 1024, b); for (p = b; *p != 0; p++) { if (*p < ' ' && *p != '\t' && *p != '\n' && *p != '\r') { *p = '.'; } if (*p == 0x7f) { *p = '.'; } if (*p >= 0x80) { if (sjis != 0 && !(0xa0 <= *p && *p <= 0xdf) && p[1] != 0) { /* SJIS全角 */ *p = '.'; p++; } *p = '.'; } } g01_putstr0(b); return; }