# 1 "comdraw_driver.c" # 1 "/opt/lush/src//" # 1 "" # 1 "" # 1 "comdraw_driver.c" # 29 "comdraw_driver.c" # 1 "../include/header.h" 1 # 34 "../include/header.h" # 1 "../include/define.h" 1 # 34 "../include/define.h" # 1 "../include/lushconf.h" 1 # 35 "../include/define.h" 2 # 47 "../include/define.h" # 1 "/usr/include/setjmp.h" 1 3 4 # 45 "/usr/include/setjmp.h" 3 4 # 1 "/usr/include/sys/cdefs.h" 1 3 4 # 46 "/usr/include/setjmp.h" 2 3 4 # 1 "/usr/include/machine/setjmp.h" 1 3 4 # 48 "/usr/include/machine/setjmp.h" 3 4 typedef struct _sigjmp_buf { int _sjb[11 + 1]; } sigjmp_buf[1]; typedef struct _jmp_buf { int _jb[11 + 1]; } jmp_buf[1]; # 49 "/usr/include/setjmp.h" 2 3 4 void _longjmp(jmp_buf, int) __attribute__((__noreturn__)); int _setjmp(jmp_buf); void longjmp(jmp_buf, int) __attribute__((__noreturn__)); void longjmperror(void); int setjmp(jmp_buf); void siglongjmp(sigjmp_buf, int) __attribute__((__noreturn__)); int sigsetjmp(sigjmp_buf, int); # 48 "../include/define.h" 2 # 1 "/usr/include/stdlib.h" 1 3 4 # 41 "/usr/include/stdlib.h" 3 4 # 1 "/usr/include/sys/_null.h" 1 3 4 # 42 "/usr/include/stdlib.h" 2 3 4 # 1 "/usr/include/sys/_types.h" 1 3 4 # 33 "/usr/include/sys/_types.h" 3 4 # 1 "/usr/include/machine/_types.h" 1 3 4 # 45 "/usr/include/machine/_types.h" 3 4 typedef signed char __int8_t; typedef unsigned char __uint8_t; typedef short __int16_t; typedef unsigned short __uint16_t; typedef int __int32_t; typedef unsigned int __uint32_t; typedef int __attribute__((__mode__(__DI__))) __int64_t; typedef unsigned int __attribute__((__mode__(__DI__))) __uint64_t; # 70 "/usr/include/machine/_types.h" 3 4 typedef unsigned long __clock_t; typedef unsigned int __cpumask_t; typedef __int32_t __critical_t; typedef double __double_t; typedef double __float_t; typedef __int32_t __intfptr_t; typedef __int64_t __intmax_t; typedef __int32_t __intptr_t; typedef __int32_t __int_fast8_t; typedef __int32_t __int_fast16_t; typedef __int32_t __int_fast32_t; typedef __int64_t __int_fast64_t; typedef __int8_t __int_least8_t; typedef __int16_t __int_least16_t; typedef __int32_t __int_least32_t; typedef __int64_t __int_least64_t; typedef __int32_t __ptrdiff_t; typedef __int32_t __register_t; typedef __int32_t __segsz_t; typedef __uint32_t __size_t; typedef __int32_t __ssize_t; typedef __int32_t __time_t; typedef __uint32_t __uintfptr_t; typedef __uint64_t __uintmax_t; typedef __uint32_t __uintptr_t; typedef __uint32_t __uint_fast8_t; typedef __uint32_t __uint_fast16_t; typedef __uint32_t __uint_fast32_t; typedef __uint64_t __uint_fast64_t; typedef __uint8_t __uint_least8_t; typedef __uint16_t __uint_least16_t; typedef __uint32_t __uint_least32_t; typedef __uint64_t __uint_least64_t; typedef __uint32_t __u_register_t; typedef __uint32_t __vm_offset_t; typedef __int64_t __vm_ooffset_t; typedef __uint32_t __vm_paddr_t; typedef __uint64_t __vm_pindex_t; typedef __uint32_t __vm_size_t; typedef __builtin_va_list __va_list; typedef __va_list __gnuc_va_list; # 34 "/usr/include/sys/_types.h" 2 3 4 typedef __int32_t __clockid_t; typedef __uint32_t __fflags_t; typedef __uint64_t __fsblkcnt_t; typedef __uint64_t __fsfilcnt_t; typedef __uint32_t __gid_t; typedef __int64_t __id_t; typedef __uint32_t __ino_t; typedef long __key_t; typedef __int32_t __lwpid_t; typedef __uint16_t __mode_t; typedef int __nl_item; typedef __uint16_t __nlink_t; typedef __int64_t __off_t; typedef __int32_t __pid_t; typedef __int64_t __rlim_t; typedef __uint8_t __sa_family_t; typedef __uint32_t __socklen_t; typedef long __suseconds_t; typedef __int32_t __timer_t; typedef __uint32_t __uid_t; typedef unsigned int __useconds_t; # 78 "/usr/include/sys/_types.h" 3 4 typedef int __ct_rune_t; typedef __ct_rune_t __rune_t; typedef __ct_rune_t __wchar_t; typedef __ct_rune_t __wint_t; typedef __uint32_t __dev_t; typedef __uint32_t __fixpt_t; typedef union { char __mbstate8[128]; __int64_t _mbstateL; } __mbstate_t; # 43 "/usr/include/stdlib.h" 2 3 4 typedef __rune_t rune_t; typedef __size_t size_t; typedef __wchar_t wchar_t; typedef struct { int quot; int rem; } div_t; typedef struct { long quot; long rem; } ldiv_t; extern int __mb_cur_max; void abort(void) __attribute__((__noreturn__)); int abs(int) __attribute__((__const__)); int atexit(void (*)(void)); double atof(const char *); int atoi(const char *); long atol(const char *); void *bsearch(const void *, const void *, size_t, size_t, int (*)(const void *, const void *)); void *calloc(size_t, size_t); div_t div(int, int) __attribute__((__const__)); void exit(int) __attribute__((__noreturn__)); void free(void *); char *getenv(const char *); long labs(long) __attribute__((__const__)); ldiv_t ldiv(long, long) __attribute__((__const__)); void *malloc(size_t); int mblen(const char *, size_t); size_t mbstowcs(wchar_t * , const char * , size_t); int mbtowc(wchar_t * , const char * , size_t); void qsort(void *, size_t, size_t, int (*)(const void *, const void *)); int rand(void); void *realloc(void *, size_t); void srand(unsigned); double strtod(const char * , char ** ); float strtof(const char * , char ** ); long strtol(const char * , char ** , int); long double strtold(const char * , char ** ); unsigned long strtoul(const char * , char ** , int); int system(const char *); int wctomb(char *, wchar_t); size_t wcstombs(char * , const wchar_t * , size_t); # 130 "/usr/include/stdlib.h" 3 4 typedef struct { long long quot; long long rem; } lldiv_t; long long atoll(const char *); long long llabs(long long) __attribute__((__const__)); lldiv_t lldiv(long long, long long) __attribute__((__const__)); long long strtoll(const char * , char ** , int); unsigned long long strtoull(const char * , char ** , int); void _Exit(int) __attribute__((__noreturn__)); # 161 "/usr/include/stdlib.h" 3 4 int rand_r(unsigned *); int setenv(const char *, const char *, int); void unsetenv(const char *); # 175 "/usr/include/stdlib.h" 3 4 double drand48(void); double erand48(unsigned short[3]); int getsubopt(char **, char *const *, char **); int grantpt(int); char *initstate(unsigned long , char *, long); long jrand48(unsigned short[3]); void lcong48(unsigned short[7]); long lrand48(void); int mkstemp(char *); char *mktemp(char *); long mrand48(void); long nrand48(unsigned short[3]); int posix_openpt(int); char *ptsname(int); int putenv(const char *); long random(void); char *realpath(const char *, char resolved_path[]); unsigned short *seed48(unsigned short[3]); int setkey(const char *); char *setstate( char *); void srand48(long); void srandom(unsigned long); int unlockpt(int); extern const char *_malloc_options; extern void (*_malloc_message)(const char *, const char *, const char *, const char *); # 235 "/usr/include/stdlib.h" 3 4 __uint32_t arc4random(void); void arc4random_addrandom(unsigned char *dat, int datlen); void arc4random_stir(void); char *getbsize(int *, long *); char *cgetcap(char *, const char *, int); int cgetclose(void); int cgetent(char **, char **, const char *); int cgetfirst(char **, char **); int cgetmatch(const char *, const char *); int cgetnext(char **, char **); int cgetnum(char *, const char *, long *); int cgetset(const char *); int cgetstr(char *, const char *, char **); int cgetustr(char *, const char *, char **); int daemon(int, int); char *devname(int, int); char *devname_r(int, int, char *, int); int getloadavg(double [], int); const char * getprogname(void); int heapsort(void *, size_t, size_t, int (*)(const void *, const void *)); int mergesort(void *, size_t, size_t, int (*)(const void *, const void *)); void qsort_r(void *, size_t, size_t, void *, int (*)(void *, const void *, const void *)); int radixsort(const unsigned char **, int, const unsigned char *, unsigned); void *reallocf(void *, size_t); void setprogname(const char *); int sradixsort(const unsigned char **, int, const unsigned char *, unsigned); void sranddev(void); void srandomdev(void); __int64_t strtoq(const char *, char **, int); __uint64_t strtouq(const char *, char **, int); extern char *suboptarg; # 49 "../include/define.h" 2 # 1 "/usr/include/stdio.h" 1 3 4 # 47 "/usr/include/stdio.h" 3 4 typedef __off_t fpos_t; # 56 "/usr/include/stdio.h" 3 4 typedef __va_list va_list; # 70 "/usr/include/stdio.h" 3 4 struct __sbuf { unsigned char *_base; int _size; }; struct __sFILEX; # 102 "/usr/include/stdio.h" 3 4 typedef struct __sFILE { unsigned char *_p; int _r; int _w; short _flags; short _file; struct __sbuf _bf; int _lbfsize; void *_cookie; int (*_close)(void *); int (*_read)(void *, char *, int); fpos_t (*_seek)(void *, fpos_t, int); int (*_write)(void *, const char *, int); struct __sbuf _ub; struct __sFILEX *_extra; int _ur; unsigned char _ubuf[3]; unsigned char _nbuf[1]; struct __sbuf _lb; int _blksize; fpos_t _offset; } FILE; extern FILE *__stdinp; extern FILE *__stdoutp; extern FILE *__stderrp; # 208 "/usr/include/stdio.h" 3 4 void clearerr(FILE *); int fclose(FILE *); int feof(FILE *); int ferror(FILE *); int fflush(FILE *); int fgetc(FILE *); int fgetpos(FILE * , fpos_t * ); char *fgets(char * , int, FILE * ); FILE *fopen(const char * , const char * ); int fprintf(FILE * , const char * , ...); int fputc(int, FILE *); int fputs(const char * , FILE * ); size_t fread(void * , size_t, size_t, FILE * ); FILE *freopen(const char * , const char * , FILE * ); int fscanf(FILE * , const char * , ...); int fseek(FILE *, long, int); int fsetpos(FILE *, const fpos_t *); long ftell(FILE *); size_t fwrite(const void * , size_t, size_t, FILE * ); int getc(FILE *); int getchar(void); char *gets(char *); void perror(const char *); int printf(const char * , ...); int putc(int, FILE *); int putchar(int); int puts(const char *); int remove(const char *); int rename(const char *, const char *); void rewind(FILE *); int scanf(const char * , ...); void setbuf(FILE * , char * ); int setvbuf(FILE * , char * , int, size_t); int sprintf(char * , const char * , ...); int sscanf(const char * , const char * , ...); FILE *tmpfile(void); char *tmpnam(char *); int ungetc(int, FILE *); int vfprintf(FILE * , const char * , __va_list); int vprintf(const char * , __va_list); int vsprintf(char * , const char * , __va_list); int snprintf(char * , size_t, const char * , ...) __attribute__((__format__ (__printf__, 3, 4))); int vfscanf(FILE * , const char * , __va_list) __attribute__((__format__ (__scanf__, 2, 0))); int vscanf(const char * , __va_list) __attribute__((__format__ (__scanf__, 1, 0))); int vsnprintf(char * , size_t, const char * , __va_list) __attribute__((__format__ (__printf__, 3, 0))); int vsscanf(const char * , const char * , __va_list) __attribute__((__format__ (__scanf__, 2, 0))); # 279 "/usr/include/stdio.h" 3 4 char *ctermid(char *); FILE *fdopen(int, const char *); int fileno(FILE *); int pclose(FILE *); FILE *popen(const char *, const char *); int ftrylockfile(FILE *); void flockfile(FILE *); void funlockfile(FILE *); int getc_unlocked(FILE *); int getchar_unlocked(void); int putc_unlocked(int, FILE *); int putchar_unlocked(int); void clearerr_unlocked(FILE *); int feof_unlocked(FILE *); int ferror_unlocked(FILE *); int fileno_unlocked(FILE *); int fseeko(FILE *, __off_t, int); __off_t ftello(FILE *); int getw(FILE *); int putw(int, FILE *); char *tempnam(const char *, const char *); int asprintf(char **, const char *, ...) __attribute__((__format__ (__printf__, 2, 3))); char *ctermid_r(char *); char *fgetln(FILE *, size_t *); const char *fmtcheck(const char *, const char *) __attribute__((__format_arg__(2))); int fpurge(FILE *); void setbuffer(FILE *, char *, int); int setlinebuf(FILE *); int vasprintf(char **, const char *, __va_list) __attribute__((__format__ (__printf__, 2, 0))); extern const int sys_nerr; extern const char *const sys_errlist[]; FILE *funopen(const void *, int (*)(void *, char *, int), int (*)(void *, const char *, int), fpos_t (*)(void *, fpos_t, int), int (*)(void *)); # 367 "/usr/include/stdio.h" 3 4 int ftruncate(int, __off_t); __off_t lseek(int, __off_t, int); void *mmap(void *, size_t, int, int, int, __off_t); int truncate(const char *, __off_t); int __srget(FILE *); int __swbuf(int, FILE *); static __inline int __sputc(int _c, FILE *_p) { if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n')) return (*_p->_p++ = _c); else return (__swbuf(_c, _p)); } # 420 "/usr/include/stdio.h" 3 4 extern int __isthreaded; # 454 "/usr/include/stdio.h" 3 4 # 50 "../include/define.h" 2 # 1 "/usr/include/ctype.h" 1 3 4 # 50 "/usr/include/ctype.h" 3 4 # 1 "/usr/include/_ctype.h" 1 3 4 # 74 "/usr/include/_ctype.h" 3 4 unsigned long ___runetype(__ct_rune_t); __ct_rune_t ___tolower(__ct_rune_t); __ct_rune_t ___toupper(__ct_rune_t); # 96 "/usr/include/_ctype.h" 3 4 # 1 "/usr/include/runetype.h" 1 3 4 # 52 "/usr/include/runetype.h" 3 4 typedef struct { __rune_t __min; __rune_t __max; __rune_t __map; unsigned long *__types; } _RuneEntry; typedef struct { int __nranges; _RuneEntry *__ranges; } _RuneRange; typedef struct { char __magic[8]; char __encoding[32]; __rune_t (*__sgetrune)(const char *, __size_t, char const **); int (*__sputrune)(__rune_t, char *, __size_t, char **); __rune_t __invalid_rune; unsigned long __runetype[(1 <<8 )]; __rune_t __maplower[(1 <<8 )]; __rune_t __mapupper[(1 <<8 )]; _RuneRange __runetype_ext; _RuneRange __maplower_ext; _RuneRange __mapupper_ext; void *__variable; int __variable_len; } _RuneLocale; extern _RuneLocale _DefaultRuneLocale; extern _RuneLocale *_CurrentRuneLocale; # 97 "/usr/include/_ctype.h" 2 3 4 static __inline int __maskrune(__ct_rune_t _c, unsigned long _f) { return ((_c < 0 || _c >= (1 <<8 )) ? ___runetype(_c) : _CurrentRuneLocale->__runetype[_c]) & _f; } static __inline int __istype(__ct_rune_t _c, unsigned long _f) { return (!!__maskrune(_c, _f)); } static __inline int __isctype(__ct_rune_t _c, unsigned long _f) { return (_c < 0 || _c >= (1 <<8 )) ? 0 : !!(_DefaultRuneLocale.__runetype[_c] & _f); } static __inline __ct_rune_t __toupper(__ct_rune_t _c) { return (_c < 0 || _c >= (1 <<8 )) ? ___toupper(_c) : _CurrentRuneLocale->__mapupper[_c]; } static __inline __ct_rune_t __tolower(__ct_rune_t _c) { return (_c < 0 || _c >= (1 <<8 )) ? ___tolower(_c) : _CurrentRuneLocale->__maplower[_c]; } static __inline int __wcwidth(__ct_rune_t _c) { unsigned int _x; if (_c == 0) return (0); _x = (unsigned int)__maskrune(_c, 0xe0000000L|0x00040000L); if ((_x & 0xe0000000L) != 0) return ((_x & 0xe0000000L) >> 30); return ((_x & 0x00040000L) != 0 ? 1 : -1); } # 51 "/usr/include/ctype.h" 2 3 4 int isalnum(int); int isalpha(int); int iscntrl(int); int isdigit(int); int isgraph(int); int islower(int); int isprint(int); int ispunct(int); int isspace(int); int isupper(int); int isxdigit(int); int tolower(int); int toupper(int); int _tolower(int); int _toupper(int); int isascii(int); int toascii(int); int isblank(int); int digittoint(int); int ishexnumber(int); int isideogram(int); int isnumber(int); int isphonogram(int); int isrune(int); int isspecial(int); # 51 "../include/define.h" 2 # 1 "/usr/include/math.h" 1 3 4 # 22 "/usr/include/math.h" 3 4 # 1 "/usr/include/machine/_limits.h" 1 3 4 # 23 "/usr/include/math.h" 2 3 4 extern const union __infinity_un { unsigned char __uc[8]; double __ud; } __infinity; extern const union __nan_un { unsigned char __uc[sizeof(float)]; float __uf; } __nan; # 121 "/usr/include/math.h" 3 4 typedef __double_t double_t; typedef __float_t float_t; # 144 "/usr/include/math.h" 3 4 extern int signgam; enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix}; # 160 "/usr/include/math.h" 3 4 extern enum fdversion _fdlib_version; # 170 "/usr/include/math.h" 3 4 struct exception { int type; char *name; double arg1; double arg2; double retval; }; # 204 "/usr/include/math.h" 3 4 int __fpclassifyd(double) __attribute__((__const__)); int __fpclassifyf(float) __attribute__((__const__)); int __fpclassifyl(long double) __attribute__((__const__)); int __isfinitef(float) __attribute__((__const__)); int __isfinite(double) __attribute__((__const__)); int __isfinitel(long double) __attribute__((__const__)); int __isinff(float) __attribute__((__const__)); int __isinfl(long double) __attribute__((__const__)); int __isnanl(long double) __attribute__((__const__)); int __isnormalf(float) __attribute__((__const__)); int __isnormal(double) __attribute__((__const__)); int __isnormall(long double) __attribute__((__const__)); int __signbit(double) __attribute__((__const__)); int __signbitf(float) __attribute__((__const__)); int __signbitl(long double) __attribute__((__const__)); double acos(double); double asin(double); double atan(double); double atan2(double, double); double cos(double); double sin(double); double tan(double); double cosh(double); double sinh(double); double tanh(double); double exp(double); double frexp(double, int *); double ldexp(double, int); double log(double); double log10(double); double modf(double, double *); double pow(double, double); double sqrt(double); double ceil(double); double fabs(double); double floor(double); double fmod(double, double); double acosh(double); double asinh(double); double atanh(double); double cbrt(double) __attribute__((__const__)); double erf(double); double erfc(double) __attribute__((__const__)); double expm1(double) __attribute__((__const__)); double hypot(double, double); int ilogb(double); int (isinf)(double) __attribute__((__const__)); int (isnan)(double) __attribute__((__const__)); double lgamma(double); double log1p(double) __attribute__((__const__)); double logb(double) __attribute__((__const__)); double nextafter(double, double); double remainder(double, double); double rint(double) __attribute__((__const__)); double j0(double); double j1(double); double jn(int, double); double scalb(double, double); double y0(double); double y1(double); double yn(int, double); double gamma(double); double copysign(double, double) __attribute__((__const__)); double fdim(double, double); double fmax(double, double) __attribute__((__const__)); double fmin(double, double) __attribute__((__const__)); double nearbyint(double) __attribute__((__const__)); double round(double); double scalbln(double, long); double scalbn(double, int); double tgamma(double); double trunc(double); double drem(double, double); int finite(double) __attribute__((__const__)); int isnanf(float) __attribute__((__const__)); double gamma_r(double, int *); double lgamma_r(double, int *); double significand(double); int matherr(struct exception *); float acosf(float); float asinf(float); float atanf(float); float atan2f(float, float); float cosf(float); float sinf(float); float tanf(float); float coshf(float); float sinhf(float); float tanhf(float); float expf(float); float expm1f(float) __attribute__((__const__)); float frexpf(float, int *); int ilogbf(float); float ldexpf(float, int); float log10f(float); float log1pf(float) __attribute__((__const__)); float logf(float); float modff(float, float *); float powf(float, float); float sqrtf(float); float ceilf(float); float fabsf(float); float floorf(float); float fmodf(float, float); float roundf(float); float erff(float); float erfcf(float) __attribute__((__const__)); float hypotf(float, float) __attribute__((__const__)); float lgammaf(float); float acoshf(float); float asinhf(float); float atanhf(float); float cbrtf(float) __attribute__((__const__)); float logbf(float) __attribute__((__const__)); float copysignf(float, float) __attribute__((__const__)); float nearbyintf(float) __attribute__((__const__)); float nextafterf(float, float); float remainderf(float, float); float rintf(float); float scalblnf(float, long); float scalbnf(float, int); float truncf(float); float fdimf(float, float); float fmaxf(float, float) __attribute__((__const__)); float fminf(float, float) __attribute__((__const__)); float dremf(float, float); int finitef(float) __attribute__((__const__)); float gammaf(float); float j0f(float); float j1f(float); float jnf(int, float); float scalbf(float, float); float y0f(float); float y1f(float); float ynf(int, float); float gammaf_r(float, int *); float lgammaf_r(float, int *); float significandf(float); # 428 "/usr/include/math.h" 3 4 long double copysignl(long double, long double); # 438 "/usr/include/math.h" 3 4 long double fabsl(long double); long double fdiml(long double, long double); long double fmaxl(long double, long double) __attribute__((__const__)); long double fminl(long double, long double) __attribute__((__const__)); # 486 "/usr/include/math.h" 3 4 # 52 "../include/define.h" 2 # 1 "/usr/include/string.h" 1 3 4 # 49 "/usr/include/string.h" 3 4 # 1 "/usr/include/strings.h" 1 3 4 # 40 "/usr/include/strings.h" 3 4 int bcmp(const void *, const void *, size_t) __attribute__((__pure__)); void bcopy(const void *, void *, size_t); void bzero(void *, size_t); int ffs(int) __attribute__((__const__)); int ffsl(long) __attribute__((__const__)); int fls(int) __attribute__((__const__)); int flsl(long) __attribute__((__const__)); char *index(const char *, int) __attribute__((__pure__)); char *rindex(const char *, int) __attribute__((__pure__)); int strcasecmp(const char *, const char *) __attribute__((__pure__)); int strncasecmp(const char *, const char *, size_t) __attribute__((__pure__)); # 50 "/usr/include/string.h" 2 3 4 void *memccpy(void * , const void * , int, size_t); void *memchr(const void *, int, size_t) __attribute__((__pure__)); int memcmp(const void *, const void *, size_t) __attribute__((__pure__)); void *memcpy(void * , const void * , size_t); void *memmove(void *, const void *, size_t); void *memset(void *, int, size_t); char *stpcpy(char *, const char *); char *strcasestr(const char *, const char *) __attribute__((__pure__)); char *strcat(char * , const char * ); char *strchr(const char *, int) __attribute__((__pure__)); int strcmp(const char *, const char *) __attribute__((__pure__)); int strcoll(const char *, const char *); char *strcpy(char * , const char * ); size_t strcspn(const char *, const char *) __attribute__((__pure__)); char *strdup(const char *); char *strerror(int); int strerror_r(int, char *, size_t); size_t strlcat(char *, const char *, size_t); size_t strlcpy(char *, const char *, size_t); size_t strlen(const char *) __attribute__((__pure__)); void strmode(int, char *); char *strncat(char * , const char * , size_t); int strncmp(const char *, const char *, size_t) __attribute__((__pure__)); char *strncpy(char * , const char * , size_t); char *strnstr(const char *, const char *, size_t) __attribute__((__pure__)); char *strpbrk(const char *, const char *) __attribute__((__pure__)); char *strrchr(const char *, int) __attribute__((__pure__)); char *strsep(char **, const char *); char *strsignal(int); size_t strspn(const char *, const char *) __attribute__((__pure__)); char *strstr(const char *, const char *) __attribute__((__pure__)); char *strtok(char * , const char * ); char *strtok_r(char *, const char *, char **); size_t strxfrm(char * , const char * , size_t); void swab(const void *, void *, size_t); # 53 "../include/define.h" 2 typedef void* gptr; # 35 "../include/header.h" 2 # 1 "/usr/include/sys/types.h" 1 # 44 "/usr/include/sys/types.h" # 1 "/usr/include/machine/endian.h" 1 3 4 # 152 "/usr/include/machine/endian.h" 3 4 static __inline __uint64_t __bswap64(__uint64_t _x) { return ((_x >> 56) | ((_x >> 40) & 0xff00) | ((_x >> 24) & 0xff0000) | ((_x >> 8) & 0xff000000) | ((_x << 8) & ((__uint64_t)0xff << 32)) | ((_x << 24) & ((__uint64_t)0xff << 40)) | ((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56))); } static __inline __uint32_t __bswap32(__uint32_t _x) { return ((__builtin_constant_p(_x) ? ((((_x) & 0xff000000) >> 24) | (((_x) & 0x00ff0000) >> 8) | (((_x) & 0x0000ff00) << 8) | (((_x) & 0x000000ff) << 24)) : __extension__ ({ register __uint32_t __X = (_x); __asm ("xchgb %h0, %b0\n\trorl $16, %0\n\txchgb %h0, %b0" : "+q" (__X)); __X; }))); } static __inline __uint16_t __bswap16(__uint16_t _x) { return ((__builtin_constant_p(_x) ? ((((_x) & 0xff00) >> 8) | (((_x) & 0x00ff) << 8)) : __extension__ ({ register __uint16_t __X = (_x); __asm ("xchgb %h0, %b0" : "+q" (__X)); __X; }))); } # 45 "/usr/include/sys/types.h" 2 typedef unsigned char u_char; typedef unsigned short u_short; typedef unsigned int u_int; typedef unsigned long u_long; typedef unsigned short ushort; typedef unsigned int uint; typedef __int8_t int8_t; typedef __int16_t int16_t; typedef __int32_t int32_t; typedef __int64_t int64_t; typedef __uint8_t uint8_t; typedef __uint16_t uint16_t; typedef __uint32_t uint32_t; typedef __uint64_t uint64_t; typedef __intptr_t intptr_t; typedef __uintptr_t uintptr_t; typedef __uint8_t u_int8_t; typedef __uint16_t u_int16_t; typedef __uint32_t u_int32_t; typedef __uint64_t u_int64_t; typedef __uint64_t u_quad_t; typedef __int64_t quad_t; typedef quad_t * qaddr_t; typedef char * caddr_t; typedef const char * c_caddr_t; typedef volatile char *v_caddr_t; typedef __clock_t clock_t; typedef __clockid_t clockid_t; typedef __critical_t critical_t; typedef __int64_t daddr_t; typedef __dev_t dev_t; typedef __fflags_t fflags_t; typedef __fixpt_t fixpt_t; typedef __fsblkcnt_t fsblkcnt_t; typedef __fsfilcnt_t fsfilcnt_t; typedef __gid_t gid_t; typedef __uint32_t in_addr_t; typedef __uint16_t in_port_t; typedef __id_t id_t; typedef __ino_t ino_t; typedef __key_t key_t; typedef __lwpid_t lwpid_t; typedef __mode_t mode_t; typedef __nlink_t nlink_t; typedef __off_t off_t; typedef __pid_t pid_t; typedef __register_t register_t; typedef __rlim_t rlim_t; typedef __segsz_t segsz_t; typedef __ssize_t ssize_t; typedef __suseconds_t suseconds_t; typedef __time_t time_t; typedef __timer_t timer_t; typedef __u_register_t u_register_t; typedef __uid_t uid_t; typedef __useconds_t useconds_t; typedef __vm_offset_t vm_offset_t; typedef __vm_ooffset_t vm_ooffset_t; typedef __vm_paddr_t vm_paddr_t; typedef __vm_pindex_t vm_pindex_t; typedef __vm_size_t vm_size_t; # 287 "/usr/include/sys/types.h" # 1 "/usr/include/sys/select.h" 1 3 4 # 38 "/usr/include/sys/select.h" 3 4 # 1 "/usr/include/sys/_sigset.h" 1 3 4 # 51 "/usr/include/sys/_sigset.h" 3 4 typedef struct __sigset { __uint32_t __bits[4]; } __sigset_t; # 39 "/usr/include/sys/select.h" 2 3 4 # 1 "/usr/include/sys/_timeval.h" 1 3 4 # 47 "/usr/include/sys/_timeval.h" 3 4 struct timeval { long tv_sec; suseconds_t tv_usec; }; # 40 "/usr/include/sys/select.h" 2 3 4 # 1 "/usr/include/sys/timespec.h" 1 3 4 # 46 "/usr/include/sys/timespec.h" 3 4 struct timespec { time_t tv_sec; long tv_nsec; }; # 41 "/usr/include/sys/select.h" 2 3 4 typedef unsigned long __fd_mask; typedef __fd_mask fd_mask; typedef __sigset_t sigset_t; # 71 "/usr/include/sys/select.h" 3 4 typedef struct fd_set { __fd_mask __fds_bits[(((1024U) + (((sizeof(__fd_mask) * 8)) - 1)) / ((sizeof(__fd_mask) * 8)))]; } fd_set; # 97 "/usr/include/sys/select.h" 3 4 int pselect(int, fd_set *, fd_set *, fd_set *, const struct timespec *, const sigset_t *); int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); # 288 "/usr/include/sys/types.h" 2 # 307 "/usr/include/sys/types.h" # 324 "/usr/include/sys/types.h" # 37 "../include/header.h" 2 # 1 "../include/fltlib.h" 1 # 124 "../include/fltlib.h" float FQtanh(float x); float FQDtanh(float x); float FQstdsigmoid(float x); float FQDstdsigmoid(float x); float FQexpmx(float x); float FQDexpmx(float x); float FQexpmx2(float x); float FQDexpmx2(float x); void Fsplinit(int size, float *parm); float Fspline(float x, int size, float *parm); float Fdspline(float x, int size, float *parm); float Frand(void); float Fgauss(void); void Fseed(int x); # 39 "../include/header.h" 2 # 72 "../include/header.h" typedef struct dhclassdoc_s dhclassdoc_t; typedef struct dhdoc_s dhdoc_t; extern int break_attempt; void lastchance(char *s) __attribute__((__noreturn__)); void toplevel_unix(void); void console_getline(char *prompt, char *buf, int size); void init_user(void); int init_user_dll(int major, int minor); void filteropen(const char *cmd, FILE **pfw, FILE **pfr); void filteropenpty(const char *cmd, FILE **pfw, FILE **pfr); FILE* unix_popen(const char *cmd, const char *mode); int unix_pclose(FILE *f); int unix_setenv(const char *name, const char *value); # 129 "../include/header.h" typedef struct at { unsigned int count; unsigned short flags; unsigned short ident; union { struct { struct at *at_car, *at_cdr; } at_cons; double at_number; gptr at_gptr; struct { gptr at_object; struct TLclass *at_class; } at_extern; } at_union; } at; # 189 "../include/header.h" extern at *(*eval_ptr) (at*); extern at *(*argeval_ptr) (at*); # 201 "../include/header.h" typedef struct TLclass { void (*self_dispose) (at*); void (*self_action) (at*, void (*f)(at*)); char* (*self_name) (at*); at* (*self_eval) (at*); at* (*list_eval) (at*, at*); void (*serialize) (at**, int); int (*compare) (at*, at*, int); unsigned long (*hash) (at*); at* (*getslot) (at*, at*); void (*setslot) (at*, at*, at*); at* classname; at* priminame; at* backptr; int slotssofar; at* keylist; at* defaults; at* atsuper; struct TLclass* super; struct TLclass* subclasses; struct TLclass* nextclass; at* methods; struct hashelem* hashtable; int hashsize; char hashok; char goaway; char dontdelete; dhclassdoc_t *classdoc; } TLclass; struct hashelem { at *symbol; at *function; int sofar; }; void purge (register at *q); at *new_gptr(gptr x); at *new_number(double x); at *new_extern(TLclass *cl, void *obj); at *new_cons(at *car, at *cdr); at *cons(at *car, at *cdr); at *car(at *q); at *caar(at *q); at *cadr(at *q); at *cdr(at *q); at *cdar(at *q); at *cddr(at *q); at *rplaca(at *q, at *p); at *rplacd(at *q, at *p); at *displace(at *q, at *p); int length(at *p); at *member(at *elem, at *list); at *nfirst(int n, at *l); at *nth(at *l, int n); at *nthcdr(at *l, int n); at *last(at *list); at *lastcdr(at *list); at *flatten(at *l); at *append(at *l1, at *l2); at *reverse(at *l); at *assoc(at *k, at *l); int used(void); void generic_dispose(at *p); void generic_action(at *p, void (*action) (at*)); char *generic_name(at *p); at *generic_eval(at *p); at *generic_listeval(at *p, at *q); # 284 "../include/header.h" at *eval_std(at *p); at *eval_debug(at *q); at *eval_nothing(at *q); at *apply(at *q, at *p); at *progn(at *p); at *prog1(at *p); at *mapc(at *f, at **listes, int arg_number); at *rmapc(at *f, at **listes, int arg_number); at *mapcar(at *f, at **listes, int arg_number); at *rmapcar(at *f, at **listes, int arg_number); # 303 "../include/header.h" struct empty_alloc { int used; struct empty_alloc *next; }; struct chunk_header { struct chunk_header *next; gptr begin; gptr end; gptr pad; }; struct alloc_root { struct empty_alloc *freelist; struct chunk_header *chunklist; int elemsize; int chunksize; }; gptr allocate(struct alloc_root *ar); void deallocate(struct alloc_root *ar, struct empty_alloc *elem); extern struct alloc_root at_alloc; # 340 "../include/header.h" void protect(at *q); void unprotect(at *q); void add_finalizer(at *q, void(*)(at*,void*), void*); void run_finalizers(at *q); void del_finalizers(void*); void garbage(int flag); void *lush_malloc(int,char*,int); void *lush_calloc(int,int,char*,int); void *lush_realloc(gptr,int,char*,int); void lush_free(gptr,char*,int); void lush_cfree(gptr,char*,int); void set_malloc_file(char*); # 371 "../include/header.h" struct hash_name { short used; char *name; at *named; struct hash_name *next; unsigned long hash; }; extern struct hash_name *names[]; # 396 "../include/header.h" extern TLclass symbol_class; struct symbol { short mode, nopurge; struct symbol *next; struct hash_name *name; at *value; at **valueptr; }; at *new_symbol(char *s); at *named(char *s); at *namedclean(char *s); char *nameof(at *p); void symbol_push (at *p, at *q); void symbol_pop (at *p); at *setq(at *p, at *q); at *symblist(void); at *oblist(void); at *TLtrue(void); void var_set(at *p, at *q); void var_SET(at *p, at *q); void var_lock(at *p); at *var_get(at *p); at *var_define(char *s); struct recur_elt { struct recur_elt *next; void *call; at *p; }; extern struct recur_doc { int hsize; int hbuckets; struct recur_elt **htable; } recur_doc; extern struct error_doc { at *this_call; at *error_call; char *error_prefix; char *error_text; at *error_suffix; short debug_tab; short ready_to_an_error; short debug_toplevel; short script_mode; FILE *script_file; } error_doc; # 470 "../include/header.h" extern struct context { struct context *next; sigjmp_buf error_jump; FILE *input_file; FILE *output_file; short input_tab; short output_tab; } *context; void context_push(struct context *newc); void context_pop(void); int recur_push_ok(struct recur_elt *elt, void *call, at *p); void recur_pop(struct recur_elt *elt); void toplevel(char *in, char *out, char *new_prompt); void TLerror(char *prefix, char *text, at *suffix) __attribute__((__noreturn__)); void user_break(char *s); void init_lush (char *program_name); void start_lisp(int argc, char **argv, int quiet); void clean_up(void); void TLabort (char *s) __attribute__((__noreturn__)); extern TLclass string_class; struct string { int flag; char *start; void *cptr; }; at *new_string(char *s); at *new_safe_string(char *s); at *new_string_bylen(int n); int str_index(char *s1, char *s2, int start); at *str_val(char *s); char *str_number(double x); char *str_number_hex(double x); char *str_gptr(gptr x); char *regex_compile(char *pattern, short int *bufstart, short int *bufend, int strict, int *rnum); int regex_exec(short int *buffer, char *string, char **regptr, int *reglen, int nregs); int regex_seek(short int *buffer, char *string, char *seekstart, char **regptr, int *reglen, int nregs, char **start, char **end); extern char *string_buffer; extern char null_string[]; extern char digit_string[]; extern char special_string[]; extern char aspect_string[]; struct large_string { char *p; char buffer[1024]; at *backup; at **where; }; void large_string_init(struct large_string *ls); void large_string_add(struct large_string *ls, char *s, int len); at * large_string_collect(struct large_string *ls); # 551 "../include/header.h" struct cfunction { int used; at *name; void *call; void *info; }; struct lfunction { int used; at *formal_arg_list; at *evaluable_list; }; extern TLclass de_class; extern TLclass df_class; extern TLclass dm_class; extern TLclass dx_class; extern TLclass dy_class; extern at **dx_stack, **dx_sp; extern struct alloc_root function_alloc; at *new_de(at *formal, at *evaluable); at *new_df(at *formal, at *evaluable); at *new_dm(at *formal, at *evaluable); at *new_dx(at *name, at *(*addr)(int,at**)); at *new_dy(at *name, at *(*addr)(at *)); at *funcdef(at *f); at *eval_a_list(at *p); gptr need_error(int i, int j, at **arg_array_ptr); void arg_eval(at **arg_array, int i); void all_args_eval(at **arg_array, int i); # 622 "../include/header.h" extern TLclass file_R_class, file_W_class; extern char lushdir_name[]; extern char file_name[]; char *cwd(char *s); at *files(char *s); int dirp(char *s); int filep(char *s); char *TLdirname(char *fname); char *TLbasename(char *fname, char *suffix); char *concat_fname(char *from, char *fname); char *relative_fname(char *from, char *fname); void clean_tmp_files(void); char *tmpname(char *s, char *suffix); char *search_file(char *s, char *suffixes); void test_file_error(FILE *f); FILE *open_read(char *s, char *suffixes); FILE *open_write(char *s, char *suffixes); FILE *open_append(char *s, char *suffixes); FILE *attempt_open_read(char *s, char *suffixes); FILE *attempt_open_write(char *s, char *suffixes); FILE *attempt_open_append(char *s, char *suffixes); void file_close(FILE *f); void set_script(char *s); int read4(FILE *f); int write4(FILE *f, unsigned int l); off_t file_size(FILE *f); # 660 "../include/header.h" extern char *line_pos; extern char *line_buffer; extern char *prompt_string; void print_char (char c); void print_string(char *s); void print_list(at *list); void print_tab(int n); char *pname(at *l); char *first_line(at *l); char read_char(void); char next_char(void); int ask (char *t); char *read_word(void); char *dmc(char *s, at *l); char skip_char(char *s); at *read_list(void); extern TLclass htable_class; unsigned long hash_value(at *); unsigned long hash_pointer(at *); at *new_htable(int nelems, int pointerhashp); void htable_set(at *htable, at *key, at *value); at *htable_get(at *htable, at *key); double mean(at *l); double sdev(at *l); double cov(at *l1, at *l2); double sum(at *p); double sup(at *p); double inf(at *p); at *rank(at *l, double target, double width); double sup_norm(at *l); double sup_dist(at *l1, at *l2); double abs_norm(at *l); double abs_dist(at *l1, at *l2); double sqr_norm(at *l); double sqr_dist(at *l1, at *l2); double hamming_norm(at *l, double margin); double hamming_dist(at *l1, at *l2, double margin); double quadrant_dist(at *l1, at *l2); double solve(double x1, double x2, double (*f) (double)); at *makelist(int n, at *v); int comp_test(at *p, at *q); int eq_test (at *p, at *q); extern TLclass class_class; extern TLclass object_class; extern TLclass number_class; extern TLclass gptr_class; extern TLclass zombie_class; extern struct alloc_root class_alloc; struct oostruct { int size; at *TLclass; void *cptr; struct oostructitem { at *symb, *val; } slots[1]; }; at *new_ooclass(at *classname, at *superclass, at *keylist, at *defaults); void putmethod(TLclass *cl, at *name, at *fun); at *new_oostruct(at *cl); at *letslot(at *obj, at *f, at *q, int howmuch); at *checksend(TLclass *cl, at *prop); at *send_message(at *classname, at *obj, at *method, at *args); at *classof(at *p); int is_of_class(at *p, TLclass *cl); void delete_at(at *p); at *getslot(at*, at*); void setslot(at**, at*, at*); extern TLclass module_class; void class_define(char *name, TLclass *cl); void dx_define(char *name, at *(*addr) (int, at **)); void dy_define(char *name, at *(*addr) (at *)); void dxmethod_define(TLclass *cl, char *name, at *(*addr) (int, at **)); void dymethod_define(TLclass *cl, char *name, at *(*addr) (at *)); void dhclass_define(char *name, dhclassdoc_t *kclass); void dh_define(char *name, dhdoc_t *kname); void dhmethod_define(dhclassdoc_t *kclass, char *name, dhdoc_t *kname); void check_primitive(at *prim); at *find_primitive(at *module, at *name); at *module_list(void); at *module_load(char *filename, at *hook); void module_unload(at *atmodule); # 778 "../include/header.h" extern char *ansidatenames[]; extern TLclass date_class; char *str_date( at *p, int *pfrom, int *pto ); at *new_date( char *s, int from, int to ); at *new_date_from_time( void *clock, int from, int to ); enum serialize_action { SRZ_SETFL, SRZ_CLRFL, SRZ_WRITE, SRZ_READ }; int bwrite(at *p, FILE *f, int opt); at *bread(FILE *f, int opt); void serialize_char(char *data, int code); void serialize_short(short int *data, int code); void serialize_int(int *data, int code); void serialize_string(char **data, int code, int maxlen); void serialize_chars(void **data, int code, int len); void serialize_flt(float *data, int code); void serialize_real(double *data, int code); void serialize_float(float *data, int code); void serialize_double(double *data, int code); int serialize_atstar(at **data, int code); FILE *serialization_file_descriptor(int code); float getnanF (void); int isnanF(float x); float infinityF (void); int isinfF(float x); double getnanD (void); int isnanD(double x); double infinityD (void); int isinfD(double x); union dz_inst { struct op_type { short op; short arg; } code; float constant; }; struct dz_cell { float (*call)(float x0, ...); int num_arg; int program_size; int required_stack; union dz_inst *program; }; extern TLclass dz_class; extern int dz_trace; extern float dz_stack[(int)1000]; float dz_execute(float x, struct dz_cell *dz); void dz_define(char *name, char *opcode, float (*cfun)(float)); extern TLclass AT_storage_class; extern TLclass P_storage_class; extern TLclass F_storage_class; extern TLclass D_storage_class; extern TLclass I32_storage_class; extern TLclass I16_storage_class; extern TLclass I8_storage_class; extern TLclass U8_storage_class; extern TLclass PTR_storage_class; enum storage_type { ST_AT, ST_P, ST_F, ST_D, ST_I32, ST_I16, ST_I8, ST_U8, ST_GPTR, ST_LAST }; extern int storage_type_size[ST_LAST]; extern float (*storage_type_getf[ST_LAST])(gptr, int); extern void (*storage_type_setf[ST_LAST])(gptr, int, float); extern double (*storage_type_getr[ST_LAST])(gptr, int); extern void (*storage_type_setr[ST_LAST])(gptr, int, double); # 900 "../include/header.h" struct srg { short flags; unsigned char type; unsigned char pad; int size; gptr data; }; struct storage { struct srg srg; void (*read_srg)(struct storage *); void (*write_srg)(struct storage *); void (*rls_srg)(struct storage *); at* (*getat)(struct storage *,int); void (*setat)(struct storage *,int,at*); at *atst; struct srg *cptr; union allinfo { struct { gptr addr; } sts_malloc; struct { gptr addr; gptr xtra; int len; } sts_mmap; # 948 "../include/header.h" } allinfo; }; void storage_read_srg(struct storage *); void storage_write_srg(struct storage *st); void storage_rls_srg(struct storage *st); at *new_AT_storage(void); at *new_P_storage(void); at *new_F_storage(void); at *new_D_storage(void); at *new_I32_storage(void); at *new_I16_storage(void); at *new_I8_storage(void); at *new_U8_storage(void); at *new_GPTR_storage(void); at *new_storage(int,int); at *new_storage_nc(int,int); void storage_malloc(at*, int, int); void storage_realloc(at*, int, int ); void storage_mmap(at*, FILE*, int); int storagep(at*); void storage_clear(at *p); int storage_load(at*, FILE*); void storage_save(at*, FILE*); # 984 "../include/header.h" extern TLclass index_class; struct idx { short ndim; short flags; int offset; int *dim; int *mod; struct srg *srg; }; struct index { short flags; short ndim; int offset; int dim[8]; int mod[8]; at *atst; struct storage *st; float **nr0; float **nr1; struct idx *cptr; }; int indexp(at*); int matrixp(at*); int arrayp(at*); at *new_index(at*); void index_dimension(at*,int,int[]); void index_undimension(at*); void index_from_index(at*,at*,int*,int*); struct index *easy_index_check(at*,int,int[]); double easy_index_get(struct index*, int*); void easy_index_set(struct index*, int*, double); char *not_a_nrvector(at*); char *not_a_nrmatrix(at*); float *make_nrvector(at*,int,int*); float **make_nrmatrix(at*,int,int,int*,int*); at *copy_matrix(at *, at *); at *AT_matrix(int,int*); at *F_matrix(int,int*); at *D_matrix(int,int*); at *P_matrix(int,int*); at *I32_matrix(int,int*); at *I16_matrix(int,int*); at *I8_matrix(int,int*); at *U8_matrix(int,int*); at *GPTR_matrix(int,int*); void index_read_idx(struct index *, struct idx *); void index_write_idx(struct index *, struct idx *); void index_rls_idx(struct index *, struct idx *); void import_raw_matrix(at *p, FILE *f, int offset); void import_text_matrix(at *p, FILE *f); int save_matrix_len (at *p); void save_matrix(at *p, FILE *f); void export_matrix(at *p, FILE *f); void save_ascii_matrix(at *p, FILE *f); void export_ascii_matrix(at *p, FILE *f); at *load_matrix(FILE *f); # 1221 "../include/header.h" # 1 "../include/check_func.h" 1 # 51 "../include/check_func.h" struct dh_trace_stack { char *info; struct dh_trace_stack *next; }; extern struct dh_trace_stack *dh_trace_root; void print_dh_recent(int,FILE*); void print_dh_trace_stack(void); # 87 "../include/check_func.h" void run_time_error(char *); extern char *rterr_bound; extern char *rterr_rtype; extern char *rterr_dim; extern char *rterr_loopdim; extern char *rterr_emptystr; extern char *rterr_range; extern char *rterr_srg_of; extern char *rterr_unsized_matrix; extern char *rterr_not_same_dim; extern char *rterr_out_of_memory; extern char *rterr_cannot_realloc; extern char *rterr_bad_dimensions; # 124 "../include/check_func.h" void check_obj_class(void *obj, void *classvtable); void srg_resize_compiled(struct srg* ,int ,char *, int); void srg_resize(struct srg *, int , char *, int ); void srg_free(struct srg *); # 344 "../include/check_func.h" void check_main_maout(struct idx *i1, struct idx *i2); void check_main_main_maout(struct idx *i0, struct idx *i1, struct idx *i2); void check_main_m0out(struct idx *i1, struct idx *i2); void check_main_main_m0out(struct idx *i0, struct idx *i1, struct idx *i2); void check_main_m0in_maout(struct idx *i0, struct idx *i1, struct idx *i2); void check_main_main_maout_dot21(struct idx *i0, struct idx *i1, struct idx *i2); void check_main_main_maout_dot42(struct idx *i0, struct idx *i1, struct idx *i2); void check_m1in_m1in_m2out(struct idx *i0, struct idx *i1, struct idx *i2); void check_m2in_m2in_m4out(struct idx *i0, struct idx *i1, struct idx *i2); # 1222 "../include/header.h" 2 # 1233 "../include/header.h" extern TLclass dh_class; at *new_dh(at *name, dhdoc_t *kdata); at *new_dhclass(at *name, dhclassdoc_t *kdata); int lside_mark_unlinked(gptr); void lside_destroy_item(gptr); int lside_check_ownership(void *cptr); void cside_create_idx(void *cptr); void cside_create_srg(void *cptr); void cside_create_obj(void *cptr, dhclassdoc_t *); void cside_destroy_range(void *from, void *to); at * cside_find_litem(void *cptr); void block_async_poll(void); void unblock_async_poll(void); void unregister_poll_functions(void *handle); void *register_poll_functions(int (*spoll)(void), void (*apoll)(void), void (*bwait)(void), void (*ewait)(void), int fd ); void *timer_add(at *handler, int delay, int period); void timer_del(void *handle); int timer_fire(void); void event_add(at *handler, at *event); at *event_peek(void); at *event_get(void *handler, int remove); at *event_wait(int console); void process_pending_events(void); void enqueue_event(at*, int event, int, int, int, int); void enqueue_eventdesc(at*, int event, int, int, int, int, char*); # 30 "comdraw_driver.c" 2 # 1 "../include/graphics.h" 1 # 44 "../include/graphics.h" struct window { short used; short pad; at *backptr; struct gdriver *gdriver; at *font; at *eventhandler; at *driverdata; int color; short clipx, clipy, clipw, cliph; }; # 80 "../include/graphics.h" extern TLclass window_class; struct window *current_window(void); struct window *current_window_no_error(void); struct event { at *handler; int code; int xd,yd,xu,yu; char *desc; }; # 115 "../include/graphics.h" struct gdriver { char *name; void (*begin) (struct window *); void (*end) (struct window *); void (*close) (struct window *); int (*xsize) (struct window *); int (*ysize) (struct window *); void (*setfont) (struct window *, char *); void (*clear) (struct window *); void (*draw_line) (struct window *, int, int, int, int); void (*draw_rect) (struct window *, int, int, unsigned int, unsigned int); void (*draw_circle) (struct window *, int, int, unsigned int); void (*fill_rect) (struct window *, int, int, unsigned int, unsigned int); void (*fill_circle) (struct window *, int, int, unsigned int); void (*draw_text) (struct window *, int, int, char *); void (*setcolor) (struct window *, int); int (*alloccolor) (struct window *, double, double, double); void (*fill_polygon) (struct window *, short (*points)[2], unsigned int); void (*rect_text) (struct window *, int, int, char*, int*, int*, int*, int*); void (*gspecial) (struct window *, char*); void (*clip) (struct window *, int, int, unsigned int, unsigned int); void (*hilite) (struct window *, int, int, int, int, int); int (*pixel_map) (struct window *, unsigned int*, int, int, unsigned int, unsigned int, unsigned int, unsigned int); int (*hinton_map) (struct window *, unsigned int*, int, int, unsigned int, unsigned int, unsigned int, unsigned int); void (*draw_arc) (struct window *, int, int, unsigned int, int, int); void (*fill_arc) (struct window *, int, int, unsigned int, int, int); void (*get_image) (struct window *, unsigned int*, int, int, unsigned int, unsigned int); int (*get_mask)(struct window *, unsigned int*, unsigned int*, unsigned int*); }; # 157 "../include/graphics.h" int gray_draw_idx(int x, int y, struct idx *idx, double minv, double maxv, int apartx, int aparty); int color_draw_idx(int x, int y, struct idx *idx, double minv, double maxv, int apartx, int aparty, unsigned int *colors); int rgb_draw_idx(int x, int y, struct idx *idx, int sx, int sy); int rgb_grab_idx(int x, int y, struct idx *idx); # 31 "comdraw_driver.c" 2 # 1 "/usr/include/limits.h" 1 3 4 # 128 "/usr/include/limits.h" 3 4 # 1 "/usr/include/sys/limits.h" 1 3 4 # 129 "/usr/include/limits.h" 2 3 4 # 1 "/usr/include/sys/syslimits.h" 1 3 4 # 132 "/usr/include/limits.h" 2 3 4 # 32 "comdraw_driver.c" 2 # 1 "/usr/include/errno.h" 1 3 4 # 43 "/usr/include/errno.h" 3 4 int * __error(void); # 33 "comdraw_driver.c" 2 # 1 "/usr/include/unistd.h" 1 3 4 # 41 "/usr/include/unistd.h" 3 4 # 1 "/usr/include/sys/types.h" 1 3 4 # 42 "/usr/include/unistd.h" 2 3 4 # 1 "/usr/include/sys/unistd.h" 1 3 4 # 43 "/usr/include/unistd.h" 2 3 4 # 318 "/usr/include/unistd.h" 3 4 void _exit(int) __attribute__((__noreturn__)); int access(const char *, int); unsigned int alarm(unsigned int); int chdir(const char *); int chown(const char *, uid_t, gid_t); int close(int); int dup(int); int dup2(int, int); int eaccess(const char *, int); int execl(const char *, const char *, ...); int execle(const char *, const char *, ...); int execlp(const char *, const char *, ...); int execv(const char *, char * const *); int execve(const char *, char * const *, char * const *); int execvp(const char *, char * const *); pid_t fork(void); long fpathconf(int, int); char *getcwd(char *, size_t); gid_t getegid(void); uid_t geteuid(void); gid_t getgid(void); int getgroups(int, gid_t []); char *getlogin(void); pid_t getpgrp(void); pid_t getpid(void); pid_t getppid(void); uid_t getuid(void); int isatty(int); int link(const char *, const char *); long pathconf(const char *, int); int pause(void); int pipe(int *); ssize_t read(int, void *, size_t); int rmdir(const char *); int setgid(gid_t); int setpgid(pid_t, pid_t); void setproctitle(const char *_fmt, ...) __attribute__((__format__ (__printf0__, 1, 2))); pid_t setsid(void); int setuid(uid_t); unsigned int sleep(unsigned int); long sysconf(int); pid_t tcgetpgrp(int); int tcsetpgrp(int, pid_t); char *ttyname(int); int unlink(const char *); ssize_t write(int, const void *, size_t); size_t confstr(int, char *, size_t); int getopt(int, char * const [], const char *); extern char *optarg; extern int optind, opterr, optopt; int fsync(int); # 398 "/usr/include/unistd.h" 3 4 int getlogin_r(char *, int); int fchown(int, uid_t, gid_t); int readlink(const char *, char *, int); int gethostname(char *, size_t); int setegid(gid_t); int seteuid(uid_t); # 418 "/usr/include/unistd.h" 3 4 int symlink(const char * , const char * ); char *crypt(const char *, const char *); int encrypt(char *, int); int fchdir(int); long gethostid(void); int getpgid(pid_t _pid); int getsid(pid_t _pid); char *getwd(char *); int lchown(const char *, uid_t, gid_t); int lockf(int, int, off_t); int nice(int); ssize_t pread(int, void *, size_t, off_t); ssize_t pwrite(int, const void *, size_t, off_t); int setpgrp(pid_t _pid, pid_t _pgrp); int setregid(gid_t, gid_t); int setreuid(uid_t, uid_t); void sync(void); useconds_t ualarm(useconds_t, useconds_t); int usleep(useconds_t); pid_t vfork(void); # 453 "/usr/include/unistd.h" 3 4 int brk(const void *); int chroot(const char *); int getdtablesize(void); int getpagesize(void) __attribute__((__const__)); char *getpass(const char *); void *sbrk(intptr_t); struct timeval; int acct(const char *); int async_daemon(void); int check_utility_compat(const char *); const char * crypt_get_format(void); int crypt_set_format(const char *); int des_cipher(const char *, char *, long, int); int des_setkey(const char *key); void endusershell(void); int exect(const char *, char * const *, char * const *); int execvP(const char *, const char *, char * const *); char *fflagstostr(u_long); int getdomainname(char *, int); int getgrouplist(const char *, gid_t, gid_t *, int *); mode_t getmode(const void *, mode_t); int getpeereid(int, uid_t *, gid_t *); int getresgid(gid_t *, gid_t *, gid_t *); int getresuid(uid_t *, uid_t *, uid_t *); char *getusershell(void); int initgroups(const char *, gid_t); int iruserok(unsigned long, int, const char *, const char *); int iruserok_sa(const void *, int, int, const char *, const char *); int issetugid(void); char *mkdtemp(char *); int mknod(const char *, mode_t, dev_t); int mkstemps(char *, int); int nfsclnt(int, void *); int nfssvc(int, void *); int profil(char *, size_t, vm_offset_t, int); int rcmd(char **, int, const char *, const char *, const char *, int *); int rcmd_af(char **, int, const char *, const char *, const char *, int *, int); int rcmdsh(char **, int, const char *, const char *, const char *, const char *); char *re_comp(const char *); int re_exec(const char *); int reboot(int); int revoke(const char *); pid_t rfork(int); pid_t rfork_thread(int, void *, int (*)(void *), void *); int rresvport(int *); int rresvport_af(int *, int); int ruserok(const char *, int, const char *, const char *); int setdomainname(const char *, int); int setgroups(int, const gid_t *); void sethostid(long); int sethostname(const char *, int); int setlogin(const char *); void *setmode(const char *); int setresgid(gid_t, gid_t, gid_t); int setresuid(uid_t, uid_t, uid_t); int setrgid(gid_t); int setruid(uid_t); void setusershell(void); int strtofflags(char **, u_long *, u_long *); int swapon(const char *); int swapoff(const char *); int syscall(int, ...); off_t __syscall(quad_t, ...); int ttyslot(void); int undelete(const char *); int unwhiteout(const char *); void *valloc(size_t); extern int optreset; # 35 "comdraw_driver.c" 2 # 1 "/usr/include/sys/time.h" 1 3 4 # 40 "/usr/include/sys/time.h" 3 4 struct timezone { int tz_minuteswest; int tz_dsttime; }; # 53 "/usr/include/sys/time.h" 3 4 struct bintime { time_t sec; uint64_t frac; }; static __inline void bintime_addx(struct bintime *bt, uint64_t x) { uint64_t u; u = bt->frac; bt->frac += x; if (u > bt->frac) bt->sec++; } static __inline void bintime_add(struct bintime *bt, const struct bintime *bt2) { uint64_t u; u = bt->frac; bt->frac += bt2->frac; if (u > bt->frac) bt->sec++; bt->sec += bt2->sec; } static __inline void bintime_sub(struct bintime *bt, const struct bintime *bt2) { uint64_t u; u = bt->frac; bt->frac -= bt2->frac; if (u < bt->frac) bt->sec--; bt->sec -= bt2->sec; } # 107 "/usr/include/sys/time.h" 3 4 static __inline void bintime2timespec(const struct bintime *bt, struct timespec *ts) { ts->tv_sec = bt->sec; ts->tv_nsec = ((uint64_t)1000000000 * (uint32_t)(bt->frac >> 32)) >> 32; } static __inline void timespec2bintime(const struct timespec *ts, struct bintime *bt) { bt->sec = ts->tv_sec; bt->frac = ts->tv_nsec * (uint64_t)18446744073LL; } static __inline void bintime2timeval(const struct bintime *bt, struct timeval *tv) { tv->tv_sec = bt->sec; tv->tv_usec = ((uint64_t)1000000 * (uint32_t)(bt->frac >> 32)) >> 32; } static __inline void timeval2bintime(const struct timeval *tv, struct bintime *bt) { bt->sec = tv->tv_sec; bt->frac = tv->tv_usec * (uint64_t)18446744073709LL; } # 219 "/usr/include/sys/time.h" 3 4 struct itimerval { struct timeval it_interval; struct timeval it_value; }; struct clockinfo { int hz; int tick; int spare; int stathz; int profhz; }; # 301 "/usr/include/sys/time.h" 3 4 # 1 "/usr/include/time.h" 1 3 4 # 95 "/usr/include/time.h" 3 4 struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; long tm_gmtoff; char *tm_zone; }; extern char *tzname[]; char *asctime(const struct tm *); clock_t clock(void); char *ctime(const time_t *); double difftime(time_t, time_t); struct tm *gmtime(const time_t *); struct tm *localtime(const time_t *); time_t mktime(struct tm *); size_t strftime(char * , size_t, const char * , const struct tm * ); time_t time(time_t *); void tzset(void); int clock_getres(clockid_t, struct timespec *); int clock_gettime(clockid_t, struct timespec *); int clock_settime(clockid_t, const struct timespec *); int nanosleep(const struct timespec *, struct timespec *); char *asctime_r(const struct tm *, char *); char *ctime_r(const time_t *, char *); struct tm *gmtime_r(const time_t *, struct tm *); struct tm *localtime_r(const time_t *, struct tm *); char *strptime(const char * , const char * , struct tm * ); char *timezone(int, int); void tzsetwall(void); time_t timelocal(struct tm * const); time_t timegm(struct tm * const); # 302 "/usr/include/sys/time.h" 2 3 4 int adjtime(const struct timeval *, struct timeval *); int futimes(int, const struct timeval *); int getitimer(int, struct itimerval *); int gettimeofday(struct timeval *, struct timezone *); int lutimes(const char *, const struct timeval *); int setitimer(int, const struct itimerval *, struct itimerval *); int settimeofday(const struct timeval *, const struct timezone *); int utimes(const char *, const struct timeval *); # 38 "comdraw_driver.c" 2 # 47 "comdraw_driver.c" # 1 "/usr/include/termios.h" 1 3 4 # 178 "/usr/include/termios.h" 3 4 typedef unsigned int tcflag_t; typedef unsigned char cc_t; typedef unsigned int speed_t; struct termios { tcflag_t c_iflag; tcflag_t c_oflag; tcflag_t c_cflag; tcflag_t c_lflag; cc_t c_cc[20]; speed_t c_ispeed; speed_t c_ospeed; }; # 247 "/usr/include/termios.h" 3 4 speed_t cfgetispeed(const struct termios *); speed_t cfgetospeed(const struct termios *); int cfsetispeed(struct termios *, speed_t); int cfsetospeed(struct termios *, speed_t); int tcgetattr(int, struct termios *); int tcsetattr(int, int, const struct termios *); int tcdrain(int); int tcflow(int, int); int tcflush(int, int); int tcsendbreak(int, int); void cfmakeraw(struct termios *); int cfsetspeed(struct termios *, speed_t); # 274 "/usr/include/termios.h" 3 4 # 1 "/usr/include/sys/ttycom.h" 1 3 4 # 41 "/usr/include/sys/ttycom.h" 3 4 # 1 "/usr/include/sys/ioccom.h" 1 3 4 # 65 "/usr/include/sys/ioccom.h" 3 4 int ioctl(int, unsigned long, ...); # 42 "/usr/include/sys/ttycom.h" 2 3 4 # 52 "/usr/include/sys/ttycom.h" 3 4 struct winsize { unsigned short ws_row; unsigned short ws_col; unsigned short ws_xpixel; unsigned short ws_ypixel; }; # 275 "/usr/include/termios.h" 2 3 4 # 283 "/usr/include/termios.h" 3 4 # 1 "/usr/include/sys/ttydefaults.h" 1 3 4 # 284 "/usr/include/termios.h" 2 3 4 # 48 "comdraw_driver.c" 2 # 85 "comdraw_driver.c" typedef struct Stack_node { int compview; struct Stack_node *link; } stack_node, *stack_ptr; static struct C_window { struct window lwin; char *filename; int saveflag; FILE *finptr; FILE *foutptr; int width; int height; stack_ptr group_stack; int compview_no; int group_cnt; int command_type; } wind[16]; static stack_ptr init_stack(void) { stack_ptr node = lush_malloc(sizeof(stack_node),"comdraw_driver.c",111); node->link = 0L; return node; } static int push(stack_ptr stack, int cw) { stack_node *node = lush_malloc(sizeof(stack_node),"comdraw_driver.c",119); if(node != 0L) { node->compview = cw; node->link = stack->link; stack->link = node; return 0; } else { fprintf(__stdoutp,"Out of memory, compview stack is full\n"); return -1; } } static int pop(stack_ptr stack) { stack_node *node; int cw; node = stack->link; stack->link = node->link; cw = node->compview; return cw; } static int read_top(stack_ptr stack) { stack_node *node; int cw; node = stack->link; cw = node->compview; return cw; } static void empty_stack(stack_ptr stack) { stack->link = 0L; } static struct C_window * comdraw_new_window(int x, int y, int w, int h, char* name) { struct C_window *info; int i; char cmd[255]; struct termios settings, default_settings; FILE *fin,*fout; if (w==0 && h==0) sprintf(cmd,"comdraw -geometry 512x512+%d+%d",x,y); else sprintf(cmd,"comdraw -geometry %dx%d+%d+%d",w, h,x,y); info = ((void *)0); for(i=0; i<16; i++) if (! wind[i].lwin.used ) { info = &wind[i]; break; } if (! info) TLerror(0L,"too many comdraw windows",0L); info->filename = lush_malloc(strlen(name)+1,"comdraw_driver.c",188); strcpy(info->filename,name); info->saveflag = 0; info->finptr = 0L; info->foutptr = 0L; info->width = 512; info->height = 512; info->group_stack = init_stack(); info->compview_no = 10000; info->group_cnt = 10000; info->command_type = 0; filteropenpty(cmd,&info->finptr,&info->foutptr); fin = info->finptr; fout = info->foutptr; if (fin && fout) { tcgetattr((!__isthreaded ? ((fout)->_file) : (fileno)(fout)),&default_settings); settings = default_settings; settings.c_lflag &= (~0x00000008); tcsetattr((!__isthreaded ? ((fout)->_file) : (fileno)(fout)),0,&settings); } return info; } static void delete_comdraw_win(struct C_window *info) { info->lwin.backptr->at_union.at_extern.at_object = 0L; info->lwin.backptr->at_union.at_extern.at_class = &zombie_class; info->lwin.backptr->flags = (1<<1) | (1<<12); lush_free(info->filename,"comdraw_driver.c",220); unix_pclose(info->foutptr); fclose(info->finptr); lush_free(info->group_stack,"comdraw_driver.c",223); info->lwin.used = 0; } static int readnbytes(int fd, char* rbuffer, int size, long maxwait) { struct timeval tv; struct timeval *ptv = &tv; int readreturn, selectreturn; char buffer[255 +1]; fd_set readset; buffer[0] = 0; do { fd_set *_p; __size_t _n; _p = (&readset); _n = (((1024U) + (((sizeof(__fd_mask) * 8)) - 1)) / ((sizeof(__fd_mask) * 8))); while (_n > 0) _p->__fds_bits[--_n] = 0; } while (0); ((&readset)->__fds_bits[(fd)/(sizeof(__fd_mask) * 8)] |= ((__fd_mask)1 << ((fd) % (sizeof(__fd_mask) * 8)))); tv.tv_sec = 0; tv.tv_usec = maxwait; if (maxwait < 0) ptv = 0; if ((selectreturn = select(fd+1, &readset, 0L, 0L, ptv))>0) if ((readreturn = read(fd, buffer, size))>=0) { buffer[readreturn] = 0; strcpy(rbuffer,buffer); return readreturn; } else { return readreturn; } else if (selectreturn<0) perror("select(2)"); return selectreturn; } static int writenbytes(int fd, char* command, int size, long maxwait) { struct timeval tv; struct timeval *ptv = &tv; int selectreturn, writereturn; fd_set writeset; do { fd_set *_p; __size_t _n; _p = (&writeset); _n = (((1024U) + (((sizeof(__fd_mask) * 8)) - 1)) / ((sizeof(__fd_mask) * 8))); while (_n > 0) _p->__fds_bits[--_n] = 0; } while (0); ((&writeset)->__fds_bits[(fd)/(sizeof(__fd_mask) * 8)] |= ((__fd_mask)1 << ((fd) % (sizeof(__fd_mask) * 8)))); tv.tv_sec = 0; tv.tv_usec = maxwait; if (maxwait < 0) ptv = 0; if ((selectreturn = select(fd+2, 0L, &writeset, 0L, ptv))>0) if((writereturn = write(fd,command,size)) >= 0) return writereturn; else { return writereturn; } else if(selectreturn == 0) fprintf(__stdoutp,"Select: Write time out!\n" ); else perror("select(2)"); return selectreturn; } static int runcommand(struct C_window* info, char* command, int noflines_toread) { int fdout; int fdin; char buffer[255]; int nofbytes = 0; int i,j; buffer[0] = 0; fdout = (!__isthreaded ? ((info->foutptr)->_file) : (fileno)(info->foutptr)); fdin = (!__isthreaded ? ((info->finptr)->_file) : (fileno)(info->finptr)); nofbytes = readnbytes(fdout, buffer, 255 -1,0); while (nofbytes>0) nofbytes = readnbytes(fdout, buffer,255 -1 ,0); if (nofbytes < 0) return -1; nofbytes = writenbytes(fdin,command,strlen(command),-1); fflush(info->finptr); if (nofbytes < 0) return -1; if (nofbytesfoutptr)->_file) : (fileno)(info->foutptr)); fdin=(!__isthreaded ? ((info->finptr)->_file) : (fileno)(info->finptr)); buffer[0] = 0; nofbytes = readnbytes(fdout, buffer,255 -1 ,0); while(nofbytes!=0) nofbytes = readnbytes(fdout, buffer, 255 -1,0); if (nofbytes < 0) return -1; nofbytes = writenbytes(fdin,command,strlen(command),-1); fflush(info->finptr); if (nofbytes < 0) return -1; if (nofbytes < strlen(command)) fprintf(__stdoutp,"Command is not written properly\n"); buffer[0] = 0; nofbytes = 0; i=lastindex=0; while(i < noflines_toread) { nofbytes += readnbytes(fdout, &buffer[strlen(buffer)], 255 -strlen(buffer)-1,-1); for(j=lastindex;j (clipy2)) code = 0x0001; else if (y < clipy1) code = 0x0010; if (x > (clipx2)) code |= 0x1000; else if (x < clipx1) code |= 0x0100; return code; } static int do_line_clip(int *x1, int *y1, int *x2, int *y2, struct C_window *info) { short code1; short code2; short code_out; int x=0, y=0; short clipx1 = info->lwin.clipx; short clipy1 = info->lwin.clipy; short clipw = info->lwin.clipw; short cliph = info->lwin.cliph; short clipx2 = clipx1+clipw-1; short clipy2 = clipy1+cliph-1; code1 = compute_code(*x1, *y1, clipx1, clipy1, clipx2, clipy2); code2 = compute_code(*x2, *y2, clipx1, clipy1, clipx2, clipy2); if (*x1==*y1 && *y1==*x2 && *x2==*y2) return 0; if (clipw==0 && cliph==0) return 1; while (code1 || code2){ if (code1 & code2) return 0; else { if (code1 > 0) code_out = code1; else code_out = code2; if ((code_out & 0x0001) == 0x0001) { y = clipy2; x = *x1+(*x2-*x1)*(y-*y1)/(*y2-*y1); } else if ((code_out & 0x0010) == 0x0010) { y = clipy1; x = *x1+(*x2-*x1)*(y-*y1)/(*y2-*y1); } else if ((code_out & 0x1000) == 0x1000) { x = clipx2; y = *y1+(*y2-*y1)*(x-*x1)/(*x2-*x1); } else if ((code_out & 0x0100) == 0x0100) { x = clipx1; y = *y1+(*y2-*y1)*(x-*x1)/(*x2-*x1); } if (code_out == code1) { *x1 = x; *y1 = y; code1 = compute_code(*x1,*y1, clipx1, clipy1, clipx2, clipy2); } else { *x2 = x; *y2 = y; code2 = compute_code(*x2,*y2, clipx1, clipy1, clipx2, clipy2); } } } return 1; } static void comdraw_begin(struct window *linfo) { struct C_window *info = (struct C_window*)linfo; char buffer[255]; stack_ptr S = info->group_stack; if (readnbytes((!__isthreaded ? ((info->foutptr)->_file) : (fileno)(info->foutptr)), buffer, 255 -1,0) < 0) { delete_comdraw_win(info); return; } push(S,0); } static void begin(struct C_window *info) { char command[255]; command[0] = 0; if (!info->saveflag) { sprintf(command,"save(\"%s\")\n",info->filename); runcommand(info,command,1); info->saveflag = 1; } info->compview_no++; info->command_type = 1; } static void begin_no_cw(struct C_window *info) { info->command_type = 2; } static void comdraw_end(struct window *linfo) { struct C_window *info = (struct C_window*)linfo; int group1 = 0; int group2 = 0; int image = info->compview_no; char command[255]; stack_ptr S = info->group_stack; int linecnt = 0; command[0] = 0; if (! info->lwin.used) return; group1 = pop(S); if (!(S->link)) return; if (group1 == 0){ group2 = read_top(S); if (group2 == 0) { if (info->command_type == 1){ pop(S); info->group_cnt++; push(S,info->group_cnt); sprintf(command,"lushng%d=growgroup(c%d c%d)\n", info->group_cnt, image, image); linecnt++; } } else { sprintf(command,"lushng%d=growgroup(lushng%d c%d)\n", info->group_cnt, group2, image); linecnt++; } } else { group2 = read_top(S); sprintf(command,"lushng%d=growgroup(lushng%d lushng%d)\n", group2, group2, group1); linecnt++; } if (info->command_type != 2){ sprintf(&command[strlen(command)],"select(:clear)\n"); runcommand(info,command,2); } } static void comdraw_close(struct window *linfo) { struct C_window *info = (struct C_window*)linfo; char command[5]; if(!(info->lwin.used)) return; command[0] = 0; sprintf(command,"save\n"); runcommand(info,command,1); sprintf(command,"exit\n"); writenbytes((!__isthreaded ? ((info->finptr)->_file) : (fileno)(info->finptr)),command,sizeof command,-1); lush_free(info->filename,"comdraw_driver.c",609); unix_pclose(info->foutptr); fclose(info->finptr); lush_free(info->group_stack,"comdraw_driver.c",612); info->lwin.used = 0; } static int comdraw_xsize(struct window *linfo) { struct C_window *info = (struct C_window*)linfo; char rbuffer[255]; char* command = "ncols\n"; int xsize = 0; char* bufptr; char number[((int)floor(log10(0x7fffffff)+1))]; int i; begin_no_cw(info); rbuffer[0] = 0; if (! info->lwin.used) return 0 ; runcommandReadout(info,command,rbuffer,1); bufptr = rbuffer; number[0] = 0; i = 0; while (*bufptr) { if (__isctype((*bufptr), 0x00000400L)) { number[i] = (*bufptr); i++; } else if (i>0) xsize = atoi(number); bufptr++; } info->width = xsize; return (xsize); } static int comdraw_ysize(struct window *linfo) { struct C_window *info = (struct C_window*)linfo; char rbuffer[255]; char* command = "nrows\n"; int ysize = 0; char* bufptr; char number[((int)floor(log10(0x7fffffff)+1))]; int i; rbuffer[0] = 0; if (! info->lwin.used) return 0 ; begin_no_cw(info); runcommandReadout(info,command,rbuffer,1); bufptr = rbuffer; number[0] = 0; i = 0; while (*bufptr) { if (__isctype((*bufptr), 0x00000400L)) { number[i] = (*bufptr); i++; } else if (i>0) ysize = atoi(number); bufptr++; } info->width = ysize; return (ysize); } static void comdraw_setfont(struct window *linfo, char *f) { struct C_window *info = (struct C_window*)linfo; char command[255]; char font[15]; char def_font[] = "default"; if (! info->lwin.used) return; command[0] = 0; begin_no_cw(info); strcpy(font,f); if(!(strcmp(font,def_font))){ strcpy(font,"Helvetica-12"); } sprintf(command,"fontbyname(\"%s\")\n",font); runcommand(info, command,1); } static void comdraw_clear(struct window *linfo) { struct C_window *info = (struct C_window*)linfo; char command[255]; if (! info->lwin.used) return; command[0] = 0; begin_no_cw(info); sprintf(command, "lushtmp=select(:all)\n" "for(i=0 icompview_no = 10000; } static void comdraw_draw_line(struct window *linfo, int x1, int y1,int x2, int y2) { struct C_window *info = (struct C_window*)linfo; char command[43+5*(((int)floor(log10(0x7fffffff)+1)))]; if (! info->lwin.used) return; if (do_line_clip(&x1, &y1, &x2, &y2, info)) { begin(info); command[0] = 0; sprintf(command,"c%d=line(%d,nrows-(%d),%d,nrows-(%d))\n" "select(:clear)\n", info->compview_no,x1, (y1+1), x2, (y2+1)); runcommand(info, command,2); } else begin_no_cw(info); } static void comdraw_draw_rect(struct window *linfo, int x1, int y1,unsigned int w, unsigned int h) { struct C_window *info = (struct C_window*)linfo; char command[47+5*(((int)floor(log10(0x7fffffff)+1)))]; if (! info->lwin.used) return; begin(info); command[0] = 0; sprintf(command,"c%d=rect(%d,nrows-(%d),%d,nrows-(%d))\n" "select(:clear)\n", info->compview_no,x1, (y1+1), x1+w-1, (y1+h)); runcommand(info,command,2); } static void comdraw_draw_circle(struct window *linfo, int x1,int y1,unsigned int r) { struct C_window *info = (struct C_window*)linfo; char command[38+5*(((int)floor(log10(0x7fffffff)+1)))]; if (! info->lwin.used) return; begin(info); command[0] = 0; sprintf(command,"c%d=ellipse(%d,nrows-(%d),%d,%d)\nselect(:clear)\n", info->compview_no,x1,(y1+1),r,r); runcommand(info,command,2); } static void comdraw_fill_rect(struct window *linfo, int x1, int y1,unsigned int w, unsigned int h) { struct C_window *info = (struct C_window*)linfo; char command[65+5*(((int)floor(log10(0x7fffffff)+1)))]; if (! info->lwin.used) return; begin(info); command[0] = 0; sprintf(command, "pattern(2)\n" "c%d=rect(%d,nrows-(%d),%d,nrows-(%d))\n" "select(:clear)\npattern(1)\n", info->compview_no,x1, (y1+1), x1+w-1, (y1+h)); runcommand(info,command,4); } static void comdraw_fill_circle(struct window *linfo,int x1,int y1,unsigned int r) { struct C_window *info = (struct C_window*)linfo; char command[60+5*(((int)floor(log10(0x7fffffff)+1)))]; if (! info->lwin.used) return; begin(info); command[0] = 0; sprintf(command, "pattern(2)\n" "c%d=ellipse(%d,nrows-(%d),%d,%d)\n" "select(:clear)\npattern(1)\n", info->compview_no,x1, y1+1, r, r); runcommand(info,command,4); } static void comdraw_draw_text(struct window *linfo, int x, int y, char *s) { struct C_window *info = (struct C_window*)linfo; char command [255]; char *t; if (! info->lwin.used) return; if (! s || !*s){ begin_no_cw(info); return; } command[0] = 0; t = strdup(s); if (*t) begin(info); if (*t=='"' || *t=='\\') sprintf(command,"lushtmp=\"\\%c",*t); else sprintf(command,"lushtmp=\"%c",*t); t++; while (*t) { if (strlen(command) >= 255 -4) { sprintf(&command[strlen(command)],"\"\n"); runcommand(info, command,1); command[0] = 0; if (*t=='"' || *t=='\\') sprintf(command,"lushtmp=lushtmp+\"\\%c",*t); else sprintf(command,"lushtmp=lushtmp+\"%c",*t); } else if (*t=='"' || *t=='\\') sprintf(&command[strlen(command)],"\\%c",*t); else sprintf(&command[strlen(command)],"%c",*t); if(!(*(t+1))){ sprintf(&command[strlen(command)],"\"\n"); runcommand(info, command,1); } t++; } if (*s){ command[0] = 0; sprintf(command,"c%d=text(%d,nrows-(%d) lushtmp)\nselect(:clear)\n", info->compview_no,x,(y+1)); runcommand(info, command,2); } } static char *hexmap = "0123456789ABCDEF"; static void comdraw_setcolor(struct window *linfo,int x) { struct C_window *info = (struct C_window*)linfo; int rr,bb,gg; char hexcolor[7]; char command[23]; command[0] = 0; if (! info->lwin.used) return; begin_no_cw(info); switch(x) { case (-1L): sprintf(hexcolor,"#000000"); break; case (-2L): sprintf(hexcolor,"#FFFFFF"); break; case (-3L): sprintf(hexcolor,"#808080"); break; default: rr = (int)((x & 0xff0000L)>>16); gg = (int)((x & 0x00ff00L)>>8); bb = (int)((x & 0x0000ffL)); sprintf(hexcolor,"#%c%c%c%c%c%c", hexmap[ (rr&0xf0)>>4 ], hexmap[ rr&0xf ], hexmap[ (gg&0xf0)>>4 ], hexmap[ gg&0xf ], hexmap[ (bb&0xf0)>>4], hexmap[ bb&0xf ]); break; } sprintf(command,"colorsrgb(\"%s\")\n",hexcolor); runcommand(info,command,1); } static int comdraw_alloccolor(struct window *linfo,double r,double g,double b) { struct C_window *info = (struct C_window*)linfo; begin_no_cw(info); return (65536*(int)(255*r)+256*(int)(255*g)+(int)(255*b)); } static void comdraw_fill_polygon(struct window *linfo,short (*points)[2], unsigned int n) { struct C_window *info = (struct C_window*)linfo; int i; char command[255]; command[0] = 0; if (! info->lwin.used) return; begin(info); sprintf(command,"lushtmp=%d,nrows-(%d)", points[0][0],(points[0][1]+1)); for (i=1; i=255 -(11+2*((int)floor(log10(0x7fffffff)+1)))){ sprintf(&command[strlen(command)],"\n"); runcommand(info, command,1); command[0] = 0; sprintf(command,"lushtmp=lushtmp,%d,nrows-(%d)", points[i][0],(points[i][1]+1)); } else sprintf(&command[strlen(command)],",%d,nrows-(%d)", points[i][0],(points[i][1]+1)); } sprintf(&command[strlen(command)],"\n"); runcommand(info,command,1); command[0] = 0; sprintf(command,"c%d=polygon(lushtmp)\npattern(2)\n" "select(:clear)\npattern(1)\n", info->compview_no); runcommand(info,command,2); } static void comdraw_rect_text(struct window *linfo, int x, int y, char *s, int *xptr, int *yptr, int *wptr, int *hptr) { struct C_window *info = (struct C_window*)linfo; char rbuffer[255]; char command[255]; char* bufptr; char number[((int)floor(log10(0x7fffffff)+1))+1]; short int i,j; int coord[4]; int ysize; char *t; *xptr = *yptr = *wptr = *hptr = 0; begin_no_cw(info); if (! s || !*s) { *xptr = x; *yptr = y; return; } rbuffer[0] = 0; command[0] = 0; if (! info->lwin.used) return; t = strdup(s); ysize = comdraw_ysize(linfo); if (*t=='"' || *t=='\\') sprintf(command,"lushtmp=\"\\%c",*t); else sprintf(command,"lushtmp=\"%c",*t); t++; while (*t) { if (strlen(command)>=255 -4){ sprintf(&command[strlen(command)],"\"\n"); runcommand(info, command,1); command[0] = 0; if (*t=='"' || *t=='\\') sprintf(command,"lushtmp=lushtmp+\"\\%c",*t); else sprintf(command,"lushtmp=lushtmp+\"%c",*t); } else if (*t=='"' || *t=='\\') sprintf(&command[strlen(command)],"\\%c",*t); else sprintf(&command[strlen(command)],"%c",*t); t++; } sprintf(&command[strlen(command)],"\"\n"); runcommand(info, command,1); command[0] = 0; sprintf(command,"lushtmp2=text(%d,nrows-(%d) lushtmp)\n" "mbr(lushtmp2 :scrn)\ndelete(lushtmp2)\n",x,(y+1)); runcommandReadout(info,command,rbuffer,3); bufptr = rbuffer; number[0] = 0; i = j = 0; while (*bufptr){ if (__isctype((*bufptr), 0x00000400L)){ number[i] = (*bufptr); i++; } else if (i>0) { number[i] = 0; i = 0; coord[j] = atoi(number); j++; } bufptr++; } (*xptr) = coord[0]; (*yptr) = ysize-(coord[3]+1); (*wptr) = coord[2]-coord[0]+1; (*hptr) = coord[3]-coord[1]+1; } static void comdraw_gspecial(struct window *linfo,char *s) { struct C_window *info = (struct C_window*)linfo; char command[255]; if (! info->lwin.used) return; begin_no_cw(info); command[0] = 0; sprintf(command,"%s\n",s); if (strlen(command)>255) fprintf(__stdoutp,"String is too long!\n"); else runcommand(info, command,1); } static void comdraw_clip(struct window *linfo, int x, int y, unsigned int w, unsigned int h) { struct C_window *info = (struct C_window*)linfo; if (! info->lwin.used) return; begin_no_cw(info); if (!(w == 0 && h == 0)){ info->lwin.clipx = x; info->lwin.clipy = y; info->lwin.clipw = w; info->lwin.cliph = h; } } static int comdraw_pixel_map(struct window *linfo, unsigned int *data, int x, int y,unsigned int w,unsigned int h, unsigned int sx,unsigned int sy) { struct C_window *info = (struct C_window*)linfo; char command[255]; register unsigned int *im, *jm, *data2; int sx_w = sx * w; int sy_h = sy * h; int i,j,k,l,hcnt,wcnt; int pointcnt; char line[255]; int index = 0; int limit = 255 -22-5*((int)floor(log10(0x7fffffff)+1)); command[0] = 0; if (! info->lwin.used) return 0; if(!(data)) return 1; line[0] = 0; begin(info); if (sx == 1 && sy == 1) { sprintf(command,"c%d=raster(%d,nrows-(%d),%d,nrows-(%d))\n", info->compview_no,x, (y+h),x+w-1 ,y+1); runcommand(info, command,1); for(hcnt=0; hcntcompview_no, pointcnt, (h-1-hcnt), (wcnt-pointcnt+1), line); runcommand(info, command,1); pointcnt = wcnt+1; line[0]= 0; } } sprintf(&line[strlen(line)],"%d",data[index+1]); sprintf(command,"pokeline(c%d %d %d %d list(%s))\n", info->compview_no, pointcnt, (h-1-hcnt), (wcnt-pointcnt+1), line); runcommand(info, command,1); } } else{ if(!(sx>0 && sy>0)) return 0; if(!(data2 = lush_malloc(sx_w * sy_h * sizeof(int),"comdraw_driver.c",1207))) return 0; for (i = 0; i < h; i++) { im = data2 + sx_w * sy * i; for (k = 0; k < w; k++, data++) { register int c; c = *data; jm = im; for (j = 0; j < sy; j++, jm += sx_w) for (l = 0; l < sx; l++) jm[l] = c; im += sx; } } sprintf(command,"c%d=raster(%d,nrows-(%d),%d,nrows-(%d))\n", info->compview_no,x, (y+sy_h),x+sx_w-1 ,y+1); runcommand(info, command,1); for(hcnt=0; hcntcompview_no, pointcnt, (h-1-hcnt), (wcnt-pointcnt+1), line); runcommand(info, command,1); pointcnt = wcnt+1; line[0] = 0; } } sprintf(&line[strlen(line)],"%d",data2[index+1]); sprintf(command,"pokeline(c%d %d %d %d list(%s))\n", info->compview_no, pointcnt, (sy_h-1-hcnt), (wcnt-pointcnt+1), line); runcommand(info, command,1); } } return 0; } static void comdraw_draw_arc(struct window *linfo, int x1, int y1,unsigned int r, int from, int to) { struct C_window *info = (struct C_window*)linfo; char command[255]; double dif = (((double)to - (double)from)*3.14159/180); double precision = dif/floor((dif+(sqrt(2.0/(double)((4)>((r)) ? (4) : ((r))))))/(sqrt(2.0/(double)((4)>((r)) ? (4) : ((r)))))); int nofpoints = (int)floor(dif/precision); struct Point { int x; int y; } point[nofpoints+1]; int cnt; command[0] = 0; if (! info->lwin.used) return; begin(info); for(cnt=0;cnt=255 -(11+2*((int)floor(log10(0x7fffffff)+1)))){ sprintf(&command[strlen(command)],"\n"); runcommand(info, command,1); command[0] = 0; sprintf(command,"lushtmp=lushtmp,%d,nrows-(%d)", point[cnt].x,(point[cnt].y+1)); } else{ sprintf(&command[strlen(command)],",%d,nrows-(%d)", point[cnt].x,(point[cnt].y+1)); } } sprintf(&command[strlen(command)],"\n"); runcommand(info, command,1); command[0] = 0; sprintf(command,"c%d=multiline(lushtmp)\nselect(:clear)\n", info->compview_no); runcommand(info, command,2); } static void comdraw_fill_arc(struct window *linfo, int x1, int y1,unsigned int r, int from, int to) { struct C_window *info = (struct C_window*)linfo; char command[255]; double dif = (((double)to - (double) from)*3.14159/180); double precision = dif/floor((dif+(sqrt(2.0/(double)((4)>((r)) ? (4) : ((r))))))/(sqrt(2.0/(double)((4)>((r)) ? (4) : ((r)))))); int nofpoints = (int)floor(dif/precision); struct Point { int x; int y; } point[nofpoints+1]; int cnt; command[0] = 0; if (! info->lwin.used) return; begin(info); for(cnt=0;cnt=255 -(11+2*((int)floor(log10(0x7fffffff)+1)))){ sprintf(&command[strlen(command)],"\n"); runcommand(info, command,1); command[0] = 0; sprintf(command,"lushtmp=lushtmp,%d,nrows-(%d)", point[cnt].x,(point[cnt].y+1)); } else sprintf(&command[strlen(command)],",%d,nrows-(%d)", point[cnt].x,(point[cnt].y+1)); } sprintf(&command[strlen(command)],"\n"); runcommand(info, command,1); command[0] = 0; sprintf(command,"c%d=polygon(lushtmp)\npattern(2)\n" "select(:clear)\npattern(1)\n", info->compview_no); runcommand(info, command,2); } int comdraw_get_mask(struct window *linfo, unsigned int *red_mask, unsigned int *green_mask, unsigned int *blue_mask) { struct C_window *info = (struct C_window*)linfo; begin_no_cw(info); *red_mask = 0xff0000; *green_mask = 0xff00; *blue_mask = 0xff; return 1; } struct gdriver comdraw_driver = { "Comdraw", comdraw_begin, comdraw_end, comdraw_close, comdraw_xsize, comdraw_ysize, comdraw_setfont, comdraw_clear, comdraw_draw_line, comdraw_draw_rect, comdraw_draw_circle, comdraw_fill_rect, comdraw_fill_circle, comdraw_draw_text, comdraw_setcolor, comdraw_alloccolor, comdraw_fill_polygon, comdraw_rect_text, comdraw_gspecial, comdraw_clip, 0L, comdraw_pixel_map, 0L, comdraw_draw_arc, comdraw_fill_arc, 0L, comdraw_get_mask, }; static at * comdraw_window(int x, int y, unsigned int w, unsigned int h, char*name) { struct C_window *info; at *ans; info = comdraw_new_window(x,y,w,h,name); ans = new_extern( &window_class, info); info->lwin.used = 1; info->lwin.font = new_safe_string("default"); info->lwin.color = (-1L); info->lwin.gdriver = &comdraw_driver; info->lwin.backptr = ans; return ans; } static at *xcomdraw_window(int arg_number, at **arg_array) { char *name = "comdraw.output"; at* ans; all_args_eval(arg_array,arg_number); switch (arg_number) { case 0: ans = comdraw_window(0, 0, 0, 0, name); break; case 1: ans = comdraw_window(0, 0, 0, 0, ( (arg_array[1]&&(arg_array[1]->flags & (1<<10))) ? (((struct string *)(( (arg_array[1]&&(arg_array[1]->flags & (1<<1))) ? ( arg_array[1] )->at_union.at_extern.at_object:(need_error(8,1,arg_array)) )))->start):(char*)(need_error(4,1,arg_array)) )); break; case 2: ans = comdraw_window(0, 0, ( (int) ( (((arg_array[1])&&((arg_array[1])->flags&(1<<2)))) ? ( arg_array[1] )->at_union.at_number:(long)(need_error(1,1,arg_array))) ), ( (int) ( (((arg_array[2])&&((arg_array[2])->flags&(1<<2)))) ? ( arg_array[2] )->at_union.at_number:(long)(need_error(1,2,arg_array))) ),name); break; case 3: ans = comdraw_window(0, 0, ( (int) ( (((arg_array[1])&&((arg_array[1])->flags&(1<<2)))) ? ( arg_array[1] )->at_union.at_number:(long)(need_error(1,1,arg_array))) ), ( (int) ( (((arg_array[2])&&((arg_array[2])->flags&(1<<2)))) ? ( arg_array[2] )->at_union.at_number:(long)(need_error(1,2,arg_array))) ), ( (arg_array[3]&&(arg_array[3]->flags & (1<<10))) ? (((struct string *)(( (arg_array[3]&&(arg_array[3]->flags & (1<<1))) ? ( arg_array[3] )->at_union.at_extern.at_object:(need_error(8,3,arg_array)) )))->start):(char*)(need_error(4,3,arg_array)) )); break; case 4: ans = comdraw_window(( (int) ( (((arg_array[1])&&((arg_array[1])->flags&(1<<2)))) ? ( arg_array[1] )->at_union.at_number:(long)(need_error(1,1,arg_array))) ), ( (int) ( (((arg_array[2])&&((arg_array[2])->flags&(1<<2)))) ? ( arg_array[2] )->at_union.at_number:(long)(need_error(1,2,arg_array))) ), ( (int) ( (((arg_array[3])&&((arg_array[3])->flags&(1<<2)))) ? ( arg_array[3] )->at_union.at_number:(long)(need_error(1,3,arg_array))) ), ( (int) ( (((arg_array[4])&&((arg_array[4])->flags&(1<<2)))) ? ( arg_array[4] )->at_union.at_number:(long)(need_error(1,4,arg_array))) ),name); break; case 5: ans = comdraw_window(( (int) ( (((arg_array[1])&&((arg_array[1])->flags&(1<<2)))) ? ( arg_array[1] )->at_union.at_number:(long)(need_error(1,1,arg_array))) ), ( (int) ( (((arg_array[2])&&((arg_array[2])->flags&(1<<2)))) ? ( arg_array[2] )->at_union.at_number:(long)(need_error(1,2,arg_array))) ), ( (int) ( (((arg_array[3])&&((arg_array[3])->flags&(1<<2)))) ? ( arg_array[3] )->at_union.at_number:(long)(need_error(1,3,arg_array))) ), ( (int) ( (((arg_array[4])&&((arg_array[4])->flags&(1<<2)))) ? ( arg_array[4] )->at_union.at_number:(long)(need_error(1,4,arg_array))) ), ( (arg_array[5]&&(arg_array[5]->flags & (1<<10))) ? (((struct string *)(( (arg_array[5]&&(arg_array[5]->flags & (1<<1))) ? ( arg_array[5] )->at_union.at_extern.at_object:(need_error(8,5,arg_array)) )))->start):(char*)(need_error(4,5,arg_array)) )); break; default: if (arg_number != -1) (need_error(0,-1,arg_array));; return 0L;; } return ans;; } # 1470 "comdraw_driver.c" void init_comdraw_driver(void) { dx_define("comdraw-window",xcomdraw_window); }