version 1.22, 2004/02/25 23:14:35 |
version 1.29, 2004/09/12 01:32:08 |
|
|
/* $OpenXM: OpenXM/src/kan96xx/Kan/ext.c,v 1.21 2003/12/06 02:49:22 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/kan96xx/Kan/ext.c,v 1.28 2004/09/11 23:49:34 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 <errno.h> |
#include <errno.h> |
#include "ox_pathfinder.h" |
#include "ox_pathfinder.h" |
|
|
|
extern int Quiet; |
extern char **environ; |
extern char **environ; |
|
|
#define MYCP_SIZE 100 |
#define MYCP_SIZE 100 |
static int Mychildren[MYCP_SIZE]; |
static int Mychildren[MYCP_SIZE]; |
static int Mycp = 0; |
static int Mycp = 0; |
|
static int Verbose_mywait = 0; |
static void mywait() { |
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) && (Verbose_mywait)) 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 111 struct object Kextension(struct object obj) |
|
Line 113 struct object Kextension(struct object obj) |
|
FILE *fp; |
FILE *fp; |
void (*oldsig)(); |
void (*oldsig)(); |
extern SecureMode; |
extern SecureMode; |
|
extern char *UD_str; |
|
extern int UD_attr; |
|
|
if (obj.tag != Sarray) errorKan1("%s\n","Kextension(): The argument must be an array."); |
if (obj.tag != Sarray) errorKan1("%s\n","Kextension(): The argument must be an array."); |
size = getoaSize(obj); |
size = getoaSize(obj); |
Line 144 struct object Kextension(struct object obj) |
|
Line 148 struct object Kextension(struct object obj) |
|
obj1 = getoa(obj,1); |
obj1 = getoa(obj,1); |
if (obj1.tag != Sinteger) errorKan1("%s\n","[(chattrs) num] extension."); |
if (obj1.tag != Sinteger) errorKan1("%s\n","[(chattrs) num] extension."); |
m = KopInteger(obj1); |
m = KopInteger(obj1); |
if (!( m == 0 || m == PROTECT || m == ABSOLUTE_PROTECT)) |
/* if (!( m == 0 || m == PROTECT || m == ABSOLUTE_PROTECT || m == ATTR_INFIX)) |
errorKan1("%s\n","The number must be 0, 1 or 2."); |
errorKan1("%s\n","The number must be 0, 1 or 2.");*/ |
putUserDictionary2((char *)NULL,0,0,m | SET_ATTR_FOR_ALL_WORDS, |
putUserDictionary2((char *)NULL,0,0,m | SET_ATTR_FOR_ALL_WORDS, |
CurrentContextp->userDictionary); |
CurrentContextp->userDictionary); |
}else if (strcmp(key,"keywords")==0) { |
}else if (strcmp(key,"keywords")==0) { |
Line 314 struct object Kextension(struct object obj) |
|
Line 318 struct object Kextension(struct object obj) |
|
if (obj1.tag != Sinteger) errorKan1("%s\n","[(chattr) num symbol] extension."); |
if (obj1.tag != Sinteger) errorKan1("%s\n","[(chattr) num symbol] extension."); |
if (obj2.tag != Sstring) errorKan1("%s\n","[(chattr) num symbol] extension."); |
if (obj2.tag != Sstring) errorKan1("%s\n","[(chattr) num symbol] extension."); |
m = KopInteger(obj1); |
m = KopInteger(obj1); |
if (!( m == 0 || m == PROTECT || m == ABSOLUTE_PROTECT)) |
/* if (!( m == 0 || m == PROTECT || m == ABSOLUTE_PROTECT || m == ATTR_INFIX)) |
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,"or_attr")==0) { |
|
if (size != 3) errorKan1("%s\n","[(or_attr) num symbol] extension."); |
|
obj1 = getoa(obj,1); |
|
obj2 = getoa(obj,2); |
|
if (obj1.tag != Sinteger) errorKan1("%s\n","[(or_attr) num symbol] extension."); |
|
if (obj2.tag != Sstring) errorKan1("%s\n","[(or_attr) num symbol] extension."); |
|
m = KopInteger(obj1); |
|
rob = KfindUserDictionary(obj2.lc.str); |
|
if (rob.tag != NoObject.tag) { |
|
if (strcmp(UD_str,obj2.lc.str) == 0) { |
|
m |= UD_attr; |
|
}else errorKan1("%s\n","or_attr: internal error."); |
|
} |
|
rob = KpoInteger(m); |
|
putUserDictionary2(obj2.lc.str,(obj2.rc.op->lc).ival,(obj2.rc.op->rc).ival, |
|
m,CurrentContextp->userDictionary); |
|
}else if (strcmp(key,"getattr")==0) { |
|
if (size != 2) errorKan1("%s\n","[(getattr) symbol] extension."); |
|
obj1 = getoa(obj,1); |
|
if (obj1.tag != Sstring) errorKan1("%s\n","[(getattr) symbol] extension."); |
|
rob = KfindUserDictionary(obj1.lc.str); |
|
if (rob.tag != NoObject.tag) { |
|
if (strcmp(UD_str,obj1.lc.str) == 0) { |
|
rob = KpoInteger(UD_attr); |
|
}else errorKan1("%s\n","getattr: internal error."); |
|
}else rob = NullObject; |
}else if (strcmp(key,"getServerEnv")==0) { |
}else if (strcmp(key,"getServerEnv")==0) { |
if (size != 2) errorKan1("%s\n","[(getServerEnv) serverName] extension."); |
if (size != 2) errorKan1("%s\n","[(getServerEnv) serverName] extension."); |
obj1 = getoa(obj,1); |
obj1 = getoa(obj,1); |
Line 363 struct object Kextension(struct object obj) |
|
Line 393 struct object Kextension(struct object obj) |
|
obj1 = getoa(obj,1); |
obj1 = getoa(obj,1); |
obj2 = getoa(obj,2); |
obj2 = getoa(obj,2); |
rob = KooPower(obj1,obj2); |
rob = KooPower(obj1,obj2); |
|
}else if (strcmp(key,"Krest")==0) { |
|
if (size != 2) errorKan1("%s\n","[(Krest) a] extension b"); |
|
obj1 = getoa(obj,1); |
|
rob = Krest(obj1); |
|
}else if (strcmp(key,"Kjoin")==0) { |
|
if (size != 3) errorKan1("%s\n","[(Kjoin) a b] extension c"); |
|
obj1 = getoa(obj,1); |
|
obj2 = getoa(obj,2); |
|
rob = Kjoin(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 371 struct object Kextension(struct object obj) |
|
Line 410 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" |
#include "Kclass/tree.hh" |