version 1.68, 2007/01/03 15:48:08 |
version 1.78, 2010/08/01 08:44:15 |
|
|
* 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/parse/glob.c,v 1.67 2006/09/28 07:43:45 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/parse/glob.c,v 1.77 2010/05/26 06:32:49 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "al.h" |
#include "al.h" |
|
|
#if defined(PARI) |
#if defined(PARI) |
#include "genpari.h" |
#include "genpari.h" |
#endif |
#endif |
#if !defined(VISUAL) && !defined(_PA_RISC1_1) && !defined(linux) && !defined(SYSV) && !defined(__CYGWIN__) && !defined(__INTERIX) |
#if !defined(VISUAL) && !defined(_PA_RISC1_1) && !defined(linux) && !defined(SYSV) && !defined(__CYGWIN__) && !defined(__INTERIX) && !defined(__FreeBSD__) |
#include <sgtty.h> |
#include <sgtty.h> |
#endif |
#endif |
|
|
|
|
|
|
#define MAXHIST 100 |
#define MAXHIST 100 |
|
|
extern int GC_free_space_divisor; |
|
extern int GC_free_space_numerator; |
|
extern FILE *asir_out; |
extern FILE *asir_out; |
|
|
INFILE asir_infile; |
INFILE asir_infile; |
Line 320 static int which(char *prog, char *path, char *buf, si |
|
Line 318 static int which(char *prog, char *path, char *buf, si |
|
void cppname_init() |
void cppname_init() |
{ |
{ |
#if !defined(VISUAL) |
#if !defined(VISUAL) |
if (access(cppname, X_OK&R_OK) != 0) { |
char oxcpp[BUFSIZ]; |
|
if(which("ox_cpp", getenv("PATH"), oxcpp, BUFSIZ) && access(oxcpp, X_OK&R_OK) == 0) { |
|
strncpy(cppname,oxcpp,BUFSIZ-1); |
|
}else if (access(cppname, X_OK&R_OK) != 0) { |
which("cpp", "/lib:/usr/ccs/lib:/usr/bin", cppname, BUFSIZ) || |
which("cpp", "/lib:/usr/ccs/lib:/usr/bin", cppname, BUFSIZ) || |
which("cpp", getenv("PATH"), cppname, BUFSIZ); |
which("cpp", getenv("PATH"), cppname, BUFSIZ); |
} |
} |
|
|
|
|
void process_args(int ac,char **av) |
void process_args(int ac,char **av) |
{ |
{ |
|
int nm,dv; |
do_asirrc = 1; |
do_asirrc = 1; |
#if !defined(MPI) |
#if !defined(MPI) |
do_message = 1; |
do_message = 1; |
Line 343 void process_args(int ac,char **av) |
|
Line 345 void process_args(int ac,char **av) |
|
GC_expand_hp(atoi(*(av+1))); av += 2; ac -= 2; |
GC_expand_hp(atoi(*(av+1))); av += 2; ac -= 2; |
} else if ( !strcmp(*av,"-adj") && (ac >= 2) ) { |
} else if ( !strcmp(*av,"-adj") && (ac >= 2) ) { |
char *slash; |
char *slash; |
|
|
slash = strrchr(*(av+1),'/'); |
slash = strrchr(*(av+1),'/'); |
if ( slash ) { |
if ( slash ) { |
*slash = 0; |
*slash = 0; |
GC_free_space_numerator = atoi(slash+1); |
nm = atoi(slash+1); |
|
}else { |
|
nm = 1; |
} |
} |
GC_free_space_divisor = atoi(*(av+1)); |
dv = atoi(*(av+1)); |
|
Risa_GC_set_adj(nm,dv); |
av += 2; ac -= 2; |
av += 2; ac -= 2; |
} else if ( !strcmp(*av,"-cpp") && (ac >= 2) ) { |
} else if ( !strcmp(*av,"-cpp") && (ac >= 2) ) { |
strcpy(cppname,*(av+1)); av += 2; ac -= 2; |
strcpy(cppname,*(av+1)); av += 2; ac -= 2; |
Line 528 void int_handler(int sig) |
|
Line 532 void int_handler(int sig) |
|
|
|
fprintf(stderr,"interrupt ?(q/t/c/d/u/w/?) "); fflush(stderr); |
fprintf(stderr,"interrupt ?(q/t/c/d/u/w/?) "); fflush(stderr); |
buf[0] = '\n'; |
buf[0] = '\n'; |
while ( buf[0] == '\n' ) |
while ( !feof(stdin) && buf[0] == '\n' ) |
fgets(buf,BUFSIZ,stdin); |
fgets(buf,BUFSIZ,stdin); |
|
if ( feof(stdin) ) { |
|
clearerr(stdin); |
|
continue; |
|
} |
switch ( c = buf[0] ) { |
switch ( c = buf[0] ) { |
case 'q': |
case 'q': |
while ( 1 ) { |
while ( 1 ) { |
Line 621 void ill_handler(int sig) |
|
Line 629 void ill_handler(int sig) |
|
#endif |
#endif |
} |
} |
|
|
|
#if defined(__DARWIN__) |
|
#define SIGNAL_FOR_TIMER SIGALRM |
|
#define ITIMER_TYPE ITIMER_REAL |
|
#else |
|
#define SIGNAL_FOR_TIMER SIGVTALRM |
|
#define ITIMER_TYPE ITIMER_VIRTUAL |
|
#endif |
|
|
void alrm_handler(int sig) |
void alrm_handler(int sig) |
{ |
{ |
fprintf(stderr,"interval timer expired (VTALRM)\n"); |
fprintf(stderr,"interval timer expired (VTALRM)\n"); |
Line 679 void error(char *s) |
|
Line 695 void error(char *s) |
|
|
|
#if !defined(VISUAL) |
#if !defined(VISUAL) |
if ( !error_in_timer && timer_is_set ) |
if ( !error_in_timer && timer_is_set ) |
alrm_handler(SIGVTALRM); |
alrm_handler(SIGNAL_FOR_TIMER); |
#endif |
#endif |
fprintf(stderr,"%s\n",s); |
fprintf(stderr,"%s\n",s); |
set_lasterror(s); |
set_lasterror(s); |
Line 716 void toplevel(char *s) |
|
Line 732 void toplevel(char *s) |
|
|
|
#if !defined(VISUAL) |
#if !defined(VISUAL) |
if ( timer_is_set ) |
if ( timer_is_set ) |
alrm_handler(SIGVTALRM); |
alrm_handler(SIGNAL_FOR_TIMER); |
#endif |
#endif |
fprintf(stderr,"%s\n",s); |
fprintf(stderr,"%s\n",s); |
if ( do_file ) { |
if ( do_file ) { |
Line 740 void set_timer(int interval) |
|
Line 756 void set_timer(int interval) |
|
it.it_interval.tv_usec = 0; |
it.it_interval.tv_usec = 0; |
it.it_value.tv_sec = interval; |
it.it_value.tv_sec = interval; |
it.it_value.tv_usec = 0; |
it.it_value.tv_usec = 0; |
setitimer(ITIMER_VIRTUAL,&it,0); |
setitimer(ITIMER_TYPE,&it,0); |
signal(SIGVTALRM,alrm_handler); |
signal(SIGNAL_FOR_TIMER,alrm_handler); |
timer_is_set = 1; |
timer_is_set = 1; |
} |
} |
|
|
Line 753 void reset_timer() |
|
Line 769 void reset_timer() |
|
it.it_interval.tv_usec = 0; |
it.it_interval.tv_usec = 0; |
it.it_value.tv_sec = 0; |
it.it_value.tv_sec = 0; |
it.it_value.tv_usec = 0; |
it.it_value.tv_usec = 0; |
setitimer(ITIMER_VIRTUAL,&it,0); |
setitimer(ITIMER_TYPE,&it,0); |
signal(SIGVTALRM,SIG_IGN); |
signal(SIGNAL_FOR_TIMER,SIG_IGN); |
timer_is_set = 0; |
timer_is_set = 0; |
} |
} |
#endif |
#endif |
Line 762 void reset_timer() |
|
Line 778 void reset_timer() |
|
unsigned int get_asir_version(); |
unsigned int get_asir_version(); |
char *get_asir_distribution(); |
char *get_asir_distribution(); |
|
|
|
char *get_gcversion() |
|
{ |
|
#if defined(GC7) |
|
return "GC 7.1 copyright 1988-2008, H-J. Boehm, A. J. Demers, Xerox, SGI, HP.\n"; |
|
#else |
|
return "GC 6.8 copyright 1988-2006, H-J. Boehm, A. J. Demers, Xerox, SGI, HP.\n"; |
|
#endif |
|
} |
|
|
char *get_pariversion() |
char *get_pariversion() |
{ |
{ |
#if PARI |
#if PARI |
Line 785 char *get_intervalversion() |
|
Line 810 char *get_intervalversion() |
|
|
|
void copyright() |
void copyright() |
{ |
{ |
char *format = "This is Risa/Asir%s, Version %d (%s Distribution).\nCopyright (C) 1994-2000, all rights reserved, FUJITSU LABORATORIES LIMITED.\nCopyright 2000-2007, Risa/Asir committers, http://www.openxm.org/.\nGC 6.5 Copyright 1988-2005, H-J. Boehm, A. J. Demers, Xerox, SGI, HP.\n%s"; |
char *scopyright(); |
printf(format, get_intervalversion(), get_asir_version(), get_asir_distribution(), get_pariversion()); |
fputs(scopyright(), stdout); |
} |
} |
|
|
char *scopyright() |
char *scopyright() |
{ |
{ |
static char *notice; |
static char *notice; |
char *s1, *s2, *s3; |
char *s1, *s2, *s3, *s4; |
int d, len; |
int d, len; |
char *format = "This is Risa/Asir%s, Version %d (%s Distribution).\nCopyright (C) 1994-2000, all rights reserved, FUJITSU LABORATORIES LIMITED.\nCopyright 2000-2007, Risa/Asir committers, http://www.openxm.org/.\nGC 6.5 copyright 1988-2005, H-J. Boehm, A. J. Demers, Xerox, SGI, HP.\n%s"; |
char *format = "This is Risa/Asir%s, Version %d (%s Distribution).\nCopyright (C) 1994-2000, all rights reserved, FUJITSU LABORATORIES LIMITED.\nCopyright 2000-2007, Risa/Asir committers, http://www.openxm.org/.\n%s%s"; |
if (!notice) { |
if (!notice) { |
s1 = get_intervalversion(); |
s1 = get_intervalversion(); |
s2 = get_asir_distribution(); |
s2 = get_asir_distribution(); |
s3 = get_pariversion(); |
s3 = get_gcversion(); |
|
s4 = get_pariversion(); |
d = get_asir_version(); |
d = get_asir_version(); |
len = (strlen(format)-8)+strlen(s1)+strlen(s2)+strlen(s3)+sizeof(int)*3; |
len = (strlen(format)-8)+strlen(s1)+strlen(s2)+strlen(s3)+strlen(s4)+sizeof(int)*3; |
notice = MALLOC(len+1); |
notice = MALLOC(len+1); |
sprintf(notice, format, s1, d, s2, s3); |
sprintf(notice, format, s1, d, s2, s3, s4); |
} |
} |
return notice; |
return notice; |
} |
} |