uncrustify! now the code is only ugly on the *inside*
This commit is contained in:
@@ -16,63 +16,59 @@ _QERPatchTable g_PatchTable;
|
||||
CSynapseServer* g_pSynapseServer = NULL;
|
||||
CSynapseClientXMap g_SynapseClient;
|
||||
|
||||
static const XMLConfigEntry_t entries[] =
|
||||
{
|
||||
{ SHADERS_MAJOR, SYN_REQUIRE, sizeof(g_ShadersTable), &g_ShadersTable },
|
||||
{ NULL, SYN_UNKNOWN, 0, NULL } };
|
||||
|
||||
static const XMLConfigEntry_t entries[] =
|
||||
{
|
||||
{ SHADERS_MAJOR, SYN_REQUIRE, sizeof( g_ShadersTable ), &g_ShadersTable },
|
||||
{ NULL, SYN_UNKNOWN, 0, NULL }
|
||||
};
|
||||
|
||||
#if __GNUC__ >= 4
|
||||
#pragma GCC visibility push(default)
|
||||
#endif
|
||||
extern "C" CSynapseClient* SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces( const char *version, CSynapseServer *pServer ) {
|
||||
extern "C" CSynapseClient * SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces( const char *version, CSynapseServer *pServer ) {
|
||||
#if __GNUC__ >= 4
|
||||
#pragma GCC visibility pop
|
||||
#endif
|
||||
if (strcmp(version, SYNAPSE_VERSION))
|
||||
{
|
||||
Syn_Printf("ERROR: synapse API version mismatch: should be '" SYNAPSE_VERSION "', got '%s'\n", version);
|
||||
return NULL;
|
||||
}
|
||||
g_pSynapseServer = pServer;
|
||||
g_pSynapseServer->IncRef();
|
||||
Set_Syn_Printf(g_pSynapseServer->Get_Syn_Printf());
|
||||
|
||||
g_SynapseClient.AddAPI(MAP_MAJOR, "mapxml", sizeof(_QERPlugMapTable));
|
||||
g_SynapseClient.AddAPI(RADIANT_MAJOR, NULL, sizeof(_QERFuncTable_1), SYN_REQUIRE, &g_FuncTable);
|
||||
g_SynapseClient.AddAPI(ENTITY_MAJOR, NULL, sizeof(g_EntityTable), SYN_REQUIRE, &g_EntityTable);
|
||||
g_SynapseClient.AddAPI(BRUSH_MAJOR, NULL, sizeof(g_BrushTable), SYN_REQUIRE, &g_BrushTable);
|
||||
g_SynapseClient.AddAPI(PATCH_MAJOR, NULL, sizeof(g_PatchTable), SYN_REQUIRE, &g_PatchTable);
|
||||
if ( strcmp( version, SYNAPSE_VERSION ) ) {
|
||||
Syn_Printf( "ERROR: synapse API version mismatch: should be '" SYNAPSE_VERSION "', got '%s'\n", version );
|
||||
return NULL;
|
||||
}
|
||||
g_pSynapseServer = pServer;
|
||||
g_pSynapseServer->IncRef();
|
||||
Set_Syn_Printf( g_pSynapseServer->Get_Syn_Printf() );
|
||||
|
||||
if ( !g_SynapseClient.ConfigXML( pServer, NULL, entries ) ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &g_SynapseClient;
|
||||
g_SynapseClient.AddAPI( MAP_MAJOR, "mapxml", sizeof( _QERPlugMapTable ) );
|
||||
g_SynapseClient.AddAPI( RADIANT_MAJOR, NULL, sizeof( _QERFuncTable_1 ), SYN_REQUIRE, &g_FuncTable );
|
||||
g_SynapseClient.AddAPI( ENTITY_MAJOR, NULL, sizeof( g_EntityTable ), SYN_REQUIRE, &g_EntityTable );
|
||||
g_SynapseClient.AddAPI( BRUSH_MAJOR, NULL, sizeof( g_BrushTable ), SYN_REQUIRE, &g_BrushTable );
|
||||
g_SynapseClient.AddAPI( PATCH_MAJOR, NULL, sizeof( g_PatchTable ), SYN_REQUIRE, &g_PatchTable );
|
||||
|
||||
if ( !g_SynapseClient.ConfigXML( pServer, NULL, entries ) ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &g_SynapseClient;
|
||||
}
|
||||
|
||||
bool CSynapseClientXMap::RequestAPI(APIDescriptor_t *pAPI)
|
||||
{
|
||||
if (!strcmp(pAPI->major_name, MAP_MAJOR))
|
||||
{
|
||||
_QERPlugMapTable* pTable= static_cast<_QERPlugMapTable*>(pAPI->mpTable);
|
||||
pTable->m_pfnMap_Read = &Map_Read;
|
||||
pTable->m_pfnMap_Write = &Map_Write;
|
||||
|
||||
return true;
|
||||
}
|
||||
bool CSynapseClientXMap::RequestAPI( APIDescriptor_t *pAPI ){
|
||||
if ( !strcmp( pAPI->major_name, MAP_MAJOR ) ) {
|
||||
_QERPlugMapTable* pTable = static_cast<_QERPlugMapTable*>( pAPI->mpTable );
|
||||
pTable->m_pfnMap_Read = &Map_Read;
|
||||
pTable->m_pfnMap_Write = &Map_Write;
|
||||
|
||||
Syn_Printf("ERROR: RequestAPI( '%s' ) not found in '%s'\n", pAPI->major_name, GetInfo());
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
Syn_Printf( "ERROR: RequestAPI( '%s' ) not found in '%s'\n", pAPI->major_name, GetInfo() );
|
||||
return false;
|
||||
}
|
||||
|
||||
#include "version.h"
|
||||
|
||||
const char* CSynapseClientXMap::GetInfo()
|
||||
{
|
||||
return "XMAP module built " __DATE__ " " RADIANT_VERSION;
|
||||
const char* CSynapseClientXMap::GetInfo(){
|
||||
return "XMAP module built " __DATE__ " " RADIANT_VERSION;
|
||||
}
|
||||
|
||||
const char* CSynapseClientXMap::GetName()
|
||||
{
|
||||
return "xmap";
|
||||
const char* CSynapseClientXMap::GetName(){
|
||||
return "xmap";
|
||||
}
|
||||
|
||||
@@ -29,21 +29,21 @@ extern _QERPatchTable g_PatchTable;
|
||||
|
||||
extern void *g_pRadiantWnd;
|
||||
|
||||
void Map_Read (IDataStream *in, CPtrArray *map);
|
||||
void Map_Write (CPtrArray *map, IDataStream *out);
|
||||
void Map_Read( IDataStream *in, CPtrArray *map );
|
||||
void Map_Write( CPtrArray *map, IDataStream *out );
|
||||
|
||||
extern CSynapseServer* g_pSynapseServer;
|
||||
|
||||
class CSynapseClientXMap : public CSynapseClient
|
||||
{
|
||||
public:
|
||||
// CSynapseClient API
|
||||
bool RequestAPI(APIDescriptor_t *pAPI);
|
||||
const char* GetInfo();
|
||||
const char* GetName(); ///< required for XML runtime config
|
||||
|
||||
CSynapseClientXMap() { }
|
||||
virtual ~CSynapseClientXMap() { }
|
||||
// CSynapseClient API
|
||||
bool RequestAPI( APIDescriptor_t *pAPI );
|
||||
const char* GetInfo();
|
||||
const char* GetName(); ///< required for XML runtime config
|
||||
|
||||
CSynapseClientXMap() { }
|
||||
virtual ~CSynapseClientXMap() { }
|
||||
};
|
||||
|
||||
#endif // _PLUGIN_H_
|
||||
|
||||
@@ -5,291 +5,284 @@
|
||||
|
||||
#include "plugin.h"
|
||||
|
||||
void Patch_XMLParse(patchMesh_t *pPatch, xmlNodePtr surface)
|
||||
{
|
||||
char *str, *content;
|
||||
int i, j;
|
||||
void Patch_XMLParse( patchMesh_t *pPatch, xmlNodePtr surface ){
|
||||
char *str, *content;
|
||||
int i, j;
|
||||
|
||||
for(xmlNodePtr current = surface->children; current != NULL; current = current->next)
|
||||
{
|
||||
if(current->type != XML_ELEMENT_NODE) continue;
|
||||
if(!strcmp((char *)current->name, "matrix"))
|
||||
{
|
||||
str = (char *)xmlGetProp(current, (xmlChar *)"width");
|
||||
pPatch->width = atoi(str);
|
||||
xmlFree(str);
|
||||
str = (char *)xmlGetProp(current, (xmlChar *)"height");
|
||||
pPatch->height = atoi(str);
|
||||
xmlFree(str);
|
||||
for ( xmlNodePtr current = surface->children; current != NULL; current = current->next )
|
||||
{
|
||||
if ( current->type != XML_ELEMENT_NODE ) {
|
||||
continue;
|
||||
}
|
||||
if ( !strcmp( (char *)current->name, "matrix" ) ) {
|
||||
str = (char *)xmlGetProp( current, (xmlChar *)"width" );
|
||||
pPatch->width = atoi( str );
|
||||
xmlFree( str );
|
||||
str = (char *)xmlGetProp( current, (xmlChar *)"height" );
|
||||
pPatch->height = atoi( str );
|
||||
xmlFree( str );
|
||||
|
||||
content = Q_StrDup((char *)current->children->content);
|
||||
content = Q_StrDup( (char *)current->children->content );
|
||||
|
||||
str = strtok(content, " \n\r\t\v\0");
|
||||
for(i=0; i<pPatch->width; i++)
|
||||
{
|
||||
for(j=0; j<pPatch->height; j++)
|
||||
{
|
||||
pPatch->ctrl[i][j].xyz[0] = atof(str);
|
||||
str = strtok(NULL, " \n\r\t\v\0");
|
||||
pPatch->ctrl[i][j].xyz[1] = atof(str);
|
||||
str = strtok(NULL, " \n\r\t\v\0");
|
||||
pPatch->ctrl[i][j].xyz[2] = atof(str);
|
||||
str = strtok(NULL, " \n\r\t\v\0");
|
||||
pPatch->ctrl[i][j].st[0] = atof(str);
|
||||
str = strtok(NULL, " \n\r\t\v\0");
|
||||
pPatch->ctrl[i][j].st[1] = atof(str);
|
||||
str = strtok(NULL, " \n\r\t\v\0");
|
||||
}
|
||||
}
|
||||
str = strtok( content, " \n\r\t\v\0" );
|
||||
for ( i = 0; i < pPatch->width; i++ )
|
||||
{
|
||||
for ( j = 0; j < pPatch->height; j++ )
|
||||
{
|
||||
pPatch->ctrl[i][j].xyz[0] = atof( str );
|
||||
str = strtok( NULL, " \n\r\t\v\0" );
|
||||
pPatch->ctrl[i][j].xyz[1] = atof( str );
|
||||
str = strtok( NULL, " \n\r\t\v\0" );
|
||||
pPatch->ctrl[i][j].xyz[2] = atof( str );
|
||||
str = strtok( NULL, " \n\r\t\v\0" );
|
||||
pPatch->ctrl[i][j].st[0] = atof( str );
|
||||
str = strtok( NULL, " \n\r\t\v\0" );
|
||||
pPatch->ctrl[i][j].st[1] = atof( str );
|
||||
str = strtok( NULL, " \n\r\t\v\0" );
|
||||
}
|
||||
}
|
||||
|
||||
delete [] content;
|
||||
}
|
||||
else if(!strcmp((char *)current->name, "shader")) {
|
||||
pPatch->pShader = QERApp_Shader_ForName((char*)current->children->content);
|
||||
pPatch->d_texture = pPatch->pShader->getTexture();
|
||||
}
|
||||
}
|
||||
delete [] content;
|
||||
}
|
||||
else if ( !strcmp( (char *)current->name, "shader" ) ) {
|
||||
pPatch->pShader = QERApp_Shader_ForName( (char*)current->children->content );
|
||||
pPatch->d_texture = pPatch->pShader->getTexture();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Face_XMLParse (face_t *face, xmlNodePtr surface)
|
||||
{
|
||||
char *str, *content;
|
||||
int i, j;
|
||||
void Face_XMLParse( face_t *face, xmlNodePtr surface ){
|
||||
char *str, *content;
|
||||
int i, j;
|
||||
|
||||
for(xmlNodePtr current = surface->children; current != NULL; current = current->next)
|
||||
{
|
||||
if(current->type != XML_ELEMENT_NODE) continue;
|
||||
if(!strcmp((char *)current->name, "planepts"))
|
||||
{
|
||||
content = Q_StrDup((char *)current->children->content);
|
||||
for ( xmlNodePtr current = surface->children; current != NULL; current = current->next )
|
||||
{
|
||||
if ( current->type != XML_ELEMENT_NODE ) {
|
||||
continue;
|
||||
}
|
||||
if ( !strcmp( (char *)current->name, "planepts" ) ) {
|
||||
content = Q_StrDup( (char *)current->children->content );
|
||||
|
||||
str = strtok(content, " \n\r\t\v\0");
|
||||
for (i=0 ; i<3 ; i++)
|
||||
{
|
||||
for (j=0 ; j<3 ; j++)
|
||||
{
|
||||
face->planepts[i][j] = atof(str);
|
||||
str = strtok(NULL, " \n\r\t\v\0");
|
||||
}
|
||||
}
|
||||
str = strtok( content, " \n\r\t\v\0" );
|
||||
for ( i = 0 ; i < 3 ; i++ )
|
||||
{
|
||||
for ( j = 0 ; j < 3 ; j++ )
|
||||
{
|
||||
face->planepts[i][j] = atof( str );
|
||||
str = strtok( NULL, " \n\r\t\v\0" );
|
||||
}
|
||||
}
|
||||
|
||||
delete [] content;
|
||||
}
|
||||
else if(!strcmp((char *)current->name, "texdef"))
|
||||
{
|
||||
content = Q_StrDup((char *)current->children->content);
|
||||
|
||||
str = strtok(content, " \n\r\t\v\0");
|
||||
face->texdef.shift[0] = atof(str);
|
||||
str = strtok(NULL, " \n\r\t\v\0");
|
||||
face->texdef.shift[1] = atof(str);
|
||||
str = strtok(NULL, " \n\r\t\v\0");
|
||||
face->texdef.rotate = atof(str);
|
||||
str = strtok(NULL, " \n\r\t\v\0");
|
||||
face->texdef.scale[0] = atof(str);
|
||||
str = strtok(NULL, " \n\r\t\v\0");
|
||||
face->texdef.scale[1] = atof(str);
|
||||
delete [] content;
|
||||
}
|
||||
else if ( !strcmp( (char *)current->name, "texdef" ) ) {
|
||||
content = Q_StrDup( (char *)current->children->content );
|
||||
|
||||
delete [] content;
|
||||
}
|
||||
else if(!strcmp((char *)current->name, "bpmatrix"))
|
||||
{
|
||||
content = Q_StrDup((char *)current->children->content);
|
||||
|
||||
str = strtok(content, " \n\r\t\v\0");
|
||||
face->brushprimit_texdef.coords[0][0] = atof(str);
|
||||
str = strtok(NULL, " \n\r\t\v\0");
|
||||
face->brushprimit_texdef.coords[0][1] = atof(str);
|
||||
str = strtok(NULL, " \n\r\t\v\0");
|
||||
face->brushprimit_texdef.coords[0][2] = atof(str);
|
||||
str = strtok(NULL, " \n\r\t\v\0");
|
||||
face->brushprimit_texdef.coords[1][0] = atof(str);
|
||||
str = strtok(NULL, " \n\r\t\v\0");
|
||||
face->brushprimit_texdef.coords[1][1] = atof(str);
|
||||
str = strtok(NULL, " \n\r\t\v\0");
|
||||
face->brushprimit_texdef.coords[1][2] = atof(str);
|
||||
str = strtok( content, " \n\r\t\v\0" );
|
||||
face->texdef.shift[0] = atof( str );
|
||||
str = strtok( NULL, " \n\r\t\v\0" );
|
||||
face->texdef.shift[1] = atof( str );
|
||||
str = strtok( NULL, " \n\r\t\v\0" );
|
||||
face->texdef.rotate = atof( str );
|
||||
str = strtok( NULL, " \n\r\t\v\0" );
|
||||
face->texdef.scale[0] = atof( str );
|
||||
str = strtok( NULL, " \n\r\t\v\0" );
|
||||
face->texdef.scale[1] = atof( str );
|
||||
|
||||
delete [] content;
|
||||
}
|
||||
else if(!strcmp((char *)current->name, "flags"))
|
||||
{
|
||||
content = Q_StrDup((char *)current->children->content);
|
||||
delete [] content;
|
||||
}
|
||||
else if ( !strcmp( (char *)current->name, "bpmatrix" ) ) {
|
||||
content = Q_StrDup( (char *)current->children->content );
|
||||
|
||||
str = strtok(content, " \n\r\t\v\0");
|
||||
face->texdef.contents = atoi(str);
|
||||
str = strtok(NULL, " \n\r\t\v\0");
|
||||
face->texdef.flags = atoi(str);
|
||||
str = strtok(NULL, " \n\r\t\v\0");
|
||||
face->texdef.value = atoi(str);
|
||||
str = strtok( content, " \n\r\t\v\0" );
|
||||
face->brushprimit_texdef.coords[0][0] = atof( str );
|
||||
str = strtok( NULL, " \n\r\t\v\0" );
|
||||
face->brushprimit_texdef.coords[0][1] = atof( str );
|
||||
str = strtok( NULL, " \n\r\t\v\0" );
|
||||
face->brushprimit_texdef.coords[0][2] = atof( str );
|
||||
str = strtok( NULL, " \n\r\t\v\0" );
|
||||
face->brushprimit_texdef.coords[1][0] = atof( str );
|
||||
str = strtok( NULL, " \n\r\t\v\0" );
|
||||
face->brushprimit_texdef.coords[1][1] = atof( str );
|
||||
str = strtok( NULL, " \n\r\t\v\0" );
|
||||
face->brushprimit_texdef.coords[1][2] = atof( str );
|
||||
|
||||
delete [] content;
|
||||
}
|
||||
else if(!strcmp((char *)current->name, "shader"))
|
||||
{
|
||||
face->texdef.SetName((char *)current->children->content);
|
||||
}
|
||||
}
|
||||
delete [] content;
|
||||
}
|
||||
else if ( !strcmp( (char *)current->name, "flags" ) ) {
|
||||
content = Q_StrDup( (char *)current->children->content );
|
||||
|
||||
str = strtok( content, " \n\r\t\v\0" );
|
||||
face->texdef.contents = atoi( str );
|
||||
str = strtok( NULL, " \n\r\t\v\0" );
|
||||
face->texdef.flags = atoi( str );
|
||||
str = strtok( NULL, " \n\r\t\v\0" );
|
||||
face->texdef.value = atoi( str );
|
||||
|
||||
delete [] content;
|
||||
}
|
||||
else if ( !strcmp( (char *)current->name, "shader" ) ) {
|
||||
face->texdef.SetName( (char *)current->children->content );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Brush_XMLParse (brush_t *pBrush, xmlNodePtr primitive)
|
||||
{
|
||||
face_t *f;
|
||||
void Brush_XMLParse( brush_t *pBrush, xmlNodePtr primitive ){
|
||||
face_t *f;
|
||||
|
||||
for(xmlNodePtr current = primitive->children; current != NULL; current = current->next)
|
||||
{
|
||||
if(current->type != XML_ELEMENT_NODE) continue;
|
||||
f = pBrush->brush_faces;
|
||||
pBrush->brush_faces = Face_Alloc();
|
||||
Face_XMLParse(pBrush->brush_faces, current);
|
||||
pBrush->brush_faces->next = f;
|
||||
}
|
||||
for ( xmlNodePtr current = primitive->children; current != NULL; current = current->next )
|
||||
{
|
||||
if ( current->type != XML_ELEMENT_NODE ) {
|
||||
continue;
|
||||
}
|
||||
f = pBrush->brush_faces;
|
||||
pBrush->brush_faces = Face_Alloc();
|
||||
Face_XMLParse( pBrush->brush_faces, current );
|
||||
pBrush->brush_faces->next = f;
|
||||
}
|
||||
}
|
||||
|
||||
void Entity_XMLParse(entity_t *pEntity, xmlNodePtr entity)
|
||||
{
|
||||
brush_t *pBrush;
|
||||
void Entity_XMLParse( entity_t *pEntity, xmlNodePtr entity ){
|
||||
brush_t *pBrush;
|
||||
|
||||
for(xmlNodePtr current = entity->children; current != NULL; current = current->next)
|
||||
{
|
||||
if(current->type != XML_ELEMENT_NODE) continue;
|
||||
if(!strcmp((char *)current->name, "epair"))
|
||||
{
|
||||
char *key = (char *)xmlGetProp(current, (xmlChar *)"key");
|
||||
char *value = (char *)xmlGetProp(current, (xmlChar *)"value");
|
||||
SetKeyValue(pEntity, key, value);
|
||||
xmlFree(key);
|
||||
xmlFree(value);
|
||||
}
|
||||
else if(strcmp((char *)current->name, "brush") == 0)
|
||||
{
|
||||
pBrush = Brush_Alloc();
|
||||
Brush_XMLParse(pBrush, current);
|
||||
((CPtrArray*)pEntity->pData)->Add(pBrush);
|
||||
}
|
||||
else if(strcmp((char *)current->name, "patch") == 0)
|
||||
{
|
||||
pBrush = Brush_Alloc();
|
||||
pBrush->patchBrush = true;
|
||||
pBrush->pPatch = Patch_Alloc();
|
||||
pBrush->pPatch->pSymbiot = pBrush;
|
||||
Patch_XMLParse(pBrush->pPatch, current);
|
||||
((CPtrArray*)pEntity->pData)->Add(pBrush);
|
||||
}
|
||||
}
|
||||
for ( xmlNodePtr current = entity->children; current != NULL; current = current->next )
|
||||
{
|
||||
if ( current->type != XML_ELEMENT_NODE ) {
|
||||
continue;
|
||||
}
|
||||
if ( !strcmp( (char *)current->name, "epair" ) ) {
|
||||
char *key = (char *)xmlGetProp( current, (xmlChar *)"key" );
|
||||
char *value = (char *)xmlGetProp( current, (xmlChar *)"value" );
|
||||
SetKeyValue( pEntity, key, value );
|
||||
xmlFree( key );
|
||||
xmlFree( value );
|
||||
}
|
||||
else if ( strcmp( (char *)current->name, "brush" ) == 0 ) {
|
||||
pBrush = Brush_Alloc();
|
||||
Brush_XMLParse( pBrush, current );
|
||||
( (CPtrArray*)pEntity->pData )->Add( pBrush );
|
||||
}
|
||||
else if ( strcmp( (char *)current->name, "patch" ) == 0 ) {
|
||||
pBrush = Brush_Alloc();
|
||||
pBrush->patchBrush = true;
|
||||
pBrush->pPatch = Patch_Alloc();
|
||||
pBrush->pPatch->pSymbiot = pBrush;
|
||||
Patch_XMLParse( pBrush->pPatch, current );
|
||||
( (CPtrArray*)pEntity->pData )->Add( pBrush );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Map_XMLRead(CPtrArray *map, xmlNodePtr map_node)
|
||||
{
|
||||
entity_t *pEntity;
|
||||
xmlNodePtr current;
|
||||
void Map_XMLRead( CPtrArray *map, xmlNodePtr map_node ){
|
||||
entity_t *pEntity;
|
||||
xmlNodePtr current;
|
||||
|
||||
for(current = map_node->children; current != NULL; current = current->next)
|
||||
{
|
||||
if(current->type != XML_ELEMENT_NODE) continue;
|
||||
pEntity = Entity_Alloc();
|
||||
pEntity->pData = new CPtrArray;
|
||||
Entity_XMLParse(pEntity, current);
|
||||
map->Add(pEntity);
|
||||
}
|
||||
for ( current = map_node->children; current != NULL; current = current->next )
|
||||
{
|
||||
if ( current->type != XML_ELEMENT_NODE ) {
|
||||
continue;
|
||||
}
|
||||
pEntity = Entity_Alloc();
|
||||
pEntity->pData = new CPtrArray;
|
||||
Entity_XMLParse( pEntity, current );
|
||||
map->Add( pEntity );
|
||||
}
|
||||
}
|
||||
|
||||
// SPoG
|
||||
// temporarily copied from qe3.cpp
|
||||
// duplicate code starts here (note: g_strAppPath swapped for g_FuncTable.m_pfnGetQERPath())
|
||||
|
||||
void HandleXMLError( void* ctxt, const char* text, ... )
|
||||
{
|
||||
va_list argptr;
|
||||
static char buf[32768];
|
||||
void HandleXMLError( void* ctxt, const char* text, ... ){
|
||||
va_list argptr;
|
||||
static char buf[32768];
|
||||
|
||||
va_start (argptr,text);
|
||||
vsprintf (buf, text, argptr);
|
||||
Sys_FPrintf (SYS_ERR, "XML %s\n", buf);
|
||||
va_end (argptr);
|
||||
va_start( argptr,text );
|
||||
vsprintf( buf, text, argptr );
|
||||
Sys_FPrintf( SYS_ERR, "XML %s\n", buf );
|
||||
va_end( argptr );
|
||||
}
|
||||
|
||||
#define DTD_BUFFER_LENGTH 1024
|
||||
xmlDocPtr ParseXMLStream(IDataStream *stream, bool validate = false)
|
||||
{
|
||||
xmlDocPtr doc = NULL;
|
||||
bool wellFormed = false, valid = false;
|
||||
int res, size = 1024;
|
||||
char chars[1024];
|
||||
xmlParserCtxtPtr ctxt;
|
||||
xmlDocPtr ParseXMLStream( IDataStream *stream, bool validate = false ){
|
||||
xmlDocPtr doc = NULL;
|
||||
bool wellFormed = false, valid = false;
|
||||
int res, size = 1024;
|
||||
char chars[1024];
|
||||
xmlParserCtxtPtr ctxt;
|
||||
|
||||
// SPoG
|
||||
// HACK: use AppPath to resolve DTD location
|
||||
// do a buffer-safe string copy and concatenate
|
||||
int i;
|
||||
char* w;
|
||||
const char* r;
|
||||
char buf[DTD_BUFFER_LENGTH];
|
||||
// SPoG
|
||||
// HACK: use AppPath to resolve DTD location
|
||||
// do a buffer-safe string copy and concatenate
|
||||
int i;
|
||||
char* w;
|
||||
const char* r;
|
||||
char buf[DTD_BUFFER_LENGTH];
|
||||
|
||||
w = buf;
|
||||
i = 0;
|
||||
// copy
|
||||
//assert(g_FuncTable.m_pfnGetQERPath() != NULL);
|
||||
for(r = g_FuncTable.m_pfnGetQERPath(); i<DTD_BUFFER_LENGTH && *r != '\0'; i++, r++) w[i] = *r;
|
||||
// concatenate
|
||||
for(r = "dtds/"; i<DTD_BUFFER_LENGTH && *r != '\0'; i++, r++) w[i] = *r;
|
||||
// terminate
|
||||
w[i] = '\0';
|
||||
w = buf;
|
||||
i = 0;
|
||||
// copy
|
||||
//assert(g_FuncTable.m_pfnGetQERPath() != NULL);
|
||||
for ( r = g_FuncTable.m_pfnGetQERPath(); i < DTD_BUFFER_LENGTH && *r != '\0'; i++, r++ ) w[i] = *r;
|
||||
// concatenate
|
||||
for ( r = "dtds/"; i < DTD_BUFFER_LENGTH && *r != '\0'; i++, r++ ) w[i] = *r;
|
||||
// terminate
|
||||
w[i] = '\0';
|
||||
|
||||
if(i == DTD_BUFFER_LENGTH)
|
||||
{
|
||||
HandleXMLError(NULL, "ERROR: buffer overflow: DTD path length too large\n");
|
||||
return NULL;
|
||||
}
|
||||
if ( i == DTD_BUFFER_LENGTH ) {
|
||||
HandleXMLError( NULL, "ERROR: buffer overflow: DTD path length too large\n" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//if(validate)
|
||||
// xmlDoValidityCheckingDefaultValue = 1;
|
||||
//else
|
||||
xmlDoValidityCheckingDefaultValue = 0;
|
||||
//if(validate)
|
||||
// xmlDoValidityCheckingDefaultValue = 1;
|
||||
//else
|
||||
xmlDoValidityCheckingDefaultValue = 0;
|
||||
|
||||
xmlSetGenericErrorFunc(NULL, HandleXMLError);
|
||||
xmlSetGenericErrorFunc( NULL, HandleXMLError );
|
||||
|
||||
res = stream->Read(chars, 4);
|
||||
if (res > 0)
|
||||
{
|
||||
ctxt = xmlCreatePushParserCtxt(NULL, NULL, chars, res, buf);
|
||||
res = stream->Read( chars, 4 );
|
||||
if ( res > 0 ) {
|
||||
ctxt = xmlCreatePushParserCtxt( NULL, NULL, chars, res, buf );
|
||||
|
||||
while ((res = stream->Read(chars, size)) > 0)
|
||||
{
|
||||
xmlParseChunk(ctxt, chars, res, 0);
|
||||
}
|
||||
xmlParseChunk(ctxt, chars, 0, 1);
|
||||
doc = ctxt->myDoc;
|
||||
while ( ( res = stream->Read( chars, size ) ) > 0 )
|
||||
{
|
||||
xmlParseChunk( ctxt, chars, res, 0 );
|
||||
}
|
||||
xmlParseChunk( ctxt, chars, 0, 1 );
|
||||
doc = ctxt->myDoc;
|
||||
|
||||
wellFormed = (ctxt->wellFormed == 1);
|
||||
valid = (ctxt->valid == 1);
|
||||
wellFormed = ( ctxt->wellFormed == 1 );
|
||||
valid = ( ctxt->valid == 1 );
|
||||
|
||||
xmlFreeParserCtxt(ctxt);
|
||||
}
|
||||
xmlFreeParserCtxt( ctxt );
|
||||
}
|
||||
|
||||
if(wellFormed && (!validate || (validate && valid)))
|
||||
return doc;
|
||||
if ( wellFormed && ( !validate || ( validate && valid ) ) ) {
|
||||
return doc;
|
||||
}
|
||||
|
||||
if(doc != NULL)
|
||||
xmlFreeDoc(doc);
|
||||
if ( doc != NULL ) {
|
||||
xmlFreeDoc( doc );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// duplicate code ends here
|
||||
|
||||
void Map_Read (IDataStream *in, CPtrArray *map)
|
||||
{
|
||||
xmlDocPtr doc;
|
||||
void Map_Read( IDataStream *in, CPtrArray *map ){
|
||||
xmlDocPtr doc;
|
||||
|
||||
doc = ParseXMLStream(in, false ); // quick hack while dtd validation is broken
|
||||
doc = ParseXMLStream( in, false ); // quick hack while dtd validation is broken
|
||||
|
||||
if(doc != NULL)
|
||||
{
|
||||
xmlNodePtr node=doc->children;
|
||||
while(node != NULL && node->type != XML_ELEMENT_NODE) node=node->next;
|
||||
if(node != NULL)
|
||||
Map_XMLRead(map, node);
|
||||
}
|
||||
|
||||
xmlFreeDoc(doc);
|
||||
if ( doc != NULL ) {
|
||||
xmlNodePtr node = doc->children;
|
||||
while ( node != NULL && node->type != XML_ELEMENT_NODE ) node = node->next;
|
||||
if ( node != NULL ) {
|
||||
Map_XMLRead( map, node );
|
||||
}
|
||||
}
|
||||
|
||||
xmlFreeDoc( doc );
|
||||
}
|
||||
|
||||
@@ -5,213 +5,203 @@
|
||||
|
||||
#include "plugin.h"
|
||||
|
||||
char *str_append_token(char *str1, const char *str2)
|
||||
{
|
||||
char *str;
|
||||
if(str1 != NULL)
|
||||
{
|
||||
str = new char[strlen(str1)+strlen(str2)+2];
|
||||
sprintf(str, "%s %s", str1, str2);
|
||||
delete [] str1;
|
||||
}
|
||||
else
|
||||
{
|
||||
str = new char[strlen(str2)+1];
|
||||
strcpy(str, str2);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
void str_from_float(char *buf, float f)
|
||||
{
|
||||
if(f == (int)f) sprintf(buf, "%i", (int)f);
|
||||
else sprintf(buf, "%f", f);
|
||||
}
|
||||
|
||||
void Patch_XMLWrite(patchMesh_t *pPatch, xmlNodePtr surface)
|
||||
{
|
||||
char buf[16];
|
||||
char *str;
|
||||
int i, j;
|
||||
xmlNodePtr node;
|
||||
|
||||
// write shader
|
||||
node = xmlNewChild(surface, NULL, (xmlChar *)"shader", (xmlChar *)pPatch->pShader->getName());
|
||||
|
||||
// write matrix
|
||||
str = NULL;
|
||||
for(i=0; i<pPatch->width; i++)
|
||||
{
|
||||
for(j=0; j<pPatch->height; j++)
|
||||
{
|
||||
str_from_float(buf, pPatch->ctrl[i][j].xyz[0]);
|
||||
str = str_append_token(str, buf);
|
||||
str_from_float(buf, pPatch->ctrl[i][j].xyz[1]);
|
||||
str = str_append_token(str, buf);
|
||||
str_from_float(buf, pPatch->ctrl[i][j].xyz[2]);
|
||||
str = str_append_token(str, buf);
|
||||
str_from_float(buf, pPatch->ctrl[i][j].st[0]);
|
||||
str = str_append_token(str, buf);
|
||||
str_from_float(buf, pPatch->ctrl[i][j].st[1]);
|
||||
str = str_append_token(str, buf);
|
||||
}
|
||||
}
|
||||
|
||||
node = xmlNewChild(surface, NULL, (xmlChar *)"matrix", (xmlChar *)str);
|
||||
delete [] str;
|
||||
sprintf(buf, "%i", pPatch->width);
|
||||
xmlSetProp(node, (xmlChar *)"width", (xmlChar *)buf);
|
||||
sprintf(buf, "%i", pPatch->height);
|
||||
xmlSetProp(node, (xmlChar *)"height", (xmlChar *)buf);
|
||||
}
|
||||
|
||||
void Face_XMLWrite (face_t *face, xmlNodePtr surface, bool bAlternateTexdef = false)
|
||||
{
|
||||
char buf[16];
|
||||
xmlNodePtr node;
|
||||
int i, j;
|
||||
char *str;
|
||||
|
||||
// write shader
|
||||
node = xmlNewChild(surface, NULL, (xmlChar *)"shader", (xmlChar *)face->texdef.GetName());
|
||||
|
||||
// write planepts
|
||||
str = NULL;
|
||||
for (i=0 ; i<3 ; i++)
|
||||
char *str_append_token( char *str1, const char *str2 ){
|
||||
char *str;
|
||||
if ( str1 != NULL ) {
|
||||
str = new char[strlen( str1 ) + strlen( str2 ) + 2];
|
||||
sprintf( str, "%s %s", str1, str2 );
|
||||
delete [] str1;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (j=0 ; j<3 ; j++)
|
||||
str = new char[strlen( str2 ) + 1];
|
||||
strcpy( str, str2 );
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
void str_from_float( char *buf, float f ){
|
||||
if ( f == (int)f ) {
|
||||
sprintf( buf, "%i", (int)f );
|
||||
}
|
||||
else{ sprintf( buf, "%f", f ); }
|
||||
}
|
||||
|
||||
void Patch_XMLWrite( patchMesh_t *pPatch, xmlNodePtr surface ){
|
||||
char buf[16];
|
||||
char *str;
|
||||
int i, j;
|
||||
xmlNodePtr node;
|
||||
|
||||
// write shader
|
||||
node = xmlNewChild( surface, NULL, (xmlChar *)"shader", (xmlChar *)pPatch->pShader->getName() );
|
||||
|
||||
// write matrix
|
||||
str = NULL;
|
||||
for ( i = 0; i < pPatch->width; i++ )
|
||||
{
|
||||
for ( j = 0; j < pPatch->height; j++ )
|
||||
{
|
||||
str_from_float(buf, face->planepts[i][j]);
|
||||
str = str_append_token(str, buf);
|
||||
str_from_float( buf, pPatch->ctrl[i][j].xyz[0] );
|
||||
str = str_append_token( str, buf );
|
||||
str_from_float( buf, pPatch->ctrl[i][j].xyz[1] );
|
||||
str = str_append_token( str, buf );
|
||||
str_from_float( buf, pPatch->ctrl[i][j].xyz[2] );
|
||||
str = str_append_token( str, buf );
|
||||
str_from_float( buf, pPatch->ctrl[i][j].st[0] );
|
||||
str = str_append_token( str, buf );
|
||||
str_from_float( buf, pPatch->ctrl[i][j].st[1] );
|
||||
str = str_append_token( str, buf );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
node = xmlNewChild(surface, NULL, (xmlChar *)"planepts", (xmlChar *)str);
|
||||
delete [] str;
|
||||
|
||||
if(!bAlternateTexdef)
|
||||
{
|
||||
// write texdef
|
||||
sprintf(buf, "%i", (int)face->texdef.shift[0]);
|
||||
str = str_append_token(NULL, buf);
|
||||
sprintf(buf, "%i", (int)face->texdef.shift[1]);
|
||||
str = str_append_token(str, buf);
|
||||
sprintf(buf, "%i", (int)face->texdef.rotate);
|
||||
str = str_append_token(str, buf);
|
||||
sprintf(buf, "%f", face->texdef.scale[0]);
|
||||
str = str_append_token(str, buf);
|
||||
sprintf(buf, "%f", face->texdef.scale[1]);
|
||||
str = str_append_token(str, buf);
|
||||
|
||||
node = xmlNewChild(surface, NULL, (xmlChar *)"texdef", (xmlChar *)str);
|
||||
delete [] str;
|
||||
}
|
||||
else
|
||||
{
|
||||
// write matrix texdef
|
||||
str = NULL;
|
||||
for (i=0 ; i<2 ; i++)
|
||||
{
|
||||
for (j=0 ; j<3 ; j++)
|
||||
{
|
||||
str_from_float(buf, face->brushprimit_texdef.coords[i][j]);
|
||||
str = str_append_token(str, buf);
|
||||
}
|
||||
}
|
||||
node = xmlNewChild(surface, NULL, (xmlChar *)"bpmatrix", (xmlChar *)str);
|
||||
delete [] str;
|
||||
}
|
||||
|
||||
// write flags
|
||||
sprintf(buf, "%i", face->texdef.contents);
|
||||
str = str_append_token(NULL, buf);
|
||||
sprintf(buf, "%i", face->texdef.flags);
|
||||
str = str_append_token(str, buf);
|
||||
sprintf(buf, "%i", face->texdef.value);
|
||||
str = str_append_token(str, buf);
|
||||
|
||||
node = xmlNewChild(surface, NULL, (xmlChar *)"flags", (xmlChar *)str);
|
||||
delete [] str;
|
||||
node = xmlNewChild( surface, NULL, (xmlChar *)"matrix", (xmlChar *)str );
|
||||
delete [] str;
|
||||
sprintf( buf, "%i", pPatch->width );
|
||||
xmlSetProp( node, (xmlChar *)"width", (xmlChar *)buf );
|
||||
sprintf( buf, "%i", pPatch->height );
|
||||
xmlSetProp( node, (xmlChar *)"height", (xmlChar *)buf );
|
||||
}
|
||||
|
||||
void Brush_XMLWrite (brush_t *brush, xmlNodePtr primitive)
|
||||
{
|
||||
xmlNodePtr node;
|
||||
void Face_XMLWrite( face_t *face, xmlNodePtr surface, bool bAlternateTexdef = false ){
|
||||
char buf[16];
|
||||
xmlNodePtr node;
|
||||
int i, j;
|
||||
char *str;
|
||||
|
||||
for(face_t *face = brush->brush_faces; face != NULL; face = face->next)
|
||||
{
|
||||
node = xmlNewChild(primitive, NULL, (xmlChar *)"plane", NULL);
|
||||
Face_XMLWrite (face, node, brush->bBrushDef);
|
||||
}
|
||||
// write shader
|
||||
node = xmlNewChild( surface, NULL, (xmlChar *)"shader", (xmlChar *)face->texdef.GetName() );
|
||||
|
||||
// write planepts
|
||||
str = NULL;
|
||||
for ( i = 0 ; i < 3 ; i++ )
|
||||
{
|
||||
for ( j = 0 ; j < 3 ; j++ )
|
||||
{
|
||||
str_from_float( buf, face->planepts[i][j] );
|
||||
str = str_append_token( str, buf );
|
||||
}
|
||||
}
|
||||
|
||||
node = xmlNewChild( surface, NULL, (xmlChar *)"planepts", (xmlChar *)str );
|
||||
delete [] str;
|
||||
|
||||
if ( !bAlternateTexdef ) {
|
||||
// write texdef
|
||||
sprintf( buf, "%i", (int)face->texdef.shift[0] );
|
||||
str = str_append_token( NULL, buf );
|
||||
sprintf( buf, "%i", (int)face->texdef.shift[1] );
|
||||
str = str_append_token( str, buf );
|
||||
sprintf( buf, "%i", (int)face->texdef.rotate );
|
||||
str = str_append_token( str, buf );
|
||||
sprintf( buf, "%f", face->texdef.scale[0] );
|
||||
str = str_append_token( str, buf );
|
||||
sprintf( buf, "%f", face->texdef.scale[1] );
|
||||
str = str_append_token( str, buf );
|
||||
|
||||
node = xmlNewChild( surface, NULL, (xmlChar *)"texdef", (xmlChar *)str );
|
||||
delete [] str;
|
||||
}
|
||||
else
|
||||
{
|
||||
// write matrix texdef
|
||||
str = NULL;
|
||||
for ( i = 0 ; i < 2 ; i++ )
|
||||
{
|
||||
for ( j = 0 ; j < 3 ; j++ )
|
||||
{
|
||||
str_from_float( buf, face->brushprimit_texdef.coords[i][j] );
|
||||
str = str_append_token( str, buf );
|
||||
}
|
||||
}
|
||||
node = xmlNewChild( surface, NULL, (xmlChar *)"bpmatrix", (xmlChar *)str );
|
||||
delete [] str;
|
||||
}
|
||||
|
||||
// write flags
|
||||
sprintf( buf, "%i", face->texdef.contents );
|
||||
str = str_append_token( NULL, buf );
|
||||
sprintf( buf, "%i", face->texdef.flags );
|
||||
str = str_append_token( str, buf );
|
||||
sprintf( buf, "%i", face->texdef.value );
|
||||
str = str_append_token( str, buf );
|
||||
|
||||
node = xmlNewChild( surface, NULL, (xmlChar *)"flags", (xmlChar *)str );
|
||||
delete [] str;
|
||||
}
|
||||
|
||||
void Epair_XMLWrite(epair_t *pEpair, xmlNodePtr epair)
|
||||
{
|
||||
xmlSetProp(epair, (xmlChar *)"key", (xmlChar *)pEpair->key);
|
||||
xmlSetProp(epair, (xmlChar *)"value", (xmlChar *)pEpair->value);
|
||||
void Brush_XMLWrite( brush_t *brush, xmlNodePtr primitive ){
|
||||
xmlNodePtr node;
|
||||
|
||||
for ( face_t *face = brush->brush_faces; face != NULL; face = face->next )
|
||||
{
|
||||
node = xmlNewChild( primitive, NULL, (xmlChar *)"plane", NULL );
|
||||
Face_XMLWrite( face, node, brush->bBrushDef );
|
||||
}
|
||||
}
|
||||
|
||||
void Entity_XMLWrite(entity_t *pEntity, xmlNodePtr entity)
|
||||
{
|
||||
brush_t *pBrush;
|
||||
epair_t *pEpair;
|
||||
xmlNodePtr node;
|
||||
|
||||
CPtrArray *brushes = (CPtrArray*)pEntity->pData;
|
||||
|
||||
for(pEpair = pEntity->epairs; pEpair != NULL; pEpair = pEpair->next)
|
||||
{
|
||||
node = xmlNewChild(entity, NULL, (xmlChar *)"epair", NULL);
|
||||
Epair_XMLWrite(pEpair, node);
|
||||
}
|
||||
|
||||
for(int i=0; i<brushes->GetSize(); i++)
|
||||
{
|
||||
pBrush = (brush_t*)brushes->GetAt(i);
|
||||
|
||||
if(pBrush->patchBrush)
|
||||
{
|
||||
node = xmlNewChild(entity, NULL, (xmlChar *)"patch", NULL);
|
||||
Patch_XMLWrite(pBrush->pPatch, node);
|
||||
}
|
||||
else
|
||||
{
|
||||
node = xmlNewChild(entity, NULL, (xmlChar *)"brush", NULL);
|
||||
Brush_XMLWrite(pBrush, node);
|
||||
}
|
||||
}
|
||||
void Epair_XMLWrite( epair_t *pEpair, xmlNodePtr epair ){
|
||||
xmlSetProp( epair, (xmlChar *)"key", (xmlChar *)pEpair->key );
|
||||
xmlSetProp( epair, (xmlChar *)"value", (xmlChar *)pEpair->value );
|
||||
}
|
||||
|
||||
void Map_XMLWrite (CPtrArray *map, xmlNodePtr map_node)
|
||||
{
|
||||
entity_t *pEntity;
|
||||
xmlNodePtr node;
|
||||
void Entity_XMLWrite( entity_t *pEntity, xmlNodePtr entity ){
|
||||
brush_t *pBrush;
|
||||
epair_t *pEpair;
|
||||
xmlNodePtr node;
|
||||
|
||||
for(int i=0; i<map->GetSize(); i++)
|
||||
{
|
||||
pEntity = (entity_t*)map->GetAt(i);
|
||||
CPtrArray *brushes = (CPtrArray*)pEntity->pData;
|
||||
|
||||
node = xmlNewChild(map_node, NULL, (xmlChar *)"entity", NULL);
|
||||
Entity_XMLWrite(pEntity, node);
|
||||
}
|
||||
for ( pEpair = pEntity->epairs; pEpair != NULL; pEpair = pEpair->next )
|
||||
{
|
||||
node = xmlNewChild( entity, NULL, (xmlChar *)"epair", NULL );
|
||||
Epair_XMLWrite( pEpair, node );
|
||||
}
|
||||
|
||||
for ( int i = 0; i < brushes->GetSize(); i++ )
|
||||
{
|
||||
pBrush = (brush_t*)brushes->GetAt( i );
|
||||
|
||||
if ( pBrush->patchBrush ) {
|
||||
node = xmlNewChild( entity, NULL, (xmlChar *)"patch", NULL );
|
||||
Patch_XMLWrite( pBrush->pPatch, node );
|
||||
}
|
||||
else
|
||||
{
|
||||
node = xmlNewChild( entity, NULL, (xmlChar *)"brush", NULL );
|
||||
Brush_XMLWrite( pBrush, node );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Map_Write (CPtrArray *map, IDataStream *out)
|
||||
{
|
||||
xmlChar* buf;
|
||||
int len;
|
||||
|
||||
xmlDocPtr doc = xmlNewDoc((xmlChar *)"1.0");
|
||||
xmlCreateIntSubset(doc, (xmlChar *)"mapq3", NULL, (xmlChar *)"mapq3.dtd");
|
||||
doc->children->next = xmlNewDocNode(doc, NULL, (xmlChar *)"mapq3", NULL);
|
||||
void Map_XMLWrite( CPtrArray *map, xmlNodePtr map_node ){
|
||||
entity_t *pEntity;
|
||||
xmlNodePtr node;
|
||||
|
||||
Map_XMLWrite(map, doc->children->next);
|
||||
for ( int i = 0; i < map->GetSize(); i++ )
|
||||
{
|
||||
pEntity = (entity_t*)map->GetAt( i );
|
||||
|
||||
// xmlDocDumpMemory(doc, &buf, &len);
|
||||
xmlDocDumpFormatMemory(doc, &buf, &len, 1);
|
||||
xmlFreeDoc(doc);
|
||||
|
||||
out->Write(buf, len);
|
||||
|
||||
xmlFree(buf);
|
||||
node = xmlNewChild( map_node, NULL, (xmlChar *)"entity", NULL );
|
||||
Entity_XMLWrite( pEntity, node );
|
||||
}
|
||||
}
|
||||
|
||||
void Map_Write( CPtrArray *map, IDataStream *out ){
|
||||
xmlChar* buf;
|
||||
int len;
|
||||
|
||||
xmlDocPtr doc = xmlNewDoc( (xmlChar *)"1.0" );
|
||||
xmlCreateIntSubset( doc, (xmlChar *)"mapq3", NULL, (xmlChar *)"mapq3.dtd" );
|
||||
doc->children->next = xmlNewDocNode( doc, NULL, (xmlChar *)"mapq3", NULL );
|
||||
|
||||
Map_XMLWrite( map, doc->children->next );
|
||||
|
||||
// xmlDocDumpMemory(doc, &buf, &len);
|
||||
xmlDocDumpFormatMemory( doc, &buf, &len, 1 );
|
||||
xmlFreeDoc( doc );
|
||||
|
||||
out->Write( buf, len );
|
||||
|
||||
xmlFree( buf );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user