_method dd_record_and_collection_mixin.enums_on(a_stream) ## Lists visible enumerated fields, print widths, and values. ## Use !output! as a_stream to list at Magik prompt. _for f _over _self.visible_fields.fast_elements() _loop t << f.type _if t _is _unset _then _continue _endif e << t.enumerator _if e _is _unset _then _continue _endif n << f.name.as_charvec() t << e.write_string p << f.print_width a_stream.write(n + " " + t + " ",p) a_stream.newline() _for v _over e.sorted_values.fast_elements() _loop # here we want to emulate show(v) as best as possible s << _unset _if v.responds_to?(:sys!slot_names_and_values|()|) _then s << v.class_name.as_charvec() + "(" + v.write_string + ")" _elif v = v.write_string _then s << %" + v.write_string + %" _else s << v.write_string _endif a_stream.write(s) a_stream.newline() _endloop write("$") _endloop _endmethod _method dd_record_and_collection_mixin.enums() _self.enums_on(!output!) _endmethod _method dd_record_and_collection_mixin.items_on(a_stream) ## Similar to describe_fields(), save that only visible fields are ## displayed. Use !output! as a_stream to list at Magik prompt. output_columns << rope.new() name_w << 0 type_w << 0 size_w << 0 _for f _over _self.visible_fields.fast_elements() _loop # check if key field _if f.is_key? _then key << "*" _else key << " " _endif # set name name << "unset" _if f.name _isnt _unset _then name << f.name.as_charvec() _endif w << name.size _if w > name_w _then name_w << w _endif # set type parameters ftype << " " size << " " type << "unset" _if f.is_physical? _or f.is_derived? _then _if f.is_derived? _then ftype << "L" _endif t << f.type _if t.enumerator _isnt _unset _then type << t.enumerator.write_string size << f.print_width.print_string _else type << t.phys_type.as_charvec() _if t.is_string? _then size << t.phys_size.print_string _endif _endif _elif f.is_geometry? _then ftype << "G" type << f.geom_type.as_charvec() _elif f.is_join? _then ftype << "J" type << f.join_type.as_charvec() t << f.result_table(_self.source_view) _if t _isnt _unset _then type +<< "(" + t.name.as_charvec() + ")" _endif _endif w << type.size _if w > type_w _then type_w << w _endif w << size.size _if w > size_w _then size_w << w _endif # add to output rope output_columns.add({key,ftype,name,size,type}) _endloop # set up string_formats n << char16_vector.new(name_w + 2) n.fill_with(%#) msf_n << string_format.new_with_properties( :string_template,n, :string_padding,:end, :string_padding_char,character.space) s << char16_vector.new(size_w) s.fill_with(%#) msf_s << string_format.new_with_properties( :string_template,s, :string_padding,:start, :string_padding_char,character.space) t << char16_vector.new(type_w + 2) t.fill_with(%#) msf_t << string_format.new_with_properties( :string_template,t, :string_padding,:end, :string_padding_char,character.space) # generate output a_stream.write(_self.write_string) a_stream.newline() _for a_line _over output_columns.fast_elements() _loop key << a_line[1] ftype << a_line[2] name << a_line[3] size << a_line[4] type << a_line[5] nf << msf_n.format(name) tf << msf_t.format(type) sf << msf_s.format(size) a_stream.write(key + ftype + " " + nf + sf + " " + tf) a_stream.newline() _endloop _endmethod _method dd_record_and_collection_mixin.items() _self.items_on(!output!) _endmethod