pike.git
/
src
/
program.h
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/program.h:1:
/*\ ||| This file a part of uLPC, and is copyright by Fredrik Hubinette ||| uLPC is distributed as GPL (General Public License) ||| See the files COPYING and DISCLAIMER for more information. \*/
-
#ifndef
EXEC
_H
-
#define
EXEC
_H
+
#ifndef
PROGRAM
_H
+
#define
PROGRAM
_H
#include <stdarg.h> #include "config.h" #include "machine.h" #include "types.h"
-
+
#define LFUN___INIT 0
+
#define LFUN_CREATE 1
+
#define LFUN_DESTROY 2
+
#define LFUN_ADD 3
+
#define LFUN_SUBTRACT 4
+
#define LFUN_AND 5
+
#define LFUN_OR 6
+
#define LFUN_XOR 7
+
#define LFUN_LSH 8
+
#define LFUN_RSH 9
+
#define LFUN_MULTIPLY 10
+
#define LFUN_DIVIDE 11
+
#define LFUN_MOD 12
+
#define LFUN_COMPL 13
+
#define LFUN_EQ 14
+
#define LFUN_LT 15
+
#define LFUN_GT 16
+
#define LFUN___HASH 17
+
#define LFUN_CAST 18
+
#define LFUN_NOT 19
+
+
#define NUM_LFUNS 20
+
+
extern char *lfun_names[];
+
struct svalue; struct module; struct object; /* I need: * a) one type that can point to a callable function. * (C function, or object->fun) * This can for instance be an svalue. * * b) one type that once the object/program is known can point * to the C/LPC function body. * * c) A number of flags to send to 'add_simul_efun' to specify side effects * and such. */ /* * Max program dimensions:
-
* 2^16 functions
+
* 2^16 functions
+ global variables
* 2^16 inherits * 2^16 arguments to lpc functions
-
* 2^32
to
efuns
and C functions
+
* 2^32 efuns
* 2^8 local variables (and arguments)
-
* 2^16 global variables
+
*/ union idptr { void (*c_fun)(INT32); INT32 offset; }; #define IDENTIFIER_LPC_FUNCTION 1 #define IDENTIFIER_C_FUNCTION 2
pike.git/src/program.h:115:
SIZE_T total_size; SIZE_T num_linenumbers; SIZE_T program_size; unsigned INT16 num_constants; unsigned INT16 num_strings; unsigned INT16 num_identifiers; unsigned INT16 num_identifier_references; unsigned INT16 num_identifier_indexes; unsigned INT16 num_inherits;
+
INT16 lfuns[NUM_LFUNS];
}; #define INHERIT_FROM_PTR(P,X) ((P)->inherits + (X)->inherit_offset) #define PROG_FROM_PTR(P,X) (INHERIT_FROM_PTR(P,X)->prog) #define ID_FROM_PTR(P,X) (PROG_FROM_PTR(P,X)->identifiers+(X)->identifier_offset) #define INHERIT_FROM_INT(P,X) INHERIT_FROM_PTR(P,(P)->identifier_references+(X)) #define PROG_FROM_INT(P,X) PROG_FROM_PTR(P,(P)->identifier_references+(X)) #define ID_FROM_INT(P,X) ID_FROM_PTR(P,(P)->identifier_references+(X)) #define free_program(p) do{ struct program *_=(p); if(!--_->refs) really_free_program(_); }while(0)