Changeset b6e51b in git
- Timestamp:
- Sep 27, 2006, 7:46:28 PM (18 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 1e35790dc0937f1166846848cf844b2811aa49f0
- Parents:
- 2245326a4cf500727c77d96a854a05d93f0cd772
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/Makefile.in
r224532 rb6e51b 521 521 522 522 TAGS: ${SOURCES} ${ESOURCES} ${HEADERS} 523 etags ${SOURCES} ${ESOURCES} ${HEADERS} 523 etags ${SOURCES} ${ESOURCES} ${HEADERS} ../kernel/*.[ch] ../kernel/*.cc ../kernel/*.inc 524 524 525 525 526 tags: -
Singular/iparith.cc
r224532 rb6e51b 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: iparith.cc,v 1.41 1 2006-09-22 12:08:03Singular Exp $ */4 /* $Id: iparith.cc,v 1.412 2006-09-27 17:46:09 Singular Exp $ */ 5 5 6 6 /* … … 53 53 #include "clapsing.h" 54 54 #include "kstdfac.h" 55 #endif 55 #endif /* HAVE_FACTORY */ 56 56 #ifdef HAVE_FGLM 57 57 #include "fglm.h" 58 #endif 58 #endif /* HAVE_FGLM */ 59 59 #define HAVE_INTERPOLATION 60 60 #ifdef HAVE_INTERPOLATION … … 75 75 #define COMM_PLURAL ,2 76 76 #define COMM_PLURAL_N 2 77 #else 77 #else /* HAVE_PLURAL */ 78 78 #define ALLOW_PLURAL 79 79 #define NO_PLURAL 80 80 #define COMM_PLURAL 81 #endif 81 #endif /* HAVE_PLURAL */ 82 82 83 83 /*=============== types =====================*/ … … 101 101 #ifdef HAVE_PLURAL 102 102 short valid_for_plural; 103 # endif103 # endif /* HAVE_PLURAL */ 104 104 }; 105 105 … … 114 114 #ifdef HAVE_PLURAL 115 115 short valid_for_plural; 116 # endif116 # endif /* HAVE_PLURAL */ 117 117 }; 118 118 … … 128 128 #ifdef HAVE_PLURAL 129 129 short valid_for_plural; 130 # endif130 # endif /* HAVE_PLURAL */ 131 131 }; 132 132 struct sValCmdM … … 138 138 #ifdef HAVE_PLURAL 139 139 short valid_for_plural; 140 # endif140 # endif /* HAVE_PLURAL */ 141 141 }; 142 #endif 142 #endif /* GENTABLE */ 143 144 typedef struct { 145 unsigned long nCmdUsed; /**< number of commands used */ 146 unsigned long nCmdAllocated; /**< number of commands-slots allocated */ 147 unsigned long nLastIdentifier; 148 cmdnames *sCmds; /**< array of existing commands */ 149 150 #ifndef GENTABLE 151 struct sValCmd1 *psValCmd1; 152 struct sValCmd2 *psValCmd2; 153 struct sValCmd3 *psValCmd3; 154 struct sValCmdM *psValCmdM; 155 #endif /* GENTABLE */ 156 } SArithBase; 157 158 /*---------------------------------------------------------------------* 159 * File scope Variables (Variables share by several functions in 160 * the same file ) 161 * 162 *---------------------------------------------------------------------*/ 163 static SArithBase sArithBase; /**< Base entry for arithmetic */ 164 165 /*---------------------------------------------------------------------* 166 * Extern Functions declarations 167 * 168 *---------------------------------------------------------------------*/ 169 static int _gentable_sort_cmds(const void *a, const void *b); 170 extern int iiArithRemoveCmd(char *szName); 171 extern int iiArithAddCmd(char *szName, short nAlias, short nTokval, 172 short nToktype, short nPos=-1); 143 173 144 174 /*============= proc =======================*/ … … 345 375 #ifdef OLD_RES 346 376 { "sres", 0, SRES_CMD , CMD_23}, 347 #else 377 #else /* OLD_RES */ 348 378 { "sres", 0, SRES_CMD , CMD_2}, 349 #endif 379 #endif /* OLD_RES */ 350 380 { "status", 0, STATUS_CMD, CMD_M}, 351 381 { "std", 0, STD_CMD , CMD_123}, … … 359 389 #ifdef HAVE_PLURAL 360 390 { "twostd", 0, TWOSTD_CMD , CMD_1}, 361 #endif 391 #endif /* HAVE_PLURAL */ 362 392 { "type", 0, TYPE_CMD , TYPE_CMD}, 363 393 { "typeof", 0, TYPEOF_CMD , CMD_1}, … … 408 438 { NULL, 0, 0, 0} 409 439 }; 410 #endif 440 #endif /* GENTABLE */ 411 441 412 442 /*=================== operations with 2 args.: static proc =================*/ … … 798 828 return TRUE; 799 829 } 800 #else 830 #else /* HAVE_NS */ 801 831 WerrorS("package is not supported in this version"); 802 832 #endif /* HAVE_NS */ … … 1200 1230 res->data=(void *)p; 1201 1231 } 1202 #else 1232 #else /* HAVE_FACTORY */ 1203 1233 WerrorS("division only by a monomial"); 1204 1234 return TRUE; 1205 #endif 1235 #endif /* HAVE_FACTORY */ 1206 1236 } 1207 1237 else … … 1233 1263 MATELEM(mm,i,j) = singclap_pdivide( MATELEM(m,i,j) , 1234 1264 q /*(poly)(v->Data())*/ ); 1235 #else 1265 #else /* HAVE_FACTORY */ 1236 1266 WerrorS("division only by a monomial"); 1237 1267 return TRUE; 1238 #endif 1268 #endif /* HAVE_FACTORY */ 1239 1269 } 1240 1270 else … … 1729 1759 //Print("exportto %s -> %s\n",v->Name(),u->Name() ); 1730 1760 return iiExport(v,0,(idhdl)u->data); 1731 #else 1761 #else /* HAVE_NS */ 1732 1762 return TRUE; 1733 #endif 1763 #endif /* HAVE_NS */ 1734 1764 } 1735 1765 static BOOLEAN jjERROR(leftv res, leftv u) … … 1806 1836 return FALSE; 1807 1837 } 1808 #endif 1838 #endif /* HAVE_FACTORY */ 1809 1839 static BOOLEAN jjFETCH(leftv res, leftv u, leftv v) 1810 1840 { … … 1982 2012 return FALSE; 1983 2013 } 1984 #endif 2014 #endif /* HAVE_FACTORY */ 1985 2015 static BOOLEAN jjHILBERT2(leftv res, leftv u, leftv v) 1986 2016 { … … 2319 2349 #ifdef buildin_rand 2320 2350 res->data =(char *)(long)((i > j) ? i : (siRand() % (j-i+1)) + i); 2321 #else 2351 #else /* buildin_rand */ 2322 2352 res->data =(char *)(long)((i > j) ? i : (rand() % (j-i+1)) + i); 2323 #endif 2353 #endif /* buildin_rand */ 2324 2354 return FALSE; 2325 2355 } … … 3951 3981 int i = 1; 3952 3982 int l = strlen(s); 3953 while (cmds[i].tokval!=0)3954 {3955 if (strcmp(s, cmds[i].name) == 0)3983 for(i=0; i<sArithBase.nCmdUsed; i++) { 3984 //while (cmds[i].tokval!=0){ 3985 if (strcmp(s, sArithBase.sCmds[i].name) == 0) 3956 3986 { 3957 3987 res->data = (char *)1; … … 4028 4058 } 4029 4059 } 4030 4060 4031 4061 assume(u_id->rank>=idRankFreeModule(u_id)); 4032 res->data=(char *)t_rep_gb(currRing, 4062 res->data=(char *)t_rep_gb(currRing, 4033 4063 u_id,u_id->rank); 4034 4064 //res->data=(char *)t_rep_gb(currRing, u_id); 4035 4065 4036 4066 if(!TEST_OPT_DEGBOUND) setFlag(res,FLAG_STD); 4037 4067 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD); … … 6231 6261 { 6232 6262 int i=1; 6233 loop 6234 { 6235 Print("%-20s",cmds[i].name); 6236 i++; 6237 if(cmds[i].name==NULL) 6238 break; 6239 if ((i%3)==1) PrintLn(); 6263 unsigned short nCount = (sArithBase.nCmdUsed-1)/3; 6264 if((3*nCount)<sArithBase.nCmdUsed) nCount++; 6265 //Print("CMDS: %d/%d\n", sArithBase.nCmdUsed, 6266 // sArithBase.nCmdAllocated); 6267 for(i=0; i<nCount; i++) 6268 { 6269 Print("%-20s",sArithBase.sCmds[i+1].name); 6270 if(i+1+nCount<sArithBase.nCmdUsed) 6271 Print("%-20s",sArithBase.sCmds[i+1+nCount].name); 6272 if(i+1+2*nCount<sArithBase.nCmdUsed) 6273 Print("%-20s",sArithBase.sCmds[i+1+2*nCount].name); 6274 //if ((i%3)==1) PrintLn(); 6275 PrintLn(); 6240 6276 } 6241 6277 PrintLn(); … … 6582 6618 } 6583 6619 /*-------------------------------------------------------------------*/ 6620 #if 0 6584 6621 void ttGen2() 6585 6622 { … … 6593 6630 6594 6631 fprintf(outfile, 6595 "cmdnames cmds[] =\n"6632 "cmdnames OLDcmds[] =\n" 6596 6633 "{ // name-string alias tokval toktype\n" 6597 6634 "{ \"$INVALID$\", 0, -1, 0},\n"); … … 6701 6738 " { NULL, 0, 0, 0}\n" 6702 6739 "};\n" 6740 "#ifdef HAVE_RTIMER\n" 6741 "#define LAST_IDENTIFIER %d\n" 6742 "#else\n" 6743 "#define LAST_IDENTIFIER %d\n" 6744 "#endif\n",id_nr,id_nr-1); 6745 fclose(outfile); 6746 } 6747 #endif 6748 /*---------------------------------------------------------------------*/ 6749 /** 6750 * @brief generate cmds initialisation 6751 **/ 6752 /*---------------------------------------------------------------------*/ 6753 6754 void ttGen2b() 6755 { 6756 int cmd_size = (sizeof(cmds)/sizeof(cmdnames))-1; 6757 6758 FILE *outfile = myfopen("iparith.inc","a"); 6759 fprintf(outfile, 6760 "/****************************************\n" 6761 "* Computer Algebra System SINGULAR *\n" 6762 "****************************************/\n\n"); 6763 /*-------------------------------------------------------------------*/ 6764 fprintf(outfile,"// identifier table for Singular\n//\n"); 6765 6766 fprintf( 6767 outfile, 6768 "void iiInitCmdName() {\n" 6769 " sArithBase.nCmdUsed = 0;\n" 6770 " sArithBase.nCmdAllocated = %d;\n" 6771 " sArithBase.sCmds = (cmdnames*)omAlloc0(sArithBase.nCmdAllocated*sizeof(cmdnames));\n" 6772 "\n" 6773 " // name-string alias tokval toktype\n", 6774 cmd_size); 6775 int m=0; 6776 int id_nr=0; 6777 6778 qsort(&cmds, cmd_size, sizeof(cmdnames), (&_gentable_sort_cmds)); 6779 6780 for(m=0; m<cmd_size; m++) { 6781 if(cmds[m].tokval>0) id_nr++; 6782 if(cmds[m].tokval==VRTIMER) fprintf(outfile,"#ifdef HAVE_RTIMER\n"); 6783 fprintf(outfile," iiArithAddCmd(\"%s\", %*d, %3d, ",cmds[m].name, 6784 20-strlen(cmds[m].name), 6785 cmds[m].alias, 6786 cmds[m].tokval); 6787 switch(cmds[m].toktype) { 6788 case CMD_1: fprintf(outfile,"CMD_1"); break; 6789 case CMD_2: fprintf(outfile,"CMD_2"); break; 6790 case CMD_3: fprintf(outfile,"CMD_3"); break; 6791 case CMD_12: fprintf(outfile,"CMD_12"); break; 6792 case CMD_123 : fprintf(outfile,"CMD_123"); break; 6793 case CMD_23: fprintf(outfile,"CMD_23"); break; 6794 case CMD_M: fprintf(outfile,"CMD_M"); break; 6795 case SYSVAR: fprintf(outfile,"SYSVAR"); break; 6796 case ROOT_DECL: fprintf(outfile,"ROOT_DECL"); break; 6797 case ROOT_DECL_LIST: fprintf(outfile,"ROOT_DECL_LIST"); break; 6798 case RING_DECL: fprintf(outfile,"RING_DECL"); break; 6799 case NONE: fprintf(outfile,"NONE"); break; 6800 default: 6801 if((cmds[m].toktype>' ') &&(cmds[m].toktype<127)) { 6802 fprintf(outfile,"'%c'",cmds[m].toktype); 6803 } else { 6804 fprintf(outfile,"%d",cmds[m].toktype); 6805 } 6806 break; 6807 #if 0 6808 fprintf(outfile," iiArithAddCmd(\"%s\", %*d, -1, 0 );\n", 6809 cmds[m].name, 20-strlen(cmds[m].name), 6810 0/*cmds[m].alias*/ 6811 /*-1 cmds[m].tokval*/ 6812 /*0 cmds[m].toktype*/); 6813 #endif 6814 } 6815 fprintf(outfile,", %d);\n", m); 6816 if(cmds[m].tokval==VRTIMER) fprintf(outfile,"#endif\n"); 6817 } 6818 fprintf(outfile, "/* end of list marker */\n"); 6819 fprintf(outfile, 6820 "#ifdef HAVE_RTIMER\n" 6821 " sArithBase.nLastIdentifier = %d;\n" 6822 "#else /* HAVE_RTIMER */\n" 6823 " sArithBase.nLastIdentifier = %d;\n" 6824 "#endif /* HAVE_RTIMER */\n", 6825 id_nr,id_nr-1); 6826 6827 6828 fprintf(outfile, 6829 "}\n" 6703 6830 "#ifdef HAVE_RTIMER\n" 6704 6831 "#define LAST_IDENTIFIER %d\n" … … 7571 7698 int i,v; 7572 7699 #ifndef GENTABLE 7573 int en=LAST_IDENTIFIER; 7574 7575 loop 7700 int en=sArithBase.nLastIdentifier; 7701 7702 //loop 7703 for(an=0; an<sArithBase.nCmdUsed; ) 7576 7704 { 7577 7705 if(an>=en-1) 7578 7706 { 7579 if (strcmp(n, cmds[an].name) == 0)7707 if (strcmp(n, sArithBase.sCmds[an].name) == 0) 7580 7708 { 7581 7709 i=an; 7582 7710 break; 7583 7711 } 7584 else if ((an!=en) && (strcmp(n, cmds[en].name) == 0))7712 else if ((an!=en) && (strcmp(n, sArithBase.sCmds[en].name) == 0)) 7585 7713 { 7586 7714 i=en; … … 7593 7721 } 7594 7722 i=(an+en)/2; 7595 if (*n < *( cmds[i].name))7723 if (*n < *(sArithBase.sCmds[i].name)) 7596 7724 { 7597 7725 en=i-1; 7598 7726 } 7599 else if (*n > *( cmds[i].name))7727 else if (*n > *(sArithBase.sCmds[i].name)) 7600 7728 { 7601 7729 an=i+1; … … 7603 7731 else 7604 7732 { 7605 v=strcmp(n, cmds[i].name);7733 v=strcmp(n,sArithBase.sCmds[i].name); 7606 7734 if(v<0) 7607 7735 { … … 7618 7746 } 7619 7747 } 7620 lastreserved= cmds[i].name;7621 tok= cmds[i].tokval;7622 if( cmds[i].alias==2)7748 lastreserved=sArithBase.sCmds[i].name; 7749 tok=sArithBase.sCmds[i].tokval; 7750 if(sArithBase.sCmds[i].alias==2) 7623 7751 { 7624 7752 Warn("outdated identifier `%s` used - please change your code", 7625 cmds[i].name);7626 cmds[i].alias=1;7753 sArithBase.sCmds[i].name); 7754 sArithBase.sCmds[i].alias=1; 7627 7755 } 7628 7756 if (currRingHdl==NULL) … … 7659 7787 } 7660 7788 } 7661 return cmds[i].toktype;7789 return sArithBase.sCmds[i].toktype; 7662 7790 #else 7663 7791 return 0; … … 7684 7812 } 7685 7813 7814 #ifdef GENTABLE 7815 char * Tok2Cmdname(int tok) 7816 { 7817 int i = 0; 7818 if (tok < 0) 7819 { 7820 return cmds[0].name; 7821 } 7822 if (tok==ANY_TYPE) return "any_type"; 7823 if (tok==NONE) return "nothing"; 7824 //if (tok==IFBREAK) return "if_break"; 7825 //if (tok==VECTOR_FROM_POLYS) return "vector_from_polys"; 7826 //if (tok==ORDER_VECTOR) return "ordering"; 7827 //if (tok==REF_VAR) return "ref"; 7828 //if (tok==OBJECT) return "object"; 7829 //if (tok==PRINT_EXPR) return "print_expr"; 7830 if (tok==IDHDL) return "identifier"; 7831 while (cmds[i].tokval!=0) 7832 { 7833 if ((cmds[i].tokval == tok)&&(cmds[i].alias==0)) 7834 { 7835 return cmds[i].name; 7836 } 7837 i++; 7838 } 7839 return cmds[0].name; 7840 } 7841 #else /* GENTABLE */ 7842 char * Tok2Cmdname(int tok) 7843 { 7844 int i = 0; 7845 if (tok < 0) 7846 { 7847 return sArithBase.sCmds[0].name; 7848 } 7849 if (tok==ANY_TYPE) return "any_type"; 7850 if (tok==NONE) return "nothing"; 7851 //if (tok==IFBREAK) return "if_break"; 7852 //if (tok==VECTOR_FROM_POLYS) return "vector_from_polys"; 7853 //if (tok==ORDER_VECTOR) return "ordering"; 7854 //if (tok==REF_VAR) return "ref"; 7855 //if (tok==OBJECT) return "object"; 7856 //if (tok==PRINT_EXPR) return "print_expr"; 7857 if (tok==IDHDL) return "identifier"; 7858 for(i=0; i<sArithBase.nCmdUsed; i++) 7859 //while (sArithBase.sCmds[i].tokval!=0) 7860 { 7861 if ((sArithBase.sCmds[i].tokval == tok)&& 7862 (sArithBase.sCmds[i].alias==0)) 7863 { 7864 return sArithBase.sCmds[i].name; 7865 } 7866 } 7867 return sArithBase.sCmds[0].name; 7868 } 7869 #endif /* GENTABLE */ 7870 7871 7872 /*---------------------------------------------------------------------*/ 7873 /** 7874 * @brief compares to entry of cmdsname-list 7875 7876 @param[in] a 7877 @param[in] b 7878 7879 @return <ReturnValue> 7880 **/ 7881 /*---------------------------------------------------------------------*/ 7882 static int _gentable_sort_cmds( const void *a, const void *b ) 7883 { 7884 cmdnames *pCmdL = (cmdnames*)a; 7885 cmdnames *pCmdR = (cmdnames*)b; 7886 7887 if(a==NULL || b==NULL) return 0; 7888 7889 /* empty entries goes to the end of the list for later reuse */ 7890 if(pCmdL->name==NULL) return 1; 7891 if(pCmdR->name==NULL) return -1; 7892 7893 /* $INVALID$ must come first */ 7894 if(strcmp(pCmdL->name, "$INVALID$")==0) return -1; 7895 if(strcmp(pCmdR->name, "$INVALID$")==0) return 1; 7896 7897 /* tokval=-1 are reserved names at the end */ 7898 if (pCmdL->tokval==-1) 7899 { 7900 if (pCmdR->tokval==-1) 7901 return strcmp(pCmdL->name, pCmdR->name); 7902 /* pCmdL->tokval==-1, pCmdL goes at the end */ 7903 return 1; 7904 } 7905 /* pCmdR->tokval==-1, pCmdR goes at the end */ 7906 if(pCmdR->tokval==-1) return -1; 7907 7908 return strcmp(pCmdL->name, pCmdR->name); 7909 } 7910 7911 /*---------------------------------------------------------------------*/ 7912 /** 7913 * @brief initialisation of arithmetic structured data 7914 7915 @retval 0 on success 7916 7917 **/ 7918 /*---------------------------------------------------------------------*/ 7919 int iiInitArithmetic() 7920 { 7921 int i; 7922 //printf("iiInitArithmetic()\n"); 7923 #ifndef GENTABLE 7924 memset(&sArithBase, 0, sizeof(sArithBase)); 7925 iiInitCmdName(); 7926 /* fix last-identifier */ 7927 #if 0 7928 /* we expect that gentable allready did every thing */ 7929 for(sArithBase.nLastIdentifier=sArithBase.nCmdUsed-1; 7930 sArithBase.nLastIdentifier>0; sArithBase.nLastIdentifier--) { 7931 if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break; 7932 } 7933 #endif 7934 //Print("L=%d\n", sArithBase.nLastIdentifier); 7935 7936 //iiArithAddCmd(szName, nAlias, nTokval, nToktype); 7937 //iiArithAddCmd("mygcd", 1, GCD_CMD, CMD_2); 7938 7939 //iiArithAddCmd("Top", 0,-1,0); 7940 7941 7942 //for(i=0; i<sArithBase.nCmdUsed; i++) { 7943 // printf("CMD[%03d] %s, %d, %d, %d\n", i, 7944 // sArithBase.sCmds[i].name, 7945 // sArithBase.sCmds[i].alias, 7946 // sArithBase.sCmds[i].tokval, 7947 // sArithBase.sCmds[i].toktype); 7948 //} 7949 //iiArithRemoveCmd("Top"); 7950 //iiArithAddCmd("mygcd", 2, GCD_CMD, CMD_2); 7951 //iiArithRemoveCmd("mygcd"); 7952 //iiArithAddCmd("kkk", 1, 1234, CMD_1); 7953 #endif /* !GENTABLE */ 7954 } 7955 7956 /*---------------------------------------------------------------------*/ 7957 /** 7958 * @brief append newitem of size sizeofitem to the list named list. 7959 7960 @param[in,out] list 7961 @param[in,out] item_count 7962 @param[in] sizeofitem 7963 @param[in] newitem 7964 7965 @retval 0 success 7966 @retval -1 failure 7967 **/ 7968 /*---------------------------------------------------------------------*/ 7969 int iiArithAddItem2list( 7970 void **list, 7971 long *item_count, 7972 long sizeofitem, 7973 void *newitem 7974 ) 7975 { 7976 int count = *item_count; 7977 7978 //TRACE(0, "add_item_to_list(%p, %p, %ld, %p)\n", list, item_count, 7979 // sizeofitem, newitem); 7980 7981 if(count==0) 7982 { 7983 *list = (void *)omAlloc(sizeofitem); 7984 } 7985 else 7986 { 7987 *list = (void *)omRealloc(*list, (count+1) * sizeofitem); 7988 } 7989 if((*list)==NULL) return -1; 7990 7991 //memset((*list)+count*sizeofitem, 0, sizeofitem); 7992 //memcpy((*list)+count*sizeofitem, newitem, sizeofitem); 7993 7994 /* erhoehe counter um 1 */ 7995 (count)++; 7996 *item_count = count; 7997 return 0; 7998 } 7999 8000 int iiArithFindCmd(const char *szName) 8001 { 8002 #ifndef GENTABLE 8003 int an=0; 8004 int i = 0,v = 0; 8005 int en=sArithBase.nLastIdentifier; 8006 8007 for(an=0; an<sArithBase.nCmdUsed; ) 8008 { 8009 if(an>=en-1) 8010 { 8011 if (strcmp(szName, sArithBase.sCmds[an].name) == 0) 8012 { 8013 //Print("RET-an=%d %s\n", an, sArithBase.sCmds[an].name); 8014 return an; 8015 } 8016 else if (strcmp(szName, sArithBase.sCmds[en].name) == 0) 8017 { 8018 //Print("RET-en=%d %s\n", en, sArithBase.sCmds[en].name); 8019 return en; 8020 } 8021 else 8022 { 8023 //Print("RET- 1\n"); 8024 return -1; 8025 } 8026 } 8027 i=(an+en)/2; 8028 if (*szName < *(sArithBase.sCmds[i].name)) 8029 { 8030 en=i-1; 8031 } 8032 else if (*szName > *(sArithBase.sCmds[i].name)) 8033 { 8034 an=i+1; 8035 } 8036 else 8037 { 8038 v=strcmp(szName,sArithBase.sCmds[i].name); 8039 if(v<0) 8040 { 8041 en=i-1; 8042 } 8043 else if(v>0) 8044 { 8045 an=i+1; 8046 } 8047 else /*v==0*/ 8048 { 8049 //Print("RET-i=%d %s\n", i, sArithBase.sCmds[i].name); 8050 return i; 8051 } 8052 } 8053 } 8054 //if(i>=0 && i<sArithBase.nCmdUsed) 8055 // return i; 8056 //Print("RET-2\n"); 8057 return -2; 8058 #else 8059 return 0; 8060 #endif 8061 } 8062 8063 char *iiArithGetCmd( int nPos ) 8064 { 8065 if(nPos<0) return NULL; 8066 if(nPos<sArithBase.nCmdUsed) 8067 return sArithBase.sCmds[nPos].name; 8068 return NULL; 8069 } 8070 8071 int iiArithRemoveCmd( char *szName) 8072 { 8073 int nIndex; 8074 if(szName==NULL) return -1; 8075 8076 nIndex = iiArithFindCmd(szName); 8077 if(nIndex<0 || nIndex>=sArithBase.nCmdUsed) 8078 { 8079 Print("'%s' not found (%d)\n", szName, nIndex); 8080 return -1; 8081 } 8082 omFree(sArithBase.sCmds[nIndex].name); 8083 sArithBase.sCmds[nIndex].name=0; 8084 qsort(sArithBase.sCmds, sArithBase.nCmdUsed, sizeof(cmdnames), 8085 (&_gentable_sort_cmds)); 8086 sArithBase.nCmdUsed--; 8087 8088 /* fix last-identifier */ 8089 for(sArithBase.nLastIdentifier=sArithBase.nCmdUsed-1; 8090 sArithBase.nLastIdentifier>0; sArithBase.nLastIdentifier--) 8091 { 8092 if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break; 8093 } 8094 //Print("L=%d\n", sArithBase.nLastIdentifier); 8095 return 0; 8096 } 8097 8098 int iiArithAddCmd( 8099 char *szName, 8100 short nAlias, 8101 short nTokval, 8102 short nToktype, 8103 short nPos 8104 ) 8105 { 8106 //printf("AddCmd(%s, %d, %d, %d, %d)\n", szName, nAlias, 8107 // nTokval, nToktype, nPos); 8108 if(nPos>=0) 8109 { 8110 if(nPos>=sArithBase.nCmdAllocated) return -1; 8111 if(szName!=NULL) sArithBase.sCmds[nPos].name = omStrDup(szName); 8112 else sArithBase.sCmds[nPos].name = NULL; 8113 sArithBase.sCmds[nPos].alias = nAlias; 8114 sArithBase.sCmds[nPos].tokval = nTokval; 8115 sArithBase.sCmds[nPos].toktype = nToktype; 8116 sArithBase.nCmdUsed++; 8117 //if(nTokval>0) sArithBase.nLastIdentifier++; 8118 } 8119 else 8120 { 8121 if(szName==NULL) return -1; 8122 int nIndex = iiArithFindCmd(szName); 8123 if(nIndex>=0) 8124 { 8125 Print("'%s' already exists at %d\n", szName, nIndex); 8126 return -1; 8127 } 8128 8129 if(sArithBase.nCmdUsed>=sArithBase.nCmdAllocated) 8130 { 8131 /* needs to create new slots */ 8132 unsigned long nSize = (sArithBase.nCmdAllocated+1)*sizeof(cmdnames); 8133 sArithBase.sCmds = (cmdnames *)omRealloc(sArithBase.sCmds, nSize); 8134 if(sArithBase.sCmds==NULL) return -1; 8135 sArithBase.nCmdAllocated++; 8136 } 8137 /* still free slots available */ 8138 sArithBase.sCmds[sArithBase.nCmdUsed].name = omStrDup(szName); 8139 sArithBase.sCmds[sArithBase.nCmdUsed].alias = nAlias; 8140 sArithBase.sCmds[sArithBase.nCmdUsed].tokval = nTokval; 8141 sArithBase.sCmds[sArithBase.nCmdUsed].toktype = nToktype; 8142 sArithBase.nCmdUsed++; 8143 8144 qsort(sArithBase.sCmds, sArithBase.nCmdUsed, sizeof(cmdnames), 8145 (&_gentable_sort_cmds)); 8146 for(sArithBase.nLastIdentifier=sArithBase.nCmdUsed-1; 8147 sArithBase.nLastIdentifier>0; sArithBase.nLastIdentifier--) 8148 { 8149 if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break; 8150 } 8151 //Print("L=%d\n", sArithBase.nLastIdentifier); 8152 } 8153 return 0; 8154 } 8155 -
Singular/iplib.cc
r224532 rb6e51b 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: iplib.cc,v 1.12 1 2006-08-10 12:52:21 Singular Exp $ */4 /* $Id: iplib.cc,v 1.122 2006-09-27 17:46:11 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: interpreter: LIB and help … … 36 36 #endif /* HAVE_LIBPARSER */ 37 37 #define NS_LRING (procstack->cRing) 38 39 extern int iiArithAddCmd(char *szName, short nAlias, short nTokval, 40 short nToktype, short nPos); 38 41 39 42 #include "mod_raw.h" … … 1085 1088 BOOLEAN pstatic, 1086 1089 BOOLEAN(*func)(leftv res, leftv v))); 1087 fktn_t fktn; 1090 typedef int (*fktn2_t)(SModulFunctions*); 1091 fktn2_t fktn; 1088 1092 idhdl pl; 1089 1093 char *plib = iiConvName(newlib); … … 1128 1132 else 1129 1133 { 1134 SModulFunctions sModulFunctions; 1135 1130 1136 #ifdef HAVE_NS 1131 1137 package s=currPack; 1132 1138 currPack=IDPACKAGE(pl); 1133 1139 #endif 1134 fktn = (fktn _t)dynl_sym(IDPACKAGE(pl)->handle, "mod_init");1140 fktn = (fktn2_t)dynl_sym(IDPACKAGE(pl)->handle, "mod_init"); 1135 1141 if( fktn!= NULL) 1136 1142 { 1137 if (autoexport) (*fktn)(iiAddCprocTop); 1138 else (*fktn)(iiAddCproc); 1143 sModulFunctions.iiArithAddCmd = iiArithAddCmd; 1144 if (autoexport) sModulFunctions.iiAddCproc = iiAddCprocTop; 1145 else sModulFunctions.iiAddCproc = iiAddCproc; 1146 (*fktn)(&sModulFunctions); 1139 1147 } 1140 1148 else Werror("mod_init: %s\n", dynl_error()); -
Singular/ipshell.cc
r224532 rb6e51b 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: ipshell.cc,v 1.14 2 2006-07-26 13:49:28Singular Exp $ */4 /* $Id: ipshell.cc,v 1.143 2006-09-27 17:46:11 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: … … 66 66 67 67 /*0 implementation*/ 68 69 char * Tok2Cmdname(int tok)70 {71 int i = 0;72 if (tok < 0)73 {74 return cmds[0].name;75 }76 if (tok==ANY_TYPE) return "any_type";77 if (tok==NONE) return "nothing";78 //if (tok==IFBREAK) return "if_break";79 //if (tok==VECTOR_FROM_POLYS) return "vector_from_polys";80 //if (tok==ORDER_VECTOR) return "ordering";81 //if (tok==REF_VAR) return "ref";82 //if (tok==OBJECT) return "object";83 //if (tok==PRINT_EXPR) return "print_expr";84 if (tok==IDHDL) return "identifier";85 while (cmds[i].tokval!=0)86 {87 if ((cmds[i].tokval == tok)&&(cmds[i].alias==0))88 {89 return cmds[i].name;90 }91 i++;92 }93 return cmds[0].name;94 }95 68 96 69 char * iiTwoOps(int t) -
Singular/tesths.cc
r224532 rb6e51b 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: tesths.cc,v 1.10 8 2006-09-21 17:00:39Singular Exp $ */4 /* $Id: tesths.cc,v 1.109 2006-09-27 17:46:12 Singular Exp $ */ 5 5 6 6 /* … … 37 37 #endif 38 38 39 extern int iiInitArithmetic(); 40 39 41 const char *singular_date=__DATE__ " " __TIME__; 40 42 … … 57 59 #ifdef GENTABLE 58 60 extern void ttGen1(); 59 extern void ttGen2 ();61 extern void ttGen2b(); 60 62 extern void ttGen4(); 61 63 extern void mpsr_ttGen(); // For initialization of (CMD, MP_COP) tables … … 63 65 ttGen4(); 64 66 ttGen1(); 65 ttGen2 ();67 ttGen2b(); 66 68 #else 67 69 // Don't worry: ifdef OM_NDEBUG, then all these calls are undef'ed … … 77 79 // do this first, because -v might print version path 78 80 feInitResources(argv[0]); 81 iiInitArithmetic(); 79 82 80 83 // parse command line options -
kernel/feread.cc
r224532 rb6e51b 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: feread.cc,v 1. 8 2006-07-18 11:25:05 brickenExp $ */4 /* $Id: feread.cc,v 1.9 2006-09-27 17:45:40 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: input from ttys, simulating fgets … … 49 49 char * (*fe_fgets_stdin)(char *pr,char *s, int size) 50 50 = fe_fgets_stdin_init; 51 52 extern char *iiArithGetCmd(int); 51 53 52 54 /* ===================================================================*/ … … 81 83 82 84 /* Return the next name which partially matches from the command list. */ 83 while ((name = cmds[list_index].name)!=NULL)85 while ((name = iiArithGetCmd(list_index))!=NULL) 84 86 { 85 87 list_index++; -
kernel/longalg.cc
r224532 rb6e51b 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: longalg.cc,v 1.1 6 2006-08-14 17:36:59Singular Exp $ */4 /* $Id: longalg.cc,v 1.17 2006-09-27 17:45:40 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: algebraic numbers … … 1353 1353 if ((zb!=NULL) && (zb->z!=NULL)) 1354 1354 { 1355 //if (zb->n!=NULL)1356 //{1357 // return TRUE;1358 //}1359 1355 return (nacGreaterZero(napGetCoeff(zb->z))||(!napIsConstant(zb->z))); 1360 1356 } -
modules/modgen/creat_top.cc
r224532 rb6e51b 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: creat_top.cc,v 1.2 4 2006-06-25 16:06:19 motsakExp $ */4 /* $Id: creat_top.cc,v 1.25 2006-09-27 17:46:27 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: lib parsing … … 122 122 fprintf(fp, "#line @d \"%s.cc\"\n", module->name); 123 123 fprintf(fp, "extern \"C\" {\n"); 124 #if 0 124 125 fprintf(fp, "int mod_init(\n int (*iiAddCproc)("); 125 126 #if 1 … … 128 129 #endif 129 130 fprintf(fp, ")\n )\n{\n"); 131 #else 132 fprintf(fp, "int mod_init(\n SModulFunctions* psModulFunctions"); 133 fprintf(fp, "\n )\n{\n"); 134 #endif 130 135 fprintf(fp, " idhdl h;\n"); 131 136 fprintf(fp, " char * tempstr;\n"); -
modules/modgen/main.cc
r224532 rb6e51b 60 60 moddef module_def; 61 61 62 extern int iiInitArithmetic(); 62 63 int init_modgen( 63 64 moddefv module_def, … … 159 160 } 160 161 162 iiInitArithmetic(); 161 163 if(init_modgen(&module_def, argv[optind])) return 1; 162 164 init_type_conv(); -
modules/modgen/misc.cc
r224532 rb6e51b 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: misc.cc,v 1.2 5 2006-04-06 19:37:00 anneExp $ */4 /* $Id: misc.cc,v 1.26 2006-09-27 17:46:27 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: lib parsing … … 35 35 #endif 36 36 37 typedef struct { 38 unsigned long nCmdUsed; /**< number of commands used */ 39 unsigned long nCmdAllocated; /**< number of commands-slots allocated */ 40 unsigned long nLastIdentifier; 41 cmdnames *sCmds; /**< array of existing commands */ 42 43 #ifndef GENTABLE 44 struct sValCmd1 *psValCmd1; 45 struct sValCmd2 *psValCmd2; 46 struct sValCmd3 *psValCmd3; 47 struct sValCmdM *psValCmdM; 48 #endif /* GENTABLE */ 49 } SArithBase; 50 51 52 /*---------------------------------------------------------------------* 53 * File scope Variables (Variables share by several functions in 54 * the same file ) 55 * 56 *---------------------------------------------------------------------*/ 57 static SArithBase sArithBase; /**< Base entry for arithmetic */ 58 37 59 char *DYNAinclude[] = { 38 60 "", … … 54 76 #define SELF_CMD MAX_TOK+1 55 77 78 /*---------------------------------------------------------------------* 79 * Extern Functions declarations 80 * 81 *---------------------------------------------------------------------*/ 82 static int _gentable_sort_cmds(const void *a, const void *b); 83 extern int iiArithRemoveCmd(char *szName); 84 extern int iiArithAddCmd(char *szName, short nAlias, short nTokval, 85 short nToktype, short nPos=-1); 56 86 extern void enter_id(FILE *fp, idtyp t, char *name, char *value, 57 87 int lineno, char *file); … … 78 108 int an=1; 79 109 int i,v; 80 int en= LAST_IDENTIFIER;110 int en=sArithBase.nLastIdentifier; 81 111 82 112 if( strcmp(n, "SELF") == 0) { … … 92 122 } 93 123 94 loop124 for(an=0; an<sArithBase.nCmdUsed; ) 95 125 { 96 126 if(an>=en-1) 97 127 { 98 if (strcmp(n, cmds[an].name) == 0)128 if (strcmp(n, sArithBase.sCmds[an].name) == 0) 99 129 { 100 130 i=an; 101 131 break; 102 132 } 103 else if ( strcmp(n, cmds[en].name) == 0)133 else if ((an!=en) && (strcmp(n, sArithBase.sCmds[en].name) == 0)) 104 134 { 105 135 i=en; … … 112 142 } 113 143 i=(an+en)/2; 114 v=strcmp(n,cmds[i].name); 144 if (*n < *(sArithBase.sCmds[i].name)) 145 { 146 en=i-1; 147 } 148 else if (*n > *(sArithBase.sCmds[i].name)) 149 { 150 an=i+1; 151 } 152 else 153 { 154 v=strcmp(n,sArithBase.sCmds[i].name); 115 155 if(v<0) 116 156 { 117 en=i;157 en=i-1; 118 158 } 119 159 else if(v>0) 120 160 { 121 an=i;161 an=i+1; 122 162 } 123 163 else /*v==0*/ … … 126 166 } 127 167 } 128 lastreserved=cmds[i].name; 129 tok=cmds[i].tokval; 130 if(cmds[i].alias==2) 131 { 168 } 169 lastreserved=sArithBase.sCmds[i].name; 170 tok=sArithBase.sCmds[i].tokval; 171 if(sArithBase.sCmds[i].alias==2) 172 { 132 173 if(trace)printf("outdated identifier `%s` used - please change your code", 133 cmds[i].name); 134 cmds[i].alias=1; 135 } 136 #if 0 137 if (!expected_parms) 138 { 139 switch (tok) 140 { 141 case IDEAL_CMD: 142 case INT_CMD: 143 case INTVEC_CMD: 144 case MAP_CMD: 145 case MATRIX_CMD: 146 case MODUL_CMD: 147 case POLY_CMD: 148 case PROC_CMD: 149 case RING_CMD: 150 case STRING_CMD: 151 cmdtok = tok; 152 break; 153 } 154 } 155 #endif 174 sArithBase.sCmds[i].name); 175 sArithBase.sCmds[i].alias=1; 176 } 177 156 178 logx("IsCmd: [%d] %s\n", tok, n); 157 179 158 if( ( cmds[i].toktype==ROOT_DECL) ||159 ( cmds[i].toktype==ROOT_DECL_LIST) ||160 ( cmds[i].toktype==RING_DECL) ||161 ( cmds[i].toktype==IDEAL_CMD) ||162 ( cmds[i].toktype==INTMAT_CMD) ||163 ( cmds[i].toktype==MODUL_CMD) ||164 ( cmds[i].toktype==MATRIX_CMD))// ||165 // ((c mds[i].toktype>=DRING_CMD) && (cmds[i].toktype<=VECTOR_CMD)))166 return cmds[i].toktype;180 if( (sArithBase.sCmds[i].toktype==ROOT_DECL) || 181 (sArithBase.sCmds[i].toktype==ROOT_DECL_LIST) || 182 (sArithBase.sCmds[i].toktype==RING_DECL) || 183 (sArithBase.sCmds[i].toktype==IDEAL_CMD) || 184 (sArithBase.sCmds[i].toktype==INTMAT_CMD) || 185 (sArithBase.sCmds[i].toktype==MODUL_CMD) || 186 (sArithBase.sCmds[i].toktype==MATRIX_CMD))// || 187 // ((csArithBase.sCds[i].toktype>=DRING_CMD) && (cmds[i].toktype<=VECTOR_CMD))) 188 return sArithBase.sCmds[i].toktype; 167 189 return 0; 168 190 } 191 169 192 170 193 char * decl2str(int n, char *name) … … 434 457 printf("->%s, %s\n", module->procs[proccnt].procname, 435 458 module->procs[proccnt].funcname); 436 fprintf(module->modfp, " iiAddCproc(\"%s\",\"%s\",%s, mod_%s);\n",459 fprintf(module->modfp, " psModulFunctions->iiAddCproc(\"%s\",\"%s\",%s, mod_%s);\n", 437 460 module->name, module->procs[proccnt].procname, 438 461 module->procs[proccnt].is_static ? "TRUE" : "FALSE", … … 616 639 617 640 /*========================================================================*/ 641 /*---------------------------------------------------------------------*/ 642 /** 643 * @brief compares to entry of cmdsname-list 644 645 @param[in] a 646 @param[in] b 647 648 @return <ReturnValue> 649 **/ 650 /*---------------------------------------------------------------------*/ 651 static int _gentable_sort_cmds( 652 const void *a, 653 const void *b 654 ) 655 { 656 cmdnames *pCmdL = (cmdnames*)a; 657 cmdnames *pCmdR = (cmdnames*)b; 658 659 if(a==NULL || b==NULL) return 0; 660 661 /* empty entries goes to the end of the list for later reuse */ 662 if(pCmdL->name==NULL) return 1; 663 if(pCmdR->name==NULL) return -1; 664 665 /* $INVALID$ must come first */ 666 if(strcmp(pCmdL->name, "$INVALID$")==0) return -1; 667 if(strcmp(pCmdR->name, "$INVALID$")==0) return 1; 668 669 /* tokval=-1 are reserved names at the end */ 670 if( (pCmdL->tokval==-1) && pCmdR->tokval==-1) 671 return strcmp(pCmdL->name, pCmdR->name); 672 673 /* pCmdL->tokval==-1, pCmdL goes at the end */ 674 if(pCmdL->tokval==-1) return 1; 675 /* pCmdR->tokval==-1, pCmdR goes at the end */ 676 if(pCmdR->tokval==-1) return -1; 677 678 return strcmp(pCmdL->name, pCmdR->name); 679 } 680 681 /*---------------------------------------------------------------------*/ 682 /** 683 * @brief initialisation of arithmetic structured data 684 685 @retval 0 on success 686 687 **/ 688 /*---------------------------------------------------------------------*/ 689 int iiInitArithmetic() 690 { 691 int i; 692 //printf("iiInitArithmetic()\n"); 693 #ifndef GENTABLE 694 memset(&sArithBase, 0, sizeof(sArithBase)); 695 iiInitCmdName(); 696 /* fix last-identifier */ 697 #endif /* !GENTABLE */ 698 } 699 700 int iiArithFindCmd(const char *szName) 701 { 702 int an=0; 703 int i = 0,v = 0; 704 #ifndef GENTABLE 705 int en=sArithBase.nLastIdentifier; 706 707 for(an=0; an<sArithBase.nCmdUsed; ) { 708 if(an>=en-1) { 709 if (strcmp(szName, sArithBase.sCmds[an].name) == 0) { 710 //Print("RET-an=%d %s\n", an, sArithBase.sCmds[an].name); 711 return an; 712 } else if (strcmp(szName, sArithBase.sCmds[en].name) == 0) 713 { 714 //Print("RET-en=%d %s\n", en, sArithBase.sCmds[en].name); 715 return en; 716 } 717 else 718 { 719 //Print("RET- 1\n"); 720 return -1; 721 } 722 } 723 i=(an+en)/2; 724 if (*szName < *(sArithBase.sCmds[i].name)) { 725 en=i-1; 726 } 727 else if (*szName > *(sArithBase.sCmds[i].name)) 728 { 729 an=i+1; 730 } 731 else 732 { 733 v=strcmp(szName,sArithBase.sCmds[i].name); 734 if(v<0) 735 { 736 en=i-1; 737 } 738 else if(v>0) 739 { 740 an=i+1; 741 } 742 else /*v==0*/ 743 { 744 //Print("RET-i=%d %s\n", i, sArithBase.sCmds[i].name); 745 return i; 746 } 747 } 748 } 749 //if(i>=0 && i<sArithBase.nCmdUsed) 750 // return i; 751 //Print("RET-2\n"); 752 return -2; 753 #else 754 return 0; 755 #endif 756 } 757 758 int iiArithAddCmd( 759 char *szName, 760 short nAlias, 761 short nTokval, 762 short nToktype, 763 short nPos 764 ) 765 { 766 //printf("AddCmd(%s, %d, %d, %d, %d)\n", szName, nAlias, 767 // nTokval, nToktype, nPos); 768 if(nPos>=0) { 769 if(nPos>=sArithBase.nCmdAllocated) return -1; 770 if(szName!=NULL) sArithBase.sCmds[nPos].name = strdup(szName); 771 else sArithBase.sCmds[nPos].name = NULL; 772 sArithBase.sCmds[nPos].alias = nAlias; 773 sArithBase.sCmds[nPos].tokval = nTokval; 774 sArithBase.sCmds[nPos].toktype = nToktype; 775 sArithBase.nCmdUsed++; 776 //if(nTokval>0) sArithBase.nLastIdentifier++; 777 } else { 778 if(szName==NULL) return -1; 779 int nIndex = iiArithFindCmd(szName); 780 if(nIndex>=0) { 781 printf("'%s' already exists at %d\n", szName, nIndex); 782 return -1; 783 } 784 785 if(sArithBase.nCmdUsed>=sArithBase.nCmdAllocated) { 786 /* needs to create new slots */ 787 unsigned long nSize = (sArithBase.nCmdAllocated+1)*sizeof(cmdnames); 788 sArithBase.sCmds = (cmdnames *)realloc(sArithBase.sCmds, nSize); 789 if(sArithBase.sCmds==NULL) return -1; 790 sArithBase.nCmdAllocated++; 791 } 792 /* still free slots available */ 793 sArithBase.sCmds[sArithBase.nCmdUsed].name = strdup(szName); 794 sArithBase.sCmds[sArithBase.nCmdUsed].alias = nAlias; 795 sArithBase.sCmds[sArithBase.nCmdUsed].tokval = nTokval; 796 sArithBase.sCmds[sArithBase.nCmdUsed].toktype = nToktype; 797 sArithBase.nCmdUsed++; 798 799 qsort(sArithBase.sCmds, sArithBase.nCmdUsed, sizeof(cmdnames), 800 (&_gentable_sort_cmds)); 801 for(sArithBase.nLastIdentifier=sArithBase.nCmdUsed-1; 802 sArithBase.nLastIdentifier>0; sArithBase.nLastIdentifier--) { 803 if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break; 804 } 805 //Print("L=%d\n", sArithBase.nLastIdentifier); 806 } 807 return 0; 808 } 809 -
modules/modgen/proc.cc
r224532 rb6e51b 1 1 /* 2 * $Id: proc.cc,v 1.2 5 2006-06-25 16:19:16 motsakExp $2 * $Id: proc.cc,v 1.26 2006-09-27 17:46:28 Singular Exp $ 3 3 */ 4 4 … … 53 53 /* write call to add procname to list */ 54 54 fprintf(module->modfp, 55 " iiAddCproc(currPack->libname,\"%s\",%s, mod_%s);\n",55 " psModulFunctions->iiAddCproc(currPack->libname,\"%s\",%s, mod_%s);\n", 56 56 proc->procname, 57 57 proc->is_static ? "TRUE" : "FALSE", … … 524 524 /*========================================================================*/ 525 525 void write_help( 526 moddefv module,526 moddefv pModule, 527 527 procdefv pi 528 528 ) … … 530 530 unsigned int i; 531 531 if(pi->help_string!=NULL) { 532 fprintf( module->fmtfp2, "#line %d \"%s\"\n", pi->lineno_other,533 module->filename);534 fprintf( module->fmtfp2, " enter_id(\"%s_help\",", pi->procname);535 fprintf( module->fmtfp2, " \"");532 fprintf(pModule->fmtfp2, "#line %d \"%s\"\n", pi->lineno_other, 533 pModule->filename); 534 fprintf(pModule->fmtfp2, " enter_id(\"%s_help\",", pi->procname); 535 fprintf(pModule->fmtfp2, " \""); 536 536 for(i=0; i<strlen(pi->help_string); i++) { 537 if(pi->help_string[i]=='\n') fprintf( module->fmtfp2,"\\n");538 else fprintf( module->fmtfp2,"%c", pi->help_string[i]);539 } 540 fprintf( module->fmtfp2, "\", STRING_CMD);\n\n", pi->help_string);537 if(pi->help_string[i]=='\n') fprintf(pModule->fmtfp2,"\\n"); 538 else fprintf(pModule->fmtfp2,"%c", pi->help_string[i]); 539 } 540 fprintf(pModule->fmtfp2, "\", STRING_CMD);\n\n", pi->help_string); 541 541 } 542 542 } -
modules/modgen/scanner.cc
r224532 rb6e51b 3 3 4 4 /* Scanner skeleton version: 5 * $Header: /exports/cvsroot-2/cvsroot/modules/modgen/scanner.cc,v 1. 2 2006-06-23 15:41:38 Singular Exp $5 * $Header: /exports/cvsroot-2/cvsroot/modules/modgen/scanner.cc,v 1.3 2006-09-27 17:46:28 Singular Exp $ 6 6 */ 7 7 … … 703 703 * Computer Algebra System SINGULAR * 704 704 ****************************************/ 705 /* $Id: scanner.cc,v 1. 2 2006-06-23 15:41:38 Singular Exp $ */705 /* $Id: scanner.cc,v 1.3 2006-09-27 17:46:28 Singular Exp $ */ 706 706 #include <stdio.h> 707 707 #include <string.h>
Note: See TracChangeset
for help on using the changeset viewer.