4 * Copyright (c) 2006 by Gilbert Ramirez <gram@alumni.rice.edu>
6 * Wireshark - Network traffic analyzer
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 #include "syntax-tree.h"
28 #include "sttype-function.h"
32 df_func_def_t *funcdef;
36 #define FUNCTION_MAGIC 0xe10f0f99
39 function_new(gpointer funcdef)
41 function_t *stfuncrec;
43 g_assert(funcdef != NULL);
45 stfuncrec = g_new(function_t, 1);
47 stfuncrec->magic = FUNCTION_MAGIC;
48 stfuncrec->funcdef = funcdef;
49 stfuncrec->params = NULL;
51 return (gpointer) stfuncrec;
55 slist_stnode_free(gpointer data, gpointer user_data _U_)
61 st_funcparams_free(GSList *params)
63 g_slist_foreach(params, slist_stnode_free, NULL);
68 function_free(gpointer value)
70 function_t *stfuncrec = value;
71 assert_magic(stfuncrec, FUNCTION_MAGIC);
72 st_funcparams_free(stfuncrec->params);
77 /* Set the parameters for a function stnode_t. */
79 sttype_function_set_params(stnode_t *node, GSList *params)
82 function_t *stfuncrec;
84 stfuncrec = stnode_data(node);
85 assert_magic(stfuncrec, FUNCTION_MAGIC);
87 stfuncrec->params = params;
90 /* Get the function-definition record for a function stnode_t. */
92 sttype_function_funcdef(stnode_t *node)
94 function_t *stfuncrec;
96 stfuncrec = stnode_data(node);
97 assert_magic(stfuncrec, FUNCTION_MAGIC);
98 return stfuncrec->funcdef;
101 /* Get the parameters for a function stnode_t. */
103 sttype_function_params(stnode_t *node)
105 function_t *stfuncrec;
107 stfuncrec = stnode_data(node);
108 assert_magic(stfuncrec, FUNCTION_MAGIC);
109 return stfuncrec->params;
114 sttype_register_function(void)
116 static sttype_t function_type = {
123 sttype_register(&function_type);