Changeset 6b32990 in git for Singular/silink.cc


Ignore:
Timestamp:
Dec 12, 2000, 9:44:55 AM (23 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
de7793b9aaa39c2f00b6e30ee4ad5c82915497aa
Parents:
52ea3f939ec0aa2915d2d6a747bab3976eb9bfb7
Message:
* dynamic kernel modules for MP and DBM links
* p_Procs improvements


git-svn-id: file:///usr/local/Singular/svn/trunk@4865 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/silink.cc

    r52ea3f r6b32990  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: silink.cc,v 1.37 2000-12-06 11:03:29 Singular Exp $ */
     4/* $Id: silink.cc,v 1.38 2000-12-12 08:44:52 obachman Exp $ */
    55
    66/*
     
    3535static BOOLEAN DumpQring(FILE *fd, idhdl h, char *type_str);
    3636static BOOLEAN DumpAsciiMaps(FILE *fd, idhdl h, idhdl rhdl);
     37static si_link_extension slTypeInit(si_link_extension s, const char* type);
    3738
    3839/* ====================================================================== */
     
    8384  {
    8485    si_link_extension s = si_link_root;
    85 
    86     while (s != NULL && (strcmp(s->type, type) != 0)) s = s->next;
     86    si_link_extension prev = s;
     87
     88    while (strcmp(s->type, type) != 0)
     89    {
     90      if (s->next == NULL)
     91      {
     92        prev = s;
     93        s = NULL;
     94        break;
     95      }
     96      else
     97      {
     98        s = s->next;
     99      }
     100    }
    87101
    88102    if (s != NULL)
     
    90104    else
    91105    {
    92       Warn("Found unknown link type: %s", type);
    93       Warn("Use default link type: %s", si_link_root->type);
    94       l->m = si_link_root;
     106      l->m = slTypeInit(prev, type);
    95107    }
    96108    omFree(type);
     
    99111    l->m = si_link_root;
    100112
     113  if (l->m == NULL) return TRUE;
     114 
    101115  l->name = (name != NULL ? name : omStrDup(""));
    102116  l->mode = (mode != NULL ? mode : omStrDup(""));
     
    809823/*------------Initialization at Start-up time------------------------*/
    810824
     825#include "slInit.h"
     826
     827static si_link_extension slTypeInit(si_link_extension s, const char* type)
     828{
     829  assume(s != NULL);
     830  s->next = NULL;
     831  si_link_extension ns = (si_link_extension)omAlloc0Bin(s_si_link_extension_bin);
     832 
     833#ifdef HAVE_MPSR
     834  if (strcmp(type, "MPfile") == 0)
     835    s->next = slInitMPFileExtension(ns);
     836  else if (strcmp(type, "MPtcp") == 0)
     837    s->next = slInitMPTcpExtension(ns);
    811838#ifdef HAVE_DBM
    812 #include "sing_dbm.h"
    813 #endif
    814 
    815 #ifdef HAVE_MPSR
    816 #include "sing_mp.h"
    817 #endif
     839  else
     840#endif
     841#endif
     842#ifdef HAVE_DBM
     843  if (strcmp(type, "DBM") == 0)
     844    s->next = slInitDBMExtension(ns);
     845#endif
     846#if defined(HAVE_DBM) || defined(HAVE_MPSR)
     847  else
     848#endif
     849  {
     850    Warn("Found unknown link type: %s", type);
     851    Warn("Use default link type: %s", si_link_root->type);
     852    omFreeBin(ns, s_si_link_extension_bin);
     853    return si_link_root;
     854  }
     855 
     856  if (s->next == NULL)
     857  {
     858    Werror("Can not initialize link type %s", type);
     859    omFreeBin(ns, s_si_link_extension_bin);
     860    return NULL;
     861  }
     862  return s->next;
     863}
    818864
    819865void slStandardInit()
     
    832878  si_link_root->type="ASCII";
    833879  s = si_link_root;
    834 #ifdef HAVE_DBM
    835 #ifndef HAVE_MODULE_DBM
    836   s->next = (si_link_extension)omAlloc0Bin(s_si_link_extension_bin);
    837   s = s->next;
    838   slInitDBMExtension(s);
    839 #endif
    840 #endif
    841 #ifdef HAVE_MPSR
    842   s->next = (si_link_extension)omAlloc0Bin(s_si_link_extension_bin);
    843   s = s->next;
    844   slInitMPFileExtension(s);
    845   s->next = (si_link_extension)omAlloc0Bin(s_si_link_extension_bin);
    846   s = s->next;
    847   slInitMPTcpExtension(s);
    848 #endif
    849 }
     880  s->next = NULL;
     881}
Note: See TracChangeset for help on using the changeset viewer.