home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / sos3-2.lha / src / genCC / genCC_main.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-23  |  1.9 KB  |  74 lines

  1. /* --------------------------------------------------------------------------
  2.  * Copyright 1992 by Forschungszentrum Informatik (FZI)
  3.  *
  4.  * You can use and distribute this software under the terms of the licence
  5.  * you should have received along with this program.
  6.  * If not or if you want additional information, write to
  7.  * Forschungszentrum Informatik, "STONE", Haid-und-Neu-Strasse 10-14,
  8.  * D-7500 Karlsruhe 1, Germany.
  9.  * --------------------------------------------------------------------------
  10.  */
  11. // **************************************************************************
  12. // Module genCC_main                                         Juergen Uhl (ju)
  13. //
  14. // **************************************************************************
  15. // SOS interface generator for C++
  16. // **************************************************************************
  17.  
  18. #include <stdio.h>
  19. #include <osfcn.h>
  20. #include "sys.h"
  21. #include "smg.h"
  22. #include "sos.h"
  23. #include "genCC_err.h"
  24. #include "trc_genCC.h"
  25. #include "mta_use.h"
  26.  
  27. #include "genCC.h"
  28.  
  29. #ifdef PROFILE
  30. extern "C" void monitor(...);
  31. #endif
  32.  
  33. int main (int argc, char *argv[])
  34. {  int status = 0;
  35.  
  36.    T_INIT ("gen.out");
  37.    sos_init (argc, argv);
  38.  
  39.    int i = 1;
  40.    if (argc >= 2 AND streql (argv[1], "-I"))
  41.    {  gen_inline = TRUE;
  42.       i++;
  43.    }
  44.    else
  45.       gen_inline = FALSE;
  46.  
  47.    if (argc != i+1)
  48.    {  err_raise (err_USE, err_GEN_USAGE, NULL, FALSE);
  49.       status = 1;
  50.    }
  51.    else
  52.    {  sos_String str = smg_String (argv[i]).make_String (TEMP_CONTAINER);
  53.       sos_Schema_module sch = sos_Schema_module::lookup (str);
  54.       if (sch == NO_OBJECT)
  55.      err_raise (err_USE, err_GEN_INVALID_SCHEMA, NULL, FALSE);
  56.       else
  57.       {  sch.container().open(READING, WAITING);
  58.      sch.open_imports ();
  59.      gen_module_out (sch);
  60.      sch.close_imports ();
  61.      sch.container().close();
  62.       }
  63.    }
  64.    if (err_occurred (err_SYS) + err_occurred (err_USE) != 0)
  65.       status = -1;
  66.  
  67. #ifdef PROFILE
  68.    monitor (0);
  69. #endif
  70.  
  71.    T_EXIT ();
  72.    exit (status);
  73. }
  74.