]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - pr_comp.h
eliminated qbyte type, now uses unsigned char throughout the engine for this purpose
[xonotic/darkplaces.git] / pr_comp.h
index 879999970d1fceb5004919cbed28a4276ebc0caf..912491e6ffd9334ed9a3663e9708a8e40d9bf467 100644 (file)
--- a/pr_comp.h
+++ b/pr_comp.h
@@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 See the GNU General Public License for more details.
 
@@ -23,10 +23,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #ifndef PR_COMP_H
 #define PR_COMP_H
 
-typedef int    func_t;
+typedef unsigned int   func_t;
 typedef int    string_t;
 
-typedef enum {ev_void, ev_string, ev_float, ev_vector, ev_entity, ev_field, ev_function, ev_pointer} etype_t;
+typedef enum etype_e {ev_void, ev_string, ev_float, ev_vector, ev_entity, ev_field, ev_function, ev_pointer} etype_t;
 
 
 #define        OFS_NULL                0
@@ -42,7 +42,8 @@ typedef enum {ev_void, ev_string, ev_float, ev_vector, ev_entity, ev_field, ev_f
 #define        RESERVED_OFS    28
 
 
-enum {
+enum opcode_e
+{
        OP_DONE,
        OP_MUL_F,
        OP_MUL_V,
@@ -53,19 +54,19 @@ enum {
        OP_ADD_V,
        OP_SUB_F,
        OP_SUB_V,
-       
+
        OP_EQ_F,
        OP_EQ_V,
        OP_EQ_S,
        OP_EQ_E,
        OP_EQ_FNC,
-       
+
        OP_NE_F,
        OP_NE_V,
        OP_NE_S,
        OP_NE_E,
        OP_NE_FNC,
-       
+
        OP_LE,
        OP_GE,
        OP_LT,
@@ -115,7 +116,7 @@ enum {
        OP_GOTO,
        OP_AND,
        OP_OR,
-       
+
        OP_BITAND,
        OP_BITOR
 };
@@ -125,61 +126,83 @@ typedef struct statement_s
 {
        unsigned short  op;
        signed short    a,b,c;
-} dstatement_t;
+}
+dstatement_t;
 
-typedef struct
+typedef struct ddef_s
 {
        unsigned short  type;           // if DEF_SAVEGLOBGAL bit is set
                                                                // the variable needs to be saved in savegames
        unsigned short  ofs;
        int                     s_name;
-} ddef_t;
+}
+ddef_t;
 #define        DEF_SAVEGLOBAL  (1<<15)
 
 #define        MAX_PARMS       8
 
-typedef struct
+typedef struct dfunction_s
 {
        int             first_statement;        // negative numbers are builtins
        int             parm_start;
        int             locals;                         // total ints of parms + locals
-       
+
        int             profile;                // runtime
-       
+
        int             s_name;
        int             s_file;                 // source file defined in
-       
+
        int             numparms;
-       qbyte   parm_size[MAX_PARMS];
-} dfunction_t;
+       unsigned char   parm_size[MAX_PARMS];
+}
+dfunction_t;
+
+typedef struct mfunction_s
+{
+       int             first_statement;        // negative numbers are builtins
+       int             parm_start;
+       int             locals;                         // total ints of parms + locals
+
+       int             profile;                // runtime
+       int             builtinsprofile; // cost of builtin functions called by this function
+       int             callcount; // times the functions has been called since the last profile call
+
+       int             s_name;
+       int             s_file;                 // source file defined in
+
+       int             numparms;
+       unsigned char   parm_size[MAX_PARMS];
+}
+mfunction_t;
 
 
 #define        PROG_VERSION    6
-typedef struct
+typedef struct dprograms_s
 {
        int             version;
        int             crc;                    // check of header file
-       
+
        int             ofs_statements;
        int             numstatements;  // statement 0 is an error
 
        int             ofs_globaldefs;
        int             numglobaldefs;
-       
+
        int             ofs_fielddefs;
        int             numfielddefs;
-       
+
        int             ofs_functions;
        int             numfunctions;   // function 0 is an empty
-       
+
        int             ofs_strings;
        int             numstrings;             // first string is a null string
 
        int             ofs_globals;
        int             numglobals;
-       
+
        int             entityfields;
-} dprograms_t;
+}
+dprograms_t;
 
 #endif