1 /****************************************************************************
2     Copyright (C) 1987-2015 by Jeffery P. Hansen
3 
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8 
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13 
14     You should have received a copy of the GNU General Public License along
15     with this program; if not, write to the Free Software Foundation, Inc.,
16     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 ****************************************************************************/
18 #ifndef __primitives_h
19 #define __primitives_h
20 
21 #define PARMSPEC_MAXPARMS	64	// Maximum number of parameters
22 
23 typedef struct Primitive_str {
24   const char	*p_name;		// Name of this primitive built-in cell
25   const char	*p_body;		// Full body of this primitive
26   const char	*p_end;			// End of full body of this primitive
27   const char	*p_nameStart;		// Pointer into body for start of module name
28   const char	*p_nameEnd;		// Pointer into body after end of module name
29   const char	*p_parmStart;		// Pointer into body for start of parameter list
30   const char	*p_parmEnd;		// Pointer into body for end of parameter list
31 } Primitive;
32 
33 typedef struct PrimParmSpec_str {
34   char	pps_name[STRMAX];
35   char	pps_value[STRMAX];
36 } PrimParmSpec;
37 
38 typedef struct PrimParm_str {
39   int			pp_size;
40   PrimParmSpec		pp_specs[PARMSPEC_MAXPARMS];
41 } PrimParm;
42 
43 
44 
45 void Primitive_write(FILE *f,const char *name,GCellSpec *gcs,PrimParm *primParm);
46 
47 void PrimParm_init(PrimParm *primParm);
48 char *PrimParm_get(PrimParm *primParm,const char *name);
49 const char *PrimParm_nget(PrimParm *primParm,const char *name,int len);
50 void PrimParm_set(PrimParm *primParm,const char *name,const char *fmt,...);
51 void PrimParm_invSet(PrimParm *primParm,const char *name,int isInv);
52 void PrimParm_rangeSet(PrimParm *primParm,const char *name,int rangeMax);
53 void PrimParm_intSet(PrimParm *primParm,const char *name,int n);
54 
55 #endif
56 
57