- Timestamp:
- Sep 26, 2016, 4:38:04 PM (8 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 61335abc447c59145b8b3e1e7c54f8d873367d4ec240db58915f633fce3013f72a3b9824f231e6ed
- Parents:
- f9b975ad27b583d3227de1370bf9e4f15adc8b3d
- Location:
- Singular
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/ipid.cc
rf9b975 r469903 280 280 if ((IDTYP(h) == t)||(t==DEF_CMD)) 281 281 { 282 if ((IDTYP(h)==PACKAGE_CMD) 283 && (strcmp(s,"Top")==0)) 282 if (IDTYP(h)==PACKAGE_CMD) 284 283 { 285 goto errlabel; 284 if (strcmp(s,"Top")==0) 285 { 286 goto errlabel; 287 } 288 else return *root; 286 289 } 287 if (BVERBOSE(V_REDEFINE)) 288 Warn("redefining %s (%s)",s,my_yylinebuf); 289 if (s==IDID(h)) IDID(h)=NULL; 290 killhdl2(h,root,currRing); 290 else 291 { 292 if (BVERBOSE(V_REDEFINE)) 293 Warn("redefining %s (%s)",s,my_yylinebuf); 294 if (s==IDID(h)) IDID(h)=NULL; 295 killhdl2(h,root,currRing); 296 } 291 297 } 292 298 else … … 649 655 BOOLEAN piKill(procinfov pi) 650 656 { 651 Voice *p=currentVoice;652 while (p!=NULL)653 {654 if (p->pi==pi && pi->ref <= 1)655 {656 Warn("`%s` in use, can not be killed",pi->procname);657 return TRUE;658 }659 p=p->next;660 }661 657 (pi->ref)--; 662 658 if (pi->ref <= 0) 663 659 { 660 Voice *p=currentVoice; 661 while (p!=NULL) 662 { 663 if (p->pi==pi && pi->ref <= 1) 664 { 665 Warn("`%s` in use, can not be killed",pi->procname); 666 return TRUE; 667 } 668 p=p->next; 669 } 664 670 if (pi->libname != NULL) // OB: ???? 665 671 omFree((ADDRESS)pi->libname); -
Singular/iplib.cc
rf9b975 r469903 882 882 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 883 883 procinfo *iiInitSingularProcinfo(procinfov pi, const char *libname, 884 const char *procname, int line, long pos, BOOLEAN pstatic) 885 { 884 const char *procname, int, long pos, BOOLEAN pstatic) 885 { 886 memset(pi,0,sizeof(*pi)); 886 887 pi->libname = omStrDup(libname); 887 888 pi->procname = omStrDup(procname); 888 889 pi->language = LANG_SINGULAR; 889 890 pi->ref = 1; 890 pi->pack = NULL;891 891 pi->is_static = pstatic; 892 892 pi->data.s.proc_start = pos; 893 pi->data.s.def_end = 0L;894 pi->data.s.help_start = 0L;895 pi->data.s.help_end = 0L;896 pi->data.s.body_start = 0L;897 pi->data.s.body_end = 0L;898 pi->data.s.example_start = 0L;899 pi->data.s.proc_lineno = line;900 pi->data.s.body_lineno = 0;901 pi->data.s.example_lineno = 0;902 pi->data.s.body = NULL;903 pi->data.s.help_chksum = 0;904 893 return(pi); 905 894 } … … 921 910 #endif 922 911 923 h = enterid(procname,0, PROC_CMD, &IDROOT, TRUE); 912 h=IDROOT->get(procname,0); 913 if ((h!=NULL) 914 && (IDTYP(h)==PROC_CMD)) 915 { 916 pi = IDPROC(h); 917 if (pi->language == LANG_SINGULAR) 918 Warn("extend `%s`",procname); 919 } 920 else 921 { 922 h = enterid(procname,0, PROC_CMD, &IDROOT, TRUE); 923 } 924 924 if ( h!= NULL ) 925 925 { 926 926 pi = IDPROC(h); 927 omfree(pi->libname); 927 928 pi->libname = omStrDup(libname); 929 omfree(pi->procname); 928 930 pi->procname = omStrDup(procname); 929 931 pi->language = LANG_C; … … 935 937 else 936 938 { 937 PrintS("iiAddCproc: failed.\n");939 WarnS("iiAddCproc: failed."); 938 940 } 939 941 return(0); … … 985 987 pl = basePack->idroot->get(plib,0); /* packages only in top level 986 988 (see enterid) */ 987 if (pl==NULL) 988 { 989 pl = enterid( plib,0, PACKAGE_CMD, &IDROOT, 990 TRUE ); 991 IDPACKAGE(pl)->language = LANG_C; 989 if ((pl!=NULL) 990 &&(IDTYP(pl)==PACKAGE_CMD)) 991 { 992 if(IDPACKAGE(pl)->language==LANG_C) 993 { 994 if (BVERBOSE(V_LOAD_LIB)) Warn( "%s already loaded as package", newlib); 995 omFree(plib); 996 return FALSE; 997 } 998 } 999 else 1000 { 1001 pl = enterid( plib,0, PACKAGE_CMD, &IDROOT, TRUE ); 992 1002 IDPACKAGE(pl)->libname=omStrDup(newlib); 993 1003 } 994 else 995 { 996 if(IDTYP(pl)!=PACKAGE_CMD) 997 { 998 Warn("not of type package."); 999 goto load_modules_end; 1000 } 1001 } 1004 IDPACKAGE(pl)->language = LANG_C; 1002 1005 if (dynl_check_opened(FullName)) 1003 1006 { 1004 if (BVERBOSE(V_LOAD_LIB)) Warn( "%s already loaded ", fullname);1007 if (BVERBOSE(V_LOAD_LIB)) Warn( "%s already loaded as C library", fullname); 1005 1008 return FALSE; 1006 1009 } … … 1065 1068 // int token; 1066 1069 1067 pl = IDROOT->get(plib,0); 1068 if (pl!=NULL) 1069 { 1070 if (BVERBOSE(V_LOAD_LIB)) Warn( "(builtin) %s already loaded", newlib); 1071 omFree(plib); 1072 return FALSE; 1073 } 1074 1075 pl = enterid( plib,0, PACKAGE_CMD, &IDROOT, 1076 TRUE ); 1070 pl = basePack->idroot->get(plib,0); // search PACKAGE only in Top 1071 if ((pl!=NULL) 1072 &&(IDTYP(pl)==PACKAGE_CMD)) 1073 { 1074 if(IDPACKAGE(pl)->language==LANG_C) 1075 { 1076 if (BVERBOSE(V_LOAD_LIB)) Warn( "(builtin) %s already loaded", newlib); 1077 omFree(plib); 1078 return FALSE; 1079 } 1080 } 1081 else 1082 { 1083 pl = enterid( plib,0, PACKAGE_CMD, &IDROOT, TRUE ); 1084 IDPACKAGE(pl)->libname=omStrDup(newlib); 1085 } 1077 1086 IDPACKAGE(pl)->language = LANG_C; 1078 IDPACKAGE(pl)->libname=omStrDup(newlib);1079 1087 1080 1088 IDPACKAGE(pl)->handle=(void *)NULL; … … 1133 1141 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 1134 1142 1143 #ifdef HAVE_DYNAMIC_LOADING 1135 1144 // loads a dynamic module from the binary path and returns a named function 1136 1145 // returns NULL, if something fails … … 1139 1148 void* result = NULL; 1140 1149 1141 #if defined(HAVE_STATIC) || !defined(HAVE_DYNAMIC_LOADING)1142 WerrorS("static version can not load function from dynamic modules");1143 #else1144 1150 const char* bin_dir = feGetResource('b'); 1145 1151 if (!bin_dir) { return NULL; } … … 1156 1162 result = dynl_sym(openlib, funcname); 1157 1163 if (!result) Werror("%s: %s\n", funcname, dynl_error()); 1164 1165 return result; 1166 } 1158 1167 #endif 1159 1160 return result;1161 }1162 1163 1168 1164 1169 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ … … 1225 1230 proc->procname); 1226 1231 if(proc->language==LANG_SINGULAR) 1227 Print("line % 4d,%-5ld %4d,%-5ld %4d,%-5ld\n",1228 proc->data.s.proc_ lineno, proc->data.s.proc_start,1232 Print("line %-5ld %4d,%-5ld %4d,%-5ld\n", 1233 proc->data.s.proc_start, 1229 1234 proc->data.s.body_lineno, proc->data.s.body_start, 1230 1235 proc->data.s.example_lineno, proc->data.s.example_start); -
Singular/ipshell.cc
rf9b975 r469903 192 192 && (strlen(IDPROC(h)->libname)>0)) 193 193 Print(" from %s",IDPROC(h)->libname); 194 if(IDPROC(h)->language==LANG_C) 195 PrintS(" (C)"); 194 196 if(IDPROC(h)->is_static) 195 197 PrintS(" (static)"); -
Singular/libparse.cc
rf9b975 r469903 1974 1974 if(check) 1975 1975 { 1976 printf("Procedure %s (line %d)has OLD-STYLE-HELP!\n",1977 pi->procname , pi->data.s.proc_lineno);1976 printf("Procedure %s has OLD-STYLE-HELP!\n", 1977 pi->procname); 1978 1978 } 1979 1979 SET_HELP_START(mode, pi, current_pos(0)); … … 1999 1999 if(check && yyleng>2) 2000 2000 { 2001 printf("Procedure %s (line %d)has OLD-STYLE-HELP!\n",2002 pi->procname , pi->data.s.proc_lineno);2001 printf("Procedure %s has OLD-STYLE-HELP!\n", 2002 pi->procname); 2003 2003 } 2004 2004 #if YYLPDEBUG -
Singular/libparse.ll
rf9b975 r469903 556 556 if(check) 557 557 { 558 printf("Procedure %s (line %d)has OLD-STYLE-HELP!\n",559 pi->procname , pi->data.s.proc_lineno);558 printf("Procedure %s has OLD-STYLE-HELP!\n", 559 pi->procname); 560 560 } 561 561 SET_HELP_START(mode, pi, current_pos(0)); … … 573 573 if(check && yyleng>2) 574 574 { 575 printf("Procedure %s (line %d)has OLD-STYLE-HELP!\n",576 pi->procname , pi->data.s.proc_lineno);575 printf("Procedure %s has OLD-STYLE-HELP!\n", 576 pi->procname); 577 577 } 578 578 #if YYLPDEBUG -
Singular/subexpr.h
rf9b975 r469903 24 24 public: 25 25 long proc_start; // position where proc is starting 26 long proc_end; // position where proc is ending 26 27 long def_end; // position where proc header is ending 27 28 long help_start; // position where help is starting … … 30 31 long body_end; // position where proc-body is ending 31 32 long example_start; // position where example is starting 32 long proc_end; // position where proc is ending33 int proc_lineno;34 33 int body_lineno; 35 34 int example_lineno;
Note: See TracChangeset
for help on using the changeset viewer.