Changeset 085370c in git
- Timestamp:
- Mar 11, 1998, 5:11:28 PM (25 years ago)
- Branches:
- (u'spielwiese', '91fdef05f09f54b8d58d92a472e9c4a43aa4656f')
- Children:
- 0e083a79e79fdba1836c125232887812195dd9b8
- Parents:
- d636adca8e47219c329f1d05ef6a4b1712a88b48
- Location:
- factory
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/fex/runfex
rd636ad r085370c 1 1 #! /home/schmidt/bin/bash 2 # $Id: runfex,v 1. 5 1998-02-02 11:00:54schmidt Exp $3 4 #{{{ docu 5 # 6 # runf xc- run factory example collection.2 # $Id: runfex,v 1.6 1998-03-11 16:11:28 schmidt Exp $ 3 4 #{{{ docu 5 # 6 # runfex - run factory example collection. 7 7 # 8 8 #}}} … … 130 130 # $1: options how to print data 131 131 # $2: default width to print data 132 # $3: name of example/collection 133 # $4: note on example/collection 132 134 # 133 135 # Global variables used: … … 139 141 typeset \ 140 142 options="$1" \ 143 name="$3" \ 144 note="$4" \ 141 145 colWidth 142 146 … … 149 153 while [ -n "$options" ]; do 150 154 case "$options" in 155 (*h*) 156 # do some pretty printing 157 if [ ${#name} -lt 7 ]; then 158 echo "$name: $note." 159 elif [ ${#name} -lt 15 ]; then 160 echo "$name: $note." 161 else 162 echo "$name: $note." 163 fi 164 options="${options//h/}" ;; 151 165 (*p*) echo "$algChar" 152 166 options="${options//p/}" ;; … … 338 352 if [ -n "$debugMode" ]; then 339 353 echo "skipping $exampleName" 340 else341 warn "skipping $exampleName"342 354 fi 343 355 return … … 423 435 424 436 # print table 425 printData "$algorithmTBOptions" "$TBColWidth" 437 printData "$algorithmTBOptions" "$TBColWidth" "$exampleName" "$exampleNote" 426 438 } 427 439 #}}} … … 435 447 # 436 448 # runROOptions: options for RO table. Read from commandline. 437 # runNote: comment on run. Read from commandline.438 449 # rawCollectionName: collection name with full path 439 450 # … … 445 456 #}}} 446 457 typeset runROOptions="" 447 typeset runNote=""448 458 typeset rawCollectionName="" 449 459 … … 451 461 # read options 452 462 typeset opt 453 while getopts " n:a:c:C:t:r:d" opt; do463 while getopts "a:c:C:t:r:d" opt; do 454 464 case "$opt" in 455 (n) runNote="$OPTARG" ;;456 465 (a) runOptions="$runOptions -a$OPTARG" ;; 457 466 (c) runOptions="$runOptions -c$OPTARG" ;; … … 518 527 options="${options//tcrd/}" 519 528 520 printData "$options" "$ROColWidth" 529 printData "$options" "$ROColWidth" "$collectionName" "$collectionNote" 521 530 } 522 531 fi -
factory/ftest/ChangeLog
rd636ad r085370c 1 Wed Feb 25 17:26:18 1998 Jens Schmidt <schmidt@mathematik.uni-kl.de> 2 3 * runfex (printData): arguments `$name' and `$note' re-added 4 which are printed on occurence of `h' in `$options'. All 5 callers changed. 6 7 * runfex (main): variable `$runNote' and corresponding commandline 8 option removed. 9 10 * gcd.fex (collection gcd): cosmetic changes 11 12 * gcd.fex (univ0RanA, univ0RanB, univ0CofactorSerialA, 13 univ0GCDSerialA): real results added 14 15 * gcd.fex (univ0CofactorSerialA): slightly modified 16 17 * ftest_util.m4 (ftestGetInVar): recognizes tagged arguments 18 19 * ftest_util.m4 (ftestGetEnv, _ftestOutput): cosmetic changes 20 21 * ftest_util.m4 (ftestRun): checks for end of commandline before 22 running algorithm 23 24 * ftest_util.m4 (ftestDefaultInitializer): new macro. 25 * ftest_util.m4 (ftestOutVar, ftestInVar): call 26 `ftestDefaultInitializer()' to write default initializer 27 28 * ftest_io.cc (ftestGetbool): new function. Declaration adapted. 29 30 * ftest_util.cc (ftestSearchTaggedArg, ftestCutBlancs): new 31 functions. Declarations adapted. 32 33 * ftest_util.cc (ftestSubStr): made external. Declaration 34 adapted. 35 36 * ftest_util.cc (ftestError, ftestGetOpts, ftestGetEnv, 37 ftestPrintTimer, ftestPrintEnv): superfluous `const' removed 38 from signature. Declarations adapted. 39 40 Fri Feb 20 18:29:40 1998 Jens Schmidt <schmidt@mathematik.uni-kl.de> 41 42 * ftest_util.cc (ftestError): returns on `errno' == `noError' 43 44 * ftest_util.h (ftestErrorT): `Ok' renamed to `noError' 45 46 Thu Feb 19 16:07:09 1998 Jens Schmidt <schmidt@mathematik.uni-kl.de> 47 48 * ftest_util.m4: `#line' preprocessor directives added to most of 49 the macros (that's cool, man!) 50 51 * ftest_util.m4 (ftestSetEnv): macro removed 52 1 53 Mon Feb 2 11:59:36 1998 Jens Schmidt <schmidt@mathematik.uni-kl.de> 2 54 3 55 * runfex (runConfiguration): new global variable. `runfex' 4 56 supports different configurations. 57 58 Fri Jan 30 15:11:23 1998 Jens Schmidt <schmidt@mathematik.uni-kl.de> 59 60 * gcd.fex (univ0CofactorSerialA, univ0GCDSerialA): new examples 61 62 * gcd.fex (univ0RanC, univ0RanD): examples removed 63 64 * runfex: (example): does not print `skipping example ...' 65 66 * runfex: cosmetic changes 67 68 * runfex: totally rewritten. Does not print html-code any longer, 69 only ASCII-information. 5 70 6 71 Thu Jan 22 10:46:03 1998 Jens Schmidt <schmidt@mathematik.uni-kl.de> -
factory/ftest/ftest_io.cc
rd636ad r085370c 1 1 /* emacs edit mode for this file is -*- C++ -*- */ 2 /* $Id: ftest_io.cc,v 1.1 0 1997-11-21 13:59:07schmidt Exp $ */2 /* $Id: ftest_io.cc,v 1.11 1998-03-11 16:10:54 schmidt Exp $ */ 3 3 4 4 //{{{ docu … … 141 141 //}}} 142 142 143 //{{{ bool ftestGetbool ( const char * stringBool ) 144 //{{{ docu 145 // 146 // ftestGetbool() - read an boolean from stringBool, 147 // return it. 148 // 149 //}}} 150 bool 151 ftestGetbool ( const char * stringBool ) 152 { 153 const char * tokenCursor; 154 155 bool b; 156 // skip blancs 157 stringBool = ftestSkipBlancs( stringBool ); 158 159 // look for "true" or "false" 160 tokenCursor = ftestSubStr( "true", stringBool ); 161 if ( stringBool != tokenCursor ) 162 b = true; 163 else { 164 tokenCursor = ftestSubStr( "false", stringBool ); 165 b = false; 166 } 167 168 // do error checks 169 if ( stringBool == tokenCursor ) 170 ftestError( CommandlineError, 171 "bool expected at `%s'\n", stringBool ); 172 173 // check for extra characters 174 stringBool = ftestSkipBlancs( tokenCursor ); 175 if ( *stringBool ) 176 ftestError( CommandlineError, 177 "extra characters after bool spec `%s'\n", stringBool ); 178 179 return b; 180 } 181 //}}} 182 143 183 //{{{ void ftestPrintResult ( const char * resultName, const CanonicalForm & result ) 144 184 //{{{ docu -
factory/ftest/ftest_io.h
rd636ad r085370c 1 1 /* emacs edit mode for this file is -*- C++ -*- */ 2 /* $Id: ftest_io.h,v 1. 5 1997-10-15 13:53:31 schmidt Exp $ */2 /* $Id: ftest_io.h,v 1.6 1998-03-11 16:11:01 schmidt Exp $ */ 3 3 4 4 #ifndef INCL_FTEST_IO_H … … 16 16 Variable ftestGetVariable ( const char * stringVariable ); 17 17 int ftestGetint ( const char * stringInt ); 18 bool ftestGetbool ( const char * stringBool ); 18 19 19 20 void ftestPrintResult ( const char * resultName, const CanonicalForm & result ); -
factory/ftest/ftest_util.cc
rd636ad r085370c 1 1 /* emacs edit mode for this file is -*- C++ -*- */ 2 /* $Id: ftest_util.cc,v 1.1 4 1997-11-21 14:07:22schmidt Exp $ */2 /* $Id: ftest_util.cc,v 1.15 1998-03-11 16:11:06 schmidt Exp $ */ 3 3 4 4 //{{{ docu … … 137 137 // - static functions. 138 138 // 139 140 //{{{ static const char * ftestSubStr( const char * subString, const char * string )141 //{{{ docu142 //143 // ftestSubStr() - check whether subString is a substring of string.144 //145 // If so, return index behind subString in string, otherwise146 // string.147 //148 //}}}149 static const char *150 ftestSubStr( const char * subString, const char * string )151 {152 const char * stringStart = string;153 154 while ( *subString && *subString == *string ) {155 subString++; string++;156 }157 158 if ( *subString )159 return stringStart;160 else161 return string;162 }163 //}}}164 139 165 140 //{{{ static char * ftestConcatEnv ( char ** argv, int & optind ) … … 590 565 //}}} 591 566 592 //{{{ void ftestError ( const ftestErrorT errno, const char * format ... ) 567 //{{{ char * ftestCutBlancs ( char * string ) 568 //{{{ docu 569 // 570 // ftestCutBlancs() - cut off all trailing blancs in `string'. 571 // 572 // Returns `string' unchanged. 573 // 574 //}}} 575 char * 576 ftestCutBlancs ( char * string ) 577 { 578 char * stringCursor = string + strlen( string ); 579 580 while ( (string != stringCursor) 581 && isspace( *(stringCursor-1) ) ) 582 stringCursor--; 583 584 *stringCursor = '\0'; 585 return string; 586 } 587 //}}} 588 589 //{{{ const char * ftestSubStr ( const char * subString, const char * string ) 590 //{{{ docu 591 // 592 // ftestSubStr() - check whether subString is a substring of string. 593 // 594 // If so, return index behind subString in string, otherwise 595 // string. 596 // 597 //}}} 598 const char * 599 ftestSubStr ( const char * subString, const char * string ) 600 { 601 const char * stringStart = string; 602 603 while ( *subString && *subString == *string ) { 604 subString++; string++; 605 } 606 607 if ( *subString ) 608 return stringStart; 609 else 610 return string; 611 } 612 //}}} 613 614 //{{{ void ftestError ( ftestErrorT errno, const char * format ... ) 593 615 //{{{ docu 594 616 // … … 602 624 //}}} 603 625 void 604 ftestError ( constftestErrorT errno, const char * format ... )626 ftestError ( ftestErrorT errno, const char * format ... ) 605 627 { 606 628 // print error message … … 617 639 618 640 switch ( errno ) { 641 case noError: 642 return; 619 643 case CommandlineError: 620 644 case EnvSyntaxError: … … 735 759 //}}} 736 760 737 //{{{ void ftestGetOpts ( constint argc, char ** argv, int & optind )761 //{{{ void ftestGetOpts ( int argc, char ** argv, int & optind ) 738 762 //{{{ docu 739 763 // … … 744 768 //}}} 745 769 void 746 ftestGetOpts ( constint argc, char ** argv, int & optind )770 ftestGetOpts ( int argc, char ** argv, int & optind ) 747 771 { 748 772 // parse command line … … 776 800 //}}} 777 801 778 //{{{ void ftestGetEnv ( constint, char ** argv, int & optind )802 //{{{ void ftestGetEnv ( int, char ** argv, int & optind ) 779 803 //{{{ docu 780 804 // … … 786 810 //}}} 787 811 void 788 ftestGetEnv ( constint, char ** argv, int & optind )812 ftestGetEnv ( int, char ** argv, int & optind ) 789 813 { 790 814 // initialize environment … … 804 828 //}}} 805 829 830 //{{{ bool ftestSearchTaggedArg ( int, char ** argv, int & optind, const char * optionTag ) 831 //{{{ docu 832 // 833 // ftestSearchTaggedArg() - search for tagged argument. 834 // 835 // If the current argument (`argv[ optind ]') is of the form 836 // `<tag>=<value>', where `<tag>' is a substring of 837 // `<optionTag>', the current argument is modified to point 838 // directly after the `=' sign and `true' is returned. 839 // 840 // Otherwise, `false' is returned. 841 // 842 // Note: There may be arbitrary white-space between the several 843 // tokens of the tagged argument, but the tokens must not span 844 // more than one argument. 845 // 846 //}}} 847 bool 848 ftestSearchTaggedArg ( int, char ** argv, int & optind, const char * optionTag ) 849 { 850 const char * tokenCursor; 851 const char * tokenString = argv[ optind ]; 852 int tokenLen; 853 854 // check for end of argument list 855 if ( ! tokenString ) 856 return false; 857 858 // skip leading blancs 859 tokenString = ftestSkipBlancs( tokenString ); 860 861 // check whether it is a tagged argument 862 tokenCursor = strchr( tokenString, '=' ); 863 if ( ! tokenCursor ) 864 return false; 865 tokenLen = tokenCursor - tokenString; 866 867 // isolate possible keyword 868 char * keyword = new char[ tokenLen+1 ]; 869 strncpy( keyword, tokenString, tokenLen ); 870 keyword[ tokenLen ] = '\0'; 871 ftestCutBlancs( keyword ); 872 873 // advance tokenString after `=' sign 874 tokenString = tokenCursor+1; 875 876 // check whether keyword is a substring of `optionTag' 877 tokenCursor = ftestSubStr( keyword, optionTag ); 878 if ( tokenCursor == optionTag ) { 879 // optionTag not found 880 delete [] keyword; 881 return false; 882 } else { 883 argv[ optind ] = (char *)tokenString; 884 return true; 885 } 886 } 887 //}}} 888 806 889 //{{{ void ftestWriteSeed () 807 890 //{{{ docu … … 824 907 //}}} 825 908 826 //{{{ void ftestPrintTimer ( constlong timer )909 //{{{ void ftestPrintTimer ( long timer ) 827 910 //{{{ docu 828 911 // … … 831 914 //}}} 832 915 void 833 ftestPrintTimer ( constlong timer )916 ftestPrintTimer ( long timer ) 834 917 { 835 918 if ( ftestPrintTimingFlag ) … … 838 921 //}}} 839 922 840 //{{{ void ftestPrintCheck ( constftestSatusT check )923 //{{{ void ftestPrintCheck ( ftestSatusT check ) 841 924 //{{{ docu 842 925 // … … 845 928 //}}} 846 929 void 847 ftestPrintCheck ( constftestStatusT check )930 ftestPrintCheck ( ftestStatusT check ) 848 931 { 849 932 if ( ftestPrintCheckFlag ) { -
factory/ftest/ftest_util.h
rd636ad r085370c 1 1 /* emacs edit mode for this file is -*- C++ -*- */ 2 /* $Id: ftest_util.h,v 1.1 1 1997-11-21 14:06:30schmidt Exp $ */2 /* $Id: ftest_util.h,v 1.12 1998-03-11 16:11:12 schmidt Exp $ */ 3 3 4 4 #ifndef INCL_FTEST_UTIL_H … … 20 20 // enum ftestErrorT - FTE error types. 21 21 // 22 // Ok: no error (rarely used :-)22 // noError: no error (rarely used :-) 23 23 // CommandlineError: commandline syntax error 24 24 // EnvSyntaxError: error in environment specification … … 32 32 enum ftestErrorT 33 33 { 34 Ok, CommandlineError, EnvSyntaxError, FileError,34 noError, CommandlineError, EnvSyntaxError, FileError, 35 35 CanFormSpecError, CheckError, 36 36 SignalError, TimeoutError = SignalError + 14 … … 46 46 47 47 const char * ftestSkipBlancs ( const char * string ); 48 void ftestError ( const ftestErrorT errno, const char * format ... ); 48 char * ftestCutBlancs ( char * string ); 49 const char * ftestSubStr ( const char * subString, const char * string ); 50 void ftestError ( ftestErrorT errno, const char * format ... ); 49 51 void ftestUsagePrint ( const char * additionalUsage = 0 ); 50 52 … … 53 55 void ftestSetName ( const char * execName, const char * algorithmName, const char * usage ); 54 56 55 void ftestGetOpts ( const int argc, char ** argv, int & optind ); 56 void ftestGetEnv ( const int, char ** argv, int & optind ); 57 void ftestGetOpts ( int argc, char ** argv, int & optind ); 58 void ftestGetEnv ( int, char ** argv, int & optind ); 59 bool ftestSearchTaggedArg ( int, char ** argv, int & optind, const char * optionTag ); 57 60 void ftestWriteSeed (); 58 61 59 void ftestPrintTimer ( constlong timer );60 void ftestPrintCheck ( constftestStatusT check );62 void ftestPrintTimer ( long timer ); 63 void ftestPrintCheck ( ftestStatusT check ); 61 64 void ftestPrintEnv (); 62 65 -
factory/ftest/ftest_util.m4
rd636ad r085370c 1 dnl $Id: ftest_util.m4,v 1.1 5 1998-02-19 15:10:07 schmidt Exp $1 dnl $Id: ftest_util.m4,v 1.16 1998-03-11 16:11:17 schmidt Exp $ 2 2 dnl 3 3 dnl ftest_util.m4 - m4 macros used by the factory test environment. … … 110 110 111 111 # 112 # ftestDefaultInitializer() - return type dependent default 113 # initializer. 114 # 115 # $1: type 116 # 117 define(`ftestDefaultInitializer', `dnl 118 ifelse( 119 `$1', `int', `` = 0'', 120 `$1', `bool', `` = false'', 121 `')') 122 123 # 112 124 # ftestOutVar() - declare output variable. 113 125 # … … 115 127 # $2: name of output variable 116 128 # 117 # Stores type of variable in macro _ftestOutType_<name>. 118 # Does some extra magic for int's to avoid warnings on129 # Stores type of variable in macro _ftestOutType_<name>. Does 130 # some extra magic for internal data types to avoid warnings on 119 131 # uninitialized variables. 120 132 # 121 133 define(`ftestOutVar', `dnl 122 134 define(`_ftestOutType_'_qstripTWS(`$2'), `$1')dnl 123 ifelse(`$1', `int', 124 ``$1 '_qstripTWS(`$2')` = 0'', 125 `$1', `bool', 126 ``$1 '_qstripTWS(`$2')` = false'', 127 ``$1 '_qstripTWS(`$2')')') 135 `$1 '_qstripTWS(`$2')ftestDefaultInitializer(`$1')') 128 136 129 137 # … … 137 145 # checks whether this variable has been set from commandline or 138 146 # not. 139 # Does some extra magic for int 's to avoid warnings on140 # uninitialized variables.147 # Does some extra magic for internal data types to avoid warnings 148 # on uninitialized variables. 141 149 # 142 150 define(`ftestInVar', `dnl 143 151 define(`_ftestInType_'_qstripTWS(`$2'), `$1')dnl 144 ifelse(`$1', `int', 145 ``$1 '_qstripTWS(`$2')` = 0;'', 146 ``$1 '_qstripTWS(`$2')`;'')` 152 `$1 '_qstripTWS(`$2')ftestDefaultInitializer(`$1')`; 147 153 bool ftestArgGiven$2= false'') 148 154 … … 163 169 `ftestGetEnv( argc, argv, optind ); 164 170 165 ftestPrintEnv()'') 171 ftestPrintEnv(); 172 173 'dnl') 166 174 167 175 # … … 170 178 # $1: name of input variable 171 179 # $2: default for optional command line arguments 180 # $3: search for optional argument with this tag 172 181 # 173 182 # Before reading the argument, check whether it really exists. … … 176 185 # more arguments, and there is no default specified, print an 177 186 # error. If there is a default value, use it instead. 187 # 188 # If optional third argument is given, call 189 # `ftestSearchTaggedArg()' to check whether there is a tagged 190 # optional argument `<tag> = <value>' where `<tag>' is a 191 # substring of `$3'. Use `<value>' as value for the input 192 # variable in this case, `$2' otherwise. 193 # 178 194 # In any case, save the fact whether the argument was given or 179 195 # not in the variable ftestArgGiven<name>. 180 196 # 181 197 define(`ftestGetInVar', `dnl 182 ifelse(`$#', `1', 198 ifelse( 199 `$#', `1', 183 200 ``if ( argv[ optind ] ) { 184 201 ftestArgGiven$1= true; … … 188 205 "expected '_stripTWS(`_ftestInType_$1')` at position %d in commandline\n", 189 206 optind );'', 207 `$#', `2', 190 208 ``if ( argv[ optind ] ) { 209 ftestArgGiven$1 = true; 210 $1 = ftestGet'_stripTWS(`_ftestInType_$1')`( argv[ optind++ ] ); 211 } else 212 $1 = '_qstripTWS(`$2')`;'', 213 ``if ( ftestSearchTaggedArg( argc, argv, optind, $3) ) { 191 214 ftestArgGiven$1 = true; 192 215 $1 = ftestGet'_stripTWS(`_ftestInType_$1')`( argv[ optind++ ] ); … … 215 238 define(`ftestRun', `dnl 216 239 `#line' __line__ "__file__" 217 `// save random generator seed now since the algorithm 240 `// check for superfluous command line arguments 241 if ( argv[ optind ] ) 242 ftestError( CommandlineError, "superfluous argument `%s' at position %d", 243 argv[ optind ], optind ); 244 245 // save random generator seed now since the algorithm 218 246 // most likely is going to change it 219 247 ftestWriteSeed(); … … 250 278 # internal auxiliary function 251 279 define(`_ftestOutput', `dnl 252 ifelse(`$#', `0', , 280 ifelse( 281 `$#', `0', , 253 282 `$#', `1', , 254 283 ``;
Note: See TracChangeset
for help on using the changeset viewer.