home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / new / gfx / edit / tsmorph / src / genmsg.c < prev    next >
C/C++ Source or Header  |  1994-02-27  |  2KB  |  66 lines

  1. // TSMorph - Amiga Morphing program
  2. // Copyright (C) © 1993  Topicsave Limited
  3.  
  4. // This program is free software; you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation; either version 2 of the License, or
  7. // any later version.
  8.  
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. // GNU General Public License for more details.
  13.  
  14. // You should have received a copy of the GNU General Public License
  15. // along with this program; if not, write to the Free Software
  16. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18. // mpaddock@cix.compulink.co.uk
  19.  
  20. // Generate the message header file
  21.  
  22. #include <stdio.h>
  23. #include <string.h>
  24. #include <proto/dos.h>
  25. #include "messages.h"
  26.  
  27. /* Version string for CLI version */
  28. char *Version = "$VER: GenMsg 1.0 (29.1.94)";
  29.  
  30. int main(void) {
  31.     BPTR in,out;
  32.     char buffer[513];
  33.     char *res,*f;
  34.     int xres=10;
  35.     int i=0;
  36.     res = "...Failed!\n";
  37.     printf(&(Version[6]));
  38.     if (in = Open("TSMorph-Messages",MODE_OLDFILE)) {
  39.         if (out = Open("tMessages.h",MODE_NEWFILE)) {
  40.             FPuts(out,"// This file generated by");
  41.             FPuts(out,&(Version[6]));
  42.             FPuts(out,"\n");
  43.             FPuts(out,"#include <exec/types.h>\n");
  44.             FPuts(out,"#include \"Messages.h\"\n");
  45.             FPuts(out,"UBYTE *message[MSG_COUNT] = {\n");
  46.             while (FGets(in,buffer,511) && (i < MSG_COUNT)) {
  47.                 FPuts(out,"\t\"");
  48.                 f = &(buffer[4]);
  49.                 if (strlen(f)) {
  50.                     f[strlen(f)-1]=0;
  51.                 }
  52.                 FPuts(out,f);
  53.                 FPuts(out,"\",\n");
  54.                 ++i;
  55.             }
  56.             FPuts(out,"};\n");
  57.             res = "...Worked ok!\n";
  58.             xres = 0;
  59.             Close(out);
  60.         }
  61.         Close(in);
  62.     }
  63.     printf(res);
  64.     return xres;
  65. }
  66.