Changeset 743c32 in git for Singular/iplib.cc
- Timestamp:
- Apr 29, 1999, 6:57:18 PM (25 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- b98018048375e2844cb029948d521db0a81570d8
- Parents:
- ce5fb2786eb5fa61fee54f85fe8647ef13e7be20
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/iplib.cc
rce5fb2 r743c32 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: iplib.cc,v 1.5 4 1999-04-15 17:28:04Singular Exp $ */4 /* $Id: iplib.cc,v 1.55 1999-04-29 16:57:13 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: interpreter: LIB and help … … 172 172 s[procbuflen+head+2] = '\0'; 173 173 offset=0; 174 for(i=0;i<=procbuflen+head+2; i++) { 174 for(i=0;i<=procbuflen+head+2; i++) 175 { 175 176 if(s[i]=='\\' && 176 (s[i+1]=='"' || s[i+1]=='{' || s[i+1]=='}' || s[i+1]=='\\')) { 177 (s[i+1]=='"' || s[i+1]=='{' || s[i+1]=='}' || s[i+1]=='\\')) 178 { 177 179 i++; 178 180 offset++; … … 316 318 { 317 319 namehdl nshdl; 318 for(nshdl=namespaceroot; nshdl->isroot != TRUE; nshdl = nshdl->next) { 320 for(nshdl=namespaceroot; nshdl->isroot != TRUE; nshdl = nshdl->next) 321 { 319 322 Print("%d lev %d:",nshdl->lev, nshdl->myynest); 320 323 if (nshdl->currRing==NULL) PrintS("NULL"); … … 603 606 lib_types LT; 604 607 605 for(i=0; suffix[i] != NULL; i++) { 608 for(i=0; suffix[i] != NULL; i++) 609 { 606 610 sprintf(libname, "%s%s", id, suffix[i]); 607 611 *libname = mytolower(*libname); 608 if((LT = type_of_LIB(libname, libnamebuf)) != LT_NONE) { 609 if(!(LoadResult = iiLibCmd(mstrdup(libname), FALSE))) { 612 if((LT = type_of_LIB(libname, libnamebuf)) != LT_NONE) 613 { 614 if(!(LoadResult = iiLibCmd(mstrdup(libname), FALSE))) 615 { 610 616 v->name = iiConvName(libname); 611 617 break; … … 813 819 } 814 820 #ifdef HAVE_NAMESPACES 815 if (BVERBOSE(V_LOAD_LIB)) { 821 if (BVERBOSE(V_LOAD_LIB)) 822 { 816 823 idhdl versionhdl = namespaceroot->get("version",0); 817 824 if(versionhdl != NULL) … … 1041 1048 "line", "start", "line", "body", "line", "example"); 1042 1049 #ifdef HAVE_NAMESPACES 1043 // for(pl = IDROOT; pl != NULL; pl = IDNEXT(pl)) { 1044 for(pl = NSROOT(namespaceroot->root); pl != NULL; pl = IDNEXT(pl)) { 1045 if(IDTYP(pl) == PACKAGE_CMD) { 1050 // for(pl = IDROOT; pl != NULL; pl = IDNEXT(pl)) 1051 //{ 1052 for(pl = NSROOT(namespaceroot->root); pl != NULL; pl = IDNEXT(pl)) 1053 { 1054 if(IDTYP(pl) == PACKAGE_CMD) 1055 { 1046 1056 for(h = IDPACKAGE(pl)->idroot; h != NULL; h = IDNEXT(h)) 1047 1057 #else /* HAVE_NAMESPACES */ … … 1101 1111 char *f = NULL; 1102 1112 if(hl!=NULL) f = strstr(IDSTRING(hl),libname); 1103 if( (hl==NULL) || (f == NULL)) { 1104 for(lp = this;lp!=NULL;lp=lp->next) { 1113 if( (hl==NULL) || (f == NULL)) 1114 { 1115 for(lp = this;lp!=NULL;lp=lp->next) 1116 { 1105 1117 if(strcmp(lp->get(), libname)==0) break; 1106 1118 } 1107 if(lp==NULL) { 1119 if(lp==NULL) 1120 { 1108 1121 libstackv ls = (libstack *)Alloc0(sizeof(libstack)); 1109 1122 ls->next = this; … … 1133 1146 lib_types type_of_LIB(char *newlib, char *libnamebuf) 1134 1147 { 1135 char buf[HOWMANY+1];/* one extra for terminating '\0' */1148 char buf[HOWMANY+1]; /* one extra for terminating '\0' */ 1136 1149 struct stat sb; 1137 1150 int nbytes = 0; … … 1146 1159 return LT; 1147 1160 } 1148 if((sb.st_mode & S_IFMT) != S_IFREG) { 1161 if((sb.st_mode & S_IFMT) != S_IFREG) 1162 { 1149 1163 goto lib_type_end; 1150 1164 } 1151 if ((nbytes = fread((char *)buf, sizeof(char), HOWMANY, fp)) == -1) { 1165 if ((nbytes = fread((char *)buf, sizeof(char), HOWMANY, fp)) == -1) 1166 { 1152 1167 goto lib_type_end; 1153 1168 /*NOTREACHED*/ … … 1155 1170 if (nbytes == 0) 1156 1171 goto lib_type_end; 1157 else { 1158 buf[nbytes++] = '\0'; /* null-terminate it */ 1159 } 1160 if( (strncmp(buf, "\177ELF\01\01\01", 7)==0) && buf[16]=='\03') { 1172 else 1173 { 1174 buf[nbytes++] = '\0'; /* null-terminate it */ 1175 } 1176 if( (strncmp(buf, "\177ELF\01\01\01", 7)==0) && buf[16]=='\03') 1177 { 1161 1178 LT = LT_ELF; 1162 1179 FreeL(newlib); … … 1164 1181 goto lib_type_end; 1165 1182 } 1166 if( (strncmp(buf, "\02\020\01\016\05\022@", 7)==0)) { 1183 if( (strncmp(buf, "\02\020\01\016\05\022@", 7)==0)) 1184 { 1167 1185 LT = LT_HPUX; 1168 1186 FreeL(newlib); … … 1170 1188 goto lib_type_end; 1171 1189 } 1172 if(isprint(buf[0]) || buf[0]=='\n') { LT = LT_SINGULAR; goto lib_type_end; } 1190 if(isprint(buf[0]) || buf[0]=='\n') 1191 { LT = LT_SINGULAR; goto lib_type_end; } 1173 1192 1174 1193 lib_type_end:
Note: See TracChangeset
for help on using the changeset viewer.