[SCM] an open source computer algebra system branch, cleanedupstream, updated. 6125e540ca6d66c307958938a9d53b245507c323

Bernhard R. Link brlink at debian.org
Tue Apr 24 15:53:07 UTC 2012


The following commit has been merged in the cleanedupstream branch:
commit eb28eee7605fd204561fb08057d99d644c98f04d
Author: Hans Schoenemann <hannes at mathematik.uni-kl.de>
Date:   Mon Feb 13 17:28:31 2012 +0100

    chg: better HOWTO-libsingular

diff --git a/HOWTO-libsingular b/HOWTO-libsingular
index 8d62ff9..43abf8b 100644
--- a/HOWTO-libsingular
+++ b/HOWTO-libsingular
@@ -10,7 +10,7 @@ make install-libsingular
 ---------------------------------------
 how to compile and run the the example:
 g++ -I......include -o tt tt.cc -L..../Singular -lsingular
-export SINGULAR="..../Singular-3-1-3/"
+export SINGULAR="..../Singular-3-1-4/"
 export SINGULAR_SYSTEM_TYPE="ix86Mac-darwin/lib"
 if [ "${SINGULAR_SYSTEM_TYPE}" = "ix86Mac-darwin/lib" ]; then
   export
@@ -21,91 +21,4 @@ LD_LIBRARY_PATH="${SINGULAR}/${SINGULAR_SYSTEM_TYPE}:${LD_LIBRARY_PATH}"
 fi
 unset SINGULAR_SYSTEM_TYPE
 
-./tt
---------------------------------------
-the example:
-#include <libsingular.h>
-main()
-{
-  // init path names etc.
-  siInit((char *)"/...Singular-3-1-3/Singular/libsingular.so");
-
-  // construct the ring Z/32003[x,y,z]
-  // the variable names
-  char **n=(char**)omalloc(3*sizeof(char*));
-  n[0]=omStrDup("x");
-  n[1]=omStrDup("y");
-  n[2]=omStrDup("z2");
-
-  ring R=rDefault(32003,3,n);
-  // make R the default ring:
-  rChangeCurrRing(R);
-
-  // create the polynomial 1
-  poly p1=p_ISet(1,R);
-
-  // create tthe polynomial 2*x^3*z^2
-  poly p2=p_ISet(2,R);
-  pSetExp(p2,1,3);
-  pSetExp(p2,3,2);
-  pSetm(p2);
-
-  // print p1 + p2
-  pWrite(p1); printf(" + \n"); pWrite(p2); printf("\n");
-
-  // compute p1+p2
-  p1=p_Add_q(p1,p2,R); p2=NULL;
-  pWrite(p1); 
-
-  // clean up:
-  pDelete(&p1);
-  rKill(R);
-
-  currentVoice=feInitStdin(NULL);
-  // hook for error handling:
-  // WerrorS_callback=......; of type p(const char *)
-  int err=iiAllStart(NULL,"int ver=system(\"version\");\n",BT_proc,0);
-  if (err) errorreported = 0; // reset error handling
-  printf("interpreter returns %d\n",err);
-  idhdl h=ggetid("ver");
-  if (h!=NULL)
-    printf("singular variable ver of type %d contains %d\n",h->typ,(int)(long)IDDATA(h));
-  else
-    printf("variable ver does not exist\n");
-
-  // calling a singular-library function
-  idhdl datetime=ggetid("datetime");
-  if (datetime==NULL)
-    printf("datetime not found\n");
-  else
-  {
-    leftv res=iiMake_proc(datetime,NULL,NULL);
-    if (res==NULL) { printf("datetime return an error\n"); errorreported = 0; }
-    else           printf("datetime returned type %d, >>%s<<\n",res->Typ(),(char *)res->Data());
-  }
-
-  // changing a ring for the interpreter
-  // re-using n and R from above
-  R=rDefault(32003,3,n);
-  idhdl newRingHdl=enterid("R" /* ring name*/,
-                           0, /*nesting level, 0=global*/
-                           RING_CMD,
-                           &IDROOT,
-                           FALSE);
-   IDRING(newRingHdl)=R;
-   // make R the default ring (include rChangeCurrRing):
-   rSetHdl(newRingHdl);
-   err=iiAllStart(NULL,"poly p=x;listvar();return();\n"),BT_Proc,0);
-
-  // calling a kernel function via the interpreter interface
-  sleftv r1; memset(&r1,0,sizeof(r1));
-  sleftv arg; memset(&arg,0,sizeof(r1));
-  arg.rtyp=STRING_CMD;
-  arg.data=omStrDup("huhu");
-  err=iiExprArith1(&r1,&arg,TYPEOF_CMD);
-  printf("interpreter returns %d\n",err);
-  if (err) errorreported = 0; // reset error handling
-  else printf("typeof returned type %d, >>%s<<\n",r1.Typ(),r1.Data());
-  // clean up r1:
-  r1.CleanUp();
-}
+find commented examples in libsing-test1.cc and libsing-test2.cc
diff --git a/kernel/febase.cc b/kernel/febase.cc
index 4dd6a19..676ef45 100644
--- a/kernel/febase.cc
+++ b/kernel/febase.cc
@@ -196,6 +196,8 @@ void newBuffer(char* s, feBufferTypes t, procinfo* pi, int lineno)
   currentVoice->Next();
   //Print(":Buffer%d(%s):%s(%x)\n",
   //  t,BT_name[t],pname,currentVoice);
+  if (currentVoice!=NULL)
+  {
   if (pi!=NULL)
   {
     long l=strlen(pi->procname);
@@ -215,6 +217,7 @@ void newBuffer(char* s, feBufferTypes t, procinfo* pi, int lineno)
   currentVoice->buffer   = s;
   currentVoice->sw       = BI_buffer;
   currentVoice->typ      = t;
+  }
   switch (t)
   {
     case BT_execute:
@@ -236,6 +239,7 @@ void newBuffer(char* s, feBufferTypes t, procinfo* pi, int lineno)
                      break;
   }
   //Print("start body (%s) at line %d\n",BT_name[t],yylineno);
+  if (currentVoice!=NULL)
   currentVoice->start_lineno = yylineno;
   //printf("start buffer typ %d\n",t);
   //Voice *p=currentVoice;

-- 
an open source computer algebra system



More information about the debian-science-commits mailing list