mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-06 05:01:26 +00:00
155 lines
4 KiB
C
155 lines
4 KiB
C
/*
|
|
qfcc.h
|
|
|
|
#DESCRIPTION#
|
|
|
|
Copyright (C) 2001 #AUTHOR#
|
|
|
|
Author: #AUTHOR#
|
|
Date: #DATE#
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU General Public License
|
|
as published by the Free Software Foundation; either version 2
|
|
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.
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to:
|
|
|
|
Free Software Foundation, Inc.
|
|
59 Temple Place - Suite 330
|
|
Boston, MA 02111-1307, USA
|
|
|
|
$Id$
|
|
*/
|
|
|
|
#ifndef __qfcc_h
|
|
#define __qfcc_h
|
|
|
|
#include "QF/pr_comp.h"
|
|
#include "QF/pr_debug.h"
|
|
|
|
#include "def.h"
|
|
|
|
typedef struct statref_s {
|
|
struct statref_s *next;
|
|
dstatement_t *statement;
|
|
int field; // a, b, c (0, 1, 2)
|
|
} statref_t;
|
|
|
|
//============================================================================
|
|
|
|
#define MAX_REGS 65536
|
|
|
|
//=============================================================================
|
|
|
|
//
|
|
// output generated by prog parsing
|
|
//
|
|
typedef struct {
|
|
int current_memory;
|
|
struct type_s *types;
|
|
|
|
def_t def_head; // unused head of linked list
|
|
def_t *def_tail; // add new defs after this and move it
|
|
def_t *search; // search chain through defs
|
|
|
|
int size_fields;
|
|
} pr_info_t;
|
|
|
|
extern pr_info_t pr;
|
|
|
|
extern opcode_t *op_done;
|
|
extern opcode_t *op_return;
|
|
extern opcode_t *op_if;
|
|
extern opcode_t *op_ifnot;
|
|
extern opcode_t *op_ifbe;
|
|
extern opcode_t *op_ifb;
|
|
extern opcode_t *op_ifae;
|
|
extern opcode_t *op_ifa;
|
|
extern opcode_t *op_state;
|
|
extern opcode_t *op_goto;
|
|
extern opcode_t *op_jump;
|
|
extern opcode_t *op_jumpb;
|
|
|
|
statref_t *PR_NewStatref (dstatement_t *st, int field);
|
|
void PR_AddStatementRef (def_t *def, dstatement_t *st, int field);
|
|
def_t *PR_Statement (opcode_t *op, def_t *var_a, def_t *var_b);
|
|
opcode_t *PR_Opcode_Find (const char *name,
|
|
def_t *var_a, def_t *var_b, def_t *var_c);
|
|
void PR_Opcode_Init_Tables (void);
|
|
|
|
//============================================================================
|
|
|
|
extern char destfile[];
|
|
extern int pr_source_line;
|
|
|
|
extern def_t *pr_scope;
|
|
extern int pr_error_count;
|
|
|
|
def_t *PR_GetArray (struct type_s *etype, const char *name, int size,
|
|
def_t *scope, int *allocate);
|
|
|
|
def_t *PR_GetDef (struct type_s *type, const char *name, def_t *scope,
|
|
int *allocate);
|
|
def_t *PR_NewDef (struct type_s *type, const char *name, def_t *scope);
|
|
int PR_NewLocation (struct type_s *type);
|
|
void PR_FreeLocation (def_t *def);
|
|
def_t *PR_GetTempDef (struct type_s *type, def_t *scope);
|
|
void PR_FreeTempDefs ();
|
|
void PR_ResetTempDefs ();
|
|
void PR_FlushScope (def_t *scope, int force_used);
|
|
void PR_DefInitialized (def_t *d);
|
|
|
|
#define G_FLOAT(o) (pr_globals[o])
|
|
#define G_INT(o) (*(int *)&pr_globals[o])
|
|
#define G_VECTOR(o) (&pr_globals[o])
|
|
#define G_STRING(o) (strings + *(string_t *)&pr_globals[o])
|
|
#define G_FUNCTION(o) (*(func_t *)&pr_globals[o])
|
|
#define G_STRUCT(t,o) (*(t *)&pr_globals[o])
|
|
|
|
extern string_t s_file; // filename for function definition
|
|
|
|
//=============================================================================
|
|
|
|
#define MAX_STRINGS 500000
|
|
#define MAX_GLOBALS 65536
|
|
#define MAX_FIELDS 1024
|
|
#define MAX_STATEMENTS 131072
|
|
#define MAX_FUNCTIONS 8192
|
|
|
|
extern char strings[MAX_STRINGS];
|
|
extern int strofs;
|
|
|
|
extern dstatement_t statements[MAX_STATEMENTS];
|
|
extern int numstatements;
|
|
extern int statement_linenums[MAX_STATEMENTS];
|
|
|
|
extern dfunction_t functions[MAX_FUNCTIONS];
|
|
extern int numfunctions;
|
|
|
|
extern float pr_globals[MAX_REGS];
|
|
extern int numpr_globals;
|
|
|
|
extern int num_auxfunctions;
|
|
extern pr_auxfunction_t *auxfunctions;
|
|
|
|
extern int num_linenos;
|
|
extern pr_lineno_t *linenos;
|
|
|
|
extern int num_locals;
|
|
extern ddef_t *locals;
|
|
|
|
pr_auxfunction_t *new_auxfunction (void);
|
|
pr_lineno_t *new_lineno (void);
|
|
ddef_t *new_local (void);
|
|
|
|
const char *strip_path (const char *filename);
|
|
|
|
#endif//__qfcc_h
|