Changeset 085370c in git


Ignore:
Timestamp:
Mar 11, 1998, 5:11:28 PM (26 years ago)
Author:
Jens Schmidt <schmidt@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
0e083a79e79fdba1836c125232887812195dd9b8
Parents:
d636adca8e47219c329f1d05ef6a4b1712a88b48
Message:
***** merge from branch `factory-gcd' to main trunk


git-svn-id: file:///usr/local/Singular/svn/trunk@1209 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
factory
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • factory/fex/runfex

    rd636ad r085370c  
    11#! /home/schmidt/bin/bash
    2 # $Id: runfex,v 1.5 1998-02-02 11:00:54 schmidt Exp $
    3 
    4 #{{{ docu
    5 #
    6 # runfxc - 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.
    77#
    88#}}}
     
    130130# $1: options how to print data
    131131# $2: default width to print data
     132# $3: name of example/collection
     133# $4: note on example/collection
    132134#
    133135# Global variables used:
     
    139141    typeset \
    140142        options="$1" \
     143        name="$3" \
     144        note="$4" \
    141145        colWidth
    142146
     
    149153    while [ -n "$options" ]; do
    150154        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/}" ;;
    151165            (*p*) echo "$algChar"
    152166                 options="${options//p/}" ;;
     
    338352        if [ -n "$debugMode" ]; then
    339353            echo "skipping $exampleName"
    340         else
    341             warn "skipping $exampleName"
    342354        fi
    343355        return
     
    423435
    424436        # print table
    425         printData "$algorithmTBOptions" "$TBColWidth"
     437        printData "$algorithmTBOptions" "$TBColWidth" "$exampleName" "$exampleNote"
    426438    }
    427439    #}}}
     
    435447#
    436448# runROOptions: options for RO table.  Read from commandline.
    437 # runNote: comment on run.  Read from commandline.
    438449# rawCollectionName: collection name with full path
    439450#
     
    445456#}}}
    446457typeset runROOptions=""
    447 typeset runNote=""
    448458typeset rawCollectionName=""
    449459
     
    451461# read options
    452462typeset opt
    453 while getopts "n:a:c:C:t:r:d" opt; do
     463while getopts "a:c:C:t:r:d" opt; do
    454464    case "$opt" in
    455         (n)  runNote="$OPTARG" ;;
    456465        (a)  runOptions="$runOptions -a$OPTARG" ;;
    457466        (c)  runOptions="$runOptions -c$OPTARG" ;;
     
    518527        options="${options//tcrd/}"
    519528
    520         printData "$options" "$ROColWidth"
     529        printData "$options" "$ROColWidth" "$collectionName" "$collectionNote"
    521530    }
    522531fi
  • factory/ftest/ChangeLog

    rd636ad r085370c  
     1Wed 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
     40Fri 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
     46Thu 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
    153Mon Feb  2 11:59:36 1998  Jens Schmidt  <schmidt@mathematik.uni-kl.de>
    254
    355        * runfex (runConfiguration): new global variable.  `runfex'
    456          supports different configurations.
     57
     58Fri 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.
    570
    671Thu Jan 22 10:46:03 1998  Jens Schmidt  <schmidt@mathematik.uni-kl.de>
  • factory/ftest/ftest_io.cc

    rd636ad r085370c  
    11/* emacs edit mode for this file is -*- C++ -*- */
    2 /* $Id: ftest_io.cc,v 1.10 1997-11-21 13:59:07 schmidt Exp $ */
     2/* $Id: ftest_io.cc,v 1.11 1998-03-11 16:10:54 schmidt Exp $ */
    33
    44//{{{ docu
     
    141141//}}}
    142142
     143//{{{ bool ftestGetbool ( const char * stringBool )
     144//{{{ docu
     145//
     146// ftestGetbool() - read an boolean from stringBool,
     147//   return it.
     148//
     149//}}}
     150bool
     151ftestGetbool ( 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
    143183//{{{ void ftestPrintResult ( const char * resultName, const CanonicalForm & result )
    144184//{{{ docu
  • factory/ftest/ftest_io.h

    rd636ad r085370c  
    11/* 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 $ */
    33
    44#ifndef INCL_FTEST_IO_H
     
    1616Variable ftestGetVariable ( const char * stringVariable );
    1717int ftestGetint ( const char * stringInt );
     18bool ftestGetbool ( const char * stringBool );
    1819
    1920void ftestPrintResult ( const char * resultName, const CanonicalForm & result );
  • factory/ftest/ftest_util.cc

    rd636ad r085370c  
    11/* emacs edit mode for this file is -*- C++ -*- */
    2 /* $Id: ftest_util.cc,v 1.14 1997-11-21 14:07:22 schmidt Exp $ */
     2/* $Id: ftest_util.cc,v 1.15 1998-03-11 16:11:06 schmidt Exp $ */
    33
    44//{{{ docu
     
    137137// - static functions.
    138138//
    139 
    140 //{{{ static const char * ftestSubStr( const char * subString, const char * string )
    141 //{{{ docu
    142 //
    143 // ftestSubStr() - check whether subString is a substring of string.
    144 //
    145 // If so, return index behind subString in string, otherwise
    146 // 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     else
    161         return string;
    162 }
    163 //}}}
    164139
    165140//{{{ static char * ftestConcatEnv ( char ** argv, int & optind )
     
    590565//}}}
    591566
    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//}}}
     575char *
     576ftestCutBlancs ( 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//}}}
     598const char *
     599ftestSubStr ( 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 ... )
    593615//{{{ docu
    594616//
     
    602624//}}}
    603625void
    604 ftestError ( const ftestErrorT errno, const char * format ... )
     626ftestError ( ftestErrorT errno, const char * format ... )
    605627{
    606628    // print error message
     
    617639
    618640    switch ( errno ) {
     641    case noError:
     642        return;
    619643    case CommandlineError:
    620644    case EnvSyntaxError:
     
    735759//}}}
    736760
    737 //{{{ void ftestGetOpts ( const int argc, char ** argv, int & optind )
     761//{{{ void ftestGetOpts ( int argc, char ** argv, int & optind )
    738762//{{{ docu
    739763//
     
    744768//}}}
    745769void
    746 ftestGetOpts ( const int argc, char ** argv, int & optind )
     770ftestGetOpts ( int argc, char ** argv, int & optind )
    747771{
    748772    // parse command line
     
    776800//}}}
    777801
    778 //{{{ void ftestGetEnv ( const int, char ** argv, int & optind )
     802//{{{ void ftestGetEnv ( int, char ** argv, int & optind )
    779803//{{{ docu
    780804//
     
    786810//}}}
    787811void
    788 ftestGetEnv ( const int, char ** argv, int & optind )
     812ftestGetEnv ( int, char ** argv, int & optind )
    789813{
    790814    // initialize environment
     
    804828//}}}
    805829
     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//}}}
     847bool
     848ftestSearchTaggedArg ( 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
    806889//{{{ void ftestWriteSeed ()
    807890//{{{ docu
     
    824907//}}}
    825908
    826 //{{{ void ftestPrintTimer ( const long timer )
     909//{{{ void ftestPrintTimer ( long timer )
    827910//{{{ docu
    828911//
     
    831914//}}}
    832915void
    833 ftestPrintTimer ( const long timer )
     916ftestPrintTimer ( long timer )
    834917{
    835918    if ( ftestPrintTimingFlag )
     
    838921//}}}
    839922
    840 //{{{ void ftestPrintCheck ( const ftestSatusT check )
     923//{{{ void ftestPrintCheck ( ftestSatusT check )
    841924//{{{ docu
    842925//
     
    845928//}}}
    846929void
    847 ftestPrintCheck ( const ftestStatusT check )
     930ftestPrintCheck ( ftestStatusT check )
    848931{
    849932    if ( ftestPrintCheckFlag ) {
  • factory/ftest/ftest_util.h

    rd636ad r085370c  
    11/* emacs edit mode for this file is -*- C++ -*- */
    2 /* $Id: ftest_util.h,v 1.11 1997-11-21 14:06:30 schmidt Exp $ */
     2/* $Id: ftest_util.h,v 1.12 1998-03-11 16:11:12 schmidt Exp $ */
    33
    44#ifndef INCL_FTEST_UTIL_H
     
    2020// enum ftestErrorT - FTE error types.
    2121//
    22 // Ok: no error (rarely used :-)
     22// noError: no error (rarely used :-)
    2323// CommandlineError: commandline syntax error
    2424// EnvSyntaxError: error in environment specification
     
    3232enum ftestErrorT
    3333{
    34     Ok, CommandlineError, EnvSyntaxError, FileError,
     34    noError, CommandlineError, EnvSyntaxError, FileError,
    3535    CanFormSpecError, CheckError,
    3636    SignalError, TimeoutError = SignalError + 14
     
    4646
    4747const char * ftestSkipBlancs ( const char * string );
    48 void ftestError ( const ftestErrorT errno, const char * format ... );
     48char * ftestCutBlancs ( char * string );
     49const char * ftestSubStr ( const char * subString, const char * string );
     50void ftestError ( ftestErrorT errno, const char * format ... );
    4951void ftestUsagePrint ( const char * additionalUsage = 0 );
    5052
     
    5355void ftestSetName ( const char * execName, const char * algorithmName, const char * usage );
    5456
    55 void ftestGetOpts ( const int argc, char ** argv, int & optind );
    56 void ftestGetEnv ( const int, char ** argv, int & optind );
     57void ftestGetOpts ( int argc, char ** argv, int & optind );
     58void ftestGetEnv ( int, char ** argv, int & optind );
     59bool ftestSearchTaggedArg ( int, char ** argv, int & optind, const char * optionTag );
    5760void ftestWriteSeed ();
    5861
    59 void ftestPrintTimer ( const long timer );
    60 void ftestPrintCheck ( const ftestStatusT check );
     62void ftestPrintTimer ( long timer );
     63void ftestPrintCheck ( ftestStatusT check );
    6164void ftestPrintEnv ();
    6265
  • factory/ftest/ftest_util.m4

    rd636ad r085370c  
    1 dnl $Id: ftest_util.m4,v 1.15 1998-02-19 15:10:07 schmidt Exp $
     1dnl $Id: ftest_util.m4,v 1.16 1998-03-11 16:11:17 schmidt Exp $
    22dnl
    33dnl ftest_util.m4 - m4 macros used by the factory test environment.
     
    110110
    111111#
     112# ftestDefaultInitializer() - return type dependent default
     113#   initializer.
     114#
     115# $1: type
     116#
     117define(`ftestDefaultInitializer', `dnl
     118ifelse(
     119  `$1', `int', `` = 0'',
     120  `$1', `bool', `` = false'',
     121  `')')
     122
     123#
    112124# ftestOutVar() - declare output variable.
    113125#
     
    115127# $2: name of output variable
    116128#
    117 # Stores type of variable in macro _ftestOutType_<name>.
    118 # Does some extra magic for int's to avoid warnings on
     129# Stores type of variable in macro _ftestOutType_<name>.  Does
     130# some extra magic for internal data types to avoid warnings on
    119131# uninitialized variables.
    120132#
    121133define(`ftestOutVar', `dnl
    122134define(`_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')')
    128136
    129137#
     
    137145# checks whether this variable has been set from commandline or
    138146# not.
    139 # Does some extra magic for int's to avoid warnings on
    140 # uninitialized variables.
     147# Does some extra magic for internal data types to avoid warnings
     148# on uninitialized variables.
    141149#
    142150define(`ftestInVar', `dnl
    143151define(`_ftestInType_'_qstripTWS(`$2'), `$1')dnl
    144 ifelse(`$1', `int',
    145   ``$1 '_qstripTWS(`$2')` = 0;'',
    146   ``$1 '_qstripTWS(`$2')`;'')`
     152`$1 '_qstripTWS(`$2')ftestDefaultInitializer(`$1')`;
    147153    bool ftestArgGiven$2= false'')
    148154
     
    163169    `ftestGetEnv( argc, argv, optind );
    164170
    165     ftestPrintEnv()'')
     171    ftestPrintEnv();
     172
     173'dnl')
    166174
    167175#
     
    170178# $1: name of input variable
    171179# $2: default for optional command line arguments
     180# $3: search for optional argument with this tag
    172181#
    173182# Before reading the argument, check whether it really exists.
     
    176185# more arguments, and there is no default specified, print an
    177186# 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#
    178194# In any case, save the fact whether the argument was given or
    179195# not in the variable ftestArgGiven<name>.
    180196#
    181197define(`ftestGetInVar', `dnl
    182 ifelse(`$#', `1',
     198ifelse(
     199  `$#', `1',
    183200  ``if ( argv[ optind ] ) {
    184201        ftestArgGiven$1= true;
     
    188205                    "expected '_stripTWS(`_ftestInType_$1')` at position %d in commandline\n",
    189206                    optind );'',
     207  `$#', `2',
    190208  ``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) ) {
    191214        ftestArgGiven$1 = true;
    192215        $1 = ftestGet'_stripTWS(`_ftestInType_$1')`( argv[ optind++ ] );
     
    215238define(`ftestRun', `dnl
    216239`#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
    218246    // most likely is going to change it
    219247    ftestWriteSeed();
     
    250278# internal auxiliary function
    251279define(`_ftestOutput', `dnl
    252 ifelse(`$#', `0', ,
     280ifelse(
     281  `$#', `0', ,
    253282  `$#', `1', ,
    254283``;
Note: See TracChangeset for help on using the changeset viewer.