diff options
Diffstat (limited to 'lisp')
49 files changed, 302 insertions, 314 deletions
diff --git a/lisp/bytecode.c b/lisp/bytecode.c index 39667b0..9ee47ba 100644 --- a/lisp/bytecode.c +++ b/lisp/bytecode.c @@ -27,7 +27,7 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/bytecode.c,v 1.15 2003/01/29 03:05:53 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/bytecode.c,v 1.18 2003/05/28 14:13:11 tsi Exp $ */ /* @@ -93,8 +93,8 @@ somethings TODO: */ -#include "bytecode.h" -#include "write.h" +#include "lisp/bytecode.h" +#include "lisp/write.h" #define SYMBOL_KEYWORD -1 /* A keyword, load as constant */ #define SYMBOL_CONSTANT -2 /* Defined as constant at compile time */ @@ -337,7 +337,7 @@ static LispObj *cons, *cons1, *cons2, *cons3, *cons4, *cons5, *cons6, *cons7; /* * Implementation */ -#include "compile.c" +#include "lisp/compile.c" void LispBytecodeInit(void) @@ -395,11 +395,10 @@ Lisp_Compile(LispBuiltin *builtin) goto finished_compilation; else if (atom->a_function) { LispCom com; - int failed, *pfailed; - int lex, base, *plex, *pbase; + int failed; + int lex = 0, base; LispArgList *alist; - LispObj *lambda, *form, *arguments, **parguments; - LispObj **presult, **pwarnings_p, **pfailure_p, **pform; + LispObj *lambda, *form, *arguments; lambda = atom->property->fun.function; if (definition != UNSPEC || lambda->funtype != LispFunction) @@ -485,14 +484,6 @@ Lisp_Compile(LispBuiltin *builtin) com.plist = CONS(NIL, NIL); GC_PROTECT(com.plist); - pfailed = &failed; - plex = &lex; - pbase = &base; - pform = &form; - presult = &result; - pwarnings_p = &warnings_p; - pfailure_p = &failure_p; - parguments = &arguments; failed = 1; if (setjmp(com.jmp) == 0) { /* Save interpreter state */ @@ -681,7 +672,6 @@ Lisp_Disassemble(LispBuiltin *builtin) LispObj **constants; LispAtom **symbols; LispBuiltin **builtins; - unsigned char **codes; LispObj **names; short stack, num_constants, num_symbols, num_builtins, num_bytecodes; unsigned char *base, *stream = bytecode->data.bytecode.bytecode->code; @@ -720,7 +710,6 @@ Lisp_Disassemble(LispBuiltin *builtin) stream += num_symbols * sizeof(LispAtom*); builtins = (LispBuiltin**)stream; stream += num_builtins * sizeof(LispBuiltin*); - codes = (unsigned char**)stream; stream += num_bytecodes * sizeof(unsigned char*); names = (LispObj**)stream; stream += num_bytecodes * sizeof(LispObj*); @@ -1200,9 +1189,8 @@ LispObj * LispCompileForm(LispObj *form) { GC_ENTER(); - int failed, *pfailed; + int failed; LispCom com; - LispObj *code, **pform; if (!CONSP(form)) /* Incorrect call or NIL */ @@ -1217,11 +1205,9 @@ LispCompileForm(LispObj *form) com.plist = CONS(NIL, NIL); GC_PROTECT(com.plist); - pfailed = &failed; - pform = &form; failed = 1; if (setjmp(com.jmp) == 0) { - for (code = form; CONSP(form); form = CDR(form)) { + for (; CONSP(form); form = CDR(form)) { com.form = form; ComEval(&com, CAR(form)); } diff --git a/lisp/bytecode.h b/lisp/bytecode.h index 40d8444..05d4d90 100644 --- a/lisp/bytecode.h +++ b/lisp/bytecode.h @@ -27,9 +27,9 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/bytecode.h,v 1.5 2002/11/23 08:26:48 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/bytecode.h,v 1.6 2003/04/27 18:17:31 tsi Exp $ */ -#include "private.h" +#include "lisp/private.h" #ifndef Lisp_Bytecode_h #define Lisp_Bytecode_h diff --git a/lisp/compile.c b/lisp/compile.c index f699f39..b7c83f9 100644 --- a/lisp/compile.c +++ b/lisp/compile.c @@ -27,7 +27,7 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/compile.c,v 1.14 2003/01/30 02:46:25 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/compile.c,v 1.16 2003/10/24 20:38:16 tsi Exp $ */ #define VARIABLE_USED 0x0001 #define VARIABLE_ARGUMENT 0x0002 @@ -1672,7 +1672,7 @@ rest_label: /* The last argument is not saved in the stack */ ComEval(com, CAR(values)); values = NIL; - com_Bytecode(com, XBC_BCONS + (count - 1)); + com_Bytecode(com, (LispByteOpcode)(XBC_BCONS + (count - 1))); } } else { @@ -2142,7 +2142,7 @@ ComMacroExpandEval(LispCom *com, LispObj *object) static LispObj * ComMacroExpand(LispCom *com, LispObj *lambda) { - LispObj *result, **presult = &result, **plambda; + LispObj *result, **presult = &result; int jumped, *pjumped = &jumped, backquote, *pbackquote = &backquote; LispBlock *block; @@ -2154,7 +2154,6 @@ ComMacroExpand(LispCom *com, LispObj *lambda) interpreter_lex = lisp__data.env.lex; /* Use the variables */ - plambda = λ *presult = NIL; *pjumped = 1; *pbackquote = !CONSP(lambda); diff --git a/lisp/core.c b/lisp/core.c index d834dd5..68364f6 100644 --- a/lisp/core.c +++ b/lisp/core.c @@ -27,15 +27,15 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/core.c,v 1.69 2002/12/20 04:32:45 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/core.c,v 1.72 2003/05/27 22:27:01 tsi Exp $ */ -#include "io.h" -#include "core.h" -#include "format.h" -#include "helper.h" -#include "package.h" -#include "private.h" -#include "write.h" +#include "lisp/io.h" +#include "lisp/core.h" +#include "lisp/format.h" +#include "lisp/helper.h" +#include "lisp/package.h" +#include "lisp/private.h" +#include "lisp/write.h" /* * Types @@ -62,6 +62,10 @@ typedef struct _SeqInfo { break; \ } +#ifdef __UNIXOS2__ +# define finite(x) isfinite(x) +#endif + #ifdef NEED_SETENV extern int setenv(const char *name, const char *value, int overwrite); extern void unsetenv(const char *name); @@ -580,7 +584,7 @@ Lisp_Block(LispBuiltin *builtin) */ { int did_jump, *pdid_jump = &did_jump; - LispObj *res, **pres = &res, **pbody; + LispObj *res, **pres = &res; LispBlock *block; LispObj *name, *body; @@ -592,7 +596,6 @@ Lisp_Block(LispBuiltin *builtin) LispDestroy("%s: %s cannot name a block", STRFUN(builtin), STROBJ(name)); - pbody = &body; *pres = NIL; *pdid_jump = 1; block = LispBeginBlock(name, LispBlockTag); @@ -779,12 +782,11 @@ Lisp_Catch(LispBuiltin *builtin) LispObj *res, **pres = &res; LispBlock *block; - LispObj *tag, *body, **pbody; + LispObj *tag, *body; body = ARGUMENT(1); tag = ARGUMENT(0); - pbody = &body; *pres = NIL; *pdid_jump = 1; block = LispBeginBlock(tag, LispBlockCatch); @@ -1013,9 +1015,8 @@ Lisp_Constantp(LispBuiltin *builtin) constantp form &optional environment */ { - LispObj *form, *environment; + LispObj *form; - environment = ARGUMENT(1); form = ARGUMENT(0); /* not all self-evaluating objects are considered constants */ @@ -1936,8 +1937,8 @@ Lisp_IgnoreErrors(LispBuiltin *builtin) ignore-erros &rest body */ { - LispObj *result, **presult, **pbody; - int i, jumped, *pjumped; + LispObj *result; + int i, jumped; LispBlock *block; /* interpreter state */ @@ -1963,9 +1964,6 @@ Lisp_IgnoreErrors(LispBuiltin *builtin) memcpy(mem, lisp__data.mem.mem, mem_level * sizeof(void*)); ++lisp__data.ignore_errors; - presult = &result; - pjumped = &jumped; - pbody = &body; result = NIL; jumped = 1; block = LispBeginBlock(NIL, LispBlockProtect); @@ -2618,16 +2616,13 @@ Lisp_MakeArray(LispBuiltin *builtin) LispType type; LispObj *dimensions, *element_type, *initial_element, *initial_contents, - *adjustable, *fill_pointer, *displaced_to, - *displaced_index_offset; + *displaced_to, *displaced_index_offset; dim = array = NIL; type = LispNil_t; displaced_index_offset = ARGUMENT(7); displaced_to = ARGUMENT(6); - fill_pointer = ARGUMENT(5); - adjustable = ARGUMENT(4); initial_contents = ARGUMENT(3); initial_element = ARGUMENT(2); element_type = ARGUMENT(1); @@ -4050,9 +4045,9 @@ Lisp_Progv(LispBuiltin *builtin) { GC_ENTER(); int head = lisp__data.env.length, i, count, ostk[32], *offsets; - LispObj *result, *list, *symbol, *value, **presult, **psymbols, **pbody; - int jumped, *pjumped, *pcount, **poffsets; - char fstk[32], *flags, **pflags; + LispObj *result, *list, *symbol, *value; + int jumped; + char fstk[32], *flags; LispBlock *block; LispAtom *atom; @@ -4075,15 +4070,6 @@ Lisp_Progv(LispBuiltin *builtin) values = EVAL(values); GC_PROTECT(values); - /* use variables */ - pbody = &body; - psymbols = &symbols; - presult = &result; - pjumped = &jumped; - poffsets = &offsets; - pcount = &count; - pflags = &flags; - /* count/check symbols and allocate space to remember symbol state */ for (count = 0, list = symbols; CONSP(list); count++, list = CDR(list)) { symbol = CAR(list); @@ -6302,8 +6288,7 @@ Lisp_Tagbody(LispBuiltin *builtin) { GC_ENTER(); int stack, lex, length; - LispObj *list, *body, *ptr, *tag, *labels, *map, - **p_list, **p_body, **p_labels; + LispObj *list, *body, *ptr, *tag, *labels, *map, **p_body; LispBlock *block; body = ARGUMENT(0); @@ -6361,9 +6346,7 @@ Lisp_Tagbody(LispBuiltin *builtin) /* Initialize */ list = body; - p_list = &list; p_body = &body; - p_labels = &labels; block = LispBeginBlock(NIL, LispBlockBody); /* Loop */ @@ -6810,12 +6793,11 @@ Lisp_While(LispBuiltin *builtin) while test &rest body */ { - LispObj *result, *test, *body, *prog; + LispObj *test, *body, *prog; body = ARGUMENT(1); test = ARGUMENT(0); - result = NIL; for (;;) { if (EVAL(test) != NIL) { for (prog = body; CONSP(prog); prog = CDR(prog)) diff --git a/lisp/core.h b/lisp/core.h index 403a75a..e5e5011 100644 --- a/lisp/core.h +++ b/lisp/core.h @@ -27,12 +27,12 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/core.h,v 1.35 2002/12/20 04:32:46 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/core.h,v 1.36 2003/04/27 18:17:32 tsi Exp $ */ #ifndef Lisp_core_h #define Lisp_core_h -#include "internal.h" +#include "lisp/internal.h" void LispCoreInit(void); diff --git a/lisp/debugger.c b/lisp/debugger.c index 4716699..01f350d 100644 --- a/lisp/debugger.c +++ b/lisp/debugger.c @@ -27,12 +27,12 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/debugger.c,v 1.24 2002/11/12 06:05:07 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/debugger.c,v 1.25 2003/04/27 18:17:32 tsi Exp $ */ #include <ctype.h> -#include "io.h" -#include "debugger.h" -#include "write.h" +#include "lisp/io.h" +#include "lisp/debugger.h" +#include "lisp/write.h" #ifdef DEBUGGER #define DebuggerHelp 0 diff --git a/lisp/debugger.h b/lisp/debugger.h index 98bd962..aa4127a 100644 --- a/lisp/debugger.h +++ b/lisp/debugger.h @@ -27,7 +27,7 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/debugger.h,v 1.7 2002/11/08 08:00:56 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/debugger.h,v 1.8 2003/04/27 18:17:32 tsi Exp $ */ #ifndef Lisp_debugger_h #define Lisp_debugger_h @@ -61,7 +61,7 @@ typedef enum _LispDebugBreak { LispDebugBreakVariable } LispDebugBreak; -#include "private.h" +#include "lisp/private.h" /* * Prototypes diff --git a/lisp/format.c b/lisp/format.c index aa593d6..5d29fc3 100644 --- a/lisp/format.c +++ b/lisp/format.c @@ -27,11 +27,11 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/format.c,v 1.28 2002/11/30 23:13:11 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/format.c,v 1.30 2003/05/27 22:27:02 tsi Exp $ */ -#include "io.h" -#include "write.h" -#include "format.h" +#include "lisp/io.h" +#include "lisp/write.h" +#include "lisp/format.h" #include <ctype.h> #define MAXFMT 8 @@ -596,9 +596,9 @@ static void format_in_radix(LispObj *stream, LispObj *object, int radix, FmtArgs *args) { if (INTEGERP(object)) { - int i, check, atsign, collon, mincol, padchar, commachar, commainterval; + int i, atsign, collon, mincol, padchar, commachar, commainterval; - i = check = (radix == 0); + i = (radix == 0); atsign = args->atsign; collon = args->collon; if (radix == 0) { diff --git a/lisp/format.h b/lisp/format.h index 7ca14b9..fb0ef45 100644 --- a/lisp/format.h +++ b/lisp/format.h @@ -27,12 +27,12 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/format.h,v 1.3 2002/11/08 08:00:56 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/format.h,v 1.4 2003/04/27 18:17:32 tsi Exp $ */ #ifndef Lisp_format_h #define Lisp_format_h -#include "private.h" +#include "lisp/private.h" /* * Prototypes diff --git a/lisp/hash.c b/lisp/hash.c index 3d32f07..98e8ac9 100644 --- a/lisp/hash.c +++ b/lisp/hash.c @@ -27,9 +27,9 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/hash.c,v 1.4 2002/11/23 08:26:48 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/hash.c,v 1.6 2003/09/17 22:28:08 paulo Exp $ */ -#include "hash.h" +#include "lisp/hash.h" /* A simple hash-table implementation * TODO: implement SXHASH and WITH-HASH-TABLE-ITERATOR @@ -324,10 +324,12 @@ LispRehash(LispHashTable *hash) if ((nentry->count % 4) == 0) { LispObj **keys, **values; - keys = realloc(nentry->keys, sizeof(LispObj*) * (i + 4)); + keys = realloc(nentry->keys, sizeof(LispObj*) * + (nentry->count + 4)); if (keys == NULL) goto out_of_memory; - values = realloc(nentry->values, sizeof(LispObj*) * (i + 4)); + values = realloc(nentry->values, sizeof(LispObj*) * + (nentry->count + 4)); if (values == NULL) { free(keys); goto out_of_memory; @@ -529,6 +531,8 @@ Lisp_MakeHashTable(LispBuiltin *builtin) test = ARGUMENT(0); if (test != UNSPEC) { + if (FUNCTIONP(test)) + test = test->data.atom->object; if (test == Oeq) function = FEQ; else if (test == Oeql) diff --git a/lisp/hash.h b/lisp/hash.h index df74c96..a8c2532 100644 --- a/lisp/hash.h +++ b/lisp/hash.h @@ -27,12 +27,12 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/hash.h,v 1.2 2002/11/08 08:00:56 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/hash.h,v 1.3 2003/04/27 18:17:33 tsi Exp $ */ #ifndef Lisp_hash_h #define Lisp_hash_h -#include "private.h" +#include "lisp/private.h" typedef struct _LispHashEntry { LispObj **keys; diff --git a/lisp/helper.c b/lisp/helper.c index 65749c5..021198c 100644 --- a/lisp/helper.c +++ b/lisp/helper.c @@ -27,15 +27,15 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/helper.c,v 1.47 2002/11/26 04:06:28 paulo Exp $ */ - -#include "helper.h" -#include "pathname.h" -#include "package.h" -#include "read.h" -#include "stream.h" -#include "write.h" -#include "hash.h" +/* $XFree86: xc/programs/xedit/lisp/helper.c,v 1.51 2003/09/17 22:28:08 paulo Exp $ */ + +#include "lisp/helper.h" +#include "lisp/pathname.h" +#include "lisp/package.h" +#include "lisp/read.h" +#include "lisp/stream.h" +#include "lisp/write.h" +#include "lisp/hash.h" #include <ctype.h> #include <fcntl.h> #include <errno.h> @@ -691,14 +691,12 @@ LispDo(LispBuiltin *builtin, int refs) do* init test &rest body */ { - int jumped, *pjumped; - LispObj *result, **presult; + int jumped; + LispObj *result; LispBlock *block; jumped = 1; result = NIL; - presult = &result; - pjumped = &jumped; block = LispBeginBlock(NIL, LispBlockTag); if (setjmp(block->jmp) == 0) { result = LispReallyDo(builtin, refs); @@ -982,7 +980,7 @@ LispPathnameField(int field, int string) pathname = ARGUMENT(0); - if (PATHNAMEP(pathname)) + if (!PATHNAMEP(pathname)) pathname = APPLY1(Oparse_namestring, pathname); result = pathname->data.pathname; @@ -1062,8 +1060,12 @@ LispProbeFile(LispBuiltin *builtin, int probe) else if (STREAMP(pathname) && pathname->data.stream.type == LispStreamFile) name = THESTR(CAR(pathname->data.stream.pathname->data.pathname)); +#ifndef __UNIXOS2__ if (realpath(name, &resolved[0]) == NULL || stat(resolved, &st)) { +#else + if ((name == NULL) || stat(resolved, &st)) { +#endif if (probe) return (NIL); LispDestroy("%s: realpath(\"%s\"): %s", diff --git a/lisp/helper.h b/lisp/helper.h index 865f397..775122d 100644 --- a/lisp/helper.h +++ b/lisp/helper.h @@ -27,12 +27,12 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/helper.h,v 1.15 2002/11/25 02:35:30 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/helper.h,v 1.16 2003/04/27 18:17:33 tsi Exp $ */ #ifndef Lisp_helper_h #define Lisp_helper_h -#include "private.h" +#include "lisp/private.h" /* * Prototypes diff --git a/lisp/internal.h b/lisp/internal.h index 1061618..a0c6f10 100644 --- a/lisp/internal.h +++ b/lisp/internal.h @@ -27,13 +27,13 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/internal.h,v 1.49 2002/12/11 04:44:27 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/internal.h,v 1.51 2003/05/27 22:27:03 tsi Exp $ */ #ifndef Lisp_internal_h #define Lisp_internal_h #include <stdio.h> -#include "lisp.h" +#include "lisp/lisp.h" #include "mp.h" #include "re.h" @@ -144,8 +144,9 @@ typedef struct _LispMac LispMac; STRFUN(builtin), STROBJ(object)) #define XOBJECT_TYPE(object) ((object)->type) -#define OBJECT_TYPE(object) \ - (POINTERP(object) ? XOBJECT_TYPE(object) : (long)(object) & BIT_MASK) +#define OBJECT_TYPE(object) (POINTERP(object) ? \ + XOBJECT_TYPE(object) : \ + (LispType)((long)(object) & BIT_MASK)) #define NIL (LispObj*)0x00000001 @@ -558,7 +559,7 @@ struct _LispObj { struct { char *string; long length; - int writable : 1; + unsigned int writable : 1; } string; long integer; double dfloat; @@ -608,8 +609,8 @@ struct _LispObj { } source; LispObj *pathname; LispStreamType type : 6; - int readable : 1; - int writable : 1; + unsigned int readable : 1; + unsigned int writable : 1; } stream; struct { void *data; @@ -27,9 +27,9 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/io.c,v 1.16 2002/12/16 03:59:27 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/io.c,v 1.17 2003/04/27 18:17:33 tsi Exp $ */ -#include "io.h" +#include "lisp/io.h" #include <errno.h> #include <fcntl.h> #include <stdarg.h> @@ -27,12 +27,12 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/io.h,v 1.8 2002/12/06 03:25:27 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/io.h,v 1.10 2003/05/27 22:27:03 tsi Exp $ */ #ifndef Lisp_io_h #define Lisp_io_h -#include "private.h" +#include "lisp/private.h" #define FILE_READ 0x01 #define FILE_WRITE 0x02 @@ -55,13 +55,13 @@ struct _LispFile { int length; /* number of bytes used */ int offset; /* read/write offset */ int unget : 8; /* unread char */ - int readable : 1; - int writable : 1; - int regular : 1; /* regular file */ - int buffered : 1; - int available : 1; /* unget field holds a char */ - int nonblock : 1; /* in nonblock mode */ - int binary : 1; /* if set, don't calculate column/line-number */ + unsigned int readable : 1; + unsigned int writable : 1; + unsigned int regular : 1; /* regular file */ + unsigned int buffered : 1; + unsigned int available : 1; /* unget field holds a char */ + unsigned int nonblock : 1; /* in nonblock mode */ + unsigned int binary : 1; /* if set, don't calculate column/line-number */ io_write_fn io_write; }; @@ -73,8 +73,8 @@ struct _LispString { int length; /* number of bytes used */ int input; /* input offset, for read operations */ int output; /* output offset, for write operations */ - int fixed : 1; /* if set, don't try to reallocate string */ - int binary : 1; /* if set, don't calculate column/line-number */ + unsigned int fixed : 1; /* if set, don't try to reallocate string */ + unsigned int binary : 1; /* if set, don't calculate column/line-number */ }; /* diff --git a/lisp/lisp.c b/lisp/lisp.c index cda8c14..0d66dc9 100644 --- a/lisp/lisp.c +++ b/lisp/lisp.c @@ -27,7 +27,7 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/lisp.c,v 1.85 2003/01/29 03:05:53 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/lisp.c,v 1.89 2003/10/02 13:30:13 eich Exp $ */ #include <stdlib.h> #include <string.h> @@ -67,20 +67,20 @@ #define HAS_SC_PAGESIZE #endif -#include "bytecode.h" - -#include "read.h" -#include "format.h" -#include "math.h" -#include "hash.h" -#include "package.h" -#include "pathname.h" -#include "regex.h" -#include "require.h" -#include "stream.h" -#include "struct.h" -#include "time.h" -#include "write.h" +#include "lisp/bytecode.h" + +#include "lisp/read.h" +#include "lisp/format.h" +#include "lisp/math.h" +#include "lisp/hash.h" +#include "lisp/package.h" +#include "lisp/pathname.h" +#include "lisp/regex.h" +#include "lisp/require.h" +#include "lisp/stream.h" +#include "lisp/struct.h" +#include "lisp/time.h" +#include "lisp/write.h" #include <math.h> typedef struct { @@ -1415,11 +1415,11 @@ LispDecrementAtomReference(LispAtom *atom) /* if atom->property is NOPROPERTY, this is an unbound symbol */ return; - --atom->property->refcount; - - if (atom->property->refcount < 0) + if (atom->property->refcount <= 0) LispDestroy("internal error at DECREMENT-ATOM-REFERENCE"); + --atom->property->refcount; + if (atom->property->refcount == 0) { LispRemAtomAllProperties(atom); free(atom->property); @@ -2630,7 +2630,8 @@ Lisp__New(LispObj *car, LispObj *cdr) obj = objseg.freeobj; objseg.freeobj = CDR(obj); - + --objseg.nfree; + return (obj); } @@ -2641,9 +2642,11 @@ LispNew(LispObj *car, LispObj *cdr) if (obj == NIL) obj = Lisp__New(car, cdr); - else + else { objseg.freeobj = CDR(obj); - + --objseg.nfree; + } + return (obj); } @@ -2782,9 +2785,10 @@ LispNewDFloat(double value) if (dfloat == NIL) dfloat = Lisp__New(NIL, NIL); - else + else { objseg.freeobj = CDR(dfloat); - + --objseg.nfree; + } dfloat->type = LispDFloat_t; dfloat->data.dfloat = value; @@ -2799,9 +2803,10 @@ LispNewString(char *str, long length, int alloced) if (string == NIL) string = Lisp__New(NIL, NIL); - else + else { objseg.freeobj = CDR(string); - + --objseg.nfree; + } if (alloced) cstring = str; else { @@ -2825,9 +2830,10 @@ LispNewComplex(LispObj *realpart, LispObj *imagpart) if (complexp == NIL) complexp = Lisp__New(realpart, imagpart); - else + else { objseg.freeobj = CDR(complexp); - + --objseg.nfree; + } complexp->type = LispComplex_t; complexp->data.complex.real = realpart; complexp->data.complex.imag = imagpart; @@ -2843,9 +2849,10 @@ LispNewInteger(long integer) if (object == NIL) object = Lisp__New(NIL, NIL); - else + else { objseg.freeobj = CDR(object); - + --objseg.nfree; + } object->type = LispInteger_t; object->data.integer = integer; @@ -2861,9 +2868,10 @@ LispNewRatio(long num, long den) if (ratio == NIL) ratio = Lisp__New(NIL, NIL); - else + else { objseg.freeobj = CDR(ratio); - + --objseg.nfree; + } ratio->type = LispRatio_t; ratio->data.ratio.numerator = num; ratio->data.ratio.denominator = den; @@ -2936,9 +2944,10 @@ LispNewCons(LispObj *car, LispObj *cdr) if (cons == NIL) cons = Lisp__New(car, cdr); - else + else { objseg.freeobj = CDR(cons); - + --objseg.nfree; + } CAR(cons) = car; CDR(cons) = cdr; @@ -3180,10 +3189,8 @@ LispGetVarPack(LispObj *symbol) int ii; char *string; LispAtom *atom; - LispProperty *property; string = ATOMID(symbol); - property = symbol->data.atom->property; ii = STRHASH(string); atom = lisp__data.pack->atoms[ii]; @@ -4860,15 +4867,13 @@ LispRunFunMac(LispObj *name, LispObj *code, int macro, int base) if (!macro) { int lex = lisp__data.env.lex; - int did_jump = 1, *pdid_jump; - LispObj **pcode, **presult; + int did_jump = 1; LispBlock *block; block = LispBeginBlock(name, LispBlockClosure); lisp__data.env.lex = base; if (setjmp(block->jmp) == 0) { - for (pcode = &code, presult = &result, pdid_jump = &did_jump; - CONSP(code); code = CDR(code)) + for (; CONSP(code); code = CDR(code)) result = EVAL(CAR(code)); did_jump = 0; } @@ -27,11 +27,11 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/lsp.c,v 1.7 2002/11/23 08:26:49 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/lsp.c,v 1.8 2003/04/27 18:17:33 tsi Exp $ */ #include <stdio.h> #include <string.h> -#include "lisp.h" +#include "lisp/lisp.h" #ifdef NEED_STRCASECMP int strcasecmp(const char *s1, const char *s2); diff --git a/lisp/math.c b/lisp/math.c index fcadefa..7d15e85 100644 --- a/lisp/math.c +++ b/lisp/math.c @@ -27,10 +27,14 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/math.c,v 1.22 2002/11/23 21:41:52 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/math.c,v 1.24 2003/04/27 18:17:33 tsi Exp $ */ -#include "math.h" -#include "private.h" +#include "lisp/math.h" +#include "lisp/private.h" + +#ifdef __UNIXOS2__ +# define finite(x) isfinite(x) +#endif /* * Prototypes @@ -50,7 +54,7 @@ Atom_id Sdefault_float_format; /* * Implementation */ -#include "mathimp.c" +#include "lisp/mathimp.c" void LispMathInit(void) diff --git a/lisp/math.h b/lisp/math.h index 8297d43..90a4dd2 100644 --- a/lisp/math.h +++ b/lisp/math.h @@ -27,12 +27,12 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/math.h,v 1.6 2002/11/08 08:00:57 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/math.h,v 1.7 2003/04/27 18:17:33 tsi Exp $ */ #ifndef Lisp_math_h #define Lisp_math_h -#include "internal.h" +#include "lisp/internal.h" #include "mp.h" void LispMathInit(void); diff --git a/lisp/mathimp.c b/lisp/mathimp.c index ccda576..fc8b255 100644 --- a/lisp/mathimp.c +++ b/lisp/mathimp.c @@ -27,7 +27,7 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/mathimp.c,v 1.14 2003/01/30 02:46:25 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/mathimp.c,v 1.15 2003/10/24 20:38:16 tsi Exp $ */ /* @@ -2763,7 +2763,7 @@ fi_fi_mul_overflow(long op1, long op2) return (op > 2147483647.0 || op < -2147483648.0); #else - int shift, sign; + int shift; long mask; if (op1 == 0 || op1 == 1 || op2 == 0 || op2 == 1) @@ -2772,8 +2772,6 @@ fi_fi_mul_overflow(long op1, long op2) if (op1 == MINSLONG || op2 == MINSLONG) return (1); - sign = (op1 < 0) ^ (op2 < 0); - if (op1 < 0) op1 = -op1; if (op2 < 0) diff --git a/lisp/modules/psql.c b/lisp/modules/psql.c index 6945947..fc112fc 100644 --- a/lisp/modules/psql.c +++ b/lisp/modules/psql.c @@ -27,15 +27,15 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/modules/psql.c,v 1.12 2002/11/23 08:26:52 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/modules/psql.c,v 1.13 2003/04/27 18:17:37 tsi Exp $ */ #include <stdlib.h> #include <libpq-fe.h> #undef USE_SSL /* cannot get it to compile... */ #include <postgres.h> #include <utils/geo_decls.h> -#include "internal.h" -#include "private.h" +#include "lisp/internal.h" +#include "lisp/private.h" /* * Prototypes diff --git a/lisp/modules/x11.c b/lisp/modules/x11.c index 3cdb0bc..2383e4e 100644 --- a/lisp/modules/x11.c +++ b/lisp/modules/x11.c @@ -27,12 +27,12 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/modules/x11.c,v 1.10 2002/11/23 08:26:52 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/modules/x11.c,v 1.12 2003/04/27 18:17:37 tsi Exp $ */ #include <stdlib.h> #include <string.h> -#include "internal.h" -#include "private.h" +#include "lisp/internal.h" +#include "lisp/private.h" #include <X11/Xlib.h> /* @@ -228,10 +228,10 @@ Lisp_XBlackPixel(LispBuiltin *builtin) if (oscreen == UNSPEC) screen = DefaultScreen(display); - else + else { CHECK_INDEX(oscreen); - else screen = FIXNUM_VALUE(oscreen); + } if (screen >= ScreenCount(display)) LispDestroy("%s: screen index %d too large, %d screens available", @@ -278,10 +278,10 @@ Lisp_XWhitePixel(LispBuiltin *builtin) if (oscreen == UNSPEC) screen = DefaultScreen(display); - else + else { CHECK_FIXNUM(oscreen); - else screen = FIXNUM_VALUE(oscreen); + } if (screen >= ScreenCount(display)) LispDestroy("%s: screen index %d too large, %d screens available", @@ -328,10 +328,10 @@ Lisp_XDefaultGC(LispBuiltin *builtin) if (oscreen == UNSPEC) screen = DefaultScreen(display); - else + else { CHECK_FIXNUM(oscreen); - else screen = FIXNUM_VALUE(oscreen); + } if (screen >= ScreenCount(display)) LispDestroy("%s: screen index %d too large, %d screens available", @@ -408,24 +408,24 @@ Lisp_XCreateSimpleWindow(LispBuiltin *builtin) /* check &OPTIONAL parameters */ if (oborder_width == UNSPEC) border_width = 1; - else + else { CHECK_INDEX(oborder_width); - else border_width = FIXNUM_VALUE(oborder_width); + } if (oborder == UNSPEC) border = BlackPixel(display, DefaultScreen(display)); - else + else { CHECK_LONGINT(oborder); - else border = LONGINT_VALUE(oborder); + } if (obackground == UNSPEC) background = WhitePixel(display, DefaultScreen(display)); - else + else { CHECK_LONGINT(obackground); - else background = LONGINT_VALUE(obackground); + } return (OPAQUE( XCreateSimpleWindow(display, parent, x, y, width, height, @@ -588,10 +588,10 @@ Lisp_XBell(LispBuiltin *builtin) if (opercent == UNSPEC) percent = 0; - else + else { CHECK_FIXNUM(opercent); - else percent = FIXNUM_VALUE(opercent); + } if (percent < -100 || percent > 100) LispDestroy("%s: percent value %d out of range -100 to 100", diff --git a/lisp/modules/xaw.c b/lisp/modules/xaw.c index c2b372b..4e6bdf4 100644 --- a/lisp/modules/xaw.c +++ b/lisp/modules/xaw.c @@ -27,7 +27,7 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/modules/xaw.c,v 1.14 2002/11/23 08:26:52 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/modules/xaw.c,v 1.16 2003/04/27 18:17:37 tsi Exp $ */ #include <stdlib.h> #include <X11/Intrinsic.h> @@ -64,8 +64,8 @@ #include <X11/Xaw/Tree.h> #include <X11/Xaw/Viewport.h> #include <X11/Vendor.h> -#include "internal.h" -#include "private.h" +#include "lisp/internal.h" +#include "lisp/private.h" /* * Types @@ -318,7 +318,6 @@ Lisp_XawScrollbarCoerceToReal(LispBuiltin *builtin) xaw-scrollbar-coerce-to-real opaque */ { - LispObj *result; float *floatp; double real; diff --git a/lisp/modules/xt.c b/lisp/modules/xt.c index 13c7ae7..83487b9 100644 --- a/lisp/modules/xt.c +++ b/lisp/modules/xt.c @@ -27,7 +27,7 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/modules/xt.c,v 1.19 2002/11/23 08:26:52 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/modules/xt.c,v 1.21 2003/04/27 18:17:38 tsi Exp $ */ #include <stdlib.h> #include <stdio.h> @@ -35,8 +35,8 @@ #include <X11/Intrinsic.h> #include <X11/StringDefs.h> #include <X11/Shell.h> -#include "internal.h" -#include "private.h" +#include "lisp/internal.h" +#include "lisp/private.h" /* * Types @@ -67,7 +67,7 @@ typedef struct { /* * Prototypes */ -int xtLoadModule(LispMac*); +int xtLoadModule(void); void LispXtCleanupCallback(Widget, XtPointer, XtPointer); void LispXtCallback(Widget, XtPointer, XtPointer); @@ -545,13 +545,13 @@ Lisp_XtAppInitialize(LispBuiltin *builtin) int count; CHECK_CONS(fallback_resources); - for (string = fallback_resources, count = 0; CONS_P(string); + for (string = fallback_resources, count = 0; CONSP(string); string = CDR(string), count++) CHECK_STRING(CAR(string)); /* fallback resources was correctly specified */ fallback = LispMalloc(sizeof(String) * (count + 1)); - for (string = fallback_resources, count = 0; CONS_P(string); + for (string = fallback_resources, count = 0; CONSP(string); string = CDR(string), count++) fallback[count] = THESTR(CAR(string)); fallback[count] = NULL; @@ -644,8 +644,8 @@ Lisp_XtAppProcessEvent(LispBuiltin *builtin) } if (mask != (mask & XtIMAll)) - LispDestroy("%s: %d does not fit in XtInputMask %d", - STRFUN(builtin), mask); + LispDestroy("%s: %ld does not fit in XtInputMask %ld", + STRFUN(builtin), (long)mask, (long)XtIMAll); if (mask) XtAppProcessEvent(appcon, mask); @@ -800,6 +800,8 @@ LispXtCreateWidget(LispBuiltin *builtin, int options) STRFUN(builtin), STROBJ(oparent)); parent = (Widget)(oparent->data.opaque.data); + if (arguments == UNSPEC) + arguments = NIL; CHECK_LIST(arguments); if (options == SHELL) @@ -807,7 +809,7 @@ LispXtCreateWidget(LispBuiltin *builtin, int options) else widget = XtCreateWidget(name, widget_class, parent, NULL, 0); - if (arguments == UNSPEC || arguments == NIL) + if (arguments == NIL) resources = NULL; else { resources = LispConvertResources(arguments, widget, @@ -878,7 +880,7 @@ Lisp_XtGetValues(LispBuiltin *builtin) GCDisable(); result = NIL; - for (list = arguments; CONS_P(list); list = CDR(list)) { + for (list = arguments; CONSP(list); list = CDR(list)) { CHECK_STRING(CAR(list)); if ((resource = GetResourceInfo(THESTR(CAR(list)), rlist, plist)) == NULL) { @@ -928,9 +930,9 @@ Lisp_XtGetValues(LispBuiltin *builtin) /* special resources */ if (resource->qtype == qString) { #ifdef LONG64 - object = CONS(CAR(list), STRING(c8)); + object = CONS(CAR(list), STRING((char*)c8)); #else - object = CONS(CAR(list), STRING(c4)); + object = CONS(CAR(list), STRING((char*)c4)); #endif } else if (resource->qtype == qCardinal || resource->qtype == qInt) { diff --git a/lisp/mp/mpi.c b/lisp/mp/mpi.c index 506dc7e..ec8f587 100644 --- a/lisp/mp/mpi.c +++ b/lisp/mp/mpi.c @@ -27,10 +27,14 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/mp/mpi.c,v 1.12 2002/11/20 07:44:43 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/mp/mpi.c,v 1.13 2003/03/25 04:18:28 dawes Exp $ */ #include "mp.h" +#ifdef __UNIXOS2__ +# define finite(x) isfinite(x) +#endif + /* * Prototypes */ diff --git a/lisp/package.c b/lisp/package.c index c046e55..ab61946 100644 --- a/lisp/package.c +++ b/lisp/package.c @@ -27,10 +27,10 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/package.c,v 1.20 2002/11/30 23:13:12 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/package.c,v 1.21 2003/04/27 18:17:34 tsi Exp $ */ -#include "package.h" -#include "private.h" +#include "lisp/package.h" +#include "lisp/private.h" /* * Prototypes diff --git a/lisp/package.h b/lisp/package.h index 23ad822..7344047 100644 --- a/lisp/package.h +++ b/lisp/package.h @@ -27,12 +27,12 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/package.h,v 1.7 2002/11/26 04:06:28 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/package.h,v 1.8 2003/04/27 18:17:34 tsi Exp $ */ #ifndef Lisp_package_h #define Lisp_package_h -#include "internal.h" +#include "lisp/internal.h" void LispPackageInit(void); LispObj *LispFindPackage(LispObj*); diff --git a/lisp/pathname.c b/lisp/pathname.c index 6af8cd1..834bfca 100644 --- a/lisp/pathname.c +++ b/lisp/pathname.c @@ -27,15 +27,15 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/pathname.c,v 1.17 2002/12/24 00:25:39 dawes Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/pathname.c,v 1.18 2003/04/27 18:17:34 tsi Exp $ */ -#include <stdio.h> /* including dirent.h first may cause problems */ +#include <stdio.h> /* including dirent.h first may cause problems */ #include <sys/types.h> #include <dirent.h> #include <errno.h> #include <sys/stat.h> -#include "pathname.h" -#include "private.h" +#include "lisp/pathname.h" +#include "lisp/private.h" #define NOREAD_SKIP 0 #define NOREAD_ERROR 1 diff --git a/lisp/pathname.h b/lisp/pathname.h index f99917e..7b5414d 100644 --- a/lisp/pathname.h +++ b/lisp/pathname.h @@ -27,12 +27,12 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/pathname.h,v 1.4 2002/11/08 08:00:57 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/pathname.h,v 1.5 2003/04/27 18:17:34 tsi Exp $ */ #ifndef Lisp_pathname_h #define Lisp_pathname_h -#include "internal.h" +#include "lisp/internal.h" #define PATH_SEP '/' #define PATH_TYPESEP '.' diff --git a/lisp/private.h b/lisp/private.h index 6e5b128..6b78d02 100644 --- a/lisp/private.h +++ b/lisp/private.h @@ -27,7 +27,7 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/private.h,v 1.39 2002/12/20 04:32:46 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/private.h,v 1.41 2003/05/27 22:27:04 tsi Exp $ */ #ifndef Lisp_private_h #define Lisp_private_h @@ -38,15 +38,15 @@ #include <setjmp.h> #include <unistd.h> #include <sys/time.h> -#include "internal.h" +#include "lisp/internal.h" -#include "core.h" +#include "lisp/core.h" #ifdef DEBUGGER -#include "debugger.h" +#include "lisp/debugger.h" #endif -#include "helper.h" -#include "string.h" -#include "struct.h" +#include "lisp/helper.h" +#include "lisp/string.h" +#include "lisp/struct.h" /* * Defines @@ -55,10 +55,10 @@ #define MULTIPLE_VALUES_LIMIT 127 #define MAX_STACK_DEPTH 16384 -#define FEATURES \ - lisp__data.features->data.atom->a_object ? \ - lisp__data.features->data.atom->property->value : \ - NIL +#define FEATURES \ + (lisp__data.features->data.atom->a_object ? \ + (LispObj *)lisp__data.features->data.atom->property->value : \ + NIL) #define PACK lisp__data.packlist #define PACKAGE lisp__data.package->data.atom->property->value #define MOD lisp__data.modlist diff --git a/lisp/read.c b/lisp/read.c index b8872a2..115dec4 100644 --- a/lisp/read.c +++ b/lisp/read.c @@ -27,12 +27,12 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/read.c,v 1.34 2003/01/13 03:57:58 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/read.c,v 1.37 2003/05/27 22:27:04 tsi Exp $ */ #include <errno.h> -#include "read.h" -#include "package.h" -#include "write.h" +#include "lisp/read.h" +#include "lisp/package.h" +#include "lisp/write.h" #include <fcntl.h> #include <stdarg.h> @@ -62,6 +62,10 @@ #define READ_ERROR_FIXNUM() READ_ERROR0("number is not a fixnum") #define READ_ERROR_INVARG() READ_ERROR0("invalid argument") +#ifdef __UNIXOS2__ +# define finite(x) isfinite(x) +#endif + /* * Types */ @@ -251,9 +255,8 @@ Lisp_Read(LispBuiltin *builtin) { LispObj *result; - LispObj *input_stream, *eof_error_p, *eof_value, *recursive_p; + LispObj *input_stream, *eof_error_p, *eof_value; - recursive_p = ARGUMENT(3); eof_value = ARGUMENT(2); eof_error_p = ARGUMENT(1); input_stream = ARGUMENT(0); @@ -294,11 +297,9 @@ static LispObj * LispReadChar(LispBuiltin *builtin, int nohang) { int character; - LispObj *result; - LispObj *input_stream, *eof_error_p, *eof_value, *recursive_p; + LispObj *input_stream, *eof_error_p, *eof_value; - recursive_p = ARGUMENT(3); eof_value = ARGUMENT(2); eof_error_p = ARGUMENT(1); input_stream = ARGUMENT(0); @@ -314,7 +315,6 @@ LispReadChar(LispBuiltin *builtin, int nohang) if (eof_value == UNSPEC) eof_value = NIL; - result = NIL; character = EOF; if (input_stream->data.stream.readable) { @@ -410,9 +410,8 @@ Lisp_ReadLine(LispBuiltin *builtin) int ch, length; LispObj *result, *status = NIL; - LispObj *input_stream, *eof_error_p, *eof_value, *recursive_p; + LispObj *input_stream, *eof_error_p, *eof_value; - recursive_p = ARGUMENT(3); eof_value = ARGUMENT(2); eof_error_p = ARGUMENT(1); input_stream = ARGUMENT(0); diff --git a/lisp/read.h b/lisp/read.h index 229ced5..f2d48fd 100644 --- a/lisp/read.h +++ b/lisp/read.h @@ -27,12 +27,12 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/read.h,v 1.3 2002/11/15 07:01:30 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/read.h,v 1.4 2003/04/27 18:17:34 tsi Exp $ */ #ifndef Lisp_read_h #define Lisp_read_h -#include "io.h" +#include "lisp/io.h" /* * Prototypes diff --git a/lisp/regex.c b/lisp/regex.c index bf3390d..196e8a4 100644 --- a/lisp/regex.c +++ b/lisp/regex.c @@ -27,11 +27,11 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/regex.c,v 1.10 2002/12/11 04:44:28 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/regex.c,v 1.11 2003/04/27 18:17:34 tsi Exp $ */ -#include "regex.h" -#include "private.h" -#include "helper.h" +#include "lisp/regex.h" +#include "lisp/private.h" +#include "lisp/helper.h" /* * Prototypes diff --git a/lisp/regex.h b/lisp/regex.h index cc4d7e6..ebd5ce3 100644 --- a/lisp/regex.h +++ b/lisp/regex.h @@ -27,12 +27,12 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/regex.h,v 1.3 2002/11/08 08:00:57 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/regex.h,v 1.4 2003/04/27 18:17:34 tsi Exp $ */ #ifndef Lisp_regex_h #define Lisp_regex_h -#include "internal.h" +#include "lisp/internal.h" /* * Prototypes diff --git a/lisp/require.c b/lisp/require.c index 7f80c3f..ff01346 100644 --- a/lisp/require.c +++ b/lisp/require.c @@ -27,9 +27,9 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/require.c,v 1.16 2002/11/23 08:26:50 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/require.c,v 1.18 2003/04/27 18:17:34 tsi Exp $ */ -#include "require.h" +#include "lisp/require.h" /* * Implementation @@ -120,13 +120,13 @@ Lisp_Require(LispBuiltin *builtin) if (lisp__data.module == NULL) { /* export our own symbols */ if (dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL) == NULL) - LispDestroy(mac, "%s: ", STRFUN(builtin), dlerror()); + LispDestroy("%s: ", STRFUN(builtin), dlerror()); } lisp_module = (LispModule*)LispMalloc(sizeof(LispModule)); if ((lisp_module->handle = dlopen(filename, RTLD_LAZY | RTLD_GLOBAL)) == NULL) - LispDestroy(mac, "%s: dlopen: %s", STRFUN(builtin), dlerror()); + LispDestroy("%s: dlopen: %s", STRFUN(builtin), dlerror()); snprintf(data, sizeof(data), "%sLispModuleData", THESTR(module)); if ((lisp_module->data = (LispModuleData*)dlsym(lisp_module->handle, data)) == NULL) { diff --git a/lisp/require.h b/lisp/require.h index 42c2064..85efe60 100644 --- a/lisp/require.h +++ b/lisp/require.h @@ -27,13 +27,13 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/require.h,v 1.4 2002/11/08 08:00:57 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/require.h,v 1.5 2003/04/27 18:17:34 tsi Exp $ */ #ifndef Lisp_require_h #define Lisp_require_h -#include "private.h" -#include "helper.h" +#include "lisp/private.h" +#include "lisp/helper.h" #ifdef SHARED_MODULES #include <dlfcn.h> #endif diff --git a/lisp/stream.c b/lisp/stream.c index be0f44d..98372a8 100644 --- a/lisp/stream.c +++ b/lisp/stream.c @@ -27,13 +27,13 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/stream.c,v 1.21 2002/12/10 03:59:03 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/stream.c,v 1.22 2003/04/27 18:17:34 tsi Exp $ */ -#include "read.h" -#include "stream.h" -#include "pathname.h" -#include "write.h" -#include "private.h" +#include "lisp/read.h" +#include "lisp/stream.h" +#include "lisp/pathname.h" +#include "lisp/write.h" +#include "lisp/private.h" #include <errno.h> #include <fcntl.h> #include <signal.h> diff --git a/lisp/stream.h b/lisp/stream.h index c510224..568347c 100644 --- a/lisp/stream.h +++ b/lisp/stream.h @@ -27,13 +27,13 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/stream.h,v 1.8 2002/12/06 03:25:27 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/stream.h,v 1.9 2003/04/27 18:17:34 tsi Exp $ */ #ifndef Lisp_stream_h #define Lisp_stream_h -#include "io.h" -#include "internal.h" +#include "lisp/io.h" +#include "lisp/internal.h" void LispStreamInit(void); diff --git a/lisp/string.c b/lisp/string.c index 95952bd..457979f 100644 --- a/lisp/string.c +++ b/lisp/string.c @@ -27,12 +27,12 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/string.c,v 1.22 2002/12/04 05:27:58 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/string.c,v 1.25 2003/05/27 22:27:04 tsi Exp $ */ -#include "helper.h" -#include "read.h" -#include "string.h" -#include "private.h" +#include "lisp/helper.h" +#include "lisp/read.h" +#include "lisp/string.h" +#include "lisp/private.h" #include <ctype.h> #define CHAR_LESS 1 @@ -549,9 +549,8 @@ Lisp_MakeString(LispBuiltin *builtin) long length; char *string, initial; - LispObj *size, *initial_element, *element_type; + LispObj *size, *initial_element; - element_type = ARGUMENT(2); initial_element = ARGUMENT(1); size = ARGUMENT(0); @@ -598,6 +597,12 @@ Lisp_ParseInteger(LispBuiltin *builtin) LispCheckSequenceStartEnd(builtin, ostring, ostart, oend, &start, &end, &length); string = THESTR(ostring); + if (oradix == UNSPEC) + radix = 10; + else { + CHECK_INDEX(oradix); + radix = FIXNUM_VALUE(oradix); + } if (radix < 2 || radix > 36) LispDestroy("%s: :RADIX %ld must be in the range 2 to 36", STRFUN(builtin), radix); @@ -725,10 +730,8 @@ Lisp_ReadFromString(LispBuiltin *builtin) LispObj *stream, *result; long length, start, end, bytes_read; - LispObj *ostring, *eof_error_p, *eof_value, - *ostart, *oend, *preserve_white_space; + LispObj *ostring, *eof_error_p, *eof_value, *ostart, *oend; - preserve_white_space = ARGUMENT(5); oend = ARGUMENT(4); ostart = ARGUMENT(3); eof_value = ARGUMENT(2); diff --git a/lisp/string.h b/lisp/string.h index 02b416b..8e3670f 100644 --- a/lisp/string.h +++ b/lisp/string.h @@ -27,12 +27,12 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/string.h,v 1.11 2002/11/25 02:35:30 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/string.h,v 1.12 2003/04/27 18:17:34 tsi Exp $ */ #ifndef Lisp_string_h #define Lisp_string_h -#include "internal.h" +#include "lisp/internal.h" LispObj *Lisp_AlphaCharP(LispBuiltin*); LispObj *Lisp_BothCaseP(LispBuiltin*); diff --git a/lisp/struct.c b/lisp/struct.c index 0d2a768..45b7e70 100644 --- a/lisp/struct.c +++ b/lisp/struct.c @@ -27,9 +27,9 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/struct.c,v 1.22 2002/11/23 08:26:50 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/struct.c,v 1.23 2003/04/27 18:17:34 tsi Exp $ */ -#include "struct.h" +#include "lisp/struct.h" /* * Prototypes diff --git a/lisp/struct.h b/lisp/struct.h index 7559a02..f639cbd 100644 --- a/lisp/struct.h +++ b/lisp/struct.h @@ -27,12 +27,12 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/struct.h,v 1.6 2002/11/10 16:29:07 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/struct.h,v 1.7 2003/04/27 18:17:35 tsi Exp $ */ #ifndef Lisp_struct_h #define Lisp_struct_h -#include "private.h" +#include "lisp/private.h" /* * Defines diff --git a/lisp/time.c b/lisp/time.c index 3c21d00..826dacc 100644 --- a/lisp/time.c +++ b/lisp/time.c @@ -27,10 +27,10 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/time.c,v 1.7 2002/11/08 08:00:57 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/time.c,v 1.10 2003/04/27 18:17:35 tsi Exp $ */ -#include "time.h" -#include "bytecode.h" +#include "lisp/time.h" +#include "lisp/bytecode.h" /* * Implementation @@ -41,6 +41,7 @@ Lisp_Time(LispBuiltin *builtin) time form */ { +#ifndef __UNIXOS2__ struct itimerval real, virt, prof; unsigned long count; long sec, usec; @@ -135,4 +136,8 @@ Lisp_Time(LispBuiltin *builtin) lisp__data.gc.timebits = 0; return (result); +#else + LispMessage("\"Lisp_Time\" not implemented under OS/2"); + return (NIL); +#endif } diff --git a/lisp/time.h b/lisp/time.h index 3d07916..f2b9da3 100644 --- a/lisp/time.h +++ b/lisp/time.h @@ -27,12 +27,12 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/time.h,v 1.3 2002/11/08 08:00:57 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/time.h,v 1.4 2003/04/27 18:17:35 tsi Exp $ */ #ifndef Lisp_time_h #define Lisp_time_h -#include "private.h" +#include "lisp/private.h" LispObj *Lisp_Time(LispBuiltin*); diff --git a/lisp/write.c b/lisp/write.c index 4952119..fbf4718 100644 --- a/lisp/write.c +++ b/lisp/write.c @@ -27,10 +27,10 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/write.c,v 1.30 2002/12/04 18:43:19 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/write.c,v 1.32 2003/05/27 22:27:04 tsi Exp $ */ -#include "write.h" -#include "hash.h" +#include "lisp/write.h" +#include "lisp/hash.h" #include <math.h> #include <ctype.h> @@ -258,14 +258,9 @@ Lisp_Write(LispBuiltin *builtin) { int head = lisp__data.env.length; - LispObj *object, *ocase, *circle, *escape, *length, *level, - *lines, *pretty, *readably, *right_margin, *stream; + LispObj *object, *ocase, *circle, *escape, *length, *level, *stream; stream = ARGUMENT(10); - right_margin = ARGUMENT(9); /* yet unused */ - readably = ARGUMENT(8); /* yet unused */ - pretty = ARGUMENT(7); /* yet unused */ - lines = ARGUMENT(6); /* yet unused */ level = ARGUMENT(5); length = ARGUMENT(4); escape = ARGUMENT(3); diff --git a/lisp/write.h b/lisp/write.h index 994a374..035368e 100644 --- a/lisp/write.h +++ b/lisp/write.h @@ -27,12 +27,12 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/write.h,v 1.9 2002/12/04 05:27:59 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/write.h,v 1.10 2003/04/27 18:17:35 tsi Exp $ */ #ifndef Lisp_write_h #define Lisp_write_h -#include "io.h" +#include "lisp/io.h" /* * Prototypes diff --git a/lisp/xedit.c b/lisp/xedit.c index 9ef7f8f..6840cdd 100644 --- a/lisp/xedit.c +++ b/lisp/xedit.c @@ -27,14 +27,14 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/xedit.c,v 1.24 2003/01/13 03:57:59 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/xedit.c,v 1.26 2003/05/20 21:44:48 tsi Exp $ */ -#include "../xedit.h" +#include "xedit/xedit.h" #include <X11/Xaw/TextSrcP.h> /* Needs some private definitions */ #include <X11/Xaw/TextSinkP.h> /* Also needs private definitions... */ #include <X11/Xmu/Xmu.h> #define XEDIT_LISP_PRIVATE -#include "xedit.h" +#include "lisp/xedit.h" #include <signal.h> /* Initialize to enter lisp */ diff --git a/lisp/xedit.h b/lisp/xedit.h index 0beff56..a544f14 100644 --- a/lisp/xedit.h +++ b/lisp/xedit.h @@ -27,16 +27,16 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/lisp/xedit.h,v 1.5 2002/11/10 23:22:00 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/lisp/xedit.h,v 1.6 2003/04/27 18:17:35 tsi Exp $ */ #ifndef Lisp_xedit_h #define Lisp_xedit_h #ifdef XEDIT_LISP_PRIVATE -#include "private.h" -#include "io.h" -#include "read.h" -#include "write.h" +#include "lisp/private.h" +#include "lisp/io.h" +#include "lisp/read.h" +#include "lisp/write.h" LispObj *Xedit_AddEntity(LispBuiltin*); LispObj *Xedit_AutoFill(LispBuiltin*); |