Changeset a18fae in git


Ignore:
Timestamp:
Feb 27, 1998, 5:28:01 PM (26 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
8520b7877eddd3c2fb9e800be697d25406a2e9fd
Parents:
057e93cfb99481837b68f0a75ed85363fff714b6
Message:
* hannes: fixed echo handling
  (febase.h febase.inc, silink.cc)
  updated documentation
  (doc/*.doc)


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

Legend:

Unmodified
Added
Removed
  • Singular/febase.h

    r057e93c ra18fae  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: febase.h,v 1.6 1998-02-27 14:06:11 Singular Exp $ */
     6/* $Id: febase.h,v 1.7 1998-02-27 16:27:56 Singular Exp $ */
    77/*
    88* ABSTRACT
     
    4747enum   feBufferTypes
    4848{
     49  BT_none  = 0,  // entry level
    4950  BT_break = 1,  // while, for
    50   BT_proc,       // proc, script
     51  BT_proc,       // proc
    5152  BT_example,    // example
    5253  BT_file,       // <"file"
  • Singular/febase.inc

    r057e93c ra18fae  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: febase.inc,v 1.2 1998-02-27 14:06:11 Singular Exp $ */
     4/* $Id: febase.inc,v 1.3 1998-02-27 16:27:57 Singular Exp $ */
    55/*
    66* ABSTRACT: handling of 'voices'
     
    345345
    346346/*2
    347 * print prompt (si_echo or TRACE), set prompt_char
     347* set prompt_char
     348* only called with currentVoice->sw == BI_stdin
    348349*/
    349350static void feShowPrompt(void)
    350351{
    351   if ((traceit&TRACE_SHOW_LINE)
    352   || (traceit&TRACE_SHOW_LINE1)
    353   || (currentVoice->Typ() != BT_example))
    354   {
    355     if ((si_echo > myynest) || (currentVoice->sw == BI_stdin) || (traceit&TRACE_SHOW_LINE)
    356     || (traceit&TRACE_SHOW_LINE1))
    357     {
     352  //if (currentVoice->sw == BI_stdin)
     353  {
    358354#ifdef HAVE_TCL
    359       if (tclmode)
    360       {
    361          PrintTCL('P',(prompt_char=='>')? 0 : 1,NULL);
    362       }
    363       else
     355    if (tclmode)
     356    {
     357       PrintTCL('P',(prompt_char=='>')? 0 : 1,NULL);
     358    }
     359    else
    364360#endif
    365       if ((BVERBOSE(V_PROMPT))&&(!feBatch))
    366       {
    367         if (currentVoice->sw == BI_stdin)
    368         {
    369           fe_promptstr[0]=prompt_char;
     361    if ((BVERBOSE(V_PROMPT))&&(!feBatch))
     362    {
     363      fe_promptstr[0]=prompt_char;
    370364#ifndef HAVE_READLINE
    371           PrintS(fe_promptstr);
     365      PrintS(fe_promptstr);
    372366#endif
    373         }
    374         else
    375         {
    376           if (currentVoice->filename==NULL)
    377             Print("(none) %3d%c ",yylineno,prompt_char);
    378           else
    379             Print("%s %3d%c ",currentVoice->filename,yylineno,prompt_char);
    380         }
    381         prompt_char = '.';
    382         mflush();
    383       }
     367    }
     368    mflush();
    384369#ifdef macintosh
    385       cols = 0;
     370    cols = 0;
    386371#endif
    387     }
    388372  }
    389373}
     
    394378static int fePrintEcho(char *anf)
    395379{
     380  prompt_char = '.';
    396381  char *ss=strchr(anf,'\n');
    397382  int len_s;
     
    411396  // handle echo:
    412397  if (((si_echo>myynest)
    413     && (currentVoice->typ!=BT_break)
    414     && (currentVoice->typ!=BT_execute)
    415     && (strncmp(anf,";return();",10)!=0)
     398    && (((currentVoice->typ==BT_proc)
     399         && (strncmp(anf,";return();",10)!=0))
     400      || (currentVoice->typ==BT_example)
     401      || (currentVoice->typ==BT_file)
     402      || (currentVoice->typ==BT_none)
     403      )
    416404  )
    417405  || (traceit&TRACE_SHOW_LINE)
    418406  || (traceit&TRACE_SHOW_LINE1))
    419407  {
     408    if (currentVoice->filename==NULL)
     409      Print("(none) %3d%c ",yylineno,prompt_char);
     410    else
     411      Print("%s %3d%c ",currentVoice->filename,yylineno,prompt_char);
    420412    fwrite(anf,1,len_s,stdout);
    421413    mflush();
     
    454446        strncpy(s,anf,len+2);
    455447        s[len+1]='\0';
    456         feShowPrompt();
    457448        fePrintEcho(s);
    458449        FreeL((ADDRESS)s);
     
    470461        s[len+1]='\0';
    471462        yylineno++;
    472         feShowPrompt();
    473463        fePrintEcho(s);
    474464        FreeL((ADDRESS)s);
     
    489479NewRead:
    490480  yylineno++;
    491   feShowPrompt();
    492481  if (currentVoice->sw==BI_stdin)
     482  {
     483    feShowPrompt();
    493484    s=fe_fgets_stdin(currentVoice->buffer+offset,(4096-sizeof(ADDRESS))-offset);
     485  }
    494486  else if (currentVoice->sw==BI_file)
    495487    s=fgets(currentVoice->buffer+offset,(4096-sizeof(ADDRESS))-offset,
  • Singular/ideals.cc

    r057e93c ra18fae  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ideals.cc,v 1.19 1998-02-24 09:52:22 siebert Exp $ */
     4/* $Id: ideals.cc,v 1.20 1998-02-27 16:27:58 Singular Exp $ */
    55/*
    66* ABSTRACT - all basic methods to manipulate ideals
     
    21972197}
    21982198
     2199/*2
     2200* compute all ar-minors of the matrix a
     2201*/
     2202ideal idMinors(matrix a, int ar)
     2203{
     2204  if(ar<=0)
     2205  {
     2206    Werror("%d-th minor ",ar);
     2207    return NULL;
     2208  }
     2209  int     i,j,k,size;
     2210  int *rowchoise,*colchoise;
     2211  BOOLEAN rowch,colch;
     2212  ideal result;
     2213  matrix tmp;
     2214  poly p;
     2215
     2216  i = binom(a->rows(),ar);
     2217  j = binom(a->cols(),ar);
     2218
     2219  rowchoise=(int *)Alloc(ar*sizeof(int));
     2220  colchoise=(int *)Alloc(ar*sizeof(int));
     2221  if ((i>512) || (j>512) || (i*j >512)) size=512;
     2222  else size=i*j;
     2223  result=idInit(size,1);
     2224  tmp=mpNew(ar,ar);
     2225  k = 0; /* the index in result*/
     2226  idInitChoise(ar,1,a->rows(),&rowch,rowchoise);
     2227  while (!rowch)
     2228  {
     2229    idInitChoise(ar,1,a->cols(),&colch,colchoise);
     2230    while (!colch)
     2231    {
     2232      for (i=1; i<=ar; i++)
     2233      {
     2234        for (j=1; j<=ar; j++)
     2235        {
     2236          MATELEM(tmp,i,j) = MATELEM(a,rowchoise[i-1],colchoise[j-1]);
     2237        }
     2238      }
     2239      p = mpDet(tmp);
     2240      if (p!=NULL)
     2241      {
     2242        if (k>=size)
     2243        {
     2244          pEnlargeSet(&result->m,size,32);
     2245          size += 32;
     2246        }
     2247        result->m[k] = p;
     2248        k++;
     2249      }
     2250      idGetNextChoise(ar,a->cols(),&colch,colchoise);
     2251    }
     2252    idGetNextChoise(ar,a->rows(),&rowch,rowchoise);
     2253  }
     2254  /*delete the matrix tmp*/
     2255  for (i=1; i<=ar; i++)
     2256  {
     2257    for (j=1; j<=ar; j++) MATELEM(tmp,i,j) = NULL;
     2258  }
     2259  idDelete((ideal*)&tmp);
     2260  if (k==0)
     2261  {
     2262    k=1;
     2263    result->m[0]=NULL;
     2264  }
     2265  Free((ADDRESS)rowchoise,ar*sizeof(int));
     2266  Free((ADDRESS)colchoise,ar*sizeof(int));
     2267  pEnlargeSet(&result->m,size,k-size);
     2268  IDELEMS(result) = k;
     2269  return (result);
     2270}
     2271
    21992272/*3
    22002273* produces recursively the ideal of all arxar-minors of a
    22012274*/
    22022275static void idRecMin(matrix a,int ar,poly *barDiv,ideal result,
    2203               int * nextPlace, int rowToChose=0)
     2276              int * nextPlace, intvec * pfRows, intvec * iv)
    22042277{
    22052278//Print("Level: %d\n",ar);
     
    22112284
    22122285/*--- initializing temporary structures-------------------*/
    2213   int i,j,r=rowToChose,c,newi,newp,k;
     2286  int i,j,r,c,newi,newp,k;
    22142287  poly p=NULL,pp;
     2288  BOOLEAN justChosen=FALSE;
    22152289
    22162290  if (ar==0)
     
    22302304          }
    22312305          MATELEM(a,i,j) = NULL;
     2306//if ((*nextPlace==21) || (*nextPlace==37))
     2307//{
     2308//  Print("Hier sind sie!\n");
     2309//}
     2310//pWrite(p);
    22322311          result->m[*nextPlace] = p;
    22332312          (*nextPlace)++;
     
    22352314      }
    22362315    }
    2237     idTest(result);
    22382316    idDelete((ideal*)&a);
    22392317    return;
     
    22432321  pp = pCopy(p);   //we had to store barDiv for the remaining loops
    22442322  matrix nextStep = mpOneStepBareiss(a,barDiv,&r,&c);
    2245 //Print("next row is: %d, next col: %d\n",r,c);
    2246 /*--- there is no pivot - the matrix is zero -------------*/
    2247   if (r*c==0)
    2248   {
    2249     idDelete((ideal*)&a);
    2250     return;
    2251   }
     2323/*--- we compute the row-index of the chosen row r -------*/
     2324  newi = 0;
     2325  while ((newi<iv->length()) && ((*iv)[newi]!=0)) newi++;
     2326  k = (*iv)[newi] = r;
     2327  for (j=newi-1;j>0;j--)
     2328  {
     2329    if (k>=(*iv)[j]) k++;
     2330  }
     2331  newp = 0;
     2332  while ((newp<pfRows->length()) && ((*pfRows)[newp]!=0))
     2333  {
     2334    if ((*pfRows)[newp]==k)
     2335    {
     2336      justChosen = TRUE;
     2337//Print("just chosen\n");
     2338      break;
     2339    }
     2340    newp++;
     2341  }
     2342  if (!justChosen) (*pfRows)[newp] = k;
     2343//Print("Chosen: ");pfRows->show();PrintLn();
     2344//Print("Deleted: ");iv->show();PrintLn();
    22522345/*--- we read out the r-1 x c-1 matrix for the next step--*/
    22532346  if ((a->nrows-1)*(a->ncols-1)>0)
     
    22642357    idDelete((ideal*)&nextStep);
    22652358/*--- we call the next Step------------------------------*/
    2266     idRecMin(next,ar-1,barDiv,result,nextPlace);
     2359    idRecMin(next,ar-1,barDiv,result,nextPlace,pfRows,iv);
    22672360    next = NULL;
    22682361  }
    22692362/*--- now we have to take out the r-th row...------------*/
    2270   if (((a->nrows)>1) && (rowToChose==0))
     2363//Print("back for rows on Level: %d\n",ar);
     2364//Print("The actual row was %d\n",k);
     2365//Print("Chosen: ");pfRows->show();PrintLn();
     2366//Print("Deleted: ");iv->show();PrintLn();
     2367  if (((a->nrows)>1) && (!justChosen))
    22712368  {
    22722369    nextStep = mpNew(a->nrows-1,a->ncols);
     
    22862383    }
    22872384/*--- and to perform the algorithm with the rest---------*/
    2288     idRecMin(nextStep,ar,&p,result,nextPlace);
     2385    idRecMin(nextStep,ar,&p,result,nextPlace,pfRows,iv);
    22892386    nextStep = NULL;
    22902387  }
    22912388/*--- now we have to take out the c-th col...------------*/
     2389//Print("back for cols on Level: %d\n",ar);
     2390//Print("Chosen: ");pfRows->show();PrintLn();
     2391//Print("Deleted: ");iv->show();PrintLn();
    22922392  if ((a->nrows)>1)
    22932393  {
     
    23092409      }
    23102410    }
     2411    idDelete((ideal*)&a);
    23112412/*--- and to perform the algorithm with the rest---------*/
    2312     idDelete((ideal*)&a);
    2313     idRecMin(nextStep,ar,&p,result,nextPlace,r);
     2413    (*iv)[newi] = 0;
     2414    idRecMin(nextStep,ar,&p,result,nextPlace,pfRows,iv);
    23142415    nextStep = NULL;
    23152416  }
    23162417/*--- deleting temporary structures and returns----------*/
     2418  if (!justChosen) (*pfRows)[newp] = 0;
    23172419  pDelete(barDiv);
    23182420  pDelete(&p);
     
    23252427* the caller of idRecMin
    23262428*/
    2327 ideal idMinors(matrix a, int ar)
     2429ideal idMinors1(matrix a, int ar)
    23282430{
    23292431  if((ar<=0) || (ar>min(a->ncols,a->nrows)))
     
    23332435  }
    23342436  int i=0;
     2437  intvec * iv=new intvec(a->nrows+1);
     2438  intvec * pv=new intvec(a->nrows+1);
    23352439  poly barDiv=NULL;
    23362440  ideal result=idInit(16,0);
    2337   idTest(result);
    2338 
    2339   idRecMin(mpCopy(a),ar-1,&barDiv,result,&i);
     2441
     2442  idRecMin(mpCopy(a),ar-1,&barDiv,result,&i,pv,iv);
    23402443  idSkipZeroes(result);
     2444  delete iv;
     2445  delete pv;
    23412446  return result;
    23422447}
  • Singular/silink.cc

    r057e93c ra18fae  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: silink.cc,v 1.14 1998-02-27 14:06:25 Singular Exp $ */
     4/* $Id: silink.cc,v 1.15 1998-02-27 16:28:01 Singular Exp $ */
    55
    66/*
     
    703703    if (status)
    704704      return TRUE;
     705     
     706    int old_echo=si_echo;
     707    si_echo=0;
     708
    705709    status=yyparse();
     710   
     711    si_echo=old_echo;
    706712
    707713    if (status)
  • Singular/tesths.cc

    r057e93c ra18fae  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: tesths.cc,v 1.30 1998-02-27 14:06:26 Singular Exp $ */
     4/* $Id: tesths.cc,v 1.31 1998-02-27 16:28:01 Singular Exp $ */
    55
    66/*
     
    148148              si_echo = (int)(argv[1][i] - '0');
    149149            }
    150             else si_echo = 2;
     150            else si_echo = 1;
    151151            break;
    152152            case 'r': siRandomStart = 0;
Note: See TracChangeset for help on using the changeset viewer.