C:/Users/Dennis/src/lang/Life_start/Life/life-1.02/source/template.h

Go to the documentation of this file.
00001 /* Copyright 1991 Digital Equipment Corporation.
00002 ** All Rights Reserved.
00003 *****************************************************************/
00004 /*      $Id: templates.h,v 1.2 1994/12/08 23:34:07 duchier Exp $         */
00005 
00006 
00007 /* constants */
00008 
00009 #define MAXNBARGS 20
00010 
00011 
00012 /* defined in templates.c */
00013 
00014 extern char *numbers[];
00015 extern long set_extra_args[];
00016 extern long get_arg ();
00017 
00018 
00019 
00020 /*  PVR: Dec 17 1992  */
00021 #ifdef X11
00022 #define XPART(argi,vali,numi) \
00023     if (argi->type == xwindow || argi->type == xpixmap) {\
00024         vali = GetIntAttr (argi, "id"); \
00025         if(vali== -34466) \
00026           numi=FALSE; \
00027     }
00028 
00029 #else
00030 #define XPART(argi,vali,numi) if (FALSE) ;
00031 #endif
00032 
00033 
00034 
00035 /* macros */
00036 
00037 
00038 #define include_var_builtin(NBARGS) \
00039         ptr_psi_term g, args[NBARGS]; \
00040         long num[NBARGS]; \
00041         long val[NBARGS]; \
00042         long ii, success=TRUE, resi=FALSE
00043 
00044 
00045 #define begin_builtin(FUNCNAME, NBARGS, NBARGSIN, TYPES) \
00046     if (NBARGS > MAXNBARGS) \
00047         Errorline ("in template: you have to increase MAXNBARGS at least to %d !\n", NBARGS); \
00048     \
00049     g=aim->a; \
00050     deref_ptr(g); \
00051     \
00052     for (ii = 0; success && ii < NBARGS; ii++) \
00053         success = get_arg (g, &args[ii], numbers[ii]); \
00054     \
00055     if (success) \
00056     { \
00057         for (ii = 0; ii < NBARGS; ii++) \
00058             deref (args[ii]); \
00059     \
00060         deref_args (g, set_extra_args [NBARGS+1]); \
00061     \
00062         for (ii = 0; success && ii < NBARGS; ii++) \
00063         { \
00064             success = matches (args[ii]->type, types[ii], &num[ii]); \
00065             if (args[ii]->value != NULL && num[ii]) \
00066                 if (types[ii] == integer) \
00067                     val[ii] = *(long *) args[ii]->value; \
00068                 else \
00069                 if (types[ii] == real) \
00070                     val[ii] = *(REAL *) args[ii]->value; \
00071                 else \
00072                 if (types[ii] == quoted_string) \
00073                     val[ii] = (long) args[ii]->value; \
00074                 else \
00075                     Errorline ("in template: type %T not expected (built-in FUNCNAME).\n", types[ii]); \
00076             else \
00077                 if (args[ii]->type == true) \
00078                     val[ii] = TRUE; \
00079                 else \
00080                 if (args[ii]->type == false) \
00081                     val[ii] = FALSE; \
00082                 else \
00083                   XPART(args[ii],val[ii],num[ii]) /* 16.12 */ \
00084                 else \
00085                     num[ii] = FALSE; /* force the residuation */ \
00086         } \
00087     \
00088         if (success) \
00089         { \
00090             for (ii = 0; ii < NBARGSIN; ii++) \
00091                 if (args[ii]->resid != NULL || !num[ii]) \
00092                 { \
00093                     residuate (args[ii]); \
00094                     resi = TRUE; \
00095                 } \
00096     \
00097             if (success && !resi) \
00098             {
00099 
00100 
00101 #define end_builtin() \
00102             } \
00103         } \
00104         else \
00105             Errorline ("bad arguments in %P.\n", g); \
00106     } \
00107     else \
00108         Errorline ("missing arguments in %P.\n", g); \
00109     \
00110     return success; 
00111 

Generated on Sat Jan 26 08:48:07 2008 for WildLife by  doxygen 1.5.4