Skip to content

Commit

Permalink
generate msgs2.d
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Jun 24, 2017
1 parent 419e1a3 commit db05d15
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
5 changes: 4 additions & 1 deletion dm/src/dmc/loadline.d
Expand Up @@ -10,14 +10,17 @@
* Source: https://github.com/DigitalMars/Compiler/blob/master/dm/src/dmc/loadline.d
*/

module loadline;

//#include "cc.h"
//#include "token.h"
//#include "global.h"
//#include "parser.h"

import msgs2;

extern (C++):
enum IDMAX = 900;
enum EM_ident2big = 5; // msgs2.h

extern __gshared char switch_E;
extern __gshared char[2*IDMAX+1] tok_ident;
Expand Down
6 changes: 3 additions & 3 deletions dm/src/dmc/makefile
Expand Up @@ -258,7 +258,7 @@ elxxx.c cdxxx.c optab.c debtab.c fltables.c tytab.c : \
$(CC) -cpp optabgen -I$(TK)
optabgen

msgs2.h msgs2.c : msgsx.exe
msgs2.d msgs2.h msgs2.c : msgsx.exe
msgsx

msgsx.exe : msgsx.c
Expand Down Expand Up @@ -376,7 +376,7 @@ strtold.obj : strtold.c
divcoeff.obj : divcoeff.d
$(DMD) -c -O -release -betterC divcoeff.d

loadline.obj : loadline.d
loadline.obj : loadline.d msgs2.d
$(DMD) -c -O -release -betterC loadline.d

################# Source file dependencies ###############
Expand Down Expand Up @@ -487,6 +487,6 @@ clean:
del *.exp
del *.dbg
del *.res
del msgs.c msgs2.h msgs2.c elxxx.c cdxxx.c optab.c debtab.c fltables.c tytab.c
del msgs.c msgs2.d msgs2.h msgs2.c elxxx.c cdxxx.c optab.c debtab.c fltables.c tytab.c

###################################
19 changes: 18 additions & 1 deletion dm/src/dmc/msgsx.c
Expand Up @@ -10,7 +10,7 @@
* Source: https://github.com/DigitalMars/Compiler/blob/master/dm/src/dmc/msgsx.c
*/

// Generate msgs2.h and msgs2.c
// Generate msgs2.d, msgs2.h and msgs2.c
// This file pulls together all the various message files into one, which
// when compiled and run, generates the tables used by the compiler.
// Currently it puts all languages into one table, but it can be changed
Expand Down Expand Up @@ -3077,6 +3077,23 @@ int main()

fclose(fp);

/////////////////////////////////////

fp = fopen("msgs2.d","w");
if (!fp)
{ printf("can't open msgs2.d\n");
exit(EXIT_FAILURE);
}

fprintf(fp,"enum\n{");
for (i = 0; i < sizeof(msgtable) / sizeof(msgtable[0]); i++)
{
fprintf(fp,"\tEM_%s=%d,\n",msgtable[i].name,i);
}
fprintf(fp,"}\n");

fclose(fp);

//////////////////////////////////////
fp = fopen("msgs2.c","w");
if (!fp)
Expand Down

0 comments on commit db05d15

Please sign in to comment.