Main Page   Compound List   File List   Compound Members   File Members  

function.c

00001 /* DICElib (DIstributed CAVE Engine library) 
00002  * Copyright (c) 2001 Bruno Barberi Gnecco <brunobg@lsi.usp.br>
00003  *
00004  * Permission is hereby granted, free of charge, to any person obtaining a copy
00005  * of this software and associated documentation files (the "Software"), to
00006  * deal in the Software without restriction, including without limitation the
00007  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
00008  * sell copies of the Software, and to permit persons to whom the Software is
00009  * furnished to do so, subject to the following conditions:
00010  *
00011  * The above copyright notice and this permission notice shall be included in
00012  * all copies of the Software, its documentation and marketing & publicity
00013  * materials, and acknowledgment shall be given in the documentation, materials
00014  * and software packages that this Software was used.
00015  *
00016  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00017  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00018  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00019  * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
00020  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00021  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00022  */
00023 
00024 #include "_dicelib.h"
00025 #include <ctype.h>
00026 #include <string.h>
00027 
00028 void *(*func_list) (void *data);
00029 
00030 #ifdef FUTURE
00031 #define FUNCTION                "dice_function_init"
00032 int dice_function_init ( char *functions ) {
00033         DICE_Function           *f = DICE_MyFunctions;
00034         char                    *p;
00035         int                     num;
00036 
00037         /* count the number of functions */
00038         p = functions;
00039         while (*p) {
00040                 while (isspace(*p))
00041                         p++;
00042                 while (isalpha(*p) || *p == '_')
00043                         p++;
00044                 num++;
00045         }
00046 
00047         /* allocate memory */
00048         func_list = malloc(num*sizeof(void (*)));
00049         /* open the functions */
00050         while (f->name) {
00051                 if (!strcmp(f->name, functions))
00052                         break;
00053                 f++;
00054         }
00055         if (!f->name) {
00056                 _dice_debug(2, dice_printf(FUNCTION, 
00057                                 "Warning: couldn't load function \"%s\"\n",
00058                                 functions);)
00059         }
00060         else
00061                 dice_data.functions = f->func;
00062 
00063         return 0;
00064 }
00065 
00066 int DICE_function ( int num, ... ) {
00067         
00068         if ( dice_data.function )
00069                 return dice_data.function(data);
00070         return -1;
00071 }
00072 #endif

Generated at Sun Dec 9 16:13:18 2001 for dicelib by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001