Doxygen Source Code Documentation
mem.c File Reference
#include "defs.h"#include "iob.h"Go to the source code of this file.
Data Structures | |
| struct | memblock |
Defines | |
| #define | MEMBSIZE 32000 |
| #define | GMEMBSIZE 16000 |
Typedefs | |
| typedef memblock | memblock |
Functions | |
| char * | gmem (int n, int round) |
| void | mem_init (Void) |
| char * | mem (int n, int round) |
| char * | tostring (register char *s, int n) |
| char * | cpstring (register char *s) |
| void | new_iob_data (register io_setup *ios, char *name) |
| char * | string_num (char *pfx, long n) |
| void | def_start (FILE *outfile, char *s1, char *s2, char *post) |
| void | other_undefs (FILE *outfile) |
Variables | |
| memblock * | mem0 |
| memblock * | curmemblock |
| memblock * | firstmemblock |
| char * | mem_first |
| char * | mem_next |
| char * | mem_last |
| char * | mem0_last |
| defines * | define_list |
Define Documentation
|
|
Definition at line 28 of file f2cdir/mem.c. Referenced by gmem(). |
|
|
Definition at line 27 of file f2cdir/mem.c. Referenced by mem(), and mem_init(). |
Typedef Documentation
|
|
Definition at line 68 of file f2cdir/mem.c. |
Function Documentation
|
|
Definition at line 173 of file f2cdir/mem.c. References mem(). Referenced by data_value(), ioseta(), new_iob_data(), and wr_equiv_init().
00175 {
00176 return strcpy(mem(strlen(s)+1,0), s);
00177 }
|
|
||||||||||||||||||||
|
Definition at line 229 of file f2cdir/mem.c. References defines::defname, in_define, mem(), n1, defines::next, nice_printf(), and s2. Referenced by wr_common_decls(), wr_one_init(), and write_char_init().
00231 {
00232 defines *d;
00233 int n, n1;
00234 extern int in_define;
00235
00236 n = n1 = strlen(s1);
00237 if (s2)
00238 n += strlen(s2);
00239 d = (defines *)mem(sizeof(defines)+n, 1);
00240 d->next = define_list;
00241 define_list = d;
00242 strcpy(d->defname, s1);
00243 if (s2)
00244 strcpy(d->defname + n1, s2);
00245 in_define = 1;
00246 nice_printf(outfile, "#define %s", d->defname);
00247 if (post)
00248 nice_printf(outfile, " %s", post);
00249 }
|
|
||||||||||||
|
Definition at line 36 of file f2cdir/mem.c. References Alloc, and GMEMBSIZE. Referenced by copy_data(), mkext1(), newarg(), putconst(), readref(), and save_argtypes().
00038 {
00039 static char *last, *next;
00040 char *rv;
00041 if (round)
00042 #ifdef CRAY
00043 if ((long)next & 0xe000000000000000)
00044 next = (char *)(((long)next & 0x1fffffffffffffff) + 1);
00045 #else
00046 #ifdef MSDOS
00047 if ((int)next & 1)
00048 next++;
00049 #else
00050 next = (char *)(((long)next + sizeof(char *)-1)
00051 & ~((long)sizeof(char *)-1));
00052 #endif
00053 #endif
00054 rv = next;
00055 if ((next += n) > last) {
00056 rv = Alloc(n + GMEMBSIZE);
00057
00058 next = rv + n;
00059 last = next + GMEMBSIZE;
00060 }
00061 return rv;
00062 }
|
|
||||||||||||
|
Definition at line 93 of file f2cdir/mem.c. References Alloc, memblock::buf, mem_last, mem_next, MEMBSIZE, and memblock::next. Referenced by cds(), cpstring(), def_start(), do_p1_charp(), dtos(), fmtname(), ioseta(), mkname(), new_iob_data(), putif(), putwhile(), save_argtypes(), setfmt(), string_num(), tostring(), and unamstring().
00095 {
00096 memblock *b;
00097 register char *rv, *s;
00098
00099 if (round)
00100 #ifdef CRAY
00101 if ((long)mem_next & 0xe000000000000000)
00102 mem_next = (char *)(((long)mem_next & 0x1fffffffffffffff) + 1);
00103 #else
00104 #ifdef MSDOS
00105 if ((int)mem_next & 1)
00106 mem_next++;
00107 #else
00108 mem_next = (char *)(((long)mem_next + sizeof(char *)-1)
00109 & ~((long)sizeof(char *)-1));
00110 #endif
00111 #endif
00112 rv = mem_next;
00113 s = rv + n;
00114 if (s >= mem_last) {
00115 if (n > MEMBSIZE) {
00116 fprintf(stderr, "mem(%d) failure!\n", n);
00117 exit(1);
00118 }
00119 if (!(b = curmemblock->next)) {
00120 b = (memblock *)Alloc(sizeof(memblock));
00121 curmemblock->next = b;
00122 b->next = 0;
00123 }
00124 curmemblock = b;
00125 rv = b->buf;
00126 mem_last = rv + sizeof(b->buf);
00127 s = rv + n;
00128 }
00129 mem_next = s;
00130 return rv;
00131 }
|
|
|
Definition at line 76 of file f2cdir/mem.c. References Alloc, memblock::buf, mem0, mem0_last, mem_first, mem_last, mem_next, MEMBSIZE, and memblock::next. Referenced by fileinit().
|
|
||||||||||||
|
Definition at line 185 of file f2cdir/mem.c. References cpstring(), iob_data::fields, mem(), iob_data::name, name, iob_data::next, and iob_data::type. Referenced by startrw().
00187 {
00188 register iob_data *iod;
00189 register char **s, **se;
00190
00191 iod = (iob_data *)
00192 mem(sizeof(iob_data) + ios->nelt*sizeof(char *), 1);
00193 iod->next = iob_list;
00194 iob_list = iod;
00195 iod->type = ios->fields[0];
00196 iod->name = cpstring(name);
00197 s = iod->fields;
00198 se = s + ios->nelt;
00199 while(s < se)
00200 *s++ = "0";
00201 *s = 0;
00202 }
|
|
|
Definition at line 256 of file f2cdir/mem.c. References defines::defname, defines::next, and nice_printf(). Referenced by start_formatting().
00258 {
00259 defines *d;
00260 if (d = define_list) {
00261 define_list = 0;
00262 nice_printf(outfile, "\n");
00263 do
00264 nice_printf(outfile, "#undef %s\n", d->defname);
00265 while(d = d->next);
00266 nice_printf(outfile, "\n");
00267 }
00268 }
|
|
||||||||||||
|
Definition at line 210 of file f2cdir/mem.c. References mem(). Referenced by ioset(), and mkcxcon().
00212 {
00213 char buf[32];
00214 sprintf(buf, "%s%ld", pfx, n);
00215 /* can't trust return type of sprintf -- BSD gets it wrong */
00216 return strcpy(mem(strlen(buf)+1,0), buf);
00217 }
|
|
||||||||||||
|
Definition at line 139 of file f2cdir/mem.c. References mem(). Referenced by ioseta().
00141 {
00142 register char *s1, *se, **sf;
00143 char *rv, *s0;
00144 register int k = n + 2, t;
00145
00146 sf = str_fmt;
00147 sf['%'] = "%";
00148 s0 = s;
00149 se = s + n;
00150 for(; s < se; s++) {
00151 t = *(unsigned char *)s;
00152 s1 = sf[t];
00153 while(*++s1)
00154 k++;
00155 }
00156 sf['%'] = "%%";
00157 rv = s1 = mem(k,0);
00158 *s1++ = '"';
00159 for(s = s0; s < se; s++) {
00160 t = *(unsigned char *)s;
00161 sprintf(s1, sf[t], t);
00162 s1 += strlen(s1);
00163 }
00164 *s1 = 0;
00165 return rv;
00166 }
|
Variable Documentation
|
|
Definition at line 71 of file f2cdir/mem.c. |
|
|
Definition at line 219 of file f2cdir/mem.c. |
|
|
Definition at line 71 of file f2cdir/mem.c. |
|
|
Definition at line 70 of file f2cdir/mem.c. Referenced by mem_init(). |
|
|
Definition at line 73 of file f2cdir/mem.c. Referenced by mem_init(), and procinit(). |
|
|
Definition at line 73 of file f2cdir/mem.c. Referenced by mem_init(), and procinit(). |
|
|
Definition at line 73 of file f2cdir/mem.c. Referenced by mem(), mem_init(), and procinit(). |
|
|
Definition at line 73 of file f2cdir/mem.c. Referenced by mem(), mem_init(), and procinit(). |