2002-06-04 18:44:03 +00:00
|
|
|
/*
|
|
|
|
qfcc.h
|
2001-02-24 06:58:54 +00:00
|
|
|
|
2002-06-04 18:44:03 +00:00
|
|
|
#DESCRIPTION#
|
2001-02-24 06:58:54 +00:00
|
|
|
|
2002-06-04 18:44:03 +00:00
|
|
|
Copyright (C) 2001 #AUTHOR#
|
2001-02-24 06:58:54 +00:00
|
|
|
|
2002-06-04 18:44:03 +00:00
|
|
|
Author: #AUTHOR#
|
|
|
|
Date: #DATE#
|
2001-02-24 06:58:54 +00:00
|
|
|
|
2002-06-04 18:44:03 +00:00
|
|
|
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
|
2001-12-08 20:40:50 +00:00
|
|
|
|
|
|
|
$Id$
|
2001-02-24 06:58:54 +00:00
|
|
|
*/
|
|
|
|
|
2001-12-08 20:40:50 +00:00
|
|
|
#ifndef __qfcc_h
|
|
|
|
#define __qfcc_h
|
|
|
|
|
2001-03-28 17:17:56 +00:00
|
|
|
#include "QF/pr_comp.h"
|
2001-06-05 08:09:12 +00:00
|
|
|
|
2001-02-24 06:58:54 +00:00
|
|
|
//============================================================================
|
|
|
|
|
2001-03-26 05:33:02 +00:00
|
|
|
#define MAX_REGS 65536
|
2001-02-24 06:58:54 +00:00
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
//
|
|
|
|
// output generated by prog parsing
|
|
|
|
//
|
2002-06-22 05:10:34 +00:00
|
|
|
typedef struct pr_info_s {
|
2002-06-04 18:44:03 +00:00
|
|
|
struct type_s *types;
|
2002-06-07 17:29:30 +00:00
|
|
|
struct ex_label_s *labels;
|
2001-02-24 06:58:54 +00:00
|
|
|
|
2002-06-05 17:12:55 +00:00
|
|
|
char *strings;
|
|
|
|
int strofs;
|
|
|
|
int strings_size;
|
|
|
|
|
|
|
|
dstatement_t *statements;
|
|
|
|
int *statement_linenums;
|
|
|
|
int num_statements;
|
|
|
|
int statements_size;
|
|
|
|
|
2002-06-06 21:51:47 +00:00
|
|
|
struct function_s *func_head;
|
|
|
|
struct function_s **func_tail;
|
2002-06-05 17:12:55 +00:00
|
|
|
dfunction_t *functions;
|
|
|
|
int num_functions;
|
|
|
|
|
2002-06-10 20:54:22 +00:00
|
|
|
struct defspace_s *near_data;
|
|
|
|
struct defspace_s *far_data;
|
2002-06-10 23:14:32 +00:00
|
|
|
struct defspace_s *entity_data;
|
2002-06-09 03:57:20 +00:00
|
|
|
struct scope_s *scope;
|
2001-02-24 06:58:54 +00:00
|
|
|
} pr_info_t;
|
|
|
|
|
|
|
|
extern pr_info_t pr;
|
|
|
|
|
2001-06-04 02:41:45 +00:00
|
|
|
//============================================================================
|
2001-02-24 06:58:54 +00:00
|
|
|
|
2002-05-21 21:28:40 +00:00
|
|
|
extern char destfile[];
|
2001-02-24 06:58:54 +00:00
|
|
|
extern int pr_source_line;
|
|
|
|
|
2002-06-09 03:57:20 +00:00
|
|
|
extern struct scope_s *current_scope;
|
2001-02-24 06:58:54 +00:00
|
|
|
extern int pr_error_count;
|
|
|
|
|
2002-06-10 20:54:22 +00:00
|
|
|
#define G_var(t, o) (pr.near_data->data[o].t##_var)
|
2002-06-09 03:57:20 +00:00
|
|
|
#define G_FLOAT(o) G_var (float, o)
|
|
|
|
#define G_INT(o) G_var (integer, o)
|
|
|
|
#define G_VECTOR(o) G_var (vector, o)
|
|
|
|
#define G_STRING(o) (pr.strings + G_var (string, o))
|
|
|
|
#define G_FUNCTION(o) G_var (func, o)
|
2002-06-10 20:54:22 +00:00
|
|
|
#define G_POINTER(t,o) ((t *)(pr.near_data->data + o))
|
|
|
|
#define G_STRUCT(t,o) (*G_POINTER (t, o))
|
2001-02-24 06:58:54 +00:00
|
|
|
|
2002-06-21 20:46:56 +00:00
|
|
|
#define POINTER_OFS(p) ((pr_type_t *) (p) - pr.near_data->data)
|
|
|
|
|
2001-02-24 06:58:54 +00:00
|
|
|
extern string_t s_file; // filename for function definition
|
|
|
|
|
2002-04-10 19:52:48 +00:00
|
|
|
const char *strip_path (const char *filename);
|
2001-06-08 06:32:15 +00:00
|
|
|
|
2002-06-05 21:13:29 +00:00
|
|
|
#define ALLOC(s, t, n, v) \
|
|
|
|
do { \
|
|
|
|
if (!free_##n) { \
|
|
|
|
int i; \
|
|
|
|
free_##n = malloc ((s) * sizeof (t)); \
|
|
|
|
for (i = 0; i < (s) - 1; i++) \
|
|
|
|
free_##n[i].next = &free_##n[i + 1];\
|
|
|
|
free_##n[i].next = 0; \
|
|
|
|
} \
|
|
|
|
v = free_##n; \
|
|
|
|
free_##n = free_##n->next; \
|
|
|
|
memset (v, 0, sizeof (*v)); \
|
|
|
|
} while (0)
|
|
|
|
|
2001-12-08 20:40:50 +00:00
|
|
|
#endif//__qfcc_h
|