version 1.30, 2014/04/02 22:08:29 |
version 1.35, 2017/06/10 05:32:24 |
|
|
* 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/asir2000/builtin/file.c,v 1.29 2013/08/20 14:22:33 ohara Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/builtin/file.c,v 1.34 2015/08/14 13:51:54 fujimoto Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "parse.h" |
#include "parse.h" |
#include "ox.h" |
#include "ox.h" |
#include "base.h" |
#include "base.h" |
#if !defined(VISUAL) |
#if !defined(VISUAL) && !defined(__MINGW32__) |
#include "unistd.h" |
#include "unistd.h" |
#endif |
#endif |
#if defined(PARI) |
#if defined(PARI) |
#include "genpari.h" |
#include "genpari.h" |
#endif |
#endif |
|
|
#if defined(VISUAL) |
#if defined(VISUAL) || defined(__MINGW32__) |
#include <windows.h> |
#include <windows.h> |
#include <process.h> |
#include <process.h> |
#include <io.h> |
#include <io.h> |
|
|
#define R_OK 0x04 |
#define R_OK 0x04 |
#endif |
#endif |
|
|
|
void Psprintf(NODE,STRING *); |
|
|
void Pget_rootdir(); |
void Pget_rootdir(); |
void Pget_asirloadpath(); |
|
void Paccess(),Premove_file(); |
void Paccess(),Premove_file(); |
void Pbsave_enc(), Pbload_enc(); |
void Pbsave_enc(), Pbload_enc(); |
|
|
|
|
|
|
extern int des_encryption; |
extern int des_encryption; |
extern char *asir_libdir; |
extern char *asir_libdir; |
extern char **ASIRLOADPATH; |
|
|
|
struct ftab file_tab[] = { |
struct ftab file_tab[] = { |
{"fprintf",Pfprintf,-99999999}, |
{"fprintf",Pfprintf,-99999999}, |
Line 108 struct ftab file_tab[] = { |
|
Line 108 struct ftab file_tab[] = { |
|
{"bsave",Pbsave,2}, |
{"bsave",Pbsave,2}, |
{"bload",Pbload,1}, |
{"bload",Pbload,1}, |
{"get_rootdir",Pget_rootdir,0}, |
{"get_rootdir",Pget_rootdir,0}, |
{"get_asirloadpath",Pget_asirloadpath,0}, |
|
#if defined(DES_ENC) |
#if defined(DES_ENC) |
{"bsave_enc",Pbsave_enc,2}, |
{"bsave_enc",Pbsave_enc,2}, |
{"bload_enc",Pbload_enc,1}, |
{"bload_enc",Pbload_enc,1}, |
Line 172 void Popen_file(NODE arg,Q *rp) |
|
Line 171 void Popen_file(NODE arg,Q *rp) |
|
asir_assert(ARG1(arg),O_STR,"open_file"); |
asir_assert(ARG1(arg),O_STR,"open_file"); |
fp = fopen(name,BDY((STRING)ARG1(arg))); |
fp = fopen(name,BDY((STRING)ARG1(arg))); |
} else |
} else |
fp = fopen(name,"r"); |
fp = fopen(name,"rb"); |
} |
} |
if ( !fp ) { |
if ( !fp ) { |
sprintf(errbuf,"open_file : cannot open \"%s\"",name); |
sprintf(errbuf,"open_file : cannot open \"%s\"",name); |
Line 509 void Pbload_cmo(NODE arg,Obj *rp) |
|
Line 508 void Pbload_cmo(NODE arg,Obj *rp) |
|
|
|
static struct oSTRING rootdir; |
static struct oSTRING rootdir; |
|
|
#if defined(VISUAL) |
#if defined(VISUAL) || defined(__MINGW32__) |
void get_rootdir(char *name,int len) |
void get_rootdir(char *name,int len) |
{ |
{ |
LONG ret; |
LONG ret; |
Line 588 void Pget_rootdir(STRING *rp) |
|
Line 587 void Pget_rootdir(STRING *rp) |
|
*rp = &rootdir; |
*rp = &rootdir; |
} |
} |
|
|
void Pget_asirloadpath(LIST *rp) |
|
{ |
|
STRING s; |
|
int i; |
|
NODE t,prev; |
|
if( ASIRLOADPATH[0] == NULL ) { |
|
*rp = NULL; |
|
return; |
|
} |
|
for(i=0; ASIRLOADPATH[i]; i++) { |
|
} |
|
for(t=0,i--; i>=0; i--) { |
|
prev=t; |
|
MKSTR(s,ASIRLOADPATH[i]); |
|
MKNODE(t,s,prev); |
|
} |
|
MKLIST(*rp,t); |
|
} |
|
|
|
void Pgetpid(Q *rp) |
void Pgetpid(Q *rp) |
{ |
{ |
int id; |
int id; |
|
|
#if defined(VISUAL) |
#if defined(VISUAL) || defined(__MINGW32__) |
id = GetCurrentProcessId(); |
id = GetCurrentProcessId(); |
#else |
#else |
id = getpid(); |
id = getpid(); |
Line 721 void Paccess(NODE arg,Q *rp) |
|
Line 701 void Paccess(NODE arg,Q *rp) |
|
*rp = 0; |
*rp = 0; |
} |
} |
|
|
#if defined(VISUAL) |
#if defined(VISUAL) || defined(__MINGW32__) |
int process_id() |
int process_id() |
{ |
{ |
return GetCurrentProcessId(); |
return GetCurrentProcessId(); |