4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
11 * Copyright (c) 1991-2001, University of Groningen, The Netherlands
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * If you want to redistribute modifications, please consider that
18 * scientific software is very special. Version control is crucial -
19 * bugs must be traceable. We will be happy to consider code for
20 * inclusion in the official distribution, but derived work must not
21 * be called official GROMACS. Details are found in the README & COPYING
22 * files - if they are missing, get the official version at www.gromacs.org.
24 * To help us fund GROMACS development, we humbly ask that you cite
25 * the papers on the package - you can find them in the top README file.
27 * For more info, check our website at http://www.gromacs.org
30 * Getting the Right Output Means no Artefacts in Calculating Stuff
36 static char *SRCID_metacode_h
= "$Id$";
44 #include <types/simple.h>
53 #define FCON " &" /* continuation line in f77 */
54 #define max(a,b) (((a) > (b)) ? (a) : (b))
57 /* Array referencing shortcut */
58 #define ARRAY(a,idx) _array(#a,#idx)
67 } decl_t
; /* Argument and variable buffer element */
69 extern int prec
; /* precision (4=single, 8=double) */
70 extern int IND
; /* current indentation */
71 extern char *codebuffer
; /* buffer to which code is written */
72 extern char header
[10000]; /* buffer for info and loop name */
73 extern FILE *output
; /* output file */
74 extern decl_t
*decl_list
; /* list with args and vars */
75 extern int ndecl
; /* length of above list */
76 extern int nargs
; /* first nargs are arguments, rest is vars */
80 /* Concatenate a string to a buffer with plus sign between terms. */
81 void add_to_buffer(char *buffer
,char *term
);
83 /* initiate output buffers */
84 void init_metacode(void);
86 /* write a function to file and empty buffers */
87 void flush_buffers(void);
89 /* Return the correct indentation as a string */
92 /* Print a line of code to the output file */
93 void code(char *fmt
, ...);
98 void comment(char *s
);
100 /* Define a new floating-point variable */
101 void declare_real(char *name
);
102 void declare_real_vector(char *name
);
104 void declare_const_real(char *name
,double val
);
105 void declare_const_int(char *name
,int val
);
107 void declare_int(char *name
);
108 void declare_int_vector(char *name
);
109 void declare_real4(char *name
);
110 void declare_int4(char *name
);
111 void declare_int8(char *name
);
112 void declare_intreal(char *name
);
113 void declare_other(char *typename
,char *name
);
115 /* Cray vector pragma */
116 void vector_pragma(void);
119 char *_array(char *a
,char *idx
, ...);
121 void _p_state(char *left
,char *right
,char *symb
);
123 void file_error(char *fn
);
125 void assign(char *left
, char *right
, ...);
127 void increment(char *left
,char *right
, ...);
129 void decrement(char *left
,char *right
, ...);
131 void add(char *left
,char *r1
,char *r2
, ...);
133 void subtract(char *left
,char *r1
,char *r2
, ...);
135 void multiply(char *left
,char *r1
,char *r2
, ...);
139 void usage(int argc
,char *argv
[]);
141 int count_lines(char *fn
);
143 void edit_warning(char *fn
);
145 void start_loop(char *lvar
,char *from
,char *to
);
147 void start_stride_loop(char *lvar
,char *from
,char *to
, char *stride
);
151 void start_if(char *cond
);
155 void close_func(void);