Changeset a088a12 in git


Ignore:
Timestamp:
Apr 20, 2011, 12:53:57 PM (12 years ago)
Author:
Andreas Steenpaß <steenpas@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
Children:
7f581eeb600e2155c7f987cf39f1e0712bfe3fbe
Parents:
f84c3bb40f874bb3f7be902077b2c20d9f8f97ef
Message:
writing newstructs to links

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

Legend:

Unmodified
Added
Removed
  • Singular/blackbox.cc

    rf84c3b ra088a12  
    4848}
    4949
    50 BOOLEAN blackbox_default_deserialize(blackbox *b, void **d, si_link f)
     50BOOLEAN blackbox_default_deserialize(blackbox **b, void **d, si_link f)
    5151{
    5252  return TRUE;
  • Singular/blackbox.h

    rf84c3b ra088a12  
    3939  BOOLEAN (*blackbox_serialize)(blackbox *b,void *d, si_link f);
    4040  /// deserialize
    41   BOOLEAN (*blackbox_deserialize)(blackbox *b,void **d, si_link f);
     41  BOOLEAN (*blackbox_deserialize)(blackbox **b,void **d, si_link f);
    4242  /// additional type info
    4343  void *data;
  • Singular/newstruct.cc

    rf84c3b ra088a12  
    301301{
    302302  newstruct_desc dd=(newstruct_desc)b->data;
    303   // write string(getBlackboxName(dd->id),
     303  sleftv l;
     304  memset(&l,0,sizeof(l));
     305  l.rtyp=STRING_CMD;
     306  l.data=(void*)getBlackboxName(dd->id);
     307  f->m->Write(f, &l);
    304308  lists ll=(lists)d;
    305   // write(ll)
     309  memset(&l,0,sizeof(l));
     310  l.rtyp=LIST_CMD;
     311  l.data=ll;
     312  f->m->Write(f, &l);
    306313  return FALSE;
    307314}
    308315
    309 BOOLEAN newstruct_deserialize(blackbox *b, void **d, si_link f)
    310 {
    311   return TRUE;
     316BOOLEAN newstruct_deserialize(blackbox **b, void **d, si_link f)
     317{
     318  // newstruct is serialiazed as a list,
     319  // just read a list and take data,
     320  // rtyp must be set correctly (to the blackbox id) by routine calling
     321  // newstruct_deserialize
     322  leftv l=f->m->Read(f);
     323  //newstruct_desc n=(newstruct_desc)b->data;
     324  //TODO: check compatibility of list l->data with description in n
     325  *d=l->data;
     326  return FALSE;
    312327}
    313328
  • Singular/ssiLink.cc

    rf84c3b ra088a12  
    4242#include <Singular/cntrlc.h>
    4343#include <Singular/lists.h>
     44#include <Singular/blackbox.h>
    4445#include <Singular/ssiLink.h>
    4546
     
    5253//#endif
    5354
    54 #define SSI_VERSION 1
     55#define SSI_VERSION 2
    5556
    5657typedef struct
     
    620621  SSI_UNBLOCK_CHLD;
    621622  return v;
     623}
     624
     625void ssiReadBlackbox(leftv res, si_link l)
     626{
     627  ssiInfo *d=(ssiInfo*)l->data;
     628  int throwaway;
     629  SSI_BLOCK_CHLD;
     630  fscanf(d->f_read,"%d ",&throwaway);
     631  SSI_UNBLOCK_CHLD;
     632  char *name=ssiReadString(d);
     633  int tok;
     634  blackboxIsCmd(name,tok);
     635  if (tok>MAX_TOK)
     636  {
     637    blackbox *b=getBlackboxStuff(tok);
     638    res->rtyp=tok;
     639    b->blackbox_deserialize(&b,&(res->data),l);
     640  }
     641  else
     642  {
     643    Werror("blackbox %s not found",name);
     644  }
    622645}
    623646
     
    10881111             res->data=ssiReadIntvec(d);
    10891112             break;
     1113    case 20: ssiReadBlackbox(res,l);
     1114             break;
    10901115    // ------------
    10911116    case 98: // version
     
    12101235                   ssiWriteIntvec(d,(intvec *)dd);
    12111236                   break;
    1212           default: Werror("not implemented (t:%d, rtyp:%d)",tt, data->rtyp);
    1213                    d->level=0;
    1214                    return TRUE;
     1237          default:
     1238            if (tt>MAX_TOK)
     1239            {
     1240              blackbox *b=getBlackboxStuff(tt);
     1241              fprintf(d->f_write,"20 ");
     1242              b->blackbox_serialize(b,dd,l);
     1243            }
     1244            else
     1245            {
     1246              Werror("not implemented (t:%d, rtyp:%d)",tt, data->rtyp);
     1247              d->level=0;
     1248              return TRUE;
     1249            }
     1250            break;
    12151251    }
    12161252    if (d->level<=1) { fprintf(d->f_write,"\n"); fflush(d->f_write); }
     
    15551591// 17 intvec <len> ...
    15561592//
     1593// 20 blackbox <name> ...
     1594//
    15571595// 98: verify version: <ssi-version> <MAX_TOK> <OPT1> <OPT2>
    15581596// 99: quit Singular
Note: See TracChangeset for help on using the changeset viewer.