mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-25 21:21:14 +00:00
Now parameters can be declared `const`, `@in`, `@out`, `@inout`. `@in` is redundant as it's the default, but I guess it's nice for self-documenting code. `const` marks the parameter as read-only in the function, `@out` and `@inout` allow the parameter to pass the value back out (by copy), but `@out` does not initialize the parameter before calling and returning without setting an `@out` parameter is an error (but unfortunately, currently detected only when optimizing). Unfortunately, it seems to have broken (only!) v6 progs when optimizing as the second parameter gets optimized out.
88 lines
2.2 KiB
C
88 lines
2.2 KiB
C
/*
|
|
specifier.h
|
|
|
|
type system
|
|
|
|
Copyright (C) 2001 Bill Currie <bill@taniwha.org>
|
|
|
|
Author: Bill Currie <bill@taniwha.org>
|
|
Date: 2001/12/11
|
|
|
|
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 __specifier_h
|
|
#define __specifier_h
|
|
|
|
typedef struct type_s type_t;
|
|
typedef struct expr_s expr_t;
|
|
typedef struct symbol_s symbol_t;
|
|
typedef struct symtab_s symtab_t;
|
|
|
|
/** Specify the storage class of a def.
|
|
*/
|
|
typedef enum storage_class_e {
|
|
sc_global, ///< def is globally visible across units
|
|
sc_system, ///< def may be redefined once
|
|
sc_extern, ///< def is externally allocated
|
|
sc_static, ///< def is private to the current unit
|
|
sc_param, ///< def is an incoming function parameter
|
|
sc_local, ///< def is local to the current function
|
|
sc_argument, ///< def is a function argument
|
|
|
|
sc_in,
|
|
sc_out,
|
|
sc_inout,
|
|
sc_uniform,
|
|
sc_buffer,
|
|
sc_shared,
|
|
} storage_class_t;
|
|
|
|
typedef struct specifier_s {
|
|
const type_t *type;
|
|
const expr_t *type_expr;
|
|
struct param_s *params;
|
|
symbol_t *sym;
|
|
symtab_t *symtab;
|
|
storage_class_t storage;
|
|
union {
|
|
struct {
|
|
bool multi_type:1;
|
|
bool multi_store:1;
|
|
bool multi_generic:1;
|
|
bool is_const:1;
|
|
bool is_signed:1;
|
|
bool is_unsigned:1;
|
|
bool is_short:1;
|
|
bool is_long:1;
|
|
bool is_typedef:1;
|
|
bool is_overload:1;
|
|
bool is_generic:1;
|
|
bool is_generic_block:1;
|
|
bool is_function:1;//FIXME do proper void(*)() -> ev_func
|
|
bool nosave:1;
|
|
bool no_va_list:1;
|
|
bool void_return:1;
|
|
};
|
|
unsigned spec_bits;
|
|
};
|
|
} specifier_t;
|
|
|
|
#endif//__type_h
|