4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
12 * Copyright (c) 1991-2001
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * If you want to redistribute modifications, please consider that
22 * scientific software is very special. Version control is crucial -
23 * bugs must be traceable. We will be happy to consider code for
24 * inclusion in the official distribution, but derived work must not
25 * be called official GROMACS. Details are found in the README & COPYING
26 * files - if they are missing, get the official version at www.gromacs.org.
28 * To help us fund GROMACS development, we humbly ask that you cite
29 * the papers on the package - you can find them in the top README file.
31 * Do check out http://www.gromacs.org , or mail us at gromacs@gromacs.org .
34 * Giving Russians Opium May Alter Current Situation
40 static char *SRCID_metacode_h = "$Id$";
48 #include <types/simple.h>
50 static char *SRCID_metacode_h = "";
59 #define FCON " &" /* continuation line in f77 */
60 #define max(a,b) (((a) > (b)) ? (a) : (b))
63 /* Array referencing shortcut */
64 #define ARRAY(a,idx) _array(#a,#idx)
73 } decl_t; /* Argument and variable buffer element */
75 extern int prec; /* precision (4=single, 8=double) */
76 extern int IND; /* current indentation */
77 extern char *codebuffer; /* buffer to which code is written */
78 extern char header[10000]; /* buffer for info and loop name */
79 extern FILE *output; /* output file */
80 extern decl_t *decl_list; /* list with args and vars */
81 extern int ndecl; /* length of above list */
82 extern int nargs; /* first nargs are arguments, rest is vars */
86 /* Concatenate a string to a buffer with plus sign between terms. */
87 void add_to_buffer(char *buffer,char *term);
89 /* initiate output buffers */
90 void init_metacode(void);
92 /* write a function to file and empty buffers */
93 void flush_buffers(void);
95 /* Return the correct indentation as a string */
98 /* Print a line of code to the output file */
99 void code(char *fmt, ...);
104 void comment(char *s);
106 /* Define a new floating-point variable */
107 void declare_real(char *name);
108 void declare_real_vector(char *name);
110 void declare_const_real(char *name,double val);
111 void declare_const_int(char *name,int val);
113 void declare_int(char *name);
114 void declare_int_vector(char *name);
115 void declare_real4(char *name);
116 void declare_int4(char *name);
117 void declare_int8(char *name);
118 void declare_intreal(char *name);
119 void declare_other(char *typename,char *name);
121 /* Cray vector pragma */
122 void vector_pragma(void);
125 char *_array(char *a,char *idx, ...);
127 void _p_state(char *left,char *right,char *symb);
129 void file_error(char *fn);
131 void assign(char *left, char *right, ...);
133 void increment(char *left,char *right, ...);
135 void decrement(char *left,char *right, ...);
137 void add(char *left,char *r1,char *r2, ...);
139 void subtract(char *left,char *r1,char *r2, ...);
141 void multiply(char *left,char *r1,char *r2, ...);
145 void usage(int argc,char *argv[]);
147 int count_lines(char *fn);
149 void edit_warning(char *fn);
151 void start_loop(char *lvar,char *from,char *to);
153 void start_stride_loop(char *lvar,char *from,char *to, char *stride);
157 void start_if(char *cond);
161 void close_func(void);