11 #include <types/simple.h>
13 static char *SRCID_metacode_h = "";
22 #define FCON " &" /* continuation line in f77 */
23 #define max(a,b) (((a) > (b)) ? (a) : (b))
26 /* Array referencing shortcut */
27 #define ARRAY(a,idx) _array(#a,#idx)
36 } decl_t; /* Argument and variable buffer element */
38 extern int prec; /* precision (4=single, 8=double) */
39 extern int IND; /* current indentation */
40 extern char *codebuffer; /* buffer to which code is written */
41 extern char header[10000]; /* buffer for info and loop name */
42 extern FILE *output; /* output file */
43 extern decl_t *decl_list; /* list with args and vars */
44 extern int ndecl; /* length of above list */
45 extern int nargs; /* first nargs are arguments, rest is vars */
49 /* Concatenate a string to a buffer with plus sign between terms. */
50 void add_to_buffer(char *buffer,char *term);
52 /* initiate output buffers */
53 void init_metacode(void);
55 /* write a function to file and empty buffers */
56 void flush_buffers(void);
58 /* Return the correct indentation as a string */
61 /* Print a line of code to the output file */
62 void code(char *fmt, ...);
67 void comment(char *s);
69 /* Define a new floating-point variable */
70 void declare_real(char *name);
71 void declare_real_vector(char *name);
73 void declare_const_real(char *name,double val);
74 void declare_const_int(char *name,int val);
76 void declare_int(char *name);
77 void declare_int_vector(char *name);
78 void declare_real4(char *name);
79 void declare_int4(char *name);
80 void declare_int8(char *name);
81 void declare_intreal(char *name);
82 void declare_other(char *typename,char *name);
84 /* Cray vector pragma */
85 void vector_pragma(void);
88 char *_array(char *a,char *idx, ...);
90 void _p_state(char *left,char *right,char *symb);
92 void file_error(char *fn);
94 void assign(char *left, char *right, ...);
96 void increment(char *left,char *right, ...);
98 void decrement(char *left,char *right, ...);
100 void add(char *left,char *r1,char *r2, ...);
102 void subtract(char *left,char *r1,char *r2, ...);
104 void multiply(char *left,char *r1,char *r2, ...);
108 void usage(int argc,char *argv[]);
110 int count_lines(char *fn);
112 void edit_warning(char *fn);
114 void start_loop(char *lvar,char *from,char *to);
116 void start_stride_loop(char *lvar,char *from,char *to, char *stride);
120 void start_if(char *cond);
124 void close_func(void);