Changeset 014db1 in git


Ignore:
Timestamp:
Mar 30, 2000, 8:36:10 AM (24 years ago)
Author:
Kai Krüger <krueger@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
bfe96e9898a9834b6a5f05048683eae6cdb49819
Parents:
affa29dcb41cb5f7503fc879b96bdfde32dc955d
Message:
Added trace and debug mode
exit on error while parsing\n
variable of procedures as declared (same name and type)\n


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

Legend:

Unmodified
Added
Removed
  • modules/modgen/creat_top.cc

    raffa29 r014db1  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: creat_top.cc,v 1.9 2000-03-29 13:56:26 krueger Exp $ */
     4/* $Id: creat_top.cc,v 1.10 2000-03-30 06:35:44 krueger Exp $ */
    55/*
    66* ABSTRACT: lib parsing
     
    133133    return -1;
    134134  }
    135   printf("Creating %s, ", filename);fflush(stdout);
     135  if(trace)printf("Creating %s, ", filename);fflush(stdout);
    136136  mod_write_header(module->modfp, module->name, 'c');
    137137  mod_copy_tmp(module->modfp, module->fmtfp);
    138   printf("  done.\n");fflush(stdout);
     138  if(trace)printf("\n");fflush(stdout);
    139139  fclose(module->fmtfp);
    140140  if(create_tmpfile(module)) return -1;
     
    143143  if(module->fmtfp2 == NULL) { printf("Cannot write HELP\n"); return -1; }
    144144  if(module->fmtfp3 == NULL) { printf("Cannot write EXAMPLE\n"); return -1; }
    145   printf("%p %p %p\n", module->fmtfp, module->fmtfp2, module->fmtfp3);
    146  
    147145 
    148146  strcpy(filename, build_filename(module, module->name, 2));
     
    152150    return -1;
    153151  }
    154   printf("Creating %s, ", filename);fflush(stdout);
     152  if(trace)printf("Creating %s, ", filename);fflush(stdout);
    155153  mod_write_header(module->modfp_h, module->name, 'h');
     154  if(trace)printf("\n");fflush(stdout);
    156155
    157156  //free(filename);
  • modules/modgen/grammar.y

    raffa29 r014db1  
    11/*
    2  * $Id: grammar.y,v 1.10 2000-03-29 14:29:11 krueger Exp $
     2 * $Id: grammar.y,v 1.11 2000-03-30 06:35:44 krueger Exp $
    33 */
    44
     
    2121extern moddef module_def;
    2222extern int yylineno;
     23extern int do_create_makefile;
    2324 
    2425extern int init_modgen(moddef *module_def, char *filename);
     
    8485goal: part1 sect2 sect2end code
    8586        {
    86           printf("Finish modules\n");
     87          if(trace)printf("Finish modules\n");
    8788          return 0;
    8889        }
     
    9192part1: initmod sect1 sect1end
    9293        {
    93           mod_create_makefile(&module_def);
     94          if(do_create_makefile)mod_create_makefile(&module_def);
    9495          if(write_intro(&module_def)) {
    95             myyyerror("Error while creating files\n");
    96             return 1;
     96            return(myyyerror("Error while creating files\n"));
    9797          }
    9898        };
     
    116116        {
    117117          memset(&procedure_decl, 0, sizeof(procdef));
    118           printf("End of section %d\n", sectnum-1);
     118          if(debug>2)printf("End of section %d\n", sectnum-1);
    119119        }
    120120        ;
    121121
    122122expr:   NAME '=' MSTRINGTOK
    123         { var_token vt;
     123        {
     124          var_token vt;
     125          int rc = 0;
    124126          void (*write_cmd)(moddefv module, var_token type = VAR_NONE,
    125127                            idtyp t, void *arg1 = NULL, void *arg2 = NULL);
     
    134136                }
    135137                else {
    136                   myyyerror("Line %d: Unknown variable '%s' in section %d\n",
     138                  rc=myyyerror("Line %d: Unknown variable '%s' in section %d\n",
    137139                            yylineno, $1, sectnum);
    138140                }
     
    143145                }
    144146                else {
    145                   myyyerror("Line %d: Unknown variable '%s' in section %d\n",
     147                  rc=myyyerror("Line %d: Unknown variable '%s' in section %d\n",
    146148                            yylineno, $1, sectnum);
    147149                }
     
    152154          free($1);
    153155          free($3.string);
     156          if(rc)return(rc);
    154157        }
    155158        | NAME '=' FILENAME
     
    208211        }
    209212        | NAME '=' BOOLTOK
    210         { var_token vt;
     213        {
     214          var_token vt;
     215          int rc = 0;
    211216          void (*write_cmd)(moddefv module, var_token type = VAR_NONE,
    212217                            idtyp t, void *arg1 = NULL, void *arg2 = NULL);
     
    217222                }
    218223                else {
    219                   myyyerror("Line %d: Unknown variable '%s' in section %d\n",
     224                  rc=myyyerror("Line %d: Unknown variable '%s' in section %d\n",
    220225                            yylineno, $1, sectnum);
    221226                }
     
    226231                }
    227232                else {
    228                   myyyerror("Line %d: Unknown variable '%s' in section %d\n",
     233                  rc=myyyerror("Line %d: Unknown variable '%s' in section %d\n",
    229234                            yylineno, $1, sectnum);
    230235                }
     
    234239          }
    235240          free($1);
     241          if(rc)return(rc);
    236242        }
    237243;
     
    239245files:  FILENAME ',' FILENAME
    240246        {
    241           printf(">>>>>>>>files '%s' , '%s'\n", $1, $3);
     247          if(debug>2)printf(">>>>>>>>files '%s' , '%s'\n", $1, $3);
    242248          Add2files(&module_def, $1);
    243249          Add2files(&module_def, $3);
     
    254260        {
    255261          write_finish_functions(&module_def, &procedure_decl);
    256           printf("End of section %d\n", sectnum-1);
     262          if(debug>2)printf("End of section %d\n", sectnum-1);
    257263        }
    258264        ;
     
    262268procdef: procdecl proccode
    263269        {
    264           printf("PROCDEF:\n");
     270          if(debug>2)printf("PROCDEF:\n");
    265271        }
    266272        | procdecl proccode procdeclexample
    267273        {
    268           printf("PROCDEF mit example:\n");
     274          if(debug>2)printf("PROCDEF mit example:\n");
    269275          fflush(module_def.fmtfp);
    270276        }
     
    286292          free($2);
    287293          if(write_singular_procedures(&module_def, &procedure_decl))
    288             myyyerror("Error while creating bin-file\n");
     294            return(myyyerror("Error while creating bin-file\n"));
    289295        }
    290296        | STATICTOK PROCDECLTOK NAME
     
    294300          free($3);
    295301          if(write_singular_procedures(&module_def, &procedure_decl))
    296             myyyerror("Error while creating bin-file\n");
     302            return(myyyerror("Error while creating bin-file\n"));
    297303        };
    298304
     
    315321funcdecl1: NAME
    316322        {
    317           printf("funcdecl1-1\n");
     323          if(debug>2)printf("funcdecl1-1\n");
    318324          init_proc(&procedure_decl, $1, NULL, yylineno);
    319325          free($1);
     
    321327        | VARTYPETOK NAME
    322328        {
    323           printf("funcdecl1-2\n");
     329          if(debug>2)printf("funcdecl1-2\n");
    324330          init_proc(&procedure_decl, $2, &$1, yylineno);
    325331          free($2);
     
    327333        | STATICTOK NAME
    328334        {
    329           printf("funcdecl1-3\n");
     335          if(debug>2)printf("funcdecl1-3\n");
    330336          init_proc(&procedure_decl, $2, NULL, yylineno);
    331337          free($2);
     
    334340        | STATICTOK VARTYPETOK NAME
    335341        {
    336           printf("funcdecl1-4\n");
     342          if(debug>2)printf("funcdecl1-4\n");
    337343          init_proc(&procedure_decl, $3, &$2, yylineno);
    338344          free($3);
     
    345351          procedure_decl.help_string = $1.string;
    346352          procedure_decl.lineno_other = $1.lineno;
    347           printf("\t\thelp at %d\n", yylineno);
     353          if(debug>2)printf("\t\thelp at %d\n", yylineno);
    348354          write_help(&module_def, &procedure_decl);
    349355        }
     
    377383        {
    378384          if(procedure_decl.procname == NULL) {
    379             myyyerror("example without proc-declaration at line %d\n",
    380                      yylineno);
    381           }
    382           printf("Example at %d\n", yylineno);
     385            return(myyyerror("example without proc-declaration at line %d\n",
     386                     yylineno));
     387          }
     388          if(debug>2)printf("Example at %d\n", yylineno);
    383389          procedure_decl.lineno_other = yylineno;
    384390        };
     
    414420          switch(vt=checkcmd($2, &write_cmd, CMDT_SINGLE, 0)) {
    415421              case CMD_NONE:
    416                 myyyerror("Line %d: Unknown command '%s' in section %d\n",
    417                           yylineno, $2, sectnum);
     422                return(myyyerror("Line %d: Unknown command '%s' in section %d\n",
     423                          yylineno, $2, sectnum));
    418424                break;
    419425              case CMD_BADSYNTAX:
    420                 myyyerror("Line %d: bad syntax of command '%s' in section %d\n",
    421                           yylineno, $2, sectnum);
     426                return(myyyerror("Line %d: bad syntax of command '%s' in section %d\n",
     427                          yylineno, $2, sectnum));
    422428                break;
    423429              default:
     
    433439          switch(vt=checkcmd($2, &write_cmd, CMDT_0, 1)) {
    434440              case CMD_NONE:
    435                 myyyerror("Line %d: Unknown command '%s' in section %d\n",
    436                           yylineno, $2, sectnum);
     441                return(myyyerror("Line %d: Unknown command '%s' in section %d\n",
     442                          yylineno, $2, sectnum));
    437443                break;
    438444              case CMD_BADSYNTAX:
    439                 myyyerror("Line %d: bad syntax of command '%s' in section %d\n",
    440                           yylineno, $2, sectnum);
     445                return(myyyerror("Line %d: bad syntax of command '%s' in section %d\n",
     446                          yylineno, $2, sectnum));
    441447                break;
    442448              default:
     
    453459          switch(vt=checkcmd($2, &write_cmd, CMDT_ANY, 1)) {
    454460              case CMD_NONE:
    455                 myyyerror("Line %d: Unknown command '%s' in section %d\n",
    456                           yylineno, $2, sectnum);
     461                return(myyyerror("Line %d: Unknown command '%s' in section %d\n",
     462                          yylineno, $2, sectnum));
    457463                break;
    458464              case CMD_BADSYNTAX:
    459                 myyyerror("Line %d: bad syntax of command '%s' in section %d\n",
    460                           yylineno, $2, sectnum);
     465                return(myyyerror("Line %d: bad syntax of command '%s' in section %d\n",
     466                          yylineno, $2, sectnum));
    461467                break;
    462468              default:
     
    472478          switch(vt=checkcmd($2, &write_cmd, CMDT_ANY, 1)) {
    473479              case CMD_NONE:
    474                 myyyerror("Line %d: Unknown command '%s' in section %d\n",
    475                           yylineno, $2, sectnum);
     480                return(myyyerror("Line %d: Unknown command '%s' in section %d\n",
     481                          yylineno, $2, sectnum));
    476482                break;
    477483              case CMD_BADSYNTAX:
    478                 myyyerror("Line %d: bad syntax of command '%s' in section %d\n",
    479                           yylineno, $2, sectnum);
     484                return(myyyerror("Line %d: bad syntax of command '%s' in section %d\n",
     485                          yylineno, $2, sectnum));
    480486                break;
    481487              default:
     
    491497          switch(vt=checkcmd($2, &write_cmd, CMDT_EQ, 0)) {
    492498              case CMD_NONE:
    493                 myyyerror("Line %d: Unknown command '%s' in section %d\n",
    494                           yylineno, $2, sectnum);
     499                return(myyyerror("Line %d: Unknown command '%s' in section %d\n",
     500                          yylineno, $2, sectnum));
    495501                break;
    496502              case CMD_BADSYNTAX:
    497                 myyyerror("Line %d: bad syntax of command '%s' in section %d\n",
    498                           yylineno, $2, sectnum);
     503                return(myyyerror("Line %d: bad syntax of command '%s' in section %d\n",
     504                          yylineno, $2, sectnum));
    499505                break;
    500506              default:
     
    506512identifier: NAME
    507513        {
    508           printf("### ID ### Name %s\n", $1);
     514          if(debug>2)printf("### ID ### Name %s\n", $1);
    509515          $$ = $1;
    510516        }
     
    512518        {
    513519          int len = strlen($$) + strlen($3) + 2;
    514           printf("### ID ### Name %s\n", $3);
     520          if(debug>2)printf("### ID ### Name %s\n", $3);
    515521          $$ = (char *)realloc($$, len);
    516522          strcat($$, "::");
     
    520526arglist: NAME
    521527        {
    522           printf("### ARGS %s\n", $1);
     528          if(debug>2)printf("### ARGS %s\n", $1);
    523529        }
    524530        | arglist ',' NAME
    525531        {
    526           printf("### ARGS %s\n", $3);
     532          if(debug>2)printf("### ARGS %s\n", $3);
    527533        };
    528534       
    529535sgtypelist: VARTYPETOK NAME
    530536        {
    531           printf("\tsgtypelist %s %s\n", $1.name, $2);
     537          if(debug>2)printf("\tsgtypelist %s %s\n", $1.name, $2);
    532538          write_singular_parameter(&module_def, yylineno, $1.name, $2);
    533539          free($1.name);
     
    536542        | VARTYPETOK '#'
    537543        {
    538           printf("\tsgtypelist %s %s\n", $1.name, $2);
     544          if(debug>2)printf("\tsgtypelist %s %s\n", $1.name, $2);
    539545          write_singular_parameter(&module_def, yylineno, $1.name, "#");
    540546          free($1.name);
     
    542548        | sgtypelist ',' VARTYPETOK NAME
    543549        {
    544           printf("\tsgtypelist next  %s %s\n", $3.name, $4);
     550          if(debug>2)printf("\tsgtypelist next  %s %s\n", $3.name, $4);
    545551          write_singular_parameter(&module_def, yylineno, $3.name, $4);
    546552          free($3.name);
     
    549555        | sgtypelist ',' VARTYPETOK '#'
    550556        {
    551           printf("\tsgtypelist next  %s %s\n", $3.name, $4);
     557          if(debug>2)printf("\tsgtypelist next  %s %s\n", $3.name, $4);
    552558          write_singular_parameter(&module_def, yylineno, $3.name, "#");
    553559          free($3.name);
     
    563569        {
    564570          if(check_reseverd($2))
    565             myyyerror("Line %d: variablename '%s' is reserved\n",
    566                             yylineno, $2);
     571            return(myyyerror("Line %d: variablename '%s' is reserved\n",
     572                            yylineno, $2));
    567573          AddParam(&procedure_decl, &$1, $2);
    568574          free($1.name); free($2);
     
    576582        {
    577583          if(check_reseverd($4))
    578             myyyerror("Line %d: variablename '%s' is reserved\n",
    579                             yylineno, $4);
     584            return(myyyerror("Line %d: variablename '%s' is reserved\n",
     585                            yylineno, $4));
    580586          AddParam(&procedure_decl, &$3, $4);
    581587          free($3.name); free($4);
  • modules/modgen/makefile.cc

    raffa29 r014db1  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: makefile.cc,v 1.4 2000-03-29 13:56:27 krueger Exp $ */
     4/* $Id: makefile.cc,v 1.5 2000-03-30 06:35:44 krueger Exp $ */
    55/*
    66* ABSTRACT: lib parsing
     
    4747  int i;
    4848 
    49   printf("Creating Makefile  ...");fflush(stdout);
     49  if(trace)printf("Creating Makefile  ...");fflush(stdout);
    5050  write_header(fp, module->name, "#");
    5151  build_head_section(fp, module);
     
    7171
    7272  fclose(fp);
    73   printf("  done.\n");
     73  if(trace)printf("  done.\n");
    7474}
    7575
  • modules/modgen/misc.cc

    raffa29 r014db1  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: misc.cc,v 1.8 2000-03-29 09:31:41 krueger Exp $ */
     4/* $Id: misc.cc,v 1.9 2000-03-30 06:35:45 krueger Exp $ */
    55/*
    66* ABSTRACT: lib parsing
     
    129129  if(cmds[i].alias==2)
    130130  {
    131     printf("outdated identifier `%s` used - please change your code",
     131    if(trace)printf("outdated identifier `%s` used - please change your code",
    132132    cmds[i].name);
    133133    cmds[i].alias=1;
     
    174174    default: strcpy(name,"(null)");
    175175  }
    176 #if 0
    177   printf("[%d=%s]", n, name);
    178   fflush(stdout);
    179 #endif
    180176  return(name);
    181177}
    182 
    183 #if 0
    184 static int iiTabIndex(const jjValCmdTab dArithTab, const int len, const int op)
    185 {
    186   int a=0;
    187   int e=len;
    188   int p=len/2;
    189   while ( a!=e)
    190   {
    191      if (op==dArithTab[p].cmd) return dArithTab[p].start;
    192      else if (op<dArithTab[p].cmd)
    193      { e=p; p=a+(e-a)/2;}
    194      else
    195      { a=p; p=p+(e-p)/2; }
    196   }
    197   return -1;
    198 }
    199 #endif
    200178
    201179/*========================================================================*/
     
    239217}
    240218 
     219/*========================================================================*/
    241220struct valid_vars_def {
    242221  char *name;
     
    273252}
    274253
     254/*========================================================================*/
    275255void write_main_variable(
    276256  moddefv module,
     
    284264           module->filename);
    285265}
    286 
    287266 
    288267/*========================================================================*/
     
    568547  strcpy(type_conv[], "");
    569548  strcpy(type_conv[], "");
    570 */
    571549  printf("[%d] %s\n", INT_CMD, type_conv[INT_CMD]);
    572550  printf("[%d] %s\n", MODUL_CMD, type_conv[MODUL_CMD]);
     
    574552  printf("[%d] %s\n", LINK_CMD, type_conv[LINK_CMD]);
    575553  printf("[%d] %s\n", PACKAGE_CMD, type_conv[PACKAGE_CMD]);
    576   /**/
    577 }
    578 
    579 /*========================================================================*/
     554  / **/
     555}
     556
     557/*========================================================================*/
  • modules/modgen/modgen.h

    raffa29 r014db1  
    11/*
    2  *  $Id: modgen.h,v 1.10 2000-03-29 13:56:27 krueger Exp $
     2 *  $Id: modgen.h,v 1.11 2000-03-30 06:36:10 krueger Exp $
    33 *
    44 */
     
    125125 */
    126126extern int modlineno;    /* lineno within module */
     127extern int debug;
     128extern int trace;
    127129
    128130extern int IsCmd(char *n, int & tok);
    129131extern char * decl2str(int n, char *name);
    130132
    131 extern void myyyerror(char *fmt, ...);
     133extern int myyyerror(char *fmt, ...);
    132134
    133135
  • modules/modgen/proc.cc

    raffa29 r014db1  
    11/*
    2  * $Id: proc.cc,v 1.11 2000-03-29 13:56:27 krueger Exp $
     2 * $Id: proc.cc,v 1.12 2000-03-30 06:35:45 krueger Exp $
    33 */
    44
     
    1212#include "typmap.h"
    1313
    14 extern int trace;
    1514
    1615#if 1
     
    3938  if( proc == NULL ) return;
    4039
    41   if(trace) printf("\tcreating '%s'...", proc->procname); fflush(stdout);
     40  if(trace) printf("\n\tcreating '%s'...", proc->procname); fflush(stdout);
    4241  fprintf(module->modfp, "#line %d \"%s\"\n", proc->lineno, module->filename);
    4342  modlineno+=1;
     
    5958        modlineno+=1;
    6059       
    61 #if 0
    62         if(proc->help_string!=NULL) {
    63           printf("WRITE HELP\n");
    64           fprintf(module->fmtfp2, "  1-enter_id(\"%s\",", proc->procname);
    65           fprintf(module->fmtfp2, " \"%s\", STRING_CMD);\n", proc->help_string);
    66         }
    67         if(proc->example_string!=NULL) {
    68           printf("WRITE EXAMPLE\n");
    69           fprintf(module->fmtfp3, "  1-enter_id(\"%s\",", proc->procname);
    70           fprintf(module->fmtfp3, " \"%s\", STRING_CMD);\n",
    71                   proc->example_string);
    72         }
    73 #endif
    7460        fprintf(module->modfp, "\n");
    7561        modlineno+=1;
     
    115101  }
    116102  for (i=0;i<pi->paramcnt; i++) {
    117     fprintf(fp, "%s res%d", type_conv[pi->param[i].typ], i);
     103    fprintf(fp, "%s %s%d", type_conv[pi->param[i].typ], i);
    118104    if(i<pi->paramcnt-1) fprintf(fp, ", ");
    119105  }
     
    135121    fprintf(module->fmtfp, "  leftv v = h, v_save;\n");
    136122    fprintf(module->fmtfp, "  int tok = NONE, index = 0;\n");
    137     for (i=0;i<pi->paramcnt; i++)
     123    for (i=0;i<pi->paramcnt; i++) {
    138124      fprintf(module->fmtfp,
    139               "  sleftv s%s; leftv %s = &s%s;\n", pi->param[i].varname,
     125              "  sleftv s%s; leftv z%s = &s%s;\n", pi->param[i].varname,
    140126              pi->param[i].varname, pi->param[i].varname);
     127      fprintf(module->fmtfp, "  %s %s;\n", type_conv[pi->param[i].typ],
     128              pi->param[i].varname);
     129    }
     130   
    141131    fprintf(module->fmtfp, "#line %d \"%s\"\n", yylineno, module->filename);
    142132    fprintf(module->fmtfp, "\n");
     
    145135}
    146136
    147 
     137/*========================================================================*/
    148138void write_function_typecheck(
    149139  moddefv module,
     
    159149}
    160150
     151/*========================================================================*/
    161152void write_function_result(
    162153  moddefv module,
     
    170161}
    171162
     163/*========================================================================*/
    172164void write_function_return(
    173165  moddefv module,
     
    181173    if( pi->funcname != NULL ) free(pi->funcname);
    182174    pi->funcname = strdup((char *)arg);
    183     printf("CMD: return(%s)\n", arg);
     175    if(debug>2)printf("CMD: return(%s)\n", arg);
    184176
    185177    /* write function declaration to header file */
     
    200192    fprintf(module->modfp_h, ");\n\n");
    201193  }
    202   else  printf("CMD: return()\n");
     194  else  if(debug>2)printf("CMD: return()\n");
    203195
    204196  fprintf(module->fmtfp, "#line %d \"%s\"\n", yylineno, module->filename);
     
    214206  int i;
    215207 
    216   printf("\nWriting return-block\n");
     208  if(trace)printf("\n\t\tsingular command block...");
    217209  fprintf(module->fmtfp, "#line @d \"%s.cc\"\n", module->name);
    218210  fprintf(module->fmtfp, "/* code for running singular commands */\n");
     
    248240  int cnt = 0, i;
    249241 
    250   printf("header..."); fflush(stdout);
     242  if(trace)printf("\n\t\theader..."); fflush(stdout);
    251243 
    252244  fprintf(fmtfp, "#line %d \"%s\"\n", pi->lineno, module->filename);
     
    276268  if(!pi->flags.declaration_done) return;
    277269 
    278   printf("type check..."); fflush(stdout);
     270  if(trace)printf("type check..."); fflush(stdout);
    279271 
    280272  if(pi->paramcnt>0) {
     
    322314  mod_copy_tmp(module->modfp, module->fmtfp);
    323315  fprintf(module->modfp, "#line %d \"%s.cc\"\n", modlineno++, module->name);
    324   printf("  done.\n");fflush(stdout);
     316  if(trace)printf("  done.\n");fflush(stdout);
    325317  fclose(module->fmtfp);
    326318  fclose(module->fmtfp2);
     
    344336  fprintf(fp, "  v_save = v->next;\n");
    345337  fprintf(fp, "  v->next = NULL;\n");
    346   fprintf(fp, "  if(iiConvert(tok, %s, index, v, %s))\n",
     338  fprintf(fp, "  if(iiConvert(tok, %s, index, v, z%s))\n",
    347339          pi->param[i].typname, pi->param[i].varname);
    348340  fprintf(fp, "     goto mod_%s_error;\n", pi->procname);
    349341  fprintf(fp, "  v = v_save;\n");
     342  fprintf(fp, "  %s = (%s)z%s->Data();\n", pi->param[i].varname,
     343          type_conv[pi->param[i].typ], pi->param[i].varname);
     344 
    350345}
    351346
     
    367362  int i;
    368363 
    369   printf("\nWriting return-block\n");
     364  if(trace)printf("\n\t\treturn block...");
    370365   
    371   printf("### RETURN: '%s' '%s' '%d'\n", pi->return_val.name,
     366  if(debug>2)printf("### RETURN: '%s' '%s' '%d'\n", pi->return_val.name,
    372367         pi->return_val.typname, pi->return_val.typ);
    373368  fprintf(module->fmtfp, "#line @d \"%s.cc\"\n", module->name);
     
    405400          fprintf(fmtfp, "  res->data = (void *)%s(", pi->funcname);
    406401          for (i=0;i<pi->paramcnt; i++) {
    407             fprintf(fmtfp, "(%s) %s->Data()",
    408                     type_conv[pi->param[i].typ], pi->param[i].varname);
     402            fprintf(fmtfp, "%s", pi->param[i].varname);
     403//            fprintf(fmtfp, "(%s) %s->Data()",
     404//                    type_conv[pi->param[i].typ], pi->param[i].varname);
    409405            if(i<pi->paramcnt-1) fprintf(fmtfp, ", ");
    410406          }
     
    439435        if(pi->paramcnt>0) {
    440436          if(pi->flags.typecheck_done) {
    441             printf("error handling..."); fflush(stdout);
     437            if(trace)printf("\n\t\terror handling..."); fflush(stdout);
    442438            fprintf(module->fmtfp, "  mod_%s_error:\n", pi->procname);
    443439            fprintf(module->fmtfp, "    Werror(\"%s(`%%s`) is not supported\", Tok2Cmdname(tok));\n",
     
    514510      return -1;
    515511    }
    516     printf("Creating %s, ", filename);fflush(stdout);
     512    if(trace)printf("Creating %s, ", filename);fflush(stdout);
    517513
    518514    //free(filename);
  • modules/modgen/proc_setup.cc

    raffa29 r014db1  
    11/*
    2  * $Id: proc_setup.cc,v 1.4 2000-02-14 21:44:40 krueger Exp $
     2 * $Id: proc_setup.cc,v 1.5 2000-03-30 06:35:45 krueger Exp $
    33 */
    44
     
    102102  paramcnt = p->paramcnt;
    103103  if(varname == NULL) {
    104     snprintf(typname, sizeof(typname), "res%d", paramcnt);
     104    snprintf(typname, sizeof(typname), "arg%d", paramcnt);
    105105    pnew.varname = strdup(typname);
    106106  } else pnew.varname = strdup(varname);
  • modules/modgen/scanner.l

    raffa29 r014db1  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 /* $Id: scanner.l,v 1.9 2000-03-29 09:31:43 krueger Exp $ */
     5/* $Id: scanner.l,v 1.10 2000-03-30 06:35:45 krueger Exp $ */
    66#include <stdio.h>
    77#include <string.h>
     
    315315        .*(\n?) { lvalp->name = yytext; return CODEPART; }
    316316
    317         <<EOF>>  { sectnum = 0; printf("XXXX\n");
     317        <<EOF>>  { sectnum = 0;
    318318                   return SECT3END;
    319319                   /*yyterminate();*/
  • modules/modgen/utils.cc

    raffa29 r014db1  
    11/*
    2  * $Id: utils.cc,v 1.7 2000-03-29 13:56:27 krueger Exp $
     2 * $Id: utils.cc,v 1.8 2000-03-30 06:35:46 krueger Exp $
    33 */
    44
     
    5959 
    6060  memset(tmpfile, '\0', sizeof(tmpfile));
    61   snprintf(tmpfile, sizeof(tmpfile), "tmp/modgen.tmpXXXXXX");
     61  snprintf(tmpfile, sizeof(tmpfile), "modgen.tmpXXXXXX");
    6262  mktemp(tmpfile);
    6363
    64   printf("create_tmpfile (%d\n", which );
     64  if(debug)printf("create_tmpfile '%s'\n", tmpfile );
    6565 
    6666  if (close(creat(tmpfile, 0600)) < 0) {
     
    7474  }
    7575
    76   printf("2)create_tmpfile (%d\n", which );
    7776  switch(which) {
    7877      case 0: module_def->fmtfp  = fp; break;
     
    116115
    117116/*========================================================================*/
    118 void myyyerror(
     117int myyyerror(
    119118  char *fmt, ...
    120119  )
     
    124123  vprintf(fmt, ap);
    125124  va_end(ap);
     125  return 1;
    126126}
Note: See TracChangeset for help on using the changeset viewer.