Module Cobol_data.Types

Representation of COBOL data items

type 'a nel = 'a NEL.t
type picture_config
type picture
type usage =
  1. | Binary of picture
  2. | Binary_C_long of signedness
  3. | Binary_char of signedness
  4. | Binary_double of signedness
  5. | Binary_long of signedness
  6. | Binary_short of signedness
  7. | Bit of picture
  8. | Display of picture
  9. | Float_binary of {
    1. width : [ `W32 | `W64 | `W128 ];
    2. endian : Cobol_ptree.endianness_mode;
    }
  10. | Float_decimal of {
    1. width : [ `W16 | `W34 ];
    2. endian : Cobol_ptree.endianness_mode;
    3. encoding : Cobol_ptree.encoding_mode;
    }
  11. | Float_extended
  12. | Float_long
  13. | Float_short
  14. | Procedure_pointer
  15. | Function_pointer of Cobol_ptree.name Cobol_common.Srcloc.TYPES.with_loc
  16. | Index
  17. | National of picture
  18. | Object_reference of Cobol_ptree.object_reference_kind option
  19. | Packed_decimal of picture
  20. | Pointer of Cobol_ptree.name Cobol_common.Srcloc.TYPES.with_loc option
  21. | Program_pointer of Cobol_ptree.name Cobol_common.Srcloc.TYPES.with_loc option
and signedness = {
  1. signed : bool;
}
type data_storage =
  1. | File
  2. | Local_storage
  3. | Working_storage
  4. | Linkage
val pp_data_storage : Stdlib.Format.formatter -> data_storage -> unit
type length =
  1. | Fixed_length
  2. | Variable_length
type record = {
  1. record_name : string;
  2. record_storage : data_storage;
  3. record_item : item_definition Cobol_common.Srcloc.TYPES.with_loc;
  4. record_renamings : record_renamings;
}
and item_definition =
  1. | Field of field_definition
  2. | Table of table_definition
and field_definition = {
  1. field_qualname : Cobol_ptree.qualname Cobol_common.Srcloc.TYPES.with_loc option;
  2. field_redefines : Cobol_ptree.qualname Cobol_common.Srcloc.TYPES.with_loc option;
  3. field_leading_ranges : table_range list;
  4. field_offset : Cobol_data__.Data_memory.size;
    (*

    offset w.r.t record address

    *)
  5. field_size : Cobol_data__.Data_memory.size;
  6. field_layout : field_layout;
  7. field_length : length;
  8. field_conditions : condition_names;
  9. field_redefinitions : item_redefinitions;
}
and field_layout =
  1. | Elementary_field of {
    1. usage : usage;
    2. init_value : Cobol_ptree.literal Cobol_common.Srcloc.TYPES.with_loc option;
    }
  2. | Struct_field of {
    1. subfields : item_definitions;
    }
and table_definition = {
  1. table_field : field_definition Cobol_common.Srcloc.TYPES.with_loc;
  2. table_offset : Cobol_data__.Data_memory.size;
  3. table_size : Cobol_data__.Data_memory.size;
  4. table_range : table_range;
  5. table_init_values : Cobol_ptree.literal Cobol_common.Srcloc.TYPES.with_loc list;
  6. table_redefines : Cobol_ptree.qualname Cobol_common.Srcloc.TYPES.with_loc option;
  7. table_redefinitions : item_redefinitions;
}
and table_range = {
  1. range_span : span;
  2. range_indexes : Cobol_ptree.qualname Cobol_common.Srcloc.TYPES.with_loc list;
}
and span =
  1. | Fixed_span of fixed_span
  2. | Depending_span of depending_span
  3. | Dynamic_span of dynamic_span
and fixed_span = {
  1. occurs_times : int Cobol_common.Srcloc.TYPES.with_loc;
}
and depending_span = {
  1. occurs_depending_min : int Cobol_common.Srcloc.TYPES.with_loc;
  2. occurs_depending_max : int Cobol_common.Srcloc.TYPES.with_loc;
  3. occurs_depending : Cobol_ptree.qualname Cobol_common.Srcloc.TYPES.with_loc;
}
and dynamic_span = {
  1. occurs_dynamic_capacity : Cobol_ptree.qualname Cobol_common.Srcloc.TYPES.with_loc option;
  2. occurs_dynamic_capacity_min : int Cobol_common.Srcloc.TYPES.with_loc option;
  3. occurs_dynamic_capacity_max : int Cobol_common.Srcloc.TYPES.with_loc option;
  4. occurs_dynamic_initialized : bool Cobol_common.Srcloc.TYPES.with_loc;
}
and condition_name = {
  1. condition_name_qualname : Cobol_ptree.qualname Cobol_common.Srcloc.TYPES.with_loc;
  2. condition_name_item : Cobol_ptree.condition_name_item;
}

Note: 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 = {
  1. renaming_name : Cobol_ptree.qualname Cobol_common.Srcloc.TYPES.with_loc;
  2. renaming_layout : renamed_item_layout;
  3. renaming_offset : Cobol_data__.Data_memory.size;
  4. renaming_size : Cobol_data__.Data_memory.size;
  5. renaming_from : Cobol_ptree.qualname Cobol_common.Srcloc.TYPES.with_loc;
  6. renaming_thru : Cobol_ptree.qualname Cobol_common.Srcloc.TYPES.with_loc option;
}
and renamed_item_layout =
  1. | Renamed_elementary of {
    1. usage : usage;
    }
  2. | Renamed_struct of {
    1. subfields : item_definitions;
    }