Changeset e08f69 in git
- Timestamp:
- Aug 25, 1999, 5:26:02 PM (25 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- abcc453829974f82c44759593b2abe1da573a348
- Parents:
- 2762d8f63b36cec5598227c07c50ae666e0dcd1a
- Location:
- Singular
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/Makefile.in
r2762d8f re08f69 67 67 CXXSOURCES=grammar.cc scanner.cc algmap.cc attrib.cc binom.cc clapconv.cc \ 68 68 clapmem.cc clapsing.cc claptmpl.cc cntrlc.cc \ 69 extra.cc febase.cc feread.cc fehelp.cc feResource.cc \69 extra.cc febase.cc feread.cc fehelp.cc feResource.cc feCmdLineOptions.cc\ 70 70 ffields.cc hdegree.cc hilb.cc hutil.cc \ 71 71 ideals.cc intvec.cc iparith.cc \ … … 246 246 ${LEX} -I -Pyylp -olibparse.cc libparse.l 247 247 248 ESingular: feResource.cc mod2.h feCmdLineOptions.cc version.h emacs.cc 249 ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${DEFS} -o ESingular emacs.cc 250 248 251 src: scanner.cc grammar.h grammar.cc libparse.cc spSpolyLoop.inc 249 252 … … 269 272 install: all installbin installslib 270 273 271 installbin: Singular libparse 274 installbin: Singular libparse ESingular 272 275 ${MKINSTALLDIRS} ${bindir} 273 276 ${INSTALL_PROGRAM} Singular ${bindir}/Singular-${SINGULAR_VERSION} 274 277 ${INSTALL_PROGRAM} libparse ${bindir}/libparse 278 ${INSTALL_PROGRAM} ESingular ${bindir}/ESingular 275 279 chmod a+x ${bindir}/Singular-${SINGULAR_VERSION} 276 280 rm -f ${bindir}/Singular … … 323 327 echo "#define SINGULAR_VERSION_ID " `date '+%y%m%d%H'` >version.h 324 328 echo "#define MAKE_DISTRIBUTION " >> version.h 325 ${MAKE} Singular 326 strip Singular 329 ${MAKE} Singular ESingular 330 strip Singular ESingular 327 331 ${INSTALL} -s Singular Singular-bindist 332 ${INSTALL} -s ESingular ESingular-bindist 328 333 echo "#define SINGULAR_VERSION_ID " `date '+%y%m%d%H'` >version.h 329 334 … … 331 336 echo "#define SINGULAR_VERSION_ID " `date '+%y%m%d%H'` >version.h 332 337 echo "#define MAKE_DISTRIBUTION " >> version.h 333 ${MAKE} Singular-static 334 strip Singular-static 338 ${MAKE} Singular-static ESingular 339 strip Singular-static ESingular 335 340 mv Singular-static Singular-static-bindist 341 ${INSTALL} -s ESingular ESingular-bindist 336 342 echo "#define SINGULAR_VERSION_ID " `date '+%y%m%d%H'` >version.h 337 343 -
Singular/feResource.cc
r2762d8f re08f69 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: feResource.cc,v 1. 7 1999-08-16 15:09:47obachman Exp $ */4 /* $Id: feResource.cc,v 1.8 1999-08-25 15:26:02 obachman Exp $ */ 5 5 /* 6 6 * ABSTRACT: management of resources … … 10 10 11 11 #include "mod2.h" 12 #include "version.h" 13 #ifndef ESINGULAR 12 14 #include "mmemory.h" 13 15 #include "febase.h" 14 #include "version.h" 16 extern "C" char* find_executable(const char* argv0); 17 #endif 15 18 16 19 // define RESOURCE_DEBUG for chattering about resource management … … 73 76 {"ManualUrl", 'u', feResUrl, "SINGULAR_URL", "http://www.mathematik.uni-kl.de/~zca/Singular/Manual/"S_VERSION1, ""}, 74 77 {"EmacsDir", 'e', feResDir, "SINGULAR_EMACS_DIR", "%r/emacs", ""}, 75 #if !defined( WINNT) && ! defined(macintosh)78 #if !defined(macintosh) 76 79 {"netscape", 'N', feResBinary,"NETSCAPE", "%b/netscape", ""}, 77 80 {"info", 'I', feResBinary,"INFO", "%b/info", ""}, … … 79 82 {"xterm", 'X', feResBinary,"XTERM", "%b/xterm", ""}, 80 83 {"Path", 'p', feResPath, NULL, "%b;$PATH", ""}, 81 #endif // !defined(WINNT) && ! defined(macintosh) 84 #endif // ! defined(macintosh) 85 86 #ifdef ESINGULAR 87 {"emacs", 'E', feResBinary, "EMACS", "%b/emacs", ""}, 88 {"SingularEmacs", 'M', feResBinary, "SINGULAR_EMACS", "%b/Singular", ""}, 89 {"EmacsLoad",'l', feResFile, "SINGULAR_EMACS_LOAD", "%e/.singular-emacs", ""}, 90 #endif 82 91 {NULL, 0, feResUndef, NULL, NULL, NULL}, // must be the last record 83 92 }; … … 104 113 static feResourceConfig feGetResourceConfig(const char* key); 105 114 static char* feResource(feResourceConfig config, int warn); 115 static char* feResourceDefault(feResourceConfig config); 106 116 static char* feInitResource(feResourceConfig config, int warn); 107 117 static char* feGetExpandedExecutable(); … … 112 122 static void mystrcpy(char* d, char* s); 113 123 static char* feSprintf(char* s, const char* fmt, int warn = -1); 114 extern "C" char* find_executable(const char* argv0);115 124 #if defined(WINNT) && defined(__GNUC__) 116 125 // utility function of Cygwin32: … … 123 132 * 124 133 *****************************************************************/ 125 char* feResource(const char id, int warn )134 char* feResource(const char id, int warn = -1) 126 135 { 127 136 return feResource(feGetResourceConfig(id), warn); 128 137 } 129 138 130 char* feResource(const char* key, int warn )139 char* feResource(const char* key, int warn = -1) 131 140 { 132 141 return feResource(feGetResourceConfig(key), warn); 142 } 143 144 char* feResourceDefault(const char id) 145 { 146 return feResourceDefault(feGetResourceConfig(id)); 147 } 148 149 char* feResourceDefault(const char* key) 150 { 151 return feResourceDefault(feGetResourceConfig(key)); 133 152 } 134 153 … … 218 237 } 219 238 239 static char* feResourceDefault(feResourceConfig config) 240 { 241 char* value = (char*) AllocL(MAXRESOURCELEN); 242 feSprintf(value, config->fmt, -1); 243 return value; 244 } 245 220 246 static char* feInitResource(feResourceConfig config, int warn) 221 247 { … … 322 348 if (warn > 0 || (warn < 0 && config->value != NULL)) 323 349 { 324 Warn("Could not get %s. ", config->key);325 Warn("Either set environment variable %s to the location of %s ",350 Warn("Could not get %s. ", config->key); 351 Warn("Either set environment variable %s to the location of %s ", 326 352 config->env, config->key); 327 353 feSprintf(value, config->fmt, warn); … … 661 687 } 662 688 663 void feStringAppendResources(int warn )689 void feStringAppendResources(int warn = -1) 664 690 { 665 691 int i = 0; -
Singular/find_exec.c
r2762d8f re08f69 19 19 #include <strings.h> 20 20 21 #ifndef ESINGULAR 21 22 #include "mmemory.h" 23 #endif 24 22 25 23 26 #ifndef MAXPATHLEN -
Singular/tesths.cc
r2762d8f re08f69 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: tesths.cc,v 1.6 8 1999-08-13 11:21:44 SingularExp $ */4 /* $Id: tesths.cc,v 1.69 1999-08-25 15:26:02 obachman Exp $ */ 5 5 6 6 /* … … 31 31 #include <factory.h> 32 32 #endif 33 #include "getopt.h" 34 35 // define the long option names here 36 #define LON_BATCH "batch" 37 #define LON_BROWSER "browser" 38 #define LON_EXECUTE "execute" 39 #define LON_EMACS "emacs" 40 #define LON_ECHO "echo" 41 #define LON_HELP "help" 42 #define LON_RANDOM "random" 43 #define LON_QUIET "quiet" 44 #define LON_NO_TTY "no-tty" 45 #define LON_USER_OPTION "user-option" 46 #define LON_VERSION "verbose" 47 #define LON_MIN_TIME "min-time" 48 #define LON_NO_STDLIB "no-stdlib" 49 #define LON_NO_RC "no-rc" 50 #define LON_TICKS_PER_SEC "ticks-per-sec" 51 #define LON_TCLMODE "tclmode" 52 #define LON_MP_PORT "MPport" 53 #define LON_MP_HOST "MPhost" 54 #define LON_NO_WARN "no-warn" 55 #define LON_NO_OUT "no-out" 56 #define LON_SDB "sdb" 57 // undocumented options 58 #ifdef HAVE_MPSR 59 #define LON_MP_TRANSP "MPtransp" 60 #define LON_MP_MODE "MPmode" 61 #endif 62 63 #define LONG_OPTION_RETURN 13 64 static struct option longopts[] = 65 { 66 #ifdef HAVE_MPSR 67 {LON_BATCH, 0, 0, 'b'}, 68 #endif 69 {LON_EXECUTE, 1, 0, 'c'}, 70 {LON_SDB, 0, 0, 'd'}, 71 {LON_ECHO, 2, 0, 'e'}, 72 {LON_HELP, 0, 0, 'h'}, 73 {LON_QUIET, 0, 0, 'q'}, 74 {LON_RANDOM, 1, 0, 'r'}, 75 {LON_NO_TTY, 0, 0, 't'}, 76 {LON_USER_OPTION, 1, 0, 'u'}, 77 {LON_VERSION, 0, 0, 'v'}, 78 #ifdef HAVE_TCL 79 {LON_TCLMODE, 0, 0, 'x'}, 80 #endif 81 {LON_BROWSER, 1, 0, LONG_OPTION_RETURN}, 82 {LON_NO_STDLIB, 0, 0, LONG_OPTION_RETURN}, 83 {LON_NO_RC, 0, 0, LONG_OPTION_RETURN}, 84 {LON_NO_WARN, 0, 0, LONG_OPTION_RETURN}, 85 {LON_NO_OUT, 0, 0, LONG_OPTION_RETURN}, 86 {LON_MIN_TIME, 1, 0, LONG_OPTION_RETURN}, 87 #ifdef HAVE_MPSR 88 {LON_MP_PORT, 1, 0, LONG_OPTION_RETURN}, 89 {LON_MP_HOST, 1, 0, LONG_OPTION_RETURN}, 90 #endif 91 {LON_TICKS_PER_SEC, 1, 0, LONG_OPTION_RETURN}, 92 // undocumented options 93 {LON_EMACS, 0, 0, LONG_OPTION_RETURN}, 94 #ifdef HAVE_MPSR 95 {LON_MP_TRANSP, 1, 0, LONG_OPTION_RETURN}, 96 {LON_MP_MODE, 1, 0, LONG_OPTION_RETURN}, 97 #endif 98 // terminator 99 { 0, 0, 0, 0 } 100 }; 101 // #define SHORT_OPTS_STRING "bc:e::hqr:tu:v" 102 #define SHORT_OPTS_STRING "bdhqtvxec:r:u:" 103 104 struct sing_option 105 { 106 const char* name; // as in option 107 108 const char* arg_name;// name of argument, if has_arg > 0 109 const char* help; // (short) help string 110 char* val; // (default) value of option: 0: not set 1:set 111 // string:"" if has_arg > 0 112 }; 113 114 // mention only documented options here 115 // or let help string start with // then option is like undocumented 116 static struct sing_option sing_longopts[] = 117 { 118 #ifdef HAVE_MPSR 119 {LON_BATCH, 0, "Run in MP batch mode", 0}, 120 #endif 121 {LON_BROWSER, "BROWSER", "Display help in BROWSER ([x,tk]info, netscape)", ""}, 122 {LON_HELP, 0, "Print help message and exit", 0}, 123 {LON_QUIET, 0, "Do not print start-up banner and library load messages", 0}, 124 {LON_SDB, 0, "Enable sdb debugger (experimental)", 0}, 125 {LON_NO_TTY, 0, "Do not redefine the terminal characteristics", 0}, 126 {LON_VERSION, 0, "Print extended version and configuration info", 0}, 127 #ifdef HAVE_TCL 128 {LON_TCLMODE, 0, "Run in TCL mode, i.e., with TCL user interface", 0}, 129 #endif 130 {LON_ECHO, "VAL", "Set value of variable `echo' to (integer) VAL", ""}, 131 {LON_EXECUTE, "STRING", "Execute STRING on start-up", ""}, 132 {LON_RANDOM, "SEED", "Seed random generator with integer (integer) SEED", ""}, 133 {LON_USER_OPTION, "STRING", "Return STRING on `system(\"--user-option\")'", ""}, 134 {LON_NO_STDLIB, 0, "Do not load `standard.lib' on start-up", 0}, 135 {LON_NO_RC, 0, "Do not execute `.singularrc' file on start-up", 0}, 136 {LON_NO_WARN, 0, "Do not display warning messages", 0}, 137 {LON_NO_OUT, 0, "Suppress all output", 0}, 138 {LON_MIN_TIME, "SECS", "Do not display times smaller than SECS (in seconds)", "0.5"}, 139 #ifdef HAVE_MPSR 140 {LON_MP_PORT, "PORT", "Use PORT number for MP conections", ""}, 141 {LON_MP_HOST, "HOST", "Use HOST for MP connections", ""}, 142 #endif 143 {LON_TICKS_PER_SEC, "TICKS", "Sets unit of timer to TICKS per second", "1"}, 144 // option whose help should not clutter up the normal help stuff 145 {LON_EMACS, 0, "// Support singular-emacs mode", 0}, 146 { 0, 0, 0, 0 } 147 }; 148 149 static struct sing_option* mainGetSingOption(const char* name) 150 { 151 int i = 0; 152 while (sing_longopts[i].name != 0) 153 { 154 if (strcmp(name, sing_longopts[i].name) == 0) 155 return &(sing_longopts[i]); 156 i++; 157 } 158 return NULL; 159 } 160 161 void mainSetSingOptionValue(const char* name, char* value) 162 { 163 sing_option* sopt = mainGetSingOption(name); 164 if (sopt != NULL) 165 { 166 sopt->val = value; 167 } 168 } 169 170 char* mainGetSingOptionValue(const char* name) 171 { 172 sing_option* sopt = mainGetSingOption(name); 173 if (sopt!=NULL) 174 return sopt->val; 175 return NULL; 176 } 177 178 179 // Prints help message 180 static void mainHelp(const char* name) 181 { 182 int i = 0; 183 struct sing_option *sopt; 184 char tmp[20]; 185 186 printf("Singular version %s -- a CAS for polynomial computations. Usage:\n", S_VERSION1); 187 printf(" %s [options] [file1 [file2 ...]]\n", name); 188 printf("Options:\n"); 189 190 while (longopts[i].name != 0) 191 { 192 sopt = mainGetSingOption(longopts[i].name); 193 if (sopt != NULL && sopt->help != NULL 194 #ifdef NDEBUG 195 && *(sopt->help) != '/' 196 #endif 197 ) 198 { 199 if (longopts[i].has_arg > 0) 200 { 201 if (longopts[i].has_arg > 1) 202 sprintf(tmp, "%s[=%s]", longopts[i].name, sopt->arg_name); 203 else 204 sprintf(tmp, "%s=%s", longopts[i].name, sopt->arg_name); 205 206 printf(" %c%c --%-19s %s\n", 207 (longopts[i].val != 0 ? '-' : ' '), 208 (longopts[i].val != 0 ? longopts[i].val : ' '), 209 tmp, 210 sopt->help); 211 } 212 else 213 { 214 printf(" %c%c --%-19s %s\n", 215 (longopts[i].val != 0 ? '-' : ' '), 216 (longopts[i].val != 0 ? longopts[i].val : ' '), 217 longopts[i].name, 218 sopt->help); 219 } 220 } 221 #ifndef NDEBUG 222 else 223 printf("--%s Undocumented\n", longopts[i].name); 224 #endif 225 i++; 226 } 227 228 printf("\nFor more information, type `help;' from within Singular or visit\n"); 229 printf("http://www.mathematik.uni-kl.de/~zca/Singular or consult the\n"); 230 printf("Singular manual (available as on-line info or printed manual).\n"); 231 } 232 233 // Prints usage message 234 static void mainUsage(char* argv0) 235 { 236 printf("Use `%s --help' for a complete list of options\n", argv0); 237 } 238 239 #ifndef NDEBUG 240 void mainOptionValues() 241 { 242 int i = 0; 243 struct sing_option *sopt; 244 245 while (longopts[i].name != 0) 246 { 247 sopt = mainGetSingOption(longopts[i].name); 248 if (sopt != NULL) 249 { 250 if (sopt->val == NULL || sopt->val == (char*) 1) 251 Print("// --%-10s %d\n", sopt->name, sopt->val); 252 else 253 Print("// --%-10s %s\n", sopt->name, sopt->val); 254 } 255 else 256 Print("// --%s Undocumented \n", longopts[i].name); 257 i++; 258 } 259 } 260 #endif // NDEBUG 261 262 BOOLEAN mainGetSingOptionValue(const char* name, char** val) 263 { 264 sing_option* sopt = mainGetSingOption(name); 265 if (sopt == NULL) 266 { 267 *val = NULL; 268 return FALSE; 269 } 270 else 271 { 272 *val = sopt->val; 273 return TRUE; 274 } 275 } 276 33 34 #include "feCmdLineOptions.cc" 277 35 /*0 implementation*/ 278 36 int main( /* main entry to Singular */
Note: See TracChangeset
for help on using the changeset viewer.