source: git/Singular/silink.cc @ b719a3

spielwiese
Last change on this file since b719a3 was ce7ba6, checked in by Hans Schönemann <hannes@…>, 25 years ago
* hannes: C++- Syntax git-svn-id: file:///usr/local/Singular/svn/trunk@3236 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 18.1 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/* $Id: silink.cc,v 1.29 1999-07-06 14:18:45 Singular Exp $ */
5
6/*
7* ABSTRACT: general interface to links
8*/
9
10#include <stdio.h>
11#include <string.h>
12#include "mod2.h"
13#include "tok.h"
14#include "mmemory.h"
15#include "febase.h"
16#include "subexpr.h"
17#include "ipid.h"
18#include "silink.h"
19#include "ipshell.h"
20#include "ring.h"
21#include "lists.h"
22#include "ideals.h"
23#include "numbers.h"
24#include "intvec.h"
25
26/* declarations */
27static BOOLEAN DumpAscii(FILE *fd, idhdl h);
28static BOOLEAN DumpAsciiIdhdl(FILE *fd, idhdl h);
29static char* GetIdString(idhdl h);
30static int DumpRhs(FILE *fd, idhdl h);
31static BOOLEAN DumpQring(FILE *fd, idhdl h, char *type_str);
32static BOOLEAN DumpAsciiMaps(FILE *fd, idhdl h, idhdl rhdl);
33
34/* ====================================================================== */
35si_link_extension si_link_root=NULL;
36
37BOOLEAN slInit(si_link l, char *istr)
38{
39  char *type = NULL, *mode = NULL, *name = NULL;
40  int i = 0, j;
41
42  // set mode and type
43  if (istr != NULL)
44  {
45    // find the first colon char in istr
46    i = 0;
47    while (istr[i] != ':' && istr[i] != '\0') i++;
48    if (istr[i] == ':')
49    {
50      // if found, set type
51      if (i > 0)
52      {
53        istr[i] = '\0';
54        type = mstrdup(istr);
55        istr[i] = ':';
56      }
57      // and check for mode
58      j = ++i;
59      while (istr[j] != ' ' && istr[j] != '\0') j++;
60      if (j > i)
61      {
62        mode = mstrdup(&(istr[i]));
63        mode[j - i] = '\0';
64      }
65      // and for the name
66      while (istr[j] == ' '&& istr[j] != '\0') j++;
67      if (istr[j] != '\0') name = mstrdup(&(istr[j]));
68    }
69    else // no colon find -- string is entire name
70    {
71      j=0;
72      while (istr[j] == ' '&& istr[j] != '\0') j++;
73      if (istr[j] != '\0') name = mstrdup(&(istr[j]));
74    }
75  }
76
77  // set the link extension
78  if (type != NULL)
79  {
80    si_link_extension s = si_link_root;
81
82    while (s != NULL && (strcmp(s->type, type) != 0)) s = s->next;
83
84    if (s != NULL)
85      l->m = s;
86    else
87    {
88      Warn("Found unknown link type: %s", type);
89      Warn("Use default link type: %s", si_link_root->type);
90      l->m = si_link_root;
91    }
92    FreeL(type);
93  }
94  else
95    l->m = si_link_root;
96
97  l->name = (name != NULL ? name : mstrdup(""));
98  l->mode = (mode != NULL ? mode : mstrdup(""));
99  l->ref = 1;
100  return FALSE;
101}
102
103void slCleanUp(si_link l)
104{
105  (l->ref)--;
106  if (l->ref == 0)
107  {
108    if (SI_LINK_OPEN_P(l))
109    {
110      if (l->m->Kill != NULL) l->m->Kill(l);
111      else if (l->m->Close != NULL) l->m->Close(l);
112    }
113    FreeL((ADDRESS)l->name);
114    FreeL((ADDRESS)l->mode);
115    memset((void *) l, 0, sizeof(ip_link));
116  }
117}
118
119void slKill(si_link l)
120{
121  slCleanUp(l);
122  if (l->ref == 0)
123    Free((ADDRESS)l, sizeof(ip_link));
124}
125
126char* slStatus(si_link l, char *request)
127{
128  if (l == NULL) return "empty link";
129  else if (l->m == NULL) return "unknown link type";
130  else if (strcmp(request, "type") == 0) return l->m->type;
131  else if (strcmp(request, "mode") == 0) return l->mode;
132  else if (strcmp(request, "name") == 0) return l->name;
133  else if (strcmp(request, "open") == 0)
134  {
135    if (SI_LINK_OPEN_P(l)) return "yes";
136    else return "no";
137  }
138  else if (strcmp(request, "openread") == 0)
139  {
140    if (SI_LINK_R_OPEN_P(l)) return "yes";
141    else return "no";
142  }
143  else if (strcmp(request, "openwrite") == 0)
144  {
145    if (SI_LINK_W_OPEN_P(l)) return "yes";
146    else return "no";
147  }
148  else if (l->m->Status == NULL) return "unknown status request";
149  else return l->m->Status(l, request);
150}
151
152//--------------------------------------------------------------------------
153BOOLEAN slOpen(si_link l, short flag)
154{
155  BOOLEAN res;
156
157  if (l->m == NULL) slInit(l, "");
158
159  if (SI_LINK_OPEN_P(l))
160  {
161    Warn("open: link of type: %s, mode: %s, name: %s is already open",
162         l->m->type, l->mode, l->name);
163    return FALSE;
164  }
165  else if (l->m->Open != NULL)
166    res = l->m->Open(l, flag);
167  else
168    res = TRUE;
169
170  if (res)
171    Werror("open: Error for link of type: %s, mode: %s, name: %s",
172           l->m->type, l->mode, l->name);
173  return res;
174}
175
176BOOLEAN slClose(si_link l)
177{
178  BOOLEAN res;
179
180  if(! SI_LINK_OPEN_P(l))
181    return FALSE;
182  else if (l->m->Close != NULL)
183    res = l->m->Close(l);
184  else
185    res = TRUE;
186
187  if (res)
188    Werror("close: Error for link of type: %s, mode: %s, name: %s",
189           l->m->type, l->mode, l->name);
190  return res;
191}
192
193leftv slRead(si_link l, leftv a)
194{
195  leftv v = NULL;
196  if( ! SI_LINK_R_OPEN_P(l)) // open r ?
197  {
198    if (slOpen(l, SI_LINK_READ)) return NULL;
199  }
200
201  if (SI_LINK_R_OPEN_P(l))
202  { // open r
203    if (a==NULL)
204    {
205      if (l->m->Read != NULL) v = l->m->Read(l);
206    }
207    else
208    {
209      if (l->m->Read2 != NULL) v = l->m->Read2(l,a);
210    }
211  }
212  else
213  {
214    Werror("read: Error to open link of type %s, mode: %s, name: %s for reading",
215           l->m->type, l->mode, l->name);
216    return NULL;
217  }
218
219  // here comes the eval:
220  if (v != NULL)
221  {
222    if (v->Eval() && !errorreported)
223      WerrorS("eval: failed");
224  }
225  else
226    Werror("read: Error for link of type %s, mode: %s, name: %s",
227           l->m->type, l->mode, l->name);
228  return v;
229}
230
231BOOLEAN slWrite(si_link l, leftv v)
232{
233  BOOLEAN res;
234
235  if(! SI_LINK_W_OPEN_P(l)) // open w ?
236  {
237    if (slOpen(l, SI_LINK_WRITE)) return TRUE;
238  }
239
240  if(SI_LINK_W_OPEN_P(l))
241  { // now open w
242    if (l->m->Write != NULL)
243      res = l->m->Write(l,v);
244    else
245      res = TRUE;
246
247    if (res)
248      Werror("write: Error for link of type %s, mode: %s, name: %s",
249             l->m->type, l->mode, l->name);
250    return res;
251  }
252  else
253  {
254    Werror("write: Error to open link of type %s, mode: %s, name: %s for writing",
255           l->m->type, l->mode, l->name);
256    return TRUE;
257  }
258}
259
260BOOLEAN slDump(si_link l)
261{
262  BOOLEAN res;
263
264  if(! SI_LINK_W_OPEN_P(l)) // open w ?
265  {
266    if (slOpen(l, SI_LINK_WRITE)) return TRUE;
267  }
268
269  if(SI_LINK_W_OPEN_P(l))
270  { // now open w
271    if (l->m->Dump != NULL)
272      res = l->m->Dump(l);
273    else
274      res = TRUE;
275
276    if (res)
277      Werror("dump: Error for link of type %s, mode: %s, name: %s",
278             l->m->type, l->mode, l->name);
279    return res;
280  }
281  else
282  {
283    Werror("dump: Error to open link of type %s, mode: %s, name: %s for writing",
284           l->m->type, l->mode, l->name);
285    return TRUE;
286  }
287}
288
289BOOLEAN slGetDump(si_link l)
290{
291  BOOLEAN res;
292
293  if(! SI_LINK_R_OPEN_P(l)) // open r ?
294  {
295    if (slOpen(l, SI_LINK_READ)) return TRUE;
296  }
297
298  if(SI_LINK_R_OPEN_P(l))
299  { // now open r
300    if (l->m->GetDump != NULL)
301      res = l->m->GetDump(l);
302    else
303      res = TRUE;
304
305    if (res)
306      Werror("getdump: Error for link of type %s, mode: %s, name: %s",
307             l->m->type, l->mode, l->name);
308    return res;
309  }
310  else
311  {
312    Werror("dump: Error open link of type %s, mode: %s, name: %s for reading",
313           l->m->type, l->mode, l->name);
314    return TRUE;
315  }
316}
317
318
319/* =============== ASCII ============================================= */
320BOOLEAN slOpenAscii(si_link l, short flag)
321{
322  char *mode;
323  if (flag & SI_LINK_OPEN)
324  {
325    if (l->mode[0] != '\0' && (strcmp(l->mode, "r") == 0))
326      flag = SI_LINK_READ;
327    else flag = SI_LINK_WRITE;
328  }
329
330  if (flag == SI_LINK_READ) mode = "r";
331  else if (strcmp(l->mode, "w") == 0) mode = "w";
332  else mode = "a";
333
334
335  if (l->name[0] == '\0')
336  {
337    // stdin or stdout
338    if (flag == SI_LINK_READ)
339    {
340      l->data = (void *) stdin;
341      mode = "r";
342    }
343    else
344    {
345      l->data = (void *) stdout;
346      mode = "a";
347    }
348  }
349  else
350  {
351    // normal ascii link to a file
352    FILE *outfile;
353    char *filename=l->name;
354
355    if(filename[0]=='>')
356    {
357      if (filename[1]=='>')
358      {
359        filename+=2;
360        mode = "a";
361      }
362      else
363      {
364        filename++;
365        mode="w";
366      }
367    }
368    outfile=myfopen(filename,mode);
369    if (outfile!=NULL)
370      l->data = (void *) outfile;
371    else
372      return TRUE;
373  }
374
375  FreeL(l->mode);
376  l->mode = mstrdup(mode);
377  SI_LINK_SET_OPEN_P(l, flag);
378  return FALSE;
379}
380
381BOOLEAN slCloseAscii(si_link l)
382{
383  SI_LINK_SET_CLOSE_P(l);
384  if (l->name[0] != '\0')
385  {
386    return (fclose((FILE *)l->data)!=0);
387  }
388  return FALSE;
389}
390
391leftv slReadAscii2(si_link l, leftv pr)
392{
393  FILE * fp=(FILE *)l->data;
394  char * buf=NULL;
395  if (fp!=NULL && l->name[0] != '\0')
396  {
397    fseek(fp,0L,SEEK_END);
398    long len=ftell(fp);
399    fseek(fp,0L,SEEK_SET);
400    buf=(char *)AllocL((int)len+1);
401    if (BVERBOSE(V_READING))
402      Print("//Reading %d chars\n",len);
403    myfread( buf, len, 1, fp);
404    buf[len]='\0';
405  }
406  else
407  {
408  #ifdef HAVE_TCL
409    if(tclmode)
410    {
411      WerrorS("reading from STDIN in TCL-mode not implemented");
412      buf=mstrdup("");
413    }
414    else
415  #endif
416    {
417      if (pr->Typ()==STRING_CMD)
418      {
419        buf=(char *)AllocL(80);
420        fe_fgets_stdin((char *)pr->Data(),buf,80);
421      }
422      else
423      {
424        WerrorS("read(<link>,<string>) expected");
425        buf=mstrdup("");
426      }
427    }
428  }
429  leftv v=(leftv)Alloc0(sizeof(sleftv));
430  v->rtyp=STRING_CMD;
431  v->data=buf;
432  return v;
433}
434
435leftv slReadAscii(si_link l)
436{
437  sleftv tmp;
438  memset(&tmp,0,sizeof(sleftv));
439  tmp.rtyp=STRING_CMD;
440  tmp.data="? ";
441  return slReadAscii2(l,&tmp);
442}
443
444BOOLEAN slWriteAscii(si_link l, leftv v)
445{
446  FILE *outfile=(FILE *)l->data;
447  BOOLEAN err=FALSE;
448  char *s;
449  while (v!=NULL)
450  {
451    s = v->String();
452    // free v ??
453    if (s!=NULL)
454    {
455      fprintf(outfile,"%s\n",s);
456      FreeL((ADDRESS)s);
457    }
458    else
459    {
460      Werror("cannot convert to string");
461      err=TRUE;
462    }
463    v = v->next;
464  }
465  fflush(outfile);
466  return err;
467}
468
469char* slStatusAscii(si_link l, char* request)
470{
471  if (strcmp(request, "read") == 0)
472  {
473    if (SI_LINK_R_OPEN_P(l)) return "ready";
474    else return "not ready";
475  }
476  else if (strcmp(request, "write") == 0)
477  {
478    if (SI_LINK_W_OPEN_P(l)) return "ready";
479    else return "not ready";
480  }
481  else return "unknown status request";
482}
483
484/*------------------ Dumping in Ascii format -----------------------*/
485
486BOOLEAN slDumpAscii(si_link l)
487{
488  FILE *fd = (FILE *) l->data;
489  idhdl h = IDROOT, rh = currRingHdl;
490  BOOLEAN status = DumpAscii(fd, h);
491
492  if (! status ) status = DumpAsciiMaps(fd, h, NULL);
493
494  if (currRingHdl != rh) rSetHdl(rh, TRUE);
495  fprintf(fd, "RETURN();\n");
496  fflush(fd);
497
498  return status;
499}
500
501// we do that recursively, to dump ids in the the order in which they
502// were actually defined
503static BOOLEAN DumpAscii(FILE *fd, idhdl h)
504{
505  if (h == NULL) return FALSE;
506
507  if (DumpAscii(fd, IDNEXT(h))) return TRUE;
508
509  // need to set the ring before writing it, otherwise we get in
510  // trouble with minpoly
511  if (IDTYP(h) == RING_CMD || IDTYP(h) == QRING_CMD)
512    rSetHdl(h, TRUE);
513
514  if (DumpAsciiIdhdl(fd, h)) return TRUE;
515
516  if (IDTYP(h) == RING_CMD || IDTYP(h) == QRING_CMD)
517    return DumpAscii(fd, IDRING(h)->idroot);
518  else
519#ifdef HAVE_NAMESPACES
520    if (IDTYP(h) == PACKAGE_CMD && strcmp(IDID(h), "Top") != 0)
521    {
522      namespaceroot->push(IDPACKAGE(h), IDID(h));
523      int ret_it = DumpAscii(fd, IDPACKAGE(h)->idroot);
524      namespaceroot->pop();
525      return ret_it;
526    }
527  else
528#endif
529    return FALSE;
530}
531
532static BOOLEAN DumpAsciiMaps(FILE *fd, idhdl h, idhdl rhdl)
533{
534  if (h == NULL) return FALSE;
535  if (DumpAsciiMaps(fd, IDNEXT(h), rhdl)) return TRUE;
536
537  if (IDTYP(h) == RING_CMD || IDTYP(h) == QRING_CMD)
538    return DumpAsciiMaps(fd, IDRING(h)->idroot, h);
539  else if (IDTYP(h) == MAP_CMD)
540  {
541    char *rhs;
542    rSetHdl(rhdl, TRUE);
543    rhs = h->String();
544
545#ifdef HAVE_NAMESPACES
546    if (fprintf(fd, "setring %s::%s;\n",
547                namespaceroot->name, IDID(rhdl)) == EOF) return TRUE;
548    if (fprintf(fd, "%s %s::%s = %s, %s;\n", Tok2Cmdname(MAP_CMD),
549                 namespaceroot->name, IDID(h),
550                IDMAP(h)->preimage, rhs) == EOF)
551#else
552    if (fprintf(fd, "setring %s;\n", IDID(rhdl)) == EOF) return TRUE;
553    if (fprintf(fd, "%s %s = %s, %s;\n", Tok2Cmdname(MAP_CMD), IDID(h),
554                IDMAP(h)->preimage, rhs) == EOF)
555#endif
556    {
557      FreeL(rhs);
558      return TRUE;
559    }
560    else
561    {
562      FreeL(rhs);
563      return FALSE;
564    }
565  }
566  else return FALSE;
567}
568
569static BOOLEAN DumpAsciiIdhdl(FILE *fd, idhdl h)
570{
571  char *type_str = GetIdString(h);
572  idtyp type_id = IDTYP(h);
573
574#ifdef HAVE_NAMESPACES
575  if ((type_id == PACKAGE_CMD) &&(strcmp(IDID(h), "Top") == 0))
576    return FALSE;
577#endif
578
579  // we do not throw an error if a wrong type was attempted to be dumped
580  if (type_str == NULL)
581    return FALSE;
582
583  // handle qrings separately
584  if (type_id == QRING_CMD)
585    return DumpQring(fd, h, type_str);
586
587  // do not dump LIB string
588  if (type_id == STRING_CMD && strcmp("LIB", IDID(h)) == 0)
589    return FALSE;
590
591  // put type and name
592#ifdef HAVE_NAMESPACES
593  if (fprintf(fd, "%s %s::%s", type_str, namespaceroot->name, IDID(h)) == EOF)
594    return TRUE;
595#else
596  if (fprintf(fd, "%s %s", type_str, IDID(h)) == EOF)
597    return TRUE;
598#endif
599  // for matricies, append the dimension
600  if (type_id == MATRIX_CMD)
601  {
602    ideal id = IDIDEAL(h);
603    if (fprintf(fd, "[%d][%d]", id->nrows, id->ncols)== EOF) return TRUE;
604  }
605  else if (type_id == INTMAT_CMD)
606  {
607    if (fprintf(fd, "[%d][%d]", IDINTVEC(h)->rows(), IDINTVEC(h)->cols())
608        == EOF) return TRUE;
609  }
610
611#ifdef HAVE_NAMESPACES
612  if (type_id == PACKAGE_CMD)
613  {
614    if (fprintf(fd, ";\n") == EOF) return TRUE;
615    else return FALSE;
616  }
617#endif
618
619  // write the equal sign
620  if (fprintf(fd, " = ") == EOF) return TRUE;
621
622  // and the right hand side
623  if (DumpRhs(fd, h) == EOF) return TRUE;
624
625  // semicolon und tschuess
626  if (fprintf(fd, ";\n") == EOF) return TRUE;
627
628  return FALSE;
629}
630
631static char* GetIdString(idhdl h)
632{
633  idtyp type = IDTYP(h);
634
635  switch(type)
636  {
637      case LIST_CMD:
638      {
639        lists l = IDLIST(h);
640        int i, nl = l->nr + 1;
641        char *name;
642
643        for (i=0; i<nl; i++)
644          if (GetIdString((idhdl) &(l->m[i])) == NULL) return NULL;
645      }
646      case PACKAGE_CMD:
647      case INT_CMD:
648      case INTVEC_CMD:
649      case INTMAT_CMD:
650      case STRING_CMD:
651      case RING_CMD:
652      case QRING_CMD:
653      case PROC_CMD:
654      case NUMBER_CMD:
655      case POLY_CMD:
656      case IDEAL_CMD:
657      case VECTOR_CMD:
658      case MODUL_CMD:
659      case MATRIX_CMD:
660        return Tok2Cmdname(type);
661
662      case MAP_CMD:
663      case LINK_CMD:
664        return NULL;
665
666      default:
667       Warn("Error dump data of type %s", Tok2Cmdname(IDTYP(h)));
668       return NULL;
669  }
670}
671
672static BOOLEAN DumpQring(FILE *fd, idhdl h, char *type_str)
673{
674  char *ring_str = h->String();
675  if (fprintf(fd, "%s temp_ring = %s;\n", Tok2Cmdname(RING_CMD), ring_str)
676              == EOF) return TRUE;
677  if (fprintf(fd, "%s temp_ideal = %s;\n", Tok2Cmdname(IDEAL_CMD),
678              iiStringMatrix((matrix) IDRING(h)->qideal, 1))
679      == EOF) return TRUE;
680  if (fprintf(fd, "attrib(temp_ideal, \"isSB\", 1);\n") == EOF) return TRUE;
681#ifdef HAVE_NAMESPACES
682  if (fprintf(fd, "%s %s::%s = temp_ideal;\n",
683              type_str,  namespaceroot->name, IDID(h)) == EOF)
684#else
685  if (fprintf(fd, "%s %s = temp_ideal;\n", type_str, IDID(h)) == EOF)
686#endif
687    return TRUE;
688  if (fprintf(fd, "kill temp_ring;\n") == EOF) return TRUE;
689  else
690  {
691    FreeL(ring_str);
692    return FALSE;
693  }
694}
695
696
697static int DumpRhs(FILE *fd, idhdl h)
698{
699  idtyp type_id = IDTYP(h);
700
701  if (type_id == LIST_CMD)
702  {
703    lists l = IDLIST(h);
704    int i, nl = l->nr;
705
706    fprintf(fd, "list(");
707
708    for (i=0; i<nl; i++)
709    {
710      if (DumpRhs(fd, (idhdl) &(l->m[i])) == EOF) return EOF;
711      fprintf(fd, ",");
712    }
713    if (nl > 0)
714    {
715      if (DumpRhs(fd, (idhdl) &(l->m[nl])) == EOF) return EOF;
716    }
717    fprintf(fd, ")");
718  }
719  else  if (type_id == STRING_CMD)
720  {
721    char *pstr = IDSTRING(h), c;
722    fputc('"', fd);
723    while (*pstr != '\0')
724    {
725      if (*pstr == '"' || *pstr == '\\')  fputc('\\', fd);
726      fputc(*pstr, fd);
727      pstr++;
728    }
729    fputc('"', fd);
730  }
731  else  if (type_id == PROC_CMD)
732  {
733    procinfov pi = IDPROC(h);
734    if (pi->language == LANG_SINGULAR) {
735      if( pi->data.s.body==NULL) iiGetLibProcBuffer(pi);
736      char *pstr = pi->data.s.body, c;
737      fputc('"', fd);
738      while (*pstr != '\0') {
739        if (*pstr == '"' || *pstr == '\\') fputc('\\', fd);
740        fputc(*pstr, fd);
741        pstr++;
742      }
743      fputc('"', fd);
744    } else fputs("(null)", fd);
745  }
746  else
747  {
748    char *rhs = h->String();
749
750    if (rhs == NULL) return EOF;
751
752    if (type_id == INTVEC_CMD) fprintf(fd, "intvec(");
753
754    if (fprintf(fd, "%s", rhs) == EOF) return EOF;
755    FreeL(rhs);
756
757    if ((type_id == RING_CMD || type_id == QRING_CMD) &&
758        IDRING(h)->minpoly != NULL)
759    {
760      StringSetS("");
761      nWrite(IDRING(h)->minpoly);
762      rhs = StringAppendS("");
763      if (fprintf(fd, "; minpoly = %s", rhs) == EOF) return EOF;
764    }
765    else if (type_id == INTVEC_CMD) fprintf(fd, ")");
766  }
767  return 1;
768}
769
770BOOLEAN slGetDumpAscii(si_link l)
771{
772  if (l->name[0] == '\0')
773  {
774    Werror("getdump: Can not get dump from stdin");
775    return TRUE;
776  }
777  else
778  {
779    BOOLEAN status = newFile(l->name);
780    if (status)
781      return TRUE;
782
783    int old_echo=si_echo;
784    si_echo=0;
785
786    status=yyparse();
787
788    si_echo=old_echo;
789
790    if (status)
791      return TRUE;
792    else
793    {
794      // lets reset the file pointer to the end to reflect that
795      // we are finished with reading
796      FILE *f = (FILE *) l->data;
797      fseek(f, 0L, SEEK_END);
798      return FALSE;
799    }
800  }
801}
802
803
804/*------------Initialization at Start-up time------------------------*/
805
806#ifdef HAVE_DBM
807#include "sing_dbm.h"
808#endif
809
810#ifdef HAVE_MPSR
811#include "sing_mp.h"
812#endif
813
814void slStandardInit()
815{
816  si_link_extension s;
817  si_link_root=(si_link_extension)Alloc0(sizeof(*si_link_root));
818  si_link_root->Open=slOpenAscii;
819  si_link_root->Close=slCloseAscii;
820  si_link_root->Kill=slCloseAscii;
821  si_link_root->Read=slReadAscii;
822  si_link_root->Read2=slReadAscii2;
823  si_link_root->Write=slWriteAscii;
824  si_link_root->Dump=slDumpAscii;
825  si_link_root->GetDump=slGetDumpAscii;
826  si_link_root->Status=slStatusAscii;
827  si_link_root->type="ASCII";
828  s = si_link_root;
829#ifdef HAVE_DBM
830#ifndef HAVE_MODULE_DBM
831  s->next = (si_link_extension)Alloc0(sizeof(*si_link_root));
832  s = s->next;
833  slInitDBMExtension(s);
834#endif
835#endif
836#ifdef HAVE_MPSR
837  s->next = (si_link_extension)Alloc0(sizeof(*si_link_root));
838  s = s->next;
839  slInitMPFileExtension(s);
840  s->next = (si_link_extension)Alloc0(sizeof(*si_link_root));
841  s = s->next;
842  slInitMPTcpExtension(s);
843#endif
844}
Note: See TracBrowser for help on using the repository browser.