2: 2010-02-01 (月) 21:14:43 lina[6] [7] | 3: 2010-02-02 (火) 17:16:00 lina[6] [8] | ||
---|---|---|---|
Line 47: | Line 47: | ||
[[ここ>http://osask.net/w/201.html]]に手がかりがあったがすこし違う。もしかして新しくなってる? | [[ここ>http://osask.net/w/201.html]]に手がかりがあったがすこし違う。もしかして新しくなってる? | ||
+ | **一旦棚上げ(毎度乙!) [#f1b254b3] | ||
+ | fprintfって、ファイルに書き込む命令でそ? [[こっち>http://osask.net/w/544.html]]でとりあえず読み込みがわかったので、まずは書くのは後回し(コメントアウトとかで)して、osalink1.optとかを読み込んでみよう | ||
- | osalink1.ca:52: `stderr' undeclared (first use in this function) | + | **再開・・・ [#tc628d7f] |
- | osalink1.ca:52: (Each undeclared identifier is reported only once | + | まずはこういう手の表記。 |
- | osalink1.ca:52: for each function it appears in.) | + | FILE *fp0, *fp1; |
- | osalink1.ca:57: `FILE' undeclared (first use in this function) | + | .g01では''スロット''というものを使ってファイルハンドルと同じ操作をするので、これは撤廃。(当然fpとかの表記もコメントアウト) |
- | osalink1.ca:57: `fp0' undeclared (first use in this function) | + | |
- | osalink1.ca:57: `fp1' undeclared (first use in this function) | + | |
- | osalink1.ca:57: warning: left-hand operand of comma expression has no effect | + | |
- | osalink1.ca:77: warning: implicit declaration of function `fopen' | + | |
- | osalink1.ca:83: warning: implicit declaration of function `fgets' | + | |
- | osalink1.ca:83: warning: comparison between pointer and integer | + | |
- | osalink1.ca:92: warning: implicit declaration of function `strcpy' | + | |
- | osalink1.ca:97: warning: implicit declaration of function `fclose' | + | |
- | osalink1.ca:104: warning: implicit declaration of function `fread' | + | |
- | osalink1.ca:163: warning: implicit declaration of function `fwrite' | + | |
- | osalink1.ca: In function `script': | + | |
- | osalink1.ca:338: `FILE' undeclared (first use in this function) | + | |
- | osalink1.ca:338: `fp' undeclared (first use in this function) | + | |
- | osalink1.ca:362: warning: implicit declaration of function `fseek' | + | |
- | osalink1.ca:362: `SEEK_SET' undeclared (first use in this function) | + | |
- | make[1]: *** [osalink1.gas] Error 1 | + | |
- | rm osalink1.ca osalink1.gas | + | |
- | make[1]: Leaving directory `D:/SFjp_SVN作業/28GO_SVN/hidetol9/k2/osalink1' | + | |
- | ..\z_tools\make.exe: *** [ALL] Error 2 | + | |
- | D:\SFjp_SVN作業\28GO_SVN\hidetol9\k2\osalink1> | + | // OPTIONFILEの読み込みと各ファイルのサイズ取得 |
+ | fp0 = fopen(optfile, "r"); | ||
+ | if (fp0 == NULL) { | ||
+ | fprintf(stderr, "Can't open \"%s\".\n", optfile); | ||
+ | return 1; | ||
+ | } | ||
+ | ここでosalink1.optを開いてるよね。これを・・・・ | ||
+ | |||
+ | // OPTIONFILEの読み込みと各ファイルのサイズ取得 | ||
+ | char *buffer1 = g01_bss1a1; | ||
+ | jg01_fopen(1, 4, optfile); | ||
+ | jg01_fread0_4(2 * 1024 * 1024, buffer1); | ||
+ | if (strlen(buffer1) == 0) { | ||
+ | g01_putstr0("Can't open optfile\n"); | ||
+ | return 1; | ||
+ | } | ||
+ | |||
+ | こういうことでいいのかな・・・ | ||
+ | |||
+ | COLOR(red){ちょっと面白いこと発見。このosalink1は、元々内部コードで2MBのバッファを確保してるんだけど、これを文字列配列でやってたのよね。で、これがあると、G01Mainがまったく動かなくなっちゃうらしいww。ちゃんとmallocやg01_bss1a1で確保すると大丈夫だというwww} | ||
+ | |||
+ | |||
+ | |||
+ | g01のapiでは、''一行読み込み''はない。すでにbuffer1内に全部入っちゃってる。つーことは・・・・~ | ||
+ | 改行コードを元に、自分で配列とかを作って割ってやらないといけない・・・のかな。例えば・・・ |
(This host) = http://osask.net