Changeset 469903 in git for Singular


Ignore:
Timestamp:
Sep 26, 2016, 4:38:04 PM (8 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
61335abc447c59145b8b3e1e7c54f8d873367d4ec240db58915f633fce3013f72a3b9824f231e6ed
Parents:
f9b975ad27b583d3227de1370bf9e4f15adc8b3d
Message:
cooperation of *.lib and *.so: keep example and help part from *.lib
Location:
Singular
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • Singular/ipid.cc

    rf9b975 r469903  
    280280      if ((IDTYP(h) == t)||(t==DEF_CMD))
    281281      {
    282         if ((IDTYP(h)==PACKAGE_CMD)
    283         && (strcmp(s,"Top")==0))
     282        if (IDTYP(h)==PACKAGE_CMD)
    284283        {
    285           goto errlabel;
     284          if (strcmp(s,"Top")==0)
     285          {
     286            goto errlabel;
     287          }
     288          else return *root;
    286289        }
    287         if (BVERBOSE(V_REDEFINE))
    288           Warn("redefining %s (%s)",s,my_yylinebuf);
    289         if (s==IDID(h)) IDID(h)=NULL;
    290         killhdl2(h,root,currRing);
     290        else
     291        {
     292          if (BVERBOSE(V_REDEFINE))
     293            Warn("redefining %s (%s)",s,my_yylinebuf);
     294          if (s==IDID(h)) IDID(h)=NULL;
     295          killhdl2(h,root,currRing);
     296        }
    291297      }
    292298      else
     
    649655BOOLEAN piKill(procinfov pi)
    650656{
    651   Voice *p=currentVoice;
    652   while (p!=NULL)
    653   {
    654     if (p->pi==pi && pi->ref <= 1)
    655     {
    656       Warn("`%s` in use, can not be killed",pi->procname);
    657       return TRUE;
    658     }
    659     p=p->next;
    660   }
    661657  (pi->ref)--;
    662658  if (pi->ref <= 0)
    663659  {
     660    Voice *p=currentVoice;
     661    while (p!=NULL)
     662    {
     663      if (p->pi==pi && pi->ref <= 1)
     664      {
     665        Warn("`%s` in use, can not be killed",pi->procname);
     666        return TRUE;
     667      }
     668      p=p->next;
     669    }
    664670    if (pi->libname != NULL) // OB: ????
    665671      omFree((ADDRESS)pi->libname);
  • Singular/iplib.cc

    rf9b975 r469903  
    882882/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
    883883procinfo *iiInitSingularProcinfo(procinfov pi, const char *libname,
    884               const char *procname, int line, long pos, BOOLEAN pstatic)
    885 {
     884              const char *procname, int, long pos, BOOLEAN pstatic)
     885{
     886  memset(pi,0,sizeof(*pi));
    886887  pi->libname = omStrDup(libname);
    887888  pi->procname = omStrDup(procname);
    888889  pi->language = LANG_SINGULAR;
    889890  pi->ref = 1;
    890   pi->pack = NULL;
    891891  pi->is_static = pstatic;
    892892  pi->data.s.proc_start = pos;
    893   pi->data.s.def_end    = 0L;
    894   pi->data.s.help_start = 0L;
    895   pi->data.s.help_end   = 0L;
    896   pi->data.s.body_start = 0L;
    897   pi->data.s.body_end   = 0L;
    898   pi->data.s.example_start = 0L;
    899   pi->data.s.proc_lineno = line;
    900   pi->data.s.body_lineno = 0;
    901   pi->data.s.example_lineno = 0;
    902   pi->data.s.body = NULL;
    903   pi->data.s.help_chksum = 0;
    904893  return(pi);
    905894}
     
    921910  #endif
    922911
    923   h = enterid(procname,0, PROC_CMD, &IDROOT, TRUE);
     912  h=IDROOT->get(procname,0);
     913  if ((h!=NULL)
     914  && (IDTYP(h)==PROC_CMD))
     915  {
     916    pi = IDPROC(h);
     917    if (pi->language == LANG_SINGULAR)
     918      Warn("extend `%s`",procname);
     919  }
     920  else
     921  {
     922    h = enterid(procname,0, PROC_CMD, &IDROOT, TRUE);
     923  }
    924924  if ( h!= NULL )
    925925  {
    926926    pi = IDPROC(h);
     927    omfree(pi->libname);
    927928    pi->libname = omStrDup(libname);
     929    omfree(pi->procname);
    928930    pi->procname = omStrDup(procname);
    929931    pi->language = LANG_C;
     
    935937  else
    936938  {
    937     PrintS("iiAddCproc: failed.\n");
     939    WarnS("iiAddCproc: failed.");
    938940  }
    939941  return(0);
     
    985987  pl = basePack->idroot->get(plib,0); /* packages only in top level
    986988                                        (see enterid) */
    987   if (pl==NULL)
    988   {
    989     pl = enterid( plib,0, PACKAGE_CMD, &IDROOT,
    990                   TRUE );
    991     IDPACKAGE(pl)->language = LANG_C;
     989  if ((pl!=NULL)
     990  &&(IDTYP(pl)==PACKAGE_CMD))
     991  {
     992    if(IDPACKAGE(pl)->language==LANG_C)
     993    {
     994      if (BVERBOSE(V_LOAD_LIB)) Warn( "%s already loaded as package", newlib);
     995      omFree(plib);
     996      return FALSE;
     997    }
     998  }
     999  else
     1000  {
     1001    pl = enterid( plib,0, PACKAGE_CMD, &IDROOT, TRUE );
    9921002    IDPACKAGE(pl)->libname=omStrDup(newlib);
    9931003  }
    994   else
    995   {
    996     if(IDTYP(pl)!=PACKAGE_CMD)
    997     {
    998       Warn("not of type package.");
    999       goto load_modules_end;
    1000     }
    1001   }
     1004  IDPACKAGE(pl)->language = LANG_C;
    10021005  if (dynl_check_opened(FullName))
    10031006  {
    1004     if (BVERBOSE(V_LOAD_LIB)) Warn( "%s already loaded", fullname);
     1007    if (BVERBOSE(V_LOAD_LIB)) Warn( "%s already loaded as C library", fullname);
    10051008    return FALSE;
    10061009  }
     
    10651068  // int token;
    10661069
    1067   pl = IDROOT->get(plib,0);
    1068   if (pl!=NULL)
    1069   {
    1070     if (BVERBOSE(V_LOAD_LIB)) Warn( "(builtin) %s already loaded", newlib);
    1071     omFree(plib);
    1072     return FALSE;
    1073   }
    1074 
    1075   pl = enterid( plib,0, PACKAGE_CMD, &IDROOT,
    1076                 TRUE );
     1070  pl = basePack->idroot->get(plib,0); // search PACKAGE only in Top
     1071  if ((pl!=NULL)
     1072  &&(IDTYP(pl)==PACKAGE_CMD))
     1073  {
     1074    if(IDPACKAGE(pl)->language==LANG_C)
     1075    {
     1076      if (BVERBOSE(V_LOAD_LIB)) Warn( "(builtin) %s already loaded", newlib);
     1077      omFree(plib);
     1078      return FALSE;
     1079    }
     1080  }
     1081  else
     1082  {
     1083    pl = enterid( plib,0, PACKAGE_CMD, &IDROOT, TRUE );
     1084    IDPACKAGE(pl)->libname=omStrDup(newlib);
     1085  }
    10771086  IDPACKAGE(pl)->language = LANG_C;
    1078   IDPACKAGE(pl)->libname=omStrDup(newlib);
    10791087
    10801088  IDPACKAGE(pl)->handle=(void *)NULL;
     
    11331141/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
    11341142
     1143#ifdef HAVE_DYNAMIC_LOADING
    11351144// loads a dynamic module from the binary path and returns a named function
    11361145// returns NULL, if something fails
     
    11391148  void* result = NULL;
    11401149
    1141 #if defined(HAVE_STATIC) || !defined(HAVE_DYNAMIC_LOADING)
    1142   WerrorS("static version can not load function from dynamic modules");
    1143 #else
    11441150  const char* bin_dir = feGetResource('b');
    11451151  if (!bin_dir)  { return NULL; }
     
    11561162  result = dynl_sym(openlib, funcname);
    11571163  if (!result) Werror("%s: %s\n", funcname, dynl_error());
     1164
     1165  return result;
     1166}
    11581167#endif
    1159 
    1160   return result;
    1161 }
    1162 
    11631168
    11641169/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
     
    12251230               proc->procname);
    12261231      if(proc->language==LANG_SINGULAR)
    1227         Print("line %4d,%-5ld  %4d,%-5ld  %4d,%-5ld\n",
    1228               proc->data.s.proc_lineno, proc->data.s.proc_start,
     1232        Print("line %-5ld  %4d,%-5ld  %4d,%-5ld\n",
     1233              proc->data.s.proc_start,
    12291234              proc->data.s.body_lineno, proc->data.s.body_start,
    12301235              proc->data.s.example_lineno, proc->data.s.example_start);
  • Singular/ipshell.cc

    rf9b975 r469903  
    192192                   && (strlen(IDPROC(h)->libname)>0))
    193193                     Print(" from %s",IDPROC(h)->libname);
     194                   if(IDPROC(h)->language==LANG_C)
     195                     PrintS(" (C)");
    194196                   if(IDPROC(h)->is_static)
    195197                     PrintS(" (static)");
  • Singular/libparse.cc

    rf9b975 r469903  
    19741974              if(check)
    19751975              {
    1976                 printf("Procedure %s (line %d) has OLD-STYLE-HELP!\n",
    1977                        pi->procname, pi->data.s.proc_lineno);
     1976                printf("Procedure %s has OLD-STYLE-HELP!\n",
     1977                       pi->procname);
    19781978              }
    19791979              SET_HELP_START(mode, pi, current_pos(0));
     
    19991999              if(check && yyleng>2)
    20002000              {
    2001                 printf("Procedure %s (line %d) has OLD-STYLE-HELP!\n",
    2002                        pi->procname, pi->data.s.proc_lineno);
     2001                printf("Procedure %s has OLD-STYLE-HELP!\n",
     2002                       pi->procname);
    20032003              }
    20042004              #if YYLPDEBUG
  • Singular/libparse.ll

    rf9b975 r469903  
    556556              if(check)
    557557              {
    558                 printf("Procedure %s (line %d) has OLD-STYLE-HELP!\n",
    559                        pi->procname, pi->data.s.proc_lineno);
     558                printf("Procedure %s has OLD-STYLE-HELP!\n",
     559                       pi->procname);
    560560              }
    561561              SET_HELP_START(mode, pi, current_pos(0));
     
    573573              if(check && yyleng>2)
    574574              {
    575                 printf("Procedure %s (line %d) has OLD-STYLE-HELP!\n",
    576                        pi->procname, pi->data.s.proc_lineno);
     575                printf("Procedure %s has OLD-STYLE-HELP!\n",
     576                       pi->procname);
    577577              }
    578578              #if YYLPDEBUG
  • Singular/subexpr.h

    rf9b975 r469903  
    2424public:
    2525  long   proc_start;       // position where proc is starting
     26  long   proc_end;         // position where proc is ending
    2627  long   def_end;          // position where proc header is ending
    2728  long   help_start;       // position where help is starting
     
    3031  long   body_end;         // position where proc-body is ending
    3132  long   example_start;    // position where example is starting
    32   long   proc_end;         // position where proc is ending
    33   int    proc_lineno;
    3433  int    body_lineno;
    3534  int    example_lineno;
Note: See TracChangeset for help on using the changeset viewer.