/home/leaf/crossfire/server/branches/1.12/utils/gridarta-types-convert.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "define.h"

Include dependency graph for gridarta-types-convert.c:

Go to the source code of this file.

Data Structures

struct  type_attribute
struct  type_definition
struct  ignore_list
struct  attribute_type
struct  attribute_definition
struct  flag_definition
struct  type_name

Functions

const flag_definitionfind_flag (const char *name)
type_attributeduplicate_attribute (type_attribute *attr)
void free_attribute (type_attribute *attr)
type_attributeget_attribute_for_type (type_definition *type, const char *attribute, int clean)
void copy_attributes (const type_definition *source, type_definition *type)
void copy_default_attributes (type_definition *type)
type_definitionget_type_definition (void)
type_definitionfind_type_definition (const char *name)
int sort_type_attribute (const void *a, const void *b)
ignore_listfind_ignore_list (const char *name)
char * read_line (char *buffer, int size, FILE *file)
void ignore_attribute (type_definition *type, const char *attribute)
void ignore_attributes (type_definition *type, ignore_list *list)
void add_required_parameter (type_definition *type, const char *buf)
void read_type (type_definition *type, FILE *file, const char *block_end)
void dump_type (type_definition *type)
void dump_types (void)
attribute_definitionget_attribute (const char *name)
attribute_typeget_description_for_attribute (attribute_definition *attribute, const char *description)
void add_type_to_attribute (attribute_definition *attribute, type_definition *type, int attr)
void read_ignore_list (const char *name, FILE *file)
void dump_ignore_lists (void)
int is_custom_attribute (const char *attribute)
void write_attribute_reference (const char *attribute, FILE *file)
void write_type_file (type_definition *type)
void write_type_index (void)
void write_attribute_file (attribute_definition *attribute)
int main (int argc, char **argv)

Variables

const char * destination_dir = "../doc/Developers"
const char * field_dir = "fields"
const char * type_dir = "types"
type_definition ** types = NULL
int type_count = 0
type_definitiondefault_type = NULL
type_definitionfallback_type = NULL
ignore_list ** lists = NULL
int list_count = 0
attribute_definition ** attributes = NULL
int attribute_count = 0


Detailed Description

This small program will extract information from Gridarta's types.xml file to generate documentation about types and fields. Files are placed in developer's documentation subdirs by default.

To build:

gcc -g -pg -O0 -Wall -pedantic gridarta-types-convert.c -I../include -o gridarta-types-convert
To run:
./gridarta-types-convert ../../gridarta/crossfire/resource/conf/types.xml
(adjust the path according to your setup)

Note that someone wishing to tweak this program should know the format of Gridarta's types.xml.

This program isn't terribly robust, there could be more conditions, and it just doesn't free memory. May be fixed someday, but since it's a "run and exit", not high priority.

This program can be modified and altered at will, as long as it's for the Crossfire project. Else don't touch it :)

Note that "attribute" is used for "field in a object/living structure".

Author:
Nicolas Weeger / Ryo_ on IRC
Date:
2008-01-06

Definition in file gridarta-types-convert.c.


Function Documentation

void add_required_parameter ( type_definition type,
const char *  buf 
)

Add a required parameter to the specified type. buf is the line read from the file, non processed.

Definition at line 480 of file gridarta-types-convert.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void add_type_to_attribute ( attribute_definition attribute,
type_definition type,
int  attr 
)

Definition at line 718 of file gridarta-types-convert.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void copy_attributes ( const type_definition source,
type_definition type 
)

Definition at line 372 of file gridarta-types-convert.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void copy_default_attributes ( type_definition type  ) 

Definition at line 388 of file gridarta-types-convert.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void dump_ignore_lists ( void   ) 

Definition at line 767 of file gridarta-types-convert.c.

void dump_type ( type_definition type  ) 

Definition at line 654 of file gridarta-types-convert.c.

Here is the caller graph for this function:

void dump_types ( void   ) 

Definition at line 665 of file gridarta-types-convert.c.

Here is the call graph for this function:

type_attribute* duplicate_attribute ( type_attribute attr  ) 

Definition at line 327 of file gridarta-types-convert.c.

const flag_definition* find_flag ( const char *  name  ) 

Return flag if exists, NULL else.

Definition at line 198 of file gridarta-types-convert.c.

Here is the caller graph for this function:

ignore_list* find_ignore_list ( const char *  name  ) 

Definition at line 432 of file gridarta-types-convert.c.

