#include <stdlib.h>#include "intersci-n.h"#include "declare.h"#include <varargs.h>Include dependency graph for declare.c:

Go to the source code of this file.
Data Structures | |
| struct | Declare |
Defines | |
| #define | DECLAREBUF 128 |
Functions | |
| void | InitDeclare () |
| void | ResetDeclare () |
| int | CheckDeclare (int type, char *declaration) |
| void | AddDeclare1 (va_alist) |
| void | AddDeclare (int type, char *declaration) |
| void | WriteInitDeclarations (FILE *f) |
| void | WriteDeclaration (FILE *f) |
Variables | |
| int | indent |
| char | target |
| static struct Declare | Init [] |
| #define DECLAREBUF 128 |
| void AddDeclare | ( | int | type, | |
| char * | declaration | |||
| ) |
Definition at line 123 of file declare.c.
References CheckDeclare(), Declare::decls, Init, j, malloc(), Declare::ndecls, and realloc().
Referenced by AddDeclare1(), Check(), CreDIMFOREXT(), CreSCALAR(), CreSTRINGMAT(), GetPOLYNOM(), OutCommon(), OutExtBMATRIX1(), OutExtCommon(), OutExtIMATRIX(), OutExtSTRING(), OutIMATRIX(), OutPOLYNOM(), WriteArgCheck(), WriteCallConvertion(), WriteCallRest(), WriteCrossCheck(), WriteExternalVariableOutput(), WriteFortranCall(), WriteFunctionCode(), WriteListAnalysis(), WriteOptArg(), WriteOutput(), and WriteVariableOutput().
00124 { 00125 int j = 0; 00126 if ( declaration[0] == '&' ) return ; 00127 if ( CheckDeclare(type,declaration)== 1) return ; 00128 while ( Init[j].type != -1) 00129 { 00130 if ( Init[j].type == type ) 00131 { 00132 if ( Init[j].decls != (char **) 0) 00133 { 00134 (Init[j].ndecls)++; 00135 Init[j].decls = (char **) realloc((char *) Init[j].decls, (unsigned) (Init[j].ndecls ) *sizeof(char *)); 00136 } 00137 else 00138 { 00139 (Init[j].ndecls)++; 00140 Init[j].decls = (char **) malloc ( (unsigned) (Init[j].ndecls ) *sizeof(char *)); 00141 } 00142 if ( Init[j].decls == ( char **) 0) 00143 { 00144 fprintf(stderr,"No more space\n"); 00145 exit(1); 00146 } 00147 Init[j].decls[Init[j].ndecls-1]=(char*) malloc((unsigned) (strlen(declaration)+1)*sizeof(char)); 00148 if ( Init[j].decls[Init[j].ndecls-1] == ( char *) 0) 00149 { 00150 fprintf(stderr,"No more space\n"); 00151 exit(1); 00152 } 00153 strcpy( Init[j].decls[Init[j].ndecls-1], declaration ); 00154 } 00155 j++; 00156 } 00157 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void AddDeclare1 | ( | va_alist | ) |
Definition at line 104 of file declare.c.
References AddDeclare(), and DECLAREBUF.
Referenced by CheckCOLUMN(), CheckPOINTER(), CheckROW(), CheckVECTOR(), CreCOLUMN(), CreCommon(), CreIMATRIX(), CrePOINTER(), CreSPARSE(), CreSTRING(), CreSTRINGMAT(), CreVECTOR(), GetCOLUMN(), GetCom(), GetDim(), GetIMATRIX(), GetPOINTER(), GetROW(), GetSPARSE(), GetSTRINGMAT(), GetVECTOR(), OptMATRIX(), OptOpointer(), OutCOLUMN(), OutLISTarg(), OutROW(), OutSCALAR(), OutSTRING(), OutVECTOR(), WriteListAnalysis(), WriteOptArg(), and WriteOptArgPhase2().
00106 { 00107 char decbuf[DECLAREBUF]; 00108 va_list ap; 00109 #ifdef __STDC__ 00110 va_start(ap,format); 00111 #else 00112 int type; 00113 char *format; 00114 va_start(ap); 00115 type = va_arg(ap, int ); 00116 format = va_arg(ap, char *); 00117 #endif 00118 vsprintf(decbuf,format,ap); 00119 AddDeclare(type,decbuf); 00120 va_end(ap); 00121 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 68 of file declare.c.
Referenced by AddDeclare().
00069 { 00070 int j = 0; 00071 while ( Init[j].type != -1) 00072 { 00073 if ( Init[j].type == type ) 00074 { 00075 int i; 00076 for ( i = 0 ; i < Init[j].ndecls ; i++ ) 00077 { 00078 if ( strcmp(declaration,Init[j].decls[i])==0) 00079 return(1); 00080 } 00081 return(0); 00082 } 00083 j++; 00084 } 00085 return(0); 00086 }
Here is the caller graph for this function:

| void InitDeclare | ( | ) |
Definition at line 39 of file declare.c.
References Declare::decls, i, Init, Declare::ndecls, and type.
Referenced by Generate(), and ISCIReadFile().
00040 { 00041 int i = 0; 00042 while ( Init[i].type != -1) 00043 { 00044 Init[i].decls = (char **) 0; 00045 Init[i].ndecls =0 ; 00046 i++; 00047 } 00048 }
Here is the caller graph for this function:

| void ResetDeclare | ( | ) |
Definition at line 50 of file declare.c.
References Declare::decls, free(), i, Init, j, Declare::ndecls, and type.
Referenced by Generate(), and ISCIReadFile().
00051 { 00052 int j = 0; 00053 while ( Init[j].type != -1) 00054 { 00055 if ( Init[j].decls != (char **) 0) 00056 { 00057 int i; 00058 for ( i = 0 ; i < Init[j].ndecls ; i++ ) 00059 free((char *) Init[j].decls[i]); 00060 free (( char *) Init[j].decls ); 00061 } 00062 Init[j].decls=(char **) 0; 00063 Init[j].ndecls=0; 00064 j++; 00065 } 00066 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void WriteDeclaration | ( | FILE * | f | ) |
Definition at line 179 of file declare.c.
References DEC_DATA, DEC_INIT, DEC_IPTR, DEC_SMAT, Fprintf(), i, indent, Init, j, Declare::ndecls, target, and WriteInitDeclarations().
Referenced by WriteHeader().
00180 { 00181 int j = 0; 00182 int i; 00183 while ( Init[j].type != -1) 00184 { 00185 if ( Init[j].type == DEC_INIT) 00186 {} 00187 else if( Init[j].type == DEC_DATA ) 00188 { 00189 for (i= 0 ; i < Init[j].ndecls ; i++) 00190 { 00191 Fprintf(f,indent,"%s ",Init[j].nameC); 00192 Fprintf(f,indent,"%s",Init[j].decls[i]); 00193 Fprintf(f,indent,";\n"); 00194 } 00195 } 00196 else 00197 { 00198 if ( Init[j].ndecls != 0) 00199 Fprintf(f,indent,"%s ",Init[j].nameC); 00200 for (i= 0 ; i < Init[j].ndecls ; i++) 00201 { 00202 if ( Init[j].type >= DEC_IPTR && target == 'C') 00203 { 00204 /* pointers declaration */ 00205 Fprintf(f,indent,"*"); 00206 } 00207 else if ( Init[j].type == DEC_SMAT && target == 'C') 00208 { 00209 Fprintf(f,indent,"**"); 00210 } 00211 Fprintf(f,indent,"%s",Init[j].decls[i]); 00212 if ( i != Init[j].ndecls -1 ) Fprintf(f,indent,","); 00213 else 00214 { 00215 Fprintf(f,indent,";\n"); 00216 } 00217 } 00218 } 00219 j++; 00220 } 00221 j=0; 00222 WriteInitDeclarations(f); 00223 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void WriteInitDeclarations | ( | FILE * | f | ) |
Definition at line 160 of file declare.c.
References DEC_INIT, Fprintf(), i, indent, Init, j, and Declare::ndecls.
Referenced by WriteDeclaration().
00161 { 00162 int j = 0; 00163 int i; 00164 while ( Init[j].type != -1) 00165 { 00166 if ( Init[j].type == DEC_INIT) 00167 { 00168 for (i= 0 ; i < Init[j].ndecls ; i++) 00169 { 00170 Fprintf(f,indent,"%s",Init[j].decls[i]); 00171 Fprintf(f,indent,";\n"); 00172 } 00173 } 00174 j++; 00175 } 00176 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 36 of file niceprintf.c.
Referenced by AddDeclare(), CheckDeclare(), InitDeclare(), ResetDeclare(), WriteDeclaration(), and WriteInitDeclarations().
| char target |
Definition at line 18 of file intersci-n.c.
Referenced by _XawTextVScroll(), do_xxprintf(), do_xxscanf(), FindFontSelection(), Generate(), main(), WriteDeclaration(), and WriteFortranCall().
1.5.1