version 1.1, 2018/09/19 05:45:06 |
version 1.2, 2018/09/28 08:20:27 |
|
|
* 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: OpenXM_contrib2/asir2018/builtin/miscf.c,v 1.1 2018/09/19 05:45:06 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "parse.h" |
#include "parse.h" |
Line 150 void Pchdir(NODE arg, Z *rp) |
|
Line 150 void Pchdir(NODE arg, Z *rp) |
|
#else |
#else |
int status = chdir(dir); |
int status = chdir(dir); |
#endif |
#endif |
STOQ(status,*rp); |
STOZ(status,*rp); |
} |
} |
|
|
void Pset_secure_mode(NODE arg,Z *rp) |
void Pset_secure_mode(NODE arg,Z *rp) |
{ |
{ |
int s; |
int s; |
if ( argc(arg) ) |
if ( argc(arg) ) |
setsecuremode(QTOS((Q)ARG0(arg))); |
setsecuremode(ZTOS((Q)ARG0(arg))); |
s = getsecuremode(); |
s = getsecuremode(); |
STOQ(s,*rp); |
STOZ(s,*rp); |
} |
} |
|
|
void Pset_secure_flag(NODE arg,Z *rp) |
void Pset_secure_flag(NODE arg,Z *rp) |
Line 172 void Pset_secure_flag(NODE arg,Z *rp) |
|
Line 172 void Pset_secure_flag(NODE arg,Z *rp) |
|
if ( !ac ) |
if ( !ac ) |
error("set_secure_flag : a function name must be specified"); |
error("set_secure_flag : a function name must be specified"); |
if ( ac == 2 ) |
if ( ac == 2 ) |
s = QTOS((Q)ARG1(arg)); |
s = ZTOS((Q)ARG1(arg)); |
else |
else |
s = 1; |
s = 1; |
f = ARG0(arg); |
f = ARG0(arg); |
Line 189 void Pset_secure_flag(NODE arg,Z *rp) |
|
Line 189 void Pset_secure_flag(NODE arg,Z *rp) |
|
status = setsecureflag(fname,s); |
status = setsecureflag(fname,s); |
if ( status < 0 ) |
if ( status < 0 ) |
error("set_secure_flag : function not found"); |
error("set_secure_flag : function not found"); |
STOQ(s,*rp); |
STOZ(s,*rp); |
} |
} |
|
|
void Ptest(NODE arg,Z *rp) |
void Ptest(NODE arg,Z *rp) |
Line 197 void Ptest(NODE arg,Z *rp) |
|
Line 197 void Ptest(NODE arg,Z *rp) |
|
int r; |
int r; |
|
|
r = equalr(CO,ARG0(arg),ARG1(arg)); |
r = equalr(CO,ARG0(arg),ARG1(arg)); |
STOQ(r,*rp); |
STOZ(r,*rp); |
} |
} |
|
|
void Psleep(NODE arg,Z *rp) |
void Psleep(NODE arg,Z *rp) |
{ |
{ |
int ms; |
int ms; |
|
|
ms = QTOS((Q)ARG0(arg)); |
ms = ZTOS((Q)ARG0(arg)); |
#if defined(VISUAL) || defined(__MINGW32__) |
#if defined(VISUAL) || defined(__MINGW32__) |
Sleep(ms); |
Sleep(ms); |
#else |
#else |
Line 315 void Pshell(NODE arg,Z *rp) |
|
Line 315 void Pshell(NODE arg,Z *rp) |
|
pstr = BDY((STRING)ARG1(arg)); |
pstr = BDY((STRING)ARG1(arg)); |
} |
} |
status = system(com); |
status = system(com); |
STOQ(status,*rp); |
STOZ(status,*rp); |
} |
} |
|
|
void Pnmono(NODE arg,Z *rp) |
void Pnmono(NODE arg,Z *rp) |
Line 329 void Pnmono(NODE arg,Z *rp) |
|
Line 329 void Pnmono(NODE arg,Z *rp) |
|
else |
else |
switch (OID(obj)) { |
switch (OID(obj)) { |
case O_N: case O_P: |
case O_N: case O_P: |
n = nmonop((P)obj); STOQ(n,*rp); break; |
n = nmonop((P)obj); STOZ(n,*rp); break; |
case O_R: |
case O_R: |
n = nmonop(NM((R)obj)) + nmonop(DN((R)obj)); |
n = nmonop(NM((R)obj)) + nmonop(DN((R)obj)); |
STOQ(n,*rp); break; |
STOZ(n,*rp); break; |
} |
} |
} |
} |
|
|
Line 343 void Pheap(NODE arg,Z *rp) |
|
Line 343 void Pheap(NODE arg,Z *rp) |
|
|
|
h0 = get_heapsize(); |
h0 = get_heapsize(); |
if ( arg ) { |
if ( arg ) { |
h = QTOS((Q)ARG0(arg)); |
h = ZTOS((Q)ARG0(arg)); |
if ( h > h0 ) |
if ( h > h0 ) |
GC_expand_hp(h-h0); |
GC_expand_hp(h-h0); |
} |
} |
h = get_heapsize(); |
h = get_heapsize(); |
UTOQ(h,*rp); |
UTOZ(h,*rp); |
} |
} |
|
|
unsigned int get_asir_version(); |
unsigned int get_asir_version(); |
Line 365 void Pversion(NODE arg,Obj *rp) |
|
Line 365 void Pversion(NODE arg,Obj *rp) |
|
|
|
version = get_asir_version(); |
version = get_asir_version(); |
distribution = get_asir_distribution(); |
distribution = get_asir_distribution(); |
UTOQ(version,q); |
UTOZ(version,q); |
if ( !argc(arg) ) |
if ( !argc(arg) ) |
*rp = (Obj)q; |
*rp = (Obj)q; |
else { |
else { |
Line 423 void Perror3(NODE arg,Z *rp) |
|
Line 423 void Perror3(NODE arg,Z *rp) |
|
asir_assert(ARG0(arg),O_N,"error3"); |
asir_assert(ARG0(arg),O_N,"error3"); |
asir_assert(ARG1(arg),O_STR,"error3"); |
asir_assert(ARG1(arg),O_STR,"error3"); |
asir_assert(ARG2(arg),O_STR,"error3"); |
asir_assert(ARG2(arg),O_STR,"error3"); |
code = QTOS((Q)ARG0(arg)); |
code = ZTOS((Q)ARG0(arg)); |
reason = BDY((STRING)ARG1(arg)); |
reason = BDY((STRING)ARG1(arg)); |
action = BDY((STRING)ARG2(arg)); |
action = BDY((STRING)ARG2(arg)); |
#if defined(VISUAL) || defined(__MINGW32__) |
#if defined(VISUAL) || defined(__MINGW32__) |
Line 483 void Pdelete_history(NODE arg,Z *rp) |
|
Line 483 void Pdelete_history(NODE arg,Z *rp) |
|
delete_history(0,(int)APVS->n); |
delete_history(0,(int)APVS->n); |
break; |
break; |
case 1: |
case 1: |
delete_history(QTOS((Q)ARG0(arg)),1); |
delete_history(ZTOS((Q)ARG0(arg)),1); |
break; |
break; |
} |
} |
*rp = 0; |
*rp = 0; |
Line 526 void Pbatch(NODE arg,Z *rp) |
|
Line 526 void Pbatch(NODE arg,Z *rp) |
|
int ret; |
int ret; |
|
|
ret = exec_file(BDY((STRING)ARG0(arg)),BDY((STRING)ARG1(arg))); |
ret = exec_file(BDY((STRING)ARG0(arg)),BDY((STRING)ARG1(arg))); |
STOQ(ret,*rp); |
STOZ(ret,*rp); |
} |
} |
|
|
#if !defined(VISUAL) && defined(DO_PLOT) |
#if !defined(VISUAL) && defined(DO_PLOT) |
Line 591 void Psend_progress(NODE arg,Z *rp) |
|
Line 591 void Psend_progress(NODE arg,Z *rp) |
|
short per; |
short per; |
char *msg; |
char *msg; |
|
|
per = (short)QTOS((Q)BDY(arg)); arg = NEXT(arg); |
per = (short)ZTOS((Q)BDY(arg)); arg = NEXT(arg); |
if ( arg ) |
if ( arg ) |
msg = BDY((STRING)BDY(arg)); |
msg = BDY((STRING)BDY(arg)); |
else |
else |
Line 606 void Pget_addr(NODE arg,Z *rp) |
|
Line 606 void Pget_addr(NODE arg,Z *rp) |
|
pointer obj; |
pointer obj; |
|
|
obj = ARG0(arg); |
obj = ARG0(arg); |
UTOQ((unsigned long)obj,*rp); |
UTOZ((unsigned long)obj,*rp); |
} |
} |
|
|
unsigned char *qtoaddr(Z q) |
unsigned char *qtoaddr(Z q) |
Line 614 unsigned char *qtoaddr(Z q) |
|
Line 614 unsigned char *qtoaddr(Z q) |
|
if ( !q ) |
if ( !q ) |
return 0; |
return 0; |
else |
else |
return (unsigned char *)QTOS(q); |
return (unsigned char *)ZTOS(q); |
} |
} |
|
|
void Phex_dump(NODE arg,Z *rp) |
void Phex_dump(NODE arg,Z *rp) |
Line 624 void Phex_dump(NODE arg,Z *rp) |
|
Line 624 void Phex_dump(NODE arg,Z *rp) |
|
|
|
*rp = 0; |
*rp = 0; |
start = qtoaddr((Z)ARG0(arg)); |
start = qtoaddr((Z)ARG0(arg)); |
len = QTOS((Q)ARG1(arg)); |
len = ZTOS((Q)ARG1(arg)); |
for ( i = 0; i < len; i++ ) { |
for ( i = 0; i < len; i++ ) { |
if ( !(i%16) ) |
if ( !(i%16) ) |
fprintf(asir_out,"%08x: ",start+i); |
fprintf(asir_out,"%08x: ",start+i); |
Line 645 void Ppeek(NODE arg,Z *rp) |
|
Line 645 void Ppeek(NODE arg,Z *rp) |
|
|
|
a = qtoaddr((Z)ARG0(arg)); |
a = qtoaddr((Z)ARG0(arg)); |
b = (unsigned long) (*a); |
b = (unsigned long) (*a); |
UTOQ(b,*rp); |
UTOZ(b,*rp); |
} |
} |
|
|
void Ppoke(NODE arg,Z *rp) |
void Ppoke(NODE arg,Z *rp) |
Line 653 void Ppoke(NODE arg,Z *rp) |
|
Line 653 void Ppoke(NODE arg,Z *rp) |
|
unsigned char *addr; |
unsigned char *addr; |
|
|
addr = qtoaddr((Z)ARG0(arg)); |
addr = qtoaddr((Z)ARG0(arg)); |
*addr = (unsigned char)QTOS((Q)ARG1(arg)); |
*addr = (unsigned char)ZTOS((Q)ARG1(arg)); |
*rp = 0; |
*rp = 0; |
} |
} |
|
|
|
|
switch ( OID(t) ) { |
switch ( OID(t) ) { |
case O_N: |
case O_N: |
if ( (NID(t)==N_Q) && INT(t) && (PL(NM((Q)t))==1) ) { |
if ( (NID(t)==N_Q) && INT(t) && (PL(NM((Q)t))==1) ) { |
n = QTOS((Q)t); |
n = ZTOS((Q)t); |
if ( !szinit ) |
if ( !szinit ) |
sz_init(); |
sz_init(); |
if ( n < 1000 ) |
if ( n < 1000 ) |