Changeset f92cf8 in git


Ignore:
Timestamp:
Jul 21, 1999, 9:52:53 PM (25 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
65a2bd9f87363fac232bdb2f6e2bcc91faad71fe
Parents:
18bd9c70860cace4782c5c85c88c5ad93550527f
Message:
* cheksum added


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

Legend:

Unmodified
Added
Removed
  • Singular/libparse.l

    r18bd9c rf92cf8  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 /* $Id: libparse.l,v 1.34 1999-07-21 11:41:16 obachman Exp $ */
     5/* $Id: libparse.l,v 1.35 1999-07-21 19:52:52 obachman Exp $ */
    66#include <stdio.h>
    77#include <string.h>
     
    126126#  endif /* STANDALONE_PARSER */
    127127
     128static unsigned long help_chksum;
    128129#  define SET_DEF_END(mode, pi, p) \
    129130     if ( mode == LOAD_LIB) pi->data.s.def_end = p;
    130131#  define SET_HELP_START(mode, pi, p) \
    131      if ( mode == LOAD_LIB) pi->data.s.help_start = p;
    132 
     132     if ( mode == LOAD_LIB) {pi->data.s.help_start = p; help_chksum = 0;}
    133133#  define SET_HELP_END(mode, pi, p) \
    134      if ( mode == LOAD_LIB) pi->data.s.help_end = p;
     134     if ( mode == LOAD_LIB) {pi->data.s.help_end = p;  \
     135                             pi->data.s.help_chksum = help_chksum;}
    135136
    136137#  define SET_BODY_START(mode, pi, l, p) \
     
    155156       if(pi->data.s.body_end==0) pi->data.s.body_end = p-1; \
    156157     }
     158
     159#define ROTATE_RIGHT(c) if ((c) & 01) (c) = ((c) >>1) + 0x8000; else (c) >>= 1;
     160#define IncrCheckSum(c)                          \
     161do                                              \
     162{                                               \
     163  ROTATE_RIGHT(help_chksum);                  \
     164  help_chksum += c;                           \
     165  help_chksum &= 0xffff;                      \
     166}                                               \
     167while(0)
    157168
    158169#  undef YY_DECL
     
    606617#endif
    607618           }
    608 <phelp>\n  { yylplineno++; }
     619<phelp>\n  { yylplineno++;}
    609620
    610621<pbody>({comment}[^\n]*) { }
     
    695706                           last_cmd = LP_NONE;
    696707                           if(old_state==phelp)
     708                           {             
    697709                              SET_HELP_END(mode, pi, current_pos(0));
     710                           }
    698711                           BEGIN(old_state); /* printf("%s", yytext); */
    699712                         }
    700 <string>(\\\\)|(\\\")    { }
    701 <string>\n               { yylplineno++; }
    702 <string>.                { }
     713<string>(\\\\)|(\\\")    { if (old_state == phelp) IncrCheckSum(*yytext);}
     714<string>\n               { yylplineno++; if (old_state == phelp) IncrCheckSum('\n');}
     715<string>.                { if (old_state == phelp) IncrCheckSum(*yytext);}
    703716
    704717<pexample>(\/\/[^\n]*)  { }
  • Singular/utils.cc

    r18bd9c rf92cf8  
    128128  pi->data.s.example_lineno = 0;
    129129  pi->data.s.body = NULL;
     130  pi->data.s.help_chksum = 0;
    130131  return(pi);
    131132}
     
    199200      PrintOut(fp, pi->data.s.example_start, pi->data.s.proc_end);
    200201      printf("\nEOT\n");
     202      printf("$chksum{\"%s\"} = %d;\n", pi->procname, pi->data.s.help_chksum);
    201203    }
    202204  }
Note: See TracChangeset for help on using the changeset viewer.