/* * Created by PyramIDE. * User: フランスのトトロ aka (David RENÉ) * Date: 21/01/2017 * Time: 01:33 * © Calexium */ read generation/types_header.anubis read generation/types_messages.anubis read generation/graphviz/graphviz_main.anubis read system/files.anubis read system/string.anubis read tools/streams.anubis read tools/basis.anubis read densaku_lib/types/ds_types.anubis define Maybe(One) generate_type ( Stream stream, DS_Type ds_type )= if write_string(stream, dump_DS_Type(ds_type)) is failure then failure else success(unique) . define Maybe(One) make_type_file ( DS_Type ds_type, //type description String dest_dir ) = since ds_type is ds_type(name, generation, alternatives), println("Generating file for type ["+name+"]"); with file_name = dest_dir+"types/generated/"+to_lower(name)+".anubis", //create all necessary directories if doesn't exist. make_directories(file_name); if file(file_name, new) is { failure then println("can't create file "+file_name);failure, success(fd) then with strm = make_stream(fd), if generate_type_header(strm, ds_type) is { failure then failure, success(_) then if generate_type(strm, ds_type) is { failure then failure, success(_) then if generation is { no_message then success(unique), message then if generate_type_message_description(strm, ds_type) is { failure then failure, success(_) then if generate_type_to_message(strm, ds_type) is { failure then failure, success(_) then if generate_type_from_message(strm, ds_type) is { failure then failure, success(_) then success(unique)}}} }}} } . public define One make_all_types ( List(DS_Type) types, String destination_dir )= map_forget((DS_Type type) |-> since type is ds_type(type_name, _, ds_alts), println("generating type file for Type ["+type_name+"]"); make_type_file(type, destination_dir), types) .