This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Functions | |
| int | SWAP (char type[], integer *fd) |
| void C2F() | mgeti (integer *fd, integer *res, integer *n, char type[], integer *ierr) |
Definition at line 35 of file mgeti.c.
References c1, fd, soundstream::fp, ft, ftf, GetFile(), GetSwap(), i, ierr, MGETI, n, nc, rblong(), rbshort(), res, rllong(), rlshort(), sciprint(), SWAP, swap, swapl(), swapw(), type, and val.
00036 { 00037 char c1,c2; 00038 int i,items=-1,nc,swap; 00039 ft_t ft; 00040 FILE *fa; 00041 char *RES_c; 00042 unsigned char *RES_uc; 00043 unsigned long *RES_ul; 00044 unsigned short *RES_us; 00045 00046 RES_c=(char *)res; 00047 RES_uc=(unsigned char *)res; 00048 RES_ul=(unsigned long *)res; 00049 RES_us=(unsigned short *)res; 00050 00051 fa = GetFile(fd); 00052 swap = GetSwap(fd); 00053 ft = &ftf; 00054 ft->fp = fa; 00055 nc=strlen(type); 00056 if ( nc == 0) 00057 { 00058 sciprint("mgeti : format is of 0 length \r\n",type); 00059 *ierr=1; 00060 return; 00061 } 00062 00063 if (fa) 00064 { 00065 switch ( type[0] ) { 00066 case 'l' : 00067 swap=SWAP(type,fd); 00068 if(swap<0) {*ierr=1;return;} 00069 MGETI(long,swapl); 00070 break; 00071 case 's' : 00072 swap=SWAP(type,fd); 00073 if(swap<0) {*ierr=1;return;} 00074 MGETI(short,swapw); 00075 break; 00076 case 'c' : 00077 for ( i=0; i< *n; i++) 00078 { 00079 char val; 00080 if ( fread(&val,sizeof(char),1,fa) != 1) 00081 {items= i;break;} 00082 *RES_c++ = val; 00083 } 00084 break; 00085 case 'u' : 00086 if ( strlen(type) > 1) c1=type[1] ; 00087 else c1=' '; 00088 00089 switch ( c1 ) 00090 { 00091 case 'b' : 00092 if ( strlen(type) > 2) c2=type[2]; 00093 else c2=' '; 00094 switch ( c2) 00095 { 00096 case 'l' : 00097 /* Read long, big-endian: big end first. 00098 68000/SPARC style. */ 00099 for ( i=0; i< *n; i++) 00100 { 00101 unsigned long val; 00102 val = rblong(ft); 00103 if ( feof(fa) != 0) {items= i;break;} 00104 *RES_ul ++ = val ; 00105 } 00106 break; 00107 case 's' : 00108 /* Read short, big-endian: big end first. 00109 68000/SPARC style. */ 00110 for ( i=0; i< *n; i++) 00111 { 00112 unsigned short val; 00113 val = rbshort(ft); 00114 if ( feof(fa) != 0) {items= i;break;} 00115 *RES_us++ = val; 00116 } 00117 break; 00118 } 00119 break; 00120 case 'l' : 00121 if ( strlen(type) > 2) c2=type[2]; 00122 else c2=' '; 00123 switch ( c2 ) 00124 { 00125 case 'l' : 00126 /* Read long, little-endian: little end first. 00127 VAX/386 style.*/ 00128 for ( i=0; i< *n; i++) 00129 { 00130 unsigned long val; 00131 val = rllong(ft); 00132 if ( feof(fa) != 0) {items= i;break;} 00133 *RES_ul++ = val; 00134 } 00135 break; 00136 case 's' : 00137 /* Read short, little-endian: little end first. 00138 VAX/386 style.*/ 00139 for ( i=0; i< *n; i++) 00140 { 00141 unsigned short val; 00142 val = rlshort(ft); 00143 if ( feof(fa) != 0) {items= i;break;} 00144 *RES_us++ = val; 00145 } 00146 break; 00147 default: 00148 MGETI(unsigned long,swapl); 00149 break; 00150 } 00151 break; 00152 case 's' : 00153 MGETI(unsigned short,swapw); 00154 break; 00155 case 'c' : 00156 for ( i=0; i< *n; i++) 00157 { 00158 unsigned char val; 00159 if ( fread(&val,sizeof(unsigned char),1,fa)!= 1) 00160 {items= i;break;}; 00161 *RES_uc++ = val; 00162 } 00163 break; 00164 default : 00165 sciprint("mget : %s format not recognized \r\n",type); 00166 *ierr=1; 00167 return; 00168 } 00169 break; 00170 default : 00171 sciprint("mget : %s format not recognized \r\n",type); 00172 *ierr=1; 00173 return; 00174 } 00175 if ( items != -1 ) 00176 { 00177 *ierr = -(items) -1 ; 00179 } 00180 return; 00181 } 00182 sciprint("No input file \r\n"); 00183 *ierr=1; 00184 }
Here is the call graph for this function:

Definition at line 186 of file mgeti.c.
00187 { 00188 int nc,swap; 00189 nc=strlen(type); 00190 swap = GetSwap(fd); 00191 if ( nc > 1) { 00192 switch (type[1]) { 00193 case 'b': 00194 if (islittle_endian()==1) swap=1;else swap=0; 00195 break; 00196 case 'l': 00197 if (islittle_endian()==1) swap=0;else swap=1; 00198 break; 00199 default: 00200 sciprint("mgeti : unknown format %s \r\n",type); 00201 swap=-1; 00202 } 00203 } 00204 return swap; 00205 }
1.5.1