diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2000-09-18 16:07:07 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2000-09-18 16:07:07 +0000 |
commit | 8ab086b6cc054501bfbf7ef6fa509c393691e860 (patch) | |
tree | 324d51845d7f1a2f4e02a14db22fb5947137c822 /rsc | |
parent | 411e68cc54ae97eebd79ae3a9cb2971b74cb2a9e (diff) |
initial import
Diffstat (limited to 'rsc')
63 files changed, 26489 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 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): _______________________________________ + * + * + ************************************************************************/ + +/****************** I N C L U D E S **************************************/ +#pragma hdrstop + +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> + +#include <tools/intn.hxx> +#include <tools/rc.h> +#include <tools/color.hxx> +#include <tools/vclrsc.hxx> + +#ifndef _RSCCONST_HXX +#include <rscconst.hxx> +#endif +#ifndef _RSCARRAY_HXX +#include <rscarray.hxx> +#endif +#ifndef _RSCCLASS_HXX +#include <rscclass.hxx> +#endif +#ifndef _RSCCONT_HXX +#include <rsccont.hxx> +#endif +#ifndef _RSCDB_HXX +#include <rscdb.hxx> +#endif + + +#include "rsclex.hxx" +#include <rscyacc.yxx.h> + +/****************** M A C R O S ******************************************/ +void RscTypCont::SETCONST( RscConst * pClass, char * szString, UINT32 nVal ) +{ + pClass->SetConstant( aNmTb.Put( szString, + (USHORT)CONSTNAME, nVal ), nVal ); +} + +void RscTypCont::SETCONST( RscConst * pClass, HASHID nName, UINT32 nVal ) +{ + pClass->SetConstant( aNmTb.Put( nName, + (USHORT)CONSTNAME, nVal ), nVal ); +} + +/****************** C O D E **********************************************/ +/************************************************************************* +|* RscTypCont::InitLangType() +|* +|* Beschreibung +*************************************************************************/ +#define LT(Name) \ + SETCONST( &aLangType, #Name, LANGUAGE_##Name ) + +RscEnum * RscTypCont::InitLangType() +{ + LT( SYSTEM ); + LT( DONTKNOW ); +#include <rsclang.c> + SETCONST( &aLangType, "LANGUAGE_USER1", LANGUAGE_USER1 ); + SETCONST( &aLangType, "LANGUAGE_USER2", LANGUAGE_USER2 ); + SETCONST( &aLangType, "LANGUAGE_USER3", LANGUAGE_USER3 ); + SETCONST( &aLangType, "LANGUAGE_USER4", LANGUAGE_USER4 ); + SETCONST( &aLangType, "LANGUAGE_USER5", LANGUAGE_USER5 ); + SETCONST( &aLangType, "LANGUAGE_USER6", LANGUAGE_USER6 ); + SETCONST( &aLangType, "LANGUAGE_USER7", LANGUAGE_USER7 ); + SETCONST( &aLangType, "LANGUAGE_USER8", LANGUAGE_USER8 ); + SETCONST( &aLangType, "LANGUAGE_USER9", LANGUAGE_USER9 ); + + return( &aLangType ); +} + +/************************************************************************* +|* +|* RscTypCont::InitDateFormatType() +|* +|* Beschreibung +|* Ersterstellung MM 22.03.91 +|* Letzte Aenderung MM 27.06.91 +|* +*************************************************************************/ +RscEnum * RscTypCont::InitDateFormatType() +{ + RscEnum * pDate; + pDate = new RscEnum( pHS->Insert( "EnumDateFormat" ), RSC_NOTYPE ); + + SETCONST( pDate, "MDY", MDY ); + SETCONST( pDate, "DMY", DMY ); + SETCONST( pDate, "YMD", YMD ); + + return pDate; +} + +/************************************************************************* +|* +|* RscTypCont::InitTimeType() +|* +|* Beschreibung +|* Ersterstellung MM 22.03.91 +|* Letzte Aenderung MM 27.06.91 +|* +*************************************************************************/ +RscEnum * RscTypCont::InitTimeFormatType() +{ + RscEnum * pTime; + pTime = new RscEnum( pHS->Insert( "EnumTimeFormat" ), RSC_NOTYPE ); + + SETCONST( pTime, "HOUR_12", HOUR_12 ); + SETCONST( pTime, "HOUR_24", HOUR_24 ); + + return pTime; +} + +/************************************************************************* +|* +|* RscTypCont::InitWeekDayFormatType() +|* +|* Beschreibung +|* Ersterstellung MM 22.03.91 +|* Letzte Aenderung MM 27.06.91 +|* +*************************************************************************/ +RscEnum * RscTypCont::InitWeekDayFormatType() +{ + RscEnum * pWeekDay; + pWeekDay = new RscEnum( pHS->Insert( "EnumWeekDayFormat" ), RSC_NOTYPE ); + + SETCONST( pWeekDay, "DAYOFWEEK_NONE", DAYOFWEEK_NONE ); + SETCONST( pWeekDay, "DAYOFWEEK_SHORT", DAYOFWEEK_SHORT ); + SETCONST( pWeekDay, "DAYOFWEEK_LONG", DAYOFWEEK_LONG ); + + return pWeekDay; +} + +/************************************************************************* +|* +|* RscTypCont::InitMonthFormatType() +|* +|* Beschreibung +|* Ersterstellung MM 22.03.91 +|* Letzte Aenderung MM 27.06.91 +|* +*************************************************************************/ +RscEnum * RscTypCont::InitMonthFormatType() +{ + RscEnum * pMonth; + pMonth = new RscEnum( pHS->Insert( "EnumMonthFormat" ), RSC_NOTYPE ); + + SETCONST( pMonth, "MONTH_NORMAL", MONTH_NORMAL ); + SETCONST( pMonth, "MONTH_ZERO", MONTH_ZERO ); + SETCONST( pMonth, "MONTH_SHORT", MONTH_SHORT ); + SETCONST( pMonth, "MONTH_LONG", MONTH_LONG ); + + return pMonth; +} + +/************************************************************************* +|* +|* RscTypCont::InitFieldUnitsType() +|* +|* Beschreibung +|* Ersterstellung MM 22.03.91 +|* Letzte Aenderung MM 27.06.91 +|* +*************************************************************************/ +RscEnum * RscTypCont::InitFieldUnitsType() +{ + RscEnum * pFieldUnits; + pFieldUnits = new RscEnum( pHS->Insert( "EnumFieldUnit" ), RSC_NOTYPE ); + + SETCONST( pFieldUnits, "FUNIT_NONE", FUNIT_NONE ); + SETCONST( pFieldUnits, "FUNIT_MM", FUNIT_MM ); + SETCONST( pFieldUnits, "FUNIT_CM", FUNIT_CM ); + SETCONST( pFieldUnits, "FUNIT_M", FUNIT_M ); + SETCONST( pFieldUnits, "FUNIT_KM", FUNIT_KM ); + SETCONST( pFieldUnits, "FUNIT_TWIP", FUNIT_TWIP ); + SETCONST( pFieldUnits, "FUNIT_POINT", FUNIT_POINT ); + SETCONST( pFieldUnits, "FUNIT_PICA", FUNIT_PICA ); + SETCONST( pFieldUnits, "FUNIT_INCH", FUNIT_INCH ); + SETCONST( pFieldUnits, "FUNIT_FOOT", FUNIT_FOOT ); + SETCONST( pFieldUnits, "FUNIT_MILE", FUNIT_MILE ); + SETCONST( pFieldUnits, "FUNIT_CUSTOM", FUNIT_CUSTOM ); + + return pFieldUnits; +} + +/************************************************************************* +|* +|* RscTypCont::InitDayOfWeekType() +|* +|* Beschreibung +|* Ersterstellung MM 22.03.91 +|* Letzte Aenderung MM 27.06.91 +|* +*************************************************************************/ +RscEnum * RscTypCont::InitDayOfWeekType() +{ + RscEnum * pDayOfWeek; + pDayOfWeek = new RscEnum( pHS->Insert( "EnumDayOfWeek" ), RSC_NOTYPE ); + + SETCONST( pDayOfWeek, "MONDAY", MONDAY ); + SETCONST( pDayOfWeek, "TUESDAY", TUESDAY ); + SETCONST( pDayOfWeek, "WEDNESDAY", WEDNESDAY ); + SETCONST( pDayOfWeek, "THURSDAY", THURSDAY ); + SETCONST( pDayOfWeek, "FRIDAY", FRIDAY ); + SETCONST( pDayOfWeek, "SATURDAY", SATURDAY ); + SETCONST( pDayOfWeek, "SUNDAY", SUNDAY ); + + return pDayOfWeek; +} + +/************************************************************************* +|* +|* RscTypCont::InitTimeFieldFormat() +|* +|* Beschreibung +|* Ersterstellung MM 22.03.91 +|* Letzte Aenderung MM 27.06.91 +|* +*************************************************************************/ +RscEnum * RscTypCont::InitTimeFieldFormat() +{ + RscEnum * pTimeFieldFormat; + pTimeFieldFormat = new RscEnum( pHS->Insert( "EnumTimeFieldFormat" ), + RSC_NOTYPE ); + + SETCONST( pTimeFieldFormat, "TIMEF_NONE", TIMEF_NONE ); + SETCONST( pTimeFieldFormat, "TIMEF_SEC", TIMEF_SEC ); + SETCONST( pTimeFieldFormat, "TIMEF_100TH_SEC", TIMEF_100TH_SEC ); + + return pTimeFieldFormat; +} + +/************************************************************************* +|* +|* RscTypCont::InitColor() +|* +|* Beschreibung +|* Ersterstellung MM 24.05.91 +|* Letzte Aenderung MM 24.05.91 +|* +*************************************************************************/ +RscEnum * RscTypCont::InitColor(){ + RscEnum * pColor; + pColor = new RscEnum( pHS->Insert( "EnumColor" ), RSC_NOTYPE ); + + SETCONST( pColor, "COL_BLACK", COL_BLACK ); + SETCONST( pColor, "COL_BLUE", COL_BLUE ); + SETCONST( pColor, "COL_GREEN", COL_GREEN ); + SETCONST( pColor, "COL_CYAN", COL_CYAN ); + SETCONST( pColor, "COL_RED", COL_RED ); + SETCONST( pColor, "COL_MAGENTA", COL_MAGENTA ); + SETCONST( pColor, "COL_BROWN", COL_BROWN ); + SETCONST( pColor, "COL_GRAY", COL_GRAY ); + SETCONST( pColor, "COL_LIGHTGRAY", COL_LIGHTGRAY ); + SETCONST( pColor, "COL_LIGHTBLUE", COL_LIGHTBLUE ); + SETCONST( pColor, "COL_LIGHTGREEN", COL_LIGHTGREEN ); + SETCONST( pColor, "COL_LIGHTCYAN", COL_LIGHTCYAN ); + SETCONST( pColor, "COL_LIGHTRED", COL_LIGHTRED ); + SETCONST( pColor, "COL_LIGHTMAGENTA", COL_LIGHTMAGENTA ); + SETCONST( pColor, "COL_YELLOW", COL_YELLOW ); + SETCONST( pColor, "COL_WHITE", COL_WHITE ); + + return( pColor ); +} + +/************************************************************************* +|* +|* RscTypCont::InitMapUnit() +|* +|* Beschreibung +|* Ersterstellung MM 24.05.91 +|* Letzte Aenderung MM 24.05.91 +|* +*************************************************************************/ +RscEnum * RscTypCont::InitMapUnit(){ + RscEnum * pMapUnit; + pMapUnit = new RscEnum( pHS->Insert( "EnumMapUnit" ), RSC_NOTYPE ); + + SETCONST( pMapUnit, "MAP_PIXEL", MAP_PIXEL ); + SETCONST( pMapUnit, "MAP_SYSFONT", MAP_SYSFONT ); + SETCONST( pMapUnit, "MAP_100TH_MM", MAP_100TH_MM ); + SETCONST( pMapUnit, "MAP_10TH_MM", MAP_10TH_MM ); + SETCONST( pMapUnit, "MAP_MM", MAP_MM ); + SETCONST( pMapUnit, "MAP_CM", MAP_CM ); + SETCONST( pMapUnit, "MAP_1000TH_INCH", MAP_1000TH_INCH ); + SETCONST( pMapUnit, "MAP_100TH_INCH", MAP_100TH_INCH ); + SETCONST( pMapUnit, "MAP_10TH_INCH", MAP_10TH_INCH ); + SETCONST( pMapUnit, "MAP_INCH", MAP_INCH ); + SETCONST( pMapUnit, "MAP_POINT", MAP_POINT ); + SETCONST( pMapUnit, "MAP_TWIP", MAP_TWIP ); + SETCONST( pMapUnit, "MAP_APPFONT", MAP_APPFONT ); + SETCONST( pMapUnit, "MAP_SV", RSC_EXTRAMAPUNIT ); + return( pMapUnit ); +} + +/************************************************************************* +|* +|* RscTypCont::InitKey() +|* +|* Beschreibung +|* Ersterstellung MM 24.05.91 +|* Letzte Aenderung MM 24.05.91 +|* +*************************************************************************/ +RscEnum * RscTypCont::InitKey(){ + RscEnum * pKey; + pKey = new RscEnum( pHS->Insert( "EnumKey" ), RSC_NOTYPE ); + + SETCONST( pKey, "KEY_0", KEY_0 ); + SETCONST( pKey, "KEY_1", KEY_1 ); + SETCONST( pKey, "KEY_2", KEY_2 ); + SETCONST( pKey, "KEY_3", KEY_3 ); + SETCONST( pKey, "KEY_4", KEY_4 ); + SETCONST( pKey, "KEY_5", KEY_5 ); + SETCONST( pKey, "KEY_6", KEY_6 ); + SETCONST( pKey, "KEY_7", KEY_7 ); + SETCONST( pKey, "KEY_8", KEY_8 ); + SETCONST( pKey, "KEY_9", KEY_9 ); + + SETCONST( pKey, "KEY_A", KEY_A ); + SETCONST( pKey, "KEY_B", KEY_B ); + SETCONST( pKey, "KEY_C", KEY_C ); + SETCONST( pKey, "KEY_D", KEY_D ); + SETCONST( pKey, "KEY_E", KEY_E ); + SETCONST( pKey, "KEY_F", KEY_F ); + SETCONST( pKey, "KEY_G", KEY_G ); + SETCONST( pKey, "KEY_H", KEY_H ); + SETCONST( pKey, "KEY_I", KEY_I ); + SETCONST( pKey, "KEY_J", KEY_J ); + SETCONST( pKey, "KEY_K", KEY_K ); + SETCONST( pKey, "KEY_L", KEY_L ); + SETCONST( pKey, "KEY_M", KEY_M ); + SETCONST( pKey, "KEY_N", KEY_N ); + SETCONST( pKey, "KEY_O", KEY_O ); + SETCONST( pKey, "KEY_P", KEY_P ); + SETCONST( pKey, "KEY_Q", KEY_Q ); + SETCONST( pKey, "KEY_R", KEY_R ); + SETCONST( pKey, "KEY_S", KEY_S ); + SETCONST( pKey, "KEY_T", KEY_T ); + SETCONST( pKey, "KEY_U", KEY_U ); + SETCONST( pKey, "KEY_V", KEY_V ); + SETCONST( pKey, "KEY_W", KEY_W ); + SETCONST( pKey, "KEY_X", KEY_X ); + SETCONST( pKey, "KEY_Y", KEY_Y ); + SETCONST( pKey, "KEY_Z", KEY_Z ); + + SETCONST( pKey, "KEY_F1", KEY_F1 ); + SETCONST( pKey, "KEY_F2", KEY_F2 ); + SETCONST( pKey, "KEY_F3", KEY_F3 ); + SETCONST( pKey, "KEY_F4", KEY_F4 ); + SETCONST( pKey, "KEY_F5", KEY_F5 ); + SETCONST( pKey, "KEY_F6", KEY_F6 ); + SETCONST( pKey, "KEY_F7", KEY_F7 ); + SETCONST( pKey, "KEY_F8", KEY_F8 ); + SETCONST( pKey, "KEY_F9", KEY_F9 ); + SETCONST( pKey, "KEY_F10", KEY_F10 ); + SETCONST( pKey, "KEY_F11", KEY_F11 ); + SETCONST( pKey, "KEY_F12", KEY_F12 ); + SETCONST( pKey, "KEY_F13", KEY_F13 ); + SETCONST( pKey, "KEY_F14", KEY_F14 ); + SETCONST( pKey, "KEY_F15", KEY_F15 ); + SETCONST( pKey, "KEY_F16", KEY_F16 ); + SETCONST( pKey, "KEY_F17", KEY_F17 ); + SETCONST( pKey, "KEY_F18", KEY_F18 ); + SETCONST( pKey, "KEY_F19", KEY_F19 ); + SETCONST( pKey, "KEY_F20", KEY_F20 ); + SETCONST( pKey, "KEY_F21", KEY_F21 ); + SETCONST( pKey, "KEY_F22", KEY_F22 ); + SETCONST( pKey, "KEY_F23", KEY_F23 ); + SETCONST( pKey, "KEY_F24", KEY_F24 ); + SETCONST( pKey, "KEY_F25", KEY_F25 ); + SETCONST( pKey, "KEY_F26", KEY_F26 ); + + SETCONST( pKey, "KEY_DOWN", KEY_DOWN ); + SETCONST( pKey, "KEY_UP", KEY_UP ); + SETCONST( pKey, "KEY_LEFT", KEY_LEFT ); + SETCONST( pKey, "KEY_RIGHT", KEY_RIGHT ); + SETCONST( pKey, "KEY_HOME", KEY_HOME ); + SETCONST( pKey, "KEY_END", KEY_END ); + SETCONST( pKey, "KEY_PAGEUP", KEY_PAGEUP ); + SETCONST( pKey, "KEY_PAGEDOWN", KEY_PAGEDOWN ); + + SETCONST( pKey, "KEY_RETURN", KEY_RETURN ); + SETCONST( pKey, "KEY_ESCAPE", KEY_ESCAPE ); + SETCONST( pKey, "KEY_TAB", KEY_TAB ); + SETCONST( pKey, "KEY_BACKSPACE", KEY_BACKSPACE ); + SETCONST( pKey, "KEY_SPACE", KEY_SPACE ); + SETCONST( pKey, "KEY_INSERT", KEY_INSERT ); + SETCONST( pKey, "KEY_DELETE", KEY_DELETE ); + + SETCONST( pKey, "KEY_ADD", KEY_ADD ); + SETCONST( pKey, "KEY_SUBTRACT", KEY_SUBTRACT ); + SETCONST( pKey, "KEY_MULTIPLY", KEY_MULTIPLY ); + SETCONST( pKey, "KEY_DIVIDE", KEY_DIVIDE ); + SETCONST( pKey, "KEY_POINT", KEY_POINT ); + SETCONST( pKey, "KEY_COMMA", KEY_COMMA ); + SETCONST( pKey, "KEY_LESS", KEY_LESS ); + SETCONST( pKey, "KEY_GREATER", KEY_GREATER ); + SETCONST( pKey, "KEY_EQUAL", KEY_EQUAL ); + + SETCONST( pKey, "KEY_OPEN", KEY_OPEN ); + SETCONST( pKey, "KEY_CUT", KEY_CUT ); + SETCONST( pKey, "KEY_COPY", KEY_COPY ); + SETCONST( pKey, "KEY_PASTE", KEY_PASTE ); + SETCONST( pKey, "KEY_UNDO", KEY_UNDO ); + SETCONST( pKey, "KEY_REPEAT", KEY_REPEAT ); + SETCONST( pKey, "KEY_FIND", KEY_FIND ); + SETCONST( pKey, "KEY_PROPERTIES", KEY_PROPERTIES ); + SETCONST( pKey, "KEY_FRONT", KEY_FRONT ); + + return( pKey ); +} + +/************************************************************************* +|* +|* RscTypCont::InitTriState() +|* +|* Beschreibung +|* Ersterstellung MM 26.11.91 +|* Letzte Aenderung MM 26.11.91 +|* +*************************************************************************/ +RscEnum * RscTypCont::InitTriState(){ + RscEnum * pTriState; + pTriState = new RscEnum( pHS->Insert( "EnumTriState" ), RSC_NOTYPE ); + + SETCONST( pTriState, "STATE_NOCHECK", STATE_NOCHECK ); + SETCONST( pTriState, "STATE_CHECK", STATE_CHECK ); + SETCONST( pTriState, "STATE_DONTKNOW", STATE_DONTKNOW ); + + return( pTriState ); +} + +/************************************************************************* +|* +|* RscTypCont::InitMessButtons() +|* +|* Beschreibung +|* Ersterstellung MM 24.05.91 +|* Letzte Aenderung MM 24.05.91 +|* +*************************************************************************/ +RscEnum * RscTypCont::InitMessButtons(){ + RscEnum * pMessButtons; + pMessButtons = new RscEnum( pHS->Insert( "EnumMessButtons" ), RSC_NOTYPE, FALSE ); + SETCONST( pMessButtons, "WB_OK", WB_OK ); + SETCONST( pMessButtons, "WB_OK_CANCEL", WB_OK_CANCEL ); + SETCONST( pMessButtons, "WB_YES_NO", WB_YES_NO ); + SETCONST( pMessButtons, "WB_YES_NO_CANCEL", WB_YES_NO_CANCEL ); + SETCONST( pMessButtons, "WB_RETRY_CANCEL", WB_RETRY_CANCEL ); + return( pMessButtons ); +} + +/************************************************************************* +|* +|* RscTypCont::InitMessDefButton() +|* +|* Beschreibung +|* Ersterstellung MM 24.05.91 +|* Letzte Aenderung MM 24.05.91 +|* +*************************************************************************/ +RscEnum * RscTypCont::InitMessDefButton(){ + RscEnum * pMessDefButton; + pMessDefButton = new RscEnum( pHS->Insert( "EnumMessDefButton" ), + RSC_NOTYPE, FALSE ); + + SETCONST( pMessDefButton, "WB_DEF_OK", WB_DEF_OK ); + SETCONST( pMessDefButton, "WB_DEF_CANCEL", WB_DEF_CANCEL ); + SETCONST( pMessDefButton, "WB_DEF_RETRY", WB_DEF_RETRY ); + SETCONST( pMessDefButton, "WB_DEF_YES", WB_DEF_YES ); + SETCONST( pMessDefButton, "WB_DEF_NO", WB_DEF_NO ); + return( pMessDefButton ); +} + +/************************************************************************* +|* +|* RscTypCont::InitGeometry() +|* +|* Beschreibung +|* Ersterstellung MM 24.05.91 +|* Letzte Aenderung MM 24.05.91 +|* +*************************************************************************/ +RscTupel * RscTypCont::InitGeometry() +{ + RscTop * pTupel; + HASHID nId; + + // Clientvariablen einfuegen + pTupel = new RscTupel( pHS->Insert( "TupelDeltaSystem" ), + RSC_NOTYPE, NULL ); + nId = aNmTb.Put( "X", VARNAME ); + pTupel->SetVariable( nId, &aShort ); + nId = aNmTb.Put( "Y", VARNAME ); + pTupel->SetVariable( nId, &aShort ); + nId = aNmTb.Put( "WIDTH", VARNAME ); + pTupel->SetVariable( nId, &aShort ); + nId = aNmTb.Put( "HEIGHT", VARNAME ); + pTupel->SetVariable( nId, &aShort ); + + return (RscTupel *)pTupel; +} + +/************************************************************************* +|* +|* RscTypCont::InitLangGeometry() +|* +|* Beschreibung +|* Ersterstellung MM 24.05.91 +|* Letzte Aenderung MM 24.05.91 +|* +*************************************************************************/ +RscArray * RscTypCont::InitLangGeometry( RscTupel * pGeo ) +{ + return new RscArray( pHS->Insert( "Lang_TupelGeometry" ), + RSC_NOTYPE, pGeo, &aLangType, + &nLangTypeId, &nDfltLangTypeId ); +} + +/************************************************************************* +|* +|* RscTypCont::InitStringList() +|* +|* Beschreibung +|* Ersterstellung MM 24.05.91 +|* Letzte Aenderung MM 24.05.91 +|* +*************************************************************************/ +RscCont * RscTypCont::InitStringList() +{ + RscCont * pCont; + + pCont = new RscCont( pHS->Insert( "Chars[]" ), RSC_NOTYPE ); + pCont->SetTypeClass( &aString ); + + return pCont; +} + +/************************************************************************* +|* +|* RscTypCont::InitLangStringList() +|* +|* Beschreibung +|* Ersterstellung MM 24.05.91 +|* Letzte Aenderung MM 24.05.91 +|* +*************************************************************************/ +RscArray * RscTypCont::InitLangStringList( RscCont * pStrLst ) +{ + return new RscArray( pHS->Insert( "Lang_CharsList" ), + RSC_NOTYPE, pStrLst, &aLangType, + &nLangTypeId, &nDfltLangTypeId ); +} + +/************************************************************************* +|* +|* RscTypCont::InitStringTupel() +|* +|* Beschreibung +|* Ersterstellung MM 24.05.91 +|* Letzte Aenderung MM 24.05.91 +|* +*************************************************************************/ +RscTupel * RscTypCont::InitStringTupel() +{ + RscTop * pTupel; + HASHID nId; + + // Clientvariablen einfuegen + pTupel = new RscTupel( pHS->Insert( "CharsTupel" ), + RSC_NOTYPE, NULL ); + nId = aNmTb.Put( "FILTER", VARNAME ); + pTupel->SetVariable( nId, &aString ); + nId = aNmTb.Put( "MASK", VARNAME ); + pTupel->SetVariable( nId, &aString ); + + return (RscTupel *)pTupel; +} + +/************************************************************************* +|* +|* RscTypCont::InitStringLongTupel() +|* +|* Beschreibung +|* Ersterstellung MM 18.07.94 +|* Letzte Aenderung MM 18.07.94 +|* +*************************************************************************/ +RscTupel * RscTypCont::InitStringLongTupel() +{ + RscTop * pTupel; + HASHID nId; + + // Clientvariablen einfuegen + pTupel = new RscTupel( pHS->Insert( "CharsLongTupel" ), RSC_NOTYPE, NULL ); + nId = aNmTb.Put( "ItemText", VARNAME ); + pTupel->SetVariable( nId, &aString ); + nId = aNmTb.Put( "ItemId", VARNAME ); + pTupel->SetVariable( nId, &aEnumLong ); + + return (RscTupel *)pTupel; +} + +/************************************************************************* +|* +|* RscTypCont::InitStringTupelList() +|* +|* Beschreibung +|* Ersterstellung MM 24.05.91 +|* Letzte Aenderung MM 24.05.91 +|* +*************************************************************************/ +RscCont * RscTypCont::InitStringTupelList( RscTupel * pTupelString ) +{ + RscCont * pCont; + + pCont = new RscCont( pHS->Insert( "CharsCharsTupel[]" ), RSC_NOTYPE ); + pCont->SetTypeClass( pTupelString ); + + return pCont; +} + +/************************************************************************* +|* +|* RscTypCont::InitStringLongTupelList() +|* +|* Beschreibung +|* Ersterstellung MM 24.05.91 +|* Letzte Aenderung MM 24.05.91 +|* +*************************************************************************/ +RscCont * RscTypCont::InitStringLongTupelList( RscTupel * pStringLong ) +{ + RscCont * pCont; + + pCont = new RscCont( pHS->Insert( "CharsLongTupel[]" ), RSC_NOTYPE ); + pCont->SetTypeClass( pStringLong ); + + return pCont; +} + +/************************************************************************* +|* +|* RscTypCont::InitLangStringTupelList() +|* +|* Beschreibung +|* Ersterstellung MM 24.05.91 +|* Letzte Aenderung MM 24.05.91 +|* +*************************************************************************/ +RscArray * RscTypCont::InitLangStringTupelList( RscCont * pStrTupelLst ) +{ + return new RscArray( pHS->Insert( "Lang_CharsCharsTupel" ), + RSC_NOTYPE, pStrTupelLst, &aLangType, + &nLangTypeId, &nDfltLangTypeId ); +} + +/************************************************************************* +|* +|* RscTypCont::InitLangStringLongTupelList() +|* +|* Beschreibung +|* Ersterstellung MM 24.05.91 +|* Letzte Aenderung MM 24.05.91 +|* +*************************************************************************/ +RscArray * RscTypCont::InitLangStringLongTupelList( RscCont * pStrLongTupelLst ) +{ + return new RscArray( pHS->Insert( "Lang_CharsLongTupelList" ), + RSC_NOTYPE, pStrLongTupelLst, &aLangType, + &nLangTypeId, &nDfltLangTypeId ); +} + diff --git a/rsc/source/parser/rscicpx.cxx b/rsc/source/parser/rscicpx.cxx new file mode 100644 index 000000000000..a632db4d8043 --- /dev/null +++ b/rsc/source/parser/rscicpx.cxx @@ -0,0 +1,2483 @@ +/************************************************************************* + * + * $RCSfile: rscicpx.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): _______________________________________ + * + * + ************************************************************************/ + +/****************** I N C L U D E S **************************************/ +#pragma hdrstop + +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> + +#include <tools/rc.h> +#include <tools/vclrsc.hxx> + +#ifndef _RSCMGR_HXX +#include <rscmgr.hxx> +#endif +#ifndef _RSCCLASS_HXX +#include <rscclass.hxx> +#endif +#ifndef _RSCCONT_HXX +#include <rsccont.hxx> +#endif +#ifndef _RSCDB_HXX +#include <rscdb.hxx> +#endif +#ifndef _RSCSFX_HXX +#include <rscsfx.hxx> +#endif + +#include "rsclex.hxx" +#include <rscyacc.yxx.h> + +/************************************************************************* +|* RscTypCont::InsWinBit() +*************************************************************************/ +void RscTypCont::InsWinBit( RscTop * pClass, const ByteString & rName, + HASHID nVal ) +{ + RscClient * pClient; + + // Clientvariablen einfuegen + aBaseLst.Insert( + pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE, + &aWinBits, nVal ), + LIST_APPEND ); + HASHID nId = aNmTb.Put( rName.GetBuffer(), VARNAME ); + pClass->SetVariable( nId, pClient, NULL, + VAR_NODATAINST, 0, nWinBitVarId ); +} + +#define INS_WINBIT( pClass, WinBit ) \ + InsWinBit( pClass, #WinBit, n##WinBit##Id ); + +/************************************************************************* +|* RscTypCont::InitClassMgr() +*************************************************************************/ +RscTop * RscTypCont::InitClassMgr() +{ + RscTop * pClassMgr; + RscBaseCont * pClass; + HASHID nId; + + aBaseLst.Insert( pClass = + new RscBaseCont( HASH_NONAME, RSC_NOTYPE, NULL, FALSE ), + LIST_APPEND ); + + nId = pHS->Insert( "Resource" ); + pClassMgr = new RscMgr( nId, RSC_RESOURCE, pClass ); + aNmTb.Put( nId, CLASSNAME, pClassMgr ); + pClassMgr->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + + // Variablen anlegen + { + RscContWriteSrc * pCont; + + // Variablen anlegen + aBaseLst.Insert( + pCont = new RscContExtraData( pHS->Insert( "ContExtradata" ), + RSC_NOTYPE ), + LIST_APPEND ); + pCont->SetTypeClass( &aShort, &aString ); + nRsc_EXTRADATA = nId = aNmTb.Put( "ExtraData", VARNAME ); + pClassMgr->SetVariable( nId, pCont ); + }; + nId = aNmTb.Put( "Comment", VARNAME ); + pClassMgr->SetVariable( nId, &aString, NULL, VAR_NORC ); + + pClass->SetTypeClass( pClassMgr ); + + return pClassMgr; +} + +/************************************************************************* +|* RscTypCont::InitClassString() +*************************************************************************/ +RscTop * RscTypCont::InitClassString( RscTop * pSuper ){ + HASHID nId; + RscTop * pClassString; + + nId = pHS->Insert( "String" ); + pClassString = new RscClass( nId, RSC_STRING, pSuper ); + aNmTb.Put( nId, CLASSNAME, pClassString ); + pClassString->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + + // Variablen anlegen + nId = aNmTb.Put( "Text", VARNAME ); + pClassString->SetVariable( nId, &aLangString ); + return( pClassString ); +} + +/************************************************************************* +|* RscTypCont::InitClassBitmap() +*************************************************************************/ +RscTop * RscTypCont::InitClassBitmap( RscTop * pSuper ){ + HASHID nId; + RscTop * pClassBitmap; + + nId = pHS->Insert( "Bitmap" ); + pClassBitmap = new RscSysDepend( nId, RSC_BITMAP, pSuper ); + pClassBitmap->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + aNmTb.Put( nId, CLASSNAME, pClassBitmap ); + + // Die Klasse RscSysDepend behandelt die Variablen + // "FILE" gesondert + nId = aNmTb.Put( "File", VARNAME ); + pClassBitmap->SetVariable( nId, &aLangString, NULL, VAR_NORC ); + + return( pClassBitmap ); +} + +/************************************************************************* +|* RscTypCont::InitClassColor() +*************************************************************************/ +RscTop * RscTypCont::InitClassColor( RscTop * pSuper, RscEnum * pColor ){ + HASHID nId; + RscTop * pClassColor; + + // Klasse anlegen + nId = pHS->Insert( "Color" ); + pClassColor = new RscClass( nId, RSC_COLOR, pSuper ); + pClassColor->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + aNmTb.Put( nId, CLASSNAME, pClassColor ); + + // Variablen anlegen + nId = aNmTb.Put( "Red", VARNAME ); + pClassColor->SetVariable( nId, &aUShort ); + nId = aNmTb.Put( "Green", VARNAME ); + pClassColor->SetVariable( nId, &aUShort ); + nId = aNmTb.Put( "Blue", VARNAME ); + pClassColor->SetVariable( nId, &aUShort ); + nId = aNmTb.Put( "Predefine", VARNAME ); + pClassColor->SetVariable( nId, pColor ); + + return( pClassColor ); +} + +/************************************************************************* +|* RscTypCont::InitClassImage() +*************************************************************************/ +RscTop * RscTypCont::InitClassImage( RscTop * pSuper, RscTop * pClassBitmap, + RscTop * pClassColor ) +{ + HASHID nId; + RscTop * pClassImage; + + // Klasse anlegen + nId = pHS->Insert( "Image" ); + pClassImage = new RscClass( nId, RSC_IMAGE, pSuper ); + pClassImage->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + aNmTb.Put( nId, CLASSNAME, pClassImage ); + + // Variablen anlegen + nId = aNmTb.Put( "ImageBitmap", VARNAME ); + pClassImage->SetVariable( nId, pClassBitmap, NULL, 0, RSC_IMAGE_IMAGEBITMAP ); + nId = aNmTb.Put( "MaskBitmap", VARNAME ); + pClassImage->SetVariable( nId, pClassBitmap, NULL, 0, RSC_IMAGE_MASKBITMAP ); + nId = aNmTb.Put( "MaskColor", VARNAME ); + pClassImage->SetVariable( nId, pClassColor, NULL, + VAR_SVDYNAMIC, RSC_IMAGE_MASKCOLOR ); + + return( pClassImage ); +} + +/************************************************************************* +|* RscTypCont::InitClassImageList() +*************************************************************************/ +RscTop * RscTypCont::InitClassImageList( RscTop * pSuper, RscTop * pClassBitmap, + RscTop * pClassColor ) +{ + HASHID nId; + RscTop * pClassImageList; + + // Klasse anlegen + nId = pHS->Insert( "ImageList" ); + pClassImageList = new RscClass( nId, RSC_IMAGELIST, pSuper ); + pClassImageList->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + aNmTb.Put( nId, CLASSNAME, pClassImageList ); + + // Variablen anlegen + nId = aNmTb.Put( "ImageBitmap", VARNAME ); + pClassImageList->SetVariable( nId, pClassBitmap, NULL, 0, + RSC_IMAGELIST_IMAGEBITMAP ); + nId = aNmTb.Put( "MaskBitmap", VARNAME ); + pClassImageList->SetVariable( nId, pClassBitmap, NULL, 0, + RSC_IMAGELIST_MASKBITMAP ); + nId = aNmTb.Put( "MaskColor", VARNAME ); + pClassImageList->SetVariable( nId, pClassColor, NULL, + VAR_SVDYNAMIC, RSC_IMAGELIST_MASKCOLOR ); + { + RscCont * pCont; + + pCont = new RscCont( pHS->Insert( "USHORT *" ), RSC_NOTYPE ); + pCont->SetTypeClass( &aIdUShort ); + aBaseLst.Insert( pCont, LIST_APPEND ); + + nId = aNmTb.Put( "IdList", VARNAME ); + pClassImageList->SetVariable( nId, pCont, NULL, 0, + RSC_IMAGELIST_IDLIST ); + } + nId = aNmTb.Put( "IdCount", VARNAME ); + pClassImageList->SetVariable( nId, &aUShort, NULL, 0, + RSC_IMAGELIST_IDCOUNT ); + return( pClassImageList ); +} + +/************************************************************************* +|* RscTypCont::InitClassWindow() +*************************************************************************/ +RscTop * RscTypCont::InitClassWindow( RscTop * pSuper, RscEnum * pMapUnit, + RscArray * pLangGeo ) +{ + HASHID nId; + RscTop * pClassWindow; + + // Klasse anlegen + nId = pHS->Insert( "Window" ); + pClassWindow = new RscClass( nId, RSC_WINDOW, pSuper ); + pClassWindow->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassWindow ); + + // Variablen anlegen + { + RscFlag * pFlag; + RscClient * pClient; + HASHID nVarId, nDisableId, nOutputSizeId; + + aBaseLst.Insert( pFlag = new RscFlag( pHS->Insert( "FlagWndExtra" ), + RSC_NOTYPE ), + LIST_APPEND ); + + // Konstanten in Tabelle stellen + nDisableId = pHS->Insert( "RSWND_DISABLE" ); + SETCONST( pFlag, nDisableId, RSWND_DISABLED ); + nOutputSizeId = pHS->Insert( "RSWND_OUTPUTSIZE" ); + SETCONST( pFlag, nOutputSizeId, RSWND_CLIENTSIZE ); + + // Variable einfuegen + nVarId = aNmTb.Put( "_RscExtraFlags", VARNAME ); + pClassWindow->SetVariable( nVarId, pFlag, NULL, + VAR_HIDDEN | VAR_NOENUM ); + + aBaseLst.Insert( + pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE, + pFlag, nDisableId ), + LIST_APPEND ); + nId = aNmTb.Put( "Disable", VARNAME ); + pClassWindow->SetVariable( nId, pClient, NULL, + VAR_NODATAINST, 0, nVarId ); + + aBaseLst.Insert( + pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE, + pFlag, nOutputSizeId ), + LIST_APPEND ); + nId = aNmTb.Put( "OutputSize", VARNAME ); + pClassWindow->SetVariable( nId, pClient, NULL, + VAR_NODATAINST, 0, nVarId ); + } + + pClassWindow->SetVariable( nWinBitVarId, &aWinBits, NULL, + VAR_HIDDEN | VAR_NOENUM ); + + INS_WINBIT(pClassWindow,Border) + INS_WINBIT(pClassWindow,Hide) + INS_WINBIT(pClassWindow,ClipChildren) + INS_WINBIT(pClassWindow,SVLook) + InsWinBit( pClassWindow, "DialogControl", nTabControlId ); + + nId = aNmTb.Put( "HelpID", VARNAME ); + pClassWindow->SetVariable( nId, &aIdLong ); + + + nRsc_XYMAPMODEId = nId = aNmTb.Put( "_XYMapMode", VARNAME ); + pClassWindow->SetVariable( nId, pMapUnit, NULL, 0, WINDOW_XYMAPMODE ); + nRsc_X = nId = aNmTb.Put( "_X", VARNAME ); + pClassWindow->SetVariable( nId, &aLong, NULL, 0, WINDOW_X ); + nRsc_Y = nId = aNmTb.Put( "_Y", VARNAME ); + pClassWindow->SetVariable( nId, &aLong, NULL, 0, WINDOW_Y ); + + nRsc_WHMAPMODEId = nId = aNmTb.Put( "_WHMapMode", VARNAME ); + pClassWindow->SetVariable( nId, pMapUnit, NULL, 0, WINDOW_WHMAPMODE ); + nRsc_WIDTH = nId = aNmTb.Put( "_Width", VARNAME ); + pClassWindow->SetVariable( nId, &aLong, NULL, 0, WINDOW_WIDTH ); + nRsc_HEIGHT = nId = aNmTb.Put( "_Height", VARNAME ); + pClassWindow->SetVariable( nId, &aLong, NULL, 0, WINDOW_HEIGHT ); + + nRsc_DELTALANG = nId = aNmTb.Put( "DeltaLang", VARNAME ); + pClassWindow->SetVariable( nId, pLangGeo, NULL, VAR_NORC | VAR_NOENUM); + nId = aNmTb.Put( "Text", VARNAME ); + pClassWindow->SetVariable( nId, &aLangString, NULL, 0, WINDOW_TEXT ); + nId = aNmTb.Put( "HelpText", VARNAME ); + pClassWindow->SetVariable( nId, &aLangString, NULL, 0, WINDOW_HELPTEXT ); + nId = aNmTb.Put( "QuickHelpText", VARNAME ); + pClassWindow->SetVariable( nId, &aLangString, NULL, 0, WINDOW_QUICKTEXT ); + nId = aNmTb.Put( "ExtraLong", VARNAME ); + pClassWindow->SetVariable( nId, &aLong, NULL, 0, WINDOW_EXTRALONG ); + nId = aNmTb.Put( "UniqueId", VARNAME ); + pClassWindow->SetVariable( nId, &aLong, NULL, 0, WINDOW_UNIQUEID ); + + return( pClassWindow ); +} + +/************************************************************************* +|* RscTypCont::InitClassSystemWindow() +*************************************************************************/ +RscTop * RscTypCont::InitClassSystemWindow( RscTop * pSuper ) +{ + HASHID nId; + RscTop * pClassSystemWindow; + + // Klasse anlegen + nId = pHS->Insert( "SystemWindow" ); + pClassSystemWindow = new RscClass( nId, RSC_SYSWINDOW, pSuper ); + pClassSystemWindow->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassSystemWindow ); + + INS_WINBIT(pClassSystemWindow,Sizeable) + INS_WINBIT(pClassSystemWindow,Moveable) + InsWinBit( pClassSystemWindow, "Minable", nMinimizeId ); + InsWinBit( pClassSystemWindow, "Maxable", nMaximizeId ); + INS_WINBIT(pClassSystemWindow,Closeable) + INS_WINBIT(pClassSystemWindow,App) + + return pClassSystemWindow ; +} + +/************************************************************************* +|* RscTypCont::InitClassWorkWindow() +*************************************************************************/ +RscTop * RscTypCont::InitClassWorkWindow( RscTop * pSuper ) +{ + HASHID nId; + RscTop * pClassWorkWindow; + + // Klasse anlegen + nId = pHS->Insert( "WorkWindow" ); + pClassWorkWindow = new RscClass( nId, RSC_WORKWIN, pSuper ); + pClassWorkWindow->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassWorkWindow ); + + // Variablen anlegen + { + HASHID nVarId; + RscEnum * pShow; + + aBaseLst.Insert( pShow = new RscEnum( pHS->Insert( "EnumShowState" ), + RSC_NOTYPE ), + LIST_APPEND ); + + SETCONST( pShow, "SHOW_NORMAL", WORKWIN_SHOWNORMAL ); + SETCONST( pShow, "SHOW_MINIMIZED", WORKWIN_SHOWMINIMIZED ); + SETCONST( pShow, "SHOW_MAXIMIZED", WORKWIN_SHOWMAXIMIZED ); + + + // Variable einfuegen + nVarId = aNmTb.Put( "Show", VARNAME ); + pClassWorkWindow->SetVariable( nVarId, pShow, NULL ); + } + + return pClassWorkWindow; +} + +/************************************************************************* +|* RscTypCont::InitClassDialogBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassModalDialog( RscTop * pSuper ) +{ + HASHID nId; + RscTop * pClassDialog; + + // Klasse anlegen + nId = pHS->Insert( "ModalDialog" ); + pClassDialog = new RscClass( nId, RSC_MODALDIALOG, pSuper ); + pClassDialog->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassDialog ); + + InsWinBit( pClassDialog, "SysModal", nSysmodalId ); + + return pClassDialog; +} + +/************************************************************************* +|* RscTypCont::InitClassModelessDialog() +*************************************************************************/ +RscTop * RscTypCont::InitClassModelessDialog( RscTop * pSuper ) +{ + HASHID nId; + RscTop * pClassDialog; + + // Klasse anlegen + nId = pHS->Insert( "ModelessDialog" ); + pClassDialog = new RscClass( nId, RSC_MODELESSDIALOG, pSuper ); + pClassDialog->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassDialog ); + + return pClassDialog; +} + +/************************************************************************* +|* RscTypCont::InitClassControl() +*************************************************************************/ +RscTop * RscTypCont::InitClassControl( RscTop * pSuper ) +{ + HASHID nId; + RscTop * pClassControl; + + // Klasse anlegen + nId = pHS->Insert( "Control" ); + pClassControl = new RscClass( nId, RSC_CONTROL, pSuper ); + pClassControl->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassControl ); + + InsWinBit( pClassControl, "TabStop", nTabstopId ); + INS_WINBIT(pClassControl,Group) + + return pClassControl; +} + +/************************************************************************* +|* RscTypCont::InitClassPushButton() +*************************************************************************/ +RscTop * RscTypCont::InitClassPushButton( RscTop * pSuper ) +{ + HASHID nId; + RscTop * pClassPushButton; + + // Klasse anlegen + nId = pHS->Insert( "PushButton" ); + pClassPushButton = new RscClass( nId, RSC_PUSHBUTTON, pSuper ); + pClassPushButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassPushButton ); + + InsWinBit( pClassPushButton, "DefButton", nDefaultId ); + + return pClassPushButton; +} + +/************************************************************************* +|* RscTypCont::InitClassTriStateBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassTriStateBox( RscTop * pSuper, + RscEnum * pTriState ) +{ + HASHID nId; + RscTop * pClassTriStateBox; + + nId = pHS->Insert( "TriStateBox" ); + pClassTriStateBox = new RscClass( nId, RSC_TRISTATEBOX, pSuper ); + pClassTriStateBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassTriStateBox ); + + // Variablen anlegen + nId = aNmTb.Put( "State", VARNAME ); + pClassTriStateBox->SetVariable( nId, pTriState ); + nId = aNmTb.Put( "TriStateDisable", VARNAME ); + pClassTriStateBox->SetVariable( nId, &aBool ); + + return( pClassTriStateBox ); +} + +/************************************************************************* +|* RscTypCont::InitClassMenuButton() +*************************************************************************/ +RscTop * RscTypCont::InitClassMenuButton( RscTop * pSuper, + RscTop * pClassMenu ) +{ + HASHID nId; + RscTop * pClassMenuButton; + + nId = pHS->Insert( "MenuButton" ); + pClassMenuButton = new RscClass( nId, RSC_MENUBUTTON, pSuper ); + pClassMenuButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassMenuButton ); + + // Variablen anlegen + nId = aNmTb.Put( "ButtonMenu", VARNAME ); + pClassMenuButton->SetVariable( nId, pClassMenu, NULL, 0, + RSCMENUBUTTON_MENU ); + + return( pClassMenuButton ); +} + + +/************************************************************************* +|* RscTypCont::InitClassImageButton() +*************************************************************************/ +RscTop * RscTypCont::InitClassImageButton( RscTop * pSuper, + RscTop * pClassImage, + RscEnum * pTriState ) +{ + HASHID nId; + RscTop * pClassImageButton; + + // Klasse anlegen + nId = pHS->Insert( "ImageButton" ); + pClassImageButton = new RscClass( nId, RSC_IMAGEBUTTON, pSuper ); + pClassImageButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassImageButton ); + + // Variablen anlegen + { + nId = aNmTb.Put( "ButtonImage", VARNAME ); + pClassImageButton->SetVariable( nId, pClassImage, NULL, 0, + RSC_IMAGEBUTTON_IMAGE ); + } + // Variablen anlegen + { + HASHID nVarId; + RscEnum * pSymbol; + + aBaseLst.Insert( pSymbol = new RscEnum( pHS->Insert( "EnumSymbolButton" ), + RSC_NOTYPE ), LIST_APPEND ); + + SETCONST( pSymbol, "IMAGEBUTTON_DONTKNOW", SYMBOL_DONTKNOW ); + SETCONST( pSymbol, "IMAGEBUTTON_IMAGE", SYMBOL_IMAGE ); + SETCONST( pSymbol, "IMAGEBUTTON_ARROW_UP", SYMBOL_ARROW_UP ); + SETCONST( pSymbol, "IMAGEBUTTON_ARROW_DOWN", SYMBOL_ARROW_DOWN ); + SETCONST( pSymbol, "IMAGEBUTTON_ARROW_LEFT", SYMBOL_ARROW_LEFT ); + SETCONST( pSymbol, "IMAGEBUTTON_ARROW_RIGHT", SYMBOL_ARROW_RIGHT ); + SETCONST( pSymbol, "IMAGEBUTTON_SPIN_UP", SYMBOL_SPIN_UP ); + SETCONST( pSymbol, "IMAGEBUTTON_SPIN_DOWN", SYMBOL_SPIN_DOWN ); + SETCONST( pSymbol, "IMAGEBUTTON_SPIN_LEFT", SYMBOL_SPIN_LEFT ); + SETCONST( pSymbol, "IMAGEBUTTON_SPIN_RIGHT", SYMBOL_SPIN_RIGHT ); + SETCONST( pSymbol, "IMAGEBUTTON_FIRST", SYMBOL_FIRST ); + SETCONST( pSymbol, "IMAGEBUTTON_LAST", SYMBOL_LAST ); + SETCONST( pSymbol, "IMAGEBUTTON_PREV", SYMBOL_PREV ); + SETCONST( pSymbol, "IMAGEBUTTON_NEXT", SYMBOL_NEXT ); + SETCONST( pSymbol, "IMAGEBUTTON_PAGEUP", SYMBOL_PAGEUP ); + SETCONST( pSymbol, "IMAGEBUTTON_PAGEDOWN", SYMBOL_PAGEDOWN ); + SETCONST( pSymbol, "IMAGEBUTTON_PLAY", SYMBOL_PLAY ); + SETCONST( pSymbol, "IMAGEBUTTON_REVERSEPLAY", SYMBOL_REVERSEPLAY ); + SETCONST( pSymbol, "IMAGEBUTTON_STOP", SYMBOL_STOP ); + SETCONST( pSymbol, "IMAGEBUTTON_PAUSE", SYMBOL_PAUSE ); + SETCONST( pSymbol, "IMAGEBUTTON_WINDSTART", SYMBOL_WINDSTART ); + SETCONST( pSymbol, "IMAGEBUTTON_WINDEND", SYMBOL_WINDEND ); + SETCONST( pSymbol, "IMAGEBUTTON_WINDBACKWARD", SYMBOL_WINDBACKWARD ); + SETCONST( pSymbol, "IMAGEBUTTON_WINDFORWARD", SYMBOL_WINDFORWARD ); + + // Variable einfuegen + nVarId = aNmTb.Put( "Symbol", VARNAME ); + pClassImageButton->SetVariable( nVarId, pSymbol, NULL, 0, + RSC_IMAGEBUTTON_SYMBOL ); + } + nId = aNmTb.Put( "State", VARNAME ); + pClassImageButton->SetVariable( nId, pTriState, NULL, 0, + RSC_IMAGEBUTTON_STATE ); + + INS_WINBIT(pClassImageButton,Repeat) + INS_WINBIT(pClassImageButton,SmallStyle) + INS_WINBIT(pClassImageButton,RectStyle) + + return pClassImageButton; +} + +/************************************************************************* +|* RscTypCont::InitClassEdit() +*************************************************************************/ +RscTop * RscTypCont::InitClassEdit( RscTop * pSuper ) +{ + HASHID nId; + RscTop * pClassEdit; + + // Klasse anlegen + nId = pHS->Insert( "Edit" ); + pClassEdit = new RscClass( nId, RSC_EDIT, pSuper ); + pClassEdit->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassEdit ); + + INS_WINBIT(pClassEdit,Left) + INS_WINBIT(pClassEdit,Center) + INS_WINBIT(pClassEdit,Right) + INS_WINBIT(pClassEdit,PassWord) + INS_WINBIT(pClassEdit,ReadOnly) + + nId = aNmTb.Put( "MaxTextLength", VARNAME ); + pClassEdit->SetVariable( nId, &aUShort ); + + return pClassEdit; +} + +/************************************************************************* +|* RscTypCont::InitClassMultiLineedit() +*************************************************************************/ +RscTop * RscTypCont::InitClassMultiLineEdit( RscTop * pSuper ) +{ + HASHID nId; + RscTop * pClassMultiLineEdit; + + // Klasse anlegen + nId = pHS->Insert( "MultiLineEdit" ); + pClassMultiLineEdit = new RscClass( nId, RSC_MULTILINEEDIT, pSuper ); + pClassMultiLineEdit->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassMultiLineEdit ); + + InsWinBit( pClassMultiLineEdit, "HScroll", nHscrollId ); + InsWinBit( pClassMultiLineEdit, "VScroll", nVscrollId ); + INS_WINBIT( pClassMultiLineEdit, IgnoreTab ); + + return pClassMultiLineEdit; +} + +/************************************************************************* +|* RscTypCont::InitClassScrollBar() +*************************************************************************/ +RscTop * RscTypCont::InitClassScrollBar( RscTop * pSuper ) +{ + HASHID nId; + RscTop * pClassScrollBar; + + // Klasse anlegen + nId = pHS->Insert( "ScrollBar" ); + pClassScrollBar = new RscClass( nId, RSC_SCROLLBAR, pSuper ); + pClassScrollBar->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassScrollBar ); + + // Variablen anlegen + nId = aNmTb.Put( "MinPos", VARNAME ); + pClassScrollBar->SetVariable( nId, &aShort ); + { + RSCINST aDfltI; + + aDfltI = aShort.Create( NULL, RSCINST(), FALSE ); + aDfltI.pClass->SetNumber( aDfltI, 100 ); +// aDfltI.pClass->MakeDefault( aDfltI ); + + nId = aNmTb.Put( "MaxPos", VARNAME ); + pClassScrollBar->SetVariable( nId, &aShort, &aDfltI ); + } + nId = aNmTb.Put( "ThumbPos", VARNAME ); + pClassScrollBar->SetVariable( nId, &aShort ); + { + RSCINST aDfltI; + + aDfltI = aShort.Create( NULL, RSCINST(), FALSE ); + aDfltI.pClass->SetNumber( aDfltI, 1 ); +// aDfltI.pClass->MakeDefault( aDfltI ); + + nId = aNmTb.Put( "PageSize", VARNAME); + pClassScrollBar->SetVariable( nId, &aShort, &aDfltI ); + } + { + RSCINST aDfltI; + + aDfltI = aShort.Create( NULL, RSCINST(), FALSE ); + aDfltI.pClass->SetNumber( aDfltI, 1 ); +// aDfltI.pClass->MakeDefault( aDfltI ); + nId = aNmTb.Put( "LineSize", VARNAME ); + pClassScrollBar->SetVariable( nId, &aShort, &aDfltI ); + } + nId = aNmTb.Put( "VisibleSize", VARNAME ); + pClassScrollBar->SetVariable( nId, &aShort ); + + InsWinBit( pClassScrollBar, "HScroll", nHscrollId ); + InsWinBit( pClassScrollBar, "VScroll", nVscrollId ); + INS_WINBIT(pClassScrollBar,Drag) + + return pClassScrollBar; +} + +/************************************************************************* +|* RscTypCont::InitClassListBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassListBox( RscTop * pSuper, RscArray * pStrLst ) +{ + HASHID nId; + RscTop * pClassListBox; + + // Klasse anlegen + nId = pHS->Insert( "ListBox" ); + pClassListBox = new RscClass( nId, RSC_LISTBOX, pSuper ); + pClassListBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassListBox ); + + // Variablen anlegen + INS_WINBIT(pClassListBox,Sort) + INS_WINBIT(pClassListBox,DropDown) + InsWinBit( pClassListBox, "HScroll", nHscrollId ); + InsWinBit( pClassListBox, "VScroll", nVscrollId ); + INS_WINBIT(pClassListBox,AutoSize) + INS_WINBIT(pClassListBox,AutoHScroll) + INS_WINBIT(pClassListBox,DDExtraWidth) + + { + RSCINST aDflt = aUShort.Create( NULL, RSCINST(), FALSE ); + aDflt.pClass->SetNumber( aDflt, (USHORT)0xFFFF ); + nId = aNmTb.Put( "CurPos", VARNAME ); + pClassListBox->SetVariable( nId, &aUShort, &aDflt ); + } + nId = aNmTb.Put( "StringList", VARNAME ); + pClassListBox->SetVariable( nId, pStrLst ); + + return pClassListBox; +} + +/************************************************************************* +|* RscTypCont::InitClassMultiListBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassMultiListBox( RscTop * pSuper ) +{ + HASHID nId; + RscTop * pClassMultiListBox; + + // Klasse anlegen + nId = pHS->Insert( "MultiListBox" ); + pClassMultiListBox = new RscClass( nId, RSC_MULTILISTBOX, pSuper ); + pClassMultiListBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassMultiListBox ); + + INS_WINBIT(pClassMultiListBox,SimpleMode) + + return pClassMultiListBox; +} + +/************************************************************************* +|* RscTypCont::InitClassComboBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassComboBox( RscTop * pSuper, RscArray * pStrLst ) +{ + HASHID nId; + RscTop * pClassComboBox; + + // Klasse anlegen + nId = pHS->Insert( "ComboBox" ); + pClassComboBox = new RscClass( nId, RSC_COMBOBOX, pSuper ); + pClassComboBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassComboBox ); + + // Variablen anlegen + INS_WINBIT(pClassComboBox,DropDown) + INS_WINBIT(pClassComboBox,Sort) + InsWinBit( pClassComboBox, "HScroll", nHscrollId ); + InsWinBit( pClassComboBox, "VScroll", nVscrollId ); + INS_WINBIT(pClassComboBox,AutoSize) + INS_WINBIT(pClassComboBox,AutoHScroll) + INS_WINBIT(pClassComboBox,DDExtraWidth) + + nId = aNmTb.Put( "StringList", VARNAME ); + pClassComboBox->SetVariable( nId, pStrLst ); + + return pClassComboBox; +} + +#ifdef MAC +#pragma segment rsctypcont +#endif + +/************************************************************************* +|* RscTypCont::InitClassFixedText() +*************************************************************************/ +RscTop * RscTypCont::InitClassFixedText( RscTop * pSuper ) +{ + HASHID nId; + RscTop * pClassFixedText; + + // Klasse anlegen + nId = pHS->Insert( "FixedText" ); + pClassFixedText = new RscClass( nId, RSC_TEXT, pSuper ); + pClassFixedText->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassFixedText ); + + // Variablen anlegen + INS_WINBIT(pClassFixedText,Left) + INS_WINBIT(pClassFixedText,Center) + INS_WINBIT(pClassFixedText,Right) + INS_WINBIT(pClassFixedText,WordBreak) + INS_WINBIT(pClassFixedText,LeftLabel) + INS_WINBIT(pClassFixedText,NoLabel) + + return pClassFixedText; +} + +/************************************************************************* +|* RscTypCont::InitClassFixedBitmap() +*************************************************************************/ +RscTop * RscTypCont::InitClassFixedBitmap( RscTop * pSuper, RscTop * pClassBitmap ) +{ + HASHID nId; + RscTop * pClassFixedBitmap; + + // Klasse anlegen + nId = pHS->Insert( "FixedBitmap" ); + pClassFixedBitmap = new RscClass( nId, RSC_FIXEDBITMAP, pSuper ); + pClassFixedBitmap->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassFixedBitmap ); + + INS_WINBIT(pClassFixedBitmap,Scale) + + // Variablen anlegen + nId = aNmTb.Put( "Fixed", VARNAME ); + pClassFixedBitmap->SetVariable( nId, pClassBitmap, 0, 0, RSC_FIXEDBITMAP_BITMAP ); + + return pClassFixedBitmap; +} + +/************************************************************************* +|* RscTypCont::InitClassFixedImage() +*************************************************************************/ +RscTop * RscTypCont::InitClassFixedImage( RscTop * pSuper, RscTop * pClassImage ) +{ + HASHID nId; + RscTop * pClassFixedImage; + + // Klasse anlegen + nId = pHS->Insert( "FixedImage" ); + pClassFixedImage = new RscClass( nId, RSC_FIXEDIMAGE, pSuper ); + pClassFixedImage->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassFixedImage ); + + // Variablen anlegen + nId = aNmTb.Put( "Fixed", VARNAME ); + pClassFixedImage->SetVariable( nId, pClassImage, 0, 0, RSC_FIXEDIMAGE_IMAGE ); + + return pClassFixedImage; +} + +/************************************************************************* +|* RscTypCont::InitClassImageRadioButton() +*************************************************************************/ +RscTop * RscTypCont::InitClassImageRadioButton( RscTop * pSuper, RscTop * pClassImage ) +{ + HASHID nId; + RscTop * pClassImageRadioButton; + + // Klasse anlegen + nId = pHS->Insert( "ImageRadioButton" ); + pClassImageRadioButton = new RscClass( nId, RSC_IMAGERADIOBUTTON, pSuper ); + pClassImageRadioButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassImageRadioButton ); + + // Variablen anlegen + INS_WINBIT(pClassImageRadioButton,TopImage) + nId = aNmTb.Put( "RadioButtonImage", VARNAME ); + pClassImageRadioButton->SetVariable( nId, pClassImage, 0, 0, RSC_IMAGERADIOBUTTON_IMAGE ); + + return pClassImageRadioButton; +} + +/************************************************************************* +|* RscTypCont::InitClassKeyCode() +*************************************************************************/ +RscTop * RscTypCont::InitClassKeyCode( RscTop * pSuper, RscEnum * pKey ) +{ + HASHID nId; + RscTop * pClassKeyCode; + + // Klasse anlegen + nId = pHS->Insert( "KeyCode" ); + pClassKeyCode = new RscClass( nId, RSC_KEYCODE, pSuper ); + aNmTb.Put( nId, CLASSNAME, pClassKeyCode ); + + // Variablen anlegen + nId = aNmTb.Put( "Code", VARNAME ); + pClassKeyCode->SetVariable( nId, pKey ); + + { + RscFlag * pFlag; + RscClient * pClient; + HASHID nVarId, nShiftId, nMod1Id, nMod2Id; + + aBaseLst.Insert( pFlag = new RscFlag( pHS->Insert( "FlagKeyModifier" ), + RSC_NOTYPE ), + LIST_APPEND ); + + // Konstanten in Tabelle stellen + nShiftId = pHS->Insert( "KEY_SHIFT" ); + SETCONST( pFlag, nShiftId, KEY_SHIFT ); + nMod1Id = pHS->Insert( "KEY_MOD1" ); + SETCONST( pFlag, nMod1Id, KEY_MOD1 ); + nMod2Id = pHS->Insert( "KEY_MOD2" ); + SETCONST( pFlag, nMod2Id, KEY_MOD2 ); + + // Variable einfuegen + nVarId = aNmTb.Put( "_ModifierFlags", VARNAME ); + pClassKeyCode->SetVariable( nVarId, pFlag, NULL, + VAR_HIDDEN | VAR_NOENUM ); + + // Clientvariablen einfuegen + aBaseLst.Insert( + pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE, + pFlag, nShiftId ), + LIST_APPEND ); + nId = aNmTb.Put( "Shift", VARNAME ); + pClassKeyCode->SetVariable( nId, pClient, NULL, + VAR_NODATAINST, 0, nVarId ); + + aBaseLst.Insert( + pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE, + pFlag, nMod1Id ), + LIST_APPEND ); + nId = aNmTb.Put( "Modifier1", VARNAME ); + pClassKeyCode->SetVariable( nId, pClient, NULL, + VAR_NODATAINST, 0, nVarId ); + + + aBaseLst.Insert( + pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE, + pFlag, nMod2Id ), + LIST_APPEND ); + nId = aNmTb.Put( "Modifier2", VARNAME ); + pClassKeyCode->SetVariable( nId, pClient, NULL, + VAR_NODATAINST, 0, nVarId ); + } + { + HASHID nVarId; + RscEnum * pKeyFunc; + + aBaseLst.Insert( pKeyFunc = new RscEnum( pHS->Insert( "EnumKeyFunc" ), + RSC_NOTYPE ), + LIST_APPEND ); + + SETCONST( pKeyFunc, "KEYFUNC_DONTKNOW", KEYFUNC_DONTKNOW ); + SETCONST( pKeyFunc, "KEYFUNC_NEW", KEYFUNC_NEW ); + SETCONST( pKeyFunc, "KEYFUNC_OPEN", KEYFUNC_OPEN ); + SETCONST( pKeyFunc, "KEYFUNC_SAVE", KEYFUNC_SAVE ); + SETCONST( pKeyFunc, "KEYFUNC_SAVEAS", KEYFUNC_SAVEAS ); + SETCONST( pKeyFunc, "KEYFUNC_PRINT", KEYFUNC_PRINT ); + SETCONST( pKeyFunc, "KEYFUNC_CLOSE", KEYFUNC_CLOSE ); + SETCONST( pKeyFunc, "KEYFUNC_QUIT", KEYFUNC_QUIT ); + SETCONST( pKeyFunc, "KEYFUNC_CUT", KEYFUNC_CUT ); + SETCONST( pKeyFunc, "KEYFUNC_COPY", KEYFUNC_COPY ); + SETCONST( pKeyFunc, "KEYFUNC_PASTE", KEYFUNC_PASTE ); + SETCONST( pKeyFunc, "KEYFUNC_UNDO", KEYFUNC_UNDO ); + SETCONST( pKeyFunc, "KEYFUNC_REDO", KEYFUNC_REDO ); + SETCONST( pKeyFunc, "KEYFUNC_DELETE", KEYFUNC_DELETE ); + SETCONST( pKeyFunc, "KEYFUNC_REPEAT", KEYFUNC_REPEAT ); + SETCONST( pKeyFunc, "KEYFUNC_FIND", KEYFUNC_FIND ); + SETCONST( pKeyFunc, "KEYFUNC_PROPERTIES", KEYFUNC_PROPERTIES ); + SETCONST( pKeyFunc, "KEYFUNC_FRONT", KEYFUNC_FRONT ); + SETCONST( pKeyFunc, "KEYFUNC_FINDBACKWARD", KEYFUNC_FINDBACKWARD ); + // Variable einfuegen + nVarId = aNmTb.Put( "Function", VARNAME ); + pClassKeyCode->SetVariable( nVarId, pKeyFunc, NULL ); + } + + return pClassKeyCode; +} + +/************************************************************************* +|* RscTypCont::InitClassAccelItem() +*************************************************************************/ +RscTop * RscTypCont::InitClassAccelItem( RscTop * pSuper, + RscTop * pClassKeyCode ) +{ + HASHID nId; + RscTop * pClassAccelItem; + + // Klasse anlegen + nId = pHS->Insert( "AcceleratorItem" ); + pClassAccelItem = new RscClass( nId, RSC_ACCELITEM, pSuper ); + aNmTb.Put( nId, CLASSNAME, pClassAccelItem ); + + // Variablen anlegen + nId = aNmTb.Put( "Identifier", VARNAME ); + pClassAccelItem->SetVariable( nId, &aIdNoZeroUShort ); + nId = aNmTb.Put( "Disable", VARNAME ); + pClassAccelItem->SetVariable( nId, &aBool ); + nId = aNmTb.Put( "Key", VARNAME ); + pClassAccelItem->SetVariable( nId, pClassKeyCode, NULL, 0, + ACCELITEM_KEY ); + + return pClassAccelItem; +} + +/************************************************************************* +|* RscTypCont::InitClassAccelm() +*************************************************************************/ +RscTop * RscTypCont::InitClassAccel( RscTop * pSuper, RscTop * pClassAccelItem ) +{ + HASHID nId; + RscTop * pClassAccel; + + // Klasse anlegen + nId = pHS->Insert( "Accelerator" ); + pClassAccel = new RscClass( nId, RSC_ACCEL, pSuper ); + pClassAccel->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + aNmTb.Put( nId, CLASSNAME, pClassAccel ); + + // Variablen anlegen + nId = aNmTb.Put( "HelpText", VARNAME ); + pClassAccel->SetVariable( nId, &aLangString ); + { + RscCont * pCont; + + aBaseLst.Insert( pCont = new RscCont( + pHS->Insert( "ContAcceleratorKey" ), + RSC_NOTYPE ), + LIST_APPEND ); + pCont->SetTypeClass( pClassAccelItem ); + nId = aNmTb.Put( "ItemList", VARNAME ); + pClassAccel->SetVariable( nId, pCont ); + } + + return pClassAccel; +} + +/************************************************************************* +|* RscTypCont::InitClassMenuItem() +*************************************************************************/ +RscTop * RscTypCont::InitClassMenuItem( RscTop * pSuper, + RscTop * pClassBitmap, + RscTop * pClassKeyCode ) +{ + HASHID nId; + RscTop * pClassMenuItem; + + // Klasse anlegen + nId = pHS->Insert( "MenuItem" ); + pClassMenuItem = new RscClass( nId, RSC_MENUITEM, pSuper ); + aNmTb.Put( nId, CLASSNAME, pClassMenuItem ); + + // Variablen anlegen + nId = aNmTb.Put( "Separator", VARNAME ); + pClassMenuItem->SetVariable( nId, &aBool, NULL, 0, + RSC_MENUITEM_SEPARATOR ); + nId = aNmTb.Put( "Identifier", VARNAME ); + pClassMenuItem->SetVariable( nId, &aIdNoZeroUShort, NULL, 0, + RSC_MENUITEM_ID ); + { + RscFlag * pFlag; + RscClient * pClient; + HASHID nVarId, nAutoCheckId, nRadioCheckId; + HASHID nCheckableId, nAboutId, nHelpId; + + aBaseLst.Insert( pFlag = new RscFlag( pHS->Insert( "FlagMenuState" ), + RSC_NOTYPE ), + LIST_APPEND ); + + // Konstanten in Tabelle stellen + nCheckableId = pHS->Insert( "MIB_CHECKABLE" ); + SETCONST( pFlag, nCheckableId, MIB_CHECKABLE ); + nAutoCheckId = pHS->Insert( "MIB_AUTOCHECK" ); + SETCONST( pFlag, nAutoCheckId, MIB_AUTOCHECK ); + nRadioCheckId = pHS->Insert( "MIB_RADIOCHECK" ); + SETCONST( pFlag, nRadioCheckId, MIB_RADIOCHECK ); + nAboutId = pHS->Insert( "MIB_ABOUT" ); + SETCONST( pFlag, nAboutId, MIB_ABOUT ); + nHelpId = pHS->Insert( "MIB_HELP" ); + SETCONST( pFlag, nHelpId, MIB_HELP ); + + // Variable einfuegen + nVarId = aNmTb.Put( "_MenuItemFlags", VARNAME ); + pClassMenuItem->SetVariable( nVarId, pFlag, NULL, + VAR_HIDDEN | VAR_NOENUM, + RSC_MENUITEM_STATUS ); + + // Clientvariablen einfuegen + aBaseLst.Insert( + pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE, + pFlag, nCheckableId ), + LIST_APPEND ); + nId = aNmTb.Put( "Checkable", VARNAME ); + pClassMenuItem->SetVariable( nId, pClient, NULL, + VAR_NODATAINST, 0, nVarId ); + + aBaseLst.Insert( + pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE, + pFlag, nAutoCheckId ), + LIST_APPEND ); + nId = aNmTb.Put( "AutoCheck", VARNAME ); + pClassMenuItem->SetVariable( nId, pClient, NULL, + VAR_NODATAINST, 0, nVarId ); + + aBaseLst.Insert( + pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE, + pFlag, nRadioCheckId ), + LIST_APPEND ); + nId = aNmTb.Put( "RadioCheck", VARNAME ); + pClassMenuItem->SetVariable( nId, pClient, NULL, + VAR_NODATAINST, 0, nVarId ); + + aBaseLst.Insert( + pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE, + pFlag, nAboutId ), + LIST_APPEND ); + nId = aNmTb.Put( "About", VARNAME ); + pClassMenuItem->SetVariable( nId, pClient, NULL, + VAR_NODATAINST, 0, nVarId ); + + aBaseLst.Insert( + pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE, + pFlag, nHelpId ), + LIST_APPEND ); + nId = aNmTb.Put( "Help", VARNAME ); + pClassMenuItem->SetVariable( nId, pClient, NULL, + VAR_NODATAINST, 0, nVarId ); + + } + nId = aNmTb.Put( "Text", VARNAME ); + pClassMenuItem->SetVariable( nId, &aLangString, NULL, 0, + RSC_MENUITEM_TEXT ); + nId = aNmTb.Put( "ItemBitmap", VARNAME ); + pClassMenuItem->SetVariable( nId, pClassBitmap, NULL, 0, + RSC_MENUITEM_BITMAP ); + nId = aNmTb.Put( "HelpText", VARNAME ); + pClassMenuItem->SetVariable( nId, &aLangString, NULL, 0, + RSC_MENUITEM_HELPTEXT ); + nId = aNmTb.Put( "HelpID", VARNAME ); + pClassMenuItem->SetVariable( nId, &aIdLong, NULL, 0, + RSC_MENUITEM_HELPID ); + nId = aNmTb.Put( "AccelKey", VARNAME ); + pClassMenuItem->SetVariable( nId, pClassKeyCode, NULL, 0, + RSC_MENUITEM_KEYCODE ); + nId = aNmTb.Put( "Check", VARNAME ); + pClassMenuItem->SetVariable( nId, &aBool, NULL, 0, + RSC_MENUITEM_CHECKED ); + nId = aNmTb.Put( "Disable", VARNAME ); + pClassMenuItem->SetVariable( nId, &aBool, NULL, 0, + RSC_MENUITEM_DISABLE ); + nId = aNmTb.Put( "Command", VARNAME ); + pClassMenuItem->SetVariable( nId, &aString, NULL, 0, + RSC_MENUITEM_COMMAND ); + + return pClassMenuItem; +} + +/************************************************************************* +|* RscTypCont::InitClassMenu() +*************************************************************************/ +RscTop * RscTypCont::InitClassMenu( RscTop * pSuper, + RscTop * pClassMenuItem ) +{ + HASHID nId; + RscTop * pClassMenu; + + // Klasse anlegen + nId = pHS->Insert( "Menu" ); + pClassMenu = new RscClass( nId, RSC_MENU, pSuper ); + pClassMenu->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + aNmTb.Put( nId, CLASSNAME, pClassMenu ); + + // Variablen anlegen + { + RscCont * pCont; + + aBaseLst.Insert( pCont = new RscCont( pHS->Insert( "ContMenuItem" ), + RSC_NOTYPE ), + LIST_APPEND ); + pCont->SetTypeClass( pClassMenuItem ); + nId = aNmTb.Put( "ItemList", VARNAME ); + pClassMenu->SetVariable( nId, pCont, NULL, 0, RSC_MENU_ITEMS ); + } + nId = aNmTb.Put( "Text", VARNAME ); + pClassMenu->SetVariable( nId, &aLangString, NULL, 0, RSC_MENU_TEXT ); + nId = aNmTb.Put( "DefaultItemId", VARNAME ); + pClassMenu->SetVariable( nId, &aIdUShort, NULL, 0, + RSC_MENU_DEFAULTITEMID ); + + return pClassMenu; +} + +/************************************************************************* +|* RscTypCont::InitClassMessageBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassMessBox( RscTop * pSuper, + RscEnum * pMessButtons, + RscEnum * pMessDefButton ) +{ + HASHID nId; + RscTop * pClassMessBox; + + // Klasse anlegen + nId = pHS->Insert( "MessBox" ); + pClassMessBox = new RscClass( nId, RSC_MESSBOX, pSuper ); + pClassMessBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassMessBox ); + + // Variablen anlegen + nId = aNmTb.Put( "Buttons", VARNAME ); + pClassMessBox->SetVariable( nId, pMessButtons ); + nId = aNmTb.Put( "DefButton", VARNAME ); + pClassMessBox->SetVariable( nId, pMessDefButton ); + nId = aNmTb.Put( "HelpID", VARNAME ); + pClassMessBox->SetVariable( nId, &aIdLong ); + nId = aNmTb.Put( "SysModal", VARNAME ); + pClassMessBox->SetVariable( nId, &aBool ); + nId = aNmTb.Put( "Title", VARNAME ); + pClassMessBox->SetVariable( nId, &aLangString ); + nId = aNmTb.Put( "Message", VARNAME ); + pClassMessBox->SetVariable( nId, &aLangString ); + nId = aNmTb.Put( "HelpText", VARNAME ); + pClassMessBox->SetVariable( nId, &aLangString ); + + return pClassMessBox; +} + +/************************************************************************* +|* RscTypCont::InitClassSplitter() +*************************************************************************/ +RscTop * RscTypCont::InitClassSplitter( RscTop * pSuper ) +{ + HASHID nId; + RscTop * pClassSplitter; + + // Klasse anlegen + nId = pHS->Insert( "Splitter" ); + pClassSplitter = new RscClass( nId, RSC_SPLITTER, pSuper ); + pClassSplitter->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassSplitter ); + + InsWinBit( pClassSplitter, "HScroll", nHscrollId ); + InsWinBit( pClassSplitter, "VScroll", nVscrollId ); + + return pClassSplitter; +} + +/************************************************************************* +|* RscTypCont::InitClassSplitWindow() +*************************************************************************/ +RscTop * RscTypCont::InitClassSplitWindow( RscTop * pSuper ) +{ + HASHID nId; + RscTop * pClassSplitWindow; + + // Klasse anlegen + nId = pHS->Insert( "SplitWindow" ); + pClassSplitWindow = new RscClass( nId, RSC_SPLITWINDOW, pSuper ); + pClassSplitWindow->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassSplitWindow ); + + INS_WINBIT(pClassSplitWindow,Sizeable) + INS_WINBIT(pClassSplitWindow,NoSplitDraw) + + return pClassSplitWindow; +} + +/************************************************************************* +|* RscTypCont::InitClassTime() +*************************************************************************/ +RscTop * RscTypCont::InitClassTime( RscTop * pSuper ) +{ + HASHID nId; + RscTop * pClassTime; + + // Klasse anlegen + nId = pHS->Insert( "Time" ); + pClassTime = new RscClass( nId, RSC_TIME, pSuper ); + pClassTime->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + + aNmTb.Put( nId, CLASSNAME, pClassTime ); + + // Variablen anlegen + nId = aNmTb.Put( "Hour", VARNAME ); + pClassTime->SetVariable( nId, &a0to23Short, NULL, 0, TIME_HOUR ); + + nId = aNmTb.Put( "Minute", VARNAME ); + pClassTime->SetVariable( nId, &a0to59Short, NULL, 0, TIME_MINUTE ); + + nId = aNmTb.Put( "Second", VARNAME ); + pClassTime->SetVariable( nId, &a0to59Short, NULL, 0, TIME_SECOND ); + + nId = aNmTb.Put( "Sec100", VARNAME ); // weiss noch nich + pClassTime->SetVariable( nId, &a0to99Short, NULL, 0, TIME_SEC100 ); + + return pClassTime; +} + +/************************************************************************* +|* RscTypCont::InitClassDate() +*************************************************************************/ +RscTop * RscTypCont::InitClassDate( RscTop * pSuper, RscEnum * /*pDayOfWeek*/ ) +{ + HASHID nId; + RscTop * pClassDate; + + // Klasse anlegen + nId = pHS->Insert( "Date" ); + pClassDate = new RscClass( nId, RSC_DATE, pSuper ); + pClassDate->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + + aNmTb.Put( nId, CLASSNAME, pClassDate ); + + // Variablen anlegen + nId = aNmTb.Put( "Year", VARNAME ); + pClassDate->SetVariable( nId, &a0to9999Short, NULL, 0, DATE_YEAR ); + + nId = aNmTb.Put( "Month", VARNAME ); + pClassDate->SetVariable( nId, &a1to12Short, NULL, 0, DATE_MONTH ); + + nId = aNmTb.Put( "Day", VARNAME ); + pClassDate->SetVariable( nId, &a1to31Short, NULL, 0, DATE_DAY ); + + return pClassDate; +} + +/************************************************************************* +|* RscTypCont::InitClassInt1() +*************************************************************************/ +RscTop * RscTypCont::InitClassInt1( RscTop * pSuper, + RscEnum * pDateFormat, + RscEnum * pTimeFormat, RscEnum * pDayOfWeekFormat, + RscEnum * pMonthFormat ) +{ + HASHID nId; + RscTop * pClassInt; + + // Klasse anlegen + nId = pHS->Insert( "SubInternational" ); + pClassInt = new RscClass( nId, RSC_NOTYPE, pSuper ); + //pClassInt->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + + // Variablen anlegen + nId = aNmTb.Put( "Language", VARNAME ); + pClassInt->SetVariable( nId, &aLangType, NULL, 0, INT1_LANGUAGE ); + + nId = aNmTb.Put( "FormatLanguage", VARNAME ); + pClassInt->SetVariable( nId, &aLangType, NULL, 0, INT1_FORMATLANGUAGE ); + + nId = aNmTb.Put( "DateFormat", VARNAME ); + pClassInt->SetVariable( nId, pDateFormat, NULL, 0, INT1_DATEFORMAT ); + + nId = aNmTb.Put( "DateDayLeadingZero", VARNAME ); + pClassInt->SetVariable( nId, &aBool, NULL, 0, INT1_DATEDAYLEADINDZERO ); + + nId = aNmTb.Put( "DateMonthLeadingZero", VARNAME ); + pClassInt->SetVariable( nId, &aBool, NULL, 0, INT1_DATEMONTHLEADINDZERO ); + + nId = aNmTb.Put( "DateCentury", VARNAME ); + pClassInt->SetVariable( nId, &aBool, NULL, 0, INT1_DATECENTURY ); + + nId = aNmTb.Put( "LongDateFormat", VARNAME ); + pClassInt->SetVariable( nId, pDateFormat, NULL, 0, INT1_LONGDATEFORMAT ); + + nId = aNmTb.Put( "LongDateDayOfWeekFormat", VARNAME ); + pClassInt->SetVariable( nId, pDayOfWeekFormat, NULL, 0, + INT1_LONGDATEDAYOFWEEKFORMAT ); + + nId = aNmTb.Put( "LongDateDayOfWeekSep", VARNAME ); + pClassInt->SetVariable( nId, &aString, NULL, 0, INT1_LONGDATEDAYOFWEEKSEP ); + + nId = aNmTb.Put( "LongDateDayLeadingZero", VARNAME ); + pClassInt->SetVariable( nId, &aBool, NULL, 0, + INT1_LONGDATEDAYLEADINGZERO ); + + nId = aNmTb.Put( "LongDateDaySep", VARNAME ); + pClassInt->SetVariable( nId, &aString, NULL, 0, INT1_LONGDATEDAYSEP ); + + nId = aNmTb.Put( "LongDateMonthFormat", VARNAME ); + pClassInt->SetVariable( nId, pMonthFormat, NULL, 0, + INT1_LONGDATEMONTHFORMAT ); + + nId = aNmTb.Put( "LongDateMonthSep", VARNAME ); + pClassInt->SetVariable( nId, &aString, NULL, 0, INT1_LONGDATEMONTHSEP ); + + nId = aNmTb.Put( "LongDateCentury", VARNAME ); + pClassInt->SetVariable( nId, &aBool, NULL, 0, INT1_LONGDATECENTURY ); + + nId = aNmTb.Put( "LongDateYearSep", VARNAME ); + pClassInt->SetVariable( nId, &aString, NULL, 0, INT1_LONGDATEYEARSEP ); + + nId = aNmTb.Put( "TimeFormat", VARNAME ); + pClassInt->SetVariable( nId, pTimeFormat, NULL, 0, INT1_TIMEFORMAT ); + + // Maske voll zweite Struktur anfangen + + return pClassInt; +} + + +/************************************************************************* +|* RscTypCont::InitClassInternational() +*************************************************************************/ +RscTop * RscTypCont::InitClassInternational( RscTop * pSuper, + RscEnum * /*pDateFormat*/, + RscEnum * /*pTimeFormat*/, RscEnum * /*pWeekDayFormat*/, + RscEnum * /*pMonthFormat*/ ) +{ + HASHID nId; + RscTop * pClassInt; + + // Klasse anlegen + nId = pHS->Insert( "International" ); + pClassInt = new RscClass( nId, RSC_INTERNATIONAL, pSuper ); + pClassInt->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + + aNmTb.Put( nId, CLASSNAME, pClassInt ); + + // Variablen anlegen + nId = aNmTb.Put( "TimeLeadingZero", VARNAME ); + pClassInt->SetVariable( nId, &aBool, NULL, 0, INT2_TIMELEADINGZERO ); + + nId = aNmTb.Put( "TimeAM", VARNAME ); + pClassInt->SetVariable( nId, &aString, NULL, 0, INT2_TIMEAM ); + + nId = aNmTb.Put( "TimePM", VARNAME ); + pClassInt->SetVariable( nId, &aString, NULL, 0, INT2_TIMEPM ); + + nId = aNmTb.Put( "NumLeadingZero", VARNAME ); + pClassInt->SetVariable( nId, &aBool, NULL, 0, INT2_NUMLEADINGZERO ); + + nId = aNmTb.Put( "NumDigits", VARNAME ); + pClassInt->SetVariable( nId, &aUShort, NULL, 0, INT2_NUMDIGITS ); + + nId = aNmTb.Put( "CurrPositiveFormat", VARNAME ); + pClassInt->SetVariable( nId, &aUShort, NULL, 0, INT2_CURRPOSITIVEFORMAT ); + + nId = aNmTb.Put( "CurrNegativeFormat", VARNAME ); + pClassInt->SetVariable( nId, &aUShort, NULL, 0, INT2_CURRNEGATIVEFORMAT ); + + nId = aNmTb.Put( "CurrDigits", VARNAME ); + pClassInt->SetVariable( nId, &aUShort, NULL, 0, INT2_CURRDIGITS ); + + nId = aNmTb.Put( "NumTrailingZeros", VARNAME ); + pClassInt->SetVariable( nId, &aBool, NULL, 0, INT2_NUMTRAILINGZEROS ); + + return pClassInt; +} + +/************************************************************************* +|* RscTypCont::InitClassPatternFormatter() +*************************************************************************/ +RscTop * RscTypCont::InitClassPatternFormatter( RscTop * pSuper ) +{ + HASHID nId; + RscTop * pClassPattern; + + // Klasse anlegen + nId = pHS->Insert( "PatternFormatter" ); + pClassPattern = new RscClass( nId, RSC_NOTYPE, pSuper ); + pClassPattern->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + + // Variablen anlegen + nId = aNmTb.Put( "StrictFormat", VARNAME ); + pClassPattern->SetVariable( nId, &aBool, NULL, + 0, PATTERNFORMATTER_STRICTFORMAT ); + nId = aNmTb.Put( "EditMask", VARNAME ); + pClassPattern->SetVariable( nId, &aLangString, NULL, + 0, PATTERNFORMATTER_EDITMASK ); + nId = aNmTb.Put( "LiteralMask", VARNAME ); + pClassPattern->SetVariable( nId, &aLangString, NULL, + 0, PATTERNFORMATTER_LITTERALMASK ); + + return pClassPattern; +} + +/************************************************************************* +|* RscTypCont::InitClassNumericFormatter() +*************************************************************************/ +RscTop * RscTypCont::InitClassNumericFormatter( RscTop * pSuper, + RscTop * pClassI12 ) +{ + HASHID nId; + RscTop * pClassNumeric; + + // Klasse anlegen + nId = pHS->Insert( "NumericFormatter" ); + pClassNumeric = new RscClass( nId, RSC_NOTYPE, pSuper ); + pClassNumeric->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + + // Variablen anlegen + nId = aNmTb.Put( "Minimum", VARNAME ); + pClassNumeric->SetVariable( nId, &aIdLong, NULL, + 0, NUMERICFORMATTER_MIN ); + nId = aNmTb.Put( "Maximum", VARNAME ); + pClassNumeric->SetVariable( nId, &aIdLong, NULL, + 0, NUMERICFORMATTER_MAX ); + nId = aNmTb.Put( "StrictFormat", VARNAME ); + pClassNumeric->SetVariable( nId, &aBool, NULL, + 0, NUMERICFORMATTER_STRICTFORMAT ); + nId = aNmTb.Put( "Intnl", VARNAME ); + pClassNumeric->SetVariable( nId, pClassI12, NULL, + 0, NUMERICFORMATTER_I12 ); + nId = aNmTb.Put( "DecimalDigits", VARNAME ); + pClassNumeric->SetVariable( nId, &aUShort, NULL, + 0, NUMERICFORMATTER_DECIMALDIGITS ); + nId = aNmTb.Put( "Value", VARNAME ); + pClassNumeric->SetVariable( nId, &aIdLong, NULL, + 0, NUMERICFORMATTER_VALUE ); + + return pClassNumeric; +} + +/************************************************************************* +|* RscTypCont::InitClassMetricFormatter() +*************************************************************************/ +RscTop * RscTypCont::InitClassMetricFormatter( RscTop * pSuper, + RscEnum * pFieldUnits ) +{ + HASHID nId; + RscTop * pClassMetric; + + // Klasse anlegen + nId = pHS->Insert( "MetricFormatter" ); + pClassMetric = new RscClass( nId, RSC_NOTYPE, pSuper ); + pClassMetric->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + + // Variablen anlegen + nId = aNmTb.Put( "Unit", VARNAME ); + pClassMetric->SetVariable( nId, pFieldUnits, NULL, + 0, METRICFORMATTER_UNIT ); + nId = aNmTb.Put( "CustomUnitText", VARNAME ); + pClassMetric->SetVariable( nId, &aLangString, NULL, + 0, METRICFORMATTER_CUSTOMUNITTEXT ); + + return pClassMetric; +} + +/************************************************************************* +|* RscTypCont::InitClassCurrencyFormatter() +*************************************************************************/ +RscTop * RscTypCont::InitClassCurrencyFormatter +( + RscTop * pSuper, + RscEnum * /* pFieldUnits */) +{ + HASHID nId; + RscTop * pClassCurrency; + + // Klasse anlegen + nId = pHS->Insert( "CurrencyFormatter" ); + pClassCurrency = new RscClass( nId, RSC_NOTYPE, pSuper ); + pClassCurrency->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + + return pClassCurrency; +} + +/************************************************************************* +|* RscTypCont::InitClassDateFormatter() +*************************************************************************/ +RscTop * RscTypCont::InitClassDateFormatter( RscTop * pSuper, + RscTop * pClassDate, RscTop * pClassI12 ) +{ + HASHID nId; + RscTop * pClassDateF; + + // Klasse anlegen + nId = pHS->Insert( "DateFormatter" ); + pClassDateF = new RscClass( nId, RSC_NOTYPE, pSuper ); + pClassDateF->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + + // Variablen anlegen + nId = aNmTb.Put( "Minimum", VARNAME ); + pClassDateF->SetVariable( nId, pClassDate, NULL, + 0, DATEFORMATTER_MIN ); + nId = aNmTb.Put( "Maximum", VARNAME ); + pClassDateF->SetVariable( nId, pClassDate, NULL, + 0, DATEFORMATTER_MAX ); + nId = aNmTb.Put( "LongFormat", VARNAME ); + pClassDateF->SetVariable( nId, &aBool, NULL, + 0, DATEFORMATTER_LONGFORMAT ); + nId = aNmTb.Put( "StrictFormat", VARNAME ); + pClassDateF->SetVariable( nId, &aBool, NULL, + 0, DATEFORMATTER_STRICTFORMAT ); + nId = aNmTb.Put( "Intnl", VARNAME ); + pClassDateF->SetVariable( nId, pClassI12, NULL, + 0, DATEFORMATTER_I12 ); + nId = aNmTb.Put( "Value", VARNAME ); + pClassDateF->SetVariable( nId, pClassDate, NULL, + 0, DATEFORMATTER_VALUE ); + + return pClassDateF; +} + +/************************************************************************* +|* RscTypCont::InitClassTimeFormatter() +*************************************************************************/ +RscTop * RscTypCont::InitClassTimeFormatter( RscTop * pSuper, + RscTop * pClassTime, RscTop * pClassI12, + RscEnum * pTimeFieldFormat ) +{ + HASHID nId; + RscTop * pClassTimeF; + + // Klasse anlegen + nId = pHS->Insert( "TimeFormatter" ); + pClassTimeF = new RscClass( nId, RSC_NOTYPE, pSuper ); + pClassTimeF->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + + // Variablen anlegen + nId = aNmTb.Put( "Minimum", VARNAME ); + pClassTimeF->SetVariable( nId, pClassTime, NULL, + 0, TIMEFORMATTER_MIN ); + nId = aNmTb.Put( "Maximum", VARNAME ); + pClassTimeF->SetVariable( nId, pClassTime, NULL, + 0, TIMEFORMATTER_MAX ); + nId = aNmTb.Put( "Format", VARNAME ); + pClassTimeF->SetVariable( nId, pTimeFieldFormat, NULL, + 0, TIMEFORMATTER_TIMEFIELDFORMAT ); + nId = aNmTb.Put( "Duration", VARNAME ); + pClassTimeF->SetVariable( nId, &aBool, NULL, + 0, TIMEFORMATTER_DURATION ); + nId = aNmTb.Put( "StrictFormat", VARNAME ); + pClassTimeF->SetVariable( nId, &aBool, NULL, + 0, TIMEFORMATTER_STRICTFORMAT ); + nId = aNmTb.Put( "Intnl", VARNAME ); + pClassTimeF->SetVariable( nId, pClassI12, NULL, + 0, TIMEFORMATTER_I12 ); + nId = aNmTb.Put( "Value", VARNAME ); + pClassTimeF->SetVariable( nId, pClassTime, NULL, + 0, TIMEFORMATTER_VALUE ); + + return pClassTimeF; +} + +/************************************************************************* +|* RscTypCont::InitClassSpinField() +*************************************************************************/ +RscTop * RscTypCont::InitClassSpinField( RscTop * pSuper ) +{ + HASHID nId; + RscTop * pClassSpinField; + + // Klasse anlegen + nId = pHS->Insert( "SpinField" ); + pClassSpinField = new RscClass( nId, RSC_SPINFIELD, pSuper ); + pClassSpinField->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassSpinField ); + + INS_WINBIT(pClassSpinField,Repeat) + INS_WINBIT(pClassSpinField,Spin) + + return pClassSpinField; +} + +/************************************************************************* +|* RscTypCont::InitClassPatternField() +*************************************************************************/ +RscTop * RscTypCont::InitClassPatternField( RscTop * pSuper ) +{ + HASHID nId; + RscTop * pClassPatternField; + + // Klasse anlegen + nId = pHS->Insert( "PatternField" ); + pClassPatternField = new RscClass( nId, RSC_PATTERNFIELD, pSuper ); + pClassPatternField->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassPatternField ); + + return pClassPatternField; +} + +/************************************************************************* +|* RscTypCont::InitClassNumericField() +*************************************************************************/ +RscTop * RscTypCont::InitClassNumericField( RscTop * pSuper ) +{ + HASHID nId; + RscTop * pClassNumericField; + + // Klasse anlegen + nId = pHS->Insert( "NumericField" ); + pClassNumericField = new RscClass( nId, RSC_NUMERICFIELD, pSuper ); + pClassNumericField->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassNumericField ); + + // Variablen anlegen + nId = aNmTb.Put( "First", VARNAME ); + pClassNumericField->SetVariable( nId, &aIdLong, NULL, + 0, NUMERICFIELD_FIRST ); + nId = aNmTb.Put( "Last", VARNAME ); + pClassNumericField->SetVariable( nId, &aIdLong, NULL, + 0, NUMERICFIELD_LAST ); + nId = aNmTb.Put( "SpinSize", VARNAME ); + pClassNumericField->SetVariable( nId, &aIdLong, NULL, + 0, NUMERICFIELD_SPINSIZE ); + + return pClassNumericField; +} + +/************************************************************************* +|* RscTypCont::InitClassMetricField() +*************************************************************************/ +RscTop * RscTypCont::InitClassMetricField( RscTop * pSuper ) +{ + HASHID nId; + RscTop * pClassMetricField; + + // Klasse anlegen + nId = pHS->Insert( "MetricField" ); + pClassMetricField = new RscClass( nId, RSC_METRICFIELD, pSuper ); + pClassMetricField->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassMetricField ); + + // Variablen anlegen + nId = aNmTb.Put( "First", VARNAME ); + pClassMetricField->SetVariable( nId, &aIdLong, NULL, + 0, METRICFIELD_FIRST ); + nId = aNmTb.Put( "Last", VARNAME ); + pClassMetricField->SetVariable( nId, &aIdLong, NULL, + 0, METRICFIELD_LAST ); + nId = aNmTb.Put( "SpinSize", VARNAME ); + pClassMetricField->SetVariable( nId, &aIdLong, NULL, + 0, METRICFIELD_SPINSIZE ); + + return pClassMetricField; +} + +/************************************************************************* +|* RscTypCont::InitClassCurrencyField() +*************************************************************************/ +RscTop * RscTypCont::InitClassCurrencyField +( + const char * pClassName, + USHORT nRT, + RscTop * pSuper +) +{ + HASHID nId; + RscTop * pClassCurrencyField; + + // Klasse anlegen + nId = pHS->Insert( pClassName ); + pClassCurrencyField = new RscClass( nId, nRT, pSuper ); + pClassCurrencyField->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassCurrencyField ); + + // Variablen anlegen + nId = aNmTb.Put( "First", VARNAME ); + pClassCurrencyField->SetVariable( nId, &aIdLong, NULL, + 0, CURRENCYFIELD_FIRST ); + nId = aNmTb.Put( "Last", VARNAME ); + pClassCurrencyField->SetVariable( nId, &aIdLong, NULL, + 0, CURRENCYFIELD_LAST ); + nId = aNmTb.Put( "SpinSize", VARNAME ); + pClassCurrencyField->SetVariable( nId, &aIdLong, NULL, + 0, CURRENCYFIELD_SPINSIZE ); + + return pClassCurrencyField; +} + +/************************************************************************* +|* RscTypCont::InitClassDateField() +*************************************************************************/ +RscTop * RscTypCont::InitClassDateField( RscTop * pSuper, RscTop * pClassDate ) +{ + HASHID nId; + RscTop * pClassDateField; + + // Klasse anlegen + nId = pHS->Insert( "DateField" ); + pClassDateField = new RscClass( nId, RSC_DATEFIELD, pSuper ); + pClassDateField->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassDateField ); + + // Variablen anlegen + nId = aNmTb.Put( "First", VARNAME ); + pClassDateField->SetVariable( nId, pClassDate, NULL, 0, DATEFIELD_FIRST ); + nId = aNmTb.Put( "Last", VARNAME ); + pClassDateField->SetVariable( nId, pClassDate, NULL, 0, DATEFIELD_LAST ); + + return pClassDateField; +} + +/************************************************************************* +|* RscTypCont::InitClassTimeField() +*************************************************************************/ +RscTop * RscTypCont::InitClassTimeField( RscTop * pSuper, RscTop * pClassTime ) +{ + HASHID nId; + RscTop * pClassTimeField; + + // Klasse anlegen + nId = pHS->Insert( "TimeField" ); + pClassTimeField = new RscClass( nId, RSC_TIMEFIELD, pSuper ); + pClassTimeField->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassTimeField ); + + // Variablen anlegen + nId = aNmTb.Put( "First", VARNAME ); + pClassTimeField->SetVariable( nId, pClassTime, NULL, 0, TIMEFIELD_FIRST ); + nId = aNmTb.Put( "Last", VARNAME ); + pClassTimeField->SetVariable( nId, pClassTime, NULL, 0, TIMEFIELD_LAST ); + + return pClassTimeField; +} + +/************************************************************************* +|* RscTypCont::InitClassPatternBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassPatternBox( RscTop * pSuper ) +{ + HASHID nId; + RscTop * pClassPatternBox; + + // Klasse anlegen + nId = pHS->Insert( "PatternBox" ); + pClassPatternBox = new RscClass( nId, RSC_PATTERNBOX, pSuper ); + pClassPatternBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassPatternBox ); + + return pClassPatternBox; +} + +/************************************************************************* +|* RscTypCont::InitClassNumericBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassNumericBox( RscTop * pSuper ) +{ + HASHID nId; + RscTop * pClassNumericBox; + + // Klasse anlegen + nId = pHS->Insert( "NumericBox" ); + pClassNumericBox = new RscClass( nId, RSC_NUMERICBOX, pSuper ); + pClassNumericBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassNumericBox ); + + // Variablen anlegen + + return pClassNumericBox; +} + +/************************************************************************* +|* RscTypCont::InitClassMetricBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassMetricBox( RscTop * pSuper ) +{ + HASHID nId; + RscTop * pClassMetricBox; + + // Klasse anlegen + nId = pHS->Insert( "MetricBox" ); + pClassMetricBox = new RscClass( nId, RSC_METRICBOX, pSuper ); + pClassMetricBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassMetricBox ); + + // Variablen anlegen + + return pClassMetricBox; +} + +/************************************************************************* +|* RscTypCont::InitClassCurrencyBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassCurrencyBox +( + const char * pClassName, + USHORT nRT, + RscTop * pSuper +) +{ + HASHID nId; + RscTop * pClassCurrencyBox; + + // Klasse anlegen + nId = pHS->Insert( pClassName ); + pClassCurrencyBox = new RscClass( nId, nRT, pSuper ); + pClassCurrencyBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassCurrencyBox ); + + // Variablen anlegen + + return pClassCurrencyBox; +} + +/************************************************************************* +|* RscTypCont::InitClassDateBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassDateBox( RscTop * pSuper, + RscTop * /*pClassDate*/ ) +{ + HASHID nId; + RscTop * pClassDateBox; + + // Klasse anlegen + nId = pHS->Insert( "DateBox" ); + pClassDateBox = new RscClass( nId, RSC_DATEBOX, pSuper ); + pClassDateBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassDateBox ); + + // Variablen anlegen + + return pClassDateBox; +} + +/************************************************************************* +|* RscTypCont::InitClassTimeBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassTimeBox( RscTop * pSuper, + RscTop * /*pClassTime*/ ) +{ + HASHID nId; + RscTop * pClassTimeBox; + + // Klasse anlegen + nId = pHS->Insert( "TimeBox" ); + pClassTimeBox = new RscClass( nId, RSC_TIMEBOX, pSuper ); + pClassTimeBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassTimeBox ); + + // Variablen anlegen + + return pClassTimeBox; +} + +/************************************************************************* +|* RscTypCont::InitClassDockWindow() +*************************************************************************/ +RscTop * RscTypCont::InitClassDockingWindow( RscTop * pSuper, + RscEnum * pMapUnit ) +{ + HASHID nId; + RscTop * pClassDockWindow; + + // Klasse anlegen + nId = pHS->Insert( "DockingWindow" ); + pClassDockWindow = new RscClass( nId, RSC_DOCKINGWINDOW, pSuper ); + pClassDockWindow->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassDockWindow ); + + // Variablen anlegen + nId = aNmTb.Put( "_FloatingPosMapMode", VARNAME ); + pClassDockWindow->SetVariable( nId, pMapUnit, NULL, 0, + RSC_DOCKINGWINDOW_XYMAPMODE ); + nId = aNmTb.Put( "_FloatingPosX", VARNAME ); + pClassDockWindow->SetVariable( nId, &aShort, NULL, 0, + RSC_DOCKINGWINDOW_X ); + nId = aNmTb.Put( "_FloatingPosY", VARNAME ); + pClassDockWindow->SetVariable( nId, &aShort, NULL, 0, + RSC_DOCKINGWINDOW_Y ); + nId = aNmTb.Put( "FloatingMode", VARNAME ); + pClassDockWindow->SetVariable( nId, &aBool, NULL, 0, + RSC_DOCKINGWINDOW_FLOATING ); + + INS_WINBIT(pClassDockWindow,Moveable) + INS_WINBIT(pClassDockWindow,Sizeable) + INS_WINBIT(pClassDockWindow,EnableResizing) + INS_WINBIT(pClassDockWindow,Closeable) + INS_WINBIT(pClassDockWindow,HideWhenDeactivate); + INS_WINBIT(pClassDockWindow,Zoomable); + INS_WINBIT(pClassDockWindow,Dockable); + + return pClassDockWindow; +} + +/************************************************************************* +|* RscTypCont::InitClassToolBoxItem() +*************************************************************************/ +RscTop * RscTypCont::InitClassToolBoxItem( RscTop * pSuper, + RscTop * pClassBitmap, + RscTop * pClassImage, + RscEnum * pTriState ) +{ + HASHID nId; + RscTop * pClassToolBoxItem; + + // Klasse anlegen + nId = pHS->Insert( "ToolBoxItem" ); + pClassToolBoxItem = new RscClass( nId, RSC_TOOLBOXITEM, pSuper ); + aNmTb.Put( nId, CLASSNAME, pClassToolBoxItem ); + + // Variablen anlegen + nId = aNmTb.Put( "Identifier", VARNAME ); + pClassToolBoxItem->SetVariable( nId, &aIdNoZeroUShort, NULL, 0, + RSC_TOOLBOXITEM_ID ); + { + RscEnum * pEnum; + + aBaseLst.Insert( + pEnum = new RscEnum( pHS->Insert( "EnumToolBoxItemType" ), + RSC_NOTYPE ), LIST_APPEND ); + SETCONST( pEnum, "TOOLBOXITEM_BUTTON", TOOLBOXITEM_BUTTON ); + SETCONST( pEnum, "TOOLBOXITEM_SPACE", TOOLBOXITEM_SPACE ); + SETCONST( pEnum, "TOOLBOXITEM_SEPARATOR", TOOLBOXITEM_SEPARATOR ); + SETCONST( pEnum, "TOOLBOXITEM_BREAK", TOOLBOXITEM_BREAK ); + + // Variable einfuegen + nId = aNmTb.Put( "Type", VARNAME ); + pClassToolBoxItem->SetVariable( nId, pEnum, NULL, 0, + RSC_TOOLBOXITEM_TYPE ); + } + { + RscFlag * pFlag; + RscClient * pClient; + HASHID nVarId, nAutoCheckId, nRadioCheckId, nCheckableId, nLeftId, nAutoSizeId, nDropDownId; + + aBaseLst.Insert( pFlag = new RscFlag( pHS->Insert( "FlagToolBoxState" ), + RSC_NOTYPE ), + LIST_APPEND ); + + // Konstanten in Tabelle stellen + nCheckableId = pHS->Insert( "TIB_CHECKABLE" ); + SETCONST( pFlag, nCheckableId, TIB_CHECKABLE ); + nAutoCheckId = pHS->Insert( "TIB_AUTOCHECK" ); + SETCONST( pFlag, nAutoCheckId, TIB_AUTOCHECK ); + nRadioCheckId = pHS->Insert( "TIB_RADIOCHECK" ); + SETCONST( pFlag, nRadioCheckId, TIB_RADIOCHECK ); + nLeftId = pHS->Insert( "TIB_LEFT" ); + SETCONST( pFlag, nLeftId, TIB_LEFT ); + nAutoSizeId = pHS->Insert( "TIB_AUTOSIZE" ); + SETCONST( pFlag, nAutoSizeId, TIB_AUTOSIZE ); + nDropDownId = pHS->Insert( "TIB_DROPDOWN" ); + SETCONST( pFlag, nDropDownId, TIB_DROPDOWN ); + + // Variable einfuegen + nVarId = aNmTb.Put( "_ToolBoxItemFlags", VARNAME ); + pClassToolBoxItem->SetVariable( nVarId, pFlag, NULL, + VAR_HIDDEN | VAR_NOENUM, + RSC_TOOLBOXITEM_STATUS ); + + // Clientvariablen einfuegen + aBaseLst.Insert( + pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE, + pFlag, nCheckableId ), LIST_APPEND ); + nId = aNmTb.Put( "Checkable", VARNAME ); + pClassToolBoxItem->SetVariable( nId, pClient, NULL, VAR_NODATAINST, 0, nVarId ); + + aBaseLst.Insert( + pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE, + pFlag, nAutoCheckId ), LIST_APPEND ); + nId = aNmTb.Put( "AutoCheck", VARNAME ); + pClassToolBoxItem->SetVariable( nId, pClient, NULL, VAR_NODATAINST, 0, nVarId ); + + aBaseLst.Insert( + pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE, + pFlag, nRadioCheckId ), LIST_APPEND ); + nId = aNmTb.Put( "RadioCheck", VARNAME ); + pClassToolBoxItem->SetVariable( nId, pClient, NULL, VAR_NODATAINST, 0, nVarId ); + + aBaseLst.Insert( + pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE, + pFlag, nLeftId ), LIST_APPEND ); + nId = aNmTb.Put( "Left", VARNAME ); + pClassToolBoxItem->SetVariable( nId, pClient, NULL, VAR_NODATAINST, 0, nVarId ); + + aBaseLst.Insert( + pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE, + pFlag, nAutoSizeId ), LIST_APPEND ); + nId = aNmTb.Put( "AutoSize", VARNAME ); + pClassToolBoxItem->SetVariable( nId, pClient, NULL, VAR_NODATAINST, 0, nVarId ); + + aBaseLst.Insert( + pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE, + pFlag, nDropDownId ), LIST_APPEND ); + nId = aNmTb.Put( "DropDown", VARNAME ); + pClassToolBoxItem->SetVariable( nId, pClient, NULL, VAR_NODATAINST, 0, nVarId ); + } + nId = aNmTb.Put( "HelpID", VARNAME ); + pClassToolBoxItem->SetVariable( nId, &aIdLong, NULL, 0, + RSC_TOOLBOXITEM_HELPID ); + nId = aNmTb.Put( "Text", VARNAME ); + pClassToolBoxItem->SetVariable( nId, &aLangString, NULL, 0, + RSC_TOOLBOXITEM_TEXT ); + nId = aNmTb.Put( "HelpText", VARNAME ); + pClassToolBoxItem->SetVariable( nId, &aLangString, NULL, 0, + RSC_TOOLBOXITEM_HELPTEXT ); + nId = aNmTb.Put( "ItemBitmap", VARNAME ); + pClassToolBoxItem->SetVariable( nId, pClassBitmap, NULL, 0, + RSC_TOOLBOXITEM_BITMAP ); + nId = aNmTb.Put( "ItemImage", VARNAME ); + pClassToolBoxItem->SetVariable( nId, pClassImage, NULL, 0, + RSC_TOOLBOXITEM_IMAGE ); + nId = aNmTb.Put( "Disable", VARNAME ); + pClassToolBoxItem->SetVariable( nId, &aBool, NULL, 0, + RSC_TOOLBOXITEM_DISABLE ); + + nId = aNmTb.Put( "State", VARNAME ); + pClassToolBoxItem->SetVariable( nId, pTriState, NULL, 0, + RSC_TOOLBOXITEM_STATE ); + nId = aNmTb.Put( "Hide", VARNAME ); + pClassToolBoxItem->SetVariable( nId, &aBool, NULL, 0, + RSC_TOOLBOXITEM_HIDE ); + nId = aNmTb.Put( "Hide", VARNAME ); + pClassToolBoxItem->SetVariable( nId, &aBool, NULL, 0, + RSC_TOOLBOXITEM_HIDE ); + nId = aNmTb.Put( "Command", VARNAME ); + pClassToolBoxItem->SetVariable( nId, &aString, NULL, 0, + RSC_TOOLBOXITEM_COMMAND ); + + return pClassToolBoxItem; +} + +/************************************************************************* +|* RscTypCont::InitClassToolBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassToolBox( RscTop * pSuper, + RscTop * pClassToolBoxItem, + RscTop * pClassImageList ) +{ + HASHID nId; + RscTop * pClassToolBox; + + // Klasse anlegen + nId = pHS->Insert( "ToolBox" ); + pClassToolBox = new RscClass( nId, RSC_TOOLBOX, pSuper ); + pClassToolBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassToolBox ); + + // Variablen anlegen + { + RscEnum * pEnum; + + aBaseLst.Insert( + pEnum = new RscEnum( pHS->Insert( "EnumButtonType" ), + RSC_NOTYPE ), LIST_APPEND ); + SETCONST( pEnum, "BUTTON_SYMBOL", BUTTON_SYMBOL ); + SETCONST( pEnum, "BUTTON_TEXT", BUTTON_TEXT ); + SETCONST( pEnum, "BUTTON_SYMBOLTEXT", BUTTON_SYMBOLTEXT ); + + // Variable einfuegen + nId = aNmTb.Put( "ButtonType", VARNAME ); + pClassToolBox->SetVariable( nId, pEnum, NULL, 0, + RSC_TOOLBOX_BUTTONTYPE ); + } + { + RscEnum * pEnum; + + aBaseLst.Insert( + pEnum = new RscEnum( pHS->Insert( "EnumToolBoxAlign" ), + RSC_NOTYPE ), LIST_APPEND ); + SETCONST( pEnum, "BOXALIGN_TOP", BOXALIGN_TOP ); + SETCONST( pEnum, "BOXALIGN_LEFT", BOXALIGN_LEFT ); + SETCONST( pEnum, "BOXALIGN_RIGHT", BOXALIGN_RIGHT ); + SETCONST( pEnum, "BOXALIGN_BOTTOM", BOXALIGN_BOTTOM ); + + // Variable einfuegen + nId = aNmTb.Put( "Align", VARNAME ); + pClassToolBox->SetVariable( nId, pEnum, NULL, 0, + RSC_TOOLBOX_ALIGN ); + } + nId = aNmTb.Put( "LineCount", VARNAME ); + pClassToolBox->SetVariable( nId, &aIdNoZeroUShort, NULL, 0, + RSC_TOOLBOX_LINECOUNT ); + nId = aNmTb.Put( "FloatingLines", VARNAME ); + pClassToolBox->SetVariable( nId, &aUShort, NULL, 0, + RSC_TOOLBOX_FLOATLINES ); + nId = aNmTb.Put( "Customize", VARNAME ); + pClassToolBox->SetVariable( nId, &aBool, NULL, 0, + RSC_TOOLBOX_CUSTOMIZE ); + nId = aNmTb.Put( "MenuStrings", VARNAME ); + pClassToolBox->SetVariable( nId, &aBool, NULL, 0, + RSC_TOOLBOX_MENUSTRINGS ); + nId = aNmTb.Put( "ItemImageList", VARNAME ); + pClassToolBox->SetVariable( nId, pClassImageList, NULL, 0, + RSC_TOOLBOX_ITEMIMAGELIST ); + { + RscCont * pCont; + + aBaseLst.Insert( pCont = new RscCont( pHS->Insert( "ContToolBoxItem" ), + RSC_NOTYPE ), + LIST_APPEND ); + pCont->SetTypeClass( pClassToolBoxItem ); + nId = aNmTb.Put( "ItemList", VARNAME ); + pClassToolBox->SetVariable( nId, pCont, NULL, 0, + RSC_TOOLBOX_ITEMLIST ); + } + INS_WINBIT(pClassToolBox,Scroll) + INS_WINBIT(pClassToolBox,LineSpacing) + INS_WINBIT(pClassToolBox,RectStyle) + + return pClassToolBox; +} + +/************************************************************************* +|* RscTypCont::InitClassStatusBar() +*************************************************************************/ +RscTop * RscTypCont::InitClassStatusBar( RscTop * pSuper ) +{ + HASHID nId; + RscTop * pClassStatusBar; + + // Klasse anlegen + nId = pHS->Insert( "StatusBar" ); + pClassStatusBar = new RscClass( nId, RSC_STATUSBAR, pSuper ); + pClassStatusBar->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassStatusBar ); + + // Variablen anlegen + INS_WINBIT(pClassStatusBar,Left) + INS_WINBIT(pClassStatusBar,Right) + + return pClassStatusBar; +} + +/************************************************************************* +|* RscTypCont::InitClassMoreButton() +*************************************************************************/ +RscTop * RscTypCont::InitClassMoreButton( RscTop * pSuper, RscEnum * pMapUnit ) +{ + HASHID nId; + RscTop * pClassMoreButton; + + // Klasse anlegen + nId = pHS->Insert( "MoreButton" ); + pClassMoreButton = new RscClass( nId, RSC_MOREBUTTON, pSuper ); + pClassMoreButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassMoreButton ); + + // Variablen anlegen + nId = aNmTb.Put( "State", VARNAME ); + pClassMoreButton->SetVariable( nId, &aBool, NULL, 0, + RSC_MOREBUTTON_STATE ); + nId = aNmTb.Put( "MapUnit", VARNAME ); + pClassMoreButton->SetVariable( nId, pMapUnit, NULL, 0, + RSC_MOREBUTTON_MAPUNIT ); + nId = aNmTb.Put( "Delta", VARNAME ); + pClassMoreButton->SetVariable( nId, &aUShort, NULL, 0, + RSC_MOREBUTTON_DELTA ); + + return pClassMoreButton; +} + +/************************************************************************* +|* RscTypCont::InitClassFloatingWindow() +*************************************************************************/ +RscTop * RscTypCont::InitClassFloatingWindow( RscTop * pSuper, + RscEnum * pMapUnit ) +{ + HASHID nId; + RscTop * pClassFloatingWindow; + + // Klasse anlegen + nId = pHS->Insert( "FloatingWindow" ); + pClassFloatingWindow = new RscClass( nId, RSC_FLOATINGWINDOW, pSuper ); + pClassFloatingWindow->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassFloatingWindow ); + + // Variablen anlegen + nId = aNmTb.Put( "_ZoomInMapMode", VARNAME ); + pClassFloatingWindow->SetVariable( nId, pMapUnit, NULL, 0, + RSC_FLOATINGWINDOW_WHMAPMODE ); + nId = aNmTb.Put( "_ZoomInWidth", VARNAME ); + pClassFloatingWindow->SetVariable( nId, &aShort, NULL, 0, + RSC_FLOATINGWINDOW_WIDTH ); + nId = aNmTb.Put( "_ZoomInHeight", VARNAME ); + pClassFloatingWindow->SetVariable( nId, &aShort, NULL, 0, + RSC_FLOATINGWINDOW_HEIGHT ); + nId = aNmTb.Put( "ZoomIn", VARNAME ); + pClassFloatingWindow->SetVariable( nId, &aBool, NULL, 0, + RSC_FLOATINGWINDOW_ZOOMIN ); + + INS_WINBIT(pClassFloatingWindow,Zoomable) + INS_WINBIT(pClassFloatingWindow,HideWhenDeactivate) + INS_WINBIT(pClassFloatingWindow,EnableResizing) + + return pClassFloatingWindow; +} + +/************************************************************************* +|* RscTypCont::InitClassTabControlItem() +*************************************************************************/ +RscTop * RscTypCont::InitClassTabControlItem( RscTop * pSuper, + RscTop * pClassTabPage ) +{ + HASHID nId; + RscTop * pClassTabControlItem; + + // Klasse anlegen + nId = pHS->Insert( "PageItem" ); + pClassTabControlItem = new RscClass( nId, RSC_TABCONTROLITEM, pSuper ); + aNmTb.Put( nId, CLASSNAME, pClassTabControlItem ); + + // Variablen anlegen + nId = aNmTb.Put( "Identifier", VARNAME ); + pClassTabControlItem->SetVariable( nId, &aIdNoZeroUShort, NULL, 0, + RSC_TABCONTROLITEM_ID ); + nId = aNmTb.Put( "Text", VARNAME ); + pClassTabControlItem->SetVariable( nId, &aLangString, NULL, 0, + RSC_TABCONTROLITEM_TEXT ); + nId = aNmTb.Put( "PageResID", VARNAME ); + pClassTabControlItem->SetVariable( nId, &aIdUShort, NULL, 0, + RSC_TABCONTROLITEM_PAGERESID ); + + return pClassTabControlItem; +} + +/************************************************************************* +|* RscTypCont::InitClassTabControl() +*************************************************************************/ +RscTop * RscTypCont::InitClassTabControl( RscTop * pSuper, + RscTop * pClassTabControlItem ) +{ + HASHID nId; + RscTop * pClassTabControl; + + // Klasse anlegen + nId = pHS->Insert( "TabControl" ); + pClassTabControl = new RscClass( nId, RSC_TABCONTROL, pSuper ); + pClassTabControl->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + aNmTb.Put( nId, CLASSNAME, pClassTabControl ); + + // Variablen anlegen + { + RscCont * pCont; + + aBaseLst.Insert( pCont = new RscCont( pHS->Insert( "ContTabControlItem" ), + RSC_NOTYPE ), + LIST_APPEND ); + pCont->SetTypeClass( pClassTabControlItem ); + nId = aNmTb.Put( "PageList", VARNAME ); + pClassTabControl->SetVariable( nId, pCont, NULL, 0, + RSC_TABCONTROL_ITEMLIST ); + } + + return pClassTabControl; +} + +/************************************************************************* +|* RscTypCont::InitClassSfxFamilyStyleItem() +*************************************************************************/ +RscTop * RscTypCont::InitClassSfxStyleFamilyItem( RscTop * pSuper, + RscTop * pClassBitmap, + RscTop * pClassImage, + RscArray * pStrLst ) +{ + HASHID nId; + RscTop * pClassSfxFamilyStyleItem; + + // Klasse anlegen + nId = pHS->Insert( "SfxStyleFamilyItem" ); + pClassSfxFamilyStyleItem = new RscClass( nId, RSC_SFX_STYLE_FAMILY_ITEM, pSuper ); + aNmTb.Put( nId, CLASSNAME, pClassSfxFamilyStyleItem ); + + nId = aNmTb.Put( "FilterList", VARNAME ); + pClassSfxFamilyStyleItem->SetVariable( nId, pStrLst, NULL, 0, + RSC_SFX_STYLE_ITEM_LIST ); + nId = aNmTb.Put( "StyleBitmap", VARNAME ); + pClassSfxFamilyStyleItem->SetVariable( nId, pClassBitmap, NULL, 0, + RSC_SFX_STYLE_ITEM_BITMAP ); + nId = aNmTb.Put( "Text", VARNAME ); + pClassSfxFamilyStyleItem->SetVariable( nId, &aLangString, NULL, 0, + RSC_SFX_STYLE_ITEM_TEXT ); + nId = aNmTb.Put( "HelpText", VARNAME ); + pClassSfxFamilyStyleItem->SetVariable( nId, &aLangString, NULL, 0, + RSC_SFX_STYLE_ITEM_HELPTEXT ); + { + RscEnum * pSfxStyleFamily; + pSfxStyleFamily = new RscEnum( pHS->Insert( "StyleFamily" ), + RSC_NOTYPE ); + + SETCONST( pSfxStyleFamily, "SFX_STYLE_FAMILY_PARA", SFX_STYLE_FAMILY_PARA ); + SETCONST( pSfxStyleFamily, "SFX_STYLE_FAMILY_CHAR", SFX_STYLE_FAMILY_CHAR ); + SETCONST( pSfxStyleFamily, "SFX_STYLE_FAMILY_FRAME",SFX_STYLE_FAMILY_FRAME); + SETCONST( pSfxStyleFamily, "SFX_STYLE_FAMILY_PAGE", SFX_STYLE_FAMILY_PAGE ); + SETCONST( pSfxStyleFamily, "SFX_STYLE_FAMILY_PSEUDO", SFX_STYLE_FAMILY_PSEUDO ); + aBaseLst.Insert( pSfxStyleFamily ); + + nId = aNmTb.Put( "StyleFamily", VARNAME ); + pClassSfxFamilyStyleItem->SetVariable( nId, pSfxStyleFamily, NULL, 0, + RSC_SFX_STYLE_ITEM_STYLEFAMILY ); + } + nId = aNmTb.Put( "StyleImage", VARNAME ); + pClassSfxFamilyStyleItem->SetVariable( nId, pClassImage, NULL, 0, + RSC_SFX_STYLE_ITEM_IMAGE ); + return pClassSfxFamilyStyleItem; +} + +/************************************************************************* +|* RscTypCont::InitClassSfxTemplateDialogm() +*************************************************************************/ +RscTop * RscTypCont::InitClassSfxTemplateDialog( RscTop * pSuper, + RscTop * pClassFamilyStyleItem ) +{ + HASHID nId; + RscTop * pClassSfxTemplateDialog; + + // Klasse anlegen + nId = pHS->Insert( "SfxStyleFamilies" ); + pClassSfxTemplateDialog = new RscClass( nId, RSC_SFX_STYLE_FAMILIES, pSuper ); + aNmTb.Put( nId, CLASSNAME, pClassSfxTemplateDialog ); + + // Variablen anlegen + { + RscCont * pCont; + + aBaseLst.Insert( pCont = new RscCont( + pHS->Insert( "ContFamilyStyleItem" ), + RSC_NOTYPE ), + LIST_APPEND ); + pCont->SetTypeClass( pClassFamilyStyleItem ); + nId = aNmTb.Put( "StyleFamilyList", VARNAME ); + pClassSfxTemplateDialog->SetVariable( nId, pCont ); + } + + return pClassSfxTemplateDialog; +} + +/************************************************************************* +|* RscTypCont::InitClassSfxSlotInfo() +*************************************************************************/ +RscTop * RscTypCont::InitClassSfxSlotInfo( RscTop * pSuper ) +{ + HASHID nId; + RscTop * pClassSfxSlotInfo; + + // Klasse anlegen + nId = pHS->Insert( "SfxSlotInfo" ); + pClassSfxSlotInfo = new RscClass( nId, RSC_SFX_SLOT_INFO, pSuper ); + aNmTb.Put( nId, CLASSNAME, pClassSfxSlotInfo ); + + nId = aNmTb.Put( "SlotName", VARNAME ); + pClassSfxSlotInfo->SetVariable( nId, &aLangString, NULL, 0, + RSC_SFX_SLOT_INFO_SLOTNAME ); + nId = aNmTb.Put( "HelpText", VARNAME ); + pClassSfxSlotInfo->SetVariable( nId, &aLangString, NULL, 0, + RSC_SFX_SLOT_INFO_HELPTEXT ); + return pClassSfxSlotInfo; +} + + diff --git a/rsc/source/parser/rscinit.cxx b/rsc/source/parser/rscinit.cxx new file mode 100644 index 000000000000..cee22a6cbdca --- /dev/null +++ b/rsc/source/parser/rscinit.cxx @@ -0,0 +1,1037 @@ +/************************************************************************* + * + * $RCSfile: rscinit.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): _______________________________________ + * + * + ************************************************************************/ + +/****************** I N C L U D E S **************************************/ +#pragma hdrstop + +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> + +#include <tools/rc.h> +#include <tools/vclrsc.hxx> + +// Programmabhaengige Includes. +#ifndef _RSCTREE_HXX +#include <rsctree.hxx> +#endif +#ifndef _RSCTOP_HXX +#include <rsctop.hxx> +#endif +#ifndef _RSCRANGE_HXX +#include <rscrange.hxx> +#endif +#ifndef _RSCCONST_HXX +#include <rscconst.hxx> +#endif +#ifndef _RSCFLAG_HXX +#include <rscflag.hxx> +#endif +#ifndef _RSCSTR_HXX +#include <rscstr.hxx> +#endif +#ifndef _RSCCONT_HXX +#include <rsccont.hxx> +#endif +#ifndef _RSCMGR_HXX +#include <rscmgr.hxx> +#endif +#ifndef _RSCCLASS_HXX +#include <rscclass.hxx> +#endif +#ifndef _RSCKEY_HXX +#include <rsckey.hxx> +#endif +#ifndef _RSCDB_HXX +#include <rscdb.hxx> +#endif + +#include "rsclex.hxx" +#include <rscyacc.yxx.h> + +/****************** M a c r o s ******************************************/ +#define INS_WINBIT( pClass, WinBit ) \ + InsWinBit( pClass, #WinBit, n##WinBit##Id ); + +/****************** C O D E **********************************************/ +void NameToVerCtrl( RSCINST & aVersion, RscTop * pClass, + RscTop * pClassString ) +{ + if( pClass ) + { + NameToVerCtrl( aVersion, (RscTop *)pClass->Left(), pClassString ); + { + RSCINST aVI; + RSCINST aStr; + + // Namen in Versionskontrolle einsetzen + aVersion.pClass-> + GetElement( aVersion, RscId( pClass->GetTypId() ), + pClassString, RSCINST(), &aVI ); + aStr = aVI.pClass->GetVariable( aVI, pHS->Insert( "TEXT" ), + RSCINST() ); + aStr.pClass->SetString( aStr, pHS->Get( pClass->GetId() ) ); + } + NameToVerCtrl( aVersion, (RscTop *)pClass->Right(), pClassString ); + } +} + +/************************************************************************* +|* +|* RscTypCont::Init() +|* +|* Beschreibung +|* Ersterstellung MM 22.03.91 +|* Letzte Aenderung MM 27.06.91 +|* +*************************************************************************/ +void RscTypCont::Init() +{ + RscEnum * pDateFormat; + RscEnum * pTimeFormat; + RscEnum * pWeekDayFormat; + RscEnum * pMonthFormat; + RscEnum * pFieldUnits; + RscEnum * pDayOfWeek; + RscEnum * pTimeFieldFormat; + RscEnum * pColor; + RscEnum * pMapUnit; + RscEnum * pKey; + RscEnum * pTriState; + RscEnum * pMessButtons; + RscEnum * pMessDefButton; + RscTupel * pGeometry; + RscArray * pLangGeometry; + RscCont * pStringList; + RscArray * pLangStringList; + RscTupel * pStringTupel; + RscTupel * pStringLongTupel; + RscCont * pStringTupelList; + RscCont * pStringLongTupelList; + RscArray * pLangStringTupelList; + RscArray * pLangStringLongTupelList; + + RscTop * pClassMgr; + RscTop * pClassString; + RscTop * pClassStringArray; + RscTop * pClassBitmap; + RscTop * pClassColor; + RscTop * pClassImage; + RscTop * pClassImageList; + RscTop * pClassWindow; + RscTop * pClassSystemWindow; + RscTop * pClassWorkWindow; + RscTop * pClassDialog; + RscTop * pClassModalDialog; + RscTop * pClassModelessDialog; + RscTop * pClassControl; + RscTop * pClassButton; + RscTop * pClassCheckBox; + RscTop * pClassPushButton; + RscTop * pClassOKButton; + RscTop * pClassCancelButton; + RscTop * pClassHelpButton; + RscTop * pClassRadioButton; + RscTop * pClassImageRadioButton; + RscTop * pClassImageButton; + RscTop * pClassTriStateBox; + RscTop * pClassEdit; + RscTop * pClassMultiLineEdit; + RscTop * pClassScrollBar; + RscTop * pClassListBox; + RscTop * pClassMultiListBox; + RscTop * pClassComboBox; + RscTop * pClassFixedText; + RscTop * pClassFixedBitmap; + RscTop * pClassFixedImage; + RscTop * pClassGroupBox; + RscTop * pClassKeyCode; + RscTop * pLangClassKeyCode; + RscTop * pClassAccelItem; + RscTop * pClassAccel; + RscTop * pClassMenuItem; + RscTop * pClassMenu; + RscTop * pClassMenuButton; + RscTop * pClassMessBox; + RscTop * pClassInfoBox; + RscTop * pClassWarningBox; + RscTop * pClassErrorBox; + RscTop * pClassQueryBox; + RscTop * pClassSplitter; + RscTop * pClassSplitWindow; + RscTop * pClassSpinButton; + RscTop * pClassTime; + RscTop * pClassDate; + RscTop * pClassI12; + RscTop * pLangClassI12; + RscTop * pClassSpinField; + RscTop * pClassPatternField; + RscTop * pClassNumericField; + RscTop * pClassMetricField; + RscTop * pClassCurrencyField; + RscTop * pClassLongCurrencyField; + RscTop * pClassDateField; + RscTop * pClassTimeField; + RscTop * pClassPatternBox; + RscTop * pClassNumericBox; + RscTop * pClassMetricBox; + RscTop * pClassCurrencyBox; + RscTop * pClassLongCurrencyBox; + RscTop * pClassDateBox; + RscTop * pClassTimeBox; + RscTop * pClassDockingWindow; + RscTop * pClassToolBoxItem; + RscTop * pClassToolBox; + RscTop * pClassStatusBar; + RscTop * pClassMoreButton; + RscTop * pClassFloatingWindow; + RscTop * pClassTabPage; + RscTop * pClassTabDialog; + RscTop * pClassTabControlItem; + RscTop * pClassTabControl; + RscTop * pClassFixedLine; + RscTop * pClassScrollBarBox; + RscTop * pClassSfxStyleFamilyItem; + RscTop * pClassSfxTemplateDialog; + RscTop * pClassSfxSlotInfo; + + HASHID nId; + + aNmTb.SetSort( FALSE ); +{ + /********** C O M P I L E R T Y P E N ******************************/ + aNmTb.Put( "LINE", (USHORT)LINE, (long)0 ); + aNmTb.Put( "NOT", (USHORT)NOT, (long)0 ); + aNmTb.Put( "DEFINE", (USHORT)DEFINE, (long)0 ); + aNmTb.Put( "INCLUDE", (USHORT)INCLUDE, (long)0 ); + aNmTb.Put( "DEFAULT", (USHORT)DEFAULT, (long)0 ); + aNmTb.Put( "class", (USHORT)CLASS, (long)0 ); + aNmTb.Put( "extendable", (USHORT)EXTENDABLE, (long)0 ); + aNmTb.Put( "writeifset", (USHORT)WRITEIFSET, (long)0 ); + +/* Werte fuer Aufzaehlungstypen */ + aNmTb.Put( "TRUE", (USHORT)BOOLEAN, (long)TRUE ); + aNmTb.Put( "FALSE", (USHORT)BOOLEAN, (long)FALSE ); + +/* Vordefinierte HilfeId's */ + aNmTb.Put( "HELP_INDEX", (USHORT)NUMBER, HELP_INDEX ); + aNmTb.Put( "HELP_HELPONHELP", (USHORT)NUMBER, HELP_HELPONHELP ); + + aNmTb.Put( "XSCALE", (USHORT)XSCALE , (long)0 ); + aNmTb.Put( "YSCALE", (USHORT)YSCALE , (long)0 ); + aNmTb.Put( "RGB", (USHORT)RGB , (long)0 ); + aNmTb.Put( "POSSIZE", (USHORT)GEOMETRY, (long)0 ); + aNmTb.Put( "POS", (USHORT)POSITION, (long)0 ); + aNmTb.Put( "SIZE", (USHORT)DIMENSION, (long)0 ); + aNmTb.Put( "ZoomInOutputSize", (USHORT)INZOOMOUTPUTSIZE,(long)0 ); + aNmTb.Put( "FloatingPos", (USHORT)FLOATINGPOS, (long)0 ); +} + /********** B A S I S T Y P E N ************************************/ +{ + /********** S H O R T ************************************************/ + aShort.SetRange( -32768, 32767 ); + + /********** U S H O R T **********************************************/ + aUShort.SetRange( 0, 0xFFFF ); + + /********** L O N G **************************************************/ + aLong.SetRange( -0x80000000, 0x7FFFFFFF ); + aEnumLong.SetRange( -0x80000000, 0x7FFFFFFF ); + + /********** I D U S H O R T ******************************************/ + aIdUShort.SetRange( 0, 0xFFFF ); + + /********** I D N O Z E R O U S H O R T ******************************/ + aIdNoZeroUShort.SetRange( 1, 0xFFFF ); + + /********** N O Z E R O S H O R T ************************************/ + aNoZeroShort.SetRange( -32768, 32767 ); + aNoZeroShort.SetOutRange( 0 ); + + /********** R A N G E S H O R T **************************************/ + a1to12Short.SetRange( 1, 12 ); + a0to23Short.SetRange( 0, 23 ); + a1to31Short.SetRange( 1, 31 ); + a0to59Short.SetRange( 0, 59 ); + a0to99Short.SetRange( 0, 99 ); + a0to9999Short.SetRange( 0, 9999 ); + + /********** I D R A N G E ********************************************/ + aIdLong.SetRange( -0x80000000, 0x7FFFFFFF ); +} +{ + /********** W I N B I T S F L A G ************************************/ + // Variablenname fuer WinBits + nWinBitVarId = aNmTb.Put( "_WinBits", VARNAME ); + + // Windows + nBorderId = pHS->Insert( "WB_BORDER" ); + aWinBits.SetConstant( nBorderId, WB_BORDER ); + nHideId = pHS->Insert( "WB_HIDE" ); + aWinBits.SetConstant( nHideId, WB_HIDE ); + nClipChildrenId = pHS->Insert( "WB_CLIPCHILDREN" ); + aWinBits.SetConstant( nClipChildrenId, WB_CLIPCHILDREN ); + nSizeableId = pHS->Insert( "WB_SIZEABLE" ); + aWinBits.SetConstant( nSizeableId, WB_SIZEABLE ); + nMoveableId = pHS->Insert( "WB_MOVEABLE" ); + aWinBits.SetConstant( nMoveableId, WB_MOVEABLE ); + nMinimizeId = pHS->Insert( "WB_MINABLE" ); + aWinBits.SetConstant( nMinimizeId, WB_MINABLE ); + nMaximizeId = pHS->Insert( "WB_MAXABLE" ); + aWinBits.SetConstant( nMaximizeId, WB_MAXABLE ); + nCloseableId = pHS->Insert( "WB_CLOSEABLE" ); + aWinBits.SetConstant( nCloseableId, WB_CLOSEABLE ); + nAppId = pHS->Insert( "WB_APP" ); + aWinBits.SetConstant( nAppId, WB_APP ); + nTabstopId = pHS->Insert( "WB_TABSTOP" ); + aWinBits.SetConstant( nTabstopId, WB_TABSTOP ); + nGroupId = pHS->Insert( "WB_GROUP" ); + aWinBits.SetConstant( nGroupId, WB_GROUP ); + nSysmodalId = pHS->Insert( "WB_SYSMODAL" ); + aWinBits.SetConstant( nSysmodalId, WB_SYSMODAL ); +} +{ + nLeftId = pHS->Insert( "WB_LEFT" ); + aWinBits.SetConstant( nLeftId, WB_LEFT ); + nCenterId = pHS->Insert( "WB_CENTER" ); + aWinBits.SetConstant( nCenterId, WB_CENTER ); + nRightId = pHS->Insert( "WB_RIGHT" ); + aWinBits.SetConstant( nRightId, WB_RIGHT ); + nHscrollId = pHS->Insert( "WB_HSCROLL" ); + aWinBits.SetConstant( nHscrollId, WB_HSCROLL ); + nVscrollId = pHS->Insert( "WB_VSCROLL" ); + aWinBits.SetConstant( nVscrollId, WB_VSCROLL ); + nSortId = pHS->Insert( "WB_SORT" ); + aWinBits.SetConstant( nSortId, WB_SORT ); + nDefaultId = pHS->Insert( "WB_DEFBUTTON" ); + aWinBits.SetConstant( nDefaultId, WB_DEFBUTTON ); + nRepeatId = pHS->Insert( "WB_REPEAT" ); + aWinBits.SetConstant( nRepeatId, WB_REPEAT ); + nSVLookId = pHS->Insert( "WB_SVLOOK" ); + aWinBits.SetConstant( nSVLookId, WB_SVLOOK ); + nDropDownId = pHS->Insert( "WB_DROPDOWN" ); + aWinBits.SetConstant( nDropDownId, WB_DROPDOWN ); + nPassWordId = pHS->Insert( "WB_PASSWORD" ); + aWinBits.SetConstant( nPassWordId, WB_PASSWORD ); + nReadOnlyId = pHS->Insert( "WB_READONLY" ); + aWinBits.SetConstant( nReadOnlyId, WB_READONLY ); + nAutoSizeId = pHS->Insert( "WB_AUTOSIZE" ); + aWinBits.SetConstant( nAutoSizeId, WB_AUTOSIZE ); + nSpinId = pHS->Insert( "WB_SPIN" ); + aWinBits.SetConstant( nSpinId, WB_SPIN ); + nTabControlId = pHS->Insert( "WB_DIALOGCONTROL" ); + aWinBits.SetConstant( nTabControlId, WB_DIALOGCONTROL ); + nSimpleModeId = pHS->Insert( "WB_SIMPLEMODE" ); + aWinBits.SetConstant( nSimpleModeId, WB_SIMPLEMODE ); + nDragId = pHS->Insert( "WB_DRAG" ); + aWinBits.SetConstant( nDragId, WB_DRAG ); + nSaveAsId = pHS->Insert( "WB_SAVEAS" ); + aWinBits.SetConstant( nSaveAsId, WB_SAVEAS ); + nOpenId = pHS->Insert( "WB_OPEN" ); + aWinBits.SetConstant( nOpenId, WB_OPEN ); + nScrollId = pHS->Insert( "WB_SCROLL" ); + aWinBits.SetConstant( nScrollId, WB_SCROLL ); + nZoomableId = pHS->Insert( "WB_ZOOMABLE" ); + aWinBits.SetConstant( nZoomableId, WB_ROLLABLE ); + nHideWhenDeactivateId = pHS->Insert( "WB_HIDEWHENDEACTIVATE" ); + aWinBits.SetConstant( nHideWhenDeactivateId, WB_HIDEWHENDEACTIVATE ); + nAutoHScrollId = pHS->Insert( "WB_AUTOHSCROLL" ); + aWinBits.SetConstant( nAutoHScrollId, WB_AUTOHSCROLL ); + nDDExtraWidthId = pHS->Insert( "WB_DDEXTRAWIDTH" ); + aWinBits.SetConstant( nDDExtraWidthId, WB_DDEXTRAWIDTH ); + nWordBreakId = pHS->Insert( "WB_WORDBREAK" ); + aWinBits.SetConstant( nWordBreakId, WB_WORDBREAK ); + nLeftLabelId = pHS->Insert( "WB_LEFTLABEL" ); + aWinBits.SetConstant( nLeftLabelId, WB_LEFTLABEL ); + nHasLinesId = pHS->Insert( "WB_HASLINES" ); + aWinBits.SetConstant( nHasLinesId, WB_HASLINES ); + nHasButtonsId = pHS->Insert( "WB_HASBUTTONS" ); + aWinBits.SetConstant( nHasButtonsId, WB_HASBUTTONS ); + nRectStyleId = pHS->Insert( "WB_RECTSTYLE" ); + aWinBits.SetConstant( nRectStyleId, WB_RECTSTYLE ); + nLineSpacingId = pHS->Insert( "WB_LINESPACING" ); + aWinBits.SetConstant( nLineSpacingId, WB_LINESPACING ); + nSmallStyleId = pHS->Insert( "WB_SMALLSTYLE" ); + aWinBits.SetConstant( nSmallStyleId, WB_SMALLSTYLE ); + nEnableResizingId = pHS->Insert( "WB_ENABLERESIZING" ); + aWinBits.SetConstant( nEnableResizingId, WB_ENABLERESIZING ); + nDockableId = pHS->Insert( "WB_DOCKABLE" ); + aWinBits.SetConstant( nDockableId, WB_DOCKABLE ); + nScaleId = pHS->Insert( "WB_SCALE" ); + aWinBits.SetConstant( nScaleId, WB_SCALE ); + nIgnoreTabId = pHS->Insert( "WB_IGNORETAB" ); + aWinBits.SetConstant( nIgnoreTabId, WB_IGNORETAB ); + nNoSplitDrawId = pHS->Insert( "WB_NOSPLITDRAW" ); + aWinBits.SetConstant( nNoSplitDrawId, WB_NOSPLITDRAW ); + nTopImageId = pHS->Insert( "WB_TOPIMAGE" ); + aWinBits.SetConstant( nTopImageId, WB_TOPIMAGE ); + nNoLabelId = pHS->Insert( "WB_NOLABEL" ); + aWinBits.SetConstant( nNoLabelId, WB_NOLABEL ); +} +{ + /********** I n i t B a s i c T y p e s **************************/ + InitLangType(); + aBaseLst.Insert( pDateFormat = InitDateFormatType(), LIST_APPEND ); + aBaseLst.Insert( pTimeFormat = InitTimeFormatType(), LIST_APPEND ); + aBaseLst.Insert( pWeekDayFormat = InitWeekDayFormatType(), LIST_APPEND ); + aBaseLst.Insert( pMonthFormat = InitMonthFormatType(), LIST_APPEND ); + aBaseLst.Insert( pFieldUnits = InitFieldUnitsType(), LIST_APPEND ); + aBaseLst.Insert( pDayOfWeek = InitDayOfWeekType(), LIST_APPEND ); + aBaseLst.Insert( pTimeFieldFormat = InitTimeFieldFormat(), LIST_APPEND ); + aBaseLst.Insert( pColor = InitColor(), LIST_APPEND ); + aBaseLst.Insert( pMapUnit = InitMapUnit(), LIST_APPEND ); + aBaseLst.Insert( pKey = InitKey(), LIST_APPEND ); + aBaseLst.Insert( pTriState = InitTriState(), LIST_APPEND ); + aBaseLst.Insert( pMessButtons = InitMessButtons(), LIST_APPEND ); + aBaseLst.Insert( pMessDefButton = InitMessDefButton(), LIST_APPEND ); + + aBaseLst.Insert( pGeometry = InitGeometry(), LIST_APPEND ); + aBaseLst.Insert( pLangGeometry = InitLangGeometry( pGeometry ), + LIST_APPEND ); + aBaseLst.Insert( pStringList = InitStringList(), LIST_APPEND ); + aBaseLst.Insert( pLangStringList = InitLangStringList( pStringList ), + LIST_APPEND ); + aBaseLst.Insert( pStringTupel = InitStringTupel(), LIST_APPEND ); + aBaseLst.Insert( pStringTupelList = InitStringTupelList( pStringTupel ), + LIST_APPEND ); + aBaseLst.Insert( pLangStringTupelList = + InitLangStringTupelList( pStringTupelList ), LIST_APPEND ); + aBaseLst.Insert( pStringLongTupel = InitStringLongTupel(), LIST_APPEND ); + aBaseLst.Insert( pStringLongTupelList = InitStringLongTupelList( pStringLongTupel ), + LIST_APPEND ); + aBaseLst.Insert( pLangStringLongTupelList = + InitLangStringLongTupelList( pStringLongTupelList ), LIST_APPEND ); +} +{ + /********** R E S O U R C E T Y P E N ******************************/ + /********** R S C M G R **********************************************/ + pRoot = pClassMgr = InitClassMgr(); + + /********** V e r s i o n s k o n t r o l l e ************************/ + aVersion.pClass = new RscClass( pHS->Insert( "VersionControl" ), + RSC_VERSIONCONTROL, pClassMgr ); + aVersion = aVersion.pClass->Create( NULL, RSCINST() ); + + /********** S T R I N G **********************************************/ + pClassString = InitClassString( pClassMgr ); + pRoot->Insert( pClassString ); + + // String als Referenzklasse des Basisstrings einsetzen + aString.SetRefClass( pClassString ); + + /********** S T R I N G L I S T **************************************/ + // Klasse anlegen + nId = pHS->Insert( "StringArray" ); + pClassStringArray = new RscClass( nId, RSC_STRINGARRAY, pClassMgr ); + pClassStringArray->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + aNmTb.Put( nId, CLASSNAME, pClassStringArray ); + pRoot->Insert( pClassStringArray ); + + // Variablen anlegen + nId = aNmTb.Put( "ItemList", VARNAME ); + pClassStringArray->SetVariable( nId, pLangStringLongTupelList ); + + /********** B I T M A P **********************************************/ + pClassBitmap = InitClassBitmap( pClassMgr ); + pRoot->Insert( pClassBitmap ); + +} +{ + /********** C O L O R ************************************************/ + pClassColor = InitClassColor( pClassMgr, pColor ); + pRoot->Insert( pClassColor ); + + /********** I M A G E ************************************************/ + pClassImage = InitClassImage( pClassMgr, pClassBitmap, pClassColor ); + pRoot->Insert( pClassImage ); + + /********** I M A G E L I S T ****************************************/ + pClassImageList = InitClassImageList( pClassMgr, pClassBitmap, pClassColor ); + pRoot->Insert( pClassImageList ); + + /********** W I N D O W **********************************************/ + pClassWindow = InitClassWindow( pClassMgr, pMapUnit, + pLangGeometry ); + pRoot->Insert( pClassWindow ); +} +{ + + /********** S Y S T E M W I N D O W **********************************/ + pClassSystemWindow = InitClassSystemWindow( pClassWindow ); + //aBaseLst.Insert( pClassSystemWindow, LIST_APPEND ); + pRoot->Insert( pClassSystemWindow ); + + /********** W O R K W I N D O W **************************************/ + pClassWorkWindow = InitClassWorkWindow( pClassSystemWindow ); + pRoot->Insert( pClassWorkWindow ); + + /********** D I A L O G **********************************************/ + // Klasse anlegen + pClassDialog = new RscClass( pHS->Insert( "Dialog" ), + RSC_DIALOG, pClassSystemWindow ); + pClassDialog->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aBaseLst.Insert( pClassDialog, LIST_APPEND ); + + /********** M O D A L D I A L O G ***********************************/ + // Klasse anlegen + pClassModalDialog = InitClassModalDialog( pClassDialog ); + pRoot->Insert( pClassModalDialog ); + + /********** M O D E L E S S D I A L O G ******************************/ + // Klasse anlegen + pClassModelessDialog = InitClassModelessDialog( pClassDialog ); + pRoot->Insert( pClassModelessDialog ); +} +{ + /********** C O N T R O L ********************************************/ + pClassControl = InitClassControl( pClassWindow ); + pRoot->Insert( pClassControl ); + + /********** B U T T O N **********************************************/ + // Klasse anlegen + nId = pHS->Insert( "Button" ); + pClassButton = new RscClass( nId, RSC_BUTTON, pClassControl ); + pClassButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassButton ); + pRoot->Insert( pClassButton ); + + /********** C H E C K B O X ******************************************/ + // Klasse anlegen + nId = pHS->Insert( "CheckBox" ); + pClassCheckBox = new RscClass( nId, RSC_CHECKBOX, pClassButton ); + pClassCheckBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassCheckBox ); + pRoot->Insert( pClassCheckBox ); + + // Variablen anlegen + nId = aNmTb.Put( "Check", VARNAME ); + pClassCheckBox->SetVariable( nId, &aBool ); + + /********** P U S H B U T T O N **************************************/ + // Klasse anlegen + pClassPushButton = InitClassPushButton( pClassButton ); + pRoot->Insert( pClassPushButton ); + + /********** H E L P B U T T O N **************************************/ + // Klasse anlegen + nId = pHS->Insert( "HelpButton" ); + pClassHelpButton = new RscClass( nId, RSC_HELPBUTTON, + pClassPushButton ); + pClassHelpButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassHelpButton ); + pRoot->Insert( pClassHelpButton ); + + /********** O K B U T T O N ******************************************/ + // Klasse anlegen + nId = pHS->Insert( "OKButton" ); + pClassOKButton = new RscClass( nId, RSC_OKBUTTON, + pClassPushButton ); + pClassOKButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassOKButton ); + pRoot->Insert( pClassOKButton ); + + /********** C A N C E L B U T T O N **********************************/ + // Klasse anlegen + nId = pHS->Insert( "CancelButton" ); + pClassCancelButton = new RscClass( nId, RSC_CANCELBUTTON, + pClassPushButton ); + pClassCancelButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassCancelButton ); + pRoot->Insert( pClassCancelButton ); +} +{ + /********** R A D I O B U T T O N ************************************/ + // Klasse anlegen + nId = pHS->Insert( "RadioButton" ); + pClassRadioButton = new RscClass( nId, RSC_RADIOBUTTON, pClassButton ); + pClassRadioButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassRadioButton ); + pRoot->Insert( pClassRadioButton ); + + // Variablen anlegen + nId = aNmTb.Put( "Check", VARNAME ); + pClassRadioButton->SetVariable( nId, &aBool ); + + /********** I m a g e R a d i o B u t t o n **************************/ + nId = pHS->Insert( "ImageRadioButton" ); + pClassImageRadioButton = InitClassImageRadioButton( pClassRadioButton, + pClassImage ); + pRoot->Insert( pClassImageRadioButton ); + + /********** T R I S T A T E B O X ************************************/ + pClassTriStateBox = InitClassTriStateBox( pClassControl, pTriState ); + pRoot->Insert( pClassTriStateBox ); + + /********** I M A G E B U T T O N ************************************/ + pClassImageButton = InitClassImageButton( pClassPushButton, + pClassImage, pTriState ); + pRoot->Insert( pClassImageButton ); + + /********** E D I T **************************************************/ + pClassEdit = InitClassEdit( pClassControl ); + pRoot->Insert( pClassEdit ); + + /********** M U L T I L I N E E D I T ********************************/ + pClassMultiLineEdit = InitClassMultiLineEdit( pClassEdit ); + pRoot->Insert( pClassMultiLineEdit ); + + /********** S C R O L L B A R ****************************************/ + pClassScrollBar = InitClassScrollBar( pClassControl ); + pRoot->Insert( pClassScrollBar ); + +} +{ + /********** L I S T B O X ********************************************/ + pClassListBox = InitClassListBox( pClassControl, pLangStringLongTupelList ); + pRoot->Insert( pClassListBox ); + + /********** M U L T I L I S T B O X **********************************/ + pClassMultiListBox = InitClassMultiListBox( pClassListBox); + pRoot->Insert( pClassMultiListBox ); + + /********** C O M B O B O X ******************************************/ + pClassComboBox = InitClassComboBox( pClassEdit, pLangStringList ); + pRoot->Insert( pClassComboBox ); + + /********** F I X E D T E X T ****************************************/ + pClassFixedText = InitClassFixedText( pClassControl ); + pRoot->Insert( pClassFixedText ); + + /********** F i x e d B i t m a p ************************************/ + pClassFixedBitmap = InitClassFixedBitmap( pClassControl, pClassBitmap ); + pRoot->Insert( pClassFixedBitmap ); + + /********** F i x e d I m a g e **************************************/ + pClassFixedImage = InitClassFixedImage( pClassControl, pClassImage ); + pRoot->Insert( pClassFixedImage ); + + /********** G R O U P B O X ******************************************/ + // Klasse anlegen + nId = pHS->Insert( "GroupBox" ); + pClassGroupBox = new RscClass( nId, RSC_GROUPBOX, pClassControl ); + pClassGroupBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassGroupBox ); + pRoot->Insert( pClassGroupBox ); + + /********** K E Y C O D E ********************************************/ + pClassKeyCode = InitClassKeyCode( pClassMgr, pKey ); + pRoot->Insert( pClassKeyCode ); + { + pLangClassKeyCode = new RscClassArray( pHS->Insert( "LangKeyCode" ), + RSC_KEYCODE, pClassKeyCode, &aLangType, + &nLangTypeId, &nDfltLangTypeId ); + aBaseLst.Insert( pLangClassKeyCode ); + } + + /********** A C C E L I T E M ***************************************/ + pClassAccelItem = InitClassAccelItem( pClassMgr, pLangClassKeyCode ); + pRoot->Insert( pClassAccelItem ); +} +{ + /********** A C C E L E R A T O R ************************************/ + pClassAccel = InitClassAccel( pClassMgr, pClassAccelItem ); + pRoot->Insert( pClassAccel ); + + /********** A C C E L I T E M ***************************************/ + // pClassAccel ist erst hier definiert + nId = aNmTb.Put( "SubAccelerator", VARNAME ); + pClassAccelItem->SetVariable( nId, pClassAccel, NULL, VAR_SVDYNAMIC, + ACCELITEM_ACCEL ); + + /********** M E N U I T E M ******************************************/ + pClassMenuItem = InitClassMenuItem( pClassMgr, pClassBitmap, + pLangClassKeyCode ); + pRoot->Insert( pClassMenuItem ); + + /********** M E N U **************************************************/ + pClassMenu = InitClassMenu( pClassMgr, pClassMenuItem ); + pRoot->Insert( pClassMenu ); + + /********** M E N U I T E M ******************************************/ + // pClassMenu ist erst hier definiert + nId = aNmTb.Put( "SubMenu", VARNAME ); + pClassMenuItem->SetVariable( nId, pClassMenu, NULL, VAR_SVDYNAMIC, + RSC_MENUITEM_MENU ); + + /********** M E N U B U T T O N **************************************/ + pClassMenuButton = InitClassMenuButton( pClassControl, pClassMenu ); + pRoot->Insert( pClassMenuButton ); + + /********** M E S S A G E B O X **************************************/ + pClassMessBox = InitClassMessBox( pClassMgr, pMessButtons, + pMessDefButton ); + pRoot->Insert( pClassMessBox ); + + /********** I N F O B O X ********************************************/ + // Klasse anlegen + nId = pHS->Insert( "InfoBox" ); + pClassInfoBox = new RscClass( nId, RSC_INFOBOX, pClassMessBox ); + pClassInfoBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassInfoBox ); + pRoot->Insert( pClassInfoBox ); + + /********** W A R N I N G B O X **************************************/ + // Klasse anlegen + nId = pHS->Insert( "WarningBox" ); + pClassWarningBox = new RscClass( nId, RSC_WARNINGBOX, pClassMessBox ); + pClassWarningBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassWarningBox ); + pRoot->Insert( pClassWarningBox ); + + /********** E R R O R B O X ******************************************/ + // Klasse anlegen + nId = pHS->Insert( "ErrorBox" ); + pClassErrorBox = new RscClass( nId, RSC_ERRORBOX, pClassMessBox ); + pClassErrorBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassErrorBox ); + pRoot->Insert( pClassErrorBox ); + + /********** Q U E R Y B O X ******************************************/ + // Klasse anlegen + nId = pHS->Insert( "QueryBox" ); + pClassQueryBox = new RscClass( nId, RSC_QUERYBOX, pClassMessBox ); + pClassQueryBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassQueryBox ); + pRoot->Insert( pClassQueryBox ); +} +{ + /********** S P L I T T E R ******************************************/ + pClassSplitter = InitClassSplitter( pClassWindow ); + pRoot->Insert( pClassSplitter ); + + /********** S P L I T W I N D O W ************************************/ + pClassSplitWindow = InitClassSplitWindow( pClassWindow ); + pRoot->Insert( pClassSplitWindow ); + + /********** S P I N B U T T O N **************************************/ + // Klasse anlegen + nId = pHS->Insert( "SpinButton" ); + pClassSpinButton = new RscClass( nId, RSC_SPINBUTTON, pClassControl ); + pClassSpinButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassSpinButton ); + { + RscClient * pClient; + + // Clientvariablen einfuegen + // Sysmodal + aBaseLst.Insert( + pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE, + &aWinBits, nRepeatId ), + LIST_APPEND ); + nId = aNmTb.Put( "Repeat", VARNAME ); + pClassSpinButton->SetVariable( nId, pClient, NULL, + VAR_NODATAINST, 0, nWinBitVarId ); + } + pRoot->Insert( pClassSpinButton ); +} +{ + /********** T I M E **************************************************/ + pClassTime = InitClassTime( pClassMgr ); + pRoot->Insert( pClassTime ); + + /********** D A T E **************************************************/ + pClassDate = InitClassDate( pClassMgr, pDayOfWeek ); + pRoot->Insert( pClassDate ); +} +{ + /********** I N T E R N A T I O N A L ********************************/ + { + RscTop * pClassInt1; + + pClassInt1 = InitClassInt1( pClassMgr, + pDateFormat, pTimeFormat, + pWeekDayFormat, pMonthFormat ); + aBaseLst.Insert( pClassInt1, LIST_APPEND ); + pClassI12 = InitClassInternational( pClassInt1, + pDateFormat, pTimeFormat, + pWeekDayFormat, pMonthFormat ); + pRoot->Insert( pClassI12 ); + } + { + pLangClassI12 = new RscClassArray( pHS->Insert( "LangInternational" ), + RSC_INTERNATIONAL, pClassI12, &aLangType, + &nLangTypeId, &nDfltLangTypeId ); + aBaseLst.Insert( pLangClassI12 ); + } + + /********** S P I N F I E L D ****************************************/ + pClassSpinField = InitClassSpinField( pClassEdit ); + pRoot->Insert( pClassSpinField ); +} +{ + /********** P A T T E R N F I E L D **********************************/ + { // Mehrfachvererbung von Hand + RscTop * pClassTmp = InitClassPatternFormatter( pClassSpinField ); + aBaseLst.Insert( pClassTmp, LIST_APPEND ); + + pClassPatternField = InitClassPatternField( pClassTmp ); + pRoot->Insert( pClassPatternField ); + } + /********** N U M E R I C F I E L D **********************************/ + { // Mehrfachvererbung von Hand + RscTop * pClassTmp = InitClassNumericFormatter( pClassSpinField, + pClassI12 ); + aBaseLst.Insert( pClassTmp, LIST_APPEND ); + + pClassNumericField = InitClassNumericField( pClassTmp ); + pRoot->Insert( pClassNumericField ); + } + /********** M E T R I C F I E L D ************************************/ + { // Mehrfachvererbung von Hand + RscTop * pClassTmp = InitClassNumericFormatter( pClassSpinField, + pClassI12 ); + aBaseLst.Insert( pClassTmp, LIST_APPEND ); + pClassTmp = InitClassMetricFormatter( pClassTmp, pFieldUnits ); + aBaseLst.Insert( pClassTmp, LIST_APPEND ); + + pClassMetricField = InitClassMetricField( pClassTmp ); + pRoot->Insert( pClassMetricField ); + } + /********** C U R R E N C Y F I E L D ********************************/ + { // Mehrfachvererbung von Hand + RscTop * pClassTmp = InitClassNumericFormatter( pClassSpinField, + pClassI12 ); + aBaseLst.Insert( pClassTmp, LIST_APPEND ); + pClassTmp = InitClassCurrencyFormatter( pClassTmp, pFieldUnits ); + aBaseLst.Insert( pClassTmp, LIST_APPEND ); + + pClassCurrencyField = InitClassCurrencyField( "CurrencyField", RSC_CURRENCYFIELD, pClassTmp ); + pRoot->Insert( pClassCurrencyField ); + + pClassLongCurrencyField = InitClassCurrencyField( "LongCurrencyField", RSC_LONGCURRENCYFIELD, pClassTmp ); + pRoot->Insert( pClassLongCurrencyField ); + + } + /********** D A T E F I E L D ****************************************/ + { // Mehrfachvererbung von Hand + RscTop * pClassTmp = InitClassDateFormatter( pClassSpinField, pClassDate, + pClassI12 ); + aBaseLst.Insert( pClassTmp, LIST_APPEND ); + + pClassDateField = InitClassDateField( pClassTmp, pClassDate ); + pRoot->Insert( pClassDateField ); + } + /********** T I M E F I E L D ****************************************/ + { // Mehrfachvererbung von Hand + RscTop * pClassTmp = InitClassTimeFormatter( pClassSpinField, pClassTime, + pClassI12, pTimeFieldFormat ); + aBaseLst.Insert( pClassTmp, LIST_APPEND ); + + pClassTimeField = InitClassTimeField( pClassTmp, pClassTime ); + pRoot->Insert( pClassTimeField ); + } + /********** P A T T E R N B O X **************************************/ + { // Mehrfachvererbung von Hand + RscTop * pClassTmp = InitClassPatternFormatter( pClassComboBox ); + aBaseLst.Insert( pClassTmp, LIST_APPEND ); + + pClassPatternBox = InitClassPatternBox( pClassTmp ); + pRoot->Insert( pClassPatternBox ); + } + /********** N U M E R I C B O X **************************************/ + { // Mehrfachvererbung von Hand + RscTop * pClassTmp = InitClassNumericFormatter( pClassComboBox, + pClassI12 ); + aBaseLst.Insert( pClassTmp, LIST_APPEND ); + + pClassNumericBox = InitClassNumericBox( pClassTmp ); + pRoot->Insert( pClassNumericBox ); + } +} +{ + /********** M E T R I C B O X ****************************************/ + { // Mehrfachvererbung von Hand + RscTop * pClassTmp = InitClassNumericFormatter( pClassComboBox, + pClassI12 ); + aBaseLst.Insert( pClassTmp, LIST_APPEND ); + pClassTmp = InitClassMetricFormatter( pClassTmp, pFieldUnits ); + aBaseLst.Insert( pClassTmp, LIST_APPEND ); + + pClassMetricBox = InitClassMetricBox( pClassTmp ); + pRoot->Insert( pClassMetricBox ); + } + /********** C U R R E N C Y B O X ************************************/ + { // Mehrfachvererbung von Hand + RscTop * pClassTmp = InitClassNumericFormatter( pClassComboBox, + pClassI12 ); + aBaseLst.Insert( pClassTmp, LIST_APPEND ); + pClassTmp = InitClassCurrencyFormatter( pClassTmp, pFieldUnits ); + aBaseLst.Insert( pClassTmp, LIST_APPEND ); + + pClassCurrencyBox = InitClassCurrencyBox( "CurrencyBox", RSC_CURRENCYBOX, pClassTmp ); + pRoot->Insert( pClassCurrencyBox ); + + pClassLongCurrencyBox = InitClassCurrencyBox( "LongCurrencyBox", RSC_LONGCURRENCYBOX, pClassTmp ); + pRoot->Insert( pClassLongCurrencyBox ); + } + /********** D A T E B O X ********************************************/ + { // Mehrfachvererbung von Hand + RscTop * pClassTmp = InitClassDateFormatter( pClassComboBox, pClassDate, + pClassI12 ); + aBaseLst.Insert( pClassTmp, LIST_APPEND ); + + pClassDateBox = InitClassDateBox( pClassTmp, pClassDate ); + pRoot->Insert( pClassDateBox ); + } + /********** T I M E B O X ********************************************/ + { // Mehrfachvererbung von Hand + RscTop * pClassTmp = InitClassTimeFormatter( pClassComboBox, pClassTime, + pClassI12, pTimeFieldFormat ); + aBaseLst.Insert( pClassTmp, LIST_APPEND ); + + pClassTimeBox = InitClassTimeBox( pClassTmp, pClassTime ); + pRoot->Insert( pClassTimeBox ); + } + /********** D O C K I N G W I N D O W ********************************/ + pClassDockingWindow = InitClassDockingWindow( pClassWindow, pMapUnit ); + pRoot->Insert( pClassDockingWindow ); + + /********** T O O L B O X I T E M ************************************/ + pClassToolBoxItem = InitClassToolBoxItem( pClassMgr, pClassBitmap, + pClassImage, pTriState ); + pRoot->Insert( pClassToolBoxItem ); + + /********** T O O L B O X ********************************************/ + pClassToolBox = InitClassToolBox( pClassDockingWindow, pClassToolBoxItem, + pClassImageList ); + pRoot->Insert( pClassToolBox ); + + /********** S T A T U S B A R ****************************************/ + pClassStatusBar = InitClassStatusBar( pClassWindow ); + pRoot->Insert( pClassStatusBar ); + + /********** M O R E B U T T O N **************************************/ + pClassMoreButton = InitClassMoreButton( pClassPushButton, pMapUnit ); + pRoot->Insert( pClassMoreButton ); + + /********** F L O A T W I N D O W ************************************/ + pClassFloatingWindow = InitClassFloatingWindow( pClassSystemWindow, + pMapUnit ); + pRoot->Insert( pClassFloatingWindow ); + + /********** T A B P A G E ********************************************/ + // Klasse anlegen + nId = pHS->Insert( "TabPage" ); + pClassTabPage = + new RscClass( nId, RSC_TABPAGE, pClassWindow ); + pClassTabPage->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassTabPage ); + pRoot->Insert( pClassTabPage ); + + /********** T A B D I A L O G ****************************************/ + // Klasse anlegen + nId = pHS->Insert( "TabDialog" ); + pClassTabDialog = + new RscClass( nId, RSC_TABDIALOG, pClassModalDialog ); + pClassTabDialog->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassTabDialog ); + pRoot->Insert( pClassTabDialog ); + + /********** T A B C O N T R O L I T E M *******************************/ + pClassTabControlItem = InitClassTabControlItem( pClassMgr, + pClassTabPage ); + pRoot->Insert( pClassTabControlItem ); + + /********** T A B C O N T R O L **************************************/ + pClassTabControl = InitClassTabControl( pClassControl, + pClassTabControlItem ); + pRoot->Insert( pClassTabControl ); + + /********** F I X E D L I N E ****************************************/ + // Klasse anlegen + nId = pHS->Insert( "FixedLine" ); + pClassFixedLine = + new RscClass( nId, RSC_FIXEDLINE, pClassControl ); + pClassFixedLine->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassFixedLine ); + pRoot->Insert( pClassFixedLine ); + + /********** S C R O L L B A R B O X **********************************/ + // Klasse anlegen + nId = pHS->Insert( "ScrollBarBox" ); + pClassScrollBarBox = + new RscClass( nId, RSC_SCROLLBARBOX, pClassWindow ); + pClassScrollBarBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassScrollBarBox ); + pRoot->Insert( pClassScrollBarBox ); + INS_WINBIT(pClassScrollBarBox,Sizeable) + + /********** S F X S T Y L E F A M I L Y I T E M **********************/ + pClassSfxStyleFamilyItem = InitClassSfxStyleFamilyItem( pClassMgr, + pClassBitmap, + pClassImage, + pLangStringLongTupelList ); + pRoot->Insert( pClassSfxStyleFamilyItem ); + + /********** S F X T E M P L A T E D I A L O G ************************/ + pClassSfxTemplateDialog = InitClassSfxTemplateDialog( pClassMgr, + pClassSfxStyleFamilyItem ); + pRoot->Insert( pClassSfxTemplateDialog ); + + /********** S F X I N F O I T E M ************************************/ + pClassSfxSlotInfo = InitClassSfxSlotInfo( pClassMgr ); + pRoot->Insert( pClassSfxSlotInfo ); +} + NameToVerCtrl( aVersion, pRoot, pClassString ); + + aNmTb.SetSort(); +} + diff --git a/rsc/source/parser/rsckey.cxx b/rsc/source/parser/rsckey.cxx new file mode 100644 index 000000000000..43a40e89ad66 --- /dev/null +++ b/rsc/source/parser/rsckey.cxx @@ -0,0 +1,297 @@ +/************************************************************************* + * + * $RCSfile: rsckey.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/rsckey.cxx,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.13 2000/09/17 12:51:11 willem.vandorp + OpenOffice header added. + + Revision 1.12 2000/07/26 17:13:21 willem.vandorp + Headers/footers replaced + + Revision 1.11 1999/10/25 11:48:18 mh + changes for VC6 + + Revision 1.10 1997/08/27 18:17:12 MM + neue Headerstruktur + + + Rev 1.9 27 Aug 1997 18:17:12 MM + neue Headerstruktur + + Rev 1.8 03 Jan 1997 17:07:16 MH + Calling Convention + + Rev 1.7 12 Jan 1996 17:23:40 TRI + WNTWTC Anpassung + + Rev 1.6 21 Nov 1995 19:49:48 TLX + Neuer Link + + Rev 1.5 27 Jul 1995 16:57:36 MM + LongEnumRange + + Rev 1.4 16 Feb 1995 19:51:06 MM + char * -> const char * + +**************************************************************************/ +/****************** I N C L U D E S **************************************/ +#pragma hdrstop + +#include <stdlib.h> +#include <stdio.h> +#include <ctype.h> +#include <string.h> + +#ifndef _RSCALL_H +#include <rscall.h> +#endif +#ifndef _RSCTOOLS_HXX +#include <rsctools.hxx> +#endif +#ifndef _RSCHASH_HXX +#include <rschash.hxx> +#endif +#ifndef _RSCKEY_HXX +#include <rsckey.hxx> +#endif + +#if defined(_MSC_VER) && (_MSC_VER >= 1200 ) +#define _cdecl __cdecl +#endif + +/****************** C o d e **********************************************/ +/****************** keyword sort function ********************************/ +extern "C" { +#if defined( ZTC ) && defined( PM2 ) + int __CLIB KeyCompare( const void * pFirst, const void * pSecond ); +#else +#if defined( WNT ) && !defined( WTC ) && !defined (ICC) + int _cdecl KeyCompare( const void * pFirst, const void * pSecond ); +#else + int KeyCompare( const void * pFirst, const void * pSecond ); +#endif +#endif +} + +#if defined( WNT ) && !defined( WTC ) && !defined(ICC) +int _cdecl KeyCompare( const void * pFirst, const void * pSecond ){ +#else +int KeyCompare( const void * pFirst, const void * pSecond ){ +#endif + if( ((KEY_STRUCT *)pFirst)->nName > ((KEY_STRUCT *)pSecond)->nName ) + return( 1 ); + else if( ((KEY_STRUCT *)pFirst)->nName < ((KEY_STRUCT *)pSecond)->nName ) + return( -1 ); + else + return( 0 ); +} + +/************************************************************************* +|* +|* RscNameTable::RscNameTable() +|* +|* Beschreibung RES.DOC +|* Ersterstellung MM 28.02.91 +|* Letzte Aenderung MM 28.02.91 +|* +*************************************************************************/ +RscNameTable::RscNameTable() { + bSort = TRUE; + nEntries = 0; + pTable = NULL; +}; + +/************************************************************************* +|* +|* RscNameTable::~RscNameTable() +|* +|* Beschreibung +|* Ersterstellung MM 15.05.91 +|* Letzte Aenderung MM 15.05.91 +|* +*************************************************************************/ +RscNameTable::~RscNameTable() { + if( pTable ) + RscMem::Free( pTable ); +}; + + +/************************************************************************* +|* +|* RscNameTable::SetSort() +|* +|* Beschreibung RES.DOC +|* Ersterstellung MM 28.02.91 +|* Letzte Aenderung MM 28.02.91 +|* +*************************************************************************/ +void RscNameTable::SetSort( BOOL bSorted ){ + bSort = bSorted; + if( bSort && pTable){ + // Schluesselwort Feld sortieren + qsort( (void *)pTable, nEntries, + sizeof( KEY_STRUCT ), KeyCompare ); + }; +}; + +/************************************************************************* +|* +|* RscNameTable::Put() +|* +|* Beschreibung RES.DOC +|* Ersterstellung MM 28.02.91 +|* Letzte Aenderung MM 28.02.91 +|* +*************************************************************************/ +HASHID RscNameTable::Put( HASHID nName, USHORT nTyp, long nValue ){ + if( pTable ) + pTable = (KEY_STRUCT *) + RscMem::Realloc( (void *)pTable, + (USHORT)((nEntries +1) * sizeof( KEY_STRUCT )) ); + else + pTable = (KEY_STRUCT *) + RscMem::Malloc( (USHORT)((nEntries +1) + * sizeof( KEY_STRUCT )) ); + pTable[ nEntries ].nName = nName; + pTable[ nEntries ].nTyp = nTyp; + pTable[ nEntries ].yylval = nValue; + nEntries++; + if( bSort ) + SetSort(); + return( nName ); +}; + +HASHID RscNameTable::Put( const char * pName, USHORT nTyp, long nValue ) +{ + return( Put( pHS->Insert( pName ), nTyp, nValue ) ); +}; + +HASHID RscNameTable::Put( HASHID nName, USHORT nTyp ) +{ + return( Put( nName, nTyp, (long)nName ) ); +}; + +HASHID RscNameTable::Put( const char * pName, USHORT nTyp ) +{ + HASHID nId; + + nId = pHS->Insert( pName ); + return( Put( nId, nTyp, (long)nId ) ); +}; + +HASHID RscNameTable::Put( HASHID nName, USHORT nTyp, RscTop * pClass ) +{ + return( Put( nName, nTyp, (long)pClass ) ); +}; + +HASHID RscNameTable::Put( const char * pName, USHORT nTyp, RscTop * pClass ) +{ + return( Put( pHS->Insert( pName ), nTyp, (long)pClass ) ); +}; + +/************************************************************************* +|* +|* RscNameTable::Get() +|* +|* Beschreibung RES.DOC +|* Ersterstellung MM 28.02.91 +|* Letzte Aenderung MM 28.02.91 +|* +*************************************************************************/ +BOOL RscNameTable::Get( HASHID nName, KEY_STRUCT * pEle ){ + KEY_STRUCT * pKey = NULL; + KEY_STRUCT aSearchName; + USHORT i; + + if( bSort ){ + // Suche nach dem Schluesselwort + aSearchName.nName = nName; + pKey = (KEY_STRUCT *)bsearch( +#ifdef UNX + (const char *) &aSearchName, (char *)pTable, +#else + (const void *) &aSearchName, (const void *)pTable, +#endif + nEntries, sizeof( KEY_STRUCT ), KeyCompare ); + } + else{ + i = 0; + while( i < nEntries && !pKey ){ + if( pTable[ i ].nName == nName ) + pKey = &pTable[ i ]; + i++; + }; + }; + + if( pKey ){ // Schluesselwort gefunden + *pEle = *pKey; + return( TRUE ); + }; + return( FALSE ); +}; + diff --git a/rsc/source/parser/rsclex.cxx b/rsc/source/parser/rsclex.cxx new file mode 100644 index 000000000000..33a14d309d57 --- /dev/null +++ b/rsc/source/parser/rsclex.cxx @@ -0,0 +1,588 @@ +/************************************************************************* + * + * $RCSfile: rsclex.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/rsclex.cxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $ + +**************************************************************************/ +#pragma hdrstop +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <ctype.h> +#include <limits.h> + +#ifdef _RSCERROR_H +#include <rscerror.h> +#endif +#ifndef _RSCHASH_HXX +#include <rschash.hxx> +#endif +#ifndef _RSCDB_HXX +#include <rscdb.hxx> +#endif +#ifndef _RSCTOP_HXX +#include <rsctop.hxx> +#endif +#ifndef _RSCKEY_HXX +#include <rsckey.hxx> +#endif +#ifndef _RSCPAR_HXX +#include <rscpar.hxx> +#endif +#ifndef _RSCDEF_HXX +#include <rscdef.hxx> +#endif + +#include "rsclex.hxx" +#include <rscyacc.yxx.h> + +#include <rtl/textcvt.h> +#include <rtl/textenc.h> + +DECLARE_LIST( RscCharList, char * ); +/*************************************************************************/ +int c; +BOOL bLastInclude;// War letztes Symbol INCLUDE +RscFileInst* pFI; +RscTypCont* pTC; +RscCharStack * pCS; +RscExpression * pExp; +struct { + int nKeyWord; + YYSTYPE aYYSType; +} aKeyVal[ 1 ]; +BOOL bTargetDefined; + + +/****************** C O D E **********************************************/ +ULONG GetNumber(){ + ULONG l = 0; + short nLog = 10; + + if( '0' == c ){ + c = pFI->GetFastChar(); + if( 'x' == c ){ + nLog = 16; + c = pFI->GetFastChar(); + } + }; + + if( nLog == 16 ){ + while( isxdigit( c ) ){ + if( isdigit( c ) ) + l = l * nLog + (c - '0'); + else + l = l * nLog + (toupper( c ) - 'A' + 10 ); + c = pFI->GetFastChar(); + } + } + else{ + while( isdigit( c ) || 'x' == c ){ + l = l * nLog + (c - '0'); + c = pFI->GetFastChar(); + } + } + + while( c=='U' || c=='u' || c=='l' || c=='L' ) //Wg. Unsigned Longs + c = pFI->GetFastChar(); + + if( l > LONG_MAX ) //Oberstes bit gegebenenfalls abschneiden; + l &= LONG_MAX; + + return( l ); +} + +char * MallocString(){ + char * pRet; + + if( NULL == (pRet = pCS->Pop()) ) + pRet = (char *)RscMem::Malloc( MINBUF ); + + *pRet = '\0'; + + return( pRet ); +} + +void PutStringBack( char * pStr ){ + //pCS->Push( pStr ); +} + +int MakeToken( YYSTYPE * pTokenVal ){ + int c1; + USHORT i; + char * pStr; + + while( TRUE ){ // Kommentare und Leerzeichen ueberlesen + while( isspace( c ) ) + c = pFI->GetFastChar(); + if( '/' == c ){ + c1 = c; + c = pFI->GetFastChar(); + if( '/' == c ){ + while( '\n' != c && !pFI->IsEof() ) + c = pFI->GetFastChar(); + c = pFI->GetFastChar(); + } + else if( '*' == c ){ + c = pFI->GetFastChar(); + do { + while( '*' != c && !pFI->IsEof() ) + c = pFI->GetFastChar(); + c = pFI->GetFastChar(); + } while( '/' != c && !pFI->IsEof() ); + c = pFI->GetFastChar(); + } + else + return( c1 ); + } + else + break; + }; + + if( c == pFI->IsEof() ){ + return( 0 ); + } + + if( bLastInclude ){ + bLastInclude = FALSE; //Zuruecksetzten + if( '<' == c ){ + USHORT nBufLen = MINBUF; + char * pBuf = MallocString(); + + i = 0; + c = pFI->GetFastChar(); + while( '>' != c && !pFI->IsEof() ) + { + if( nBufLen <= (USHORT)(i +1) ) + { + nBufLen += MINBUF; + pBuf = (char *)RscMem::Realloc( pBuf, nBufLen ); + } + pBuf[i++] = c; + c = pFI->GetFastChar(); + }; + c = pFI->GetFastChar(); + pBuf[i] = '\0'; + pTokenVal->string = pBuf; + return( INCLUDE_STRING ); + }; + } + + if( c == '"' ) + { + USHORT nBufLen = MINBUF; + char * pBuf = MallocString(); + + i = 0; + BOOL bDone = FALSE; + while( !bDone && !pFI->IsEof() && c ) + { + if( nBufLen <= (USHORT)(i +2) ) + { + nBufLen += MINBUF; + pBuf = (char *)RscMem::Realloc( pBuf, nBufLen ); + } + c = pFI->GetFastChar(); + if( c == '"' ) + { + c = pFI->GetFastChar(); + if( c == '"' ) + { + pBuf[i++] = '"'; + pBuf[i++] = '"'; + } + else + bDone = TRUE; + } + else if( c == '\\' ) + { + pBuf[i++] = '\\'; + c = pFI->GetFastChar(); + if( c ) + { + pBuf[i++] = c; + } + } + else + pBuf[i++] = c; + } + pBuf[i++] = '\0'; + //pStr = pTokenVal->string = RscChar::MakeUTF8( pBuf, pFI->GetCharSet() ); + pStr = pTokenVal->string = pBuf; + //PutStringBack( pBuf ); + return( STRING ); + } + if (isdigit (c)){ + pTokenVal->value = GetNumber(); + return( NUMBER ); + } + + if( isalpha (c) || (c == '_') ){ + HASHID nHashId; + USHORT nBufLen = MINBUF; + char * pBuf = MallocString(); + + + i = 0; + while( isalnum (c) || (c == '_') ) + { + if( nBufLen <= (USHORT)(i +1) ) + { + nBufLen += MINBUF; + pBuf = (char *)RscMem::Realloc( pBuf, nBufLen ); + } + pBuf[i++] = c; + c = pFI->GetFastChar(); + } + /* + if( pBuf[0] == 'L' && i == 1 && c == '"' ) + { + // it is an L string + + i = 0; + BOOL bDone = FALSE; + while( !bDone && !pFI->IsEof() && c ) + { + if( nBufLen <= (USHORT)(i +2) ) + { + nBufLen += MINBUF; + pBuf = (char *)RscMem::Realloc( pBuf, nBufLen ); + } + c = pFI->GetFastChar(); + if( c == '"' ) + { + c = pFI->GetFastChar(); + if( c == '"' ) + { + pBuf[i++] = '"'; + pBuf[i++] = '"'; + } + else + bDone = TRUE; + } + else if( c == '\\' ) + { + pBuf[i++] = '\\'; + c = pFI->GetFastChar(); + if( c ) + { + pBuf[i++] = c; + } + } + else + pBuf[i++] = c; + } + pBuf[i++] = '\0'; + pStr = pTokenVal->string = RscChar::MakeUTF8FromL( pBuf ); + PutStringBack( pBuf ); + return( STRING ); + } + else + */ + { + pBuf[i++] = '\0'; + + nHashId = pHS->Test( pBuf ); + if( HASH_NONAME != nHashId ) + { + KEY_STRUCT aKey; + + // Suche nach dem Schluesselwort + if( pTC->aNmTb.Get( nHashId, &aKey ) ) + { + + // Schluesselwort gefunden + switch( aKey.nTyp ) + { + case CLASSNAME: + pTokenVal->pClass = (RscTop *)aKey.yylval; + break; + case VARNAME: + pTokenVal->varid = aKey.nName; + break; + case CONSTNAME: + pTokenVal->constname.hashid = aKey.nName; + pTokenVal->constname.nValue = aKey.yylval; + break; + case BOOLEAN: + pTokenVal->svbool = (BOOL)aKey.yylval; + break; + case INCLUDE: + bLastInclude = TRUE; + default: + pTokenVal->value = aKey.yylval; + }; + + // String zurueckgeben + PutStringBack( pBuf ); + return( aKey.nTyp ); + } + else{ + pTokenVal->string = pBuf; + return( SYMBOL ); + } + } + else{ // Symbol + RscDefine * pDef; + + pDef = pTC->aFileTab.FindDef( pBuf ); + if( pDef ){ + pTokenVal->defineele = pDef; + + // String zurueckgeben + PutStringBack( pBuf ); + return( RSCDEFINE ); + } + + pTokenVal->string = pBuf; + return( SYMBOL ); + } + } + } + + if( c=='<' ) + { + c = pFI->GetFastChar(); + if( c=='<' ) + { + c = pFI->GetFastChar(); + return LEFTSHIFT; + } + else + return '<'; + } + + if( c=='>' ) + { + c = pFI->GetFastChar(); + if( c=='>' ) + { + c = pFI->GetFastChar(); + return RIGHTSHIFT; + } + else + return '>'; + } + + c1 = c; + c = pFI->GetFastChar(); + return( c1 ); +} + +#if defined( RS6000 ) || defined( HP9000 ) || defined( SCO ) +extern "C" int yylex() +#else +int yylex() +#endif +{ + if( bTargetDefined ) + bTargetDefined = FALSE; + else + aKeyVal[ 0 ].nKeyWord = + MakeToken( &aKeyVal[ 0 ].aYYSType ); + + yylval = aKeyVal[ 0 ].aYYSType; + return( aKeyVal[ 0 ].nKeyWord ); +} + +/****************** yyerror **********************************************/ +#ifdef RS6000 +extern "C" void yyerror( char* pMessage ) +#elif defined HP9000 || defined SCO || defined IRIX || defined SOLARIS +extern "C" void yyerror( const char* pMessage ) +#else +void yyerror( char* pMessage ) +#endif +{ + pTC->pEH->Error( ERR_YACC, NULL, RscId(), pMessage ); +} + +/****************** parser start function ********************************/ +void InitParser( RscFileInst * pFileInst ) +{ + pTC = pFileInst->pTypCont; // Datenkontainer setzten + pFI = pFileInst; + pCS = new RscCharStack(); //Puffer Vorrat + pExp = NULL; //fuer MacroParser + bTargetDefined = FALSE; + + // Anfangszeichen initialisieren + bLastInclude = FALSE; + c = pFI->GetFastChar(); +} + +void EndParser(){ + char * pStr; + + // Stack abraeumen + while( ! S.IsEmpty() ) + S.Pop(); + + // Speicher freigeben + while( NULL != (pStr = pCS->Pop()) ) + RscMem::Free( pStr ); + delete pCS; + if( pExp ) + delete pExp; + pTC = NULL; + pFI = NULL; + pCS = NULL; + pExp = NULL; + +} + +void IncludeParser( RscFileInst * pFileInst ) +{ + int nToken; // Wert des Tokens + YYSTYPE aYYSType; // Daten des Tokens + RscFile * pFName; // Filestruktur + ULONG lKey; // Fileschluessel + RscTypCont * pTypCon = pFileInst->pTypCont; + + pFName = pTypCon->aFileTab.Get( pFileInst->GetFileIndex() ); + InitParser( pFileInst ); + + nToken = MakeToken( &aYYSType ); + while( 0 != nToken && CLASSNAME != nToken ){ + if( '#' == nToken ){ + if( INCLUDE == (nToken = MakeToken( &aYYSType )) ){ + if( STRING == (nToken = MakeToken( &aYYSType )) ){ + lKey = pTypCon->aFileTab.NewIncFile( aYYSType.string, + aYYSType.string ); + pFName->InsertDependFile( lKey, LIST_APPEND ); + } + else if( INCLUDE_STRING == nToken ){ + lKey = pTypCon->aFileTab.NewIncFile( aYYSType.string, + ByteString() ); + pFName->InsertDependFile( lKey, LIST_APPEND ); + }; + }; + }; + switch( nToken ){ + case STRING: + case INCLUDE_STRING: + case SYMBOL: + // String zurueckgeben + pCS->Push( aYYSType.string ); + break; + }; + nToken = MakeToken( &aYYSType ); + }; + + EndParser(); +} + +ERRTYPE parser( RscFileInst * pFileInst ) +{ + ERRTYPE aError; + + InitParser( pFileInst ); + + aError = yyparse(); + + EndParser(); + + // yyparser gibt 0 zurueck, wenn erfolgreich + if( 0 == (USHORT)aError ) + aError.Clear(); + if( pFileInst->pTypCont->pEH->nErrors ) + aError = ERR_ERROR; + pFileInst->SetError( aError ); + return( aError ); +} + +RscExpression * MacroParser( RscFileInst & rFileInst ) +{ + ERRTYPE aError; + RscExpression * pExpression; + + InitParser( &rFileInst ); + + //Ziel auf macro_expression setzen + aKeyVal[ 0 ].nKeyWord = MACROTARGET; + bTargetDefined = TRUE; + aError = yyparse(); + + pExpression = pExp; + //EndParser() wuerde pExp loeschen + if( pExp ) + pExp = NULL; + + EndParser(); + + // yyparser gibt 0 zurueck, wenn erfolgreich + if( 0 == (USHORT)aError ) + aError.Clear(); + if( rFileInst.pTypCont->pEH->nErrors ) + aError = ERR_ERROR; + rFileInst.SetError( aError ); + + //im Fehlerfall pExpression loeschen + if( aError.IsError() && pExpression ){ + delete pExpression; + pExpression = NULL; + }; + return( pExpression ); +} + diff --git a/rsc/source/parser/rsclex.hxx b/rsc/source/parser/rsclex.hxx new file mode 100644 index 000000000000..e1b4704746ca --- /dev/null +++ b/rsc/source/parser/rsclex.hxx @@ -0,0 +1,217 @@ +/************************************************************************* + * + * $RCSfile: rsclex.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 - Update + + $Log: not supported by cvs2svn $ + Revision 1.18 2000/09/17 12:51:11 willem.vandorp + OpenOffice header added. + + Revision 1.17 2000/07/26 17:13:21 willem.vandorp + Headers/footers replaced + + Revision 1.16 1999/09/24 13:15:07 hr + forward decl. + + Revision 1.15 1998/09/24 17:51:52 HR + GCC braucht richtige Vorwaertsdeklaration + + + Rev 1.14 24 Sep 1998 17:51:52 HR + GCC braucht richtige Vorwaertsdeklaration + + Rev 1.13 27 Aug 1997 18:17:16 MM + neue Headerstruktur + + Rev 1.12 18 Oct 1996 16:27:12 MM + dynamische Member + + Rev 1.11 24 Jul 1996 12:49:02 mda + IRIX + + Rev 1.10 18 Jun 1996 13:38:14 MM + Header Anpassungen + + Rev 1.9 05 Jun 1996 19:22:40 PL + Deklarationen fuer SCO + + Rev 1.8 21 Nov 1995 19:49:50 TLX + Neuer Link + + Rev 1.7 10 Jan 1995 11:23:04 eg + HP9000 yyerror( const char* ) + + Rev 1.6 09 Sep 1994 12:08:06 MH + Watcom + + Rev 1.5 25 Apr 1994 15:02:20 sv + HP9000 needs different declarations for yyerror and yylex (extern C) + + Rev 1.4 12 Jan 1994 15:20:44 mm + Alignementprobleme und Warnings fuer DEC-Alpha beseitigt + + Rev 1.3 21 Sep 1993 10:03:44 mm + RS6000 needs different prototyps (extern "C") + + Rev 1.2 25 Aug 1993 15:25:02 mm + Fehler und Warnings beseitigt + + Rev 1.1 23 Dec 1992 14:05:44 mm + Sprachaenderung + + Rev 1.0 10 Aug 1992 07:22:46 MM + Initial revision. + +**************************************************************************/ +#include <tools/stack.hxx> + +#define MINBUF 256 +#define MAXBUF 256 + +enum MODE_ENUM { MODE_MODELESS, MODE_APPLICATIONMODAL, MODE_SYSTEMMODAL }; + +enum JUSTIFY_ENUM { JUST_CENTER, JUST_RIGHT, JUST_LEFT }; + +enum SHOW_ENUM { SHOW_NORMAL, SHOW_MINIMIZED, SHOW_MAXIMIZED }; + +enum ENUMHEADER { HEADER_NAME, HEADER_NUMBER }; + +enum REF_ENUM { TYPE_NOTHING, TYPE_REF, TYPE_COPY }; + +struct RSCHEADER { + RscTop * pClass; + RscExpType nName1; + REF_ENUM nTyp; + RscTop * pRefClass; + RscExpType nName2; +}; + +DECLARE_STACK( RscCharStack, char * ) +void PutStringBack( char * pStr ); + +/************** O b j e c t s t a c k ************************************/ +struct Node { + Node* pPrev; + RSCINST aInst; + USHORT nTupelRec; // Rekursionstiefe fuer Tupel + Node() { pPrev = NULL; nTupelRec = 0; }; +}; + +class ObjectStack { + private : + Node* pRoot; + public : + + ObjectStack () { pRoot = NULL; } + + const RSCINST & Top () { return pRoot->aInst; } + BOOL IsEmpty() { return( pRoot == NULL ); } + void IncTupelRec() { pRoot->nTupelRec++; } + void DecTupelRec() { pRoot->nTupelRec--; } + USHORT TupelRecCount() const { return pRoot->nTupelRec; } + void Push( RSCINST aInst ) + { + Node* pTmp; + + pTmp = pRoot; + pRoot = new Node; + pRoot->aInst = aInst; + pRoot->pPrev = pTmp; + } + void Pop() + { + Node* pTmp; + + pTmp = pRoot; + pRoot = pTmp->pPrev; + delete pTmp; + } +}; + +/****************** F o r w a r d s **************************************/ +#if defined( RS6000 ) +extern "C" int yyparse(); // forward Deklaration fuer erzeugte Funktion +extern "C" void yyerror( char * ); +extern "C" int yylex( void ); +#elif defined( HP9000 ) || defined( SCO ) || defined ( IRIX ) || defined ( SOLARIS ) +extern "C" int yyparse(); // forward Deklaration fuer erzeugte Funktion +extern "C" void yyerror( const char * ); +extern "C" int yylex( void ); +#else +#if defined ( WTC ) || defined ( GCC ) +int yyparse(); // forward Deklaration fuer erzeugte Funktion +#else +yyparse(); // forward Deklaration fuer erzeugte Funktion +#endif +void yyerror( char * ); +int yylex( void ); +#endif + +class RscTypCont; +class RscFileInst; +class RscCharStack; + +extern RscTypCont* pTC; +extern RscFileInst * pFI; +extern RscCharStack * pCS; +extern RscExpression * pExp; +extern ObjectStack S; diff --git a/rsc/source/parser/rscpar.cxx b/rsc/source/parser/rscpar.cxx new file mode 100644 index 000000000000..a0c3fd7d71a7 --- /dev/null +++ b/rsc/source/parser/rscpar.cxx @@ -0,0 +1,299 @@ +/************************************************************************* + * + * $RCSfile: rscpar.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/rscpar.cxx,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.19 2000/09/17 12:51:11 willem.vandorp + OpenOffice header added. + + Revision 1.18 2000/07/26 17:13:21 willem.vandorp + Headers/footers replaced + + Revision 1.17 2000/07/12 11:35:51 th + Unicode + + Revision 1.16 1999/09/07 13:30:04 mm + UniCode + + Revision 1.15 1997/08/27 18:17:18 MM + neue Headerstruktur + +**************************************************************************/ +/****************** I N C L U D E S **************************************/ +#pragma hdrstop + +// C and C++ Includes. +#include <string.h> + +#ifndef _RSCPAR_HXX +#include <rscpar.hxx> +#endif +#ifndef _RSCDB_HXX +#include <rscdb.hxx> +#endif + +/****************** R s c F i l e I n s t ********************************/ +/****************** C O D E **********************************************/ +/************************************************************************* +|* +|* RscFileInst::Init() +|* +|* Beschreibung +|* Ersterstellung MM 05.11.91 +|* Letzte Aenderung MM 17.02.93 +|* +*************************************************************************/ +void RscFileInst::Init() +{ + SetCharSet( RTL_TEXTENCODING_MS_1252 ); + + nLineNo = 0; + nLineBufLen = 256; + pLine = (char *)RscMem::Malloc( nLineBufLen ); + *pLine = '\0'; + nScanPos = 0; + cLastChar = '\0'; + bEof = FALSE; +}; + +/************************************************************************* +|* +|* RscFileInst::RscFileInst() +|* +|* Beschreibung +|* Ersterstellung MM 06.06.91 +|* Letzte Aenderung MM 06.06.91 +|* +*************************************************************************/ +RscFileInst::RscFileInst( RscTypCont * pTC, ULONG lIndexSrc, + ULONG lFIndex, FILE * fFile, + rtl_TextEncoding nSourceCharSet ) +{ + pTypCont = pTC; + Init(); + + lFileIndex = lFIndex; + lSrcIndex = lIndexSrc; + fInputFile = fFile; + + SetCharSet( nSourceCharSet ); + + //Status: Zeiger am Ende des Lesepuffers + nInputPos = nInputEndPos = nInputBufLen = READBUFFER_MAX; + pInput = (char *)RscMem::Malloc( nInputBufLen ); +} + +RscFileInst::RscFileInst( RscTypCont * pTC, ULONG lIndexSrc, + ULONG lFIndex, const ByteString& rBuf, + rtl_TextEncoding nSourceCharSet ) +{ + pTypCont = pTC; + Init(); + lFileIndex = lFIndex; + lSrcIndex = lIndexSrc; + fInputFile = NULL; + nInputPos = 0; + nInputEndPos = rBuf.Len(); + + SetCharSet( nSourceCharSet ); + + // Muss groesser sein wegen Eingabeende bei nInputBufLen < nInputEndPos + nInputBufLen = nInputEndPos +1; + pInput = (char *)RscMem::Malloc( nInputBufLen +100 ); + memcpy( pInput, rBuf.GetBuffer(), nInputEndPos ); +} + +/************************************************************************* +|* +|* RscFileInst::~RscFileInst() +|* +|* Beschreibung +|* Ersterstellung MM 06.06.91 +|* Letzte Aenderung MM 06.06.91 +|* +*************************************************************************/ +RscFileInst::~RscFileInst(){ + if( pInput ) + RscMem::Free( pInput ); + if( pLine ) + RscMem::Free( pLine ); +} + +/************************************************************************* +|* +|* RscFileInst::GetChar() +|* +|* Beschreibung +|* Ersterstellung MM 01.06.91 +|* Letzte Aenderung MM 09.08.91 +|* +*************************************************************************/ +int RscFileInst::GetChar() +{ + if( pLine[ nScanPos ] ) + return( pLine[ nScanPos++ ] ); + else if( nInputPos >= nInputEndPos && nInputEndPos != nInputBufLen ) + { + // Dateiende + bEof = TRUE; + return 0; + } + else + { + GetNewLine(); + return( '\n' ); + } +} + +/************************************************************************* +|* +|* RscFileInst::GetNewLine() +|* +|* Beschreibung +|* Ersterstellung MM 06.06.91 +|* Letzte Aenderung MM 06.06.91 +|* +*************************************************************************/ +void RscFileInst::GetNewLine() +{ + nLineNo++; + nScanPos = 0; + + //laeuft bis Dateiende + USHORT nLen = 0; + while( (nInputPos < nInputEndPos) || (nInputEndPos == nInputBufLen) ) + { + if( (nInputPos >= nInputEndPos) && fInputFile ) + { + nInputEndPos = fread( pInput, 1, nInputBufLen, fInputFile ); + nInputPos = 0; + } + + while( nInputPos < nInputEndPos ) + { + //immer eine Zeile lesen + if( nLen >= nLineBufLen ) + { + nLineBufLen += 256; + // einen dazu fuer '\0' + pLine = RscMem::Realloc( pLine, nLineBufLen +1 ); + } + + // cr lf, lf cr, lf oder cr wird '\0' + if( pInput[ nInputPos ] == '\n' ){ + nInputPos++; + if( cLastChar != '\r' ){ + cLastChar = '\n'; + pLine[ nLen++ ] = '\0'; + goto END; + } + } + else if( pInput[ nInputPos ] == '\r' ){ + nInputPos++; + if( cLastChar != '\n' ){ + cLastChar = '\r'; + pLine[ nLen++ ] = '\0'; + goto END; + } + } + else + pLine[ nLen++ ] = pInput[ nInputPos++ ]; + }; + }; + + // Abbruch ueber EOF + pLine[ nLen ] = '\0'; + +END: + if( pTypCont->pEH->GetListFile() ){ + char buf[ 10 ]; + + sprintf( buf, "%5d ", GetLineNo() ); + pTypCont->pEH->LstOut( buf ); + pTypCont->pEH->LstOut( GetLine() ); + pTypCont->pEH->LstOut( "\n" ); + } +} + +/************************************************************************* +|* +|* RscFileInst::SetError() +|* +|* Beschreibung +|* Ersterstellung MM 05.11.91 +|* Letzte Aenderung MM 05.11.91 +|* +*************************************************************************/ +void RscFileInst::SetError( ERRTYPE aError ) +{ + if( aError.IsOk() ) + { + aFirstError = aError; + nErrorLine = GetLineNo(); + nErrorPos = GetScanPos() -1; + }; +}; diff --git a/rsc/source/parser/rscyacc.cxx b/rsc/source/parser/rscyacc.cxx new file mode 100644 index 000000000000..50cc9cd034a7 --- /dev/null +++ b/rsc/source/parser/rscyacc.cxx @@ -0,0 +1,322 @@ +/************************************************************************* + * + * $RCSfile: rscyacc.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/rscyacc.cxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $ + +*************************************************************************/ +#pragma hdrstop + +#include <stdio.h> +#include <ctype.h> +#include <string.h> + +#include <tools/rc.h> + +#ifndef _RSCERROR_H +#include <rscerror.h> +#endif + +#ifndef _RSCTOOLS_HXX +#include <rsctools.hxx> +#endif +#ifndef _RSCCLASS_HXX +#include <rscclass.hxx> +#endif +#ifndef _RSCCONT_HXX +#include <rsccont.hxx> +#endif +#ifndef _RSCTREE_HXX +#include <rsctree.hxx> +#endif +#ifndef _RSCDB_HXX +#include <rscdb.hxx> +#endif +#ifndef _RSCDEF_HXX +#include <rscdef.hxx> +#endif +#ifndef _RSCPAR_HXX +#include <rscpar.hxx> +#endif + +#include "rsclex.hxx" + +/************** V a r i a b l e n ****************************************/ +ObjectStack S; +RscTop * pCurClass; +USHORT nCurMask; +char szErrBuf[ 100 ]; + +/************** H i l f s F u n k t i o n e n ****************************/ +RSCINST GetVarInst( const RSCINST & rInst, char * pVarName ) +{ + RSCINST aInst; + + aInst = rInst.pClass->GetVariable( rInst, pHS->Insert( pVarName ), + RSCINST() ); + + if( !aInst.pData ) + pTC->pEH->Error( ERR_NOVARIABLENAME, rInst.pClass, RscId() ); + + return( aInst ); +} + +void SetNumber( const RSCINST & rInst, char * pVarName, long lValue ) +{ + RSCINST aInst; + + aInst = GetVarInst( rInst, pVarName ); + + if( aInst.pData ){ + ERRTYPE aError; + aError = aInst.pClass->SetNumber( aInst, lValue ); + + if( aError.IsError() ) + pTC->pEH->Error( aError, aInst.pClass, RscId() ); + } +} + +void SetConst( const RSCINST & rInst, char * pVarName, + HASHID nValueId, long nVal ) +{ + RSCINST aInst; + + aInst = GetVarInst( rInst, pVarName ); + if( aInst.pData ) + { + ERRTYPE aError; + aError = aInst.pClass->SetConst( aInst, nValueId, nVal ); + + if( aError.IsError() ) + pTC->pEH->Error( aError, aInst.pClass, RscId() ); + } +} + +void SetString( const RSCINST & rInst, char * pVarName, char * pStr ) +{ + RSCINST aInst; + + aInst = GetVarInst( rInst, pVarName ); + if( aInst.pData ){ + ERRTYPE aError; + aError = aInst.pClass->SetString( aInst, pStr ); + + if( aError.IsError() ) + pTC->pEH->Error( aError, aInst.pClass, RscId() ); + } +} + +RscId MakeRscId( RscExpType aExpType ) +{ + if( !aExpType.IsNothing() ){ + long lValue; + + if( !aExpType.Evaluate( &lValue ) ) + pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() ); + if( lValue < 1 || lValue > (long)0x7FFF ) + { + pTC->pEH->Error( ERR_IDRANGE, NULL, RscId(), + ByteString::CreateFromInt32( lValue ).GetBuffer() ); + } + + if( aExpType.IsDefinition() ) + return RscId( aExpType.aExp.pDef ); + else + return RscId( lValue ); + } + return RscId(); +} + +BOOL DoClassHeader( RSCHEADER * pHeader, BOOL bMember ) +{ + RSCINST aCopyInst; + RscId aName1 = MakeRscId( pHeader->nName1 ); + RscId aName2 = MakeRscId( pHeader->nName2 ); + + if( pHeader->pRefClass ) + aCopyInst.pClass = pHeader->pRefClass; + else + aCopyInst.pClass = pHeader->pClass; + + if( TYPE_COPY == pHeader->nTyp ) + { + ObjNode * pCopyObj = aCopyInst.pClass->GetObjNode( aName2 ); + + if( !pCopyObj ) + { + ByteString aMsg( pHS->Get( aCopyInst.pClass->GetId() ) ); + aMsg += ' '; + aMsg += aName2.GetName(); + pTC->pEH->Error( ERR_NOCOPYOBJ, pHeader->pClass, aName1, + aMsg.GetBuffer() ); + } + else + aCopyInst.pData = pCopyObj->GetRscObj(); + } + + if( bMember ) + { + // Angabe von Superklassen oder abgeleiteten Klassen ist jetzt erlaubt + if( S.Top().pClass->InHierarchy( pHeader->pClass ) + || pHeader->pClass->InHierarchy( S.Top().pClass) ) + { + if( aCopyInst.IsInst() ) + { + RSCINST aTmpI( S.Top() ); + aTmpI.pClass->Destroy( aTmpI ); + aTmpI.pClass->Create( &aTmpI, aCopyInst ); + }; + } + else + pTC->pEH->Error( ERR_FALSETYPE, S.Top().pClass, aName1, + pHS->Get( pHeader->pClass->GetId() ) ); + } + else + { + if( S.IsEmpty() ) + { + if( (long)aName1 < 256 ) + pTC->pEH->Error( WRN_GLOBALID, pHeader->pClass, aName1 ); + + if( aCopyInst.IsInst() ) + S.Push( pHeader->pClass->Create( NULL, aCopyInst ) ); + else + S.Push( pHeader->pClass->Create( NULL, RSCINST() ) ); + + ObjNode * pNode = new ObjNode( aName1, S.Top().pData, + pFI->GetFileIndex() ); + pTC->pEH->StdOut( "." ); + + if( !aName1.IsId() ) + pTC->pEH->Error( ERR_IDEXPECTED, pHeader->pClass, aName1 ); + else if( !pHeader->pClass->PutObjNode( pNode ) ) + pTC->pEH->Error( ERR_DOUBLEID, pHeader->pClass, aName1 ); + } + else + { + RSCINST aTmpI; + ERRTYPE aError; + + if( (long)aName1 >= 256 && aName1.IsId() ) + pTC->pEH->Error( WRN_LOCALID, pHeader->pClass, aName1 ); + aError = S.Top().pClass->GetElement( S.Top(), aName1, + pHeader->pClass, aCopyInst, &aTmpI ); + + if( aError.IsWarning() ) + pTC->pEH->Error( aError, pHeader->pClass, aName1 ); + else if( aError.IsError() ) + { + if( ERR_CONT_INVALIDTYPE == (USHORT)aError ) + pTC->pEH->Error( aError, S.Top().pClass, aName1, + pHS->Get( pHeader->pClass->GetId() ) ); + else + pTC->pEH->Error( aError, S.Top().pClass, aName1 ); + S.Top().pClass->GetElement( S.Top(), RscId(), + pHeader->pClass, RSCINST(), &aTmpI ); + + if( !aTmpI.IsInst() ) + return( FALSE ); + } + S.Push( aTmpI ); + }; + }; + if( TYPE_REF == pHeader->nTyp ) + { + ERRTYPE aError; + + aError = S.Top().pClass->SetRef( S.Top(), aName2 ); + pTC->pEH->Error( aError, S.Top().pClass, aName1 ); + } + + return( TRUE ); +} + +RSCINST GetFirstTupelEle( const RSCINST & rTop ) +{ // Aufwaertskompatible, Tupel probieren + RSCINST aInst; + ERRTYPE aErr; + + aErr = rTop.pClass->GetElement( rTop, RscId(), NULL, RSCINST(), &aInst ); + if( !aErr.IsError() ) + aInst = aInst.pClass->GetTupelVar( aInst, 0, RSCINST() ); + return aInst; +} + +/************** Y a c c C o d e ****************************************/ +//#define YYDEBUG 1 + +#define TYPE_HASHID 0 +#define TYPE_RESID 1 + +#ifdef UNX +#define YYMAXDEPTH 2000 +#else +#ifdef W30 +#define YYMAXDEPTH 300 +#else +#define YYMAXDEPTH 800 +#endif +#endif + +#include "rscyacc.yxx" + diff --git a/rsc/source/prj/gui.cxx b/rsc/source/prj/gui.cxx new file mode 100644 index 000000000000..235bebc54c0d --- /dev/null +++ b/rsc/source/prj/gui.cxx @@ -0,0 +1,172 @@ +/************************************************************************* + * + * $RCSfile: gui.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 <stdlib.h> +#include <stdio.h> +#ifdef MAC +#include <cursorctl.h> +#endif + +#ifndef _RSCRSC_HXX +#include <rscrsc.hxx> +#endif +#ifndef _RSCDB_HXX +#include <rscdb.hxx> +#endif + +/*************** G l o b a l e V a r i a b l e n **********************/ +static RscCompiler * pRscCompiler = NULL; +/****************************************************************/ +/* */ +/* Function : ExitProgram() */ +/* */ +/* Description : Gibt die Temporaeren Dateien frei. */ +/****************************************************************/ +#if defined( UNX ) || ( defined( PM2 ) && ( defined( TCPP ) || defined ( GCC )) ) || defined( MAC ) || defined (WTC) || defined (MTW) + void ExitProgram( void ){ +#else +#if defined( CSET ) + void _Optlink ExitProgram( void ){ +#else + void cdecl ExitProgram( void ){ +#endif +#endif + if( pRscCompiler ) + delete pRscCompiler; +} + +void PrimeNumber(){ + USHORT i, n; + for( i = 801; i < 1000; i += 2 ){ + for( n = 2; n < i && ((i % n) != 0); n++ ); + if( n == i ){ + printf( "\nPrimzahl: %d\n", i ); + return; + } + } +} + + +#if defined( UNX ) || defined( MAC ) || ( defined( PM2 ) && ( defined( CSET ) || defined ( GCC ))) || defined (WTC) || defined(ICC) +int main ( int argc, char ** argv) { +#else +#if defined( MTW ) +int main ( int argc, char const ** argv) { +#else +int cdecl main ( int argc, char ** argv) { +#endif +#endif +#ifndef UNX +#ifdef CSET + atexit( ExitProgram ); +#else + atexit( ExitProgram ); +#endif +#endif +#ifdef MAC + InitCursorCtl( 0 ); +#endif + + ERRTYPE aError; + + InitRscCompiler(); + RscError* pErrHdl = new RscError(); +#ifdef MTW + RscCmdLine* pCmdLine = new RscCmdLine( argc, (char **)argv, pErrHdl ); +#else + RscCmdLine* pCmdLine = new RscCmdLine( argc, argv, pErrHdl ); +#endif + RscTypCont* pTypCont = new RscTypCont( pErrHdl, + pCmdLine->nLangTypeId, + pCmdLine->nByteOrder, + pCmdLine->nSourceCharSet, + pCmdLine->aPath, + pCmdLine->nCommands ); + + if( pErrHdl->nErrors ) + aError = ERR_ERROR; + else{ + RscCompiler* pCompiler = new RscCompiler( pCmdLine, pTypCont ); + + pRscCompiler = pCompiler; + aError = pCompiler->Start(); + pRscCompiler = NULL; + + delete pCompiler; + } + + delete pTypCont; + delete pCmdLine; + delete pErrHdl; + delete pHS; // wird durch InitRscCompiler erzeugt + + if( aError.IsOk() ) + return( 0 ); + else + return( 1 ); +} + +void RscExit( USHORT nExit ) +{ + if( nExit ) + printf( "Program exit is %d\n", nExit ); + exit( nExit ); +} diff --git a/rsc/source/prj/makefile.mk b/rsc/source/prj/makefile.mk new file mode 100644 index 000000000000..dd1e69d70c11 --- /dev/null +++ b/rsc/source/prj/makefile.mk @@ -0,0 +1,161 @@ +#************************************************************************* +# +# $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 +TARGETTYPE=CUI +TARGET=rsc +LIBTARGET=NO + +# --- Settings ----------------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Files -------------------------------------------------------------- + +.IF "$(GUI)"!="WIN" +CXXFILES= gui.cxx \ + start.cxx + +OBJFILES= $(OBJ)$/gui.obj \ + $(OBJ)$/start.obj + +.IF "$(GUI)$(COM)$(COMEX)" != "DOSSTCX" +APP1TARGET= rsc +APP1STDLIBS=$(TOOLSLIB) $(VOSLIB) $(SALLIB) # $(RTLLIB) +APP1LIBS= $(LIBPRE) $(LB)$/rsctoo.lib +APP1OBJS= $(OBJ)$/start.obj +APP1STACK=64000 +.IF "$(GUI)" != "OS2" +APP1STACK=32768 +.ENDIF +.ENDIF + +.IF "$(GUI)$(COM)$(COMEX)" != "DOSSTC" +APP2TARGET= rsc2 +.IF "$(GUI)" == "MAC" +APP2STDLIBS=$(PRJ)$/..$/TOOLS$/$(INPATH)$/SLB$/tools.lib \ + $(PRJ)$/..$/SAL$/$(INPATH)$/SLB$/cpposl.lib \ + $(PRJ)$/..$/VOS$/$(INPATH)$/SLB$/cppvos.lib \ + $(PRJ)$/..$/RTL$/$(INPATH)$/SLB$/cpprtl.lib \ + $(MWPPCLibraries)PPCToolLibs.o \ + $(STDSLOGUI) +MACRES= $(SV_RES)MPWToolCfrg.r -d SVTOOLNAME="¶"SV TOOL¶"" +.ELSE +.IF "$(OS)"=="SCO" +# SCO hat Probleme mit fork/exec und einigen shared libraries. +# rsc2 muss daher statisch gelinkt werden +APP2STDLIBS=$(STATIC) -latools $(BPICONVLIB) $(VOSLIB) $(OSLLIB) $(RTLLIB) $(DYNAMIC) +.ELSE +APP2STDLIBS=$(TOOLSLIB) $(VOSLIB) $(SALLIB) #RTLLIB) +.ENDIF +.ENDIF +APP2LIBS= $(LIBPRE) $(LB)$/rsctoo.lib \ + $(LIBPRE) $(LB)$/rscres.lib \ + $(LIBPRE) $(LB)$/rscpar.lib \ + $(LIBPRE) $(LB)$/rscrsc.lib \ + $(LIBPRE) $(LB)$/rscmis.lib +APP2OBJS= $(OBJ)$/gui.obj +APP2STACK=64000 +.IF "$(GUI)" != "OS2" +APP2STACK=32768 +.ENDIF +.ENDIF +.ENDIF + +# --- Targets ------------------------------------------------------------ + +.INCLUDE : target.mk + +# ------------------------------------------------------------------- +# PM2 +# ------------------------------------------------------------------- + +.IF "$(GUI)" == "OS2" + +$(MISC)$/$(APP1TARGET).def : makefile + echo NAME RSC WINDOWCOMPAT >$@ + echo DESCRIPTION 'RSC-Compiler' >>$@ +.IF "$(COM)" != "BLC" + echo STUB 'os2STUB.EXE' >>$@ +.ENDIF + echo DATA MULTIPLE >>$@ + echo EXETYPE OS2 >>$@ + echo PROTMODE >>$@ + echo HEAPSIZE 16000 >>$@ + echo STACKSIZE 48000 >>$@ + +$(MISC)$/$(APP2TARGET).def : makefile + echo NAME RSC2 WINDOWCOMPAT >$@ + echo DESCRIPTION 'RSC2-Compiler' >>$@ +.IF "$(COM)" != "BLC" + echo STUB 'os2STUB.EXE' >>$@ +.ENDIF + echo DATA MULTIPLE >>$@ + echo EXETYPE OS2 >>$@ + echo PROTMODE >>$@ + echo HEAPSIZE 16000 >>$@ + echo STACKSIZE 48000 >>$@ +.ENDIF diff --git a/rsc/source/prj/start.cxx b/rsc/source/prj/start.cxx new file mode 100644 index 000000000000..fda87c6a407a --- /dev/null +++ b/rsc/source/prj/start.cxx @@ -0,0 +1,495 @@ +/************************************************************************* + * + * $RCSfile: start.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 <stdlib.h> +#include <stdio.h> +#include <fcntl.h> +#include <string.h> +#if defined (WNT) && defined (tcpp) +#define _spawnvp spawnvp +#define _P_WAIT P_WAIT +#endif +#ifdef UNX +#include <unistd.h> +#include <sys/wait.h> +#else +#ifndef MAC +#include <io.h> +#include <process.h> +#if defined ( OS2 ) && !defined ( GCC ) +#include <direct.h> +#endif +#ifndef CSET +#include <dos.h> +#endif +#endif +#endif + +#ifndef _RSCTOOLS_HXX +#include <rsctools.hxx> +#endif +#include <tools/fsys.hxx> + +/*************** C O D E ************************************************/ +/****************************************************************/ +/* */ +/* Function : fuer Ansi kompatibilitaet */ +/* */ +/****************************************************************/ +#ifdef UNX +#define P_WAIT 0 + int spawnvp( int, const char * cmdname, char *const* argv ){ + int rc; + /* + union wait rc; + rc.w_status = 0; + */ + + switch( fork() ){ + case -1: + return( -1 ); + case 0: + if( execvp( cmdname, argv ) == -1 ) + // an error occurs + return( -1 ); + break; + default: + if( -1 == wait( &rc ) ) + return( -1 ); + } + return( WEXITSTATUS( rc ) ); + } +#endif + +/************************************************************************* +|* CallPrePro() +|* +|* Beschreibung +*************************************************************************/ +static BOOL CallPrePro( const ByteString& rPrePro, + const ByteString& rInput, + const ByteString& rOutput, + RscPtrPtr * pCmdLine, + BOOL bResponse ) +{ + RscPtrPtr aNewCmdL; // Kommandozeile + RscPtrPtr aRespCmdL; // Kommandozeile + RscPtrPtr * pCmdL = &aNewCmdL; + short i, nExit; + FILE* fRspFile = NULL; + ByteString aRspFileName; + + if( bResponse ) + { + aRspFileName = ::GetTmpFileName(); + fRspFile = fopen( aRspFileName.GetBuffer(), "w" ); + } + + if( !fRspFile ) + aNewCmdL.Append( RscMem::Assignsw( rPrePro.GetBuffer(), 0 ) ); + for( i = 1; i < (short)(pCmdLine->GetCount() -1); i++ ){ + if( !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-u", 2 ) + || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-i", 2 ) + || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-d", 2 ) ) + { + aNewCmdL.Append( + RscMem::Assignsw( (char *)pCmdLine->GetEntry( i ), 0 ) ); + } + }; + aNewCmdL.Append( RscMem::Assignsw( rInput.GetBuffer(), 0 ) ); + aNewCmdL.Append( RscMem::Assignsw( rOutput.GetBuffer(), 0 ) ); + aNewCmdL.Append( (void *)0 ); + + printf( "Preprocessor commandline: " ); + for( i = 0; i < (short)(pCmdL->GetCount() -1); i++ ) + { + printf( " " ); + printf( "%s", (const char *)pCmdL->GetEntry( i ) ); + } + printf( "\n" ); + + if( fRspFile ) + { + aRespCmdL.Append( RscMem::Assignsw( rPrePro.GetBuffer(), 0 ) ); + ByteString aTmpStr( '@' ); + aTmpStr += aRspFileName; + aRespCmdL.Append( RscMem::Assignsw( aTmpStr.GetBuffer(), 0 ) ); + aRespCmdL.Append( (void *)0 ); + + pCmdL = &aRespCmdL; + for( i = 0; i < (short)(aNewCmdL.GetCount() -1); i++ ) + { + fprintf( fRspFile, "%s ", (const char *)aNewCmdL.GetEntry( i ) ); + } + fclose( fRspFile ); + + printf( "Preprocessor startline: " ); + for( i = 0; i < (short)(pCmdL->GetCount() -1); i++ ) + { + printf( " " ); + printf( "%s", (const char *)pCmdL->GetEntry( i ) ); + } + printf( "\n" ); + } + +#if ((defined PM2 || defined WNT) && (defined TCPP || defined tcpp)) || defined UNX + nExit = spawnvp( P_WAIT, rPrePro.GetBuffer(), (char* const*)pCmdL->GetBlock() ); +#elif defined CSET + nExit = spawnvp( P_WAIT, (char*)rPrePro.GetBuffer(), char **) (const char**)pCmdL->GetBlock() ); +#elif defined WTC + nExit = spawnvp( P_WAIT, (char*)rPrePro.GetBuffer(), (const char* const*)pCmdL->GetBlock() ); +#elif defined MTW + nExit = spawnvp( P_WAIT, (char*)rPrePro.GetBuffer(), (char**)pCmdL->GetBlock() ); +#else + nExit = spawnvp( P_WAIT, (char*)rPrePro.GetBuffer(), (const char**)pCmdL->GetBlock() ); +#endif + + if ( fRspFile ) + unlink( aRspFileName.GetBuffer() ); + if ( nExit ) + return FALSE; + + return TRUE; +} + + +/************************************************************************* +|* CallRsc2 +|* +|* Beschreibung +*************************************************************************/ +static BOOL CallRsc2( ByteString aRsc2Name, + RscStrList * pInputList, + ByteString aSrsName, + ByteString aRcName, + RscPtrPtr * pCmdLine ) +{ + RscPtrPtr aNewCmdL; // Kommandozeile + short i, nExit; + ByteString* pString; + ByteString aRspFileName; // Response-Datei + FILE * fRspFile; // Response-Datei + + aRspFileName = ::GetTmpFileName(); + fRspFile = fopen( aRspFileName.GetBuffer(), "w" ); + + printf( "Rsc2 commandline: " ); + aNewCmdL.Append( RscMem::Assignsw( aRsc2Name.GetBuffer(), 0 ) ); + printf( "%s", (const char *)aNewCmdL.GetEntry( aNewCmdL.GetCount() -1 ) ); + printf( " " ); + ByteString aTmpStr( '@' ); + aTmpStr += aRspFileName; + aNewCmdL.Append( RscMem::Assignsw( aTmpStr.GetBuffer(), 0 ) ); + printf( "%s", (const char *)aNewCmdL.GetEntry( aNewCmdL.GetCount() -1 ) ); + aNewCmdL.Append( (void *)0 ); + printf( "\n" ); + + if( fRspFile ) + { + for( i = 1; i < (short)(pCmdLine->GetCount() -1); i++ ) + { + if( !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-fp", 3 ) + || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-fo", 3 ) + || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-fs", 3 ) + || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-pp", 3 ) + || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-presponse", 9 ) + || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-rc", 3 ) + || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-+" ) + || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-br" ) + || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-bz" ) + || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-r" ) + || ( '-' != *(char *)pCmdLine->GetEntry( i ) ) ) + { + } + else + fprintf( fRspFile, "%s ", + (const char *)pCmdLine->GetEntry( i ) ); + }; + + fprintf( fRspFile, "%s -fs%s", + aSrsName.GetBuffer(), aRcName.GetBuffer() ); + + pString = pInputList->First(); + while( pString ) + { + fprintf( fRspFile, " %s", pString->GetBuffer() ); + pString = pInputList->Next(); + }; + + fclose( fRspFile ); + }; + +#if ((defined PM2 || defined WNT) && (defined TCPP || defined tcpp)) || defined UNX + nExit = spawnvp( P_WAIT, aRsc2Name.GetBuffer(), (char* const*)aNewCmdL.GetBlock() ); +#elif defined CSET + nExit = spawnvp( P_WAIT, (char*)aRsc2Name.GetBuffer(), (char **)(const char**)aNewCmdL.GetBlock() ); +#elif defined WTC + nExit = spawnvp( P_WAIT, (char*)aRsc2Name.GetBuffer(), (const char* const*)aNewCmdL.GetBlock() ); +#elif defined MTW + nExit = spawnvp( P_WAIT, (char*)aRsc2Name.GetBuffer(), (char**)aNewCmdL.GetBlock() ); +#else + nExit = spawnvp( P_WAIT, (char*)aRsc2Name.GetBuffer(), (const char**)aNewCmdL.GetBlock() ); +#endif + + if( fRspFile ) + unlink( aRspFileName.GetBuffer() ); + if( nExit ) + return( FALSE ); + return( TRUE ); +} + +/************************************************************************* +|* CallRes +|* +|* Beschreibung +*************************************************************************/ +static BOOL CallRes( ByteString aRcName, ByteString aResName ) +{ + short nExit; + + unlink( aResName.GetBuffer() ); // Zieldatei loeschen + printf( "Copy %s to %s\n", aRcName.GetBuffer(), aResName.GetBuffer() ); + if( !Append( aResName, aRcName ) ) + { + printf( "Cannot open file <%s or %s>\n", + aResName.GetBuffer(), aRcName.GetBuffer() ); + nExit = 1; + } + else + nExit = 0; + return( nExit == 0 ); +} + +/************************************************************************* +|* +|* main() +|* +|* Beschreibung +|* Ersterstellung MM 05.09.91 +|* Letzte Aenderung MM 05.09.91 +|* +*************************************************************************/ +#if defined UNX || (defined PM2 && (defined CSET || defined GCC )) || defined WTC || defined MTW || defined ICC +int main ( int argc, char ** argv) +{ +#else +int cdecl main ( int argc, char ** argv) +{ +#endif + + BOOL bPrePro = TRUE; + BOOL bResFile = TRUE; + BOOL bHelp = FALSE; + BOOL bError = FALSE; + BOOL bResponse = FALSE; + ByteString aPrePro( "rscpp" ); + ByteString aRsc2Name( "rsc2" ); + ByteString aSrsName; + ByteString aRcName; + ByteString aResName; + RscStrList aInputList; + RscStrList aTmpList; + char * pStr; + char ** ppStr; + RscPtrPtr aCmdLine; // Kommandozeile + USHORT i; + ByteString* pString; + + printf( "VCL Resource Compiler 3.0\n" ); + + pStr = ::ResponseFile( &aCmdLine, argv, argc ); + if( pStr ) + { + printf( "Cannot open response file <%s>\n", pStr ); + return( 1 ); + }; + + ppStr = (char **)aCmdLine.GetBlock(); + ppStr++; + i = 1; + BOOL bSetSrs = FALSE; + while( ppStr && i < (USHORT)(aCmdLine.GetCount() -1) ) + { + if( '-' == **ppStr ) + { + if( !rsc_stricmp( (*ppStr) + 1, "p" ) + || !rsc_stricmp( (*ppStr) + 1, "l" ) ) + { // kein Preprozessor + bPrePro = FALSE; + } + else if( !rsc_stricmp( (*ppStr) + 1, "r" ) + || !rsc_stricmp( (*ppStr) + 1, "s" ) ) + { // erzeugt kein .res-file + bResFile = FALSE; + } + else if( !rsc_stricmp( (*ppStr) + 1, "h" ) ) + { // Hilfe anzeigen + bHelp = TRUE; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "presponse", 9 ) ) + { // anderer Name fuer den Preprozessor + bResponse = TRUE; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "pp", 2 ) ) + { // anderer Name fuer den Preprozessor + aPrePro = (*ppStr) + 3; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "fo", 2 ) ) + { // anderer Name fuer .res-file + aResName = (*ppStr) + 3; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "fs", 2 ) ) + { // anderer Name fuer .rc-file + aRcName = (*ppStr) + 3; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "fp", 2 ) ) + { // anderer Name fuer .srs-file + bSetSrs = TRUE; + aSrsName = (*ppStr); + } + } + else + { + // Eingabedatei + aInputList.Insert( new ByteString( *ppStr ), CONTAINER_APPEND ); + } + ppStr++; + i++; + } + + if( aInputList.Count() ) + { + /* build the output file names */ + if( ! aResName.Len() ) + aResName = OutputFile( *aInputList.First(), "res" ); + if( ! aRcName.Len() ) + aRcName = OutputFile( *aInputList.First(), "rc" ); + if( ! bSetSrs ) + { + aSrsName = "-fp"; + aSrsName += OutputFile( *aInputList.First(), "srs" ); + } + }; + + if( bHelp ) + { + bPrePro = FALSE; + bResFile = FALSE; + }; + if( bPrePro && aInputList.Count() ) + { + ByteString aTmpName; + + pString = aInputList.First(); + while( pString ) + { + aTmpName = ::GetTmpFileName(); + if( !CallPrePro( aPrePro, *pString, aTmpName, &aCmdLine, bResponse ) ) + { + printf( "Error starting preprocessor\n" ); + bError = TRUE; + break; + } + aTmpList.Insert( new ByteString( aTmpName ), CONTAINER_APPEND ); + pString = aInputList.Next(); + }; + }; + + if( !bError ) + { + if( !CallRsc2( aRsc2Name, bPrePro ? &aTmpList : &aInputList, + aSrsName, aRcName, &aCmdLine ) ) + { + if( !bHelp ) + { + printf( "Error starting rsc2 compiler\n" ); + bError = TRUE; + } + }; + }; + + pString = aTmpList.First(); + while( pString ) + { + unlink( pString->GetBuffer() ); + pString = aTmpList.Next(); + }; + + if( !bError && bResFile ) + { + if( !CallRes( aRcName, aResName ) ) + { + printf( "Error in system resource compiler\n" ); + bError = TRUE; + } + else + unlink( aRcName.GetBuffer() ); + }; + + return( bError ); +} + +void RscExit( USHORT nExit ) +{ + if( nExit ) + printf( "Program exit is %d\n", nExit ); + exit( nExit ); +} diff --git a/rsc/source/res/makefile.mk b/rsc/source/res/makefile.mk new file mode 100644 index 000000000000..68f6d5096b63 --- /dev/null +++ b/rsc/source/res/makefile.mk @@ -0,0 +1,98 @@ +#************************************************************************* +# +# $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=rscres + +# --- Settings ------------------------------------------------------ + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +OBJFILES= $(OBJ)$/rscclobj.obj \ + $(OBJ)$/rsccont.obj \ + $(OBJ)$/rsctop.obj \ + $(OBJ)$/rscrange.obj \ + $(OBJ)$/rscconst.obj \ + $(OBJ)$/rscflag.obj \ + $(OBJ)$/rscstr.obj \ + $(OBJ)$/rscall.obj \ + $(OBJ)$/rscmgr.obj \ + $(OBJ)$/rscclass.obj \ + $(OBJ)$/rscarray.obj + +CXXFILES= rscclobj.cxx \ + rsctop.cxx \ + rscrange.cxx \ + rscconst.cxx \ + rscflag.cxx \ + rscstr.cxx \ + rscall.cxx \ + rsccont.cxx \ + rscclass.cxx \ + rscmgr.cxx \ + rscarray.cxx + +.INCLUDE : target.mk diff --git a/rsc/source/res/rscall.cxx b/rsc/source/res/rscall.cxx new file mode 100644 index 000000000000..978514c8d4e4 --- /dev/null +++ b/rsc/source/res/rscall.cxx @@ -0,0 +1,125 @@ +/************************************************************************* + * + * $RCSfile: rscall.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/res/rscall.cxx,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:11 willem.vandorp + OpenOffice header added. + + Revision 1.11 2000/07/26 17:13:22 willem.vandorp + Headers/footers replaced + + Revision 1.10 2000/07/12 11:37:45 th + Unicode + + Revision 1.9 1997/08/27 18:17:36 MM + neue Headerstruktur + +**************************************************************************/ +/****************** I N C L U D E S **************************************/ + +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> + +// Programmabhaengige Includes. +#ifndef _RSCALL_H +#include <rscall.h> +#endif +#ifndef _RSCKEY_HXX +#include <rsckey.hxx> +#endif +#ifndef _RSCHASH_HXX +#include <rschash.hxx> +#endif + +USHORT nRsc_XYMAPMODEId; +USHORT nRsc_WHMAPMODEId; +USHORT nRsc_X; +USHORT nRsc_Y; +USHORT nRsc_WIDTH; +USHORT nRsc_HEIGHT; +USHORT nRsc_DELTALANG; +USHORT nRsc_DELTASYSTEM; +USHORT nRsc_EXTRADATA; + +void InitRscCompiler() +{ + pHS = new HashString( 3271 ); + + pStdParType = new ByteString( "( const ResId & rResId, BOOL" ); + pStdPar1 = new ByteString( '(' ); + pStdPar2 = new ByteString( '(' ); + + pWinParType = new ByteString( "( Window * pParent, const ResId & rResId, BOOL" ); + pWinPar1 = new ByteString( "( pParent," ); + pWinPar2 = new ByteString( "( this," ); + nRefDeep = 10; + nRsc_XYMAPMODEId = HASH_NONAME; + nRsc_WHMAPMODEId = HASH_NONAME; +}; + diff --git a/rsc/source/res/rscarray.cxx b/rsc/source/res/rscarray.cxx new file mode 100644 index 000000000000..64bf18bc38d5 --- /dev/null +++ b/rsc/source/res/rscarray.cxx @@ -0,0 +1,766 @@ +/************************************************************************* + * + * $RCSfile: rscarray.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/res/rscarray.cxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $ + +**************************************************************************/ +/****************** I N C L U D E S **************************************/ + +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +// Programmabhaengige Includes. +#ifndef _RSCCONST_HXX +#include <rscconst.hxx> +#endif +#ifndef _RSCSARRAY_HXX +#include <rscarray.hxx> +#endif +#ifndef _RSCDB_HXX +#include <rscdb.hxx> +#endif + +/****************** C O D E **********************************************/ +/****************** R s c I n s t N o d e ********************************/ +/************************************************************************* +|* +|* RscInstNode::RscInstNode() +|* +|* Beschreibung +|* Ersterstellung MM 06.08.91 +|* Letzte Aenderung MM 06.08.91 +|* +*************************************************************************/ +RscInstNode::RscInstNode( USHORT nId ) +{ + nTypeId = nId; +} + +/************************************************************************* +|* +|* RscInstNode::~RscInstNode() +|* +|* Beschreibung +|* Ersterstellung MM 06.08.91 +|* Letzte Aenderung MM 06.08.91 +|* +*************************************************************************/ +RscInstNode::~RscInstNode() +{ + if( aInst.IsInst() ) + { + aInst.pClass->Destroy( aInst ); + RscMem::Free( aInst.pData ); + } +} + +/************************************************************************* +|* +|* RscInstNode::GetId() +|* +|* Beschreibung +|* Ersterstellung MM 06.08.91 +|* Letzte Aenderung MM 06.08.91 +|* +*************************************************************************/ +USHORT RscInstNode::GetId() const +{ + return nTypeId; +} + +/****************** R s c A r r a y *************************************/ +/************************************************************************* +|* +|* RscArray::RscArray() +|* +|* Beschreibung +|* Ersterstellung MM 25.05.91 +|* Letzte Aenderung MM 25.05.91 +|* +*************************************************************************/ +RscArray::RscArray( HASHID nId, USHORT nTypeId, RscTop * pSuper, + RscEnum * pTypeCl, + USHORT * pTypeValue, USHORT * pFallBackType ) + : RscTop( nId, nTypeId, pSuper ) +{ + pTypeClass = pTypeCl; + nOffInstData = RscTop::Size(); + nSize = nOffInstData + ALIGNED_SIZE( sizeof( RscArrayInst ) ); + pWriteTypeValue = pTypeValue; + pWriteDfltTypeValue = pFallBackType; +} + +/************************************************************************* +|* +|* RscArray::~RscArray() +|* +|* Beschreibung +|* Ersterstellung MM 25.05.91 +|* Letzte Aenderung MM 25.05.91 +|* +*************************************************************************/ +RscArray::~RscArray() +{ +} + +/************************************************************************* +|* +|* RscArray::~RscArray() +|* +|* Beschreibung +|* Ersterstellung MM 25.05.91 +|* Letzte Aenderung MM 25.05.91 +|* +*************************************************************************/ +RSCCLASS_TYPE RscArray::GetClassType() const +{ + return RSCCLASS_ENUMARRAY; +} + +/************************************************************************* +|* +|* RscArray::GetIndexType() +|* +|* Beschreibung +|* Ersterstellung MM 23.12.92 +|* Letzte Aenderung MM +|* +*************************************************************************/ +RscTop * RscArray::GetTypeClass() const +{ + return pTypeClass; +} + +/************************************************************************* +|* +|* RscArray::Create() +|* +|* Beschreibung +|* Ersterstellung MM 26.04.91 +|* Letzte Aenderung MM 26.04.91 +|* +*************************************************************************/ +static RscInstNode * Create( RscInstNode * pNode ) +{ + RscInstNode * pRetNode = NULL; + RscInstNode * pTmpNode; + + if( pNode ) + { + pRetNode = new RscInstNode( pNode->GetId() ); + pRetNode->aInst = pNode->aInst.pClass->Create( NULL, pNode->aInst ); + if( (pTmpNode = Create( pNode->Left() )) != NULL ) + pRetNode->Insert( pTmpNode ); + if( (pTmpNode = Create( pNode->Right() )) != NULL ) + pRetNode->Insert( pTmpNode ); + } + + return pRetNode; +} + +RSCINST RscArray::Create( RSCINST * pInst, const RSCINST & rDflt, + BOOL bOwnClass ) +{ + RSCINST aInst; + RscArrayInst * pClassData; + + if( !pInst ) + { + aInst.pClass = this; + aInst.pData = (CLASS_DATA) RscMem::Malloc( Size() ); + } + else + aInst = *pInst; + if( !bOwnClass && rDflt.IsInst() ) + bOwnClass = rDflt.pClass->InHierarchy( this ); + + RscTop::Create( &aInst, rDflt, bOwnClass ); + + pClassData = (RscArrayInst *)(aInst.pData + nOffInstData); + pClassData->pNode = NULL; + if( bOwnClass ) + { + RscArrayInst * pDfltClassData; + + pDfltClassData = (RscArrayInst *)(rDflt.pData + nOffInstData); + + pClassData->pNode = ::Create( pDfltClassData->pNode ); + } + return( aInst ); +} + +/************************************************************************* +|* +|* RscArray::Destroy() +|* +|* Beschreibung +|* +*************************************************************************/ +static void Destroy( RscInstNode * pNode ) +{ + if( pNode ) + { + Destroy( pNode->Left() ); + Destroy( pNode->Right() ); + delete pNode; + } +} + +void RscArray::Destroy( const RSCINST & rInst ) +{ + RscArrayInst * pClassData; + + RscTop::Destroy( rInst ); + + pClassData = (RscArrayInst *)(rInst.pData + nOffInstData); + + //Baum rekursiv loeschen + ::Destroy( pClassData->pNode ); +} + +/************************************************************************* +|* +|* RscArray::GetValueEle() +|* +|* Beschreibung +|* +*************************************************************************/ +ERRTYPE RscArray::GetValueEle +( + const RSCINST & rInst, + long lValue, + RscTop * pCreateClass, + RSCINST * pGetInst +) +{ + RscArrayInst * pClassData; + RscInstNode * pNode; + + pClassData = (RscArrayInst *)(rInst.pData + nOffInstData); + + ERRTYPE aError; + + HASHID nId; + if( (lValue < 0) || (lValue > 0xFFFF) + || !pTypeClass->GetValueConst( (USHORT)lValue, &nId ) ) + { // nicht gefunden + return ERR_ARRAY_INVALIDINDEX; + } + + if( pClassData->pNode ) + pNode = pClassData->pNode->Search( (USHORT)lValue ); + else + pNode = NULL; + +/* + if( pNode ) + { + if( pNode->aInst.pClass->IsDefault( pNode->aInst ) ) + { + GetSuperClass()->Destroy( pNode->aInst ); + GetSuperClass()->Create( &pNode->aInst, rInst ); + pNode->aInst.pClass->SetToDefault( pNode->aInst ); + } + } + else +*/ + if( !pNode ) + { + pNode = new RscInstNode( (USHORT)lValue ); + if( pCreateClass && GetSuperClass()->InHierarchy( pCreateClass ) ) + pNode->aInst = pCreateClass->Create( NULL, rInst ); + else + pNode->aInst = GetSuperClass()->Create( NULL, rInst ); + pNode->aInst.pClass->SetToDefault( pNode->aInst ); + if( pClassData->pNode ) + pClassData->pNode->Insert( pNode ); + else + pClassData->pNode = pNode; + } + + *pGetInst = pNode->aInst; + return aError; +} + +/************************************************************************* +|* +|* RscArray::GetArrayEle() +|* +|* Beschreibung +|* +*************************************************************************/ +ERRTYPE RscArray::GetArrayEle +( + const RSCINST & rInst, + HASHID nId, + RscTop * pCreateClass, + RSCINST * pGetInst +) +{ + INT32 lValue; + if( !pTypeClass->GetConstValue( nId, &lValue ) ) + { // nicht gefunden + return ERR_ARRAY_INVALIDINDEX; + } + + return GetValueEle( rInst, lValue, pCreateClass, pGetInst ); +} + +/************************************************************************* +|* +|* RscArray::IsConsistent() +|* +|* Beschreibung +|* Ersterstellung MM 23.09.91 +|* Letzte Aenderung MM 23.09.91 +|* +*************************************************************************/ +static BOOL IsConsistent( RscInstNode * pNode, RscInconsList * pList ) +{ + BOOL bRet = TRUE; + + if( pNode ) + { + bRet = pNode->aInst.pClass->IsConsistent( pNode->aInst, pList ); + if( !IsConsistent( pNode->Left(), pList ) ) + bRet = FALSE; + if( !IsConsistent( pNode->Right(), pList ) ) + bRet = FALSE; + } + return bRet; +} + +BOOL RscArray::IsConsistent( const RSCINST & rInst, RscInconsList * pList ) +{ + RscArrayInst * pClassData; + BOOL bRet; + + bRet = RscTop::IsConsistent( rInst, pList ); + + pClassData = (RscArrayInst *)(rInst.pData + nOffInstData); + if( !::IsConsistent( pClassData->pNode, pList ) ) + bRet = FALSE; + + return( bRet ); +} + +/************************************************************************* +|* +|* RscArray::SetToDefault() +|* +|* Beschreibung +|* Ersterstellung MM 25.04.91 +|* Letzte Aenderung MM 25.04.91 +|* +*************************************************************************/ +static void SetToDefault( RscInstNode * pNode ) +{ + if( pNode ) + { + pNode->aInst.pClass->SetToDefault( pNode->aInst ); + SetToDefault( pNode->Left() ); + SetToDefault( pNode->Right() ); + } +} + +void RscArray::SetToDefault( const RSCINST & rInst ) +{ + RscArrayInst * pClassData; + + pClassData = (RscArrayInst *)(rInst.pData + nOffInstData); + + ::SetToDefault( pClassData->pNode ); + + RscTop::SetToDefault( rInst ); +} + +/************************************************************************* +|* +|* RscArray::IsDefault() +|* +|* Beschreibung +|* Ersterstellung MM 25.04.91 +|* Letzte Aenderung MM 25.04.91 +|* +*************************************************************************/ +static BOOL IsDefault( RscInstNode * pNode ) +{ + BOOL bRet = TRUE; + + if( pNode ) + { + bRet = pNode->aInst.pClass->IsDefault( pNode->aInst ); + if( bRet ) + bRet = IsDefault( pNode->Left() ); + if( bRet ) + bRet = IsDefault( pNode->Right() ); + } + return bRet; +} + +BOOL RscArray::IsDefault( const RSCINST & rInst ) +{ + RscArrayInst * pClassData; + + pClassData = (RscArrayInst *)(rInst.pData + nOffInstData); + + BOOL bRet = ::IsDefault( pClassData->pNode ); + + if( bRet ) + bRet = RscTop::IsDefault( rInst ); + return bRet; +} + +/************************************************************************* +|* +|* RscArray::IsValueDefault() +|* +|* Beschreibung +|* Ersterstellung MM 25.04.91 +|* Letzte Aenderung MM 15.01.92 +|* +*************************************************************************/ +static BOOL IsValueDefault( RscInstNode * pNode, CLASS_DATA pDef ) +{ + BOOL bRet = TRUE; + + if( pNode ) + { + bRet = pNode->aInst.pClass->IsValueDefault( pNode->aInst, pDef ); + if( bRet ) + bRet = IsValueDefault( pNode->Left(), pDef ); + if( bRet ) + bRet = IsValueDefault( pNode->Right(), pDef ); + } + return bRet; +} + +BOOL RscArray::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) +{ + RscArrayInst * pClassData; + BOOL bRet; + + bRet = RscTop::IsValueDefault( rInst, pDef ); + + if( bRet ) + { + pClassData = (RscArrayInst *)(rInst.pData + nOffInstData); + + bRet = ::IsValueDefault( pClassData->pNode, pDef ); + } + return bRet; +} + +/************************************************************************* +|* RscArray::WriteSrcHeader() +|* +|* Beschreibung +*************************************************************************/ +void RscArray::WriteSrcHeader( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, + const RscId & aId, const char * pVarName ) +{ + RscArrayInst * pClassData; + + pClassData = (RscArrayInst *)(rInst.pData + nOffInstData); + + if( pTC->IsSrsDefault() ) + { // nur einen Wert schreiben + RscInstNode * pNode = NULL; + if( pClassData->pNode ) + { + pNode = pClassData->pNode->Search( *pWriteTypeValue ); + if( !pNode && *pWriteTypeValue != *pWriteDfltTypeValue ) + pNode = pClassData->pNode->Search( *pWriteDfltTypeValue ); + } + + if( pNode ) + { + if( pNode->aInst.pClass->IsDefault( pNode->aInst ) ) + fprintf( fOutput, "Default" ); + else + pNode->aInst.pClass->WriteSrcHeader( + pNode->aInst, fOutput, + pTC, nTab, aId, pVarName ); + return; + } + } + + if( IsDefault( rInst ) ) + fprintf( fOutput, "Default" ); + else + { + RSCINST aSuper( GetSuperClass(), rInst.pData ); + aSuper.pClass->WriteSrcHeader( aSuper, fOutput, pTC, + nTab, aId, pVarName ); + } + if( !pTC->IsSrsDefault() ) + WriteSrc( rInst, fOutput, pTC, nTab, pVarName ); +} + +/************************************************************************* +|* RscArray::WriteSrc() +|* +|* Beschreibung +*************************************************************************/ +static void WriteSrc( RscInstNode * pNode, FILE * fOutput, RscTypCont * pTC, + USHORT nTab, const char * pVarName, + CLASS_DATA pDfltData, RscConst * pTypeClass ) +{ + if( pNode ) + { + WriteSrc( pNode->Left(), fOutput, pTC, nTab, pVarName, + pDfltData, pTypeClass ); + if( !pNode->aInst.pClass->IsValueDefault( pNode->aInst, pDfltData ) ) + { + fprintf( fOutput, ";\n" ); + for( USHORT n = 0; n < nTab; n++ ) + fputc( '\t', fOutput ); + + HASHID nIdxId; + pTypeClass->GetValueConst( pNode->GetId(), &nIdxId ); + fprintf( fOutput, "%s[ %s ] = ", pVarName, pHS->Get( nIdxId ) ); + pNode->aInst.pClass->WriteSrcHeader( pNode->aInst, fOutput, pTC, + nTab, RscId(), pVarName ); + } + WriteSrc( pNode->Right(), fOutput, pTC, nTab, pVarName, + pDfltData, pTypeClass ); + } +} + +void RscArray::WriteSrcArray( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, + const char * pVarName ) +{ + RscArrayInst * pClassData; + + pClassData = (RscArrayInst *)(rInst.pData + nOffInstData); + + ::WriteSrc( pClassData->pNode, fOutput, pTC, nTab, pVarName, + rInst.pData, pTypeClass ); +}; + +void RscArray::WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, + const char * pVarName ) +{ + WriteSrcArray( rInst, fOutput, pTC, nTab, pVarName ); +} + +/************************************************************************* +|* RscArray::WriteRc() +|* +|* Beschreibung +*************************************************************************/ +ERRTYPE RscArray::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, + RscTypCont * pTC, USHORT nDeep, BOOL bExtra ) +{ + ERRTYPE aError; + RscArrayInst * pClassData; + RscInstNode * pNode = NULL; + + pClassData = (RscArrayInst *)(rInst.pData + nOffInstData); + + if( pClassData->pNode ) + { + pNode = pClassData->pNode->Search( *pWriteTypeValue ); + if( !pNode && *pWriteTypeValue != *pWriteDfltTypeValue ) + pNode = pClassData->pNode->Search( *pWriteDfltTypeValue ); + } + + if( pNode ) + aError = pNode->aInst.pClass->WriteRc( pNode->aInst, rMem, pTC, + nDeep, bExtra ); + else + aError = RscTop::WriteRc( rInst, rMem, pTC, nDeep, bExtra ); + + return aError; +} + +//======================================================================== +void RscArray::WriteRcAccess +( + FILE * fOutput, + RscTypCont * pTC, + const char * pName +) +{ + GetSuperClass()->WriteRcAccess( fOutput, pTC, pName ); +} + +/************************************************************************* +|* +|* RscClassArray::RscClassArray() +|* +|* Beschreibung +|* Ersterstellung MM 25.05.91 +|* Letzte Aenderung MM 25.05.91 +|* +*************************************************************************/ +RscClassArray::RscClassArray( HASHID nId, USHORT nTypeId, RscTop * pSuper, + RscEnum * pTypeCl, + USHORT * pTypeValue, USHORT * pFallBackType ) + : RscArray( nId, nTypeId, pSuper, pTypeCl, pTypeValue, pFallBackType ) +{ +} + +/************************************************************************* +|* +|* RscClassArray::~RscClassArray() +|* +|* Beschreibung +|* Ersterstellung MM 25.05.91 +|* Letzte Aenderung MM 25.05.91 +|* +*************************************************************************/ +RscClassArray::~RscClassArray() +{ +} + +/************************************************************************* +|* +|* RscClassArray::WriteSrcHeader() +|* +|* Beschreibung +|* Ersterstellung MM 25.05.91 +|* Letzte Aenderung MM 25.05.91 +|* +*************************************************************************/ +void RscClassArray::WriteSrcHeader( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, + const RscId & aId, const char * pName ) +{ + RscArray::WriteSrcHeader( rInst, fOutput, pTC, nTab, aId, pName ); +} + +/************************************************************************* +|* +|* RscClassArray::WriteSrc() +|* +|* Beschreibung +|* Ersterstellung MM 25.05.91 +|* Letzte Aenderung MM 25.05.91 +|* +*************************************************************************/ +void RscClassArray::WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, + const char * pVarName ) +{ + RscArray::WriteSrc( rInst, fOutput, pTC, nTab, pVarName ); +} + +/************************************************************************* +|* +|* RscClassArray::WriteRcHeader() +|* +|* Beschreibung +|* Ersterstellung MM 25.05.91 +|* Letzte Aenderung MM 25.05.91 +|* +*************************************************************************/ +ERRTYPE RscClassArray::WriteRcHeader( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, const RscId & aId, + USHORT nDeep, BOOL bExtra ) +{ + // Eigenen Typ schreiben + return GetSuperClass()->WriteRcHeader( rInst, aMem, pTC, aId, + nDeep, bExtra ); +} + +/************************************************************************* +|* +|* RscLangArray::RscLangArray() +|* +|* Beschreibung +|* Ersterstellung MM 25.05.91 +|* Letzte Aenderung MM 25.05.91 +|* +*************************************************************************/ +RscLangArray::RscLangArray( HASHID nId, USHORT nTypeId, RscTop * pSuper, + RscEnum * pTypeCl, + USHORT * pTypeValue, USHORT * pFallBackType ) + : RscArray( nId, nTypeId, pSuper, pTypeCl, pTypeValue, pFallBackType ) +{ +} + +/************************************************************************* +|* +|* RscLangArray::RscLangArray() +|* +|* Beschreibung +|* Ersterstellung MM 25.05.91 +|* Letzte Aenderung MM 25.05.91 +|* +*************************************************************************/ +RSCCLASS_TYPE RscLangArray::GetClassType() const +{ + if( GetSuperClass() ) + return GetSuperClass()->GetClassType(); + else + return RscArray::GetClassType(); + +} + diff --git a/rsc/source/res/rscclass.cxx b/rsc/source/res/rscclass.cxx new file mode 100644 index 000000000000..30de42d9a174 --- /dev/null +++ b/rsc/source/res/rscclass.cxx @@ -0,0 +1,1324 @@ +/************************************************************************* + * + * $RCSfile: rscclass.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/res/rscclass.cxx,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.39 2000/09/17 12:51:11 willem.vandorp + OpenOffice header added. + + Revision 1.38 2000/07/26 17:13:22 willem.vandorp + Headers/footers replaced + + Revision 1.37 2000/07/12 11:38:05 th + Unicode + + Revision 1.36 1999/11/24 17:54:35 th + remove dependencies to vcl + + Revision 1.35 1999/09/08 09:24:59 mm + BigEndian/LittleEndian komplett durchgezogen + + Revision 1.34 1999/09/07 13:30:05 mm + UniCode + +**************************************************************************/ +/****************** I N C L U D E S **************************************/ + +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +// Programmabhaengige Includes. +#ifndef _RSCDB_HXX +#include <rscdb.hxx> +#endif +#ifndef _RSCCLASS_HXX +#include <rscclass.hxx> +#endif + +#include <tools/fsys.hxx> +#include <tools/rcid.h> +#include <tools/rc.h> + +/****************** C O D E **********************************************/ +/****************** R s c C l a s s **************************************/ +/************************************************************************* +|* +|* RscClass::RscClass() +|* +|* Beschreibung +|* Ersterstellung MM 25.05.91 +|* Letzte Aenderung MM 25.05.91 +|* +*************************************************************************/ +RscClass::RscClass( HASHID nId, USHORT nTypeId, RscTop * pSuperCl ) + : RscTop( nId, nTypeId, pSuperCl ) +{ + nEntries = 0; + pVarTypeList = NULL; + nSuperSize = RscTop::Size(); + nSize = nSuperSize + ALIGNED_SIZE( sizeof( RscClassInst ) ); +} + +/************************************************************************* +|* +|* RscClass::Pre_dtor() +|* +|* Beschreibung +|* Ersterstellung MM 25.05.91 +|* Letzte Aenderung MM 25.05.91 +|* +*************************************************************************/ +void RscClass::Pre_dtor() +{ + USHORT i; + + RscTop::Pre_dtor(); + + for( i = 0; i < nEntries; i++ ) + { + if( pVarTypeList[ i ].pDefault ) + { + pVarTypeList[ i ].pClass->Destroy( + RSCINST( pVarTypeList[ i ].pClass, + pVarTypeList[ i ].pDefault ) ); + RscMem::Free( pVarTypeList[ i ].pDefault ); + pVarTypeList[ i ].pDefault = NULL; + }; + }; +} + +/************************************************************************* +|* +|* RscClass::~RscClass() +|* +|* Beschreibung +|* Ersterstellung MM 25.05.91 +|* Letzte Aenderung MM 25.05.91 +|* +*************************************************************************/ +RscClass::~RscClass() +{ + if( pVarTypeList ) + RscMem::Free( (void *)pVarTypeList ); +} + +/************************************************************************* +|* +|* RscClass::GetClassType() +|* +|* Beschreibung +|* Ersterstellung MM 25.05.91 +|* Letzte Aenderung MM 25.05.91 +|* +*************************************************************************/ +RSCCLASS_TYPE RscClass::GetClassType() const +{ + return RSCCLASS_COMPLEX; +} + +/************************************************************************* +|* +|* RscClass::GetInstData() +|* +|* Beschreibung +|* Ersterstellung MM 15.04.91 +|* Letzte Aenderung MM 15.04.91 +|* +*************************************************************************/ +RSCINST RscClass::GetInstData +( + CLASS_DATA pData, + USHORT nEle, + BOOL bGetCopy +) +{ + RSCINST aInst; + + aInst.pClass = pVarTypeList[ nEle ].pClass; + if( pData ) + { + if( VAR_NODATAINST & pVarTypeList[ nEle ].nVarType ) + { + RSCINST aTmpI; + + aTmpI.pClass = this; + aTmpI.pData = pData; + if( bGetCopy ) + aInst.pData = GetCopyVar( + aTmpI, + pVarTypeList[ nEle ].nDataBaseName + ).pData; + else + aInst.pData = GetVariable( + aTmpI, + pVarTypeList[ nEle ].nDataBaseName, + RSCINST() + ).pData; + } + else if( VAR_POINTER & pVarTypeList[ nEle ].nVarType ) + { + if( VAR_EXTENDABLE & pVarTypeList[ nEle ].nVarType ) + aInst = *(RSCINST *) + (pData + pVarTypeList[ nEle ].nOffset); + else + aInst.pData = *(CLASS_DATA *) + (pData + pVarTypeList[ nEle ].nOffset); + } + else + aInst.pData = pData + pVarTypeList[ nEle ].nOffset; + }; + return( aInst ); +} + +/************************************************************************* +|* +|* RscClass::GetInstDflt() +|* +|* Beschreibung +|* +*************************************************************************/ +CLASS_DATA RscClass::GetDfltData( USHORT nEle ) +{ + if( pVarTypeList[ nEle ].pDefault ) + return pVarTypeList[ nEle ].pDefault; + + return pVarTypeList[ nEle ].pClass->GetDefault().pData; +} + +/************************************************************************* +|* +|* RscClass::SetVarDflt() +|* +|* Beschreibung +|* Ersterstellung MM 22.07.91 +|* Letzte Aenderung MM 22.07.91 +|* +*************************************************************************/ +void RscClass::SetVarDflt( CLASS_DATA pData, USHORT nEle, BOOL bSet ) +{ + RscClassInst * pClass; + + pClass = (RscClassInst *)(pData + nSuperSize ); + if( bSet ) + pClass->nVarDflt |= ((ULONG)1 << nEle); + else + pClass->nVarDflt &= ~((ULONG)1 << nEle); +} + +/************************************************************************* +|* +|* RscClass::IsDflt() +|* +|* Beschreibung +|* Ersterstellung MM 22.07.91 +|* Letzte Aenderung MM 08.01.92 +|* +*************************************************************************/ +BOOL RscClass::IsDflt( CLASS_DATA pData, USHORT nEle ) +{ + RscClassInst * pClass; + BOOL bRet; + + pClass = (RscClassInst *)(pData + nSuperSize ); + if( pClass->nVarDflt & ((ULONG)1 << nEle) ) + bRet = TRUE; + else + bRet = FALSE; +/* { + //Variablenname ist Default + RSCINST aTmpI; + + aTmpI = GetInstData( pData, nEle, TRUE ); + if( aTmpI.IsInst() && !aTmpI.pClass->IsDefault( aTmpI ) ) + bRet = FALSE; + } +*/ + return bRet; +} + +/************************************************************************* +|* +|* RscClass::Create() +|* +|* Beschreibung +|* Ersterstellung MM 03.04.91 +|* Letzte Aenderung MM 03.04.91 +|* +*************************************************************************/ +RSCINST RscClass::Create +( + RSCINST * pInst, + const RSCINST & rDflt, + BOOL bOwnClass +) +{ + USHORT i; + CLASS_DATA * ppData; + RSCINST aInst; + RSCINST aMemInst, aDfltI; + + if( !pInst ) + { + aInst.pClass = this; + aInst.pData = (CLASS_DATA) RscMem::Malloc( Size() ); + } + else + aInst = *pInst; + if( !bOwnClass && rDflt.IsInst() ) + bOwnClass = rDflt.pClass->InHierarchy( this ); + + RscTop::Create( &aInst, rDflt, bOwnClass ); + + if( bOwnClass ) + ((RscClassInst *)(aInst.pData + nSuperSize))->nVarDflt = + ((RscClassInst *)(rDflt.pData + nSuperSize))->nVarDflt; + else + ((RscClassInst *)(aInst.pData + nSuperSize))->nVarDflt = 0xFFFFFFFF; + + for( i = 0; i < nEntries; i++ ) + { + aDfltI = GetInstData( bOwnClass ? rDflt.pData : NULL, i, TRUE ); + + if( (VAR_POINTER & pVarTypeList[ i ].nVarType) + && !(VAR_NODATAINST & pVarTypeList[ i ].nVarType) ) + { + if( VAR_EXTENDABLE & pVarTypeList[ i ].nVarType ) + { + RSCINST * pInst = (RSCINST *) + (aInst.pData + pVarTypeList[ i ].nOffset ); + pInst->pClass = pVarTypeList[ i ].pClass; + ppData = &pInst->pData; + } + else + ppData = (CLASS_DATA* ) + (aInst.pData + pVarTypeList[ i ].nOffset ); + *ppData = NULL; + if( aDfltI.IsInst() ) + { + aMemInst = pVarTypeList[ i ].pClass->Create( NULL, aDfltI ); + *ppData = aMemInst.pData; + }; + } + else + { + aMemInst = GetInstData( aInst.pData, i, TRUE ); + aMemInst = aMemInst.pClass->Create( &aMemInst, aDfltI ); + }; + } + + return( aInst ); +} + +/************************************************************************* +|* +|* RscClass::Destroy() +|* +|* Beschreibung +|* +*************************************************************************/ +void RscClass::Destroy( const RSCINST & rInst ) +{ + USHORT i; + + RscTop::Destroy( rInst ); + + for( i = 0; i < nEntries; i++ ) + { + if( !(pVarTypeList[ i ].nVarType & VAR_NODATAINST) ) + { + RSCINST aTmpI; + + aTmpI = GetInstData( rInst.pData, i, TRUE ); + if( aTmpI.IsInst() ) + { + // Objekt loeschen + aTmpI.pClass->Destroy( aTmpI ); + if( pVarTypeList[ i ].nVarType & VAR_POINTER ) + { + // Speicher freigeben + RscMem::Free( aTmpI.pData ); + }; + }; + } + }; +} + +/************************************************************************* +|* +|* RscClass::SetVariable() +|* +|* Beschreibung +|* +*************************************************************************/ +ERRTYPE RscClass::SetVariable +( + HASHID nVarName, + RscTop * pClass, + RSCINST * pDflt, + RSCVAR nVarType, + USHORT nMask, + HASHID nDataBaseName +) +{ + if( pVarTypeList ) + pVarTypeList = (VARTYPE_STRUCT *) + RscMem::Realloc( (void *)pVarTypeList, + (USHORT)((nEntries +1) * sizeof( VARTYPE_STRUCT )) ); + else + pVarTypeList = (VARTYPE_STRUCT *) + RscMem::Malloc( (USHORT)((nEntries +1) + * sizeof( VARTYPE_STRUCT )) ); + + pVarTypeList[ nEntries ].nVarName = nVarName; + pVarTypeList[ nEntries ].nMask = nMask; + pVarTypeList[ nEntries ].pClass = pClass; + pVarTypeList[ nEntries ].nOffset = nSize; + pVarTypeList[ nEntries ].nDataBaseName = nDataBaseName; + if( pDflt ) + pVarTypeList[ nEntries ].pDefault = pDflt->pData; + else + pVarTypeList[ nEntries ].pDefault = NULL; + + pVarTypeList[ nEntries ].nVarType = ~VAR_POINTER & nVarType; + if( pClass->Size() > 10 || (nVarType & VAR_EXTENDABLE) ) + pVarTypeList[ nEntries ].nVarType |= VAR_POINTER; + + if( !(pVarTypeList[ nEntries ].nVarType & VAR_NODATAINST) ) + { + if( pVarTypeList[ nEntries ].nVarType & VAR_POINTER ) + { + if( pVarTypeList[ nEntries ].nVarType & VAR_EXTENDABLE ) + nSize += sizeof( RSCINST ); + else + nSize += sizeof( CLASS_DATA ); + } + else + nSize += pClass->Size(); + } + + nEntries++; + if( nEntries > (sizeof( ULONG ) * 8) ) + { + // Bereich fuer Default zu klein + RscExit( 16 ); + }; + return( ERR_OK ); +} + +/************************************************************************* +|* +|* RscClass::EnumVariable() +|* +|* Beschreibung +|* +*************************************************************************/ +void RscClass::EnumVariables( void * pData, VarEnumCallbackProc pProc ) +{ + USHORT i; + + RscTop::EnumVariables( pData, pProc ); + for( i = 0; i < nEntries; i ++ ) + { + if( !(pVarTypeList[ i ].nVarType & VAR_NOENUM) ) + (*pProc)( pData, pVarTypeList[ i ].pClass->GetClassType(), + pVarTypeList[ i ].nVarName ); + } +} + +/************************************************************************* +|* +|* RscClass::GetVariable() +|* +|* Beschreibung +|* +*************************************************************************/ +RSCINST RscClass::GetVariable +( + const RSCINST & rInst, + HASHID nVarName, + const RSCINST & rInitInst, + BOOL bInitDflt, + RscTop * pCreateClass +) +{ + USHORT i; + RSCINST aTmpI; + + i = 0; + while( i < nEntries && pVarTypeList[ i ].nVarName != nVarName ) + i++; + if( i < nEntries ) + { + if( VAR_NODATAINST & pVarTypeList[ i ].nVarType ) + { + aTmpI = GetVariable( rInst, + pVarTypeList[ i ].nDataBaseName, + RSCINST() ); + aTmpI.pClass = pVarTypeList[ i ].pClass; + } + else + { + // Default Instanz generieren + RSCINST aDfltInst = rInitInst; + if( !aDfltInst.IsInst() && bInitDflt ) + { + // mit dem Variablen-Default besetzen + aDfltInst.pData = pVarTypeList[ i ].pDefault; + aDfltInst.pClass = pVarTypeList[ i ].pClass; + } + + aTmpI = GetInstData( rInst.pData, i ); + if( aTmpI.IsInst() ) + { + if( aDfltInst.IsInst() ) + { + aTmpI.pClass->Destroy( aTmpI ); + aTmpI.pClass->Create( &aTmpI, aDfltInst ); + } + } + else + { // Wird ueber Zeiger angegeben + if( VAR_EXTENDABLE & pVarTypeList[ i ].nVarType ) + { + RSCINST * pInst = (RSCINST *) + (rInst.pData + pVarTypeList[ i ].nOffset ); + if( pCreateClass && pCreateClass->InHierarchy( aTmpI.pClass ) ) + *pInst = pCreateClass->Create( NULL, aDfltInst ); + else + *pInst = aTmpI.pClass->Create( NULL, aDfltInst ); + aTmpI = *pInst; + } + else + { + CLASS_DATA * ppData + = (CLASS_DATA *)(rInst.pData + pVarTypeList[ i ].nOffset); + aTmpI = aTmpI.pClass->Create( NULL, aDfltInst ); + *ppData = aTmpI.pData; + } + } + }; + // auf nicht Default setzen + SetVarDflt( rInst.pData, i, FALSE ); + return( aTmpI ); + }; + + return( RscTop::GetVariable( rInst, nVarName, rInitInst, + bInitDflt, pCreateClass ) ); +} + +/************************************************************************* +|* +|* RscClass::GetCopyVar() +|* +|* Beschreibung +|* +*************************************************************************/ +RSCINST RscClass::GetCopyVar +( + const RSCINST & rInst, + HASHID nVarName +) +{ + USHORT i; + RSCINST aVarI; + + i = 0; + while( i < nEntries && pVarTypeList[ i ].nVarName != nVarName ) + i++; + + if( i < nEntries ) + { + if( VAR_NODATAINST & pVarTypeList[ i ].nVarType ) + { + aVarI = GetCopyVar( rInst, pVarTypeList[ i ].nDataBaseName ); + aVarI.pClass = pVarTypeList[ i ].pClass; + } + else + { + if( IsDflt( rInst.pData, i ) ) + { + // mit Variablen Default initialiaieren + aVarI = GetVariable( rInst, nVarName, RSCINST(), TRUE ); + SetVarDflt( rInst.pData, i, TRUE ); + } + else + aVarI = GetInstData( rInst.pData, i, TRUE ); + + }; + return aVarI ; + }; + + return RscTop::GetCopyVar( rInst, nVarName ); +} + +/************************************************************************* +|* +|* RscClass::IsConsistent() +|* +|* Beschreibung +|* +*************************************************************************/ +BOOL RscClass::IsConsistent( const RSCINST & rInst, RscInconsList * pList ) +{ + USHORT i; + RSCINST aTmpI; + BOOL bRet; + + bRet = RscTop::IsConsistent( rInst, pList ); + + for( i = 0; i < nEntries; i++ ) + { + if( !(VAR_NODATAINST & pVarTypeList[ i ].nVarType) ) + { + aTmpI = GetInstData( rInst.pData, i, TRUE ); + + if( aTmpI.IsInst() ) + if( ! aTmpI.pClass->IsConsistent( aTmpI, pList ) ) + bRet = FALSE; + } + }; + + return( bRet ); +} + +/************************************************************************* +|* +|* RscClass::SetToDefault() +|* +|* Beschreibung +|* +*************************************************************************/ +void RscClass::SetToDefault( const RSCINST & rInst ) +{ + USHORT i; + RSCINST aTmpI; + RscClassInst * pClass; + + pClass = (RscClassInst *)(rInst.pData + nSuperSize ); + + for( i = 0; i < nEntries; i++ ) + { + // Variablen ohne eigenen Speicher werden vom "Datenserver" + // auf Default gesetzt + if( !(VAR_NODATAINST & pVarTypeList[ i ].nVarType) ) + { + aTmpI = GetInstData( rInst.pData, i, TRUE ); + if( aTmpI.IsInst() ) + aTmpI.pClass->SetToDefault( aTmpI ); + } + } + pClass->nVarDflt = 0xFFFFFFFF; // alles auf Default + + RscTop::SetToDefault( rInst ); +} + +/************************************************************************* +|* +|* RscClass::IsDefault() +|* +|* Beschreibung +|* +*************************************************************************/ +BOOL RscClass::IsDefault( const RSCINST & rInst ) +{ + USHORT i; + RSCINST aTmpI; + + for( i = 0; i < nEntries; i++ ) + { + // Variablen ohne eigenen Speicher werden vom "Datenserver" + // auf Default untersucht + if( !(VAR_NODATAINST & pVarTypeList[ i ].nVarType) ) + if( !IsDflt( rInst.pData, i ) ) + return( FALSE ); + }; + + return( RscTop::IsDefault( rInst ) ); +} + +/************************************************************************* +|* +|* RscClass::GetDefault() +|* +|* Beschreibung +|* +*************************************************************************/ +RSCINST RscClass::GetDefault( HASHID nVarId ) +{ + USHORT i; + + i = 0; + while( i < nEntries && pVarTypeList[ i ].nVarName != nVarId ) + i++; + if( i < nEntries ) + { + RSCINST aTmpI; + + aTmpI.pClass = pVarTypeList[ i ].pClass; + aTmpI.pData = GetDfltData( i ); + return( aTmpI ); + }; + + return( RscTop::GetDefault( nVarId ) ); +} + +/************************************************************************* +|* +|* RscClass::IsValueDflt() +|* +|* Beschreibung +|* +*************************************************************************/ +BOOL RscClass::IsValueDflt( CLASS_DATA pData, USHORT nEle ) +{ + RSCINST aTmpI; + + aTmpI = GetInstData( pData, nEle, TRUE ); + + if( aTmpI.IsInst() ) + { + if( VAR_SVDYNAMIC & pVarTypeList[ nEle ].nVarType ) + return FALSE; + + if( aTmpI.pClass == pVarTypeList[ nEle ].pClass ) + //sie haben auch die gleiche Klasse + return aTmpI.pClass->IsValueDefault( aTmpI, GetDfltData( nEle ) ); + else + return FALSE; + } + return TRUE; +} + +/************************************************************************* +|* +|* RscClass::IsValueDefault() +|* +|* Beschreibung +|* +*************************************************************************/ +BOOL RscClass::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) +{ + USHORT i; + RSCINST aTmpI; + RSCINST aDfltI; + + if( !RscTop::IsValueDefault( rInst, pDef ) ) + return FALSE; + + if( pDef ) + { + for( i = 0; i < nEntries; i++ ) + { + aTmpI = GetInstData( rInst.pData, i, TRUE ); + if( aTmpI.IsInst() ) + { + if( aTmpI.pClass != pVarTypeList[ i ].pClass ) + //sie haben nicht die gleiche Klasse + return FALSE; + + aDfltI = GetInstData( pDef, i, TRUE ); + if( !aDfltI.IsInst() ) + aDfltI.pData = GetDfltData( i ); + + if( !aTmpI.pClass->IsValueDefault( aTmpI, aDfltI.pData ) ) + return FALSE; + } + } + } + else + return FALSE; + + return TRUE; +} + +/************************************************************************* +|* +|* RscClass::SetDefault() +|* +|* Beschreibung +|* +*************************************************************************/ +void RscClass::SetDefault( const RSCINST & rInst, HASHID nVarName ) +{ + USHORT i; + RSCINST aTmpI; + + i = 0; + while( i < nEntries && pVarTypeList[ i ].nVarName != nVarName ) + i++; + + if( i < nEntries ) + { + aTmpI = GetInstData( rInst.pData, i, TRUE ); + if( aTmpI.IsInst() ) + { + aTmpI.pClass->Destroy( aTmpI ); + aTmpI.pClass->Create( &aTmpI, RSCINST() ); + SetVarDflt( rInst.pData, i, TRUE ); + } + } + else //In Superklasse nach Variable suchen + RscTop::SetDefault( rInst, nVarName ); + +} + + +/************************************************************************* +|* +|* RscClass::WriteSrc() +|* +|* Beschreibung +|* +*************************************************************************/ +void RscClass::WriteSrc +( + const RSCINST & rInst, + FILE * fOutput, + RscTypCont * pTC, + USHORT nTab, + const char * pVarName +) +{ + USHORT i, n; + RSCINST aTmpI; + + RscTop::WriteSrc( rInst, fOutput, pTC, nTab, pVarName ); + + for( i = 0; i < nEntries; i++ ) + { + if( !(VAR_HIDDEN & pVarTypeList[ i ].nVarType) ) + { + // Hack wegen Position und Dimensiuon + if( nRsc_XYMAPMODEId == pVarTypeList[ i ].nVarName + || nRsc_WHMAPMODEId == pVarTypeList[ i ].nVarName ) + { + if( !IsDflt( rInst.pData, i ) //MapUnit + || !IsDflt( rInst.pData, i+1 ) //X, Width + || !IsDflt( rInst.pData, i+2 ) )//Y, Height + {// ein Wert ist nicht Default + for( n = 0; n < nTab; n++ ) + fputc( '\t', fOutput ); + if( nRsc_XYMAPMODEId == pVarTypeList[ i ].nVarName ) + fprintf( fOutput, "Pos = " ); + else + fprintf( fOutput, "Size = " ); + + if( !IsDflt( rInst.pData, i ) ) + { + aTmpI = GetInstData( rInst.pData, i, TRUE ); + aTmpI.pClass->WriteSrcHeader( + aTmpI, fOutput, pTC, nTab, RscId(), pVarName ); + } + + fprintf( fOutput, "( " ); + aTmpI = GetInstData( rInst.pData, i+1, TRUE ); + if( !aTmpI.IsInst() ) + aTmpI.pData = GetDfltData( i+1 ); + aTmpI.pClass->WriteSrcHeader( + aTmpI, fOutput, pTC, nTab, RscId(), pVarName ); + + fprintf( fOutput, ", " ); + aTmpI = GetInstData( rInst.pData, i+2, TRUE ); + if( !aTmpI.IsInst() ) + aTmpI.pData = GetDfltData( i+2 ); + aTmpI.pClass->WriteSrcHeader( + aTmpI, fOutput, pTC, nTab, RscId(), pVarName ); + fprintf( fOutput, " );\n" ); + } + i += 2; //_X, _Y oder _Widht, Height ueberlesen + } + else if( !IsDflt( rInst.pData, i ) + && !IsValueDflt( rInst.pData, i ) ) + { + aTmpI = GetInstData( rInst.pData, i, TRUE ); + + if( aTmpI.IsInst() ) + { + char * pName = pHS->Get( pVarTypeList[ i ].nVarName ); + + for( n = 0; n < nTab; n++ ) + fputc( '\t', fOutput ); + fprintf( fOutput, "%s", pName ); + fprintf( fOutput, " = " ); + aTmpI.pClass->WriteSrcHeader( + aTmpI, fOutput, pTC, nTab, RscId(), pName ); + fprintf( fOutput, ";\n" ); + } + }; + }; + }; + + return; +} + +/************************************************************************* +|* +|* RscClass::WriteInstRc() +|* +|* Beschreibung +|* +*************************************************************************/ +long RscClass::GetCorrectValues +( + const RSCINST & rInst, + USHORT nVarPos, + USHORT nTupelIdx, + RscTypCont * pTC +) +{ + long nLang = 0; + long nBaseValue; + + // Basiswert holen + RSCINST aTmpI = GetInstData( rInst.pData, nVarPos, TRUE ); + aTmpI.pClass->GetNumber( aTmpI, &nBaseValue ); + + // Sprach Delta holen + aTmpI = rInst.pClass->GetVariable( rInst, nRsc_DELTALANG, RSCINST() ); + if( aTmpI.IsInst() ) + { + RscWriteRc aMem; + aTmpI.pClass->WriteRc( aTmpI, aMem, pTC, 0, FALSE ); + nLang = (short)aMem.GetShort( nTupelIdx * sizeof( short ) ); + } + + return nLang + nBaseValue; +} + +ERRTYPE RscClass::WriteInstRc +( + const RSCINST & rInst, + RscWriteRc & rMem, + RscTypCont * pTC, + USHORT nDeep, + BOOL bExtra +) +{ + USHORT i; + ERRTYPE aError; + RSCINST aTmpI; + USHORT nMaskOff;// Offset um Maskenfeld zu addressieren + + // Wenn eine Variable Maskierung hat, dann Maskenfeld + for( i = 0; i < nEntries; i++ ) + { + if( pVarTypeList[ i ].nMask ) + { + nMaskOff = rMem.Size(); + rMem.Put( (USHORT)0 ); + break; + } + }; + + for( i = 0; i < nEntries && aError.IsOk(); i++ ) + { + if( !((VAR_NODATAINST | VAR_NORC) & pVarTypeList[ i ].nVarType )) + { + if( pVarTypeList[ i ].nMask ) + { + if( !IsDflt( rInst.pData, i ) ) + { + if( nRsc_X == pVarTypeList[ i ].nVarName ) + { + INT32 nVal = GetCorrectValues( rInst, i, 0, pTC ); + rMem.Put( nVal ); + } + else if( nRsc_Y == pVarTypeList[ i ].nVarName ) + { + INT32 nVal = GetCorrectValues( rInst, i, 1, pTC ); + rMem.Put( nVal ); + } + else if( nRsc_WIDTH == pVarTypeList[ i ].nVarName ) + { + INT32 nVal = GetCorrectValues( rInst, i, 2, pTC ); + rMem.Put( nVal ); + } + else if( nRsc_HEIGHT == pVarTypeList[ i ].nVarName ) + { + INT32 nVal = GetCorrectValues( rInst, i, 3, pTC ); + rMem.Put( nVal ); + } + else + { + aTmpI = GetInstData( rInst.pData, i, TRUE ); + // Nur an Variable Extradata bExtra nicht auf FALSE + // setzen + aError = aTmpI.pClass-> + WriteRcHeader( aTmpI, rMem, pTC, + RscId(), nDeep, + (nRsc_EXTRADATA + == pVarTypeList[ i ].nVarName) + ? bExtra : FALSE ); + } + USHORT nMask = rMem.GetShort( nMaskOff ); + nMask |= pVarTypeList[ i ].nMask; + rMem.PutAt( nMaskOff, nMask ); + } + } + else{ + if( IsDflt( rInst.pData, i ) ) + { + aTmpI.pClass = pVarTypeList[ i ].pClass; + aTmpI.pData = GetDfltData( i ); + } + else + aTmpI = GetInstData( rInst.pData, i, TRUE ); + // Nur an Variable Extradata bExtra nicht auf FALSE + // setzen + aError = aTmpI.pClass-> + WriteRcHeader( aTmpI, rMem, pTC, + RscId(), nDeep, + (nRsc_EXTRADATA + == pVarTypeList[ i ].nVarName) + ? bExtra : FALSE ); + } + } + } + + return( aError ); +} + +/************************************************************************* +|* +|* RscClass::WriteRc() +|* +|* Beschreibung +|* +*************************************************************************/ +ERRTYPE RscClass::WriteRc +( + const RSCINST & rInst, + RscWriteRc & rMem, + RscTypCont * pTC, + USHORT nDeep, + BOOL bExtra +) +{ + ERRTYPE aError; + + aError = RscTop::WriteRc( rInst, rMem, pTC, nDeep, bExtra ); + if( aError.IsOk() ) + aError = WriteInstRc( rInst, rMem, pTC, nDeep, bExtra ); + + return( aError ); +} + +/************************************************************************* +|* +|* RscClass::WriteSyntax() +|* +|* Beschreibung +|* +*************************************************************************/ +void RscClass::WriteSyntax( FILE * fOutput, RscTypCont * pTC ) +{ + RscTop::WriteSyntax( fOutput, pTC ); + + USHORT i; + // Wenn eine Variable Maskierung hat, dann Maskenfeld + fprintf( fOutput, "\t//%s\n", pHS->Get( GetId() ) ); + for( i = 0; i < nEntries; i++ ) + { + fprintf( fOutput, "\t%s", pHS->Get( pVarTypeList[ i ].nVarName ) ); + USHORT n = strlen( pHS->Get( pVarTypeList[ i ].nVarName ) ); + while( n < 20 ) + { + putc( ' ', fOutput ); + n++; + } + fprintf( fOutput, " = %s;\n", + pHS->Get( pVarTypeList[ i ].pClass->GetId() ) ); + }; +} + +//================================================================== +void RscClass::WriteRcAccess +( + FILE * fOutput, + RscTypCont * pTC, + const char * pName +) +{ + fprintf( fOutput, "\t\tSet%s( %s ", pName, pHS->Get( GetId() ) ); + fprintf( fOutput, "%s ", aCallPar2.GetBuffer() ); + fprintf( fOutput, "ResId( (RSHEADER_TYPE*)(pResData+nOffset) ) ) );\n" ); + fprintf( fOutput, "\t\tnOffset += GetObjSizeRes( (RSHEADER_TYPE*)(pResData+nOffset) );\n" ); +} + +//================================================================== +void RscClass::WriteRcCtor( FILE * fOutput, RscTypCont * pTC ) +{ + if( GetId() != HASH_NONAME ) + { + // Konstruktor + fprintf( fOutput, "%s::%s%s bFreeResource )", + pHS->Get( GetId() ), pHS->Get( GetId() ), + aCallParType.GetBuffer() ); + if( GetSuperClass() ) + { + // Superaufruf + fprintf( fOutput, "\n\t: %s", pHS->Get( GetSuperClass()->GetId() ) ); + fprintf( fOutput, "%s", GetSuperClass()->aCallPar1.GetBuffer() ); + fprintf( fOutput, " rResId.SetRT2( 0x%x ) )", GetTypId() ); + } + fprintf( fOutput, "\n{\n" ); + fprintf( fOutput, "\tUSHORT\tnObjMask;\n" ); + fprintf( fOutput, "\tUSHORT\tnOffset = 0;\n" ); + fprintf( fOutput, "\tBYTE *\tpResData;\n\n" ); + fprintf( fOutput, "\tpResData = (BYTE *)GetClassRes();\n\n" ); + fprintf( fOutput, "\tnObjMask = *(USHORT*)pResData;\n" ); + fprintf( fOutput, "\tnOffset += 2;\n\n" ); + + for( USHORT i = 0; i < nEntries; i++ ) + { + if( !((VAR_NODATAINST | VAR_NORC) & pVarTypeList[ i ].nVarType )) + { + fprintf( fOutput, "\tif( nObjMask & 0x%x )\n\t{\n", + pVarTypeList[ i ].nMask ); + + pVarTypeList[ i ].pClass->WriteRcAccess( fOutput, pTC, + pHS->Get( pVarTypeList[ i ].nVarName ) ); + + fprintf( fOutput, "\t}\n" ); + } + } + fprintf( fOutput, "\tIncrementRes( nOffset );\n" ); + fprintf( fOutput, "\tif( bFreeResource )\n" ); + fprintf( fOutput, "\t\tFreeResource();\n" ); + fprintf( fOutput, "}\n\n" ); + } +} + +/************************************************************************* +|* +|* RscSysDepend::RscSysDepend() +|* +|* Beschreibung +|* +*************************************************************************/ +RscSysDepend::RscSysDepend( HASHID nId, USHORT nTypeId, RscTop * pSuper ) + : RscClass( nId, nTypeId, pSuper ) +{} + +/************************************************************************* +|* +|* RscSysDepend::WriteRc() +|* +|* Beschreibung +|* +*************************************************************************/ +ERRTYPE RscSysDepend::WriteSysDependRc( const RSCINST & rInst, RscWriteRc & rMem, + RscTypCont * pTC, USHORT nDeep, BOOL bExtra, BOOL bFirst ) +{ + USHORT nId = 0xFFFF; + ERRTYPE aError; + RSCINST aFileName; + + //Instanz mit dem Dateinamen "FILENAME" holen + aFileName = RscClass::GetCopyVar( rInst, pHS->Test( "FILE" ) ); + if( aFileName.IsInst() ) + { + RscWriteRc aTmpMem; + aError = aFileName.pClass->WriteRcHeader( aFileName, aTmpMem, pTC, + RscId(), nDeep, bExtra ); + // Obsolete - need changes in VCL + rMem.Put( (USHORT)0 ); + + // Identifier schreiben + if( aTmpMem.Size() && pTC && (*aTmpMem.GetUTF8( 0 ) != '\0') ) + { + nId = pTC->PutSysName( rInst.pClass->GetTypId(), + aTmpMem.GetUTF8( 0 ), + 0, (USHORT)0, bFirst ); + } + rMem.Put( nId ); + aError = aFileName.pClass->WriteRcHeader( aFileName, rMem, pTC, + RscId(), nDeep, bExtra ); + } + else + aError = ERR_ERROR; + + return( aError ); +} + +/************************************************************************* +|* +|* RscSysDepend::WriteRc() +|* +|* Beschreibung +|* +*************************************************************************/ +ERRTYPE RscSysDepend::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, + RscTypCont * pTC, USHORT nDeep, BOOL bExtra ) +{ + ERRTYPE aError = RscClass::WriteRc( rInst, rMem, pTC, nDeep, bExtra ); + + if( this == rInst.pClass ) + // nur wenn es eigen Klasse ist + aError = WriteSysDependRc( rInst, rMem, pTC, nDeep, bExtra ); + return aError; +} + +/************************************************************************* +|* +|* RscFirstSysDepend::RscFirstSysDepend() +|* +|* Beschreibung +|* +*************************************************************************/ +RscFirstSysDepend::RscFirstSysDepend( HASHID nId, USHORT nTypeId, + RscTop * pSuper ) + : RscSysDepend( nId, nTypeId, pSuper ) +{} + +/************************************************************************* +|* +|* RscFirstSysDepend::WriteRc() +|* +|* Beschreibung +|* +*************************************************************************/ +ERRTYPE RscFirstSysDepend::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, + RscTypCont * pTC, USHORT nDeep, BOOL bExtra ) +{ + ERRTYPE aError = RscClass::WriteRc( rInst, rMem, pTC, nDeep, bExtra ); + aError = WriteSysDependRc( rInst, rMem, pTC, nDeep, bExtra, TRUE ); + return aError; +} + +/************************************************************************* +|* +|* RscTupel::RscTupel() +|* +|* Beschreibung +|* +*************************************************************************/ +RscTupel::RscTupel( HASHID nId, USHORT nTypeId, RscTop * pSuper ) + : RscClass( nId, nTypeId, pSuper ) +{} + +/************************************************************************* +|* +|* RscTupel::GetTupelVar() +|* +|* Beschreibung +|* +*************************************************************************/ +RSCINST RscTupel::GetTupelVar( const RSCINST & rInst, USHORT nPos, + const RSCINST & rInitInst ) +{ + if( nPos >= nEntries ) + { + return RSCINST(); + } + else + return GetVariable( rInst, pVarTypeList[ nPos ].nVarName, rInitInst ); +} + +/************************************************************************* +|* +|* RscTupel::WriteSrc() +|* +|* Beschreibung +|* +*************************************************************************/ +void RscTupel::WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, + const char * pVarName ) +{ + USHORT i; + RSCINST aTmpI; + + RscTop::WriteSrc( rInst, fOutput, pTC, nTab, pVarName ); + + fprintf( fOutput, "< " ); + for( i = 0; i < nEntries; i++ ) + { + if( !(VAR_HIDDEN & pVarTypeList[ i ].nVarType) ) + { + if( !IsDflt( rInst.pData, i ) + && !IsValueDflt( rInst.pData, i ) ) + { + aTmpI = GetInstData( rInst.pData, i, TRUE ); + + if( aTmpI.IsInst() ) + aTmpI.pClass->WriteSrcHeader( + aTmpI, fOutput, pTC, nTab, RscId(), pVarName ); + else + fprintf( fOutput, "Default" ); + } + else + fprintf( fOutput, "Default" ); + fprintf( fOutput, "; " ); + }; + }; + fprintf( fOutput, ">" ); + + return; +} diff --git a/rsc/source/res/rscclobj.cxx b/rsc/source/res/rscclobj.cxx new file mode 100644 index 000000000000..d2c778c37d15 --- /dev/null +++ b/rsc/source/res/rscclobj.cxx @@ -0,0 +1,303 @@ +/************************************************************************* + * + * $RCSfile: rscclobj.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/res/rscclobj.cxx,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.9 2000/09/17 12:51:11 willem.vandorp + OpenOffice header added. + + Revision 1.8 2000/07/26 17:13:22 willem.vandorp + Headers/footers replaced + + Revision 1.7 1998/01/08 13:20:44 MM + includes angepasst + + + Rev 1.6 08 Jan 1998 13:20:44 MM + includes angepasst + + Rev 1.5 12 Sep 1996 12:44:06 MM + Eigene Ressourcen definieren + + Rev 1.4 21 Nov 1995 19:50:20 TLX + Neuer Link + + Rev 1.3 03 Mar 1994 12:03:28 mm + C40 Warnings beseitigt + + Rev 1.2 12 Jan 1994 15:20:18 mm + Alignementprobleme und Warnings fuer DEC-Alpha beseitigt + + Rev 1.1 25 Aug 1993 15:29:00 mm + Fehler und Warnings beseitigt + + Rev 1.0 10 Aug 1992 07:20:50 MM + Initial revision. + +**************************************************************************/ +/****************** I N C L U D E S **************************************/ + +// C and C++ Includes. + +// Solar Definitionen +#include <tools/solar.h> + +// Programmabhaengige Includes. +#ifndef _RSCCLOBJ_HXX +#include <rscclobj.hxx> +#endif +#ifndef _RSCTOP_HXX +#include <rsctop.hxx> +#endif + +/****************** C O D E **********************************************/ + +/****************** R e f N o d e ****************************************/ +/************************************************************************* +|* +|* RefNode::RefNode() +|* +|* Beschreibung +|* Ersterstellung MM 03.05.91 +|* Letzte Aenderung MM 03.05.91 +|* +*************************************************************************/ +RefNode::RefNode( HASHID nTyp ){ + pObjBiTree = 0; + nTypNameId = nTyp; +} + +/************************************************************************* +|* +|* RefNode::GetId() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +USHORT RefNode::GetId() const +{ + return( nTypNameId ); +} + +/************************************************************************* +|* +|* RefNode::PutObjNode() +|* +|* Beschreibung NAME.DOC +|* Ersterstellung MM 21.03.90 +|* Letzte Aenderung MM 27.06.90 +|* +*************************************************************************/ +BOOL RefNode::PutObjNode( ObjNode * pPutObject ){ +// insert a node in the b-tree pObjBiTree +// if the node with the same name is in pObjBiTree, +// return FALSE and no insert, + + if( pObjBiTree ) + return( pObjBiTree->Insert( pPutObject ) ); + + pObjBiTree = pPutObject; + return( TRUE ); +} + +/****************** O b j N o d e ****************************************/ +/************************************************************************* +|* +|* RefNode::GetObjNode() +|* +|* Beschreibung NAME.DOC +|* Ersterstellung MM 21.03.90 +|* Letzte Aenderung MM 27.06.90 +|* +*************************************************************************/ +ObjNode * RefNode :: GetObjNode( const RscId & rRscId ){ +// insert a node in the b-tree pObjBiTree +// if the node with the same name is in pObjBiTree, +// return NULL and no insert, +// if not return the pointer to the Object + + if( pObjBiTree ) + return( pObjBiTree->Search( rRscId ) ); + return( NULL ); +} + +/************************************************************************* +|* +|* ObjNode::ObjNode() +|* +|* Beschreibung +|* Ersterstellung MM 15.05.91 +|* Letzte Aenderung MM 15.05.91 +|* +*************************************************************************/ +ObjNode::ObjNode( const RscId & rId, CLASS_DATA pData, ULONG lKey ){ + pRscObj = pData; + aRscId = rId; + lFileKey = lKey; +} + +/************************************************************************* +|* +|* ObjNode::DelObjNode() +|* +|* Beschreibung +|* Ersterstellung MM 09.12.91 +|* Letzte Aenderung MM 09.12.91 +|* +*************************************************************************/ +ObjNode * ObjNode::DelObjNode( RscTop * pClass, ULONG nFileKey ){ + ObjNode * pRetNode = this; + + if( Right() ) + pRight = ((ObjNode *)Right())->DelObjNode( pClass, nFileKey ); + if( Left() ) + pLeft = ((ObjNode *)Left())->DelObjNode( pClass, nFileKey ); + + if( GetFileKey() == nFileKey ){ + if( GetRscObj() ){ + pClass->Destroy( RSCINST( pClass, GetRscObj() ) ); + RscMem::Free( GetRscObj() ); + } + pRetNode = (ObjNode *)Right(); + if( pRetNode ){ + if( Left() ) + pRetNode->Insert( (ObjNode *)Left() ); + } + else + pRetNode = (ObjNode *)Left(); + delete this; + } + return pRetNode; +} + +/************************************************************************* +|* +|* ObjNode::GetId() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +USHORT ObjNode::GetId() const +{ + return( (USHORT)(long)aRscId ); +} + +/************************************************************************* +|* +|* ObjNode::IsConsistent() +|* +|* Beschreibung +|* Ersterstellung MM 23.09.91 +|* Letzte Aenderung MM 23.09.91 +|* +*************************************************************************/ +BOOL ObjNode::IsConsistent( RscInconsList * pList ) +{ + BOOL bRet = TRUE; + + if( (long)aRscId > 0x7FFF || (long)aRscId < 1 ) + { + bRet = FALSE; + if( pList ) + pList->Insert( new RscInconsistent( aRscId, aRscId ) ); + } + else + { + if( Left() ) + { + if( !((ObjNode *)Left())->IsConsistent( pList ) ) + bRet = FALSE; + if( ((ObjNode *)Left())->aRscId >= aRscId ) + { + bRet = FALSE; + if( pList ) + pList->Insert( + new RscInconsistent( ((ObjNode *)Left())->GetRscId(), + GetRscId() ) ); + } + }; + if( Right() ) + { + if( ((ObjNode *)Right())->aRscId <= aRscId ) + { + bRet = FALSE; + if( pList ) + pList->Insert( + new RscInconsistent( GetRscId(), + ((ObjNode *)Right())->GetRscId() ) ); + } + if( !((ObjNode *)Right())->IsConsistent( pList ) ) + bRet = FALSE; + }; + }; + + return( bRet ); +} diff --git a/rsc/source/res/rscconst.cxx b/rsc/source/res/rscconst.cxx new file mode 100644 index 000000000000..97c5ab81f668 --- /dev/null +++ b/rsc/source/res/rscconst.cxx @@ -0,0 +1,451 @@ +/************************************************************************* + * + * $RCSfile: rscconst.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/res/rscconst.cxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $ + +**************************************************************************/ +/****************** I N C L U D E S **************************************/ + +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +// Solar Definitionen +#include <tools/solar.h> + +// Programmabh„ngige Includes. +#ifndef _RSCCONST_HXX +#include <rscconst.hxx> +#endif + +/****************** C O D E **********************************************/ +/****************** R s c C o n s t **************************************/ +/************************************************************************* +|* +|* RscConst::RscConst() +|* +|* Beschreibung +|* Ersterstellung MM 03.05.91 +|* Letzte Aenderung MM 03.05.91 +|* +*************************************************************************/ +RscConst::RscConst( HASHID nId, USHORT nTypeId ) + : RscTop( nId, nTypeId ) +{ + pVarArray = NULL; + nEntries = 0; +} + +/************************************************************************* +|* +|* RscConst::~RscConst() +|* +|* Beschreibung +|* Ersterstellung MM 03.05.91 +|* Letzte Aenderung MM 03.05.91 +|* +*************************************************************************/ +RscConst::~RscConst() +{ + if( pVarArray ) + RscMem::Free( (void *)pVarArray ); +} + +/************************************************************************* +|* +|* RscConst::GetClassType() +|* +|* Beschreibung +|* Ersterstellung MM 03.05.91 +|* Letzte Aenderung MM 03.05.91 +|* +*************************************************************************/ +RSCCLASS_TYPE RscConst::GetClassType() const +{ + return RSCCLASS_CONST; +} + +/************************************************************************* +|* +|* RscConst::SetConstance() +|* +|* Beschreibung +|* Ersterstellung MM 03.04.91 +|* Letzte Aenderung MM 03.04.91 +|* +*************************************************************************/ +ERRTYPE RscConst::SetConstant( HASHID nVarName, INT32 lValue ){ + if( pVarArray ) + pVarArray = (VarEle *) + RscMem::Realloc( (void *)pVarArray, + (USHORT)((nEntries +1) * sizeof( VarEle )) ); + else + pVarArray = (VarEle *) + RscMem::Malloc( (USHORT)((nEntries +1) * sizeof( VarEle )) ); + pVarArray[ nEntries ].nId = nVarName; + pVarArray[ nEntries ].lValue = lValue; + nEntries++; + + return( ERR_OK ); +} + +/************************************************************************* +|* +|* RscConst::GetConstance() +|* +|* Beschreibung +|* Ersterstellung MM 15.05.91 +|* Letzte Aenderung MM 15.05.91 +|* +*************************************************************************/ +HASHID RscConst::GetConstant( USHORT nPos ){ + if( nPos < nEntries ) + return pVarArray[ nPos ].nId; + return( HASH_NONAME ); +} + +/************************************************************************* +|* +|* RscConst::GetConstValue() +|* +|* Beschreibung +|* Ersterstellung MM 15.05.91 +|* Letzte Aenderung MM 15.05.91 +|* +*************************************************************************/ +BOOL RscConst::GetConstValue( HASHID nConst, INT32 * pValue ) const +{ + USHORT i; + + for( i = 0; i < nEntries; i++ ) + if( pVarArray[ i ].nId == nConst ) + { + *pValue = pVarArray[ i ].lValue; + return TRUE; + } + return FALSE; +} + +/************************************************************************* +|* +|* RscConst::GetValueConst() +|* +|* Beschreibung +|* Ersterstellung MM 15.05.91 +|* Letzte Aenderung MM 15.05.91 +|* +*************************************************************************/ +BOOL RscConst::GetValueConst( INT32 lValue, HASHID * pConst ) const +{ + USHORT i; + + for( i = 0; i < nEntries; i++ ) + if( pVarArray[ i ].lValue == lValue ) + { + *pConst = pVarArray[ i ].nId; + return TRUE; + } + return FALSE; +} + +/************************************************************************* +|* +|* RscConst::GetConstPos() +|* +|* Beschreibung Sucht die Position der Konstanten +|* Return = nEntries, nicht gefunden +|* Return = Position im Feld +|* Ersterstellung MM 03.04.91 +|* Letzte Aenderung MM 03.04.91 +|* +*************************************************************************/ +USHORT RscConst::GetConstPos( HASHID nConst ) +{ + USHORT i; + + for( i = 0; i < nEntries; i++ ) + { + if( pVarArray[ i ].nId == nConst ) + return( i ); + } + + return( nEntries ); +} + +/************************************************************************* +|* +|* RscEnum::WriteSyntax() +|* +|* Beschreibung +|* Ersterstellung MM 29.05.91 +|* Letzte Aenderung MM 29.05.91 +|* +*************************************************************************/ +void RscConst::WriteSyntax( FILE * fOutput, RscTypCont * pTC ) +{ + RscTop::WriteSyntax( fOutput, pTC ); + + USHORT i; + // Wenn eine Variable Maskierung hat, dann Maskenfeld + fprintf( fOutput, "\t" ); + for( i = 0; i < nEntries; i++ ) + { + fprintf( fOutput, "%s, ", pHS->Get( pVarArray[ i ].nId ) ); + if( 3 == (i % 4) && i < (USHORT)(nEntries -1) ) + fprintf( fOutput, "\n\t" ); + }; + fprintf( fOutput, "\n" ); +} + +//================================================================== +void RscConst::WriteRcAccess +( + FILE * fOutput, + RscTypCont * pTC, + const char * pName +) +{ + fprintf( fOutput, "\t\tSet%s( %s( ", pName, pHS->Get( GetId() ) ); + fprintf( fOutput, "*(short*)(pResData+nOffset) ) );\n" ); + fprintf( fOutput, "\t\tnOffset += sizeof( short );\n" ); +} + +/****************** R s c E n u m ****************************************/ +/************************************************************************* +|* +|* RscEnum::RscEnum() +|* +|* Beschreibung +|* Ersterstellung MM 03.04.91 +|* Letzte Aenderung MM 03.04.91 +|* +*************************************************************************/ +RscEnum::RscEnum( HASHID nId, USHORT nTypeId, BOOL bUSHORT_ ) + : RscConst( nId, nTypeId ) + , bUSHORT( bUSHORT_ ) +{ + nSize = ALIGNED_SIZE( sizeof( RscEnumInst ) ); +} + +/************************************************************************* +|* +|* RscEnum::SetConst() +|* +|* Beschreibung +|* Ersterstellung MM 03.04.91 +|* Letzte Aenderung MM 03.04.91 +|* +*************************************************************************/ +ERRTYPE RscEnum::SetConst( const RSCINST & rInst, HASHID nConst, long nVal ) +{ + USHORT i; + + if( nEntries != (i = GetConstPos( nConst )) ) + { + ((RscEnumInst *)rInst.pData)->nValue = i; + ((RscEnumInst *)rInst.pData)->bDflt = FALSE; + return( ERR_OK ); + }; + + return( ERR_RSCENUM ); +} + +/************************************************************************* +|* +|* RscEnum::SetNumber() +|* +|* Beschreibung +|* Ersterstellung MM 18.07.91 +|* Letzte Aenderung MM 18.07.91 +|* +*************************************************************************/ +ERRTYPE RscEnum::SetNumber( const RSCINST & rInst, INT32 lValue ){ + USHORT i; + + for( i = 0; i < nEntries; i++ ){ + if( (long)pVarArray[ i ].lValue == lValue ) + return( SetConst( rInst, pVarArray[ i ].nId, lValue ) ); + }; + + return( ERR_RSCENUM ); +} + +/************************************************************************* +|* +|* RscEnum::GetConst() +|* +|* Beschreibung +|* Ersterstellung MM 03.04.91 +|* Letzte Aenderung MM 03.04.91 +|* +*************************************************************************/ +ERRTYPE RscEnum::GetConst( const RSCINST & rInst, HASHID * pH ){ + *pH = pVarArray[ ((RscEnumInst *)rInst.pData)->nValue ].nId; + return( ERR_OK ); +} + +/************************************************************************* +|* +|* RscEnum::GetNumber() +|* +|* Beschreibung +|* Ersterstellung MM 16.09.91 +|* Letzte Aenderung MM 16.09.91 +|* +*************************************************************************/ +ERRTYPE RscEnum::GetNumber( const RSCINST & rInst, long * pNumber ){ + *pNumber = pVarArray[ ((RscEnumInst *)rInst.pData)->nValue ].lValue; + return( ERR_OK ); +} + +/************************************************************************* +|* +|* RscEnum::Create() +|* +|* Beschreibung +|* Ersterstellung MM 03.04.91 +|* Letzte Aenderung MM 03.04.91 +|* +*************************************************************************/ +RSCINST RscEnum::Create( RSCINST * pInst, const RSCINST & rDflt, BOOL bOwnClass ){ + RSCINST aInst; + + if( !pInst ){ + aInst.pClass = this; + aInst.pData = (CLASS_DATA) + RscMem::Malloc( sizeof( RscEnumInst ) ); + } + else + aInst = *pInst; + if( !bOwnClass && rDflt.IsInst() ) + bOwnClass = rDflt.pClass->InHierarchy( this ); + + if( bOwnClass ) + memmove( aInst.pData, rDflt.pData, Size() ); + else{ + ((RscEnumInst *)aInst.pData)->nValue = 0; + ((RscEnumInst *)aInst.pData)->bDflt = TRUE; + } + + return( aInst ); +} + +/************************************************************************* +|* +|* RscEnum::IsValueDefault() +|* +|* Beschreibung +|* Ersterstellung MM 15.01.92 +|* Letzte Aenderung MM 15.01.92 +|* +*************************************************************************/ +BOOL RscEnum::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ){ + if( pDef ){ + if( ((RscEnumInst*)rInst.pData)->nValue == + ((RscEnumInst*)pDef)->nValue ) + { + return TRUE; + } + } + + return FALSE; +} + +/************************************************************************* +|* +|* RscEnum::WriteSrc() +|* +|* Beschreibung +|* Ersterstellung MM 08.04.91 +|* Letzte Aenderung MM 08.04.91 +|* +*************************************************************************/ +void RscEnum::WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont *, USHORT, const char * ) +{ + fprintf( fOutput, "%s", pHS->Get( + pVarArray[ ((RscEnumInst *)rInst.pData)->nValue ].nId ) ); +} + +/************************************************************************* +|* +|* RscEnum::WriteRc() +|* +|* Beschreibung +|* Ersterstellung MM 15.04.91 +|* Letzte Aenderung MM 15.04.91 +|* +*************************************************************************/ +ERRTYPE RscEnum::WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont *, USHORT, BOOL ) +{ + if( bUSHORT ) + aMem.Put( (USHORT)pVarArray[ ((RscEnumInst *)rInst.pData)->nValue ].lValue ); + else + aMem.Put( (INT32)pVarArray[ ((RscEnumInst *)rInst.pData)->nValue ].lValue ); + return( ERR_OK ); +} + + diff --git a/rsc/source/res/rsccont.cxx b/rsc/source/res/rsccont.cxx new file mode 100644 index 000000000000..e3a16f37d8bb --- /dev/null +++ b/rsc/source/res/rsccont.cxx @@ -0,0 +1,1236 @@ +/************************************************************************* + * + * $RCSfile: rsccont.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $ + * + * 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/res/rsccont.cxx,v 1.1.1.1 2000-09-18 16:42:56 hr Exp $ + + Source Code Control System - Update + + $Log: not supported by cvs2svn $ + Revision 1.20 2000/09/17 12:51:11 willem.vandorp + OpenOffice header added. + + Revision 1.19 2000/07/26 17:13:22 willem.vandorp + Headers/footers replaced + + Revision 1.18 2000/07/12 11:38:19 th + Unicode + + Revision 1.17 1999/11/24 17:54:47 th + remove dependencies to vcl + + Revision 1.16 1999/09/08 09:24:59 mm + BigEndian/LittleEndian komplett durchgezogen + + Revision 1.15 1998/02/19 17:50:42 HJS + includes + +**************************************************************************/ +/****************** I N C L U D E S **************************************/ + +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +// Programmabh„ngige Includes. +#ifndef _RSCCONT_HXX +#include <rsccont.hxx> +#endif + +#include <tools/rcid.h> + +/****************** C O D E **********************************************/ +/****************** E N T R Y S T R U C T ********************************/ +/************************************************************************* +|* +|* ENTRYSTRUCT::Destroy() +|* +|* Beschreibung +|* Ersterstellung MM 06.08.91 +|* Letzte Aenderung MM 06.08.91 +|* +*************************************************************************/ +void ENTRY_STRUCT::Destroy() +{ + aName.Destroy(); + if( aInst.IsInst() ){ + aInst.pClass->Destroy( aInst ); + RscMem::Free( aInst.pData ); + }; +} + +/****************** R s c B a s e C o n t ********************************/ +/************************************************************************* +|* +|* RscBaseCont::RscBaseCont() +|* +|* Beschreibung +|* Ersterstellung MM 25.05.91 +|* Letzte Aenderung MM 25.05.91 +|* +*************************************************************************/ +RscBaseCont::RscBaseCont( HASHID nId, USHORT nTypeId, RscTop * pSuper, + BOOL bNoIdent ) + : RscTop( nId, nTypeId, pSuper ) +{ + pTypeClass = NULL; + pTypeClass1 = NULL; + bNoId = bNoIdent; + nOffInstData = RscTop::Size(); + nSize = nOffInstData + ALIGNED_SIZE( sizeof( RscBaseContInst ) ); +} + +/************************************************************************* +|* +|* RscBaseCont::~RscBaseCont() +|* +|* Beschreibung +|* Ersterstellung MM 25.05.91 +|* Letzte Aenderung MM 25.05.91 +|* +*************************************************************************/ +RscBaseCont::~RscBaseCont(){ +} + +/************************************************************************* +|* +|* RscBaseCont::GetClassType() +|* +|* Beschreibung +|* Ersterstellung MM 25.05.91 +|* Letzte Aenderung MM 25.05.91 +|* +*************************************************************************/ +RSCCLASS_TYPE RscBaseCont::GetClassType() const +{ + return RSCCLASS_COMPLEX; +} + +/************************************************************************* +|* +|* DestroyElements() +|* +|* Beschreibung +|* Ersterstellung MM 26.04.91 +|* Letzte Aenderung MM 26.04.91 +|* +*************************************************************************/ +void RscBaseCont::DestroyElements( RscBaseContInst * pClassData ){ + USHORT i; + + if( pClassData->nEntries ){ + for( i = 0; i < pClassData->nEntries; i++ ){ + pClassData->pEntries[ i ].Destroy(); + }; + RscMem::Free( pClassData->pEntries ); + pClassData->pEntries = NULL; + pClassData->nEntries = 0; + }; +} + +/************************************************************************* +|* +|* RscBaseCont::Create() +|* +|* Beschreibung +|* Ersterstellung MM 26.04.91 +|* Letzte Aenderung MM 26.04.91 +|* +*************************************************************************/ +RSCINST RscBaseCont::Create( RSCINST * pInst, const RSCINST & rDflt, + BOOL bOwnClass ) +{ + USHORT i; + RSCINST aInst; + RscBaseContInst * pClassData; + + if( !pInst ){ + aInst.pClass = this; + aInst.pData = (CLASS_DATA) RscMem::Malloc( Size() ); + } + else + aInst = *pInst; + if( !bOwnClass && rDflt.IsInst() ) + bOwnClass = rDflt.pClass->InHierarchy( this ); + + RscTop::Create( &aInst, rDflt, bOwnClass ); + + pClassData = (RscBaseContInst *)(aInst.pData + nOffInstData); + pClassData->nEntries = 0; + pClassData->pEntries = NULL; + pClassData->bDflt = TRUE; + + if( bOwnClass ){ + RscBaseContInst * pDfltClassData; + RSCINST aDfltI; + + pDfltClassData = (RscBaseContInst *)(rDflt.pData + nOffInstData); + + if( 0 != pDfltClassData->nEntries ){ + *pClassData = *pDfltClassData; + pClassData->pEntries = + (ENTRY_STRUCT *)RscMem::Malloc( sizeof( ENTRY_STRUCT ) + * pClassData->nEntries ); + for( i = 0; i < pClassData->nEntries; i++ ){ + pClassData->pEntries[ i ].Create(); + pClassData->pEntries[ i ].aName = + pDfltClassData->pEntries[ i ].aName; + aDfltI = pDfltClassData->pEntries[ i ].aInst; + pClassData->pEntries[ i ].aInst = + aDfltI.pClass->Create( NULL, aDfltI ); + }; + }; + } + + return( aInst ); +} + +/************************************************************************* +|* +|* RscBaseCont::Destroy() +|* +|* Beschreibung +|* Ersterstellung MM 25.05.91 +|* Letzte Aenderung MM 25.05.91 +|* +*************************************************************************/ +void RscBaseCont::Destroy( const RSCINST & rInst ){ + RscBaseContInst * pClassData; + + RscTop::Destroy( rInst); + + pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + DestroyElements( pClassData ); +} + +/************************************************************************* +|* +|* RscBaseCont::SearchEle() +|* +|* Beschreibung +|* Ersterstellung MM 17.05.91 +|* Letzte Aenderung MM 17.05.91 +|* +*************************************************************************/ +RSCINST RscBaseCont::SearchElePos( const RSCINST & rInst, const RscId & rEleName, + RscTop * pClass, USHORT nPos ) +{ + USHORT i; + RscBaseContInst * pClassData; + + pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + if( !pClass ) + pClass = pTypeClass; + + if( rEleName.IsId() ){ + for( i = nPos; i < pClassData->nEntries; i++ ){ + if( pClassData->pEntries[ i ].aName == rEleName + && pClassData->pEntries[ i ].aInst.pClass == pClass ) + { + return( pClassData->pEntries[ i ].aInst ); + }; + }; + }; + return RSCINST(); +} + +/************************************************************************* +|* +|* RscBaseCont::SearchEle() +|* +|* Beschreibung +|* Ersterstellung MM 17.05.91 +|* Letzte Aenderung MM 17.05.91 +|* +*************************************************************************/ +RSCINST RscBaseCont::SearchEle( const RSCINST & rInst, const RscId & rEleName, + RscTop * pClass ) +{ + return SearchElePos( rInst, rEleName, pClass, 0 ); +} + +/************************************************************************* +|* +|* RscBaseCont::GetElement() +|* +|* Beschreibung +|* Ersterstellung MM 26.04.91 +|* Letzte Aenderung MM 26.04.91 +|* +*************************************************************************/ +ERRTYPE RscBaseCont::GetElement( const RSCINST & rInst, const RscId & rEleName, + RscTop * pCreateClass, + const RSCINST & rCreateInst, RSCINST * pGetInst ) +{ + RscBaseContInst * pClassData; + RSCINST aTmpI; + ERRTYPE aError; + + if( !bNoId && !rEleName.IsId() ) + aError = WRN_CONT_NOID; + pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + + if( pCreateClass ){ + if( !pCreateClass->InHierarchy( pTypeClass ) ){ + if( pTypeClass1 ){ + if( !pCreateClass->InHierarchy( pTypeClass1 ) ){ + // Falscher Typ + return ERR_CONT_INVALIDTYPE; + } + } + else{ + // Falscher Typ + return ERR_CONT_INVALIDTYPE; + }; + }; + } + else + pCreateClass = pTypeClass; + + pClassData->bDflt = FALSE; + if( !bNoId ) + aTmpI = SearchEle( rInst, rEleName, pCreateClass ); + // Eintrag gefunden + if( aTmpI.IsInst() ){ + aError = WRN_CONT_DOUBLEID; + if( rCreateInst.IsInst() ){ + aTmpI.pClass->Destroy( aTmpI ); + aTmpI.pClass->Create( &aTmpI, rCreateInst ); + }; + } + else { + if( pClassData->pEntries ){ + pClassData->pEntries = + (ENTRY_STRUCT *)RscMem::Realloc( pClassData->pEntries, + sizeof( ENTRY_STRUCT ) * (pClassData->nEntries +1) ); + } + else { + pClassData->pEntries = + (ENTRY_STRUCT *)RscMem::Malloc( sizeof( ENTRY_STRUCT ) + * (pClassData->nEntries +1) ); + }; + + pClassData->pEntries[ pClassData->nEntries ].Create(); + pClassData->pEntries[ pClassData->nEntries ].aName = rEleName; + + if( rCreateInst.IsInst() ){ + // Instanz mit CreateInst-Daten initialisieren + pClassData->pEntries[ pClassData->nEntries ].aInst = + pCreateClass->Create( NULL, rCreateInst ); + } + else { + pClassData->pEntries[ pClassData->nEntries ].aInst = + pCreateClass->Create( NULL, RSCINST() ); + }; + + pClassData->nEntries++; + aTmpI = pClassData->pEntries[ pClassData->nEntries -1 ].aInst; + } + + *pGetInst = aTmpI; + return aError; +} + +/************************************************************************* +|* +|* RscBaseCont::GetCount() +|* +|* Beschreibung +|* Ersterstellung MM 08.05.91 +|* Letzte Aenderung MM 08.05.91 +|* +*************************************************************************/ +USHORT RscBaseCont::GetCount( const RSCINST & rInst ){ + RscBaseContInst * pClassData; + + pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + return( pClassData->nEntries ); +} + +/************************************************************************* +|* +|* RscBaseCont::GetPosEle() +|* +|* Beschreibung +|* Ersterstellung MM 08.05.91 +|* Letzte Aenderung MM 08.05.91 +|* +*************************************************************************/ +RSCINST RscBaseCont::GetPosEle( const RSCINST & rInst, USHORT nPos ){ + RscBaseContInst * pClassData; + + pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + + if( nPos < pClassData->nEntries ) + return( pClassData->pEntries[ nPos ].aInst ); + return RSCINST(); +} + +/************************************************************************* +|* +|* RscBaseCont::MovePosEle() +|* +|* Beschreibung +|* Ersterstellung MM 23.10.91 +|* Letzte Aenderung MM 23.10.91 +|* +*************************************************************************/ +ERRTYPE RscBaseCont::MovePosEle( const RSCINST & rInst, USHORT nDestPos, + USHORT nSourcePos ) +{ + ERRTYPE aError; + RscBaseContInst * pClassData; + + pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + + if( (nDestPos < pClassData->nEntries) && (nSourcePos < pClassData->nEntries) ){ + ENTRY_STRUCT aEntry; + short nInc = 1; + USHORT i; + + // Quelle Merken + aEntry = pClassData->pEntries[ nSourcePos ]; + // Richtung der for-Schleife bestimmen + if( nDestPos < nSourcePos ) + nInc = -1; + + for( i = nSourcePos; i != nDestPos; i += nInc ) + pClassData->pEntries[ i ] = pClassData->pEntries[ i + nInc ]; + + // Zuweisung Quelle auf Ziel + pClassData->pEntries[ nDestPos ] = aEntry; + } + else + aError = ERR_RSCCONT; + return aError; +} + +/************************************************************************* +|* +|* RscBaseCont::SetPosRscId() +|* +|* Beschreibung +|* Ersterstellung MM 30.09.91 +|* Letzte Aenderung MM 30.09.91 +|* +*************************************************************************/ +ERRTYPE RscBaseCont::SetPosRscId( const RSCINST & rInst, USHORT nPos, + const RscId & rId ){ + RscBaseContInst * pClassData; + RSCINST aTmpI; + ERRTYPE aError; + + pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + + if( nPos < pClassData->nEntries ){ + if( ! (rId == pClassData->pEntries[ nPos ].aName) ) + aTmpI = SearchEle( rInst, rId, + pClassData->pEntries[ nPos ].aInst.pClass ); + if( !aTmpI.IsInst() ) + pClassData->pEntries[ nPos ].aName = rId; + else + aError = ERR_RSCCONT; + } + else + aError = ERR_RSCCONT; + return( aError ); +} + +/************************************************************************* +|* +|* RscBaseCont::GetInfoEle() +|* +|* Beschreibung +|* Ersterstellung MM 08.05.91 +|* Letzte Aenderung MM 08.05.91 +|* +*************************************************************************/ +SUBINFO_STRUCT RscBaseCont::GetInfoEle( const RSCINST & rInst, USHORT nPos ){ + RscBaseContInst * pClassData; + SUBINFO_STRUCT aInfo; + + pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + + if( nPos < pClassData->nEntries ){ + aInfo.aId = pClassData->pEntries[ nPos ].aName; + aInfo.nPos = nPos; + aInfo.pClass = pClassData->pEntries[ nPos ].aInst.pClass; + } + return( aInfo ); +} + +/************************************************************************* +|* +|* RscBaseCont::SetString() +|* +|* Beschreibung +|* Ersterstellung MM 29.04.91 +|* Letzte Aenderung MM 29.04.91 +|* +*************************************************************************/ +ERRTYPE RscBaseCont::SetString( const RSCINST & rInst, char * pStr ){ + RscBaseContInst * pClassData; + RSCINST aTmpI; + ERRTYPE aError; + char *pTmpStr; + + pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + +//?B 040991 +//?W 040991 sonst Endlosrekursion moeglich +if( RSC_NOTYPE == pTypeClass->GetTypId() ){ + aError = GetElement( rInst, RscId(), pTypeClass, RSCINST(), &aTmpI ); + aError = aTmpI.pClass->GetString( aTmpI, &pTmpStr ); + if( aError.IsOk() ) + aError = aTmpI.pClass->SetString( aTmpI, pStr ); + else { + aError.Clear(); + DeletePos( rInst, pClassData->nEntries -1 ); + aError = GetElement( rInst, RscId(), pTypeClass1, RSCINST(), &aTmpI ); + aError = aTmpI.pClass->GetString( aTmpI, &pTmpStr ); + if( aError.IsOk() ) + aError = aTmpI.pClass->SetString( aTmpI, pStr ); + } + if( aError.IsError() ) + DeletePos( rInst, pClassData->nEntries -1 ); +} +else + aError = ERR_UNKNOWN_METHOD; + + return( aError ); +} + +/************************************************************************* +|* +|* RscBaseCont::SetNumber() +|* +|* Beschreibung +|* Ersterstellung MM 12.06.91 +|* Letzte Aenderung MM 12.06.91 +|* +*************************************************************************/ +ERRTYPE RscBaseCont::SetNumber( const RSCINST & rInst, long lValue ){ + RscBaseContInst * pClassData; + RSCINST aTmpI; + ERRTYPE aError; + long lNumber; + + pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + +//?B 040991 +//?W 040991 sonst Endlosrekursion moeglich +if( RSC_NOTYPE == pTypeClass->GetTypId() ){ + aError = GetElement( rInst, RscId(), pTypeClass, RSCINST(), &aTmpI ); + aError = aTmpI.pClass->GetNumber( aTmpI, &lNumber ); + if( aError.IsOk() ) + aError = aTmpI.pClass->SetNumber( aTmpI, lValue ); + else { + aError.Clear(); + DeletePos( rInst, pClassData->nEntries -1 ); + aError = GetElement( rInst, RscId(), pTypeClass1, RSCINST(), &aTmpI ); + aError = aTmpI.pClass->GetNumber( aTmpI, &lNumber ); + if( aError.IsOk() ) + aError = aTmpI.pClass->SetNumber( aTmpI, lValue ); + } + if( aError.IsError() ) + DeletePos( rInst, pClassData->nEntries -1 ); +} +else + aError = ERR_UNKNOWN_METHOD; + + return( aError ); +} + +//================================================================== +ERRTYPE RscBaseCont::SetBool +( + const RSCINST & rInst, + BOOL bValue +) +{ + RscBaseContInst * pClassData; + RSCINST aTmpI; + ERRTYPE aError; + BOOL bBool; + + pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + +//?B 040991 +//?W 040991 sonst Endlosrekursion moeglich +if( RSC_NOTYPE == pTypeClass->GetTypId() ) +{ + aError = GetElement( rInst, RscId(), pTypeClass, RSCINST(), &aTmpI ); + aError = aTmpI.pClass->GetBool( aTmpI, &bBool ); + if( aError.IsOk() ) + aError = aTmpI.pClass->SetBool( aTmpI, bValue ); + else { + aError.Clear(); + DeletePos( rInst, pClassData->nEntries -1 ); + aError = GetElement( rInst, RscId(), pTypeClass1, RSCINST(), &aTmpI ); + aError = aTmpI.pClass->GetBool( aTmpI, &bBool ); + if( aError.IsOk() ) + aError = aTmpI.pClass->SetBool( aTmpI, bValue ); + } + if( aError.IsError() ) + DeletePos( rInst, pClassData->nEntries -1 ); +} +else + aError = ERR_UNKNOWN_METHOD; + + return( aError ); +} + +//================================================================== +ERRTYPE RscBaseCont::SetConst +( + const RSCINST & rInst, + HASHID nValueId, + long lValue +) +{ + RscBaseContInst * pClassData; + RSCINST aTmpI; + ERRTYPE aError; + HASHID nConst; + + pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + +//?B 040991 +//?W 040991 sonst Endlosrekursion moeglich +if( RSC_NOTYPE == pTypeClass->GetTypId() ){ + aError = GetElement( rInst, RscId(), pTypeClass, RSCINST(), &aTmpI ); + aError = aTmpI.pClass->GetConst( aTmpI, &nConst ); + if( aError.IsOk() ) + aError = aTmpI.pClass->SetConst( aTmpI, nValueId, lValue ); + else { + aError.Clear(); + DeletePos( rInst, pClassData->nEntries -1 ); + aError = GetElement( rInst, RscId(), pTypeClass1, RSCINST(), &aTmpI ); + aError = aTmpI.pClass->GetConst( aTmpI, &nConst ); + if( aError.IsOk() ) + aError = aTmpI.pClass->SetConst( aTmpI, nValueId, lValue ); + } + if( aError.IsError() ) + DeletePos( rInst, pClassData->nEntries -1 ); +} +else + aError = ERR_UNKNOWN_METHOD; + + return( aError ); +} + +/************************************************************************* +|* +|* RscBaseCont::SetRef() +|* +|* Beschreibung +|* Ersterstellung MM 02.12.91 +|* Letzte Aenderung MM 02.12.91 +|* +*************************************************************************/ +ERRTYPE RscBaseCont::SetRef( const RSCINST & rInst, const RscId & rRefId ){ + RscBaseContInst * pClassData; + RSCINST aTmpI; + ERRTYPE aError; + RscId aId; + + pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + +//?B 040991 +//?W 040991 sonst Endlosrekursion moeglich +if( RSC_NOTYPE == pTypeClass->GetTypId() ){ + aError = GetElement( rInst, RscId(), pTypeClass, RSCINST(), &aTmpI ); + aError = aTmpI.pClass->GetRef( aTmpI, &aId ); + if( aError.IsOk() ) + aError = aTmpI.pClass->SetRef( aTmpI, rRefId ); + else { + aError.Clear(); + DeletePos( rInst, pClassData->nEntries -1 ); + aError = GetElement( rInst, RscId(), pTypeClass1, RSCINST(), &aTmpI ); + aError = aTmpI.pClass->GetRef( aTmpI, &aId ); + if( aError.IsOk() ) + aError = aTmpI.pClass->SetNumber( aTmpI, rRefId ); + } + if( aError.IsError() ) + DeletePos( rInst, pClassData->nEntries -1 ); +} +else + aError = ERR_UNKNOWN_METHOD; + + return( aError ); +} + +/************************************************************************* +|* +|* RscBaseCont::IsConsistent() +|* +|* Beschreibung +|* Ersterstellung MM 23.09.91 +|* Letzte Aenderung MM 23.09.91 +|* +*************************************************************************/ +BOOL RscBaseCont::IsConsistent( const RSCINST & rInst, RscInconsList * pList ){ + USHORT i; + RscBaseContInst * pClassData; + BOOL bRet; + + bRet = RscTop::IsConsistent( rInst, pList ); + + pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + + // auf doppelten Id Testen und Reihenfolge beibehalten + // Komplexitaet = n^2 / 2 + for( i = 0; i < pClassData->nEntries; i++ ){ + if( !bNoId ){ + if( (long)pClassData->pEntries[ i ].aName > 0x7FFF + || (long)pClassData->pEntries[ i ].aName < 1 ){ + bRet = FALSE; + if( pList ) + pList->Insert( new RscInconsistent( + pClassData->pEntries[ i ].aName, + pClassData->pEntries[ i ].aName ) ); + } + else if( SearchElePos( rInst, pClassData->pEntries[ i ].aName, + pClassData->pEntries[ i ].aInst.pClass, i +1 ).IsInst() ) + { + bRet = FALSE; + if( pList ) + pList->Insert( new RscInconsistent( + pClassData->pEntries[ i ].aName, + pClassData->pEntries[ i +1 ].aName ) ); + }; + } + if( ! pClassData->pEntries[ i ].aInst.pClass-> + IsConsistent( pClassData->pEntries[ i ].aInst, pList ) ) + bRet = FALSE; + }; + + return( bRet ); +} + +/************************************************************************* +|* +|* RscBaseCont::SetToDefault() +|* +|* Beschreibung +|* Ersterstellung MM 25.04.91 +|* Letzte Aenderung MM 25.04.91 +|* +*************************************************************************/ +void RscBaseCont::SetToDefault( const RSCINST & rInst ) +{ + USHORT i; + RscBaseContInst * pClassData; + + pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + + for( i = 0; i < pClassData->nEntries; i++ ) + { + pClassData->pEntries[ i ].aInst.pClass-> + SetToDefault( pClassData->pEntries[ i ].aInst ); + }; + + RscTop::SetToDefault( rInst ); +} + +/************************************************************************* +|* +|* RscBaseCont::IsDefault() +|* +|* Beschreibung +|* Ersterstellung MM 25.04.91 +|* Letzte Aenderung MM 25.04.91 +|* +*************************************************************************/ +BOOL RscBaseCont::IsDefault( const RSCINST & rInst ){ + USHORT i; + RscBaseContInst * pClassData; + + pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + + if( !pClassData->bDflt ) + return FALSE; + + for( i = 0; i < pClassData->nEntries; i++ ){ + if( ! pClassData->pEntries[ i ].aInst.pClass-> + IsDefault( pClassData->pEntries[ i ].aInst ) ) + { + return( FALSE ); + }; + }; + + return( RscTop::IsDefault( rInst ) ); +} + +/************************************************************************* +|* +|* RscBaseCont::IsValueDefault() +|* +|* Beschreibung +|* Ersterstellung MM 25.04.91 +|* Letzte Aenderung MM 15.01.92 +|* +*************************************************************************/ +BOOL RscBaseCont::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) +{ + RscBaseContInst * pClassData; + + if( !RscTop::IsValueDefault( rInst, pDef ) ) + return FALSE; + + pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + + if( pClassData->nEntries ) + return FALSE; + else + return TRUE; +} + +/************************************************************************* +|* +|* RscBaseCont::Delete() +|* +|* Beschreibung +|* Ersterstellung MM 12.06.91 +|* Letzte Aenderung MM 12.06.91 +|* +*************************************************************************/ +void RscBaseCont::Delete( const RSCINST & rInst, RscTop * pClass, + const RscId & rId ) +{ + USHORT i; + RscBaseContInst * pClassData; + + pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + if( !pClass ) + pClass = pTypeClass; + + for( i = 0; i < pClassData->nEntries; i++ ){ + if( pClassData->pEntries[ i ].aName == rId ) + if( pClassData->pEntries[ i ].aInst.pClass == pClass || !pClass ){ + DeletePos( rInst, i ); + return; + }; + }; + +} + +/************************************************************************* +|* +|* RscBaseCont::DeletePos() +|* +|* Beschreibung +|* Ersterstellung MM 12.06.91 +|* Letzte Aenderung MM 12.06.91 +|* +*************************************************************************/ +void RscBaseCont::DeletePos( const RSCINST & rInst, USHORT nPos ){ + RscBaseContInst * pClassData; + USHORT i; + + pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + + if( nPos < pClassData->nEntries ){ + if( 1 == pClassData->nEntries ) + DestroyElements( pClassData ); + else{ + pClassData->pEntries[ nPos ].Destroy(); + pClassData->nEntries--; + for( i = nPos; i < pClassData->nEntries; i++ ) + pClassData->pEntries[ i ] = pClassData->pEntries[ i + 1 ]; + }; + }; +} + +/************************************************************************* +|* +|* RscBaseCont::ContWriteSrc() +|* +|* Beschreibung +|* Ersterstellung MM 26.04.91 +|* Letzte Aenderung MM 26.04.91 +|* +*************************************************************************/ +void RscBaseCont::ContWriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, + const char * pVarName ) +{ + USHORT i, t; + RscBaseContInst * pClassData; + + pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + + for( i = 0; i < pClassData->nEntries; i++ ) + { + for( t = 0; t < nTab; t++ ) + fputc( '\t', fOutput ); + pClassData->pEntries[ i ].aInst.pClass-> + WriteSrcHeader( pClassData->pEntries[ i ].aInst, + fOutput, pTC, nTab, + pClassData->pEntries[ i ].aName, pVarName ); + fprintf( fOutput, ";\n" ); + }; +} + +/************************************************************************* +|* +|* RscBaseCont::ContWriteRc() +|* +|* Beschreibung +|* Ersterstellung MM 26.04.91 +|* Letzte Aenderung MM 26.04.91 +|* +*************************************************************************/ +ERRTYPE RscBaseCont::ContWriteRc( const RSCINST & rInst, RscWriteRc & rMem, + RscTypCont * pTC, USHORT nDeep, BOOL bExtra ) +{ + USHORT i; + RscBaseContInst * pClassData; + ERRTYPE aError; + + if( bExtra || bNoId ) + { // Nur Subresourcen schreiben, wenn bExtra == TRUE + pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + + for( i = 0; i < pClassData->nEntries && aError.IsOk(); i++ ){ + aError = pClassData->pEntries[ i ].aInst.pClass-> + WriteRcHeader( pClassData->pEntries[ i ].aInst, + rMem, pTC, + pClassData->pEntries[ i ].aName, + nDeep, bExtra ); + } + } + + return( aError ); +} + +//================================================================== +void RscBaseCont::ContWriteRcAccess +( + FILE * fOutput, + RscTypCont * pTC, + const char * pName, + BOOL bWriteSize +) +{ + if( (bNoId || bWriteSize) && !pTypeClass1 ) + { + fprintf( fOutput, "\t\tUSHORT nItems = *(USHORT *)(pResData+nOffset) );\n" ); + fprintf( fOutput, "\t\tnOffset += sizeof( USHORT );\n" ); + + fprintf( fOutput, "\t\t// Items hinzufuegen\n" ); + fprintf( fOutput, "\t\tfor( USHORT i = 0; i < nItems; i++ )\n" ); + fprintf( fOutput, "\t\t{\n" ); + pTypeClass->WriteRcAccess( fOutput, pTC, "Item" ); + fprintf( fOutput, "\t\t}\n" ); + } + else + { + fprintf( fOutput, "\t\tSet%s( %s ", pName, pHS->Get( GetId() ) ); + fprintf( fOutput, "%s ", aCallPar2.GetBuffer() ); + fprintf( fOutput, "ResId( (RSHEADER_TYPE*)(pResData+nOffset) ) ) );\n" ); + fprintf( fOutput, "\t\tnOffset += GetObjSizeRes( (RSHEADER_TYPE*)(pResData+nOffset) );\n" ); + } +} + + +/************************************************************************* +|* +|* RscBaseCont::WriteSrc() +|* +|* Beschreibung +|* Ersterstellung MM 26.04.91 +|* Letzte Aenderung MM 26.04.91 +|* +*************************************************************************/ +void RscBaseCont::WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, + const char * pVarName ) +{ + RscTop::WriteSrc( rInst, fOutput, pTC, nTab, pVarName ); + ContWriteSrc( rInst, fOutput, pTC, nTab, pVarName ); +} + +/************************************************************************* +|* +|* RscBaseCont::WriteRc() +|* +|* Beschreibung +|* Ersterstellung MM 26.04.91 +|* Letzte Aenderung MM 26.04.91 +|* +*************************************************************************/ +ERRTYPE RscBaseCont::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, + RscTypCont * pTC, USHORT nDeep, BOOL bExtra ) +{ + ERRTYPE aError; + + aError = RscTop::WriteRc( rInst, rMem, pTC, nDeep, bExtra ); + if( aError.IsOk() ) + aError = ContWriteRc( rInst, rMem, pTC, nDeep, bExtra ); + + return( aError ); +} + +/************************************************************************* +|* +|* RscBaseCont::WriteHxx() +|* +|* Beschreibung +|* Ersterstellung MM 26.04.91 +|* Letzte Aenderung MM 26.04.91 +|* +*************************************************************************/ +ERRTYPE RscBaseCont::WriteHxx( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId & rRscId ) +{ + USHORT i; + RscBaseContInst * pClassData; + ERRTYPE aError; + + aError = RscTop::WriteHxx( rInst, fOutput, pTC, rRscId ); + + pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + + for( i = 0; i < pClassData->nEntries && aError.IsOk(); i++ ) + { + if( pClassData->pEntries[ i ].aName.IsId() + && pClassData->pEntries[ i ].aInst.pClass->IsCodeWriteable() ) + { + aError = pClassData->pEntries[ i ].aInst.pClass-> + WriteHxx( pClassData->pEntries[ i ].aInst, + fOutput, pTC, + pClassData->pEntries[ i ].aName ); + } + }; + + return( aError ); +} + +/************************************************************************* +|* +|* RscBaseCont::WriteCxx() +|* +|* Beschreibung +|* Ersterstellung MM 26.04.91 +|* Letzte Aenderung MM 26.04.91 +|* +*************************************************************************/ +ERRTYPE RscBaseCont::WriteCxx( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId & rRscId ) +{ + USHORT i; + RscBaseContInst * pClassData; + ERRTYPE aError; + + aError = RscTop::WriteCxx( rInst, fOutput, pTC, rRscId ); + + pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + + for( i = 0; i < pClassData->nEntries && aError.IsOk(); i++ ) + { + if( pClassData->pEntries[ i ].aName.IsId() + && pClassData->pEntries[ i ].aInst.pClass->IsCodeWriteable() ) + { + aError = pClassData->pEntries[ i ].aInst.pClass-> + WriteCxx( pClassData->pEntries[ i ].aInst, + fOutput, pTC, + pClassData->pEntries[ i ].aName ); + } + }; + + return( aError ); +} + +/*************** R s c C o n t W r i t e S r c ***************************/ +/************************************************************************* +|* +|* RscContWriteSrc::RscContWriteSrc() +|* +|* Beschreibung +|* Ersterstellung MM 08.05.91 +|* Letzte Aenderung MM 08.05.91 +|* +*************************************************************************/ +RscContWriteSrc::RscContWriteSrc( HASHID nId, USHORT nTypeId, + RscTop * pSuper, BOOL bNoIdent ) + : RscBaseCont( nId, nTypeId, pSuper, bNoIdent ) +{} + +/************************************************************************* +|* +|* RscContWriteSrc::WriteSrc() +|* +|* Beschreibung +|* Ersterstellung MM 08.05.91 +|* Letzte Aenderung MM 08.05.91 +|* +*************************************************************************/ +void RscContWriteSrc::WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, + const char * pVarName ) +{ + USHORT i; + + RscTop::WriteSrc( rInst, fOutput, pTC, nTab, pVarName ); + + fprintf( fOutput, "\n" ); + for( i = 0; i < nTab; i++ ) + fputc( '\t', fOutput ); + fprintf( fOutput, "{\n" ); + + ContWriteSrc( rInst, fOutput, pTC, nTab +1, pVarName ); + + for( i = 0; i < nTab; i++ ) + fputc( '\t', fOutput ); + fprintf( fOutput, "}" ); +} + +/*************** R s c C o n t *******************************************/ +/************************************************************************* +|* +|* RscCont::RscCont() +|* +|* Beschreibung +|* Ersterstellung MM 08.05.91 +|* Letzte Aenderung MM 08.05.91 +|* +*************************************************************************/ +RscCont::RscCont( HASHID nId, USHORT nTypeId, RscTop * pSuper, BOOL bNoIdent ) + : RscContWriteSrc( nId, nTypeId, pSuper, bNoIdent ) +{} + +/************************************************************************* +|* +|* RscCont::WriteRc() +|* +|* Beschreibung +|* Ersterstellung MM 08.05.91 +|* Letzte Aenderung MM 08.05.91 +|* +*************************************************************************/ +ERRTYPE RscCont::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, + RscTypCont * pTC, USHORT nDeep, BOOL bExtra ) +{ + RscBaseContInst * pClassData; + ERRTYPE aError; + + aError = RscTop::WriteRc( rInst, rMem, pTC, nDeep, bExtra ); + + pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + + rMem.Put( pClassData->nEntries ); + + if( aError.IsOk() ) + aError = ContWriteRc( rInst, rMem, pTC, nDeep, bExtra ); + + return aError; +} + +//================================================================== +void RscCont::WriteRcAccess +( + FILE * fOutput, + RscTypCont * pTC, + const char * pName +) +{ + ContWriteRcAccess( fOutput, pTC, pName, TRUE ); +} + +/************************************************************************* +|* +|* RscContExtraData::RscContExtraData() +|* +|* Beschreibung +|* Ersterstellung MM 08.05.91 +|* Letzte Aenderung MM 08.05.91 +|* +*************************************************************************/ +RscContExtraData::RscContExtraData( HASHID nId, USHORT nTypeId, + RscTop * pSuper, BOOL bNoIdent ) + : RscContWriteSrc( nId, nTypeId, pSuper, bNoIdent ) +{} + +/************************************************************************* +|* +|* RscContExtraData::WriteRc() +|* +|* Beschreibung +|* Ersterstellung MM 08.05.91 +|* Letzte Aenderung MM 08.05.91 +|* +*************************************************************************/ +ERRTYPE RscContExtraData::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, + RscTypCont * pTC, USHORT nDeep, BOOL bExtra ) +{ + ERRTYPE aError; + + if( bExtra ) + aError = RscContWriteSrc::WriteRc( rInst, rMem, pTC, nDeep, bExtra ); + else + aError = RscTop::WriteRc( rInst, rMem, pTC, nDeep, bExtra ); + + return aError; +} diff --git a/rsc/source/res/rscflag.cxx b/rsc/source/res/rscflag.cxx new file mode 100644 index 000000000000..b246b5a46fd7 --- /dev/null +++ b/rsc/source/res/rscflag.cxx @@ -0,0 +1,531 @@ +/************************************************************************* + * + * $RCSfile: rscflag.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $ + * + * 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/res/rscflag.cxx,v 1.1.1.1 2000-09-18 16:42:56 hr Exp $ + +*************************************************************************/ +/****************** I N C L U D E S **************************************/ + +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +// Programmabh„ngige Includes. +#ifndef _RSCFLAG_HXX +#include <rscflag.hxx> +#endif + +/****************** C O D E **********************************************/ +/****************** R s c F l a g ****************************************/ +/************************************************************************* +|* +|* RscFlag::RscFlag() +|* +|* Beschreibung +|* Ersterstellung MM 03.04.91 +|* Letzte Aenderung MM 03.04.91 +|* +*************************************************************************/ +RscFlag::RscFlag( HASHID nId, USHORT nTypeId, BOOL bUSHORT_ ) + : RscConst( nId, nTypeId ) + , bUSHORT( bUSHORT_ ) +{} + +/************************************************************************* +|* +|* RscFlag::Size() +|* +|* Beschreibung Die Groeáe der Instanzdaten richtet sich nach +|* der Anzahl der Flags +|* Ersterstellung MM 03.04.91 +|* Letzte Aenderung MM 03.04.91 +|* +*************************************************************************/ +USHORT RscFlag::Size() +{ + return( ALIGNED_SIZE( sizeof( RscFlagInst ) * + ( 1 + (nEntries -1) / (sizeof( USHORT ) * 8) ) ) ); +} + +/************************************************************************* +|* +|* RscFlag::SetNotConst() +|* +|* Beschreibung +|* Ersterstellung MM 03.04.91 +|* Letzte Aenderung MM 03.04.91 +|* +*************************************************************************/ +ERRTYPE RscFlag::SetNotConst( const RSCINST & rInst, HASHID nConst ){ + USHORT i, nFlag; + + if( nEntries != (i = GetConstPos( nConst )) ){ + nFlag = 1 << (i % (sizeof( USHORT ) * 8) ); + i = i / (sizeof( USHORT ) * 8); + ((RscFlagInst *)rInst.pData)[ i ].nFlags &= ~nFlag; + ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags &= ~nFlag; + return( ERR_OK ); + }; + + return( ERR_RSCFLAG ); +} + +/************************************************************************* +|* +|* RscFlag::SetConst() +|* +|* Beschreibung +|* Ersterstellung MM 03.04.91 +|* Letzte Aenderung MM 03.04.91 +|* +*************************************************************************/ +ERRTYPE RscFlag::SetConst( const RSCINST & rInst, HASHID nConst, long nVal ) +{ + USHORT i, nFlag; + + if( nEntries != (i = GetConstPos( nConst )) ){ + nFlag = 1 << (i % (sizeof( USHORT ) * 8) ); + i = i / (sizeof( USHORT ) * 8); + ((RscFlagInst *)rInst.pData)[ i ].nFlags |= nFlag; + ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags &= ~nFlag; + return( ERR_OK ); + }; + + return( ERR_RSCFLAG ); +} + +/************************************************************************* +|* +|* RscFlag::CreateBasic() +|* +|* Beschreibung +|* Ersterstellung MM 16.01.92 +|* Letzte Aenderung MM 16.01.92 +|* +*************************************************************************/ +RSCINST RscFlag::CreateBasic( RSCINST * pInst ) +{ + RSCINST aInst; + + if( !pInst ){ + aInst.pClass = this; + aInst.pData = (CLASS_DATA) RscMem::Malloc( Size() ); + } + else + aInst = *pInst; + + return( aInst ); +} + +/************************************************************************* +|* +|* RscFlag::Create() +|* +|* Beschreibung +|* Ersterstellung MM 03.04.91 +|* Letzte Aenderung MM 16.01.92 +|* +*************************************************************************/ +RSCINST RscFlag::Create( RSCINST * pInst, const RSCINST & rDflt, BOOL bOwnClass ){ + RSCINST aInst = CreateBasic( pInst ); + USHORT i; + + if( !bOwnClass && rDflt.IsInst() ) + bOwnClass = rDflt.pClass->InHierarchy( this ); + + if( bOwnClass ) + memmove( aInst.pData, rDflt.pData, Size() ); + else + { + for( i = 0; i < Size() / sizeof( RscFlagInst ); i++ ) + { + ((RscFlagInst *)aInst.pData)[ i ].nFlags = 0; + ((RscFlagInst *)aInst.pData)[ i ].nDfltFlags = 0xFFFF; + } + }; + + return( aInst ); +} + +/************************************************************************* +|* +|* RscFlag::CreateClient() +|* +|* Beschreibung +|* Ersterstellung MM 16.01.92 +|* Letzte Aenderung MM 16.01.92 +|* +*************************************************************************/ +RSCINST RscFlag::CreateClient( RSCINST * pInst, const RSCINST & rDfltI, + BOOL bOwnClass, HASHID nConstId ) +{ + RSCINST aInst = CreateBasic( pInst ); + USHORT i, nFlag; + + if( !bOwnClass && rDfltI.IsInst() ) + bOwnClass = rDfltI.pClass->InHierarchy( this ); + + if( nEntries != (i = GetConstPos( nConstId )) ){ + nFlag = 1 << (i % (sizeof( USHORT ) * 8) ); + i = i / (sizeof( USHORT ) * 8); + if( bOwnClass ){ + ((RscFlagInst *)aInst.pData)[ i ].nFlags &= + ~nFlag | ((RscFlagInst *)rDfltI.pData)[ i ].nFlags; + ((RscFlagInst *)aInst.pData)[ i ].nDfltFlags &= + ~nFlag | ((RscFlagInst *)rDfltI.pData)[ i ].nDfltFlags; + } + else{ + ((RscFlagInst *)aInst.pData)[ i ].nFlags &= ~nFlag; + ((RscFlagInst *)aInst.pData)[ i ].nDfltFlags |= nFlag; + } + } + + return( aInst ); +} + +/************************************************************************* +|* +|* RscFlag::SetToDefault() +|* +|* Beschreibung +|* Ersterstellung MM 03.04.91 +|* Letzte Aenderung MM 03.04.91 +|* +*************************************************************************/ +void RscFlag::SetToDefault( const RSCINST & rInst ) +{ + USHORT i; + + for( i = 0; i < Size() / sizeof( RscFlagInst ); i++ ) + ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags = 0xFFFF; +} + +/************************************************************************* +|* +|* RscFlag::IsDlft() +|* +|* Beschreibung +|* Ersterstellung MM 03.04.91 +|* Letzte Aenderung MM 03.04.91 +|* +*************************************************************************/ +BOOL RscFlag::IsDefault( const RSCINST & rInst ) +{ + USHORT i; + + for( i = 0; i < Size() / sizeof( RscFlagInst ); i++ ) + if( ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags != 0xFFFF ) + return( FALSE ); + return( TRUE ); +} + +BOOL RscFlag::IsDefault( const RSCINST & rInst, HASHID nConstId ) +{ + USHORT i, nFlag; + + if( nEntries != (i = GetConstPos( nConstId )) ){ + nFlag = 1 << (i % (sizeof( USHORT ) * 8) ); + i = i / (sizeof( USHORT ) * 8); + if( ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags & nFlag ) + return( TRUE ); + else + return( FALSE ); + }; + return( TRUE ); +} + +/************************************************************************* +|* +|* RscFlag::IsValueDefault() +|* +|* Beschreibung +|* Ersterstellung MM 25.04.91 +|* Letzte Aenderung MM 25.04.91 +|* +*************************************************************************/ +BOOL RscFlag::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef, + HASHID nConstId ) +{ + USHORT i, nFlag; + + if( nEntries != (i = GetConstPos( nConstId )) ){ + nFlag = 1 << (i % (sizeof( USHORT ) * 8) ); + i = i / (sizeof( USHORT ) * 8); + + if( pDef ){ + if( (((RscFlagInst *)rInst.pData)[ i ].nFlags & nFlag) + == (((RscFlagInst *)pDef)[ i ].nFlags & nFlag) ) + { + return TRUE; + } + } + }; + + return FALSE; +} + +BOOL RscFlag::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ){ + USHORT i; + + if( pDef ){ + USHORT Flag, nIndex; + + Flag = 1; + for( i = 0; i < nEntries; i++ ){ + nIndex = i / (sizeof( USHORT ) * 8); + if( (((RscFlagInst *)rInst.pData)[ nIndex ].nFlags & Flag) + != (((RscFlagInst *)pDef)[ nIndex ].nFlags & Flag) ) + { + return FALSE; + } + Flag <<= 1; + if( !Flag ) + Flag = 1; + }; + } + else + return FALSE; + + return TRUE; +} + +/************************************************************************* +|* +|* RscFlag::IsSet() +|* +|* Beschreibung +|* Ersterstellung MM 10.04.91 +|* Letzte Aenderung MM 10.04.91 +|* +*************************************************************************/ +BOOL RscFlag::IsSet( const RSCINST & rInst, HASHID nConstId ){ + USHORT i, nFlag; + + if( nEntries != (i = GetConstPos( nConstId )) ){ + nFlag = 1 << (i % (sizeof( USHORT ) * 8) ); + i = i / (sizeof( USHORT ) * 8); + if( ((RscFlagInst *)rInst.pData)[ i ].nFlags & nFlag ) + return( TRUE ); + else + return( FALSE ); + }; + return( TRUE ); +} + +/************************************************************************* +|* +|* RscFlag::WriteSrc() +|* +|* Beschreibung +|* Ersterstellung MM 08.04.91 +|* Letzte Aenderung MM 08.04.91 +|* +*************************************************************************/ +void RscFlag::WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont *, USHORT, const char * ) +{ + USHORT i, Flag, nIndex; + BOOL bComma = FALSE; + + Flag = 1; + for( i = 0; i < nEntries; i++ ){ + nIndex = i / (sizeof( USHORT ) * 8); + if( !( ((RscFlagInst *)rInst.pData)[ nIndex ].nDfltFlags & Flag) ){ + if( bComma ) + fprintf( fOutput, ", " ); + if( ((RscFlagInst *)rInst.pData)[ nIndex ].nFlags & Flag ) + fprintf( fOutput, "%s", pHS->Get( pVarArray[ i ].nId ) ); + else{ + fprintf( fOutput, "not " ); + fprintf( fOutput, "%s", pHS->Get( pVarArray[ i ].nId ) ); + } + bComma = TRUE; + } + Flag <<= 1; + if( !Flag ) + Flag = 1; + }; +} + +/************************************************************************* +|* +|* RscFlag::WriteRc() +|* +|* Beschreibung +|* Ersterstellung MM 15.04.91 +|* Letzte Aenderung MM 15.04.91 +|* +*************************************************************************/ +ERRTYPE RscFlag::WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont *, USHORT, BOOL ) +{ + INT32 lVal = 0; + USHORT i, Flag, nIndex; + + Flag = 1; + for( i = 0; i < nEntries; i++ ){ + nIndex = i / (sizeof( USHORT ) * 8); + if( ((RscFlagInst *)rInst.pData)[ nIndex ].nFlags & Flag ) + lVal |= pVarArray[ i ].lValue; + + Flag <<= 1; + if( !Flag ) + Flag = 1; + }; + + if( bUSHORT ) + aMem.Put( (USHORT)lVal ); + else + aMem.Put( (INT32)lVal ); + return( ERR_OK ); +} + +/************************************************************************* +|* +|* RscClient::RscClient() +|* +|* Beschreibung +|* Ersterstellung MM 08.04.91 +|* Letzte Aenderung MM 08.04.91 +|* +*************************************************************************/ +RscClient::RscClient( HASHID nId, USHORT nTypeId, RscFlag * pClass, + HASHID nConstantId ) + : RscTop ( nId, nTypeId ) +{ + pRefClass = pClass; + nConstId = nConstantId; +} + +/************************************************************************* +|* +|* RscClient::GetClassType() +|* +|* Beschreibung +|* Ersterstellung MM 08.04.91 +|* Letzte Aenderung MM 08.04.91 +|* +*************************************************************************/ +RSCCLASS_TYPE RscClient::GetClassType() const +{ + return RSCCLASS_BOOL; +} + +/************************************************************************* +|* +|* RscClient::WriteSrc() +|* +|* Beschreibung +|* Ersterstellung MM 08.04.91 +|* Letzte Aenderung MM 08.04.91 +|* +*************************************************************************/ +void RscClient::WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont *, USHORT, const char * ) +{ + if( pRefClass->IsSet( rInst, nConstId ) ) + fprintf( fOutput, "TRUE" ); + else + fprintf( fOutput, "FALSE" ); +} + +/************************************************************************* +|* +|* RscClient::Create() +|* +|* Beschreibung +|* Ersterstellung MM 08.04.91 +|* Letzte Aenderung MM 08.04.91 +|* +*************************************************************************/ +RSCINST RscClient::Create( RSCINST * pInst, const RSCINST & rDflt, + BOOL bOwnClass ) +{ + RSCINST aTmpI, aDfltI; + + if( pInst ){ + aTmpI.pClass = pRefClass; + aTmpI.pData = pInst->pData; + } + + if( !bOwnClass && rDflt.IsInst() ){ + bOwnClass = rDflt.pClass->InHierarchy( this ); + if( bOwnClass ){ + aDfltI.pClass = pRefClass; + aDfltI.pData = rDflt.pData; + } + } + + if( pInst ) + aTmpI = pRefClass->CreateClient( &aTmpI, aDfltI, + bOwnClass, nConstId ); + else + aTmpI = pRefClass->CreateClient( NULL, aDfltI, + bOwnClass, nConstId ); + aTmpI.pClass = this; + + return( aTmpI ); +} + diff --git a/rsc/source/res/rscmgr.cxx b/rsc/source/res/rscmgr.cxx new file mode 100644 index 000000000000..4ad36873727f --- /dev/null +++ b/rsc/source/res/rscmgr.cxx @@ -0,0 +1,778 @@ +/************************************************************************* + * + * $RCSfile: rscmgr.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $ + * + * 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/res/rscmgr.cxx,v 1.1.1.1 2000-09-18 16:42:56 hr Exp $ + + Source Code Control System - Update + + $Log: not supported by cvs2svn $ + Revision 1.21 2000/09/17 12:51:11 willem.vandorp + OpenOffice header added. + + Revision 1.20 2000/07/26 17:13:22 willem.vandorp + Headers/footers replaced + + Revision 1.19 2000/07/12 11:38:32 th + Unicode + + Revision 1.18 1999/09/20 17:26:04 pl + PutAt with short + + Revision 1.17 1999/09/08 09:24:59 mm + BigEndian/LittleEndian komplett durchgezogen + +**************************************************************************/ +/****************** I N C L U D E S **************************************/ + +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <ctype.h> + +// Programmabhaengige Includes. +#ifndef _RSCMGR_HXX +#include <rscmgr.hxx> +#endif +#ifndef _RSCDB_HXX +#include <rscdb.hxx> +#endif + +/****************** C O D E **********************************************/ +/****************** R s c M g r ******************************************/ +/************************************************************************* +|* +|* RscMgr::RscMgr() +|* +|* Beschreibung +|* Ersterstellung MM 26.04.91 +|* Letzte Aenderung MM 26.04.91 +|* +*************************************************************************/ +RscMgr::RscMgr( HASHID nId, USHORT nTypeId, RscTop * pSuperCl ) + : RscClass( nId, nTypeId, pSuperCl ) +{ +} + +/************************************************************************* +|* +|* RscMgr::Size() +|* +|* Beschreibung +|* Ersterstellung MM 26.04.91 +|* Letzte Aenderung MM 26.04.91 +|* +*************************************************************************/ +USHORT RscMgr::Size() +{ + return RscClass::Size() + ALIGNED_SIZE( sizeof( RscMgrInst ) ); +} + +/************************************************************************* +|* +|* RscMgr::Create() +|* +|* Beschreibung +|* Ersterstellung MM 03.04.91 +|* Letzte Aenderung MM 03.04.91 +|* +*************************************************************************/ +RSCINST RscMgr::Create( RSCINST * pInst, const RSCINST & rDflt, BOOL bOwnClass ){ + RSCINST aInst; + RscMgrInst * pClassData; + + if( !pInst ){ + aInst.pClass = this; + aInst.pData = (CLASS_DATA) RscMem::Malloc( Size() ); + } + else + aInst = *pInst; + if( !bOwnClass && rDflt.IsInst() ) + bOwnClass = rDflt.pClass->InHierarchy( this ); + + RscClass::Create( &aInst, rDflt, bOwnClass ); + + pClassData = (RscMgrInst *)(aInst.pData + RscClass::Size() ); + pClassData->Create(); + + if( bOwnClass ){ + RscMgrInst * pDfltData = (RscMgrInst *)(rDflt.pData + RscClass::Size()); + *pClassData = *pDfltData; + }; + + return( aInst ); +} + +/************************************************************************* +|* +|* RscMgr::Destroy() +|* +|* Beschreibung +|* Ersterstellung MM 21.06.91 +|* Letzte Aenderung MM 21.06.91 +|* +*************************************************************************/ +void RscMgr::Destroy( const RSCINST & rInst ){ + RscMgrInst * pClassData; + + RscClass::Destroy( rInst ); + + pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); + pClassData->Destroy(); +} + +/************************************************************************* +|* +|* RscMgr::SetToDefault() +|* +|* Beschreibung +|* Ersterstellung MM 12.06.91 +|* Letzte Aenderung MM 12.06.91 +|* +*************************************************************************/ +void RscMgr::SetToDefault( const RSCINST & rInst ) +{ + RscMgrInst * pClassData; + + pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); + pClassData->bDflt = TRUE; + + RscClass::SetToDefault( rInst ); +} + +/************************************************************************* +|* +|* RscMgr::IsDefault() +|* +|* Beschreibung +|* Ersterstellung MM 12.06.91 +|* Letzte Aenderung MM 12.06.91 +|* +*************************************************************************/ +BOOL RscMgr::IsDefault( const RSCINST & rInst ){ + RscMgrInst * pClassData; + + pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); + if( !pClassData->bDflt ) + return( FALSE ); + + return( RscClass::IsDefault( rInst ) ); +} + +/************************************************************************* +|* +|* RscMgr::IsValueDefault() +|* +|* Beschreibung +|* Ersterstellung MM 12.06.91 +|* Letzte Aenderung MM 12.06.91 +|* +*************************************************************************/ +BOOL RscMgr::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ){ + RscMgrInst * pClassData; + RscMgrInst * pDfltData; + + if( !RscClass::IsValueDefault( rInst, pDef ) ) + return FALSE; + + if( pDef ){ + pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); + pDfltData = (RscMgrInst *)(pDef + RscClass::Size()); + + if( !pClassData->aRefId.IsId() && !pDfltData->aRefId.IsId() ){ + return TRUE; + } + } + + return FALSE; +} + + +/************************************************************************* +|* +|* RscMgr::WriteSrcHeader() +|* +|* Beschreibung +|* Ersterstellung MM 08.04.91 +|* Letzte Aenderung MM 08.04.91 +|* +*************************************************************************/ +void RscMgr::WriteSrcHeader( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, + const RscId & rId, const char * pVarName ) +{ + RscMgrInst * pClassData; + USHORT i; + + pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); + + fprintf( fOutput, "%s %s", + pHS->Get( rInst.pClass->GetId() ), + (rId.GetName()).GetBuffer() ); + if( pClassData->aRefId.IsId() ) + fprintf( fOutput, ",%s", pClassData->aRefId.GetName().GetBuffer() ); + else + { + fprintf( fOutput, "\n" ); + for( i = 0; i < nTab; i++ ) + fputc( '\t', fOutput ); + fprintf( fOutput, "{\n" ); + + rInst.pClass->WriteSrc( rInst, fOutput, pTC, nTab +1, pVarName ); + + RscClass::WriteSrc( rInst, fOutput, pTC, nTab +1, pVarName); + + for( i = 0; i < nTab; i++ ) + fputc( '\t', fOutput ); + fprintf( fOutput, "}" ); + } +} + +/************************************************************************* +|* +|* RscMgr::WriteSrc() +|* +|* Beschreibung +|* Ersterstellung MM 08.04.91 +|* Letzte Aenderung MM 08.04.91 +|* +*************************************************************************/ +void RscMgr::WriteSrc( const RSCINST &, FILE *, RscTypCont *, USHORT, + const char * ) +{ +} + +/************************************************************************* +|* +|* RscMgr::WriteRcHeader() +|* +|* Beschreibung +|* Ersterstellung MM 15.04.91 +|* Letzte Aenderung MM 15.04.91 +|* +*************************************************************************/ +ERRTYPE RscMgr::WriteRcHeader( const RSCINST & rInst, RscWriteRc & rMem, + RscTypCont * pTC, const RscId &rId, + USHORT nDeep, BOOL bExtra ) +{ + RscMgrInst * pClassData; + ERRTYPE aError; + ObjNode * pObjNode = NULL; + + pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); + + if( pClassData->aRefId.IsId() ) + { + //Erhoehen und abfragen um Endlosrekusion zu vermeiden + nDeep++; + if( nDeep > nRefDeep ) + aError = ERR_REFTODEEP; + else + pObjNode = rInst.pClass->GetRefClass()-> + GetObjNode( pClassData->aRefId ); + if( !pObjNode && pTC ) + { + ByteString aMsg( pHS->Get( rInst.pClass->GetId() ) ); + aMsg += ' '; + aMsg += pClassData->aRefId.GetName(); + aError = WRN_MGR_REFNOTFOUND; + pTC->pEH->Error( aError, rInst.pClass, rId, aMsg.GetBuffer() ); + } + } + + if( aError.IsOk() ) + { + if( pObjNode ) + { + RSCINST aRefI; + RscTop * pTmpRefClass = rInst.pClass->GetRefClass(); + + aRefI = RSCINST( rInst.pClass, pObjNode->GetRscObj() ); + if( pTmpRefClass == rInst.pClass ) + { + aError = aRefI.pClass->WriteRcHeader( aRefI, rMem, pTC, + rId, nDeep, bExtra ); + } + else + { + RSCINST aRefInst = rInst.pClass->Create( NULL, aRefI ); + aError = aRefI.pClass->WriteRcHeader( aRefInst, rMem, pTC, + rId, nDeep, bExtra ); + pTmpRefClass->Destroy( aRefInst ); + } + } + else + { + USHORT nOldSize; + USHORT nLocalSize; + + nOldSize = rMem.IncSize( 8 /*sizeof( RSHEADER_TYPE )*/ ); + + aError = rInst.pClass->WriteRc( rInst, rMem, pTC, nDeep, bExtra ); + if( aError.IsOk() ) + aError = WriteInstRc( rInst, rMem, pTC, nDeep, bExtra ); + nLocalSize = rMem.Size(); + + if( aError.IsOk() ) + { + // RscClass wird uebersprungen + aError = RscTop::WriteRc( rInst, rMem, pTC, nDeep, bExtra ); + }; + + /* + // Definition der Struktur, aus denen die Resource aufgebaut ist + struct RSHEADER_TYPE{ + RESOURCE_TYPE nRT; // Resource Typ + USHORT nRT; // Resource Typ + USHORT nGlobOff; // Globaler Offset + USHORT nLocalOff; // Lokaler Offset + }; + */ + USHORT nID = rId; + rMem.PutAt( nOldSize, nID ); + rMem.PutAt( nOldSize +2, (USHORT)rInst.pClass->GetTypId() ); + rMem.PutAt( nOldSize +4, (USHORT)(rMem.Size() - nOldSize) ); + rMem.PutAt( nOldSize +6, (USHORT)(nLocalSize - nOldSize) ); + }; + }; + + return( aError ); +} + +/************************************************************************* +|* +|* RscMgr::WriteRc() +|* +|* Beschreibung +|* Ersterstellung MM 26.04.91 +|* Letzte Aenderung MM 26.04.91 +|* +*************************************************************************/ +ERRTYPE RscMgr::WriteRc( const RSCINST &, RscWriteRc &, + RscTypCont *, USHORT, BOOL ) + +{ + return( ERR_OK ); +} + + +static ByteString MakeSmartName( const ByteString & rDefName ) +{ + ByteString aSmartName; + if( rDefName.Len() ) + { + char * pStr = (char *)rDefName.GetBuffer(); + aSmartName = (char)toupper( *pStr ); + while( *++pStr ) + { + if( '_' == *pStr ) + { + if( *++pStr ) + aSmartName += (char)toupper( *pStr ); + else + break; + } + else + aSmartName += (char)tolower( *pStr ); + } + } + return aSmartName; +} + +static ByteString MakeName( RscTypCont * pTypCon, RscTop * pClass, + const ByteString & rName ) +{ + ByteString aRet; + if( !pTypCon->IsSmart() || isdigit( rName.GetChar(0) ) ) + { + aRet += pHS->Get( pClass->GetId() ); + aRet += rName; + } + else + aRet += MakeSmartName( rName ); + return aRet; +} + +/************************************************************************* +|* +|* RscMgr::WriteHxxHeader() +|* +|* Beschreibung +|* Ersterstellung MM 29.05.91 +|* Letzte Aenderung MM 29.05.91 +|* +*************************************************************************/ +ERRTYPE RscMgr::WriteHxxHeader( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId &rId ) +{ + RscMgrInst * pClassData; + ERRTYPE aError; + ObjNode * pObjNode = NULL; + + pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); + + if( pClassData->aRefId.IsId() ) + { + pObjNode = rInst.pClass->GetObjNode( pClassData->aRefId ); + if( !pObjNode && pTC ) + { + ByteString aMsg( pHS->Get( rInst.pClass->GetId() ) ); + aMsg += ' '; + aMsg += pClassData->aRefId.GetName(); + aError = WRN_MGR_REFNOTFOUND; + pTC->pEH->Error( aError, rInst.pClass, rId, aMsg.GetBuffer() ); + } + } + + if( pObjNode ) + { + RSCINST aRefI; + + aRefI = RSCINST( rInst.pClass, pObjNode->GetRscObj() ); + aError = aRefI.pClass->WriteHxxHeader( aRefI, fOutput, pTC, + rId ); + } + else + { + fprintf( fOutput, "class %s", + MakeName( pTC, rInst.pClass, + rId.GetName() ).GetBuffer() ); + fprintf( fOutput, " : public %s", + pHS->Get( rInst.pClass->GetId() ) ); + fprintf( fOutput, "\n{\nprotected:\n" ); + + aError = RscClass::WriteHxx( rInst, fOutput, pTC, rId ); + + RSCINST aExtraInst = rInst.pClass->GetCopyVar( rInst, nRsc_EXTRADATA ); + if( aExtraInst.IsInst() ) + { + if( aExtraInst.pClass->GetCount( aExtraInst ) ) + fprintf( fOutput, " char * pExtraData;\n" ); + } + if( aError.IsOk() ) + { + fprintf( fOutput, "public:\n " ); + fprintf( fOutput, "%s%s bFreeRes = TRUE )", + MakeName( pTC, rInst.pClass, + rId.GetName() ).GetBuffer(), + (rInst.pClass->aCallParType).GetBuffer() ); + fprintf( fOutput, ";\n};\n\n" ); + } + }; + return aError; +} + +/************************************************************************* +|* +|* RscMgr::WriteHxx() +|* +|* Beschreibung +|* Ersterstellung MM 29.05.91 +|* Letzte Aenderung MM 29.05.91 +|* +*************************************************************************/ +ERRTYPE RscMgr::WriteHxx( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId & rId ) +{ + fprintf( fOutput, " %s", pHS->Get( rInst.pClass->GetId() ) ); + fprintf( fOutput, " a%s;\n", + MakeName( pTC, rInst.pClass, rId.GetName() ).GetBuffer() ); + + return ERR_OK; +} + +/************************************************************************* +|* +|* RscClass::WriteCxxHeader() +|* +|* Beschreibung +|* Ersterstellung MM 29.05.91 +|* Letzte Aenderung MM 29.05.91 +|* +*************************************************************************/ +ERRTYPE RscMgr::WriteCxxHeader( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId & rId ) +{ + RscMgrInst * pClassData; + ERRTYPE aError; + ObjNode * pObjNode = NULL; + + pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); + + if( pClassData->aRefId.IsId() ) + { + pObjNode = rInst.pClass->GetObjNode( pClassData->aRefId ); + if( !pObjNode && pTC ) + { + ByteString aMsg( pHS->Get( rInst.pClass->GetId() ) ); + aMsg += ' '; + aMsg += pClassData->aRefId.GetName(); + aError = WRN_MGR_REFNOTFOUND; + pTC->pEH->Error( aError, rInst.pClass, rId, aMsg.GetBuffer() ); + } + } + + if( pObjNode ) + { + RSCINST aRefI; + + aRefI = RSCINST( rInst.pClass, pObjNode->GetRscObj() ); + aError = aRefI.pClass->WriteCxxHeader( aRefI, fOutput, pTC, + rId ); + } + else + { + fprintf( fOutput, "%s::%s", + MakeName( pTC, rInst.pClass, rId.GetName() ).GetBuffer(), + MakeName( pTC, rInst.pClass, rId.GetName() ).GetBuffer() ); + fprintf( fOutput, "%s", (rInst.pClass->aCallParType).GetBuffer() ); + if( GetCount( rInst ) ) + fprintf( fOutput, " bFreeRes" ); + fprintf( fOutput, " )\n : %s", pHS->Get( rInst.pClass->GetId() ) ); + fprintf( fOutput, "%s", (rInst.pClass->aCallPar1).GetBuffer() ); + fprintf( fOutput, " rResId )" ); + + aError = RscClass::WriteCxx( rInst, fOutput, pTC, rId ); + + fprintf( fOutput, "\n{\n" ); + RSCINST aExtraInst = rInst.pClass->GetCopyVar( rInst, nRsc_EXTRADATA ); + if( aExtraInst.IsInst() ) + { + if( aExtraInst.pClass->GetCount( aExtraInst ) ) + { + fprintf( fOutput, " //read extra data\n" ); + fprintf( fOutput, " pExtraData = new char " + "[ GetRemainSizeRes() ];\n" ); + fprintf( fOutput, " memcpy( pExtraData, " + "GetClassRes(), GetRemainSizeRes() );\n" ); + fprintf( fOutput, " IncrementRes( GetRemainSizeRes() );\n" ); + } + } + + if( GetCount( rInst ) ) + { // Es gibt UnterResourcen + fprintf( fOutput, " if( bFreeRes ) FreeResource();\n" ); + } + else + { + fprintf( fOutput, + " // No subresources, automatic free resource\n" ); + } + fprintf( fOutput, "}\n\n" ); + } + return aError; +} + +/************************************************************************* +|* +|* RscClass::WriteCxx() +|* +|* Beschreibung +|* Ersterstellung MM 29.05.91 +|* Letzte Aenderung MM 29.05.91 +|* +*************************************************************************/ +ERRTYPE RscMgr::WriteCxx( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId & rId ) +{ + const char * pName = rId.GetName().GetBuffer(); + fprintf( fOutput, ",\n a%s", + MakeName( pTC, rInst.pClass, rId.GetName() ).GetBuffer() ); + fprintf( fOutput, "%s", (rInst.pClass->aCallPar2).GetBuffer() ); + fprintf( fOutput, " ResId( %s ) )", (rId.GetName()).GetBuffer() ); + + return ERR_OK; +} + +/************************************************************************* +|* +|* RscArray::IsConsistent() +|* +|* Beschreibung +|* Ersterstellung MM 23.09.91 +|* Letzte Aenderung MM 23.09.91 +|* +*************************************************************************/ +BOOL RscMgr::IsConsistent( const RSCINST & rInst, RscInconsList * pList ) +{ + BOOL bRet; + RscMgrInst * pClassData; + + bRet = RscClass::IsConsistent( rInst, pList ); + + pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); + if( pClassData->aRefId.IsId() && + ((pClassData->aRefId.GetNumber() < 1) + || (pClassData->aRefId.GetNumber() > 0x7FFF) + || IsToDeep( rInst ).IsError()) ) + { + if( pList ) + pList->Insert( + new RscInconsistent( pClassData->aRefId, + pClassData->aRefId ) ); + bRet = FALSE; + } + + return( bRet ); +} + +/************************************************************************* +|* +|* RscMgr::GetRef() +|* +|* Beschreibung +|* Ersterstellung MM 15.05.91 +|* Letzte Aenderung MM 15.05.91 +|* +*************************************************************************/ +ERRTYPE RscMgr::GetRef( const RSCINST & rInst, RscId * pRscId ){ + RscMgrInst * pClassData; + + pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); + *pRscId = pClassData->aRefId; + return ERR_OK; +} + +/************************************************************************* +|* +|* RscMgr::IsToDeep() +|* +|* Beschreibung +|* Ersterstellung MM 15.05.91 +|* Letzte Aenderung MM 15.05.91 +|* +*************************************************************************/ +ERRTYPE RscMgr::IsToDeep( const RSCINST & rInst, USHORT nDeep ) +{ + RscMgrInst * pClassData; + RscId aOldId, aId; + ERRTYPE aError; + RSCINST aTmpI = rInst; + ObjNode * pObjNode; + + pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); + + while( aTmpI.IsInst() && (nDeep < nRefDeep) && aError.IsOk() ) + { + // Referenz holen + aTmpI.pClass->GetRef( aTmpI, &aId ); + // Referenziertes Objekt holen + pObjNode = aTmpI.pClass->GetObjNode( aId ); + // Referenzierte Objekt gefunden ? + if( pObjNode ) + { + aTmpI.pData = pObjNode->GetRscObj(); + nDeep++; + } + else //aTmpI.IsInst() wird FALSE, Schleife beenden + aTmpI.pData = NULL; + } + + if( nDeep >= nRefDeep ) + { + pClassData->aRefId = aOldId; + aError = ERR_REFTODEEP; + } + + return( aError ); +} + +/************************************************************************* +|* +|* RscMgr::SetRef() +|* +|* Beschreibung +|* Ersterstellung MM 15.05.91 +|* Letzte Aenderung MM 15.05.91 +|* +*************************************************************************/ +ERRTYPE RscMgr::SetRef( const RSCINST & rInst, const RscId & rRefId ) +{ + RscMgrInst * pClassData; + RscId aOldId, aId; + ERRTYPE aError; + RSCINST aTmpI = rInst; + + if( rRefId.IsId() && + ((rRefId.GetNumber() < 1) || (rRefId.GetNumber() > 0x7FFF)) ) + { + aError = ERR_IDRANGE; + } + else + { + pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); + aOldId = pClassData->aRefId;// Alten Wert merken + pClassData->aRefId = rRefId;// vorher eintragen, + // sonst Fehler bei rekursion + + + aError = IsToDeep( rInst ); + if( aError.IsOk() ) + pClassData->bDflt = FALSE; + else + pClassData->aRefId = aOldId; + } + + return( aError ); +} diff --git a/rsc/source/res/rscrange.cxx b/rsc/source/res/rscrange.cxx new file mode 100644 index 000000000000..225754f5df1c --- /dev/null +++ b/rsc/source/res/rscrange.cxx @@ -0,0 +1,904 @@ +/************************************************************************* + * + * $RCSfile: rscrange.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $ + * + * 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/res/rscrange.cxx,v 1.1.1.1 2000-09-18 16:42:56 hr Exp $ + +*************************************************************************/ +/****************** I N C L U D E S **************************************/ + +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +// Solar Definitionen +#include <tools/solar.h> + +// Programmabh„ngige Includes. +#ifndef _RSCRANGE_HXX +#include <rscrange.hxx> +#endif + +/****************** D E F I N E S ****************************************/ +#define USHORTBITS (sizeof( USHORT ) * 8) +/****************** C O D E **********************************************/ +/****************** R s c R a n g e **************************************/ +/************************************************************************* +|* +|* RscRange::RscRange() +|* +|* Beschreibung +|* Ersterstellung MM 03.04.91 +|* Letzte Aenderung MM 03.04.91 +|* +*************************************************************************/ +RscRange::RscRange( HASHID nId, USHORT nTypeId ) + : RscTop( nId, nTypeId ) +{ + nMin = nMax = 0; + nSize = ALIGNED_SIZE( sizeof( RscRangeInst ) ); +} + +/************************************************************************* +|* +|* RscRange::GetClassType() +|* +|* Beschreibung +|* Ersterstellung MM 03.04.91 +|* Letzte Aenderung MM 03.04.91 +|* +*************************************************************************/ +RSCCLASS_TYPE RscRange::GetClassType() const +{ + return RSCCLASS_NUMBER; +} + +/************************************************************************* +|* +|* RscRange::SetRange() +|* +|* Beschreibung +|* Ersterstellung MM 03.04.91 +|* Letzte Aenderung MM 03.04.91 +|* +*************************************************************************/ +ERRTYPE RscRange::SetRange( long nMinimum, long nMaximum ) +{ + if( nMinimum > nMaximum ) + { + nMin = nMaximum; + nMax = nMinimum; + } + else + { + nMax = nMaximum; + nMin = nMinimum; + }; + + return( ERR_OK ); +} + +/************************************************************************* +|* +|* RscRange::IsValueDefault() +|* +|* Beschreibung +|* Ersterstellung MM 15.02.92 +|* Letzte Aenderung MM 15.02.92 +|* +*************************************************************************/ +BOOL RscRange::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) +{ + if( pDef ) + { + if( ((RscRangeInst*)rInst.pData)->nValue == + ((RscRangeInst*)pDef)->nValue ) + { + return TRUE; + } + } + + return FALSE; +} + +/************************************************************************* +|* +|* RscRange::SetNumber() +|* +|* Beschreibung +|* Ersterstellung MM 03.04.91 +|* Letzte Aenderung MM 03.04.91 +|* +*************************************************************************/ +ERRTYPE RscRange::SetNumber( const RSCINST & rInst, long nValue ) +{ + if( nMax < nValue || nMin > nValue ) + return( ERR_RSCRANGE_OUTDEFSET ); + ((RscRangeInst *)rInst.pData)->nValue = (USHORT)( nValue - nMin ); + ((RscRangeInst *)rInst.pData)->bDflt = FALSE; + return( ERR_OK ); +} + +/************************************************************************* +|* +|* RscRange::GetNumber() +|* +|* Beschreibung +|* Ersterstellung MM 22.04.91 +|* Letzte Aenderung MM 22.04.91 +|* +*************************************************************************/ +ERRTYPE RscRange::GetNumber( const RSCINST & rInst, long * pN ) +{ + *pN = ((RscRangeInst *)rInst.pData)->nValue + nMin; + return( ERR_OK ); +} + +/************************************************************************* +|* +|* RscRange::Create() +|* +|* Beschreibung +|* Ersterstellung MM 03.04.91 +|* Letzte Aenderung MM 03.04.91 +|* +*************************************************************************/ +RSCINST RscRange::Create( RSCINST * pInst, const RSCINST & rDflt, + BOOL bOwnClass ) +{ + RSCINST aInst; + + if( !pInst ) + { + aInst.pClass = this; + aInst.pData = (CLASS_DATA) + RscMem::Malloc( sizeof( RscRangeInst ) ); + } + else + aInst = *pInst; + if( !bOwnClass && rDflt.IsInst() ) + bOwnClass = rDflt.pClass->InHierarchy( this ); + + if( bOwnClass ) + memmove( aInst.pData, rDflt.pData, sizeof( RscRangeInst ) ); + else + { + if( 0L >= nMin && 0L <= nMax ) + ((RscRangeInst *)aInst.pData)->nValue = (USHORT)(0L - nMin); + else + ((RscRangeInst *)aInst.pData)->nValue = 0; + ((RscRangeInst *)aInst.pData)->bDflt = TRUE; + } + + return( aInst ); +} + +/************************************************************************* +|* +|* RscRange::WriteSrc() +|* +|* Beschreibung +|* Ersterstellung MM 08.04.91 +|* Letzte Aenderung MM 08.04.91 +|* +*************************************************************************/ +void RscRange::WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont *, USHORT, const char * ) +{ + fprintf( fOutput, "%ld", ((RscRangeInst *)rInst.pData)->nValue + nMin ); +} + +/************************************************************************* +|* +|* RscRange::WriteRc() +|* +|* Beschreibung +|* Ersterstellung MM 15.04.91 +|* Letzte Aenderung MM 15.04.91 +|* +*************************************************************************/ +ERRTYPE RscRange::WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont *, USHORT, BOOL ) +{ + if( nMin >= 0 ) + { + USHORT n; + n = (USHORT)(((RscRangeInst *)rInst.pData)->nValue + nMin); + aMem.Put( n ); + } + else + { + short n; + n = (short)(((RscRangeInst *)rInst.pData)->nValue + nMin); + aMem.Put( n ); + } + + return( ERR_OK ); +} + +//======================================================================= +void RscRange::WriteRcAccess +( + FILE * fOutput, + RscTypCont * pTC, + const char * pName +) +{ + fprintf( fOutput, "\t\tSet%s( ", pName ); + if( nMin >= 0 ) + fprintf( fOutput, "*(USHORT *)(pResData+nOffset) );\n", pName ); + else + fprintf( fOutput, "*(short *)(pResData+nOffset) );\n", pName ); + fprintf( fOutput, "\t\tnOffset += sizeof( short );\n" ); +} + +/****************** R s c L o n g R a n g e ******************************/ +/************************************************************************* +|* +|* RscLongRange::RscLongRange() +|* +|* Beschreibung +|* Ersterstellung MM 18.07.94 +|* Letzte Aenderung MM 18.07.94 +|* +*************************************************************************/ +RscLongRange::RscLongRange( HASHID nId, USHORT nTypeId ) + : RscTop( nId, nTypeId ) +{ + nMin = nMax = 0; + nSize = ALIGNED_SIZE( sizeof( RscLongRangeInst ) ); +} + +/************************************************************************* +|* +|* RscLongRange::GetClassType() +|* +|* Beschreibung +|* Ersterstellung MM 18.07.94 +|* Letzte Aenderung MM 18.07.94 +|* +*************************************************************************/ +RSCCLASS_TYPE RscLongRange::GetClassType() const +{ + return RSCCLASS_NUMBER; +} + +/************************************************************************* +|* +|* RscLongRange::SetRange() +|* +|* Beschreibung +|* Ersterstellung MM 18.07.94 +|* Letzte Aenderung MM 18.07.94 +|* +*************************************************************************/ +ERRTYPE RscLongRange::SetRange( long nMinimum, long nMaximum ) +{ + if( nMinimum > nMaximum ) + { + nMin = nMaximum; + nMax = nMinimum; + } + else + { + nMax = nMaximum; + nMin = nMinimum; + }; + + return( ERR_OK ); +} + +/************************************************************************* +|* +|* RscLongRange::IsValueDefault() +|* +|* Beschreibung +|* Ersterstellung MM 15.02.92 +|* Letzte Aenderung MM 15.02.92 +|* +*************************************************************************/ +BOOL RscLongRange::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) +{ + if( pDef ) + return 0 == memcmp( &((RscLongRangeInst*)rInst.pData)->nValue, + &((RscLongRangeInst*)pDef)->nValue, + sizeof( long ) ); + + return FALSE; +} + +/************************************************************************* +|* +|* RscLongRange::SetNumber() +|* +|* Beschreibung +|* Ersterstellung MM 18.07.94 +|* Letzte Aenderung MM 18.07.94 +|* +*************************************************************************/ +ERRTYPE RscLongRange::SetNumber( const RSCINST & rInst, long nValue ) +{ + if( nMax < nValue || nMin > nValue ) + return( ERR_RSCRANGE_OUTDEFSET ); + void * pData = &((RscLongRangeInst*)rInst.pData)->nValue; + memmove( pData, &nValue, sizeof( long ) ); + ((RscLongRangeInst *)rInst.pData)->bDflt = FALSE; + return( ERR_OK ); +} + +/************************************************************************* +|* +|* RscLongRange::GetNumber() +|* +|* Beschreibung +|* Ersterstellung MM 22.04.91 +|* Letzte Aenderung MM 22.04.91 +|* +*************************************************************************/ +ERRTYPE RscLongRange::GetNumber( const RSCINST & rInst, long * pN ) +{ + memmove( pN, &((RscLongRangeInst*)rInst.pData)->nValue, + sizeof( long ) ); + return( ERR_OK ); +} + +/************************************************************************* +|* +|* RscLongRange::Create() +|* +|* Beschreibung +|* Ersterstellung MM 18.07.94 +|* Letzte Aenderung MM 18.07.94 +|* +*************************************************************************/ +RSCINST RscLongRange::Create( RSCINST * pInst, const RSCINST & rDflt, + BOOL bOwnClass ) +{ + RSCINST aInst; + + if( !pInst ) + { + aInst.pClass = this; + aInst.pData = (CLASS_DATA) + RscMem::Malloc( sizeof( RscLongRangeInst ) ); + } + else + aInst = *pInst; + if( !bOwnClass && rDflt.IsInst() ) + bOwnClass = rDflt.pClass->InHierarchy( this ); + + if( bOwnClass ) + memmove( aInst.pData, rDflt.pData, sizeof( RscLongRangeInst ) ); + else + { + long lDflt; + if( 0L >= nMin && 0L <= nMax ) + lDflt = 0; + else + lDflt = nMin; + void * pData = &((RscLongRangeInst*)aInst.pData)->nValue; + memmove( pData, &lDflt, sizeof( long ) ); + ((RscLongRangeInst *)aInst.pData)->bDflt = TRUE; + } + + return( aInst ); +} + +/************************************************************************* +|* +|* RscLongRange::WriteSrc() +|* +|* Beschreibung +|* Ersterstellung MM 18.07.94 +|* Letzte Aenderung MM 18.07.94 +|* +*************************************************************************/ +void RscLongRange::WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont *, USHORT, const char * ) +{ + long lVal; + GetNumber( rInst, &lVal ); + fprintf( fOutput, "%ld", lVal ); +} + +/************************************************************************* +|* +|* RscLongRange::WriteRc() +|* +|* Beschreibung +|* Ersterstellung MM 18.07.94 +|* Letzte Aenderung MM 18.04.94 +|* +*************************************************************************/ +ERRTYPE RscLongRange::WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont *, USHORT, BOOL ) +{ + long lVal; + + GetNumber( rInst, &lVal ); + aMem.Put( (INT32)lVal ); + + return( ERR_OK ); +} + +//======================================================================= +void RscLongRange::WriteRcAccess +( + FILE * fOutput, + RscTypCont * pTC, + const char * pName +) +{ + fprintf( fOutput, "\t\tSet%s( ", pName ); + fprintf( fOutput, "GetLong( pResData+nOffset ) );\n", pName ); + fprintf( fOutput, "\t\tnOffset += sizeof( INT32 );\n" ); +} + +/****************** R s c L o n g E n u m R a n g e *********************/ +/************************************************************************* +|* RscLongEnumRange::RscLongEnumRange() +|* +|* Beschreibung +*************************************************************************/ +RscLongEnumRange::RscLongEnumRange( HASHID nId, USHORT nTypeId ) + : RscLongRange( nId, nTypeId ) +{ +} + +/************************************************************************* +|* RscLongEnumRange::SetConst() +|* +|* Beschreibung +*************************************************************************/ +ERRTYPE RscLongEnumRange::SetConst( const RSCINST & rInst, HASHID nConst, + long nValue ) +{ + return SetNumber( rInst, nValue ); +} + +/****************** R s c I d R a n g e **********************************/ +/************************************************************************* +|* +|* RscIdRange::RscIdRange() +|* +|* Beschreibung +|* Ersterstellung MM 03.04.91 +|* Letzte Aenderung MM 03.04.91 +|* +*************************************************************************/ +RscIdRange::RscIdRange( HASHID nId, USHORT nTypeId, BOOL bRcL ) + : RscTop( nId, nTypeId ) +{ + nSize = ALIGNED_SIZE( sizeof( RscId ) ); + nMin = nMax = 0; + bRcLong = bRcL; +} + +/************************************************************************* +|* +|* RscIdRange::RscIdRange() +|* +|* Beschreibung +|* Ersterstellung MM 03.04.91 +|* Letzte Aenderung MM 03.04.91 +|* +*************************************************************************/ +RSCCLASS_TYPE RscIdRange::GetClassType() const +{ + return RSCCLASS_NUMBER; +} + +/************************************************************************* +|* +|* RscIdRange::Create() +|* +|* Beschreibung +|* Ersterstellung MM 03.04.91 +|* Letzte Aenderung MM 03.04.91 +|* +*************************************************************************/ +RSCINST RscIdRange::Create( RSCINST * pInst, const RSCINST & rDflt, BOOL bOwnClass ){ + RSCINST aInst; + RscId * pClassData; + + if( !pInst ){ + aInst.pClass = this; + aInst.pData = (CLASS_DATA)RscMem::Malloc( sizeof( RscId ) ); + } + else + aInst = *pInst; + + + if( !bOwnClass && rDflt.IsInst() ) + bOwnClass = rDflt.pClass->InHierarchy( this ); + + pClassData = (RscId *)aInst.pData; + + pClassData->Create(); + if( bOwnClass ) + *pClassData = *(RscId *)rDflt.pData; + else{ + *pClassData = RscId(); + if( 0L >= nMin && 0L <= nMax ) + *pClassData = RscId( 0L ); + else + *pClassData = RscId( nMin ); + //cUnused wird fuer Defaultkennung verwendet + ((RscId *)aInst.pData)->aExp.cUnused = TRUE; + } + + return( aInst ); +} + +/************************************************************************* +|* +|* RscIdRange::Destroy() +|* +|* Beschreibung +|* Ersterstellung MM 22.11.91 +|* Letzte Aenderung MM 22.11.91 +|* +*************************************************************************/ +void RscIdRange :: Destroy( const RSCINST & rInst ){ + ((RscId *)rInst.pData)->Destroy(); +} + +/************************************************************************* +|* +|* RscIdRange::IsValueDefault() +|* +|* Beschreibung +|* Ersterstellung MM 15.01.92 +|* Letzte Aenderung MM 15.01.92 +|* +*************************************************************************/ +BOOL RscIdRange::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ){ + if( pDef ){ + if( ((RscId*)rInst.pData)->aExp.IsNumber() + && ((RscId*)pDef)->aExp.IsNumber() ) + { + if( ((RscId*)rInst.pData)->GetNumber() == + ((RscId*)pDef)->GetNumber() ) + { + return TRUE; + } + } + } + + return FALSE; +} + +/************************************************************************* +|* +|* RscIdRange::SetNumber() +|* +|* Beschreibung +|* Ersterstellung MM 25.11.91 +|* Letzte Aenderung MM 25.11.91 +|* +*************************************************************************/ +ERRTYPE RscIdRange::SetNumber( const RSCINST & rInst, long nValue ) +{ + if( nMax < nValue || nMin > nValue ) + return( ERR_RSCRANGE_OUTDEFSET ); + + *(RscId *)rInst.pData = RscId( nValue ); + ((RscId *)rInst.pData)->aExp.cUnused = FALSE; + return( ERR_OK ); +} + +/************************************************************************* +|* +|* RscIdRange::GetNumber() +|* +|* Beschreibung +|* Ersterstellung MM 25.11.91 +|* Letzte Aenderung MM 25.11.91 +|* +*************************************************************************/ +ERRTYPE RscIdRange::GetNumber( const RSCINST & rInst, long * plValue ){ + *plValue = ((RscId *)rInst.pData)->GetNumber(); + return( ERR_OK ); +} + +/************************************************************************* +|* +|* RscIdRange::SetRef() +|* +|* Beschreibung +|* Ersterstellung MM 22.11.91 +|* Letzte Aenderung MM 22.11.91 +|* +*************************************************************************/ +ERRTYPE RscIdRange::SetRef( const RSCINST & rInst, const RscId & rRscId ){ + ERRTYPE aError; + if( rRscId.IsId() ){ + aError = SetNumber( rInst, rRscId ); + if( aError.IsOk() ){ + *(RscId *)rInst.pData = rRscId; + ((RscId *)rInst.pData)->aExp.cUnused = FALSE; + } + } + else + aError = ERR_RSCRANGE_OUTDEFSET; + + return( aError ); +} + +/************************************************************************* +|* +|* RscIdRange::GetRef() +|* +|* Beschreibung +|* Ersterstellung MM 22.11.91 +|* Letzte Aenderung MM 22.11.91 +|* +*************************************************************************/ +ERRTYPE RscIdRange::GetRef( const RSCINST & rInst, RscId * pRscId ){ + *pRscId = *(RscId *)rInst.pData; + + return( ERR_OK ); +} + +/************************************************************************* +|* +|* RscIdRange::WriteSrc() +|* +|* Beschreibung +|* Ersterstellung MM 22.11.91 +|* Letzte Aenderung MM 25.11.91 +|* +*************************************************************************/ +void RscIdRange::WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont *, USHORT, const char * ) +{ + fprintf( fOutput, "%s", ((RscId *)rInst.pData)->GetName().GetBuffer() ); +} + +/************************************************************************* +|* +|* RscIdRange::WriteRc() +|* +|* Beschreibung +|* Ersterstellung MM 25.11.91 +|* Letzte Aenderung MM 25.11.91 +|* +*************************************************************************/ +ERRTYPE RscIdRange::WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont *, USHORT, BOOL ) +{ + long lVal = ((RscId*)rInst.pData)->GetNumber(); + + if( bRcLong ) + //wenn long geschrieben werden soll + aMem.Put( (INT32)lVal ); + else + aMem.Put( (USHORT)lVal ); + + return( ERR_OK ); +} + +//======================================================================= +void RscIdRange::WriteRcAccess +( + FILE * fOutput, + RscTypCont * pTC, + const char * pName +) +{ + fprintf( fOutput, "\t\tSet%s( ", pName ); + if( bRcLong ) + { + fprintf( fOutput, "GetLong( pResData+nOffset ) );\n", pName ); + fprintf( fOutput, "\t\tnOffset += sizeof( INT32 );\n" ); + } + else + { + fprintf( fOutput, "*(USHORT *)(pResData+nOffset) );\n", pName ); + fprintf( fOutput, "\t\tnOffset += sizeof( short );\n" ); + } +} + +/************************************************************************* +|* +|* RscIdRange::IsConsistent() +|* +|* Beschreibung +|* Ersterstellung MM 22.11.91 +|* Letzte Aenderung MM 22.11.91 +|* +*************************************************************************/ +BOOL RscIdRange::IsConsistent( const RSCINST & rInst, RscInconsList * pList ) +{ + long nValue = ((RscId *)rInst.pData)->GetNumber(); + if( (nMax >= nValue) && (nMin <= nValue) ) + return TRUE; + else { + if( pList ) + pList->Insert( new RscInconsistent( + *(RscId *)rInst.pData, *(RscId *)rInst.pData ) ); + return FALSE; + } +} + +/****************** R s c B o o l ****************************************/ +/************************************************************************* +|* +|* RscBool::RscBool() +|* +|* Beschreibung +|* Ersterstellung MM 29.04.91 +|* Letzte Aenderung MM 29.04.91 +|* +*************************************************************************/ +RscBool::RscBool( HASHID nId, USHORT nTypeId ) + : RscRange( nId, nTypeId ) +{ + RscRange::SetRange( 0, 1 ); +} + +/************************************************************************* +|* +|* RscBool::GetClassType() +|* +|* Beschreibung +|* Ersterstellung MM 29.04.91 +|* Letzte Aenderung MM 29.04.91 +|* +*************************************************************************/ +RSCCLASS_TYPE RscBool::GetClassType() const +{ + return RSCCLASS_BOOL; +} + +/************************************************************************* +|* +|* RscBool::WriteSrc() +|* +|* Beschreibung +|* Ersterstellung MM 29.04.91 +|* Letzte Aenderung MM 29.04.91 +|* +*************************************************************************/ +void RscBool::WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont *, USHORT, const char * ) +{ + long l; + + GetNumber( rInst, &l ); + if( l ) + fprintf( fOutput, "TRUE" ); + else + fprintf( fOutput, "FALSE" ); +} + +//======================================================================= +void RscBool::WriteRcAccess +( + FILE * fOutput, + RscTypCont * pTC, + const char * pName +) +{ + fprintf( fOutput, "\t\tSet%s( ", pName ); + fprintf( fOutput, "(BOOL)*(short *)(pResData+nOffset) );\n", pName ); + fprintf( fOutput, "\t\tnOffset += sizeof( short );\n" ); +} + +/****************** R s c B r e a k R a n g e ****************************/ +/************************************************************************* +|* +|* RscBreakRange::SetNumber() +|* +|* Beschreibung +|* Ersterstellung MM 24.06.91 +|* Letzte Aenderung MM 24.06.91 +|* +*************************************************************************/ +RscBreakRange :: RscBreakRange( HASHID nId, USHORT nTypeId ) + : RscRange( nId, nTypeId ) +{ + nOutRange = 0xFFFFFFFF; +} + +/************************************************************************* +|* +|* RscBreakRange::SetNumber() +|* +|* Beschreibung +|* Ersterstellung MM 24.06.91 +|* Letzte Aenderung MM 24.06.91 +|* +*************************************************************************/ +ERRTYPE RscBreakRange::SetNumber( const RSCINST & rInst, long nValue ){ + if( nValue == nOutRange ) + return( ERR_RSCRANGE_OUTDEFSET ); + else + return( RscRange::SetNumber( rInst, nValue ) ); +} + +/************************************************************************* +|* +|* RscBreakRange::Create() +|* +|* Beschreibung +|* Ersterstellung MM 24.06.91 +|* Letzte Aenderung MM 24.06.91 +|* +*************************************************************************/ +RSCINST RscBreakRange::Create( RSCINST * pInst, const RSCINST & rDflt, + BOOL bOwnClass ) +{ + RSCINST aInst; + long l; + + aInst = RscRange::Create( pInst, rDflt, bOwnClass ); + + GetNumber( aInst, &l ); + if( l == nOutRange ) + ((RscRangeInst *)aInst.pData)->nValue++; + + return( aInst ); +} + diff --git a/rsc/source/res/rscstr.cxx b/rsc/source/res/rscstr.cxx new file mode 100644 index 000000000000..bc64ac66acdb --- /dev/null +++ b/rsc/source/res/rscstr.cxx @@ -0,0 +1,516 @@ +/************************************************************************* + * + * $RCSfile: rscstr.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $ + * + * 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/res/rscstr.cxx,v 1.1.1.1 2000-09-18 16:42:56 hr Exp $ + + Source Code Control System - Update + + $Log: not supported by cvs2svn $ + Revision 1.22 2000/09/17 12:51:11 willem.vandorp + OpenOffice header added. + + Revision 1.21 2000/07/26 17:13:23 willem.vandorp + Headers/footers replaced + + Revision 1.20 2000/07/12 11:38:42 th + Unicode + + Revision 1.19 1999/10/12 08:45:03 mm + gpf corrected + + Revision 1.18 1999/10/11 17:21:53 mm + no LString + +**************************************************************************/ +/****************** I N C L U D E S **************************************/ + +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +// Programmabh„ngige Includes. +#ifndef _RSCDB_HXX +#include <rscdb.hxx> +#endif +#ifndef _RSCSTR_HXX +#include <rscstr.hxx> +#endif + +#include <rtl/textcvt.h> +#include <rtl/textenc.h> + +/****************** C O D E **********************************************/ +/****************** R s c S t r i n g ************************************/ +/************************************************************************* +|* +|* RscString::RscString() +|* +|* Beschreibung +|* Ersterstellung MM 25.04.91 +|* Letzte Aenderung MM 25.04.91 +|* +*************************************************************************/ +RscString::RscString( HASHID nId, USHORT nTypeId ) + : RscTop( nId, nTypeId ) +{ + nSize = ALIGNED_SIZE( sizeof( RscStringInst ) ); + pRefClass = NULL; +} + +/************************************************************************* +|* +|* RscString::GetClassType() +|* +|* Beschreibung +|* Ersterstellung MM 25.04.91 +|* Letzte Aenderung MM 25.04.91 +|* +*************************************************************************/ +RSCCLASS_TYPE RscString::GetClassType() const +{ + return RSCCLASS_STRING; +} + +/************************************************************************* +|* +|* RscString::SetNumber() +|* +|* Beschreibung +|* Ersterstellung MM 25.04.91 +|* Letzte Aenderung MM 25.04.91 +|* +*************************************************************************/ +ERRTYPE RscString::SetString( const RSCINST & rInst, char * pStr ){ + char * pTmp; + ERRTYPE aError; + + if( aError.IsOk() ){ + ((RscStringInst *)rInst.pData)->bDflt = FALSE; + + pTmp = ((RscStringInst *)rInst.pData)->pStr; + if( pTmp ){ + RscMem::Free( pTmp ); + pTmp = NULL; + } + + if( pStr ){ + USHORT nLen = strlen( pStr ) +1; + pTmp = (char *)RscMem::Malloc( nLen ); + memcpy( pTmp, pStr, nLen ); + }; + + ((RscStringInst *)rInst.pData)->pStr = pTmp; + } + + return( aError ); +} + +/************************************************************************* +|* +|* RscString::GetString() +|* +|* Beschreibung +|* Ersterstellung MM 25.04.91 +|* Letzte Aenderung MM 25.04.91 +|* +*************************************************************************/ +ERRTYPE RscString::GetString( const RSCINST & rInst, char ** ppStr ){ + *ppStr = ((RscStringInst *)rInst.pData)->pStr; + return( ERR_OK ); +} + +/************************************************************************* +|* +|* RscString::GetRef() +|* +|* Beschreibung +|* Ersterstellung MM 22.07.91 +|* Letzte Aenderung MM 22.07.91 +|* +*************************************************************************/ +ERRTYPE RscString::GetRef( const RSCINST & rInst, RscId * pRscId ){ + *pRscId = ((RscStringInst *)rInst.pData)->aRefId; + return( ERR_OK ); +} + +/************************************************************************* +|* +|* RscString::SetRef() +|* +|* Beschreibung +|* Ersterstellung MM 15.05.91 +|* Letzte Aenderung MM 15.05.91 +|* +*************************************************************************/ +ERRTYPE RscString::SetRef( const RSCINST & rInst, const RscId & rRefId ){ + if( pRefClass ){ + ((RscStringInst *)rInst.pData)->aRefId = rRefId; + ((RscStringInst *)rInst.pData)->bDflt = FALSE; + } + else + return( ERR_REFNOTALLOWED ); + + return ERR_OK; +} + +/************************************************************************* +|* +|* RscString::Create() +|* +|* Beschreibung +|* Ersterstellung MM 25.04.91 +|* Letzte Aenderung MM 25.04.91 +|* +*************************************************************************/ +RSCINST RscString::Create( RSCINST * pInst, const RSCINST & rDflt, + BOOL bOwnClass ) +{ + RSCINST aInst; + + if( !pInst ){ + aInst.pClass = this; + aInst.pData = (CLASS_DATA) + RscMem::Malloc( sizeof( RscStringInst ) ); + } + else + aInst = *pInst; + if( !bOwnClass && rDflt.IsInst() ) + bOwnClass = rDflt.pClass->InHierarchy( this ); + + ((RscStringInst *)aInst.pData)->aRefId.Create(); + ((RscStringInst *)aInst.pData)->pStr = NULL; + ((RscStringInst *)aInst.pData)->bDflt = TRUE; + + if( bOwnClass ){ + ((RscStringInst *)aInst.pData)->aRefId = + ((RscStringInst *)rDflt.pData)->aRefId; + SetString( aInst, ((RscStringInst *)rDflt.pData)->pStr ); + ((RscStringInst *)aInst.pData)->bDflt = + ((RscStringInst *)rDflt.pData)->bDflt ; + } + + return( aInst ); +} + +/************************************************************************* +|* +|* RscString::Destroy() +|* +|* Beschreibung +|* Ersterstellung MM 15.05.91 +|* Letzte Aenderung MM 15.05.91 +|* +*************************************************************************/ +void RscString::Destroy( const RSCINST & rInst ){ + if( ((RscStringInst *)rInst.pData)->pStr ) + RscMem::Free( ((RscStringInst *)rInst.pData)->pStr ); + ((RscStringInst *)rInst.pData)->aRefId.Destroy(); +} + +/************************************************************************* +|* +|* RscString::IsValueDefault() +|* +|* Beschreibung +|* Ersterstellung MM 15.01.92 +|* Letzte Aenderung MM 15.01.92 +|* +*************************************************************************/ +BOOL RscString::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ){ + RscStringInst * pData = (RscStringInst*)rInst.pData; + RscStringInst * pDefData = (RscStringInst*)pDef; + + if( pDef ){ + if( pData->aRefId.IsId() || pDefData->aRefId.IsId() ) + { + if( pData->aRefId.aExp.IsNumber() + && pDefData->aRefId.aExp.IsNumber() ) + { + // Sind die Referenzidentifier gleich + if( pData->aRefId.GetNumber() == pDefData->aRefId.GetNumber() ) + { + return TRUE; + } + } + } + else { + BOOL bStrEmpty = FALSE; + BOOL bDefStrEmpty = FALSE; + + if( pData->pStr ){ + bStrEmpty = ('\0' == *pData->pStr); + } + else + bStrEmpty = TRUE; + + if( pDefData->pStr ){ + bDefStrEmpty = ('\0' == *pDefData->pStr); + } + else + bDefStrEmpty = TRUE; + + if( !bStrEmpty || !bDefStrEmpty ){ + return FALSE; + } + else if( !(bStrEmpty || bDefStrEmpty) ){ + if( strcmp( pData->pStr, pDefData->pStr ) ) + return FALSE; + } + return TRUE; + } + } + + return FALSE; +} + +/************************************************************************* +|* +|* RscString::WriteSrc() +|* +|* Beschreibung +|* Ersterstellung MM 25.04.91 +|* Letzte Aenderung MM 25.04.91 +|* +*************************************************************************/ +void RscString::WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont *, USHORT, const char * ) +{ + if ( ((RscStringInst *)rInst.pData)->aRefId.IsId() ) + { + fprintf( fOutput, "%s", + ((RscStringInst *)rInst.pData)->aRefId.GetName().GetBuffer() ); + } + else + { + RscStringInst * pStrI = ((RscStringInst *)rInst.pData); + if( pStrI->pStr ){ + //char * pChangeTab = RscChar::GetChangeTab(); + USHORT n = 0; + USHORT nPos, nSlashPos; + + do { + fputc( '\"', fOutput ); + nSlashPos = nPos = 0; + while( pStrI->pStr[ n ] + && (nPos < 72 || nPos - nSlashPos <= 3) ) + { // nach \ mindesten 3 Zeichen wegeb \xa7 + fputc( pStrI->pStr[ n ], fOutput ); + if( pStrI->pStr[ n ] == '\\' ) + nSlashPos = nPos; + n++; + nPos++; + } + + fputc( '\"', fOutput ); + if( pStrI->pStr[ n ] ) //nocht nicht zu ende + fputc( '\n', fOutput ); + } while( pStrI->pStr[ n ] ); + } + else + fprintf( fOutput, "\"\"" ); + /* + if( pStrI->pStr ) + { + UINT16 nStrLen = strlen( pStrI->pStr ); + sal_Unicode * pUniCode = new sal_Unicode[ nStrLen +1 ]; + rtl_TextToUnicodeConverter hConv = rtl_createTextToUnicodeConverter( RTL_TEXTENCODING_UTF8 ); + + sal_uInt32 nInfo; + sal_Size nSrcCvtBytes; + sal_Size nSize = rtl_convertTextToUnicode( hConv, 0, + pStrI->pStr, nStrLen, + pUniCode, nStrLen, + RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_DEFAULT + | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT + | RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT + | RTL_TEXTTOUNICODE_FLAGS_FLUSH, + &nInfo, + &nSrcCvtBytes ); + fputc( 'L', fOutput ); + fputc( '\"', fOutput ); + for( sal_Size i = 0; i < nSize; i++ ) + { + if( pUniCode[i] >= 32 && pUniCode[i] < 128 ) + { + if( pUniCode[i] == '\\' ) + { + fputc( (char)pUniCode[i], fOutput ); + fputc( (char)pUniCode[i], fOutput ); + } + else if( pUniCode[i] == '\"' ) + { + fputc( '\\', fOutput ); + fputc( '"', fOutput ); + } + else + fputc( (char)pUniCode[i], fOutput ); + } + else + fprintf( fOutput, "\\x%4.4lX", (long)pUniCode[i] ); + if( !((i +1) % 40) && i +1 != nSize ) + fprintf( fOutput, "\"\n\t\t\tL\"" ); + } + fputc( '\"', fOutput ); + + rtl_destroyTextToUnicodeConverter( hConv ); + delete pUniCode; + } + else + fprintf( fOutput, "\"\"" ); + */ + }; +} + +/************************************************************************* +|* +|* RscString::WriteRc() +|* +|* Beschreibung +|* Ersterstellung MM 15.04.91 +|* Letzte Aenderung MM 15.04.91 +|* +*************************************************************************/ +ERRTYPE RscString::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, + RscTypCont * pTC, USHORT nDeep, BOOL bExtra ) +{ + ERRTYPE aError; + ObjNode * pObjNode = NULL; + + + if( ((RscStringInst *)rInst.pData)->aRefId.IsId() ){ + RscId aId( ((RscStringInst *)rInst.pData)->aRefId ); + RSCINST aTmpI; + + aTmpI.pClass = pRefClass; + + while( aError.IsOk() && aId.IsId() ){ + //Erhoehen und abfragen um Endlosrekusion zu vermeiden + nDeep++; + if( nDeep > nRefDeep ) + aError = ERR_REFTODEEP; + else + { + pObjNode = pRefClass->GetObjNode( aId ); + if( pObjNode ) + { + aTmpI.pData = pObjNode->GetRscObj(); + aError = pRefClass->GetRef( aTmpI, &aId ); + } + else + { + if( pTC ) + { + ByteString aMsg( pHS->Get( pRefClass->GetId() ) ); + aMsg += ' '; + aMsg += aId.GetName(); + aError = WRN_STR_REFNOTFOUND; + pTC->pEH->Error( aError, rInst.pClass, + RscId(), aMsg.GetBuffer() ); + } + break; + } + } + } + } + + if( aError.IsOk() ) + { + if( pObjNode ) + { + RSCINST aRefI; + + aRefI = RSCINST( pRefClass, pObjNode->GetRscObj() ); + aError = aRefI.pClass->WriteRc( aRefI, rMem, pTC, nDeep, bExtra ); + } + else + { + if( ((RscStringInst *)rInst.pData)->pStr ) + { + char * pStr = RscChar::MakeUTF8( ((RscStringInst *)rInst.pData)->pStr, + pTC->GetSourceCharSet() ); + rMem.PutUTF8( pStr ); + RscMem::Free( pStr ); + } + else + rMem.PutUTF8( ((RscStringInst *)rInst.pData)->pStr ); + //rMem.PutUTF8( ((RscStringInst *)rInst.pData)->pStr ); + }; + }; + return( aError ); +} + +//================================================================== +void RscString::WriteRcAccess +( + FILE * fOutput, + RscTypCont * pTC, + const char * pName +) +{ + fprintf( fOutput, "\t\tString aStr( (const char*)(pResData+nOffset) );\n" ); + fprintf( fOutput, "\t\tSet%s( aStr );\n", pName ); + fprintf( fOutput, "\t\tnOffset += GetStringSizeRes( aStr );\n" ); +} + diff --git a/rsc/source/res/rsctop.cxx b/rsc/source/res/rsctop.cxx new file mode 100644 index 000000000000..eac8604ca30e --- /dev/null +++ b/rsc/source/res/rsctop.cxx @@ -0,0 +1,1035 @@ +/************************************************************************* + * + * $RCSfile: rsctop.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $ + * + * 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/res/rsctop.cxx,v 1.1.1.1 2000-09-18 16:42:56 hr Exp $ + +*************************************************************************/ +/****************** I N C L U D E S **************************************/ + +// C and C++ Includes. +#include <stdio.h> +#include <string.h> + +// Solar Definitionen +#include <tools/solar.h> + +#ifndef _RSCTOP_HXX +#include <rsctop.hxx> +#endif +/****************** C O D E **********************************************/ +/****************** R s c T o p ******************************************/ +/************************************************************************* +|* +|* RscTop::RscTop() +|* +|* Beschreibung +|* Ersterstellung MM 03.06.91 +|* Letzte Aenderung MM 03.06.91 +|* +*************************************************************************/ +RscTop::RscTop( HASHID nId, USHORT nTypIdent, RscTop * pSuperCl ) + : RefNode( nId ) + , nTypId( nTypIdent ) + , pSuperClass( pSuperCl ) +{ + pRefClass = this; + if( pSuperClass ) + SetCallPar( pSuperClass->aCallPar1, pSuperClass->aCallPar2, + pSuperClass->aCallParType ); +} + +/************************************************************************* +|* +|* RscTop::SetCallPar() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +void RscTop::SetCallPar( const ByteString & rPar1, const ByteString & rPar2, + const ByteString & rParType ) +{ + aCallPar1 = rPar1; + aCallPar2 = rPar2; + aCallParType = rParType; +} + +/************************************************************************* +|* +|* RscTop::GetDefault() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +RSCINST RscTop::GetDefault() +{ + if( !aDfltInst.IsInst() ) + aDfltInst = this->Create( NULL, RSCINST() ); + return aDfltInst; +} + +/************************************************************************* +|* +|* RscTop::Pre_dtor() +|* +|* Beschreibung +|* Ersterstellung MM 19.06.91 +|* Letzte Aenderung MM 19.06.91 +|* +*************************************************************************/ +void RscTop :: Pre_dtor(){ + if( aDfltInst.IsInst() ){ + aDfltInst.pClass->Destroy( aDfltInst ); + RscMem::Free( aDfltInst.pData ); + aDfltInst = RSCINST(); + }; +} + +/************************************************************************* +|* +|* RscTop::GetConstant() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +HASHID RscTop :: GetConstant( USHORT ){ + return HASH_NONAME; +} + +/************************************************************************* +|* +|* RscTop::GetIndexType() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +RscTop * RscTop::GetTypeClass() const +{ + if( pSuperClass ) + return pSuperClass->GetTypeClass(); + else + return NULL; +} + +/************************************************************************* +|* +|* RscTop::Size() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +USHORT RscTop :: Size() +{ + if( pSuperClass ) + return pSuperClass->Size(); + else + return 0; +} + +/************************************************************************* +|* +|* RscTop::GetRef() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +ERRTYPE RscTop :: GetRef( const RSCINST & rInst, RscId * pRscId ){ + if( pSuperClass ) + return pSuperClass->GetRef( rInst, pRscId ); + else + return ERR_UNKNOWN_METHOD; +} + +/************************************************************************* +|* +|* RscTop::InHierarchy() +|* +|* Beschreibung +|* Ersterstellung MM 17.05.91 +|* Letzte Aenderung MM 17.05.91 +|* +*************************************************************************/ +BOOL RscTop::InHierarchy( RscTop * pClass ){ + if( this == pClass ) + return( TRUE ); + if( pSuperClass ) + return( pSuperClass->InHierarchy( pClass ) ); + return( FALSE ); +} + +/************************************************************************* +|* +|* RscTop::SetVariable() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +ERRTYPE RscTop::SetVariable( HASHID nVarName, RscTop * pClass, + RSCINST * pDflt, RSCVAR nVarType, USHORT nMask, + HASHID nDataBaseName ) +{ + if( pSuperClass ) + return pSuperClass-> + SetVariable( nVarName, pClass, pDflt, + nVarType, nMask, nDataBaseName ); + else + return ERR_UNKNOWN_METHOD; +} + +/************************************************************************* +|* +|* RscTop::EnumVariable() +|* +|* Beschreibung +|* Ersterstellung MM 03.02.93 +|* Letzte Aenderung MM 03.02.93 +|* +*************************************************************************/ +void RscTop::EnumVariables( void * pData, VarEnumCallbackProc pProc ) +{ + if( pSuperClass ) + pSuperClass->EnumVariables( pData, pProc ); +} + +/************************************************************************* +|* +|* RscTop::GetVariable() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +RSCINST RscTop::GetVariable +( + const RSCINST & rInst, + HASHID nVarName, + const RSCINST & rInitInst, + BOOL bInitDflt, + RscTop * pCreateClass +) +{ + if( pSuperClass ) + return pSuperClass-> + GetVariable( rInst, nVarName, rInitInst, bInitDflt, pCreateClass ); + else + return RSCINST(); +} + +/************************************************************************* +|* +|* RscTop::GetCopyVar() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +RSCINST RscTop::GetCopyVar( const RSCINST & rInst, HASHID nVarName ) +{ + if( pSuperClass ) + return pSuperClass-> + GetCopyVar( rInst, nVarName ); + else + return RSCINST(); +} + +/************************************************************************* +|* +|* RscTop::GetTupelVar() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +RSCINST RscTop::GetTupelVar( const RSCINST & rInst, USHORT nPos, + const RSCINST & rInitInst ) +{ + if( pSuperClass ) + return pSuperClass->GetTupelVar( rInst, nPos, rInitInst ); + else + return RSCINST(); +} + +/************************************************************************* +|* +|* RscTop::GetElement() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +ERRTYPE RscTop::GetElement( const RSCINST & rInst, const RscId & rEleName, + RscTop *pCreateClass, const RSCINST & rCreateInst, + RSCINST * pGetInst ) +{ + if( pSuperClass ) + return pSuperClass-> + GetElement( rInst, rEleName, + pCreateClass, rCreateInst, + pGetInst ); + else + return ERR_UNKNOWN_METHOD; +} + +/************************************************************************* +|* +|* RscTop::GetArrayEle() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +ERRTYPE RscTop::GetArrayEle +( + const RSCINST & rInst, + HASHID nId, + RscTop * pCreateClass, + RSCINST * pGetInst +) +{ + if( pSuperClass ) + return pSuperClass->GetArrayEle( rInst, nId, pCreateClass, pGetInst ); + else + return ERR_UNKNOWN_METHOD; +} + +/************************************************************************* +|* +|* RscTop::GetValueEle() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +ERRTYPE RscTop::GetValueEle +( + const RSCINST & rInst, + long lValue, + RscTop * pCreateClass, + RSCINST * pGetInst +) +{ + if( pSuperClass ) + return pSuperClass->GetValueEle( rInst, lValue, pCreateClass, pGetInst ); + else + return ERR_UNKNOWN_METHOD; +} + +/************************************************************************* +|* +|* RscTop::SearchEle() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +RSCINST RscTop::SearchEle( const RSCINST & rInst, const RscId & rEleName, + RscTop * pClass ) +{ + if( pSuperClass ) + return pSuperClass-> + SearchEle( rInst, rEleName, pClass ); + else + return RSCINST(); +} + +/************************************************************************* +|* +|* RscTop::GetPosEle() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +RSCINST RscTop::GetPosEle( const RSCINST & rInst, USHORT nPos ){ + if( pSuperClass ) + return pSuperClass-> + GetPosEle( rInst, nPos ); + else + return RSCINST(); +} + +/************************************************************************* +|* +|* RscTop::MovePosEle() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +ERRTYPE RscTop::MovePosEle( const RSCINST & rInst, USHORT nDestPos, + USHORT nSourcePos ) +{ + if( pSuperClass ) + return pSuperClass-> + MovePosEle( rInst, nDestPos, nSourcePos ); + else + return ERR_UNKNOWN_METHOD; +} + +/************************************************************************* +|* +|* RscTop::SetPosRscId() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +ERRTYPE RscTop::SetPosRscId( const RSCINST & rInst, USHORT nPos, + const RscId & rRscId ) +{ + if( pSuperClass ) + return pSuperClass-> + SetPosRscId( rInst, nPos, rRscId ); + else + return ERR_UNKNOWN_METHOD; +} + +/************************************************************************* +|* +|* RscTop::GetInfoEle() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +SUBINFO_STRUCT RscTop::GetInfoEle( const RSCINST & rInst, USHORT nPos ){ + if( pSuperClass ) + return pSuperClass-> + GetInfoEle( rInst, nPos ); + else + return SUBINFO_STRUCT(); +} + +/************************************************************************* +|* +|* RscTop::GetCount() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +USHORT RscTop::GetCount( const RSCINST & rInst ){ + if( pSuperClass ) + return pSuperClass->GetCount( rInst ); + else + return 0; +} + +/************************************************************************* +|* +|* RscTop::SetNumber() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +ERRTYPE RscTop::SetNumber( const RSCINST & rInst, long lValue ){ + if( pSuperClass ) + return pSuperClass-> + SetNumber( rInst, lValue ); + else + return ERR_UNKNOWN_METHOD; +} + +/************************************************************************* +|* +|* RscTop::SetBool() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +ERRTYPE RscTop::SetBool( const RSCINST & rInst, BOOL bValue ){ + if( pSuperClass ) + return pSuperClass-> + SetBool( rInst, bValue ); + else + return ERR_UNKNOWN_METHOD; +} + +/************************************************************************* +|* +|* RscTop::SetConst() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +ERRTYPE RscTop::SetConst( const RSCINST & rInst, HASHID nId, long nVal ) +{ + if( pSuperClass ) + return pSuperClass->SetConst( rInst, nId, nVal ); + else + return ERR_UNKNOWN_METHOD; +} + +/************************************************************************* +|* +|* RscTop::SetNotConst() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +ERRTYPE RscTop::SetNotConst( const RSCINST & rInst, HASHID nId ){ + if( pSuperClass ) + return pSuperClass-> + SetNotConst( rInst, nId ); + else + return ERR_UNKNOWN_METHOD; +} + +/************************************************************************* +|* +|* RscTop::SetString() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +ERRTYPE RscTop::SetString( const RSCINST & rInst, char * pStr ){ + if( pSuperClass ) + return pSuperClass-> + SetString( rInst, pStr ); + else + return ERR_UNKNOWN_METHOD; +} + +/************************************************************************* +|* +|* RscTop::GetNumber() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +ERRTYPE RscTop::GetNumber( const RSCINST & rInst, long * pN ){ + if( pSuperClass ) + return pSuperClass-> + GetNumber( rInst, pN ); + else + return ERR_UNKNOWN_METHOD; +} + +/************************************************************************* +|* +|* RscTop::GetBool() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +ERRTYPE RscTop::GetBool( const RSCINST & rInst, BOOL * pB ){ + if( pSuperClass ) + return pSuperClass-> + GetBool( rInst, pB ); + else + return ERR_UNKNOWN_METHOD; +} + +/************************************************************************* +|* +|* RscTop::GetCont() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +ERRTYPE RscTop::GetConst( const RSCINST & rInst, HASHID * pH ){ + if( pSuperClass ) + return pSuperClass-> + GetConst( rInst, pH ); + else + return ERR_UNKNOWN_METHOD; +} + +/************************************************************************* +|* +|* RscTop::GetString() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +ERRTYPE RscTop::GetString( const RSCINST & rInst, char ** ppStr ){ + if( pSuperClass ) + return pSuperClass-> + GetString( rInst, ppStr ); + else + return ERR_UNKNOWN_METHOD; +} + +/************************************************************************* +|* +|* RscTop::Create() +|* +|* Beschreibung +|* Ersterstellung MM 17.05.91 +|* Letzte Aenderung MM 17.07.91 +|* +*************************************************************************/ +RSCINST RscTop::Create( RSCINST * pInst, const RSCINST & rDefInst, BOOL bOwnRange ) +{ + if( pSuperClass ) + return pSuperClass-> + Create( pInst, rDefInst, bOwnRange ); + else{ + if( pInst ) + return *pInst; + return RSCINST(); + } +} + +/************************************************************************* +|* +|* RscTop::Destroy() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +void RscTop::Destroy( const RSCINST & rInst ){ + if( pSuperClass ) + pSuperClass->Destroy( rInst ); +} + +/************************************************************************* +|* +|* RscTop::IsConsistent() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +BOOL RscTop::IsConsistent( const RSCINST & rInst, + RscInconsList * pList ) +{ + if( pSuperClass ) + return pSuperClass->IsConsistent( rInst, pList ); + else + return TRUE; +} + +/************************************************************************* +|* +|* RscTop::SetToDefault() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +void RscTop::SetToDefault( const RSCINST & rInst ) +{ + if( pSuperClass ) + pSuperClass->SetToDefault( rInst ); +} + +/************************************************************************* +|* +|* RscTop::IsDefault() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +BOOL RscTop::IsDefault( const RSCINST & rInst ){ + if( pSuperClass ) + return pSuperClass->IsDefault( rInst ); + else + return TRUE; +} + +/************************************************************************* +|* +|* RscTop::IsValueDefault() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +BOOL RscTop::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ){ + if( pSuperClass ) + return pSuperClass->IsValueDefault( rInst, pDef ); + else + return TRUE; +} + +/************************************************************************* +|* +|* RscTop::SetDefault() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +void RscTop::SetDefault( const RSCINST & rInst, HASHID nVarId ){ + if( pSuperClass ) + pSuperClass->SetDefault( rInst, nVarId ); +} + +/************************************************************************* +|* +|* RscTop::GetDefault() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +RSCINST RscTop::GetDefault( HASHID nVarId ){ + if( pSuperClass ) + return pSuperClass-> + GetDefault( nVarId ); + else + return RSCINST(); +} + +/************************************************************************* +|* +|* RscTop::Delete() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +void RscTop::Delete( const RSCINST & rInst, RscTop * pClass, + const RscId & rId ) +{ + if( pSuperClass ) + pSuperClass->Delete( rInst, pClass, rId ); +} + +/************************************************************************* +|* +|* RscTop::DeletePos() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +void RscTop::DeletePos( const RSCINST & rInst, USHORT nPos ) +{ + if( pSuperClass ) + pSuperClass->DeletePos( rInst, nPos ); +} + +/************************************************************************* +|* +|* RscTop::SetRef() +|* +|* Beschreibung +|* Ersterstellung MM 18.09.91 +|* Letzte Aenderung MM 18.09.91 +|* +*************************************************************************/ +ERRTYPE RscTop::SetRef( const RSCINST & rInst, const RscId & rRefId ){ + if( pSuperClass ) + return pSuperClass->SetRef( rInst, rRefId ); + else + return ERR_UNKNOWN_METHOD; +} + +/************************************************************************* +|* +|* RscTop::WriteHxxHeader() +|* +|* Beschreibung +|* Ersterstellung MM 29.05.91 +|* Letzte Aenderung MM 29.05.91 +|* +*************************************************************************/ +ERRTYPE RscTop::WriteHxxHeader( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId & rId ) +{ + if( pSuperClass ) + return pSuperClass->WriteHxxHeader( rInst, fOutput, pTC, rId ); + else + return rInst.pClass->WriteHxx( rInst, fOutput, pTC, rId ); +} + +/************************************************************************* +|* +|* RscTop::WriteHxx() +|* +|* Beschreibung +|* Ersterstellung MM 29.05.91 +|* Letzte Aenderung MM 29.05.91 +|* +*************************************************************************/ +ERRTYPE RscTop::WriteHxx( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId & rId ){ + if( pSuperClass ) + return pSuperClass->WriteHxx( rInst, fOutput, pTC, rId ); + else + return( ERR_OK ); +} + +/************************************************************************* +|* +|* RscTop::WriteCxxHeader() +|* +|* Beschreibung +|* Ersterstellung MM 29.05.91 +|* Letzte Aenderung MM 29.05.91 +|* +*************************************************************************/ +ERRTYPE RscTop::WriteCxxHeader( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId & rId ) +{ + if( pSuperClass ) + return pSuperClass->WriteCxxHeader( rInst, fOutput, pTC, rId ); + else + return rInst.pClass->WriteCxx( rInst, fOutput, pTC, rId ); +} + +/************************************************************************* +|* +|* RscTop::WriteCxx() +|* +|* Beschreibung +|* Ersterstellung MM 29.05.91 +|* Letzte Aenderung MM 29.05.91 +|* +*************************************************************************/ +ERRTYPE RscTop::WriteCxx( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, const RscId & rId ){ + if( pSuperClass ) + return pSuperClass->WriteCxx( rInst, fOutput, pTC, rId ); + else + return ERR_OK; +} + +/************************************************************************* +|* +|* RscTop::WriteSrcHeader() +|* +|* Beschreibung +|* Ersterstellung MM 08.04.91 +|* Letzte Aenderung MM 08.04.91 +|* +*************************************************************************/ +void RscTop::WriteSrcHeader( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, + const RscId & rId, const char * pVarName ) +{ + if( pSuperClass ) + pSuperClass->WriteSrcHeader( rInst, fOutput, pTC, nTab, rId, pVarName ); + else + rInst.pClass->WriteSrc( rInst, fOutput, pTC, nTab, pVarName ); +} + +/************************************************************************* +|* +|* RscTop::WriteSrc() +|* +|* Beschreibung +|* Ersterstellung MM 08.04.91 +|* Letzte Aenderung MM 08.04.91 +|* +*************************************************************************/ +void RscTop::WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, USHORT nTab, const char * pVarName ) +{ + if( pSuperClass ) + pSuperClass->WriteSrc( rInst, fOutput, pTC, nTab, pVarName ); +} + +/************************************************************************* +|* +|* RscTop::WriteRcHeader() +|* +|* Beschreibung +|* Ersterstellung MM 12.04.91 +|* Letzte Aenderung MM 12.04.91 +|* +*************************************************************************/ +ERRTYPE RscTop::WriteRcHeader( const RSCINST & rInst, RscWriteRc & rMem, + RscTypCont * pTC, const RscId & rId, + USHORT nDeep, BOOL bExtra ) +{ + if( pSuperClass ) + return( pSuperClass-> + WriteRcHeader( rInst, rMem, pTC, rId, nDeep, bExtra ) ); + else + return( rInst.pClass->WriteRc( rInst, rMem, pTC, nDeep, bExtra ) ); +} + +/************************************************************************* +|* +|* RscTop::WriteRc() +|* +|* Beschreibung +|* Ersterstellung MM 08.04.91 +|* Letzte Aenderung MM 08.04.91 +|* +*************************************************************************/ +ERRTYPE RscTop::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, + RscTypCont * pTC, USHORT nDeep, BOOL bExtra ) +{ + if( pSuperClass ) + return( pSuperClass-> + WriteRc( rInst, rMem, pTC, nDeep, bExtra ) ); + else + return( ERR_OK ); +} + +/************************************************************************* +|* +|* RscTop::WriteSyntaxHeader() +|* +|* Beschreibung +|* Ersterstellung MM 29.05.91 +|* Letzte Aenderung MM 29.05.91 +|* +*************************************************************************/ +void RscTop::WriteSyntaxHeader( FILE * fOutput, RscTypCont * pTC ) +{ + if( GetId() != HASH_NONAME ) + { + fprintf( fOutput, "class %s \n{\n", pHS->Get( GetId() ) ); + WriteSyntax( fOutput, pTC ); + fprintf( fOutput, "};\n\n" ); + } +} + +/************************************************************************* +|* +|* RscTop::WriteSyntax() +|* +|* Beschreibung +|* Ersterstellung MM 29.05.91 +|* Letzte Aenderung MM 29.05.91 +|* +*************************************************************************/ +void RscTop::WriteSyntax( FILE * fOutput, RscTypCont * pTC ) +{ + if( pSuperClass ) + pSuperClass->WriteSyntax( fOutput, pTC ); +} + +//======================================================================== +void RscTop::WriteRcAccess +( + FILE * fOutput, + RscTypCont * pTC, + const char * pName +) +{ + if( GetId() != HASH_NONAME ) + { + fprintf( fOutput, "\t\t//%s %s\n", + pHS->Get( GetId() ), pName ); + } +} + +//======================================================================== +void RscTop::WriteRcCtor( FILE * fOutput, RscTypCont * pTC ) +{ + if( pSuperClass ) + pSuperClass->WriteRcCtor( fOutput, pTC ); +} + + diff --git a/rsc/source/rsc/makefile.mk b/rsc/source/rsc/makefile.mk new file mode 100644 index 000000000000..95ae993e0b83 --- /dev/null +++ b/rsc/source/rsc/makefile.mk @@ -0,0 +1,80 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $ +# +# 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=rscrsc + +# --- Settings ------------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +OBJFILES= $(OBJ)$/rsc.obj \ + $(OBJ)$/rscinst.obj + +CXXFILES= rsc.cxx \ + rscinst.cxx + +.INCLUDE : target.mk diff --git a/rsc/source/rsc/rsc.cxx b/rsc/source/rsc/rsc.cxx new file mode 100644 index 000000000000..257a7094ccfc --- /dev/null +++ b/rsc/source/rsc/rsc.cxx @@ -0,0 +1,999 @@ +/************************************************************************* + * + * $RCSfile: rsc.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $ + * + * 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/rsc/rsc.cxx,v 1.1.1.1 2000-09-18 16:42:56 hr Exp $ + +**************************************************************************/ +/****************************************************************/ +/* Include File */ +/****************************************************************/ +#ifdef MAC +#include "mac_start.h" +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <fcntl.h> +#ifdef UNX +#include <unistd.h> +#include <sys/wait.h> +#else +#ifndef MAC +#include <io.h> +#include <process.h> +#include <direct.h> +#endif +#endif +#include <string.h> +#include <ctype.h> +#include <errno.h> + +#ifdef MAC +#ifdef MAC_UNIVERSAL +#ifndef _UNISTD + #include <unistd.h> +#endif +#endif +#include "mac_end.h" +#endif + +#if defined( PM2 ) && defined( ZTC ) +#include <svpm.h> +#ifndef unlink +#define unlink( p ) DosDelete( (PSZ)(const char*)p ) +#endif +#endif + +#include <tools/fsys.hxx> + +#ifndef _RSCERROR_H +#include <rscerror.h> +#endif +#ifndef _RSCTOP_HXX +#include <rsctop.hxx> +#endif +#ifndef _RSCDB_HXX +#include <rscdb.hxx> +#endif +#ifndef _RSCPAR_HXX +#include <rscpar.hxx> +#endif +#ifndef _RSCRSC_HXX +#include <rscrsc.hxx> +#endif + +#include <rtl/tencinfo.h> +#include <rtl/textenc.h> +/*************** F o r w a r d s *****************************************/ +/*************** G l o b a l e V a r i a b l e n **********************/ +HashString* pHS = NULL; +ByteString* pStdParType = NULL; +ByteString* pStdPar1 = NULL; +ByteString* pStdPar2 = NULL; +ByteString* pWinParType = NULL; +ByteString* pWinPar1 = NULL; +ByteString* pWinPar2 = NULL; +USHORT nRefDeep = 10; + +/*************** R s c C m d L i n e ************************************/ +/************************************************************************* +|* +|* RscCmdLine::Init() +|* +|* Beschreibung Kommandozeile interpretierten +|* Ersterstellung MM 03.05.91 +|* Letzte Aenderung MM 03.05.91 +|* +*************************************************************************/ +void RscCmdLine::Init() +{ + nSourceCharSet = RTL_TEXTENCODING_MS_1252; + nCommands = 0; + nLangTypeId = LANGUAGE_DONTKNOW; + nByteOrder = RSC_BIGENDIAN; + + DirEntry aEntry; + aPath = ByteString( aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US ); //Immer im Aktuellen Pfad suchen +} + +/************************************************************************* +|* +|* RscCmdLine::RscCmdLine() +|* +|* Beschreibung Kommandozeile interpretierten +|* Ersterstellung MM 13.02.91 +|* Letzte Aenderung MM 13.02.91 +|* +*************************************************************************/ +RscCmdLine::RscCmdLine() +{ + Init(); +} + +/************************************************************************* +|* +|* RscCmdLine::RscCmdLine() +|* +|* Beschreibung Kommandozeile interpretierten +|* Ersterstellung MM 13.02.91 +|* Letzte Aenderung MM 13.02.91 +|* +*************************************************************************/ +RscCmdLine::RscCmdLine( short argc, char ** argv, RscError * pEH ) +{ + char * pStr; + char ** ppStr; + RscPtrPtr aCmdLine; // Kommandozeile + ByteString aString; + USHORT i; + BOOL bOutputSrsIsSet = FALSE; + + Init(); // Defaults setzen + + pStr = ::ResponseFile( &aCmdLine, argv, argc ); + if( pStr ) + pEH->FatalError( ERR_OPENFILE, RscId(), pStr ); + + /* check the inputted switches */ + ppStr = (char **)aCmdLine.GetBlock(); + ppStr++; + i = 1; + while( ppStr && i < (USHORT)(aCmdLine.GetCount() -1) ) + { + if( '-' == **ppStr ) + { + if( !rsc_stricmp( (*ppStr) + 1, "h" ) + || !strcmp( (*ppStr) + 1, "?" ) ) + { // Hilfe + nCommands |= HELP_FLAG; + } + else if( !rsc_stricmp( (*ppStr) + 1, "syntax" ) ) + { // Hilfe + nCommands |= PRINTSYNTAX_FLAG; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "RefDeep", 7 ) ) + { // maximale Aufloesungtiefe fuer Referenzen + nRefDeep = (short)(ByteString( (*ppStr) +1 + strlen( "RefDeep" ) ).ToInt32()); + } + else if( !rsc_stricmp( (*ppStr) + 1, "p" ) ) + { // kein Preprozessor + nCommands |= NOPREPRO_FLAG; + } + else if( !rsc_stricmp( (*ppStr) + 1, "s" ) ) + { // nicht linken + nCommands |= NOLINK_FLAG; + } + else if( !rsc_stricmp( (*ppStr) + 1, "l" ) ) + { // Linken, keine Syntax und kein Prepro + nCommands |= NOPREPRO_FLAG; + nCommands |= NOSYNTAX_FLAG; + } + else if( !rsc_stricmp( (*ppStr) + 1, "r" ) ) + { // erzeugt kein .res-file + nCommands |= NORESFILE_FLAG; + } + else if( !rsc_stricmp( (*ppStr) + 1, "PreLoad" ) ) + { // Alle Ressourcen mit Preload + nCommands |= PRELOAD_FLAG; + } + else if( !rsc_stricmp( (*ppStr) + 1, "LITTLEENDIAN" ) ) + { // Byte Ordnung beim Schreiben + nByteOrder = RSC_LITTLEENDIAN; + } + else if( !rsc_stricmp( (*ppStr) + 1, "BIGENDIAN" ) ) + { // Byte Ordnung beim Schreiben + nByteOrder = RSC_BIGENDIAN; + } + else if( !rsc_stricmp( (*ppStr) + 1, "SMART" ) ) + { // Byte Ordnung beim Schreiben + nCommands |= SMART_FLAG; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "d", 1 ) ) + { // Symbole definieren + nCommands |= DEFINE_FLAG; + aSymbolList.Insert( new ByteString( (*ppStr) + 2 ), 0xFFFF ); + } + else if( !rsc_strnicmp( (*ppStr) + 1, "i", 1 ) ) + { // Include-Pfade definieren + nCommands |= INCLUDE_FLAG; + if( aPath.Len() ) + aPath += ByteString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US ); + aPath += (*ppStr) + 2; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "fs", 2 ) ) + { // anderer Name fuer .rc-file + aOutputRc = (*ppStr) + 3; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "fp", 2 ) ) + { // anderer Name fuer .srs-file + aOutputSrs = (*ppStr) + 3; + bOutputSrsIsSet = TRUE; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "fl", 2 ) ) + { // Name fuer listing-file + aOutputLst = (*ppStr) + 3; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "fh", 2 ) ) + { // Name fuer .hxx-file + aOutputHxx = (*ppStr) + 3; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "fc", 2 ) ) + { // Name fuer .cxx-file + aOutputCxx = (*ppStr) + 3; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "fr", 2 ) ) + { // Name fuer .cxx-file der Ressource Konstruktoren + aOutputRcCtor = (*ppStr) + 3; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "fx", 2 ) ) + { // Name fuer .src-file + aOutputSrc = (*ppStr) + 3; + } + else if( !rsc_stricmp( (*ppStr) + 1, "NoSysResTest" ) ) + { // Bitmap, Pointers, Icons nicht ueberpruefen + nCommands |= NOSYSRESTEST_FLAG; + } + else if( !rsc_stricmp( (*ppStr) + 1, "SrsDefault" ) ) + { // Bitmap, Pointers, Icons nicht ueberpruefen + nCommands |= SRSDEFAULT_FLAG; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "CHARSET_", 8 ) ) + { + if( !rsc_stricmp( (*ppStr) + 9, "ANSI" ) ) + nSourceCharSet = RTL_TEXTENCODING_MS_1252; + else if( !rsc_stricmp( (*ppStr) + 9, "MAC" ) ) + nSourceCharSet = RTL_TEXTENCODING_APPLE_ROMAN; + else if( !rsc_stricmp( (*ppStr) + 9, "IBMPC_437" ) ) + nSourceCharSet = RTL_TEXTENCODING_IBM_437; + else if( !rsc_stricmp( (*ppStr) + 9, "IBMPC_850" ) ) + nSourceCharSet = RTL_TEXTENCODING_IBM_850; + else if( !rsc_stricmp( (*ppStr) + 9, "IBMPC_860" ) ) + nSourceCharSet = RTL_TEXTENCODING_IBM_860; + else if( !rsc_stricmp( (*ppStr) + 9, "IBMPC_861" ) ) + nSourceCharSet = RTL_TEXTENCODING_IBM_861; + else if( !rsc_stricmp( (*ppStr) + 9, "IBMPC_863" ) ) + nSourceCharSet = RTL_TEXTENCODING_IBM_863; + else if( !rsc_stricmp( (*ppStr) + 9, "IBMPC_865" ) ) + nSourceCharSet = RTL_TEXTENCODING_IBM_865; + else if( !rsc_stricmp( (*ppStr) + 9, "IBMPC" ) ) + nSourceCharSet = RTL_TEXTENCODING_IBM_850; + else if( !rsc_stricmp( (*ppStr) + 9, "DONTKNOW" ) ) + nSourceCharSet = RTL_TEXTENCODING_DONTKNOW; + else + { + nSourceCharSet = rtl_getTextEncodingFromUnixCharset( (*ppStr) + 9 ); + if( nSourceCharSet == 0 ) + { + nSourceCharSet = RTL_TEXTENCODING_MS_1252; + pEH->FatalError( ERR_UNKNOWNSW, RscId(), *ppStr ); + break; + } + } + } + else if( !rsc_stricmp( (*ppStr) + 1, "lg" ) ) + { + nLangTypeId = LANGUAGE_DONTKNOW; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "lg", 2 ) ) + { + nLangTypeId = LANGUAGE_DONTKNOW; +#define LT(Name) \ + if( !rsc_stricmp( (*ppStr) + 3, #Name ) ) \ + nLangTypeId = LANGUAGE_##Name + LT( SYSTEM ); +#include <rsclang.c> + LT( USER1 ); + LT( USER2 ); + LT( USER3 ); + LT( USER4 ); + LT( USER5 ); + LT( USER6 ); + LT( USER7 ); + LT( USER8 ); + LT( USER9 ); + if( nLangTypeId == LANGUAGE_DONTKNOW ) + pEH->FatalError( ERR_UNKNOWNSW, RscId(), *ppStr ); + } + else + pEH->FatalError( ERR_UNKNOWNSW, RscId(), *ppStr ); + } + else + { + // Eingabedatei + aInputList.Insert( new ByteString( *ppStr ), 0xFFFF ); + } + ppStr++; + i++; + } + + if( nCommands & HELP_FLAG ) + pEH->FatalError( ERR_USAGE, RscId() ); + // was an inputted file specified + else if( aInputList.Count() ) + { + if( ! aOutputRc.Len() ) + aOutputRc = OutputFile( *aInputList.First(), "rc" ); + if( ! bOutputSrsIsSet ) + aOutputSrs = OutputFile( *aInputList.First(), "srs" ); + } + else if( !(nCommands & PRINTSYNTAX_FLAG) ) + pEH->FatalError( ERR_NOINPUT, RscId() ); +} + +/************************************************************************* +|* +|* RscCmdLine::SetInputFile() +|* +|* Beschreibung +|* Ersterstellung MM 22.04.91 +|* Letzte Aenderung MM 22.04.91 +|* +*************************************************************************/ +void RscCmdLine::SetInputFile( const ByteString & rInputName ) +{ + ByteString * pString; + + while( NULL != (pString = aInputList.Remove( (ULONG)0 )) ) + delete pString; + aInputList.Insert( new ByteString( rInputName ) ); +} + +/************************************************************************* +|* +|* RscCmdLine::~RscCmdLine() +|* +|* Beschreibung dtor +|* Ersterstellung MM 13.02.91 +|* Letzte Aenderung MM 13.02.91 +|* +*************************************************************************/ +RscCmdLine::~RscCmdLine() +{ + ByteString *pString; + + while( NULL != (pString = aInputList.Remove( (ULONG)0 )) ) + delete pString; + while( NULL != (pString = aSymbolList.Remove( (ULONG)0 )) ) + delete pString; +} + +/*************** R s c C o m p i l e r **********************************/ +/****************************************************************/ +/* */ +/* RscCompiler :: RscCompiler(int argc, char **argv) */ +/* */ +/* Parameters : argc - number of parameters on command line */ +/* argv - arry of pointers to input parameters */ +/* */ +/* Description : main calling routine. Calls functions to */ +/* check and assign the input parameters. It then builds the */ +/* command line to call the Glockenspiel preprocessor */ +/****************************************************************/ + +RscCompiler::RscCompiler( RscCmdLine * pLine, RscTypCont * pTypCont ) +{ + fListing = NULL; + fExitFile = NULL; + + //Kommandozeile setzen, TypContainer setzen + pCL = pLine; + pTC = pTypCont; + + if( pCL->aOutputLst.Len() ) + { + if ( NULL == (fListing = fopen( pCL->aOutputLst.GetBuffer(), "w" )) ) + pTC->pEH->FatalError( ERR_OPENFILE, RscId(), pCL->aOutputLst.GetBuffer() ); + pTC->pEH->SetListFile( fListing ); + } +} + +/************************************************************************* +|* +|* RscCompiler :: RscCompiler() +|* +|* Beschreibung +|* Ersterstellung MM 07.02.91 +|* Letzte Aenderung MM 07.02.91 +|* +*************************************************************************/ +RscCompiler::~RscCompiler() +{ + ByteString* pString; + + // Dateien loeschen + pString = aTmpFileList.First(); + while( pString ) + { + unlink( pString->GetBuffer() ); + delete pString; + pString = aTmpFileList.Next(); + } + + pTC->pEH->SetListFile( NULL ); + + if( fListing ) + fclose( fListing ); + + if( fExitFile ) + fclose( fExitFile ); + if( aTmpOutputRc.Len() ) + unlink( aTmpOutputRc.GetBuffer() ); + if( aTmpOutputHxx.Len() ) + unlink( aTmpOutputHxx.GetBuffer() ); + if( aTmpOutputCxx.Len() ) + unlink( aTmpOutputCxx.GetBuffer() ); + if( aTmpOutputRcCtor.Len() ) + unlink( aTmpOutputRcCtor.GetBuffer() ); + if( aTmpOutputSrc.Len() ) + unlink( aTmpOutputSrc.GetBuffer() ); +} + +/************************************************************************* +|* +|* RscCompiler::Start() +|* +|* Beschreibung Datei in Kommandozeile aendern +|* Ersterstellung MM 13.02.91 +|* Letzte Aenderung MM 13.02.91 +|* +*************************************************************************/ +ERRTYPE RscCompiler::Start() +{ + ERRTYPE aError; + ByteString* pString; + RscFile* pFName; + + if( PRINTSYNTAX_FLAG & pCL->nCommands ) + { +#ifndef W30 + pTC->WriteSyntax( stdout ); +printf( "khg\n" ); +#endif + return ERR_OK; + } + + // Kein Parameter, dann Hilfe + pString = pCL->aInputList.First(); + if( !pString ) + pTC->pEH->FatalError( ERR_NOINPUT, RscId() ); + + while( pString ) + { + pTC->aFileTab.NewCodeFile( *pString ); + pString = pCL->aInputList.Next(); + } + + if( !(pCL->nCommands & NOSYNTAX_FLAG) ) + { + if( pCL->nCommands & NOPREPRO_FLAG ) + { + + pTC->pEH->SetListFile( NULL ); + + pFName = pTC->aFileTab.First(); + while( pFName && aError.IsOk() ) + { + if( !pFName->bScanned && !pFName->IsIncFile() ) + { + aError = IncludeParser( + pTC->aFileTab.GetIndex( pFName ) + ); + // Currentzeiger richtig setzen + pTC->aFileTab.Seek( pFName ); + }; + pFName = pTC->aFileTab.Next(); + }; + + pTC->pEH->SetListFile( fListing ); + } + }; + + pTC->pEH->StdOut( "Files: " ); + pFName = pTC->aFileTab.First(); + while( pFName ) + { + pTC->pEH->StdOut( pFName->aFileName.GetBuffer() ); + pTC->pEH->StdOut( " " ); + pFName = pTC->aFileTab.Next(); + }; + pTC->pEH->StdOut( "\n" ); + + if( aError.IsOk() ) + aError = CheckSyntax(); + + if( aError.IsOk() ) + aError = Link(); + + if( aError.IsOk() ) + EndCompile(); + + if( aError.IsError() ) + pTC->pEH->Error( ERR_ERROR, NULL, RscId() ); + + return( aError ); +} +/************************************************************************* +|* +|* RscCmdLine::EndCompile() +|* +|* Beschreibung Datei in Kommandozeile aendern +|* Ersterstellung MM 13.02.91 +|* Letzte Aenderung MM 13.02.91 +|* +*************************************************************************/ +void RscCompiler::EndCompile() +{ + if( pCL->aOutputSrs.Len() && (pCL->nCommands & NOLINK_FLAG) ) + { + pTC->pEH->StdOut( "Writing file " ); + pTC->pEH->StdOut( pCL->aOutputSrs.GetBuffer() ); + pTC->pEH->StdOut( ".\n" ); + + // kopiere von TMP auf richtigen Namen + unlink( pCL->aOutputSrs.GetBuffer() ); // Zieldatei loeschen + if( !(pCL->nCommands & NOSYNTAX_FLAG) ) + { + FILE * foutput; + RscFile * pFN; + + if( NULL == (foutput = fopen( pCL->aOutputSrs.GetBuffer(), "w" )) ) + pTC->pEH->FatalError( ERR_OPENFILE, RscId(), pCL->aOutputSrs.GetBuffer() ); + else + { + // Schreibe Datei + pFN = pTC->aFileTab.First(); + while( pFN ) + { + if( !pFN->IsIncFile() ) + { + pTC->WriteSrc( foutput, NOFILE_INDEX, + RTL_TEXTENCODING_UNICODE, FALSE ); + break; // ?T 281091MM nur eine Src-Datei + } + }; + + fclose( foutput ); + }; + }; + } + + if ( aTmpOutputHxx.Len() ) + { + pTC->pEH->StdOut( "Writing file " ); + pTC->pEH->StdOut( pCL->aOutputHxx.GetBuffer() ); + pTC->pEH->StdOut( ".\n" ); + + // kopiere von TMP auf richtigen Namen + unlink( pCL->aOutputHxx.GetBuffer() ); // Zieldatei loeschen + Append( pCL->aOutputHxx, aTmpOutputHxx ); + unlink( aTmpOutputHxx.GetBuffer() );// TempDatei loeschen + aTmpOutputHxx = ByteString(); + } + + if( aTmpOutputCxx.Len() ) + { + pTC->pEH->StdOut( "Writing file " ); + pTC->pEH->StdOut( pCL->aOutputCxx.GetBuffer() ); + pTC->pEH->StdOut( ".\n" ); + + // kopiere von TMP auf richtigen Namen + unlink( pCL->aOutputCxx.GetBuffer() ); // Zieldatei loeschen + Append( pCL->aOutputCxx, aTmpOutputCxx ); + unlink( aTmpOutputCxx.GetBuffer() );// TempDatei loeschen + aTmpOutputCxx = ByteString(); + } + + if( aTmpOutputRcCtor.Len() ) + { + pTC->pEH->StdOut( "Writing file " ); + pTC->pEH->StdOut( pCL->aOutputRcCtor.GetBuffer() ); + pTC->pEH->StdOut( ".\n" ); + + // kopiere von TMP auf richtigen Namen + unlink( pCL->aOutputRcCtor.GetBuffer() ); // Zieldatei loeschen + Append( pCL->aOutputRcCtor, aTmpOutputRcCtor ); + unlink( aTmpOutputRcCtor.GetBuffer() );// TempDatei loeschen + aTmpOutputRcCtor = ByteString(); + } + + if( aTmpOutputSrc.Len() ) + { + // kopiere von TMP auf richtigen Namen + unlink( pCL->aOutputSrc.GetBuffer() ); // Zieldatei loeschen + Append( pCL->aOutputSrc, aTmpOutputSrc ); + unlink( aTmpOutputSrc.GetBuffer() );// TempDatei loeschen + aTmpOutputSrc = ByteString(); + } + + if( aTmpOutputRc.Len() ) + { + // kopiere von TMP auf richtigen Namen + unlink( pCL->aOutputRc.GetBuffer() ); // Zieldatei loeschen + Append( pCL->aOutputRc, aTmpOutputRc ); + unlink( aTmpOutputRc.GetBuffer() ); // TempDatei loeschen + aTmpOutputRc = ByteString(); + } +} + +/************************************************************************* +|* +|* RscCompiler::IncludeParser() +|* +|* Beschreibung +|* Ersterstellung MM 21.06.91 +|* Letzte Aenderung MM 21.06.91 +|* +*************************************************************************/ +ERRTYPE RscCompiler :: IncludeParser( ULONG lFileKey ) +{ + FILE * finput; + RscFile * pFName; + ERRTYPE aError; + + pFName = pTC->aFileTab.Get( lFileKey ); + if( !pFName ) + aError = ERR_ERROR; + else if( !pFName->bScanned ) + { + finput = fopen( pFName->aPathName.GetBuffer(), "r" ); + if( !finput ) + { + aError = ERR_OPENFILE; + pTC->pEH->Error( aError, NULL, RscId(), + pFName->aPathName.GetBuffer() ); + } + else + { + RscFile * pFNTmp; + ByteString aPathName; + RscDepend * pDep; + RscFileInst aFileInst( pTC, lFileKey, lFileKey, + finput, pCL->nSourceCharSet ); + + pFName->bScanned = TRUE; + ::IncludeParser( &aFileInst ); + fclose( finput ); + + // Include-Pfad durchsuchen + pDep = pFName->First(); + while( pDep ) + { + pFNTmp = pTC->aFileTab.GetFile( pDep->GetFileKey() ); + pDep = pFName->Next(); + } + + pDep = pFName->First(); + while( pDep ) + { + pFNTmp = pTC->aFileTab.GetFile( pDep->GetFileKey() ); + // Kein Pfad und Include Datei + if( pFNTmp && !pFNTmp->bLoaded ) + { + UniString aUniFileName( pFNTmp->aFileName, RTL_TEXTENCODING_ASCII_US ); + DirEntry aFullName( aUniFileName ); + if ( aFullName.Find( UniString( pCL->aPath, RTL_TEXTENCODING_ASCII_US ) ) ) + pFNTmp->aPathName = ByteString( aFullName.GetFull(), RTL_TEXTENCODING_ASCII_US ); + else + aError = ERR_OPENFILE; + } + pDep = pFName->Next(); + }; + }; + }; + + return aError; +} + +/************************************************************************* +|* +|* RscCompiler :: ParseOneFile() +|* +|* Beschreibung +|* Ersterstellung MM 26.06.91 +|* Letzte Aenderung MM 26.06.91 +|* +*************************************************************************/ +ERRTYPE RscCompiler :: ParseOneFile( ULONG lFileKey ) +{ + FILE * finput = NULL; + ERRTYPE aError; + RscFile * pFName; + + pFName = pTC->aFileTab.Get( lFileKey ); + if( !pFName ) + aError = ERR_ERROR; + else if( !pFName->bLoaded ) + { + RscDepend * pDep; + + //Include-Dateien vorher lesen + pFName->bLoaded = TRUE; //Endlos Rekursion vermeiden + pDep = pFName->First(); + while( pDep && aError.IsOk() ) + { + aError = ParseOneFile( pDep->GetFileKey() ); + pFName->Seek( pDep ); + pDep = pFName->Next(); + } + + if( aError.IsError() ) + pFName->bLoaded = FALSE; //bei Fehler nicht geladenen + else + { + finput = fopen( pFName->aPathName.GetBuffer(), "r" ); + if( !finput ) + { + pTC->pEH->Error( ERR_OPENFILE, NULL, RscId(), + pFName->aPathName.GetBuffer() ); + aError = ERR_OPENFILE; + } + else + { + RscFileInst aFileInst( pTC, lFileKey, lFileKey, finput, + pCL->nSourceCharSet ); + // Parser schreibt Punkte fuer jedes Objekt auf + // unterster Ebene nach stdout + pTC->pEH->StdOut( "reading file " ); + pTC->pEH->StdOut( pFName->aPathName.GetBuffer() ); + pTC->pEH->StdOut( " " ); + + aError = ::parser( &aFileInst ); + if( aError.IsError() ) + pTC->Delete( lFileKey );//Resourceobjekte loeschen + pTC->pEH->StdOut( "\n" ); + fclose( finput ); + }; + }; + }; + + return( aError ); +} + +/************************************************************************* +|* +|* RscCompiler :: CheckSyntax() +|* +|* Beschreibung +|* Ersterstellung MM 07.02.91 +|* Letzte Aenderung MM 07.02.91 +|* +*************************************************************************/ +ERRTYPE RscCompiler::CheckSyntax(){ + ERRTYPE aError; + RscFile * pFName; + + // Parser schreibt Punkte fuer jedes Objekt auf + // unterster Ebene nach stdout + + //Eingabedateien liegen als Liste vor + pFName = pTC->aFileTab.First(); + while( pFName && aError.IsOk() ){ + if( !pFName->IsIncFile() ){ + aError = ParseOneFile( pTC->aFileTab.GetIndex( pFName ) ); + // Currentzeiger richtig setzen + pTC->aFileTab.Seek( pFName ); + }; + pFName = pTC->aFileTab.Next(); + }; + + return( aError ); +} + +/************************************************************************* +|* +|* RscCompiler :: Link() +|* +|* Beschreibung +|* Ersterstellung MM 07.02.91 +|* Letzte Aenderung MM 07.02.91 +|* +*************************************************************************/ +ERRTYPE RscCompiler::Link() +{ + FILE * foutput; + ERRTYPE aError; + + if( !(pCL->nCommands & NOLINK_FLAG) ) + { + // rc-Datei schreiben + aTmpOutputRc = ::GetTmpFileName(); + if ( NULL == (fExitFile = foutput = fopen( aTmpOutputRc.GetBuffer(), "wb" )) ) + pTC->pEH->FatalError( ERR_OPENFILE, RscId(), aTmpOutputRc.GetBuffer() ); + + pTC->pEH->StdOut( "Generating .rc file\n" ); + + // Schreibe Datei + aError = pTC->WriteRc( foutput ); + + fclose( foutput ); + fExitFile = NULL; + }; + + // hxx-Datei schreiben + if( pCL->aOutputHxx.Len() && aError.IsOk() ) + { + aTmpOutputHxx = ::GetTmpFileName(); + if ( NULL == (fExitFile = foutput = fopen( aTmpOutputHxx.GetBuffer(), "w" )) ) + pTC->pEH->FatalError( ERR_OPENFILE, RscId(), aTmpOutputHxx.GetBuffer() ); + + pTC->pEH->StdOut( "Generating .hxx file\n" ); + + // Schreibe Datei + aError = pTC->WriteHxx( foutput, NOFILE_INDEX ); + + fclose( foutput ); + fExitFile = NULL; + } + + // cxx-Datei schreiben + if( pCL->aOutputCxx.Len() && aError.IsOk() ) + { + aTmpOutputCxx = ::GetTmpFileName(); + if ( NULL == (fExitFile = foutput = fopen( aTmpOutputCxx.GetBuffer(), "w" )) ) + pTC->pEH->FatalError( ERR_OPENFILE, RscId(), aTmpOutputCxx.GetBuffer() ); + + pTC->pEH->StdOut( "Generating .cxx file\n" ); + + ByteString aHxx = pCL->aOutputHxx; + if( !aHxx.Len() ) + { + UniString aUniOutputCxx( pCL->aOutputCxx, RTL_TEXTENCODING_ASCII_US ); + aHxx = ByteString( DirEntry( aUniOutputCxx ).GetBase(), RTL_TEXTENCODING_ASCII_US ); + aHxx += ".hxx"; + } + + // Schreibe Datei + aError = pTC->WriteCxx( foutput, NOFILE_INDEX, aHxx ); + + fclose( foutput ); + fExitFile = NULL; + } + + // RcCtor-Datei schreiben + if( pCL->aOutputRcCtor.Len() && aError.IsOk() ) + { + aTmpOutputRcCtor = ::GetTmpFileName(); + if ( NULL == (fExitFile = foutput = fopen( aTmpOutputRcCtor.GetBuffer(), "w" )) ) + pTC->pEH->FatalError( ERR_OPENFILE, RscId(), aTmpOutputRcCtor.GetBuffer() ); + + pTC->pEH->StdOut( "Generating .cxx ressource constructor file\n" ); + + // Schreibe Datei + pTC->WriteRcCtor( foutput ); + + fclose( foutput ); + fExitFile = NULL; + } + + // src-Datei schreiben + if( pCL->aOutputSrc.Len() && aError.IsOk() ) + { + aTmpOutputSrc = ::GetTmpFileName(); + if ( NULL == (fExitFile = foutput = fopen( aTmpOutputSrc.GetBuffer(), "w" )) ) + pTC->pEH->FatalError( ERR_OPENFILE, RscId(), aTmpOutputSrc.GetBuffer() ); + + // Schreibe Datei + pTC->WriteSrc( foutput, NOFILE_INDEX, RTL_TEXTENCODING_UNICODE ); + + fclose( foutput ); + fExitFile = NULL; + }; + + return( aError ); +} + +/********************************************************************/ +/* */ +/* Function : Append( ) */ +/* */ +/* Parameters : psw - pointer to a preprocessor switch */ +/* */ +/* Description : appends text files */ +/********************************************************************/ +void RscCompiler::Append( const ByteString& rOutputSrs, + const ByteString& rTmpFile ) +{ + if( !::Append( rOutputSrs, rTmpFile ) ) + { + ByteString aTemp = rOutputSrs; + aTemp += " or "; + aTemp += rTmpFile; + pTC->pEH->FatalError( ERR_OPENFILE, RscId(), aTemp.GetBuffer() ); + } +} + +/********************************************************************/ +/* */ +/* Function : GetTmpFileName() */ +/* */ +/* Description : Packt einen Dateinamen in Tmp-Dateiliste. */ +/* */ +/********************************************************************/ +ByteString RscCompiler::GetTmpFileName() +{ + ByteString aFileName; + + aFileName = ::GetTmpFileName(); + aTmpFileList.Insert( new ByteString( aFileName ) ); + return( aFileName ); +} + +/********************************************************************/ +/* */ +/* Function : BOOL openinput() */ +/* */ +/* Description : Check to see if the input file exists and can */ +/* be opened for reading. */ +/********************************************************************/ + +void RscCompiler::OpenInput( const ByteString& rInput ) +{ + FILE *fp; + /* try to open the input file */ + if( NULL == (fp = fopen( rInput.GetBuffer(), "r"))) + pTC->pEH->FatalError( ERR_OPENFILE, RscId(), rInput.GetBuffer() ); + + fclose( fp ); +} + diff --git a/rsc/source/tools/makefile.mk b/rsc/source/tools/makefile.mk new file mode 100644 index 000000000000..3ac670ed2827 --- /dev/null +++ b/rsc/source/tools/makefile.mk @@ -0,0 +1,86 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $ +# +# 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=rsctoo + +# --- Settings ------------------------------------------------------ + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +OBJFILES= $(OBJ)$/rschash.obj \ + $(OBJ)$/rsctree.obj \ + $(OBJ)$/rsctools.obj \ + $(OBJ)$/rscchar.obj \ + $(OBJ)$/rscdef.obj + +CXXFILES= rschash.cxx \ + rsctree.cxx \ + rsctools.cxx \ + rscchar.cxx \ + rscdef.cxx + +.INCLUDE : target.mk diff --git a/rsc/source/tools/rscchar.cxx b/rsc/source/tools/rscchar.cxx new file mode 100644 index 000000000000..2ab9badbcd74 --- /dev/null +++ b/rsc/source/tools/rscchar.cxx @@ -0,0 +1,411 @@ +/************************************************************************* + * + * $RCSfile: rscchar.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $ + * + * 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/tools/rscchar.cxx,v 1.1.1.1 2000-09-18 16:42:56 hr Exp $ + + Source Code Control System - Update + + $Log: not supported by cvs2svn $ + Revision 1.14 2000/09/17 12:51:12 willem.vandorp + OpenOffice header added. + + Revision 1.13 2000/07/26 17:13:23 willem.vandorp + Headers/footers replaced + + Revision 1.12 1999/09/20 16:12:22 mm + \X is possible in the character converter + + Revision 1.11 1999/09/09 13:10:53 mm + UTF8 corrected + + Revision 1.10 1999/09/07 13:30:06 mm + UniCode + + Revision 1.9 1998/01/08 13:20:56 MM + includes angepasst + + + Rev 1.8 08 Jan 1998 13:20:56 MM + includes angepasst + + Rev 1.7 07 Aug 1997 15:47:20 TJ + include + + Rev 1.6 21 Nov 1995 19:50:52 TLX + Neuer Link + + Rev 1.5 25 Aug 1993 15:31:38 mm + Zeichensaetze aus den tools + + Rev 1.4 06 Aug 1993 13:14:56 TH + Equal-Tablle zwischen 200-209 jetzt richtig + + Rev 1.3 19 Jul 1993 19:21:42 mm + \ verbessert + + Rev 1.2 19 Jul 1993 16:29:46 mm + + Rev 1.1 20 Aug 1992 18:18:20 mm + +**************************************************************************/ +/****************** I N C L U D E S **************************************/ +#include <stdio.h> +#include <string.h> +#include <ctype.h> + +#ifndef _TABLE_HXX //autogen +#include <tools/table.hxx> +#endif + +// Solar Definitionen +#include <tools/solar.h> +#ifndef _RSCTOOLS_HXX +#include <rsctools.hxx> +#endif + +#include <rtl/textcvt.h> +#include <rtl/textenc.h> + +/************************************************************************* +|* +|* RscChar::MakeChar() +|* +|* Beschreibung Der String wird nach C-Konvention umgesetzt +|* Ersterstellung MM 20.03.91 +|* Letzte Aenderung MM 20.03.91 +|* +*************************************************************************/ +char * RscChar::MakeUTF8( char * pStr, UINT16 nTextEncoding ) +{ + sal_Size nMaxUniCodeBuf = strlen( pStr ) + 1; + char * pOrgStr = new char[ nMaxUniCodeBuf ]; + USHORT nOrgLen = 0; + + if( nMaxUniCodeBuf * 6 > 0xFFFF ) + RscExit( 10 ); + + char cOld = '1'; + while( cOld != 0 ) + { + char c; + + if( *pStr == '\\' ) + { + ++pStr; + switch( *pStr ) + { + case 'a': + c = '\a'; + break; + case 'b': + c = '\b'; + break; + case 'f': + c = '\f'; + break; + case 'n': + c = '\n'; + break; + case 'r': + c = '\r'; + break; + case 't': + c = '\t'; + break; + case 'v': + c = '\v'; + break; + case '\\': + c = '\\'; + break; + case '?': + c = '\?'; + break; + case '\'': + c = '\''; + break; + case '\"': + c = '\"'; + break; + default: + { + if( '0' <= *pStr && '7' >= *pStr ) + { + USHORT nChar = 0; + USHORT i = 0; + while( '0' <= *pStr && '7' >= *pStr && i != 3 ) + { + nChar = nChar * 8 + (BYTE)*pStr - (BYTE)'0'; + ++pStr; + i++; + } + if( nChar > 255 ) + { + RscMem::Free( pOrgStr ); + + // Wert zu gross, oder kein 3 Ziffern + return( NULL ); + } + c = (char)nChar; + pStr--; + } + else if( 'x' == *pStr ) + { + USHORT nChar = 0; + USHORT i = 0; + ++pStr; + while( isxdigit( *pStr ) && i != 2 ) + { + if( isdigit( *pStr ) ) + nChar = nChar * 16 + (BYTE)*pStr - (BYTE)'0'; + else if( isupper( *pStr ) ) + nChar = nChar * 16 + (BYTE)*pStr - (BYTE)'A' +10; + else + nChar = nChar * 16 + (BYTE)*pStr - (BYTE)'a' +10; + ++pStr; + i++; + } + c = (char)nChar; + pStr--; + } + else + c = *pStr; + }; + } + } + else + c = *pStr; + pOrgStr[ nOrgLen++ ] = c; + cOld = *pStr; + pStr++; + } + + sal_Unicode * pUniCode = new sal_Unicode[ nMaxUniCodeBuf ]; + rtl_TextToUnicodeConverter hConv = rtl_createTextToUnicodeConverter( nTextEncoding ); + + sal_uInt32 nInfo; + sal_Size nSrcCvtBytes; + sal_Size nUniSize = rtl_convertTextToUnicode( hConv, 0, + pOrgStr, nOrgLen, + pUniCode, nMaxUniCodeBuf, + RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_DEFAULT + | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT + | RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT + | RTL_TEXTTOUNICODE_FLAGS_FLUSH, + &nInfo, + &nSrcCvtBytes ); + + rtl_destroyTextToUnicodeConverter( hConv ); + + hConv = rtl_createUnicodeToTextConverter( RTL_TEXTENCODING_UTF8 ); + // factor fo 6 is the maximum size of an UNICODE character as utf8 + char * pUtf8 = (char *)RscMem::Malloc( (USHORT)(nMaxUniCodeBuf * 6) ); + UINT16 nUtf8Len = 0; + + rtl_convertUnicodeToText( hConv, 0, + pUniCode, nUniSize, + pUtf8, nMaxUniCodeBuf * 6, + RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT + | RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT + | RTL_UNICODETOTEXT_FLAGS_FLUSH, + &nInfo, + &nSrcCvtBytes ); + + rtl_destroyTextToUnicodeConverter( hConv ); + + delete pUniCode; + delete pOrgStr; + return pUtf8; +}; + +/************************************************************************* +|* +|* RscChar::MakeChar() +|* +|* Beschreibung Der String wird nach C-Konvention umgesetzt +|* Ersterstellung MM 20.03.91 +|* Letzte Aenderung MM 20.03.91 +|* +*************************************************************************/ +char * RscChar::MakeUTF8FromL( char * pStr ) +{ + sal_Size nUniPos = 0; + sal_Unicode * pUniCode = new sal_Unicode[ strlen( pStr ) + 1 ]; + + char cOld = '1'; + while( cOld != 0 ) + { + sal_Unicode c; + if( *pStr == '\\' ) + { + ++pStr; + switch( *pStr ) + { + case 'a': + c = '\a'; + break; + case 'b': + c = '\b'; + break; + case 'f': + c = '\f'; + break; + case 'n': + c = '\n'; + break; + case 'r': + c = '\r'; + break; + case 't': + c = '\t'; + break; + case 'v': + c = '\v'; + break; + case '\\': + c = '\\'; + break; + case '?': + c = '\?'; + break; + case '\'': + c = '\''; + break; + case '\"': + c = '\"'; + break; + default: + { + if( '0' <= *pStr && '7' >= *pStr ) + { + UINT32 nChar = 0; + USHORT i = 0; + while( '0' <= *pStr && '7' >= *pStr && i != 6 ) + { + nChar = nChar * 8 + (BYTE)*pStr - (BYTE)'0'; + ++pStr; + i++; + } + if( nChar > 0xFFFF ) + // Wert zu gross, oder kein 3 Ziffern + return( FALSE ); + c = (UINT16)nChar; + pStr--; + } + else if( 'x' == *pStr || 'X' == *pStr ) + { + UINT32 nChar = 0; + USHORT i = 0; + ++pStr; + while( isxdigit( *pStr ) && i != 4 ) + { + if( isdigit( *pStr ) ) + nChar = nChar * 16 + (BYTE)*pStr - (BYTE)'0'; + else if( isupper( *pStr ) ) + nChar = nChar * 16 + (BYTE)*pStr - (BYTE)'A' +10; + else + nChar = nChar * 16 + (BYTE)*pStr - (BYTE)'a' +10; + ++pStr; + i++; + } + c = (UINT16)nChar; + pStr--; + } + else + c = *pStr; + }; + } + } + else + c = *pStr; + + pUniCode[ nUniPos++ ] = c; + cOld = *pStr; + pStr++; + } + + // factor fo 6 is the maximum size of an UNICODE character as utf8 + sal_Size nMaxUtf8Len = nUniPos * 6; + if( nUniPos * 6 > 0xFFFF ) + RscExit( 10 ); + char * pUtf8 = (char *)RscMem::Malloc( (USHORT)nMaxUtf8Len ); + rtl_TextToUnicodeConverter hConv = rtl_createUnicodeToTextConverter( RTL_TEXTENCODING_UTF8 ); + + sal_uInt32 nInfo; + sal_Size nSrcCvtBytes; + sal_Size nSize = rtl_convertUnicodeToText( hConv, 0, + pUniCode, nUniPos, + pUtf8, nMaxUtf8Len, + RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT + | RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT + | RTL_UNICODETOTEXT_FLAGS_FLUSH, + &nInfo, + &nSrcCvtBytes ); + + rtl_destroyUnicodeToTextConverter( hConv ); + + delete pUniCode; + return pUtf8; +}; + diff --git a/rsc/source/tools/rscdef.cxx b/rsc/source/tools/rscdef.cxx new file mode 100644 index 000000000000..13b82098a823 --- /dev/null +++ b/rsc/source/tools/rscdef.cxx @@ -0,0 +1,1456 @@ +/************************************************************************* + * + * $RCSfile: rscdef.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $ + * + * 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/tools/rscdef.cxx,v 1.1.1.1 2000-09-18 16:42:56 hr Exp $ + + Source Code Control System - Update + + $Log: not supported by cvs2svn $ + Revision 1.13 2000/09/17 12:51:12 willem.vandorp + OpenOffice header added. + + Revision 1.12 2000/07/26 17:13:24 willem.vandorp + Headers/footers replaced + + Revision 1.11 2000/07/11 17:17:36 th + Unicode + + Revision 1.10 1997/08/27 18:17:52 MM + neue Headerstruktur + +**************************************************************************/ +/****************** I N C L U D E S **************************************/ + +// Programmuebergreifende Includes. +#ifndef _RSCDEF_HXX +#include <rscdef.hxx> +#endif + +/****************** C o d e **********************************************/ +/****************** R s c I d ********************************************/ +BOOL RscId::bNames = TRUE; + +/************************************************************************* +|* +|* static RscId::SetNames +|* static RscId::SetNoNames +|* +|* Beschreibung +|* Ersterstellung MM 26.06.91 +|* Letzte Aenderung MM 26.06.91 +|* +*************************************************************************/ +void RscId::SetNames( BOOL bSet ) { bNames = bSet; } +BOOL RscId::IsSetNames() { return bNames; } + +/************************************************************************* +|* +|* RscId::GetNumber +|* +|* Beschreibung +|* Ersterstellung MM 17.05.91 +|* Letzte Aenderung MM 17.05.91 +|* +*************************************************************************/ +long RscId::GetNumber() const{ + long lVal; + aExp.Evaluate( &lVal ); + return lVal; +} + +/************************************************************************* +|* +|* RscId::Create() +|* +|* Beschreibung +|* Ersterstellung MM 01.11.91 +|* Letzte Aenderung MM 01.11.91 +|* +*************************************************************************/ +void RscId::Create( const RscExpType & rExpType ) +{ + aExp = rExpType; + if( aExp.IsDefinition() ) + aExp.aExp.pDef->IncRef(); + else if( aExp.IsExpression() ){ + long lValue; + + aExp.Evaluate( &lValue ); + aExp.SetLong( lValue ); + } +} + +/************************************************************************* +|* +|* RscId::Destroy() +|* +|* Beschreibung +|* Ersterstellung MM 01.11.91 +|* Letzte Aenderung MM 01.11.91 +|* +*************************************************************************/ +void RscId::Destroy(){ + if( aExp.IsDefinition() ) + aExp.aExp.pDef->DecRef(); + aExp.cType = RSCEXP_NOTHING; +} + +/************************************************************************* +|* +|* RscId::RscId() +|* +|* Beschreibung +|* Ersterstellung MM 01.11.91 +|* Letzte Aenderung MM 01.11.91 +|* +*************************************************************************/ +RscId::RscId( const RscId& rRscId ){ + aExp = rRscId.aExp; + if( aExp.IsDefinition() ) + aExp.aExp.pDef->IncRef(); +} + +/************************************************************************* +|* +|* RscId::RscId() +|* +|* Beschreibung +|* Ersterstellung MM 01.11.91 +|* Letzte Aenderung MM 25.11.91 +|* +*************************************************************************/ +RscId::RscId( RscDefine * pDef ){ + RscExpType aExpType; + + aExpType.aExp.pDef = pDef; + aExpType.cType = RSCEXP_DEF; + Create( aExpType ); +} + +/************************************************************************* +|* +|* RscId:: = +|* +|* Beschreibung +|* Ersterstellung MM 01.11.91 +|* Letzte Aenderung MM 01.11.91 +|* +*************************************************************************/ +RscId& RscId::operator = ( const RscId& rRscId ){ + if( rRscId.aExp.IsDefinition() ) + rRscId.aExp.aExp.pDef->IncRef(); + Destroy(); + aExp = rRscId.aExp; + return *this; +} + +/************************************************************************* +|* +|* RscId::operator == +|* +|* Beschreibung +|* Ersterstellung MM 16.05.91 +|* Letzte Aenderung MM 16.05.91 +|* +*************************************************************************/ +BOOL RscId::operator == ( const RscId& rRscId ) const +{ + return( GetNumber() == rRscId.GetNumber() ); +} + +/************************************************************************* +|* +|* RscId::operator < +|* +|* Beschreibung +|* Ersterstellung MM 16.05.91 +|* Letzte Aenderung MM 16.05.91 +|* +*************************************************************************/ +BOOL RscId::operator < ( const RscId& rRscId ) const +{ + return( GetNumber() < rRscId.GetNumber() ); +} + +/************************************************************************* +|* +|* RscId::operator > +|* +|* Beschreibung +|* Ersterstellung MM 16.05.91 +|* Letzte Aenderung MM 16.05.91 +|* +*************************************************************************/ +BOOL RscId::operator > ( const RscId& rRscId ) const +{ + return( GetNumber() > rRscId.GetNumber() ); +} + +/************************************************************************* +|* +|* RscId::long() +|* +|* Beschreibung +|* Ersterstellung MM 16.05.91 +|* Letzte Aenderung MM 16.05.91 +|* +*************************************************************************/ +RscId::operator long() const +{ + return( GetNumber() ); +} + +/************************************************************************* +|* +|* RscId::GetNames() +|* +|* Beschreibung +|* Ersterstellung MM 16.05.91 +|* Letzte Aenderung MM 25.11.91 +|* +*************************************************************************/ +ByteString RscId::GetName() const +{ + ByteString aStr; + + if ( !aExp.IsNothing() ) + { + if( bNames ) + aExp.GetMacro( aStr ); + else + aStr = ByteString::CreateFromInt32( GetNumber() ); + } + + return aStr; +} + +/************************************************************************* +|* +|* RscId::GetMacro() +|* +|* Beschreibung +|* Ersterstellung MM 01.11.91 +|* Letzte Aenderung MM 25.11.91 +|* +*************************************************************************/ +ByteString RscId::GetMacro() const +{ + ByteString aStr; + + if ( aExp.IsDefinition() ) + aStr = aExp.aExp.pDef->GetMacro(); + else + aExp.GetMacro( aStr ); + + return aStr; +} + +/****************** R s c D e f i n e ************************************/ +/************************************************************************* +|* +|* RscDefine::RscDefine() +|* +|* Beschreibung +|* Ersterstellung MM 01.11.91 +|* Letzte Aenderung MM 01.11.91 +|* +*************************************************************************/ +RscDefine::RscDefine( ULONG lKey, const ByteString & rDefName, long lDefId ) + : StringNode( rDefName ) +{ + nRefCount = 0; + lFileKey = lKey; + lId = lDefId; + pExp = NULL; +} + +RscDefine::RscDefine( ULONG lKey, const ByteString & rDefName, + RscExpression * pExpression ) + : StringNode( rDefName ) +{ + nRefCount = 0; + lFileKey = lKey; + pExpression->Evaluate( &lId ); + pExp = pExpression; +} + +/************************************************************************* +|* +|* RscDefine::~RscDefine() +|* +|* Beschreibung +|* Ersterstellung MM 01.11.91 +|* Letzte Aenderung MM 01.11.91 +|* +*************************************************************************/ +RscDefine::~RscDefine(){ + if( pExp ) + delete pExp; + if( nRefCount ) + RscExit( 14 ); +} + +/************************************************************************* +|* +|* RscDefine::DecRef() +|* +|* Beschreibung +|* Ersterstellung MM 01.11.91 +|* Letzte Aenderung MM 01.11.91 +|* +*************************************************************************/ +void RscDefine::DecRef(){ + nRefCount--; + if( 0 == nRefCount ){ + delete this; + } +} + +/************************************************************************* +|* +|* RscDefine::DefineToNumber() +|* +|* Beschreibung +|* Ersterstellung MM 07.11.91 +|* Letzte Aenderung MM 07.11.91 +|* +*************************************************************************/ +void RscDefine::DefineToNumber() +{ + if( pExp ) + delete pExp; + pExp = NULL; + SetName( ByteString::CreateFromInt32( lId ) ); +} + +/************************************************************************* +|* +|* RscDefine::ChangeMacro() +|* +|* Beschreibung +|* Ersterstellung MM 04.11.91 +|* Letzte Aenderung MM 04.11.91 +|* +*************************************************************************/ +void RscDefine::ChangeMacro( RscExpression * pExpression ){ + if( pExp ) + delete pExp; + pExp = pExpression; + pExp->Evaluate( &lId ); +} + +void RscDefine::ChangeMacro( long lIdentifier ){ + if( pExp ){ + delete pExp; + pExp = NULL; + } + lId = lIdentifier; +} + +/************************************************************************* +|* +|* RscDefine::Evaluate() +|* +|* Beschreibung +|* Ersterstellung MM 01.11.91 +|* Letzte Aenderung MM 01.11.91 +|* +*************************************************************************/ +BOOL RscDefine::Evaluate(){ + BOOL bRet = TRUE; + + if( pExp ) + bRet = !pExp->Evaluate( &lId ); + + return bRet; +} + +/************************************************************************* +|* +|* RscDefine::Search() +|* +|* Beschreibung +|* Ersterstellung MM 11.11.91 +|* Letzte Aenderung MM 11.11.91 +|* +*************************************************************************/ +RscDefine * RscDefine::Search( const char * pStr ){ + return (RscDefine *)StringNode::Search( pStr ); +} + +/************************************************************************* +|* +|* RscDefine::GetMacro() +|* +|* Beschreibung +|* Ersterstellung MM 01.11.91 +|* Letzte Aenderung MM 01.11.91 +|* +*************************************************************************/ +ByteString RscDefine::GetMacro() +{ + if( pExp ) + return pExp->GetMacro(); + return ByteString::CreateFromInt32( lId ); +} + +/****************** R s c D e f i n e L i s t ****************************/ +/************************************************************************* +|* +|* RscDefineList::New() +|* +|* Beschreibung +|* Ersterstellung MM 04.11.91 +|* Letzte Aenderung MM 04.11.91 +|* +*************************************************************************/ +RscDefine * RscDefineList::New( ULONG lFileKey, const ByteString & rDefName, + long lDefId, ULONG lPos ) +{ + RscDefine * pDef; + + pDef = new RscDefine( lFileKey, rDefName, lDefId ); + pDef->IncRef(); + Insert( pDef, lPos ); + return pDef; +} + +RscDefine * RscDefineList::New( ULONG lFileKey, const ByteString & rDefName, + RscExpression * pExpression, ULONG lPos ) +{ + RscDefine * pDef; + + pDef = new RscDefine( lFileKey, rDefName, pExpression ); + pDef->IncRef(); + Insert( pDef, lPos ); + + return pDef; +} + +/************************************************************************* +|* +|* RscDefineList::Remove() +|* +|* Beschreibung +|* Ersterstellung MM 04.11.91 +|* Letzte Aenderung MM 04.11.91 +|* +*************************************************************************/ +BOOL RscDefineList::Remove( RscDefine * pDef ){ + pDef = RscSubDefList::Remove( pDef ); + if( pDef ){ + pDef->DefineToNumber(); + pDef->DecRef(); + } + + return( NULL != pDef ); +} + +BOOL RscDefineList::Remove( ULONG lIndex ){ + RscDefine * pDef = RscSubDefList::Remove( lIndex ); + if( pDef ){ + pDef->DefineToNumber(); + pDef->DecRef(); + } + + return( NULL != pDef ); +} + +BOOL RscDefineList::Remove(){ + RscDefine * pDef; + + pDef = RscSubDefList::Remove( (ULONG)0 ); + + if( pDef ){ + pDef->DefineToNumber(); + pDef->DecRef(); + } + return( NULL != pDef ); +} + +/************************************************************************* +|* +|* RscDefineList::Befor() +|* +|* Beschreibung +|* Ersterstellung MM 12.11.91 +|* Letzte Aenderung MM 12.11.91 +|* +*************************************************************************/ +BOOL RscDefineList::Befor( const RscDefine * pFree, + const RscDefine * pDepend ) +{ + RscDefine * pDef; + + pDef = First(); + while( pDef ){ + if( pDef == pFree ){ + pDef = Next(); + while( pDef ){ + if( pDef == pDepend ) + return TRUE; + pDef = Next(); + } + } + pDef = Next(); + }; + return FALSE; +} + +/************************************************************************* +|* +|* RscDefineList::WriteAll() +|* +|* Beschreibung +|* Ersterstellung MM 28.10.91 +|* Letzte Aenderung MM 28.10.91 +|* +*************************************************************************/ +void RscDefineList::WriteAll( FILE * fOutput ) +{ + RscDefine * pDefEle = First(); + + while( pDefEle ) + { + fprintf( fOutput, "#define %s %s\n", + pDefEle->GetName().GetBuffer(), + pDefEle->GetMacro().GetBuffer() ); + pDefEle = Next(); + }; +} + +/****************** R s c E x p T y p e **********************************/ +/************************************************************************* +|* +|* RscExpType::Evaluate() +|* +|* Beschreibung +|* Ersterstellung MM 01.11.91 +|* Letzte Aenderung MM 01.11.91 +|* +*************************************************************************/ +BOOL RscExpType::Evaluate( long * plValue ) const{ + if( IsDefinition() ){ + aExp.pDef->Evaluate(); + // Eventuellen Fehler ignorieren + *plValue = aExp.pDef->GetNumber(); + } + else if( IsExpression() ) + return( aExp.pExp->Evaluate( plValue ) ); + else if( IsNothing() ) + *plValue = 0; + else + *plValue = GetLong(); + + return TRUE; +} + +/************************************************************************* +|* +|* RscExpType::GetMacro() +|* +|* Beschreibung +|* Ersterstellung MM 01.11.91 +|* Letzte Aenderung MM 01.11.91 +|* +*************************************************************************/ +void RscExpType::GetMacro( ByteString & rStr ) const +{ + ByteString aStr; + + if( IsDefinition() ) + { + rStr += aExp.pDef->GetName(); + } + else if( IsExpression() ) + rStr += aExp.pExp->GetMacro(); + else if( IsNumber() ) + rStr += ByteString::CreateFromInt32( GetLong() ); +} + + +/****************** R s c E x p r e s s i o n ****************************/ +/************************************************************************* +|* +|* RscExpression::RscExpression() +|* +|* Beschreibung +|* Ersterstellung MM 01.11.91 +|* Letzte Aenderung MM 01.11.91 +|* +*************************************************************************/ +RscExpression::RscExpression( RscExpType aLE, char cOp, RscExpType aRE ) +{ + aLeftExp = aLE; + cOperation = cOp; + aRightExp = aRE; + if( aLeftExp.IsDefinition() ) + aLeftExp.aExp.pDef->IncRef(); + if( aRightExp.IsDefinition() ) + aRightExp.aExp.pDef->IncRef(); +} + +/************************************************************************* +|* +|* RscExpression::~RscExpression() +|* +|* Beschreibung +|* Ersterstellung MM 01.11.91 +|* Letzte Aenderung MM 01.11.91 +|* +*************************************************************************/ +RscExpression::~RscExpression(){ + if( aLeftExp.IsDefinition() ) + aLeftExp.aExp.pDef->DecRef(); + else if( aLeftExp.IsExpression() ) + delete aLeftExp.aExp.pExp; + + if( aRightExp.IsDefinition() ) + aRightExp.aExp.pDef->DecRef(); + else if( aRightExp.IsExpression() ) + delete aRightExp.aExp.pExp; +} + +/************************************************************************* +|* +|* RscExpression::Evaluate() +|* +|* Beschreibung +|* Ersterstellung MM 01.11.91 +|* Letzte Aenderung MM 01.11.91 +|* +*************************************************************************/ +BOOL RscExpression::Evaluate( long * plValue ){ + long lLeft; + long lRight; + + // linken und rechten Zweig auswerten + if( aLeftExp.Evaluate( &lLeft ) && aRightExp.Evaluate( &lRight ) ){ + if( cOperation == '&' ) + *plValue = lLeft & lRight; + else if( cOperation == '|' ) + *plValue = lLeft | lRight; + else if( cOperation == '+' ) + *plValue = lLeft + lRight; + else if( cOperation == '-' ) + *plValue = lLeft - lRight; + else if( cOperation == '*' ) + *plValue = lLeft * lRight; + else if( cOperation == 'r' ) + *plValue = lLeft >> lRight; + else if( cOperation == 'l' ) + *plValue = lLeft << lRight; + else{ + if( 0L == lRight ) + return FALSE; + *plValue = lLeft / lRight; + }; + return TRUE; + } + return FALSE; +} + +/************************************************************************* +|* +|* RscExpression::GetMacro() +|* +|* Beschreibung +|* Ersterstellung MM 01.11.91 +|* Letzte Aenderung MM 01.11.91 +|* +*************************************************************************/ +ByteString RscExpression::GetMacro() +{ + ByteString aLeft; + + // Ausgabeoptimierung + if( aLeftExp.IsNothing() ) + { + if ( '-' == cOperation ) + { + aLeft += '('; + aLeft += '-'; + } + aRightExp.GetMacro( aLeft ); + if( '-' == cOperation ) + aLeft += ')'; + } + else if( aRightExp.IsNothing() ) + aLeftExp.GetMacro( aLeft ); + else{ + aLeft += '('; + // linken Zweig auswerten + aLeftExp.GetMacro( aLeft ); + + aLeft += cOperation; + + aLeft += '('; + // rechten Zweig auswerten + aRightExp.GetMacro( aLeft ); + aLeft += ')'; + + aLeft += ')'; + } + + return aLeft; +} + +/****************** R s c F i l e ****************************************/ +/************************************************************************* +|* +|* RscFile::RscFile() +|* +|* Beschreibung +|* Ersterstellung MM 04.11.91 +|* Letzte Aenderung MM 04.11.91 +|* +*************************************************************************/ +RscFile :: RscFile(){ + bLoaded = FALSE; + bIncFile = FALSE; + bDirty = FALSE; + bScanned = FALSE; +} + +/************************************************************************* +|* +|* RscFile::~RscFile() +|* +|* Beschreibung +|* Ersterstellung MM 04.11.91 +|* Letzte Aenderung MM 04.11.91 +|* +*************************************************************************/ +RscFile :: ~RscFile(){ + RscDepend * pDep = Remove( (ULONG)0 ); + + while( pDep ){ + delete pDep; + pDep = Remove( (ULONG)0 ); + } + + //von hinten nach vorne ist besser wegen der Abhaengigkeiten + //Objekte zerstoeren sich, wenn Referenzzaehler NULL + aDefLst.Last(); + while( aDefLst.Remove() ); +} + +/************************************************************************* +|* +|* RscFile::Depend() +|* +|* Beschreibung Diese Methode gibt TRUE zurueck, wenn lDepend +|* existiert und hinter lFree steht, oder wenn +|* lDepend nicht existiert. +|* Ersterstellung MM 12.11.91 +|* Letzte Aenderung MM 12.11.91 +|* +*************************************************************************/ +BOOL RscFile::Depend( ULONG lDepend, ULONG lFree ){ + RscDepend * pDep; + + pDep = Last(); + while( pDep ){ + if( pDep->GetFileKey() == lDepend ){ + while( pDep ){ + if( pDep->GetFileKey() == lFree ) + return TRUE; + pDep = Prev(); + } + return FALSE; + } + pDep = Prev(); + }; + + return TRUE; +} + +/************************************************************************* +|* +|* RscFile::InsertDependFile() +|* +|* Beschreibung +|* Ersterstellung MM 06.01.92 +|* Letzte Aenderung MM 06.01.92 +|* +*************************************************************************/ +BOOL RscFile :: InsertDependFile( ULONG lIncFile, ULONG lPos ) +{ + RscDepend * pDep; + + pDep = First(); + while( pDep ){ + if( pDep->GetFileKey() == lIncFile ) + return TRUE; + pDep = Next(); + } + + // Current-Zeiger steht auf letztem Element + if( lPos >= Count() ){ //letztes Element muss immer letztes bleiben + // Abhaengigkeit vor der letzten Position eintragen + Insert( new RscDepend( lIncFile ) ); + } + else + Insert( new RscDepend( lIncFile ), lPos ); + + return TRUE; +} + +/************************************************************************* +|* +|* RscFile::RemoveDependFile() +|* +|* Beschreibung +|* Ersterstellung MM 18.11.91 +|* Letzte Aenderung MM 18.11.91 +|* +*************************************************************************/ +void RscFile :: RemoveDependFile( ULONG lDepFile ) +{ + + RscDepend * pDep = Last(); + + while( pDep ){ + if( pDep->GetFileKey() == lDepFile ){ + Remove( pDep ); + delete pDep; + } + pDep = Prev(); + } +} + +/****************** R s c D e f T r e e **********************************/ +/************************************************************************* +|* +|* RscDefTree::~RscDefTree() +|* +|* Beschreibung +|* Ersterstellung MM 12.11.91 +|* Letzte Aenderung MM 12.11.91 +|* +*************************************************************************/ +RscDefTree::~RscDefTree(){ + Remove(); +} + +/************************************************************************* +|* +|* RscDefTree::Remove() +|* +|* Beschreibung +|* Ersterstellung MM 12.11.91 +|* Letzte Aenderung MM 12.11.91 +|* +*************************************************************************/ +void RscDefTree::Remove(){ + RscDefine * pDef; + while( pDefRoot ){ + pDef = pDefRoot; + pDefRoot = (RscDefine *)pDefRoot->Remove( pDefRoot ); + pDef->DecRef(); + } +} + +/************************************************************************* +|* +|* RscDefTree::~Search() +|* +|* Beschreibung +|* Ersterstellung MM 12.11.91 +|* Letzte Aenderung MM 12.11.91 +|* +*************************************************************************/ +RscDefine * RscDefTree::Search( const char * pName ){ + if( pDefRoot ) + return pDefRoot->Search( pName ); + return NULL; +} + +/************************************************************************* +|* +|* RscDefTree::Insert() +|* +|* Beschreibung +|* Ersterstellung MM 12.11.91 +|* Letzte Aenderung MM 12.11.91 +|* +*************************************************************************/ +void RscDefTree::Insert( RscDefine * pDef ){ + if( pDefRoot ) + pDefRoot->Insert( pDef ); + else + pDefRoot = pDef; + pDef->IncRef(); +} + +/************************************************************************* +|* +|* RscDefTree::Remove() +|* +|* Beschreibung +|* Ersterstellung MM 12.11.91 +|* Letzte Aenderung MM 12.11.91 +|* +*************************************************************************/ +void RscDefTree::Remove( RscDefine * pDef ){ + if( pDefRoot ){ + //falls pDef == pDefRoot + pDefRoot = (RscDefine *)pDefRoot->Remove( pDef ); + } + pDef->DecRef(); +} + +/************************************************************************* +|* +|* RscDefTree::Evaluate() +|* +|* Beschreibung +|* Ersterstellung MM 12.11.91 +|* Letzte Aenderung MM 12.11.91 +|* +*************************************************************************/ +BOOL RscDefTree::Evaluate( RscDefine * pDef ){ + if( pDef ){ + if( !Evaluate( (RscDefine *)pDef->Left() ) ) + return FALSE; + if( !Evaluate( (RscDefine *)pDef->Right() ) ) + return FALSE; + }; + return TRUE; +} + +BOOL RscDefTree::Evaluate(){ + return Evaluate( pDefRoot ); +} + +/****************** R s c F i l e T a b **********************************/ +/************************************************************************* +|* +|* RscFileTab::RscFileTab() +|* +|* Beschreibung +|* Ersterstellung MM 07.11.91 +|* Letzte Aenderung MM 07.11.91 +|* +*************************************************************************/ +RscFileTab::RscFileTab(){ +} + +/************************************************************************* +|* +|* RscFileTab::~RscFileTab() +|* +|* Beschreibung +|* Ersterstellung MM 04.11.91 +|* Letzte Aenderung MM 04.11.91 +|* +*************************************************************************/ +RscFileTab :: ~RscFileTab(){ + RscFile * pFile; + + aDefTree.Remove(); + + pFile = Last(); + while( pFile ){ + Remove( GetIndex( pFile ) ); + delete pFile; + pFile = Prev(); + }; +} + +/************************************************************************* +|* +|* RscFileTab::Find() +|* +|* Beschreibung +|* Ersterstellung MM 16.05.91 +|* Letzte Aenderung MM 16.05.91 +|* +*************************************************************************/ +ULONG RscFileTab :: Find( const ByteString & rName ) +{ + RscFile * pFName; + + pFName = First(); + while( pFName && (pFName->aFileName != rName) ) + pFName = Next(); + + if( pFName ) + return( GetIndex( pFName ) ); + else + return( NOFILE_INDEX ); +} + +/************************************************************************* +|* +|* RscFileTab::FindDef() +|* +|* Beschreibung +|* Ersterstellung MM 30.10.91 +|* Letzte Aenderung MM 01.11.91 +|* +*************************************************************************/ +RscDefine * RscFileTab::FindDef( const char * pName ){ + return aDefTree.Search( pName ); +} + +/************************************************************************* +|* +|* RscFileTab::FindDef() +|* +|* Beschreibung +|* Ersterstellung MM 30.10.91 +|* Letzte Aenderung MM 01.11.91 +|* +*************************************************************************/ +RscDefine * RscFileTab::FindDef( ULONG lFileKey, const ByteString & rName ) +{ + RscDefine * pDef = FindDef( rName ); + + if( pDef ) + //befindet sich das DEFINE in einer Include-Datei in der + //Datei lFileKey + if( Depend( lFileKey, pDef->GetFileKey() ) ) + return pDef; + return NULL; +} + +/************************************************************************* +|* +|* RscFileTab::Depend() +|* +|* Beschreibung +|* Ersterstellung MM 08.11.91 +|* Letzte Aenderung MM 08.11.91 +|* +*************************************************************************/ +BOOL RscFileTab::Depend( ULONG lDepend, ULONG lFree ){ + if( lDepend == lFree ) + return TRUE; + + RscFile * pFile = First(); + while( pFile ){ + if( !pFile->IsIncFile() ){ + if( !pFile->Depend( lDepend, lFree ) ) + return FALSE; + }; + pFile = Next(); + }; + + return TRUE; +} + +/************************************************************************* +|* +|* RscFileTab::TestDef() +|* +|* Beschreibung +|* Ersterstellung MM 14.01.92 +|* Letzte Aenderung MM 14.01.92 +|* +*************************************************************************/ +BOOL RscFileTab::TestDef( ULONG lFileKey, ULONG lPos, + const RscDefine * pDefDec ) +{ + if( lFileKey == pDefDec->GetFileKey() ){ + RscFile * pFile = GetFile( pDefDec->GetFileKey() ); + if( pFile && (lPos <= pFile->aDefLst.GetPos( (RscDefine *)pDefDec )) + && (lPos != LIST_APPEND) ) + return FALSE; + } + else if( !Depend( lFileKey, pDefDec->GetFileKey() ) ) + return FALSE; + + return TestDef( lFileKey, lPos, pDefDec->pExp ); +} + +/************************************************************************* +|* +|* RscFileTab::TestDef() +|* +|* Beschreibung +|* Ersterstellung MM 14.01.92 +|* Letzte Aenderung MM 14.01.92 +|* +*************************************************************************/ +BOOL RscFileTab::TestDef( ULONG lFileKey, ULONG lPos, + const RscExpression * pExpDec ) +{ + if( !pExpDec ) + return TRUE; + + if( pExpDec->aLeftExp.IsExpression() ) + if( !TestDef( lFileKey, lPos, pExpDec->aLeftExp.aExp.pExp ) ) + return FALSE; + + if( pExpDec->aLeftExp.IsDefinition() ) + if( !TestDef( lFileKey, lPos, pExpDec->aLeftExp.aExp.pDef ) ) + return FALSE; + + if( pExpDec->aRightExp.IsExpression() ) + if( !TestDef( lFileKey, lPos, pExpDec->aRightExp.aExp.pExp ) ) + return FALSE; + + if( pExpDec->aRightExp.IsDefinition() ) + if( !TestDef( lFileKey, lPos, pExpDec->aRightExp.aExp.pDef ) ) + return FALSE; + + return TRUE; +} + +/************************************************************************* +|* +|* RscFileTab::NewDef() +|* +|* Beschreibung +|* Ersterstellung MM 04.11.91 +|* Letzte Aenderung MM 04.11.91 +|* +*************************************************************************/ +RscDefine * RscFileTab::NewDef( ULONG lFileKey, const ByteString & rDefName, + long lId, ULONG lPos ) +{ + RscDefine * pDef = FindDef( rDefName ); + + if( !pDef ){ + RscFile * pFile = GetFile( lFileKey ); + + if( pFile ){ + pDef = pFile->aDefLst.New( lFileKey, rDefName, lId, lPos ); + aDefTree.Insert( pDef ); + } + } + else + pDef = NULL; + + return( pDef ); +} + +/************************************************************************* +|* +|* RscFileTab::NewDef() +|* +|* Beschreibung +|* Ersterstellung MM 04.11.91 +|* Letzte Aenderung MM 04.11.91 +|* +*************************************************************************/ +RscDefine * RscFileTab::NewDef( ULONG lFileKey, const ByteString & rDefName, + RscExpression * pExp, ULONG lPos ) +{ + RscDefine * pDef = FindDef( rDefName ); + + if( !pDef ){ + //Macros in den Expressions sind definiert ? + if( TestDef( lFileKey, lPos, pExp ) ){ + RscFile * pFile = GetFile( lFileKey ); + + if( pFile ){ + pDef = pFile->aDefLst.New( lFileKey, rDefName, pExp, lPos ); + aDefTree.Insert( pDef ); + } + } + } + else + pDef = NULL; + + if( !pDef ){ + // pExp wird immer Eigentum und muss, wenn es nicht benoetigt wird + // geloescht werden + delete pExp; + } + return( pDef ); +} + +/************************************************************************* +|* +|* RscFileTab::IsDefUsed() +|* +|* Beschreibung +|* Ersterstellung MM 22.11.91 +|* Letzte Aenderung MM 22.11.91 +|* +*************************************************************************/ +BOOL RscFileTab::IsDefUsed( const ByteString & rDefName ) +{ + RscDefine * pDef = FindDef( rDefName ); + + if( pDef ) + return( pDef->GetRefCount() != 2 ); + + return FALSE; +} + +/************************************************************************* +|* +|* RscFileTab::DeleteDef() +|* +|* Beschreibung +|* Ersterstellung MM 11.11.91 +|* Letzte Aenderung MM 11.11.91 +|* +*************************************************************************/ +void RscFileTab::DeleteDef( const ByteString & rDefName ) +{ + RscDefine * pDef = FindDef( rDefName ); + RscFile * pFile; + + if( pDef ){ + pFile = GetFile( pDef->GetFileKey() ); + if( pFile ){ + aDefTree.Remove( pDef ); + pFile->aDefLst.Remove( pDef ); + } + }; +} + +/************************************************************************* +|* +|* RscFileTab::ChangeDef() +|* +|* Beschreibung +|* Ersterstellung MM 04.11.91 +|* Letzte Aenderung MM 11.11.91 +|* +*************************************************************************/ +BOOL RscFileTab::ChangeDef( const ByteString & rDefName, long lId ) +{ + RscDefine * pDef = FindDef( rDefName ); + + if( pDef ){ + pDef->ChangeMacro( lId ); + //alle Macros neu bewerten + return aDefTree.Evaluate(); + }; + return( FALSE ); +} + +/************************************************************************* +|* +|* RscFileTab::ChangeDef() +|* +|* Beschreibung +|* Ersterstellung MM 04.11.91 +|* Letzte Aenderung MM 11.11.91 +|* +*************************************************************************/ +BOOL RscFileTab::ChangeDef( const ByteString & rDefName, + RscExpression * pExp ) +{ + RscDefine * pDef = FindDef( rDefName ); + RscFile * pFile; + ULONG lPos; + + if( pDef ){ + pFile = GetFile( pDef->GetFileKey() ); + if( pFile ) + lPos = pFile->aDefLst.GetPos( pDef ); + //Macros in den Expressions sind definiert ? + if( TestDef( pDef->GetFileKey(), lPos, pExp ) ){ + pDef->ChangeMacro( pExp ); + //alle Macros neu bewerten + return aDefTree.Evaluate(); + } + }; + + // pExp wird immer Eigentum und muss, wenn es nicht benoetigt wird + // geloescht werden + delete pExp; + + return( FALSE ); +} + +/************************************************************************* +|* +|* RscFileTab::ChangeDefName() +|* +|* Beschreibung +|* Ersterstellung MM 04.11.91 +|* Letzte Aenderung MM 04.11.91 +|* +*************************************************************************/ +BOOL RscFileTab::ChangeDefName( const ByteString & rDefName, + const ByteString & rNewName ) +{ + RscDefine * pDef = FindDef( rDefName ); + + //Name gefunden ? + if( pDef ){ + // und neuer Name noch nicht bekannt ? + if( !FindDef( pDef->GetFileKey(), rNewName ) ){ + aDefTree.Remove( pDef ); + pDef->SetName( rNewName ); + aDefTree.Insert( pDef ); + return( TRUE ); + } + }; + + return( FALSE ); +} + +/************************************************************************* +|* +|* RscFileTab::DeleteFileContext() +|* +|* Beschreibung +|* Ersterstellung MM 09.12.91 +|* Letzte Aenderung MM 09.12.91 +|* +*************************************************************************/ +void RscFileTab :: DeleteFileContext( ULONG lFileKey ){ + RscFile * pFName; + + pFName = GetFile( lFileKey ); + if( pFName ){ + RscDefine * pDef; + + pDef = pFName->aDefLst.First(); + while( pDef ){ + aDefTree.Remove( pDef ); + pDef = pFName->aDefLst.Next(); + }; + while( pFName->aDefLst.Remove( (ULONG)0 ) ); + } +} + +/************************************************************************* +|* +|* RscFileTab::DeleteFile() +|* +|* Beschreibung +|* Ersterstellung MM 16.05.91 +|* Letzte Aenderung MM 16.05.91 +|* +*************************************************************************/ +void RscFileTab :: DeleteFile( ULONG lFileKey ){ + RscFile * pFName; + + //Defines freigeben + DeleteFileContext( lFileKey ); + + //Schleife ueber alle Abhaengigkeiten + pFName = First(); + while( pFName ){ + pFName->RemoveDependFile( lFileKey ); + pFName = Next(); + }; + + pFName = Remove( lFileKey ); + if( pFName ) + delete pFName; +} + +/************************************************************************* +|* +|* RscFileTab::NewCodeFile() +|* +|* Beschreibung +|* Ersterstellung MM 16.05.91 +|* Letzte Aenderung MM 16.05.91 +|* +*************************************************************************/ +ULONG RscFileTab :: NewCodeFile( const ByteString & rName ) +{ + ULONG lKey; + RscFile * pFName; + + lKey = Find( rName ); + if( UNIQUEINDEX_ENTRY_NOTFOUND == lKey ) + { + pFName = new RscFile(); + pFName->aFileName = rName; + pFName->aPathName = rName; + lKey = Insert( pFName ); + pFName->InsertDependFile( lKey, LIST_APPEND ); + } + return lKey; +} + +/************************************************************************* +|* +|* RscFileTab::NewIncFile() +|* +|* Beschreibung +|* Ersterstellung MM 16.05.91 +|* Letzte Aenderung MM 16.05.91 +|* +*************************************************************************/ +ULONG RscFileTab :: NewIncFile( const ByteString & rName, + const ByteString & rPath ) +{ + ULONG lKey; + RscFile * pFName; + + lKey = Find( rName ); + if( UNIQUEINDEX_ENTRY_NOTFOUND == lKey ) + { + pFName = new RscFile(); + pFName->aFileName = rName; + pFName->aPathName = rPath; + pFName->SetIncFlag(); + lKey = Insert( pFName ); + pFName->InsertDependFile( lKey, LIST_APPEND ); + } + return lKey; +} diff --git a/rsc/source/tools/rschash.cxx b/rsc/source/tools/rschash.cxx new file mode 100644 index 000000000000..c47b078db082 --- /dev/null +++ b/rsc/source/tools/rschash.cxx @@ -0,0 +1,440 @@ +/************************************************************************* + * + * $RCSfile: rschash.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $ + * + * 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/tools/rschash.cxx,v 1.1.1.1 2000-09-18 16:42:56 hr Exp $ + + Source Code Control System - Update + + $Log: not supported by cvs2svn $ + Revision 1.7 2000/09/17 12:51:12 willem.vandorp + OpenOffice header added. + + Revision 1.6 2000/07/26 17:13:24 willem.vandorp + Headers/footers replaced + + Revision 1.5 1997/08/27 18:17:52 MM + neue Headerstruktur + + + Rev 1.4 27 Aug 1997 18:17:52 MM + neue Headerstruktur + + Rev 1.3 21 Nov 1995 19:50:48 TLX + Neuer Link + + Rev 1.2 25 Aug 1993 15:31:02 mm + Fehler und Warnings beseitigt + + Rev 1.1 03 Jun 1993 15:45:48 mm + Fehler in Test_HashId verbessert + + Rev 1.0 10 Aug 1992 07:18:56 MM + Initial revision. + + Rev 1.6 23 Mar 1992 15:25:54 MM + + Rev 1.5 26 Nov 1991 08:42:22 MM + Methode Test mit char* und void* Argument + + Rev 1.4 11 Sep 1991 12:40:52 MM + + Rev 1.3 31 Jul 1991 15:37:10 MM + + Rev 1.2 24 Jul 1991 10:10:52 MM + Ausgabe auskommentiert + + Rev 1.1 18 Jul 1991 12:55:24 MM + Fehler mit (BOOL) beseitigt + + Rev 1.0 14 Jun 1991 16:20:56 MM + Initial revision. + + Rev 1.2 22 Mar 1991 11:41:44 MM + + Rev 1.1 25 Feb 1991 13:47:12 MM + + Rev 1.0 08 Feb 1991 13:12:06 MM + Initial revision. + +**************************************************************************/ +/****************** I N C L U D E S **************************************/ +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <ctype.h> + +// Programmabh„ngige Includes. +#ifndef _RSCHASH_HXX +#include <rschash.hxx> +#endif + +/****************** C O D E **********************************************/ +/************************************************************************* +|* +|* HashTabel::HashTabel() +|* +|* Beschreibung HASHTAB.DOC +|* Ersterstellung MM 20.03.90 +|* Letzte Aenderung MM 27.06.90 +|* +*************************************************************************/ +HashTabel :: HashTabel( USHORT nMaxEntries ){ + nMax = nMaxEntries; // set max entries + nFill = 0; // no entries + lTry = 0; + lAsk = 0; +} + +/************************************************************************* +|* +|* HashTabel::~HashTabel() +|* +|* Beschreibung +|* Ersterstellung MM 17.07.91 +|* Letzte Aenderung MM 17.07.91 +|* +*************************************************************************/ +HashTabel :: ~HashTabel(){ +#ifdef DOS +/* + printf( "Maximum: %d, Fuellung: %d\n", nMax, nFill ); + printf( "Anfragen: %ld, Versuche: %ld", lAsk, lTry ); + if( lTry != 0 ) + printf( ", V/E = %ld\n", lTry / lAsk ); +*/ +#endif +} + +/************************************************************************* +|* +|* HashTabel::Test_Insert() +|* +|* Beschreibung HASHTAB.DOC +|* Ersterstellung MM 20.03.90 +|* Letzte Aenderung MM 27.06.90 +|* +*************************************************************************/ +HASHID HashTabel::Test_Insert( const void * pElement, BOOL bInsert ) +{ + USHORT nHash; + USHORT nIndex; + USHORT nLoop; + + lAsk++; + lTry++; + + nHash = HashFunc( pElement ); + nIndex = nHash % nMax; + + nLoop = 0; // divide to range + while( (nMax != nLoop) && IsEntry( nIndex ) ) + { // is place occupied + if( EQUAL == Compare( pElement, nIndex ) ) // is element in tabel + return( nIndex ); // place of Element + nLoop++; + lTry++; + nIndex = (USHORT)(nIndex + nHash + 7) % nMax; + } + + if( bInsert ) + { + if( nMax == nLoop ) // is tabel full + RscExit( 11 ); + nFill++; + return( nIndex ); // return free place + } + return( HASH_NONAME ); +} + +/************************************************************************* +|* +|* HashTabel::Test() +|* +|* Beschreibung HASHTAB.DOC +|* Ersterstellung MM 15.05.91 +|* Letzte Aenderung MM 15.05.91 +|* +*************************************************************************/ +HASHID HashTabel::Test( const void * pElement ){ + return( Test_Insert( pElement, FALSE ) ); +} + +/************************************************************************* +|* +|* HashTabel::Insert() +|* +|* Beschreibung HASHTAB.DOC +|* Ersterstellung MM 20.03.90 +|* Letzte Aenderung MM 27.06.90 +|* +*************************************************************************/ +HASHID HashTabel::Insert( const void * pElement ){ +// return free place in Tabel or the place, if Element is in the tabel + return( Test_Insert( pElement, TRUE ) ); +} + +/************************************************************************* +|* +|* HashString::HashString() +|* +|* Beschreibung HASHTAB.DOC +|* Ersterstellung MM 20.03.90 +|* Letzte Aenderung MM 27.06.90 +|* +*************************************************************************/ +HashString::HashString( USHORT nMaxEntries ) : HashTabel( nMaxEntries ){ + if( (long)nMaxEntries * sizeof( char * ) >= 0x10000 ){ + // can't allocate more then 64k - 1 Bytes + RscExit( 12 ); + } + // allocate + + ppStr = (char **)RscMem::Malloc( nMaxEntries * sizeof( char * ) ); + + memset( ppStr, 0, nMaxEntries * sizeof( char * ) ); + paSC = new StringCon( (USHORT)40000 ); +} + +/************************************************************************* +|* +|* ~HashString::HashString() +|* +|* Beschreibung HASHTAB.DOC +|* Ersterstellung MM 02.06.91 +|* Letzte Aenderung MM 02.06.91 +|* +*************************************************************************/ +HashString::~HashString(){ + delete paSC; + RscMem::Free( (void *)ppStr ); +} + +/************************************************************************* +|* +|* HashString::HashFunc() +|* +|* Beschreibung HASHTAB.DOC +|* Ersterstellung MM 20.03.90 +|* Letzte Aenderung MM 27.06.90 +|* +*************************************************************************/ +USHORT HashString :: HashFunc( const void * pElement ){ + const char *pStr; + USHORT nHash = 0; // hash value + + pStr = (const char *)pElement; + while( *pStr ){ + nHash ^= toupper( *pStr ) - 'A'; + if( *++pStr ){ + nHash ^= (toupper( *pStr ) - 'A') << 4; + if( *++pStr ) + nHash ^= (toupper( *pStr ) - 'A') << 8; + } + } + return( nHash ); +} + +/************************************************************************* +|* +|* HashString::IsEntry() +|* +|* Beschreibung HASHTAB.DOC +|* Ersterstellung MM 20.03.90 +|* Letzte Aenderung MM 27.06.90 +|* +*************************************************************************/ +BOOL HashString :: IsEntry( HASHID nIndex ){ +// return TRUE if place is occupied +// return FALSE if place is FREE + // ppStr[ nIndex ] == pointer to stringtabel + return( NULL != ppStr[ nIndex ] ); +} + +/************************************************************************* +|* +|* HashString::Insert() +|* +|* Beschreibung HASHTAB.DOC +|* Ersterstellung MM 20.03.90 +|* Letzte Aenderung MM 27.06.90 +|* +*************************************************************************/ +HASHID HashString :: Insert( const char * pElement ){ + HASHID nIndex; + + nIndex = HashTabel::Insert( (const void *)pElement ); + if( !IsEntry( nIndex ) )// is place not occupied ? + // put string in the string tabel + ppStr[ nIndex ] = paSC->Put( pElement ); + return( nIndex ); +} + +/************************************************************************* +|* +|* HashString::Test() +|* +|* Beschreibung +|* Ersterstellung MM 05.11.91 +|* Letzte Aenderung MM 05.11.91 +|* +*************************************************************************/ +HASHID HashString :: Test( const char * pElement ){ + return HashTabel::Test( (const void *)pElement ); +} + +/************************************************************************* +|* +|* HashString::Get() +|* +|* Beschreibung HASHTAB.DOC +|* Ersterstellung MM 20.03.90 +|* Letzte Aenderung MM 27.06.90 +|* +*************************************************************************/ +char * HashString :: Get( HASHID nIndex ){ +// return pointer to string + if( nIndex != HASH_NONAME ) + return( ppStr[ nIndex ] ); + else + return( NULL ); +} + +/************************************************************************* +|* +|* HashString::Get() +|* +|* Beschreibung HASHTAB.DOC +|* Ersterstellung MM 20.03.90 +|* Letzte Aenderung MM 27.06.90 +|* +*************************************************************************/ +COMPARE HashString :: Compare( const void * pElement, HASHID nIndex ){ + short nCmp; // Vergleichsresultat + + nCmp = rsc_stricmp( (const char *)pElement, ppStr[ nIndex ] ); + + if( 0 < nCmp ) + return( GREATER ); + else if( 0 == nCmp ) + return( EQUAL ); + else + return( LESS ); +} + +/************************************************************************* +|* +|* StringCon::StringCon() +|* +|* Beschreibung HASHTAB.DOC +|* Ersterstellung MM 20.03.90 +|* Letzte Aenderung MM 27.06.90 +|* +*************************************************************************/ +StringCon::StringCon( USHORT nMaxEntries ){ + // allocate character field + pField = (char * )RscMem::Malloc( nMaxEntries ); + + nMax = nMaxEntries; // set maximum of characters + nFill = 0; // no character in tabel +} + +/************************************************************************* +|* +|* StringCon::~StringCon() +|* +|* Beschreibung HASHTAB.DOC +|* Ersterstellung MM 02.06.91 +|* Letzte Aenderung MM 02.06.91 +|* +*************************************************************************/ +StringCon::~StringCon(){ + // free character field + RscMem::Free( pField ); +} + +/************************************************************************* +|* +|* StringCon::Put() +|* +|* Beschreibung HASHTAB.DOC +|* Ersterstellung MM 20.03.90 +|* Letzte Aenderung MM 27.06.90 +|* +*************************************************************************/ +char * StringCon :: Put( const char * pStr ) +{ +// put string into the tabel + char * pReturn = pField + nFill; // set return value + + while( nMax > (USHORT)(nFill +1) && *pStr ) // strcpy in tabel + pField[ nFill++ ] = *pStr++; + if( nMax == nFill +1 ){ // buffer overflow ? + RscExit( 13 ); + } + else + pField[ nFill++ ] = '\0'; // terminate with zero. + + return( pReturn ); // return pointer to string +} diff --git a/rsc/source/tools/rsctools.cxx b/rsc/source/tools/rsctools.cxx new file mode 100644 index 000000000000..dd8b545442df --- /dev/null +++ b/rsc/source/tools/rsctools.cxx @@ -0,0 +1,656 @@ +/************************************************************************* + * + * $RCSfile: rsctools.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $ + * + * 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/tools/rsctools.cxx,v 1.1.1.1 2000-09-18 16:42:56 hr Exp $ + + Source Code Control System - Update + + $Log: not supported by cvs2svn $ + Revision 1.32 2000/09/17 12:51:12 willem.vandorp + OpenOffice header added. + + Revision 1.31 2000/09/07 04:30:57 patrick.luby + Replaced tempnam() with tmpnam() as tempnam() keeps returning the same file name on Mac OS X. + + Revision 1.30 2000/07/26 17:13:24 willem.vandorp + Headers/footers replaced + + Revision 1.29 2000/07/11 17:17:46 th + Unicode + + Revision 1.28 1999/12/08 15:33:51 mh + tmp file not in actual directory + + Revision 1.27 1999/09/21 17:08:45 mm + Bigendian correct + +**************************************************************************/ +/****************** I N C L U D E S **************************************/ + +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> +#if defined ( DOS ) || defined ( WIN ) || defined (WNT ) +#include <direct.h> +#endif +#if defined ( OS2 ) && !defined ( GCC ) +#include <direct.h> +#endif +#include <string.h> +#include <ctype.h> +#ifdef MAC +#include <cursorctl.h> +#endif + +#include <tools/fsys.hxx> + +// Include +#ifndef _RSCDEF_HXX +#include <rscdef.hxx> +#endif +#ifndef _RSCTOOLS_HXX +#include <rsctools.hxx> +#endif + +#if defined (WIN) || defined (MAC) +#define ONLY_NEW +#endif + +/****************** C o d e **********************************************/ +/************************************************************************* +|* +|* rsc_strnicmp() +|* +|* Beschreibung Vergleicht zwei Strings Case-Unabhaengig bis zu +|* einer bestimmten Laenge +|* Ersterstellung MM 13.02.91 +|* Letzte Aenderung MM 13.02.91 +|* +*************************************************************************/ +int rsc_strnicmp( const char *string1, const char *string2, size_t count ) +{ + size_t i; + + for( i = 0; ( i < count ) && string1[ i ] && string2[ i ] ; i++ ) + { + if( tolower( string1[ i ] ) < tolower( string2[ i ] ) ) + return( -1 ); + else if( tolower( string1[ i ] ) > tolower( string2[ i ] ) ) + return( 1 ); + } + if( i == count ) + return( 0 ); + else if( tolower( string1[ i ] ) < tolower( string2[ i ] ) ) + return( -1 ); + else if( tolower( string1[ i ] ) > tolower( string2[ i ] ) ) + return( 1 ); + return( 0 ); +} + +/************************************************************************* +|* +|* rsc_strnicmp() +|* +|* Beschreibung Vergleicht zwei Strings Case-Unabhaengig +|* Ersterstellung MM 13.02.91 +|* Letzte Aenderung MM 13.02.91 +|* +*************************************************************************/ +int rsc_stricmp( const char *string1, const char *string2 ){ + int i; + + for( i = 0; string1[ i ] && string2[ i ]; i++ ){ + if( tolower( string1[ i ] ) < tolower( string2[ i ] ) ) + return( -1 ); + else if( tolower( string1[ i ] ) > tolower( string2[ i ] ) ) + return( 1 ); + } + if( tolower( string1[ i ] ) < tolower( string2[ i ] ) ) + return( -1 ); + else if( tolower( string1[ i ] ) > tolower( string2[ i ] ) ) + return( 1 ); + return( 0 ); +} + +/************************************************************************* +|* +|* GetTmpFileName() +|* +|* Beschreibung Gibt einen String eines eindeutigen Dateinamens +|* zurueck. Der Speicher fuer den String wird mit +|* malloc allokiert +|* Ersterstellung MM 13.02.91 +|* Letzte Aenderung MH 13.10.97 +|* +*************************************************************************/ +ByteString GetTmpFileName() +{ + // Use tmpnam instead of tempnam as tempnam has some bugs in Mac OS X + return ByteString( tmpnam( NULL ) ); +} + +/********************************************************************/ +/* */ +/* Function : Append( ) */ +/* */ +/* Parameters : psw - pointer to a preprocessor switch */ +/* */ +/* Description : appends text files */ +/********************************************************************/ +BOOL Append( FILE * fDest, ByteString aTmpFile ) +{ +#define MAX_BUF 1000 + char szBuf[ MAX_BUF ]; + short nItems; + FILE *fSource; + + fSource = fopen( aTmpFile.GetBuffer(), "rb" ); + if( !fDest || !fSource ){ + if( fSource ) + fclose( fSource ); + return FALSE; + } + else{ + do{ // append + nItems = fread( szBuf, sizeof( char ), MAX_BUF, fSource ); + fwrite( szBuf, sizeof( char ), nItems, fDest ); + } while( MAX_BUF == nItems ); + + fclose( fSource ); + }; + return TRUE; +} + +BOOL Append( ByteString aOutputSrs, ByteString aTmpFile ) +{ + FILE * fDest = fopen( aOutputSrs.GetBuffer(), "ab" ); + + BOOL bRet = Append( fDest, aTmpFile ); + + if( fDest ) + fclose( fDest ); + + return bRet; +} + +/************************************************************************* +|* +|* InputFile +|* +|* Beschreibung Haengt Extension an, wenn keine da ist +|* Parameter: pInput, der Input-Dateiname. +|* pExt, die Extension des Ausgabenamens +|* Ersterstellung MM 13.02.91 +|* Letzte Aenderung MM 28.06.91 +|* +*************************************************************************/ +ByteString InputFile ( char * pInput, char * pExt ) +{ + UniString aUniInput( pInput, RTL_TEXTENCODING_ASCII_US ); + DirEntry aFileName( aUniInput ); + + if ( 0 == aFileName.GetExtension().Len() ) + { + UniString aExt( pExt, RTL_TEXTENCODING_ASCII_US ); + aFileName.SetExtension( aExt ); + } + + return ByteString( aFileName.GetFull(), RTL_TEXTENCODING_ASCII_US ); +} + +/************************************************************************* +|* +|* OutputFile +|* +|* Beschreibung Ersetzt Extension durch eine andere +|* Parameter: input, der Input-Dateiname. +|* pExt, die Extension des Ausgabenamens +|* Ersterstellung MM 13.02.91 +|* Letzte Aenderung MM 28.06.91 +|* +*************************************************************************/ +ByteString OutputFile ( ByteString aInput, char * pExt ) +{ + UniString aUniInput( aInput, RTL_TEXTENCODING_ASCII_US ); + DirEntry aFileName( aUniInput ); + + UniString aExt( pExt, RTL_TEXTENCODING_ASCII_US ); + aFileName.SetExtension( aExt ); + + return ByteString( aFileName.GetFull(), RTL_TEXTENCODING_ASCII_US ); +} + +/************************************************************************* +|* +|* ::ResonseFile() +|* +|* Beschreibung Kommandozeile aufbereiten +|* Ersterstellung MM 05.09.91 +|* Letzte Aenderung MM 05.09.91 +|* +*************************************************************************/ +char * ResponseFile( RscPtrPtr * ppCmd, char ** ppArgv, + USHORT nArgc ) +{ + FILE *fFile; + int nItems; + char szBuffer[4096]; // file buffer + USHORT i; + + // Programmname + ppCmd->Append( ((RscMem *)0)->Assignsw( *ppArgv, 0 ) ); + for( i = 1; i < nArgc; i++ ) + { + if( '@' == **(ppArgv +i) ){ // wenn @, dann Response-Datei + if( NULL == (fFile = fopen( (*(ppArgv +i)) +1, "r" )) ) + return( (*(ppArgv +i)) ); + + nItems = fread( &szBuffer[ 0 ], 1, sizeof( char ), fFile ); + while( nItems ) + { + if( !isspace( szBuffer[ 0 ] ) ) + { + USHORT n = 0; + while( nItems && !isspace( szBuffer[ n ] ) && + n +1 < sizeof( szBuffer ) ) + { + n++; + nItems = fread( &szBuffer[ n ], 1, + sizeof( char ), fFile ); + } + szBuffer[ n ] = '\0'; + ppCmd->Append( ((RscMem *)0)->Assignsw( szBuffer, 0 ) ); + } + nItems = fread( &szBuffer[ 0 ], 1, sizeof( char ), fFile ); + }; + + fclose( fFile ); + } + else + ppCmd->Append( ((RscMem *)0)->Assignsw( *(ppArgv +i), 0 ) ); + }; + ppCmd->Append( (void *)0 ); + return( NULL ); +} + + +/*************** R s c M e m ********************************************/ + +#ifdef DOS +class RscCount { +public: + long nCount; + RscCount(){ nCount = 0; } +// ~RscCount(){ printf( "\nMalloczaehler: %ld\n", nCount ); } +}; +RscCount aRscCount; +#endif +/************************************************************************* +|* +|* RscMem :: Malloc() +|* +|* Beschreibung Speicher allokieren +|* Ersterstellung MM 13.02.91 +|* Letzte Aenderung MM 13.02.91 +|* +*************************************************************************/ +void * RscMem :: Malloc( USHORT nSize ){ + char * pMem; + +#ifdef MAC + SpinCursor( 1 ); +#endif +#ifdef DOS + aRscCount.nCount++; +#endif +#ifdef ONLY_NEW + pMem = new char[ nSize + sizeof( USHORT ) ]; + *(USHORT *)pMem = nSize; + pMem += sizeof( USHORT ); +#else + if( NULL == (pMem = (char *)malloc( nSize )) ) + RscExit( 10 ); +#endif + return( pMem ); +} + +/************************************************************************* +|* +|* RscMem :: Realloc() +|* +|* Beschreibung Speicher zusaetzlich allokieren +|* Ersterstellung MM 13.02.91 +|* Letzte Aenderung MM 13.02.91 +|* +*************************************************************************/ +void * RscMem :: Realloc( void * pMem, USHORT nSize ){ +#ifdef MAC + SpinCursor( 1 ); +#endif +#ifdef ONLY_NEW + char * pTmp = (char *)pMem; + USHORT nMin, nOldSize; + + pMem = Malloc( nSize ); + nOldSize = *(USHORT *)(pTmp - sizeof( USHORT ) ); + nMin = (nSize < nOldSize) ? nSize : nOldSize; + memcpy( pMem, pTmp, nMin ); + delete (pTmp - sizeof( USHORT )); +#else +#ifdef UNX + if( NULL == (pMem = realloc( (char*)pMem, nSize )) ) +#else + if( NULL == (pMem = realloc( pMem, nSize )) ) +#endif + RscExit( 10 ); +#endif + return( pMem ); +} + +/************************************************************************* +|* +|* RscMem :: Free() +|* +|* Beschreibung Speicher freigeben +|* Ersterstellung MM 13.02.91 +|* Letzte Aenderung MM 13.02.91 +|* +*************************************************************************/ +void RscMem :: Free( void * pMem ){ +#ifdef DOS + aRscCount.nCount--; +#endif +#ifdef ONLY_NEW + delete ((char *)pMem - sizeof( USHORT )); +#else +#ifdef UNX + free( (char *)pMem ); +#else + free( pMem ); +#endif +#endif +} + +/************************************************************************* +|* +|* RscMem :: Assignsw +|* +|* Beschreibung Allokiert speicher fuer String und kopiert ihn +|* Parameter: psw, der String. +|* nExtraSpace, weiterer Speicher hinter dem String +|* Ersterstellung MM 13.02.91 +|* Letzte Aenderung MM 13.02.91 +|* +*************************************************************************/ +char * RscMem :: Assignsw( const char *psw, short nExtraSpace ) +{ + char * pTmp; + + if( !psw ) + psw = ""; + /* allocate memory */ + pTmp = (char *)Malloc( strlen( psw ) + 1 + nExtraSpace ); + /* copy string into allocated memory*/ + strcpy( pTmp, psw ); + return( pTmp ); +} + +/*************** R s c P t r P t r **************************************/ +/************************************************************************* +|* +|* RscPtrPtr :: RscPtrPtr() +|* +|* Beschreibung Eine Tabelle mit Zeigern +|* Ersterstellung MM 13.02.91 +|* Letzte Aenderung MM 13.02.91 +|* +*************************************************************************/ +RscPtrPtr :: RscPtrPtr(){ + nCount = 0; + pMem = NULL; +} + +/************************************************************************* +|* +|* RscPtrPtr :: ~RscPtrPtr() +|* +|* Beschreibung Zerst”rt eine Tabelle mit Zeigern, die Zeiger werde +|* ebenfalls freigegebn +|* Ersterstellung MM 13.02.91 +|* Letzte Aenderung MM 13.02.91 +|* +*************************************************************************/ +RscPtrPtr :: ~RscPtrPtr(){ + Reset(); +} + +/************************************************************************* +|* +|* RscPtrPtr :: Reset() +|* +|* Beschreibung +|* Ersterstellung MM 03.05.91 +|* Letzte Aenderung MM 03.05.91 +|* +*************************************************************************/ +void RscPtrPtr :: Reset(){ + USHORT i; + + if( pMem ){ + for( i = 0; i < nCount; i++ ){ + if( pMem[ i ] ) + RscMem::Free( pMem[ i ] ); + } + RscMem::Free( (void *)pMem ); + }; + nCount = 0; + pMem = NULL; +} + +/************************************************************************* +|* +|* RscPtrPtr :: Append() +|* +|* Beschreibung Haengt einen Eintrag an. +|* Ersterstellung MM 13.02.91 +|* Letzte Aenderung MM 13.02.91 +|* +*************************************************************************/ +USHORT RscPtrPtr :: Append( void * pBuffer ){ + if( !pMem ) + pMem = (void **)RscMem::Malloc( (nCount +1) * sizeof( void * ) ); + else + pMem = (void **)RscMem::Realloc( (void *)pMem, + (USHORT)((nCount +1) * sizeof( void * ) + ) ); + pMem[ nCount ] = pBuffer; + return( nCount++ ); +} + +/************************************************************************* +|* +|* RscPtrPtr :: GetEntry() +|* +|* Beschreibung Liefert einen Eintrag, NULL wenn nicht vorhanden. +|* Ersterstellung MM 13.02.91 +|* Letzte Aenderung MM 13.02.91 +|* +*************************************************************************/ +void * RscPtrPtr :: GetEntry( USHORT nEntry ){ + if( nEntry < nCount ) + return( pMem[ nEntry ] ); + return( NULL ); +} + +/****************** R S C W R I T E R C **********************************/ +/************************************************************************* +|* +|* RscWriteRc :: RscWriteRc() +|* +|* Beschreibung +|* Ersterstellung MM 15.04.91 +|* Letzte Aenderung MM 15.04.91 +|* +*************************************************************************/ +RscWriteRc::RscWriteRc( RSCBYTEORDER_TYPE nOrder ) +{ + short nSwapTest = 1; + RSCBYTEORDER_TYPE nMachineOrder; + + bSwap = FALSE; + if( nOrder != RSC_SYSTEMENDIAN ) + { + if( (BYTE)*(BYTE *)&nSwapTest ) + nMachineOrder = RSC_LITTLEENDIAN; + else + nMachineOrder = RSC_BIGENDIAN; + bSwap = nOrder != nMachineOrder; + } + nByteOrder = nOrder; + nLen = 0; + pMem = NULL; +} + +/************************************************************************* +|* +|* RscWriteRc :: ~RscWriteRc() +|* +|* Beschreibung +|* Ersterstellung MM 15.04.91 +|* Letzte Aenderung MM 15.04.91 +|* +*************************************************************************/ +RscWriteRc :: ~RscWriteRc() +{ + if( pMem ) + RscMem::Free( pMem ); +} + +/************************************************************************* +|* +|* RscWriteRc :: IncSize() +|* +|* Beschreibung +|* Ersterstellung MM 15.04.91 +|* Letzte Aenderung MM 15.04.91 +|* +*************************************************************************/ +USHORT RscWriteRc :: IncSize( USHORT nSize ) +{ + nLen += nSize; + if( pMem ) + pMem = RscMem::Realloc( pMem, nLen ); + return( nLen - nSize ); +} + +/************************************************************************* +|* +|* RscWriteRc :: GetPointer() +|* +|* Beschreibung +|* Ersterstellung MM 15.04.91 +|* Letzte Aenderung MM 15.04.91 +|* +*************************************************************************/ +char * RscWriteRc :: GetPointer( USHORT nSize ) +{ + if( !pMem ) + pMem = (char *)RscMem::Malloc( nLen ); + return( pMem + nSize ); +} + + +/************************************************************************* +|* +|* RscWriteRc :: Put() +|* +|* Beschreibung +|* Ersterstellung MM 15.04.91 +|* Letzte Aenderung MM 15.04.91 +|* +*************************************************************************/ +void RscWriteRc :: Put( USHORT nVal ) +{ + USHORT nOldLen; + + nOldLen = IncSize( sizeof( nVal ) ); + PutAt( nOldLen, nVal ); +} + +void RscWriteRc :: PutUTF8( char * pStr ) +{ + USHORT nStrLen = 0; + if( pStr ) + nStrLen = strlen( pStr ); + + USHORT n = nStrLen +1; + if( n % 2 ) + // align to 2 + n++; + + USHORT nOldLen = IncSize( n ); + memcpy( GetPointer( nOldLen ), pStr, nStrLen ); + // 0 terminated + pMem[ nOldLen + nStrLen ] = '\0'; +} diff --git a/rsc/source/tools/rsctree.cxx b/rsc/source/tools/rsctree.cxx new file mode 100644 index 000000000000..bc7ea5194a3c --- /dev/null +++ b/rsc/source/tools/rsctree.cxx @@ -0,0 +1,604 @@ +/************************************************************************* + * + * $RCSfile: rsctree.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $ + * + * 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/tools/rsctree.cxx,v 1.1.1.1 2000-09-18 16:42:56 hr Exp $ + + Source Code Control System - Update + + $Log: not supported by cvs2svn $ + Revision 1.11 2000/09/17 12:51:12 willem.vandorp + OpenOffice header added. + + Revision 1.10 2000/07/26 17:13:24 willem.vandorp + Headers/footers replaced + + Revision 1.9 2000/07/11 17:17:55 th + Unicode + + Revision 1.8 1997/08/27 18:17:52 MM + neue Headerstruktur + +**************************************************************************/ +/****************** I N C L U D E S **************************************/ + +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +// Programmabh„ngige Includes. +#ifndef _LINK_HXX //autogen +#include <tools/link.hxx> +#endif + +#ifndef _RSCTREE_HXX +#include <rsctree.hxx> +#endif + +/****************** C O D E **********************************************/ + +/****************** B i N o d e ******************************************/ +/************************************************************************* +|* +|* BiNode::BiNode() +|* +|* Beschreibung NAME.DOC +|* Ersterstellung MM 07.02.91 +|* Letzte Aenderung MM 07.02.91 +|* +*************************************************************************/ +BiNode::BiNode(){ + pLeft = pRight = NULL; +} + +/************************************************************************* +|* +|* BiNode::~BiNode() +|* +|* Beschreibung +|* Ersterstellung MM 07.02.91 +|* Letzte Aenderung MM 07.02.91 +|* +*************************************************************************/ +BiNode::~BiNode(){ +} + +/************************************************************************* +|* +|* BiNode::EnumNodes() +|* +|* Beschreibung +|* Ersterstellung MM 07.02.91 +|* Letzte Aenderung MM 07.02.91 +|* +*************************************************************************/ +void BiNode::EnumNodes( Link aLink ) const{ + if( Left() ) + Left()->EnumNodes( aLink ); + aLink.Call( (BiNode *)this ); + if( Right() ) + Right()->EnumNodes( aLink ); +} + +/************************************************************************* +|* +|* BiNode::ChangeDLListBTree() +|* +|* Beschreibung +|* Ersterstellung MM 11.01.91 +|* Letzte Aenderung MM 11.01.91 +|* +*************************************************************************/ +BiNode * BiNode::ChangeDLListBTree( BiNode * pList ){ + BiNode * pRightNode; + BiNode * pMiddle; + BiNode * pTmp; + USHORT nEle, i; + + if( pList ){ + while( pList->Left() ) + pList = pList->Left(); + pTmp = pList; + for( nEle = 0; pTmp->Right(); nEle++ ) + pTmp = pTmp->Right(); + pMiddle = pList; + if( nEle / 2 ) + for( i = 0; i < (USHORT)(nEle / 2); i++ ) + pMiddle = pMiddle->Right(); + else + pList = (BiNode *)0; + + if( NULL != (pTmp = pMiddle->Left()) ) // rechten Zeiger auf Null + pTmp->pRight = (BiNode *)0; + + // linken Zeiger auf Null + if( NULL != (pRightNode = pMiddle->Right()) ) + pRightNode->pLeft = (BiNode *)0; + + pMiddle->pLeft = ChangeDLListBTree( pList ); + pMiddle->pRight = ChangeDLListBTree( pRightNode ); + + return( pMiddle ); + } + return( pList ); +} + +/************************************************************************* +|* +|* BiNode::ChangeBTreeDLList() +|* +|* Beschreibung +|* Ersterstellung MM 11.01.91 +|* Letzte Aenderung MM 11.01.91 +|* +*************************************************************************/ +BiNode * BiNode::ChangeBTreeDLList(){ + BiNode * pList; + BiNode * pLL_RN; // linke Liste rechter Knoten + + if( Right() ){ + pList = Right()->ChangeBTreeDLList(); + pRight = pList; + pList->pLeft = this; + } + pList = this; + if( Left() ){ + pLL_RN = pList = Left()->ChangeBTreeDLList(); + while( pLL_RN->Right() ) + pLL_RN = pLL_RN->Right(); + pLeft = pLL_RN; + pLL_RN->pRight = this; + } + return( pList ); +} + +/****************** N a m e N o d e **************************************/ +/************************************************************************* +|* +|* NameNode::Remove() +|* +|* Beschreibung +|* Ersterstellung MM 10.07.91 +|* Letzte Aenderung MM 10.07.91 +|* +*************************************************************************/ +NameNode * NameNode::Remove( NameNode * pRemove ){ + NameNode * pRoot = this; + NameNode * pParent = SearchParent( pRemove ); + + if( pParent ){ + if( pParent->Left() + && (EQUAL == pRemove->Compare( pParent->Left() ) ) ){ + pParent->pLeft = pRemove->Left(); + if( pRemove->Right() ) + pParent->Insert( pRemove->Right() ); + } + else if( pParent->Right() + && (EQUAL == pRemove->Compare( pParent->Right() ) ) ){ + pParent->pRight = pRemove->Right(); + if( pRemove->Left() ) + pParent->Insert( pRemove->Left() ); + } + } + else if( EQUAL == this->Compare( pRemove ) ){ + if( Right() ){ + pRoot = Right(); + if( Left() ) + Right()->Insert( Left() ); + } + else{ + pRoot = Left(); + } + } + pRemove->pLeft = pRemove->pRight = NULL; + + return pRoot; +} + + +/************************************************************************* +|* +|* NameNode::Compare +|* +|* Beschreibung +|* Ersterstellung MM 10.07.91 +|* Letzte Aenderung MM 13.07.91 +|* +*************************************************************************/ +COMPARE NameNode::Compare( const NameNode * pCompare ) const{ + if( (long)this < (long)pCompare ) + return LESS; + else if( (long)this > (long)pCompare ) + return GREATER; + else + return EQUAL; +} + +COMPARE NameNode::Compare( const void * pCompare ) const{ + if( (long)this < (long)pCompare ) + return LESS; + else if( (long)this > (long)pCompare ) + return GREATER; + else + return EQUAL; +} + +/************************************************************************* +|* +|* NameNode::SearchParent +|* +|* Beschreibung +|* Ersterstellung MM 10.07.91 +|* Letzte Aenderung MM 10.07.91 +|* +*************************************************************************/ +NameNode* NameNode::SearchParent( const NameNode * pSearch ) const{ +// search for a parent node. +// return a pointer to the parent node if found. +// otherwise return 0. + short nCmp = Compare( pSearch ); + + if( nCmp == GREATER ){ + if( Left() ){ + if( ((NameNode *)Left())->Compare( pSearch ) == EQUAL ) + return (NameNode *)this; + return ((NameNode *)Left())->SearchParent( pSearch ); + }; + } + else if( nCmp == LESS ){ + if( Right() ){ + if( ((NameNode *)Right())->Compare( pSearch ) == EQUAL ) + return (NameNode *)this; + return ((NameNode *)Right())->SearchParent( pSearch ); + } + }; + return( (NameNode *)NULL ); +} + +/************************************************************************* +|* +|* NameNode::Search +|* +|* Beschreibung +|* Ersterstellung MM 21.03.90 +|* Letzte Aenderung MM 27.06.90 +|* +*************************************************************************/ +NameNode* NameNode::Search( const NameNode * pSearch ) const{ +// search for a node. +// return a pointer to the node if found. +// otherwise return 0. + short nCmp = Compare( pSearch ); + + if( nCmp == GREATER ){ + if( Left() ) + return ((NameNode *)Left())->Search( pSearch ); + } + else if( nCmp == LESS ){ + if( Right() ) + return ((NameNode *)Right())->Search( pSearch ); + } + else + return( (NameNode *)this ); + + return( NULL ); +} + +NameNode* NameNode::Search( const void * pSearch ) const{ +// search for a node. +// return a pointer to the node if found. +// otherwise return 0. + short nCmp = Compare( pSearch ); + + if( nCmp == GREATER ){ + if( Left() ) + return ((NameNode *)Left())->Search( pSearch ); + } + else if( nCmp == LESS ){ + if( Right() ) + return ((NameNode *)Right())->Search( pSearch ); + } + else + return( (NameNode *)this ); + + return( NULL ); +} + +/************************************************************************* +|* +|* NameNode::Insert() +|* +|* Beschreibung NAME.DOC +|* Ersterstellung MM 11.01.91 +|* Letzte Aenderung MM 11.01.91 +|* +*************************************************************************/ +BOOL NameNode::Insert( NameNode * pTN, USHORT * pnDepth ){ +// Ein Knoten wird in den Baum eingefuegt +// Gibt es einen Knoten mit dem gleichen Namen, dann return FALSE +// sonst return TRUE. Der Knoten wird auf jeden Fall eingefuegt. + + BOOL bRet = TRUE; + short nCmp = Compare( pTN ); + + *pnDepth += 1; + if( nCmp == GREATER ){ + if( Left() ) + bRet = ((NameNode *)Left())->Insert( pTN, pnDepth ); + else + pLeft = pTN; + } + else{ + if( Right() ) + bRet = ((NameNode *)Right())->Insert( pTN, pnDepth ); + else + pRight = pTN; + if( nCmp == EQUAL ) + bRet = FALSE; + }; + return( bRet ); +} + +/************************************************************************* +|* +|* NameNode::Insert() +|* +|* Beschreibung NAME.DOC +|* Ersterstellung MM 21.03.90 +|* Letzte Aenderung MM 11.01.91 +|* +*************************************************************************/ +BOOL NameNode::Insert( NameNode * pTN ){ +// insert a node in the tree. +// if the node with the same name is in, return FALSE and no insert. +// if not return true. + USHORT nDepth = 0; + BOOL bRet; + + bRet = Insert( pTN, &nDepth ); + if( bRet ){ + if( nDepth > 20 ){ + if( Left() ) + pLeft = ChangeDLListBTree( Left()->ChangeBTreeDLList() ); + if( Right() ) + pRight = ChangeDLListBTree( Right()->ChangeBTreeDLList() ); + } + } + + return( bRet ); +} + +/************************************************************************* +|* +|* NameNode::OrderTree() +|* +|* Beschreibung +|* Ersterstellung MM 23.09.91 +|* Letzte Aenderung MM 23.09.91 +|* +*************************************************************************/ +void NameNode::OrderTree(){ + NameNode * pTmpLeft = (NameNode *)Left(); + NameNode * pTmpRight = (NameNode *)Right(); + + pLeft = NULL; + pRight = NULL; + SubOrderTree( pTmpLeft ); + SubOrderTree( pTmpRight ); +} + +void NameNode::SubOrderTree( NameNode * pOrderNode ){ + if( pOrderNode ){ + NameNode * pTmpLeft = (NameNode *)pOrderNode->Left(); + NameNode * pTmpRight = (NameNode *)pOrderNode->Right(); + pOrderNode->pLeft = NULL; + pOrderNode->pRight = NULL; + Insert( pOrderNode ); + SubOrderTree( pTmpLeft ); + SubOrderTree( pTmpRight ); + } +} + +/************************************************************************* +|* +|* NameNode::IdOrderTree() +|* +|* Beschreibung +|* Ersterstellung MM 15.11.91 +|* Letzte Aenderung MM 15.11.91 +|* +*************************************************************************/ +class OrderCtrl { + BOOL bOrder; + NameNode * pName; + DECL_LINK( CallBackFunc, NameNode * ); +public: + OrderCtrl() { bOrder = FALSE; pName = NULL; } + BOOL IsOrder( const NameNode * pRoot ) + { + bOrder = TRUE; + pName = NULL; + pRoot->EnumNodes( LINK( this, OrderCtrl, CallBackFunc ) ); + return bOrder; + }; +}; +IMPL_LINK_INLINE_START( OrderCtrl, CallBackFunc, NameNode *, pNext ) +{ + if( pName && pName->Compare( pNext ) != LESS ) + bOrder = FALSE; + pName = pNext; + return 0; +} +IMPL_LINK_INLINE_END( OrderCtrl, CallBackFunc, NameNode *, pNext ) + +BOOL NameNode::IsOrderTree() const{ + OrderCtrl aOrder; + + return aOrder.IsOrder( this ); +} + +/****************** I d N o d e ******************************************/ +/************************************************************************* +|* +|* IdNode::Search() +|* +|* Beschreibung +|* Ersterstellung MM 06.11.91 +|* Letzte Aenderung MM 06.11.91 +|* +*************************************************************************/ +IdNode * IdNode::Search( USHORT nTypeName ) const{ + return( (IdNode *)NameNode::Search( (const void *)&nTypeName ) ); +} + +/************************************************************************* +|* +|* IdNode::Compare() +|* +|* Beschreibung +|* Ersterstellung MM 06.11.91 +|* Letzte Aenderung MM 06.11.91 +|* +*************************************************************************/ +COMPARE IdNode::Compare( const NameNode * pSearch ) const +{ + if( GetId() < (USHORT)(((const IdNode *)pSearch)->GetId()) ) + return LESS; + else if( GetId() > (USHORT)(((const IdNode *)pSearch)->GetId()) ) + return GREATER; + else + return EQUAL; +} + +COMPARE IdNode::Compare( const void * pSearch ) const{ +// pSearch ist ein Zeiger auf USHORT + + if( GetId() < *((const USHORT *)pSearch) ) + return LESS; + else if( GetId() > *((const USHORT *)pSearch) ) + return GREATER; + else + return EQUAL; +} + +/************************************************************************* +|* +|* IdNode::GetId() +|* +|* Beschreibung +|* Ersterstellung MM 23.09.91 +|* Letzte Aenderung MM 23.09.91 +|* +*************************************************************************/ +USHORT IdNode::GetId() const +{ + return( 0xFFFF ); +} + +/************************************************************************* +|* +|* StringNode::Search() +|* +|* Beschreibung +|* Ersterstellung MM 06.11.91 +|* Letzte Aenderung MM 06.11.91 +|* +*************************************************************************/ +StringNode * StringNode::Search( const char * pSearch ) const{ + return (StringNode *)NameNode::Search( (const void *)pSearch ); +} + +/************************************************************************* +|* +|* StringNode::Compare() +|* +|* Beschreibung +|* Ersterstellung MM 06.11.91 +|* Letzte Aenderung MM 06.11.91 +|* +*************************************************************************/ +COMPARE StringNode::Compare( const NameNode * pSearch ) const +{ + short nCmp = strcmp( aName.GetBuffer(), + ((const StringNode *)pSearch)->aName.GetBuffer() ); + if( nCmp < 0 ) + return LESS; + else if( nCmp > 0 ) + return GREATER; + else + return EQUAL; +} + +COMPARE StringNode::Compare( const void * pSearch ) const +{ +// pSearch ist ein Zeiger auf const char * + short nCmp = strcmp( aName.GetBuffer(), (const char *)pSearch ); + + if( nCmp < 0 ) + return LESS; + else if( nCmp > 0 ) + return GREATER; + else + return EQUAL; +} |