2002-06-04 18:44:03 +00:00
|
|
|
/*
|
|
|
|
def.h
|
|
|
|
|
2002-10-22 14:53:18 +00:00
|
|
|
def management and symbol tables
|
2002-06-04 18:44:03 +00:00
|
|
|
|
2002-10-22 14:53:18 +00:00
|
|
|
Copyright (C) 2002 Bill Currie <bill@taniwha.org>
|
2002-06-04 18:44:03 +00:00
|
|
|
|
2002-10-22 14:53:18 +00:00
|
|
|
Author: Bill Currie <bill@taniwha.org>
|
|
|
|
Date: 2002/06/04
|
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
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __def_h
|
|
|
|
#define __def_h
|
|
|
|
|
|
|
|
#include "QF/pr_comp.h"
|
|
|
|
#include "QF/pr_debug.h"
|
|
|
|
|
|
|
|
typedef struct def_s {
|
2011-01-24 06:41:43 +00:00
|
|
|
struct def_s *next; ///< general purpose linking
|
|
|
|
|
2002-06-04 18:44:03 +00:00
|
|
|
struct type_s *type;
|
|
|
|
const char *name;
|
2011-01-24 06:41:43 +00:00
|
|
|
struct defspace_s *space;
|
|
|
|
int offset;
|
|
|
|
|
2011-01-25 06:42:26 +00:00
|
|
|
struct def_s *alias;
|
2011-01-24 06:41:43 +00:00
|
|
|
struct reloc_s *relocs; ///< for relocations
|
2012-11-03 09:12:44 +00:00
|
|
|
struct expr_s *initializer; ///< initialer expression
|
2011-01-24 06:41:43 +00:00
|
|
|
|
2011-02-15 13:43:07 +00:00
|
|
|
unsigned offset_reloc:1; ///< use *_def_ofs relocs
|
2011-01-24 06:41:43 +00:00
|
|
|
unsigned initialized:1;
|
|
|
|
unsigned constant:1; ///< stores constant value
|
2008-08-01 00:47:38 +00:00
|
|
|
unsigned global:1; ///< globally declared def
|
|
|
|
unsigned external:1; ///< externally declared def
|
|
|
|
unsigned local:1; ///< function local def
|
|
|
|
unsigned system:1; ///< system def
|
|
|
|
unsigned nosave:1; ///< don't set DEF_SAVEGLOBAL
|
|
|
|
|
|
|
|
string_t file; ///< source file
|
|
|
|
int line; ///< source line
|
|
|
|
|
2011-02-23 05:50:10 +00:00
|
|
|
int qfo_def; ///< index to def in qfo defs
|
2002-06-21 20:46:56 +00:00
|
|
|
|
2008-08-01 00:47:38 +00:00
|
|
|
void *return_addr; ///< who allocated this
|
2002-06-04 18:44:03 +00:00
|
|
|
} def_t;
|
|
|
|
|
2011-01-24 06:41:43 +00:00
|
|
|
typedef enum storage_class_e {
|
2002-06-28 17:59:32 +00:00
|
|
|
st_global,
|
2002-09-16 15:42:11 +00:00
|
|
|
st_system,
|
2002-06-28 17:59:32 +00:00
|
|
|
st_extern,
|
|
|
|
st_static,
|
|
|
|
st_local
|
|
|
|
} storage_class_t;
|
|
|
|
|
2011-01-26 05:48:22 +00:00
|
|
|
extern storage_class_t current_storage;
|
|
|
|
|
2011-01-24 06:41:43 +00:00
|
|
|
def_t *new_def (const char *name, struct type_s *type,
|
2011-01-25 03:07:02 +00:00
|
|
|
struct defspace_s *space, storage_class_t storage);
|
2011-01-25 06:42:26 +00:00
|
|
|
def_t *alias_def (def_t *def, struct type_s *type);
|
2011-03-23 12:32:14 +00:00
|
|
|
def_t *temp_def (etype_t type, int size);
|
2012-11-18 10:08:16 +00:00
|
|
|
void free_temp_def (def_t *temp);
|
2011-01-24 06:41:43 +00:00
|
|
|
void free_def (def_t *def);
|
2002-06-04 21:54:47 +00:00
|
|
|
|
2002-07-17 15:40:08 +00:00
|
|
|
void def_to_ddef (def_t *def, ddef_t *ddef, int aux);
|
|
|
|
|
2011-01-25 03:07:02 +00:00
|
|
|
struct symbol_s;
|
|
|
|
struct expr_s;
|
|
|
|
|
|
|
|
void initialize_def (struct symbol_s *sym, struct type_s *type,
|
|
|
|
struct expr_s *init, struct defspace_s *space,
|
|
|
|
storage_class_t storage);
|
|
|
|
|
2002-06-04 18:44:03 +00:00
|
|
|
#endif//__def_h
|