xref: /AOO41X/main/basic/source/inc/filefmt.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _SB_FILEFMT_HXX
29*cdf0e10cSrcweir #define _SB_FILEFMT_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <tools/solar.h>
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir class SvStream;
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir // Version  2: Datentyp des Returnwerts fuer Publics
36*cdf0e10cSrcweir // Version  3: neue Opcodes
37*cdf0e10cSrcweir // Version  4: neue Opcodes
38*cdf0e10cSrcweir // Version  5: Bug (Ansprung von STATIC-Variablen im Init-Code)
39*cdf0e10cSrcweir // Version  6: Neue Opcodes und Bug (Globals anlegen, ohne BASIC zu beenden)
40*cdf0e10cSrcweir // Version  7: Korrektur im WITH-Parsing
41*cdf0e10cSrcweir // Version  8: Korrektur im IF-Parsing
42*cdf0e10cSrcweir // Version  9: Init-Code auch mit LEAVE beenden, wenn keine SUB/FUNCTION folgt
43*cdf0e10cSrcweir // Version  A: #36374 Bei DIM AS NEW... auch Variablen anlegen
44*cdf0e10cSrcweir // Version  B: #40689 Static umgestellt
45*cdf0e10cSrcweir // Version  C: #41606 Bug bei Static
46*cdf0e10cSrcweir // Version  D: #42678 Bug bei RTL-Function spc
47*cdf0e10cSrcweir // Version  E: #56204 DCREATE, um auch bei DIM AS NEW Arrays anzulegen
48*cdf0e10cSrcweir // Version  F: #57844 Einfuehrung von SvNumberformat::StringToDouble
49*cdf0e10cSrcweir // Version 10: #29955 For-Schleifen-Level in Statement-PCodes generieren
50*cdf0e10cSrcweir // Version 11: #29955 Wegen Build-Inkonsistenzen Neu-Compilieren erzwingen
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir #define B_LEGACYVERSION 0x00000011L
53*cdf0e10cSrcweir #define B_CURVERSION 0x00000012L
54*cdf0e10cSrcweir #define B_EXT_IMG_VERSION 0x00000012L
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir // Eine Datei enthaelt entweder einen Modul- oder einen Library-Record.
57*cdf0e10cSrcweir // Diese Records enthalten wiederum weitere Records. Jeder Record hat
58*cdf0e10cSrcweir // den folgenden Header:
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir //  sal_uInt16 Kennung
61*cdf0e10cSrcweir //  sal_uInt32 Laenge des Records ohne Header
62*cdf0e10cSrcweir //  sal_uInt16 Anzahl Unterelemente
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir // Alle Datei-Offsets in Records sind relativ zum Start des Moduls!
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir #define B_LIBRARY		0x4C42		// BL Library Record
67*cdf0e10cSrcweir #define	B_MODULE		0x4D42		// BM Module Record
68*cdf0e10cSrcweir #define	B_NAME			0x4E4D		// MN module name
69*cdf0e10cSrcweir #define	B_COMMENT		0x434D		// MC comment
70*cdf0e10cSrcweir #define	B_SOURCE		0x4353		// SC source code
71*cdf0e10cSrcweir #define	B_PCODE			0x4350		// PC p-code
72*cdf0e10cSrcweir #define	B_OLDPUBLICS 	0x7550		// Pu publics
73*cdf0e10cSrcweir #define	B_PUBLICS 		0x5550		// PU publics
74*cdf0e10cSrcweir #define	B_POOLDIR 		0x4450		// PD symbol pool directory
75*cdf0e10cSrcweir #define	B_SYMPOOL		0x5953		// SY symbol pool
76*cdf0e10cSrcweir #define	B_STRINGPOOL	0x5453		// ST symbol pool
77*cdf0e10cSrcweir #define	B_LINERANGES	0x524C		// LR line ranges for publics
78*cdf0e10cSrcweir #define	B_MODEND		0x454D		// ME module end
79*cdf0e10cSrcweir #define	B_SBXOBJECTS	0x5853		// SX SBX objects
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir #define	EXTENDED_BINARY_MODULES
82*cdf0e10cSrcweir #ifdef  EXTENDED_BINARY_MODULES
83*cdf0e10cSrcweir #define	B_EXTSOURCE		0x5345		// ES extended source
84*cdf0e10cSrcweir #endif
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir // Ein Library Record enthaelt nur Module Records
87*cdf0e10cSrcweir //  sal_uInt16 Kennung BL
88*cdf0e10cSrcweir //  sal_uInt32 Laenge des Records
89*cdf0e10cSrcweir //  sal_uInt16 Anzahl Module
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir // Ein Modul-Record enthaelt alle anderen Recordtypen
92*cdf0e10cSrcweir //  sal_uInt16 Kennung BM
93*cdf0e10cSrcweir //  sal_uInt32 Laenge des Records
94*cdf0e10cSrcweir //  sal_uInt16 1
95*cdf0e10cSrcweir // Daten:
96*cdf0e10cSrcweir //  sal_uInt32 Versionsnummer
97*cdf0e10cSrcweir //  sal_uInt32 Zeichensatz
98*cdf0e10cSrcweir //  sal_uInt32 Startadresse Initialisierungscode
99*cdf0e10cSrcweir //  sal_uInt32 Startadresse Sub Main
100*cdf0e10cSrcweir //  sal_uInt32 Reserviert
101*cdf0e10cSrcweir //  sal_uInt32 Reserviert
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir // Modulname, Kommentar und Quellcode:
104*cdf0e10cSrcweir //  sal_uInt16 Kennung MN, MC oder SC
105*cdf0e10cSrcweir //  sal_uInt32 Laenge des Records
106*cdf0e10cSrcweir //  sal_uInt16 1
107*cdf0e10cSrcweir // Daten:
108*cdf0e10cSrcweir //  String-Instanz
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir // P-Code:
111*cdf0e10cSrcweir //  sal_uInt16 Kennung PC
112*cdf0e10cSrcweir //  sal_uInt32 Laenge des Records
113*cdf0e10cSrcweir //  sal_uInt16 1
114*cdf0e10cSrcweir // Daten:
115*cdf0e10cSrcweir //  Der P-Code als Bytesack
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir // Alle Symbole und Strings werden in einem String-Pool gehalten.
118*cdf0e10cSrcweir // Verweise auf diese Strings sind in Form eines Indexes in diesen Pool.
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir // Liste aller Publics:
121*cdf0e10cSrcweir //  sal_uInt16 Kennung PU oder Pu
122*cdf0e10cSrcweir //  sal_uInt32 Laenge des Records
123*cdf0e10cSrcweir //  sal_uInt16 Anzahl der Publics
124*cdf0e10cSrcweir // Daten fuer jeden Public-Eintrag:
125*cdf0e10cSrcweir //  sal_uInt16 String-Index
126*cdf0e10cSrcweir //  sal_uInt32 Startadresse im P-Code-Image (sal_uInt16 fuer alte Publics)
127*cdf0e10cSrcweir //  sal_uInt16 Datentyp des Returnwertes (ab Version 2)
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir // Verzeichnis der Symbol-Tabellen:
130*cdf0e10cSrcweir //  sal_uInt16 Kennung SP
131*cdf0e10cSrcweir //  sal_uInt32 Laenge des Records
132*cdf0e10cSrcweir //  sal_uInt16 Anzahl der Symboltabellen
133*cdf0e10cSrcweir // Daten fuer jede Symboltabelle:
134*cdf0e10cSrcweir //  sal_uInt16 Stringindex des Namens
135*cdf0e10cSrcweir //  sal_uInt16 Anzahl Symbole
136*cdf0e10cSrcweir //  sal_uInt16 Scope-Kennung
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir // Symboltabelle:
139*cdf0e10cSrcweir //  sal_uInt16 Kennung SY
140*cdf0e10cSrcweir //  sal_uInt32 Laenge des Records
141*cdf0e10cSrcweir //  sal_uInt16 Anzahl der Symbole
142*cdf0e10cSrcweir // Daten:
143*cdf0e10cSrcweir //  sal_uInt16 Stringindex des Namens
144*cdf0e10cSrcweir //  sal_uInt16 Anzahl Symbole
145*cdf0e10cSrcweir // Daten fuer jedes Symbol:
146*cdf0e10cSrcweir //  sal_uInt16 Stringindex des Namens
147*cdf0e10cSrcweir //  sal_uInt16 Datentyp
148*cdf0e10cSrcweir //  sal_uInt16 Laenge bei STRING*n-Symbolen (0x8000: STATIC-Variable)
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir // Stringpool:
151*cdf0e10cSrcweir //  sal_uInt16 Kennung ST
152*cdf0e10cSrcweir //  sal_uInt32 Laenge des Records
153*cdf0e10cSrcweir //  sal_uInt16 Anzahl der Strings
154*cdf0e10cSrcweir // Daten fuer jeden String:
155*cdf0e10cSrcweir //  sal_uInt32 Offset in den Block aller Strings
156*cdf0e10cSrcweir // Danach folgt der Block aller Strings, die dort als ASCIIZ-Strings liegen.
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir // Line Ranges:
159*cdf0e10cSrcweir //  sal_uInt16 Kennung LR
160*cdf0e10cSrcweir //  sal_uInt32 Laenge des Records
161*cdf0e10cSrcweir //  sal_uInt16 Anzahl der Strings
162*cdf0e10cSrcweir // Daten fuer jedes Public:
163*cdf0e10cSrcweir //  sal_uInt16 1. Zeile (Sub XXX)
164*cdf0e10cSrcweir //  sal_uInt16 2. Zeile (End Sub)
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir // SBX-Objekte:
167*cdf0e10cSrcweir // sal_uInt16 Anzahl Objekte
168*cdf0e10cSrcweir // ....   Objektdaten
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir // Service-Routinen (in IMAGE.CXX)
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir sal_Bool  SbGood( SvStream& r );
175*cdf0e10cSrcweir sal_uIntPtr SbOpenRecord( SvStream&, sal_uInt16 nSignature, sal_uInt16 nElem );
176*cdf0e10cSrcweir void  SbCloseRecord( SvStream&, sal_uIntPtr );
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir #endif
179