home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 20 / AACD20.BIN / AACD / Programming / Jikes / Source / src / option.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-03-03  |  2.9 KB  |  163 lines

  1. // $Id: option.h,v 1.29 2001/02/24 22:19:24 mdejong Exp $
  2. //
  3. // This software is subject to the terms of the IBM Jikes Compiler
  4. // License Agreement available at the following URL:
  5. // http://www.ibm.com/research/jikes.
  6. // Copyright (C) 1996, 1998, International Business Machines Corporation
  7. // and others.  All Rights Reserved.
  8. // You must accept the terms of that agreement to use this software.
  9. //
  10.  
  11. #ifndef option_INCLUDED
  12. #define option_INCLUDED
  13.  
  14. #include "platform.h"
  15. #include "code.h"
  16. #include "tuple.h"
  17. #include "jikesapi.h"
  18.  
  19. //FIXME: include stuff
  20. //#include <ctype.h>
  21.  
  22. #ifdef AMIGAOS_FILE_SYSTEM
  23. #include <unistd.h>
  24. #include <sys/param.h>
  25. #endif
  26.  
  27. #ifdef    HAVE_JIKES_NAMESPACE
  28. namespace Jikes {    // Open namespace Jikes block
  29. #endif
  30.  
  31. class ArgumentExpander
  32. {
  33. public:
  34.  
  35.     int argc;
  36.     char **argv;
  37.  
  38.     ArgumentExpander(int, char **);
  39.  
  40.     ArgumentExpander(Tuple<char> &);
  41.  
  42.     ~ArgumentExpander()
  43.     {
  44.         for (int i = 0; i < argc; i++)
  45.             delete [] argv[i];
  46.         delete [] argv;
  47.     }
  48.  
  49.     bool ArgumentExpanded(Tuple<char *> &, char *);
  50. };
  51.  
  52.  
  53. class KeywordMap
  54. {
  55. public:
  56.     wchar_t *name;
  57.     int length,
  58.         key;
  59. };
  60.  
  61.  
  62. class OptionError
  63. {
  64. public:
  65.     int kind;
  66.     wchar_t *name;
  67.  
  68.     OptionError(int kind_, char *str) : kind(kind_)
  69.     {
  70.         int length = strlen(str);
  71.         name = new wchar_t[length + 1];
  72.         for (int i = 0; i < length; i++)
  73.             name[i] = str[i];
  74.         name[length] = U_NULL;
  75.  
  76.         return;
  77.     }
  78.  
  79.     ~OptionError() { delete [] name; }
  80. };
  81.  
  82. class Ostream;
  83.  
  84. class Option: public JikesOption
  85.  {
  86.  
  87. #ifdef WIN32_FILE_SYSTEM
  88.  
  89.     char main_disk, *current_directory[128];
  90.  
  91. public:
  92.  
  93.     bool BadMainDisk() { return main_disk == 0; }
  94.  
  95.     void ResetCurrentDirectoryOnDisk(char d)
  96.     {
  97.         if (d != 0)
  98.         {
  99.             assert(current_directory[d]);
  100.             SetCurrentDirectory(current_directory[d]);
  101.         }
  102.     }
  103.     void SetMainCurrentDirectory()
  104.     {
  105.         SetCurrentDirectory(current_directory[main_disk]);
  106.     }
  107.     
  108.     char *GetMainCurrentDirectory()
  109.     {
  110.         return current_directory[main_disk];
  111.     }
  112. #elif defined(AMIGAOS_FILE_SYSTEM)
  113. public:
  114.     char *GetMainCurrentDirectory()
  115.     {
  116.     static char buf[MAXPATHLEN+1];
  117.     return getcwd(buf, sizeof(buf));
  118.     }
  119.  
  120.     void SaveCurrentDirectoryOnDisk(char c);
  121.  
  122. #endif
  123.  
  124. public:
  125.          
  126.     Tuple<KeywordMap> keyword_map;
  127.     Tuple<OptionError *> bad_options;
  128.  
  129.     int first_file_index;
  130.  
  131.     int debug_trap_op;
  132.  
  133.     bool debug_dump_lex,
  134.          debug_dump_ast,
  135.          debug_unparse_ast,
  136.          debug_unparse_ast_debug,
  137.          debug_dump_class,
  138.          nocleanup,
  139.          incremental,
  140.          makefile,
  141.      dependence_report,
  142.          bytecode,
  143.          full_check,
  144.          unzip,
  145.          dump_errors,
  146.          errors,
  147.          comments,
  148.          pedantic;
  149.  
  150.     char *dependence_report_name;
  151.  
  152.     Option(ArgumentExpander &);
  153.  
  154.     ~Option();
  155. };
  156.  
  157. #ifdef    HAVE_JIKES_NAMESPACE
  158. }            // Close namespace Jikes block
  159. #endif
  160.  
  161. #endif /* option_INCLUDED */
  162.  
  163.