version 1.2, 2018/09/28 08:20:27 |
version 1.3, 2020/10/06 06:31:19 |
|
|
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* |
* |
* $OpenXM: OpenXM_contrib2/asir2018/builtin/file.c,v 1.1 2018/09/19 05:45:05 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2018/builtin/file.c,v 1.2 2018/09/28 08:20:27 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "parse.h" |
#include "parse.h" |
Line 215 void Pget_line(NODE arg,STRING *rp) |
|
Line 215 void Pget_line(NODE arg,STRING *rp) |
|
|
|
asir_assert(ARG0(arg),O_N,"get_line"); |
asir_assert(ARG0(arg),O_N,"get_line"); |
i = ZTOS((Q)ARG0(arg)); |
i = ZTOS((Q)ARG0(arg)); |
if ( fp = file_ptrs[i] ) { |
if ( ( fp = file_ptrs[i] ) != 0 ) { |
if ( feof(fp) ) { |
if ( feof(fp) ) { |
*rp = 0; |
*rp = 0; |
return; |
return; |
Line 256 void Pget_byte(NODE arg,Z *rp) |
|
Line 256 void Pget_byte(NODE arg,Z *rp) |
|
|
|
asir_assert(ARG0(arg),O_N,"get_byte"); |
asir_assert(ARG0(arg),O_N,"get_byte"); |
i = ZTOS((Q)ARG0(arg)); |
i = ZTOS((Q)ARG0(arg)); |
if ( fp = file_ptrs[i] ) { |
if ( ( fp = file_ptrs[i] ) != 0 ) { |
if ( feof(fp) ) { |
if ( feof(fp) ) { |
STOZ(-1,*rp); |
STOZ(-1,*rp); |
return; |
return; |
Line 274 void Pget_word(NODE arg,Z *rp) |
|
Line 274 void Pget_word(NODE arg,Z *rp) |
|
|
|
asir_assert(ARG0(arg),O_N,"get_word"); |
asir_assert(ARG0(arg),O_N,"get_word"); |
i = ZTOS((Q)ARG0(arg)); |
i = ZTOS((Q)ARG0(arg)); |
if ( fp = file_ptrs[i] ) { |
if ( ( fp = file_ptrs[i] ) != 0 ) { |
if ( feof(fp) ) { |
if ( feof(fp) ) { |
error("get_word : end of file"); |
error("get_word : end of file"); |
return; |
return; |
} |
} |
read_int(fp,&c); |
read_int(fp,(unsigned int *)&c); |
STOZ(c,*rp); |
STOZ(c,*rp); |
} else |
} else |
error("get_word : invalid argument"); |
error("get_word : invalid argument"); |
Line 325 void Pput_word(NODE arg,Obj *rp) |
|
Line 325 void Pput_word(NODE arg,Obj *rp) |
|
|
|
obj = (Obj)ARG1(arg); |
obj = (Obj)ARG1(arg); |
c = ZTOS((Q)obj); |
c = ZTOS((Q)obj); |
write_int(fp,&c); |
write_int(fp,(unsigned int *)&c); |
*rp = obj; |
*rp = obj; |
} |
} |
|
|