Cobol_data.TypesRepresentation of COBOL data items
module NEL = Cobol_common.Basics.NELtype 'a nel = 'a NEL.ttype usage = | Binary of picture| Binary_C_long of signedness| Binary_char of signedness| Binary_double of signedness| Binary_long of signedness| Binary_short of signedness| Bit of picture| Display of picture| Float_binary of {width : [ `W32 | `W64 | `W128 ];endian : Cobol_ptree.endianness_mode;}| Float_decimal of {width : [ `W16 | `W34 ];endian : Cobol_ptree.endianness_mode;encoding : Cobol_ptree.encoding_mode;}| Float_extended| Float_long| Float_short| Procedure_pointer| Function_pointer of Cobol_ptree.name Cobol_common.Srcloc.TYPES.with_loc| Index| National of picture| Object_reference of Cobol_ptree.object_reference_kind option| Packed_decimal of picture| Pointer of Cobol_ptree.name Cobol_common.Srcloc.TYPES.with_loc option| Program_pointer of Cobol_ptree.name Cobol_common.Srcloc.TYPES.with_loc optionval pp_data_storage : Stdlib.Format.formatter -> data_storage -> unittype record = {record_name : string;record_storage : data_storage;record_item : item_definition Cobol_common.Srcloc.TYPES.with_loc;record_renamings : record_renamings;}and item_definitions = item_definition Cobol_common.Srcloc.TYPES.with_loc neland item_redefinitions =
item_definition Cobol_common.Srcloc.TYPES.with_loc listand field_definition = {field_qualname : Cobol_ptree.qualname Cobol_common.Srcloc.TYPES.with_loc option;field_redefines : Cobol_ptree.qualname Cobol_common.Srcloc.TYPES.with_loc
option;field_leading_ranges : table_range list;field_offset : Cobol_data__.Data_memory.size;offset w.r.t record address
*)field_size : Cobol_data__.Data_memory.size;field_layout : field_layout;field_length : length;field_conditions : condition_names;field_redefinitions : item_redefinitions;}and field_layout = | Elementary_field of {usage : usage;init_value : Cobol_ptree.literal Cobol_common.Srcloc.TYPES.with_loc option;}| Struct_field of {subfields : item_definitions;}and table_definition = {table_field : field_definition Cobol_common.Srcloc.TYPES.with_loc;table_offset : Cobol_data__.Data_memory.size;table_size : Cobol_data__.Data_memory.size;table_range : table_range;table_init_values : Cobol_ptree.literal Cobol_common.Srcloc.TYPES.with_loc list;table_redefines : Cobol_ptree.qualname Cobol_common.Srcloc.TYPES.with_loc
option;table_redefinitions : item_redefinitions;}and table_range = {range_span : span;range_indexes : Cobol_ptree.qualname Cobol_common.Srcloc.TYPES.with_loc list;}and span = | Fixed_span of fixed_span| Depending_span of depending_span| Dynamic_span of dynamic_spanand depending_span = {occurs_depending_min : int Cobol_common.Srcloc.TYPES.with_loc;occurs_depending_max : int Cobol_common.Srcloc.TYPES.with_loc;occurs_depending : Cobol_ptree.qualname Cobol_common.Srcloc.TYPES.with_loc;}and dynamic_span = {occurs_dynamic_capacity : Cobol_ptree.qualname
Cobol_common.Srcloc.TYPES.with_loc
option;occurs_dynamic_capacity_min : int Cobol_common.Srcloc.TYPES.with_loc option;occurs_dynamic_capacity_max : int Cobol_common.Srcloc.TYPES.with_loc option;occurs_dynamic_initialized : bool Cobol_common.Srcloc.TYPES.with_loc;}and condition_names = condition_name Cobol_common.Srcloc.TYPES.with_loc listand condition_name = {condition_name_qualname : Cobol_ptree.qualname
Cobol_common.Srcloc.TYPES.with_loc;condition_name_item : Cobol_ptree.condition_name_item;}and record_renamings = record_renaming Cobol_common.Srcloc.TYPES.with_loc listNote: RENAMES could be represented by simply adding an (optional, non-constant) offset to redefinitions (and use group layouts with FILLERs throughout to forbid using the new name as a qualifier).
Such a representation would be much more general than what typical COBOL data definitions allow; in particular, one could have "shifted" redefintions of any non-01 group item.
However, we keep the distinction between RENAMES and REDEFINES to better match said typical COBOL, and possibly allow more detailed error reporting.
and record_renaming = {renaming_name : Cobol_ptree.qualname Cobol_common.Srcloc.TYPES.with_loc;renaming_layout : renamed_item_layout;renaming_offset : Cobol_data__.Data_memory.size;renaming_size : Cobol_data__.Data_memory.size;renaming_from : Cobol_ptree.qualname Cobol_common.Srcloc.TYPES.with_loc;renaming_thru : Cobol_ptree.qualname Cobol_common.Srcloc.TYPES.with_loc option;}and renamed_item_layout = | Renamed_elementary of {usage : usage;}| Renamed_struct of {subfields : item_definitions;}type data_definition = | Data_field of {record : record;def : field_definition Cobol_common.Srcloc.TYPES.with_loc;}| Data_renaming of {record : record;def : record_renaming Cobol_common.Srcloc.TYPES.with_loc;}| Data_condition of {record : record;field : field_definition Cobol_common.Srcloc.TYPES.with_loc;def : condition_name Cobol_common.Srcloc.TYPES.with_loc;}| Table_index of {record : record;table : table_definition Cobol_common.Srcloc.TYPES.with_loc;qualname : Cobol_ptree.qualname Cobol_common.Srcloc.TYPES.with_loc;}