| version 1.14, 2003/07/14 12:49:52 |
version 1.24, 2004/09/04 11:25:58 |
|
|
| /* $OpenXM: OpenXM/src/kan96xx/Kan/ext.c,v 1.13 2002/11/10 07:00:05 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/kan96xx/Kan/ext.c,v 1.23 2004/02/28 13:39:42 takayama Exp $ */ |
| #include <stdio.h> |
#include <stdio.h> |
| #include <sys/types.h> |
#include <sys/types.h> |
| #include <sys/stat.h> |
#include <sys/stat.h> |
|
|
| #include "extern2.h" |
#include "extern2.h" |
| #include <signal.h> |
#include <signal.h> |
| #include "plugin.h" |
#include "plugin.h" |
| |
#include "kclass.h" |
| #include <ctype.h> |
#include <ctype.h> |
| |
#include <errno.h> |
| |
#include "ox_pathfinder.h" |
| |
|
| |
extern int Quiet; |
| extern char **environ; |
extern char **environ; |
| |
|
| #define MYCP_SIZE 100 |
#define MYCP_SIZE 100 |
| Line 23 static void mywait() { |
|
| Line 27 static void mywait() { |
|
| int status; |
int status; |
| int pid; |
int pid; |
| int i,j; |
int i,j; |
| signal(SIGCHLD,SIG_IGN); |
/* signal(SIGCHLD,SIG_IGN); */ |
| pid = wait(&status); |
pid = wait(&status); |
| fprintf(stderr,"Child process %d is exiting.\n",pid); |
if (!Quiet) fprintf(stderr,"Child process %d is exiting.\n",pid); |
| for (i=0; i<Mycp; i++) { |
for (i=0; i<Mycp; i++) { |
| if (Mychildren[i] == pid) { |
if (Mychildren[i] == pid) { |
| for (j=i; j<Mycp-1; j++) { |
for (j=i; j<Mycp-1; j++) { |
| Line 101 struct object Kextension(struct object obj) |
|
| Line 105 struct object Kextension(struct object obj) |
|
| #endif |
#endif |
| extern void ctrlC(); |
extern void ctrlC(); |
| extern int SigIgn; |
extern int SigIgn; |
| extern errno; |
|
| extern int DebugCMO; |
extern int DebugCMO; |
| extern int OXprintMessage; |
extern int OXprintMessage; |
| struct stat buf; |
struct stat buf; |
| Line 316 struct object Kextension(struct object obj) |
|
| Line 319 struct object Kextension(struct object obj) |
|
| errorKan1("%s\n","The number must be 0, 1 or 2."); |
errorKan1("%s\n","The number must be 0, 1 or 2."); |
| putUserDictionary2(obj2.lc.str,(obj2.rc.op->lc).ival,(obj2.rc.op->rc).ival, |
putUserDictionary2(obj2.lc.str,(obj2.rc.op->lc).ival,(obj2.rc.op->rc).ival, |
| m,CurrentContextp->userDictionary); |
m,CurrentContextp->userDictionary); |
| |
}else if (strcmp(key,"getServerEnv")==0) { |
| |
if (size != 2) errorKan1("%s\n","[(getServerEnv) serverName] extension."); |
| |
obj1 = getoa(obj,1); |
| |
if (obj1.tag != Sdollar) errorKan1("%s\n","[(getServerEnv) serverName] extension."); |
| |
{ |
| |
char **se; int ii; int nn; |
| |
se = getServerEnv(KopString(obj1)); |
| |
if (se == NULL) { |
| |
debugServerEnv(KopString(obj1)); |
| |
rob = NullObject; |
| |
}else{ |
| |
for (ii=0,nn=0; se[ii] != NULL; ii++) nn++; |
| |
rob = newObjectArray(nn); |
| |
for (ii=0; ii<nn; ii++) { |
| |
putoa(rob,ii,KpoString(se[ii])); |
| |
} |
| |
} |
| |
} |
| }else if (strcmp(key,"regionMatches")==0) { |
}else if (strcmp(key,"regionMatches")==0) { |
| if (size != 3) errorKan1("%s\n","[(regionMatches) str strArray] extension."); |
if (size != 3) errorKan1("%s\n","[(regionMatches) str strArray] extension."); |
| obj1 = getoa(obj,1); |
obj1 = getoa(obj,1); |
| Line 323 struct object Kextension(struct object obj) |
|
| Line 344 struct object Kextension(struct object obj) |
|
| obj2 = getoa(obj,2); |
obj2 = getoa(obj,2); |
| if (obj2.tag != Sarray) errorKan1("%s\n","[(regionMatches) str strArray] extension. strArray must be an array."); |
if (obj2.tag != Sarray) errorKan1("%s\n","[(regionMatches) str strArray] extension. strArray must be an array."); |
| rob = KregionMatches(obj1,obj2); |
rob = KregionMatches(obj1,obj2); |
| |
}else if (strcmp(key,"newVector")==0) { |
| |
if (size != 2) errorKan1("%s\n","[(newVector) m] extension."); |
| |
obj1 = getoa(obj,1); |
| |
if (obj1.tag != Sinteger) errorKan1("%s\n","[(newVector) m] extension. m must be an integer."); |
| |
rob = newObjectArray(KopInteger(obj1)); |
| |
}else if (strcmp(key,"newMatrix")==0) { |
| |
if (size != 3) errorKan1("%s\n","[(newMatrix) m n] extension."); |
| |
obj1 = getoa(obj,1); |
| |
if (obj1.tag != Sinteger) errorKan1("%s\n","[(newMatrix) m n] extension. m must be an integer."); |
| |
obj2 = getoa(obj,2); |
| |
if (obj2.tag != Sinteger) errorKan1("%s\n","[(newMatrix) m n] extension. n must be an integer."); |
| |
rob = newObjectArray(KopInteger(obj1)); |
| |
for (i=0; i<KopInteger(obj1); i++) { |
| |
putoa(rob,i,newObjectArray(KopInteger(obj2))); |
| |
} |
| |
}else if (strcmp(key,"ooPower")==0) { |
| |
if (size != 3) errorKan1("%s\n","[(ooPower) a b] extension."); |
| |
obj1 = getoa(obj,1); |
| |
obj2 = getoa(obj,2); |
| |
rob = KooPower(obj1,obj2); |
| }else if (strcmp(key,"ostype")==0) { |
}else if (strcmp(key,"ostype")==0) { |
| rob = newObjectArray(1); |
rob = newObjectArray(1); |
| /* Hard encode the OS type. */ |
/* Hard encode the OS type. */ |
| Line 331 struct object Kextension(struct object obj) |
|
| Line 372 struct object Kextension(struct object obj) |
|
| #else |
#else |
| putoa(rob,0,KpoString("unix")); |
putoa(rob,0,KpoString("unix")); |
| #endif |
#endif |
| |
}else if (strcmp(key,"traceClearStack")==0) { |
| |
traceClearStack(); |
| |
rob = NullObject; |
| |
}else if (strcmp(key,"traceShowStack")==0) { |
| |
char *ssst; |
| |
ssst = traceShowStack(); |
| |
if (ssst != NULL) { |
| |
rob = KpoString(ssst); |
| |
}else{ |
| |
rob = NullObject; |
| |
} |
| } |
} |
| #include "plugin.hh" |
#include "plugin.hh" |
| |
#include "Kclass/tree.hh" |
| else{ |
else{ |
| errorKan1("%s\n","Unknown tag for extension."); |
errorKan1("%s\n","Unknown tag for extension."); |
| } |
} |