Changeset 70433b5 in git


Ignore:
Timestamp:
Oct 25, 1999, 8:21:53 PM (24 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
Children:
3ce7b66ce4f4c6aa1846f4edb90839c950a9c891
Parents:
fc7421d294f85b2020c01c2d1fd1603f1ebf4cb8
Message:
* hannes: ring.cc/ipshell.cc: fixed rSetHdl(NULL)
          feResource.cc febase.h mmbt.c: introduced flag feRes_okay
	     -> feGetRessource can now be used


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

Legend:

Unmodified
Added
Removed
  • Singular/Makefile.in

    rfc7421 r70433b5  
    426426CXXFLAGSP       = -pg -O3 ${PIPE}
    427427CXXTEMPLFLAGSP  = -fno-implicit-templates
    428 DEFSP           = -DNDEBUG -DDO_PROFILE -D@SING_UNAME@
     428DEFSP           = -DNDEBUG -DDO_PROFILE -D@SING_UNAME@ @DEFS@
    429429LDFLAGSP        = -static @LDFLAGS@
    430430
     
    432432CXXFLAGSB       = -g -O3 ${PIPE}
    433433CXXTEMPLFLAGSB  = -fno-implicit-templates
    434 DEFSB           = -D@SING_UNAME@ -DNDEBUG
     434DEFSB           = -D@SING_UNAME@ -DNDEBUG @DEFS@
    435435LDFLAGSB        = -static @LDFLAGS@
    436436
     
    438438BPROFOBJ        = /usr/local/lib/bmon.o
    439439
    440 DEFST           = -DNDEBUG -D@SING_UNAME@ -DMTRACK
    441 LDFLAGST        = -static @LDFLAGS@
     440DEFST           = -DNDEBUG -D@SING_UNAME@ -DMTRACK @DEFS@
     441LDFLAGST        = @LDFLAGS@
    442442CFLAGST         = -g  -w ${PIPE}
    443443CXXFLAGST       = -g  -w ${PIPE}
  • Singular/feResource.cc

    rfc7421 r70433b5  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: feResource.cc,v 1.14 1999-10-22 12:15:07 obachman Exp $ */
     4/* $Id: feResource.cc,v 1.15 1999-10-25 18:21:50 Singular Exp $ */
    55/*
    66* ABSTRACT: management of resources
     
    2121
    2222#if defined(MAKE_DISTRIBUTION)
    23 #if defined(WINNT) 
     23#if defined(WINNT)
    2424#define SINGULAR_DEFAULT_DIR "/Singular/"S_VERSION1
    2525#elif defined(macintosh)
     
    2727#else // unix
    2828#define SINGULAR_DEFAULT_DIR "/usr/local/Singular/"S_VERSION1
    29 #endif 
     29#endif
    3030#else // ! defined(MAKE_DISTRIBUTION)
    3131#define SINGULAR_DEFAULT_DIR S_ROOT_DIR
    32 #endif // defined(MAKE_DISTRIBUTION) 
     32#endif // defined(MAKE_DISTRIBUTION)
    3333
    3434/*****************************************************************
     
    4646  char*           env;   // env variable to look for
    4747  char*           fmt;   // format string -- see below for epxlaination
    48   char*                        value; // what it was set to 
     48  char*                        value; // what it was set to
    4949} feResourceConfig_s;
    5050typedef feResourceConfig_s * feResourceConfig;
    5151
    52 // feSprintf transforms format strings as follows format string: 
     52// feSprintf transforms format strings as follows format string:
    5353// 1.) substrings of the form %c (c being a letter) are replaced by respective resource value
    5454// 2.) substrings of the form $string are replaced by value of resp. env variable
     
    5757// 1.) '/' characters are replaced by respective directory - separators
    5858// 2.) ';' characters are replaced by respective path separators
    59 static feResourceConfig_s feResourceConfigs[20] = 
    60 {
    61   {"SearchPath",    's',     feResPath,  NULL,         
     59static feResourceConfig_s feResourceConfigs[20] =
     60{
     61  {"SearchPath",    's',     feResPath,  NULL,
    6262   "$SINGULARPATH;"
    6363   "%b/LIB;"
     
    8383  {"Path",      'p',    feResPath,  NULL,                   "%b;$PATH",         ""},
    8484#endif // ! defined(macintosh)
    85  
     85
    8686#ifdef ESINGULAR
    8787  {"emacs",    'E',    feResBinary, "EMACS",               "%b/emacs",              ""},
     
    9898 *
    9999 *****************************************************************/
    100 char* feArgv0;
     100char* feArgv0=NULL;
    101101#define MAXRESOURCELEN 5*MAXPATHLEN
    102 char fePathSep =
     102
     103#ifdef MTRACK
     104BOOLEAN feRes_works=FALSE;
     105#endif
     106
     107char fePathSep =
    103108#if defined(WINNT)
    104109';'
     
    172177  // don't complain about stuff when initializing SingularPath
    173178  feResource('s',0);
    174  
    175  
    176  
     179
    177180#ifdef HAVE_SETENV
    178181  char* path = feResource('p');
     
    181184#endif
    182185  if (path != NULL) setenv("PATH", path, 1);
     186#endif
     187#ifdef MTRACK
     188  feRes_works=TRUE;
    183189#endif
    184190}
     
    261267  if (config->env != NULL)
    262268  {
    263     char* evalue = getenv(config->env); 
     269    char* evalue = getenv(config->env);
    264270    if (evalue != NULL)
    265     { 
     271    {
    266272#ifdef RESOURCE_DEBUG
    267273      printf("feInitResource: Found value from env:%s\n", evalue);
     
    270276      if (config->type == feResBinary  // do not verify binaries
    271277          ||
    272           feVerifyResourceValue(config->type, 
     278          feVerifyResourceValue(config->type,
    273279                                feCleanResourceValue(config->type, value)))
    274280      {
     
    281287    }
    282288  }
    283  
     289
    284290  *value = '\0';
    285291  // Special treatment of executable
     
    287293  {
    288294    char* executable = feGetExpandedExecutable();
    289     if (executable != NULL) 
     295    if (executable != NULL)
    290296    {
    291297      strcpy(value, executable);
     
    307313    }
    308314  }
    309  
     315
    310316  if (*value == '\0' && config->fmt != NULL )
    311317  {
     
    320326
    321327  // Clean and verify
    322   if (feVerifyResourceValue(config->type, 
     328  if (feVerifyResourceValue(config->type,
    323329                            feCleanResourceValue(config->type, value)))
    324330  {
     
    337343      strcpy(value, executable);
    338344      FreeL(executable);
    339       if (feVerifyResourceValue(config->type, 
     345      if (feVerifyResourceValue(config->type,
    340346                                feCleanResourceValue(config->type, value)))
    341347      {
     
    349355  }
    350356
    351   // issue warning if explicitely requested, or if 
     357  // issue warning if explicitely requested, or if
    352358  // this value is gotten for the first time
    353359  if (warn > 0 || (warn < 0 && config->value != NULL))
    354360  {
    355361    Warn("Could not get %s. ", config->key);
    356     Warn("Either set environment variable %s to %s,", 
     362    Warn("Either set environment variable %s to %s,",
    357363         config->env, config->key);
    358364    feSprintf(value, config->fmt, warn);
     
    405411#endif
    406412}
    407  
    408      
     413
     414
    409415static BOOLEAN feVerifyResourceValue(feResourceType type, char* value)
    410416{
     
    417423      case feResPath:
    418424        return TRUE;
    419        
     425
    420426      case feResFile:
    421427        return ! access(value, R_OK);
     
    424430      case feResDir:
    425431        return ! access(value, X_OK);
    426        
     432
    427433      default:
    428434        return FALSE;
     
    446452      strcat(value, ".exe");
    447453  }
    448 #endif 
     454#endif
    449455  if (type == feResFile || type == feResBinary || type == feResDir)
    450456    return feCleanUpFile(value);
     
    500506    }
    501507  }
    502  
     508
    503509#ifdef macintosh
    504510  // replace / and .. by DIR_SEP and UP_DIR
     
    517523  }
    518524#endif
    519    
     525
    520526#ifdef RESOURCE_DEBUG
    521527  printf("feCleanUpFile: leaving with =%s=\n", fname);
     
    637643  *d = '\0';
    638644}
    639  
     645
    640646/*****************************************************************
    641647 *
     
    647653  char* s_in = s;
    648654  if (fmt == NULL) return NULL;
    649  
     655
    650656  while (*fmt != '\0')
    651657  {
    652658    *s = *fmt;
    653    
     659
    654660    if (*fmt == '%' && *(fmt + 1) != '\0')
    655661    {
     
    691697  return s_in;
    692698}
    693    
     699
    694700void feStringAppendResources(int warn = -1)
    695701{
     
    699705  {
    700706    r = feResource(feResourceConfigs[i].key, warn);
    701     StringAppend("%-10s:\t%s\n", feResourceConfigs[i].key, 
     707    StringAppend("%-10s:\t%s\n", feResourceConfigs[i].key,
    702708                 (r != NULL ? r : ""));
    703709    i++;
    704710  }
    705711}
    706 
    707 
    708  
    709  
  • Singular/febase.h

    rfc7421 r70433b5  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: febase.h,v 1.41 1999-10-22 11:14:07 obachman Exp $ */
     6/* $Id: febase.h,v 1.42 1999-10-25 18:21:51 Singular Exp $ */
    77/*
    88* ABSTRACT: basic i/o
     
    5353
    5454extern char*  feErrors;
     55extern char*  feArgv0;
    5556extern int    feErrorsLen;
    5657extern FILE*  feProtFile;
     
    6162extern int    yy_blocklineno;
    6263extern int    yy_noeof;
     64#ifdef MTRACK
     65extern BOOLEAN feRes_works;
     66#endif
    6367extern char   prompt_char;
    6468extern const char feNotImplemented[];
     
    128132// returns value of Resource as read-only string, or NULL
    129133// if Resource not found
    130 // issues warning, if explicitely requested (warn > 0), or 
     134// issues warning, if explicitely requested (warn > 0), or
    131135// if warn < 0 and Resource is gotten for the first time
    132136// Always quiet if warn == 0
     
    149153// display general help, otherwise
    150154void feHelp(char* str = NULL);
    151 // if browser != NULL or feOpt("browser") != NULL 
    152 //    set HelpBrowser to browser 
    153 // otherwise, if browser was already set, leave as is, 
     155// if browser != NULL or feOpt("browser") != NULL
     156//    set HelpBrowser to browser
     157// otherwise, if browser was already set, leave as is,
    154158//            if not, choose first available browser
    155159// return string identifying current browser
     
    267271  /* fgets: */
    268272  char * fe_fgets(char *pr,char *s, int size);
    269  
     273
    270274  #ifdef HAVE_TCL
    271275  /* tcl: */
  • Singular/ipshell.cc

    rfc7421 r70433b5  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ipshell.cc,v 1.50 1999-10-14 14:27:10 obachman Exp $ */
     4/* $Id: ipshell.cc,v 1.51 1999-10-25 18:21:51 Singular Exp $ */
    55/*
    66* ABSTRACT:
     
    311311    currRing=NULL;
    312312    currRingHdl=NULL;
    313     rSetHdl(sh,TRUE);
     313    if (sh!=NULL) rSetHdl(sh,TRUE);
    314314  }
    315315
  • Singular/ipshell.h

    rfc7421 r70433b5  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: ipshell.h,v 1.20 1999-09-20 18:03:49 obachman Exp $ */
     6/* $Id: ipshell.h,v 1.21 1999-10-25 18:21:52 Singular Exp $ */
    77/*
    88* ABSTRACT
     
    2424extern int  myynest;
    2525extern char *  currid;
    26 extern char * feArgv0;
    2726extern int     iiRETURNEXPR_len;
    2827extern sleftv *iiRETURNEXPR;
  • Singular/mmbt.c

    rfc7421 r70433b5  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: mmbt.c,v 1.19 1999-10-25 16:13:19 Singular Exp $ */
     4/* $Id: mmbt.c,v 1.20 1999-10-25 18:21:52 Singular Exp $ */
    55/*
    66* ABSTRACT: backtrace: part of memory subsystem (for linux/elf)
     
    2828#include "febase.h"
    2929#include "mmbt.h"
    30 #include "febase.h"
    3130
    3231
     
    6564    return 0;
    6665  }
    67   else
     66  else if (feRes_works)
    6867  {
    6968    char buf[255];
     
    7473      {
    7574        fprintf(stderr,
    76           "environment variable MPRPC not found\nand pipe to `%s`failed\n",buf);
     75          "environment variable MPRPC not found\nand pipe to `%s`failed\n",buf);
    7776        m2_end(1);
    7877      }
     
    9695        pclose(nm);
    9796      }
     97      return 0;
    9898    }
    9999  }
     
    121121
    122122  if (mm_lowpc==0) mmTrackInit();
    123 
    124123
    125124  while ((fp!=NULL) && ((unsigned long)fp>4095)
     
    176175  mm_p2n_max=i;
    177176}
     177
    178178char * mmP2cName(unsigned long p)
    179179{
  • Singular/ring.cc

    rfc7421 r70433b5  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ring.cc,v 1.77 1999-10-25 08:32:18 obachman Exp $ */
     4/* $Id: ring.cc,v 1.78 1999-10-25 18:21:53 Singular Exp $ */
    55
    66/*
     
    19841984  if (r == NULL)
    19851985  {
    1986     Werror("Null ring in %s:%l\n", fn, l);
     1986    Werror("Null ring in %s:%d\n", fn, l);
    19871987    return FALSE;
    19881988  }
Note: See TracChangeset for help on using the changeset viewer.