summaryrefslogtreecommitdiff
path: root/idl/source/prj
diff options
context:
space:
mode:
Diffstat (limited to 'idl/source/prj')
-rw-r--r--idl/source/prj/command.cxx472
-rw-r--r--idl/source/prj/database.cxx1378
-rw-r--r--idl/source/prj/globals.cxx233
-rw-r--r--idl/source/prj/idldll.cxx115
-rw-r--r--idl/source/prj/makefile.mk101
-rw-r--r--idl/source/prj/svidl.cxx463
6 files changed, 2762 insertions, 0 deletions
diff --git a/idl/source/prj/command.cxx b/idl/source/prj/command.cxx
new file mode 100644
index 000000000000..9961f737339d
--- /dev/null
+++ b/idl/source/prj/command.cxx
@@ -0,0 +1,472 @@
+/*************************************************************************
+ *
+ * $RCSfile: command.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30:41 $
+ *
+ * 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 <string.h>
+#include <ctype.h>
+
+#include <command.hxx>
+#include <globals.hxx>
+#include <database.hxx>
+
+#ifndef _FSYS_HXX //autogen
+#include <tools/fsys.hxx>
+#endif
+
+#pragma hdrstop
+
+/*************************************************************************
+|*
+|* Syntaxbeschreibung
+|*
+*************************************************************************/
+char* SyntaxStrings[] = {
+"basic-type:",
+"\tvoid| char| int| float| double|",
+"\tUINT16| INT16| UINT32| INT32| BOOL|",
+"\tBYTE| String| SbxObject",
+"",
+"{ import \"filename\" }\n",
+"module definition:",
+"module",
+"\tunique id range (ask MM)",
+"modul-name",
+"'['",
+"\tSlotIdFile( \"filename\" )",
+"']'",
+"'{'",
+"\t{ include \"filename\" }\n",
+
+"\titem definition:",
+"\titem type item-name;\n",
+
+"\ttype definition:",
+"\tstruct | union identifier",
+"\t'{'",
+"\t\t{ type idetifier }",
+"\t'}'",
+"\t|",
+"\tenum identifier",
+"\t'{'",
+"\t\t{ identifier, }",
+"\t'}'",
+"\t|",
+"\ttypedef type identifier\n",
+
+"\titem-method:",
+"\titem identifier item-method-args\n",
+
+"\titem-method-args:",
+"\t( { item parameter-name SLOT_ID } )\n",
+
+"\tslot definition:",
+"\titem identifier SLOT_ID [ item-method-args ]",
+"\t'['\n",
+
+"\t\titem-method-args",
+"\t\tAccelConfig, MenuConfig, StatusBarConfig, ToolbarConfig",
+"\t\tAutomation*",
+"\t\tAutoUpdate",
+"\t\tCachable*, Volatile",
+"\t\tContainer",
+"\t\tDefault = Identifier",
+"\t\tExecMethod = Identifier",
+"\t\tExport*",
+"\t\tFastCall",
+"\t\tGet, Set",
+"\t\tGroupId = Identifier",
+"\t\tHasCoreId",
+"\t\tHasDialog",
+"\t\tIsCollection",
+"\t\tPlugComm",
+"\t\tPseudoPrefix = Identifier",
+"\t\tPseudoSlots",
+"\t\tReadOnly",
+"\t\tReadOnlyDoc*",
+"\t\tRecordPerSet*, RecordPerItem, RecordManual, NoRecord",
+"\t\tRecordAbsolute",
+"\t\tStateMethod = Identifier",
+"\t\tSynchron*, Asynchron",
+"\t\tToggle",
+"\t']'\n",
+
+"\tinterface definition:",
+"\tshell | interface identifier ':' interface",
+"\t'{'",
+"\t\t{ slot }",
+"\t'}'\n",
+"---syntax example is sfx.idl---\n",
+NULL };
+
+char CommandLineSyntax[] =
+"-fs<slotmap file> -fl<listing file>\n"
+"-fo<odl file> -fd<data base file>\n"
+"-fi<item implementation> -ft<type library file> (not OLE)\n"
+"-fr<ressource file> -fm<makefile target file>\n"
+"-fC<c++ source file> -fH<c++ header file>\n"
+"-fc<c source file> -fh<c header file>\n"
+"-rsc <*.srs header line>\n"
+"-help, ? @<file> response file\n"
+" <filenames>\n";
+
+/*************************************************************************
+|*
+|* Init()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.12.94
+|* Letzte Aenderung MM 15.12.94
+|*
+*************************************************************************/
+void Init( const SvCommand & rCommand )
+{
+ if( !IDLAPP->pHashTable )
+ IDLAPP->pHashTable = new SvStringHashTable( 2801 );
+ if( !IDLAPP->pGlobalNames )
+ IDLAPP->pGlobalNames = new SvGlobalHashNames();
+}
+
+/*************************************************************************
+|*
+|* DeInit()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+void DeInit()
+{
+ delete IDLAPP;
+}
+
+/*************************************************************************
+|*
+|* DeInit()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+BOOL ReadIdl( SvIdlWorkingBase * pDataBase, const SvCommand & rCommand )
+{
+ for( USHORT n = 0; n < rCommand.aInFileList.Count(); n++ )
+ {
+ String aFileName ( *rCommand.aInFileList.GetObject( n ) );
+ SvFileStream aStm( aFileName, STREAM_STD_READ | STREAM_NOCREATE );
+ if( aStm.GetError() == SVSTREAM_OK )
+ {
+ if( pDataBase->IsBinaryFormat( aStm ) )
+ {
+ pDataBase->Load( aStm );
+ if( aStm.GetError() != SVSTREAM_OK )
+ {
+ ByteString aStr;
+ if( aStm.GetError() == SVSTREAM_FILEFORMAT_ERROR )
+ aStr = "error: incompatible format, file ";
+ else if( aStm.GetError() == SVSTREAM_WRONGVERSION )
+ aStr = "error: wrong version, file ";
+ else
+ aStr = "error during load, file ";
+ aStr += ByteString( aFileName, RTL_TEXTENCODING_UTF8 );
+ fprintf( stderr, "%s\n", aStr.GetBuffer() );
+ return FALSE;
+ }
+ }
+ else
+ {
+ SvTokenStream aTokStm( aStm, aFileName );
+ if( !pDataBase->ReadSvIdl( aTokStm, FALSE, rCommand.aPath ) )
+ return FALSE;
+ }
+ }
+ else
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* SvCommand::SvCommand()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.12.94
+|* Letzte Aenderung MM 15.12.94
+|*
+*************************************************************************/
+SvCommand::SvCommand()
+ : nFlags( 0 )
+{
+ DirEntry aEntry;
+ aPath = aEntry.GetFull(); //Immer im Aktuellen Pfad suchen
+}
+
+/*************************************************************************
+|*
+|* SvCommand::SvCommand()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+static BOOL ResponseFile( StringList * pList, int argc, char ** argv )
+{
+ // Programmname
+ pList->Insert( new String( String::CreateFromAscii(*argv) ), LIST_APPEND );
+ for( int i = 1; i < argc; i++ )
+ {
+ if( '@' == **(argv +i) )
+ { // wenn @, dann Response-Datei
+ SvFileStream aStm( String::CreateFromAscii((*(argv +i)) +1), STREAM_STD_READ | STREAM_NOCREATE );
+ if( aStm.GetError() != SVSTREAM_OK )
+ return FALSE;
+
+ ByteString aStr;
+ while( aStm.ReadLine( aStr ) )
+ {
+ USHORT n = 0;
+ USHORT nPos = 1;
+ while( n != nPos )
+ {
+ while( aStr.GetChar(n) && isspace( aStr.GetChar(n) ) )
+ n++;
+ nPos = n;
+ while( aStr.GetChar(n) && !isspace( aStr.GetChar(n) ) )
+ n++;
+ if( n != nPos )
+ pList->Insert( new String( String::CreateFromAscii( aStr.Copy( nPos, n - nPos ).GetBuffer() ) ), LIST_APPEND );
+ }
+ }
+ }
+ else if( argv[ i ] )
+ pList->Insert( new String( String::CreateFromAscii( argv[ i ] ) ), LIST_APPEND );
+ }
+ return TRUE;
+}
+
+/*************************************************************************
+|* SvCommand::SvCommand()
+|*
+|* Beschreibung
+*************************************************************************/
+SvCommand::SvCommand( int argc, char ** argv )
+ : nFlags( 0 )
+{
+ StringList aList;
+
+ if( ResponseFile( &aList, argc, argv ) )
+ for( ULONG i = 1; i < aList.Count(); i++ )
+ {
+ String aParam( *aList.GetObject( i ) );
+ sal_Unicode aFirstChar( aParam.GetChar(0) );
+ if( '-' == aFirstChar )
+ {
+ aParam.Erase( 0, 1 );
+ aFirstChar = aParam.GetChar(0);
+ if( aFirstChar == 'F' || aFirstChar == 'f' )
+ {
+ aParam.Erase( 0, 1 );
+ aFirstChar = aParam.GetChar(0);
+ String aName( aParam.Copy( 1 ) );
+ if( 's' == aFirstChar )
+ { // Name der Slot-Ausgabe
+ aSlotMapFile = aName;
+ }
+ else if( 'l' == aFirstChar )
+ { // Name der Listing
+ aListFile = aName;
+ }
+ else if( 'i' == aFirstChar )
+ { // Name der Item-Datei
+// aSfxItemFile = aName;
+ }
+ else if( 'o' == aFirstChar )
+ { // Name der ODL-Datei
+// aODLFile = aName;
+ }
+ else if( 'd' == aFirstChar )
+ { // Name der Datenbasis-Datei
+ aDataBaseFile = aName;
+ }
+ else if( 'D' == aFirstChar )
+ { // Name der Docu-Datei f"ur das API
+// aDocuFile = aName;
+ }
+ else if( 'C' == aFirstChar )
+ { // Name der cxx-Datei
+// aCxxFile = aName;
+ }
+ else if( 'H' == aFirstChar )
+ { // Name der hxx-Datei
+// aHxxFile = aName;
+ }
+ else if( 'c' == aFirstChar )
+ { // Name der C-Header-Datei
+// aCSourceFile = aName;
+ }
+ else if( 'h' == aFirstChar )
+ { // Name der C-Header-Datei
+// aCHeaderFile = aName;
+ }
+ else if( 't' == aFirstChar )
+ { // Name der Info-Datei
+// aCallingFile = aName;
+ }
+ else if( 'm' == aFirstChar )
+ { // Name der Info-Datei
+ aTargetFile = aName;
+ }
+ else if( 'r' == aFirstChar )
+ { // Name der Resource-Datei
+// aSrcFile = aName;
+ }
+ else if( 'z' == aFirstChar )
+ { // Name der HelpId-Datei
+ aHelpIdFile = aName;
+ }
+ else if( 'y' == aFirstChar )
+ { // Name der CSV-Datei
+ aCSVFile = aName;
+ }
+ else if( 'x' == aFirstChar )
+ { // Name der IDL-Datei fuer die CSV-Datei
+ aExportFile = aName;
+ }
+ else
+ {
+ printf( "unknown switch: %s\n", aParam.GetBuffer() );
+ exit( -1 );
+ }
+ }
+ else if( aParam.EqualsIgnoreCaseAscii( "help" ) || aParam.EqualsIgnoreCaseAscii( "?" ) )
+ { // Hilfe
+ printf( CommandLineSyntax );
+ }
+ else if( aParam.EqualsIgnoreCaseAscii( "syntax" ) )
+ { // Hilfe
+ int i = 0;
+ while(SyntaxStrings[i])
+ printf("%s\n",SyntaxStrings[i++]);
+ }
+ else if( aParam.EqualsIgnoreCaseAscii( "i", 0, 1 ) )
+ { // Include-Pfade definieren
+ String aName( aParam.Copy( 1 ) );
+ if( aPath.Len() )
+ aPath += DirEntry::GetSearchDelimiter();
+ aPath += aName;
+ }
+ else if( aParam.EqualsIgnoreCaseAscii( "rsc", 0, 3 ) )
+ { // erste Zeile im *.srs File
+ if( aList.GetObject( i +1 ) )
+ {
+ aSrsLine = ByteString( *aList.GetObject( i +1 ), RTL_TEXTENCODING_UTF8 );
+ i++;
+ }
+ }
+ else
+ {
+#if SUPD>589
+ // temporary compatibility hack
+ printf( "unknown switch: %s\n", aParam.GetBuffer() );
+ exit( -1 );
+#endif
+ }
+ }
+ else
+ {
+ aInFileList.Insert( new String( aParam ), LIST_APPEND );
+ }
+ }
+ else
+ {
+ printf( CommandLineSyntax );
+ }
+
+ String * pStr = aList.First();
+ while( pStr )
+ {
+ delete pStr;
+ pStr = aList.Next();
+ }
+
+ ByteString aInc( getenv( "INCLUDE" ) );
+ // Include Environmentvariable anhaengen
+ if( aInc.Len() )
+ {
+ if( aPath.Len() )
+ aPath += DirEntry::GetSearchDelimiter();
+ aPath += String::CreateFromAscii( aInc.GetBuffer() );
+ }
+}
+
+/*************************************************************************
+|*
+|* SvCommand::~SvCommand()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+SvCommand::~SvCommand()
+{
+ // ByteString Liste freigeben
+ String * pStr;
+ while( NULL != (pStr = aInFileList.Remove()) )
+ delete pStr;
+}
+
diff --git a/idl/source/prj/database.cxx b/idl/source/prj/database.cxx
new file mode 100644
index 000000000000..ec47b5d73530
--- /dev/null
+++ b/idl/source/prj/database.cxx
@@ -0,0 +1,1378 @@
+/*************************************************************************
+ *
+ * $RCSfile: database.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30:41 $
+ *
+ * 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 <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifndef _FSYS_HXX //autogen
+#include <tools/fsys.hxx>
+#endif
+#include <tools/debug.hxx>
+#include <database.hxx>
+#include <globals.hxx>
+#pragma hdrstop
+
+
+/****************** SvIdlDataBase ****************************************/
+/*************************************************************************
+|* SvIdlDataBase::SvIdlDataBase()
+|*
+|* Beschreibung
+*************************************************************************/
+/*
+void PrimeNumber(){
+ USHORT i, n;
+ for( i = 5001; i < 5500; i += 2 ){
+ for( n = 2; n < i && ((i % n) != 0); n++ );
+ if( n == i ){
+ printf( "\nPrimzahl: %d\n", i );
+ return;
+ }
+ }
+}
+*/
+
+SvIdlDataBase::SvIdlDataBase()
+ : bIsModified( FALSE )
+ , bExport( FALSE )
+ , aPersStream( *IDLAPP->pClassMgr, NULL )
+ , pIdTable( NULL )
+ , nUniqueId( 0 )
+{
+ //PrimeNumber();
+}
+
+/*************************************************************************
+|* SvIdlDataBase::~SvIdlDataBase()
+|*
+|* Beschreibung
+*************************************************************************/
+SvIdlDataBase::~SvIdlDataBase()
+{
+ String * pStr = aIdFileList.First();
+ while( pStr )
+ {
+ delete pStr;
+ pStr = aIdFileList.Next();
+ }
+ delete pIdTable;
+}
+
+/*************************************************************************
+|* SvIdlDataBase::IsModified()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvIdlDataBase::IsModified() const
+{
+ for( ULONG n = 0; n < aModuleList.Count(); n++ )
+ if( aModuleList.GetObject( n )->IsModified() )
+ return TRUE;
+ //bIsModified;
+ return FALSE;
+}
+
+/*************************************************************************
+|* SvIdlDataBase::GetTypeList()
+|*
+|* Beschreibung
+*************************************************************************/
+#define ADD_TYPE( Name, OdlName, ParserChar, CName, BasName, BasPost ) \
+ aTypeList.Append( new SvMetaType( SvHash_##Name()->GetName(), \
+ BasName, OdlName, ParserChar, CName, BasName, BasPost ) );
+
+SvMetaTypeMemberList & SvIdlDataBase::GetTypeList()
+{
+ if( aTypeList.Count() == 0 )
+ { // Initial fuellen
+ aTypeList.Append( new SvMetaTypeString() );
+ aTypeList.Append( new SvMetaTypevoid() );
+
+ // MI: IDispatch::Invoke kann keine unsigned
+ ADD_TYPE( UINT16, "long", 'h', "unsigned short", "Long", "&" );
+ ADD_TYPE( INT16, "short", 'h', "short", "Integer", "%" );
+ ADD_TYPE( UINT32, "long", 'l', "unsigned long", "Long", "&" );
+ ADD_TYPE( INT32, "long", 'l', "long", "Long", "&" );
+ ADD_TYPE( int, "int", 'i', "int", "Integer", "%" );
+ ADD_TYPE( BOOL, "boolean", 'b', "unsigned char", "Boolean", "" );
+ ADD_TYPE( char, "char", 'c', "char", "Integer", "%" );
+ ADD_TYPE( BYTE, "char", 'c', "unsigned char", "Integer", "%" );
+ ADD_TYPE( float, "float", 'f', "float", "Single", "!" );
+ ADD_TYPE( double, "double", 'F', "double", "Double", "#" );
+ ADD_TYPE( SbxObject, "VARIANT", 'o', "C_Object", "Object", "" );
+
+ // A c h t u n g !!!, bei hinzufuegen von Typen werden alle
+ // binren Datenbasen inkompatibel
+
+ /*
+ // So tun als ob die Init-Daten auf einem Stream gelesen wurden
+ SvMemoryStream aStm;
+ aPersStream.SetStream( &aStm );
+ // Alle Init-Daten Streamen
+ aPersStream << aTypeList;
+ // Nur die Id-Zuordnung merken
+ aPersStream.SetStream( NULL );
+ */
+ }
+ return aTypeList;
+}
+
+/*************************************************************************
+|*
+|* SvIdlDataBase::GetModuleInfo()
+|*
+|* Beschreibung
+|* Ersterstellung MM 13.12.94
+|* Letzte Aenderung MM 13.12.94
+|*
+*************************************************************************/
+SvMetaModule * SvIdlDataBase::GetModule( const ByteString & rName )
+{
+ for( ULONG n = 0; n < aModuleList.Count(); n++ )
+ if( aModuleList.GetObject( n )->GetName() == rName )
+ return aModuleList.GetObject( n );
+ return NULL;
+}
+
+/*************************************************************************
+|*
+|* SvIdlDataBase::IsBinaryFormat()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+#define DATABASE_SIGNATURE (UINT32)0x13B799F2
+#define DATABASE_VER 0x0006
+BOOL SvIdlDataBase::IsBinaryFormat( SvStream & rStm )
+{
+ UINT32 nSig = 0;
+ ULONG nPos = rStm.Tell();
+ rStm >> nSig;
+ rStm.Seek( nPos );
+
+ return nSig == DATABASE_SIGNATURE;
+}
+
+/*************************************************************************
+|*
+|* SvIdlDataBase::Load()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+void SvIdlDataBase::Load( SvStream & rStm )
+{
+ DBG_ASSERT( aTypeList.Count() == 0, "type list already initialized" )
+ SvPersistStream aPStm( *IDLAPP->pClassMgr, &rStm );
+
+ USHORT nVersion = 0;
+ UINT32 nSig = 0;
+
+ aPStm >> nSig;
+ aPStm >> nVersion;
+ if( nSig != DATABASE_SIGNATURE )
+ {
+ aPStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
+ return;
+ }
+ if( nVersion != DATABASE_VER )
+ {
+ aPStm.SetError( SVSTREAM_WRONGVERSION );
+ return;
+ }
+ aPStm >> aClassList;
+ aPStm >> aTypeList;
+ aPStm >> aAttrList;
+ aPStm >> aModuleList;
+ aPStm >> nUniqueId;
+
+ if( aPStm.IsEof() )
+ aPStm.SetError( SVSTREAM_GENERALERROR );
+}
+
+/*************************************************************************
+|* SvIdlDataBase::Save()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvIdlDataBase::Save( SvStream & rStm, UINT32 nFlags )
+{
+ SvPersistStream aPStm( *IDLAPP->pClassMgr, &rStm );
+ aPStm.SetContextFlags( nFlags );
+
+ aPStm << (UINT32)DATABASE_SIGNATURE;
+ aPStm << (USHORT)DATABASE_VER;
+
+ BOOL bOnlyStreamedObjs = FALSE;
+ if( nFlags & IDL_WRITE_CALLING )
+ bOnlyStreamedObjs = TRUE;
+
+ if( bOnlyStreamedObjs )
+ {
+ SvMetaClassMemberList aList;
+ for( ULONG n = 0; n < GetModuleList().Count(); n++ )
+ {
+ SvMetaModule * pModule = GetModuleList().GetObject( n );
+ if( !pModule->IsImported() )
+ aList.Append( pModule->GetClassList() );
+ }
+ aPStm << aList;
+ }
+ else
+ aPStm << aClassList;
+
+ //aClassList.WriteObjects( aPStm, bOnlyStreamedObjs );
+ aTypeList.WriteObjects( aPStm, bOnlyStreamedObjs );
+ aAttrList.WriteObjects( aPStm, bOnlyStreamedObjs );
+ aModuleList.WriteObjects( aPStm, bOnlyStreamedObjs );
+ aPStm << nUniqueId;
+}
+
+/*************************************************************************
+|* SvIdlDataBase::SetError()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvIdlDataBase::SetError( const ByteString & rError, SvToken * pTok )
+{
+ if( pTok->GetLine() > 10000 )
+ aError.SetText( "hgchcg" );
+
+ if( aError.nLine < pTok->GetLine()
+ || aError.nLine == pTok->GetLine() && aError.nColumn < pTok->GetColumn() )
+ {
+ aError = SvIdlError( pTok->GetLine(), pTok->GetColumn() );
+ aError.SetText( rError );
+ }
+}
+
+/*************************************************************************
+|* SvIdlDataBase::Push()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvIdlDataBase::Push( SvMetaObject * pObj )
+{
+ GetStack().Push( pObj );
+}
+
+#ifdef IDL_COMPILER
+/*************************************************************************
+|*
+|* SvIdlDataBase::FindId()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+BOOL SvIdlDataBase::FindId( const ByteString & rIdName, ULONG * pVal )
+{
+ if( pIdTable )
+ {
+ UINT32 nHash;
+ if( pIdTable->Test( rIdName, &nHash ) )
+ {
+ *pVal = pIdTable->Get( nHash )->GetValue();
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* SvIdlDataBase::InsertId()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+BOOL SvIdlDataBase::InsertId( const ByteString & rIdName, ULONG nVal )
+{
+ if( !pIdTable )
+ pIdTable = new SvStringHashTable( 20003 );
+
+ UINT32 nHash;
+ if( pIdTable->Insert( rIdName, &nHash ) )
+ {
+ pIdTable->Get( nHash )->SetValue( nVal );
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*************************************************************************
+|* SvIdlDataBase::ReadIdFile()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvIdlDataBase::ReadIdFile( const String & rFileName )
+{
+#ifndef MAC
+ DirEntry aFullName( rFileName );
+#else
+ DirEntry aFullName( rFileName, FSYS_STYLE_UNX );
+#endif
+ aFullName.Find( GetPath() );
+
+ String * pIdFile = aIdFileList.First();
+ while( pIdFile )
+ {
+ if( *pIdFile == rFileName )
+ return TRUE; // schon eingelesen
+ pIdFile = aIdFileList.Next();
+ }
+
+ aIdFileList.Insert( new String( rFileName ), LIST_APPEND );
+
+ SvTokenStream aTokStm( aFullName.GetFull() );
+ if( aTokStm.GetStream().GetError() == SVSTREAM_OK )
+ {
+ SvToken * pTok = aTokStm.GetToken_Next();
+
+ while( !pTok->IsEof() )
+ {
+ if( pTok->IsChar() && pTok->GetChar() == '#' )
+ {
+ pTok = aTokStm.GetToken_Next();
+ if( pTok->Is( SvHash_define() ) )
+ {
+ pTok = aTokStm.GetToken_Next();
+ ByteString aDefName;
+ if( pTok->IsIdentifier() )
+ aDefName = pTok->GetString();
+ else
+ {
+ ByteString aStr( "unexpected token after define" );
+ // Fehler setzen
+ SetError( aStr, pTok );
+ WriteError( aTokStm );
+ return FALSE;
+ }
+
+ ULONG nVal = 0;
+ BOOL bOk = TRUE;
+ while( bOk )
+ {
+ pTok = aTokStm.GetToken_Next();
+ if( pTok->IsIdentifier() )
+ {
+ ULONG n;
+ if( FindId( pTok->GetString(), &n ) )
+ nVal += n;
+ else
+ bOk = FALSE;
+ }
+ else if( pTok->IsChar() )
+ {
+ if( pTok->GetChar() == '-'
+ || pTok->GetChar() == '/'
+ || pTok->GetChar() == '*'
+ || pTok->GetChar() == '&'
+ || pTok->GetChar() == '|'
+ || pTok->GetChar() == '^'
+ || pTok->GetChar() == '~' )
+ {
+ ByteString aStr( "unknown operator '" );
+ aStr += pTok->GetChar();
+ aStr += "'in define";
+ // Fehler setzen
+ SetError( aStr, pTok );
+ WriteError( aTokStm );
+ return FALSE;
+ }
+ if( pTok->GetChar() != '+'
+ && pTok->GetChar() != '('
+ && pTok->GetChar() != ')' )
+ // nur + erlaubt, Klammern spielen kein Rolle,
+ // da + komutativ ist
+ break;
+ }
+ else if( pTok->IsInteger() )
+ {
+ nVal += pTok->GetNumber();
+ }
+ else
+ break;
+ }
+ if( bOk )
+ {
+ if( !InsertId( aDefName, nVal ) )
+ {
+ ByteString aStr = "hash table overflow: ";
+ SetError( aStr, pTok );
+ WriteError( aTokStm );
+ return FALSE;
+ }
+ }
+ }
+ else if( pTok->Is( SvHash_include() ) )
+ {
+ pTok = aTokStm.GetToken_Next();
+ ByteString aName;
+ if( pTok->IsString() )
+ aName = pTok->GetString();
+ else if( pTok->IsChar() && pTok->GetChar() == '<' )
+ {
+ pTok = aTokStm.GetToken_Next();
+ while( !pTok->IsEof()
+ && !(pTok->IsChar() && pTok->GetChar() == '>') )
+ {
+ aName += pTok->GetTokenAsString();
+ pTok = aTokStm.GetToken_Next();
+ }
+ if( pTok->IsEof() )
+ {
+ ByteString aStr( "unexpected eof in #include" );
+ // Fehler setzen
+ SetError( aStr, pTok );
+ WriteError( aTokStm );
+ return FALSE;
+ }
+ }
+ if( !ReadIdFile( String::CreateFromAscii(aName.GetBuffer()) ) )
+ {
+ ByteString aStr = "cannot read file: ";
+ aStr += aName;
+ SetError( aStr, pTok );
+ WriteError( aTokStm );
+ return FALSE;
+ }
+ }
+ }
+ else
+ pTok = aTokStm.GetToken_Next();
+ }
+ }
+ else
+ return FALSE;
+ return TRUE;
+}
+
+/*************************************************************************
+|* SvIdlDataBase::FindType()
+|*
+|* Beschreibung
+*************************************************************************/
+SvMetaType * SvIdlDataBase::FindType( const SvMetaType * pPType,
+ SvMetaTypeMemberList & rList )
+{
+ SvMetaType * pType = rList.First();
+ while( pType && pPType != pType )
+ pType = rList.Next();
+ return pType;
+}
+
+SvMetaType * SvIdlDataBase::FindType( const ByteString & rName )
+{
+ SvMetaType * pType = aTypeList.First();
+ while( pType && rName != pType->GetName() )
+ pType = aTypeList.Next();
+ return pType;
+}
+
+/*************************************************************************
+|* SvIdlDataBase::FindName()
+|*
+|* Beschreibung
+*************************************************************************/
+ByteString * SvIdlDataBase::FindName( const ByteString & rName, ByteStringList & rList )
+{
+ ByteString * pS = rList.First();
+ while( pS && *pS != rName )
+ pS = rList.Next();
+ return pS;
+}
+
+/*************************************************************************
+|* SvIdlDataBase::FillTypeList()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvIdlDataBase::FillTypeList( SvMetaTypeList & rOutList,
+ SvToken * pNameTok )
+{
+ rOutList.Clear();
+// if( pNameTok->IsIdentifierHash() ) Optimierung spaeter
+ if( pNameTok->IsIdentifier() )
+ {
+ ByteString aName = pNameTok->GetString();
+ SvMetaType * pMetaType = GetTypeList().First();
+ while( pMetaType )
+ {
+ if( pMetaType->GetName() == aName )
+ rOutList.Insert( pMetaType, LIST_APPEND );
+ pMetaType = GetTypeList().Next();
+ }
+ }
+ return rOutList.Count() != 0;
+}
+
+/*************************************************************************
+|* SvIdlDataBase::ReadKnownType()
+|*
+|* Beschreibung
+*************************************************************************/
+SvMetaType * SvIdlDataBase::ReadKnownType( SvTokenStream & rInStm )
+{
+ BOOL bIn = FALSE;
+ BOOL bOut = FALSE;
+ int nCall0 = CALL_VALUE;
+ int nCall1 = CALL_VALUE;
+ BOOL bSet = FALSE; //irgent ein Attribut gesetzt
+
+ UINT32 nTokPos = rInStm.Tell();
+ SvToken * pTok = rInStm.GetToken_Next();
+
+ if( pTok->HasHash() )
+ {
+ UINT32 nBeginPos = 0; // kann mit Tell nicht vorkommen
+ while( nBeginPos != rInStm.Tell() )
+ {
+ nBeginPos = rInStm.Tell();
+ if( pTok->Is( SvHash_in() ) )
+ {
+ bIn = TRUE;
+ pTok = rInStm.GetToken_Next();
+ bSet = TRUE;
+ }
+ if( pTok->Is( SvHash_out() ) )
+ {
+ bOut = TRUE;
+ pTok = rInStm.GetToken_Next();
+ bSet = TRUE;
+ }
+ if( pTok->Is( SvHash_inout() ) )
+ {
+ bIn = TRUE;
+ bOut = TRUE;
+ pTok = rInStm.GetToken_Next();
+ bSet = TRUE;
+ }
+ }
+ }
+/*
+ SvMetaTypeList aTmpTypeList;
+ if( FillTypeList( aTmpTypeList, pTok ) )
+*/
+ if( pTok->IsIdentifier() )
+ {
+ ByteString aName = pTok->GetString();
+ SvMetaTypeMemberList & rList = GetTypeList();
+ SvMetaType * pType = rList.First();
+ while( pType )
+ {
+ if( pType->GetName() == aName )
+ break;
+ pType = rList.Next();
+ }
+ if( pType )
+ {
+ pTok = rInStm.GetToken();
+ if( pTok->IsChar() )
+ {
+ if( pTok->GetChar() == '&' || pTok->GetChar() == '*' )
+ {
+ nCall0 = (pTok->GetChar() == '&') ? CALL_REFERENCE :
+ CALL_POINTER;
+ rInStm.GetToken_Next();
+ pTok = rInStm.GetToken();
+ if( pTok->GetChar() == '&' || pTok->GetChar() == '*' )
+ {
+ nCall1 = (pTok->GetChar() == '&') ? CALL_REFERENCE :
+ CALL_POINTER;
+ rInStm.GetToken_Next();
+ }
+ bSet = TRUE;
+ }
+ }
+ /*
+ SvMetaType * pMetaType = aTmpTypeList.First();
+ while( pMetaType )
+ {
+ if( pMetaType->GetIn() == bIn
+ && pMetaType->GetOut() == bOut
+ && pMetaType->GetCall0() == nCall0
+ && pMetaType->GetCall1() == nCall1 )
+ {
+ return pMetaType;
+ }
+ pMetaType = aTmpTypeList.Next();
+ }
+ */
+ //SvMetaType * pType = aTmpTypeList.First();
+ if( !bSet )
+ // Ist genau dieser Typ
+ return pType;
+
+ DBG_ASSERT( aTmpTypeList.First(), "mindestens ein Element" )
+ SvMetaTypeRef xType = new SvMetaType( pType->GetName(), 'h', "dummy" );
+ xType->SetRef( pType );
+ xType->SetIn( bIn );
+ xType->SetOut( bOut );
+ xType->SetCall0( nCall0 );
+ xType->SetCall1( nCall1 );
+
+ aTmpTypeList.Append( xType );
+ return xType;
+ }
+ }
+ rInStm.Seek( nTokPos );
+ return NULL;
+}
+
+/*************************************************************************
+|*
+|* SvIdlDataBase::ReadKnownAttr()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+SvMetaAttribute * SvIdlDataBase::FindAttr( SvMetaAttributeMemberList * pList,
+ SvMetaAttribute * pAttr ) const
+{
+ for( ULONG n = 0; n < pList->Count(); n++ )
+ {
+ SvMetaAttribute * p = pList->GetObject( n );
+ if( p->GetName() == pAttr->GetName() )
+ return pAttr;
+ else if( p->GetSlotId().GetValue() == pAttr->GetSlotId().GetValue() )
+ {
+ ByteString aStr = "different slot names with same id: ";
+ aStr += p->GetName();
+ aStr += " and ";
+ aStr += pAttr->GetName();
+ WriteError( "warning", "*.srs", aStr );
+ return FALSE;
+ }
+ }
+ return NULL;
+}
+
+/*************************************************************************
+|*
+|* SvIdlDataBase::ReadKnownAttr()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+SvMetaAttribute * SvIdlDataBase::ReadKnownAttr
+(
+ SvTokenStream & rInStm,
+ SvMetaType * pType /* Wenn der pType == NULL, dann muss der Typ
+ noch gelesen werden. */
+)
+{
+ UINT32 nTokPos = rInStm.Tell();
+
+ if( !pType )
+ pType = ReadKnownType( rInStm );
+
+ if( pType )
+ {
+ // Wenn wir Slots auf die Wiese stellen, d"urfen wir nicht voraussetzen,
+ // da\s jeder Slot einen anderen Namen hat!
+/*
+ SvToken * pTok = rInStm.GetToken_Next();
+ if( pTok->IsIdentifier() )
+ for( ULONG n = 0; n < aAttrList.Count(); n++ )
+ {
+ SvMetaAttribute * pAttr = aAttrList.GetObject( n );
+ if( pAttr->GetName() == pTok->GetString() )
+ return pAttr;
+ }
+*/
+ }
+ else
+ {
+ // sonst SlotId?
+ SvToken * pTok = rInStm.GetToken_Next();
+ if( pTok->IsIdentifier() )
+ {
+ ULONG n;
+ if( FindId( pTok->GetString(), &n ) )
+ {
+ for( ULONG n = 0; n < aAttrList.Count(); n++ )
+ {
+ SvMetaAttribute * pAttr = aAttrList.GetObject( n );
+ if( pAttr->GetSlotId() == pTok->GetString() )
+ return pAttr;
+ }
+ }
+
+ ByteString aStr( "Nicht gefunden : " );
+ aStr += pTok->GetString();
+ DBG_ERROR( aStr.GetBuffer() );
+ }
+ }
+
+ rInStm.Seek( nTokPos );
+ return NULL;
+}
+
+SvMetaAttribute* SvIdlDataBase::SearchKnownAttr
+(
+ const SvNumberIdentifier& rId
+)
+{
+ ULONG n;
+ if( FindId( rId, &n ) )
+ {
+ for( ULONG n = 0; n < aAttrList.Count(); n++ )
+ {
+ SvMetaAttribute * pAttr = aAttrList.GetObject( n );
+ if( pAttr->GetSlotId() == rId )
+ return pAttr;
+ }
+ }
+
+ return NULL;
+}
+
+/*************************************************************************
+|* SvIdlDataBase::ReadKnownClass()
+|*
+|* Beschreibung
+*************************************************************************/
+SvMetaClass * SvIdlDataBase::ReadKnownClass( SvTokenStream & rInStm )
+{
+ UINT32 nTokPos = rInStm.Tell();
+ SvToken * pTok = rInStm.GetToken_Next();
+
+ if( pTok->IsIdentifier() )
+ for( ULONG n = 0; n < aClassList.Count(); n++ )
+ {
+ SvMetaClass * pClass = aClassList.GetObject( n );
+ if( pClass->GetName() == pTok->GetString() )
+ return pClass;
+ }
+
+ rInStm.Seek( nTokPos );
+ return NULL;
+}
+
+/*************************************************************************
+|* SvIdlDataBase::Write()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvIdlDataBase::Write( const ByteString & rText )
+{
+#ifndef W31
+ fprintf( stdout, "%s", rText.GetBuffer() );
+#endif
+}
+
+/*************************************************************************
+|* SvIdlDataBase::WriteError()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvIdlDataBase::WriteError( const ByteString & rErrWrn,
+ const ByteString & rFileName,
+ const ByteString & rErrorText,
+ ULONG nRow, ULONG nColumn ) const
+{
+ //Fehlerbehandlung
+#ifndef W31
+ fprintf( stderr, "\n%s --- %s: ( %ld, %ld )\n",
+ rFileName.GetBuffer(), rErrWrn.GetBuffer(), nRow, nColumn );
+
+ if( rErrorText.Len() )
+ { // Fehler gesetzt
+ fprintf( stderr, "\t%s\n", rErrorText.GetBuffer() );
+ }
+#endif
+}
+
+/*************************************************************************
+|* SvIdlDataBase::WriteError()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvIdlDataBase::WriteError( SvTokenStream & rInStm )
+{
+ //Fehlerbehandlung
+#ifndef W31
+ String aFileName( rInStm.GetFileName() );
+ ByteString aErrorText;
+ ULONG nRow = 0, nColumn = 0;
+
+ rInStm.SeekEnd();
+ SvToken *pTok = rInStm.GetToken();
+
+ // Fehlerposition
+ nRow = pTok->GetLine();
+ nColumn = pTok->GetColumn();
+
+ if( aError.IsError() )
+ { // Fehler gesetzt
+ // Fehler Token suchen
+ // Fehlertext
+ if( aError.GetText().Len() )
+ {
+ aErrorText = "may be <";
+ aErrorText += aError.GetText();
+ }
+ SvToken * pPrevTok = NULL;
+ while( pTok != pPrevTok )
+ {
+ pPrevTok = pTok;
+ if( pTok->GetLine() == aError.nLine
+ && pTok->GetColumn() == aError.nColumn )
+ break;
+ pTok = rInStm.GetToken_PrevAll();
+ }
+
+ // Fehlerposition
+ aErrorText += "> at ( ";
+ aErrorText += aError.nLine;
+ aErrorText += ", ";
+ aErrorText += aError.nColumn;
+ aErrorText += " )";
+
+ // Fehler zuruecksetzen
+ aError = SvIdlError();
+ }
+
+ WriteError( "error", ByteString( aFileName, RTL_TEXTENCODING_UTF8 ), aErrorText, nRow, nColumn );
+
+ DBG_ASSERT( pTok, "token must be found" )
+ if( !pTok )
+ return;
+
+ // Identifier in der Naehe suchen
+ if( !pTok->IsIdentifier() )
+ {
+ rInStm.GetToken_PrevAll();
+ pTok = rInStm.GetToken();
+ }
+ if( pTok && pTok->IsIdentifier() )
+ {
+ ByteString aN = IDLAPP->pHashTable->GetNearString( pTok->GetString() );
+ if( aN.Len() )
+ fprintf( stderr, "%s versus %s\n", pTok->GetString().GetBuffer(), aN.GetBuffer() );
+ }
+#endif
+}
+
+/****************** SvIdlWorkingBase ****************************************/
+/*************************************************************************
+|* SvIdlWorkingBase::SvIdlWorkingBase()
+|*
+|* Beschreibung
+*************************************************************************/
+SvIdlWorkingBase::SvIdlWorkingBase()
+{
+}
+
+/*************************************************************************
+|* SvIdlWorkingBase::ReadSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvIdlWorkingBase::ReadSvIdl( SvTokenStream & rInStm, BOOL bImported, const String & rPath )
+{
+ aPath = rPath; // nur fuer den durchlauf gueltig
+ SvToken * pTok;
+ BOOL bOk = TRUE;
+ pTok = rInStm.GetToken();
+ // nur ein import ganz am Anfang
+ if( pTok->Is( SvHash_import() ) )
+ {
+ rInStm.GetToken_Next();
+ rInStm.Read( '(' ); // optional
+ pTok = rInStm.GetToken_Next();
+ if( pTok->IsString() )
+ {
+ DirEntry aFullName( String::CreateFromAscii( pTok->GetString().GetBuffer() ) );
+ if( aFullName.Find( rPath ) )
+ {
+ SvFileStream aStm( aFullName.GetFull(),
+ STREAM_STD_READ | STREAM_NOCREATE );
+ Load( aStm );
+ if( aStm.GetError() != SVSTREAM_OK )
+ {
+ if( aStm.GetError() == SVSTREAM_WRONGVERSION )
+ {
+ ByteString aStr( "wrong version, file " );
+ aStr += ByteString( aFullName.GetFull(), RTL_TEXTENCODING_UTF8 );
+ SetError( aStr, pTok );
+ WriteError( rInStm );
+ bOk = FALSE;
+ }
+ else
+ {
+ aStm.Seek( 0 );
+ aStm.ResetError();
+ SvTokenStream aTokStm( aStm, aFullName.GetFull() );
+ bOk = ReadSvIdl( aTokStm, TRUE, rPath );
+ }
+ }
+ }
+ else
+ bOk = FALSE;
+ }
+ else
+ bOk = FALSE;
+ }
+
+ UINT32 nBeginPos = 0xFFFFFFFF; // kann mit Tell nicht vorkommen
+
+ while( bOk && nBeginPos != rInStm.Tell() )
+ {
+ nBeginPos = rInStm.Tell();
+ pTok = rInStm.GetToken();
+ if( pTok->IsEof() )
+ return TRUE;
+ if( pTok->IsEmpty() )
+ bOk = FALSE;
+
+ // nur ein import ganz am Anfang
+ /*else */if( pTok->Is( SvHash_module() ) )
+ {
+ SvMetaModuleRef aModule = new SvMetaModule( rInStm.GetFileName(), bImported );
+ if( aModule->ReadSvIdl( *this, rInStm ) )
+ GetModuleList().Append( aModule );
+ else
+ bOk = FALSE;
+ }
+ else
+ bOk = FALSE;
+ }
+ if( !bOk || !pTok->IsEof() )
+ {
+ //Fehlerbehandlung
+ WriteError( rInStm );
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/*************************************************************************
+|* SvIdlWorkingBase::WriteSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvIdlWorkingBase::WriteSvIdl( SvStream & rOutStm )
+{
+ if( rOutStm.GetError() != SVSTREAM_OK )
+ return FALSE;
+
+ SvStringHashList aList;
+ if( GetIdTable() )
+ {
+ GetIdTable()->FillHashList( &aList );
+ SvStringHashEntry * pEntry = aList.First();
+ while( pEntry )
+ {
+ rOutStm << "#define " << pEntry->GetName().GetBuffer()
+ << '\t' << ByteString( pEntry->GetValue() ).GetBuffer()
+ << endl;
+ pEntry = aList.Next();
+ }
+ }
+
+ for( ULONG n = 0; n < GetModuleList().Count(); n++ )
+ {
+ SvMetaModule * pModule = GetModuleList().GetObject( n );
+ //if( !pModule->IsImported() )
+ pModule->WriteSvIdl( *this, rOutStm, 0 );
+ }
+ return TRUE;
+}
+
+/*************************************************************************
+|* SvIdlWorkingBase::WriteSfx()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvIdlWorkingBase::WriteSfx( SvStream & rOutStm )
+{
+ if( rOutStm.GetError() != SVSTREAM_OK )
+ return FALSE;
+
+ // alle Tmp-Variablen fuer das Schreiben zuruecksetzen
+ WriteReset();
+ SvMemoryStream aTmpStm( 256000, 256000 );
+ ULONG n;
+ for( n = 0; n < GetModuleList().Count(); n++ )
+ {
+ SvMetaModule * pModule = GetModuleList().GetObject( n );
+ if( !pModule->IsImported() )
+ pModule->WriteSfx( *this, aTmpStm );
+ aTmpStm.Seek( 0 );
+ }
+ for( n = 0; n < aUsedTypes.Count(); n++ )
+ {
+ SvMetaType * pType = aUsedTypes.GetObject( n );
+ pType->WriteSfx( *this, rOutStm );
+ }
+ aUsedTypes.Clear();
+ rOutStm << aTmpStm;
+ return TRUE;
+}
+
+BOOL SvIdlWorkingBase::WriteHelpIds( SvStream& rOutStm )
+{
+ if( rOutStm.GetError() != SVSTREAM_OK )
+ return FALSE;
+
+ Table aIdTable;
+ ULONG n;
+ for( n = 0; n < GetModuleList().Count(); n++ )
+ {
+ SvMetaModule * pModule = GetModuleList().GetObject( n );
+ //if( !pModule->IsImported() )
+ pModule->WriteHelpIds( *this, rOutStm, &aIdTable );
+ }
+
+ const SvMetaAttributeMemberList & rAttrList = GetAttrList();
+ for( n = 0; n < rAttrList.Count(); n++ )
+ {
+ SvMetaAttribute * pAttr = rAttrList.GetObject( n );
+ pAttr->WriteHelpId( *this, rOutStm, &aIdTable );
+ }
+
+ return TRUE;
+}
+
+/*************************************************************************
+|* SvIdlWorkingBase::WriteCHeader()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvIdlWorkingBase::WriteCHeader( SvStream & rOutStm )
+{
+ if( rOutStm.GetError() != SVSTREAM_OK )
+ return FALSE;
+
+ ULONG n;
+ for( n = 0; n < GetTypeList().Count(); n++ )
+ {
+ SvMetaType * pType = GetTypeList().GetObject( n );
+ pType->Write( *this, rOutStm, 0, WRITE_C_HEADER );
+ }
+ for( n = 0; n < GetModuleList().Count(); n++ )
+ {
+ SvMetaModule * pModule = GetModuleList().GetObject( n );
+ if( !pModule->IsImported() )
+ {
+ aModulePrefix = pModule->GetModulePrefix();
+ pModule->Write( *this, rOutStm, 0, WRITE_C_HEADER );
+ }
+ }
+ return TRUE;
+}
+
+/*************************************************************************
+|* SvIdlWorkingBase::WriteCSource()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvIdlWorkingBase::WriteCSource( SvStream & rOutStm )
+{
+ if( rOutStm.GetError() != SVSTREAM_OK )
+ return FALSE;
+
+ ULONG n;
+ for( n = 0; n < GetTypeList().Count(); n++ )
+ {
+ SvMetaType * pType = GetTypeList().GetObject( n );
+ pType->Write( *this, rOutStm, 0, WRITE_C_SOURCE );
+ }
+ rOutStm << endl;
+ for( n = 0; n < GetModuleList().Count(); n++ )
+ {
+ SvMetaModule * pModule = GetModuleList().GetObject( n );
+ if( !pModule->IsImported() )
+ {
+ aModulePrefix = pModule->GetModulePrefix();
+ pModule->Write( *this, rOutStm, 0, WRITE_C_SOURCE );
+ }
+ }
+ return TRUE;
+}
+
+
+
+/*************************************************************************
+|* SvIdlWorkingBase::WriteSfxItem()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvIdlWorkingBase::WriteSfxItem( SvStream & rOutStm )
+{
+/*
+ if( rOutStm.GetError() != SVSTREAM_OK )
+ return FALSE;
+
+ for( ULONG n = 0; n < GetModuleList().Count(); n++ )
+ {
+ SvMetaModule * pModule = GetModuleList().GetObject( n );
+ if( !pModule->IsImported() )
+ {
+ const SvMetaItemMemberList & rItemList = pModule->GetItemList();
+ for( ULONG i = 0; i < rItemList.Count(); i++ )
+ {
+ SvMetaItem * pItem = rItemList.GetObject( i );
+ if( HAS_BASE( SvMetaItem, pItem ) )
+ {
+ // Header
+ ((SvMetaItem*)pItem)->WriteSfxItem( *this, rOutStm, TRUE );
+ // Source
+ ((SvMetaItem*)pItem)->WriteSfxItem( *this, rOutStm, FALSE );
+ }
+ }
+ }
+ }
+ return TRUE;
+*/
+ return FALSE;
+}
+
+/*************************************************************************
+|* SvIdlWorkingBase::WriteSbx()
+|*
+|* Beschreibung
+*************************************************************************/
+/*
+BOOL SvIdlWorkingBase::WriteSbx( SvStream & rOutStm )
+{
+ if( rOutStm.GetError() != SVSTREAM_OK )
+ return FALSE;
+
+ SvNamePosList aList;
+ SvMemoryStream aTmpStm( 256000, 256000 );
+ for( ULONG n = 0; n < GetModuleList().Count(); n++ )
+ {
+ SvMetaModule * pModule = GetModuleList().GetObject( n );
+ if( !pModule->IsImported() )
+ pModule->WriteSbx( *this, aTmpStm, aList );
+ }
+ // Version, steht auch in so2 auto.cxx
+ rOutStm << (UINT32)0x1258F170;
+ rOutStm << (UINT32)aList.Count();
+ ULONG i ;
+ for( i = 0; i < aList.Count(); i++ )
+ {
+ SvNamePos * p = aList.GetObject( i );
+ rOutStm << p->aUUId;
+ rOutStm << (UINT32)0;
+ }
+ // Ende der Tabelle
+ ULONG nEndPos = rOutStm.Tell();
+ rOutStm.Seek( 2 * sizeof( UINT32 ) );
+ SvGlobalName aTmpName;
+ for( i = 0; i < aList.Count(); i++ )
+ {
+ SvNamePos * p = aList.GetObject( i );
+ // Um an die richtige Position zu gelangen
+ rOutStm >> aTmpName;
+ // richtigen Offset schreiben
+ rOutStm << (UINT32)(nEndPos + p->nStmPos);
+ }
+ aTmpStm.Seek( 0L );
+ rOutStm << aTmpStm;
+
+ return TRUE;
+}
+*/
+
+/*************************************************************************
+|* SvIdlWorkingBase::WriteOdl()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvIdlWorkingBase::WriteOdl( SvStream & rOutStm )
+{
+ if( rOutStm.GetError() != SVSTREAM_OK )
+ return FALSE;
+
+ for( ULONG n = 0; n < GetModuleList().Count(); n++ )
+ {
+ SvMetaModule * pModule = GetModuleList().GetObject( n );
+ if( !pModule->IsImported() )
+ pModule->Write( *this, rOutStm, 0, WRITE_ODL );
+ }
+ return TRUE;
+}
+
+/*************************************************************************
+|* OdlWorkingBase::WriteSrc()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvIdlWorkingBase::WriteSrc( SvStream & rOutStm )
+{
+ if( rOutStm.GetError() != SVSTREAM_OK )
+ return FALSE;
+
+ Table aIdTable;
+ ULONG n;
+ for( n = 0; n < GetModuleList().Count(); n++ )
+ {
+ SvMetaModule * pModule = GetModuleList().GetObject( n );
+ //if( !pModule->IsImported() )
+ pModule->WriteSrc( *this, rOutStm, &aIdTable );
+ }
+ const SvMetaAttributeMemberList & rAttrList = GetAttrList();
+ for( n = 0; n < rAttrList.Count(); n++ )
+ {
+ SvMetaAttribute * pAttr = rAttrList.GetObject( n );
+ pAttr->WriteSrc( *this, rOutStm, &aIdTable );
+ }
+
+ return TRUE;
+}
+
+/*************************************************************************
+|* OdlWorkingBase::WriteCxx()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvIdlWorkingBase::WriteCxx( SvStream & rOutStm )
+{
+ if( rOutStm.GetError() != SVSTREAM_OK )
+ return FALSE;
+
+ for( ULONG n = 0; n < GetModuleList().Count(); n++ )
+ {
+ SvMetaModule * pModule = GetModuleList().GetObject( n );
+ if( !pModule->IsImported() )
+ pModule->WriteCxx( *this, rOutStm, 0 );
+ }
+
+ return TRUE;
+}
+
+/*************************************************************************
+|* OdlWorkingBase::WriteHxx()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvIdlWorkingBase::WriteHxx( SvStream & rOutStm )
+{
+ if( rOutStm.GetError() != SVSTREAM_OK )
+ return FALSE;
+
+ for( ULONG n = 0; n < GetModuleList().Count(); n++ )
+ {
+ SvMetaModule * pModule = GetModuleList().GetObject( n );
+ if( !pModule->IsImported() )
+ pModule->WriteHxx( *this, rOutStm, 0 );
+ }
+
+ return TRUE;
+}
+
+void SvIdlDataBase::StartNewFile( const String& rName )
+{
+ bExport = ( aExportFile.EqualsIgnoreCaseAscii( rName ) );
+}
+
+void SvIdlDataBase::AppendAttr( SvMetaAttribute *pAttr )
+{
+ aAttrList.Append( pAttr );
+ if ( bExport )
+ pAttr->SetNewAttribute( TRUE );
+}
+
+BOOL SvIdlWorkingBase::WriteCSV( SvStream& rStrm )
+{
+ SvMetaAttributeMemberList &rList = GetAttrList();
+ ULONG nCount = rList.Count();
+ for ( ULONG n=0; n<nCount; n++ )
+ {
+ if ( rList.GetObject(n)->IsNewAttribute() )
+ {
+ rList.GetObject(n)->WriteCSV( *this, rStrm );
+ }
+ }
+
+ if ( rStrm.GetError() != SVSTREAM_OK )
+ return FALSE;
+ else
+ return TRUE;
+}
+
+/*************************************************************************
+|* SvIdlWorkingBase::WriteDocumentation()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvIdlWorkingBase::WriteDocumentation( SvStream & rOutStm )
+{
+ if( rOutStm.GetError() != SVSTREAM_OK )
+ return FALSE;
+
+ for( ULONG n = 0; n < GetModuleList().Count(); n++ )
+ {
+ SvMetaModule * pModule = GetModuleList().GetObject( n );
+ if( !pModule->IsImported() )
+ pModule->Write( *this, rOutStm, 0, WRITE_DOCU );
+ }
+ return TRUE;
+}
+
+
+
+#endif // IDL_COMPILER
+
diff --git a/idl/source/prj/globals.cxx b/idl/source/prj/globals.cxx
new file mode 100644
index 000000000000..9e3468439842
--- /dev/null
+++ b/idl/source/prj/globals.cxx
@@ -0,0 +1,233 @@
+/*************************************************************************
+ *
+ * $RCSfile: globals.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30:41 $
+ *
+ * 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 **************************************/
+
+#ifndef _SHL_HXX //autogen
+#include <tools/shl.hxx>
+#endif
+
+#include <globals.hxx>
+#include <database.hxx>
+#pragma hdrstop
+
+/****************** G L O B A L S ****************************************/
+#ifdef DOS
+static IdlDll * pApp = NULL;
+IdlDll * GetIdlApp()
+{
+ if( !pApp )
+ pApp = new IdlDll();
+ return pApp;
+}
+#else
+IdlDll * GetIdlApp()
+{
+ if( !(*(IdlDll**)GetAppData(SHL_IDL)) )
+ {
+ (*(IdlDll**)GetAppData(SHL_IDL)) = new IdlDll();
+ // Temporaer, sonst nur wenn Compiler
+ //GetIdlApp()->pHashTable = new SvStringHashTable( 2801 );
+ //GetIdlApp()->pGlobalNames = new SvGlobalHashNames();
+ }
+ return (*(IdlDll**)GetAppData(SHL_IDL));
+}
+#endif
+
+IdlDll::IdlDll()
+ : pHashTable( NULL )
+ , pGlobalNames( NULL )
+ , pClassMgr( NULL )
+
+{
+ pClassMgr = new SvClassManager();
+ // File OBJECT.HXX:
+ pClassMgr->SV_CLASS_REGISTER( SvMetaAttribute );
+ pClassMgr->SV_CLASS_REGISTER( SvMetaClass );
+ //File SLOT.HXX:
+ pClassMgr->SV_CLASS_REGISTER( SvMetaSlot );
+ //File MODULE.HXX:
+ pClassMgr->SV_CLASS_REGISTER( SvMetaModule );
+ //File BASOBJ.HXX:
+ pClassMgr->SV_CLASS_REGISTER( SvMetaObject );
+ pClassMgr->SV_CLASS_REGISTER( SvMetaName );
+ pClassMgr->SV_CLASS_REGISTER( SvMetaExtern );
+ pClassMgr->SV_CLASS_REGISTER( SvMetaReference );
+ //File TYPES.HXX:
+ pClassMgr->SV_CLASS_REGISTER( SvMetaType );
+ pClassMgr->SV_CLASS_REGISTER( SvMetaTypeString );
+ pClassMgr->SV_CLASS_REGISTER( SvMetaEnumValue );
+ pClassMgr->SV_CLASS_REGISTER( SvMetaTypeEnum );
+ pClassMgr->SV_CLASS_REGISTER( SvMetaTypevoid );
+ pClassMgr->SV_CLASS_REGISTER( SvClassElement );
+}
+
+IdlDll::~IdlDll()
+{
+ delete pGlobalNames;
+ delete pClassMgr;
+ delete pHashTable;
+}
+
+/*************************************************************************
+|*
+|* SvGlobalHashNames::SvGlobalHashNames()
+|*
+|* Beschreibung
+|* Ersterstellung MM 08.08.91
+|* Letzte Aenderung MM 08.08.91
+|*
+*************************************************************************/
+inline SvStringHashEntry * INS( const ByteString & rName )
+{
+ UINT32 nIdx;
+ IDLAPP->pHashTable->Insert( rName, &nIdx );
+ return (SvStringHashEntry * )IDLAPP->pHashTable->Get( nIdx );
+}
+#define A_ENTRY( Name ) , MM_##Name( INS( #Name ) )
+
+SvGlobalHashNames::SvGlobalHashNames()
+ : MM_Name( INS( "Name" ) )
+ , MM_module( INS( "module" ) )
+ , MM_interface( INS( "interface" ) )
+ , MM_in( INS( "in" ) )
+ , MM_out( INS( "out" ) )
+ , MM_inout( INS( "inout" ) )
+ , MM_String( INS( "String" ) )
+ , MM_UCHAR( INS( "UCHAR" ) )
+ , MM_USHORT( INS( "USHORT" ) )
+ , MM_uuid( INS( "uuid" ) )
+ , MM_HelpContext( INS( "HelpContext" ) )
+ , MM_HelpText( INS( "HelpText" ) )
+ , MM_void( INS( "void" ) )
+ , MM_shell( INS( "shell" ) )
+ , MM_Get( INS( "Get" ) )
+ , MM_Set( INS( "Set" ) )
+ , MM_SlotId( INS( "SlotId" ) )
+ , MM_HasCoreId( INS( "HasCoreId" ) )
+ , MM_Cachable( INS( "Cachable" ) )
+ , MM_Volatile( INS( "Volatile" ) )
+ , MM_Toggle( INS( "Toggle" ) )
+ , MM_AutoUpdate( INS( "AutoUpdate" ) )
+ , MM_Synchron( INS( "Synchron" ) )
+ , MM_Asynchron( INS( "Asynchron" ) )
+ A_ENTRY(RecordPerItem)
+ A_ENTRY(RecordPerSet)
+ A_ENTRY(RecordManual)
+ A_ENTRY(NoRecord)
+ A_ENTRY(RecordAbsolute)
+ A_ENTRY(enum)
+ A_ENTRY(UINT16)
+ A_ENTRY(INT16)
+ A_ENTRY(UINT32)
+ A_ENTRY(INT32)
+ A_ENTRY(int)
+ A_ENTRY(BOOL)
+ A_ENTRY(char)
+ A_ENTRY(BYTE)
+ A_ENTRY(float)
+ A_ENTRY(double)
+ A_ENTRY(item)
+ A_ENTRY(PseudoSlots)
+ A_ENTRY(map)
+ A_ENTRY(Default)
+ A_ENTRY(HelpFile)
+ A_ENTRY(Version)
+ A_ENTRY(import)
+ A_ENTRY(SlotIdFile)
+ A_ENTRY(SvName)
+ A_ENTRY(SbxName)
+ A_ENTRY(ItemName)
+ A_ENTRY(OdlName)
+ A_ENTRY(include)
+ A_ENTRY(ExecMethod)
+ A_ENTRY(StateMethod)
+ A_ENTRY(GroupId)
+ A_ENTRY(HasDialog)
+ A_ENTRY(MenuConfig)
+ A_ENTRY(ToolBoxConfig)
+ A_ENTRY(StatusBarConfig)
+ A_ENTRY(AccelConfig)
+ A_ENTRY(AllConfig)
+ A_ENTRY(FastCall)
+ A_ENTRY(TypeLibFile)
+ A_ENTRY(Export)
+ A_ENTRY(Automation)
+ A_ENTRY(PseudoPrefix)
+ A_ENTRY(define)
+ A_ENTRY(SbxObject)
+ A_ENTRY(Container)
+ A_ENTRY(PlugComm)
+ A_ENTRY(IsCollection)
+ A_ENTRY(ReadOnlyDoc)
+ A_ENTRY(ConfigName)
+ A_ENTRY(struct)
+ A_ENTRY(union)
+ A_ENTRY(typedef)
+ A_ENTRY(Readonly)
+ A_ENTRY(SlotType)
+ A_ENTRY(ModulePrefix)
+ A_ENTRY(DisableFlags)
+ A_ENTRY(Hidden)
+ A_ENTRY(Description)
+ A_ENTRY(UnoName)
+{}
+
diff --git a/idl/source/prj/idldll.cxx b/idl/source/prj/idldll.cxx
new file mode 100644
index 000000000000..b0862cd6f335
--- /dev/null
+++ b/idl/source/prj/idldll.cxx
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * $RCSfile: idldll.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30:41 $
+ *
+ * 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
+
+#ifdef WIN
+
+#ifndef _SVWIN_H
+#include <svwin.h>
+#endif
+
+#ifndef _SYSDEP_HXX
+#include <sysdep.hxx>
+#endif
+
+// Statische DLL-Verwaltungs-Variablen
+static HINSTANCE hDLLInst = 0; // HANDLE der DLL
+
+
+/***************************************************************************
+|*
+|* LibMain()
+|*
+|* Beschreibung Initialisierungsfunktion der DLL
+|* Ersterstellung TH 05.05.93
+|* Letzte Aenderung TH 05.05.93
+|*
+***************************************************************************/
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+#ifndef WNT
+ if ( nHeap )
+ UnlockData( 0 );
+#endif
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+/***************************************************************************
+|*
+|* WEP()
+|*
+|* Beschreibung DLL-Deinitialisierung
+|* Ersterstellung TH 05.05.93
+|* Letzte Aenderung TH 05.05.93
+|*
+***************************************************************************/
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
diff --git a/idl/source/prj/makefile.mk b/idl/source/prj/makefile.mk
new file mode 100644
index 000000000000..e142121cdd68
--- /dev/null
+++ b/idl/source/prj/makefile.mk
@@ -0,0 +1,101 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:30:41 $
+#
+# 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=..$/..
+
+PROJECTPCH4DLL=TRUE
+PROJECTPCH=idlpch
+PROJECTPCHSOURCE=$(PRJ)$/util$/idlpch
+
+PRJNAME=SVIDL
+TARGET=prj
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+.IF "$(COM)"=="WTC"
+CFLAGS+=-od
+.ENDIF
+
+CDEFS+=-DIDL_COMPILER
+# --- Files --------------------------------------------------------------
+
+CXXFILES= command.cxx \
+ globals.cxx \
+ database.cxx \
+ svidl.cxx \
+ idldll.cxx \
+ $(PROJECTPCHSOURCE).cxx
+
+OBJFILES= $(OBJ)$/command.obj \
+ $(OBJ)$/svidl.obj \
+ $(OBJ)$/globals.obj \
+ $(OBJ)$/idldll.obj \
+ $(OBJ)$/database.obj
+
+# --- Targets ------------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/idl/source/prj/svidl.cxx b/idl/source/prj/svidl.cxx
new file mode 100644
index 000000000000..6bd36f4b4fdb
--- /dev/null
+++ b/idl/source/prj/svidl.cxx
@@ -0,0 +1,463 @@
+/*************************************************************************
+ *
+ * $RCSfile: svidl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30:41 $
+ *
+ * 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 <database.hxx>
+#include <globals.hxx>
+#include <command.hxx>
+
+#ifndef _FSYS_HXX //autogen
+#include <tools/fsys.hxx>
+#endif
+
+#ifndef _STRING_HXX //autogen
+#include <tools/string.hxx>
+#endif
+
+#pragma hdrstop
+
+#define BR 0x8000
+BOOL FileMove_Impl( const String & rFile1, const String & rFile2, BOOL bImmerVerschieben )
+{
+ //printf( "Move from %s to %s\n", rFile2.GetStr(), rFile1.GetStr() );
+ ULONG nC1 = 0;
+ ULONG nC2 = 1;
+ if( !bImmerVerschieben )
+ {
+ SvFileStream aOutStm1( rFile1, STREAM_STD_READ );
+ SvFileStream aOutStm2( rFile2, STREAM_STD_READ );
+ if( aOutStm1.GetError() == SVSTREAM_OK )
+ {
+ void * pBuf1 = new BYTE[ BR ];
+ void * pBuf2 = new BYTE[ BR ];
+ nC1 = aOutStm1.Read( pBuf1, BR );
+ nC2 = aOutStm2.Read( pBuf2, BR );
+ BOOL bOk = TRUE;
+ while( nC1 == nC2 )
+ {
+ if( memcmp( pBuf1, pBuf2, nC1 ) )
+ {
+ nC1++;
+ break;
+ }
+ else
+ {
+ if( 0x8000 != nC1 )
+ break;
+ nC1 = aOutStm1.Read( pBuf1, BR );
+ nC2 = aOutStm2.Read( pBuf2, BR );
+ }
+ }
+ delete pBuf1;
+ delete pBuf2;
+ }
+ }
+ DirEntry aF2( rFile2 );
+ if( nC1 != nC2 )
+ {// es hat sich etwas geaendert
+ DirEntry aF1( rFile1 );
+ aF1.Kill();
+ // Datei verschieben
+ if( aF2.MoveTo( aF1 ) )
+ {
+ // Beide Dateien loeschen
+ aF1.Kill();
+ aF2.Kill();
+ return FALSE;
+ }
+/*
+ else
+ {
+ printf( "%s to %s moved\n",
+ rFile2.GetStr(), rFile1.GetStr() );
+ }
+*/
+ return TRUE;
+ }
+ return 0 == aF2.Kill();
+}
+
+/*************************************************************************
+|* main()
+|*
+|* Beschreibung
+*************************************************************************/
+#if defined( UNX ) || (defined( PM2 ) && defined( CSET )) || defined (WTC) || defined (MAC) || defined (MTW)
+int main ( int argc, char ** argv)
+{
+#else
+int cdecl main ( int argc, char ** argv)
+{
+#endif
+
+ printf( "StarView Interface Definition Language (IDL) Compiler 3.0\n" );
+
+/*
+ pStr = ::ResponseFile( &aCmdLine, argv, argc );
+ if( pStr )
+ {
+ printf( "Cannot open response file <%s>\n", pStr );
+ return( 1 );
+ };
+*/
+
+ String aTmpListFile;
+ String aTmpSlotMapFile;
+ String aTmpSfxItemFile;
+ String aTmpDataBaseFile;
+ String aTmpCallingFile;
+ String aTmpSrcFile;
+ String aTmpCxxFile;
+ String aTmpHxxFile;
+ String aTmpHelpIdFile;
+ String aTmpCSVFile;
+ String aTmpDocuFile;
+
+ SvCommand aCommand( argc, argv );
+ Init( aCommand );
+ SvIdlWorkingBase * pDataBase = new SvIdlWorkingBase();
+
+ int nExit = 0;
+ if( aCommand.aExportFile.Len() )
+ {
+ DirEntry aDE( aCommand.aExportFile );
+ pDataBase->SetExportFile( aDE.GetName() );
+ }
+
+ if( ReadIdl( pDataBase, aCommand ) )
+ {
+ if( nExit == 0 && aCommand.aDocuFile.Len() )
+ {
+ DirEntry aDE( aCommand.aDocuFile );
+ aDE.ToAbs();
+ aTmpDocuFile = aDE.GetPath().TempName().GetFull();
+ SvFileStream aOutStm( aTmpDocuFile, STREAM_READWRITE | STREAM_TRUNC );
+ if( !pDataBase->WriteDocumentation( aOutStm ) )
+ {
+ nExit = -1;
+ ByteString aStr = "cannot write documentation file: ";
+ aStr += ByteString( aCommand.aDocuFile, RTL_TEXTENCODING_UTF8 );
+ fprintf( stderr, "%s\n", aStr.GetBuffer() );
+ }
+ }
+ if( nExit == 0 && aCommand.aListFile.Len() )
+ {
+ DirEntry aDE( aCommand.aListFile );
+ aDE.ToAbs();
+ aTmpListFile = aDE.GetPath().TempName().GetFull();
+ SvFileStream aOutStm( aTmpListFile, STREAM_READWRITE | STREAM_TRUNC );
+ if( !pDataBase->WriteSvIdl( aOutStm ) )
+ {
+ nExit = -1;
+ ByteString aStr = "cannot write list file: ";
+ aStr += ByteString( aCommand.aListFile, RTL_TEXTENCODING_UTF8 );
+ fprintf( stderr, "%s\n", aStr.GetBuffer() );
+ }
+ }
+ if( nExit == 0 && aCommand.aSlotMapFile.Len() )
+ {
+ DirEntry aDE( aCommand.aSlotMapFile );
+ aDE.ToAbs();
+ aTmpSlotMapFile = aDE.GetPath().TempName().GetFull();
+ SvFileStream aOutStm( aTmpSlotMapFile, STREAM_READWRITE | STREAM_TRUNC );
+ if( !pDataBase->WriteSfx( aOutStm ) )
+ {
+ nExit = -1;
+ ByteString aStr = "cannot write slotmap file: ";
+ aStr += ByteString( aCommand.aSlotMapFile, RTL_TEXTENCODING_UTF8 );
+ fprintf( stderr, "%s\n", aStr.GetBuffer() );
+ }
+ }
+ if( nExit == 0 && aCommand.aHelpIdFile.Len() )
+ {
+ DirEntry aDE( aCommand.aHelpIdFile );
+ aDE.ToAbs();
+ aTmpHelpIdFile = aDE.GetPath().TempName().GetFull();
+ SvFileStream aStm( aTmpHelpIdFile, STREAM_READWRITE | STREAM_TRUNC );
+ if (!pDataBase->WriteHelpIds( aStm ) )
+ {
+ nExit = -1;
+ ByteString aStr = "cannot write help ID file: ";
+ aStr += ByteString( aCommand.aHelpIdFile, RTL_TEXTENCODING_UTF8 );
+ fprintf( stderr, "%s\n", aStr.GetBuffer() );
+ }
+ }
+ if( nExit == 0 && aCommand.aCSVFile.Len() )
+ {
+ DirEntry aDE( aCommand.aCSVFile );
+ aDE.ToAbs();
+ aTmpCSVFile = aDE.GetPath().TempName().GetFull();
+ SvFileStream aStm( aTmpCSVFile, STREAM_READWRITE | STREAM_TRUNC );
+ if (!pDataBase->WriteCSV( aStm ) )
+ {
+ nExit = -1;
+ ByteString aStr = "cannot write CSV file: ";
+ aStr += ByteString( aCommand.aCSVFile, RTL_TEXTENCODING_UTF8 );
+ fprintf( stderr, "%s\n", aStr.GetBuffer() );
+ }
+ }
+ if( nExit == 0 && aCommand.aSfxItemFile.Len() )
+ {
+ DirEntry aDE( aCommand.aSfxItemFile );
+ aDE.ToAbs();
+ aTmpSfxItemFile = aDE.GetPath().TempName().GetFull();
+ SvFileStream aOutStm( aTmpSfxItemFile, STREAM_READWRITE | STREAM_TRUNC );
+ if( !pDataBase->WriteSfxItem( aOutStm ) )
+ {
+ nExit = -1;
+ ByteString aStr = "cannot write item file: ";
+ aStr += ByteString( aCommand.aSfxItemFile, RTL_TEXTENCODING_UTF8 );
+ fprintf( stderr, "%s\n", aStr.GetBuffer() );
+ }
+ }
+ if( nExit == 0 && aCommand.aDataBaseFile.Len() )
+ {
+ DirEntry aDE( aCommand.aDataBaseFile );
+ aDE.ToAbs();
+ aTmpDataBaseFile = aDE.GetPath().TempName().GetFull();
+ SvFileStream aOutStm( aTmpDataBaseFile, STREAM_READWRITE | STREAM_TRUNC );
+ pDataBase->Save( aOutStm, aCommand.nFlags );
+ if( aOutStm.GetError() != SVSTREAM_OK )
+ {
+ nExit = -1;
+ ByteString aStr = "cannot write database file: ";
+ aStr += ByteString( aCommand.aDataBaseFile, RTL_TEXTENCODING_UTF8 );
+ fprintf( stderr, "%s\n", aStr.GetBuffer() );
+ }
+ }
+/*
+ if( nExit == 0 && aCommand.aCallingFile.Len() )
+ {
+ DirEntry aDE( aCommand.aCallingFile );
+ aDE.ToAbs();
+ aTmpCallingFile = aDE.GetPath().TempName().GetFull();
+ SvFileStream aOutStm( aTmpCallingFile, STREAM_READWRITE | STREAM_TRUNC );
+ pDataBase->WriteSbx( aOutStm );
+ //pDataBase->Save( aOutStm, aCommand.nFlags | IDL_WRITE_CALLING );
+ if( aOutStm.GetError() != SVSTREAM_OK )
+ {
+ nExit = -1;
+ ByteString aStr = "cannot write calling file: ";
+ aStr += aCommand.aCallingFile;
+ fprintf( stderr, "%s\n", aStr.GetStr() );
+ }
+ }
+ if( nExit == 0 && aCommand.aCxxFile.Len() )
+ {
+ DirEntry aDE( aCommand.aCxxFile );
+ aDE.ToAbs();
+ aTmpCxxFile = aDE.GetPath().TempName().GetFull();
+ SvFileStream aOutStm( aTmpCxxFile, STREAM_READWRITE | STREAM_TRUNC );
+
+ aOutStm << "#pragma hdrstop" << endl;
+ aOutStm << "#include <";
+ if( aCommand.aHxxFile.Len() )
+ aOutStm << DirEntry(aCommand.aHxxFile).GetName().GetBuffer();
+ else
+ {
+ DirEntry aDE( aCommand.aCxxFile );
+ aDE.SetExtension( "hxx" );
+ aOutStm << aDE.GetName().GetBuffer);
+ }
+ aOutStm << '>' << endl;
+ if( !pDataBase->WriteCxx( aOutStm ) )
+ {
+ nExit = -1;
+ ByteString aStr = "cannot write cxx file: ";
+ aStr += ByteString( aCommand.aCxxFile, RTL_TEXTENCODING_UTF8 );
+ fprintf( stderr, "%s\n", aStr.GetBuffer() );
+ }
+ }
+ if( nExit == 0 && aCommand.aHxxFile.Len() )
+ {
+ DirEntry aDE( aCommand.aHxxFile );
+ aDE.ToAbs();
+ aTmpHxxFile = aDE.GetPath().TempName().GetFull();
+ SvFileStream aOutStm( aTmpHxxFile, STREAM_READWRITE | STREAM_TRUNC );
+
+ aOutStm << "#include <somisc.hxx>" << endl;
+ if( !pDataBase->WriteHxx( aOutStm ) )
+ {
+ nExit = -1;
+ ByteString aStr = "cannot write cxx file: ";
+ aStr += ByteString( aCommand.aHxxFile, RTL_TEXTENCODING_UTF8 );
+ fprintf( stderr, "%s\n", aStr.GetBuffer() );
+ }
+ }
+ */
+ }
+ else
+ nExit = -1;
+
+ if( nExit == 0 )
+ {
+ BOOL bErr = FALSE;
+ BOOL bDoMove = aCommand.aTargetFile.Len() == 0;
+ String aErrFile;
+ if( !bErr && aCommand.aListFile.Len() )
+ {
+ bErr |= !FileMove_Impl( aCommand.aListFile, aTmpListFile, bDoMove );
+ if( bErr )
+ aErrFile = aCommand.aListFile;
+ }
+ if( !bErr && aCommand.aSlotMapFile.Len() )
+ {
+ bErr |= !FileMove_Impl( aCommand.aSlotMapFile, aTmpSlotMapFile, bDoMove );
+ if( bErr )
+ aErrFile = aCommand.aSlotMapFile;
+ }
+ if( !bErr && aCommand.aSfxItemFile.Len() )
+ {
+ bErr |= !FileMove_Impl( aCommand.aSfxItemFile, aTmpSfxItemFile, bDoMove );
+ if( bErr )
+ aErrFile = aCommand.aSfxItemFile;
+ }
+ if( !bErr && aCommand.aDataBaseFile.Len() )
+ {
+ bErr |= !FileMove_Impl( aCommand.aDataBaseFile, aTmpDataBaseFile, bDoMove );
+ if( bErr )
+ aErrFile = aCommand.aDataBaseFile;
+ }
+ if( !bErr && aCommand.aCallingFile.Len() )
+ {
+ bErr |= !FileMove_Impl( aCommand.aCallingFile, aTmpCallingFile, bDoMove );
+ if( bErr )
+ aErrFile = aCommand.aCallingFile;
+ }
+ if( !bErr && aCommand.aCxxFile.Len() )
+ {
+ bErr |= !FileMove_Impl( aCommand.aCxxFile, aTmpCxxFile, bDoMove );
+ if( bErr )
+ aErrFile = aCommand.aCxxFile;
+ }
+ if( !bErr && aCommand.aHxxFile.Len() )
+ {
+ bErr |= !FileMove_Impl( aCommand.aHxxFile, aTmpHxxFile, bDoMove );
+ if( bErr )
+ aErrFile = aCommand.aHxxFile;
+ }
+ if( !bErr && aCommand.aHelpIdFile.Len() )
+ {
+ bErr |= !FileMove_Impl( aCommand.aHelpIdFile, aTmpHelpIdFile, bDoMove );
+ if( bErr )
+ aErrFile = aCommand.aHelpIdFile;
+ }
+ if( !bErr && aCommand.aCSVFile.Len() )
+ {
+ bErr |= !FileMove_Impl( aCommand.aCSVFile, aTmpCSVFile, bDoMove );
+ if( bErr )
+ aErrFile = aCommand.aCSVFile;
+ }
+ if( !bErr && aCommand.aDocuFile.Len() )
+ {
+ bErr |= !FileMove_Impl( aCommand.aDocuFile, aTmpDocuFile, bDoMove );
+ if( bErr )
+ aErrFile = aCommand.aDocuFile;
+ }
+
+ if( bErr )
+ {
+ nExit = -1;
+ ByteString aStr = "cannot write file: ";
+ aStr += ByteString( aErrFile, RTL_TEXTENCODING_UTF8 );
+ fprintf( stderr, "%s\n", aStr.GetBuffer() );
+ }
+ else
+ {
+ if( aCommand.aTargetFile.Len() )
+ {
+#ifdef ICC
+ DirEntry aT(aCommand.aTargetFile);
+ aT.Kill();
+#endif
+ // Datei stempeln, da idl korrekt durchlaufen wurde
+ SvFileStream aOutStm( aCommand.aTargetFile,
+ STREAM_READWRITE | STREAM_TRUNC );
+ }
+ }
+ }
+
+ if( nExit != 0 )
+ {
+ if( aCommand.aListFile.Len() )
+ DirEntry( aTmpListFile ).Kill();
+ if( aCommand.aSlotMapFile.Len() )
+ DirEntry( aTmpSlotMapFile ).Kill();
+ if( aCommand.aSfxItemFile.Len() )
+ DirEntry( aTmpSfxItemFile ).Kill();
+ if( aCommand.aDataBaseFile.Len() )
+ DirEntry( aTmpDataBaseFile ).Kill();
+ if( aCommand.aCallingFile.Len() )
+ DirEntry( aTmpCallingFile ).Kill();
+ if( aCommand.aCxxFile.Len() )
+ DirEntry( aTmpCxxFile ).Kill();
+ if( aCommand.aHxxFile.Len() )
+ DirEntry( aTmpHxxFile ).Kill();
+ }
+
+ delete pDataBase;
+ DeInit();
+ if( nExit != 0 )
+ fprintf( stderr, "svidl terminated with errors\n" );
+ return nExit;
+}
+