Here is the caller graph for this function:

type_definition* find_type_definition ( const char *  name  ) 

Used for type import.

Definition at line 413 of file gridarta-types-convert.c.

Here is the caller graph for this function:

void free_attribute ( type_attribute attr  ) 

Definition at line 335 of file gridarta-types-convert.c.

Here is the caller graph for this function:

attribute_definition* get_attribute ( const char *  name  ) 

Get an attribute, create it if it doesn't exist yet.

Definition at line 676 of file gridarta-types-convert.c.

Here is the caller graph for this function:

type_attribute* get_attribute_for_type ( type_definition type,
const char *  attribute,
int  clean 
)

Gets the attribute for the specified type. If it doesn't exist, create it. If the attribute is already defined, return the existing one, after cleaning its fields if clean is set.

Definition at line 346 of file gridarta-types-convert.c.

Here is the caller graph for this function:

attribute_type* get_description_for_attribute ( attribute_definition attribute,
const char *  description 
)

Gets a type description for specified attribute, create it if doesn't exist.

Definition at line 696 of file gridarta-types-convert.c.

Here is the caller graph for this function:

type_definition* get_type_definition ( void   ) 

Returns a new type_definition having the default attributes.

Definition at line 397 of file gridarta-types-convert.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void ignore_attribute ( type_definition type,
const char *  attribute 
)

Remove an attribute from the type.

Definition at line 450 of file gridarta-types-convert.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void ignore_attributes ( type_definition type,
ignore_list list 
)

Remove all attributes in the specified list from the type.

Definition at line 466 of file gridarta-types-convert.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int is_custom_attribute ( const char *  attribute  ) 

Definition at line 814 of file gridarta-types-convert.c.

Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Main entry point.

Parameters:
argc length of argv.
argv command-line options.
Returns:
0.

Definition at line 962 of file gridarta-types-convert.c.

Here is the call graph for this function:

void read_ignore_list ( const char *  name,
FILE *  file 
)

Read the contents of a <ignore_list> tag.

Definition at line 730 of file gridarta-types-convert.c.

Here is the call graph for this function:

Here is the caller graph for this function:

char* read_line ( char *  buffer,
int  size,
FILE *  file 
)

Todo:
remove spaces at line start/end.

Definition at line 445 of file gridarta-types-convert.c.

Here is the caller graph for this function:

void read_type ( type_definition type,
FILE *  file,
const char *  block_end 
)

Read all lines related to a type, stop when "block_end" is found on a line.

Definition at line 515 of file gridarta-types-convert.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int sort_type_attribute ( const void *  a,
const void *  b 
)

To sort attributes.

Definition at line 425 of file gridarta-types-convert.c.

Here is the caller graph for this function:

void write_attribute_file ( attribute_definition attribute  ) 

Write the description of a field.

Definition at line 922 of file gridarta-types-convert.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void write_attribute_reference ( const char *  attribute,
FILE *  file 
)

Write the part to the right of a @ref for the specified attribute.

Definition at line 826 of file gridarta-types-convert.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void write_type_file ( type_definition type  ) 

Write a type definition file.

Definition at line 856 of file gridarta-types-convert.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void write_type_index ( void   ) 

Write index of all types.

Definition at line 901 of file gridarta-types-convert.c.

Here is the caller graph for this function:


Variable Documentation

int attribute_count = 0

Definition at line 91 of file gridarta-types-convert.c.

Definition at line 90 of file gridarta-types-convert.c.

Definitions all types have by default.

Definition at line 60 of file gridarta-types-convert.c.

const char* destination_dir = "../doc/Developers"

Root destination dir.

Definition at line 31 of file gridarta-types-convert.c.

Dummy object type that non defined objects use.

Definition at line 63 of file gridarta-types-convert.c.

const char* field_dir = "fields"

Where the files about the fields will be stored.

Definition at line 32 of file gridarta-types-convert.c.

int list_count = 0

Definition at line 73 of file gridarta-types-convert.c.

ignore_list** lists = NULL

Definition at line 72 of file gridarta-types-convert.c.

int type_count = 0

Definition at line 57 of file gridarta-types-convert.c.

const char* type_dir = "types"

Where the files about types will be stored.

Definition at line 33 of file gridarta-types-convert.c.

Defined types.

Definition at line 55 of file gridarta-types-convert.c.


Generated on Thu Mar 25 23:27:38 2010 for Crossfire Server, Branch 1.12 by  doxygen 1.5.8