home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / som30tk.zip / som30os2.zip / bin / newemit.cmd < prev    next >
OS/2 REXX Batch file  |  1996-12-24  |  3KB  |  114 lines

  1. /*  [REXX]  */
  2. /* @(#) somc/newemit.cmd 2.12 1/9/96 17:24:51 [12/24/96 07:39:03] */
  3.  
  4. /*
  5.  *   COMPONENT_NAME: some
  6.  *
  7.  *   ORIGINS: 27
  8.  *
  9.  *
  10.  *    25H7912  (C)  COPYRIGHT International Business Machines Corp. 1992,1994,1996 
  11.  *   All Rights Reserved
  12.  *   Licensed Materials - Property of IBM
  13.  *   US Government Users Restricted Rights - Use, duplication or
  14.  *   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  15.  */
  16.  
  17.  
  18. /*
  19.  *  SOMObjects Emitter Framework - Create a new Emitter.
  20.  */
  21.  
  22. parse arg argv;
  23. argc = words(argv);
  24.  
  25. if argc < 2 then do;
  26.     parse source . . progname ".CMD";
  27.     say "usage:" progname "[-C | -C++] <className> <stem>";
  28.     exit(-1);
  29. end;
  30.  
  31. if word(argv, 1) = "-C" | word(argv, 1) = "-c" then do;
  32.    targetlang = "C";
  33.    class = word(argv, 2);
  34.    stem  = word(argv, 3);
  35. end;
  36. else if word(argv, 1) = "-C++" | word(argv, 1) = "-c++" then do;
  37.    targetlang = "C++";    
  38.    class = word(argv, 2);
  39.    stem  = word(argv, 3);
  40. end;
  41. else if argc > 2 then do;
  42.     parse source . . progname ".CMD";
  43.     say "usage:" progname "[-C | -C++] <className> <stem>";
  44.     exit(-1);
  45. end;
  46. else do;
  47.    targetlang = "C";
  48.    class = word(argv, 1);
  49.    stem  = word(argv, 2);
  50. end;
  51.  
  52. s_idl = stem || ".idl";
  53. if targetlang = "C" then
  54.    s_c   = stem || ".c";
  55. else
  56.    s_c   = stem || ".cpp";
  57. s_efw = stem || ".efw";
  58. s_def = "emit" || stem || ".def";
  59. if targetlang = "C" then
  60.    emits_c = "emit" || stem || ".c";
  61. else
  62.    emits_c = "emit" || stem || ".cpp";
  63. sc = value("sc",,"os2environment");
  64. if sc = "" then sc = "sc";
  65.  
  66. call RxFuncAdd "SysSearchPath", "RexxUtil", "SysSearchPath";
  67.  
  68. if stream(s_idl, "c", "query exists") <> "" then do;
  69.     "@del " || s_idl;
  70. end;
  71. r = stream(s_idl, "c", "open");
  72. r = lineout(s_idl, "interface" class "{};");
  73. r = stream(s_idl, "c", "close");
  74.  
  75. say s_idl || ":";
  76. efwfile = SysSearchPath("SMINCLUDE", "gen_idl.efw");
  77. "@" || sc "-aemitfile=_" || s_idl "-adeffile=" || efwfile "-sgen -mnochk" s_idl;
  78. "@del " || s_idl;
  79. "@ren _" || s_idl s_idl;
  80.  
  81. say s_c || ":";
  82. if targetlang = "C" then
  83.    efwfile = SysSearchPath("SMINCLUDE", "gen_c.efw");
  84. else
  85.    efwfile = SysSearchPath("SMINCLUDE", "gen_cpp.efw");
  86. "@" || sc "-aemitfile=" || s_c "-adeffile=" || efwfile "-sgen -mnochk" s_idl;
  87.  
  88. say "emit" || s_c || ":";
  89. if targetlang = "C" then
  90.    efwfile = SysSearchPath("SMINCLUDE", "gen_emit.efw");
  91. else
  92.    efwfile = SysSearchPath("SMINCLUDE", "gen_emit.efx");
  93. "@" || sc "-aemitfile=" || emits_c "-adeffile=" || efwfile "-sgen -mnochk" s_idl;
  94.  
  95. if stream("Makefile", "c", "query exists") <> "" then do;
  96.     "@del Makefile.bak >nul 2>&1";
  97.     "@ren Makefile Makefile.bak";
  98. end;
  99.  
  100. say "Makefile:";
  101. if targetlang = "C" then
  102.    efwfile = SysSearchPath("SMINCLUDE", "gen_mk32.efw");
  103. else
  104.    efwfile = SysSearchPath("SMINCLUDE", "gen_mk32.efx");
  105. "@" || sc "-aemitfile=Makefile -adeffile=" || efwfile "-sgen -mnochk" s_idl;
  106.  
  107. say s_def || ":";
  108. efwfile = SysSearchPath("SMINCLUDE", "gen_def.efw");
  109. "@" || sc "-aemitfile=" || s_def "-adeffile=" || efwfile "-sgen -mnochk" s_idl;
  110.  
  111. say s_efw || ":";
  112. efwfile = SysSearchPath("SMINCLUDE", "gen_temp.efw");
  113. "@copy" efwfile s_efw;
  114.