diff options
Diffstat (limited to 'xml2cmp')
45 files changed, 0 insertions, 6525 deletions
diff --git a/xml2cmp/prj/build.lst b/xml2cmp/prj/build.lst deleted file mode 100644 index 28ecf4f12..000000000 --- a/xml2cmp/prj/build.lst +++ /dev/null @@ -1,7 +0,0 @@ -xc xml2cmp : soltools NULL -xc xml2cmp usr1 - all xc_mkout NULL -xc xml2cmp\prj get - all xc_prj NULL -xc xml2cmp\source\support nmake - all xc_supp NULL -xc xml2cmp\source\xcd nmake - all xc_xcd NULL -xc xml2cmp\util nmake - all xc_util xc_supp xc_xcd NULL -xc xml2cmp\source\finder nmake - all xc_sfi xc_supp xc_xcd NULL diff --git a/xml2cmp/prj/d.lst b/xml2cmp/prj/d.lst deleted file mode 100644 index bb5adfa21..000000000 --- a/xml2cmp/prj/d.lst +++ /dev/null @@ -1,4 +0,0 @@ -..\%__SRC%\bin\xml2cmp.exe %_DEST%\bin\xml2cmp.exe -..\%__SRC%\bin\xml2cmp %_DEST%\bin\xml2cmp -..\%__SRC%\bin\srvdepy.exe %_DEST%\bin\srvdepy.exe -..\%__SRC%\bin\srvdepy %_DEST%\bin\srvdepy diff --git a/xml2cmp/source/finder/dep_main.cxx b/xml2cmp/source/finder/dep_main.cxx deleted file mode 100644 index 1d9913c61..000000000 --- a/xml2cmp/source/finder/dep_main.cxx +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <iostream> - -#include "dependy.hxx" - - -int -#ifdef WNT -_cdecl -#endif -main( int argc, - char * argv[] ) -{ - if (argc < 2 || *argv[1] == '?') - { - std::cout << "\nUse:\n" - << "srvdepy.exe <xml-component-descriptions-root-directory>\n" - << std::endl; - return 0; - } - - - DependencyFinder aDependencies; - - aDependencies.GatherData(argv[1]); - char sInput[500] = ""; - std::vector<Simstr> aLibs; - std::vector<Simstr> aServs; - - - std::cout - << "\nNow you can start to put in Service names.\n" - << "Please use correct case, but don't use namespaces.\n" - << "Just the Service's own name.\n\n" - << "To stop the program, put in a hashmark \"#\" + ENTER.\n" - << std::endl; - - - - do { - - sInput[0] = 0; - std::cin >> sInput; - Simstr sImplService(sInput); - if (*sInput != '#') - { - aLibs.erase( aLibs.begin(), aLibs.end() ); - aServs.erase( aServs.begin(), aServs.end() ); - - aDependencies.FindNeededServices( aLibs, aServs, sImplService ); - - std::cout << "\n\n\nNeeded libraries: " << std::endl; - for ( unsigned i = 0; i < aLibs.size(); ++i ) - { - std::cout << " " << aLibs[i].str() << std::endl; - } - std::cout << "\nNeeded services: " << std::endl; - for ( unsigned s= 0; s < aServs.size(); ++s ) - { - std::cout << " " << aServs[s].str() << std::endl; - } - std::cout << "\n\n" << std::endl; - } - } while (*sInput != '#'); - - return 0; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/finder/dependy.cxx b/xml2cmp/source/finder/dependy.cxx deleted file mode 100644 index 1b34b5655..000000000 --- a/xml2cmp/source/finder/dependy.cxx +++ /dev/null @@ -1,225 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include "dependy.hxx" -#include <iostream> -#include "../support/syshelp.hxx" -#include "../support/list.hxx" -#include "../xcd/xmltree.hxx" -#include "../xcd/parse.hxx" - - - -Simstr ShortName(const Simstr & i_rService); - - - -Service::Service( const char * i_sName ) - : sName(i_sName) - // aImplementations -{ -} - -ServiceInfo & -Service::AddImplementation( const char * i_sLibrary ) -{ - ServiceInfo * ret = new ServiceInfo(i_sLibrary); - aImplementations.push_back(ret); - return *ret; -} - -ServiceInfo::ServiceInfo( const char * i_sLibrary ) - : sImplementingLibrary(i_sLibrary) - // aNeededServices -{ -} - -void -ServiceInfo::AddDependency( const char * i_sNeededService ) -{ - aNeededServices.push_back(i_sNeededService); -} - -DependencyFinder::DependencyFinder() -{ -} - -DependencyFinder::~DependencyFinder() -{ -} - -void -DependencyFinder::GatherData( const char * i_sSearchDirectory ) -{ - List<Simstr> aFiles; - GatherFileNames( aFiles, i_sSearchDirectory ); - - for ( unsigned i = 0; i < aFiles.size(); ++i ) - { - ReadFile( aFiles[i].str() ); - } -} - -void -DependencyFinder::FindNeededServices( StringVector & o_rLibraries, - StringVector & o_rServices, - const Simstr & i_rService ) -{ - Map_Services::const_iterator itService = aServices.find(i_rService); - if ( itService == aServices.end() ) - { - std::cerr << "Error: Service \"" - << i_rService.str() - << "\" not found." - << std::endl; - return ; - } - - aResult_Libraries.erase( aResult_Libraries.begin(), aResult_Libraries.end() ); - aResult_Services.erase( aResult_Services.begin(), aResult_Services.end() ); - - Add2Result( *(*itService).second ); - - for ( std::set< Simstr >::const_iterator il = aResult_Libraries.begin(); - il != aResult_Libraries.end(); - ++il ) - { - o_rLibraries.push_back(*il); - } - - for ( std::set< Simstr >::const_iterator is = aResult_Services.begin(); - is != aResult_Services.end(); - ++is ) - { - o_rServices.push_back(*is); - } -} - -void -DependencyFinder::ReadFile( const char * i_sFilename ) -{ - ModuleDescription aModule; - X2CParser aParser(aModule); - - if ( !aParser.Parse(i_sFilename) ) - { - std::cerr << "Error: File \"" - << i_sFilename - << "\" could not be parsed." - << std::endl; - return; - } - - // GetResults: - Simstr sModule = aModule.ModuleName(); - - List < const MultipleTextElement* > aImplServices; - List < const MultipleTextElement* > aNeededServices; - - aModule.Get_SupportedServices(aImplServices); - aModule.Get_ServiceDependencies(aNeededServices); - - unsigned nImplServicesSize = aImplServices.size(); - unsigned nNeededServicesSize = aNeededServices.size(); - - for ( unsigned i = 0; i < nImplServicesSize; ++i ) - { - const MultipleTextElement & rImpl = *aImplServices[i]; - - unsigned nImplDataSize = rImpl.Size(); - for ( unsigned di = 0; di < nImplDataSize; ++di ) - { - Simstr sService = ShortName(rImpl.Data(di)); - Service * pService = aServices[sService]; - if (pService == 0) - { - pService = new Service(rImpl.Data(di)); - aServices[sService] = pService; - } - ServiceInfo & rSInfo = pService->AddImplementation(sModule); - - for ( unsigned n = 0; n < nNeededServicesSize; ++n ) - { - unsigned nNeededDataSize = aNeededServices[n]->Size(); - for ( unsigned dn = 0; dn < nNeededDataSize; ++dn ) - { - if (! aNeededServices[n]->Data(dn).is_no_text()) - rSInfo.AddDependency( ShortName(aNeededServices[n]->Data(dn)) ); - } // end for dn - } // end for n - } // end for di - } // end for i -} - -void -DependencyFinder::Add2Result( const Service & i_rService ) -{ - const ServiceInfo & rSInfo = i_rService.FirstImplementation(); - aResult_Libraries.insert(rSInfo.Library()); - - const ServiceInfo::List_NeededServices & rNeededs - = rSInfo.NeededServices(); - for ( StringVector::const_iterator it = rNeededs.begin(); - it != rNeededs.end(); - ++it ) - { - std::pair< std::set< Simstr >::iterator, bool > aInsertResult - = aResult_Services.insert(*it); - if (aInsertResult.second) - { // Needed service not yet known - Map_Services::const_iterator itFound = aServices.find(*it); - if ( itFound == aServices.end() ) - { - std::cerr << "Needed service \"" - << (*it).str() - << "\" not found," - << std::endl; - } - else - { - Add2Result( *(*itFound).second ); - } - } // endif (! aInsertResult.second) - } // end for (it) -} - - - -Simstr -ShortName(const Simstr & i_rService) -{ - const char * pStart = i_rService.str(); - const char * pEnd = strchr(pStart,' '); - if (pEnd != 0) - return Simstr(pStart, 0, int(pEnd-pStart)); - else - return i_rService; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/finder/dependy.hxx b/xml2cmp/source/finder/dependy.hxx deleted file mode 100644 index 3db0a51c2..000000000 --- a/xml2cmp/source/finder/dependy.hxx +++ /dev/null @@ -1,118 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef X2C_DEPENDY_HXX -#define X2C_DEPENDY_HXX - - -#include <vector> -#include <map> -#include <set> -#include <../support/sistr.hxx> - -class Service; -class ServiceInfo; - -typedef std::vector< Simstr> StringVector; -typedef std::vector< ServiceInfo* > List_Implementations; -typedef std::map< Simstr, Service* > Map_Services; - -class Service -{ - public: - Service( - const char * i_sName ); - - ServiceInfo & AddImplementation( - const char * i_sLibrary ); /// That is: module-name. - - const Simstr & Name() const { return sName; } - const ServiceInfo & FirstImplementation() const - { return *aImplementations[0]; } - - private: - Simstr sName; - List_Implementations - aImplementations; -}; - -class ServiceInfo -{ - public: - typedef StringVector List_NeededServices; - - ServiceInfo( - const char * i_sLibrary ); - - void AddDependency( - const char * i_sNeededService ); - - const Simstr & Library() const { return sImplementingLibrary; } - const List_NeededServices & - NeededServices() const { return aNeededServices; } - - - private: - Simstr sImplementingLibrary; - List_NeededServices aNeededServices; -}; - - -class DependencyFinder -{ - public: - DependencyFinder(); - ~DependencyFinder(); - - void GatherData( - const char * i_sSearchDirectory ); - - void FindNeededServices( - StringVector & o_rLibraries, - StringVector & o_rServices, - const Simstr & i_rService ); - private: - void ReadFile( - const char * i_sFilename ); - void Add2Result( - const Service & i_rService ); - - // Data - Map_Services aServices; - - // Temporary data - std::set< Simstr > aResult_Libraries; - std::set< Simstr > aResult_Services; -}; - - - -#endif - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/finder/makefile.mk b/xml2cmp/source/finder/makefile.mk deleted file mode 100644 index fee7e41c6..000000000 --- a/xml2cmp/source/finder/makefile.mk +++ /dev/null @@ -1,65 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org 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 Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=xml2cmp -TARGET=srvdepy -TARGETTYPE=CUI - -# --- Settings ----------------------------------------------------- - -ENABLE_EXCEPTIONS=TRUE - -.INCLUDE : settings.mk - -.IF "$(CROSS_COMPILING)"=="YES" -all: - @echo Nothing done when cross-compiling -.ENDIF - -# --- Files -------------------------------------------------------- - -OBJFILES= \ - $(OBJ)$/dependy.obj \ - $(OBJ)$/dep_main.obj - -# --- Targets ------------------------------------------------------ - -APP1TARGET= $(TARGET) -APP1STACK= 1000000 - -LIBSALCPPRT=$(0) - -.IF "$(GUI)"=="WNT" -UWINAPILIB=$(0) -.ENDIF - -APP1LIBS= $(LB)$/$(TARGET).lib $(LB)$/x2c_xcdl.lib $(LB)$/x2c_support.lib -APP1DEPN= $(LB)$/$(TARGET).lib $(LB)$/x2c_xcdl.lib $(LB)$/x2c_support.lib - -.INCLUDE : target.mk diff --git a/xml2cmp/source/inc/lst_str.h b/xml2cmp/source/inc/lst_str.h deleted file mode 100644 index e450c1096..000000000 --- a/xml2cmp/source/inc/lst_str.h +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef CPV_LST_STR_H -#define CPV_LST_STR_H - -#include "str.h" - - -typedef struct LSElem -{ - Cstring * pData; - struct LSElem * pNext; -} LSElem; - - -typedef struct LSIterator -{ - LSElem * pElement; -} LSIterator; - - -typedef struct ListCstring -{ - LSElem * dpStart; - LSElem * pEnd; - Bool bAutoDeleteData; -} ListCstring; - - -#define ListCstring_THIS ListCstring * pThis -#define LSIterator_THIS LSIterator * pThis -#define LSElem_THIS LSElem * pThis - - - -void ListCstring_CTOR( ListCstring_THIS, - Bool i_bAutoDeleteData ); -void ListCstring_DTOR( ListCstring_THIS ); - -void LS_Add( ListCstring_THIS, - Cstring * i_pData ); -void LS_Empty( ListCstring_THIS, - Bool i_bDeleteData ); -void LS_Append( ListCstring_THIS, - char * i_sStrings[], - intt i_nNrOfStrings ); -Bool LS_IsEmpty( ListCstring_THIS ); - -LSIterator LS_Begin( ListCstring_THIS ); - - -void LSIterator_CTOR( LSIterator_THIS, - LSElem * i_pElement ); -void LSI_opp( LSIterator_THIS ); /** operator++() */ - -Bool LSI_obool( LSIterator_THIS ); -Cstring * LSI_optr( LSIterator_THIS ); /** operator->() */ - - -void LSElem_CTOR( LSElem_THIS, - Cstring * i_pData ); -void LSElem_DTOR( LSElem_THIS ); - -Cstring * LSE_Data( LSElem_THIS ); -LSElem * LSE_Next( LSElem_THIS ); - -void LSE_SetNext( LSElem_THIS, - LSElem * i_pNext ); -void LSE_DeleteData( LSElem_THIS ); - - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/inc/new_del.h b/xml2cmp/source/inc/new_del.h deleted file mode 100644 index aa22bc854..000000000 --- a/xml2cmp/source/inc/new_del.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef CPV_NEW_DEL_H -#define CPV_NEW_DEL_H - - -void * New( - intt i_nSize ); -void Delete( - void * io_pMemory ); - -/* at ASSIGN_NEW ptr must be an L-Value. */ -#define ASSIGN_NEW( ptr, type ) \ - { ptr = New( sizeof( type ) ); type##_CTOR( ptr ); } - -#define ASSIGN_NEW1( ptr, type, param1 ) \ - { ptr = New( sizeof( type ) ); type##_CTOR( ptr, param1 ); } - -#define ASSIGN_NEW2( ptr, type, param1, param2 ) \ - { ptr = New( sizeof( type ) ); type##_CTOR( ptr, param1, param2 ); } - -#define ASSIGN_NEW3( ptr, type, param1, param2, param3 ) \ - { ptr = New( sizeof( type ) ); type##_CTOR( ptr, param1, param2, param3 ); } - -#define DELETE( ptr, type ) \ - { type##_DTOR( ptr ); Delete(ptr); } - -#endif - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/inc/precomp.h b/xml2cmp/source/inc/precomp.h deleted file mode 100644 index 64dfc6984..000000000 --- a/xml2cmp/source/inc/precomp.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef CPV_PRECOMP_H -#define CPV_PRECOMP_H - -#define _NO_BOOL_TYPE_ - -typedef short Bool; -#define True 1 -#define False 0 - - - -typedef long intt; - -#define AND && -#define OR || -#define NOT ! - - -#define REF( x ) (&(x)) -#define MREF( x ) (&(pThis->x)) -#define THIS_ pThis - - - -#endif - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/inc/str.h b/xml2cmp/source/inc/str.h deleted file mode 100644 index aad0eb60e..000000000 --- a/xml2cmp/source/inc/str.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef CPV_STR_H -#define CPV_STR_H - - -#ifdef UNX -#define stricmp(str1,str2) strcasecmp(str1, str2) -#define strnicmp(str1,str2,n) strncasecmp(str1, str2, n) -#endif - - -typedef struct Cstring -{ - char * dpText; - intt nLength; - -} Cstring; - -#define Cstring_THIS Cstring * pThis - - -void Cstring_CTOR( Cstring_THIS, - char * pText ); -void Cstring_DTOR( Cstring * pThis ); - -void Cs_Assign( Cstring_THIS, - char * i_pNewText ); -void Cs_AssignPart( Cstring_THIS, - char * i_pNewText, - intt i_nLength ); - -void Cs_AddCs( Cstring_THIS, - Cstring * i_pAddedText ); -void Cs_Add( Cstring_THIS, - char * i_pAddedText ); - -char * Cs_Str( Cstring_THIS ); -intt Cs_Length( Cstring_THIS ); - -void Cs_ToUpper( Cstring_THIS ); - - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/inc/textbuff.h b/xml2cmp/source/inc/textbuff.h deleted file mode 100644 index 357d79fcb..000000000 --- a/xml2cmp/source/inc/textbuff.h +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef CTLS_TEXTBUFF_H -#define CTLS_TEXTBUFF_H - -#include "textfile.h" - - -typedef struct TextBuffer -{ - char * dpText; - intt nSize; - - intt nPosition; - -} TextBuffer; - -#define TextBuffer_THIS TextBuffer * pThis - - -#define ENDS '\0' -#define ENDL '\n' - -typedef enum E_TB_Relation -{ - tb_begin, - tb_cur, - tb_end -} E_TB_Relation; - - -void TextBuffer_CTOR( TextBuffer_THIS, - intt i_nSize ); -void TextBuffer_DTOR( TextBuffer_THIS ); -void TB_Resize( TextBuffer_THIS, - intt i_nNewSize ); - -Bool TB_oin( TextBuffer_THIS, /** operator>>(char *) */ - char * i_pText ); -Bool TB_oinChar( TextBuffer_THIS, /** operator>>(char) */ - char i_cChar ); -Bool TB_oinFile( TextBuffer_THIS, /** operator>>(TextFile*) */ - TextFile * i_pFile ); -void TB_opp( TextBuffer_THIS ); /** operator++ */ - -intt TB_Goto( TextBuffer_THIS, - intt i_nPosition, - E_TB_Relation i_nRelation ); /** tb_begin, tb_cur, tb_end */ - - -char * TB_Text( TextBuffer_THIS ); -char TB_CurChar( TextBuffer_THIS ); -char * TB_CurCharPtr( TextBuffer_THIS ); -intt TB_Size( TextBuffer_THIS ); -intt TB_Position( TextBuffer_THIS ); -Bool TB_EndOfBuffer( TextBuffer_THIS ); - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/inc/textfile.h b/xml2cmp/source/inc/textfile.h deleted file mode 100644 index 1d6f6c509..000000000 --- a/xml2cmp/source/inc/textfile.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef CPV_TEXTFILE_H -#define CPV_TEXTFILE_H - -#include <stdio.h> -#include "str.h" - - - -typedef struct TextFile -{ - Cstring sName; - FILE * hFile; - intt nLastAction; -} TextFile; - -#define TextFile_THIS TextFile * pThis - - - -void TextFile_CTOR( TextFile_THIS, - char * i_pName ); -void TextFile_DTOR( TextFile_THIS ); - -Bool TF_Open( TextFile_THIS, - char * i_sOptions ); /* options for second parameter of fopen */ -Bool TF_Create( TextFile_THIS ); -void TF_Close( TextFile_THIS ); - -void TF_Goto( TextFile_THIS, - intt i_nPosition ); -intt TF_Read( TextFile_THIS, - char * o_pBuffer, - intt i_nNrOfBytes ); -intt TF_Write( TextFile_THIS, - char * i_pBuffer, - intt i_nNrOfBytes ); -intt TF_WriteStr( TextFile_THIS, - char * i_pString ); - -intt TF_Position( TextFile_THIS ); -intt TF_Size( TextFile_THIS ); - - - - -#endif - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/support/badcast.cxx b/xml2cmp/source/support/badcast.cxx deleted file mode 100644 index 429671e39..000000000 --- a/xml2cmp/source/support/badcast.cxx +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - - -/* Include this for instantiating bad-cast, - due to problems with WNT-STL-headers. -*/ - -#if defined(WNT) && !defined(__MINGW32__) - -#define _NTSDK -#include<typeinfo> - -_STD_BEGIN -bad_cast G_Dummy_Inst_bad_cast; -_STD_END -#endif // WNT - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/support/cmdline.cxx b/xml2cmp/source/support/cmdline.cxx deleted file mode 100644 index d75718cc0..000000000 --- a/xml2cmp/source/support/cmdline.cxx +++ /dev/null @@ -1,225 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "cmdline.hxx" - -#include <ctype.h> -#include <string.h> -#include <stdlib.h> -#include <iostream> - - -char C_sUseText[] = "Use: xml2cmp.exe \n" - " [-func funcFile] \n" - " [-html htmlFile] \n" - " [-types typeFile] \n" - " [-idlpath idlPath] \n" - " Xml_FileName\n" - " or: xml2cmp.exe \n" - " -ix \n" - " sourceDirectory \n" - " outputDirectory \n" - " [-idlpath idlPath] \n" - " tagname [tagname ...]"; - - -char C_sCmdFunc[] = "-func"; -char C_sCmdHtml[] = "-html"; -char C_sCmdType[] = "-types"; -char C_sCmdIndex[] = "-ix"; -char C_sCmdIdlPath[] = "-idlpath"; - - - -bool GetParameter( Simstr & o_rMemory, int & io_nCountArg, int argc, char * argv[] ); - - -CommandLine::CommandLine( int argc, - char * argv[] ) - : bIsOk(true) -{ - bool bDisplayUse = false; - - /* Check command line: */ - if ( argc < 2 ) - bDisplayUse = true; - else if ( argc == 2 && ! isalnum(argv[1][0]) ) - bDisplayUse = true; - else if ( strcmp( argv[1], C_sCmdIndex ) == 0 && argc < 5 ) - bDisplayUse = true; - - if (bDisplayUse) - { - std::cout << C_sUseText << std::endl; - bIsOk = false; - exit(0); - } - - if ( strcmp( argv[1], C_sCmdIndex ) == 0 ) - { - ParseIndexCommand(argc,argv); - } - else - { - ParseSingleFileCommand(argc,argv); - } - - if ( sXmlSourceFile.l() == 0 - && sXmlSourceDirectory.l() == 0 ) - { - bIsOk = false; - } - else if ( sXmlSourceFile.l() > 0 - && sXmlSourceDirectory.l() > 0 ) - { - bIsOk = false; - } - else if ( sIndexFile.l() > 0 - && ( sXmlSourceDirectory.l() == 0 - || aTagsInIndex.size() == 0 - ) - ) - { - bIsOk = false; - } - -} - -CommandLine::~CommandLine() -{ -} - - -const char * -CommandLine::ErrorText() const -{ - static char cOut[] = "Error: Command line was incorrect. Probably there was a flag without\n" - " the corresponding parameter. Or there was no XML-sourcefile specified.\n"; - return cOut; -} - -bool -GetParameter( Simstr & o_pMemory, - int & io_pCountArg, - int argc, - char * argv[] ) -{ - io_pCountArg++; - if( io_pCountArg < argc ) - { - o_pMemory = argv[io_pCountArg]; - return true; - } - return false; -} - - -void -CommandLine::ParseIndexCommand( int argc, - char * argv[] ) -{ - int nCountArg = 1; - bIsOk = GetParameter( - sXmlSourceDirectory, - nCountArg, - argc, - argv ); - if (bIsOk) - bIsOk = GetParameter( - sOutputDirectory, - nCountArg, - argc, - argv ); - if (bIsOk && strcmp( argv[nCountArg+1], C_sCmdIdlPath ) == 0 ) - bIsOk = GetParameter( - sIdlRootPath, - ++nCountArg, - argc, - argv ); - - sIndexFile = sOutputDirectory; -#if defined(WNT) - sIndexFile+= "\\xmlindex.html"; -#elif defined(UNX) - sIndexFile+= "/xmlindex.html"; -#endif - - for ( ++nCountArg; nCountArg < argc; ++nCountArg ) - { - Simstr sElementName(argv[nCountArg]); - aTagsInIndex.push_back( sElementName ); - } -} - - -void -CommandLine::ParseSingleFileCommand( int argc, - char * argv[] ) -{ - for ( int nCountArg = 1; nCountArg < argc && bIsOk; ++nCountArg ) - { - if ( strcmp( argv[nCountArg], C_sCmdFunc ) == 0 ) - { - bIsOk = GetParameter( - sFuncFile, - nCountArg, - argc, - argv ); - } - else if ( strcmp( argv[nCountArg], C_sCmdHtml ) == 0 ) - { - bIsOk = GetParameter( - sHtmlFile, - nCountArg, - argc, - argv ); - } - else if ( strcmp( argv[nCountArg], C_sCmdType ) == 0 ) - { - bIsOk = GetParameter( - sTypeInfoFile, - nCountArg, - argc, - argv ); - } - else if ( strcmp( argv[nCountArg], C_sCmdIdlPath ) == 0 ) - { - bIsOk = GetParameter( - sIdlRootPath, - nCountArg, - argc, - argv ); - } - else - { - sXmlSourceFile = argv[nCountArg]; - } - } /* end for */ -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/support/cmdline.hxx b/xml2cmp/source/support/cmdline.hxx deleted file mode 100644 index c4126d842..000000000 --- a/xml2cmp/source/support/cmdline.hxx +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef X2C_CMDLINE_HXX -#define X2C_CMDLINE_HXX - -#include "sistr.hxx" -#include "list.hxx" - - -class CommandLine -{ - public: - CommandLine( - int i_argc, - char * i_argv[] ); - ~CommandLine(); - - bool IsOk() const { return bIsOk; } - const char * ErrorText() const; - - const char * XmlSrcFile() const { return sXmlSourceFile.str(); } - const char * FuncFile() const { return sFuncFile.str(); } - const char * HtmlFile() const { return sHtmlFile.str(); } - const char * TypeInfoFile() const { return sTypeInfoFile.str(); } - - bool IsIndexCommand() const { return sIndexFile.l() > 0; } - const char * XmlSrcDirectory() const { return sXmlSourceDirectory.str(); } - const char * IndexOutputFile() const { return sIndexFile.str(); } - const char * OutputDirectory() const { return sOutputDirectory.str(); } - const List<Simstr> & - IndexedTags() const { return aTagsInIndex; } - - const char * IdlRootPath() const { return sIdlRootPath.str(); } - - private: - void ParseIndexCommand( - int argc, - char * argv[] ); - void ParseSingleFileCommand( - int argc, - char * argv[] ); - Simstr sXmlSourceFile; - Simstr sFuncFile; - Simstr sHtmlFile; - Simstr sTypeInfoFile; - - Simstr sXmlSourceDirectory; - Simstr sIndexFile; - Simstr sOutputDirectory; - List<Simstr> aTagsInIndex; - - Simstr sIdlRootPath; - - bool bIsOk; -}; - - - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/support/heap.cxx b/xml2cmp/source/support/heap.cxx deleted file mode 100644 index db51e3484..000000000 --- a/xml2cmp/source/support/heap.cxx +++ /dev/null @@ -1,209 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <string.h> -#include "heap.hxx" - - -#include <iostream> -#include <stdlib.h> -#define AssertionOf(x) {if (!(x)) {std::cerr << "Assertion failed: " << #x << __FILE__ << __LINE__ << std::endl; exit(3); }} - -#ifdef UNX -#define stricmp strcasecmp -#endif - - - -Heap::Heap(unsigned i_nWidth) - : dpColumnsArray(new Column[i_nWidth]), - nColumnsArraySize(i_nWidth), - nActiveColumn(nColumnsArraySize-1) -{ - for ( unsigned i = 0; i < nColumnsArraySize; i++) - { - dpColumnsArray[i] = 0; - } // end for -} - -Heap::~Heap() -{ - for ( unsigned i = 0; i < nColumnsArraySize; i++) - { - HeapItem * & rColumn = dpColumnsArray[i]; - for ( HeapItem * pValue = rColumn; pValue != 0; pValue = rColumn ) - { - rColumn = rColumn->Next(); - delete pValue; - } - } // end for - - delete [] dpColumnsArray; -} - -void -Heap::InsertValue( const char * i_sKey, - const char * i_sValue ) -{ - HeapItem * pSearch1 = 0; - HeapItem * pSearch2 = 0; - HeapItem * pNew = new HeapItem(i_sKey, i_sValue); - - IncColumn(); - pSearch1 = ActiveColumn(); - - if ( pSearch1 != 0 ? *pNew < *pSearch1 : true ) - { - pNew->SetNext( pSearch1 ); - ActiveColumn() = pNew; - - if ( pNew->Next() != 0) - { - AssertionOf( *pNew <= *pNew->Next() ); - } - - return; - } - - do - { - pSearch2 = pSearch1; - pSearch1 = pSearch1->Next(); - - if ( pSearch1 != 0 ? *pNew < *pSearch1 : true ) - { - pNew->SetNext( pSearch1 ); - pSearch2->SetNext(pNew); - - - AssertionOf( *pSearch2 <= *pNew ); - if ( pNew->Next() != 0) - { - AssertionOf( *pNew <= *pNew->Next() ); - } - - } - } while (pSearch2->Next() != pNew); -} - - -Simstr sKey1; -Simstr sValue1; -Simstr sKey2; -Simstr sValue2; -int nCol1 = 0; -int nCol2 = 0; - - -HeapItem * -Heap::ReleaseTop() -{ - unsigned nRetColumn = 0; - HeapItem * ret = dpColumnsArray[0]; - HeapItem * pSearch = 0; - - for ( unsigned i = 1; i < nColumnsArraySize; ++i ) - { - pSearch = dpColumnsArray[i]; - if (pSearch != 0) - { - if ( ret == 0 ? true : *pSearch < *ret) - { - ret = pSearch; - nRetColumn = i; - } - } - } // for - - if (ret != 0) - { - dpColumnsArray[nRetColumn] = ret->Next(); - } - return ret; -} - -void -Heap::IncColumn() -{ - if (++nActiveColumn >= nColumnsArraySize) - nActiveColumn = 0; -} - - - -HeapItem::HeapItem( const char * i_sKey, - const char * i_sValue ) - : sValue(i_sValue), - sKey(i_sKey), - pNext(0) -{ -} - -HeapItem::~HeapItem() -{ -} - -bool -HeapItem::operator<( const HeapItem & i_rOther ) const -{ - int ret = stricmp(sKey.str(), i_rOther.sKey.str()); - if (ret == 0) - ret = strcmp(sKey.str(), i_rOther.sKey.str()); - if (ret == 0) - ret = stricmp(sValue.str(), i_rOther.sValue.str()); - if (ret == 0) - ret = strcmp(sValue.str(), i_rOther.sValue.str()); - return ret < 0; -} - -const Simstr & -HeapItem::Value() const -{ - return sValue; -} - -const Simstr & -HeapItem::Key() const -{ - return sKey; -} - -HeapItem * -HeapItem::Next() const -{ - return pNext; -} - -void -HeapItem::SetNext( HeapItem * i_pNext ) -{ - pNext = i_pNext; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/support/heap.hxx b/xml2cmp/source/support/heap.hxx deleted file mode 100644 index ccd49788b..000000000 --- a/xml2cmp/source/support/heap.hxx +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef X2C_HEAP_HXX -#define X2C_HEAP_HXX - -#include "sistr.hxx" - -class HeapItem; - -class Heap -{ - public: - Heap( - unsigned i_nWidth ); - ~Heap(); - - void InsertValue( - const char * i_sKey, - const char * i_sValue ); - HeapItem * ReleaseTop(); /// @return must be deleted by caller of method. - - private: - typedef HeapItem * Column; - - void IncColumn(); - Column & ActiveColumn() { return dpColumnsArray[nActiveColumn]; } - - Column * dpColumnsArray; - unsigned nColumnsArraySize; - unsigned nActiveColumn; -}; - - -class HeapItem -{ - public: - HeapItem( - const char * i_sKey, - const char * i_sValue ); - ~HeapItem( ); - - bool operator<( - const HeapItem & i_rOther ) const; - bool operator<=( - const HeapItem & i_rOther ) const - { return ! (i_rOther < *this); } - const Simstr & Value() const; - const Simstr & Key() const; - HeapItem * Next() const; - - void SetNext( - HeapItem * i_pNext ); - private: - Simstr sValue; - Simstr sKey; - HeapItem * pNext; -}; - - - - - - -#endif - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/support/list.hxx b/xml2cmp/source/support/list.hxx deleted file mode 100644 index 6de123e29..000000000 --- a/xml2cmp/source/support/list.hxx +++ /dev/null @@ -1,250 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __LISTEN_123456__ -#define __LISTEN_123456__ - -#include <string.h> -#include <iostream> -#include <stdlib.h> - -template <class XX> -class List -{ - public : - typedef XX * iterator; - typedef const XX * const_iterator; - - // LIFECYCLE - List(); - virtual ~List() { delete [] inhalt; } - - // OPERATORS - const XX & operator[]( - unsigned n) const - { return elem(n); } - XX & operator[]( - unsigned n) - { return elem(n); } - // OPERATIONS - void reserve( - unsigned i_nSize ) - { alloc(i_nSize,true); } - virtual void insert( - unsigned pos, - const XX & elem ); - void push_back( - const XX & elem_) - { insert(size(),elem_); } - - virtual void remove( - unsigned pos ); - void pop_back() { remove(size()-1); } - void erase_all() { while (size()) remove(size()-1); } - - // INQUIRY - const XX & front() const { return elem(0); } - const XX & back() const { return elem(len-1); } - - unsigned size() const { return len; } - unsigned space() const { return allocated; } - // ACCESS - XX & front() { return elem(0); } - XX & back() { return elem(len-1); } - - protected: - void checkSize( - unsigned newLength); - void alloc( - unsigned newSpace, - bool re = false ); - - const XX & elem( - unsigned n ) const - { return inhalt[n]; } - XX & elem( - unsigned n ) - { return inhalt[n]; } - // DATA - XX * inhalt; - unsigned len; - unsigned allocated; - - private: - // forbidden functions - List(const List<XX> & L); - List<XX> & operator=( - const List<XX> & L); - -}; - -template <class XY> -class DynamicList : public List<XY*> -{ - public: - virtual ~DynamicList(); - - virtual void insert( - unsigned pos, - XY * const & elem ); - virtual void remove( - unsigned pos ); -}; - - - -template <class XX> -List<XX>::List() - : inhalt(0), - len(0), - allocated(0) - -{ - alloc(1); -} - - -template <class XX> -void -List<XX>::insert(unsigned pos, const XX & elem_) -{ - if ( pos > len ) - return; - - checkSize(len+2); - for ( unsigned p = len; p > pos; --p) - { - inhalt[p] = inhalt[p-1]; - } - inhalt[pos] = elem_; - len++; -} - - -template <class XX> -void -List<XX>::remove(unsigned pos) -{ - if ( pos >= len ) - return; - len--; - for ( unsigned p = pos; p < len; ++p) - { - inhalt[p] = inhalt[p+1]; - } -} - - -// Protected: -template <class XX> -void -List<XX>::checkSize(unsigned newLength) -{ - // test new size requirement: - unsigned newSpace = space(); - if (newLength > newSpace) - { - if (!newSpace) - newSpace = 1; - const unsigned nBorder = 65536 / 2; - while(newLength > newSpace) - { - if (newSpace < nBorder) - newSpace <<= 1; - else - { - std::cerr << "List becomes too big" << std::endl; - exit(1); - } - } - } - - // change? - if (newSpace != space()) - alloc(newSpace,true); -} - -template <class XX> -void -List<XX>::alloc( unsigned newSpace, - bool re ) -{ - XX * pNew = new XX[newSpace]; - - if (inhalt != 0) - { - if (re) - { - for (unsigned i = 0; i < len; ++i) - { - pNew[i] = inhalt[i]; - } // end for - } - delete [] inhalt; - } - - inhalt = pNew; - allocated = newSpace; -} - - -template <class XY> -DynamicList<XY>::~DynamicList() -{ - this->erase_all(); -} - -template <class XY> -void -DynamicList<XY>::insert(unsigned pos, XY * const & elem_) -{ - if ( pos > this->len ) - return; - - checkSize(this->len+2); - memmove(this->inhalt[pos+1], this->inhalt[pos], (this->len-pos) * sizeof(XY*) ); - this->inhalt[pos] = elem_; - this->len++; -} - -template <class XY> -void -DynamicList<XY>::remove( unsigned pos ) -{ - if (pos >= this->len) - return; - this->len--; - delete this->inhalt[pos]; - memmove(this->inhalt[pos], this->inhalt[pos+1], (this->len-pos) * sizeof(XY*) ); -} - - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/support/makefile.mk b/xml2cmp/source/support/makefile.mk deleted file mode 100644 index 4c243174c..000000000 --- a/xml2cmp/source/support/makefile.mk +++ /dev/null @@ -1,57 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org 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 Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=xml2cmp -TARGET=x2c_support -TARGETTYPE=CUI - -# --- Settings ----------------------------------------------------- - -ENABLE_EXCEPTIONS=TRUE - -.INCLUDE : settings.mk - -.IF "$(CROSS_COMPILING)"=="YES" -all: - @echo Nothing done when cross-compiling -.ENDIF - -# --- Files -------------------------------------------------------- - -OBJFILES= \ - $(OBJ)$/cmdline.obj \ - $(OBJ)$/heap.obj \ - $(OBJ)$/sistr.obj \ - $(OBJ)$/syshelp.obj \ - $(OBJ)$/badcast.obj - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - diff --git a/xml2cmp/source/support/sistr.cxx b/xml2cmp/source/support/sistr.cxx deleted file mode 100644 index f7031c213..000000000 --- a/xml2cmp/source/support/sistr.cxx +++ /dev/null @@ -1,402 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include <sistr.hxx> - -// The following two header-files declare -// standard ANSI-C++ functions. They may be replaced -// by the corresponding header-file-names of the -// actually used runtime library. -#include <string.h> // strlen(), memcpy(), memset() -#include <ctype.h> // tolower() -#include <limits.h> // INT_MAX - -#if (_MSC_VER >=1400) -#pragma warning(disable:4365) -#endif - -const char NULCH = '\0'; -const int NO_POS = -1; - - -Simstr::Simstr(const char * str_) -{ - if (str_ == 0) - { - len = 0; - sz = new char[1]; - *sz = 0; - } - else - { - len = strlen(str_); - sz = new char[len+1]; - memcpy(sz,str_,len+1); - } -} - -Simstr::Simstr( const char * anybytes, - int firstBytesPos, - int nrOfBytes) -{ - unsigned slen = strlen(anybytes); - if (anybytes == 0 || slen <= unsigned(firstBytesPos)) - { - len = 0; - sz = new char[1]; - *sz = 0; - } - else - { - int maxLen = slen - unsigned(firstBytesPos); - len = maxLen < nrOfBytes - ? maxLen - : nrOfBytes; - sz = new char[len+1]; - memcpy(sz,anybytes+firstBytesPos,len); - *(sz+len) = 0; - } -} - - -Simstr::Simstr(const Simstr & S) -{ - len = S.len; - sz = new char[len+1]; - memcpy(sz,S.sz,len+1); -} - -Simstr & Simstr::operator=(const Simstr & S) -{ - if (sz == S.sz) - return *this; - - delete [] sz; - - len = S.len; - sz = new char[len+1]; - memcpy(sz,S.sz,len+1); - - return *this; -} - -Simstr::~Simstr() -{ - delete [] sz; -} - -Simstr -Simstr::operator+(const Simstr & S) const -{ - Simstr ret = sz; - ret.push_back(S); - return ret; -} - -Simstr & -Simstr::operator+=(const Simstr & S) -{ - push_back(S); - return *this; -} - - -// REL - -bool -Simstr::operator==(const Simstr & S) const -{ return !strcmp(sz,S.sz) ? true : false; } - -bool -Simstr::operator!=(const Simstr & S) const -{ return strcmp(sz,S.sz) ? true : false; } - -bool -Simstr::operator<(const Simstr & S) const -{ return (strcmp(sz,S.sz) < 0) ? true : false; } - -bool -Simstr::operator>(const Simstr & S) const -{ return (strcmp(sz,S.sz) > 0) ? true : false; } - -bool -Simstr::operator<=(const Simstr & S) const -{ return (strcmp(sz,S.sz) <= 0) ? true : false; } - -bool -Simstr::operator>=(const Simstr & S) const -{ return (strcmp(sz,S.sz) >= 0) ? true : false; } - - - - -// ************** LIST - Funktionen ***************** - -// Insert - -void -Simstr::push_front(char c) -{ - char * result = new char[len+2]; - - result[0] = c; - memcpy(result+1,sz,len+1); - - delete [] sz; - sz = result; - len++; -} - -void -Simstr::push_back(char c) -{ - char * result = new char[len+2]; - - memcpy(result,sz,len); - result[len] = c; - result[len+1] = 0; - - delete [] sz; - sz = result; - len++; -} - -void -Simstr::push_front(const Simstr & S) -{ - char * result = new char[len+1+S.len]; - - memcpy(result,S.sz,S.len); - memcpy(result+S.len,sz,len+1); - - delete [] sz; - sz = result; - len += S.len; -} - -void -Simstr::push_back(const Simstr & S) -{ - char * result = new char[len+1+S.len]; - - memcpy(result,sz,len); - memcpy(result+len,S.sz,S.len+1); - - delete [] sz; - sz = result; - len += S.len; -} - - -// Remove - -void -Simstr::remove(int pos, int anzahl) -{ - if (pos >= len || pos < 0 || anzahl < 1) - return; - - int anz = len - pos < anzahl ? len - pos : anzahl; - - char * result = new char[len-anz+1]; - - memcpy(result,sz,pos); - memcpy(result+pos,sz+pos+anz,len-pos-anz+1); - - delete [] sz; - sz = result; - len -= anz; -} - -void -Simstr::remove_trailing_blanks() -{ - int newlen = len-1; - for ( ; newlen > 1 && sz[newlen] <= 32; --newlen ) {} - - if (newlen < len-1) - remove ( newlen+1, len-newlen); -} - -// Find - -int -Simstr::pos_first(char c) const -{ - int i = 0; - for (i = 0; i < len ? sz[i] != c : false; i++) ; - if (i >= len) - return NO_POS; - else - return i; -} - -int -Simstr::pos_last(char c) const -{ - int i = 0; - for (i = len-1; i >= 0 ? sz[i] != c : false; i--) ; - if (i < 0) - return NO_POS; - else - return i; -} - -bool -Simstr::is_no_text() const -{ - if (!len) - return true; - - int i; - for (i = 0; sz[i] <= 32 && i < len; i++) ; - if (i < len) - return false; - return true; -} - -// Change - -void -Simstr::replace_all(char oldCh, char newCh) -{ - for (int i=0; i < len; i++) - if (sz[i] == oldCh) - sz[i] = newCh; -} - -// Simstr addition -Simstr -operator+(const char * str, const Simstr & S) -{ - Simstr ret = S; - ret.push_front(str); - return ret; -} - -Simstr -operator+(const Simstr & S, const char * str) -{ - Simstr ret = S; - ret.push_back(str); - return ret; -} - -Simstr -operator+(char c, const Simstr & S) -{ - Simstr ret = S; - ret.push_front(c); - return ret; -} - -Simstr -operator+(const Simstr & S, char c) -{ - Simstr ret = S; - ret.push_back(c); - return ret; -} - - -// Simstr-Vergleiche mit char * -bool -operator==(const Simstr & S, const char * str) -{ - return strcmp(S,str) == 0; -} - -bool -operator!=(const Simstr & S, const char * str) -{ - return strcmp(S,str) != 0; -} - -bool -operator<(const Simstr & S, const char * str) -{ - return strcmp(S,str) < 0; -} - -bool -operator>(const Simstr & S, const char * str) -{ - return strcmp(S,str) > 0; -} - -bool -operator<=(const Simstr & S, const char * str) -{ - return strcmp(S,str) <= 0; -} - -bool -operator>=(const Simstr & S, const char * str) -{ - return strcmp(S,str) >= 0; -} - -bool -operator==(const char * str, const Simstr & S) -{ - return strcmp(str,S) == 0; -} - -bool -operator!=(const char * str, const Simstr & S) -{ - return strcmp(str,S) != 0; -} - -bool -operator<(const char * str, const Simstr & S) -{ - return strcmp(str,S) < 0; -} - -bool -operator>(const char * str, const Simstr & S) -{ - return strcmp(str,S) > 0; -} - -bool -operator<=(const char * str, const Simstr & S) -{ - return strcmp(str,S) <= 0; -} - -bool -operator>=(const char * str, const Simstr & S) -{ - return strcmp(str,S) >= 0; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/support/sistr.hxx b/xml2cmp/source/support/sistr.hxx deleted file mode 100644 index deb7d6e81..000000000 --- a/xml2cmp/source/support/sistr.hxx +++ /dev/null @@ -1,150 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef XML2CMP_SISTR_HXX -#define XML2CMP_SISTR_HXX - - -class Simstr -{ -// INTERFACE - public: - // Constructors, destructor, '=' and typecasts - Simstr( - const char * str = 0); - Simstr( // Creates Simstr out of a copy of the described bytes within 'anyBytes'. - // Adds a '\0' at the end. - const char * anybytes, - int firstBytesPos, - int nrOfBytes); - virtual ~Simstr(); - Simstr( - const Simstr & S); - Simstr & operator=( - const Simstr & S); - operator const char*() const; - - // diverse utility functions - const char * str() const { return sz; } - char * s(); // CAUTION!!! // Only use when a function needs a 'char*' but - // still will NOT MODIFY THE STRING! - // Typecasts to 'const char*' are performed automatically. - int l() const; // Length of string without '\0' at end. - Simstr operator+( - const Simstr & S) const; - Simstr & operator+=( - const Simstr & S); - - // comparison operators - bool operator==( - const Simstr & S) const; - bool operator!=( - const Simstr & S) const; - bool operator<( - const Simstr & S) const; - bool operator>( - const Simstr & S) const; - bool operator<=( - const Simstr & S) const; - bool operator>=( - const Simstr & S) const; - - - // 'List of characters' - functions - // insert - functions - void push_front( - char c); - void push_back( - char c); - void push_front( - const Simstr & S); - void push_back( - const Simstr & S); - // remove - functions - void remove( - int pos, - int anzahl = 1); - void remove_trailing_blanks(); - - // search functions - int pos_first( - char c) const; - int pos_last( - char c) const; - bool is_empty() const; // Only true if object == "". - bool is_no_text() const; // String may contain spaces or tabs. - - // substitution functions - void replace_all( - char oldCh, - char newCh); - // token functions - // get...-functions return the token, separated by char 'c' and leave the object unchanged. - // take...-functions return the same, but remove the token and the corresponding separator from the object. - Simstr get_last_token( - char c) const; - - private: - char * sz; - int len; -}; - -// Simstr - char* / char - concatenations -Simstr operator+(const char * str, const Simstr & S); -Simstr operator+(const Simstr & S, const char * str); -Simstr operator+(char c, const Simstr & S); -Simstr operator+(const Simstr & S, char c); - -// Simstr - char* - comparison operators -bool operator==(const Simstr & S, const char * str); -bool operator!=(const Simstr & S, const char * str); -bool operator<(const Simstr & S, const char * str); -bool operator>(const Simstr & S, const char * str); -bool operator<=(const Simstr & S, const char * str); -bool operator>=(const Simstr & S, const char * str); -bool operator==(const char * str, const Simstr & S); -bool operator!=(const char * str, const Simstr & S); -bool operator<(const char * str, const Simstr & S); -bool operator>(const char * str, const Simstr & S); -bool operator<=(const char * str, const Simstr & S); -bool operator>=(const char * str, const Simstr & S); - - -inline char * -Simstr::s() { return sz; } -inline int -Simstr::l() const { return len; } -inline -Simstr::operator const char*() const { return sz; } -inline bool -Simstr::is_empty() const { return len == 0; } - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/support/syshelp.cxx b/xml2cmp/source/support/syshelp.cxx deleted file mode 100644 index 60ec2f08a..000000000 --- a/xml2cmp/source/support/syshelp.cxx +++ /dev/null @@ -1,316 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include <syshelp.hxx> - - -// NOT FULLY DEFINED SERVICES -#include <string.h> -#include "sistr.hxx" -#include "list.hxx" - -#ifdef WNT -#include <io.h> -#elif defined(UNX) -#include <sys/types.h> -#include <sys/stat.h> -#include <dirent.h> -#define stricmp strcasecmp -#else -#error Must run under unix or windows, please define UNX or WNT. -#endif - - -char C_sSpaceInName[] = " "; - -void -WriteName( std::ostream & o_rFile, - const Simstr & i_rIdlDocuBaseDir, - const Simstr & i_rName, - E_LinkType i_eLinkType ) -{ - if (i_rName.l() == 0) - return; - - - const char * pNameEnd = strstr( i_rName.str(), " in " ); - - // No link: - if ( i_eLinkType == lt_nolink ) - { - if ( pNameEnd != 0 ) - { - const char * pStart = i_rName.str(); - o_rFile.write( pStart, pNameEnd - pStart ); - WriteStr( o_rFile, C_sSpaceInName ); - WriteStr( o_rFile, pNameEnd ); - } - else - { - WriteStr( o_rFile, i_rName ); - } - return; - } - - if ( i_eLinkType == lt_idl ) - { - Simstr sPath(i_rName); - sPath.replace_all('.','/'); - int nNameEnd = sPath.pos_first(' '); - int nPathStart = sPath.pos_last(' '); - WriteStr( o_rFile, "<A HREF=\"" ); - - if ( nNameEnd > -1 ) - { - WriteStr( o_rFile, "file:///" ); - WriteStr( o_rFile, i_rIdlDocuBaseDir ); - WriteStr( o_rFile, "/" ); - WriteStr( o_rFile, sPath.str() + 1 + nPathStart ); - WriteStr( o_rFile, "/" ); - o_rFile.write( sPath.str(), nNameEnd ); - WriteStr( o_rFile, ".html\">" ); - } - else - { // Should not be reached: - WriteStr(o_rFile, i_rName); - return; - } - } - else if ( i_eLinkType == lt_html ) - { - int nKomma = i_rName.pos_first(','); - int nEnd = i_rName.pos_first(' '); - if ( nKomma > -1 ) - { - o_rFile.write( i_rName.str(), nKomma ); - WriteStr( o_rFile, ": " ); - - WriteStr( o_rFile, "<A HREF=\"" ); - - o_rFile.write( i_rName.str(), nKomma ); - WriteStr( o_rFile, ".html#" ); - if ( nEnd > -1 ) - o_rFile.write( i_rName.str() + nKomma + 1, nEnd - nKomma ); - else - WriteStr( o_rFile, i_rName.str() + nKomma + 1 ); - WriteStr( o_rFile, "\">" ); - - o_rFile.write( i_rName.str() + nKomma + 1, nEnd - nKomma ); - } - else - { - WriteStr( o_rFile, "<A HREF=\"" ); - WriteStr( o_rFile, i_rName ); - WriteStr( o_rFile, ".html\">" ); - - WriteStr( o_rFile, i_rName ); - } - WriteStr( o_rFile, "</A>" ); - return; - } - - if ( pNameEnd != 0 ) - { - const char * pStart = i_rName.str(); - if ( pNameEnd > pStart ) - o_rFile.write( pStart, pNameEnd - pStart ); - WriteStr( o_rFile, "</A>" ); - - WriteStr( o_rFile, C_sSpaceInName ); - WriteStr( o_rFile, pNameEnd ); - } - else - { - WriteStr( o_rFile, i_rName ); - WriteStr( o_rFile, "</A>" ); - } -} - - -void -WriteStr( std::ostream & o_rFile, - const char * i_sStr ) -{ - o_rFile.write( i_sStr, (int) strlen(i_sStr) ); -} - -void -WriteStr( std::ostream & o_rFile, - const Simstr & i_sStr ) -{ - o_rFile.write( i_sStr.str(), i_sStr.l() ); -} - - -const char C_sXML_END[] = "\\*.xml"; - -void -GatherFileNames( List<Simstr> & o_sFiles, - const char * i_sSrcDirectory ) -{ - static int nAliveCounter = 0; - - char * sNextDir = 0; - Simstr sNew = 0; - -#ifdef WNT - struct _finddata_t aEntry; - long hFile = 0; - int bFindMore = 0; - char * sFilter = new char[ strlen(i_sSrcDirectory) + sizeof C_sXML_END ]; - - // Stayingalive sign - if (++nAliveCounter % 100 == 1) - std::cout << "." << std::flush; - - strcpy(sFilter, i_sSrcDirectory); // STRCPY SAFE HERE - strcat(sFilter,C_sXML_END); // STRCAT SAFE HERE - - hFile = _findfirst( sFilter, &aEntry ); - for ( bFindMore = hFile == -1; - bFindMore == 0; - bFindMore = _findnext( hFile, &aEntry ) ) - { - sNew = i_sSrcDirectory; - sNew += "\\"; - sNew += aEntry.name; - o_sFiles.push_back(sNew); - } // end for - - _findclose(hFile); - delete [] sFilter; -#elif defined(UNX) - DIR * pDir = opendir( i_sSrcDirectory ); - dirent * pEntry = 0; - char * sEnding; - - // Stayingalive sign - if (++nAliveCounter % 100 == 1) - std::cout << "." << std::flush; - - while ( (pEntry = readdir(pDir)) != 0 ) - { - sEnding = strrchr(pEntry->d_name,'.'); - if (sEnding != 0 ? stricmp(sEnding,".xml") == 0 : 0 ) - { - sNew = i_sSrcDirectory; - sNew += "/"; - sNew += pEntry->d_name; - o_sFiles.push_back(sNew); - } - } // end while - - closedir( pDir ); -#else -#error Must run on unix or windows, please define UNX or WNT. -#endif - - // gathering from subdirectories: - List<Simstr> aSubDirectories; - GatherSubDirectories( aSubDirectories, i_sSrcDirectory ); - - unsigned d_max = aSubDirectories.size(); - for ( unsigned d = 0; d < d_max; ++d ) - { - sNextDir = new char[ strlen(i_sSrcDirectory) + 2 + aSubDirectories[d].l() ]; - - strcpy(sNextDir, i_sSrcDirectory); - strcat(sNextDir, C_sSLASH); - strcat(sNextDir, aSubDirectories[d].str()); - GatherFileNames(o_sFiles, sNextDir); - - delete [] sNextDir; - } -} - - -const char * C_sANYDIR = "\\*.*"; - -void -GatherSubDirectories( List<Simstr> & o_sSubDirectories, - const char * i_sParentdDirectory ) -{ - Simstr sNew; - -#ifdef WNT - struct _finddata_t aEntry; - long hFile = 0; - int bFindMore = 0; - char * sFilter = new char[strlen(i_sParentdDirectory) + sizeof C_sANYDIR]; - - strcpy(sFilter, i_sParentdDirectory); - strcat(sFilter,C_sANYDIR); - - hFile = _findfirst( sFilter, &aEntry ); - for ( bFindMore = hFile == -1; - bFindMore == 0; - bFindMore = _findnext( hFile, &aEntry ) ) - { - if (aEntry.attrib == _A_SUBDIR) - { - // Do not gather . .. and outputtree directories - if ( strchr(aEntry.name,'.') == 0 - && strncmp(aEntry.name, "wnt", 3) != 0 - && strncmp(aEntry.name, "unx", 3) != 0 ) - { - sNew = aEntry.name; - o_sSubDirectories.push_back(sNew); - } - } // endif (aEntry.attrib == _A_SUBDIR) - } // end for - _findclose(hFile); - delete [] sFilter; - -#elif defined(UNX) - DIR * pDir = opendir( i_sParentdDirectory ); - dirent * pEntry = 0; - struct stat aEntryStatus; - - while ( ( pEntry = readdir(pDir) ) != 0 ) - { - stat(pEntry->d_name, &aEntryStatus); - if ( ( aEntryStatus.st_mode & S_IFDIR ) == S_IFDIR ) - { - // Do not gather . .. and outputtree directories - if ( strchr(pEntry->d_name,'.') == 0 - && strncmp(pEntry->d_name, "wnt", 3) != 0 - && strncmp(pEntry->d_name, "unx", 3) != 0 ) - { - sNew = pEntry->d_name; - o_sSubDirectories.push_back(sNew); - } - } // endif (aEntry.attrib == _A_SUBDIR) - } // end while - closedir( pDir ); -#else -#error Must run on unix or windows, please define UNX or WNT. -#endif -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/support/syshelp.hxx b/xml2cmp/source/support/syshelp.hxx deleted file mode 100644 index 72751d8d5..000000000 --- a/xml2cmp/source/support/syshelp.hxx +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef X2C_SYSHELP_HXX -#define X2C_SYSHELP_HXX - - - -// USED SERVICES - // BASE CLASSES - // COMPONENTS - // PARAMETERS -#include <iosfwd> - -class Simstr; -template <class XY> class List; - - -#if defined(WNT) -const char C_sSLASH[] = "\\"; -const char C_cSLASH = '\\'; -#elif defined(UNX) -const char C_sSLASH[] = "/"; -const char C_cSLASH = '/'; -#else -#error Must run under unix or windows, please define UNX or WNT. -#endif - -enum E_LinkType -{ - lt_nolink = 0, - lt_idl, - lt_html -}; - - -void WriteName( - std::ostream & o_rFile, - const Simstr & i_rIdlDocuBaseDir, - const Simstr & i_rName, - E_LinkType i_eLinkType ); - - -void WriteStr( - std::ostream & o_rFile, - const char * i_sStr ); -void WriteStr( - std::ostream & o_rFile, - const Simstr & i_sStr ); - -void GatherFileNames( - List<Simstr> & o_sFiles, - const char * i_sSrcDirectory ); -void GatherSubDirectories( - List<Simstr> & o_sSubDirectories, - const char * i_sParentdDirectory ); - - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/x2cclass/xml_cd.hxx b/xml2cmp/source/x2cclass/xml_cd.hxx deleted file mode 100644 index 8b71d22c0..000000000 --- a/xml2cmp/source/x2cclass/xml_cd.hxx +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef UDKSERVICE_XML_CD_HXX -#define UDKSERVICE_XML_CD_HXX - - -#include <tools/string.hxx> -#include <vector> - - - -/** Represents one Component description from an XML file. - DatumOf() is used for tags with only one value. - DataOf() is used, if the tag has multiple values or if - you don't know. -**/ -class ComponentDescription -{ - public: - /** @ATTENTION - Because the enum values are used as array indices: - tag_None must be the first and have the value "0". - tag_MAX must be the last. - The enum values must not be assigned numbers. - **/ - enum E_Tag - { - tag_None = 0, - tag_Name, - tag_Description, - tag_ModuleName, - tag_LoaderName, - tag_SupportedService, - tag_ProjectBuildDependency, - tag_RuntimeModuleDependency, - tag_ServiceDependency, - tag_Language, - tag_Status, - tag_Type, - tag_MAX - }; - - virtual ~ComponentDescription() {} - - /// @return All values of this tag. An empty vector for wrong indices. - virtual const std::vector< ByteString > & - DataOf( - ComponentDescription::E_Tag - i_eTag ) const = 0; - - /// @return The only or the first value of this tag. An empty string for wrong indices. - virtual ByteString DatumOf( - ComponentDescription::E_Tag - i_eTag ) const = 0; -}; - - -#endif - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/x2cclass/xml_cdff.cxx b/xml2cmp/source/x2cclass/xml_cdff.cxx deleted file mode 100644 index 264a65364..000000000 --- a/xml2cmp/source/x2cclass/xml_cdff.cxx +++ /dev/null @@ -1,233 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "xml_cdff.hxx" - -#include <string.h> -#include <tools/stream.hxx> -#include "xml_cdim.hxx" -#include <ctype.h> - - -typedef ComponentDescriptionImpl::ValueList CdiValueList; - -class dyn_buffer -{ - public: - dyn_buffer() : s(0) {} - ~dyn_buffer() { if (s) delete [] s; } - operator const char *() const { return s; } - char * operator->() { return s; } - char & operator[]( - INT32 ix ) { return s[ix]; } - void SetSize( - INT32 i_size ) { if (s) delete [] s; s = new char [i_size]; } - private: - char * s; -}; - - -inline BOOL -LoadXmlFile( dyn_buffer & o_rBuffer, - const UniString & i_sXmlFilePath ) -{ - BOOL ret = TRUE; - SvFileStream aXmlFile; - - aXmlFile.Open(i_sXmlFilePath, STREAM_READ); - if (aXmlFile.GetErrorCode() != FSYS_ERR_OK) - ret = FALSE; - if (ret) - { - aXmlFile.Seek(STREAM_SEEK_TO_END); - INT32 nBufferSize = aXmlFile.Tell(); - o_rBuffer.SetSize(nBufferSize + 1); - o_rBuffer[nBufferSize] = '\0'; - aXmlFile.Seek(0); - if (aXmlFile.Read(o_rBuffer.operator->(), nBufferSize) == 0) - ret = FALSE; - } - - aXmlFile.Close(); - return ret; -} - - - -CompDescrsFromAnXmlFile::CompDescrsFromAnXmlFile() - : dpDescriptions(new std::vector< ComponentDescriptionImpl* >), - eStatus(not_yet_parsed) -{ - dpDescriptions->reserve(3); -} - -CompDescrsFromAnXmlFile::~CompDescrsFromAnXmlFile() -{ - Empty(); - delete dpDescriptions; -} - - -BOOL -CompDescrsFromAnXmlFile::Parse( const UniString & i_sXmlFilePath ) -{ - dyn_buffer dpBuffer; - - if (! LoadXmlFile(dpBuffer,i_sXmlFilePath) ) - { - eStatus = cant_read_file; - return FALSE; - } - - const char * pTokenStart = 0; - const char * pBufferPosition = dpBuffer; - INT32 nTokenLength = 0; - BOOL bWithinElement = FALSE; - - CdiValueList * pCurTagData = 0; - ByteString sStatusValue; // Used only if a <Status ...> tag is found. - - - for ( ComponentDescriptionImpl::ParseUntilStartOfDescription(pBufferPosition); - pBufferPosition != 0; - ComponentDescriptionImpl::ParseUntilStartOfDescription(pBufferPosition) ) - { - ComponentDescriptionImpl * pCurCD = 0; - pCurCD = new ComponentDescriptionImpl; - dpDescriptions->push_back(pCurCD); - - for ( ; *pBufferPosition != '\0' && pCurCD != 0; ) - { - switch (*pBufferPosition) - { - case '<' : - if (! bWithinElement) - { - pCurTagData = pCurCD->GetBeginTag(sStatusValue, pBufferPosition); - if (pCurTagData != 0) - { - if (sStatusValue.Len () == 0) - { - // Start new token: - pTokenStart = pBufferPosition; - nTokenLength = 0; - bWithinElement = TRUE;; - } - else - { - // Status tag is already parsed: - pCurTagData->push_back(sStatusValue); - } // endif (sStatusValue.Length () == 0) - } - else if ( ComponentDescriptionImpl::CheckEndOfDescription(pBufferPosition) ) - { - pBufferPosition += ComponentDescriptionImpl::DescriptionEndTagSize(); - pCurCD = 0; - } - else - { - eStatus = inconsistent_file; - return FALSE; - } // endif (pCurTagData != 0) elseif() else - } - else if ( pCurTagData->MatchesEndTag(pBufferPosition) ) - { - // Finish token: - pBufferPosition += pCurTagData->EndTagLength(); - bWithinElement = FALSE; - - // Remove leading and trailing spaces: - while ( isspace(*pTokenStart) ) - { - pTokenStart++; - nTokenLength--; - } - while ( nTokenLength > 0 - && isspace(pTokenStart[nTokenLength-1]) ) - { - nTokenLength--; - } - // Add token to tag values list. - pCurTagData->push_back(ByteString(pTokenStart,nTokenLength)); - } - else - { - nTokenLength++; - ++pBufferPosition; - } // endif (!bWithinElement) else if () else - break; - default: - if (bWithinElement) - { - ++nTokenLength; - } - ++pBufferPosition; - } // end switch - } // end for - - if (bWithinElement) - { - eStatus = inconsistent_file; - return FALSE; - } - } // end for - - return TRUE; -} - -INT32 -CompDescrsFromAnXmlFile::NrOfDescriptions() const -{ - return dpDescriptions->size(); -} - -const ComponentDescription & -CompDescrsFromAnXmlFile::operator[](INT32 i_nIndex) const -{ - static const ComponentDescriptionImpl aNullDescr_; - return 0 <= i_nIndex && i_nIndex < dpDescriptions->size() - ? *(*dpDescriptions)[i_nIndex] - : aNullDescr_; -} - -void -CompDescrsFromAnXmlFile::Empty() -{ - for ( std::vector< ComponentDescriptionImpl* >::iterator aIter = dpDescriptions->begin(); - aIter != dpDescriptions->end(); - ++aIter ) - { - delete *aIter; - } - dpDescriptions->erase( dpDescriptions->begin(), - dpDescriptions->end() ); -} - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/x2cclass/xml_cdff.hxx b/xml2cmp/source/x2cclass/xml_cdff.hxx deleted file mode 100644 index 28ded806c..000000000 --- a/xml2cmp/source/x2cclass/xml_cdff.hxx +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef UDKSERVICE_XML_CDFF_HXX -#define UDKSERVICE_XML_CDFF_HXX - - -#include <tools/string.hxx> -#include "xml_cd.hxx" - -class ComponentDescriptionImpl; - - -/** @descr - Is able to parse an XML file with Component descriptions. Gives access - to the parsed data. - - Use: - CompDescrsFromAnXmlFile aCds; - UniString aFilepath(...); - if (! aCds.Parse(aFilepath) ) - { - // react on: - aCds.Status(); - } - - With operator[] you get access to ComponentDescriptions - on indices 0 to NrOfDescriptions()-1 . - - For further handling see class ComponentDescription - in xml_cd.hxx . - - It is possible to parse more than one time. Then the old data - are discarded. -**/ -class CompDescrsFromAnXmlFile -{ - public: - enum E_Status - { - ok = 0, - not_yet_parsed, - cant_read_file, - inconsistent_file, - no_tag_found_in_file - }; - - // LIFECYCLE - CompDescrsFromAnXmlFile(); - ~CompDescrsFromAnXmlFile(); - - // OPERATIONS - BOOL Parse( - const UniString & i_sXmlFilePath ); - - // INQUIRY - INT32 NrOfDescriptions() const; - const ComponentDescription & - operator[]( /// @return an empty description, if index does not exist. - INT32 i_nIndex ) const; - CompDescrsFromAnXmlFile::E_Status - Status() const; - - private: - // PRIVATE SERVICES - void Empty(); - - // DATA - std::vector< ComponentDescriptionImpl* > * - dpDescriptions; - E_Status eStatus; -}; - - - - - -#endif - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/x2cclass/xml_cdim.cxx b/xml2cmp/source/x2cclass/xml_cdim.cxx deleted file mode 100644 index 24546691c..000000000 --- a/xml2cmp/source/x2cclass/xml_cdim.cxx +++ /dev/null @@ -1,185 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "xml_cdim.hxx" - -const char ComponentDescriptionImpl::C_sTagDescription[] - = "COMPONENTDESCRIPTION"; -const char ComponentDescriptionImpl::C_sStatus[] - = "Status"; -const char * ComponentDescriptionImpl::C_sSubTags[ComponentDescription::tag_MAX] - = { "None", - "Name", - "Description", - "ModuleName", - "LoaderName", - "SupportedService", - "ProjectBuildDependency", - "RuntimeModuleDependency", - "ServiceDependency", - "Language", - C_sStatus, - "Type" - }; - -ComponentDescriptionImpl::ComponentDescriptionImpl() -// : aTags -{ - const int i_max = tag_MAX; - aTags.reserve(i_max); - - for (int i = 0; i < i_max; ++i) - { - aTags.push_back( new ValueList(E_Tag(i)) ); - } // end for -} - -ComponentDescriptionImpl::~ComponentDescriptionImpl() -{ - for ( std::vector< ValueList* >::iterator aIter = aTags.begin(); - aIter != aTags.end(); - ++aIter ) - { - delete *aIter; - } -} - -inline void -GetStatusValue( ByteString & o_sValue, const ByteString & i_sStatusTag ) -{ - // o_sValue is always == "" at the beginning. - - const char * pStatusValue = strchr(i_sStatusTag.GetBuffer(), '"'); - if (pStatusValue == 0) - return; - pStatusValue++; - const char * pStatusValueEnd = strrchr(pStatusValue,'"'); - if (pStatusValueEnd == 0 || pStatusValueEnd - pStatusValue < 1) - return ; - - ByteString sValue(pStatusValue, pStatusValueEnd - pStatusValue); - o_sValue = sValue; -} - -ComponentDescriptionImpl::ValueList * -ComponentDescriptionImpl::GetBeginTag( ByteString & o_sValue, - const char *& io_pStartOfTag ) const -{ - o_sValue = ""; - - const char * pCurTextEnd = strchr(io_pStartOfTag,'>'); - if ( 0 == pCurTextEnd ) - return 0; - - if ( ComponentDescriptionImpl::CheckEndOfDescription(io_pStartOfTag) ) - return 0; - - ByteString sTag(io_pStartOfTag + 1, pCurTextEnd - io_pStartOfTag - 1); - io_pStartOfTag += sTag.Len() + 2; - - // Special case <Status ... > - if ( strnicmp(C_sStatus, sTag.GetBuffer(), (sizeof C_sStatus) - 1 ) == 0 ) - { - GetStatusValue(o_sValue,sTag); - return aTags[tag_Status]; - } - - // Regular seeking for matching data list: - for ( INT32 i = 0; i < tag_MAX; i++ ) - { - if ( 0 == stricmp(sTag.GetBuffer(), C_sSubTags[i]) ) - return aTags[i]; - } // end for - - return 0; -} - -const std::vector< ByteString > & -ComponentDescriptionImpl::DataOf( ComponentDescriptionImpl::E_Tag i_eTag ) const -{ - if (0 < i_eTag && i_eTag < tag_MAX) - return *aTags[i_eTag]; - else - return ValueList::Null_(); -} - -ByteString -ComponentDescriptionImpl::DatumOf( ComponentDescriptionImpl::E_Tag i_eTag ) const -{ - if (0 < i_eTag && i_eTag < tag_MAX) - { - ValueList & rValues = *aTags[i_eTag]; - if (rValues.size() > 0) - return rValues[0]; - } - return ""; -} - -void -ComponentDescriptionImpl::ParseUntilStartOfDescription( const char * & io_pBufferPosition ) -{ - for ( const char * pSearch = strchr(io_pBufferPosition,'<'); - pSearch != 0; - pSearch = strchr(pSearch+1,'<') ) - { - if ( pSearch != io_pBufferPosition - && 0 == strnicmp(pSearch+1,C_sTagDescription, strlen(C_sTagDescription)) - && *(pSearch + strlen(C_sTagDescription) + 1) == '>' ) - { - io_pBufferPosition = pSearch + strlen(C_sTagDescription) + 2; - return; - } - } // end for - - io_pBufferPosition = 0; -} - -BOOL -ComponentDescriptionImpl::ValueList::MatchesEndTag( const char * i_pTextPosition ) const -{ - return strnicmp( i_pTextPosition+2, C_sSubTags[eTag], strlen(C_sSubTags[eTag]) ) == 0 - && strncmp(i_pTextPosition,"</",2) == 0 - && *(i_pTextPosition + 2 + strlen(C_sSubTags[eTag]) ) == '>'; -} - -INT32 -ComponentDescriptionImpl::ValueList::EndTagLength() const -{ - return strlen(C_sSubTags[eTag]) + 3; -} - - -const ComponentDescriptionImpl::ValueList & -ComponentDescriptionImpl::ValueList::Null_() -{ - static const ValueList aNull_(ComponentDescription::tag_None); - return aNull_; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/x2cclass/xml_cdim.hxx b/xml2cmp/source/x2cclass/xml_cdim.hxx deleted file mode 100644 index e7656b6c2..000000000 --- a/xml2cmp/source/x2cclass/xml_cdim.hxx +++ /dev/null @@ -1,115 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef UDKSERVICE_XML_CDIM_HXX -#define UDKSERVICE_XML_CDIM_HXX - - -#include "xml_cd.hxx" -#include <tools/string.hxx> - - - - - -/** Represents one of the Component descriptions in an XML file. - Implements ComponentDescription and does part of the parsing for class CompDescrsFromAnXmlFile. -**/ -class ComponentDescriptionImpl : public ComponentDescription -{ - public: - class ValueList : public std::vector< ByteString > - { - public: - // LIFECYCLE - ValueList( - E_Tag i_eTag ) - : eTag(i_eTag) {} - // INQUIRY - const char * BeginTag() const; - BOOL MatchesEndTag( - const char * i_pTextPosition ) const; - INT32 EndTagLength() const; - - static const ValueList & - Null_(); - private: - E_Tag eTag; - }; - - // LIFECYCLE - ComponentDescriptionImpl(); - virtual ~ComponentDescriptionImpl(); - - // OPERATIONS - ValueList * GetBeginTag( - ByteString & o_sValue, - const char * & io_pStartOfTag ) const; - static void ParseUntilStartOfDescription( - const char * & io_pBufferPosition ); - static BOOL CheckEndOfDescription( - const char * & io_pBufferPosition ); - // INQUIRY - static INT32 DescriptionEndTagSize(); - - // INTERFACE ComponentDescription - // INQUIRY - virtual const std::vector< ByteString > & - DataOf( /// @return All values of this tag. - ComponentDescription::E_Tag - i_eTag ) const; - virtual ByteString DatumOf( /// @return The only or the first value of this tag. - ComponentDescription::E_Tag - i_eTag ) const; - private: - // DATA - static const char C_sTagDescription[]; - static const char C_sStatus[]; - static const char * C_sSubTags[ComponentDescription::tag_MAX]; - friend class ValueList; - - std::vector< ValueList* > // Dynamic allocated pointers. - aTags; -}; - - -inline BOOL -ComponentDescriptionImpl::CheckEndOfDescription( const char * & io_pBufferPosition ) - { return strnicmp(io_pBufferPosition + 2, C_sTagDescription, strlen(C_sTagDescription)) == 0 - && strncmp(io_pBufferPosition, "</", 2) == 0 - && * (io_pBufferPosition + 2 + strlen(C_sTagDescription)) == '>'; } - -inline INT32 -ComponentDescriptionImpl::DescriptionEndTagSize() - { return strlen(C_sTagDescription) + 3; } - - -#endif - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/cr_html.cxx b/xml2cmp/source/xcd/cr_html.cxx deleted file mode 100644 index 334c322e9..000000000 --- a/xml2cmp/source/xcd/cr_html.cxx +++ /dev/null @@ -1,270 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <fstream> -#include "cr_html.hxx" -#include "xmltree.hxx" -#include "../support/syshelp.hxx" - - - - -char C_sHtmlFileHeader1[] = - "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n" - "<HTML>\n" - "<HEAD>\n" - " <TITLE>"; - -char C_sHtmlFileHeader2[] = - "</TITLE>\n" - " <META NAME=\"GENERATOR\" CONTENT=\"xml2cmp\">\n" - "</HEAD>\n" - "<BODY BGCOLOR=\"#ffffff\">\n<P><BR></P>"; - - -char C_sHtmlFileFoot[] = "</BODY>\n</HTML>\n"; - - -HtmlCreator::HtmlCreator( const char * i_pOutputFileName, - const XmlElement & i_rDocument, - const Simstr & i_sIDL_BaseDirectory ) - : aFile(i_pOutputFileName, std::ios::out -#if defined(WNT) - | std::ios::binary -#endif - ), - rDocument(i_rDocument), - sIdl_BaseDirectory(i_sIDL_BaseDirectory) -{ - if ( !aFile ) - { - std::cerr << "Error: " << i_pOutputFileName << " could not be created." << std::endl; - exit(0); - } -} - -HtmlCreator::~HtmlCreator() -{ - aFile.close(); -} - -void -HtmlCreator::Run() -{ - WriteStr( C_sHtmlFileHeader1 ); - WriteStr( "ModuleDescription" ); - WriteStr( C_sHtmlFileHeader2 ); - - rDocument.Write2Html(*this); - - WriteStr( "<P><BR><BR></P>\n" ); - WriteStr( C_sHtmlFileFoot ); -} - -void -HtmlCreator::StartTable() -{ - WriteStr( "<P><BR></P>\n" ); - WriteStr( - "<TABLE WIDTH=95% BORDER=1 CELLSPACING=0 CELLPADDING=4>\n" - " <TBODY>\n" ); -} - -void -HtmlCreator::FinishTable() -{ - WriteStr( " </TBODY>\n" - "</TABLE>\n\n" ); -} - -void -HtmlCreator::StartBigCell( const char * i_sTitle ) -{ - WriteStr( "<TR><TD COLSPAN=2>\n" - "<H4><BR>" ); - WriteStr( i_sTitle ); - WriteStr( "</H4>\n" ); - -} - -void -HtmlCreator::FinishBigCell() -{ - WriteStr( "</TD><TR>\n" ); -} - -void -HtmlCreator::Write_SglTextElement( const SglTextElement & i_rElement, - bool i_bStrong ) -{ - StartRow(); - - WriteElementName( i_rElement.Name(), i_bStrong ); - - StartCell( "77%"); - if (i_bStrong) - { - WriteStr( "<H4><A NAME=\"" ); - unsigned nLen = strlen(i_rElement.Data()); - if ( i_rElement.IsReversedName()) - { - const char * pEnd = strchr(i_rElement.Data(), ' '); - nLen = (unsigned)( pEnd - i_rElement.Data() ); - } - aFile.write( i_rElement.Data(), (int) nLen ); - WriteStr( "\">" ); - } - - WriteName( aFile, sIdl_BaseDirectory, i_rElement.Data(), - i_bStrong ? lt_nolink : i_rElement.LinkType() ); - - if (i_bStrong) - WriteStr( "</A></H4>" ); - FinishCell(); - - FinishRow(); -} - -void -HtmlCreator::Write_MultiTextElement( const MultipleTextElement & i_rElement ) -{ - StartRow(); - - WriteElementName( i_rElement.Name(), false ); - - StartCell( "77%"); - unsigned i_max = i_rElement.Size(); - for ( unsigned i = 0; i < i_max; ++i ) - { - if (i > 0) - WriteStr( "<BR>\n" ); - WriteName( aFile, sIdl_BaseDirectory, i_rElement.Data(i), i_rElement.LinkType() ); - } // end for - FinishCell(); - - FinishRow(); -} - -void -HtmlCreator::Write_SglText( const Simstr & i_sName, - const Simstr & i_sValue ) -{ - StartRow(); - - WriteElementName( i_sName, false ); - - StartCell( "77%"); - WriteStr( i_sValue ); - FinishCell(); - - FinishRow(); -} - -void -HtmlCreator::Write_ReferenceDocu( const Simstr & i_sName, - const Simstr & i_sRef, - const Simstr & i_sRole, - const Simstr & i_sTitle ) -{ - StartRow(); - - StartCell( "23%" ); - WriteStr(i_sName); - FinishCell(); - - StartCell( "77%" ); - if ( !i_sRef.is_empty() ) - { - WriteStr("<A href=\""); - WriteStr(i_sRef); - WriteStr("\">"); - if ( !i_sTitle.is_empty() ) - WriteStr( i_sTitle ); - else - WriteStr(i_sRef); - WriteStr("</A><BR>\n"); - } - else if ( !i_sTitle.is_empty() ) - { - WriteStr("Title: "); - WriteStr( i_sTitle ); - WriteStr("<BR>\n"); - } - if ( !i_sRole.is_empty() ) - { - WriteStr("Role: "); - WriteStr( i_sRole ); - } - FinishCell(); - - FinishRow(); -} - - -void -HtmlCreator::StartRow() -{ - WriteStr( " <TR VALIGN=TOP>\n" ); -} - -void -HtmlCreator::FinishRow() -{ - WriteStr( " </TR>\n" ); -} - -void -HtmlCreator::StartCell( const char * i_pWidth) -{ - WriteStr( " <TD WIDTH=" ); - WriteStr( i_pWidth ); - WriteStr( ">\n <P>" ); -} - -void -HtmlCreator::FinishCell() -{ - WriteStr( "</P>\n </TD>\n" ); -} - -void -HtmlCreator::WriteElementName( const Simstr & i_sName, - bool i_bStrong ) -{ - StartCell( "23%" ); - if (i_bStrong) - WriteStr( "<H4>" ); - WriteStr(i_sName); - if (i_bStrong) - WriteStr( "</H4>" ); - FinishCell(); -} - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/cr_html.hxx b/xml2cmp/source/xcd/cr_html.hxx deleted file mode 100644 index d7e662dfa..000000000 --- a/xml2cmp/source/xcd/cr_html.hxx +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef X2C_CR_HTML_HXX -#define X2C_CR_HTML_HXX - - -#include <string.h> -#include <fstream> -#include "../support/sistr.hxx" -#include "../support/syshelp.hxx" - - -class XmlElement; -class SglTextElement; -class MultipleTextElement; - - -class HtmlCreator -{ - public: - HtmlCreator( - const char * i_pOutputFileName, - const XmlElement & i_rDocument, - const Simstr & i_sIDL_BaseDirectory ); - ~HtmlCreator(); - - void Run(); - - void StartTable(); - void FinishTable(); - void StartBigCell( - const char * i_sTitle ); - void FinishBigCell(); - - void Write_SglTextElement( - const SglTextElement & - i_rElement, - bool i_bStrong = false ); - void Write_MultiTextElement( - const MultipleTextElement & - i_rElement ); - void Write_SglText( - const Simstr & i_sName, - const Simstr & i_sValue ); - void Write_ReferenceDocu( - const Simstr & i_sName, - const Simstr & i_sRef, - const Simstr & i_sRole, - const Simstr & i_sTitle ); - private: - void StartRow(); - void FinishRow(); - void StartCell( - const char * i_pWidth ); - void FinishCell(); - - void WriteElementName( - const Simstr & i_sName, - bool i_bStrong ); - void WriteStr( - const char * i_sStr ) - { aFile.write( i_sStr, (int) strlen(i_sStr) ); } - // DATA - std::ofstream aFile; - const XmlElement & rDocument; - Simstr sIdl_BaseDirectory; -}; - - - - -#endif - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/cr_index.cxx b/xml2cmp/source/xcd/cr_index.cxx deleted file mode 100644 index 3d1055432..000000000 --- a/xml2cmp/source/xcd/cr_index.cxx +++ /dev/null @@ -1,277 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include "cr_index.hxx" - -#include <string.h> -#include <fstream> -#include "../support/syshelp.hxx" -#include "xmltree.hxx" -#include "parse.hxx" -#include "cr_html.hxx" - - -extern unsigned C_nSupportedServicesIndex; - -char C_sLineEnd[] = "\n"; - -char C_sFileBegin[] = "<HTML><HEAD></HEAD><BODY bgcolor=\"#ffffff\">\n"; -char C_sFileEnd[] = "</BODY></HTML>\n"; -char C_sTableBegin[] = "<TABLE WIDTH=100% BORDER=1 CELLPADDING=4 CELLSPACING=0><TBODY>\n"; -char C_sTableEnd[] = "</TBODY></TABLE>\n"; -char C_sService[] = "SupportedService"; -char C_sModule[] = "ModuleName"; -char C_sComponentname[] = "ComponentName"; - - - -Simstr sIdlRootPath; - - -Index::Index( const char * i_sOutputDirectory, - const char * i_sIdlRootPath, - const List<Simstr> & ) - : aService2Module(20), - aModule2Service(20), - sOutputDirectory(i_sOutputDirectory), - sIdlRootPath(i_sIdlRootPath) - // sCurModule -{ - ::sIdlRootPath = i_sIdlRootPath; -} - -Index::~Index() -{ -} - -void -Index::GatherData( const List<Simstr> & i_rInputFileList ) -{ - for ( unsigned i = 0; i < i_rInputFileList.size(); ++i ) - { - ReadFile( i_rInputFileList[i].str() ); - } -} - -void -Index::WriteOutput( const char * i_sOuputFile ) -{ - std::ofstream aOut( i_sOuputFile, std::ios::out ); - if (! aOut) - { - std::cerr << "Error: Indexfile \"" - << i_sOuputFile - << "\" could not be created." - << std::endl; - return; - } - - WriteStr(aOut, C_sFileBegin); - - WriteStr(aOut, "<H2>Module Descriptions Index</H2>"); - WriteStr(aOut, C_sLineEnd ); - - - WriteTableFromHeap( aOut, aService2Module, C_sService, C_sModule, lt_html ); - WriteTableFromHeap( aOut, aModule2Service, C_sModule, C_sService, lt_idl ); - - WriteStr( aOut, C_sFileEnd ); - aOut.close(); -} - -void -Index::InsertSupportedService( const Simstr & i_sService ) -{ - aService2Module.InsertValue( i_sService, sCurModule ); - aModule2Service.InsertValue( sCurModule, i_sService ); -} - -void -Index::ReadFile( const char * i_sFilename ) -{ - static char sOutputHtml[1020]; - - ModuleDescription aModule; - X2CParser aParser(aModule); - - // Parse - bool bResult = aParser.Parse(i_sFilename); - if (! bResult) - { - std::cerr << "Error: File \"" - << i_sFilename - << "\" could not be parsed." - << std::endl; - return; - } - - // Create Html: - CreateHtmlFileName( sOutputHtml, aModule ); - HtmlCreator aHtmlCreator( sOutputHtml, aModule, sIdlRootPath ); - aHtmlCreator.Run(); - - // GetResults: - sCurModule = aModule.ModuleName(); - - List< const MultipleTextElement* > aSupportedServices; - aModule.Get_SupportedServices(aSupportedServices); - - for ( unsigned s = 0; s < aSupportedServices.size(); ++s ) - { - aSupportedServices[s]->Insert2Index(*this); - } -} - -void -Index::CreateHtmlFileName( char * o_sOutputHtml, - const ModuleDescription & i_rModule ) -{ - if ( strlen(sOutputDirectory.str()) + strlen(i_rModule.ModuleName()) > 1000 ) - { - strcpy( o_sOutputHtml, "too-long-filename.html"); // STRCPY SAFE HERE - return; - } - - strcpy( o_sOutputHtml, sOutputDirectory.str() ); // STRCPY SAFE HERE -#if defined(WNT) - strcat(o_sOutputHtml, "\\"); // STRCAT SAFE HERE -#elif defined(UNX) - strcat(o_sOutputHtml, "/"); // STRCAT SAFE HERE -#else -#error WNT or UNX have to be defined. -#endif - strcat( o_sOutputHtml, i_rModule.ModuleName() ); // STRCAT SAFE HERE - strcat( o_sOutputHtml, ".html" ); // STRCAT SAFE HERE -} - - -void -Index::WriteTableFromHeap( std::ostream & o_rOut, - Heap & i_rHeap, - const char * i_sIndexValue, - const char * i_sIndexReference, - E_LinkType i_eLinkType ) -{ - WriteStr(o_rOut, "<H3><BR>"); - WriteStr(o_rOut, i_sIndexValue ); - WriteStr(o_rOut, " -> "); - WriteStr(o_rOut, i_sIndexReference ); - WriteStr(o_rOut, "</H3>\n"); - - WriteStr(o_rOut, C_sTableBegin); - WriteHeap( o_rOut, i_rHeap, i_eLinkType ); - WriteStr(o_rOut, C_sTableEnd); -} - - -void -Index::WriteHeap( std::ostream & o_rOut, - Heap & i_rHeap, - E_LinkType i_eLinkType ) -{ - static Simstr S_sKey; - static char C_sSpaceInName[] = " "; - S_sKey = ""; - - - WriteStr( o_rOut, "<TR><TD width=33% valign=\"top\">" ); - - for ( HeapItem * pHeapTop = i_rHeap.ReleaseTop(); - pHeapTop != 0; - pHeapTop = i_rHeap.ReleaseTop() ) - { - if ( S_sKey != pHeapTop->Key() ) - { - const char * pStart = pHeapTop->Key().str(); - const char * pBreak = strstr( pStart, " in "); - - if (S_sKey.l()>0) - { - WriteStr( o_rOut, "</TD></TR>\n" ); - WriteStr( o_rOut, "<TR><TD width=33% valign=\"top\">" ); - } - - if ( pBreak == 0 ) - WriteStr( o_rOut, pStart ); - else - { - o_rOut.write( pStart, pBreak - pStart ); - WriteStr( o_rOut, C_sSpaceInName ); - WriteStr( o_rOut, pBreak ); - } - WriteStr( o_rOut, "</TD><TD width=66%>" ); - S_sKey = pHeapTop->Key(); - } - else - { - WriteStr( o_rOut, "<BR>" ); - } - WriteName( o_rOut, sIdlRootPath, pHeapTop->Value(), i_eLinkType ); - delete pHeapTop; - } - - WriteStr( o_rOut, "</TD></TR>\n" ); -} - - - -/** Structure overview - -MODULEDESCRIPTION -{ - ModuleName, - COMPONENTDESCRIPTION - { - Author, - Name, - Description, - LoaderName, - Language, - Status, - SupportedService+, - ReferenceDocu* - ServiceDependency* - Type* - } - ProjectBuildDependency* - RuntimeModuleDependency* - ReferenceDocu* - ServiceDependency* - Type* -} - - -*/ - - - - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/cr_index.hxx b/xml2cmp/source/xcd/cr_index.hxx deleted file mode 100644 index 912ecf831..000000000 --- a/xml2cmp/source/xcd/cr_index.hxx +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef X2C_CR_INDEX_HXX -#define X2C_CR_INDEX_HXX - -#include "../support/sistr.hxx" -#include "../support/heap.hxx" -#include "../support/list.hxx" -#include "../support/syshelp.hxx" - - -class ModuleDescription; - - -class Index -{ - public: - Index( - const char * i_sOutputDirectory, - const char * i_sIdlRootPath, - const List<Simstr> & - i_rTagList ); - ~Index(); - - void GatherData( - const List<Simstr> & - i_rInputFileList ); - void WriteOutput( - const char * i_sOuputFile ); - - void InsertSupportedService( - const Simstr & i_sService ); - private: - void ReadFile( - const char * i_sFilename ); - void CreateHtmlFileName( - char * o_sOutputHtml, - const ModuleDescription & - i_rModule ); - void WriteTableFromHeap( - std::ostream & o_rOut, - Heap & i_rHeap, - const char * i_sIndexKey, - const char * i_sIndexReference, - E_LinkType i_eLinkType ); - void WriteHeap( - std::ostream & o_rOut, - Heap & i_rHeap, - E_LinkType i_eLinkType ); - - // DATA - Heap aService2Module; - Heap aModule2Service; - - Simstr sOutputDirectory; - Simstr sIdlRootPath; - - // Temporary Data - Simstr sCurModule; -}; - - - - -#endif - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/cr_metho.cxx b/xml2cmp/source/xcd/cr_metho.cxx deleted file mode 100644 index 3e1540771..000000000 --- a/xml2cmp/source/xcd/cr_metho.cxx +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "cr_metho.hxx" - -#include <string.h> -#include <fstream> -#include <iostream> - - - -const char C_sFileHeader1[] - = "/* "; -const char C_sFileHeader2[] - = " */\r\n/* Implementation of component_getDescriptionFunc() */\r\n\r\n" - "#include <sal/types.h>\r\n\r\n"; -const char C_sFuncBegin[] - = "#ifdef __cplusplus\r\n" - "extern \"C\" {\r\n" - "#endif\r\n\r\n" - "const sal_Char * SAL_CALL\r\ncomponent_getDescriptionFunc()\r\n" - "{\r\n" - " return (const sal_Char*) \r\n" - " \""; -const char C_sFuncEnd[] = "\";\r\n" - "}\r\n\r\n" - "#ifdef __cplusplus\r\n" - "} /* end of extern \"C\" */\r\n" - "#endif\r\n"; - - -void -Create_AccessMethod( const char * i_pOutputFileName, - const char * i_sText ) -{ - const char * pText = i_sText; - const char * pTrans = 0; - const char sDescrLineChange[] = "\"\r\n \""; - int sDescrLen = (int) strlen(sDescrLineChange); - - std::ofstream aFile(i_pOutputFileName, std::ios::out -#if defined(WNT) - | std::ios::binary -#endif - ); - - - if ( !aFile ) - { - std::cerr << "Error: " << i_pOutputFileName << " could not be created." << std::endl; - return; - } - - aFile.write( C_sFileHeader1, (int) strlen(C_sFileHeader1) ); - aFile.write( i_pOutputFileName, (int) strlen(i_pOutputFileName) ); - aFile.write( C_sFileHeader2, (int) strlen(C_sFileHeader2) ); - aFile.write( C_sFuncBegin, (int) strlen(C_sFuncBegin) ); - - for ( pTrans = pText; *pTrans != '\0'; pTrans++ ) - { - switch (*pTrans) - { - case '"': aFile.write( "\\\"", 2); - break; - case '\n': aFile.write( "\\n", 2); - aFile.write( sDescrLineChange, sDescrLen); - break; - case '\r': aFile.write( "\\r", 2); - break; - default: aFile.write( pTrans, 1); - } - } /* end for */ - - aFile.write( C_sFuncEnd, (int) strlen(C_sFuncEnd) ); - - - aFile.close(); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/cr_metho.hxx b/xml2cmp/source/xcd/cr_metho.hxx deleted file mode 100644 index d538da95f..000000000 --- a/xml2cmp/source/xcd/cr_metho.hxx +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef CPV_CR_METHOD_H -#define CPV_CR_METHOD_H - - - -void Create_AccessMethod( - const char * i_pOutputFileName, - const char * i_sText ); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/filebuff.cxx b/xml2cmp/source/xcd/filebuff.cxx deleted file mode 100644 index de9168bab..000000000 --- a/xml2cmp/source/xcd/filebuff.cxx +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifdef AIX -# undef _THREAD_SAFE -#endif - -#include "filebuff.hxx" - -#include <string.h> -#include <fstream> -#include <ctype.h> - - -bool -LoadXmlFile( Buffer & o_rBuffer, - const char * i_sXmlFilePath ) -{ - std::ifstream aXmlFile; - - aXmlFile.open(i_sXmlFilePath, std::ios::in -#if defined(WNT) - | std::ios::binary -#endif // WNT - ); - - if (! aXmlFile) - return false; - - // Prepare buffer: - aXmlFile.seekg(0, std::ios::end); - unsigned long nBufferSize = (unsigned long) aXmlFile.tellg(); - o_rBuffer.SetSize(nBufferSize + 1); - o_rBuffer.Data()[nBufferSize] = '\0'; - aXmlFile.seekg(0); - - // Read file: - aXmlFile.read(o_rBuffer.Data(), (int) nBufferSize); - bool ret = aXmlFile.good() != 0; - aXmlFile.close(); - return ret; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/filebuff.hxx b/xml2cmp/source/xcd/filebuff.hxx deleted file mode 100644 index 07de89f52..000000000 --- a/xml2cmp/source/xcd/filebuff.hxx +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef X2C_FILEBUFF_HXX -#define X2C_FILEBUFF_HXX - - -class Buffer -{ - public: - Buffer() : s(0) {} - ~Buffer() { if (s) delete [] s; } - operator const char *() const - { return s; } - char * Data() { return s; } - void SetSize( - unsigned long i_size ) - { if (s) delete [] s; s = new char [i_size]; } - private: - char * s; -}; - - -bool LoadXmlFile( - Buffer & o_rBuffer, - const char * i_sXmlFilePath ); - - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/main.cxx b/xml2cmp/source/xcd/main.cxx deleted file mode 100644 index aeb701acb..000000000 --- a/xml2cmp/source/xcd/main.cxx +++ /dev/null @@ -1,260 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <iostream> -#include <fstream> -#include <stdio.h> - - -#include <string.h> -#include "../support/cmdline.hxx" -#include "cr_metho.hxx" -#include "cr_html.hxx" -#include "cr_index.hxx" -#include "xmlelem.hxx" -#include "xmltree.hxx" -#include "parse.hxx" -#include "../support/syshelp.hxx" -#include "../support/heap.hxx" - - - -int Do_IndexCommandLine( - const CommandLine & i_rCommandLine ); -int Do_SingleFileCommandLine( - const CommandLine & i_rCommandLine ); -void Create_TypeInfo( - const char * o_sOutputFile, - ModuleDescription & i_rData ); - - -int -#ifdef WNT -_cdecl -#endif -main( int argc, - char * argv[] ) -{ - // Variables - CommandLine aCommandLine(argc, argv); - int ret = 0; - - if (! aCommandLine.IsOk()) - { - std::cerr << aCommandLine.ErrorText() << std::endl ; - return 1; - } - - if ( aCommandLine.IsIndexCommand() ) - ret = Do_IndexCommandLine(aCommandLine); - else - ret = Do_SingleFileCommandLine(aCommandLine); - - return ret; -} - - -int -Do_SingleFileCommandLine(const CommandLine & i_rCommandLine) -{ - ModuleDescription aDescr; - X2CParser aParser(aDescr); - - // Load file and create Function-file - bool bLoadResult = aParser.LoadFile(i_rCommandLine.XmlSrcFile()); - if (! bLoadResult) - { - std::cerr << "Error: File " << i_rCommandLine.XmlSrcFile() << " could not be loaded." << std::endl; - return 1; - } - - if ( strlen(i_rCommandLine.FuncFile()) > 0 ) - { - Create_AccessMethod( i_rCommandLine.FuncFile(), - aParser.PureText() ); - - std::cout << "File " - << i_rCommandLine.FuncFile() - << " with component_getDescriptionFunc() is created now." - << std::endl; - } - - // Parse - aParser.Parse(); - - // Produce output - if ( strlen(i_rCommandLine.HtmlFile()) > 0 ) - { - HtmlCreator aHtmlCreator( i_rCommandLine.HtmlFile(), - aDescr, - i_rCommandLine.IdlRootPath() ); - aHtmlCreator.Run(); - } - - if (strlen(i_rCommandLine.TypeInfoFile()) > 0) - { - Create_TypeInfo( i_rCommandLine.TypeInfoFile(), - aDescr ); - } - - return 0; -}; - -int -Do_IndexCommandLine(const CommandLine & i_rCommandLine) -{ - // Parse files: - List<Simstr> aFiles; - Index aIndex( i_rCommandLine.OutputDirectory(), - i_rCommandLine.IdlRootPath(), - i_rCommandLine.IndexedTags() ); - - std::cout << "Gathering xml-files ..." << std::endl; - GatherFileNames( aFiles, i_rCommandLine.XmlSrcDirectory() ); - - std::cout << "Creating output ..." << std::endl; - aIndex.GatherData(aFiles); - aIndex.WriteOutput( i_rCommandLine.IndexOutputFile() ); - - std::cout << "... done." << std::endl; - - return 0; -}; - - - -//******************** Creating of typeinfo ********************// - - -void Put2StdOut_TypeInfo( - ModuleDescription & i_rData ); -void Put2File_TypeInfo( - const char * i_sOutputFile, - ModuleDescription & i_rData ); -void StreamOut_TypeInfo( - std::ostream & o_rOut, - ModuleDescription & i_rData, - const char * i_sSeparator ); - - - - -void -Create_TypeInfo( const char * o_sOutputFile, - ModuleDescription & i_rData ) -{ - if ( strcmp(o_sOutputFile, "stdout") == 0 ) - Put2StdOut_TypeInfo(i_rData); - else - Put2File_TypeInfo(o_sOutputFile,i_rData); -} - -void -Put2StdOut_TypeInfo( ModuleDescription & i_rData ) -{ - StreamOut_TypeInfo(std::cout, i_rData, " "); -} - -void -Put2File_TypeInfo( const char * i_sOutputFile, - ModuleDescription & i_rData ) -{ - std::ofstream aOut(i_sOutputFile, std::ios::out -#if defined(WNT) - | std::ios::binary -#endif - ); - if ( !aOut ) - { - std::cerr << "Error: " << i_sOutputFile << " could not be created." << std::endl; - return; - } - - Simstr sLibPrefix = i_rData.ModuleName(); - WriteStr( aOut, sLibPrefix ); - WriteStr( aOut, "_XML2CMPTYPES= "); - - StreamOut_TypeInfo(aOut, i_rData, "\t\\\n\t\t"); - - aOut.close(); -} - -void -StreamOut_TypeInfo( std::ostream & o_rOut, - ModuleDescription & i_rData, - const char * i_sSeparator ) -{ - Heap aTypesHeap(12); - - // Gather types: - List< const MultipleTextElement * > aTypes; - i_rData.Get_Types(aTypes); - - for ( unsigned t = 0; t < aTypes.size(); ++t ) - { - unsigned i_max = aTypes[t]->Size(); - for ( unsigned i = 0; i < i_max; ++i ) - { - aTypesHeap.InsertValue( aTypes[t]->Data(i), "" ); - } // end for - } - - // Write types: - HeapItem * pLastHeapTop = 0; - for ( HeapItem * pHeapTop = aTypesHeap.ReleaseTop(); pHeapTop != 0; pHeapTop = aTypesHeap.ReleaseTop() ) - { - if (pLastHeapTop != 0) - { - if ( 0 == strcmp(pHeapTop->Key(), pLastHeapTop->Key()) ) - continue; - delete pLastHeapTop; - } - pLastHeapTop = pHeapTop; - - WriteStr( o_rOut, i_sSeparator ); - - const char * sEnd = strchr( pHeapTop->Key(), ' ' ); - if (sEnd != 0) - { - const char * sQuali = strrchr( pHeapTop->Key(), ' ' ) + 1; - WriteStr( o_rOut, sQuali ); - WriteStr( o_rOut, "." ); - o_rOut.write( pHeapTop->Key(), sEnd - pHeapTop->Key() ); - } - else - WriteStr( o_rOut, pHeapTop->Key() ); - } // end for - - if (pLastHeapTop != 0) - { - delete pLastHeapTop; - pLastHeapTop = 0; - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/makefile.mk b/xml2cmp/source/xcd/makefile.mk deleted file mode 100644 index 096d5c786..000000000 --- a/xml2cmp/source/xcd/makefile.mk +++ /dev/null @@ -1,72 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org 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 Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=xml2cmp -TARGET=x2c_xcd -TARGETTYPE=CUI - -LIBTARGET=NO - -# --- Settings ----------------------------------------------------- - -ENABLE_EXCEPTIONS=TRUE - -.INCLUDE : settings.mk - -.IF "$(CROSS_COMPILING)"=="YES" -all: - @echo Nothing done when cross-compiling -.ENDIF - -# --- Files -------------------------------------------------------- - -LIBONLYFILES=\ - $(OBJ)$/cr_html.obj \ - $(OBJ)$/cr_index.obj \ - $(OBJ)$/cr_metho.obj \ - $(OBJ)$/filebuff.obj \ - $(OBJ)$/parse.obj \ - $(OBJ)$/xmlelem.obj \ - $(OBJ)$/xmltree.obj - -OBJFILES=\ - $(OBJ)$/main.obj \ - $(LIBONLYFILES) - -LIB1TARGET=$(LB)$/$(TARGET).lib -LIB1OBJFILES=\ - $(OBJFILES) - -LIB2TARGET=$(LB)$/$(TARGET)l.lib -LIB2OBJFILES=\ - $(LIBONLYFILES) - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/xml2cmp/source/xcd/parse.cxx b/xml2cmp/source/xcd/parse.cxx deleted file mode 100644 index 9a7b4f625..000000000 --- a/xml2cmp/source/xcd/parse.cxx +++ /dev/null @@ -1,450 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include <parse.hxx> - -#include <string.h> -#include <iostream> -#include <xmlelem.hxx> - -#if (_MSC_VER >=1400) -#pragma warning(disable:4365) -#endif - -#ifdef UNX -#define strnicmp strncasecmp -#endif - - - -// NOT FULLY DEFINED SERVICES - - - -#define AssertionOf(x) \ - {if (!(x)) {std::cerr << "Assertion failed: " << #x << __FILE__ << __LINE__ << std::endl; exit(3); }} - - - -X2CParser::X2CParser( XmlElement & o_rDocumentData ) - : // sFileName, - nFileLine(0), - pDocumentData(&o_rDocumentData), - // sWord, - text(0) -{ -} - -X2CParser::~X2CParser() -{ -} - - -bool -X2CParser::LoadFile( const char * i_sFilename ) -{ - sFileName = i_sFilename; - nFileLine = 1; - - // Load file: - if ( ! LoadXmlFile( aFile, i_sFilename ) ) - return false; - - // Test correct end: - const char * pLastTag = strrchr(aFile.operator const char *(),'<'); - if (pLastTag == 0) - return false; - if ( strnicmp(pLastTag+2, pDocumentData->Name().str(), pDocumentData->Name().l()) != 0 - || strnicmp(pLastTag, "</", 2) != 0 ) - return false; - if (strchr(pLastTag,'>') == 0) - return false; - return true; -} - -void -X2CParser::Parse() -{ - // Parse: - text = aFile.operator const char *(); - - Parse_XmlDeclaration(); - Parse_Doctype(); - - pDocumentData->Parse(*this); -} - -bool -X2CParser::Parse( const char * i_sFilename ) -{ - bool ret = LoadFile(i_sFilename); - if (ret) - Parse(); - return ret; -} - -void -X2CParser::Parse_XmlDeclaration() -{ - Goto('<'); - if ( IsText("<?xml") ) - { - Goto_And_Pass('>'); - } -} - -void -X2CParser::Parse_Doctype() -{ - Goto('<'); - if ( IsText("<!DOCTYPE") ) - Goto_And_Pass('>'); -} - -void -X2CParser::Parse_Sequence( DynamicList<XmlElement> & o_rElements, - const Simstr & i_sElementName ) -{ - CheckAndPassBeginTag(i_sElementName.str()); - - unsigned int i_max = o_rElements.size(); - for (unsigned i = 0; i < i_max; ++i) - { - o_rElements[i]->Parse(*this); - } // end for - - CheckAndPassEndTag(i_sElementName.str()); -} - -void -X2CParser::Parse_FreeChoice( DynamicList<XmlElement> & o_rElements ) -{ - unsigned nSize = o_rElements.size(); - - for ( bool bBreak = false; !bBreak; ) - { - bBreak = true; - for ( unsigned i = 0; i < nSize; ++i ) - { - Goto('<'); - if ( IsBeginTag(o_rElements[i]->Name().str()) ) - { - o_rElements[i]->Parse(*this); - bBreak = false; - break; - } - } // end for i - } // end for !bBreak -} - -void -X2CParser::Parse_List( ListElement & o_rListElem ) -{ - - for ( Goto('<'); IsBeginTag(o_rListElem.Name().str()); Goto('<') ) - { - XmlElement * pNew = o_rListElem.Create_and_Add_NewElement(); - pNew->Parse(*this); - } -} - -void -X2CParser::Parse_Text( Simstr & o_sText, - const Simstr & i_sElementName, - bool i_bReverseName ) -{ - - if ( ! CheckAndPassBeginTag(i_sElementName.str()) ) - return; - - // Add new Element - GetTextTill( o_sText, '<', i_bReverseName ); - o_sText.remove_trailing_blanks(); - - CheckAndPassEndTag(i_sElementName.str()); -} - -void -X2CParser::Parse_MultipleText( List<Simstr> & o_rTexts, - const Simstr & i_sElementName, - bool i_bReverseName ) -{ - for ( Goto('<'); IsBeginTag(i_sElementName.str()); Goto('<') ) - { - Simstr sNew; - Parse_Text(sNew, i_sElementName, i_bReverseName); - if (sNew.l() > 0) - o_rTexts.push_back(sNew); - } -} - -void -X2CParser::Parse_SglAttr( Simstr & o_sAttrValue, - const Simstr & i_sElementName, - const Simstr & i_sAttrName ) -{ - Goto('<'); - if ( !IsBeginTag(i_sElementName.str()) ) - SyntaxError("unexpected element"); - Move( i_sElementName.l() + 1 ); - - Pass_White(); - if (*text == '>') - SyntaxError("no attribute found where one was expected"); - Simstr sAttrName; - Get_Attribute(o_sAttrValue, sAttrName); - if (sAttrName != i_sAttrName) - SyntaxError("unknown attribute found"); - Pass_White(); - if (strncmp(text,"/>",2) != 0) - SyntaxError("missing \"/>\" at end of empty element"); - Move(2); -} - -void -X2CParser::Parse_MultipleAttr( List<Simstr> & o_rAttrValues, - const Simstr & i_sElementName, - const List<Simstr> & i_rAttrNames ) -{ - Goto('<'); - if ( !IsBeginTag(i_sElementName.str()) ) - SyntaxError("unexpected element"); - Move( i_sElementName.l() + 1 ); - Simstr sAttrName; - Simstr sAttrValue; - unsigned nSize = i_rAttrNames.size(); - unsigned i; - - for ( Pass_White(); *text != '/'; Pass_White() ) - { - - Get_Attribute(sAttrValue, sAttrName); - - for ( i = 0; i < nSize; ++i ) - { - if ( i_rAttrNames[i] == sAttrName ) - { - o_rAttrValues[i] = sAttrValue; - break; - } - } - if (i == nSize) - SyntaxError("unknown attribute found"); - } - Move(2); -} - - -void -X2CParser::Get_Attribute( Simstr & o_rAttrValue, - Simstr & o_rAttrName ) -{ - GetTextTill( o_rAttrName, '='); - - while (*(++text) != '"') - { - if (*text == '\0') - SyntaxError("unexpected end of file"); - } - - ++text; - GetTextTill( o_rAttrValue, '"'); - ++text; -} - -bool -X2CParser::IsText( const char * i_sComparedText ) -{ - return strnicmp( text, i_sComparedText, strlen(i_sComparedText) ) == 0; -} - -bool -X2CParser::IsBeginTag( const char * i_sTagName ) -{ - return strnicmp( text+1, i_sTagName, strlen(i_sTagName) ) == 0 - && *text == '<'; -} - -bool -X2CParser::IsEndTag( const char * i_sTagName ) -{ - return strnicmp( text+2, i_sTagName, strlen(i_sTagName) ) == 0 - && strnicmp( text, "</", 2 ) == 0; -} - -void -X2CParser::Goto( char i_cNext ) -{ - while (*text != i_cNext) - { - TestCurChar(); - ++text; - } -} - -void -X2CParser::Goto_And_Pass( char i_cNext ) -{ - Goto(i_cNext); - ++text; -} - -void -X2CParser::Move( int i_nForward ) -{ - text += i_nForward; -} - -void -X2CParser::Pass_White() -{ - while (*text <= 32) - { - TestCurChar(); - ++text; - } -} - -void -X2CParser::GetTextTill( Simstr & o_rText, - char i_cEnd, - bool i_bReverseName ) -{ - char * pResult = &sWord[0]; - char * pSet; - - for ( pSet = pResult; - *text != i_cEnd; - ++text ) - { - TestCurChar(); - *pSet++ = *text; - } - - while ( *pResult < 33 && *pResult > 0 ) - ++pResult; - while ( pSet > pResult ? *(pSet-1) < 33 : false ) - pSet--; - *pSet = '\0'; - - - if (i_bReverseName) - { - const unsigned int nMaxLen = 1000; - if (strlen(pResult) < nMaxLen) - { - char * sBreak = strrchr(pResult,'.'); - if (sBreak != 0) - { - static char sScope[nMaxLen+10]; - static char sName[nMaxLen+10]; - - unsigned nScopeLen = sBreak - pResult; - strncpy ( sScope, pResult, nScopeLen ); // STRNCPY SAFE HERE - sScope[nScopeLen] = '\0'; - strcpy( sName, sBreak + 1 ); // STRCPY SAFE HERE - strcat( sName, " in " ); // STRCAT SAFE HERE - strcat( sName, sScope ); // STRCAT SAFE HERE - - o_rText = sName; - return; - } - } - } // endif (i_bReverseName) - - o_rText = &sWord[0]; -} - -bool -X2CParser::CheckAndPassBeginTag( const char * i_sElementName ) -{ - bool ret = true; - Goto('<'); - if ( ! IsBeginTag(i_sElementName) ) - SyntaxError( "unexpected element"); - if (IsAbsoluteEmpty()) - ret = false; - Goto_And_Pass('>'); - if (ret) - Pass_White(); - return ret; -} - -void -X2CParser::CheckAndPassEndTag( const char * i_sElementName ) -{ - Pass_White(); - if ( !IsEndTag(i_sElementName) ) - SyntaxError("missing or not matching end tag"); - Goto_And_Pass('>'); -} - -bool -X2CParser::IsAbsoluteEmpty() const -{ - const char * pEnd = strchr(text+1, '>'); - if (pEnd != 0) - { - if ( *(pEnd-1) == '/' ) - { - const char * pAttr = strchr(text+1, '"'); - if (pAttr == 0) - return true; - else if ( (pAttr-text) > (pEnd-text) ) - return true; - } - } - return false; -} - -void -X2CParser::SyntaxError( const char * i_sText ) -{ - std::cerr - << "Syntax error " - << i_sText - << " in file: " - << sFileName.str() - << " in line " - << nFileLine - << "." - << std::endl; - - exit(3); -} - -void -X2CParser::TestCurChar() -{ - if (*text == '\n') - nFileLine++; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/parse.hxx b/xml2cmp/source/xcd/parse.hxx deleted file mode 100644 index 732fea698..000000000 --- a/xml2cmp/source/xcd/parse.hxx +++ /dev/null @@ -1,145 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef X2C_PARSE_HXX -#define X2C_PARSE_HXX - - - -// USED SERVICES - // BASE CLASSES - // COMPONENTS -#include "filebuff.hxx" -#include "../support/sistr.hxx" -#include "../support/list.hxx" - // PARAMETERS - - -class XmlElement; -class ListElement; - -class X2CParser -{ - public: - typedef XmlElement * (*F_CREATE)(const Simstr &); - - X2CParser( - XmlElement & o_rDocumentData ); - ~X2CParser(); - - bool LoadFile( - const char * i_sFilename ); - void Parse(); - bool Parse( - const char * i_sFilename ); - - - const char * PureText() const { return aFile.operator const char*(); } - - void Parse_Sequence( - DynamicList<XmlElement> & - o_rElements, - const Simstr & i_sElementName ); - void Parse_FreeChoice( - DynamicList<XmlElement> & - o_rElements ); - void Parse_List( - ListElement & o_rListElem ); - void Parse_Text( - Simstr & o_sText, - const Simstr & i_sElementName, - bool i_bReverseName ); - void Parse_MultipleText( - List<Simstr> & o_rTexts, - const Simstr & i_sElementName, - bool i_bReverseName ); - void Parse_SglAttr( - Simstr & o_sAttrValue, - const Simstr & i_sElementName, - const Simstr & i_sAttrName ); - void Parse_MultipleAttr( - List<Simstr> & o_rAttrValues, - const Simstr & i_sElementName, - const List<Simstr> & - i_rAttrNames ); - - private: - void Parse_XmlDeclaration(); - void Parse_Doctype(); - - void Get_Attribute( - Simstr & o_rAttrValue, - Simstr & o_rAttrName ); - bool IsText( - const char * i_sComparedText ); - bool IsBeginTag( - const char * i_sTagName ); - bool IsEndTag( - const char * i_sTagName ); - void Goto( - char i_cNext ); - void Goto_And_Pass( - char i_cNext ); - void Move( - int i_nForward ); - void Pass_White(); - void GetTextTill( - Simstr & o_rText, - char i_cEnd, - bool i_bReverseName = false ); - /// @return false in case of empty tag with no attributes. - bool CheckAndPassBeginTag( - const char * i_sElementName ); - void CheckAndPassEndTag( - const char * i_sElementName ); - /// @precond IsBeginTag() == true. - bool IsAbsoluteEmpty() const; - - - void SyntaxError( - const char * i_sText ); - void TestCurChar(); - - // DATA - Simstr sFileName; - unsigned nFileLine; - - Buffer aFile; - XmlElement * pDocumentData; - - char sWord[8192]; - const char * text; -}; - - - -// IMPLEMENTATION - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/xmlelem.cxx b/xml2cmp/source/xcd/xmlelem.cxx deleted file mode 100644 index 94405c302..000000000 --- a/xml2cmp/source/xcd/xmlelem.cxx +++ /dev/null @@ -1,266 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include <xmlelem.hxx> - - -// NOT FULLY DEFINED SERVICES -#include <parse.hxx> -#include <cr_html.hxx> - -XmlElement::XmlElement( const char * i_sName ) - : sName(i_sName) -{ -} - -void -XmlElement::Insert2Index( Index & ) const -{ - // Default version. Does nothing. -} - -XmlElement * -MultipleElement::FindChild( const Simstr & i_sChildName ) -{ - unsigned i_max = aChildren.size(); - for ( unsigned i = 0; i < i_max; ++i ) - { - if ( aChildren[i]->Name() == i_sChildName ) - return aChildren[i]; - } - - return 0; -} - -MultipleElement::~MultipleElement() -{ -} - -MultipleElement::MultipleElement( const char * i_sName ) - : XmlElement(i_sName) -{ -} - -void -MultipleElement::AddChild( XmlElement & let_drElement ) -{ - aChildren.push_back(&let_drElement); -} - -void -SequenceElement::Parse( X2CParser & io_rParser ) -{ - io_rParser.Parse_Sequence( Children(), Name() ); -} - -void -SequenceElement::Write2Html( HtmlCreator & io_rHC ) const -{ - io_rHC.StartTable(); - - Children()[nIndexNameElement]->Write2Html(io_rHC); - for ( unsigned i = 0; i < Children().size(); ++i ) - { - if (i != nIndexNameElement) - { - Children()[i]->Write2Html(io_rHC); - } - } // end for - - io_rHC.FinishTable(); -} - - -SequenceElement::SequenceElement( const char * i_sName, - unsigned i_nIndexNameElement ) - : MultipleElement(i_sName), - nIndexNameElement(i_nIndexNameElement) -{ -} - -FreeChoiceElement::FreeChoiceElement() - : MultipleElement("") -{ -} - -void -FreeChoiceElement::Parse( X2CParser & io_rParser ) -{ - io_rParser.Parse_FreeChoice(Children()); -} - -void -FreeChoiceElement::Write2Html( HtmlCreator & io_rHC ) const -{ - for ( unsigned i = 0; i < Children().size(); ++i ) - { - Children()[i]->Write2Html(io_rHC); - } // end for -} - -ListElement::ListElement( const char * i_sElementsName, - F_CREATE i_fCreateNewElement ) - : MultipleElement(i_sElementsName), - fCreateNewElement(i_fCreateNewElement) -{ -} - -void -ListElement::Parse( X2CParser & io_rParser ) -{ - io_rParser.Parse_List( *this ); -} - -void -ListElement::Write2Html( HtmlCreator & io_rHC ) const -{ - for ( unsigned i = 0; i < Children().size(); ++i ) - { - Children()[i]->Write2Html(io_rHC); - } // end for -} - -XmlElement * -ListElement::Create_and_Add_NewElement() -{ - XmlElement * pNew = (*fCreateNewElement)(Name()); - Children().push_back( pNew ); - return pNew; -} - -TextElement::TextElement( const char * i_sName, - E_LinkType i_eLinkType, - bool i_bReverseName ) - : XmlElement(i_sName), - eLinkType(i_eLinkType), - bReverseName(i_bReverseName) -{ -} - -SglTextElement::SglTextElement( const char * i_sName, - E_LinkType i_eLinkType, - bool i_bReverseName ) - : TextElement(i_sName, i_eLinkType, i_bReverseName) -{ -} - -void -SglTextElement::Parse( X2CParser & io_rParser ) -{ - io_rParser.Parse_Text(sContent, Name(), IsReversedName()); -} - -void -SglTextElement::Write2Html( HtmlCreator & io_rHC ) const -{ - if ( !sContent.is_no_text() ) - io_rHC.Write_SglTextElement( *this ); -} - -MultipleTextElement::MultipleTextElement( const char * i_sName, - E_LinkType i_eLinkType, - bool i_bReverseName ) - : TextElement(i_sName, i_eLinkType, i_bReverseName) -{ -} - -void -MultipleTextElement::Parse( X2CParser & io_rParser ) -{ - io_rParser.Parse_MultipleText(aContent, Name(), IsReversedName()); -} - -void -MultipleTextElement::Write2Html( HtmlCreator & io_rHC ) const -{ - if (Size() > 0) - io_rHC.Write_MultiTextElement( *this ); -} - -const Simstr & -MultipleTextElement::Data( unsigned i_nNr ) const -{ - static const Simstr sNull_; - - if (i_nNr < aContent.size()) - return aContent[i_nNr]; - return sNull_; -} - -EmptyElement::EmptyElement( const char * i_sName ) - : XmlElement(i_sName) -{ -} - -SglAttrElement::SglAttrElement( const char * i_sName, - const char * i_sAttrName ) - : EmptyElement(i_sName), - sAttrName(i_sAttrName) -{ -} - -void -SglAttrElement::Parse( X2CParser & io_rParser ) -{ - io_rParser.Parse_SglAttr(sAttrValue, Name(), sAttrName); -} - -void -SglAttrElement::Write2Html( HtmlCreator & io_rHC ) const -{ - io_rHC.Write_SglText( Name(), sAttrValue ); -} - -MultipleAttrElement::MultipleAttrElement( const char * i_sName, - const char ** i_sAttrNames, - unsigned i_nSize ) - : EmptyElement(i_sName) -{ - for ( unsigned i = 0; i < i_nSize; ++i ) - { - aAttrNames.push_back(Simstr(i_sAttrNames[i])); - aAttrValues.push_back(Simstr("")); - } -} - -void -MultipleAttrElement::Parse( X2CParser & io_rParser ) -{ - io_rParser.Parse_MultipleAttr(aAttrValues, Name(), aAttrNames); -} - -void -MultipleAttrElement::Write2Html( HtmlCreator & io_rHC ) const -{ - if ( ! aAttrValues[0].is_no_text() ) - io_rHC.Write_ReferenceDocu( Name(), aAttrValues[0], aAttrValues[1], aAttrValues[2] ); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/xmlelem.hxx b/xml2cmp/source/xcd/xmlelem.hxx deleted file mode 100644 index b42eb4337..000000000 --- a/xml2cmp/source/xcd/xmlelem.hxx +++ /dev/null @@ -1,241 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef X2C_XMLELEM_HXX -#define X2C_XMLELEM_HXX - - - -// USED SERVICES - // BASE CLASSES - // COMPONENTS -#include "../support/sistr.hxx" -#include "../support/list.hxx" -#include "../support/syshelp.hxx" - // PARAMETERS - - -class X2CParser; -class HtmlCreator; -class Index; - -class XmlElement -{ - public: - virtual ~XmlElement() {} - virtual void Parse( - X2CParser & io_rParser ) = 0; - virtual void Write2Html( - HtmlCreator & io_rHC ) const = 0; - virtual void Insert2Index( - Index & o_rIndex ) const; // Default: Does nothing, but can be overwritten. - - const Simstr & Name() const { return sName; } - - protected: - XmlElement( - const char * i_sName ); - private: - Simstr sName; -}; - - -class MultipleElement : public XmlElement -{ - public: - ~MultipleElement(); - - virtual XmlElement * - FindChild( - const Simstr & i_sChildName ); - - - protected: - typedef DynamicList<XmlElement> ChildList; - - MultipleElement( - const char * i_sName ); - - void AddChild( - XmlElement & let_drElement ); - - const ChildList & Children() const { return aChildren; } - ChildList & Children() { return aChildren; } - - private: - ChildList aChildren; -}; - -class SequenceElement : public MultipleElement -{ - public: - virtual void Parse( - X2CParser & io_rParser ); - virtual void Write2Html( - HtmlCreator & io_rHC ) const; - - protected: - SequenceElement( - const char * i_sName, - unsigned i_nIndexNameElement = 0 ); - private: - unsigned nIndexNameElement; -}; - -class FreeChoiceElement : public MultipleElement -{ - public: - FreeChoiceElement(); - using MultipleElement::AddChild; - - virtual void Parse( - X2CParser & io_rParser ); - virtual void Write2Html( - HtmlCreator & io_rHC ) const; -}; - -class ListElement : public MultipleElement -{ - public: - typedef XmlElement * (*F_CREATE)(const Simstr &); - - ListElement( - const char * i_sElementsName, - F_CREATE i_fCreateNewElement ); - - virtual void Parse( - X2CParser & io_rParser ); - virtual void Write2Html( - HtmlCreator & io_rHC ) const; - virtual XmlElement * - Create_and_Add_NewElement(); - private: - F_CREATE fCreateNewElement; -}; - -class TextElement : public XmlElement -{ - public: - E_LinkType LinkType() const { return eLinkType; } - bool IsReversedName() const { return bReverseName; } - protected: - TextElement( - const char * i_sName, - E_LinkType i_eLinkType, - bool i_bReverseName ); - private: - E_LinkType eLinkType; - bool bReverseName; -}; - -class SglTextElement : public TextElement -{ - public: - SglTextElement( - const char * i_sName, - E_LinkType i_eLinkType, - bool i_bReverseName ); - - virtual void Parse( - X2CParser & io_rParser ); - virtual void Write2Html( - HtmlCreator & io_rHC ) const; - virtual const Simstr & - Data() const { return sContent; } - private: - Simstr sContent; -}; - -class MultipleTextElement : public TextElement -{ - public: - MultipleTextElement( - const char * i_sName, - E_LinkType i_eLinkType, - bool i_bReverseName ); - - virtual void Parse( - X2CParser & io_rParser ); - virtual void Write2Html( - HtmlCreator & io_rHC ) const; - virtual const Simstr & - Data( - unsigned i_nNr ) const; - virtual unsigned Size() const { return aContent.size(); } - - private: - List<Simstr> aContent; -}; - -class EmptyElement : public XmlElement -{ - protected: - EmptyElement( - const char * i_sName ); -}; - -class SglAttrElement : public EmptyElement -{ - public: - SglAttrElement( - const char * i_sName, - const char * i_sAttrName ); - - virtual void Parse( - X2CParser & io_rParser ); - virtual void Write2Html( - HtmlCreator & io_rHC ) const; - private: - Simstr sAttrName; - Simstr sAttrValue; -}; - - -class MultipleAttrElement : public EmptyElement -{ - public: - MultipleAttrElement( - const char * i_sName, - const char ** i_sAttrNames, - unsigned i_nSize ); - - virtual void Parse( - X2CParser & io_rParser ); - virtual void Write2Html( - HtmlCreator & io_rHC ) const; - private: - List<Simstr> aAttrNames; - List<Simstr> aAttrValues; -}; - -// IMPLEMENTATION - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/xmltree.cxx b/xml2cmp/source/xcd/xmltree.cxx deleted file mode 100644 index 240f41130..000000000 --- a/xml2cmp/source/xcd/xmltree.cxx +++ /dev/null @@ -1,252 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include <xmltree.hxx> - - -// NOT FULLY DEFINED SERVICES -#include <cr_html.hxx> -#include <cr_index.hxx> - - -char C_sMODULEDESCRIPTION[] = "module-description"; -char C_sCOMPONENTDESCRIPTION[] = "component-description"; -char C_sAuthor[] = "author"; -char C_sName[] = "name"; -char C_sDescription[] = "description"; -char C_sReferenceDocu[] = "reference-docu"; -char C_sModuleName[] = "module-name"; -char C_sLoaderName[] = "loader-name"; -char C_sSupportedService[] = "supported-service"; -char C_sServiceDependency[] = "service-dependency"; -char C_sProjectBuildDependency[] = "project-build-dependency"; -char C_sRuntimeModuleDependency[] = "runtime-module-dependency"; -char C_sLanguage[] = "language"; -char C_sStatus[] = "status"; -char C_sType[] = "type"; -char C_sAttr_value[] = "value"; -char C_sAttr_xl_href[] = "xlink:href"; -char C_sAttr_xl_role[] = "xlink:role"; -char C_sAttr_xl_title[] = "xlink:title"; -char C_sAttr_xmlns[] = "xmlns:xlink"; -char C_sAttr_xl_type[] = "xlink:type"; -char C_sCompDescrListTitle[] = "Component Descriptions"; - - -FreeChoiceElement * Create_ModuleDescrOptional_Element( - MultipleTextElement * & - o_rTypes, - MultipleTextElement * & - o_rServiceDependencies ); -FreeChoiceElement * Create_CompDescrOptional_Element( - MultipleTextElement * & - o_rTypes, - MultipleTextElement * & - o_rServiceDependencies ); - - - -ModuleDescription::ModuleDescription() - : SequenceElement(C_sMODULEDESCRIPTION), - pModuleName(0), - pCdList(0), - pTypes(0), - pServiceDependencies(0) -{ - pModuleName = new MdName; - AddChild( *pModuleName ); - pCdList = new CompDescrList; - AddChild( *pCdList ); - AddChild( *Create_ModuleDescrOptional_Element( pTypes, pServiceDependencies ) ); -} - -const Simstr & -ModuleDescription::ModuleName() const -{ - return pModuleName->Data(); -} - -void -ModuleDescription::Get_SupportedServices( List< const MultipleTextElement * > & o_rServices ) const -{ - o_rServices.push_back(pServiceDependencies); - pCdList->Get_SupportedServices( o_rServices ); -} - -void -ModuleDescription::Get_Types( List< const MultipleTextElement * > & o_rTypes ) const -{ - o_rTypes.push_back(pTypes); - pCdList->Get_Types( o_rTypes ); -} - -void -ModuleDescription::Get_ServiceDependencies( List< const MultipleTextElement * > & o_rServices ) const -{ - pCdList->Get_ServiceDependencies( o_rServices ); -} - -ComponentDescription::ComponentDescription() - : SequenceElement(C_sCOMPONENTDESCRIPTION,1), - pComponentName(0), - pSupportedServices(0), - pTypes(0), - pServiceDependencies(0) -{ - AddChild( *new SglTextElement(C_sAuthor, lt_nolink, false) ); - pComponentName = new CdName; - AddChild( *pComponentName ); - AddChild( *new SglTextElement(C_sDescription, lt_nolink, false) ); - AddChild( *new SglTextElement(C_sLoaderName, lt_idl, true) ); - AddChild( *new SglTextElement(C_sLanguage, lt_nolink, false) ); - AddChild( *new SglAttrElement(C_sStatus, C_sAttr_value) ); - pSupportedServices = new SupportedService; - AddChild( *pSupportedServices ); - AddChild( *Create_CompDescrOptional_Element( pTypes, pServiceDependencies ) ); -} - -CompDescrList::CompDescrList() - : ListElement(C_sCOMPONENTDESCRIPTION, 0) -{ -} - -void -CompDescrList::Write2Html( HtmlCreator & io_rHC ) const -{ - io_rHC.StartBigCell(C_sCompDescrListTitle); - ListElement::Write2Html(io_rHC); - io_rHC.FinishBigCell(); -} - -XmlElement * -CompDescrList::Create_and_Add_NewElement() -{ - ComponentDescription * pCD = new ComponentDescription; - Children().push_back(pCD); - aCDs.push_back(pCD); - return pCD; -} - -void -CompDescrList::Get_SupportedServices( List< const MultipleTextElement * > & o_rResult ) const -{ - unsigned i_max = aCDs.size();; - for (unsigned i = 0; i < i_max; ++i) - { - o_rResult.push_back(& aCDs[i]->SupportedServices()); - } // end for -} - -void -CompDescrList::Get_Types( List< const MultipleTextElement * > & o_rResult ) const -{ - unsigned i_max = aCDs.size();; - for (unsigned i = 0; i < i_max; ++i) - { - o_rResult.push_back(& aCDs[i]->Types()); - } // end for -} - -void -CompDescrList::Get_ServiceDependencies( List< const MultipleTextElement * > & o_rResult ) const -{ - unsigned i_max = aCDs.size();; - for (unsigned i = 0; i < i_max; ++i) - { - o_rResult.push_back(& aCDs[i]->ServiceDependencies()); - } // end for -} - -MdName::MdName() - : SglTextElement(C_sModuleName, lt_html, false) -{ -} - -void -MdName::Write2Html( HtmlCreator & io_rHC ) const -{ - io_rHC.Write_SglTextElement( *this, true ); -} - -CdName::CdName() - : SglTextElement(C_sName, lt_html, true) -{ -} - -void -CdName::Write2Html( HtmlCreator & io_rHC ) const -{ - io_rHC.Write_SglTextElement( *this, true ); -} - -SupportedService::SupportedService() - : MultipleTextElement(C_sSupportedService, lt_idl, true) -{ -} - -void -SupportedService::Insert2Index( Index & o_rIndex ) const -{ - for ( unsigned i = 0; i < Size(); ++i ) - { - o_rIndex.InsertSupportedService( Data(i) ); - } -} - -FreeChoiceElement * -Create_ModuleDescrOptional_Element( MultipleTextElement * & o_rTypes, - MultipleTextElement * & o_rServiceDependencies ) -{ - FreeChoiceElement * ret = Create_CompDescrOptional_Element( o_rTypes, o_rServiceDependencies ); - - ret->AddChild( *new MultipleTextElement(C_sProjectBuildDependency, lt_nolink, false) ); - ret->AddChild( *new MultipleTextElement(C_sRuntimeModuleDependency, lt_nolink, false) ); - return ret; -} - -FreeChoiceElement * -Create_CompDescrOptional_Element( MultipleTextElement * & o_rTypes, - MultipleTextElement * & o_rServiceDependencies ) -{ - FreeChoiceElement * ret = new FreeChoiceElement; - const unsigned C_sRefDocuAttrNumber = 5; - static const char * C_sRefDocuAttrNames[C_sRefDocuAttrNumber] - = { C_sAttr_xl_href, C_sAttr_xl_role, C_sAttr_xl_title, C_sAttr_xmlns, C_sAttr_xl_type }; - - ret->AddChild( *new MultipleAttrElement(C_sReferenceDocu, C_sRefDocuAttrNames, C_sRefDocuAttrNumber) ); - o_rServiceDependencies = new MultipleTextElement(C_sServiceDependency, lt_idl, true); - ret->AddChild( *o_rServiceDependencies ); - o_rTypes = new MultipleTextElement(C_sType, lt_idl, true); - ret->AddChild( *o_rTypes ); - return ret; -} - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/source/xcd/xmltree.hxx b/xml2cmp/source/xcd/xmltree.hxx deleted file mode 100644 index 7728f586d..000000000 --- a/xml2cmp/source/xcd/xmltree.hxx +++ /dev/null @@ -1,148 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef X2C_XMLTREE_HXX -#define X2C_XMLTREE_HXX - - - -// USED SERVICES - // BASE CLASSES -#include "xmlelem.hxx" - // COMPONENTS -#include "../support/sistr.hxx" -#include "../support/list.hxx" - // PARAMETERS - - -class CompDescrList; - -class ModuleDescription : public SequenceElement -{ - public: - ModuleDescription(); - - const Simstr & ModuleName() const; - void Get_SupportedServices( /// @return also the children of component-description. - List< const MultipleTextElement * > & - o_rServices ) const; - void Get_Types( - List< const MultipleTextElement * > & - o_rTypes ) const; - void Get_ServiceDependencies( - List< const MultipleTextElement * > & - o_rServices ) const; - private: - SglTextElement * pModuleName; - CompDescrList * pCdList; - MultipleTextElement * - pTypes; - MultipleTextElement * - pServiceDependencies; -}; - - -class ComponentDescription : public SequenceElement -{ - public: - ComponentDescription(); - - const Simstr & ComponentName() const { return pComponentName->Data(); } - const MultipleTextElement & - SupportedServices() const - { return *pSupportedServices; } - const MultipleTextElement & - Types() const { return *pTypes; } - const MultipleTextElement & - ServiceDependencies() const - { return *pServiceDependencies; } - private: - SglTextElement * pComponentName; - MultipleTextElement * - pSupportedServices; - MultipleTextElement * - pTypes; - MultipleTextElement * - pServiceDependencies; -}; - -class CompDescrList : public ListElement -{ - public: - CompDescrList(); - virtual void Write2Html( - HtmlCreator & io_rHC ) const; - virtual XmlElement * - Create_and_Add_NewElement(); - - void Get_SupportedServices( - List< const MultipleTextElement * > & - o_rResult ) const; - void Get_Types( - List< const MultipleTextElement * > & - o_rResult ) const; - void Get_ServiceDependencies( - List< const MultipleTextElement * > & - o_rResult ) const; - private: - List< ComponentDescription * > - aCDs; -}; - -class MdName : public SglTextElement -{ - public: - MdName(); - virtual void Write2Html( - HtmlCreator & io_rHC ) const; -}; - -class CdName : public SglTextElement -{ - public: - CdName(); - virtual void Write2Html( - HtmlCreator & io_rHC ) const; -}; - -class SupportedService : public MultipleTextElement -{ - public: - SupportedService(); - - virtual void Insert2Index( - Index & o_rIndex ) const; -}; - - -// IMPLEMENTATION - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xml2cmp/util/makefile.mk b/xml2cmp/util/makefile.mk deleted file mode 100644 index b50d318a1..000000000 --- a/xml2cmp/util/makefile.mk +++ /dev/null @@ -1,58 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org 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 Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=.. - -PRJNAME=xml2cmp -TARGET=xml2cmp -TARGETTYPE=CUI - -# --- Settings ----------------------------------------------------- -ENABLE_EXCEPTIONS=TRUE - -.INCLUDE : settings.mk - -.IF "$(CROSS_COMPILING)"=="YES" -all: - @echo Nothing done when cross-compiling -.ENDIF - -# --- Files -------------------------------------------------------- - -# --- Targets ------------------------------------------------------ - -APP1TARGET= $(TARGET) -APP1STACK= 1000000 - -UWINAPILIB=$(0) -LIBSALCPPRT=$(0) - -APP1LIBS= $(LB)$/x2c_xcd.lib $(LB)$/x2c_support.lib -APP1DEPN= $(LB)$/x2c_xcd.lib $(LB)$/x2c_support.lib -APP1RPATH= NONE - -.INCLUDE : target.mk |