quakeforge/tools/qfcc/include/function.h

76 lines
2 KiB
C
Raw Normal View History

/*
#FILENAME#
#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 __function_h
#define __function_h
2002-06-04 18:44:03 +00:00
#include "QF/pr_comp.h"
typedef struct function_s {
struct function_s *next;
dfunction_t *dfunc;
pr_auxfunction_t *aux; // debug info;
int builtin; // if non 0, call an internal function
int code; // first statement
int function_num;
2002-06-04 18:44:03 +00:00
const char *file; // source file with definition
int file_line;
struct def_s *def;
struct scope_s *scope;
2002-06-04 18:44:03 +00:00
} function_t;
extern function_t *current_func;
typedef struct param_s {
2002-05-09 20:12:28 +00:00
// the first two fields match the first two fiels of keywordarg_t in
// method.h
struct param_s *next;
const char *selector;
2002-06-04 18:44:03 +00:00
struct type_s *type;
const char *name;
} param_t;
2002-05-17 18:35:54 +00:00
struct expr_s;
2002-06-04 18:44:03 +00:00
param_t *new_param (const char *selector, struct type_s *type,
const char *name);
2002-05-08 21:24:24 +00:00
param_t *_reverse_params (param_t *params, param_t *next);
param_t *reverse_params (param_t *params);
2002-06-04 18:44:03 +00:00
struct type_s *parse_params (struct type_s *type, param_t *params);
void build_scope (function_t *f, struct def_s *func, param_t *params);
function_t *new_function (void);
2002-06-04 18:44:03 +00:00
void build_builtin_function (struct def_s *def, struct expr_s *bi_val);
void build_function (function_t *f);
void finish_function (function_t *f);
void emit_function (function_t *f, expr_t *e);
#endif//__function_h