00001 #if !defined ( __CML_FILE__ )
00002 #define __CML_FILE__
00003
00004 #if !defined ( __GENERIC_CONSTANTS__ )
00005 #define __GENERIC_CONSTANTS__
00006
00007 #define MinDouble -1.0e+99
00008 #define MaxDouble +1.0e+99
00009 #define NearZero +1.0e-16
00010 #define NoDouble -7.87813047009E+177
00011 #define NoInt -9279187
00012
00013
00014 #endif
00015
00016 #include <stdio.h>
00017
00018 typedef FILE* PFILE ;
00019 struct keyword ;
00020 struct section ;
00021
00022 #define LABEL label
00023 #define SECTION section_name
00024
00025 class cmlfile
00026 {
00027 public:
00028 cmlfile ( void ) ;
00029 cmlfile ( const char *ofname ) ;
00030 ~cmlfile ( void ) ;
00031
00032 public:
00033 void set_names ( long onames ) ;
00034 void set_name_string ( long oname , char *oname_string ) ;
00035 void get_value_from_name ( long olabel , long &ovalue ) ;
00036 void get_value_from_name ( long olabel , long oorder , long &ovalue ) ;
00037 void get_value_with_index_from_name ( long olabel , long oindex , long &ovalue ) ;
00038 void get_value_with_index_from_name ( long olabel , long oindex , long oorder , long &ovalue ) ;
00039 void get_section_value ( long olabel, long oline, long oorder, long &ovalue ) ;
00040 void get_section_value ( long olabel, long oline, long oorder, double &ovalue ) ;
00041 void get_section_value ( long olabel, long oline, long oorder, char *ovalue ) ;
00042 long name ( const char *obuffer ) ;
00043 public:
00044 keyword *get_name ;
00045 long names ;
00046
00047
00048 public:
00049 void get_next_line_in_section ( long olabel, long &ovalue );
00050 void get_next_line_in_section ( long olabel, double &ovalue );
00051 void get_next_line_in_section ( long olabel, char *ovalue );
00052
00053 public:
00054 void open ( const char *ofname ) ;
00055 void open_for_output ( const char *ofname ) ;
00056 void close ( void ) ;
00057 void set_labels ( long olabels ) ;
00058 void set_sections ( long osections ) ;
00059 void set_label_string ( long olabel , const char *olabel_string ) ;
00060 void set_section_string ( long olabel , const char *osection_string ) ;
00061 void set_double_format ( const char *odouble_format ) ;
00062 void compile ( void ) ;
00063 void check_requirements ( void ) ;
00064 void require ( long olabel ) ;
00065 void minimal ( long olabel , long ominimal ) ;
00066 void optionalize ( long olabel ) ;
00067 void refuse ( long olabel ) ;
00068 void check_label ( long olabel ) ;
00069 void set_minimal_rows ( long osection , long ominimal ) ;
00070 void check_section ( long osection ) ;
00071 void load_labels ( const char *orcname ) ;
00072 void inherit_labels ( cmlfile &of ) ;
00073 void get_value_count ( long olabel , long &ocount ) ;
00074 void get_value ( long olabel , long &ovalue ) ;
00075 void get_value ( long olabel , double &ovalue ) ;
00076 void get_value ( long olabel , char *ovalue ) ;
00077 void get_value ( long olabel , long oorder , long &ovalue ) ;
00078 void get_value ( long olabel , long oorder , double &ovalue ) ;
00079 void get_value ( long olabel , long oorder , char *ovalue ) ;
00080 void get_value_with_key ( long olabel , long okey , long &ovalue ) ;
00081 void get_value_with_key ( long olabel , long okey , double &ovalue ) ;
00082 void get_value_with_key ( long olabel , long okey , char *ovalue ) ;
00083 void get_value_with_key ( long olabel , long okey , long oorder , long &ovalue ) ;
00084 void get_value_with_key ( long olabel , long okey , long oorder , double &ovalue ) ;
00085 void get_value_with_key ( long olabel , long okey , long oorder , char *ovalue ) ;
00086 void get_value_with_key ( long olabel , const char *okey , long &ovalue ) ;
00087 void get_value_with_key ( long olabel , const char *okey , double &ovalue ) ;
00088 void get_value_with_key ( long olabel , const char *okey , char *ovalue ) ;
00089 void get_value_with_key ( long olabel , const char *okey , long oorder , long &ovalue ) ;
00090 void get_value_with_key ( long olabel , const char *okey , long oorder , double &ovalue ) ;
00091 void get_value_with_key ( long olabel , const char *okey , long oorder , char *ovalue ) ;
00092 void get_value_with_index ( long olabel , long oindex , long &ovalue ) ;
00093 void get_value_with_index ( long olabel , long oindex , double &ovalue ) ;
00094 void get_value_with_index ( long olabel , long oindex , char *ovalue ) ;
00095 void get_value_with_index ( long olabel , long oindex , long oorder , long &ovalue ) ;
00096 void get_value_with_index ( long olabel , long oindex , long oorder , double &ovalue ) ;
00097 void get_value_with_index ( long olabel , long oindex , long oorder , char *ovalue ) ;
00098 void get_percentage ( long olabel , double &ovalue ) ;
00099 void get_percentage ( long olabel , long oorder , double &ovalue ) ;
00100 void get_percentage_with_key ( long olabel , long okey , double &ovalue ) ;
00101 void get_percentage_with_key ( long olabel , long okey , long oorder , double &ovalue ) ;
00102 void get_percentage_with_key ( long olabel , const char *okey , double &ovalue ) ;
00103 void get_percentage_with_key ( long olabel , const char *okey , long oorder , double &ovalue ) ;
00104 void get_percentage_with_index ( long olabel , long okey , double &ovalue ) ;
00105 void get_percentage_with_index ( long olabel , long okey , long oorder , double &ovalue ) ;
00106 void get_line ( long olabel , char *oline ) ;
00107 void get_line_with_key ( long olabel , long okey , char *oline ) ;
00108 void get_line_with_key ( long olabel , const char *okey , char *oline ) ;
00109 void get_line_with_index ( long olabel , long oindex , char *oline ) ;
00110 void find_section ( long olabel , long &osection_rows ) ;
00111 void get_section_line ( long olabel , char *oline ) ;
00112 void end_reading_section ( void ) ;
00113 void out ( long olabel , long ovalue ) ;
00114 void out ( long olabel , double ovalue ) ;
00115 void out ( long olabel , const char *ovalue ) ;
00116 void out_label ( long olabel ) ;
00117 void out_long ( long ovalue ) ;
00118 void out_double ( double ovalue ) ;
00119 void out_string ( const char *ovalue ) ;
00120 void out_free_string ( const char *ovalue ) ;
00121 void out_eoln ( void ) ;
00122 void out_section ( long olabel ) ;
00123 void out_data ( const char *oline ) ;
00124 void out_section_end ( void ) ;
00125 void clear_errors ( void ) ;
00126 long error_opening_file ( void ) ;
00127 long error_reading_file ( void ) ;
00128 long error_writing_file ( void ) ;
00129 long error_in_requirements ( void ) ;
00130 long any_error ( void ) ;
00131 long label ( const char *obuffer ) ;
00132 long section_name ( const char *obuffer ) ;
00133 private:
00134 void open_next_input ( const char *ofname ) ;
00135 void stat_section ( void ) ;
00136 void jump_over_section ( void ) ;
00137 PFILE *input ;
00138 FILE *output ;
00139 keyword *stop ;
00140 section *block ;
00141 char *buffer,*double_format ;
00142 long files,labels,sections,actual ;
00143 long normal_read_disable,requirement_insufficient,compiled ;
00144 long open_error,read_error,write_error ;
00145 } ;
00146
00147 typedef cmlfile* Pcmlfile ;
00148
00149 #endif
00150