diff options
1167 files changed, 527915 insertions, 0 deletions
diff --git a/rsc/inc/rscall.h b/rsc/inc/rscall.h new file mode 100644 index 000000000000..35528e750e9d --- /dev/null +++ b/rsc/inc/rscall.h @@ -0,0 +1,162 @@ +/************************************************************************* + * + * $RCSfile: rscall.h,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************ + + Source Code Control System - Header + + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscall.h,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $ + +**************************************************************************/ + +#ifndef _RSCALL_H +#define _RSCALL_H + +#ifndef _TOOLS_STRING_HXX +#include <tools/string.hxx> +#endif +#ifndef _RSCTOOLS_HXX +#include <rsctools.hxx> +#endif +#ifndef _RSCERROR_H +#include <rscerror.h> +#endif +#ifndef _RSCDEF_HXX +#include <rscdef.hxx> +#endif + +/******************* T y p e s *******************************************/ +typedef char * CLASS_DATA; // Zeiger auf die Daten einer Klasse + +/******************* C l a s s e s F o r w a r d s *********************/ +class RscCompiler; +class HashString; +class RscTop; +class RscTypCont; +class RscIncList; + +/******************* G l o b a l V a r i a b l e s *********************/ +extern HashString* pHS; +extern ByteString* pStdParType; +extern ByteString* pStdPar1; +extern ByteString* pStdPar2; +extern ByteString* pWinParType; +extern ByteString* pWinPar1; +extern ByteString* pWinPar2; +extern USHORT nRefDeep; +extern USHORT nRsc_XYMAPMODEId; +extern USHORT nRsc_WHMAPMODEId; +extern USHORT nRsc_X; +extern USHORT nRsc_Y; +extern USHORT nRsc_WIDTH; +extern USHORT nRsc_HEIGHT; +extern USHORT nRsc_DELTALANG; +extern USHORT nRsc_DELTASYSTEM; +extern USHORT nRsc_EXTRADATA; + +/******************* D e f i n e s ***************************************/ + +#define HELP_FLAG 0x0001 // Hilfe anzeigen +#define NOPREPRO_FLAG 0x0002 // kein Preprozesor +#define NOSYNTAX_FLAG 0x0004 // keine Syntaxanalyse +#define NOLINK_FLAG 0x0008 // nicht linken +#define NORESFILE_FLAG 0x0010 // keine .res-Datei erzeugen +#define DEFINE_FLAG 0x0020 // es wurde Definitionen angegeben +#define INCLUDE_FLAG 0x0040 // der Include-Pfad wurde erweitert +#define MSCPREPRO_FLAG 0x0080 // spezial Preprozessor +#define PRINTSYNTAX_FLAG 0x0100 // Syntax ausgeben +#define PRELOAD_FLAG 0x0200 // Alle Ressourcen Preloaden +#define SMART_FLAG 0x0400 // abgekuertze Name +#define SRSDEFAULT_FLAG 0x1000 // immer der Default geschrieben +#define NOSYSRESTEST_FLAG 0x2000 // ueberprueft nicht die Richtigkeit von (bmp, ico, cur) + + +/******************* T y p e s *******************************************/ +enum RSCCLASS_TYPE { RSCCLASS_BOOL, RSCCLASS_STRING, RSCCLASS_NUMBER, + RSCCLASS_CONST, RSCCLASS_COMPLEX, RSCCLASS_ENUMARRAY }; + +typedef void (* VarEnumCallbackProc)( void * pData, RSCCLASS_TYPE, HASHID ); + +/******************* S t r u c t s ***************************************/ +struct RSCINST { + RscTop * pClass; + CLASS_DATA pData; + + RSCINST(){ pClass = NULL; pData = NULL; } + RSCINST( RscTop * pCl, CLASS_DATA pClassData ){ + pClass = pCl; + pData = pClassData; + } + BOOL IsInst() const { return( pData != NULL ); } +}; + +/********************** S U B I N F O S T R U C T ************************/ +struct SUBINFO_STRUCT { + SUBINFO_STRUCT(){ nPos = 0; pClass = NULL; }; + RscId aId; // Identifier der Resource + USHORT nPos; // Position der Resource + RscTop * pClass; // Klasse des Eintrages +}; + +/******************* F u n c t i o n *************************************/ +// Legt Hashtabelle an, legt Strings zur Initialisierung an +void InitRscCompiler(); + +#endif // _RSCALL_H diff --git a/rsc/inc/rscarray.hxx b/rsc/inc/rscarray.hxx new file mode 100644 index 000000000000..420afdf54074 --- /dev/null +++ b/rsc/inc/rscarray.hxx @@ -0,0 +1,187 @@ +/************************************************************************* + * + * $RCSfile: rscarray.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************ + + Source Code Control System - Header + + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscarray.hxx,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $ + +**************************************************************************/ + +#ifndef _RSCARRAY_HXX +#define _RSCARRAY_HXX + +#ifndef _RSCALL_H +#include <rscall.h> +#endif +#ifndef _RSCERROR_H +#include <rscerror.h> +#endif +#ifndef _RSCTOP_HXX +#include <rsctop.hxx> +#endif + +class RscEnum; + +/******************* R s c A r r a y ************************************/ +class RscInstNode : public IdNode +{ + USHORT nTypeId; +public: + RSCINST aInst; + RscInstNode( USHORT nId ); + ~RscInstNode(); + virtual USHORT GetId() const; + RscInstNode * Left() const { return (RscInstNode *)pLeft ; }; + RscInstNode * Right() const{ return (RscInstNode *)pRight ; }; + RscInstNode * Search( USHORT nId ) const + { + return (RscInstNode *)IdNode::Search( nId ); + } +}; + +struct RscArrayInst +{ + RscInstNode * pNode; +}; + +/* Der Baum wird ueber die Werte des Enums sortiert, nicht ueber + seine HashId. +*/ +class RscArray : public RscTop +{ +protected: + RscEnum * pTypeClass; // Typ der Eintraege + USHORT nSize; // Groesse der Instanzdaten dieser Klasse + // mit Superklassen + USHORT nOffInstData;// Offset auf eigen Instanzdaten + USHORT * pWriteTypeValue;// Was soll geschrieben werden + USHORT * pWriteDfltTypeValue; // fallback fuer WriteTypeValue + void WriteSrcArray( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, const char * ); +public: + RscArray( HASHID nId, USHORT nTypId, + RscTop * pSuper, RscEnum * pTypeClass, + USHORT * pTypeValue, USHORT * pFallBackType ); + ~RscArray(); + virtual RSCCLASS_TYPE GetClassType() const; + + void SetTypeClass( RscEnum * pClass ) + { + pTypeClass = pClass; + } + virtual RscTop * GetTypeClass() const; + RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, BOOL ); + void Destroy( const RSCINST & rInst ); + virtual ERRTYPE GetValueEle( const RSCINST & rInst, long lValue, + RscTop * pCreateClass, + RSCINST * pGetInst ); + virtual ERRTYPE GetArrayEle( const RSCINST & rInst, HASHID nId, + RscTop * pCreateClass, + RSCINST * pGetInst ); + + // Gibt die Groesse der Klasse in Bytes + USHORT Size(){ return( nSize ); }; + + BOOL IsConsistent( const RSCINST & rInst, RscInconsList * pList ); + virtual void SetToDefault( const RSCINST & rInst ); + BOOL IsDefault( const RSCINST & rInst ); + BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + + virtual void WriteSrcHeader( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, + const RscId & aId, const char * ); + void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, const char * ); + ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, USHORT, BOOL bExtra ); + virtual void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, + const char * ); +}; + +class RscClassArray : public RscArray +{ +public: + RscClassArray( HASHID nId, USHORT nTypId, + RscTop * pSuper, RscEnum * pTypeClass, + USHORT * pTypeValue, USHORT * pFallBackType ); + ~RscClassArray(); + virtual void WriteSrcHeader( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, + const RscId & aId, const char * ); + void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, const char * ); + virtual ERRTYPE WriteRcHeader( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, const RscId & aId, + USHORT nDeep, BOOL bExtra ); +}; + + +class RscLangArray : public RscArray +{ +public: + RscLangArray( HASHID nId, USHORT nTypId, + RscTop * pSuper, RscEnum * pTypeClass, + USHORT * pTypeValue, USHORT * pFallBackType ); + virtual RSCCLASS_TYPE GetClassType() const; +}; + +#endif //_RSCARRAY diff --git a/rsc/inc/rscclass.hxx b/rsc/inc/rscclass.hxx new file mode 100644 index 000000000000..df5d5cb5c557 --- /dev/null +++ b/rsc/inc/rscclass.hxx @@ -0,0 +1,188 @@ +/************************************************************************* + * + * $RCSfile: rscclass.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************ + + Source Code Control System - Header + + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscclass.hxx,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $ + +**************************************************************************/ + +#ifndef _RSCCLASS_HXX +#define _RSCCLASS_HXX + +#ifndef _RSCALL_H +#include <rscall.h> +#endif +#ifndef _RSCERROR_H +#include <rscerror.h> +#endif +#ifndef _RSCHASH_HXX +#include <rschash.hxx> +#endif +#ifndef _RSCTOP_HXX +#include <rsctop.hxx> +#endif + +/******************* R s c C l a s s *************************************/ +class RscClass : public RscTop +{ +protected: + struct RscClassInst{ + ULONG nVarDflt; + }; + struct VARTYPE_STRUCT { + HASHID nVarName; // Variablenname + RSCVAR nVarType; // Variablentyp + USHORT nMask; // Maskierungsbit + USHORT nOffset; // Beginn der Instanzdaten + RscTop * pClass; // Klasse + CLASS_DATA pDefault; // Zeiger auf DefaultDaten + HASHID nDataBaseName;//Name fuer Fremddatenbereich + }; + USHORT nSuperSize; // Groesse der Instanzdaten der SuperKl. + USHORT nSize; // Groesse der Instanzdaten dieser Klasse + // mit Superklassen + USHORT nEntries; // Eintraege in pVarTypeList + VARTYPE_STRUCT * pVarTypeList; // Variablenliste + RSCINST GetInstData( CLASS_DATA pData, USHORT nEle, + BOOL bGetCopy = FALSE ); + CLASS_DATA GetDfltData( USHORT nEle ); + BOOL IsDflt( CLASS_DATA pData, USHORT nEle ); + BOOL IsValueDflt( CLASS_DATA pData, USHORT nEle ); + void SetVarDflt( CLASS_DATA pData, USHORT nEle, + BOOL bSet ); + long GetCorrectValues( const RSCINST & rInst, USHORT nVarPos, + USHORT nTupelIdx, RscTypCont * pTC ); +public: + RscClass( HASHID nId, USHORT nTypId, RscTop * pSuperCl ); + ~RscClass(); + + virtual RSCCLASS_TYPE GetClassType() const; + + void Pre_dtor(); + ERRTYPE SetVariable( HASHID nVarName, RscTop * pClass, + RSCINST * pDflt, + RSCVAR nVarType, USHORT nMask, + HASHID nDataBaseName ); + virtual void EnumVariables( void * pData, VarEnumCallbackProc ); + RSCINST GetVariable( const RSCINST & rInst, HASHID nVarName, + const RSCINST & rInitInst, + BOOL nInitDflt = FALSE, + RscTop * pCreateClass = NULL ); + RSCINST GetCopyVar( const RSCINST & rInst, HASHID nVarName ); + + // Gibt die Groesse der Klasse in Bytes + USHORT Size(){ return( nSize ); }; + + BOOL IsConsistent( const RSCINST & rInst, RscInconsList * pList ); + void SetToDefault( const RSCINST & rInst ); + BOOL IsDefault( const RSCINST & rInst ); + BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + void SetDefault( const RSCINST & rData, HASHID nVarId ); + RSCINST GetDefault( HASHID nVarId ); + + RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, BOOL ); + void Destroy( const RSCINST & rInst ); + void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, const char * ); + ERRTYPE WriteInstRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, USHORT, BOOL bExtra ); + ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, USHORT, BOOL bExtra ); + void WriteSyntax( FILE * fOutput, RscTypCont * pTC ); + + void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, + const char * ); + void WriteRcCtor( FILE * fOutput, RscTypCont * pTC ); +}; + +class RscSysDepend : public RscClass +{ +public: + RscSysDepend( HASHID nId, USHORT nTypId, RscTop * pSuper ); + ERRTYPE WriteSysDependRc( const RSCINST &, RscWriteRc & aMem, + RscTypCont * pTC, USHORT, BOOL bExtra, + BOOL bFirst = FALSE ); + ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem, + RscTypCont * pTC, USHORT, BOOL bExtra ); +}; + +class RscFirstSysDepend : public RscSysDepend +{ +public: + RscFirstSysDepend( HASHID nId, USHORT nTypId, + RscTop * pSuper ); + ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem, + RscTypCont * pTC, USHORT, BOOL bExtra ); +}; + +class RscTupel : public RscClass +{ +public: + RscTupel( HASHID nId, USHORT nTypId, RscTop * pSuper ); + RSCINST GetTupelVar( const RSCINST & rInst, USHORT nPos, + const RSCINST & rInitInst ); + void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, const char * ); +}; + +#endif //_RSCCLASS_HXX diff --git a/rsc/inc/rscclobj.hxx b/rsc/inc/rscclobj.hxx new file mode 100644 index 000000000000..334bb9c145f1 --- /dev/null +++ b/rsc/inc/rscclobj.hxx @@ -0,0 +1,183 @@ +/************************************************************************* + * + * $RCSfile: rscclobj.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************ + + Source Code Control System - Header + + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscclobj.hxx,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $ + + Source Code Control System - Update + + $Log: not supported by cvs2svn $ + Revision 1.6 2000/09/17 12:51:09 willem.vandorp + OpenOffice header added. + + Revision 1.5 2000/07/26 17:13:17 willem.vandorp + Headers/footers replaced + + Revision 1.4 1997/08/27 18:18:12 MM + neue Headerstruktur + + + Rev 1.3 27 Aug 1997 18:18:12 MM + neue Headerstruktur + + Rev 1.2 21 Nov 1995 19:49:10 TLX + Neuer Link + + Rev 1.1 12 Jan 1994 15:18:10 mm + Alignementprobleme und Warnings fuer DEC-Alpha beseitigt + + Rev 1.0 10 Aug 1992 07:14:38 MM + Initial revision. + + Rev 1.2 23 Mar 1992 15:23:42 MM + + Rev 1.1 10 Dec 1991 11:49:10 MM + ObjNode::DelObjNode + + Rev 1.0 26 Nov 1991 08:57:04 MM + Initial revision. + +**************************************************************************/ + +#ifndef _RSCCLOBJ_HXX +#define _RSCCLOBJ_HXX + +#ifndef _RSCTREE_HXX +#include <rsctree.hxx> +#endif +#ifndef _RSCDEF_HXX +#include <rscdef.hxx> +#endif +#ifndef _RSCALL_H +#include <rscall.h> +#endif + +/****************** C L A S S E S ****************************************/ +class RscTypCont; + +/*********** R s c I n c o n s i s t e n t *******************************/ +class RscInconsistent { +public: + RscId aFirstId; //Paar von inkonsistenten Id's + RscId aSecondId; + RscInconsistent( const RscId & rFirst, const RscId & rSecond ){ + aFirstId = rFirst; + aSecondId = rSecond; + }; +}; + +DECLARE_LIST( RscInconsList, RscInconsistent * ) + +/******************* O b j N o d e ***************************************/ +class ObjNode : public IdNode{ + RscId aRscId; // Id der Resource + CLASS_DATA pRscObj;// pointer to a resourceobject + ULONG lFileKey;// Dateischluessel +public: + ObjNode( const RscId & rId, CLASS_DATA pData, ULONG lKey ); + ObjNode * DelObjNode( RscTop * pClass, ULONG lFileKey ); + USHORT GetId() const; + RscId GetRscId(){ return( aRscId ); } + ULONG GetFileKey(){ return lFileKey; }; + ObjNode* Search( const RscId &rName ) const{ + // search the index in the b-tree + return( (ObjNode *)IdNode::Search( rName ) ); + } + BOOL Insert( ObjNode* pTN ){ + // insert a new node in the b-tree + return( IdNode::Insert( (IdNode *)pTN ) ); + } + CLASS_DATA GetRscObj(){ + // get the Object from this Node + return( pRscObj ); + } + BOOL IsConsistent( RscInconsList * pList = NULL ); +}; + +/******************* R e f N o d e ***************************************/ +class RefNode : public IdNode{ + HASHID nTypNameId; // index of a Name in a hashtabel +public: + ObjNode* pObjBiTree; // Zeiger auf Objektbaum + RefNode( HASHID nTyp ); + USHORT GetId() const; + RefNode* Search( HASHID typ ) const{ + // search the index in the b-tree + return( (RefNode *)IdNode::Search( typ ) ); + }; + BOOL Insert( RefNode* pTN ){ + // insert a new node in the b-tree + return( IdNode::Insert( (IdNode *)pTN ) ); + }; + BOOL PutObjNode( ObjNode * pPutObject ); + + // insert new node in b-tree pObjBiTree + ObjNode * GetObjNode( const RscId &rRscId ); + + ObjNode * GetObjNode(){ + // hole pObjBiTree + return( pObjBiTree ); + }; +}; + +#endif // _RSCCLOBJ_HXX diff --git a/rsc/inc/rscconst.hxx b/rsc/inc/rscconst.hxx new file mode 100644 index 000000000000..580aac51a689 --- /dev/null +++ b/rsc/inc/rscconst.hxx @@ -0,0 +1,146 @@ +/************************************************************************* + * + * $RCSfile: rscconst.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************ + + Source Code Control System - Header + + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscconst.hxx,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $ + +**************************************************************************/ + +#ifndef _RSCCONST_HXX +#define _RSCCONST_HXX + +#ifndef _RSCALL_H +#include <rscall.h> +#endif +#ifndef _RSCERROR_H +#include <rscerror.h> +#endif +#ifndef _RSCHASH_HXX +#include <rschash.hxx> +#endif +#ifndef _RSCTOP_HXX +#include <rsctop.hxx> +#endif + +/******************* R s c C o n s t *************************************/ +class RscConst : public RscTop +{ +protected: + struct VarEle { + HASHID nId; // Name der Konstante + INT32 lValue; // Wert der Konstante + }; + VarEle * pVarArray; // Zeiger auf das Feld mit Konstanten + USHORT nEntries; // Anzahle der Eintraege im Feld +public: + RscConst( HASHID nId, USHORT nTypId ); + ~RscConst(); + virtual RSCCLASS_TYPE GetClassType() const; + USHORT GetEntryCount() const { return nEntries; } + // Die erlaubten Werte werden gesetzt + ERRTYPE SetConstant( HASHID nVarName, INT32 lValue ); + HASHID GetConstant( USHORT nPos ); + BOOL GetConstValue( HASHID nConstId, INT32 * pVal ) const; + BOOL GetValueConst( INT32 nValue, HASHID * pConstId ) const; + USHORT GetConstPos( HASHID nConstId ); + virtual void WriteSyntax( FILE * fOutput, RscTypCont * pTC ); + virtual void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, + const char * ); +}; + +/******************* R s c E n u m ***************************************/ +class RscEnum : public RscConst { + struct RscEnumInst { + USHORT nValue; // Position der Konstanten im Array + BOOL bDflt; // Ist Default + }; + USHORT nSize; + BOOL bUSHORT; +public: + RscEnum( HASHID nId, USHORT nTypId, BOOL bUSHORT = TRUE ); + RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, BOOL ); + USHORT Size(){ return nSize; } + + virtual void SetToDefault( const RSCINST & rInst ) + { + ((RscEnumInst*)rInst.pData)->bDflt = TRUE; + } + BOOL IsDefault( const RSCINST & rInst ) + { + return( ((RscEnumInst*)rInst.pData)->bDflt ); + }; + // Als Default setzen + BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + + ERRTYPE SetConst( const RSCINST & rInst, HASHID nValueId, + long nValue ); + ERRTYPE SetNumber( const RSCINST & rInst, long nValue ); + ERRTYPE GetConst( const RSCINST & rInst, HASHID * ); + ERRTYPE GetNumber( const RSCINST & rInst, long * nValue ); + void WriteSrc( const RSCINST &rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, const char * ); + ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, USHORT, BOOL bExtra ); +}; + +#endif // _RSCCONST_HXX diff --git a/rsc/inc/rsccont.hxx b/rsc/inc/rsccont.hxx new file mode 100644 index 000000000000..ad2877abdad4 --- /dev/null +++ b/rsc/inc/rsccont.hxx @@ -0,0 +1,244 @@ +/************************************************************************* + * + * $RCSfile: rsccont.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************ + + Source Code Control System - Header + + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rsccont.hxx,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $ + + Source Code Control System - Update + + $Log: not supported by cvs2svn $ + Revision 1.11 2000/09/17 12:51:09 willem.vandorp + OpenOffice header added. + + Revision 1.10 2000/07/26 17:13:17 willem.vandorp + Headers/footers replaced + + Revision 1.9 1997/08/27 18:18:04 MM + neue Headerstruktur + + + Rev 1.8 27 Aug 1997 18:18:04 MM + neue Headerstruktur + + Rev 1.7 12 Sep 1996 12:45:38 MM + Eigene Ressourcen definieren + + Rev 1.6 21 Nov 1995 19:49:16 TLX + Neuer Link + + Rev 1.5 25 Aug 1993 15:33:58 mm + Fehler und Warnings beseitigt + + Rev 1.4 04 Feb 1993 17:38:58 mm + GetClassType Fehler verbessert und keine Inline -ctor. + + Rev 1.3 03 Feb 1993 15:03:12 mm + GetClassType() implementiert + + Rev 1.2 05 Jan 1993 10:50:30 mm + Neues Default verhalten + + Rev 1.1 23 Dec 1992 14:02:24 mm + Sprachaenderung + + Rev 1.0 10 Aug 1992 07:14:38 MM + Initial revision. + + Rev 1.13 29 Jul 1992 15:45:18 MM + Aenderungen wg. MSC7.0 + +**************************************************************************/ + +#ifndef _RSCCONT_HXX +#define _RSCCONT_HXX + +#ifndef _RSCALL_H +#include <rscall.h> +#endif +#ifndef _RSCERROR_H +#include <rscerror.h> +#endif +#ifndef _RSCTOP_HXX +#include <rsctop.hxx> +#endif + +/******************* R s c B a s e C o n t *******************************/ +struct ENTRY_STRUCT { + RscId aName; + RSCINST aInst; + void Create(){ aName.Create(); aInst = RSCINST(); } + void Destroy(); +}; +struct RscBaseContInst { + USHORT nEntries; + ENTRY_STRUCT * pEntries; + BOOL bDflt; +}; + +class RscBaseCont : public RscTop +{ +protected: + RscTop * pTypeClass; // Typ der Eintraege + RscTop * pTypeClass1;// Zwei verschiedene Typen moeglich + BOOL bNoId; // Keine Identifier + USHORT nSize; // Groesse der Instanzdaten dieser Klasse + // mit Superklassen + USHORT nOffInstData;// Offset auf eigen Instanzdaten + void DestroyElements( RscBaseContInst * pClassData ); + RSCINST SearchElePos( const RSCINST & rInst, const RscId & rEleName, + RscTop * pClass, USHORT nPos ); +protected: + void ContWriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, const char * ); + ERRTYPE ContWriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, USHORT, BOOL bExtra ); + void ContWriteRcAccess( FILE * fOutput, RscTypCont * pTC, + const char *, BOOL nWriteSize ); +public: + RscBaseCont( HASHID nId, USHORT nTypId, + RscTop * pSuper = NULL, + BOOL bNoId = TRUE ); + ~RscBaseCont(); + virtual RSCCLASS_TYPE GetClassType() const; + void SetTypeClass( RscTop * pClass, RscTop * pClass1 = NULL ) + { + pTypeClass = pClass; + pTypeClass1 = pClass1; + }; + RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, BOOL ); + void Destroy( const RSCINST & rInst ); + ERRTYPE GetElement( const RSCINST & rInst, const RscId & rEleName, + RscTop * pCreateClass, const RSCINST & rCreateInst, + RSCINST * pGetInst ); + RSCINST SearchEle( const RSCINST & rInst, const RscId & rEleName, + RscTop * pClass ); + USHORT GetCount( const RSCINST & rInst ); + RSCINST GetPosEle( const RSCINST & rInst, USHORT nPos ); + ERRTYPE MovePosEle( const RSCINST & rInst, USHORT nDestPos, + USHORT nSourcePos ); + virtual ERRTYPE SetPosRscId( const RSCINST & rInst, USHORT nPos, + const RscId & rRscId); + SUBINFO_STRUCT GetInfoEle( const RSCINST & rInst, USHORT nPos ); + ERRTYPE SetString( const RSCINST &, char * pStr ); + ERRTYPE SetNumber( const RSCINST &, long lValue ); + ERRTYPE SetBool( const RSCINST & rInst, BOOL bValue ); + ERRTYPE SetConst( const RSCINST & rInst, HASHID nValueId, + long nValue ); + ERRTYPE SetRef( const RSCINST & rInst, const RscId & rRefId ); + + // Gibt die Groesse der Klasse in Bytes + USHORT Size(){ return( nSize ); }; + + BOOL IsConsistent( const RSCINST & rInst, RscInconsList * pList ); + void SetToDefault( const RSCINST & rInst ); + BOOL IsDefault( const RSCINST & rInst ); + BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + + void Delete( const RSCINST & rInst, RscTop * pClass, + const RscId & rId ); + void DeletePos( const RSCINST & rInst, USHORT nPos ); + + void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, const char * ); + ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, USHORT , BOOL bExtra); + ERRTYPE WriteHxx( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId & rId ); + ERRTYPE WriteCxx( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId &rId ); +}; + +/******************* R s c C o n t W r i t e S r c ***********************/ +class RscContWriteSrc : public RscBaseCont +{ +public: + RscContWriteSrc( HASHID nId, USHORT nTypId, + RscTop * pSuper = NULL, + BOOL bNoId = TRUE ); + void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, const char * ); +}; + +/******************* R s c C o n t ***************************************/ +class RscCont : public RscContWriteSrc { +public: + RscCont( HASHID nId, USHORT nTypId, + RscTop * pSuper = NULL, + BOOL bNoId = TRUE ); + ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, USHORT, BOOL bExtra ); + void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, + const char * ); +}; + +/******************* R s c C o n t E x t r a D a t a *********************/ +class RscContExtraData : public RscContWriteSrc { +public: + RscContExtraData( HASHID nId, USHORT nTypId, + RscTop * pSuper = NULL, + BOOL bNoId = TRUE ); + ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, USHORT, BOOL bExtra ); +}; + +#endif //_RSCCONT_HXX diff --git a/rsc/inc/rscdb.hxx b/rsc/inc/rscdb.hxx new file mode 100644 index 000000000000..7f92d7e78e46 --- /dev/null +++ b/rsc/inc/rscdb.hxx @@ -0,0 +1,406 @@ +/************************************************************************* + * + * $RCSfile: rscdb.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _RSCDB_HXX +#define _RSCDB_HXX + +#ifndef _TABLE_HXX //autogen +#include <tools/table.hxx> +#endif + +#ifndef _LANG_HXX //autogen +#include <tools/lang.hxx> +#endif + +#ifndef _RSCALL_H +#include <rscall.h> +#endif +#ifndef _RSCKEY_HXX +#include <rsckey.hxx> +#endif +#ifndef _RSCCONST_HXX +#include <rscconst.hxx> +#endif +#ifndef _RSCFLAG_HXX +#include <rscflag.hxx> +#endif +#ifndef _RSCRANGE_HXX +#include <rscrange.hxx> +#endif +#ifndef _RSCSTR_HXX +#include <rscstr.hxx> +#endif +#ifndef _RSCARRAY_HXX +#include <rscarray.hxx> +#endif +#ifndef _RSCDEF_HXX +#include <rscdef.hxx> +#endif + +class RscError; +class REResourceList; +class RscTupel; +class RscCont; + +/****************** R s c T y p C o n ************************************/ +// Liste die alle Basistypen enthaelt +DECLARE_LIST( RscBaseList, RscTop * ) + +// Tabelle fuer Systemabhaengige Resourcen +struct RscSysEntry +{ + USHORT nKey; + USHORT nRscTyp; + ByteString aFileName; + USHORT nTyp; + USHORT nRefId; +}; +DECLARE_LIST( RscSysList, RscSysEntry * ) + +class RscTypCont +{ + CharSet nSourceCharSet; + USHORT nLangTypeId; // Globale Sprachtyp + USHORT nDfltLangTypeId; // fallback fuer globalen Sprachtyp + USHORT nMachineId; // Globaler Maschinentyp + RSCBYTEORDER_TYPE nByteOrder; // Intel oder + ByteString aSearchPath; // Suchen der Bitmap, Icon, Pointer + USHORT nUniqueId; // eindeutiger Id fuer Systemresourcen + ULONG nFilePos; // Position in der Datei ( MTF ) + USHORT nPMId; // eindeutiger Id fuer PM-Rseourcefile + // muss groesser als RSC_VERSIONCONTROL_ID sein + RscTop * pRoot; // Zeiger auf die Wurzel vom Typenbaum + RSCINST aVersion; // Versionskontrollinstanz + + RscBaseList aBaseLst; // Liste der einfachen Resourceklasse + RscSysList aSysLst; // Liste der Systemresourcen + + HASHID nWinBitVarId; // Name der Winbitvariablen + HASHID nBorderId; + HASHID nHideId; + HASHID nClipChildrenId; + HASHID nSizeableId; + HASHID nMoveableId; + HASHID nMinimizeId; + HASHID nMaximizeId; + HASHID nCloseableId; + HASHID nAppId; + HASHID nTabstopId; + HASHID nGroupId; + HASHID nSysmodalId; + HASHID nLeftId; + HASHID nCenterId; + HASHID nRightId; + HASHID nHscrollId; + HASHID nVscrollId; + HASHID nSortId; + HASHID nDefaultId; + HASHID nSVLookId; + HASHID nRepeatId; + HASHID nDropDownId; + HASHID nPassWordId; + HASHID nReadOnlyId; + HASHID nAutoSizeId; + HASHID nSpinId; + HASHID nTabControlId; + HASHID nSimpleModeId; + HASHID nDragId; + HASHID nSaveAsId; + HASHID nOpenId; + HASHID nScrollId; + HASHID nZoomableId; + HASHID nHideWhenDeactivateId; + HASHID nAutoHScrollId; + HASHID nDDExtraWidthId; + HASHID nWordBreakId; + HASHID nLeftLabelId; + HASHID nHasLinesId; + HASHID nHasButtonsId; + HASHID nRectStyleId; + HASHID nLineSpacingId; + HASHID nSmallStyleId; + HASHID nEnableResizingId; + HASHID nDockableId; + HASHID nScaleId; + HASHID nIgnoreTabId; + HASHID nNoSplitDrawId; + HASHID nTopImageId; + HASHID nNoLabelId; + + void Init(); // Initialisiert Klassen und Tabelle + void SETCONST( RscConst *, char *, UINT32 ); + void SETCONST( RscConst *, HASHID, UINT32 ); + RscEnum * InitLangType(); + RscEnum * InitDateFormatType(); + RscEnum * InitTimeFormatType(); + RscEnum * InitWeekDayFormatType(); + RscEnum * InitMonthFormatType(); + RscEnum * InitFieldUnitsType(); + RscEnum * InitDayOfWeekType(); + RscEnum * InitTimeFieldFormat(); + RscEnum * InitColor(); + RscEnum * InitMapUnit(); + RscEnum * InitKey(); + RscEnum * InitTriState(); + RscEnum * InitMessButtons(); + RscEnum * InitMessDefButton(); + RscTupel * InitGeometry(); + RscArray * InitLangGeometry( RscTupel * pGeo ); + RscArray * InitSystemGeometry( RscTupel * pGeo ); + RscCont * InitStringList(); + RscArray * InitLangStringList( RscCont * pStrLst ); + RscTupel * InitStringTupel(); + RscTupel * InitStringLongTupel(); + RscCont * InitStringTupelList( RscTupel * pStringTupel ); + RscCont * InitStringLongTupelList( RscTupel * pStringLongTupel ); + RscArray * InitLangStringTupelList( RscCont * pStrTupelLst ); + RscArray * InitLangStringLongTupelList( RscCont * pStrLongTupelLst ); + + RscTop * InitClassMgr(); + RscTop * InitClassString( RscTop * pSuper ); + RscTop * InitClassBitmap( RscTop * pSuper ); + RscTop * InitClassColor( RscTop * pSuper, RscEnum * pColor ); + RscTop * InitClassImage( RscTop * pSuper, RscTop *pClassBitmap, + RscTop * pClassColor ); + RscTop * InitClassImageList( RscTop * pSuper, RscTop *pClassBitmap, + RscTop * pClassColor ); + RscTop * InitClassWindow( RscTop * pSuper, RscEnum * pMapUnit, + RscArray * pLangGeo ); + RscTop * InitClassSystemWindow( RscTop * pSuper ); + RscTop * InitClassWorkWindow( RscTop * pSuper ); + RscTop * InitClassModalDialog( RscTop * pSuper ); + RscTop * InitClassModelessDialog( RscTop * pSuper ); + RscTop * InitClassControl( RscTop * pSuper ); + RscTop * InitClassPushButton( RscTop * pSuper ); + RscTop * InitClassTriStateBox( RscTop * pSuper, RscEnum * pTriState ); + RscTop * InitClassMenuButton( RscTop * pSuper, RscTop * pClasMenu ); + RscTop * InitClassImageButton( RscTop * pSuper, RscTop * pClassImage, + RscEnum * pTriState ); + RscTop * InitClassEdit( RscTop * pSuper ); + RscTop * InitClassMultiLineEdit( RscTop * pSuper ); + RscTop * InitClassScrollBar( RscTop * pSuper ); + RscTop * InitClassListBox( RscTop * pSuper, RscArray * pStrLst ); + RscTop * InitClassMultiListBox( RscTop * pSuper ); + RscTop * InitClassComboBox( RscTop * pSuper, RscArray * pStrLst ); + RscTop * InitClassFixedText( RscTop * pSuper ); + RscTop * InitClassFixedBitmap( RscTop * pSuper, RscTop * pClassBitmap ); + RscTop * InitClassFixedImage( RscTop * pSuper, RscTop * pClassImage ); + RscTop * InitClassImageRadioButton( RscTop * pSuper, RscTop * pClassImage ); + RscTop * InitClassKeyCode( RscTop * pSuper, RscEnum * pKey ); + RscTop * InitClassAccelItem( RscTop * pSuper, RscTop * pKeyCode ); + RscTop * InitClassAccel( RscTop * pSuper, RscTop * pClassAccelItem ); + RscTop * InitClassMenuItem( RscTop * pSuper, RscTop * pClassBitmap, + RscTop * pClassKeyCode ); + RscTop * InitClassMenu( RscTop * pSuper, RscTop * pMenuItem ); + RscTop * InitClassMessBox( RscTop * pSuper, + RscEnum * pMessButtons, + RscEnum * pMessDefButton ); + RscTop * InitClassSplitter( RscTop * pSuper ); + RscTop * InitClassSplitWindow( RscTop * pSuper ); + RscTop * InitClassTime( RscTop * pSuper ); + RscTop * InitClassDate( RscTop * pSuper, RscEnum * pDayOfWeek ); + RscTop * InitClassInt1( RscTop * pSuper, + RscEnum * pDateFormat, + RscEnum * pTimeFormat, RscEnum * pWeekDayFormat, + RscEnum * pMonthFormat ); + RscTop * InitClassInternational( RscTop * pSuper, + RscEnum * pDateFormat, + RscEnum * pTimeFormat, RscEnum * pWeekDayFormat, + RscEnum * pMonthFormat ); + + RscTop * InitClassPatternFormatter( RscTop * pSuper ); + RscTop * InitClassNumericFormatter( RscTop * pSuper, + RscTop * pClassI12 ); + RscTop * InitClassMetricFormatter( RscTop * pSuper, + RscEnum * pFieldUnits ); + RscTop * InitClassCurrencyFormatter( RscTop * pSuper, + RscEnum * pFieldUnits ); + RscTop * InitClassDateFormatter( RscTop * pSuper, RscTop * pClassDate, + RscTop * pClassI12 ); + RscTop * InitClassTimeFormatter( RscTop * pSuper, RscTop * pClassTime, + RscTop * pClassI12, + RscEnum * pTimeFieldFormat ); + + RscTop * InitClassSpinField( RscTop * pSuper ); + RscTop * InitClassPatternField( RscTop * pSuper ); + RscTop * InitClassNumericField( RscTop * pSuper ); + RscTop * InitClassMetricField( RscTop * pSuper ); + RscTop * InitClassCurrencyField( const char * pClassName, USHORT nRT, + RscTop * pSuper ); + RscTop * InitClassDateField( RscTop * pSuper, RscTop * pClassDate ); + RscTop * InitClassTimeField( RscTop * pSuper, RscTop * pClassTime ); + RscTop * InitClassPatternBox( RscTop * pSuper ); + RscTop * InitClassNumericBox( RscTop * pSuper ); + RscTop * InitClassMetricBox( RscTop * pSuper ); + RscTop * InitClassCurrencyBox( const char * pClassName, USHORT nRT, + RscTop * pSuper ); + RscTop * InitClassDateBox( RscTop * pSuper, RscTop * pClassDate ); + RscTop * InitClassTimeBox( RscTop * pSuper, RscTop * pClassTime ); + + RscTop * InitClassDockingWindow( RscTop * pSuper, + RscEnum * pMapUnit ); + RscTop * InitClassToolBoxItem( RscTop * pSuper, RscTop * pClassBitmap, + RscTop * pClassImage, + RscEnum * pTriState ); + RscTop * InitClassToolBox( RscTop * pSuper, RscTop * pClassToolBoxItem, + RscTop * pClassImageList ); + RscTop * InitClassStatusBar( RscTop * pSuper ); + RscTop * InitClassMoreButton( RscTop * pSuper, RscEnum * pMapUnit ); + RscTop * InitClassFloatingWindow( RscTop * pSuper, + RscEnum * pMapUnit ); + RscTop * InitClassTabControlItem( RscTop * pSuper, + RscTop * pClassTabPage ); + RscTop * InitClassTabControl( RscTop * pSuper, + RscTop * pClassTabControlItem ); + RscTop * InitClassSfxStyleFamilyItem( RscTop * pSuper, + RscTop * pClassBitmap, + RscTop * pClassImage, + RscArray * pStrLst ); + RscTop * InitClassSfxTemplateDialog( RscTop * pSuper, + RscTop * pStyleFamily ); + RscTop * InitClassSfxSlotInfo( RscTop * pSuper ); + + void InsWinBit( RscTop * pClass, const ByteString & rName, + HASHID nVal ); + void WriteInc( FILE * fOutput, ULONG lKey ); + +public: + RscBool aBool; + RscRange aShort; + RscRange aUShort; + RscLongRange aLong; + RscLongEnumRange aEnumLong; + RscIdRange aIdUShort; + RscIdRange aIdNoZeroUShort; + RscBreakRange aNoZeroShort; + RscRange a1to12Short; + RscRange a0to23Short; + RscRange a1to31Short; + RscRange a0to59Short; + RscRange a0to99Short; + RscRange a0to9999Short; + RscIdRange aIdLong; + RscString aString; + RscFlag aWinBits; + RscEnum aLangType; + RscLangArray aLangString; + RscLangArray aLangShort; + + RscError* pEH; // Fehlerhandler + RscNameTable aNmTb; // Tabelle fuer Namen + RscFileTab aFileTab; // Tabelle der Dateinamen + USHORT nFlags; + Table aIdTranslator; //Ordnet Resourcetypen und Id's einen Id zu + //(unter PM), oder eine Dateiposition (MTF) + + RscTypCont( RscError *, LanguageType, + RSCBYTEORDER_TYPE, + CharSet nSourceCharSet, + const ByteString & rSearchPath, USHORT nFlags ); + ~RscTypCont(); + + BOOL IsPreload() const + { return (nFlags & PRELOAD_FLAG) ? TRUE : FALSE; } + BOOL IsSmart() const + { return (nFlags & SMART_FLAG) ? TRUE : FALSE; } + BOOL IsSysResTest() const + { return (nFlags & NOSYSRESTEST_FLAG) ? FALSE : TRUE; } + BOOL IsSrsDefault() const + { return (nFlags & SRSDEFAULT_FLAG) ? TRUE : FALSE; } + LanguageType ChangeLanguage( LanguageType eLang ) + { + LanguageType nOldLang = (LanguageType)nLangTypeId; + nLangTypeId = eLang; + return nOldLang; + } + RSCBYTEORDER_TYPE GetByteOrder() const { return nByteOrder; } + CharSet GetSourceCharSet() const { return nSourceCharSet; } + void SetSearchPath( const ByteString & rStr) { aSearchPath = rStr; } + ByteString GetSearchPath() const { return aSearchPath; } + void InsertType( RscTop * pType ) + { + aBaseLst.Insert( pType, LIST_APPEND ); + } + RscTop * SearchType( HASHID nTypId ); + RscTop * Search( HASHID typ ); + CLASS_DATA Search( HASHID typ, const RscId & rId ); + void Delete( HASHID typ, const RscId & rId ); + // loescht alle Resourceobjekte diese Datei + void Delete( ULONG lFileKey ); + RscTop * GetRoot() { return( pRoot ); }; + USHORT PutSysName( USHORT nRscTyp, char * pName, USHORT nConst, + USHORT nId, BOOL bFirst ); + ERRTYPE WriteRc( FILE * fOutput ); + void WriteSrc( FILE * fOutput, ULONG nFileIndex, + CharSet nCharSet, BOOL bName = TRUE ); + ERRTYPE WriteHxx( FILE * fOutput, ULONG nFileKey); + ERRTYPE WriteCxx( FILE * fOutput, ULONG nFileKey, + const ByteString & rHxxName ); + void WriteSyntax( FILE * fOutput ); + void WriteRcCtor( FILE * fOutput ); + void FillNameIdList( REResourceList * pList, ULONG lFileKey ); + BOOL MakeConsistent( RscInconsList * pList ); + USHORT PutTranslatorKey( ULONG nKey ); + void IncFilePos( ULONG nOffset ){ nFilePos += nOffset; } +}; + +#endif + diff --git a/rsc/inc/rscdef.hxx b/rsc/inc/rscdef.hxx new file mode 100644 index 000000000000..2935d4061e8e --- /dev/null +++ b/rsc/inc/rscdef.hxx @@ -0,0 +1,331 @@ +/************************************************************************* + * + * $RCSfile: rscdef.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************ + + Source Code Control System - Header + + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscdef.hxx,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $ + + Source Code Control System - Update + + $Log: not supported by cvs2svn $ + Revision 1.10 2000/09/17 12:51:09 willem.vandorp + OpenOffice header added. + + Revision 1.9 2000/07/26 17:13:17 willem.vandorp + Headers/footers replaced + + Revision 1.8 2000/07/11 17:00:08 th + Unicode + + Revision 1.7 1997/08/27 18:18:14 MM + neue Headerstruktur + +**************************************************************************/ + +#ifndef _RSCDEF_HXX +#define _RSCDEF_HXX + +#ifndef _TOOLS_UNQIDX_HXX +#include <tools/unqidx.hxx> +#endif +#ifndef _RSCTREE_HXX +#include <rsctree.hxx> +#endif + +/****************** C L A S S E S ****************************************/ +class RscExpression; +class RscFileTab; +class RscDefine; + +/*********** R s c E x p r e s s i o n ***********************************/ +#define RSCEXP_LONG 0 +#define RSCEXP_EXP 1 +#define RSCEXP_DEF 2 +#define RSCEXP_NOTHING 3 + +class RscExpType +{ +public: + union { + RscExpression * pExp; + RscDefine * pDef; + struct { + short nHi; + USHORT nLo; + } aLong; + } aExp; + char cType; + char cUnused; + BOOL IsNumber() const { return( RSCEXP_LONG == cType ); } + BOOL IsExpression()const { return( RSCEXP_EXP == cType ); } + BOOL IsDefinition()const { return( RSCEXP_DEF == cType ); } + BOOL IsNothing() const { return( RSCEXP_NOTHING == cType ); } + void SetLong( long lValue ){ + aExp.aLong.nHi = (short)(lValue >> 16); + aExp.aLong.nLo = (USHORT)lValue; + cType = RSCEXP_LONG; + } + long GetLong() const{ + return aExp.aLong.nLo | + ((long)aExp.aLong.nHi << 16); + } + BOOL Evaluate( long * pValue ) const; + void GetMacro( ByteString & ) const; +}; + +/*********** R s c I d ***************************************************/ +class RscId +{ + static BOOL bNames;// FALSE, bei den Namenoperation nur Zahlen +public: + RscExpType aExp; // Zahl, Define oder Ausdruck + long GetNumber() const; + void Create( const RscExpType & rExpType ); + void Create(){ aExp.cType = RSCEXP_NOTHING; } + + RscId() { Create(); } + + RscId( RscDefine * pEle ); + RscId( long lNumber ) + { aExp.SetLong( lNumber ); } + + RscId( const RscExpType & rExpType ) + { Create( rExpType ); } + + void Destroy(); + + ~RscId(){ + Destroy(); + } + + RscId( const RscId& rRscId ); + + RscId& operator = ( const RscId& rRscId ); + + static BOOL IsSetNames(); + static void SetNames( BOOL bSet = TRUE ); + operator long() const; // Gibt Nummer zurueck + ByteString GetName() const; // Gibt den Namen des Defines zurueck + ByteString GetMacro() const; // Gibt das Macro zurueck + BOOL operator < ( const RscId& rRscId ) const; + BOOL operator > ( const RscId& rRscId ) const; + BOOL operator == ( const RscId& rRscId ) const; + BOOL operator <= ( const RscId& rRscId ) const + { return !(operator > ( rRscId )); } + BOOL operator >= ( const RscId& rRscId ) const + { return !(operator < ( rRscId )); } + BOOL IsId() const { return !aExp.IsNothing(); } +}; + +/*********** R s c D e f i n e *******************************************/ +class RscDefine : public StringNode +{ +friend class RscFileTab; +friend class RscDefineList; +friend class RscDefTree; +friend class RscExpression; +friend class RscId; + ULONG lFileKey; // zu welcher Datei gehoert das Define + USHORT nRefCount; // Wieviele Referenzen auf dieses Objekt + long lId; // Identifier + RscExpression * pExp; // Ausdruck +protected: + + RscDefine( ULONG lFileKey, const ByteString & rDefName, + long lDefId ); + RscDefine( ULONG lFileKey, const ByteString & rDefName, + RscExpression * pExpression ); + ~RscDefine(); + void IncRef(){ nRefCount++; } + USHORT GetRefCount() const { return nRefCount; } + void DecRef(); + void DefineToNumber(); + void SetName( const ByteString & rNewName ){ aName = rNewName; } + void ChangeMacro( RscExpression * pExpression ); + void ChangeMacro( long lIdentifier ); +public: + RscDefine * Search( const char * ); + ULONG GetFileKey() const { return lFileKey; } + BOOL Evaluate(); + long GetNumber() const { return lId; } + ByteString GetMacro(); +}; + +DECLARE_LIST( RscSubDefList, RscDefine * ) + +class RscDefineList : public RscSubDefList { +friend class RscFile; +friend class RscFileTab; +private: + // pExpression wird auf jedenfall Eigentum der Liste + RscDefine * New( ULONG lFileKey, const ByteString & rDefName, + long lDefId, ULONG lPos ); + RscDefine * New( ULONG lFileKey, const ByteString & rDefName, + RscExpression * pExpression, ULONG lPos ); + BOOL Befor( const RscDefine * pFree, const RscDefine * pDepend ); + BOOL Remove( RscDefine * pDef ); + BOOL Remove( ULONG nIndex ); + BOOL Remove(); +public: + void WriteAll( FILE * fOutput ); +}; + +/*********** R s c E x p r e s s i o n ***********************************/ +class RscExpression { +friend class RscFileTab; + char cOperation; + RscExpType aLeftExp; + RscExpType aRightExp; +public: + RscExpression( RscExpType aLE, char cOp, + RscExpType aRE ); + ~RscExpression(); + BOOL Evaluate( long * pValue ); + ByteString GetMacro(); +}; + +/********************** R S C F I L E ************************************/ +class RscDepend { + ULONG lKey; +public: + RscDepend( ULONG lIncKey ){ lKey = lIncKey; }; + ULONG GetFileKey(){ return lKey; } +}; +DECLARE_LIST( RscDependList, RscDepend * ) + +// Tabelle die alle Dateinamen enthaelt +class RscFile : public RscDependList +{ +friend class RscFileTab; + BOOL bIncFile; // Ist es eine Include-Datei +public: + BOOL bLoaded; // Ist die Datei geladen + BOOL bScanned; // Wurde Datei nach Inclide abgesucht + BOOL bDirty; // Dirty-Flag + ByteString aFileName; // Name der Datei + ByteString aPathName; // Pfad und Name der Datei + RscDefineList aDefLst; // Liste der Defines + + RscFile(); + ~RscFile(); + BOOL InsertDependFile( ULONG lDepFile, ULONG lPos ); + void RemoveDependFile( ULONG lDepFile ); + BOOL Depend( ULONG lDepend, ULONG lFree ); + void SetIncFlag(){ bIncFile = TRUE; }; + BOOL IsIncFile(){ return bIncFile; }; +}; + +DECLARE_UNIQUEINDEX( RscSubFileTab, RscFile * ) +#define NOFILE_INDEX UNIQUEINDEX_ENTRY_NOTFOUND + +class RscDefTree { + RscDefine * pDefRoot; +public: + static BOOL Evaluate( RscDefine * pDef ); + RscDefTree(){ pDefRoot = NULL; } + ~RscDefTree(); + void Remove(); + BOOL Evaluate(); + RscDefine * Search( const char * pName ); + void Insert( RscDefine * pDef ); + void Remove( RscDefine * pDef ); +}; + +class RscFileTab : public RscSubFileTab { + RscDefTree aDefTree; + ULONG Find( const ByteString & rName ); +public: + RscFileTab(); + ~RscFileTab(); + + RscDefine * FindDef( const char * ); + RscDefine * FindDef( const ByteString& rStr ) { return FindDef( rStr.GetBuffer() ); } + RscDefine * FindDef( ULONG lKey, const ByteString & ); + + BOOL Depend( ULONG lDepend, ULONG lFree ); + BOOL TestDef( ULONG lFileKey, ULONG lPos, + const RscDefine * pDefDec ); + BOOL TestDef( ULONG lFileKey, ULONG lPos, + const RscExpression * pExpDec ); + + RscDefine * NewDef( ULONG lKey, const ByteString & rDefName, + long lId, ULONG lPos ); + RscDefine * NewDef( ULONG lKey, const ByteString & rDefName, + RscExpression *, ULONG lPos ); + + BOOL ChangeDef( const ByteString & rDefName, long lId ); + BOOL ChangeDef( const ByteString & rDefName, RscExpression * ); + + BOOL IsDefUsed( const ByteString & ); + void DeleteDef( const ByteString & ); + BOOL ChangeDefName( const ByteString & rDefName, + const ByteString & rNewName ); + + // Alle Defines die in dieser Datei Definiert sind loeschen + void DeleteFileContext( ULONG lKey ); + void DeleteFile( ULONG lKey ); + ULONG NewCodeFile( const ByteString & rName ); + ULONG NewIncFile( const ByteString & rName, const ByteString & rPath ); + RscFile * GetFile( ULONG lFileKey ){ return Get( lFileKey ); } +}; + +#endif // _RSCDEF_HXX diff --git a/rsc/inc/rscerror.h b/rsc/inc/rscerror.h new file mode 100644 index 000000000000..695326625b62 --- /dev/null +++ b/rsc/inc/rscerror.h @@ -0,0 +1,205 @@ +/************************************************************************* + * + * $RCSfile: rscerror.h,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************ + + Source Code Control System - Header + + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscerror.h,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $ + + Source Code Control System - Update + + $Log: not supported by cvs2svn $ + Revision 1.14 2000/09/17 12:51:09 willem.vandorp + OpenOffice header added. + + Revision 1.13 2000/07/26 17:13:17 willem.vandorp + Headers/footers replaced + + Revision 1.12 2000/07/11 17:00:17 th + Unicode + + Revision 1.11 1997/08/27 18:18:16 MM + neue Headerstruktur + +**************************************************************************/ + +#ifndef _RSCERROR_H +#define _RSCERROR_H + +#ifndef _TOOLS_SOLAR_H +#include <tools/solar.h> +#endif + +/****************** D E F I N I T I O N S ********************************/ +/******************* R e t u r n E r r o r s *******************/ +#define ERR_OK 0xFFFF + +#define ERR_ERROR 0x0100 +#define ERR_UNKNOWN_METHOD 0x0101 // Return +#define ERR_OPENFILE 0x0102 // Return +#define ERR_NOCHAR 0x0103 // Return +#define ERR_NORSCINST 0x0104 // Return +#define ERR_USAGE 0x0105 // +#define ERR_NOINPUT 0x0106 // Return +#define ERR_UNKNOWNSW 0x0107 // +#define ERR_REFTODEEP 0x0108 // Return +#define ERR_FILEFORMAT 0x0109 // Return +#define ERR_FILESIZE 0x010A // Return + +#define ERR_RSCRANGE 0x0200 // Return +#define ERR_RSCRANGE_OUTDEFSET (ERR_RSCRANGE +1 ) + +#define ERR_RSCENUM 0x0210 // Return +#define ERR_RSCFLAG 0x0220 // Return +#define ERR_RSCCONT 0x0240 // Return +#define ERR_CONT_INVALIDPOS (ERR_RSCCONT +1 ) // Return +#define ERR_CONT_INVALIDTYPE (ERR_RSCCONT +2 ) // Return + +#define ERR_RSCCMPED 0x0250 +#define ERR_RSCINST 0x0260 +#define ERR_RSCINST_NOVARNAME (ERR_RSCINST +1 ) // Return +#define ERR_RSCINST_RESERVEDNAME (ERR_RSCINST +2 ) // Return + +#define ERR_LEX 0x0270 +#define ERR_YACC 0x0280 // +#define ERR_DOUBLEID (ERR_YACC +1 ) // +#define ERR_FALSETYPE (ERR_YACC +2 ) // +#define ERR_NOVARIABLENAME (ERR_YACC +3 ) // +#define ERR_USHORTRANGE (ERR_YACC +4 ) // +#define ERR_IDRANGE (ERR_YACC +5 ) // +#define ERR_NOCOPYOBJ (ERR_YACC +6 ) // +#define ERR_REFNOTALLOWED (ERR_YACC +7 ) // Return +#define ERR_DOUBLEDEFINE (ERR_YACC +8 ) // +#define ERR_COPYNOTALLOWED (ERR_YACC +9 ) // +#define ERR_IDEXPECTED (ERR_YACC +10) // +#define ERR_ZERODIVISION (ERR_YACC +11) // +#define ERR_PRAGMA (ERR_YACC +12) // +#define ERR_DECLAREDEFINE (ERR_YACC +13) // +#define ERR_NOTUPELNAME (ERR_YACC +14) // +#define ERR_NOTYPE (ERR_YACC +15) // + +#define ERR_RSCARRAY 0x02A0 // Return +#define ERR_ARRAY_INVALIDINDEX (ERR_RSCARRAY +1 ) // Return + +#define ERR_ERROREND 0x1000 + +#define ERR_WARNINGSTART 0x1001 +#define WRN_LOCALID (ERR_WARNINGSTART +1 ) +#define WRN_GLOBALID (ERR_WARNINGSTART +2 ) +#define WRN_SUBINMEMBER (ERR_WARNINGSTART +3 ) +#define WRN_CONT_NOID (ERR_WARNINGSTART +4 ) +#define WRN_STR_REFNOTFOUND (ERR_WARNINGSTART +5 ) +#define WRN_MGR_REFNOTFOUND (ERR_WARNINGSTART +6 ) +#define WRN_CONT_DOUBLEID (ERR_WARNINGSTART +7 ) + +#define ERR_WARNINGEND 0x2000 + +class ERRTYPE { + USHORT nError; +public: + ERRTYPE() { nError = ERR_OK; } + ERRTYPE( USHORT nErr ) { nError = nErr; } + ERRTYPE( const ERRTYPE & rErr ) { nError = rErr.nError; }; + ERRTYPE& operator = ( const ERRTYPE & rError ); + operator USHORT() const { return( nError ); } + BOOL IsError() const { return( nError <= ERR_ERROREND ); } + BOOL IsOk() const { return( !IsError() ); } + BOOL IsWarning() const { + return( nError >= ERR_WARNINGSTART && nError <= ERR_WARNINGEND ); + }; + void Clear(){ nError = ERR_OK; } +}; + +/****************** R s c E r r o r **************************************/ +class RscId; +class RscTop; + +class RscError +{ + FILE * fListing; + + void WriteError( const ERRTYPE& rError, const char * pMessage ); + void StdLstOut( const char * pStr ); + void ErrorFormat( const ERRTYPE& rError, RscTop * pClass, + const RscId & aId ); +public: + USHORT nErrors;// Anzahl der Fehler + RscError(){ + fListing = NULL; + nErrors = 0; + }; + void SetListFile( FILE * fList ){ + fListing = fList; + }; + FILE * GetListFile(){ + return fListing; + }; + virtual void StdOut( const char * ); + virtual void LstOut( const char * ); + virtual void Error( const ERRTYPE& rError, RscTop* pClass, const RscId &aId, + const char * pMessage = NULL ); + // Dieser Fehler sollte nur im Compilermodus auftreten, + // das Programm wird mit exit() verlassen + virtual void FatalError( const ERRTYPE& rError, const RscId &aId, + const char * pMessage = NULL ); +}; + +#endif // _RSCERROR_H diff --git a/rsc/inc/rscflag.hxx b/rsc/inc/rscflag.hxx new file mode 100644 index 000000000000..6c6d36c34174 --- /dev/null +++ b/rsc/inc/rscflag.hxx @@ -0,0 +1,157 @@ +/************************************************************************* + * + * $RCSfile: rscflag.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************ + + Source Code Control System - Header + + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscflag.hxx,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $ + +**************************************************************************/ + +#ifndef _RSCFLAG_HXX +#define _RSCFLAG_HXX + +#ifndef _RSCALL_H +#include <rscall.h> +#endif +#ifndef _RSCERROR_H +#include <rscerror.h> +#endif +#ifndef _RSCHASH_HXX +#include <rschash.hxx> +#endif +#ifndef _RSCCONST_HXX +#include <rscconst.hxx> +#endif + +/******************* R s c F l a g ***************************************/ +class RscFlag : public RscConst { + struct RscFlagInst{ + USHORT nFlags; + USHORT nDfltFlags; + }; + BOOL bUSHORT; + RSCINST CreateBasic( RSCINST * pInst ); +public: + RscFlag( HASHID nId, USHORT nTypId, BOOL bUSHORT = TRUE ); + RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, BOOL ); + RSCINST CreateClient( RSCINST * pInst, const RSCINST & rDflt, + BOOL bOwnClass, HASHID nConsId ); + USHORT Size(); + + virtual void SetToDefault( const RSCINST & rInst ); + BOOL IsDefault( const RSCINST & rInst ); + BOOL IsDefault( const RSCINST & rInst, HASHID nConstId ); + + // Ist das Flag gesetzt + BOOL IsSet( const RSCINST & rInst, HASHID nConstId ); + + // Als Default setzen + BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef, + HASHID nConstId ); + + ERRTYPE SetConst( const RSCINST & rInst, HASHID nValueId, + long nValue ); + ERRTYPE SetNotConst( const RSCINST & rInst, HASHID nConstId ); + void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, const char * ); + ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, USHORT, BOOL bExtra ); +}; + +/******************* R s c C l i e n t ***********************************/ +class RscClient : public RscTop +{ + RscFlag * pRefClass; //Klasse die als Server benutzt wird + HASHID nConstId; //Id des zu setzenden Wertes +public: + RscClient( HASHID nId, USHORT nTypId, RscFlag * pClass, + HASHID nConstantId ); + virtual RSCCLASS_TYPE GetClassType() const; + RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, BOOL ); + USHORT Size(){ return( pRefClass->Size() ); }; + + // Eine Zuweisung an eine Variable + BOOL IsDefault( const RSCINST & rInst ){ + return( pRefClass->IsDefault( rInst, nConstId ) ); + }; + // Als Default setzen + BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ){ + return pRefClass->IsValueDefault( rInst, + pDef, nConstId ); + } + ERRTYPE SetBool( const RSCINST & rInst, BOOL bValue ){ + if( bValue ) + return( pRefClass->SetConst( rInst, nConstId, bValue ) ); + else + return( pRefClass-> + SetNotConst( rInst, nConstId ) ); + }; + ERRTYPE GetBool( const RSCINST & rInst, BOOL * pB ){ + *pB = pRefClass->IsSet( rInst, nConstId ); + return( ERR_OK ); + }; + void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, const char * ); +}; + +#endif // _RSCFLAG_HXX diff --git a/rsc/inc/rschash.hxx b/rsc/inc/rschash.hxx new file mode 100644 index 000000000000..0ef00f7020a6 --- /dev/null +++ b/rsc/inc/rschash.hxx @@ -0,0 +1,170 @@ +/************************************************************************* + * + * $RCSfile: rschash.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************ + + Source Code Control System - Header + + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rschash.hxx,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $ + + Source Code Control System - Update + + $Log: not supported by cvs2svn $ + Revision 1.6 2000/09/17 12:51:09 willem.vandorp + OpenOffice header added. + + Revision 1.5 2000/07/26 17:13:17 willem.vandorp + Headers/footers replaced + + Revision 1.4 1997/08/27 18:18:10 MM + neue Headerstruktur + + + Rev 1.3 27 Aug 1997 18:18:10 MM + neue Headerstruktur + + Rev 1.2 21 Nov 1995 19:49:20 TLX + Neuer Link + + Rev 1.1 04 May 1995 10:17:20 mk + ^Z am Ende + + Rev 1.0 10 Aug 1992 07:14:22 MM + Initial revision. + + Rev 1.4 23 Mar 1992 15:23:50 MM + + Rev 1.3 26 Nov 1991 08:56:06 MM + + Rev 1.2 11 Sep 1991 12:20:10 MM + + Rev 1.1 18 Jul 1991 12:53:26 MM + Unix Anpassung + + Rev 1.0 17 Jun 1991 14:54:46 MM + Initial revision. + + Rev 1.0 08 Feb 1991 13:42:52 MM + Initial revision. + +**************************************************************************/ + +#ifndef _RSCHASH_HXX +#define _RSCHASH_HXX + +#ifndef _RSCTOOLS_HXX +#include <rsctools.hxx> +#endif + +/****************** T Y P E S ********************************************/ +/****************** C L A S S E S ****************************************/ +/****************** S t r i n g - C o n **********************************/ +class StringCon{ +private: + USHORT nMax; // sizeof character field + USHORT nFill; // index after last entry + char * pField; // pointer to character field +public: + StringCon( USHORT nMaxEntries ); // maximum numbers of characters + ~StringCon(); + char *Put( const char * pStr ); // put string in field +}; + +/****************** H a s h - T a b e l **********************************/ +class HashTabel{ +private: + USHORT nMax; // size of hash-tabel + USHORT nFill; // elements in hash-tabel + ULONG lAsk; // Anzahl der Anfragen + ULONG lTry; // Anzahl der Versuche +protected: + HASHID Test_Insert( const void *, BOOL bInsert ); +public: + HashTabel( USHORT nMaxEntries ); // max size of hash-tabel + ~HashTabel(); + HASHID Test( const void * ); // test of insert + HASHID Insert( const void * pElement ); // insert in hashtabel + virtual USHORT HashFunc( const void * ){ return( 0 ); }; + // get hash value from subclass + virtual BOOL IsEntry( HASHID ){ return( FALSE ); }; + // is field + // nIndex = index in Field + virtual COMPARE Compare( const void * , HASHID ) + { return( EQUAL ); }; // compare element with entry +}; + +/****************** H a s h - S t r i n g ********************************/ +class HashString : public HashTabel{ +private: + StringCon * paSC; // container of strings + char * * ppStr; // pointer to char * array +public: + HashString( USHORT nMaxEntries ); // max size of hash-tabel + ~HashString(); + USHORT HashFunc( const void * pElement ); // return hash value + BOOL IsEntry( HASHID nIndex ); + COMPARE Compare( const void * pElement, HASHID nIndex ); + HASHID Insert( const char * pStr ); // test of insert string + HASHID Test( const char * pStr ); // insert string + char * Get( HASHID nIndex ); // return pointer to string +}; + +#endif // _RSCHASH_HXX + diff --git a/rsc/inc/rscinst.hxx b/rsc/inc/rscinst.hxx new file mode 100644 index 000000000000..f0a982c21217 --- /dev/null +++ b/rsc/inc/rscinst.hxx @@ -0,0 +1,310 @@ +/************************************************************************* + * + * $RCSfile: rscinst.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************ + + Source Code Control System - Header + + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscinst.hxx,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $ + + Source Code Control System - Update + + $Log: not supported by cvs2svn $ + Revision 1.14 2000/09/17 12:51:09 willem.vandorp + OpenOffice header added. + + Revision 1.13 2000/07/26 17:13:17 willem.vandorp + Headers/footers replaced + + Revision 1.12 2000/07/11 17:00:28 th + Unicode + + Revision 1.11 1999/09/07 13:30:02 mm + UniCode + + Revision 1.10 1997/08/27 18:18:06 MM + neue Headerstruktur + +**************************************************************************/ + +#ifndef _RSCINST_HXX +#define _RSCINST_HXX + +#ifndef _RSCALL_H +#include <rscall.h> +#endif +#ifndef _RSCERROR_H +#include <rscerror.h> +#endif +#ifndef _RSCTOOLS_HXX +#include <rsctools.hxx> +#endif + +/******************* C l a s s e s F o r w a r d s *********************/ +class RscTypCont; +class RscCmdLine; +class REResourceList; +class RscTop; +class RscInstCopy; + +/******************* F u n c t i o n F o r w a r d s *******************/ +HASHID HashId( const char * ); // Gibt zu einem String eine HashId +const char * GetHashString( HASHID ); // Gibt zu einer HASHID einen String + // NULL, wenn kein Eintrag vorhanden + +/******************* S t r u c t s ***************************************/ + +/****************** C L A S S E S ****************************************/ +class RscInst +{ + void MakeCopy( RSCINST aCopyInst ); + static RSCINST GetSysLangInst( RSCINST & rInst ); +public: + RSCINST aInst; + + RscInst(); + RscInst( const RscInst & rInst ); + RscInst( RSCINST aTmpI ); + RscInst& operator = ( const RscInst& rRscInst ); + ~RscInst(); + void OverWrite( RscInstCopy & rInst ); + BOOL IsInst() const { return( aInst.IsInst() ); } + + // Listen Methoden + ERRTYPE SetElement( const RscId & rName, RscInstCopy & rInst ); + ERRTYPE SetPosEle( USHORT nPos, RscInstCopy & rInst ); + ERRTYPE SetPosRscId( USHORT nPos, const RscId & rId ); + SUBINFO_STRUCT GetInfoEle( USHORT nPos ); + USHORT GetCount(); + RscInst GetElement( RscTop * pClass, const RscId & rName ); + RscInst GetPosEle( USHORT nPos ); + ERRTYPE MovePosEle( USHORT nDestPos, USHORT nSourcePos ); + ERRTYPE DeleteElement( RscTop * pClass, const RscId & rName ); + ERRTYPE DeletePosEle( USHORT nPos ); + + ERRTYPE SetVar( HASHID nVarName, RscInstCopy & rInst ); + ERRTYPE SetConst( HASHID nVarName, HASHID nConstId ); + ERRTYPE SetBool( HASHID nVarName, BOOL ); + + // Hack fuer X, Y, Width, Height + static ERRTYPE SetCorrectValues( RSCINST & rInst, RSCINST & rVarInst, + long lValue, USHORT nTupelIdx ); + ERRTYPE SetNumber( HASHID nVarName, long ); + + ERRTYPE SetString( HASHID nVarName, const char * ); + ERRTYPE SetConst( HASHID nConstId ); + ERRTYPE SetBool( BOOL ); + ERRTYPE SetNumber( long ); + ERRTYPE SetString( const char * ); + ERRTYPE SetRef( const RscId & rRscId ); + ERRTYPE SetDefault( HASHID nVarName ); + + RscInst GetVar( HASHID nVarName ); + HASHID GetConst( HASHID nVarName = HASH_NONAME ); + USHORT GetConstPos( HASHID nVarName = HASH_NONAME ); + BOOL GetBool( HASHID nVarName = HASH_NONAME ); + + // Hack fuer X, Y, Width, Height + static long GetCorrectValues( RSCINST & rInst, RSCINST & rVarInst, + USHORT nTupelIdx ); + long GetNumber( HASHID nVarName = HASH_NONAME ); + + const char *GetString( HASHID nVarName = HASH_NONAME ); + RscId GetRef(); + BOOL IsDefault( HASHID nVarName ); + BOOL IsConsistent( RscInconsList * pList ); + + HASHID GetClassEnum( HASHID nVarName, USHORT nPos ); + HASHID GetClassEnum( USHORT nPos ); + RscTop * GetClassType(){ return aInst.pClass; }; + HASHID GetClassName(); + void EnumClassVariables( void * pData, VarEnumCallbackProc ) const; + ERRTYPE WriteRc( RscWriteRc & aMem ); +}; + +class RscInstCopy : public RscInst { + void MakeCopy( RSCINST aCopyInst ); +public: + RscInstCopy(); + RscInstCopy( const RscInstCopy & rInst ); + RscInstCopy( const RscInst & rInst ); + RscInstCopy( RSCINST aTmpI ); + RscInstCopy( RscTop * pNewType, const RscInst & rInst ); + RscInstCopy& operator = ( const RscInstCopy & rRscInst ); + RscInstCopy& operator = ( const RscInst & rRscInst ); + ~RscInstCopy(); +}; + +class RscDataBase +{ +friend class RscHrc; +friend class RscSrc; +friend class RscInst; + + RscCmdLine * pCmdLine; + RscTypCont * pTC; + LanguageType nLangType; +public: + RscDataBase( RscError * ); + ~RscDataBase(); + +// void SetLanguage( LanguageType nTyp ) { nLangType = nTyp; } + void SetLanguage( HASHID nId ); + HASHID GetLanguage() const; + + ByteString GetPath() const; + void SetPath( const ByteString & rPath ); + // Konvertiert einen Namen in einen Typ + RscTop* GetClassType( HASHID nClassName ); + // Instanz einer Klasse erzeugen + BOOL MakeConsistent( RscInconsList * pList ); + // Array mit Dateinamen + RscFileTab* GetFileTab(); + // Eine Dateinamen-Instanz holen + RscFile * GetFileStruct( ULONG lKey ); + + ULONG AddSrcFile( const ByteString & rFileName ); + ULONG AddHrcFile( const ByteString & rFileName ); + // Traegt die Include-Dateien in die Abhaengigkeitsliste + // von lFileKey ein + void ScanForIncFiles( ULONG lFileKey ); + void RemoveFile( ULONG lKey ); + + // Suche ueber alle DEFINES + RscDefine * FindDef( const ByteString & rName ); + ULONG GetFileKey( const ByteString & rFileName ); +}; + +class RscHrc +{ +protected: + ULONG lFileKey; // Index der Instanz + RscDataBase * pDataBase;// Datenbasis +public: + + // Kompilerinstanz erzeugen + RscHrc( RscDataBase * pDBase, ULONG lKey ); + ~RscHrc(); + + // Daten von Datei uebernehmen + ERRTYPE ReadFile(); + + ULONG GetFileKey() const { return lFileKey; } + + void SetDirty( BOOL bSet ); + BOOL IsDirty(); + void SetPathName( const ByteString & ); + ByteString GetPathName(); + void SetFileName( const ByteString & ); + ByteString GetFileName(); + + //Depend-Datei anhaengen + void InsertDepend( ULONG lKey, ULONG lPos ); + + // DefineList holen + RscDefineList * GetDefineList(); + // Suche ueber all DEFINES im Zugriff + RscDefine * FindDef( const ByteString & rName ); + ERRTYPE NewDef( const ByteString & rMacroName, long lValue, + ULONG lPos ); + ERRTYPE NewDef( const ByteString & rMacroName, const ByteString & rMacro, + ULONG lPos ); + ERRTYPE ChangeDef( const ByteString & rMacroName, long lValue ); + ERRTYPE ChangeDef( const ByteString & rMacroName, + const ByteString & rMacro ); + BOOL IsDefUsed( const ByteString & ); + void DeleteDef( const ByteString & rMacroName ); + ERRTYPE ChangeDefName( const ByteString & rMacroName, + const ByteString & rNewName ); + + // Dateinamen-Instanz holen + RscFile * GetFileStruct(); + //Abhaengigkeitsliste holen holen + RscDependList * GetDependList(); + + // Datei schreiben + ERRTYPE WriteFile(); +}; + +class RscSrc : public RscHrc { +public: + // Kompilerinstanz erzeugen + RscSrc( RscDataBase * pDBase, ULONG lKey ); + ~RscSrc(); + + + RscInstCopy CreateRscInst( RscTop * pClass ); + // Instanz loeschen + ERRTYPE DeleteRscInst( RscTop * pClass, const RscId & rInstName ); + // Datenbasis nach Define Veraenderung wiederherstellen + //Instanz global zur Verfuegung stellen + ERRTYPE SetRscInst( const RscId & rInstName, RscInstCopy & ); + //Instanz holen + RscInst GetRscInst( RscTop* pClass, const RscId & rInstName ); + + // Namen und Identifier Liste fuellen + void FillNameIdList( REResourceList * pList ); + + // C++ Resourcekonstruktor schreiben + ERRTYPE WriteCxxFile( const ByteString &, const ByteString & rHxxName ); + ERRTYPE WriteHxxFile( const ByteString & ); // C++ Klasskopf schreiben +}; + +#endif //_RSCINST_HXX diff --git a/rsc/inc/rsckey.hxx b/rsc/inc/rsckey.hxx new file mode 100644 index 000000000000..f4da97b39dd1 --- /dev/null +++ b/rsc/inc/rsckey.hxx @@ -0,0 +1,129 @@ +/************************************************************************* + * + * $RCSfile: rsckey.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************ + + Source Code Control System - Header + + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rsckey.hxx,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $ + + Source Code Control System - Update + + $Log: not supported by cvs2svn $ + Revision 1.6 2000/09/17 12:51:09 willem.vandorp + OpenOffice header added. + + Revision 1.5 2000/07/26 17:13:17 willem.vandorp + Headers/footers replaced + + Revision 1.4 1997/08/27 18:18:06 MM + neue Headerstruktur + + + Rev 1.3 27 Aug 1997 18:18:06 MM + neue Headerstruktur + + Rev 1.2 21 Nov 1995 19:49:18 TLX + Neuer Link + + Rev 1.1 16 Feb 1995 19:50:50 MM + char * -> const char * + + Rev 1.0 10 Aug 1992 07:14:30 MM + Initial revision. +**************************************************************************/ + +#ifndef _RSCKEY_HXX +#define _RSCKEY_HXX + +/****************** C l a s s F o r w a r d s **************************/ +class RscTop; + +#ifndef _RSCALL_H +#include <rscall.h> +#endif + +typedef struct { + HASHID nName; + USHORT nTyp; + long yylval; +} KEY_STRUCT; + +class RscNameTable { + BOOL bSort; //soll bei jedem einfuegen sortiert werden? + USHORT nEntries; //Anzahl der Eintr„ge + KEY_STRUCT * pTable; +public: + RscNameTable(); + ~RscNameTable(); + void SetSort( BOOL bSorted = TRUE ); + HASHID Put( HASHID nName, USHORT nTyp, long nValue ); + HASHID Put( HASHID nName, USHORT nTyp ); + HASHID Put( const char * pName, USHORT nTyp, long nValue ); + HASHID Put( const char * pName, USHORT nTyp ); + HASHID Put( HASHID nName, USHORT nTyp, RscTop * pClass ); + HASHID Put( const char * pName, USHORT nTyp, RscTop * pClass ); + + // TRUE, wurde gefunden + BOOL Get( HASHID nName, KEY_STRUCT * pEle ); +}; + + +#endif// _RSCKEY_HXX diff --git a/rsc/inc/rsclst.hxx b/rsc/inc/rsclst.hxx new file mode 100644 index 000000000000..2caf10123202 --- /dev/null +++ b/rsc/inc/rsclst.hxx @@ -0,0 +1,103 @@ +/************************************************************************* + * + * $RCSfile: rsclst.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _RSCLST_HXX +#define _RSCLST_HXX + +#ifndef _TOOLS_LIST_HXX +#include <tools/list.hxx> +#endif +#ifndef _RSCALL_H +#include <rscall.h> +#endif + +class REResourceList; + +DECLARE_LIST( RESubResourceList, REResourceList * ) + +class REResourceList : public RESubResourceList +{ +protected: + REResourceList* pParent; + RscId aRscId; //Id und Name des Resourceobjektes + ByteString aClassName; + BOOL bVisible; + +public: + REResourceList(); + REResourceList( REResourceList * pParentList, + ByteString& rClassName, + const RscId & rResourceID, + BOOL bVisible = FALSE ); + ~REResourceList(); + + REResourceList* GetParent() { return pParent; } + ByteString GetObjName() { return aRscId.GetName(); } + ByteString GetClassName() { return aClassName; } + RscId GetRscId() { return aRscId; } + void SetRscId( const RscId & rId ){ aRscId = rId; } + + void SetVisible( BOOL bVis ) + { bVisible = bVis; } + BOOL IsVisible() { return bVisible; } +}; + +#endif // _RSCLST_HXX diff --git a/rsc/inc/rscmgr.hxx b/rsc/inc/rscmgr.hxx new file mode 100644 index 000000000000..815944357ab7 --- /dev/null +++ b/rsc/inc/rscmgr.hxx @@ -0,0 +1,169 @@ +/************************************************************************* + * + * $RCSfile: rscmgr.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************ + + Source Code Control System - Header + + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscmgr.hxx,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $ + + Source Code Control System - Update + + $Log: not supported by cvs2svn $ + Revision 1.10 2000/09/17 12:51:09 willem.vandorp + OpenOffice header added. + + Revision 1.9 2000/07/26 17:13:17 willem.vandorp + Headers/footers replaced + + Revision 1.8 1997/08/27 18:18:10 MM + neue Headerstruktur + + + Rev 1.7 27 Aug 1997 18:18:10 MM + neue Headerstruktur + + Rev 1.6 21 Nov 1995 19:49:08 TLX + Neuer Link + + Rev 1.5 12 Jan 1994 15:18:06 mm + Alignementprobleme und Warnings fuer DEC-Alpha beseitigt + + Rev 1.4 28 Oct 1993 17:12:36 mm + Referenzeingabe wird besser geprueft + + Rev 1.3 25 Aug 1993 15:34:18 mm + Fehler und Warnings beseitigt + + Rev 1.2 05 Jan 1993 10:50:36 mm + Neues Default verhalten + + Rev 1.1 23 Dec 1992 14:02:32 mm + Sprachaenderung + + Rev 1.0 10 Aug 1992 07:14:20 MM + Initial revision. + +**************************************************************************/ + +#ifndef _RSCMGR_HXX +#define _RSCMGR_HXX + +#ifndef _RSCALL_H +#include <rscall.h> +#endif +#ifndef _RSCERROR_H +#include <rscerror.h> +#endif +#ifndef _RSCHASH_HXX +#include <rschash.hxx> +#endif +#ifndef _RSCTOP_HXX +#include <rsctop.hxx> +#endif +#ifndef _RSCCLASS_HXX +#include <rscclass.hxx> +#endif + +/******************* R s c M g r *****************************************/ +class RscMgr : public RscClass { + struct RscMgrInst { + RscId aRefId; // nRefId = Referenz Identifier + BOOL bDflt; // Ist Default + void Create(){ aRefId.Create(); bDflt = TRUE; } + void Destroy(){ aRefId.Destroy(); } + }; + ERRTYPE IsToDeep( const RSCINST & rInst, USHORT nDeep = 0 ); +public: + RscMgr( HASHID nId, USHORT nTypId, RscTop * pSuperCl ); + + void SetToDefault( const RSCINST & rInst ); + BOOL IsDefault( const RSCINST & rInst ); + BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + + RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, BOOL ); + void Destroy( const RSCINST & rInst ); + USHORT Size(); + void WriteSrcHeader( const RSCINST & aInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, + const RscId & rId, const char * ); + + void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, const char * ); + ERRTYPE WriteRcHeader( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, const RscId & rId, + USHORT, BOOL bExtra ); + ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, USHORT, BOOL bExtra ); + ERRTYPE WriteHxxHeader( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId & rId ); + ERRTYPE WriteHxx( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId & rId ); + ERRTYPE WriteCxxHeader( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId & rId ); + ERRTYPE WriteCxx( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId & rId ); + BOOL IsConsistent( const RSCINST & rInst, + RscInconsList * pList = NULL ); + ERRTYPE GetRef( const RSCINST & rInst, RscId * ); + ERRTYPE SetRef( const RSCINST & rInst, const RscId & rRefId ); +}; + +#endif //_RSCMGR_HXX diff --git a/rsc/inc/rscpar.hxx b/rsc/inc/rscpar.hxx new file mode 100644 index 000000000000..5fe35835cd37 --- /dev/null +++ b/rsc/inc/rscpar.hxx @@ -0,0 +1,142 @@ +/************************************************************************* + * + * $RCSfile: rscpar.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************ + + Source Code Control System - Header + + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscpar.hxx,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $ + +**************************************************************************/ +#ifndef _RSCPAR_HXX +#define _RSCPAR_HXX + +#ifndef _RSCTOOLS_HXX +#include <rsctools.hxx> +#endif +#ifndef _RSCERROR_H +#include <rscerror.h> +#endif + +/****************** C L A S S E S ****************************************/ +class RscTypCont; +class RscExpression; +/*********** R s c F i l e I n s t ***************************************/ + +#define READBUFFER_MAX 256 +class RscFileInst +{ + ERRTYPE aFirstError;// Erster Fehler + USHORT nErrorLine; // Zeile des ersten Fehlers + USHORT nErrorPos; // Position des ersten Fehlers + rtl_TextEncoding nCharSet; // Zeichensatz der einzulesenden Datei + BOOL bIncLine; // Muss Zeilennummer incrementiert werden + USHORT nLineNo; // Zeile in der Eingabedatei + ULONG lFileIndex; // Index auf Eingabedatei + ULONG lSrcIndex; // Index auf Basisdatei + FILE * fInputFile; // Eingabedatei + char * pInput; // Lesepuffer + USHORT nInputBufLen; // Laenge des Lesepuffers + USHORT nInputPos; // Position im Lesepuffer + USHORT nInputEndPos;// Ende im Lesepuffer + char * pLine; // Zeile + USHORT nLineBufLen;//Lange des Zeilenpuffres + USHORT nScanPos; // Position in der Zeile + int cLastChar; + BOOL bEof; + +public: + RscTypCont * pTypCont; + void Init(); // ctor initialisieren + RscFileInst( RscTypCont * pTC, ULONG lIndexSrc, + ULONG lFileIndex, FILE * fFile, + rtl_TextEncoding nSourceCharSet ); + RscFileInst( RscTypCont * pTC, ULONG lIndexSrc, + ULONG lFileIndex, const ByteString &, + rtl_TextEncoding nSourceCharSet ); + ~RscFileInst(); + BOOL IsEof() const { return bEof; } + void SetCharSet( rtl_TextEncoding nSet ) { nCharSet = nSet; } + UINT16 GetCharSet() const { return (UINT16)nCharSet; } + void SetFileIndex( ULONG lFIndex ) { lFileIndex = lFIndex; } + ULONG GetFileIndex() { return( lFileIndex ); } + ULONG GetSrcIndex() { return( lSrcIndex ); } + void SetLineNo( USHORT nLine ) { nLineNo = nLine; } + USHORT GetLineNo() { return( nLineNo ); } + USHORT GetScanPos() { return( nScanPos ); } + char * GetLine() { return( pLine ); } + int GetChar(); + int GetFastChar() { return pLine[ nScanPos ] ? + pLine[ nScanPos++ ] : GetChar(); + } + void GetNewLine(); + // Fehlerbehandlung + void SetError( ERRTYPE aError ); + ERRTYPE GetError() { return aFirstError; } + USHORT GetErrorLine() { return nErrorLine; } + USHORT GetErrorPos() { return nErrorPos; } +}; + +/******************* F u n c t i o n *************************************/ +void IncludeParser( RscFileInst * pFileInst ); +ERRTYPE parser( RscFileInst * pFileInst ); +RscExpression * MacroParser( RscFileInst & rFileInst ); + +#endif // _RSCPAR_HXX diff --git a/rsc/inc/rscrange.hxx b/rsc/inc/rscrange.hxx new file mode 100644 index 000000000000..48a7a80c9ea6 --- /dev/null +++ b/rsc/inc/rscrange.hxx @@ -0,0 +1,260 @@ +/************************************************************************* + * + * $RCSfile: rscrange.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************ + + Source Code Control System - Header + + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscrange.hxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $ + +**************************************************************************/ + +#ifndef _RSCRANGE_HXX +#define _RSCRANGE_HXX + +#ifndef _RSCALL_H +#include <rscall.h> +#endif +#ifndef _RSCERROR_H +#include <rscerror.h> +#endif +#ifndef _RSCHASH_HXX +#include <rschash.hxx> +#endif +#ifndef _RSCTOP_HXX +#include <rsctop.hxx> +#endif + +/******************* R s c R a n g e *************************************/ +class RscRange : public RscTop +{ +protected: + struct RscRangeInst { + USHORT nValue; // nValue = Ausgangswert - nMin + BOOL bDflt; // Ist Default + }; + long nMin; // Minimum des Bereiches + long nMax; // Maximum des Bereiches + USHORT nSize; +public: + RscRange( HASHID nId, USHORT nTypId ); + virtual RSCCLASS_TYPE GetClassType() const; + RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, BOOL ); + // Der zulaessige Bereich wird gesetzt + ERRTYPE SetRange( long nMinimum, long nMaximum ); + // Gibt die Groesse der Klasse in Bytes + USHORT Size(){ return nSize; } + // Eine Zuweisung an eine Variable + virtual void SetToDefault( const RSCINST & rInst ) + { + ((RscRangeInst*)rInst.pData)->bDflt = TRUE; + } + BOOL IsDefault( const RSCINST & rInst) + { + return( ((RscRangeInst*)rInst.pData)->bDflt ); + }; + // Als Default setzen + BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + ERRTYPE SetNumber( const RSCINST &, long ); + ERRTYPE GetNumber( const RSCINST &, long * ); + void WriteSrc( const RSCINST &, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, const char * ); + ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem, + RscTypCont * pTC, USHORT, BOOL bExtra ); + void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, + const char * ); +}; + +/******************* R s c L o n g R a n g e ******************************/ +class RscLongRange : public RscTop +{ +protected: + struct RscLongRangeInst + { + long nValue; // nValue = Ausgangswert - nMin + BOOL bDflt; // Ist Default + }; + long nMin; // Minimum des Bereiches + long nMax; // Maximum des Bereiches + USHORT nSize; +public: + RscLongRange( HASHID nId, USHORT nTypId ); + virtual RSCCLASS_TYPE GetClassType() const; + RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, BOOL ); + // Der zulaessige Bereich wird gesetzt + ERRTYPE SetRange( long nMinimum, long nMaximum ); + // Gibt die Groesse der Klasse in Bytes + USHORT Size(){ return nSize; } + // Eine Zuweisung an eine Variable + virtual void SetToDefault( const RSCINST & rInst ) + { + ((RscLongRangeInst*)rInst.pData)->bDflt = TRUE; + } + BOOL IsDefault( const RSCINST & rInst) + { + return( ((RscLongRangeInst*)rInst.pData)->bDflt ); + }; + // Als Default setzen + BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + ERRTYPE SetNumber( const RSCINST &, long ); + ERRTYPE GetNumber( const RSCINST &, long * ); + void WriteSrc( const RSCINST &, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, const char * ); + ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem, + RscTypCont * pTC, USHORT, BOOL bExtra ); + void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, + const char * ); + +}; + +/******************* R s c L o n g E n u m R a n g e ******************/ +class RscLongEnumRange : public RscLongRange +{ +public: + RscLongEnumRange( HASHID nId, USHORT nTypId ); + + ERRTYPE SetConst( const RSCINST & rInst, HASHID nValueId, + long nValue ); +}; + +/******************* R s c I d R a n g e ***********************************/ +class RscIdRange : public RscTop +{ + USHORT nSize; +protected: + long nMin; // Minimum des Bereiches + long nMax; // Maximum des Bereiches + BOOL bRcLong;// Binaere Resource 4 Byte statt 2 +public: + RscIdRange( HASHID nId, USHORT nTypId, BOOL bRcL = FALSE ); + virtual RSCCLASS_TYPE GetClassType() const; + // Der zulaessige Bereich wird gesetzt + ERRTYPE SetRange( long nMinimum, long nMaximum ){ + nMin = nMinimum; + nMax = nMaximum; + return ERR_OK; + } + RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, BOOL ); + void Destroy( const RSCINST & rInst ); + USHORT Size(){ return nSize; } + virtual void SetToDefault( const RSCINST & rInst ) + { + ((RscId*)rInst.pData)->aExp.cUnused = TRUE; + } + BOOL IsDefault( const RSCINST & rInst) + { + //cUnused wird fuer Defaultkennung verwendet + return ((RscId*)rInst.pData)->aExp.cUnused + ? TRUE : FALSE; + } + // Als Default setzen + BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + ERRTYPE SetNumber( const RSCINST &, long ); + ERRTYPE GetNumber( const RSCINST &, long * ); + ERRTYPE SetRef( const RSCINST &, const RscId & rRscId ); + ERRTYPE GetRef( const RSCINST & rInst, RscId * ); + void WriteSrc( const RSCINST &, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, const char * ); + ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem, + RscTypCont * pTC, USHORT, BOOL bExtra ); + BOOL IsConsistent( const RSCINST & rInst, RscInconsList * pList ); + void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, + const char * ); + +}; + +/******************* R s c B o o l ***************************************/ +class RscBool : public RscRange +{ +public: + RscBool( HASHID nId, USHORT nTypId ); + virtual RSCCLASS_TYPE GetClassType() const; + // Der zulaessige Bereich wird gesetzt + ERRTYPE SetRange( long, long ){ + return( ERR_UNKNOWN_METHOD ); + }; + ERRTYPE SetBool( const RSCINST & rInst, BOOL b ){ + return( SetNumber( rInst, (long)b ) ); + }; + ERRTYPE GetBool( const RSCINST & rInst, BOOL * pB){ + long l; + GetNumber( rInst, &l ); + *pB = (0 != l); + return( ERR_OK ); + }; + void WriteSrc( const RSCINST &, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, const char * ); + void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, + const char * ); + +}; + +class RscBreakRange : public RscRange { + long nOutRange; +public: + RscBreakRange( HASHID nId, USHORT nTypId ); + void SetOutRange( long nNumber ){ + nOutRange = nNumber; + } + RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, BOOL ); + ERRTYPE SetNumber( const RSCINST &, long ); +}; + +#endif // _RSCRANGE_HXX diff --git a/rsc/inc/rscrsc.hxx b/rsc/inc/rscrsc.hxx new file mode 100644 index 000000000000..2a37bc48e698 --- /dev/null +++ b/rsc/inc/rscrsc.hxx @@ -0,0 +1,158 @@ +/************************************************************************* + * + * $RCSfile: rscrsc.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************ + + Source Code Control System - Header + + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscrsc.hxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $ + +**************************************************************************/ + +#ifndef _RSCRSC_HXX +#define _RSCRSC_HXX + +#ifndef _LANG_HXX //autogen +#include <tools/lang.hxx> +#endif + + +#ifndef RSCALL_H +#include <rscall.h> +#endif +#ifndef RSCERROR_H +#include <rscerror.h> +#endif +#ifndef RSCTOOLS_HXX +#include <rsctools.hxx> +#endif + +class RscTypCont; + +/****************** T Y P E S ********************************************/ + +#define MAX_INPUTFILES 100 +#define MAX_SYMBOLS 10 +#define MAX_INCLUDES 10 + +/****************** R s c C m d L i n e **********************************/ +class RscCmdLine +{ + void Init(); + +public: + RscStrList aInputList; // Liste der Quelldateien + RscStrList aSymbolList; // Liste der Symbole + ByteString aPath; // Liste der Pfade + CharSet nSourceCharSet; // Welcher Quellzeichensatz + LanguageType nLangTypeId; // Globale Sprachtyp + RSCBYTEORDER_TYPE nByteOrder; + short nCommands; // Steuerbits + ByteString aOutputSrs; // Name der Srs-Ausgabedatei + ByteString aOutputRc; // Name der Rc-Ausgabedatei + ByteString aOutputLst; // Name der List-Ausgabedatei + ByteString aOutputSrc; // Name der Src-Ausgabedatei + ByteString aOutputRcCtor; // Name der Ctor-Ausgabedatei + ByteString aOutputCxx; // Name der Cxx-Ausgabedatei + ByteString aOutputHxx; // Name der Hxx-Ausgabedatei + + RscCmdLine( short argc, char ** argv, RscError * pEH ); + RscCmdLine(); + + void SetInputFile( const ByteString & rInputName ); + ~RscCmdLine(); +}; +/****************** R s c ************************************************/ +class RscCompiler +{ +private: + RscStrList aTmpFileList; // Liste der Tmp-Dateien + ByteString aTmpOutputRc; // Name der TempRc-Ausgabedatei + ByteString aTmpOutputHxx; // Name der TempHxx-Ausgabedatei + ByteString aTmpOutputCxx; // Name der TempCxx-Ausgabedatei + ByteString aTmpOutputRcCtor; // Name der Temp Ctor-Ausgabedatei + ByteString aTmpOutputSrc; // Name der TempSrc-Ausgabedatei + + void CreateResFile( const char * pRc ); + + void Append( const ByteString& rOutputSrs, const ByteString& rTmpFile ); + void OpenInput( const ByteString& rInput ); + +public: + RscTypCont* pTC; // String und Id-Verwalter + RscCmdLine* pCL; // Kommandozeile + FILE * fListing; // Ausgabedatei fuer Listings + FILE * fExitFile; // bei Abbruch muss diese Datei geschlossen werden + + RscCompiler( RscCmdLine *, RscTypCont * ); + ~RscCompiler(); + + ERRTYPE Start(); + ByteString GetTmpFileName(); // Die Dateien werden geloescht + + // Include Statements lesen + ERRTYPE IncludeParser( ULONG lFileKey ); + ERRTYPE ParseOneFile( ULONG lFileKey ); + ERRTYPE CheckSyntax(); + ERRTYPE Link(); + void EndCompile(); +}; + +#endif //_RSCRSC_HXX diff --git a/rsc/inc/rscsfx.hxx b/rsc/inc/rscsfx.hxx new file mode 100644 index 000000000000..57713e2cc740 --- /dev/null +++ b/rsc/inc/rscsfx.hxx @@ -0,0 +1,104 @@ +/************************************************************************* + * + * $RCSfile: rscsfx.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************ + + Source Code Control System - Header + + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscsfx.hxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $ + +**************************************************************************/ + +#ifndef _RSCSFX_HXX +#define _RSCSFX_HXX + +// StarView (RSC_NOTYPE) bis (RSC_NOTYPE + 0x190) +// Sfx (RSC_NOTYPE + 0x200) bis (RSC_NOTYPE + 0x20F) +#define RSC_SFX_STYLE_FAMILIES (0x100 + 0x201) +#define RSC_SFX_STYLE_FAMILY_ITEM (0x100 + 0x202) +#define RSC_SFX_SLOT_INFO (0x100 + 0x203) +// StarMoney (RSC_NOTYPE + 0x210) bis (RSC_NOTYPE + 0x22F) +// Public (RSC_NOTYPE + 0x300) bis (RSC_NOTYPE + 0x3FF) + +//========== S F X ======================================= +enum SfxStyleFamily { SFX_STYLE_FAMILY_CHAR = 1, + SFX_STYLE_FAMILY_PARA = 2, + SFX_STYLE_FAMILY_FRAME = 4, + SFX_STYLE_FAMILY_PAGE = 8, + SFX_STYLE_FAMILY_PSEUDO = 16, + SFX_STYLE_FAMILY_ALL = 0x7fff + }; + + +// SfxTemplateDialog +#define RSC_SFX_STYLE_ITEM_LIST 0x1 +#define RSC_SFX_STYLE_ITEM_BITMAP 0x2 +#define RSC_SFX_STYLE_ITEM_TEXT 0x4 +#define RSC_SFX_STYLE_ITEM_HELPTEXT 0x8 +#define RSC_SFX_STYLE_ITEM_STYLEFAMILY 0x10 +#define RSC_SFX_STYLE_ITEM_IMAGE 0x20 + + +// SfxSlotInfo +#define RSC_SFX_SLOT_INFO_SLOTNAME 0x1 +#define RSC_SFX_SLOT_INFO_HELPTEXT 0x2 + + +#endif diff --git a/rsc/inc/rscstr.hxx b/rsc/inc/rscstr.hxx new file mode 100644 index 000000000000..72be37d459a3 --- /dev/null +++ b/rsc/inc/rscstr.hxx @@ -0,0 +1,176 @@ +/************************************************************************* + * + * $RCSfile: rscstr.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************ + + Source Code Control System - Header + + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscstr.hxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $ + + Source Code Control System - Update + + $Log: not supported by cvs2svn $ + Revision 1.12 2000/09/17 12:51:09 willem.vandorp + OpenOffice header added. + + Revision 1.11 2000/07/26 17:13:17 willem.vandorp + Headers/footers replaced + + Revision 1.10 1997/08/27 18:18:12 MM + neue Headerstruktur + + + Rev 1.9 27 Aug 1997 18:18:12 MM + neue Headerstruktur + + Rev 1.8 12 Sep 1996 12:44:56 MM + Eigene Ressourcen definieren + + Rev 1.7 21 Nov 1995 19:49:08 TLX + Neuer Link + + Rev 1.6 12 Jan 1994 15:18:22 mm + Alignementprobleme und Warnings fuer DEC-Alpha beseitigt + + Rev 1.5 25 Aug 1993 15:34:30 mm + Fehler und Warnings beseitigt + + Rev 1.4 04 Feb 1993 17:38:44 mm + GetClassType Fehler verbessert und keine Inline -ctor. + + Rev 1.3 03 Feb 1993 15:03:08 mm + GetClassType() implementiert + + Rev 1.2 05 Jan 1993 10:50:44 mm + Neues Default verhalten + + Rev 1.1 23 Dec 1992 14:02:40 mm + Sprachaenderung + + Rev 1.0 10 Aug 1992 07:14:14 MM + Initial revision. + + Rev 1.11 23 Mar 1992 15:24:20 MM + + Rev 1.10 16 Jan 1992 12:48:06 MM + IsVarDefault +**************************************************************************/ + +#ifndef _RSCSTR_HXX +#define _RSCSTR_HXX + +#ifndef _RSCALL_H +#include <rscall.h> +#endif +#ifndef _RSCERROR_H +#include <rscerror.h> +#endif +#ifndef _RSCHASH_HXX +#include <rschash.hxx> +#endif +#ifndef _RSCTOP_HXX +#include <rsctop.hxx> +#endif + +/******************* R s c S t r i n g ***********************************/ +class RscString : public RscTop +{ + RscTop * pRefClass; + struct RscStringInst { + char * pStr; // Zeiger auf String + BOOL bDflt; // Ist Default + RscId aRefId; // ReferenzName + }; + USHORT nSize; +public: + RscString( HASHID nId, USHORT nTypId ); + virtual RSCCLASS_TYPE GetClassType() const; + + void SetRefClass( RscTop * pClass ) + { + pRefClass = pClass; + }; + RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, BOOL ); + // Der zulaessige Bereich wird gesetzt + void Destroy( const RSCINST & rInst ); + USHORT Size(){ return nSize; } + void SetToDefault( const RSCINST & rInst ) + { + ((RscStringInst*)rInst.pData)->bDflt = TRUE; + } + BOOL IsDefault( const RSCINST & rInst) + { + return( ((RscStringInst*)rInst.pData)->bDflt ); + }; + // Als Default setzen + BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + ERRTYPE SetString( const RSCINST &, char * pStr ); + ERRTYPE GetString( const RSCINST &, char ** ppStr ); + ERRTYPE GetRef( const RSCINST & rInst, RscId * ); + ERRTYPE SetRef( const RSCINST & rInst, const RscId & rRefId ); + void WriteSrc( const RSCINST &, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, const char * ); + ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem, + RscTypCont * pTC, USHORT, BOOL bExtra ); + virtual void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, + const char * ); +}; + +#endif // _RSCSTR_HXX diff --git a/rsc/inc/rsctools.hxx b/rsc/inc/rsctools.hxx new file mode 100644 index 000000000000..d5545699b017 --- /dev/null +++ b/rsc/inc/rsctools.hxx @@ -0,0 +1,246 @@ +/************************************************************************* + * + * $RCSfile: rsctools.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************ + + Source Code Control System - Header + + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rsctools.hxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $ + + Source Code Control System - Update + + $Log: not supported by cvs2svn $ + Revision 1.16 2000/09/17 12:51:09 willem.vandorp + OpenOffice header added. + + Revision 1.15 2000/07/26 17:13:17 willem.vandorp + Headers/footers replaced + + Revision 1.14 2000/07/11 16:59:41 th + Unicode + + Revision 1.13 1999/09/20 17:25:29 pl + PutAt mit short + + Revision 1.12 1999/09/08 11:47:39 mm + BigEndian/LittleEndian corrected + +**************************************************************************/ +struct RSHEADER_TYPE; +class RscPtrPtr; + +#ifndef _RSCTOOLS_HXX +#define _RSCTOOLS_HXX + +#ifdef UNX +#include <stdlib.h> +#endif +#include <stdio.h> + +#ifndef _STRING_HXX //autogen +#include <tools/string.hxx> +#endif + +#ifndef _LIST_HXX //autogen +#include <tools/list.hxx> +#endif + +/******************* T y p e s *******************************************/ +#define HASH_NONAME 0xFFFF //not an entry in hashtabel +typedef USHORT HASHID; // Definition von HASHID +// Zeichensatz +enum COMPARE { LESS = -1, EQUAL = 0, GREATER = 1 }; + +enum RSCBYTEORDER_TYPE { RSC_BIGENDIAN, RSC_LITTLEENDIAN, RSC_SYSTEMENDIAN }; + +/******************* M A K R O S *****************************************/ +#define ALIGNED_SIZE( nSize ) \ + (nSize + sizeof( void * ) -1) / sizeof( void * ) * sizeof( void * ) +/******************* F u n c t i o n F o r w a r d s *******************/ +ByteString GetTmpFileName(); +BOOL Append( ByteString aDestFile, ByteString aSourceFile ); +BOOL Append( FILE * fDest, ByteString aSourceFile ); +ByteString InputFile ( char * pInput, char * pExt ); +ByteString OutputFile( ByteString aInput, char * ext ); +char * ResponseFile( RscPtrPtr * ppCmd, char ** ppArgv, + USHORT nArgc ); +void RscExit( USHORT nExit ); + +/********* A n s i - F u n c t i o n F o r w a r d s *******************/ +int rsc_strnicmp( const char *string1, const char *string2, size_t count ); +int rsc_stricmp( const char *string1, const char *string2 ); + +/****************** C L A S S E S ****************************************/ +DECLARE_LIST( RscStrList, ByteString * ) +/*********** R s c C h a r ***********************************************/ +class RscChar +{ +public: + static char * MakeUTF8( char * pStr, UINT16 nTextEncoding ); + static char * MakeUTF8FromL( char * pStr ); +}; + +/*********** R s c M e m *************************************************/ +class RscMem +{ +public: + static void * Malloc( USHORT nSize ); + static void * Realloc( void * pMem, USHORT nSize ); + static char * Realloc( char * pMem, USHORT nSize ){ + return (char *)Realloc( (void *)pMem, nSize ); + } + static void Free( void * pMem ); + static void Free( char * pMem ){ + Free( (void *)pMem ); + } + static char * Assignsw( const char *psw, short nExtraSpace ); +}; + +/****************** R s c P t r P t r ************************************/ +class RscPtrPtr +{ + USHORT nCount; + void ** pMem; +public: + RscPtrPtr(); + ~RscPtrPtr(); + void Reset(); + USHORT Append( void * ); + USHORT Append( char * pStr ){ + return( Append( (void *)pStr ) ); + }; + USHORT GetCount(){ return( nCount ); }; + void * GetEntry( USHORT nEle ); + void ** GetBlock(){ return( pMem ); }; +}; + +/****************** R s c W r i t e R c **********************************/ +class RscWriteRc +{ + USHORT nLen; + BOOL bSwap; + RSCBYTEORDER_TYPE nByteOrder; + char * pMem; + char * GetPointer( USHORT nSize ); +public: + RscWriteRc( RSCBYTEORDER_TYPE nOrder = RSC_SYSTEMENDIAN ); + ~RscWriteRc(); + USHORT IncSize( USHORT nSize );// gibt die vorherige Groesse + void * GetBuffer() + { + return GetPointer( 0 ); + } + USHORT GetShort( USHORT nPos ) + { + return bSwap ? SWAPSHORT( *(USHORT*)(GetPointer(nPos)) ) : *(USHORT*)(GetPointer(nPos)); + } + char * GetUTF8( USHORT nPos ) + { + return GetPointer( nPos ); + } + + + RSCBYTEORDER_TYPE GetByteOrder() const { return nByteOrder; } + USHORT Size(){ return( nLen ); }; + //void Put( void * pData, USHORT nSize ); + void Put( INT32 lVal ) + { + if( bSwap ) + { + Put( *(((USHORT*)&lVal) +1) ); + Put( *(USHORT*)&lVal ); + } + else + { + Put( *(USHORT*)&lVal ); + Put( *(((USHORT*)&lVal) +1) ); + } + } + void Put( UINT32 nValue ) + { Put( (INT32)nValue ); } + void Put( USHORT nValue ); + void Put( short nValue ) + { Put( (USHORT)nValue ); } + void PutUTF8( char * pData ); + + void PutAt( USHORT nPos, INT32 lVal ) + { + if( bSwap ) + { + PutAt( nPos, *(((USHORT*)&lVal) +1) ); + PutAt( nPos + 2, *(USHORT*)&lVal ); + } + else + { + PutAt( nPos, *(USHORT*)&lVal ); + PutAt( nPos + 2, *(((USHORT*)&lVal) +1) ); + } + } + void PutAt( USHORT nPos, short nVal ) + { + PutAt( nPos, (USHORT)nVal ); + } + void PutAt( USHORT nPos, USHORT nVal ) + { + *(USHORT *)(GetPointer( nPos )) = bSwap ? SWAPSHORT( nVal ) : nVal; + } +}; + +#endif // _RSCTOOLS_HXX diff --git a/rsc/inc/rsctop.hxx b/rsc/inc/rsctop.hxx new file mode 100644 index 000000000000..4dd365c04bc2 --- /dev/null +++ b/rsc/inc/rsctop.hxx @@ -0,0 +1,297 @@ +/************************************************************************* + * + * $RCSfile: rsctop.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************ + + Source Code Control System - Header + + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rsctop.hxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $ + +**************************************************************************/ + +#ifndef _RSCTOP_HXX +#define _RSCTOP_HXX + +#ifndef _RSCERROR_H +#include <rscerror.h> +#endif +#ifndef _RSCTOOLS_HXX +#include <rsctools.hxx> +#endif +#ifndef _RSCHASH_HXX +#include <rschash.hxx> +#endif +#ifndef _RSCCLOBJ_HXX +#include <rscclobj.hxx> +#endif + +/****************** T Y P E S ********************************************/ +typedef short RSCVAR; +#define VAR_POINTER 0x0001 +#define VAR_HIDDEN 0x0002 +#define VAR_NODATAINST 0x0004 +#define VAR_NORC 0x0008 +#define VAR_SVDYNAMIC 0x0010 +#define VAR_NOENUM 0x0020 +#define VAR_EXTENDABLE 0x0040 /* Auch die Ableitung einer Klasse kann angegeben werden */ + +/****************** C L A S S E S ****************************************/ +/******************* R s c C l a s s *************************************/ +class RscTop : public RefNode +{ + RscTop * pSuperClass; + RSCINST aDfltInst; + USHORT nTypId; + RscTop * pRefClass; + +protected: + RscTop( HASHID nId, USHORT nTypIdent, + RscTop * pSuperCl = NULL ); + +public: + ByteString aCallPar1; // Klassenaufruf ohne Typen bis ResId + ByteString aCallPar2; // Klassenaufruf ohne Typen ab ResId + ByteString aCallParType; // Klassenaufruf mit Typen + + void SetSuperClass( RscTop * pClass ) + { + pSuperClass = pClass; + } + RscTop* GetSuperClass() const + { return pSuperClass; } + // Gibt den Typidentifier zurueck + USHORT GetTypId() const + { return nTypId; }; + // Gibt die Oberklasse zurueck + BOOL InHierarchy( RscTop * pClass ); + BOOL IsCodeWriteable() const + { + return( 0 != aCallParType.Len() ); + } + void SetCallPar( const ByteString & rPar1, const ByteString & rPar2, + const ByteString & rParType ); + void SetRefClass( RscTop * pRef ) { pRefClass = pRef; } + RscTop* GetRefClass() const { return pRefClass; } + virtual RSCCLASS_TYPE GetClassType() const = 0; + RSCINST GetDefault(); + + // Vorbereitung auf den dtor aufruf + // Da die Klassen gegenseitige Abhaengigkeiten + // aufweisen koennen, kann man im dtor nicht davon + // ausgehen, dass alle Klassenzeiger noch gueltig sind + virtual void Pre_dtor(); + + virtual HASHID GetConstant( USHORT ); + + virtual RscTop * GetTypeClass() const; + + // Gibt die Groesse der Klasse in Bytes + virtual USHORT Size(); + + // Gibt die Referenz zurueck + virtual ERRTYPE GetRef( const RSCINST & rInst, RscId * ); + + // Gibt die Referenz zurueck + virtual ERRTYPE SetRef( const RSCINST & rInst, const RscId & rRefId ); + + // Variable anlegen + virtual ERRTYPE SetVariable( HASHID nVarName, RscTop * pClass, + RSCINST * pDflt = NULL, + RSCVAR nVarType = 0, USHORT nMask = 0, + HASHID nDataBaseName = HASH_NONAME ); + + // Zaehlt alle Variablen auf + virtual void EnumVariables( void * pData, VarEnumCallbackProc ); + + // Liefert Instanz der Variablen zurueck + // pData, pClass im return koennen NULL sein + virtual RSCINST GetVariable( const RSCINST & rInst, HASHID nVarName, + const RSCINST & rInitInst, + BOOL nInitDflt = FALSE, + RscTop * pCreateClass = NULL ); + virtual RSCINST GetCopyVar( const RSCINST & rInst, HASHID nVarName ); + + virtual RSCINST GetTupelVar( const RSCINST & rInst, USHORT nPos, + const RSCINST & rInitInst ); + + // Liefert Instanz aus einem Feld zurueck + // pGetInst im return kann NULL sein + virtual ERRTYPE GetElement( const RSCINST & rInst, const RscId & rEleName, + RscTop *pCreateClass, const RSCINST & rCreateInst, + RSCINST * pGetInst ); + + // Liefert Instanz aus einem Feld zurueck + // pGetInst im return kann NULL sein + virtual ERRTYPE GetValueEle( const RSCINST & rInst, long lValue, + RscTop * pCreateClass, + RSCINST * pGetInst ); + + // Liefert Instanz aus einem Feld zurueck + // pGetInst im return kann NULL sein + virtual ERRTYPE GetArrayEle( const RSCINST & rInst, HASHID nId, + RscTop * pCreateClass, + RSCINST * pGetInst ); + + virtual RSCINST SearchEle( const RSCINST & rInst, const RscId & rEleName, + RscTop * pClass ); + + // Liefert Instanz an der Position zurueck + virtual RSCINST GetPosEle( const RSCINST & rInst, USHORT nPos ); + + // verschiebt eine Instanz + virtual ERRTYPE MovePosEle( const RSCINST & rInst, USHORT nDestPos, + USHORT nSourcePos ); + + // aendert RscId an Position + virtual ERRTYPE SetPosRscId( const RSCINST & rInst, USHORT nPos, + const RscId & rRscId); + + // Liefert Information ueber Instanz + // an der Position zurueck + virtual SUBINFO_STRUCT GetInfoEle( const RSCINST & rInst, USHORT nPos ); + + // Anzahl der Eintraege + virtual USHORT GetCount( const RSCINST & rInst ); + + // Eine Zuweisung an eine Variable + virtual ERRTYPE SetNumber( const RSCINST & rInst, long lValue ); + + // Eine Zuweisung an eine Variable + virtual ERRTYPE SetBool( const RSCINST & rInst, BOOL bValue ); + + // Eine Zuweisung an eine Variable + virtual ERRTYPE SetConst( const RSCINST & rInst, HASHID nValueId, + long nValue ); + + // Eine Zuweisung an eine Variable + virtual ERRTYPE SetNotConst( const RSCINST & rInst, HASHID nId ); + + virtual ERRTYPE SetString( const RSCINST & rInst, char * pStr ); + + virtual ERRTYPE GetNumber( const RSCINST & rInst, long * pN ); + + virtual ERRTYPE GetBool( const RSCINST & rInst, BOOL * pB ); + + virtual ERRTYPE GetConst( const RSCINST & rInst, HASHID * pH ); + + virtual ERRTYPE GetString( const RSCINST & rInst, char ** ppStr ); + + virtual RSCINST Create( RSCINST * pInst, + const RSCINST & rDefInst, BOOL bOwnClass = FALSE ); + + // Instanz zerstoeren + virtual void Destroy( const RSCINST & rInst ); + + // prueft auf konsistenz + virtual BOOL IsConsistent( const RSCINST & rInst, + RscInconsList * pList = NULL ); + + // Alles auf Default setzen + virtual void SetToDefault( const RSCINST & rInst ); + + // Ist Eingabe = Default + virtual BOOL IsDefault( const RSCINST & rInst ); + + // Gleiche Werte auf Default setzen + virtual BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + + // Instanz auf Default setzen + virtual void SetDefault( const RSCINST & rInst, HASHID nVarId ); + + // Default zu einer Variablen holen + virtual RSCINST GetDefault( HASHID nVarId ); + + virtual void Delete( const RSCINST & rInst, RscTop * pClass, + const RscId & rId ); + + virtual void DeletePos( const RSCINST & rInst, USHORT nPos ); + + // Schreibt den Kopf und das Ende einer Resource + // Script Datei + virtual void WriteSrcHeader( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, + const RscId & aId, const char * ); + virtual void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab,const char * ); + virtual ERRTYPE WriteRcHeader( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, const RscId & aId, + USHORT nDeep, BOOL bExtra ); + virtual ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, USHORT nDeep, BOOL bExtra ); + + // Weiterleitung an Superklassen wird unterbunden + virtual ERRTYPE WriteHxxHeader( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId & rId ); + virtual ERRTYPE WriteHxx( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId &rId ); + virtual ERRTYPE WriteCxxHeader( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId &rId ); + virtual ERRTYPE WriteCxx( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId &rId ); + + void WriteSyntaxHeader( FILE * fOutput, RscTypCont * pTC ); + virtual void WriteSyntax( FILE * fOutput, RscTypCont * pTC ); + + virtual void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, + const char * ); + virtual void WriteRcCtor( FILE * fOutput, RscTypCont * pTC ); +}; + +#endif //_RSCTOP_HXX diff --git a/rsc/inc/rsctree.hxx b/rsc/inc/rsctree.hxx new file mode 100644 index 000000000000..2fb07b9b4e6b --- /dev/null +++ b/rsc/inc/rsctree.hxx @@ -0,0 +1,176 @@ +/************************************************************************* + * + * $RCSfile: rsctree.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************ + + Source Code Control System - Header + + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rsctree.hxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $ + + Source Code Control System - Update + + $Log: not supported by cvs2svn $ + Revision 1.8 2000/09/17 12:51:10 willem.vandorp + OpenOffice header added. + + Revision 1.7 2000/07/26 17:13:17 willem.vandorp + Headers/footers replaced + + Revision 1.6 2000/07/11 17:01:09 th + Unicode + + Revision 1.5 1997/08/27 18:18:02 MM + neue Headerstruktur + +**************************************************************************/ + +#ifndef _RSCTREE_HXX +#define _RSCTREE_HXX + +#ifndef _LINK_HXX +#include <tools/link.hxx> +#endif + +#ifndef _RSCTOOLS_HXX +#include <rsctools.hxx> +#endif + +/****************** C L A S S E S ****************************************/ +class BiNode +{ +protected: + BiNode* pLeft; // left subtree + BiNode* pRight; // right subtree + +public: + + // Wandelt eine doppelt verkettete Liste in + // einen binaeren Baum um + BiNode * ChangeDLListBTree( BiNode * pList ); + + BiNode(); + virtual ~BiNode(); + + + // Wandelt einen binaeren Baum in eine doppelt + // verkettete Liste um + BiNode* ChangeBTreeDLList(); + + BiNode * Left() const { return pLeft ; }; + BiNode * Right() const{ return pRight ; }; + void EnumNodes( Link aLink ) const; +}; + +/*************************************************************************/ +class NameNode : public BiNode +{ + void SubOrderTree( NameNode * pOrderNode ); + +protected: + // pCmp ist Zeiger auf Namen + NameNode* Search( const void * pCmp ) const; + +public: + NameNode* Left() const { return (NameNode *)pLeft ; }; + NameNode* Right() const{ return (NameNode *)pRight ; }; + NameNode* Search( const NameNode * pName ) const; + // insert a new node in the b-tree + BOOL Insert( NameNode * pTN, USHORT * nDepth ); + BOOL Insert( NameNode* pTN ); + virtual COMPARE Compare( const NameNode * ) const; + virtual COMPARE Compare( const void * ) const; + NameNode* SearchParent( const NameNode * ) const; + // return ist neue Root + NameNode* Remove( NameNode * ); + void OrderTree(); + BOOL IsOrderTree() const; + +}; + +/*************************************************************************/ +class IdNode : public NameNode +{ + virtual COMPARE Compare( const NameNode * ) const; + virtual COMPARE Compare( const void * ) const; + +public: + + IdNode* Search( USHORT nTypName ) const; + virtual USHORT GetId() const; +}; + +/*************************************************************************/ +class StringNode : public NameNode +{ + virtual COMPARE Compare( const NameNode * ) const; + virtual COMPARE Compare( const void * ) const; + +protected: + ByteString aName; + +public: + StringNode(){}; + StringNode( const ByteString & rStr ) { aName = rStr; } + + StringNode* Search( const char * ) const; + ByteString GetName() const { return aName; } +}; + +#endif // _RSCTREE_HXX diff --git a/rsc/prj/d.lst b/rsc/prj/d.lst new file mode 100644 index 000000000000..0d6fb9eacab7 --- /dev/null +++ b/rsc/prj/d.lst @@ -0,0 +1,7 @@ +..\%__SRC%\bin\rsc.exe %_DEST%\bin%_EXT%\rsc.exe +..\%__SRC%\bin\rsc2.exe %_DEST%\bin%_EXT%\rsc2.exe +..\%__SRC%\bin\rsc %_DEST%\bin%_EXT%\rsc +..\%__SRC%\bin\rsc2 %_DEST%\bin%_EXT%\rsc2 + +mkdir: %_DEST%\inc%_EXT%\rsc +hedabu: ..\inc\rscsfx.hxx %_DEST%\inc%_EXT%\rsc\rscsfx.hxx diff --git a/rsc/source/misc/makefile.mk b/rsc/source/misc/makefile.mk new file mode 100644 index 000000000000..3deeb7780924 --- /dev/null +++ b/rsc/source/misc/makefile.mk @@ -0,0 +1,82 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=rsc +TARGET=rscmis + +# --- Settings ------------------------------------------------------ + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Files --------------------------------------------------------- + +CXXFILES= rsclst.cxx \ + rscdbl.cxx + +OBJFILES= $(OBJ)$/rsclst.obj \ + $(OBJ)$/rscdbl.obj + +.INCLUDE : target.mk diff --git a/rsc/source/misc/rscdbl.cxx b/rsc/source/misc/rscdbl.cxx new file mode 100644 index 000000000000..ec47846ac826 --- /dev/null +++ b/rsc/source/misc/rscdbl.cxx @@ -0,0 +1,162 @@ +/************************************************************************* + * + * $RCSfile: rscdbl.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <stdio.h> + +#ifndef _RSCDB_HXX +#include <rscdb.hxx> +#endif +#ifndef _RSCALL_H +#include <rscall.h> +#endif +#ifndef _RSCHASH_HXX +#include <rschash.hxx> +#endif +#ifndef _RSCTREE_HXX +#include <rsctree.hxx> +#endif +#ifndef _RSCTOP_HXX +#include <rsctop.hxx> +#endif +#ifndef _RSCLST_HXX +#include "rsclst.hxx" +#endif + +/************************************************************************* +|* +|* RscTypCont::FillNameIdList() +|* +|* Beschreibung +|* Ersterstellung MM 07.05.91 +|* Letzte Aenderung MM 30.05.91 +|* +*************************************************************************/ +REResourceList * InsertList( HASHID nClassName, const RscId& rId, + REResourceList * pList ){ + REResourceList * pSubList; + char * pStrClass; + ByteString aStrClass; + + pStrClass = pHS->Get( nClassName ); + if( pStrClass ) + aStrClass = pStrClass; + else + aStrClass = ByteString::CreateFromInt32( (long)nClassName ); + + pSubList = new REResourceList( pList, aStrClass, rId ); + + pList->Insert( pSubList, 0xFFFF ); + return( pSubList ); +} + +void FillSubList( RSCINST & rInst, REResourceList * pList ){ + USHORT nCount, i; + SUBINFO_STRUCT aInfo; + REResourceList* pSubList; + RSCINST aTmpI; + + nCount = rInst.pClass->GetCount( rInst ); + for( i = 0; i < nCount; i++ ){ + aInfo = rInst.pClass->GetInfoEle( rInst, i ); + aTmpI = rInst.pClass->GetPosEle( rInst, i ); + pSubList = InsertList( aInfo.pClass->GetId(), + aInfo.aId, pList ); + FillSubList( aTmpI, pSubList ); + }; +} + +void FillListObj( ObjNode * pObjNode, RscTop * pRscTop, + REResourceList * pList, ULONG lFileKey ) +{ + if( pObjNode ){ + if( pObjNode->GetFileKey() == lFileKey ){ + RSCINST aTmpI; + REResourceList* pSubList; + + FillListObj( (ObjNode*)pObjNode->Left(), pRscTop, + pList, lFileKey ); + + pSubList = InsertList( pRscTop->GetId(), + pObjNode->GetRscId(), pList ); + + aTmpI.pClass = pRscTop; + aTmpI.pData = pObjNode->GetRscObj(); + FillSubList( aTmpI, pSubList ); + + FillListObj( (ObjNode*)pObjNode->Right(), pRscTop, + pList, lFileKey ); + } + }; +} + +void FillList( RscTop * pRscTop, REResourceList * pList, ULONG lFileKey ){ + if( pRscTop ){ + FillList( (RscTop*)pRscTop->Left(), pList, lFileKey ); + + FillListObj( pRscTop->GetObjNode(), pRscTop, pList, lFileKey ); + + FillList( (RscTop*)pRscTop->Right(), pList, lFileKey ); + }; +} + +void RscTypCont::FillNameIdList( REResourceList * pList, ULONG lFileKey ){ + FillList( pRoot, pList, lFileKey ); +} diff --git a/rsc/source/misc/rsclst.cxx b/rsc/source/misc/rsclst.cxx new file mode 100644 index 000000000000..a172097a031f --- /dev/null +++ b/rsc/source/misc/rsclst.cxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * $RCSfile: rsclst.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include "rsclst.hxx" + +REResourceList :: REResourceList() +{ + bVisible = FALSE; + pParent = NULL; +} + +REResourceList :: REResourceList( REResourceList* pParentList, + ByteString& rClassName, + const RscId & rResourceID, BOOL bVis ) +{ + pParent = pParentList; + aClassName = rClassName; + aRscId = rResourceID; + bVisible = bVis; +} + +REResourceList :: ~REResourceList() +{ +} diff --git a/rsc/source/parser/erscerr.cxx b/rsc/source/parser/erscerr.cxx new file mode 100644 index 000000000000..1a0453dca865 --- /dev/null +++ b/rsc/source/parser/erscerr.cxx @@ -0,0 +1,512 @@ +/************************************************************************* + * + * $RCSfile: erscerr.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************ + + Source Code Control System - Header + + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/source/parser/erscerr.cxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $ + +************************************************************************/ +#pragma hdrstop +#include <stdlib.h> +#include <stdio.h> + +#include <tools/rcid.h> + +#ifndef _RSCHASH_HXX +#include <rschash.hxx> +#endif +#ifndef _RSCERROR_H +#include <rscerror.h> +#endif +#ifndef _RSCALL_H +#include <rscall.h> +#endif +#ifndef _RSCDB_HXX +#include <rscdb.hxx> +#endif +#ifndef _RSCPAR_HXX +#include <rscpar.hxx> +#endif + +#include "rsclex.hxx" + +/************************************************************************* +|* +|* ERRTYPE::operator = ; +|* +|* Beschreibung +|* Ersterstellung MM 25.09.91 +|* Letzte Aenderung MM 25.09.91 +|* +*************************************************************************/ +ERRTYPE& ERRTYPE::operator = ( const ERRTYPE & rError ) +{ + if( !IsError() ){ + if( rError.IsError() || !IsWarning() ) + nError = rError.nError; + } + return *this; +} + +/************************************************************************* +|* +|* RscError::StdOut(); +|* +|* Beschreibung +|* Ersterstellung MM 06.05.91 +|* Letzte Aenderung MM 06.05.91 +|* +*************************************************************************/ +void RscError::StdOut( const char * pStr ) +{ +#ifndef WIN + if( pStr ){ + printf( "%s", pStr ); + fflush( stdout ); + } +#endif +} + +/************************************************************************* +|* +|* RscError::LstOut(); +|* +|* Beschreibung +|* Ersterstellung MM 06.05.91 +|* Letzte Aenderung MM 06.05.91 +|* +*************************************************************************/ +void RscError::LstOut( const char * pStr ){ + if( fListing && pStr ) + fprintf( fListing, "%s", pStr ); +} + +/************************************************************************* +|* +|* RscError::StdLstOut(); +|* +|* Beschreibung +|* Ersterstellung MM 06.05.91 +|* Letzte Aenderung MM 06.05.91 +|* +*************************************************************************/ +void RscError::StdLstOut( const char * pStr ){ + StdOut( pStr ); + LstOut( pStr ); +} + +/************************************************************************* +|* +|* RscError::WriteError(); +|* +|* Beschreibung +|* Ersterstellung MM 06.05.91 +|* Letzte Aenderung MM 06.05.91 +|* +*************************************************************************/ +void RscError::WriteError( const ERRTYPE& rError, const char * pMessage ) +{ + switch( rError ) + { + case ERR_ERROR: { + StdLstOut( "!! " ); + if( 1 == nErrors ) + StdLstOut( ByteString::CreateFromInt32( nErrors ).GetBuffer() ); + else + StdLstOut( ByteString::CreateFromInt32( (USHORT)(nErrors -1) ).GetBuffer() ); + StdLstOut( " Error" ); + StdLstOut( " found!!" ); + } + break; + + case ERR_UNKNOWN_METHOD: + StdLstOut( "The used type is not allowed." ); + break; + + case ERR_OPENFILE: + StdLstOut( "This file <" ); + StdLstOut( pMessage ); + StdLstOut( "> cannot be opened." ); + break; + + case ERR_FILESIZE: + StdLstOut( "Wrong file <" ); + StdLstOut( pMessage ); + StdLstOut( "> length." ); + break; + + case ERR_FILEFORMAT: + StdLstOut( "Wrong file type <" ); + StdLstOut( pMessage ); + StdLstOut( ">." ); + break; + + case ERR_NOCHAR: + StdLstOut( "Character: '\\xxx'; The value xxx is greater than 255."); + break; + + case ERR_NORSCINST: + StdLstOut( "Internal error, instance invalid."); + break; + + + case ERR_NOINPUT: + StdLstOut( "Input file was not specified.\n"); + case ERR_USAGE: + StdLstOut( "Copyright (C) 1990-92 STAR DIVISION GmbH\n" ); + { + char buf[40]; + + StdLstOut( "DataVersion: " ); + sprintf( buf, "%d.%d\n\n", + RSCVERSION_ID / 100, RSCVERSION_ID % 100 ); + StdLstOut( buf ); + }; + + StdLstOut( "Command line: rsc [Switches] <Source File(s)>\n" ); + StdLstOut( "Command line: rsc @<Command File>\n" ); + StdLstOut( "-h shows this help.\n" ); + StdLstOut( "-p No Preprocessor.\n" ); + StdLstOut( "-s Syntax analysis, creates .srs file\n"); + StdLstOut( "-l Linker, links files created with rsc -s,\n" ); + StdLstOut( " creates .rc file and .res file.\n" ); + StdLstOut( "-r Prevents .res file.\n" ); + StdLstOut( "-d Symbol definitions for the Preprocessor.\n" ); + StdLstOut( "-i Include directives for the Preprocessor.\n" ); + StdLstOut( "-presponse Use response file for Preprocessor.\n" ); + StdLstOut( "-lg<language> Use a different language.\n" ); + StdLstOut( "-pp<filename> Use a different Preprocessor.\n" ); + StdLstOut( "-rc<filename> Use a different system resource compiler.\n" ); + StdLstOut( "-fo<filename> Renaming of the .res file.\n" ); + StdLstOut( "-fs<filename> Renaming of the .rc file.\n" ); + StdLstOut( "-fp<filename> Renaming of the .srs file.\n" ); + StdLstOut( "-fl<filename> Listing file.\n" ); + StdLstOut( "-fh<filename> Header file.\n" ); + StdLstOut( "-fc<filename> Code file.\n" ); + StdLstOut( "-CHARSET_... Convert to this character set.\n" ); + StdLstOut( "-BIGENDIAN Format of number values.\n" ); + StdLstOut( "-LITTLEENDIAN Format of number values.\n" ); + StdLstOut( "-SMART Generate smart names (cxx, hxx).\n" ); + StdLstOut( "-SrsDefault Only write one language to srs file.\n" ); + break; + + case ERR_UNKNOWNSW: + StdLstOut( "Unknown switch <" ); + StdLstOut( pMessage ); + StdLstOut( ">." ); + break; + + case ERR_REFTODEEP: + StdLstOut( "Too many reference levels have been used (see Switch -RefDeep)." ); + break; + + case ERR_CONT_INVALIDPOS: + StdLstOut( "Internal error, Container class: invalid position." ); + break; + + case ERR_CONT_INVALIDTYPE: + StdLstOut( "Invalid type <" ); + StdLstOut( pMessage ); + StdLstOut( ">." ); + break; + + case ERR_ARRAY_INVALIDINDEX: + StdLstOut( "Internal error, Array class: invalid index." ); + break; + + case ERR_RSCINST_NOVARNAME: + StdLstOut( "Internal error, invalid name of variable." ); + break; + + case ERR_YACC: + StdLstOut( pMessage ); + break; + + case ERR_DOUBLEID: + StdLstOut( "Two global resources have the same identifier." ); + break; + + case ERR_FALSETYPE: + StdLstOut( "Wrong type <" ); + StdLstOut( pMessage ); + StdLstOut( ">." ); + break; + + case ERR_NOVARIABLENAME: + StdLstOut( "The variable <" ); + StdLstOut( pMessage ); + StdLstOut( "> must not be used here." ); + break; + + case ERR_RSCRANGE_OUTDEFSET: + StdLstOut( "The used value is not in the expected domain." ); + break; + + case ERR_USHORTRANGE: + StdLstOut( "Value is <" ); + StdLstOut( pMessage ); + StdLstOut( "> the allowed domain is from 0 up to 65535." ); + break; + + case ERR_IDRANGE: + StdLstOut( "Value is <" ); + StdLstOut( pMessage ); + StdLstOut( "> the allowed domain is from 1 up to 32767." ); + break; + + case ERR_NOCOPYOBJ: + StdLstOut( "Default resource <" ); + StdLstOut( pMessage ); + StdLstOut( "> not found." ); + break; + + case ERR_REFNOTALLOWED: + StdLstOut( "The use of a reference is not allowed." ); + break; + + case ERR_COPYNOTALLOWED: + StdLstOut( "The use of a default resource is not allowed." ); + break; + + case ERR_IDEXPECTED: + StdLstOut( "An identifier needs to be specified." ); + break; + + case ERR_DOUBLEDEFINE: + StdLstOut( "The symbol <" ); + StdLstOut( pMessage ); + StdLstOut( "> is defined twice." ); + break; + + case ERR_RSCINST_RESERVEDNAME: + StdLstOut( "The symbol <" ); + StdLstOut( pMessage ); + StdLstOut( "> is a reserved name." ); + break; + + case ERR_ZERODIVISION: + StdLstOut( "Attempt to divide by zero." ); + break; + + case ERR_PRAGMA: + StdLstOut( "Error in a #pragma statement." ); + break; + + case ERR_DECLAREDEFINE: + StdLstOut( "Error in the declaration part of the macro." ); + break; + + case ERR_NOTYPE: + StdLstOut( "type expected." ); + break; + +/****************** W A R N I N G S **************************************/ + case WRN_LOCALID: + StdLstOut( "Sub resources should have an identifier < 256." ); + break; + + case WRN_GLOBALID: + StdLstOut( "Global resources should have an identifier >= 256." ); + break; + + case WRN_SUBINMEMBER: + StdLstOut( "Sub resources are ignored." ); + break; + + case WRN_CONT_NOID: + StdLstOut( "Resources without name are ignored." ); + break; + + case WRN_CONT_DOUBLEID: + StdLstOut( "Two local resources have the same identifier." ); + break; + + case WRN_STR_REFNOTFOUND: + StdLstOut( "String reference <" ); + StdLstOut( pMessage ); + StdLstOut( " > could not be resolved." ); + break; + + case WRN_MGR_REFNOTFOUND: + StdLstOut( "Reference <" ); + StdLstOut( pMessage ); + StdLstOut( " > could not be resolved." ); + break; + + default: + if( pMessage ){ + StdLstOut( "\nMessage: " ); + StdLstOut( pMessage ); + }; + break; + } +} + +/************************************************************************* +|* +|* RscErrorFormat() +|* +|* Beschreibung +|* Ersterstellung MM 06.05.91 +|* Letzte Aenderung MM 06.05.91 +|* +*************************************************************************/ +void RscError::ErrorFormat( const ERRTYPE& rError, RscTop * pClass, + const RscId & aId ){ + char buf[ 10 ]; + USHORT i; + + if( pFI ) + { + pFI->SetError( rError ); + StdOut( "\n" ); + StdOut( pFI->GetLine() ); + StdOut( "\n" ); + // Fehlerposition anzeigen + for( i = 0; (USHORT)(i +1) < pFI->GetScanPos(); i++ ) + StdLstOut( " " ); + LstOut( " ^" ); //Zeilennummern beachten + StdOut( "^" ); + StdLstOut( "\n" ); + } + StdLstOut( "f" ); + sprintf( buf, "%u", (USHORT)rError ); + StdLstOut( buf ); + + if( pFI && pTC ){ + StdLstOut( ": \"" ); + StdLstOut( pTC->aFileTab.Get( pFI->GetFileIndex() )->aFileName.GetBuffer() ); + StdLstOut( "\", line " ); + sprintf( buf, "%d", pFI->GetLineNo() ); + StdLstOut( buf ); + } + + if( rError.IsError() ) + StdLstOut( ": Error" ); + else + StdLstOut( ": Warning" ); + + if( pClass || aId.IsId() ) + { + StdLstOut( " in the object (" ); + if( pClass ) + { + StdLstOut( "Type: " ); + StdLstOut( pHS->Get( pClass->GetId() ) ); + if( aId.IsId() ) + StdLstOut( ", " ); + } + if( aId.IsId() ) + StdLstOut( aId.GetName().GetBuffer() ); + StdLstOut( "):\n" ); + } + else + StdLstOut( ": " ); +} + +/************************************************************************* +|* +|* RscError::Error() +|* +|* Beschreibung +|* Ersterstellung MM 06.05.91 +|* Letzte Aenderung MM 06.05.91 +|* +*************************************************************************/ +void RscError::Error( const ERRTYPE& rError, RscTop * pClass, + const RscId & aId, const char * pMessage ) +{ + if( WRN_LOCALID == (USHORT)rError ) // Keine Warning erzeugen + return; + if( rError.IsError() ) + nErrors++; + if( rError.IsError() || rError.IsWarning() ){ + ErrorFormat( rError, pClass, aId ); + WriteError( rError, pMessage ); + StdLstOut( "\n" ); + }; +} + +/************************************************************************* +|* +|* RscError::FatalError(); +|* +|* Beschreibung +|* Ersterstellung MM 06.05.91 +|* Letzte Aenderung MM 06.05.91 +|* +*************************************************************************/ +void RscError::FatalError( const ERRTYPE& rError, const RscId &aId, + const char * pMessage ) +{ + if( ERR_USAGE != (USHORT)rError ){ + nErrors++; + ErrorFormat( rError, NULL, aId ); + WriteError( rError, pMessage ); + StdLstOut( "\nTerminating compiler\n" ); + } + else + WriteError( rError, pMessage ); + + exit( 1 ); +} + diff --git a/rsc/source/parser/makefile.mk b/rsc/source/parser/makefile.mk new file mode 100644 index 000000000000..a1563686ed64 --- /dev/null +++ b/rsc/source/parser/makefile.mk @@ -0,0 +1,111 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. + +PROJECTPCH=parser +PROJECTPCHSOURCE=parser +PRJNAME=rsc +TARGET=rscpar + +# --- Settings ----------------------------------------------------- + +.IF "$(COM)"=="ICC" +CFLAGS+= /O- +.ENDIF + +#prjpch=T +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Files -------------------------------------------------------- + +YACCOUT=$(INCCOM) + +YACCTARGET= $(YACCOUT)$/rscyacc.yxx +YACCFILES= rscyacc.y + +CXXFILES= rscpar.cxx \ + rscyacc.cxx \ + rsclex.cxx \ + erscerr.cxx \ + rsckey.cxx \ + rscinit.cxx \ + rscibas.cxx \ + rscdb.cxx \ + rscicpx.cxx \ + parser.cxx + +OBJFILES= $(OBJ)$/rscpar.obj \ + $(OBJ)$/rscyacc.obj \ + $(OBJ)$/rsclex.obj \ + $(OBJ)$/erscerr.obj \ + $(OBJ)$/rsckey.obj \ + $(OBJ)$/rscinit.obj \ + $(OBJ)$/rscibas.obj \ + $(OBJ)$/rscdb.obj \ + $(OBJ)$/rscicpx.obj + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/rsc/source/parser/parser.cxx b/rsc/source/parser/parser.cxx new file mode 100644 index 000000000000..68da2c7d69b4 --- /dev/null +++ b/rsc/source/parser/parser.cxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * $RCSfile: parser.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#pragma hdrstop +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <string.h> +#include <ctype.h> + +#include <tools/solar.h> +#define RSC_COMPILER + +#include <rscall.h> +#include <rsctools.hxx> +#include <rschash.hxx> +#include <rsckey.hxx> +#include <rsctree.hxx> +#include <rscerror.h> +#include <rscdef.hxx> + +#include <rsctop.hxx> +#include <rscmgr.hxx> +#include <rscconst.hxx> +#include <rscarray.hxx> +#include <rscclass.hxx> +#include <rsccont.hxx> +#include <rscrange.hxx> +#include <rscflag.hxx> +#include <rscstr.hxx> + +#include <rscdb.hxx> +#include <rscpar.hxx> + diff --git a/rsc/source/parser/parser.hxx b/rsc/source/parser/parser.hxx new file mode 100644 index 000000000000..a70d723ca401 --- /dev/null +++ b/rsc/source/parser/parser.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * $RCSfile: parser.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ diff --git a/rsc/source/parser/rscdb.cxx b/rsc/source/parser/rscdb.cxx new file mode 100644 index 000000000000..bf92498609fb --- /dev/null +++ b/rsc/source/parser/rscdb.cxx @@ -0,0 +1,1127 @@ +/************************************************************************* + * + * $RCSfile: rscdb.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************ + + Source Code Control System - Header + + $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/source/parser/rscdb.cxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $ + +*************************************************************************/ +/****************** I N C L U D E S **************************************/ + +#pragma hdrstop + +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <tools/intn.hxx> +#include <tools/fsys.hxx> +#include <tools/rc.h> + +// Programmabhaengige Includes. +#ifndef _RSCTREE_HXX +#include <rsctree.hxx> +#endif +#ifndef _RSCTOP_HXX +#include <rsctop.hxx> +#endif +#ifndef _RSCMGR_HXX +#include <rscmgr.hxx> +#endif +#ifndef _RSCDB_HXX +#include <rscdb.hxx> +#endif + +/************************************************************************* +|* +|* RscTypCont :: RscTypCont +|* +|* Beschreibung RES.DOC +|* Ersterstellung MM 22.03.90 +|* Letzte Aenderung MM 27.06.90 +|* +*************************************************************************/ +RscTypCont :: RscTypCont( RscError * pErrHdl, + LanguageType nLangType, + RSCBYTEORDER_TYPE nOrder, + rtl_TextEncoding nSourceCharSet_, + const ByteString & rSearchPath, + USHORT nFlagsP ) + : nLangTypeId( nLangType ), + nDfltLangTypeId( International::GetNeutralLanguage( nLangType ) ), + nByteOrder( nOrder ), + nSourceCharSet( nSourceCharSet_ ), + aSearchPath( rSearchPath ), + nFlags( nFlagsP ), + aBool( pHS->Insert( "BOOL" ), RSC_NOTYPE ), + aShort( pHS->Insert( "short" ), RSC_NOTYPE ), + aUShort( pHS->Insert( "USHORT" ), RSC_NOTYPE ), + aLong( pHS->Insert( "long" ), RSC_NOTYPE ), + aEnumLong( pHS->Insert( "enum_long" ), RSC_NOTYPE ), + aIdUShort( pHS->Insert( "IDUSHORT" ), RSC_NOTYPE ), + aIdNoZeroUShort( pHS->Insert( "IDUSHORT" ), RSC_NOTYPE ), + aNoZeroShort( pHS->Insert( "NoZeroShort" ), RSC_NOTYPE ), + a1to12Short( pHS->Insert( "MonthShort" ), RSC_NOTYPE ), + a0to23Short( pHS->Insert( "HourShort" ), RSC_NOTYPE ), + a1to31Short( pHS->Insert( "DayShort" ), RSC_NOTYPE ), + a0to59Short( pHS->Insert( "MinuteShort" ), RSC_NOTYPE ), + a0to99Short( pHS->Insert( "_0to59Short" ), RSC_NOTYPE ), + a0to9999Short( pHS->Insert( "YearShort" ), RSC_NOTYPE ), + aIdLong( pHS->Insert( "IDLONG" ), RSC_NOTYPE, TRUE ), + aString( pHS->Insert( "Chars" ), RSC_NOTYPE ), + aWinBits( pHS->Insert( "WinBits" ), RSC_NOTYPE, FALSE ), + aLangType( pHS->Insert( "LangEnum" ), RSC_NOTYPE ), + aLangString( pHS->Insert( "Lang_Chars" ), RSC_NOTYPE, &aString, + &aLangType, &nLangTypeId, &nDfltLangTypeId ), + aLangShort( pHS->Insert( "Lang_short" ), RSC_NOTYPE, &aShort, + &aLangType, &nLangTypeId, &nDfltLangTypeId ) +{ + nUniqueId = 256; + nPMId = RSC_VERSIONCONTROL +1; //mindestens einen groesser + pEH = pErrHdl; + Init(); +} + +/************************************************************************* +|* +|* RscTypCont :: ~RscTypCont +|* +|* Beschreibung RES.DOC +|* Ersterstellung MM 22.03.90 +|* Letzte Aenderung MM 27.06.90 +|* +*************************************************************************/ +void DestroyNode( RscTop * pRscTop, ObjNode * pObjNode ){ + if( pObjNode ){ + DestroyNode( pRscTop, (ObjNode*)pObjNode->Left() ); + DestroyNode( pRscTop, (ObjNode*)pObjNode->Right() ); + + if( pObjNode->GetRscObj() ){ + pRscTop->Destroy( RSCINST( pRscTop, pObjNode->GetRscObj() ) ); + RscMem::Free( pObjNode->GetRscObj() ); + } + delete pObjNode; + }; +} + +void DestroySubTrees( RscTop * pRscTop ){ + if( pRscTop ){ + DestroySubTrees( (RscTop*)pRscTop->Left() ); + + DestroyNode( pRscTop, pRscTop->GetObjNode() ); + + DestroySubTrees( (RscTop*)pRscTop->Right() ); + }; +} + +void DestroyTree( RscTop * pRscTop ){ + if( pRscTop ){ + DestroyTree( (RscTop*)pRscTop->Left() ); + DestroyTree( (RscTop*)pRscTop->Right() ); + + delete pRscTop; + }; +} + +void Pre_dtorTree( RscTop * pRscTop ){ + if( pRscTop ){ + Pre_dtorTree( (RscTop*)pRscTop->Left() ); + Pre_dtorTree( (RscTop*)pRscTop->Right() ); + + pRscTop->Pre_dtor(); + }; +} + +RscTypCont :: ~RscTypCont(){ + RscTop * pRscTmp; + RscSysEntry * pSysEntry; + + // Alle Unterbaeume loeschen + aVersion.pClass->Destroy( aVersion ); + RscMem::Free( aVersion.pData ); + DestroySubTrees( pRoot ); + + // Alle Klassen noch gueltig, jeweilige Instanzen freigeben + // BasisTypen + pRscTmp = aBaseLst.First(); + while( pRscTmp ){ + pRscTmp->Pre_dtor(); + pRscTmp = aBaseLst.Next(); + }; + aBool.Pre_dtor(); + aShort.Pre_dtor(); + aUShort.Pre_dtor(); + aIdUShort.Pre_dtor(); + aIdNoZeroUShort.Pre_dtor(); + aNoZeroShort.Pre_dtor(); + aIdLong.Pre_dtor(); + aString.Pre_dtor(); + aWinBits.Pre_dtor(); + aVersion.pClass->Pre_dtor(); + // Zusammengesetzte Typen + Pre_dtorTree( pRoot ); + + // Klassen zerstoeren + delete aVersion.pClass; + DestroyTree( pRoot ); + + while( NULL != (pRscTmp = aBaseLst.Remove()) ){ + delete pRscTmp; + }; + + while( NULL != (pSysEntry = aSysLst.Remove()) ){ + delete pSysEntry; + }; +} + +//======================================================================= +RscTop * RscTypCont::SearchType( HASHID nId ) +/* [Beschreibung] + + Sucht eine Basistyp nId; +*/ +{ + if( nId == HASH_NONAME ) + return NULL; + +#define ELSE_IF( a ) \ + else if( a##.GetId() == nId ) \ + return &a; \ + + if( aBool.GetId() == nId ) + return &aBool; + ELSE_IF( aShort ) + ELSE_IF( aUShort ) + ELSE_IF( aLong ) + ELSE_IF( aEnumLong ) + ELSE_IF( aIdUShort ) + ELSE_IF( aIdNoZeroUShort ) + ELSE_IF( aNoZeroShort ) + ELSE_IF( a1to12Short ) + ELSE_IF( a0to23Short ) + ELSE_IF( a1to31Short ) + ELSE_IF( a0to59Short ) + ELSE_IF( a0to99Short ) + ELSE_IF( a0to9999Short ) + ELSE_IF( aIdLong ) + ELSE_IF( aString ) + ELSE_IF( aWinBits ) + ELSE_IF( aLangType ) + ELSE_IF( aLangString ) + ELSE_IF( aLangShort ) + + RscTop * pEle = aBaseLst.First(); + while( pEle ) + { + if( pEle->GetId() == nId ) + return pEle; + pEle = aBaseLst.Next(); + } + return NULL; +} + +/************************************************************************* +|* +|* RscTypCont :: Search +|* +|* Beschreibung RES.DOC +|* Ersterstellung MM 22.03.90 +|* Letzte Aenderung MM 27.06.90 +|* +*************************************************************************/ +RscTop * RscTypCont :: Search( HASHID nRT ){ + return( (RscTop *)pRoot->Search( nRT ) ); +} + +CLASS_DATA RscTypCont :: Search( HASHID nRT, const RscId & rId ){ + ObjNode *pObjNode; + RscTop *pRscTop; + + if( NULL != (pRscTop = Search( nRT )) ){ + if( NULL != (pObjNode = pRscTop->GetObjNode( rId )) ){ + return( pObjNode->GetRscObj() ); + } + } + return( (CLASS_DATA)0 ); +} + +/************************************************************************* +|* +|* RscTypCont :: Delete() +|* +|* Beschreibung +|* Ersterstellung MM 10.07.91 +|* Letzte Aenderung MM 10.07.91 +|* +*************************************************************************/ +void RscTypCont :: Delete( HASHID nRT, const RscId & rId ){ + ObjNode * pObjNode; + RscTop * pRscTop; + + if( NULL != (pRscTop = Search( nRT )) ){ + if( NULL != (pObjNode = pRscTop->GetObjNode()) ){ + pObjNode = pObjNode->Search( rId ); + + if( pObjNode ){ + //Objekt aus Baum entfernen + pRscTop->pObjBiTree = + (ObjNode *)pRscTop->pObjBiTree->Remove( pObjNode ); + + if( pObjNode->GetRscObj() ){ + pRscTop->Destroy( RSCINST( pRscTop, + pObjNode->GetRscObj() ) ); + RscMem::Free( pObjNode->GetRscObj() ); + } + delete pObjNode; + } + } + } +} + +/************************************************************************* +|* +|* RscTypCont :: PutSysName() +|* +|* Beschreibung RES.DOC +|* Ersterstellung MM 22.03.90 +|* Letzte Aenderung MM 27.06.90 +|* +*************************************************************************/ +USHORT RscTypCont :: PutSysName( USHORT nRscTyp, char * pFileName, + USHORT nConst, USHORT nId, BOOL bFirst ) +{ + RscSysEntry * pSysEntry; + BOOL bId1 = FALSE; + + pSysEntry = aSysLst.First(); + while( pSysEntry ) + { + if( pSysEntry->nKey == 1 ) + bId1 = TRUE; + if( !strcmp( pSysEntry->aFileName.GetBuffer(), pFileName ) ) + if( pSysEntry->nRscTyp == nRscTyp + && pSysEntry->nTyp == nConst + && pSysEntry->nRefId == nId ) + break; + pSysEntry = aSysLst.Next(); + } + + if ( !pSysEntry || (bFirst && !bId1) ) + { + pSysEntry = new RscSysEntry; + pSysEntry->nKey = nUniqueId++; + pSysEntry->nRscTyp = nRscTyp; + pSysEntry->nTyp = nConst; + pSysEntry->nRefId = nId; + pSysEntry->aFileName = (const char*)pFileName; + if( bFirst && !bId1 ) + { + pSysEntry->nKey = 1; + aSysLst.Insert( pSysEntry, (ULONG)0 ); + } + else + aSysLst.Insert( pSysEntry, LIST_APPEND ); + } + + return pSysEntry->nKey; +} + +/************************************************************************* +|* +|* RscTypCont :: WriteInc +|* +|* Beschreibung RES.DOC +|* Ersterstellung MM 21.06.90 +|* Letzte Aenderung MM 21.06.90 +|* +*************************************************************************/ +void RscTypCont :: WriteInc( FILE * fOutput, ULONG lFileKey ) +{ + RscFile * pFName; + + if( NOFILE_INDEX == lFileKey ) + { + pFName = aFileTab.First(); + while( pFName ) + { + if( pFName && pFName->IsIncFile() ) + { + fprintf( fOutput, "#include " ); + fprintf( fOutput, "\"%s\"\n", + pFName->aFileName.GetBuffer() ); + } + pFName = aFileTab.Next(); + } + } + else + { + RscDepend * pDep; + RscFile * pFile; + + pFName = aFileTab.Get( lFileKey ); + if( pFName ) + { + pDep = pFName->First(); + while( pDep ) + { + if( pDep->GetFileKey() != lFileKey ) + { + pFile = aFileTab.GetFile( pDep->GetFileKey() ); + if( pFile ) + { + fprintf( fOutput, "#include " ); + fprintf( fOutput, "\"%s\"\n", + pFile->aFileName.GetBuffer() ); + } + } + pDep = pFName->Next(); + }; + }; + }; +} + +/************************************************************************* +|* +|* RscTypCont :: Methoden die ueber all Knoten laufen +|* +|* Beschreibung RES.DOC +|* Ersterstellung MM 22.03.90 +|* Letzte Aenderung MM 09.12.91 +|* +*************************************************************************/ + +class RscEnumerateObj +{ +friend class RscEnumerateRef; +private: + ERRTYPE aError; // Enthaelt den ersten Fehler + RscTypCont* pTypCont; + FILE * fOutput; // AusgabeDatei + ULONG lFileKey; // Welche src-Datei + RscTop * pClass; + + DECL_LINK( CallBackWriteRc, ObjNode * ); + DECL_LINK( CallBackWriteSrc, ObjNode * ); + DECL_LINK( CallBackWriteCxx, ObjNode * ); + DECL_LINK( CallBackWriteHxx, ObjNode * ); + + ERRTYPE WriteRc( RscTop * pCl, ObjNode * pRoot ) + { + pClass = pCl; + if( pRoot ) + pRoot->EnumNodes( LINK( this, RscEnumerateObj, CallBackWriteRc ) ); + return aError; + } + ERRTYPE WriteSrc( RscTop * pCl, ObjNode * pRoot ){ + pClass = pCl; + if( pRoot ) + pRoot->EnumNodes( LINK( this, RscEnumerateObj, CallBackWriteSrc ) ); + return aError; + } + ERRTYPE WriteCxx( RscTop * pCl, ObjNode * pRoot ){ + pClass = pCl; + if( pRoot ) + pRoot->EnumNodes( LINK( this, RscEnumerateObj, CallBackWriteCxx ) ); + return aError; + } + ERRTYPE WriteHxx( RscTop * pCl, ObjNode * pRoot ){ + pClass = pCl; + if( pRoot ) + pRoot->EnumNodes( LINK( this, RscEnumerateObj, CallBackWriteHxx ) ); + return aError; + } +public: + void WriteRcFile( RscWriteRc & rMem, FILE * fOutput ); +}; + +/************************************************************************* +|* +|* RscEnumerateObj :: CallBackWriteRc +|* +|* Beschreibung +|* Ersterstellung MM 09.12.91 +|* Letzte Aenderung MM 09.12.91 +|* +*************************************************************************/ +IMPL_LINK( RscEnumerateObj, CallBackWriteRc, ObjNode *, pObjNode ) +{ + RscWriteRc aMem( pTypCont->GetByteOrder() ); + + aError = pClass->WriteRcHeader( RSCINST( pClass, pObjNode->GetRscObj() ), + aMem, pTypCont, + pObjNode->GetRscId(), 0, TRUE ); + if( aError.IsError() || aError.IsWarning() ) + pTypCont->pEH->Error( aError, pClass, pObjNode->GetRscId() ); + + WriteRcFile( aMem, fOutput ); + return 0; +} + +/************************************************************************* +|* +|* RscEnumerateObj :: CallBackWriteSrc +|* +|* Beschreibung +|* Ersterstellung MM 09.12.91 +|* Letzte Aenderung MM 09.12.91 +|* +*************************************************************************/ +IMPL_LINK_INLINE_START( RscEnumerateObj, CallBackWriteSrc, ObjNode *, pObjNode ) +{ + if( pObjNode->GetFileKey() == lFileKey ){ + pClass->WriteSrcHeader( RSCINST( pClass, pObjNode->GetRscObj() ), + fOutput, pTypCont, 0, + pObjNode->GetRscId(), "" ); + fprintf( fOutput, ";\n" ); + } + return 0; +} +IMPL_LINK_INLINE_END( RscEnumerateObj, CallBackWriteSrc, ObjNode *, pObjNode ) + +/************************************************************************* +|* +|* RscEnumerateObj :: CallBackWriteCxx +|* +|* Beschreibung +|* Ersterstellung MM 09.12.91 +|* Letzte Aenderung MM 09.12.91 +|* +*************************************************************************/ +IMPL_LINK_INLINE_START( RscEnumerateObj, CallBackWriteCxx, ObjNode *, pObjNode ) +{ + if( pClass->IsCodeWriteable() && pObjNode->GetFileKey() == lFileKey ) + aError = pClass->WriteCxxHeader( + RSCINST( pClass, pObjNode->GetRscObj() ), + fOutput, pTypCont, pObjNode->GetRscId() ); + return 0; +} +IMPL_LINK_INLINE_END( RscEnumerateObj, CallBackWriteCxx, ObjNode *, pObjNode ) + +/************************************************************************* +|* +|* RscEnumerateObj :: CallBackWriteHxx +|* +|* Beschreibung +|* Ersterstellung MM 09.12.91 +|* Letzte Aenderung MM 09.12.91 +|* +*************************************************************************/ +IMPL_LINK_INLINE_START( RscEnumerateObj, CallBackWriteHxx, ObjNode *, pObjNode ) +{ + if( pClass->IsCodeWriteable() && pObjNode->GetFileKey() == lFileKey ) + aError = pClass->WriteHxxHeader( + RSCINST( pClass, pObjNode->GetRscObj() ), + fOutput, pTypCont, pObjNode->GetRscId() ); + return 0; +} +IMPL_LINK_INLINE_END( RscEnumerateObj, CallBackWriteHxx, ObjNode *, pObjNode ) + +/************************************************************************* +|* +|* RscEnumerateObj :: WriteRcFile +|* +|* Beschreibung +|* Ersterstellung MM 09.12.91 +|* Letzte Aenderung MM 09.12.91 +|* +*************************************************************************/ +ULONG WritePMRes( FILE * fOutput, USHORT nType, USHORT nId, UINT32 nLen ) +{ + fputc( (char)0xFF, fOutput ); + fwrite( (const char *)&nType, sizeof( nType ), 1, fOutput ); + fputc( (char)0xFF, fOutput ); + fwrite( (const char *)&nId, sizeof( nId ), 1, fOutput ); + USHORT fsOption = 0x0030; // Aus Resourcefile ermittelt + fwrite( (const char *)&fsOption, sizeof( fsOption ), 1, fOutput ); + // !!! Achtung: Groesse der Resource NICHT dazuaddieren + // !!! nLen += 12; // groesse des Headers + ULONG nFilePos = ftell( fOutput ); + fwrite( (const char *)&nLen, sizeof( nLen ), 1, fOutput ); + return nFilePos; +} + +void RscEnumerateObj :: WriteRcFile( RscWriteRc & rMem, FILE * fOut ){ + // Definition der Struktur, aus denen die Resource aufgebaut ist + /* + struct RSHEADER_TYPE{ + USHORT nId; // Identifier der Resource + USHORT nRT; // Resource Typ + USHORT nGlobOff; // Globaler Offset + USHORT nLocalOff; // Lokaler Offset + } aHeader; + */ + + USHORT nId = rMem.GetShort( 0 ); + USHORT nRT = rMem.GetShort( 2 ); + + // Tabelle wird entsprechend gefuellt + pTypCont->PutTranslatorKey( ((INT32)nRT << 16) + nId ); + + if( nRT == RSC_VERSIONCONTROL ) + { // kommt immmer als letztes + INT32 nCount = pTypCont->aIdTranslator.Count(); + // groesse der Tabelle + UINT32 nSize = (nCount * 2 + 1) * sizeof( INT32 ); + + rMem.Put( nCount ); //Anzahl speichern + INT32 l = (INT32)pTypCont->aIdTranslator.First(); + while( nCount ) + { + // Schluessel schreiben + l = pTypCont->aIdTranslator.GetCurKey(); + rMem.Put( l ); + // Objekt Id oder Position schreiben + l = (INT32)pTypCont->aIdTranslator.GetCurObject(); + rMem.Put( l ); + l = (INT32)pTypCont->aIdTranslator.Next(); + nCount--; + } + rMem.Put( nSize ); // Groesse hinten Speichern + } + + //Dateioffset neu setzen + pTypCont->IncFilePos( rMem.Size() ); + + + //Position wurde vorher in Tabelle geschrieben + fwrite( rMem.GetBuffer(), rMem.Size(), 1, fOut ); + +}; + +class RscEnumerateRef +{ +private: + RscTop * pRoot; + + DECL_LINK( CallBackWriteRc, RscTop * ); + DECL_LINK( CallBackWriteSrc, RscTop * ); + DECL_LINK( CallBackWriteCxx, RscTop * ); + DECL_LINK( CallBackWriteHxx, RscTop * ); + DECL_LINK( CallBackWriteSyntax, RscTop * ); + DECL_LINK( CallBackWriteRcCtor, RscTop * ); +public: + RscEnumerateObj aEnumObj; + + RscEnumerateRef( RscTypCont * pTC, RscTop * pR, + FILE * fOutput ) + { + aEnumObj.pTypCont = pTC; + aEnumObj.fOutput = fOutput; + pRoot = pR; + } + ERRTYPE WriteRc() + { + aEnumObj.aError.Clear(); + pRoot->EnumNodes( LINK( this, RscEnumerateRef, CallBackWriteRc ) ); + return aEnumObj.aError; + }; + + ERRTYPE WriteSrc( ULONG lFileKey ) + { + aEnumObj.lFileKey = lFileKey; + + aEnumObj.aError.Clear(); + pRoot->EnumNodes( LINK( this, RscEnumerateRef, CallBackWriteSrc ) ); + return aEnumObj.aError; + } + + ERRTYPE WriteCxx( ULONG lFileKey ) + { + aEnumObj.lFileKey = lFileKey; + + aEnumObj.aError.Clear(); + pRoot->EnumNodes( LINK( this, RscEnumerateRef, CallBackWriteCxx ) ); + return aEnumObj.aError; + } + + ERRTYPE WriteHxx( ULONG lFileKey ) + { + aEnumObj.lFileKey = lFileKey; + + aEnumObj.aError.Clear(); + pRoot->EnumNodes( LINK( this, RscEnumerateRef, CallBackWriteHxx ) ); + return aEnumObj.aError; + } + + void WriteSyntax() + { + pRoot->EnumNodes( LINK( this, RscEnumerateRef, + CallBackWriteSyntax ) ); + } + + void WriteRcCtor() + { + pRoot->EnumNodes( LINK( this, RscEnumerateRef, + CallBackWriteRcCtor ) ); + } +}; + +/************************************************************************* +|* +|* RscRscEnumerateRef :: CallBack... +|* +|* Beschreibung +|* Ersterstellung MM 09.12.91 +|* Letzte Aenderung MM 09.12.91 +|* +*************************************************************************/ +IMPL_LINK_INLINE_START( RscEnumerateRef, CallBackWriteRc, RscTop *, pRef ) +{ + aEnumObj.WriteRc( pRef, pRef->GetObjNode() ); + return 0; +} +IMPL_LINK_INLINE_END( RscEnumerateRef, CallBackWriteRc, RscTop *, pRef ) +IMPL_LINK_INLINE_START( RscEnumerateRef, CallBackWriteSrc, RscTop *, pRef ) +{ + aEnumObj.WriteSrc( pRef, pRef->GetObjNode() ); + return 0; +} +IMPL_LINK_INLINE_END( RscEnumerateRef, CallBackWriteSrc, RscTop *, pRef ) +IMPL_LINK_INLINE_START( RscEnumerateRef, CallBackWriteCxx, RscTop *, pRef ) +{ + if( pRef->IsCodeWriteable() ) + aEnumObj.WriteCxx( pRef, pRef->GetObjNode() ); + return 0; +} +IMPL_LINK_INLINE_END( RscEnumerateRef, CallBackWriteCxx, RscTop *, pRef ) +IMPL_LINK_INLINE_START( RscEnumerateRef, CallBackWriteHxx, RscTop *, pRef ) +{ + if( pRef->IsCodeWriteable() ) + aEnumObj.WriteHxx( pRef, pRef->GetObjNode() ); + return 0; +} +IMPL_LINK_INLINE_END( RscEnumerateRef, CallBackWriteHxx, RscTop *, pRef ) +IMPL_LINK_INLINE_START( RscEnumerateRef, CallBackWriteSyntax, RscTop *, pRef ) +{ + pRef->WriteSyntaxHeader( aEnumObj.fOutput, aEnumObj.pTypCont ); + return 0; +} +IMPL_LINK_INLINE_END( RscEnumerateRef, CallBackWriteSyntax, RscTop *, pRef ) +IMPL_LINK_INLINE_START( RscEnumerateRef, CallBackWriteRcCtor, RscTop *, pRef ) +{ + pRef->WriteRcCtor( aEnumObj.fOutput, aEnumObj.pTypCont ); + return 0; +} +IMPL_LINK_INLINE_END( RscEnumerateRef, CallBackWriteRcCtor, RscTop *, pRef ) + +/************************************************************************* +|* +|* RscTypCont :: WriteRc +|* +|* Beschreibung RES.DOC +|* Ersterstellung MM 22.03.90 +|* Letzte Aenderung MM 22.07.91 +|* +*************************************************************************/ +ERRTYPE RscTypCont::WriteRc( FILE * fOutput ) +{ + RscSysEntry * pSysEntry; + ERRTYPE aError; + RscEnumerateRef aEnumRef( this, pRoot, fOutput ); + + aIdTranslator.Clear(); + nFilePos = 0; + nPMId = RSCVERSION_ID +1; //mindestens einen groesser + + aError = aEnumRef.WriteRc(); + + if( aError.IsOk() ) + { + // Systemabhaengige Resourcen schreiben + pSysEntry = aSysLst.First(); + while( pSysEntry && aError.IsOk() ) + { + UniString aUniFileName( pSysEntry->aFileName, RTL_TEXTENCODING_ASCII_US ); + DirEntry aFullName( aUniFileName ); + aFullName.Find( UniString( GetSearchPath(), RTL_TEXTENCODING_ASCII_US ) ); + pSysEntry->aFileName = ByteString( aFullName.GetFull(), RTL_TEXTENCODING_ASCII_US ); + if( !::Append( fOutput, pSysEntry->aFileName.GetBuffer() ) ) + { + pEH->FatalError( ERR_OPENFILE, RscId(), pSysEntry->aFileName.GetBuffer() ); + break; + } + UniString aUniFileName2( pSysEntry->aFileName, RTL_TEXTENCODING_ASCII_US ); + FileStat aFS( aUniFileName2 ); + if( !aFS.IsKind( FSYS_KIND_FILE ) ) + { + pEH->FatalError( ERR_OPENFILE, RscId(), pSysEntry->aFileName.GetBuffer() ); + break; + } + + // Tabelle wird entsprechend gefuellt + PutTranslatorKey( ((ULONG)RT_SYS_BITMAP << 16) + pSysEntry->nKey ); + UINT32 nSize = aFS.GetSize(); + IncFilePos( nSize ); + + // wegen Alignment + nSize = sizeof( int ) - nSize % sizeof( int ); + nSize %= sizeof( int ); + IncFilePos( nSize ); + while( nSize-- ) + fputc( 0, fOutput ); + + pSysEntry = aSysLst.Next(); + } + + // Versionskontrolle schreiben + RscWriteRc aMem( nByteOrder ); + aVersion.pClass->WriteRcHeader( aVersion, aMem, this, + RscId( RSCVERSION_ID ), 0, TRUE ); + aEnumRef.aEnumObj.WriteRcFile( aMem, fOutput ); + } + + return( aError ); +} + +/************************************************************************* +|* +|* RscTypCont :: WriteSrc +|* +|* Beschreibung RES.DOC +|* Ersterstellung MM 22.03.90 +|* Letzte Aenderung MM 27.06.90 +|* +*************************************************************************/ +void RscTypCont :: WriteSrc( FILE * fOutput, ULONG nFileKey, + CharSet nCharSet, BOOL bName ) +{ + RscFile * pFName; + RscEnumerateRef aEnumRef( this, pRoot, fOutput ); + + if( bName ) + { + WriteInc( fOutput, nFileKey ); + + if( NOFILE_INDEX == nFileKey ) + { + pFName = aFileTab.First(); + while( pFName ){ + if( !pFName->IsIncFile() ) + pFName->aDefLst.WriteAll( fOutput ); + aEnumRef.WriteSrc( aFileTab.GetIndex( pFName ) ); + pFName = aFileTab.Next(); + }; + } + else + { + pFName = aFileTab.Get( nFileKey ); + if( pFName ){ + pFName->aDefLst.WriteAll( fOutput ); + aEnumRef.WriteSrc( nFileKey ); + } + } + } + else + { + RscId::SetNames( FALSE ); + if( NOFILE_INDEX == nFileKey ) + { + pFName = aFileTab.First(); + while( pFName ) + { + aEnumRef.WriteSrc( aFileTab.GetIndex( pFName ) ); + pFName = aFileTab.Next(); + }; + } + else + aEnumRef.WriteSrc( nFileKey ); + RscId::SetNames(); + }; +} + +/************************************************************************* +|* +|* RscTypCont :: WriteHxx +|* +|* Beschreibung +|* Ersterstellung MM 30.05.91 +|* Letzte Aenderung MM 30.05.91 +|* +*************************************************************************/ +ERRTYPE RscTypCont :: WriteHxx( FILE * fOutput, ULONG nFileKey ) +{ + fprintf( fOutput, "#include <tools/rc.hxx>\n" ); + fprintf( fOutput, "#include <tools/resid.hxx>\n" ); + fprintf( fOutput, "#include <vcl/accel.hxx>\n" ); + fprintf( fOutput, "#include <vcl/bitmap.hxx>\n" ); + fprintf( fOutput, "#include <vcl/button.hxx>\n" ); + fprintf( fOutput, "#include <vcl/color.hxx>\n" ); + fprintf( fOutput, "#include <vcl/combobox.hxx>\n" ); + fprintf( fOutput, "#include <vcl/ctrl.hxx>\n" ); + fprintf( fOutput, "#include <vcl/dialog.hxx>\n" ); + fprintf( fOutput, "#include <vcl/edit.hxx>\n" ); + fprintf( fOutput, "#include <vcl/field.hxx>\n" ); + fprintf( fOutput, "#include <vcl/fixed.hxx>\n" ); + fprintf( fOutput, "#include <vcl/group.hxx>\n" ); + fprintf( fOutput, "#include <vcl/image.hxx>\n" ); + fprintf( fOutput, "#include <vcl/imagebtn.hxx>\n" ); + fprintf( fOutput, "#include <vcl/keycod.hxx>\n" ); + fprintf( fOutput, "#include <vcl/lstbox.hxx>\n" ); + fprintf( fOutput, "#include <vcl/mapmod.hxx>\n" ); + fprintf( fOutput, "#include <vcl/menu.hxx>\n" ); + fprintf( fOutput, "#include <vcl/menubtn.hxx>\n" ); + fprintf( fOutput, "#include <vcl/morebtn.hxx>\n" ); + fprintf( fOutput, "#include <vcl/msgbox.hxx>\n" ); + fprintf( fOutput, "#include <vcl/scrbar.hxx>\n" ); + fprintf( fOutput, "#include <vcl/spin.hxx>\n" ); + fprintf( fOutput, "#include <vcl/spinfld.hxx>\n" ); + fprintf( fOutput, "#include <vcl/splitwin.hxx>\n" ); + fprintf( fOutput, "#include <vcl/status.hxx>\n" ); + fprintf( fOutput, "#include <vcl/tabctrl.hxx>\n" ); + fprintf( fOutput, "#include <vcl/tabdlg.hxx>\n" ); + fprintf( fOutput, "#include <vcl/tabpage.hxx>\n" ); + fprintf( fOutput, "#include <vcl/toolbox.hxx>\n" ); + fprintf( fOutput, "#include <vcl/window.hxx>\n" ); + fprintf( fOutput, "#include <vcl/wrkwin.hxx>\n" ); + fprintf( fOutput, "#include <svtools/svmedit.hxx>\n" ); + + RscEnumerateRef aEnumRef( this, pRoot, fOutput ); + ERRTYPE aError; + + if( NOFILE_INDEX == nFileKey ) + { + RscFile * pFName; + + pFName = aFileTab.First(); + while( pFName ) + { + aError = aEnumRef.WriteHxx( aFileTab.GetIndex( pFName ) ); + pFName = aFileTab.Next(); + }; + } + else + aError = aEnumRef.WriteHxx( nFileKey ); + + return aError; +} + +/************************************************************************* +|* +|* RscTypCont :: WriteCxx +|* +|* Beschreibung +|* Ersterstellung MM 30.05.91 +|* Letzte Aenderung MM 30.05.91 +|* +*************************************************************************/ +ERRTYPE RscTypCont::WriteCxx( FILE * fOutput, ULONG nFileKey, + const ByteString & rHxxName ) +{ + RscEnumerateRef aEnumRef( this, pRoot, fOutput ); + ERRTYPE aError; + fprintf( fOutput, "#include <string.h>\n" ); + WriteInc( fOutput, nFileKey ); + if( rHxxName.Len() ) + fprintf( fOutput, "#include \"%s\"\n", rHxxName.GetBuffer() ); + fprintf( fOutput, "\n\n" ); + + if( NOFILE_INDEX == nFileKey ) + { + RscFile * pFName; + + pFName = aFileTab.First(); + while( pFName ) + { + aError = aEnumRef.WriteCxx( aFileTab.GetIndex( pFName ) ); + pFName = aFileTab.Next(); + }; + } + else + aError = aEnumRef.WriteCxx( nFileKey ); + + return aError; +} + +/************************************************************************* +|* +|* RscTypCont :: WriteSyntax +|* +|* Beschreibung +|* Ersterstellung MM 30.05.91 +|* Letzte Aenderung MM 30.05.91 +|* +*************************************************************************/ +void RscTypCont::WriteSyntax( FILE * fOutput ) +{ + for( USHORT i = 0; i < aBaseLst.Count(); i++ ) + aBaseLst.GetObject( i )->WriteSyntaxHeader( fOutput, this ); + RscEnumerateRef aEnumRef( this, pRoot, fOutput ); + aEnumRef.WriteSyntax(); +} + +//======================================================================= +void RscTypCont::WriteRcCtor +( + FILE * fOutput +) +{ + RscEnumerateRef aEnumRef( this, pRoot, fOutput ); + aEnumRef.WriteRcCtor(); +} + +/************************************************************************* +|* +|* RscTypCont :: Delete() +|* +|* Beschreibung +|* Ersterstellung MM 09.12.91 +|* Letzte Aenderung MM 09.12.91 +|* +*************************************************************************/ +class RscDel +{ + ULONG lFileKey; + DECL_LINK( Delete, RscTop * ); +public: + RscDel( RscTop * pRoot, ULONG lKey ); +}; + + +inline RscDel::RscDel( RscTop * pRoot, ULONG lKey ) +{ + lFileKey = lKey; + pRoot->EnumNodes( LINK( this, RscDel, Delete ) ); +} + +IMPL_LINK_INLINE_START( RscDel, Delete, RscTop *, pNode ) +{ + if( pNode->GetObjNode() ) + pNode->pObjBiTree = pNode->GetObjNode()->DelObjNode( pNode, lFileKey ); + return 0; +} +IMPL_LINK_INLINE_END( RscDel, Delete, RscTop *, pNode ) + +void RscTypCont :: Delete( ULONG lFileKey ){ + // Resourceinstanzen loeschen + RscDel aDel( pRoot, lFileKey ); + // Defines loeschen + aFileTab.DeleteFileContext( lFileKey ); +} + +/************************************************************************* +|* +|* RscTypCont :: MakeConsistent() +|* +|* Beschreibung +|* Ersterstellung MM 23.09.91 +|* Letzte Aenderung MM 23.09.91 +|* +*************************************************************************/ +BOOL IsInstConsistent( ObjNode * pObjNode, RscTop * pRscTop, + RscInconsList * pList ) +{ + BOOL bRet = TRUE; + + if( pObjNode ){ + RSCINST aTmpI; + + if( ! IsInstConsistent( (ObjNode*)pObjNode->Left(), pRscTop, pList ) ) + bRet = FALSE; + + aTmpI.pClass = pRscTop; + aTmpI.pData = pObjNode->GetRscObj(); + if( ! aTmpI.pClass->IsConsistent( aTmpI, pList ) ) + bRet = FALSE; + + if( ! IsInstConsistent( (ObjNode*)pObjNode->Right(), pRscTop, pList ) ) + bRet = FALSE; + }; + + return( bRet ); +} + +BOOL MakeConsistent( RscTop * pRscTop, RscInconsList * pList ) +{ + BOOL bRet = TRUE; + + if( pRscTop ){ + if( ! ::MakeConsistent( (RscTop*)pRscTop->Left(), pList ) ) + bRet = FALSE; + + if( pRscTop->GetObjNode() ){ + if( ! pRscTop->GetObjNode()->IsConsistent() ){ + pRscTop->GetObjNode()->OrderTree(); + if( ! pRscTop->GetObjNode()->IsConsistent( pList ) ) + bRet = FALSE; + } + if( ! IsInstConsistent( pRscTop->GetObjNode(), pRscTop, pList ) ) + bRet = FALSE; + } + + if( ! ::MakeConsistent( (RscTop*)pRscTop->Right(), pList ) ) + bRet = FALSE; + }; + + return bRet; +} + +BOOL RscTypCont :: MakeConsistent( RscInconsList * pList ){ + return( ::MakeConsistent( pRoot, pList ) ); +} + +USHORT RscTypCont::PutTranslatorKey( ULONG nKey ) +{ + aIdTranslator.Insert( nKey, (void*)nFilePos ); + return nPMId++; +} + diff --git a/rsc/source/parser/rscibas.cxx b/rsc/source/parser/rscibas.cxx new file mode 100644 index 000000000000..0032cb78fb66 --- /dev/null +++ b/rsc/source/parser/rscibas.cxx @@ -0,0 +1,736 @@ +/************************************************************************* + * + * $RCSfile: rscibas.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version |