Changeset ea986d in git
- Timestamp:
- Mar 27, 1997, 9:26:06 PM (27 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- a6815bc36646e83a9fa1fd030f6cedf55e4441b5
- Parents:
- 34ab5de9eb181b0ef28b8bbee6004e8363496a04
- Location:
- Singular
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/subexpr.cc
r34ab5de rea986d 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 static char rcsid[] = "$Header: /exports/cvsroot-2/cvsroot/Singular/subexpr.cc,v 1. 8 1997-03-27 12:42:50 SingularExp $";4 static char rcsid[] = "$Header: /exports/cvsroot-2/cvsroot/Singular/subexpr.cc,v 1.9 1997-03-27 20:26:03 obachman Exp $"; 5 5 /* $Log: not supported by cvs2svn $ 6 // Revision 1.8 1997/03/27 12:42:50 Singular 7 // * hannes: added rString, sleftv->String for RING_CMD, QRING_CMD, 8 // string(ring), string(qring) in iparith.cc 9 // TEST_OPT_PROT for hilbert driven std 10 // 6 11 // Revision 1.7 1997/03/26 17:07:27 Singular 7 12 // * hannes/wichmann: added fglm … … 318 323 case VCOLMAX: 319 324 case VTIMER: 325 #ifdef HAVE_RTIMER 326 case VRTIMER: 327 #endif 320 328 case VOICE: 321 329 case VMAXDEG: … … 352 360 case VCOLMAX: 353 361 case VTIMER: 362 #ifdef HAVE_RTIMER 363 case VRTIMER: 364 #endif 354 365 case VOICE: 355 366 case VMAXDEG: … … 708 719 case VCOLMAX: 709 720 case VTIMER: 721 #ifdef HAVE_RTIMER 722 case VRTIMER: 723 #endif 710 724 case VOICE: 711 725 case VMAXDEG: … … 816 830 case VCOLMAX: return (void *)colmax; 817 831 case VTIMER: return (void *)getTimer(); 832 #ifdef HAVE_RTIMER 833 case VRTIMER: return (void *)getRTimer(); 834 #endif 818 835 case VOICE: return (void *)(myynest+1); 819 836 case VMAXDEG: return (void *)Kstd1_deg; -
Singular/tesths.cc
r34ab5de rea986d 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 static char rcsid[] = "$Id: tesths.cc,v 1. 3 1997-03-26 17:07:28 SingularExp $";4 static char rcsid[] = "$Id: tesths.cc,v 1.4 1997-03-27 20:26:04 obachman Exp $"; 5 5 /* 6 6 * ABSTRACT - initialize SINGULARs components, run Script and start SHELL … … 27 27 #include "version.h" 28 28 #include "silink.h" 29 #include "timer.h" 29 30 30 31 /*0 implementation*/ … … 56 57 for (;(argc > 1) && (!feBatch); --argc, ++argv) 57 58 { 58 if ((argv[1][0] != '-') ||(argv[1][1] == '-')) 59 break; 60 for (i=1;argv[1][i]!='\0';i++) 59 if (strcmp(argv[1], "-m") == 0) 61 60 { 62 switch (argv[1][i]) 63 { 64 case 'V': 65 case 'v':{ 66 printf("Singular %s%c %s(%d) %s %s\n", 67 S_VERSION1,(VERSION%10)+'a',S_VERSION2, 68 S_SUBVERSION,__DATE__,__TIME__); 69 printf("with "); 61 { 62 if (argc > 2) 63 { 64 char* ptr = NULL; 65 double mintime = strtod(argv[2], &ptr); 66 if (errno != ERANGE && ptr != argv[2]) 67 { 68 argc--; 69 argv++; 70 SetMinDisplayTime(mintime); 71 } 72 else 73 printf("Can not convert %s to a float\n", argv[2]); 74 } 75 else 76 { 77 printf("Need a float to set mintime"); 78 } 79 } 80 } 81 else if (strcmp(argv[1], "-d") == 0) 82 { 83 if (argc > 2) 84 { 85 char* ptr = NULL; 86 long res = strtol(argv[2], &ptr, 10); 87 if (errno != ERANGE && ptr != argv[2]) 88 { 89 argc--; 90 argv++; 91 SetTimerResolution(res); 92 } 93 else 94 printf("Can not convert %s to an integer\n", argv[2]); 95 } 96 else 97 { 98 printf("Need an integer to set timer resolution"); 99 } 100 } 101 else 102 { 103 104 if ((argv[1][0] != '-') ||(argv[1][1] == '-')) 105 break; 106 for (i=1;argv[1][i]!='\0';i++) 107 { 108 switch (argv[1][i]) 109 { 110 case 'V': 111 case 'v':{ 112 printf("Singular %s%c %s(%d) %s %s\n", 113 S_VERSION1,(VERSION%10)+'a',S_VERSION2, 114 S_SUBVERSION,__DATE__,__TIME__); 115 printf("with "); 70 116 #ifdef HAVE_LIBFACTORY 71 117 printf("factory,"); 72 118 #endif 73 119 #ifdef HAVE_LIBFACTORY 74 120 printf("fac(p),"); 75 121 #endif 76 122 #ifdef SRING 77 123 printf("super algebra,"); 78 124 #endif 79 125 #ifdef DRING 80 126 printf("Weyl algebra,"); 81 127 #endif 82 128 #ifdef HAVE_GMP 83 129 printf("GMP,"); 84 130 #endif 85 131 #ifdef HAVE_DBM 86 132 printf("DBM,"); 87 133 #endif 88 134 #ifdef HAVE_MPSR 89 135 printf("MP,"); 90 136 #endif 91 137 #ifdef HAVE_READLINE 92 138 printf("RL,"); 93 139 #endif 94 140 #ifdef HAVE_FEREAD 95 141 printf("SRL,"); 96 142 #endif 97 143 #ifdef TEST 98 144 printf("TESTs,"); 99 145 #endif 100 146 #if YYDEBUG 101 147 printf("YYDEBUG,"); 102 148 #endif 103 149 #ifdef MDEBUG 104 150 printf("MDEBUG=%d,",MDEBUG); 105 151 #endif 106 152 #ifndef __OPTIMIZE__ 107 108 #endif 109 153 printf("-g,"); 154 #endif 155 printf("random=%d\n",siRandomStart); 110 156 #ifdef MSDOS 111 112 #else 113 114 #endif 115 116 117 118 119 120 121 case 'e': if ((argv[1][i+1]>'0') && (argv[1][i+1]<='9'))122 123 124 125 126 127 128 case 'r': siRandomStart = 0;129 130 131 132 133 157 char *p=getenv("SPATH"); 158 #else 159 char *p=getenv("SingularPath"); 160 #endif 161 if (p!=NULL) 162 printf("search path:%s\n\n",p); 163 else 164 printf("standard search path:/usr/local/Singular\n\n"); 165 break; 166 } 167 case 'e': if ((argv[1][i+1]>'0') && (argv[1][i+1]<='9')) 168 { 169 i++; 170 si_echo = (int)(argv[1][i] - '0'); 171 } 172 else si_echo = 2; 173 break; 174 case 'r': siRandomStart = 0; 175 while((argv[1][i+1]>='0') && (argv[1][i+1]<='9')) 176 { 177 i++; 178 siRandomStart = siRandomStart*10+(int)(argv[1][i] - '0'); 179 } 134 180 #ifdef buildin_rand 135 136 #else 137 138 #endif 139 140 case 'x': tclmode=TRUE;141 181 siSeed=siRandomStart; 182 #else 183 srand((unsigned int)siRandomStart); 184 #endif 185 break; 186 case 'x': tclmode=TRUE; 187 break; 142 188 #ifdef HAVE_MPSR 143 case 'b': feBatch=TRUE; 144 #endif 145 case 'q': verbose &= ~(Sy_bit(0)|Sy_bit(V_LOAD_LIB)); 146 break; 147 case 't': 148 #ifdef HAVE_FEREAD 149 fe_use_fgets=TRUE; 150 #endif 151 break; 152 default : printf("Unknown option -%c\n",argv[1][i]); 153 printf("Usage: %s [-bteqvx] [file]\n",thisfile); 154 exit(1); 189 case 'b': feBatch=TRUE; 190 #endif 191 case 'q': verbose &= ~(Sy_bit(0)|Sy_bit(V_LOAD_LIB)); 192 break; 193 case 't': 194 #ifdef HAVE_FEREAD 195 fe_use_fgets=TRUE; 196 #endif 197 break; 198 default : printf("Unknown option -%c\n",argv[1][i]); 199 printf("Usage: %s [-bteqvx] [file]\n",thisfile); 200 exit(1); 201 } 155 202 } 156 203 } 157 204 } 205 158 206 159 207 /*. say hello */ -
Singular/timer.cc
r34ab5de rea986d 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 static char rcsid[] = "$Id: timer.cc,v 1. 2 1997-03-24 14:26:05 SingularExp $";4 static char rcsid[] = "$Id: timer.cc,v 1.3 1997-03-27 20:26:04 obachman Exp $"; 5 5 /* 6 6 * ABSTRACT - get the computing time 7 7 */ 8 9 #include "mod2.h" 8 10 9 11 //the mpw timer is quite the same as the dos timer: … … 13 15 14 16 int timerv = 0; 17 #ifdef TIME_SEC 18 static double timer_resolution = 1.0; 19 #else 20 static double timer_resolution = 10.0; 21 #endif 22 23 static double mintime = 0.5; 24 25 void SetTimerResolution(int res) 26 { 27 timer_resolution = (double) res; 28 } 29 30 void SetMinDisplayTime(double mtime) 31 { 32 mintime = mtime; 33 } 34 15 35 16 36 #ifndef MSDOS … … 43 63 #endif 44 64 45 #include "mod2.h"46 65 #include "timer.h" 47 66 #include "febase.h" 48 #define HALF_SEC 3049 67 /*3 50 68 * the start time of the timer … … 83 101 curr = t_rec.tms_utime - siStartTime; 84 102 85 #ifdef TIME_SEC 86 double f = ((double)curr)/ (double)HZ; 103 double f = ((double)curr) * timer_resolution / (double)HZ; 87 104 return (int)(f+0.5); 88 #else89 return (int)curr;90 #endif91 105 } 92 106 93 107 /*2 94 108 * stops timer, writes string s and the time since last call of startTimer 95 * if this time is > 0.5sec109 * if this time is > mintime sec 96 110 */ 97 111 void writeTime(void* v) … … 101 115 times(&t_rec); 102 116 curr = t_rec.tms_utime - startl; 103 if (curr < (clock_t)HALF_SEC) return; 104 105 double f = ((double)curr)/ (double)HZ; 106 Print("//%s %.2f sec\n" ,v ,f); 107 } 117 118 double f = ((double)curr) / (double)HZ; 119 if (f > mintime) 120 Print("//%s %.2f sec\n" ,v ,f); 121 } 122 123 #ifdef HAVE_RTIMER 124 #include <sys/time.h> 125 /*0 Real timer implementation*/ 126 int rtimerv = 0; 127 static struct timeval startRl; 128 static struct timeval siStartRTime; 129 static struct timezone tzp; 130 void initRTimer() 131 { 132 gettimeofday(&startRl, &tzp); 133 } 134 135 void startRTimer() 136 { 137 gettimeofday(&siStartRTime, &tzp); 138 } 139 140 /*2 141 * returns the time since a fixed point in resolutions 142 */ 143 int getRTimer() 144 { 145 struct timeval now; 146 147 gettimeofday(&now, &tzp); 148 149 if (startRl.tv_usec > now.tv_usec) 150 { 151 now.tv_usec += 1000000; 152 now.tv_sec --; 153 } 154 155 double f =((double) (now.tv_sec - startRl.tv_sec))*timer_resolution + 156 ((double) (now.tv_usec - startRl.tv_usec))*timer_resolution / 157 (double) 1000000; 158 159 return (int)(f+0.5); 160 } 161 162 /*2 163 * stops timer, writes string s and the time since last call of startTimer 164 * if this time is > mintime 165 */ 166 void writeRTime(void* v) 167 { 168 struct timeval now; 169 170 gettimeofday(&now, &tzp); 171 172 if (siStartRTime.tv_usec > now.tv_usec) 173 { 174 now.tv_usec += 1000000; 175 now.tv_sec --; 176 } 177 178 double f =((double) (now.tv_sec - siStartRTime.tv_sec)) + 179 ((double) (now.tv_usec - siStartRTime.tv_usec)) / 180 (double) 1000000; 181 182 if (f > mintime) 183 Print("//%s %.2f sec \n" ,v ,f); 184 } 185 #endif 186 108 187 #else 109 188 … … 147 226 { 148 227 clock_t curr = clock() - siStartTime; 149 #ifdef TIME_SEC 150 double f = ((double)curr)/ (double)CLOCKS_PER_SEC; 228 double f = ((double)curr)*timer_resolution/ (double)CLOCKS_PER_SEC; 151 229 return (int)(f+0.5); 152 #else153 return (int)curr;154 #endif155 230 } 156 231 /*2 … … 161 236 { 162 237 clock_t curr = clock() - startl; 163 if (curr < (clock_t)CLOCKS_PER_SEC) return;164 165 238 double f = ((double)curr) / CLOCKS_PER_SEC; 166 Print("//%s %.1f sec\n" ,v ,f); 167 } 168 #endif 239 if (f > mintime) 240 Print("//%s %.1f sec\n" ,v ,f); 241 } 242 #endif -
Singular/timer.h
r34ab5de rea986d 7 7 * ABSTRACT 8 8 */ 9 /* $Id: timer.h,v 1. 2 1997-03-24 14:26:05 SingularExp $ */9 /* $Id: timer.h,v 1.3 1997-03-27 20:26:05 obachman Exp $ */ 10 10 11 11 extern int timerv; … … 14 14 15 15 int initTimer(); 16 int getTimer(); /* unit: sec */ 16 int getTimer(); 17 18 #ifdef HAVE_RTIMER 19 extern int rtimerv; 20 void startRTimer(void); 21 void writeRTime(void* s); 22 23 void initRTimer(); 24 int getRTimer(); 17 25 #endif 18 26 27 void SetTimerResolution(int res); 28 void SetMinDisplayTime(double mtime); 29 30 #endif 31 -
Singular/tok.h
r34ab5de rea986d 7 7 * ABSTRACT 8 8 */ 9 /* $Id: tok.h,v 1. 3 1997-03-26 17:07:29 SingularExp $ */9 /* $Id: tok.h,v 1.4 1997-03-27 20:26:06 obachman Exp $ */ 10 10 11 11 #ifndef MYYSTYPE … … 62 62 EXTGCD_CMD, 63 63 FAC_CMD, 64 FIND_CMD, 64 65 FACSTD_CMD, 65 66 FGLM_CMD, 66 FIND_CMD,67 67 GCD_CMD, 68 68 INSERT_CMD, … … 110 110 VCOLMAX, 111 111 VTIMER, 112 #ifdef HAVE_RTIMER 113 VRTIMER, 114 #endif 112 115 TRACE, 113 116 VOICE,
Note: See TracChangeset
for help on using the changeset viewer.