Merge remote-tracking branch 'upstream/master'
commit
c2b935a5ac
@ -1 +1,2 @@
|
||||
build-real
|
||||
VC2010
|
||||
DF_PATH.txt
|
||||
|
@ -0,0 +1,4 @@
|
||||
call "%VS100COMNTOOLS%vsvars32.bat"
|
||||
cd VC2010
|
||||
msbuild /m /p:Platform=Win32 /p:Configuration=RelWithDebInfo ALL_BUILD.vcxproj
|
||||
cd ..
|
@ -0,0 +1,4 @@
|
||||
call "%VS100COMNTOOLS%vsvars32.bat"
|
||||
cd VC2010
|
||||
msbuild /m /p:Platform=Win32 /p:Configuration=Release ALL_BUILD.vcxproj
|
||||
cd ..
|
@ -1,5 +0,0 @@
|
||||
mkdir VC2010
|
||||
cd VC2010
|
||||
echo Pre-generating a build folder
|
||||
cmake ..\.. -G"Visual Studio 10"
|
||||
cmake-gui .
|
@ -0,0 +1,6 @@
|
||||
IF EXIST DF_PATH.txt SET /P _DF_PATH=<DF_PATH.txt
|
||||
IF NOT EXIST DF_PATH.txt SET _DF_PATH=%CD%\DF
|
||||
mkdir VC2010
|
||||
cd VC2010
|
||||
echo generating a build folder
|
||||
cmake ..\.. -G"Visual Studio 10" -DCMAKE_INSTALL_PREFIX=%_DF_PATH% -DBUILD_DEVEL=1 -DBUILD_DEV_PLUGINS=1 -DBUILD_DF2MC=1 -DBUILD_DFUSION=1 -DBUILD_STONESENSE=1 -DBUILD_SERVER=1
|
@ -0,0 +1,7 @@
|
||||
IF EXIST DF_PATH.txt SET /P _DF_PATH=<DF_PATH.txt
|
||||
IF NOT EXIST DF_PATH.txt SET _DF_PATH=%CD%\DF
|
||||
mkdir VC2010
|
||||
cd VC2010
|
||||
echo Pre-generating a build folder
|
||||
cmake ..\.. -G"Visual Studio 10" -DCMAKE_INSTALL_PREFIX=%_DF_PATH%
|
||||
cmake-gui .
|
@ -0,0 +1,6 @@
|
||||
IF EXIST DF_PATH.txt SET /P _DF_PATH=<DF_PATH.txt
|
||||
IF NOT EXIST DF_PATH.txt SET _DF_PATH=%CD%\DF
|
||||
mkdir VC2010
|
||||
cd VC2010
|
||||
echo generating a build folder
|
||||
cmake ..\.. -G"Visual Studio 10" -DCMAKE_INSTALL_PREFIX=%_DF_PATH% -DBUILD_DEVEL=0 -DBUILD_DEV_PLUGINS=0 -DBUILD_DF2MC=0 -DBUILD_DFUSION=0 -DBUILD_STONESENSE=0 -DBUILD_SERVER=0
|
@ -0,0 +1,4 @@
|
||||
call "%VS100COMNTOOLS%vsvars32.bat"
|
||||
cd VC2010
|
||||
msbuild /m /p:Platform=Win32 /p:Configuration=RelWithDebInfo INSTALL.vcxproj
|
||||
cd ..
|
@ -0,0 +1,4 @@
|
||||
call "%VS100COMNTOOLS%vsvars32.bat"
|
||||
cd VC2010
|
||||
msbuild /m /p:Platform=Win32 /p:Configuration=Release INSTALL.vcxproj
|
||||
cd ..
|
@ -0,0 +1,4 @@
|
||||
call "%VS100COMNTOOLS%vsvars32.bat"
|
||||
cd VC2010
|
||||
msbuild /m /p:Platform=Win32 /p:Configuration=RelWithDebInfo PACKAGE.vcxproj
|
||||
cd ..
|
@ -0,0 +1,4 @@
|
||||
call "%VS100COMNTOOLS%vsvars32.bat"
|
||||
cd VC2010
|
||||
msbuild /m /p:Platform=Win32 /p:Configuration=Release PACKAGE.vcxproj
|
||||
cd ..
|
@ -0,0 +1,32 @@
|
||||
Option Explicit
|
||||
|
||||
Const BIF_returnonlyfsdirs = &H0001
|
||||
|
||||
Dim wsh, objDlg, objF, fso, spoFile
|
||||
Set objDlg = WScript.CreateObject("Shell.Application")
|
||||
Set objF = objDlg.BrowseForFolder (&H0,"Select your DF folder", BIF_returnonlyfsdirs)
|
||||
|
||||
Set fso = CreateObject("Scripting.FileSystemObject")
|
||||
If fso.FileExists("DF_PATH.txt") Then
|
||||
fso.DeleteFile "DF_PATH.txt", True
|
||||
End If
|
||||
|
||||
If IsValue(objF) Then
|
||||
If InStr(1, TypeName(objF), "Folder") > 0 Then
|
||||
Set spoFile = fso.CreateTextFile("DF_PATH.txt", True)
|
||||
spoFile.WriteLine(objF.Self.Path)
|
||||
End If
|
||||
End If
|
||||
|
||||
Function IsValue(obj)
|
||||
' Check whether the value has been returned.
|
||||
Dim tmp
|
||||
On Error Resume Next
|
||||
tmp = " " & obj
|
||||
If Err <> 0 Then
|
||||
IsValue = False
|
||||
Else
|
||||
IsValue = True
|
||||
End If
|
||||
On Error GoTo 0
|
||||
End Function
|
@ -0,0 +1,6 @@
|
||||
#include "Internal.h"
|
||||
#include "DataDefs.h"
|
||||
#include "MiscUtils.h"
|
||||
|
||||
// Object constructors
|
||||
#include "df/static.ctors.inc"
|
@ -0,0 +1,104 @@
|
||||
/*
|
||||
https://github.com/peterix/dfhack
|
||||
Copyright (c) 2009-2011 Petr Mrázek (peterix@gmail.com)
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "Export.h"
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <climits>
|
||||
#include <stdint.h>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
#include <cstdio>
|
||||
|
||||
using namespace std;
|
||||
|
||||
template <typename T>
|
||||
void print_bits ( T val, DFHack::Console& out )
|
||||
{
|
||||
stringstream strs;
|
||||
T n_bits = sizeof ( val ) * CHAR_BIT;
|
||||
int cnt;
|
||||
for ( unsigned i = 0; i < n_bits; ++i )
|
||||
{
|
||||
cnt = i/10;
|
||||
strs << cnt << " ";
|
||||
}
|
||||
strs << endl;
|
||||
for ( unsigned i = 0; i < n_bits; ++i )
|
||||
{
|
||||
cnt = i%10;
|
||||
strs << cnt << " ";
|
||||
}
|
||||
strs << endl;
|
||||
for ( unsigned i = 0; i < n_bits; ++i )
|
||||
{
|
||||
strs << "--";
|
||||
}
|
||||
strs << endl;
|
||||
for ( unsigned i = 0; i < n_bits; ++i )
|
||||
{
|
||||
strs<< !!( val & 1 ) << " ";
|
||||
val >>= 1;
|
||||
}
|
||||
strs << endl;
|
||||
out.print(strs.str().c_str());
|
||||
}
|
||||
|
||||
//FIXME: Error 8 error C4519: default template arguments are only allowed on a class template
|
||||
template <typename CT, typename FT, typename AT/* = FT*/>
|
||||
CT *binsearch_in_vector(std::vector<CT*> &vec, FT CT::*field, AT value)
|
||||
{
|
||||
int min = -1, max = (int)vec.size();
|
||||
CT **p = vec.data();
|
||||
FT key = (FT)value;
|
||||
for (;;)
|
||||
{
|
||||
int mid = (min + max)>>1;
|
||||
if (mid == min)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
FT midv = p[mid]->*field;
|
||||
if (midv == key)
|
||||
{
|
||||
return p[mid];
|
||||
}
|
||||
else if (midv < key)
|
||||
{
|
||||
min = mid;
|
||||
}
|
||||
else
|
||||
{
|
||||
max = mid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the amount of milliseconds elapsed since the UNIX epoch.
|
||||
* Works on both windows and linux.
|
||||
* source: http://stackoverflow.com/questions/1861294/how-to-calculate-execution-time-of-a-code-snippet-in-c
|
||||
*/
|
||||
DFHACK_EXPORT uint64_t GetTimeMs64();
|
@ -1,2 +1,3 @@
|
||||
*.h
|
||||
*.inc
|
||||
*.xml
|
@ -1,269 +0,0 @@
|
||||
/*
|
||||
https://github.com/peterix/dfhack
|
||||
Copyright (c) 2009-2011 Petr Mrázek (peterix@gmail.com)
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <climits>
|
||||
#include <stdint.h>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
#include <ctime>
|
||||
#include <cstdio>
|
||||
|
||||
using namespace std;
|
||||
/*
|
||||
#include <dfhack/Process.h>
|
||||
#include <dfhack/VersionInfo.h>
|
||||
#include <dfhack/Vector.h>
|
||||
|
||||
void DumpObjStr0Vector (const char * name, DFHack::Process *p, uint32_t addr)
|
||||
{
|
||||
cout << "----==== " << name << " ====----" << endl;
|
||||
DFHack::DfVector <uint32_t> vect(p,addr);
|
||||
for(uint32_t i = 0; i < vect.size();i++)
|
||||
{
|
||||
uint32_t addr = vect[i];
|
||||
cout << p->readSTLString(addr) << endl;
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
void DumpObjVtables (const char * name, DFHack::Process *p, uint32_t addr)
|
||||
{
|
||||
cout << "----==== " << name << " ====----" << endl;
|
||||
DFHack::DfVector <uint32_t> vect(p,addr);
|
||||
for(uint32_t i = 0; i < vect.size();i++)
|
||||
{
|
||||
uint32_t addr = vect[i];
|
||||
uint32_t vptr = p->readDWord(addr);
|
||||
cout << p->readClassName(vptr) << endl;
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
void DumpDWordVector (const char * name, DFHack::Process *p, uint32_t addr)
|
||||
{
|
||||
cout << "----==== " << name << " ====----" << endl;
|
||||
DFHack::DfVector <uint32_t> vect(p,addr);
|
||||
for(uint32_t i = 0; i < vect.size();i++)
|
||||
{
|
||||
uint32_t number = vect[i];
|
||||
cout << number << endl;
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
*/
|
||||
/*
|
||||
address = absolute address of dump start
|
||||
length = length in lines. 1 line = 16 bytes
|
||||
*/
|
||||
/*
|
||||
void hexdump (DFHack::Context *DF, uint32_t address, uint32_t length)
|
||||
{
|
||||
char *buf = new char[length];
|
||||
DF->ReadRaw(address, length, (uint8_t *) buf);
|
||||
uint32_t i = 0;
|
||||
while (i < length)
|
||||
{
|
||||
// leading offset
|
||||
if(i%16 == 0)
|
||||
cout << "0x" << hex << setw(8) << address + i << "| ";
|
||||
// bytes
|
||||
for(int k = 0; k < 4; k++)
|
||||
{
|
||||
cout << hex << setw(2) << int(static_cast<unsigned char>(buf[i])) << " ";
|
||||
i++;
|
||||
if(i == length) break;
|
||||
}
|
||||
if(i%16 == 0 || i>= length)
|
||||
{
|
||||
cout << endl;
|
||||
}
|
||||
else if(i%4 == 0)
|
||||
{
|
||||
cout << " ";
|
||||
}
|
||||
}
|
||||
delete buf;
|
||||
}
|
||||
|
||||
void interleave_hex (DFHack::Context* DF, vector < uint32_t > & addresses, uint32_t length)
|
||||
{
|
||||
vector <char * > bufs;
|
||||
|
||||
for(uint32_t counter = 0; counter < addresses.size(); counter ++)
|
||||
{
|
||||
char * buf = new char[length * 16];
|
||||
DF->ReadRaw(addresses[counter], length * 16, (uint8_t *) buf);
|
||||
bufs.push_back(buf);
|
||||
}
|
||||
cout << setfill('0');
|
||||
|
||||
// output a header
|
||||
cout << "line offset ";
|
||||
for (uint32_t obj = 0; obj < addresses.size(); obj++)
|
||||
{
|
||||
cout << "0x" << hex << setw(9) << addresses[obj] << " ";
|
||||
}
|
||||
cout << endl;
|
||||
|
||||
for(uint32_t offs = 0 ; offs < length * 16; offs += 4)
|
||||
{
|
||||
if((!(offs % 16)) && offs != 0)
|
||||
{
|
||||
cout << endl;
|
||||
}
|
||||
cout << setfill(' ');
|
||||
cout << dec << setw(4) << offs/4 << " ";
|
||||
cout << setfill('0');
|
||||
cout << "0x" << hex << setw(4) << offs << " ";
|
||||
for (uint32_t object = 0; object < bufs.size(); object++)
|
||||
{
|
||||
// bytes
|
||||
for(int k = 0; k < 4; k++)
|
||||
{
|
||||
uint8_t data = bufs[object][offs + k];
|
||||
cout << hex << setw(2) << int(static_cast<unsigned char>(data)) << " ";
|
||||
}
|
||||
cout << " ";
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
for(uint32_t counter = 0; counter < addresses.size(); counter ++)
|
||||
{
|
||||
delete bufs[counter];
|
||||
}
|
||||
}
|
||||
*/
|
||||
template <typename T>
|
||||
void print_bits ( T val, DFHack::Console& out )
|
||||
{
|
||||
stringstream strs;
|
||||
T n_bits = sizeof ( val ) * CHAR_BIT;
|
||||
int cnt;
|
||||
for ( unsigned i = 0; i < n_bits; ++i )
|
||||
{
|
||||
cnt = i/10;
|
||||
strs << cnt << " ";
|
||||
}
|
||||
strs << endl;
|
||||
for ( unsigned i = 0; i < n_bits; ++i )
|
||||
{
|
||||
cnt = i%10;
|
||||
strs << cnt << " ";
|
||||
}
|
||||
strs << endl;
|
||||
for ( unsigned i = 0; i < n_bits; ++i )
|
||||
{
|
||||
strs << "--";
|
||||
}
|
||||
strs << endl;
|
||||
for ( unsigned i = 0; i < n_bits; ++i )
|
||||
{
|
||||
strs<< !!( val & 1 ) << " ";
|
||||
val >>= 1;
|
||||
}
|
||||
strs << endl;
|
||||
out.print(strs.str().c_str());
|
||||
}
|
||||
|
||||
/*
|
||||
// this is probably completely bogus
|
||||
std::string PrintSplatterType (int16_t mat1, int32_t mat2, vector<DFHack::t_matgloss> &creature_types)
|
||||
{
|
||||
std::string ret;
|
||||
switch (mat1)
|
||||
{
|
||||
case 0:
|
||||
return "Rock";
|
||||
case 1:
|
||||
return "Amber";
|
||||
case 2:
|
||||
return "Coral";
|
||||
case 3:
|
||||
return "Green Glass";
|
||||
case 4:
|
||||
return "Clear Glass";
|
||||
case 5:
|
||||
return "Crystal Glass";
|
||||
case 6:
|
||||
return "Water";
|
||||
case 7:
|
||||
return "Coal";
|
||||
case 8:
|
||||
return "Potash";
|
||||
case 9:
|
||||
return "Ash";
|
||||
case 10:
|
||||
return "Pearlash";
|
||||
case 11:
|
||||
return "Lye";
|
||||
case 12:
|
||||
return "Mud";
|
||||
case 13:
|
||||
return "Vomit";
|
||||
case 14:
|
||||
return "Salt";
|
||||
case 15:
|
||||
return "Filth";
|
||||
case 16:
|
||||
return "Frozen? Filth";
|
||||
case 18:
|
||||
return "Grime";
|
||||
case 0xF2:
|
||||
return "Very Specific Blood (references a named creature)";
|
||||
case 0x2A:
|
||||
case 0x2B:
|
||||
if(mat2 != -1)
|
||||
{
|
||||
ret += creature_types[mat2].id;
|
||||
ret += " ";
|
||||
}
|
||||
ret += "Blood";
|
||||
return ret;
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//FIXME: Error 8 error C4519: default template arguments are only allowed on a class template
|
||||
template <typename CT, typename FT, typename AT/* = FT*/>
|
||||
CT *binsearch_in_vector(std::vector<CT*> &vec, FT CT::*field, AT value) {
|
||||
int min = -1, max = (int)vec.size();
|
||||
CT **p = vec.data();
|
||||
FT key = (FT)value;
|
||||
for (;;) {
|
||||
int mid = (min + max)>>1;
|
||||
if (mid == min)
|
||||
return NULL;
|
||||
FT midv = p[mid]->*field;
|
||||
if (midv == key)
|
||||
return p[mid];
|
||||
else if (midv < key)
|
||||
min = mid;
|
||||
else
|
||||
max = mid;
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
https://github.com/peterix/dfhack
|
||||
Copyright (c) 2009-2011 Petr Mrázek (peterix@gmail.com)
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifndef TERMUTIL_H
|
||||
#define TERMUTIL_H
|
||||
|
||||
#ifdef LINUX_BUILD
|
||||
// FIXME: is this ever true?
|
||||
bool TemporaryTerminal ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <conio.h>
|
||||
bool TemporaryTerminal ()
|
||||
{
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
HANDLE hStdOutput;
|
||||
hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
if (!GetConsoleScreenBufferInfo(hStdOutput, &csbi))
|
||||
{
|
||||
printf("GetConsoleScreenBufferInfo failed: %d\n", GetLastError());
|
||||
return false;
|
||||
}
|
||||
return ((!csbi.dwCursorPosition.X) && (!csbi.dwCursorPosition.Y));
|
||||
};
|
||||
|
||||
#endif // LINUX_BUILD
|
||||
|
||||
#endif
|
@ -0,0 +1 @@
|
||||
Subproject commit 7a730830c515fea701ff73b33cb604f48a4531fc
|
@ -1,944 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use XML::LibXML;
|
||||
|
||||
my $input_dir = $ARGV[0] || '.';
|
||||
my $output_dir = $ARGV[1] || 'codegen';
|
||||
my $main_namespace = $ARGV[2] || 'df';
|
||||
my $export_prefix = 'DFHACK_EXPORT ';
|
||||
|
||||
my %types;
|
||||
my %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 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;
|
||||
}
|
||||
|
||||
# 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) = @_;
|
||||
$prefix ||= '';
|
||||
$suffix ||= '';
|
||||
emit $prefix,'{';
|
||||
&indent($blk);
|
||||
emit '}',$suffix;
|
||||
}
|
||||
|
||||
# Static file output
|
||||
|
||||
my @static_lines;
|
||||
my %static_includes;
|
||||
|
||||
sub with_emit_static(&) {
|
||||
my ($blk) = @_;
|
||||
$static_includes{$typename}++;
|
||||
push @static_lines, &with_emit($blk,2);
|
||||
}
|
||||
|
||||
# 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->();
|
||||
}
|
||||
|
||||
# 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 ptr-string stl-string flag-bit
|
||||
pointer);
|
||||
|
||||
my %primitive_aliases = (
|
||||
'stl-string' => 'std::string',
|
||||
'ptr-string' => 'char*',
|
||||
'flag-bit' => 'void',
|
||||
'pointer' => 'void*',
|
||||
's-float' => 'float',
|
||||
);
|
||||
|
||||
my %primitive_types;
|
||||
$primitive_types{$_}++ for @primitive_type_list;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
# 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}++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Determines if referenced other types should be included or forward-declared
|
||||
our $is_strong_ref = 1;
|
||||
|
||||
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 $is_strong_ref = 1; # reset the state
|
||||
if ($flags{-no_anon}) {
|
||||
$blk->();
|
||||
} else {
|
||||
&with_anon($blk);
|
||||
}
|
||||
} $prefix, ";";
|
||||
}
|
||||
|
||||
sub decode_type_name_ref($;%) {
|
||||
# Interpret the type-name field of a tag
|
||||
my ($tag,%flags) = @_;
|
||||
my $force_type = $flags{-force_type};
|
||||
my $force_strong = $flags{-force_strong};
|
||||
my $tname = $tag->getAttribute($flags{-attr_name} || 'type-name')
|
||||
or return undef;
|
||||
|
||||
if ($primitive_types{$tname}) {
|
||||
die "Cannot use type $tname as type-name of ".$tag->nodeName."\n"
|
||||
if ($force_type && $force_type ne 'primitive');
|
||||
return primitive_type_name($tname);
|
||||
} else {
|
||||
register_ref $tname, ($force_strong||$is_strong_ref);
|
||||
die "Cannot use type $tname as type-name of ".$tag->nodeName."\n"
|
||||
if ($force_type && $force_type ne $types{$tname}->nodeName);
|
||||
return $main_namespace.'::'.$tname;
|
||||
}
|
||||
}
|
||||
|
||||
# CONDITIONALS
|
||||
|
||||
sub is_conditional($) {
|
||||
my ($tag) = @_;
|
||||
return $tag->nodeName =~ /^(cond-if|cond-elseif)$/;
|
||||
}
|
||||
|
||||
sub translate_if_cond($) {
|
||||
my ($tag) = @_;
|
||||
|
||||
my @rules;
|
||||
if (my $defvar = $tag->getAttribute('defined')) {
|
||||
push @rules, "defined($defvar)";
|
||||
}
|
||||
if (my $cmpvar = $tag->getAttribute('var')) {
|
||||
if (my $cmpval = $tag->getAttribute('lt')) {
|
||||
push @rules, "($cmpvar < $cmpval)";
|
||||
}
|
||||
if (my $cmpval = $tag->getAttribute('le')) {
|
||||
push @rules, "($cmpvar <= $cmpval)";
|
||||
}
|
||||
if (my $cmpval = $tag->getAttribute('eq')) {
|
||||
push @rules, "($cmpvar == $cmpval)";
|
||||
}
|
||||
if (my $cmpval = $tag->getAttribute('ge')) {
|
||||
push @rules, "($cmpvar >= $cmpval)";
|
||||
}
|
||||
if (my $cmpval = $tag->getAttribute('gt')) {
|
||||
push @rules, "($cmpvar > $cmpval)";
|
||||
}
|
||||
if (my $cmpval = $tag->getAttribute('ne')) {
|
||||
push @rules, "($cmpvar != $cmpval)";
|
||||
}
|
||||
}
|
||||
return '('.(join(' && ',@rules) || '1').')';
|
||||
}
|
||||
|
||||
our $in_cond = 0;
|
||||
|
||||
sub render_cond_if($$$;@) {
|
||||
my ($tag, $in_elseif, $render_cb, @tail) = @_;
|
||||
|
||||
local $in_cond = 1;
|
||||
|
||||
{
|
||||
local $indentation = 0;
|
||||
my $op = ($in_elseif && $in_elseif >= 2) ? '#elif' : '#if';
|
||||
emit $op, ' ', translate_if_cond($tag);
|
||||
}
|
||||
|
||||
for my $child ($tag->findnodes('child::*')) {
|
||||
&render_cond($child, $render_cb, @tail);
|
||||
}
|
||||
|
||||
unless ($in_elseif) {
|
||||
local $indentation = 0;
|
||||
emit "#endif";
|
||||
}
|
||||
}
|
||||
|
||||
sub render_cond($$;@) {
|
||||
my ($tag, $render_cb, @tail) = @_;
|
||||
|
||||
my $tag_name = $tag->nodeName;
|
||||
if ($tag_name eq 'cond-if') {
|
||||
render_cond_if($tag, 0, $render_cb, @tail);
|
||||
} elsif ($tag_name eq 'cond-elseif') {
|
||||
my $idx = 1;
|
||||
for my $child ($tag->findnodes('child::*')) {
|
||||
($child->nodeName eq 'cond-if')
|
||||
or die "Only cond-if tags may be inside a cond-switch: ".$child->nodeName."\n";
|
||||
render_cond_if($child, $idx++, $render_cb, @tail);
|
||||
}
|
||||
{
|
||||
local $indentation = 0;
|
||||
emit "#endif";
|
||||
}
|
||||
} else {
|
||||
local $_ = $tag;
|
||||
$render_cb->($tag, @tail);
|
||||
}
|
||||
}
|
||||
|
||||
# ENUM
|
||||
|
||||
sub render_enum_core($$) {
|
||||
my ($name,$tag) = @_;
|
||||
|
||||
my $base = 0;
|
||||
|
||||
emit_block {
|
||||
my @items = $tag->findnodes('child::*');
|
||||
my $idx = 0;
|
||||
|
||||
for my $item (@items) {
|
||||
render_cond $item, sub {
|
||||
my $tag = $_->nodeName;
|
||||
return if $tag eq 'enum-attr';
|
||||
($tag eq 'enum-item')
|
||||
or die "Invalid enum member: ".$item->nodeName."\n";
|
||||
|
||||
my $name = ensure_name $_->getAttribute('name');
|
||||
my $value = $_->getAttribute('value');
|
||||
|
||||
$base = ($idx == 0 && !$in_cond) ? $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);
|
||||
|
||||
for my $attr ($tag->findnodes('child::enum-attr')) {
|
||||
my $name = $attr->getAttribute('name') or die "Unnamed enum-attr.\n";
|
||||
my $type = $attr->getAttribute('type-name');
|
||||
my $def = $attr->getAttribute('default-value');
|
||||
|
||||
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 @avals, (defined $def ? $def : "($type)0");
|
||||
} else {
|
||||
push @atypes, 'const char*';
|
||||
push @avals, (defined $def ? "\"$def\"" : 'NULL');
|
||||
}
|
||||
}
|
||||
|
||||
# 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::*')) {
|
||||
render_cond $item, sub {
|
||||
my $tag = $_->nodeName;
|
||||
return if $tag eq 'enum-attr';
|
||||
|
||||
# Assemble item-specific attr values
|
||||
my @evals = @avals;
|
||||
my $name = $_->getAttribute('name');
|
||||
$evals[0] = "\"$name\"" if $name;
|
||||
|
||||
for my $attr ($_->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] = $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 ";
|
||||
};
|
||||
}
|
||||
|
||||
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,";";
|
||||
}
|
||||
|
||||
# BITFIELD
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
sub render_bitfield_core {
|
||||
my ($name, $tag) = @_;
|
||||
|
||||
emit_block {
|
||||
emit get_primitive_base($tag), ' whole;';
|
||||
|
||||
emit_block {
|
||||
for my $item ($tag->findnodes('child::*')) {
|
||||
render_cond $item, sub {
|
||||
my ($item) = @_;
|
||||
($item->nodeName eq 'flag-bit')
|
||||
or die "Invalid bitfield member:".$item->nodeName."\n";
|
||||
|
||||
check_bad_attrs($item);
|
||||
my $name = ensure_name $item->getAttribute('name');
|
||||
my $size = $item->getAttribute('count') || 1;
|
||||
emit "unsigned ", $name, " : ", $size, ";";
|
||||
};
|
||||
}
|
||||
} "struct ", " bits;";
|
||||
} "union $name ", ";";
|
||||
}
|
||||
|
||||
sub render_bitfield_type {
|
||||
my ($tag) = @_;
|
||||
render_bitfield_core($typename,$tag);
|
||||
}
|
||||
|
||||
# STRUCT
|
||||
|
||||
my %struct_field_handlers;
|
||||
|
||||
sub get_struct_fields($) {
|
||||
# Retrieve subtags that are actual struct fields
|
||||
my ($struct_tag) = @_;
|
||||
local $_;
|
||||
return grep {
|
||||
my $tag = $_->nodeName;
|
||||
die "Unknown field tag: $tag\n"
|
||||
unless exists $struct_field_handlers{$tag};
|
||||
$struct_field_handlers{$tag};
|
||||
} $struct_tag->findnodes('child::*');
|
||||
}
|
||||
|
||||
sub get_struct_field_type($) {
|
||||
# Dispatch on the tag name, and retrieve the type prefix & suffix
|
||||
my ($tag) = @_;
|
||||
my $handler = $struct_field_handlers{$tag->nodeName}
|
||||
or die "Unexpected tag: ".$tag->nodeName;
|
||||
return $handler->($tag);
|
||||
}
|
||||
|
||||
sub do_render_struct_field($) {
|
||||
my ($tag) = @_;
|
||||
my $tag_name = $tag->nodeName;
|
||||
my $field_name = $tag->getAttribute('name');
|
||||
|
||||
# Special case: anonymous compounds.
|
||||
if ($tag_name eq 'compound' && !defined $field_name &&
|
||||
!defined $tag->getAttribute('type-name'))
|
||||
{
|
||||
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 $name = ensure_name $field_name;
|
||||
with_anon {
|
||||
my ($prefix, $postfix) = get_struct_field_type($tag);
|
||||
emit $prefix, ' ', $name, $postfix, ';';
|
||||
} "T_$name";
|
||||
}
|
||||
|
||||
sub render_struct_field($) {
|
||||
my ($tag) = @_;
|
||||
render_cond $tag, \&do_render_struct_field;
|
||||
}
|
||||
|
||||
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_container_item_type($$;$) {
|
||||
# Interpret the type-name and nested fields for a generic container type
|
||||
my ($tag,$strong_ref,$allow_void) = @_;
|
||||
|
||||
check_bad_attrs($tag);
|
||||
|
||||
my $prefix;
|
||||
my $postfix = '';
|
||||
local $is_strong_ref = $strong_ref;
|
||||
|
||||
unless ($prefix = decode_type_name_ref($tag)) {
|
||||
my @fields = get_struct_fields($tag);
|
||||
|
||||
if (scalar(@fields) == 1 && !is_conditional($fields[0])) {
|
||||
($prefix, $postfix) = get_struct_field_type($fields[0]);
|
||||
} elsif (scalar(@fields) == 0) {
|
||||
$allow_void or die "Empty container: ".$tag->nodeName."\n";
|
||||
$prefix = $allow_void;
|
||||
} else {
|
||||
$prefix = ensure_name undef;
|
||||
with_struct_block {
|
||||
render_struct_field($_) for @fields;
|
||||
} $tag, $prefix;
|
||||
}
|
||||
}
|
||||
|
||||
return ($prefix,$postfix) if wantarray;
|
||||
return emit_typedef($prefix, $postfix) if $postfix;
|
||||
return $prefix;
|
||||
}
|
||||
|
||||
sub get_primitive_field_type {
|
||||
# Primitive type handler
|
||||
my ($tag,$fname) = @_;
|
||||
check_bad_attrs($tag);
|
||||
my $name = $tag->nodeName;
|
||||
return (primitive_type_name($name), "");
|
||||
}
|
||||
|
||||
sub get_static_string_type {
|
||||
# Static string handler
|
||||
my ($tag, $fname) = @_;
|
||||
check_bad_attrs($tag, 1);
|
||||
my $count = $tag->getAttribute('size') || 0;
|
||||
return ('char', "[$count]");
|
||||
}
|
||||
|
||||
sub get_padding_type {
|
||||
# Padding handler. Supports limited alignment.
|
||||
my ($tag, $fname) = @_;
|
||||
|
||||
check_bad_attrs($tag, 1, 1);
|
||||
my $count = $tag->getAttribute('size') || 0;
|
||||
my $align = $tag->getAttribute('alignment') || 1;
|
||||
|
||||
if ($align == 1) {
|
||||
return ('char', "[$count]");
|
||||
} elsif ($align == 2) {
|
||||
($count % 2 == 0) or die "Size not aligned in padding: $count at $align\n";
|
||||
return ('short', "[".($count/2)."]");
|
||||
} elsif ($align == 4) {
|
||||
($count % 4 == 0) or die "Size not aligned in padding: $count at $align\n";
|
||||
return ('int', "[".($count/4)."]");
|
||||
} else {
|
||||
die "Bad padding alignment $align in $typename in $filename\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub get_static_array_type {
|
||||
# static-array handler
|
||||
my ($tag, $fname) = @_;
|
||||
my ($pre, $post) = get_container_item_type($tag, 1);
|
||||
my $count = $tag->getAttribute('count')
|
||||
or die "Count is mandatory for static-array in $typename in $filename\n";
|
||||
return ($pre, "[$count]".$post);
|
||||
}
|
||||
|
||||
sub get_pointer_type($) {
|
||||
# pointer handler
|
||||
my ($tag) = @_;
|
||||
my $item = get_container_item_type($tag, 0, 'void');
|
||||
return ($item.'*', '');
|
||||
}
|
||||
|
||||
sub get_compound_type($) {
|
||||
# compound (nested struct) handler
|
||||
my ($tag) = @_;
|
||||
check_bad_attrs($tag);
|
||||
|
||||
my $tname = decode_type_name_ref($tag);
|
||||
unless ($tname) {
|
||||
$tname = ensure_name undef;
|
||||
with_struct_block {
|
||||
render_struct_field($_) for get_struct_fields($tag);
|
||||
} $tag, $tname;
|
||||
}
|
||||
return ($tname,'');
|
||||
}
|
||||
|
||||
sub get_bitfield_type($) {
|
||||
# nested bitfield handler
|
||||
my ($tag) = @_;
|
||||
check_bad_attrs($tag);
|
||||
|
||||
my $tname = decode_type_name_ref($tag, -force_type => 'bitfield-type');
|
||||
unless ($tname) {
|
||||
$tname = ensure_name undef;
|
||||
with_anon {
|
||||
render_bitfield_core($tname, $tag);
|
||||
};
|
||||
}
|
||||
return ($tname,'');
|
||||
}
|
||||
|
||||
sub get_enum_type($) {
|
||||
# nested enum handler
|
||||
my ($tag) = @_;
|
||||
check_bad_attrs($tag);
|
||||
|
||||
my $tname = decode_type_name_ref($tag, -force_type => 'enum-type', -force_strong => 1);
|
||||
my $base = get_primitive_base($tag, 'int32_t');
|
||||
unless ($tname) {
|
||||
$tname = ensure_name undef;
|
||||
with_anon {
|
||||
render_enum_core($tname,$tag);
|
||||
};
|
||||
}
|
||||
return ("enum_field<$tname,$base>", '');
|
||||
}
|
||||
|
||||
sub get_stl_vector_type($) {
|
||||
# STL vector
|
||||
my ($tag) = @_;
|
||||
my $item = get_container_item_type($tag,1,'void*');
|
||||
$item = 'char' if $item eq 'bool';
|
||||
return ("std::vector<$item>", '');
|
||||
}
|
||||
|
||||
sub get_stl_bit_vector_type($) {
|
||||
# STL bit vector
|
||||
my ($tag) = @_;
|
||||
check_bad_attrs($tag);
|
||||
return ("std::vector<bool>", '');
|
||||
}
|
||||
|
||||
sub get_df_flagarray_type($) {
|
||||
# DF flag array
|
||||
my ($tag) = @_;
|
||||
check_bad_attrs($tag);
|
||||
my $type = decode_type_name_ref($tag, -attr_name => 'index-enum', -force_type => 'enum-type', -force_strong => 1) || 'int';
|
||||
return ("BitArray<$type>", '');
|
||||
}
|
||||
|
||||
# Struct dispatch table and core
|
||||
|
||||
%struct_field_handlers = (
|
||||
'comment' => undef, # skip
|
||||
'code-helper' => undef, # skip
|
||||
'cond-if' => sub { die "cond handling error"; },
|
||||
'cond-elseif' => sub { die "cond handling error"; },
|
||||
'static-string' => \&get_static_string_type,
|
||||
'padding' => \&get_padding_type,
|
||||
'static-array' => \&get_static_array_type,
|
||||
'pointer' => \&get_pointer_type,
|
||||
'compound' => \&get_compound_type,
|
||||
'bitfield' => \&get_bitfield_type,
|
||||
'enum' => \&get_enum_type,
|
||||
'stl-vector' => \&get_stl_vector_type,
|
||||
'stl-bit-vector' => \&get_stl_bit_vector_type,
|
||||
'df-flagarray' => \&get_df_flagarray_type,
|
||||
);
|
||||
$struct_field_handlers{$_} ||= \&get_primitive_field_type for @primitive_type_list;
|
||||
|
||||
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_struct_type {
|
||||
my ($tag) = @_;
|
||||
|
||||
my $tag_name = $tag->nodeName;
|
||||
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 {
|
||||
render_struct_field($_) for get_struct_fields($tag);
|
||||
|
||||
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'),
|
||||
");";
|
||||
}
|
||||
}
|
||||
|
||||
outdent {
|
||||
emit "protected:";
|
||||
};
|
||||
|
||||
if ($is_class) {
|
||||
emit "virtual ~",$typename,"() {}";
|
||||
} else {
|
||||
emit "~",$typename,"() {}";
|
||||
}
|
||||
}
|
||||
} $tag, "$typename$ispec", -export => 1;
|
||||
}
|
||||
|
||||
# MAIN BODY
|
||||
|
||||
# Collect all type definitions from XML files
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
for my $fn (glob "$input_dir/*.xml") {
|
||||
local $filename = $fn;
|
||||
my $parser = XML::LibXML->new();
|
||||
my $doc = $parser->parse_file($filename);
|
||||
|
||||
add_type_to_hash $_ foreach $doc->findnodes('/data-definition/enum-type');
|
||||
add_type_to_hash $_ foreach $doc->findnodes('/data-definition/bitfield-type');
|
||||
add_type_to_hash $_ foreach $doc->findnodes('/data-definition/struct-type');
|
||||
add_type_to_hash $_ foreach $doc->findnodes('/data-definition/class-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};
|
||||
|
||||
# Emit the actual type definition
|
||||
my @code = with_emit {
|
||||
with_anon {
|
||||
$type_handlers{$type->nodeName}->($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;
|
||||
}
|
||||
|
||||
# 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
|
||||
open FH, ">$output_dir/static.inc";
|
||||
print FH "/* THIS FILE WAS GENERATED. DO NOT EDIT. */";
|
||||
for my $name (sort { $a cmp $b } keys %static_includes) {
|
||||
print FH "#include \"$name.h\"";
|
||||
}
|
||||
print FH "namespace $main_namespace {";
|
||||
print FH @static_lines;
|
||||
print FH '}';
|
||||
close FH;
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
<data-definition>
|
||||
<class-type type-name='building_def' original-name='building_defst' key-field='code'>
|
||||
<stl-string name="code"/>
|
||||
<int32_t name="index"/>
|
||||
<stl-string name="name"/>
|
||||
|
||||
<int32_t name='unk_40'/>
|
||||
<int32_t name='unk_44'/>
|
||||
<static-array name='name_color' count='3' type-name='int16_t'/>
|
||||
|
||||
<static-array name='tile' count='4'>
|
||||
<static-array count='31'>
|
||||
<static-array count='31' type-name='uint8_t'/>
|
||||
</static-array>
|
||||
</static-array>
|
||||
|
||||
<static-array name='tile_color' count='3'>
|
||||
<static-array count='4'>
|
||||
<static-array count='31'>
|
||||
<static-array count='31' type-name='uint8_t'/>
|
||||
</static-array>
|
||||
</static-array>
|
||||
</static-array>
|
||||
|
||||
<static-array name='tile_block' count='31'>
|
||||
<static-array count='31' type-name='uint8_t'/>
|
||||
</static-array>
|
||||
|
||||
<int32_t name='build_key'/>
|
||||
<bool name='needs_magma'/>
|
||||
|
||||
<stl-vector name="build_items">
|
||||
<pointer/>
|
||||
</stl-vector>
|
||||
|
||||
<int32_t name="dim_x"/>
|
||||
<int32_t name="dim_y"/>
|
||||
<int32_t name="workloc_x"/>
|
||||
<int32_t name="workloc_y"/>
|
||||
|
||||
<stl-vector name="build_labors">
|
||||
<enum base-type='int32_t' type-name='unit_labor'/>
|
||||
</stl-vector>
|
||||
<stl-string name="labor_description"/>
|
||||
|
||||
<int32_t name="build_stages"/>
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_def_workshopst' inherits-from='building_def'/>
|
||||
<class-type type-name='building_def_furnacest' inherits-from='building_def'/>
|
||||
</data-definition>
|
||||
|
||||
<!--
|
||||
Local Variables:
|
||||
indent-tabs-mode: nil
|
||||
nxml-child-indent: 4
|
||||
End:
|
||||
-->
|
@ -1,403 +0,0 @@
|
||||
<data-definition>
|
||||
<bitfield-type type-name='building_flags'>
|
||||
<flag-bit name='exists' comment='actually built, not just ordered'/>
|
||||
<flag-bit/>
|
||||
<flag-bit name='room_collision' comment='major intersection with another room?'/>
|
||||
<flag-bit/>
|
||||
<flag-bit name='justice'/>
|
||||
</bitfield-type>
|
||||
|
||||
<class-type type-name='building' original-name='buildingst'
|
||||
instance-vector='$global.world.buildings.all' key-field='id'>
|
||||
|
||||
<int32_t name='x1' comment='left'/>
|
||||
<int32_t name='y1'/>
|
||||
<int32_t name='x2' comment='work location'/>
|
||||
<int32_t name='x3' comment='right'/>
|
||||
<int32_t name='y3'/>
|
||||
<int32_t name='y2'/>
|
||||
<int32_t name='z'/>
|
||||
|
||||
<compound name='flags' type-name='building_flags'/>
|
||||
|
||||
<int16_t name='materialType' ref-target='material' aux-value='$$.materialIndex'/>
|
||||
<int32_t name='materialIndex'/>
|
||||
|
||||
<compound name='room'>
|
||||
<pointer name='extents' type-name='uint8_t'>
|
||||
<comment>0 - not room; 1 in stockpile; 2 wall; 3 inner; 4 distance boundary.</comment>
|
||||
</pointer>
|
||||
<int32_t name='x'/>
|
||||
<int32_t name='y'/>
|
||||
<int32_t name='width'/>
|
||||
<int32_t name='height'/>
|
||||
</compound>
|
||||
|
||||
<int32_t name='age'/>
|
||||
<int16_t name='race' ref-target='creature_raw'/>
|
||||
<int32_t name='id'/>
|
||||
|
||||
<stl-vector name='jobs'>
|
||||
<pointer type-name='job'/>
|
||||
</stl-vector>
|
||||
<stl-vector name='meetings'>
|
||||
<pointer type-name='meeting_ref'/>
|
||||
</stl-vector>
|
||||
<stl-vector name='unk6' type-name='pointer'/>
|
||||
|
||||
<bool name='is_room'/>
|
||||
|
||||
<stl-vector name='children' comment='other buildings within this room'>
|
||||
<pointer type-name='building'/>
|
||||
</stl-vector>
|
||||
<stl-vector name='parents' comment='rooms this building belongs to'>
|
||||
<pointer type-name='building'/>
|
||||
</stl-vector>
|
||||
|
||||
<pointer type-name='unit' name='owner'/>
|
||||
|
||||
<stl-vector name='unk7' type-name='pointer'/>
|
||||
<stl-string name='name'/>
|
||||
|
||||
<stl-vector name='activities'>
|
||||
<pointer>
|
||||
<int32_t name='id' ref-target='activity_entry'/>
|
||||
<int32_t name='is_group'/>
|
||||
</pointer>
|
||||
</stl-vector>
|
||||
</class-type>
|
||||
|
||||
-- stockpile --
|
||||
|
||||
<class-type type-name='building_stockpilest' inherits-from='building'>
|
||||
<compound type-name='stockpile_settings' name='settings'/>
|
||||
|
||||
<int16_t name='max_barrels'/>
|
||||
<int16_t name='max_bins'/>
|
||||
|
||||
<stl-vector name='container_type'>
|
||||
<enum base-type='int16_t' type-name='item_type'/>
|
||||
</stl-vector>
|
||||
<stl-vector name='container_item_id'>
|
||||
<int32_t ref-target='item'/>
|
||||
</stl-vector>
|
||||
<stl-vector name='container_x' type-name='int16_t'/>
|
||||
<stl-vector name='container_y' type-name='int16_t'/>
|
||||
|
||||
<pointer name='give_to' type-name='building_stockpilest'/>
|
||||
<stl-vector name='take_from'>
|
||||
<pointer type-name='building_stockpilest'/>
|
||||
</stl-vector>
|
||||
|
||||
<int32_t name='stockpile_number'/>
|
||||
</class-type>
|
||||
|
||||
-- zone --
|
||||
|
||||
<class-type type-name='building_civzonest' inherits-from='building'>
|
||||
|
||||
</class-type>
|
||||
|
||||
-- actual --
|
||||
|
||||
<class-type type-name='building_actual' inherits-from='building'
|
||||
original-name='building_actualst'>
|
||||
<int16_t name='construction_stage'
|
||||
comment='0 not started, then 1 or 3 max depending on type'/>
|
||||
|
||||
<stl-vector name='contained_items'>
|
||||
<pointer>
|
||||
<pointer name='item' type-name='item'/>
|
||||
<int16_t name='use_mode'/>
|
||||
</pointer>
|
||||
</stl-vector>
|
||||
|
||||
<pointer name='design' type-name='building_design'/>
|
||||
</class-type>
|
||||
|
||||
<struct-type type-name='building_design'>
|
||||
<int32_t name='architect' ref-target='historical_figure'/>
|
||||
<int32_t name='unk2' comment='-1'/>
|
||||
<int16_t name='unk3'/>
|
||||
<int32_t name='builder1' ref-target='historical_figure'/>
|
||||
<int32_t name='unk5' comment='-1'/>
|
||||
<int16_t name='unk6'/>
|
||||
<int16_t name='build_timer1' comment='+1 per 10 frames while building'/>
|
||||
<int32_t name='builder2' ref-target='historical_figure'/>
|
||||
<int16_t name='build_timer2'/>
|
||||
<int16_t name='unk8b'/>
|
||||
<int16_t name='unk9'/>
|
||||
<bitfield name='flags' base-type='uint32_t'>
|
||||
<flag-bit name='rough' comment='rough gabbro road'/>
|
||||
<flag-bit name='built'/>
|
||||
<flag-bit name='designed'/>
|
||||
</bitfield>
|
||||
<int32_t name='unk11'/>
|
||||
<int32_t name='unk12'/>
|
||||
<int32_t name='unk13'/>
|
||||
</struct-type>
|
||||
|
||||
-- workshops --
|
||||
|
||||
<enum-type type-name='furnace_type'>
|
||||
<enum-item name="WoodFurnace"/>
|
||||
<enum-item name="Smelter"/>
|
||||
<enum-item name="GlassFurnace"/>
|
||||
<enum-item name="Kiln"/>
|
||||
<enum-item name="MagmaSmelter"/>
|
||||
<enum-item name="MagmaGlassFurnace"/>
|
||||
<enum-item name="MagmaKiln"/>
|
||||
<enum-item name="Custom"/>
|
||||
</enum-type>
|
||||
|
||||
<class-type type-name='building_furnacest' inherits-from='building_actual'>
|
||||
<stl-vector name='melt_remainder' type-name='int32_t'
|
||||
index-refers-to='(material-by-id 0 $)'/>
|
||||
|
||||
<int16_t name="unk_108"/>
|
||||
|
||||
<enum base-type='int16_t' name="type" type-name='furnace_type'/>
|
||||
|
||||
<stl-vector name="permitted_workers">
|
||||
<int32_t ref-target='unit'/>
|
||||
</stl-vector>
|
||||
<int32_t name="min_level"/>
|
||||
<int32_t name="max_level"/>
|
||||
|
||||
<int32_t name="custom_type" refers-to='$global.world.raws.buildings.furnaces[$]'/>
|
||||
</class-type>
|
||||
|
||||
<enum-type type-name='workshop_type'>
|
||||
<enum-item name="Carpenters"/>
|
||||
<enum-item name="Farmers"/>
|
||||
<enum-item name="Masons"/>
|
||||
<enum-item name="Craftdwarfs"/>
|
||||
<enum-item name="Jewelers"/>
|
||||
<enum-item name="MetalsmithsForge"/>
|
||||
<enum-item name="MagmaForge"/>
|
||||
<enum-item name="Bowyers"/>
|
||||
<enum-item name="Mechanics"/>
|
||||
<enum-item name="Siege"/>
|
||||
<enum-item name="Butchers"/>
|
||||
<enum-item name="Leatherworks"/>
|
||||
<enum-item name="Tanners"/>
|
||||
<enum-item name="Clothiers"/>
|
||||
<enum-item name="Fishery"/>
|
||||
<enum-item name="Still"/>
|
||||
<enum-item name="Loom"/>
|
||||
<enum-item name="Quern"/>
|
||||
<enum-item name="Kennels"/>
|
||||
<enum-item name="Kitchen"/>
|
||||
<enum-item name="Ashery"/>
|
||||
<enum-item name="Dyers"/>
|
||||
<enum-item name="Millstone"/>
|
||||
<enum-item name="Custom"/>
|
||||
</enum-type>
|
||||
|
||||
<class-type type-name='building_workshopst' inherits-from='building_actual'>
|
||||
<enum base-type='int16_t' name="type" type-name='workshop_type'/>
|
||||
|
||||
<stl-vector name="permitted_workers">
|
||||
<int32_t ref-target='unit'/>
|
||||
</stl-vector>
|
||||
<int32_t name="min_level"/>
|
||||
<int32_t name="max_level"/>
|
||||
|
||||
<int32_t name="machine_id" ref-target='machine'/>
|
||||
<int32_t name="unk_118"/>
|
||||
|
||||
<int32_t name="custom_type" refers-to='$global.world.raws.buildings.workshops[$]'/>
|
||||
</class-type>
|
||||
|
||||
-- misc --
|
||||
|
||||
<class-type type-name='building_animaltrapst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_archerytargetst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_armorstandst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_bars_verticalst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_bars_floorst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_bedst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_boxst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_bridgest' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_cabinetst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_cagest' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_chainst' inherits-from='building_actual'>
|
||||
<pointer name='assigned' type-name='unit'/>
|
||||
<pointer name='chained' type-name='unit'/>
|
||||
<int16_t name='unk'/>
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_chairst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_coffinst' inherits-from='building_actual'>
|
||||
<bitfield name='burial_mode' base-type='uint16_t'>
|
||||
<flag-bit name='allow_burial'/>
|
||||
<flag-bit name='no_citizens'/>
|
||||
<flag-bit name='no_pets'/>
|
||||
</bitfield>
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_constructionst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_doorst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_farmplotst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_floodgatest' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_grate_floorst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_grate_wallst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_hatchst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_hivest' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_nestst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_nest_boxst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_roadst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_road_dirtst' inherits-from='building_roadst'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_road_pavedst' inherits-from='building_roadst'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_shopst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_siegeenginest' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_slabst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_statuest' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_supportst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_tablest' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_traction_benchst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_tradedepotst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_trapst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_wagonst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_weaponst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_weaponrackst' inherits-from='building_actual'>
|
||||
<int16_t name='unk_c0'/>
|
||||
|
||||
<stl-vector name='assignments'>
|
||||
<pointer>
|
||||
<int32_t name='squad_id' ref-target='squad'/>
|
||||
<compound name='mode' type-name='squad_use_flags'/>
|
||||
</pointer>
|
||||
</stl-vector>
|
||||
|
||||
<int32_t name='unk_d0'/>
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_wellst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_windowst' inherits-from='building_actual'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_window_glassst' inherits-from='building_windowst'>
|
||||
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='building_window_gemst' inherits-from='building_windowst'>
|
||||
|
||||
</class-type>
|
||||
</data-definition>
|
||||
|
||||
<!--
|
||||
Local Variables:
|
||||
indent-tabs-mode: nil
|
||||
nxml-child-indent: 4
|
||||
End:
|
||||
-->
|
@ -1,592 +0,0 @@
|
||||
<data-definition>
|
||||
<enum-type type-name='creature_raw_flags'>
|
||||
<enum-item/>
|
||||
<enum-item name='EQUIPMENT_WAGON'/>
|
||||
<enum-item name='MUNDANE'/>
|
||||
<enum-item name='VERMIN_EATER'/>
|
||||
<enum-item name='VERMIN_GROUNDER'/>
|
||||
<enum-item name='VERMIN_ROTTER'/>
|
||||
<enum-item name='VERMIN_SOIL'/>
|
||||
<enum-item name='VERMIN_SOIL_COLONY'/>
|
||||
|
||||
<enum-item name='LARGE_ROAMING'/>
|
||||
<enum-item name='VERMIN_FISH'/>
|
||||
<enum-item name='LOOSE_CLUSTERS'/>
|
||||
<enum-item name='FANCIFUL'/>
|
||||
<enum-item name='BIOME_MOUNTAIN'/>
|
||||
<enum-item name='BIOME_GLACIER'/>
|
||||
<enum-item name='BIOME_TUNDRA'/>
|
||||
<enum-item name='BIOME_SWAMP_TEMPERATE_FRESHWATER'/>
|
||||
|
||||
<enum-item name='BIOME_SWAMP_TEMPERATE_SALTWATER'/>
|
||||
<enum-item name='BIOME_MARSH_TEMPERATE_FRESHWATER'/>
|
||||
<enum-item name='BIOME_MARSH_TEMPERATE_SALTWATER'/>
|
||||
<enum-item name='BIOME_SWAMP_TROPICAL_FRESHWATER'/>
|
||||
<enum-item name='BIOME_SWAMP_TROPICAL_SALTWATER'/>
|
||||
<enum-item name='BIOME_SWAMP_MANGROVE'/>
|
||||
<enum-item name='BIOME_MARSH_TROPICAL_FRESHWATER'/>
|
||||
<enum-item name='BIOME_MARSH_TROPICAL_SALTWATER'/>
|
||||
|
||||
<enum-item name='BIOME_FOREST_TAIGA'/>
|
||||
<enum-item name='BIOME_FOREST_TEMPERATE_CONIFER'/>
|
||||
<enum-item name='BIOME_FOREST_TEMPERATE_BROADLEAF'/>
|
||||
<enum-item name='BIOME_FOREST_TROPICAL_CONIFER'/>
|
||||
<enum-item name='BIOME_FOREST_TROPICAL_DRY_BROADLEAF'/>
|
||||
<enum-item name='BIOME_FOREST_TROPICAL_MOIST_BROADLEAF'/>
|
||||
<enum-item name='BIOME_GRASSLAND_TEMPERATE'/>
|
||||
<enum-item name='BIOME_SAVANNA_TEMPERATE'/>
|
||||
|
||||
<enum-item name='BIOME_SHRUBLAND_TEMPERATE'/>
|
||||
<enum-item name='BIOME_GRASSLAND_TROPICAL'/>
|
||||
<enum-item name='BIOME_SAVANNA_TROPICAL'/>
|
||||
<enum-item name='BIOME_SHRUBLAND_TROPICAL'/>
|
||||
<enum-item name='BIOME_DESERT_BADLAND'/>
|
||||
<enum-item name='BIOME_DESERT_ROCK'/>
|
||||
<enum-item name='BIOME_DESERT_SAND'/>
|
||||
<enum-item name='BIOME_OCEAN_TROPICAL'/>
|
||||
|
||||
<enum-item name='BIOME_OCEAN_TEMPERATE'/>
|
||||
<enum-item name='BIOME_OCEAN_ARCTIC'/>
|
||||
<enum-item name='BIOME_SUBTERRANEAN_WATER'/>
|
||||
<enum-item name='BIOME_SUBTERRANEAN_CHASM'/>
|
||||
<enum-item name='BIOME_SUBTERRANEAN_LAVA'/>
|
||||
<enum-item name='BIOME_POOL_TEMPERATE_FRESHWATER'/>
|
||||
<enum-item name='BIOME_POOL_TEMPERATE_BRACKISHWATER'/>
|
||||
<enum-item name='BIOME_POOL_TEMPERATE_SALTWATER'/>
|
||||
|
||||
<enum-item name='BIOME_POOL_TROPICAL_FRESHWATER'/>
|
||||
<enum-item name='BIOME_POOL_TROPICAL_BRACKISHWATER'/>
|
||||
<enum-item name='BIOME_POOL_TROPICAL_SALTWATER'/>
|
||||
<enum-item name='BIOME_LAKE_TEMPERATE_FRESHWATER'/>
|
||||
<enum-item name='BIOME_LAKE_TEMPERATE_BRACKISHWATER'/>
|
||||
<enum-item name='BIOME_LAKE_TEMPERATE_SALTWATER'/>
|
||||
<enum-item name='BIOME_LAKE_TROPICAL_FRESHWATER'/>
|
||||
<enum-item name='BIOME_LAKE_TROPICAL_BRACKISHWATER'/>
|
||||
|
||||
<enum-item name='BIOME_LAKE_TROPICAL_SALTWATER'/>
|
||||
<enum-item name='BIOME_RIVER_TEMPERATE_FRESHWATER'/>
|
||||
<enum-item name='BIOME_RIVER_TEMPERATE_BRACKISHWATER'/>
|
||||
<enum-item name='BIOME_RIVER_TEMPERATE_SALTWATER'/>
|
||||
<enum-item name='BIOME_RIVER_TROPICAL_FRESHWATER'/>
|
||||
<enum-item name='BIOME_RIVER_TROPICAL_BRACKISHWATER'/>
|
||||
<enum-item name='BIOME_RIVER_TROPICAL_SALTWATER'/>
|
||||
<enum-item name='GOOD'/>
|
||||
|
||||
<enum-item name='EVIL'/>
|
||||
<enum-item name='SAVAGE'/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item name='GENERATED'/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item name='DOES_NOT_EXIST'/>
|
||||
<enum-item/>
|
||||
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item name='ARTIFICIAL_HIVEABLE'/>
|
||||
|
||||
<enum-item name='UBIQUITOUS'/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
<enum-item/>
|
||||
</enum-type>
|
||||
|
||||
<struct-type type-name='body_part_layer_raw' key-field='layer_name'>
|
||||
<stl-string name='layer_name'/>
|
||||
|
||||
<int32_t name='tissue_id'/>
|
||||
|
||||
<df-flagarray name='flags'/>
|
||||
|
||||
<int32_t name='unk2'/>
|
||||
|
||||
<int32_t name='healing_rate'/>
|
||||
<int32_t name='vascular'/>
|
||||
<int32_t name='pain_receptors'/>
|
||||
|
||||
<int32_t name='unk6'/>
|
||||
<int16_t name='unk7'/>
|
||||
|
||||
<stl-vector name='unk8'/>
|
||||
|
||||
<int32_t name='layer_id' comment='across all body parts'/>
|
||||
|
||||
<int32_t name='unk10'/>
|
||||
<int32_t name='unk11'/>
|
||||
<int32_t name='layer_depth' comment='-1 for skin and internal organs'/>
|
||||
<int32_t name='unk13'/>
|
||||
<int32_t name='unk14'/>
|
||||
<int32_t name='unk15'/>
|
||||
<int32_t name='unk16'/>
|
||||
</struct-type>
|
||||
|
||||
<struct-type type-name='body_part_raw' key-field='part_name'>
|
||||
<stl-string name='part_code'/>
|
||||
<stl-string name='part_name'/>
|
||||
|
||||
<int16_t name='con_part_id'/>
|
||||
|
||||
<df-flagarray name='flags'/>
|
||||
|
||||
<stl-vector name='layers'>
|
||||
<pointer type-name='body_part_layer_raw'/>
|
||||
</stl-vector>
|
||||
|
||||
<int32_t name='unk2'/>
|
||||
<int32_t name='unk3'/>
|
||||
<int32_t name='unk4'/>
|
||||
<int32_t name='unk5'/>
|
||||
<int32_t name='relsize'/>
|
||||
<int32_t name='unk7'/>
|
||||
|
||||
<int16_t name='unk7b'/>
|
||||
|
||||
<stl-vector name='name_singular'>
|
||||
<pointer type-name='stl-string'/>
|
||||
</stl-vector>
|
||||
<stl-vector name='name_plural'>
|
||||
<pointer type-name='stl-string'/>
|
||||
</stl-vector>
|
||||
|
||||
<pointer name='bp_relation_part_id'>
|
||||
<stl-vector type-name='int16_t'/>
|
||||
</pointer>
|
||||
<pointer name='bp_relation_code'>
|
||||
<stl-vector type-name='int16_t'/> // 0 around of, 1 around by
|
||||
</pointer>
|
||||
<pointer name='bp_relation_coverage'>
|
||||
<stl-vector type-name='int16_t'/>
|
||||
</pointer>
|
||||
|
||||
<uint16_t name='min_temp'/>
|
||||
<uint16_t name='max_temp'/>
|
||||
<uint16_t name='temp_factor'/>
|
||||
|
||||
<int32_t name='unused'/>
|
||||
|
||||
<int32_t name='unk11'/>
|
||||
<int16_t name='unk12'/>
|
||||
</struct-type>
|
||||
|
||||
<struct-type type-name='caste_raw' key-field='caste_id'>
|
||||
<stl-string name='caste_id'/>
|
||||
|
||||
<code-helper name='find-instance'>$global.world.raws.creatures.all[$$].caste[$]</code-helper>
|
||||
|
||||
<static-array type-name='stl-string' name='caste_name' count='3'/>
|
||||
|
||||
<stl-string name='vermin_bite_txt'/>
|
||||
<stl-string name='gnawer_txt'/>
|
||||
|
||||
<static-array type-name='stl-string' name='baby_name' count='2'/>
|
||||
<static-array type-name='stl-string' name='child_name' count='2'/>
|
||||
<static-array type-name='stl-string' name='itemcorpse_str' count='5'/> // temporary
|
||||
<static-array type-name='stl-string' name='remains' count='2'/>
|
||||
<stl-string name='description'/>
|
||||
<static-array type-name='stl-string' name='mannerisms' count='17'>
|
||||
<comment>fingers[2], nose, ear, head, eyes, mouth, hair, knuckles, lips, cheek, nails, f eet, arms, hands, tongue, leg</comment>
|
||||
</static-array>
|
||||
|
||||
<uint8_t name='caste_tile'/>
|
||||
<uint8_t name='caste_soldier_tile'/>
|
||||
<uint8_t name='caste_alttile'/>
|
||||
<uint8_t name='caste_soldier_alttile'/>
|
||||
<uint8_t name='caste_glowtile'/>
|
||||
|
||||
<uint16_t name='homeotherm'/>
|
||||
<int16_t name='unk1_1'/>
|
||||
<int16_t name='unk1_2'/>
|
||||
<uint16_t name='fixed_temp'/>
|
||||
|
||||
<static-array type-name='int16_t' name='caste_color' count='3'/>
|
||||
|
||||
<compound name='misc'>
|
||||
<int16_t name='litter_size_min'/>
|
||||
<int16_t name='litter_size_max'/>
|
||||
<int16_t name='penetratepower'/>
|
||||
<int16_t name='vermin_bite_chance'/>
|
||||
<int16_t name='grasstrample'/>
|
||||
<int16_t name='buildingdestroyer'/>
|
||||
<enum base-type='int16_t' name='itemcorpse_itemtype' type-name='item_type'/>
|
||||
<int16_t name='itemcorpse_itemsubtype'/>
|
||||
<int16_t name='itemcorpse_materialtype'
|
||||
ref-target='material' aux-value='$$.itemcorpse_materialindex'/>
|
||||
<int16_t name='itemcorpse_materialindex'/> // NOT 32-bit!
|
||||
<int16_t name='itemcorpse_quality'/>
|
||||
<static-array type-name='int16_t' name='remains_color' count='3'/>
|
||||
<int16_t name='difficulty'/>
|
||||
<static-array type-name='int16_t' name='caste_glowcolor' count='3'/>
|
||||
<int16_t name='beach_frequency'/>
|
||||
<int16_t name='clutch_size_min'/>
|
||||
<int16_t name='clutch_size_max'/>
|
||||
<int32_t name='speed'/>
|
||||
<int32_t name='modvalue'/>
|
||||
<int32_t name='petvalue'/>
|
||||
<int32_t name='milkable'/>
|
||||
<int32_t name='viewrange'/>
|
||||
<int32_t name='maxage_min'/>
|
||||
<int32_t name='maxage_max'/>
|
||||
<static-array type-name='int32_t' name='unk3' count='2'/>
|
||||
<int32_t name='swim_speed'/>
|
||||
<int32_t name='trade_capacity'/>
|
||||
<int32_t name='unk4'/>
|
||||
<int32_t name='pop_ratio'/>
|
||||
<int32_t name='adult_size'/>
|
||||
<static-array type-name='int32_t' name='unk5' count='4'/>
|
||||
<static-array type-name='int32_t' name='attack_trigger' count='3'/>
|
||||
<int32_t name='egg_size'/>
|
||||
<int32_t name='grazer'/>
|
||||
<int32_t name='petvalue_divisor'/>
|
||||
<int32_t name='prone_to_rage'/>
|
||||
<static-array type-name='int32_t' name='unk6' count='29'/>
|
||||
</compound>
|
||||
|
||||
<static-array name='personality' count='30'>
|
||||
<int16_t name='a'/>
|
||||
<int16_t name='b'/>
|
||||
<int16_t name='c'/>
|
||||
</static-array>
|
||||
|
||||
<df-flagarray name='flags'/>
|
||||
|
||||
<int32_t name='unk7'/>
|
||||
|
||||
<stl-vector name='body_parts'>
|
||||
<pointer type-name='body_part_raw'/>
|
||||
</stl-vector>
|
||||
|
||||
<stl-vector name='attacks'>
|
||||
<pointer/>
|
||||
</stl-vector>
|
||||
|
||||
<compound name='unknown1'>
|
||||
<int32_t name='unk8'/>
|
||||
<stl-vector type-name='int16_t' name='unk9a'/>
|
||||
<stl-vector type-name='int16_t' name='unk9b'/>
|
||||
<stl-vector name='unk10'/>
|
||||
<stl-vector name='unk11'/>
|
||||
<stl-vector name='unk12'/>
|
||||
<stl-vector type-name='int16_t' name='unk13'/>
|
||||
<stl-vector type-name='int32_t' name='unk14'/>
|
||||
</compound>
|
||||
|
||||
<static-array type-name='int32_t' name='unk15' count='4'/>
|
||||
|
||||
<stl-vector name='caste_speech_1'/>
|
||||
<stl-vector name='caste_speech_2'/>
|
||||
|
||||
<static-array name='skill_rates' count='116'>
|
||||
<static-array type-name='int32_t' count='4'/>
|
||||
</static-array>
|
||||
|
||||
<compound name='attributes'>
|
||||
<static-array name='phys_att_range' count='7'>
|
||||
<static-array type-name='int32_t' count='6'/>
|
||||
</static-array>
|
||||
<static-array name='ment_att_range' count='7'>
|
||||
<static-array type-name='int32_t' count='13'/>
|
||||
</static-array>
|
||||
<static-array name='phys_att_rates' count='4'>
|
||||
<static-array type-name='int32_t' count='6'/>
|
||||
</static-array>
|
||||
<static-array name='ment_att_rates' count='4'>
|
||||
<static-array type-name='int32_t' count='13'/>
|
||||
</static-array>
|
||||
<static-array type-name='int32_t' name='phys_att_cap_perc' count='6'/>
|
||||
<static-array type-name='int32_t' name='ment_att_cap_perc' count='13'/>
|
||||
</compound>
|
||||
|
||||
<int8_t name='gender'/>
|
||||
|
||||
<stl-vector type-name='int32_t' name='body_size_1'/>
|
||||
<stl-vector type-name='int32_t' name='body_size_2'/>
|
||||
|
||||
<static-array name='unk16' count='19'>
|
||||
<stl-vector/>
|
||||
</static-array>
|
||||
|
||||
<static-array type-name='int32_t' name='unk17' count='2'/>
|
||||
|
||||
<stl-vector type-name='int16_t' name='natural_skill_id'/>
|
||||
<stl-vector type-name='int32_t' name='natural_skill_exp'/>
|
||||
<stl-vector type-name='int32_t' name='natural_skill_lvl'/>
|
||||
|
||||
<static-array name='caste_profession_name' count='106'>
|
||||
<stl-string name='singular'/>
|
||||
<stl-string name='plural'/>
|
||||
</static-array>
|
||||
|
||||
<compound name='extracts'>
|
||||
<stl-vector type-name='int16_t' name='extract_mat'/>
|
||||
<stl-vector type-name='int32_t' name='extract_matidx'/>
|
||||
<static-array name='extract_str' count='3'>
|
||||
<stl-vector>
|
||||
<pointer type-name='stl-string'/>
|
||||
</stl-vector>
|
||||
</static-array>
|
||||
|
||||
<int16_t name='milkable_mat'/>
|
||||
<int32_t name='milkable_matidx'/>
|
||||
<static-array name='milkable_str' count='3'>
|
||||
<stl-string/>
|
||||
</static-array>
|
||||
|
||||
<int16_t name='webber_mat'/>
|
||||
<int32_t name='webber_matidx'/>
|
||||
<static-array name='webber_str' count='3'>
|
||||
<stl-string/>
|
||||
</static-array>
|
||||
|
||||
<int16_t name='vermin_bite_mat'/>
|
||||
<int32_t name='vermin_bite_matidx'/>
|
||||
<int16_t name='vermin_bite_chance'/>
|
||||
<static-array name='vermin_bite_str' count='3'>
|
||||
<stl-string/>
|
||||
</static-array>
|
||||
|
||||
<int16_t name='tendons_mat'/>
|
||||
<int32_t name='tendons_matidx'/>
|
||||
<static-array name='tendons_str' count='3'>
|
||||
<stl-string/>
|
||||
</static-array>
|
||||
<int32_t name='tendons_heal'/>
|
||||
|
||||
<int16_t name='ligaments_mat'/>
|
||||
<int32_t name='ligaments_matidx'/>
|
||||
<static-array name='ligaments_str' count='3'>
|
||||
<stl-string/>
|
||||
</static-array>
|
||||
<int32_t name='ligaments_heal'/>
|
||||
|
||||
<int16_t name='blood_state'/>
|
||||
<int16_t name='blood_mat'/>
|
||||
<int32_t name='blood_matidx'/>
|
||||
<static-array name='blood_str' count='3'>
|
||||
<stl-string/>
|
||||
</static-array>
|
||||
|
||||
<int16_t name='pus_state'/>
|
||||
<int16_t name='pus_mat'/>
|
||||
<int32_t name='pus_matidx'/>
|
||||
<static-array name='pus_str' count='3'>
|
||||
<stl-string/>
|
||||
</static-array>
|
||||
|
||||
<stl-vector type-name='int16_t' name='material_breath_attack_mattype'/>
|
||||
<stl-vector type-name='int32_t' name='material_breath_attack_matindex'/>
|
||||
<static-array name='material_breath_attack_str' count='3'>
|
||||
<stl-vector>
|
||||
<pointer type-name='stl-string'/>
|
||||
</stl-vector>
|
||||
</static-array>
|
||||
<stl-vector type-name='int16_t' name='material_breath_attack_type'/>
|
||||
|
||||
<stl-vector type-name='int16_t' name='egg_material_mattype'/>
|
||||
<stl-vector type-name='int32_t' name='egg_material_matindex'/>
|
||||
<static-array name='egg_material_str' count='3'>
|
||||
<stl-vector>
|
||||
<pointer type-name='stl-string'/>
|
||||
</stl-vector>
|
||||
</static-array>
|
||||
|
||||
<stl-vector name='lays_unusual_eggs_itemtype'>
|
||||
<enum base-type='int16_t' type-name='item_type'/>
|
||||
</stl-vector>
|
||||
<stl-vector name='lays_unusual_eggs_itemsubtype'/>
|
||||
<stl-vector type-name='int16_t' name='lays_unusual_eggs_mattype'/>
|
||||
<stl-vector type-name='int32_t' name='lays_unusual_eggs_matindex'/>
|
||||
<static-array name='lays_unusual_eggs_str' count='5'>
|
||||
<stl-vector>
|
||||
<pointer type-name='stl-string'/>
|
||||
</stl-vector>
|
||||
</static-array>
|
||||
</compound>
|
||||
|
||||
<stl-vector name='unk22'/>
|
||||
|
||||
<stl-vector name='creature_class'>
|
||||
<pointer type-name='stl-string'/>
|
||||
</stl-vector>
|
||||
|
||||
<compound name='unknown2'>
|
||||
<stl-vector name='unk23a'/>
|
||||
<stl-vector name='unk23b'/>
|
||||
<stl-vector name='unk23c'/>
|
||||
|
||||
<df-flagarray name='unk24_flags'/>
|
||||
<df-flagarray name='unk25_flags'/>
|
||||
|
||||
<static-array type-name='int32_t' name='unk26' count='33'/>
|
||||
<static-array name='unk27' count='5'><stl-vector/></static-array>
|
||||
<static-array type-name='int32_t' name='unk28' count='2'/>
|
||||
</compound>
|
||||
|
||||
<static-array type-name='int32_t' name='habit_num' count='2'/>
|
||||
<static-array name='habit' count='2'><stl-vector/></static-array>
|
||||
<static-array name='lair' count='2'><stl-vector/></static-array>
|
||||
<static-array name='lair_characteristic' count='2'><stl-vector/></static-array>
|
||||
<static-array name='lair_hunter_speech' count='2'><stl-vector/></static-array>
|
||||
<static-array name='unk29' count='2'><stl-vector/></static-array>
|
||||
<static-array name='specific_food' count='2'><stl-vector/></static-array>
|
||||
<static-array name='unk30' count='3'><stl-vector/></static-array>
|
||||
</struct-type>
|
||||
|
||||
<struct-type type-name='creature_raw' key-field='creature_id'>
|
||||
<stl-string name='creature_id'/>
|
||||
|
||||
<code-helper name='find-instance'>$global.world.raws.creatures.all[$]</code-helper>
|
||||
|
||||
<static-array type-name='stl-string' name='name' count='3'/>
|
||||
<static-array type-name='stl-string' name='general_baby_name' count='2'/>
|
||||
<static-array type-name='stl-string' name='general_child_name' count='2'/>
|
||||
|
||||
<uint8_t name='creature_tile'/>
|
||||
<uint8_t name='creature_soldier_tile'/>
|
||||
<uint8_t name='alttile'/>
|
||||
<uint8_t name='soldier_alttile'/>
|
||||
<uint8_t name='glowtile'/>
|
||||
|
||||
<int16_t name='unk1'/>
|
||||
<int16_t name='unk2'/>
|
||||
<int16_t name='frequency'/>
|
||||
<static-array type-name='int16_t' name='population_number' count='2'/>
|
||||
<static-array type-name='int16_t' name='cluster_number' count='2'/>
|
||||
<static-array type-name='int16_t' name='triggerable_group' count='2'/>
|
||||
<static-array type-name='int16_t' name='color' count='3'/>
|
||||
<static-array type-name='int16_t' name='glowcolor' count='3'/>
|
||||
|
||||
<int32_t name='adultsize'/>
|
||||
|
||||
<stl-vector name='prefstring'>
|
||||
<pointer type-name='stl-string'/>
|
||||
</stl-vector>
|
||||
|
||||
<stl-vector type-name='int16_t' name='sphere'/>
|
||||
<stl-vector name='caste'>
|
||||
<pointer type-name='caste_raw'/>
|
||||
</stl-vector>
|
||||
|
||||
<stl-vector type-name='int32_t' name='pop_ratio'/>
|
||||
|
||||
<df-flagarray name='flags' index-enum='creature_raw_flags'/>
|
||||
|
||||
<compound name='stuff'>
|
||||
<static-array name='stuff1' count='2'>
|
||||
<static-array type-name='int32_t' count='7'/>
|
||||
</static-array>
|
||||
|
||||
<static-array name='stuff2a' count='7'>
|
||||
<static-array type-name='int32_t' count='12'/>
|
||||
</static-array>
|
||||
|
||||
<static-array name='stuff2b' count='7'>
|
||||
<static-array type-name='int32_t' count='12'/>
|
||||
</static-array>
|
||||
|
||||
<static-array type-name='int32_t' name='unk3' count='84'/>
|
||||
|
||||
<static-array name='stuff3a' count='7'>
|
||||
<static-array type-name='int32_t' count='106'/>
|
||||
</static-array>
|
||||
|
||||
<static-array name='stuff3b' count='7'>
|
||||
<static-array type-name='int32_t' count='106'/>
|
||||
</static-array>
|
||||
|
||||
<static-array type-name='int8_t' name='stuff4' count='7'/>
|
||||
|
||||
<static-array name='stuff2c' count='7'>
|
||||
<static-array type-name='int8_t' count='12'/>
|
||||
</static-array>
|
||||
|
||||
<static-array type-name='int8_t' name='unk4' count='42'/>
|
||||
|
||||
<static-array name='stuff3c' count='7'>
|
||||
<static-array type-name='int8_t' count='106'/>
|
||||
</static-array>
|
||||
</compound>
|
||||
|
||||
<stl-vector name='unk5'/>
|
||||
<stl-vector name='speech1'/>
|
||||
<stl-vector name='speech2'/>
|
||||
<stl-vector name='speech3'/>
|
||||
|
||||
<stl-vector name='material'>
|
||||
<pointer type-name='material'/>
|
||||
</stl-vector>
|
||||
<stl-vector type-name='pointer' name='tissue'/>
|
||||
|
||||
<static-array name='profession_name' count='106'>
|
||||
<stl-string name='singular'/>
|
||||
<stl-string name='plural'/>
|
||||
</static-array>
|
||||
|
||||
<pointer name='unk6pa'/>
|
||||
<pointer name='unk6pb'/>
|
||||
|
||||
<stl-vector type-name='int32_t' name='unk6'/>
|
||||
<stl-vector type-name='int32_t' name='unk7'/>
|
||||
|
||||
<stl-vector type-name='int32_t' name='hive_product_0'/>
|
||||
<stl-vector type-name='int32_t' name='hive_product_1'/>
|
||||
<stl-vector type-name='int16_t' name='hive_product_2'/>
|
||||
<stl-vector type-name='int16_t' name='hive_product_3'/>
|
||||
<stl-vector type-name='int16_t' name='hive_product_4'/>
|
||||
<stl-vector type-name='int32_t' name='hive_product_5'/>
|
||||
|
||||
<static-array name='hive_product_tmpstr' count='5'>
|
||||
<stl-vector>
|
||||
<pointer type-name='stl-string'/>
|
||||
</stl-vector>
|
||||
</static-array>
|
||||
|
||||
<int32_t name='unk8'/>
|
||||
|
||||
<stl-vector name='raws'>
|
||||
<pointer type-name='stl-string'/>
|
||||
</stl-vector>
|
||||
</struct-type>
|
||||
</data-definition>
|
||||
|
||||
<!--
|
||||
Local Variables:
|
||||
indent-tabs-mode: nil
|
||||
nxml-child-indent: 4
|
||||
End:
|
||||
-->
|
@ -1,129 +0,0 @@
|
||||
<data-definition>
|
||||
<enum-type type-name='d_init_nickname'>
|
||||
<enum-item name='REPLACE_FIRST'/>
|
||||
<enum-item name='CENTRALIZE'/>
|
||||
<enum-item name='REPLACE_ALL'/>
|
||||
</enum-type>
|
||||
|
||||
<enum-type type-name='d_init_z_view'>
|
||||
<enum-item name='OFF'/>
|
||||
<enum-item name='UNHIDDEN'/>
|
||||
<enum-item name='CREATURE'/>
|
||||
<enum-item name='ON'/>
|
||||
</enum-type>
|
||||
|
||||
<enum-type type-name='d_init_idlers'>
|
||||
<enum-item name='OFF' value='-1'/>
|
||||
<enum-item name='TOP'/>
|
||||
<enum-item name='BOTTOM'/>
|
||||
</enum-type>
|
||||
|
||||
<enum-type type-name='d_init_tunnel'>
|
||||
<enum-item name='NO'/>
|
||||
<enum-item name='FINDER'/>
|
||||
<enum-item name='ALWAYS'/>
|
||||
</enum-type>
|
||||
|
||||
<enum-type type-name='d_init_flags1'>
|
||||
<enum-item name='VARIED_GROUND_TILES'/>
|
||||
<enum-item name='ENGRAVINGS_START_OBSCURED'/>
|
||||
<enum-item name='SHOW_IMP_QUALITY'/>
|
||||
<enum-item name='SHOW_FLOW_AMOUNTS'/>
|
||||
</enum-type>
|
||||
|
||||
<enum-type type-name='d_init_flags2'>
|
||||
<enum-item name='MORE'/>
|
||||
<enum-item name='ADVENTURER_TRAPS'/>
|
||||
<enum-item name='ADVENTURER_ALWAYS_CENTER'/>
|
||||
</enum-type>
|
||||
|
||||
<enum-type type-name='d_init_flags3'>
|
||||
<enum-item name='COFFIN_NO_PETS_DEFAULT'/>
|
||||
</enum-type>
|
||||
|
||||
<enum-type type-name='d_init_flags4'>
|
||||
<enum-item name='TEMPERATURE'/>
|
||||
<enum-item name='WEATHER'/>
|
||||
<enum-item name='ECONOMY'/>
|
||||
<enum-item name='ZERO_RENT'/>
|
||||
<enum-item name='AUTOSAVE_SEASONAL'/>
|
||||
<enum-item name='AUTOSAVE_YEARLY'/>
|
||||
<enum-item name='AUTOSAVE_PAUSE'/>
|
||||
<enum-item name='AUTOBACKUP'/>
|
||||
<enum-item name='INITIAL_SAVE'/>
|
||||
<enum-item name='INVADERS'/>
|
||||
<enum-item name='CAVEINS'/>
|
||||
<enum-item name='ARTIFACTS'/>
|
||||
<enum-item name='LOG_MAP_REJECTS'/>
|
||||
<enum-item name='PAUSE_ON_LOAD'/>
|
||||
<enum-item name='EMBARK_WARNING_ALWAYS'/>
|
||||
<enum-item name='SHOW_ALL_HISTORY_IN_DWARF_MODE'/>
|
||||
<enum-item name='TESTING_ARENA'/>
|
||||
<enum-item name='WALKING_SPREADS_SPATTER_DWF'/>
|
||||
<enum-item name='WALKING_SPREADS_SPATTER_ADV'/>
|
||||
</enum-type>
|
||||
|
||||
<struct-type type-name='d_init'>
|
||||
<df-flagarray name='flags1' index-enum='d_init_flags1'/>
|
||||
|
||||
<enum name="nickname_dwarf" type-name='d_init_nickname'/>
|
||||
<enum name="nickname_adventure" type-name='d_init_nickname'/>
|
||||
<enum name="nickname_legends" type-name='d_init_nickname'/>
|
||||
<enum name="nickname_dwarf2" type-name='d_init_nickname'/>
|
||||
|
||||
<int32_t name="unk_18"/>
|
||||
<int32_t name="unk_1c"/>
|
||||
|
||||
<uint8_t name='sky_tile'/>
|
||||
<static-array name='sky_color' type-name='int16_t' count='3'/>
|
||||
<uint8_t name='chasm_tile'/>
|
||||
<uint8_t name='pillar_tile'/>
|
||||
<static-array name='chasm_color' type-name='int16_t' count='3'/>
|
||||
|
||||
<compound name='wound_color'>
|
||||
<static-array name='none' type-name='int16_t' count='3'/>
|
||||
<static-array name='minor' type-name='int16_t' count='3'/>
|
||||
<static-array name='inhibited' type-name='int16_t' count='3'/>
|
||||
<static-array name='function_loss' type-name='int16_t' count='3'/>
|
||||
<static-array name='broken' type-name='int16_t' count='3'/>
|
||||
<static-array name='missing' type-name='int16_t' count='3'/>
|
||||
</compound>
|
||||
|
||||
<enum name="idlers" base-type='int16_t' type-name='d_init_idlers'/>
|
||||
<enum name="show_embark_tunnel" base-type='int16_t' type-name='d_init_tunnel'/>
|
||||
|
||||
<df-flagarray name='flags2' index-enum='d_init_flags2'/>
|
||||
|
||||
<int32_t name="display_length"/>
|
||||
|
||||
<enum name="adventurer_z_view" type-name='d_init_z_view'/>
|
||||
<int32_t name="adventurer_z_view_size"/>
|
||||
|
||||
<df-flagarray name='flags3' index-enum='d_init_flags3'/>
|
||||
|
||||
<int32_t name="population_cap"/>
|
||||
<int32_t name="baby_cap_absolute"/>
|
||||
<int32_t name="baby_cap_percent"/>
|
||||
|
||||
<static-array name='path_cost' type-name='int32_t' count='4'/>
|
||||
<static-array name='embark_rect' type-name='int16_t' count='2'/>
|
||||
|
||||
<compound name='store_dist'>
|
||||
<int16_t name='item_decrease'/>
|
||||
<int16_t name='seed_combine'/>
|
||||
<int16_t name='bucket_combine'/>
|
||||
<int16_t name='barrel_combine'/>
|
||||
<int16_t name='bin_combine'/>
|
||||
</compound>
|
||||
|
||||
<df-flagarray name='flags4' index-enum='d_init_flags4'/>
|
||||
85266c0
|
||||
</struct-type>
|
||||
</data-definition>
|
||||
|
||||
<!--
|
||||
Local Variables:
|
||||
indent-tabs-mode: nil
|
||||
nxml-child-indent: 4
|
||||
End:
|
||||
-->
|
@ -1,126 +0,0 @@
|
||||
<data-definition>
|
||||
<struct-type type-name='historical_figure' instance-vector='$global.world.history.figures' key-field='id'>
|
||||
<enum base-type='int16_t' name='profession' type-name='profession'/>
|
||||
|
||||
<int16_t name='race' ref-target='creature_raw'/>
|
||||
<int16_t name='caste' ref-target='caste_raw' aux-value='$$.race'/>
|
||||
|
||||
<int8_t name='sex'/>
|
||||
|
||||
<int32_t name='appeared_year'/>
|
||||
<int32_t name='born_year'/>
|
||||
<int32_t name='born_seconds'/>
|
||||
<int32_t name='old_year'/>
|
||||
<int32_t name='old_seconds'/>
|
||||
<int32_t name='died_year'/>
|
||||
<int32_t name='died_seconds'/>
|
||||
|
||||
<compound type-name='language_name' name='name'/>
|
||||
|
||||
<code-helper name='describe'>
|
||||
(describe-obj $.name)
|
||||
(awhen (find-creature $.race)
|
||||
(fmt "~:(~A ~A~)" $it.caste[$.caste].caste_id $it.creature_id))
|
||||
</code-helper>
|
||||
|
||||
<int32_t name='civ_id' ref-target='historical_entity'/>
|
||||
<int32_t name='population_id' ref-target='entity_population'/>
|
||||
|
||||
<df-flagarray name='flags'/>
|
||||
|
||||
<int32_t name='unit_id' ref-target='unit'/>
|
||||
<int32_t name='id'/>
|
||||
|
||||
<int32_t name='unk4'/>
|
||||
|
||||
<stl-vector name='entity_links'/>
|
||||
<stl-vector name='site_links'/>
|
||||
<stl-vector name='histfig_links'/>
|
||||
|
||||
<pointer name='unk6'/>
|
||||
|
||||
<static-array name='unk7' count='5' type-name='int32_t' comment='empty'/>
|
||||
</struct-type>
|
||||
|
||||
<class-type type-name='history_event' original-name='history_eventst'
|
||||
instance-vector='$global.world.history.events' key-field='id'>
|
||||
<int32_t name='year'/>
|
||||
<int32_t name='seconds'/>
|
||||
<df-flagarray name='flags'/>
|
||||
<int32_t name='id'/>
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='history_event_masterpiece_createdst' inherits-from='history_event'>
|
||||
<int32_t name='maker' ref-target='historical_figure'/>
|
||||
<int32_t name='maker_entity' ref-target='historical_entity'/>
|
||||
<int32_t name='site' ref-target='world_site'/>
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='history_event_masterpiece_created_itemst'
|
||||
inherits-from='history_event_masterpiece_createdst'>
|
||||
<enum base-type='int32_t' name='skill_used' type-name='job_skill'/>
|
||||
<enum base-type='int16_t' name='item_type' type-name='item_type'/>
|
||||
<int16_t name='item_subtype' refers-to='(item-subtype-target $$._parent.item_type $)'/>
|
||||
<int16_t name='mat_type' ref-target='material' aux-value='$$.mat_index'/>
|
||||
<int16_t name='mat_index'/>
|
||||
<int32_t name='item_id' ref-target='item'/>
|
||||
</class-type>
|
||||
|
||||
<class-type type-name='history_event_masterpiece_created_foodst'
|
||||
inherits-from='history_event_masterpiece_createdst'>
|
||||
<int32_t name='unk1'/>
|
||||
<int16_t name='item_subtype' refers-to='$global.world.raws.itemdefs.food[$]'/>
|
||||
<int32_t name='item_id' ref-target='item'/>
|
||||
</class-type>
|
||||
|
||||
<struct-type type-name='world_history'>
|
||||
dtor 8532fa0
|
||||
|
||||
<stl-vector name='events'>
|
||||
<pointer type-name='history_event'/>
|
||||
</stl-vector>
|
||||
<stl-vector name='events2'>
|
||||
<pointer type-name='history_event'/>
|
||||
</stl-vector>
|
||||
|
||||
<stl-vector name='figures'>
|
||||
<pointer type-name='historical_figure'/>
|
||||
</stl-vector>
|
||||
|
||||
<static-array name='other_events' count='9'>
|
||||
<stl-vector>
|
||||
<pointer type-name='history_event'/>
|
||||
</stl-vector>
|
||||
</static-array>
|
||||
|
||||
<stl-vector name='ages'>
|
||||
<pointer/>
|
||||
</stl-vector>
|
||||
|
||||
<stl-vector name='unk1' type-name='int32_t'/>
|
||||
<stl-vector name='unk2' type-name='int16_t'/>
|
||||
|
||||
<int32_t/>
|
||||
<int32_t/>
|
||||
<int32_t/>
|
||||
<int32_t/>
|
||||
<stl-vector/>
|
||||
<stl-vector/>
|
||||
<stl-vector/>
|
||||
<stl-vector/>
|
||||
<stl-vector/>
|
||||
<stl-vector/>
|
||||
<bool/>
|
||||
<stl-vector/>
|
||||
<int32_t/>
|
||||
<int32_t/>
|
||||
<int32_t/>
|
||||
</struct-type>
|
||||
</data-definition>
|
||||
|
||||
<!--
|
||||
Local Variables:
|
||||
indent-tabs-mode: nil
|
||||
nxml-child-indent: 4
|
||||
End:
|
||||
-->
|
@ -1,138 +0,0 @@
|
||||
<data-definition>
|
||||
-- init.h
|
||||
|
||||
<enum-type type-name='init_display_flags'>
|
||||
<enum-item name='USE_GRAPHICS'/>
|
||||
<enum-item name='BLACK_SPACE'/>
|
||||
<enum-item name='PARTIAL_PRINT'/>
|
||||
<enum-item name='FRAME_BUFFER'/>
|
||||
<enum-item name='SINGLE_BUFFER'/>
|
||||
<enum-item name='ACCUM_BUFFER'/>
|
||||
<enum-item name='VBO'/>
|
||||
<enum-item name='RENDER_2D'/>
|
||||
<enum-item name='RENDER_2DHW'/>
|
||||
<enum-item name='RENDER_2DASYNC'/>
|
||||
<enum-item name='UNUSED_01_08'/>
|
||||
<enum-item name='TEXT'/>
|
||||
<enum-item name='SHADER'/>
|
||||
<enum-item name='NOT_RESIZABLE'/>
|
||||
<enum-item name='ARB_SYNC'/>
|
||||
</enum-type>
|
||||
|
||||
<struct-type type-name='init_display'>
|
||||
<df-flagarray name='flag' index-enum='init_display_flags'/>
|
||||
|
||||
<enum name='windowed'>
|
||||
<enum-item name='True'/>
|
||||
<enum-item name='False'/>
|
||||
<enum-item name='Prompt'/>
|
||||
</enum>
|
||||
|
||||
<int32_t name='grid_x'/>
|
||||
<int32_t name='grid_y'/>
|
||||
|
||||
<int32_t name='desired_fullscreen_width'/>
|
||||
<int32_t name='desired_fullscreen_height'/>
|
||||
<int32_t name='desired_windowed_width'/>
|
||||
<int32_t name='desired_windowed_height'/>
|
||||
|
||||
<int8_t name='partial_print_count'/>
|
||||
</struct-type>
|
||||
|
||||
<enum-type type-name='init_media_flags'>
|
||||
<enum-item name='SOUND_OFF'/>
|
||||
<enum-item name='INTRO_OFF'/>
|
||||
<enum-item name='COMPRESS_SAVES'/>
|
||||
</enum-type>
|
||||
|
||||
<struct-type type-name='init_media'>
|
||||
<df-flagarray name='flag' index-enum='init_media_flags'/>
|
||||
<int32_t name='volume'/>
|
||||
</struct-type>
|
||||
|
||||
<enum-type type-name='init_input_flags'>
|
||||
<enum-item name='MOUSE_OFF'/>
|
||||
<enum-item name='MOUSE_PICTURE'/>
|
||||
</enum-type>
|
||||
|
||||
<struct-type type-name='init_input'>
|
||||
<int32_t name='hold_time'/>
|
||||
<int32_t name='repeat_time'/>
|
||||
<int32_t name='macro_time'/>
|
||||
<int32_t name='pause_zoom_no_interface_ms'/>
|
||||
<df-flagarray name='flag' index-enum='init_input_flags'/>
|
||||
<int32_t name='zoom_speed'/>
|
||||
<int32_t name='repeat_accel_start'/>
|
||||
<int32_t name='repeat_accel_limit'/>
|
||||
</struct-type>
|
||||
|
||||
<struct-type type-name='init_font'>
|
||||
<static-array name='small_font_texpos' type-name='int32_t' count='256'/>
|
||||
<static-array name='large_font_texpos' type-name='int32_t' count='256'/>
|
||||
<static-array name='small_font_datapos' type-name='int32_t' count='256'/>
|
||||
<static-array name='large_font_datapos' type-name='int32_t' count='256'/>
|
||||
<s-float name='small_font_adjx'/>
|
||||
<s-float name='small_font_adjy'/>
|
||||
<s-float name='large_font_adjx'/>
|
||||
<s-float name='large_font_adjy'/>
|
||||
<int32_t name='small_font_dispx'/>
|
||||
<int32_t name='small_font_dispy'/>
|
||||
<int32_t name='large_font_dispx'/>
|
||||
<int32_t name='large_font_dispy'/>
|
||||
<bool name='use_ttf'/>
|
||||
</struct-type>
|
||||
|
||||
<enum-type type-name='init_window_flags'>
|
||||
<enum-item name='TOPMOST'/>
|
||||
<enum-item name='VSYNC_ON'/>
|
||||
<enum-item name='VSYNC_OFF'/>
|
||||
<enum-item name='TEXTURE_LINEAR'/>
|
||||
</enum-type>
|
||||
|
||||
<struct-type type-name='init_window'>
|
||||
<df-flagarray name='flag' index-enum='init_window_flags'/>
|
||||
</struct-type>
|
||||
|
||||
<struct-type type-name='init'>
|
||||
<compound name='display' type-name='init_display'/>
|
||||
<compound name='media' type-name='init_media'/>
|
||||
<compound name='input' type-name='init_input'/>
|
||||
<compound name='font' type-name='init_font'/>
|
||||
<compound name='window' type-name='init_window'/>
|
||||
</struct-type>
|
||||
|
||||
-- texture_handler.h
|
||||
|
||||
<struct-type type-name='tile_page'>
|
||||
<stl-string name='token'/>
|
||||
<stl-string name='filename'/>
|
||||
|
||||
<int16_t name='tile_dim_x'/>
|
||||
<int16_t name='tile_dim_y'/>
|
||||
<int16_t name='page_dim_x'/>
|
||||
<int16_t name='page_dim_y'/>
|
||||
|
||||
<stl-vector name='texpos' type-name='int32_t'/>
|
||||
<stl-vector name='datapos' type-name='int32_t'/>
|
||||
<stl-vector name='texpos_gs' type-name='int32_t'/>
|
||||
<stl-vector name='datapos_gs' type-name='int32_t'/>
|
||||
|
||||
<bool name='loaded'/>
|
||||
</struct-type>
|
||||
|
||||
<struct-type type-name='texture_handler'>
|
||||
<stl-vector name='page'>
|
||||
<pointer type-name='tile_page'/>
|
||||
</stl-vector>
|
||||
|
||||
<stl-vector name='texpos' type-name='int32_t'/>
|
||||
<stl-vector name='datapos' type-name='int32_t'/>
|
||||
</struct-type>
|
||||
</data-definition>
|
||||
|
||||
<!--
|
||||
Local Variables:
|
||||
indent-tabs-mode: nil
|
||||
nxml-child-indent: 4
|
||||
End:
|
||||
-->
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue