my own uncrustify run

This commit is contained in:
Rudolf Polzer
2012-03-27 12:03:21 +02:00
parent 203343b01a
commit e4287c28bb
1056 changed files with 194610 additions and 205971 deletions

View File

@@ -1,23 +1,23 @@
/*
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
This file is part of GtkRadiant.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "parse.h"
@@ -33,119 +33,106 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "stringio.h"
#include "eclasslib.h"
inline MapImporter* Node_getMapImporter(scene::Node& node)
{
return NodeTypeCast<MapImporter>::cast(node);
inline MapImporter* Node_getMapImporter( scene::Node& node ){
return NodeTypeCast<MapImporter>::cast( node );
}
typedef std::list< std::pair<CopiedString, CopiedString> > KeyValues;
NodeSmartReference g_nullNode(NewNullNode());
NodeSmartReference g_nullNode( NewNullNode() );
NodeSmartReference Entity_create(EntityCreator& entityTable, EntityClass* entityClass, const KeyValues& keyValues)
{
scene::Node& entity(entityTable.createEntity(entityClass));
for(KeyValues::const_iterator i = keyValues.begin(); i != keyValues.end(); ++i)
{
Node_getEntity(entity)->setKeyValue((*i).first.c_str(), (*i).second.c_str());
}
return NodeSmartReference(entity);
NodeSmartReference Entity_create( EntityCreator& entityTable, EntityClass* entityClass, const KeyValues& keyValues ){
scene::Node& entity( entityTable.createEntity( entityClass ) );
for ( KeyValues::const_iterator i = keyValues.begin(); i != keyValues.end(); ++i )
{
Node_getEntity( entity )->setKeyValue( ( *i ).first.c_str(), ( *i ).second.c_str() );
}
return NodeSmartReference( entity );
}
NodeSmartReference Entity_parseTokens(Tokeniser& tokeniser, EntityCreator& entityTable, const PrimitiveParser& parser, int index)
{
NodeSmartReference entity(g_nullNode);
KeyValues keyValues;
const char* classname = "";
NodeSmartReference Entity_parseTokens( Tokeniser& tokeniser, EntityCreator& entityTable, const PrimitiveParser& parser, int index ){
NodeSmartReference entity( g_nullNode );
KeyValues keyValues;
const char* classname = "";
int count_primitives = 0;
while(1)
{
tokeniser.nextLine();
const char* token = tokeniser.getToken();
if(token == 0)
{
Tokeniser_unexpectedError(tokeniser, token, "#entity-token");
return g_nullNode;
}
if (!strcmp(token, "}")) // end entity
{
if(entity == g_nullNode)
{
// entity does not have brushes
entity = Entity_create(entityTable, GlobalEntityClassManager().findOrInsert(classname, false), keyValues);
}
return entity;
}
else if(!strcmp(token, "{")) // begin primitive
{
if(entity == g_nullNode)
{
// entity has brushes
entity = Entity_create(entityTable, GlobalEntityClassManager().findOrInsert(classname, true), keyValues);
}
int count_primitives = 0;
while ( 1 )
{
tokeniser.nextLine();
const char* token = tokeniser.getToken();
if ( token == 0 ) {
Tokeniser_unexpectedError( tokeniser, token, "#entity-token" );
return g_nullNode;
}
if ( !strcmp( token, "}" ) ) { // end entity
if ( entity == g_nullNode ) {
// entity does not have brushes
entity = Entity_create( entityTable, GlobalEntityClassManager().findOrInsert( classname, false ), keyValues );
}
return entity;
}
else if ( !strcmp( token, "{" ) ) { // begin primitive
if ( entity == g_nullNode ) {
// entity has brushes
entity = Entity_create( entityTable, GlobalEntityClassManager().findOrInsert( classname, true ), keyValues );
}
tokeniser.nextLine();
tokeniser.nextLine();
NodeSmartReference primitive(parser.parsePrimitive(tokeniser));
if(primitive == g_nullNode || !Node_getMapImporter(primitive)->importTokens(tokeniser))
{
globalErrorStream() << "brush " << count_primitives << ": parse error\n";
return g_nullNode;
}
NodeSmartReference primitive( parser.parsePrimitive( tokeniser ) );
if ( primitive == g_nullNode || !Node_getMapImporter( primitive )->importTokens( tokeniser ) ) {
globalErrorStream() << "brush " << count_primitives << ": parse error\n";
return g_nullNode;
}
scene::Traversable* traversable = Node_getTraversable(entity);
if(Node_getEntity(entity)->isContainer() && traversable != 0)
{
traversable->insert(primitive);
}
else
{
globalErrorStream() << "entity " << index << ": type " << classname << ": discarding brush " << count_primitives << "\n";
}
++count_primitives;
}
else // epair
{
CopiedString key(token);
token = tokeniser.getToken();
if(token == 0)
{
Tokeniser_unexpectedError(tokeniser, token, "#epair-value");
return g_nullNode;
}
keyValues.push_back(KeyValues::value_type(key, token));
if(string_equal(key.c_str(), "classname"))
{
classname = keyValues.back().second.c_str();
}
}
}
// unreachable code
return g_nullNode;
scene::Traversable* traversable = Node_getTraversable( entity );
if ( Node_getEntity( entity )->isContainer() && traversable != 0 ) {
traversable->insert( primitive );
}
else
{
globalErrorStream() << "entity " << index << ": type " << classname << ": discarding brush " << count_primitives << "\n";
}
++count_primitives;
}
else // epair
{
CopiedString key( token );
token = tokeniser.getToken();
if ( token == 0 ) {
Tokeniser_unexpectedError( tokeniser, token, "#epair-value" );
return g_nullNode;
}
keyValues.push_back( KeyValues::value_type( key, token ) );
if ( string_equal( key.c_str(), "classname" ) ) {
classname = keyValues.back().second.c_str();
}
}
}
// unreachable code
return g_nullNode;
}
void Map_Read(scene::Node& root, Tokeniser& tokeniser, EntityCreator& entityTable, const PrimitiveParser& parser)
{
int count_entities = 0;
for(;;)
{
tokeniser.nextLine();
if (!tokeniser.getToken()) // { or 0
break;
void Map_Read( scene::Node& root, Tokeniser& tokeniser, EntityCreator& entityTable, const PrimitiveParser& parser ){
int count_entities = 0;
for (;; )
{
tokeniser.nextLine();
if ( !tokeniser.getToken() ) { // { or 0
break;
}
NodeSmartReference entity(Entity_parseTokens(tokeniser, entityTable, parser, count_entities));
NodeSmartReference entity( Entity_parseTokens( tokeniser, entityTable, parser, count_entities ) );
if(entity == g_nullNode)
{
globalErrorStream() << "entity " << count_entities << ": parse error\n";
return;
}
if ( entity == g_nullNode ) {
globalErrorStream() << "entity " << count_entities << ": parse error\n";
return;
}
Node_getTraversable(root)->insert(entity);
Node_getTraversable( root )->insert( entity );
++count_entities;
}
++count_entities;
}
}

View File

@@ -1,25 +1,25 @@
/*
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
This file is part of GtkRadiant.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if !defined(INCLUDED_PARSE_H)
#if !defined( INCLUDED_PARSE_H )
#define INCLUDED_PARSE_H
#include "imap.h"
@@ -30,14 +30,14 @@ class PatchCreator;
class PrimitiveParser
{
public:
virtual scene::Node& parsePrimitive(Tokeniser& tokeniser) const = 0;
virtual scene::Node& parsePrimitive( Tokeniser& tokeniser ) const = 0;
};
void Map_Read(scene::Node& root, Tokeniser& tokeniser, EntityCreator& entityTable, const PrimitiveParser& parser);
void Map_Read( scene::Node& root, Tokeniser& tokeniser, EntityCreator& entityTable, const PrimitiveParser& parser );
namespace scene
{
class Node;
class Node;
}
#include "generic/referencecounted.h"

File diff suppressed because it is too large Load Diff

View File

@@ -1,25 +1,25 @@
/*
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
This file is part of GtkRadiant.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if !defined(INCLUDED_PLUGIN_H)
#if !defined( INCLUDED_PLUGIN_H )
#define INCLUDED_PLUGIN_H
#endif

View File

@@ -1,23 +1,23 @@
/*
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
This file is part of GtkRadiant.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "write.h"
@@ -25,9 +25,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "iscriplib.h"
#include "scenelib.h"
inline MapExporter* Node_getMapExporter(scene::Node& node)
{
return NodeTypeCast<MapExporter>::cast(node);
inline MapExporter* Node_getMapExporter( scene::Node& node ){
return NodeTypeCast<MapExporter>::cast( node );
}
@@ -35,90 +34,79 @@ static std::size_t g_count_entities;
static std::size_t g_count_brushes;
void Entity_ExportTokens(const Entity& entity, TokenWriter& writer)
{
g_count_brushes = 0;
void Entity_ExportTokens( const Entity& entity, TokenWriter& writer ){
g_count_brushes = 0;
class WriteKeyValue : public Entity::Visitor
{
TokenWriter& m_writer;
public:
WriteKeyValue(TokenWriter& writer)
: m_writer(writer)
{
}
class WriteKeyValue : public Entity::Visitor
{
TokenWriter& m_writer;
public:
WriteKeyValue( TokenWriter& writer )
: m_writer( writer ){
}
void visit(const char* key, const char* value)
{
m_writer.writeString(key);
m_writer.writeString(value);
m_writer.nextLine();
}
void visit( const char* key, const char* value ){
m_writer.writeString( key );
m_writer.writeString( value );
m_writer.nextLine();
}
} visitor(writer);
} visitor( writer );
entity.forEachKeyValue(visitor);
entity.forEachKeyValue( visitor );
}
class WriteTokensWalker : public scene::Traversable::Walker
{
mutable Stack<bool> m_stack;
TokenWriter& m_writer;
bool m_ignorePatches;
mutable Stack<bool> m_stack;
TokenWriter& m_writer;
bool m_ignorePatches;
public:
WriteTokensWalker(TokenWriter& writer, bool ignorePatches)
: m_writer(writer), m_ignorePatches(ignorePatches)
{
}
bool pre(scene::Node& node) const
{
m_stack.push(false);
WriteTokensWalker( TokenWriter& writer, bool ignorePatches )
: m_writer( writer ), m_ignorePatches( ignorePatches ){
}
bool pre( scene::Node& node ) const {
m_stack.push( false );
Entity* entity = Node_getEntity(node);
if(entity != 0)
{
m_writer.writeToken("//");
m_writer.writeToken("entity");
m_writer.writeUnsigned(g_count_entities++);
m_writer.nextLine();
Entity* entity = Node_getEntity( node );
if ( entity != 0 ) {
m_writer.writeToken( "//" );
m_writer.writeToken( "entity" );
m_writer.writeUnsigned( g_count_entities++ );
m_writer.nextLine();
m_writer.writeToken("{");
m_writer.nextLine();
m_stack.top() = true;
m_writer.writeToken( "{" );
m_writer.nextLine();
m_stack.top() = true;
Entity_ExportTokens(*entity, m_writer);
}
else
{
MapExporter* exporter = Node_getMapExporter(node);
if(exporter != 0
&& !(m_ignorePatches && Node_isPatch(node)))
{
m_writer.writeToken("//");
m_writer.writeToken("brush");
m_writer.writeUnsigned(g_count_brushes++);
m_writer.nextLine();
Entity_ExportTokens( *entity, m_writer );
}
else
{
MapExporter* exporter = Node_getMapExporter( node );
if ( exporter != 0
&& !( m_ignorePatches && Node_isPatch( node ) ) ) {
m_writer.writeToken( "//" );
m_writer.writeToken( "brush" );
m_writer.writeUnsigned( g_count_brushes++ );
m_writer.nextLine();
exporter->exportTokens(m_writer);
}
}
exporter->exportTokens( m_writer );
}
}
return true;
}
void post(scene::Node& node) const
{
if(m_stack.top())
{
m_writer.writeToken("}");
m_writer.nextLine();
}
m_stack.pop();
}
return true;
}
void post( scene::Node& node ) const {
if ( m_stack.top() ) {
m_writer.writeToken( "}" );
m_writer.nextLine();
}
m_stack.pop();
}
};
void Map_Write(scene::Node& root, GraphTraversalFunc traverse, TokenWriter& writer, bool ignorePatches)
{
g_count_entities = 0;
traverse(root, WriteTokensWalker(writer, ignorePatches));
void Map_Write( scene::Node& root, GraphTraversalFunc traverse, TokenWriter& writer, bool ignorePatches ){
g_count_entities = 0;
traverse( root, WriteTokensWalker( writer, ignorePatches ) );
}

View File

@@ -1,29 +1,29 @@
/*
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
This file is part of GtkRadiant.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if !defined(INCLUDED_WRITE_H)
#if !defined( INCLUDED_WRITE_H )
#define INCLUDED_WRITE_H
#include "imap.h"
void Map_Write(scene::Node& root, GraphTraversalFunc traverse, TokenWriter& writer, bool ignorePatches);
void Map_Write( scene::Node& root, GraphTraversalFunc traverse, TokenWriter& writer, bool ignorePatches );
#endif