Changeset 5922b4 in git


Ignore:
Timestamp:
Jul 1, 2002, 2:31:34 PM (22 years ago)
Author:
Anne Frühbis-Krüger <anne@…>
Branches:
(u'spielwiese', 'd1d239e9808fca76a9497a01fa91ad4e8db6fba5')
Children:
3afeb99391febdd4823ff1281334ea07b43cabbe
Parents:
eba5064688f73b02b3f1d0d66283b4d5950f445f
Message:
*anne: 1) modgen now supports package names different from the name of
          the declaration file
       2) example and help sections of the C-like procedures from
          section 3 are now stored in variables <procname>_help
	  respectively <procname>_example inside the package


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

Legend:

Unmodified
Added
Removed
  • modules/modgen/Makefile.in

    reba506 r5922b4  
    5454        echo "#define TOPSRCDIR \"$(topsrcdir)\"" >> pathnames.h
    5555        echo "#define LIBDIR    \"$(libdir)\"" >> pathnames.h
     56        echo "#define PREFIX    \"$(prefix)\"" >> pathnames.h
     57        echo "#define EXEC_PREFIX       \"$(exec_prefix)\"" >> pathnames.h
    5658
    5759modgen: ${OBJS} modgen.h decl.inc typmap.h pathnames.h stype.h
  • modules/modgen/creat_top.cc

    reba506 r5922b4  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: creat_top.cc,v 1.15 2002-06-26 12:03:16 anne Exp $ */
     4/* $Id: creat_top.cc,v 1.16 2002-07-01 12:31:32 anne Exp $ */
    55/*
    66* ABSTRACT: lib parsing
     
    119119  fprintf(fp, "int mod_init(int(*iiAddCproc)())\n{\n");
    120120  fprintf(fp, "  idhdl h;\n");
    121 /* HIER MUSS ERST ZUARBEIT VON HANS KOMMEN
    122   fprintf(fp, "  idhdl helphdl = enter_id(\"Help\", NULL, PACKAGE_CMD);\n");
    123   fprintf(fp, "  idhdl examplehdl = enter_id(\"Example\", NULL, PACKAGE_CMD);\n\n");
     121  fprintf(fp, "   fill_help_package();\n");
    124122  fprintf(fp, "  \n");
    125   fprintf(fp, "   if( helphdl == NULL)\n");
    126   fprintf(fp, "     Warn(\"Cannot create help-package\\n\");\n");
    127   fprintf(fp, "   else fill_help_package(helphdl);\n");
    128   fprintf(fp, "  \n");
    129   fprintf(fp, "   if( examplehdl == NULL)\n");
    130   fprintf(fp, "     Warn(\"Cannot create example-package\\n\");\n");
    131   fprintf(fp, "   else fill_example_package(examplehdl);\n");
    132    BIS HIERHIN ZUARBEIT VON HANS NOETIG
    133 */
     123  fprintf(fp, "   fill_example_package();\n");
    134124}
    135125
  • modules/modgen/grammar.y

    reba506 r5922b4  
    11/*
    2  * $Id: grammar.y,v 1.17 2002-06-27 14:01:11 anne Exp $
     2 * $Id: grammar.y,v 1.18 2002-07-01 12:31:32 anne Exp $
    33 */
    44
     
    6666/* SECT4: C/C++ text */
    6767%token SECT4START
    68 %token SECT4END
     68%token <name> SECT4END
    6969
    7070/*%token PROCEND*/
     
    177177                  if(vt==VAR_VERSION)
    178178                    make_version($3.string, &module_def);
     179                  if(vt==VAR_MODULE)
     180                    make_module_name($3.string, &module_def);
    179181                }
    180182                else {
     
    491493                 $2, len);
    492494          procedure_decl.example_len = newlen;
    493           //strncat(procedure_decl.example_string, $2, strlen($2));
    494           //procedure_decl.example_string[procedure_decl.example_len] = '\0';
    495495        };
    496496
  • modules/modgen/main.cc

    reba506 r5922b4  
    1313
    1414#include "modgen.h"
     15#include "pathnames.h"
    1516#include "stype.h"
    1617
     
    6970int trace = 0;
    7071int do_create_makefile = 1;
    71 char* inst_dir = ".";
     72char* inst_dir = EXEC_PREFIX;
    7273
    7374static struct option long_options[] =
  • modules/modgen/makefile.cc

    reba506 r5922b4  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: makefile.cc,v 1.10 2002-06-27 14:01:11 anne Exp $ */
     4/* $Id: makefile.cc,v 1.11 2002-07-01 12:31:33 anne Exp $ */
    55/*
    66* ABSTRACT: lib parsing
     
    4949  FILE *fp;
    5050
     51  if(module->targetname==NULL)
     52  {
     53     module->targetname = (char *)malloc(strlen(module->name)+1);
     54     memset(module->targetname, '\0', strlen(module->name)+1);
     55     memcpy(module->targetname,module->name,strlen(module->name));
     56  }
    5157  mkdir(module->name, 0755);
    5258  fp = fopen(build_filename(module, "Makefile", 0), "w");
     
    124130  fprintf(fp, "\t${MKINSTALLDIRS} ${instdir}/modules\n");
    125131  fprintf(fp, "\t${INSTALL_PROGRAM} %s.so ${instdir}/modules/%s.so\n",
    126           module->name, module->name);
     132          module->targetname, module->targetname);
    127133}
    128134
     
    149155  )
    150156{
    151   fprintf(fp, "all:\t%s.so %s_g.so \n", module->name, module->name);
     157  fprintf(fp, "all:\t%s.so %s_g.so \n", module->targetname, module->targetname);
    152158  fprintf(fp, "\n");
    153159  fprintf(fp, "%%.o: %%.cc Makefile\n");
     
    158164  fprintf(fp, "\n");
    159165 
    160   fprintf(fp, "%s.so: ${OBJS}\n", module->name);
     166  fprintf(fp, "%s.so: ${OBJS}\n", module->targetname);
    161167  fprintf(fp, "\t${CC} ${CFLAGS} -shared -Wl,-soname -Wl,%s.so.%d \\\n",
    162           module->name, module->major);
    163   fprintf(fp, "\t\t-o %s.so.%d.%d.%d ${OBJS}\n", module->name,
     168          module->targetname, module->major);
     169  fprintf(fp, "\t\t-o %s.so.%d.%d.%d ${OBJS}\n", module->targetname,
    164170          module->major, module->minor, module->level);
    165   fprintf(fp, "\trm -f %s.so\n", module->name);
    166   fprintf(fp, "\tln -s %s.so.%d.%d.%d %s.so\n", module->name, module->major,
    167           module->minor, module->level, module->name);
    168   fprintf(fp, "\n");
    169 
    170   fprintf(fp, "%s_g.so: ${DOBJS}\n", module->name);
     171  fprintf(fp, "\trm -f %s.so\n", module->targetname);
     172  fprintf(fp, "\tln -s %s.so.%d.%d.%d %s.so\n", module->targetname, module->major,
     173          module->minor, module->level, module->targetname);
     174  fprintf(fp, "\n");
     175
     176  fprintf(fp, "%s_g.so: ${DOBJS}\n", module->targetname);
    171177  fprintf(fp, "\t${CC} ${DCFLAGS} -shared -Wl,-soname -Wl,%s_g.so.%d \\\n",
    172           module->name, module->major);
    173   fprintf(fp, "\t\t-o %s_g.so.%d.%d.%d ${DOBJS}\n", module->name,
     178          module->targetname, module->major);
     179  fprintf(fp, "\t\t-o %s_g.so.%d.%d.%d ${DOBJS}\n", module->targetname,
    174180          module->major, module->minor, module->level);
    175   fprintf(fp, "\trm -f %s_g.so\n", module->name);
    176   fprintf(fp, "\tln -s %s_g.so.%d.%d.%d %s_g.so\n", module->name,
    177           module->major, module->minor, module->level, module->name);
     181  fprintf(fp, "\trm -f %s_g.so\n", module->targetname);
     182  fprintf(fp, "\tln -s %s_g.so.%d.%d.%d %s_g.so\n", module->targetname,
     183          module->major, module->minor, module->level, module->targetname);
    178184  fprintf(fp, "\n");
    179185}
     
    187193  )
    188194{
    189   fprintf(fp, "all:\t%s.sl\n", module->name);
     195  fprintf(fp, "all:\t%s.sl\n", module->targetname);
    190196  fprintf(fp, "\n");
    191197  fprintf(fp, "%%.o: %%.cc Makefile\n");
    192198  fprintf(fp, "\t${CC} ${CFLAGS} -c -fPIC -DPIC $< -o $*.o\n");
    193199  fprintf(fp, "\n");
    194   fprintf(fp, "%s.sl: ${OBJS}\n", module->name);
    195   fprintf(fp, "\t${LD} -b -o %s.sl \\\n", module->name);
     200  fprintf(fp, "%s.sl: ${OBJS}\n", module->targetname);
     201  fprintf(fp, "\t${LD} -b -o %s.sl \\\n", module->targetname);
    196202  fprintf(fp, "\t\t${OBJS}\n");
    197203}
  • modules/modgen/misc.cc

    reba506 r5922b4  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: misc.cc,v 1.15 2002-06-26 12:03:16 anne Exp $ */
     4/* $Id: misc.cc,v 1.16 2002-07-01 12:31:33 anne Exp $ */
    55/*
    66* ABSTRACT: lib parsing
     
    309309  memset(module->revision, '\0', strlen(libnamebuf)+1);
    310310  memcpy(module->revision, libnamebuf, strlen(libnamebuf));
     311}
     312
     313/*========================================================================*/
     314void make_module_name(char *p, moddefv module)
     315{
     316  if(strlen(p)>=1)
     317  {
     318    module->targetname = (char *)malloc(strlen(p)+1);
     319    memset(module->targetname, '\0', strlen(p)+1);
     320    memcpy(module->targetname,p,strlen(p));
     321  } else {
     322    module->targetname = (char *)malloc(strlen(module->name)+1);
     323    memset(module->targetname, '\0', strlen(module->name)+1);
     324    memcpy(module->targetname,module->name,strlen(module->name));
     325  }
     326
    311327}
    312328
     
    487503    fprintf(fp, "\n");
    488504   
    489 /* HIER FEHLT ZUARBEIT VON HANS
    490     fprintf(fp, "void fill_help_package(idhdl pl);\n");
    491     fprintf(fp, "void fill_example_package(idhdl pl);\n");
    492    BIS HIER
    493 */
     505    fprintf(fp, "void fill_help_package();\n");
     506    fprintf(fp, "void fill_example_package();\n");
    494507    modlineno+=3;
    495508  }
  • modules/modgen/modgen.h

    reba506 r5922b4  
    11/*
    2  *  $Id: modgen.h,v 1.13 2000-11-09 21:58:14 krueger Exp $
     2 *  $Id: modgen.h,v 1.14 2002-07-01 12:31:33 anne Exp $
    33 *
    44 */
     
    8888                             in an extra file */
    8989  char * filename;        /* inputfile to parse */
    90   char * name;            /* name of the module */
     90  char * name;            /* name of the module directory*/
     91  char * targetname;      /* name of dynamic module + package */
    9192  unsigned int major, minor, level;
    9293  char * version;
     
    148149extern void write_header(FILE *fp, char *module, char *comment="");
    149150extern void make_version(char *p, moddefv module);
     151extern void make_module_name(char *p, moddefv module);
    150152extern void write_procedure_text(moddefv module, int lineno);
    151153/*extern void write_procedure_header(moddefv module);*/
  • modules/modgen/proc.cc

    reba506 r5922b4  
    11/*
    2  * $Id: proc.cc,v 1.17 2002-06-18 15:09:16 anne Exp $
     2 * $Id: proc.cc,v 1.18 2002-07-01 12:31:33 anne Exp $
    33 */
    44
     
    364364  fprintf(module->modfp, "#line %d \"%s.cc\"\n", modlineno++, module->name);
    365365  fprintf(module->modfp, "/* Help section */\n");
    366 //  fprintf(module->modfp, "void fill_help_package(idhdl pl) {\n");
    367 //  fprintf(module->modfp, "  namespaceroot->push(IDPACKAGE(pl), IDID(pl));\n");
    368 //  modlineno+=3;
    369 //  mod_copy_tmp(module->modfp, module->fmtfp2);
    370 //  fprintf(module->modfp, "#line %d \"%s.cc\"\n", modlineno++, module->name);
    371 //  fprintf(module->modfp, "  namespaceroot->pop();\n");
    372 //  fprintf(module->modfp, "}  /* End of Help section */\n\n");
    373 //  modlineno+=3;
    374 
    375 //  fprintf(module->modfp, "/* Example section */\n");
    376 //  fprintf(module->modfp, "void fill_example_package(idhdl pl) {\n");
    377 //  fprintf(module->modfp, "  namespaceroot->push(IDPACKAGE(pl), IDID(pl));\n");
    378 //  modlineno+=3;
    379 //  mod_copy_tmp(module->modfp, module->fmtfp3);
    380 //  fprintf(module->modfp, "#line %d \"%s.cc\"\n", modlineno++, module->name);
    381 //  fprintf(module->modfp, "  namespaceroot->pop();\n");
    382 //  fprintf(module->modfp, "} /* End of Example section */\n\n");
    383 //  modlineno+=2;
     366  fprintf(module->modfp, "void fill_help_package() {\n");
     367  modlineno+=3;
     368  mod_copy_tmp(module->modfp, module->fmtfp2);
     369  fprintf(module->modfp, "#line %d \"%s.cc\"\n", modlineno++, module->name);
     370  fprintf(module->modfp, "}  /* End of Help section */\n\n");
     371  modlineno+=3;
     372
     373  fprintf(module->modfp, "/* Example section */\n");
     374  fprintf(module->modfp, "void fill_example_package() {\n");
     375  modlineno+=3;
     376  mod_copy_tmp(module->modfp, module->fmtfp3);
     377  fprintf(module->modfp, "#line %d \"%s.cc\"\n", modlineno++, module->name);
     378  fprintf(module->modfp, "} /* End of Example section */\n\n");
     379  modlineno+=2;
    384380
    385381  mod_copy_tmp(module->modfp, module->fmtfp);
     
    542538    fprintf(module->fmtfp2, "#line %d \"%s\"\n", pi->lineno_other,
    543539            module->filename);
    544     fprintf(module->fmtfp2, "  enter_id(\"%s\",", pi->procname);
     540    fprintf(module->fmtfp2, "  enter_id(\"%s_help\",", pi->procname);
    545541    fprintf(module->fmtfp2, " \"%s\", STRING_CMD);\n\n", pi->help_string);
    546542  }
     
    559555    fprintf(module->fmtfp3, "#line %d \"%s\"\n", pi->lineno_other,
    560556            module->filename);
    561     fprintf(module->fmtfp3, "  enter_id(\"%s\",\n", pi->procname);
     557    fprintf(module->fmtfp3, "  enter_id(\"%s_example\",\n", pi->procname);
    562558    fprintf(module->fmtfp3, " \"%s\", STRING_CMD);\n\n", pi->example_string);
    563559  }
  • modules/modgen/scanner.l

    reba506 r5922b4  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 /* $Id: scanner.l,v 1.13 2002-06-27 14:01:12 anne Exp $ */
     5/* $Id: scanner.l,v 1.14 2002-07-01 12:31:34 anne Exp $ */
    66#include <stdio.h>
    77#include <string.h>
     
    396396        <<EOF>>  { sectnum = 0;
    397397                   iseof=1;
     398                   lvalp->name = yytext;
    398399                   return SECT4END;
    399400                   /* yyterminate(); */
Note: See TracChangeset for help on using the changeset viewer.