From f2a69188ea3fc100662bb334664f7223cbfe5049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 1 Jan 2012 03:34:29 +0100 Subject: [PATCH] Use submodule for memory structure definitions (df-structures). --- .gitmodules | 3 + library/xml | 1 + library/xml/Bitfield.pm | 50 - library/xml/Common.pm | 262 ---- library/xml/Enum.pm | 165 --- library/xml/StructFields.pm | 328 ----- library/xml/StructType.pm | 192 --- library/xml/codegen.pl | 166 --- library/xml/df.building-raws.xml | 58 - library/xml/df.buildings.xml | 403 ------ library/xml/df.creature-raws.xml | 592 -------- library/xml/df.d_init.xml | 129 -- library/xml/df.history.xml | 246 ---- library/xml/df.init.xml | 138 -- library/xml/df.item-raws.xml | 374 ----- library/xml/df.items.xml | 894 ------------ library/xml/df.job-enums.xml | 2191 ------------------------------ library/xml/df.jobs.xml | 264 ---- library/xml/df.language.xml | 123 -- library/xml/df.legends.xml | 305 ----- library/xml/df.machines.xml | 96 -- library/xml/df.map.xml | 247 ---- library/xml/df.materials.xml | 419 ------ library/xml/df.military.xml | 285 ---- library/xml/df.projectile.xml | 62 - library/xml/df.raws.xml | 237 ---- library/xml/df.refs.xml | 109 -- library/xml/df.stockpile.xml | 254 ---- library/xml/df.ui.xml | 607 --------- library/xml/df.units.xml | 696 ---------- library/xml/df.viewscreen.xml | 106 -- library/xml/df.world-data.xml | 476 ------- library/xml/df.world.xml | 518 ------- library/xml/list.pl | 33 - library/xml/lower-1.xslt | 289 ---- library/xml/lower-2.xslt | 78 -- 36 files changed, 4 insertions(+), 11392 deletions(-) create mode 160000 library/xml delete mode 100644 library/xml/Bitfield.pm delete mode 100644 library/xml/Common.pm delete mode 100644 library/xml/Enum.pm delete mode 100644 library/xml/StructFields.pm delete mode 100644 library/xml/StructType.pm delete mode 100755 library/xml/codegen.pl delete mode 100644 library/xml/df.building-raws.xml delete mode 100644 library/xml/df.buildings.xml delete mode 100644 library/xml/df.creature-raws.xml delete mode 100644 library/xml/df.d_init.xml delete mode 100644 library/xml/df.history.xml delete mode 100644 library/xml/df.init.xml delete mode 100644 library/xml/df.item-raws.xml delete mode 100644 library/xml/df.items.xml delete mode 100644 library/xml/df.job-enums.xml delete mode 100644 library/xml/df.jobs.xml delete mode 100644 library/xml/df.language.xml delete mode 100644 library/xml/df.legends.xml delete mode 100644 library/xml/df.machines.xml delete mode 100644 library/xml/df.map.xml delete mode 100644 library/xml/df.materials.xml delete mode 100644 library/xml/df.military.xml delete mode 100644 library/xml/df.projectile.xml delete mode 100644 library/xml/df.raws.xml delete mode 100644 library/xml/df.refs.xml delete mode 100644 library/xml/df.stockpile.xml delete mode 100644 library/xml/df.ui.xml delete mode 100644 library/xml/df.units.xml delete mode 100644 library/xml/df.viewscreen.xml delete mode 100644 library/xml/df.world-data.xml delete mode 100644 library/xml/df.world.xml delete mode 100755 library/xml/list.pl delete mode 100644 library/xml/lower-1.xslt delete mode 100644 library/xml/lower-2.xslt diff --git a/.gitmodules b/.gitmodules index 5fcc3ec0d..76fb139db 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "plugins/df2mc"] path = plugins/df2mc url = git://github.com/peterix/DF2MC.git +[submodule "library/xml"] + path = library/xml + url = git://github.com/peterix/df-structures.git diff --git a/library/xml b/library/xml new file mode 160000 index 000000000..af32a27c8 --- /dev/null +++ b/library/xml @@ -0,0 +1 @@ +Subproject commit af32a27c89382a0cab330a74e5b6dec8a0006bff diff --git a/library/xml/Bitfield.pm b/library/xml/Bitfield.pm deleted file mode 100644 index e85c7af68..000000000 --- a/library/xml/Bitfield.pm +++ /dev/null @@ -1,50 +0,0 @@ -package Bitfield; - -use utf8; -use strict; -use warnings; - -BEGIN { - use Exporter (); - our $VERSION = 1.00; - our @ISA = qw(Exporter); - our @EXPORT = qw( &render_bitfield_core &render_bitfield_type ); - our %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], - our @EXPORT_OK = qw( ); -} - -END { } - -use XML::LibXML; - -use Common; - -sub render_bitfield_core { - my ($name, $tag) = @_; - - emit_block { - emit get_primitive_base($tag), ' whole;'; - - emit_block { - for my $item ($tag->findnodes('child::ld:field')) { - ($item->getAttribute('ld:meta') eq 'number' && - $item->getAttribute('ld:subtype') eq 'flag-bit') - or die "Invalid bitfield member: ".$item->toString."\n"; - - check_bad_attrs($item); - my $name = ensure_name $item->getAttribute('name'); - my $size = $item->getAttribute('count') || 1; - emit "unsigned ", $name, " : ", $size, ";"; - } - } "struct ", " bits;"; - - emit $name, '() : whole(0) {};'; - } "union $name ", ";"; -} - -sub render_bitfield_type { - my ($tag) = @_; - render_bitfield_core($typename,$tag); -} - -1; diff --git a/library/xml/Common.pm b/library/xml/Common.pm deleted file mode 100644 index 82835a6b6..000000000 --- a/library/xml/Common.pm +++ /dev/null @@ -1,262 +0,0 @@ -package Common; - -use utf8; -use strict; -use warnings; - -BEGIN { - use Exporter (); - our $VERSION = 1.00; - our @ISA = qw(Exporter); - our @EXPORT = qw( - $main_namespace $export_prefix - %types %type_files *typename *filename - - &parse_address &check_bad_attrs &check_name - &is_attr_true &type_header_def &add_type_to_hash - - *lines *indentation &with_emit &emit &indent &outdent &emit_block - - &is_primitive_type &primitive_type_name &get_primitive_base - - *weak_refs *strong_refs ®ister_ref &decode_type_name_ref - - %static_lines %static_includes &with_emit_static - - &ensure_name &with_anon - ); - our %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], - our @EXPORT_OK = qw( ); -} - -END { } - -use XML::LibXML; - -our $main_namespace = ''; -our $export_prefix = ''; - -our %types; -our %type_files; - -# Misc XML analysis - -our $typename; -our $filename; - -sub parse_address($;$) { - my ($str,$in_bits) = @_; - return undef unless defined $str; - - # Parse the format used by offset attributes in xml - $str =~ /^0x([0-9a-f]+)(?:\.([0-7]))?$/ - or die "Invalid address syntax: $str\n"; - my ($full, $bv) = ($1, $2); - die "Bits not allowed: $str\n" unless $in_bits; - return $in_bits ? (hex($full)*8 + ($bv||0)) : hex($full); -} - -sub check_bad_attrs($;$$) { - my ($tag, $allow_size, $allow_align) = @_; - - die "Cannot use size, alignment or offset for ".$tag->nodeName."\n" - if ((!$allow_size && defined $tag->getAttribute('size')) || - defined $tag->getAttribute('offset') || - (!$allow_align && defined $tag->getAttribute('alignment'))); -} - -sub check_name($) { - my ($name) = @_; - $name =~ /^[_a-zA-Z][_a-zA-Z0-9]*$/ - or die "Invalid identifier: $name\n"; - return $name; -} - -sub is_attr_true($$) { - my ($tag, $name) = @_; - return ($tag->getAttribute($name)||'') eq 'true'; -} - -sub type_header_def($) { - my ($name) = @_; - return uc($main_namespace).'_'.uc($name).'_H'; -} - -sub add_type_to_hash($) { - my ($type) = @_; - - my $name = $type->getAttribute('type-name') - or die "Type without a name in $filename\n"; - - die "Duplicate definition of $name in $filename\n" if $types{$name}; - - local $typename = $name; - check_bad_attrs $type; - $types{$name} = $type; - $type_files{$name} = $filename; -} - -# Text generation with indentation - -our @lines; -our $indentation = 0; - -sub with_emit(&;$) { - # Executes the code block, and returns emitted lines - my ($blk, $start_indent) = @_; - local @lines; - local $indentation = ($start_indent||0); - $blk->(); - return @lines; -} - -sub emit(@) { - # Emit an indented line to be returned from with_emit - my $line = join('',map { defined($_) ? $_ : '' } @_); - $line = (' 'x$indentation).$line unless length($line) == 0; - push @lines, $line; -} - -sub indent(&) { - # Indent lines emitted from the block by one step - my ($blk) = @_; - local $indentation = $indentation+2; - $blk->(); -} - -sub outdent(&) { - # Unindent lines emitted from the block by one step - my ($blk) = @_; - local $indentation = ($indentation >= 2 ? $indentation-2 : 0); - $blk->(); -} - -sub emit_block(&;$$%) { - # Emit a full {...} block with indentation - my ($blk, $prefix, $suffix, %flags) = @_; - my @inner = &with_emit($blk,$indentation+2); - return if $flags{-auto} && !@inner; - $prefix ||= ''; - $suffix ||= ''; - emit $prefix,'{'; - push @lines, @inner; - emit '}',$suffix; -} - -# Primitive types - -my @primitive_type_list = - qw(int8_t uint8_t int16_t uint16_t - int32_t uint32_t int64_t uint64_t - s-float - bool flag-bit - padding static-string); - -my %primitive_aliases = ( - 's-float' => 'float', - 'static-string' => 'char', - 'flag-bit' => 'void', - 'padding' => 'void', -); - -my %primitive_types; -$primitive_types{$_}++ for @primitive_type_list; - -sub is_primitive_type($) { - return $primitive_types{$_[0]}; -} - -sub primitive_type_name($) { - my ($tag_name) = @_; - $primitive_types{$tag_name} - or die "Not primitive: $tag_name\n"; - return $primitive_aliases{$tag_name} || $tag_name; -} - -sub get_primitive_base($;$) { - my ($tag, $default) = @_; - - my $base = $tag->getAttribute('base-type') || $default || 'uint32_t'; - $primitive_types{$base} or die "Must be primitive: $base\n"; - - return $base; -} - -# Type references - -our %weak_refs; -our %strong_refs; - -sub register_ref($;$) { - # Register a reference to another type. - # Strong ones require the type to be included. - my ($ref, $is_strong) = @_; - - if ($ref) { - my $type = $types{$ref} - or die "Unknown type $ref referenced.\n"; - - if ($is_strong) { - $strong_refs{$ref}++; - } else { - $weak_refs{$ref}++; - } - } -} - -sub decode_type_name_ref($;%) { - # Interpret the type-name field of a tag - my ($tag,%flags) = @_; - my $force_type = $flags{-force_type}; - my $attr = $flags{-attr_name} || 'type-name'; - my $tname = $tag->getAttribute($attr) or return undef; - - if ($primitive_types{$tname}) { - die "Cannot use type $tname as $attr here: $tag\n" - if ($force_type && $force_type ne 'primitive'); - return primitive_type_name($tname); - } else { - register_ref $tname, !$flags{-weak}; - die "Cannot use type $tname as $attr here: $tag\n" - if ($force_type && $force_type ne $types{$tname}->getAttribute('ld:meta')); - return $main_namespace.'::'.$tname; - } -} - -# Static file output - -our %static_lines; -our %static_includes; - -sub with_emit_static(&;$) { - my ($blk, $tag) = @_; - my @inner = &with_emit($blk,2) or return; - $tag ||= ''; - $static_includes{$tag}{$typename}++; - push @{$static_lines{$tag}}, @inner; -} - -# Anonymous variable names - -our $anon_id = 0; -our $anon_prefix; - -sub ensure_name($) { - # If the name is empty, assign an auto-generated one - my ($name) = @_; - unless ($name) { - $name = $anon_prefix.(($anon_id == 0) ? '' : '_'.$anon_id); - $anon_id++; - } - return check_name($name); -} - -sub with_anon(&;$) { - # Establish a new anonymous namespace - my ($blk,$stem) = @_; - local $anon_id = $stem ? 0 : 1; - local $anon_prefix = ($stem||'anon'); - $blk->(); -} - -1; diff --git a/library/xml/Enum.pm b/library/xml/Enum.pm deleted file mode 100644 index 7a22239c8..000000000 --- a/library/xml/Enum.pm +++ /dev/null @@ -1,165 +0,0 @@ -package Enum; - -use utf8; -use strict; -use warnings; - -BEGIN { - use Exporter (); - our $VERSION = 1.00; - our @ISA = qw(Exporter); - our @EXPORT = qw( &render_enum_core &render_enum_type ); - our %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], - our @EXPORT_OK = qw( ); -} - -END { } - -use XML::LibXML; - -use Common; - -sub render_enum_core($$) { - my ($name,$tag) = @_; - - my $base = 0; - - emit_block { - my @items = $tag->findnodes('child::enum-item'); - my $idx = 0; - - for my $item (@items) { - my $name = ensure_name $item->getAttribute('name'); - my $value = $item->getAttribute('value'); - - $base = ($idx == 0) ? $value : undef if defined $value; - $idx++; - - emit $name, (defined($value) ? ' = '.$value : ''), ','; - } - - emit "_last_item_of_$name"; - } "enum $name ", ";"; - - return $base; -} - -sub render_enum_tables($$$) { - my ($name,$tag,$base) = @_; - - # Enumerate enum attributes - - my %aidx = ('key' => 0); - my @anames = ('key'); - my @avals = ('NULL'); - my @atypes = ('const char*'); - my @atnames = (undef); - my @aprefix = (''); - - for my $attr ($tag->findnodes('child::enum-attr')) { - my $name = $attr->getAttribute('name') or die "Unnamed enum-attr.\n"; - my $type = decode_type_name_ref $attr; - my $def = $attr->getAttribute('default-value'); - - my $base_tname = ($type && $type =~ /::(.*)$/ ? $1 : ''); - $type = $base_tname if $base_tname eq $typename; - - die "Duplicate attribute $name.\n" if exists $aidx{$name}; - - check_name $name; - $aidx{$name} = scalar @anames; - push @anames, $name; - push @atnames, $type; - - if ($type) { - push @atypes, $type; - push @aprefix, ($base_tname ? $base_tname."::" : ''); - push @avals, (defined $def ? $aprefix[-1].$def : "($type)0"); - } else { - push @atypes, 'const char*'; - push @avals, (defined $def ? "\"$def\"" : 'NULL'); - push @aprefix, ''; - } - } - - # Emit accessor function prototypes - - emit "const $name _first_item_of_$name = ($name)$base;"; - - emit_block { - emit "return (value >= _first_item_of_$name && value < _last_item_of_$name);"; - } "inline bool is_valid($name value) "; - - for (my $i = 0; $i < @anames; $i++) { - emit "${export_prefix}$atypes[$i] get_$anames[$i]($name value);"; - } - - # Emit implementation - - with_emit_static { - emit_block { - emit_block { - # Emit the entry type - emit_block { - for (my $i = 0; $i < @anames; $i++) { - emit "$atypes[$i] $anames[$i];"; - } - } "struct _info_entry ", ";"; - - # Emit the info table - emit_block { - for my $item ($tag->findnodes('child::enum-item')) { - my $tag = $item->nodeName; - - # Assemble item-specific attr values - my @evals = @avals; - my $name = $item->getAttribute('name'); - $evals[0] = "\"$name\"" if $name; - - for my $attr ($item->findnodes('child::item-attr')) { - my $name = $attr->getAttribute('name') or die "Unnamed item-attr.\n"; - my $value = $attr->getAttribute('value') or die "No-value item-attr.\n"; - my $idx = $aidx{$name} or die "Unknown item-attr: $name\n"; - - if ($atnames[$idx]) { - $evals[$idx] = $aprefix[$idx].$value; - } else { - $evals[$idx] = "\"$value\""; - } - } - - emit "{ ",join(', ',@evals)," },"; - } - - emit "{ ",join(', ',@avals)," }"; - } "static const _info_entry _info[] = ", ";"; - - for (my $i = 0; $i < @anames; $i++) { - emit_block { - emit "return is_valid(value) ? _info[value - $base].$anames[$i] : $avals[$i];"; - } "$atypes[$i] get_$anames[$i]($name value) "; - } - } "namespace $name "; - } "namespace enums "; - } 'enums'; -} - -sub render_enum_type { - my ($tag) = @_; - - emit_block { - emit_block { - my $base = render_enum_core($typename,$tag); - - if (defined $base) { - render_enum_tables($typename,$tag,$base); - } else { - print STDERR "Warning: complex enum: $typename\n"; - } - } "namespace $typename "; - } "namespace enums "; - - emit "using enums::",$typename,"::",$typename,";"; -} - -1; diff --git a/library/xml/StructFields.pm b/library/xml/StructFields.pm deleted file mode 100644 index 8947ef4a6..000000000 --- a/library/xml/StructFields.pm +++ /dev/null @@ -1,328 +0,0 @@ -package StructFields; - -use utf8; -use strict; -use warnings; - -BEGIN { - use Exporter (); - our $VERSION = 1.00; - our @ISA = qw(Exporter); - our @EXPORT = qw( - *in_struct_body &with_struct_block - &get_struct_fields &get_struct_field_type - &emit_struct_fields - ); - our %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], - our @EXPORT_OK = qw( ); -} - -END { } - -use XML::LibXML; - -use Common; -use Enum; -use Bitfield; - -# MISC - -our $in_struct_body = 0; - -sub with_struct_block(&$;$%) { - my ($blk, $tag, $name, %flags) = @_; - - my $kwd = (is_attr_true($tag,'is-union') ? "union" : "struct"); - my $exp = $flags{-export} ? $export_prefix : ''; - my $prefix = $kwd.' '.$exp.($name ? $name.' ' : ''); - - emit_block { - local $_; - local $in_struct_body = 1; - if ($flags{-no_anon}) { - $blk->(); - } else { - &with_anon($blk); - } - } $prefix, ";"; -} - -# FIELD TYPE - -sub get_container_item_type($;%) { - my ($tag, %flags) = @_; - my @items = $tag->findnodes('ld:item'); - if (@items) { - return get_struct_field_type($items[0], -local => 1, %flags); - } elsif ($flags{-void}) { - return $flags{-void}; - } else { - die "Container without element: $tag\n"; - } -} - -my %atable = ( 1 => 'char', 2 => 'short', 4 => 'int' ); - -my %custom_primitive_handlers = ( - 'stl-string' => sub { return "std::string"; }, -); - -my %custom_container_handlers = ( - 'stl-vector' => sub { - my $item = get_container_item_type($_, -void => 'void*'); - $item = 'char' if $item eq 'bool'; - return "std::vector<$item>"; - }, - 'stl-bit-vector' => sub { - return "std::vector"; - }, - 'df-flagarray' => sub { - my $type = decode_type_name_ref($_, -attr_name => 'index-enum', -force_type => 'enum-type') || 'int'; - return "BitArray<$type>"; - }, -); - -sub emit_typedef($$) { - # Convert a prefix/postfix pair into a single name - my ($pre, $post) = @_; - my $name = ensure_name undef; - emit 'typedef ', $pre, ' ', $name, $post, ';'; - return $name; -} - -sub get_struct_fields($) { - return $_[0]->findnodes('ld:field'); -} - -sub get_struct_field_type($;%) { - # Dispatch on the tag name, and retrieve the type prefix & suffix - my ($tag, %flags) = @_; - my $meta = $tag->getAttribute('ld:meta'); - my $subtype = $tag->getAttribute('ld:subtype'); - my $prefix; - my $suffix = ''; - - if ($prefix = $tag->getAttribute('ld:typedef-name')) { - unless ($flags{-local}) { - my @names = ( $main_namespace ); - for my $parent ($tag->findnodes('ancestor::*')) { - if ($parent->nodeName eq 'ld:global-type') { - push @names, $parent->getAttribute('type-name'); - } elsif (my $n = $parent->getAttribute('ld:typedef-name')) { - push @names, $n; - } - } - $prefix = join('::',@names,$prefix); - } - } elsif ($meta eq 'number') { - $prefix = primitive_type_name($subtype); - } elsif ($meta eq 'bytes') { - if ($flags{-local} && !$flags{-weak}) { - if ($subtype eq 'static-string') { - my $count = $tag->getAttribute('size') || 0; - $prefix = "char"; - $suffix = "[$count]"; - } elsif ($subtype eq 'padding') { - my $count = $tag->getAttribute('size') || 0; - my $alignment = $tag->getAttribute('alignment') || 1; - $prefix = $atable{$alignment} or die "Invalid alignment: $alignment\n"; - ($count % $alignment) == 0 or die "Invalid size & alignment: $count $alignment\n"; - $suffix = "[".($count/$alignment)."]"; - } else { - die "Invalid bytes subtype: $subtype\n"; - } - } else { - $prefix = primitive_type_name($subtype); - } - } elsif ($meta eq 'global') { - my $tname = $tag->getAttribute('type-name'); - register_ref $tname, !$flags{-weak}; - $prefix = $main_namespace.'::'.$tname; - } elsif ($meta eq 'compound') { - die "Unnamed compound in global mode: ".$tag->toString."\n" unless $flags{-local}; - - $prefix = ensure_name undef; - $tag->setAttribute('ld:typedef-name', $prefix) if $in_struct_body; - - $subtype ||= 'compound'; - if ($subtype eq 'enum') { - with_anon { - render_enum_core($prefix,$tag); - }; - } elsif ($subtype eq 'bitfield') { - with_anon { - render_bitfield_core($prefix,$tag); - }; - } else { - with_struct_block { - emit_struct_fields($tag, $prefix); - } $tag, $prefix; - } - } elsif ($meta eq 'pointer') { - $prefix = get_container_item_type($tag, -weak => 1, -void => 'void')."*"; - } elsif ($meta eq 'static-array') { - ($prefix, $suffix) = get_container_item_type($tag); - my $count = $tag->getAttribute('count') || 0; - $suffix = "[$count]".$suffix; - } elsif ($meta eq 'primitive') { - local $_ = $tag; - my $handler = $custom_primitive_handlers{$subtype} or die "Invalid primitive: $subtype\n"; - $prefix = $handler->($tag, %flags); - } elsif ($meta eq 'container') { - local $_ = $tag; - my $handler = $custom_container_handlers{$subtype} or die "Invalid container: $subtype\n"; - $prefix = $handler->($tag, %flags); - } elsif (!$flags{-local} && $tag->nodeName eq 'ld:global-type') { - my $tname = $tag->getAttribute('type-name'); - $prefix = $main_namespace.'::'.$tname; - } else { - die "Invalid field meta type: $meta\n"; - } - - if ($subtype && $flags{-local} && $subtype eq 'enum') { - my $base = get_primitive_base($tag, 'int32_t'); - $prefix = "enum_field<$prefix,$base>"; - } - - return ($prefix,$suffix) if wantarray; - if ($suffix) { - $prefix = emit_typedef($prefix, $suffix); - $tag->setAttribute('ld:typedef-name', $prefix) if $flags{-local} && $in_struct_body; - } - return $prefix; -} - -sub render_struct_field($) { - my ($tag) = @_; - - # Special case: anonymous compounds. - if (is_attr_true($tag, 'ld:anon-compound')) - { - check_bad_attrs($tag); - with_struct_block { - render_struct_field($_) for get_struct_fields($tag); - } $tag, undef, -no_anon => 1; - return; - } - - # Otherwise, create the name if necessary, and render - my $field_name = $tag->getAttribute('name'); - my $name = ensure_name $field_name; - $tag->setAttribute('ld:anon-name', $name) unless $field_name; - with_anon { - my ($prefix, $postfix) = get_struct_field_type($tag, -local => 1); - emit $prefix, ' ', $name, $postfix, ';'; - } "T_$name"; -} - -our @simple_inits; -our $in_union = 0; - -sub render_field_init($$) { - my ($field, $prefix) = @_; - local $_; - - my $meta = $field->getAttribute('ld:meta'); - my $subtype = $field->getAttribute('ld:subtype'); - my $name = $field->getAttribute('name') || $field->getAttribute('ld:anon-name'); - my $fname = ($prefix && $name ? $prefix.'.'.$name : ($name||$prefix)); - - my $is_struct = $meta eq 'compound' && !$subtype; - my $is_union = ($is_struct && is_attr_true($field, 'is-union')); - local $in_union = $in_union || $is_union; - - if (is_attr_true($field, 'ld:anon-compound') || ($in_union && $is_struct)) - { - my @fields = $is_union ? $field->findnodes('ld:field[1]') : get_struct_fields($field); - &render_field_init($_, $fname) for @fields; - return; - } - - return unless ($name || $prefix =~ /\]$/); - - my $val = $field->getAttribute('init-value'); - my $assign = 0; - - if ($meta eq 'number' || $meta eq 'pointer') { - $assign = 1; - my $signed_ref = - !is_attr_true($field,'ld:unsigned') && - ($field->getAttribute('ref-target') || $field->getAttribute('refers-to')); - $val ||= ($signed_ref ? '-1' : 0); - } elsif ($meta eq 'bytes') { - emit "memset($fname, 0, sizeof($fname));"; - } elsif ($meta eq 'global' || $meta eq 'compound') { - return unless $subtype; - - if ($subtype eq 'bitfield' && $val) { - emit $fname, '.whole = ', $val; - } elsif ($subtype eq 'enum') { - $assign = 1; - if ($meta eq 'global') { - my $tname = $field->getAttribute('type-name'); - $val = ($val ? $main_namespace.'::enums::'.$tname.'::'.$val : "ENUM_FIRST_ITEM($tname)"); - } else { - $val ||= $field->findvalue('enum-item[1]/@name'); - } - } - } elsif ($meta eq 'static-array') { - my $idx = ensure_name undef; - my $count = $field->getAttribute('count')||0; - emit_block { - my $pfix = $fname."[$idx]"; - render_field_init($_, $pfix) for $field->findnodes('ld:item'); - } "for (int $idx = 0; $idx < $count; $idx++) ", "", -auto => 1; - } - - if ($assign) { - if ($prefix || $in_union) { - emit "$fname = $val;"; - } else { - push @simple_inits, "$name($val)"; - } - } -} - -sub emit_struct_fields($$;%) { - my ($tag, $name, %flags) = @_; - - local $_; - my @fields = get_struct_fields($tag); - &render_struct_field($_) for @fields; - - return if $tag->findnodes("ancestor-or-self::ld:field[\@is-union='true']"); - - local $in_struct_body = 0; - - my $want_ctor = 0; - my $ctor_args = ''; - my $ctor_arg_init = ''; - - with_emit_static { - local @simple_inits; - my @ctor_lines = with_emit { - if ($flags{-class}) { - $ctor_args = "virtual_identity *_id"; - $ctor_arg_init = " = &".$name."::_identity"; - push @simple_inits, "$flags{-inherits}(_id)" if $flags{-inherits}; - emit "_identity.adjust_vtable(this, _id);"; - } - render_field_init($_, '') for @fields; - }; - if (@simple_inits || @ctor_lines) { - $want_ctor = 1; - my $full_name = get_struct_field_type($tag); - emit $full_name,'::',$name,"($ctor_args)"; - emit " : ", join(', ', @simple_inits) if @simple_inits; - emit_block { - emit $_ for @ctor_lines; - }; - } - } 'ctors'; - - if ($want_ctor) { - emit "$name($ctor_args$ctor_arg_init);"; - } -} - -1; diff --git a/library/xml/StructType.pm b/library/xml/StructType.pm deleted file mode 100644 index bc5561d46..000000000 --- a/library/xml/StructType.pm +++ /dev/null @@ -1,192 +0,0 @@ -package StructType; - -use utf8; -use strict; -use warnings; - -BEGIN { - use Exporter (); - our $VERSION = 1.00; - our @ISA = qw(Exporter); - our @EXPORT = qw( - &render_struct_type - ); - our %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], - our @EXPORT_OK = qw( ); -} - -END { } - -use XML::LibXML; - -use Common; -use StructFields; - -# MISC - -sub translate_lookup($) { - my ($str) = @_; - return undef unless $str && $str =~ /^\$global((\.[_a-zA-Z0-9]+)+)$/; - my @fields = split /\./, substr($1,1); - my $expr = "df::global::".shift(@fields); - for my $fn (@fields) { - $expr = "_toref($expr).$fn"; - } - return $expr; -} - -sub emit_find_instance { - my ($tag) = @_; - - my $instance_vector = translate_lookup $tag->getAttribute('instance-vector'); - if ($instance_vector) { - emit "static std::vector<$typename*> &get_vector();"; - emit "static $typename *find(int id);"; - - with_emit_static { - emit_block { - emit "return ", $instance_vector, ";"; - } "std::vector<$typename*>& ${typename}::get_vector() "; - - emit_block { - emit "std::vector<$typename*> &vec_ = get_vector();"; - - if (my $id = $tag->getAttribute('key-field')) { - emit "return binsearch_in_vector(vec_, &${typename}::$id, id_);"; - } else { - emit "return (id_ >= 0 && id_ < vec_.size()) ? vec_[id_] : NULL;"; - } - } "$typename *${typename}::find(int id_) "; - }; - } -} - -sub render_virtual_methods { - my ($tag) = @_; - - # Collect all parent classes - my @parents = ( $tag ); - for (;;) { - my $inherits = $parents[0]->getAttribute('inherits-from') or last; - my $parent = $types{$inherits} || die "Unknown parent: $inherits\n"; - unshift @parents, $parent; - } - - # Build the vtable array - my %name_index; - my @vtable; - my @starts; - my $dtor_id = '~destructor'; - - for my $type (@parents) { - push @starts, scalar(@vtable); - for my $method ($type->findnodes('virtual-methods/vmethod')) { - my $is_destructor = is_attr_true($method, 'is-destructor'); - my $name = $is_destructor ? $dtor_id : $method->getAttribute('name'); - if ($name) { - die "Duplicate method: $name in ".$type->getAttribute('type-name')."\n" - if exists $name_index{$name}; - $name_index{$name} = scalar(@vtable); - } - push @vtable, $method; - } - } - - # Ensure there is a destructor to avoid warnings - my $dtor_idx = $name_index{$dtor_id}; - unless (defined $dtor_idx) { - for (my $i = 0; $i <= $#vtable; $i++) { - next if $vtable[$i]->getAttribute('name'); - $name_index{$dtor_id} = $dtor_idx = $i; - last; - } - } - unless (defined $dtor_idx) { - push @vtable, undef; - $dtor_idx = $#vtable; - } - - # Generate the methods - my $min_id = $starts[-1]; - my $cur_mode = ''; - for (my $idx = $min_id; $idx <= $#vtable; $idx++) { - my $method = $vtable[$idx]; - my $is_destructor = 1; - my $name = $typename; - my $is_anon = 1; - - if ($method) { - $is_destructor = is_attr_true($method, 'is-destructor'); - $name = $method->getAttribute('name') unless $is_destructor; - $is_anon = 0 if $name; - } - - my $rq_mode = $is_anon ? 'protected' : 'public'; - unless ($rq_mode eq $cur_mode) { - $cur_mode = $rq_mode; - outdent { emit "$cur_mode:"; } - } - - with_anon { - $name = ensure_name $name; - $method->setAttribute('ld:anon-name', $name) if $method && $is_anon; - - my @ret_type = $is_destructor ? () : $method->findnodes('ret-type'); - my @arg_types = $is_destructor ? () : $method->findnodes('ld:field'); - my $ret_type = $ret_type[0] ? get_struct_field_type($ret_type[0], -local => 1) : 'void'; - my @arg_strs = map { scalar get_struct_field_type($_, -local => 1) } @arg_types; - - my $ret_stmt = ''; - unless ($ret_type eq 'void') { - $ret_stmt = ' return '.($ret_type =~ /\*$/ ? '0' : "$ret_type()").'; '; - } - - emit 'virtual ', ($is_destructor?'~':$ret_type.' '), $name, - '(', join(', ', @arg_strs), ') {', $ret_stmt, '}; //', $idx; - } "anon_vmethod_$idx"; - } -} - -sub render_struct_type { - my ($tag) = @_; - - my $tag_name = $tag->getAttribute('ld:meta'); - my $is_class = ($tag_name eq 'class-type'); - my $has_methods = $is_class || is_attr_true($tag, 'has-methods'); - my $inherits = $tag->getAttribute('inherits-from'); - my $original_name = $tag->getAttribute('original-name'); - my $ispec = ''; - - if ($inherits) { - register_ref $inherits, 1; - $ispec = ' : '.$inherits; - } elsif ($is_class) { - $ispec = ' : virtual_class'; - } - - with_struct_block { - emit_struct_fields($tag, $typename, -class => $is_class, -inherits => $inherits); - emit_find_instance($tag); - - if ($has_methods) { - if ($is_class) { - emit "static class_virtual_identity<$typename> _identity;"; - with_emit_static { - emit "class_virtual_identity<$typename> ${typename}::_identity(", - "\"$typename\",", - ($original_name ? "\"$original_name\"" : 'NULL'), ',', - ($inherits ? "&${inherits}::_identity" : 'NULL'), - ");"; - }; - } - - if ($is_class) { - render_virtual_methods $tag; - } else { - emit "~",$typename,"() {}"; - } - } - } $tag, "$typename$ispec", -export => 1; -} - -1; diff --git a/library/xml/codegen.pl b/library/xml/codegen.pl deleted file mode 100755 index 20c4a431f..000000000 --- a/library/xml/codegen.pl +++ /dev/null @@ -1,166 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -BEGIN { - our $script_root = '.'; - if ($0 =~ /^(.*)[\\\/][^\\\/]*$/) { - $script_root = $1; - unshift @INC, $1; - } -}; - -use XML::LibXML; -use XML::LibXSLT; - -use Common; - -use Enum; -use Bitfield; -use StructType; - -my $input_dir = $ARGV[0] || '.'; -my $output_dir = $ARGV[1] || 'codegen'; - -$main_namespace = $ARGV[2] || 'df'; -$export_prefix = 'DFHACK_EXPORT '; - -# Collect all type definitions from XML files - -our $script_root; -my $parser = XML::LibXML->new(); -my $xslt = XML::LibXSLT->new(); -my @transforms = - map { $xslt->parse_stylesheet_file("$script_root/$_"); } - ('lower-1.xslt', 'lower-2.xslt'); -my @documents; - -for my $fn (sort { $a cmp $b } glob "$input_dir/*.xml") { - local $filename = $fn; - my $doc = $parser->parse_file($filename); - $doc = $_->transform($doc) for @transforms; - - push @documents, $doc; - add_type_to_hash $_ foreach $doc->findnodes('/ld:data-definition/ld:global-type'); -} - -# Generate text representations - -my %type_handlers = ( - 'enum-type' => \&render_enum_type, - 'bitfield-type' => \&render_bitfield_type, - 'class-type' => \&render_struct_type, - 'struct-type' => \&render_struct_type, -); - -my %type_data; - -for my $name (sort { $a cmp $b } keys %types) { - local $typename = $name; - local $filename = $type_files{$typename}; - local %weak_refs; - local %strong_refs; - - eval { - my $type = $types{$typename}; - my $meta = $type->getAttribute('ld:meta') or die "Null meta"; - - # Emit the actual type definition - my @code = with_emit { - with_anon { - my $handler = $type_handlers{$meta} or die "Unknown type meta: $meta\n"; - $handler->($type); - }; - } 2; - - delete $weak_refs{$name}; - delete $strong_refs{$name}; - - # Add wrapping - my @all = with_emit { - my $def = type_header_def($typename); - emit "#ifndef $def"; - emit "#define $def"; - - for my $strong (sort { $a cmp $b } keys %strong_refs) { - my $sdef = type_header_def($strong); - emit "#ifndef $sdef"; - emit "#include \"$strong.h\""; - emit "#endif"; - } - - emit_block { - for my $weak (sort { $a cmp $b } keys %weak_refs) { - next if $strong_refs{$weak}; - my $ttype = $types{$weak}; - my $tstr = 'struct'; - $tstr = 'enum' if $ttype->nodeName eq 'enum-type'; - $tstr = 'union' if $ttype->nodeName eq 'bitfield-type'; - $tstr = 'union' if ($ttype->nodeName eq 'struct-type' && is_attr_true($ttype,'is-union')); - emit $tstr, ' ', $weak, ';'; - } - - push @lines, @code; - } "namespace $main_namespace "; - - emit "#endif"; - }; - - $type_data{$typename} = \@all; - }; - if ($@) { - print 'Error: '.$@."Type $typename in $filename ignored\n"; - } -} - -# Write output files - -mkdir $output_dir; - -{ - # Delete the old files - for my $name (glob "$output_dir/*.h") { - unlink $name; - } - for my $name (glob "$output_dir/*.inc") { - unlink $name; - } - unlink "$output_dir/codegen.out.xml"; - - # Write out the headers - local $, = "\n"; - local $\ = "\n"; - - for my $name (keys %type_data) { - open FH, ">$output_dir/$name.h"; - print FH "/* THIS FILE WAS GENERATED. DO NOT EDIT. */"; - print FH @{$type_data{$name}}; - close FH; - } - - # Write out the static file - for my $tag (keys %static_lines) { - my $name = $output_dir.'/static'.($tag?'.'.$tag:'').'.inc'; - open FH, ">$name"; - print FH "/* THIS FILE WAS GENERATED. DO NOT EDIT. */"; - for my $name (sort { $a cmp $b } keys %{$static_includes{$tag}}) { - print FH "#include \"$name.h\""; - } - print FH "namespace $main_namespace {"; - print FH @{$static_lines{$tag}}; - print FH '}'; - close FH; - } - - # Write an xml file with all types - open FH, ">$output_dir/codegen.out.xml"; - print FH ''; - for my $doc (@documents) { - for my $node ($doc->documentElement()->findnodes('*')) { - print FH ' '.$node->toString(); - } - } - print FH ''; - close FH; -} diff --git a/library/xml/df.building-raws.xml b/library/xml/df.building-raws.xml deleted file mode 100644 index bf522ae31..000000000 --- a/library/xml/df.building-raws.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/library/xml/df.buildings.xml b/library/xml/df.buildings.xml deleted file mode 100644 index 74df09eb7..000000000 --- a/library/xml/df.buildings.xml +++ /dev/null @@ -1,403 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - not room; 1 in stockpile; 2 wall; 3 inner; 4 distance boundary. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- stockpile -- - - - - - - - - - - - - - - - - - - - - - - - - - -- zone -- - - - - - - -- actual -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- workshops -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- misc -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/library/xml/df.creature-raws.xml b/library/xml/df.creature-raws.xml deleted file mode 100644 index 61aa7ed7c..000000000 --- a/library/xml/df.creature-raws.xml +++ /dev/null @@ -1,592 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // 0 around of, 1 around by - - - - - - - - - - - - - - - - - - - $global.world.raws.creatures.all[$$].caste[$] - - - - - - - - - // temporary - - - - fingers[2], nose, ear, head, eyes, mouth, hair, knuckles, lips, cheek, nails, f eet, arms, hands, tongue, leg - - - - - - - - - - - - - - - - - - - - - - - - - - // NOT 32-bit! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $global.world.raws.creatures.all[$] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/library/xml/df.d_init.xml b/library/xml/df.d_init.xml deleted file mode 100644 index 345fa812a..000000000 --- a/library/xml/df.d_init.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 85266c0 - - - - diff --git a/library/xml/df.history.xml b/library/xml/df.history.xml deleted file mode 100644 index da666e933..000000000 --- a/library/xml/df.history.xml +++ /dev/null @@ -1,246 +0,0 @@ - - - -- Important - - - - - - -- Misc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (let* ((info $$._parent._parent._parent) - (figure $info._parent._parent) - (caste (find-instance $caste_raw $figure.caste $figure.race))) - $caste.body_parts[$]) - - - - - - - - - - - - - - - - - - - - - - - - - (describe-obj $.name) - (awhen (find-creature $.race) - (fmt "~:(~A ~A~)" $it.caste[$.caste].caste_id $it.creature_id)) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - dtor 8532fa0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/library/xml/df.init.xml b/library/xml/df.init.xml deleted file mode 100644 index 6680b788a..000000000 --- a/library/xml/df.init.xml +++ /dev/null @@ -1,138 +0,0 @@ - - -- init.h - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- texture_handler.h - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/library/xml/df.item-raws.xml b/library/xml/df.item-raws.xml deleted file mode 100644 index cdd3a175e..000000000 --- a/library/xml/df.item-raws.xml +++ /dev/null @@ -1,374 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/library/xml/df.items.xml b/library/xml/df.items.xml deleted file mode 100644 index d4c5732b3..000000000 --- a/library/xml/df.items.xml +++ /dev/null @@ -1,894 +0,0 @@ - - -- MISC TYPES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- CORE ITEM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 10 - - - - - - - - - - - - - - - - -- 20 - - - - - - - - - - - - - - - - -- 30 - - - - - - - - - - - - - - -- 40 - - - - - - - - - - - - - - - - - -- 50 - - - - - - - - - - - - - - - - - - -- 60 - - - - - - - - - - - - - - -- 70 - - - - - - - - - - - - - - - - - -- 80 - - - - - - - - - - - - - - -- 90 - - - - - - - - - - - - - - -- 100 - - - - - - - - - - - - - - - - - - - - -- 110 - - - - - - - - - - - - - - -- 120 - - - - - - - - - - - - - - - - - - - -- 130 - - - - - - - - - - - - - - -- 140 - - - - - - - - - - - - - - -- 150 - - - - - - - - - - - - - - - - - -- 160 - - - - - - - - - - - - - - -- 170 - - - - - - - - - - - - - - - - - -- 180 - - - - - - - - - - - - - - -- 190 - - - - - - - - - - - - - - - - -- 200 - - - - - - - - - - - - - - -- 210 - - - - - - - - - - - - - - -- ACTUAL ITEM - - - - - -- Wielders - - - - - - - - - - - - - - - - - - (if (> $.stack_size 1) (fmt "stack: ~A" $.stack_size)) - (if (> $.wear 0) (fmt "wear: ~A" $.wear)) - - - - - - - - - - - - - - - - - - - - - - - - - - -- CRAFTED ITEM - - - - - - - $.quality - (describe-obj (material-by-id $.matType $.matIndex)) - - - - - - - - - - -- CONSTRUCTED ITEM - - - - - - - - -- BODY COMPONENT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- CRITTER - - - - - - - - - -- LIQUID/POWER - - - - - - - - - - - - - - - - - - -- MISC - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- CONSTRUCTED - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/library/xml/df.job-enums.xml b/library/xml/df.job-enums.xml deleted file mode 100644 index 608693cb6..000000000 --- a/library/xml/df.job-enums.xml +++ /dev/null @@ -1,2191 +0,0 @@ - - ----- PROFESSION ----- - - - - - - - - - - -- 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 10 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 20 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 30 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 40 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 50 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 60 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 70 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 80 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 90 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 100 - - - - - - - - - - - - - - - - - - - - - - - - - - - - ----- LABOR ----- - - - - - - - -- 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 10 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 20 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 30 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 40 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 50 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 60 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 70 - - - - - - - - - - - - - ----- SKILL ----- - - - - - - - - - - - - - - - - - - - - - - - -- 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 10 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 20 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 30 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 40 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 50 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 60 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 70 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 80 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 90 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 100 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 110 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ----- JOB TYPE ----- - - - -- Declare attributes: - - - - -- 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 10 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 20 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 30 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 40 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 50 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 60 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 70 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 80 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 90 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 100 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 110 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 120 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 130 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 140 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 150 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 160 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 170 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 180 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 190 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 200 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 210 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 220 - - - - - - - - - - - - - - - - - - - - diff --git a/library/xml/df.jobs.xml b/library/xml/df.jobs.xml deleted file mode 100644 index 3c2150736..000000000 --- a/library/xml/df.jobs.xml +++ /dev/null @@ -1,264 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- Guess: - - - - - - - - - - - -- Either empty, or same as above: - - - - - - - - -- These are equal to the ones above: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/library/xml/df.language.xml b/library/xml/df.language.xml deleted file mode 100644 index 9a0c7d7f2..000000000 --- a/library/xml/df.language.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $.word - - - - - - - - - - - - - - $.name - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (when $.has_name - (let* ((nick $.nickname) - (language $global.world.raws.translations[$.language]) - (english $global.world.raws.language_words) - (fname $.first_name) - (lwords $language.words)) - (flet ((get-words (start end) - (loop for i from start to end - for word = $.words[i] - collect $lwords[word].value)) - (get-english (start end) - (loop for i from start to end - for word = $.words[i] and ps = $.parts_of_speech[i] - collect $english[word].forms[ps]))) - (list - (fmt "Name:~:(~@[ ~A~]~@[ '~A'~]~@[ ~{~A~}~]~@[ ~{~A~}~]~@[ ~{~A~}~]~)" - (if (> (length fname) 0) fname) - (if (> (length nick) 0) nick) - (flatten (get-words 0 1)) - (flatten (get-words 2 5)) - (flatten (get-words 6 6))) - (fmt "aka~:(~@[ ~A~]~@[ ~{~A~}~]~@[ the ~A~]~@[ of ~{~A~}~]~)" - (if (> (length fname) 0) fname) - (flatten (get-english 0 1)) - (when (>= $.words[5] 0) - (apply #'format nil "~@[~A ~]~@[~A ~]~@[~A-~]~A" (get-english 2 5))) - (flatten (get-english 6 6))))))) - - - - - diff --git a/library/xml/df.legends.xml b/library/xml/df.legends.xml deleted file mode 100644 index baa0da159..000000000 --- a/library/xml/df.legends.xml +++ /dev/null @@ -1,305 +0,0 @@ - - - - - - - - - - - - - (describe-obj $.name) - (describe-obj (find-creature $.race)) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (describe-obj $.name) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (describe-obj $.figure) - - - - - - - - - - - - - - - - (describe-obj $.name) - - - - - - - - - - - diff --git a/library/xml/df.machines.xml b/library/xml/df.machines.xml deleted file mode 100644 index 000e83255..000000000 --- a/library/xml/df.machines.xml +++ /dev/null @@ -1,96 +0,0 @@ - - -- MACHINE - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- MACHINE COMPONENT BUILDINGS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/library/xml/df.map.xml b/library/xml/df.map.xml deleted file mode 100644 index eac8bbeb9..000000000 --- a/library/xml/df.map.xml +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/library/xml/df.materials.xml b/library/xml/df.materials.xml deleted file mode 100644 index c69b876a1..000000000 --- a/library/xml/df.materials.xml +++ /dev/null @@ -1,419 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (describe-material $) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // color token index - - - - - - - - - - - (material-by-id $ $$) - (describe-material $) - - - - - - - - - - - - - - - (describe-material $) - - - - - - - - - $.id - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $.id - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/library/xml/df.military.xml b/library/xml/df.military.xml deleted file mode 100644 index e22fd1fa5..000000000 --- a/library/xml/df.military.xml +++ /dev/null @@ -1,285 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- May be invalid: - - - - - - - - - - - - - - - - - - - - (describe-obj $.name) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (describe-obj $.name) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/library/xml/df.projectile.xml b/library/xml/df.projectile.xml deleted file mode 100644 index 5fc9b3e4a..000000000 --- a/library/xml/df.projectile.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/library/xml/df.raws.xml b/library/xml/df.raws.xml deleted file mode 100644 index ed2745fb5..000000000 --- a/library/xml/df.raws.xml +++ /dev/null @@ -1,237 +0,0 @@ - - - -- Materials - - - - - - -- Inorganic - - - - - - - - - -- Plants - - - dtor 852cc20 - - - - - - - - - - - - - - - - - - - - - - - - - -- Creature RAWs - - - - dtor 89bab50 - - - dtor 8527e40 - - - - - - - - - - - - - dtor 89ba980 - - - -- Creatures - - - dtor 81448c0 - - - - - - - - - - - - - - - - -- Item RAWs - - - dtor 852e080 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- Sapient species - - - - - - -- Language RAWs - - dtor 852bc90 - - - - - - - - - - - - - - - - - - - - - - -- Words - - - - - - - - - - - - - - - - - - - - - - - - - - - -- Reaction RAWs - - - - - - -- Workshops - - - - - - - - - - - - - - - - -- Material index - - - - - - diff --git a/library/xml/df.refs.xml b/library/xml/df.refs.xml deleted file mode 100644 index 04671dc55..000000000 --- a/library/xml/df.refs.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/library/xml/df.stockpile.xml b/library/xml/df.stockpile.xml deleted file mode 100644 index cfd48e38d..000000000 --- a/library/xml/df.stockpile.xml +++ /dev/null @@ -1,254 +0,0 @@ - - - - - - - - - - - also 26 - also 31 - also 32 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 16 - - - - - - - - - - - - - - - - - - - - - 2 - - - - - - - - 5 - 5 - - - - - 659 - - - - - - - - 17 - - - - - - - - - - - - - - - - - - - - - - - - 11 - - - - - - - - - - - - - - - 11 - - - - - - - - - - - - - diff --git a/library/xml/df.ui.xml b/library/xml/df.ui.xml deleted file mode 100644 index 826a507c3..000000000 --- a/library/xml/df.ui.xml +++ /dev/null @@ -1,607 +0,0 @@ - - - - - - - - - - - - - - - (describe-obj $.name) - - - - - - - - - - - - - - - - - - -- 2 - - - - - - - - - - - - - - - -- 14 - - - - - - -- 17 - - - - - - - - -- 22 - - - - - - -- 25 - - - - - - - - - - - -- 33 - - - - - -- 35 - - - - -- 36 - - - - - - - -- 40 - - - - - - - -- 44 - - - - - - - - - - - - - - - - - - - - - - - - - - ctor 86e33c0 x - dtor 8534190 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - dtor: 0x85272c0 - - - - diff --git a/library/xml/df.units.xml b/library/xml/df.units.xml deleted file mode 100644 index 51282dfde..000000000 --- a/library/xml/df.units.xml +++ /dev/null @@ -1,696 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Scuttle creature: causes creature to be killed, leaving a behind - corpse and generating negative thoughts like a real kill. - - - - - - - - - - - - (describe-obj $.name) - (awhen (find-creature $.race) - (fmt "~:(~A ~A~)" $it.caste[$.caste].caste_id $it.creature_id)) - - - - - - - - - - - - - - - - E.g. for a dead miner, holds the place where he - was likely hanging around when he got the command - to mine in an aquifer. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- If shot by a ranged weapon: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // fight related - // fight related - - - // increments every tick - - - - - - - - - // 87*0 ? - - - - - // 238*0 - // 238*0 - // 238*0 - // 238*0 - // 238*0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // 490 - - - - - - - - - - - - - - - - - - - - - - - - // 53c decrements every job_counter reroll, set when changing jobs - // 540 current_job unit/walk done when reach -1, decremented every tick - // if set, decrements every job_counter reroll - - - // 54c decrements every tick, unstun at 0 - - - - - // coords ? (-30.000x3) - - - // coords again - - - - - - - - - - - - - - - - - - - - - - - - // counter, decrement to 0 - // same as 58c - - // fluctuate - - - - - - - - - - - - - - - - - - - - - - - - // 0x3e8 (1000) - // 0x3e8 (1000) - - - - - - - - - - - - - - - - // item ids? - - // 6f0: dined in a legendary dinning room, etc - - - - // 710 - - - - - // 738 - - - - // coords (-30000*3) - - - - - - - - - - - // 794 - // 796 - // 798 - // 79a - - - - - - - - - - - - - - - - - - - - - - // combat log? - - - - - - - - - - - - - // item related - - - - - - // age ? incremented every tick - - - - - - - - - - // items ids? - - // same size as 8e8, soldier related? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (fmt "value=~A" $.value) - - - - - - - - - - - - - - - (describe-obj $.name) - (awhen (find-creature $.race) - (fmt "~:(~A ~A~)" $it.caste[$.caste].caste_id $it.creature_id)) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/library/xml/df.viewscreen.xml b/library/xml/df.viewscreen.xml deleted file mode 100644 index e5816a194..000000000 --- a/library/xml/df.viewscreen.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - todo - - - - - diff --git a/library/xml/df.world-data.xml b/library/xml/df.world-data.xml deleted file mode 100644 index a914f01e6..000000000 --- a/library/xml/df.world-data.xml +++ /dev/null @@ -1,476 +0,0 @@ - - - - - - - - - - - - - - - - - - - - (describe-obj $.name) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/library/xml/df.world.xml b/library/xml/df.world.xml deleted file mode 100644 index 79f01fc8b..000000000 --- a/library/xml/df.world.xml +++ /dev/null @@ -1,518 +0,0 @@ - - - dtor 89fff80 - - - dtor 8532540 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - -- Entities - - - - - - - - - - - - -- Unknown - - - - -- Units - - - - - - - - - - - - - - - - - - -- Unknown - - - - - - - - - -- Nemesis - - - - - - - - - - - - - - -- Items - - - dtor 852f4b0 - - - - - - - - - - - - - - - - - - - -- Artifacts - - - - - - - - - - - - -- Jobs and projectiles - - - - - - -- Buildings - - - dtor 85316f0 - - - - - - - - - - - - - - - - - - - - -- Machines (connected groups of gears and so on) - - - - - - - - - - - -- Unknown - - - - - - - - - - - - - - - - - - - - - - - - -- Plants - - - - - - - - - -- Unknown - - - - -- Unknown - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- Drills - - - - - - - - - - - -- Reports and announcements - - - dtor 85356e0 - - - - - - - - - - Written to by code at 0x80fd7b0 - - - - - - - - - - - - - - - - - - - - - - 52cdc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 547f8 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- RAWs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ctor 87ae880 - - - - - - - - - - - dtor 83bed90 - - - - - - - - - - - - -- hist figures - - - - - - - - - - - - - - - - Looks like a temporary buffer for pathfinding or something. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 192be0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/library/xml/list.pl b/library/xml/list.pl deleted file mode 100755 index 206565843..000000000 --- a/library/xml/list.pl +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use XML::LibXML; - -my $input_dir = $ARGV[0] || '.'; -my $output_dir = $ARGV[1] || 'codegen'; -my $separator = $ARGV[2] || "\n"; - -print "$output_dir/static.inc"; - -for my $filename (glob "$input_dir/*.xml") { - my $parser = XML::LibXML->new(); - my $doc = $parser->parse_file($filename); - - my @nodes = ( - $doc->findnodes('/data-definition/enum-type'), - $doc->findnodes('/data-definition/bitfield-type'), - $doc->findnodes('/data-definition/struct-type'), - $doc->findnodes('/data-definition/class-type') - ); - - for my $node (@nodes) { - my $name = $node->getAttribute('type-name') - or die "Unnamed type in $filename\n"; - print "$separator$output_dir/$name.h"; - } -} - -print $separator if $separator eq "\n"; - diff --git a/library/xml/lower-1.xslt b/library/xml/lower-1.xslt deleted file mode 100644 index 8316a384f..000000000 --- a/library/xml/lower-1.xslt +++ /dev/null @@ -1,289 +0,0 @@ - - - - - - - - - - - - - Error: Unexpected tag: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - - - - - - - - - - - - - - - - - - - Error: Cannot refer to primitive types from - - - - - - - - - global - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - compound - - - - - - - - - - - - true - - - - - - - - - - - - - - - - - - - - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/library/xml/lower-2.xslt b/library/xml/lower-2.xslt deleted file mode 100644 index 9bcd53f0a..000000000 --- a/library/xml/lower-2.xslt +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - Unexpected field: - - - - - - Unexpected method: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -