undo more CRLF screwups.

This commit is contained in:
Enno Rehling 2010-08-08 01:06:34 -07:00
parent 14b3ed309f
commit a5e712580f
413 changed files with 105706 additions and 105752 deletions

View file

@ -14,13 +14,10 @@ without prior permission by the authors of Eressea.
#include "bind_building.h"
#include "bind_unit.h"
#include <kernel/config.h>
#include <kernel/unit.h>
#include <kernel/building.h>
#include <kernel/region.h>
#include <util/language.h>
#include <lua.h>
#include <tolua.h>

View file

@ -760,9 +760,7 @@ static int tolua_set_alliance_name(lua_State* L)
return 0;
}
#ifdef HAVE_LIBXML
#include <libxml/tree.h>
#endif
#include <util/functions.h>
#include <util/xml.h>
#include <kernel/spell.h>
@ -770,7 +768,6 @@ static int tolua_set_alliance_name(lua_State* L)
static int
tolua_write_spells(lua_State* L)
{
#ifdef HAVE_LIBXML
spell_f fun = (spell_f)get_function("lua_castspell");
const char * filename = "magic.xml";
xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0");
@ -830,7 +827,6 @@ tolua_write_spells(lua_State* L)
xmlKeepBlanksDefault(0);
xmlSaveFormatFileEnc(filename, doc, "utf-8", 1);
xmlFreeDoc(doc);
#endif
return 0;
}

View file

@ -2,6 +2,7 @@
#include <platform.h>
#include "stdafx.h"
#ifdef BINDINGS_TOLUA
#include <bindings/bindings.c>
#include <bindings/bind_attrib.c>
#include <bindings/bind_sqlite.c>
@ -12,13 +13,11 @@
#include <bindings/bind_faction.c>
#include <bindings/bind_message.c>
#include <bindings/bind_hashtable.c>
#include <bindings/bind_gmtool.c>
#include <bindings/bind_storage.c>
#include <bindings/helpers.c>
#ifdef HAVE_CURSES
#include <bindings/bind_gmtool.c>
#endif
#include <gamecode/archetype.c>
#include <gamecode/creation.c>
#include <gamecode/creport.c>
@ -33,6 +32,7 @@
#include <gamecode/spy.c>
#include <gamecode/study.c>
#include <gamecode/summary.c>
#include <gamecode/xmlreport.c>
#include <attributes/alliance.c>
#include <attributes/attributes.c>

View file

@ -38,13 +38,8 @@
#include <kernel/terrain.c>
#include <kernel/textstore.c>
#include <kernel/unit.c>
#include <kernel/sqlite.c>
#ifdef HAVE_LIBXML
#include <kernel/xmlreader.c>
#else
void register_xmlreader(void) {}
void enable_xml_gamecode(void) {}
#endif
#include <kernel/sqlite.c>
#include <modules/arena.c>
#include <modules/autoseed.c>

View file

@ -2,9 +2,6 @@
#include <platform.h>
#include "stdafx.h"
#ifdef HAVE_CURSES
#include <util/listbox.c>
#include <gmtool.c>
#endif
#include <eressea.c>

View file

@ -7,6 +7,7 @@
#include <util/log.h>
/* lua includes */
#ifdef BINDINGS_TOLUA
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
@ -15,15 +16,14 @@
#include <bindings/bind_attrib.h>
#include <bindings/bind_building.h>
#include <bindings/bind_faction.h>
#include <bindings/bind_gmtool.h>
#include <bindings/bind_hashtable.h>
#include <bindings/bind_message.h>
#include <bindings/bind_region.h>
#include <bindings/bind_ship.h>
#include <bindings/bind_storage.h>
#include <bindings/bind_unit.h>
#ifdef HAVE_CURSES
#include <bindings/bind_gmtool.h>
#endif
#endif // BINDINGS_TOLUA
#if MUSEUM_MODULE
#include <modules/museum.h>
@ -33,9 +33,7 @@
#endif
#include <triggers/triggers.h>
#include <util/language.h>
#ifdef HAVE_LIBXML
#include <kernel/xmlreader.h>
#endif
#include <kernel/reports.h>
#include <kernel/item.h>
#include <kernel/names.h>
@ -48,6 +46,7 @@
#include <gamecode/report.h>
#include <gamecode/items.h>
#include <gamecode/creport.h>
#include <gamecode/xmlreport.h>
#include <items/itemtypes.h>
#include <attributes/attributes.h>
@ -92,6 +91,7 @@ lua_init(void)
lua_State * L = lua_open();
openlibs(L);
#ifdef BINDINGS_TOLUA
register_tolua_helpers();
tolua_eressea_open(L);
tolua_sqlite_open(L);
@ -104,10 +104,9 @@ lua_init(void)
tolua_unit_open(L);
tolua_message_open(L);
tolua_hashtable_open(L);
#ifdef HAVE_CURSES
tolua_gmtool_open(L);
#endif
tolua_storage_open(L);
#endif
return L;
}
@ -139,6 +138,7 @@ game_init(void)
register_reports();
register_nr();
register_cr();
register_xr();
debug_language("locales.log");
register_names();
@ -160,6 +160,7 @@ game_init(void)
register_xmlreader();
register_archetypes();
enable_xml_gamecode();
register_attributes();
register_gmcmd();

View file

@ -15,12 +15,10 @@
#include <util/xml.h>
#include <util/functions.h>
#ifdef HAVE_LIBXML
/* libxml includes */
#include <libxml/tree.h>
#include <libxml/xpath.h>
#include <libxml/encoding.h>
#endif
/* libc includes */
#include <string.h>
@ -73,7 +71,6 @@ init_archetypes(void)
}
}
#ifdef HAVE_LIBXML
static int
parse_archetypes(xmlDocPtr doc)
{
@ -160,12 +157,9 @@ parse_archetypes(xmlDocPtr doc)
xmlXPathFreeContext(xpath);
return 0;
}
#endif
void
register_archetypes(void)
{
#ifdef HAVE_LIBXML
xml_register_callback(parse_archetypes);
#endif
}

View file

@ -58,13 +58,14 @@ without prior permission by the authors of Eressea.
#include <util/attrib.h>
#include <util/base36.h>
#include <util/crmessage.h>
#include <util/encoding.h>
#include <util/goodies.h>
#include <util/language.h>
#include <util/log.h>
#include <util/message.h>
#include <util/nrmessage.h>
#include <libxml/encoding.h>
/* libc includes */
#include <assert.h>
#include <errno.h>
@ -1363,7 +1364,7 @@ report_computer(const char * filename, report_context * ctx, const char * charse
#if SCORE_MODULE
int score = 0, avgscore = 0;
#endif
int enc = get_encoding_by_name(charset);
int enc = xmlParseCharEncoding(charset);
FILE * F = fopen(filename, "wt");
if (era<0) {
@ -1372,7 +1373,7 @@ report_computer(const char * filename, report_context * ctx, const char * charse
if (F==NULL) {
perror(filename);
return -1;
} else if (enc==ENCODING_UTF8) {
} else if (enc==XML_CHAR_ENCODING_UTF8) {
const unsigned char utf8_bom[4] = { 0xef, 0xbb, 0xbf };
fwrite(utf8_bom, 1, 3, F);
}

View file

@ -70,7 +70,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/attrib.h>
#include <util/base36.h>
#include <util/bsdstring.h>
#include <util/encoding.h>
#include <util/goodies.h>
#include <util/language.h>
#include <util/lists.h>
@ -79,6 +78,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/nrmessage.h>
#include <util/rng.h>
#include <libxml/encoding.h>
/* libc includes */
#include <assert.h>
#include <ctype.h>
@ -1362,14 +1363,14 @@ report_template(const char * filename, report_context * ctx, const char * charse
size_t size;
int bytes;
int enc = get_encoding_by_name(charset);
int enc = xmlParseCharEncoding(charset);
if (F==NULL) {
perror(filename);
return -1;
}
if (enc==ENCODING_UTF8) {
if (enc==XML_CHAR_ENCODING_UTF8) {
const unsigned char utf8_bom[4] = { 0xef, 0xbb, 0xbf };
fwrite(utf8_bom, 1, 3, F);
}
@ -1940,7 +1941,7 @@ report_plaintext(const char * filename, report_context * ctx, const char * chars
seen_region * sr = NULL;
char buf[8192];
char * bufp;
int enc = get_encoding_by_name(charset);
int enc = xmlParseCharEncoding(charset);
size_t size;
/* static variables can cope with writing for different turns */
@ -1960,7 +1961,7 @@ report_plaintext(const char * filename, report_context * ctx, const char * chars
perror(filename);
return -1;
}
if (enc==ENCODING_UTF8) {
if (enc==XML_CHAR_ENCODING_UTF8) {
const unsigned char utf8_bom[4] = { 0xef, 0xbb, 0xbf };
fwrite(utf8_bom, 1, 3, F);
}

View file

@ -60,6 +60,8 @@
#include <util/listbox.h>
#include <util/storage.h>
#include <libxml/encoding.h>
#include <lua.h>
#include <assert.h>

View file

@ -13,15 +13,12 @@ without prior permission by the authors of Eressea.
#include "save.h"
#include "version.h"
#include <util/base36.h>
#include <util/encoding.h>
#include <util/log.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_LIBXML
#include <libxml/encoding.h>
#endif
#define file(store) (FILE *)((store)->userdata)
@ -250,7 +247,7 @@ bin_open(struct storage * store, const char * filename, int mode)
const char * modes[] = { 0, "rb", "wb", "ab" };
FILE * F = fopen(filename, modes[mode]);
store->userdata = F;
store->encoding = ENCODING_UTF8; /* always utf8 it is */
store->encoding=XML_CHAR_ENCODING_UTF8; /* always utf8 it is */
if (F) {
if (mode==IO_READ) {
int stream_version = 0;
@ -266,7 +263,7 @@ bin_open(struct storage * store, const char * filename, int mode)
store->r_int = bin_r_int;
store->w_int = bin_w_int;
}
} else if (store->encoding==ENCODING_UTF8) {
} else if (store->encoding==XML_CHAR_ENCODING_UTF8) {
bin_w_int(store, RELEASE_VERSION);
bin_w_int(store, STREAM_VERSION);
}

View file

@ -51,6 +51,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/log.h>
#include <util/parser.h>
#include <util/resolve.h>
#include <util/xml.h>
/* from libc */
#include <assert.h>

View file

@ -54,7 +54,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/attrib.h>
#include <util/base36.h>
#include <util/crmessage.h>
#include <util/encoding.h>
#include <util/event.h>
#include <util/functions.h>
#include <util/language.h>
@ -66,9 +65,14 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/sql.h>
#include <util/translation.h>
#include <util/umlaut.h>
#include <util/xml.h>
#include <util/bsdstring.h>
#include <util/unicode.h>
/* libxml includes */
#include <libxml/tree.h>
#include <libxml/xpath.h>
#include <iniparser/iniparser.h>
/* libc includes */
@ -3255,7 +3259,7 @@ load_inifile(dictionary * d)
lomem = iniparser_getint(d, "eressea:lomem", lomem)?1:0;
str = iniparser_getstring(d, "eressea:encoding", NULL);
if (str) enc_gamedata = get_encoding_by_name(str);
if (str) enc_gamedata = xmlParseCharEncoding(str);
verbosity = iniparser_getint(d, "eressea:verbose", 2);
sqlpatch = iniparser_getint(d, "eressea:sqlpatch", false);

View file

@ -45,7 +45,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/functions.h>
#include <util/goodies.h>
#include <util/language.h>
#include <util/log.h>
#include <util/message.h>
#include <util/umlaut.h>
#include <util/rng.h>

View file

@ -55,7 +55,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/attrib.h>
#include <util/base36.h>
#include <util/bsdstring.h>
#include <util/encoding.h>
#include <util/event.h>
#include <util/filereader.h>
#include <util/goodies.h>
@ -71,6 +70,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/umlaut.h>
#include <util/unicode.h>
#include <libxml/encoding.h>
/* libc includes */
#include <string.h>
#include <stdio.h>
@ -167,7 +168,7 @@ freadstr(FILE * F, int encoding, char * start, size_t size)
break;
default:
if ((size_t)(str-start+1)<size) {
if (encoding == ENCODING_8859_1 && c&0x80) {
if (encoding == XML_CHAR_ENCODING_8859_1 && c&0x80) {
char inbuf = (char)c;
size_t inbytes = 1;
size_t outbytes = size-(str-start);
@ -175,7 +176,7 @@ freadstr(FILE * F, int encoding, char * start, size_t size)
if (ret>0) str+=ret;
else {
log_error(("input data was not iso-8859-1! assuming utf-8\n"));
encoding = ENCODING_ERROR;
encoding = XML_CHAR_ENCODING_ERROR;
*str++ = (char)c;
}
} else {
@ -186,7 +187,7 @@ freadstr(FILE * F, int encoding, char * start, size_t size)
break;
default:
if ((size_t)(str-start+1)<size) {
if (encoding == ENCODING_8859_1 && c&0x80) {
if (encoding == XML_CHAR_ENCODING_8859_1 && c&0x80) {
char inbuf = (char)c;
size_t inbytes = 1;
size_t outbytes = size-(str-start);
@ -194,7 +195,7 @@ freadstr(FILE * F, int encoding, char * start, size_t size)
if (ret>0) str+=ret;
else {
log_error(("input data was not iso-8859-1! assuming utf-8\n"));
encoding = ENCODING_ERROR;
encoding = XML_CHAR_ENCODING_ERROR;
*str++ = (char)c;
}
} else {

View file

@ -36,6 +36,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/lists.h>
#include <util/umlaut.h>
#include <util/storage.h>
#include <util/xml.h>
/* libc includes */
#include <assert.h>

View file

@ -13,15 +13,12 @@ without prior permission by the authors of Eressea.
#include "save.h"
#include "version.h"
#include <util/base36.h>
#include <util/encoding.h>
#include <util/log.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_LIBXML
#include <libxml/encoding.h>
#endif
#define NULL_TOKEN '@'
@ -155,19 +152,19 @@ txt_open(struct storage * store, const char * filename, int mode)
/* recognize UTF8 BOM */
store->r_tok_buf(store, token, sizeof(token));
if (memcmp(token, utf8_bom, 3)==0) {
if (enc_gamedata!=ENCODING_UTF8) {
if (enc_gamedata!=XML_CHAR_ENCODING_UTF8) {
log_warning(("Found UTF-8 BOM, assuming unicode game data.\n"));
store->encoding = ENCODING_UTF8;
store->encoding = XML_CHAR_ENCODING_UTF8;
}
store->version = atoi(token+3);
} else {
if (store->encoding==ENCODING_NONE) {
store->encoding = ENCODING_8859_1;
if (store->encoding==XML_CHAR_ENCODING_NONE) {
store->encoding = XML_CHAR_ENCODING_8859_1;
log_warning(("No BOM, assuming 8859-1 game data.\n"));
}
store->version = atoi(token);
}
} else if (store->encoding==ENCODING_UTF8) {
} else if (store->encoding==XML_CHAR_ENCODING_UTF8) {
fputs(utf8_bom, F);
fprintf(F, "%d\n", RELEASE_VERSION);
}

View file

@ -17,11 +17,9 @@ without prior permission by the authors of Eressea.
extern "C" {
#endif
#ifdef HAVE_LIBXML
#include <libxml/xpath.h>
extern void xml_readconstruction(xmlXPathContextPtr xpath, xmlNodeSetPtr nodeSet, struct construction ** consPtr);
#endif
#ifdef __cplusplus
}

View file

@ -12,7 +12,6 @@ without prior permission by the authors of Eressea.
#ifndef H_KRNL_XMLREADER_H
#define H_KRNL_XMLREADER_H
#ifdef __cplusplus
extern "C" {
#endif

View file

@ -39,6 +39,8 @@
#include <util/sql.h>
#include <util/unicode.h>
#include <libxml/encoding.h>
/* libc includes */
#include <limits.h>
#include <memory.h>

View file

@ -30,7 +30,6 @@
#include <util/rng.h>
#include <util/resolve.h>
#include <util/storage.h>
#include <util/language.h>
/* libc includes */
#include <assert.h>

View file

@ -19,10 +19,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef CONFIG_H
#define CONFIG_H
#define HAVE_LIBXML
#undef HAVE_TINYXML
#define HAVE_CURSES
#ifdef _MSC_VER
# define VC_EXTRALEAN
# define WIN32_LEAN_AND_MEAN

View file

@ -52,4 +52,12 @@
#define SIMPLE_COMBAT
#define SIMPLE_ESCAPE
#if defined(BINDINGS_LUABIND)
# undef BINDINGS_TOLUA
#elif defined(BINDINGS_TOLUA)
# undef BINDINGS_LUABIND
#else
# define BINDINGS_TOLUA /* new default */
#endif
#undef REGIONOWNERS /* (WIP) region-owner uses HELP_TRAVEL to control entry to region */

View file

@ -4,7 +4,7 @@
#include <util/log.h>
#include <util/unicode.h>
#include <util/encoding.h>
#include <libxml/encoding.h>
#include <ctype.h>
#include <wctype.h>
@ -309,6 +309,6 @@ getbuf_utf8(FILE * F)
const char *
getbuf(FILE * F, int encoding)
{
if (encoding==ENCODING_UTF8) return getbuf_utf8(F);
if (encoding==XML_CHAR_ENCODING_UTF8) return getbuf_utf8(F);
return getbuf_latin1(F);
}

View file

@ -126,29 +126,3 @@ set_email(char** pemail, const char *newmail)
}
return 0;
}
#include "encoding.h"
#include <string.h>
static struct {
int encoding;
const char * names;
} encodings[] = {
{ ENCODING_UTF8, " utf8 utf-8 UTF8 UTF-8 "},
{ ENCODING_8859_1, " iso8859-1 latin1 latin-1 iso-8859-1 ISO8859-1 LATIN1 LATIN-1 ISO-8859-1 "},
{ ENCODING_NONE, 0 }
};
int
get_encoding_by_name(const char * name)
{
char str[32];
int i;
snprintf(str, 32, " %s ", name);
for (i=0;encodings[i].encoding!=ENCODING_NONE;++i) {
if (strstr(encodings[i].names, str)) {
return encodings[i].encoding;
}
}
return ENCODING_NONE;
}

View file

@ -15,10 +15,8 @@
/* util includes */
#include "log.h"
#ifdef HAVE_LIBXML
#include <libxml/catalog.h>
#include <libxml/xmlstring.h>
#endif
/* libc includes */
#include <assert.h>
@ -27,7 +25,6 @@
#include <string.h>
#include <ctype.h>
#ifdef HAVE_LIBXML
const xmlChar *
xml_i(double number)
{
@ -107,12 +104,10 @@ xml_register_callback(xml_callback callback)
while (*insert) insert = &(*insert)->next;
*insert = reader;
}
#endif
int
read_xml(const char * filename, const char * catalog)
{
#ifdef HAVE_LIBXML
xml_reader * reader = xmlReaders;
xmlDocPtr doc;
@ -139,7 +134,6 @@ read_xml(const char * filename, const char * catalog)
reader = reader->next;
}
xmlFreeDoc(doc);
#endif
return 0;
}

View file

@ -18,17 +18,17 @@
extern "C" {
#endif
#ifdef HAVE_LIBXML
/* new xml functions: */
#include <libxml/tree.h>
typedef int (*xml_callback)(xmlDocPtr);
extern void xml_register_callback(xml_callback callback);
extern int read_xml(const char * filename, const char * catalog);
extern double xml_fvalue(xmlNodePtr node, const char * name, double dflt);
extern int xml_ivalue(xmlNodePtr node, const char * name, int dflt);
extern boolean xml_bvalue(xmlNodePtr node, const char * name, boolean dflt);
const xmlChar * xml_i(double number);
#endif
extern int read_xml(const char * filename, const char * catalog);
const xmlChar * xml_i(double number);
#ifdef __cplusplus
}