diff options
Diffstat (limited to 'rsc')
82 files changed, 41760 insertions, 0 deletions
diff --git a/rsc/doku/feinkonz.43/rsc.doc b/rsc/doku/feinkonz.43/rsc.doc new file mode 100644 index 000000000000..5727feb5b6f0 --- /dev/null +++ b/rsc/doku/feinkonz.43/rsc.doc @@ -0,0 +1,4096 @@ +.\\\ WRITER 6 \\\
+C:\ALMUT\SV\SVREF5.LAY
+R:\SW55N\TREIBER\PS.GPM
+12
+00000
+00010
+01463
+00001
+00001
+00001
+00002
+00002
+00000
+00000
+00000
+00000
+MM
+User Doku
+RSC
+RSC-Beschreibung
+
+
+
+
+
+
+0
+11905
+8390
+0
+0
+JA
+3
+75
+0
+20
+0
+0
+0
+0
+0
+0
+0
+JA
+
+
+
+6
+16
+29
+courier 9.5
+C1
+33
+19
+0
+
+Helvetica 14 Pt Fett
+F1
+65
+28
+2
+
+Helvetica 12 Pt Fett
+F2
+65
+24
+2
+
+Helvetia 10 Pt Fett
+F3
+65
+20
+2
+
+Times 10
+T1
+97
+20
+0
+
+Courier 7
+C2
+33
+14
+0
+
+Grund - Absatzlayout
+GA
+0
+0
+0
+0
+5
+97
+20
+0
+0
+0
+1
+NEIN
+NEIN
+NEIN
+238
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+Listing
+LI
+0
+0
+0
+0
+1
+33
+19
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+238
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+432
+0
+0
+1008
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+7632
+0
+0
+8352
+0
+0
+Funktionsparameter
+FP
+0
+2449
+0
+0
+5
+97
+20
+0
+0
+0
+1
+NEIN
+NEIN
+NEIN
+238
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+8
+2448
+0
+0
+3024
+0
+0
+3600
+0
+0
+4176
+0
+0
+4752
+0
+0
+5328
+0
+0
+5904
+0
+0
+6480
+0
+0
+Unterberschrift
+F1
+0
+0
+0
+0
+4
+65
+20
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+238
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+Punktliste
+PL
+0
+289
+0
+0
+5
+97
+20
+0
+0
+0
+1
+NEIN
+NEIN
+NEIN
+238
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+1
+288
+0
+0
+berschrift Klasse
+U1
+0
+0
+0
+0
+2
+65
+28
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+238
+1
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+berschrift Methode
+U0
+0
+0
+0
+0
+2
+65
+24
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+238
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+Kopfzeile rechts
+KR
+0
+0
+0
+0
+4
+65
+20
+0
+2
+0
+1
+NEIN
+NEIN
+NEIN
+238
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+1
+7920
+1
+0
+Kopfzeile links
+KL
+0
+0
+0
+0
+4
+65
+20
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+238
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+1
+6916
+1
+0
+Fuzeile linksbndig
+FL
+0
+0
+0
+0
+4
+65
+20
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+238
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+1
+5952
+1
+0
+Fuzeile rechtsbndig
+FR
+0
+0
+0
+0
+4
+65
+20
+0
+2
+0
+1
+NEIN
+NEIN
+NEIN
+0
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+1
+6768
+1
+0
+Linie linksbndig
+LL
+0
+0
+0
+0
+4
+65
+20
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+0
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+1
+7920
+1
+0
+Linie rechtsbndig
+LR
+0
+0
+0
+0
+4
+65
+20
+0
+2
+0
+1
+NEIN
+NEIN
+NEIN
+0
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+1
+7920
+1
+0
+Tabelle
+TB
+0
+0
+0
+0
+6
+33
+14
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+120
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+rechtsbndiger Fustrich
+RS
+0
+0
+0
+0
+4
+65
+20
+0
+2
+0
+1
+NEIN
+NEIN
+NEIN
+238
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+1
+5952
+1
+0
+linksbndiger Fustrich
+LS
+0
+0
+0
+0
+4
+65
+20
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+238
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+1
+5952
+1
+0
+Starlab-Layout
+GS
+566
+440
+850
+566
+1133
+680
+0
+0
+1
+NEIN
+0
+0
+
+Akl#_PFAD##_TEXTNAME# ,-#_S#-
+All______________________________________________________________
+
+Als______________________________________________________________
+Afl$Date: 23 Jan 1992 14:42:12 $
+Afr4$Revision: 1.25 $
+
+Resource linke Seite
+L2
+566
+440
+850
+566
+1133
+680
+0
+2
+1
+NEIN
+0
+0
+
+AklResource
+All______________________________________________________________
+
+Ars______________________________________________________________
+Afl-#_S#-
+Afr3StarView - Referenz
+
+Resource rechte Seite
+L3
+566
+440
+850
+566
+1133
+680
+0
+1
+1
+NEIN
+0
+0
+
+Akr=Resource
+Alr______________________________________________________________
+
+Als______________________________________________________________
+Afl(c) 1990/1991 StarDivision
+Afr@-#_S#-
+
+Resourcecompiler linke Seite
+L4
+566
+440
+850
+566
+1133
+680
+0
+2
+1
+NEIN
+0
+0
+
+AklResourcecompiler
+All______________________________________________________________
+
+Ars______________________________________________________________
+Afl-#_S#-
+Afr3StarView - Referenz
+
+Resourcecompiler rechte Seite
+L5
+566
+440
+850
+566
+1133
+680
+0
+1
+1
+NEIN
+0
+0
+
+Akr4Resourcecompiler
+Alr______________________________________________________________
+
+Als______________________________________________________________
+Afl(c) 1990/1991 StarDivision
+Afr@-#_S#-
+
+ResOwner linke Seite
+L6
+566
+440
+850
+566
+1133
+680
+0
+2
+1
+NEIN
+0
+0
+
+AklResOwner
+All______________________________________________________________
+
+Ars______________________________________________________________
+Afl-#_S#-
+Afr3StarView - Referenz
+
+ResOwner rechte Seite
+L7
+566
+440
+850
+566
+1133
+680
+0
+1
+1
+NEIN
+0
+0
+
+Akr<ResOwner
+Alr______________________________________________________________
+
+Als______________________________________________________________
+Afl(c) 1990/1991 StarDivision
+Afr@-#_S#-
+
+ScrollBar linke Seite
+L8
+566
+440
+850
+566
+1133
+680
+0
+2
+1
+NEIN
+0
+0
+
+AklScrollBar
+All______________________________________________________________
+
+Ars______________________________________________________________
+Afl-#_S#-
+Afr3StarView - Referenz
+
+ScrollBar rechte Seite
+L9
+566
+440
+850
+566
+1133
+680
+0
+1
+1
+NEIN
+0
+0
+
+Akr=ScrollBar
+Alr______________________________________________________________
+
+Als______________________________________________________________
+Afl(c) 1990/1991 StarDivision
+Afr@-#_S#-
+
+SingleLineEdit linke Seite
+M0
+566
+440
+850
+566
+1133
+680
+0
+2
+1
+NEIN
+0
+0
+
+AklSingleLineEdit
+All______________________________________________________________
+
+Ars______________________________________________________________
+Afl-#_S#-
+Afr3StarView - Referenz
+
+SingleLineEdit rechte Seite
+M1
+566
+440
+850
+566
+1133
+680
+0
+1
+1
+NEIN
+0
+0
+
+Akr8SingleLineEdit
+Alr______________________________________________________________
+
+Als______________________________________________________________
+Afl(c) 1990/1991 StarDivision
+Afr@-#_S#-
+
+SysMessBox linke Seite
+M2
+566
+440
+850
+566
+1133
+680
+0
+2
+1
+NEIN
+0
+0
+
+AklSysMessBox
+All______________________________________________________________
+
+Ars______________________________________________________________
+Afl-#_S#-
+Afr3StarView - Referenz
+
+SYsMessBox rechte Seite
+M3
+566
+440
+850
+566
+1133
+680
+0
+1
+1
+NEIN
+0
+0
+
+Akr:SysMessBox
+Alr______________________________________________________________
+
+Als______________________________________________________________
+Afl(c) 1990/1991 StarDivision
+Afr@-#_S#-
+
+System linke Seite
+M4
+566
+440
+850
+566
+1133
+680
+0
+2
+1
+NEIN
+0
+0
+
+AklSystem
+All______________________________________________________________
+
+Ars______________________________________________________________
+Afl-#_S#-
+Afr3StarView - Referenz
+
+System rechte Seite
+M5
+566
+440
+850
+566
+1133
+680
+0
+1
+1
+NEIN
+0
+0
+
+Akr?System
+Alr______________________________________________________________
+
+Als______________________________________________________________
+Afl(c) 1990/1991 StarDivision
+Afr@-#_S#-
+
+SystemWindow linke Seite
+M6
+566
+440
+850
+566
+1133
+680
+0
+2
+1
+NEIN
+0
+0
+
+AklSystemWindow
+All______________________________________________________________
+
+Ars______________________________________________________________
+Afl-#_S#-
+Afr3StarView - Referenz
+
+SystemWindow rechte Seite
+M7
+566
+440
+850
+566
+1133
+680
+0
+1
+1
+NEIN
+0
+0
+
+Akr7SystemWindow
+Alr______________________________________________________________
+
+Als______________________________________________________________
+Afl(c) 1990/1991 StarDivision
+Afr@-#_S#-
+
+Timer linke Seite
+M8
+566
+440
+850
+566
+1133
+680
+0
+2
+1
+NEIN
+0
+0
+
+AklTimer
+All______________________________________________________________
+
+Ars______________________________________________________________
+Afl-#_S#-
+Afr3StarView - Referenz
+
+Timer rechte Seite
+M9
+566
+440
+850
+566
+1133
+680
+0
+1
+1
+NEIN
+0
+0
+
+Akr@Timer
+Alr______________________________________________________________
+
+Als______________________________________________________________
+Afl(c) 1990/1991 StarDivision
+Afr@-#_S#-
+
+VirtualDevice linke Seite
+N0
+566
+440
+850
+566
+1133
+680
+0
+2
+1
+NEIN
+0
+0
+
+AklVirtualDevice
+All______________________________________________________________
+
+Ars______________________________________________________________
+Afl-#_S#-
+Afr3StarView - Referenz
+
+VirtualDevice rechte Seite
+N1
+566
+440
+850
+566
+1133
+680
+0
+1
+1
+NEIN
+0
+0
+
+Akr9VirtualDevice
+Alr______________________________________________________________
+
+Als______________________________________________________________
+Afl(c) 1990/1991 StarDivision
+Afr@-#_S#-
+
+VirtualPrinter linke Seite
+N2
+566
+440
+850
+566
+1133
+680
+0
+2
+1
+NEIN
+0
+0
+
+AklVirtualPrinter
+All______________________________________________________________
+
+Ars______________________________________________________________
+Afl-#_S#-
+Afr3StarView - Referenz
+
+VirtualPrinter rechte Seite
+N3
+566
+440
+850
+566
+1133
+680
+0
+1
+1
+NEIN
+0
+0
+
+Akr9VirtualPrinter
+Alr______________________________________________________________
+
+Als______________________________________________________________
+Afl(c) 1990/1991 StarDivision
+Afr@-#_S#-
+
+VScrollBar linke Seite
+N4
+566
+440
+850
+566
+1133
+680
+0
+2
+1
+NEIN
+0
+0
+
+AklVScrollBar
+All______________________________________________________________
+
+Ars______________________________________________________________
+Afl-#_S#-
+Afr3StarView - Referenz
+
+VScrollBar rechte Seite
+N5
+566
+440
+850
+566
+1133
+680
+0
+1
+1
+NEIN
+0
+0
+
+Akr<VScrollBar
+Alr______________________________________________________________
+
+Als______________________________________________________________
+Afl(c) 1990/1991 StarDivision
+Afr@-#_S#-
+
+WarningBox linke Seite
+N6
+566
+440
+850
+566
+1133
+680
+0
+2
+1
+NEIN
+0
+0
+
+AklWarningBox
+All______________________________________________________________
+
+Ars______________________________________________________________
+Afl-#_S#-
+Afr3StarView - Referenz
+
+WarningBox rechte Seite
+N7
+566
+440
+850
+566
+1133
+680
+0
+1
+1
+NEIN
+0
+0
+
+Akr:WarningBox
+Alr______________________________________________________________
+
+Als______________________________________________________________
+Afl(c) 1990/1991 StarDivision
+Afr@-#_S#-
+
+WinBits linke Seite
+N8
+566
+440
+850
+566
+1133
+680
+0
+2
+1
+NEIN
+0
+0
+
+AklWinBits
+All______________________________________________________________
+
+Ars______________________________________________________________
+Afl-#_S#-
+Afr3StarView - Referenz
+
+WinBits rechte Seite
+N9
+566
+440
+850
+566
+1133
+680
+0
+1
+1
+NEIN
+0
+0
+
+Akr>WinBits
+Alr______________________________________________________________
+
+Als______________________________________________________________
+Afl(c) 1990/1991 StarDivision
+Afr@-#_S#-
+
+
+
+
+0
+
+0
+
+SkfAga
+
+
+
+
+
+
+
+
+
+Au0 #_KATEGORIE#
+Aga
+
+Au0 #_THEMA2#
+Aga
+
+Au0
+Aga
+
+
+
+
+
+
+
+
+
+
+
+
+Au0 #_AUTOR#
+Aga
+
+Au0 STAR DIVISION / STAR LAB Hamburg
+Aga
+
+Au0 Stand: $Date: 23 Jan 1992 14:42:12 $
+Aga
+
+Sgs
+SkfAgaPA
+
+
+Au0#_KATEGORIE#
+Aga
+
+
+AfpDokumentenname #_THEMA2#
+Aga
+AfpProjektname #_THEMA1#
+Aga
+AfpVersionsnummer $Revision: 1.25 $
+Aga
+
+Afperstellt 31. Juli 1990
+Aga
+Afpgendert $Date: 23 Jan 1992 14:42:12 $
+Aga
+
+AfpDateiname #_PFAD##_TEXTNAME#
+Aga
+
+AfpAutor #_AUTOR#
+Aga
+AfpBearbeiter $Author: MM $
+Aga
+AfpQualittskontrolle
+Aga
+
+AfpStatus XX in Arbeit
+Afp __ fertiggestellt
+Afp __ abgenommen
+Afp __ freigegeben
+Aga
+
+AfpVertraulich __ Ja XX Nein
+Aga
+
+AfpCopyright (C) Star Division 1990
+Aga
+Sgs
+SivAu0PA
+
+Au0Inhaltsverzeichnis
+Aga
+StarView Resourcecompiler 4
+Einleitung 4
+Bekannte Fehler 4
+Systemabhngigkeiten 4
+Installationshinweise 5
+rsc-Kommandozeile 5
+rsc-Preprocessor 7
+Default Preprozessor 8
+Einfaches Beispiel 9
+Syntax 16
+Klassen-Erklrung: Resource -> StarView 18
+Spezielle Syntax-Konstrukte 59
+Stichwortverzeichnis 63
+
+SgsAiv
+Aga
+Au1paStarView Resourcecompiler
+Aga
+
+Au1Einleitung
+Aga
+Diese Beschreibung gilt fr den Resourcecompiler in der Version 1.21.
+
+Der StarView Resourcecompiler ( rsc ) dient dazu, die systemunabhngigen Resourcen +in den Beschreibungsdateien in systemabhngige Beschreibungsdateien zu berfhren, +die dann mit den systemabhngigen Resourcecompilern effizient (Laufzeit) in binre +Resourcen bersetzt werden.
+
+
+Au1Bekannte Fehler
+Aga
+Apl- Unter Unix (Motif) werden noch keine Icons, Bitmaps und Pointer untersttzt.
+- Die TMP-Environmentvariable darf keinen "\" am Ende haben (MS-DOS).
+- Unter MS-DOS wird die ".rc"-Datei nicht gelscht.
+- Der rscpp gibt die Zeilennummern nicht richtig aus.
+- Unter Unix und MAC darf die src-Datei am Ende kein ^Z haben.
+Aga
+
+Au1Systemabhngigkeiten
+Aga
+Die Resource-Scriptdatei (".src") ist bis auf die Typen Icon, Bitmap und Pointer unab +hngig. Jede Resource dieser drei Typen steht in einer eigenen Datei. Ob das Format +oder die Version korrekt sind, wird durch den systemabhngigen Resourcecompiler +(rc, uid, rez) entschieden.
+
+Die Pfadnamen in den Include-Anweisungen sind systemabhngig. Unter MS-DOS ist +der Pfadname z.B. "..\..\..", unter Unix ist er z.B. "../../.." und unter dem Betriebssystem +des Macintosh z.B. ":: ".
+
+Die erstellten Resourcedateien sind nicht nur betriebssystemabhngig, sondern auch +processor- bzw. compilerabhngig. Dies betrifft die Lnge des int und die Darstellung +(Drehungen) von ganzzahligen Datentypen.
+
+Die Default-Resourcedatei ist unter MS-Windows die ausfhrbare Datei, unter Unix +(Motif) die ausfhrbare Datei mit der Extension ".res" und unter Macintosh noch nicht +festgelegt.
+
+Au1paLieferumfang
+Aga
+Dateien fuer den Macintosh:
+ rsc, rsc2, rscpp.
+Dateien fuer Motif:
+ rsc, rsc2, rscpp.
+Dateien fuer MS-DOS:
+ rsc.exe, rsc2.exe, rsc2r.exe, rsc2z.exe, rscpp, zpm.exe.
+
+Au1Installationshinweise
+Aga
+Beim Aufruf des rsc mssen der Preprocessor rscpp, der Parser rsc2 sowie der +systemabhngige Resourcecompiler rc.exe fr MSC-Windows unter MS-DOS, uid fr +Motif unter Unix und rez auf dem Macintosh im Zugriffspfad liegen. Der Preprozessor +kann durch einen eigenen ersetzt werden, wenn er den Schnittstellenanforderungen +gengt (siehe rsc-Preprocessor).
+Aga
+
+Au1rsc-Kommandozeile
+Aga
+Af1Syntax der Kommandozeile
+Aga
+Alirsc [<Schalter>...] <Quelldateiliste>
+rsc @<Kommandodatei>
+Aga
+Af1Schalter
+Aga
+Der rsc akzeptiert folgende Schalter:
+Aga
+-h Zeigt eine Hilfe fr die Kommandozeile an.
+Aga-p Es wird kein Preprozessor aufgerufen. Weiteres siehe "Default
+ Preprozessor".
+-s Es wird eine Syntaxanalyse durchgefhrt und eine ".srs"-Datei
+ geschrieben.
+-l Es wird eine Syntaxanalyse durchgefhrt, der Preprocessor wird
+ nicht aufgerufen. Es wird eine ".rc"-Datei geschrieben. Dann
+ wird der systemabhngige Resourcecompiler aufgerufen und
+ eine ".res"-Datei erzeugt.
+-r Der systemabhngige Resourcecompiler wird nicht aufgerufen.
+-d<Symbol> Es wird ein Symbol definiert.
+-i<Pfad> Der Include-Pfad fr den Preprocessor wird erweitert.
+-fl<Dateiname> Mit diesem Schalter wird eine Listing-Datei angegeben. In diese
+ Datei werden Fehlermeldungen ausgegeben.
+-fo<Dateiname> ndert den Namen der ".res"-Datei. Der Defaultname ist der
+ erste Name in der Quelldateiliste. Dieser Name bekommt die
+ Extension ".res". Die ".res"-Datei ist die vom Resourcecompiler
+ erzeugte binre Datei.
+-fs<Dateiname> ndert den Namen der ".rc"-Datei. Der Defaultname ist der erste
+ Name in der Quelldateiliste. Dieser Name bekommt die
+ Extension ".rc". Die ".rc"-Datei ist die vom Resourcecompiler
+ erzeugte systemabhngige Beschreibungsdatei.
+-fp<Dateiname> ndert den Namen der ".srs"-Datei. Der Defaultname ist der erste
+ Name in der Quelldateiliste. Dieser Name bekommt die
+ Extension ".srs". Die ".srs"-Datei ist eine symbolfreie
+ Beschreibungsdatei.
+-fc<Dateiname> In diese Datei werden die Resource-Konstruktoren der in der
+ Beschreibungsdatei spezifizierten Klassen geschrieben. Die
+ Sprache ist C++.
+-fh<Dateiname> In diese Datei werden die Deklarationen der in der
+ Beschreibungsdatei spezifizierten Klassen geschrieben. Die
+ Sprache ist C++.
+-WIN Es wird eine MS-Windows-Resourcedatei erstellt.
+-MTF Es wird eine Motif-Resourcedatei erstellt.
+-MAC Es wird eine Mac-Resourcedatei erstellt.
+-REFDEEP<Zahl> Die Zahl gibt an wie Tief der rsc-Compiler beim auflsen von
+ Referenzen gehen soll. Der Default ist 10, das heit der Compiler
+ lst verschachtelungen von Referenzen bis 10 auf.
+Aga
+Af1Kommandodatei
+Aga
+Die Kommandodatei hat folgende Syntax:
+Aga
+Ali[<Schalter>...] <Quelldateiliste>
+Aga
+Af1Beispiele
+Aga
+AliKommando: rsc test
+Aga
+Wirkung: Quelldatei heit "test.src".
+Ae2Die vom Preprocessor erzeugte Datei heit "test.srs".
+Die vom rsc-Compiler erzeugte Datei heit "test.rc".
+Die vom systemabhngigen Compiler erzeugte Datei heit "test.res".
+
+AliKommando: rsc -s -fpTest.srs Test1 Test2 Test3
+Aga
+Wirkung: Es wird nur eine Syntaxanalyse durchgefhrt.
+Ae2Die Quelldateien heien "Test1.src", "Test2.src" und "Test3.src".
+AgaDie vom Preprocessor erzeugte Datei heit "Test.srs".
+AgaWeitere Dateien werden nicht erzeugt.
+
+AliKommando: rsc -l test
+Aga
+Wirkung: Quelldatei heit "test.srs".
+Ae2Der Preprocessor wird nicht benutzt.
+Die vom rsc-Compiler erzeugte Datei heit "test.rc".
+Die vom systemabhngigen Compiler erzeugte Datei heit "test.res".
+Aga
+Au1parsc-Preprocessor
+Aga
+Af1Kommandozeile
+Aga
+AgaDie Kommandozeile hat folgende Syntax:
+
+Alirscpp [<Schalter>...] Quelldatei Zieldatei
+Aga
+Af1Schalter
+Aga
+-C Entfernt die Kommentare nicht( //, /* ... */ ).
+-D<Symbolname> Hat die gleiche Wirkung wie #define Symbolname in der Datei
+ selbst.
+-I<Pfadname> Gibt an, in welchen Verzeichnissen nach Include-Dateien gesucht
+ werden soll.
+
+Af1Preprocessor-Anweisungen
+Aga
+Der Preprocessor mu folgende Anweisungen verarbeiten knnen:
+
+#define Definiert ein Symbol.
+#undef Nimmt die Definition eines Symbols zurck.
+#if, #ifdef,
+#ifndef, #elif,
+#else und #endif Bedingte bersetzung.
+#include Eine Datei einschieben.
+
+Au1paDefault Preprozessor
+Aga
+Der "Default Preprozessor" erkennt nur die Schlsselwrter #define und #include. +Gro- und Kleinschreibung wird ignoriert.
+Hinter dem Schlsselwort #define mu eine Zahl definiert werden. Hierzu drfen +vorher mit dem Schlsselwort #define definierte Namen verwendet werden. Defines +drfen nicht an beliebiger Stelle in der Datei stehen.
+Hinter dem Schlsselwort #include mu ein Dateiname angegeben werden. Der Name +steht in spitzen Klammern oder in Anfhrungszeichen. Beide Formate werden gleich +interpretiert. Includedateien innerhalb von Includedatei werden ignoriert. Die +Includedateien werden in der Reihenfolge in der sie auftreten abgearbeitet. Sie werden +immer vor der Datei abgearbeitet, in der sie definiert sind.
+Eine Datei die nur mit dem "Default Preprozessor" bersetzt wird, kann mit dem +Designeditor bearbeitet werden.
+Au1paEinfaches Beispiel
+Aga
+Szenario: Es soll ein kurzes Programm geschrieben werden, um zu sehen, wie das +StarView-Resourcesystem arbeitet. Das Programm heit "ownrc".
+
+Af1Sourcedatei "ownrc.cxx".
+Aga
+Ali/**********************************************************
+/# Programm zum Anzeigen einer Dialogbox aus der Resource
+/# Dateiname: ownrc.cxx
+/# Autor: MM
+/# Datum: 31.07.90
+**********************************************************/
+/******************* I N C L U D E S *********************/
+#include <solar.h>
+#include <tools.hxx>
+#include <sv.hxx>
+#include <ownrc.hrc> // Identifier der Dialogbox
+
+/******************* C L A S S E S **********************/
+class MyApplication : public Application
+{ // Meine Applikationsklasse
+public:
+ void Main( int argc, char* argv[] );
+};
+
+class MyDialog : public ModelessDialog
+{ // Dialogbox mit einem Flash- und Cancel-Button.
+ PushButton aPB_Flash;
+ PushButton aPB_Cancel;
+public:
+ // Der Konstruktor mit ResId zeigt an, da MyDialog aus
+ // der Resource geladen wird.
+ MyDialog( Window* pParent, ResId & rResId );
+ void FlashBtnHdl ( Button* );
+ void CancelBtnHdl( Button* );
+};
+
+paclass MyWindow : public WorkWin
+{
+public:
+ MyWindow( Window* pParent, WinBits aWinStyle ) :
+ (pParent, aWinStyle)
+ {
+ // Es wird eine Dialogbox aus der Resource geladen.
+ new MyDialog( this, ResId( DLG_CANCEL ));
+ };
+};
+/*************** G L O B A L V A R I A B L E S ******/
+MyApplication MyApp; // Applikationsinstanz
+
+/******************* C O D E *****************************/
+/******************* M y Ap p l i c a t i o n **********/
+/*********************************************************/
+|*
+|* MyApplication::Main()
+|*
+|* Beschreibung: Virtuelle Methode, die vom System
+|* gerufen wird, um das Programm zu
+|* starten.
+|* Ersterstellung: MM 01.08.90
+|* Letzte Aenderung: MM 03.06.91
+|*
+**********************************************************/
+void MyApplication::Main( int, char* argv[] )
+{
+ // Applikationsfenster erzeugen.
+ MyWindow aCancel( NULL, WinBits( WB_APP | WB_MOVEABLE |
+ WB_SIZEABLE |
+ WB_MINMAX |
+ WB_CLOSEABLE ));
+ // Applikationsfenster anzeigen.
+ aCancel.Show();
+ // Event-Schleife des Fenstersystems starten.
+ Execute();
+}
+
+pa/**********************************************************
+|*
+|* MyDialog::MyDialog()
+|*
+|* Beschreibung: Konstruktor der Klasse MyDialog.
+|* Dies ist ein typischer Konstruktor,
+|* um Objekte aus der Resource zu
+|* laden.
+|* 1. rResId.Lock(), die Resource wird
+|* gelockt.
+|* 2. aPB_Flash( this, ResId( PB_FLASH ));
+|* Es wird der Flash-Button geladen.
+|* 3. aPB_Cancel( this, ResId( PB_Cancel ));
+|* Es wird der Cancel-Button geladen.
+|* 4. rResId.Unlock(), ein Unlock auf
+|* die Resource.
+|* Wurde von keiner abgeleiteten Klasse
+|* ein Lock ausgefhrt, dann wird die
+|* Resource an dieser Stelle freigegeben.
+|* Ersterstellung: MM 01.08.90
+|* Letzte Aenderung: MM 03.06.91
+|*
+**********************************************************/
+MyDialog::MyDialog( Window* pParent, ResId & rResId ) :
+ ( pParent, rResId.Lock()),
+ aPB_Flash( this, ResId( PB_FLASH )),
+ aPB_Cancel( this, ResId( PB_CANCEL ))
+{
+ // Handler setzen.
+ aPB_Flash.ChangeClickHdl
+ ( LINK( this, MyDialog::FlashBtnHdl ));
+ aPB_Cancel.ChangeClickHdl
+ ( LINK( this, MyDialog::CancelBtnHdl ));
+
+ rResId.Unlock(); // Resource freigeben.
+}
+pa/*********************************************************
+|* MyDialog::CancelBtnHdl()
+|*
+|* Beschreibung: Die Dialogbox wird zerstrt.
+|* Ersterstellung: MM 01.08.90
+|* Letzte Aenderung: MM 14.08.90
+*********************************************************/
+void MyDialog::CancelBtnHdl( Button* )
+{
+ // Das Lschen der Dialogbox ist schneller, wenn sie
+ // vorher nicht mehr sichtbar ist.
+ Hide();
+ // Zerstren der DialogBox-Instanz.
+ delete this;
+}
+
+/**********************************************************
+|* MyDialog::FlashBtnHdl()
+|*
+|* Beschreibung: Die Titlebar der Dialogbox flackert
+|* einmal.
+|* Ersterstellung: MM 01.08.90
+|* Letzte Aenderung: MM 14.08.90
+**********************************************************/
+void MyDialog::FlashBtnHdl( Button* )
+{
+ FlashWindow();
+}
+Aga
+Af1Resource-Headerdatei
+Aga
+Ali/**********************************************************
+|* Headerdatei fuer ownrc.src
+|* Dateiname: ownrc.hxx
+|* Autor: MM
+|* Datum: 31.07.90
+*********************************************************/
+#define DLG_CANCEL 300
+#define PB_FLASH 1
+#define PB_CANCEL 2
+#define DLG_PROTOTYPE 301
+Aga
+Af1paResource-Beschreibungsdatei
+Aga
+Ali/**********************************************************
+|* Resourcedatei fuer ownrc.cxx
+|* Dateiname: ownrc.src
+|* Autor: MM
+|* Datum: 31.07.90
+**********************************************************/
+#include <ownrc.hrc>
+
+MODELESSDIALOG DLG_PROTOTYPE
+{
+ Pos = Map_Pixel( 50, 60 );
+ Size = Map_SysFont( 100, 100 );
+ TEXT = "Markus zweite Dialogbox";
+ MOVEABLE = TRUE;
+ SIZEABLE = TRUE;
+ CLOSEABLE = TRUE;
+
+ // Diese Objekte werden automatisch angezeigt.
+ WinChilds =
+ {
+ PUSHBUTTON
+ {
+ PosSize = ( 10, 50, 100, 30 );
+ TEXT = "Ok";
+ TABSTOP = TRUE;
+ };
+ PUSHBUTTON
+ {
+ Pos = ( 130, 50 );
+ Size = ( 100, 30 );
+ TEXT = "Cancel";
+ TABSTOP = TRUE;
+ };
+ };
+};
+paMODELESSDIALOG DLG_CANCEL
+{
+ PosSize = ( 50, 60, 100, 100 );
+ TEXT = "Markus erste Dialogbox";
+ MOVEABLE = TRUE;
+ SIZEABLE = TRUE;
+
+ PUSHBUTTON PB_FLASH
+ {
+ PosSize = ( 10, 50, 100, 30 );
+ TEXT = "Flash";
+ TABSTOP = TRUE;
+ };
+
+ PUSHBUTTON PB_CANCEL
+ {
+ PosSize = ( 130, 50, 100, 30 );
+ TEXT = "Abbrechen";
+ TABSTOP = TRUE;
+ };
+
+ // Ueber solche Konstruktionen koennen Objekte in der
+ // Resource automatisch angezeigt werden.
+ WinChilds =
+ {
+ MODELESSDIALOG , DLG_PROTOTYPE;
+ };
+};
+Aga
+Af1paMakefile
+Aga
+Wie die Dateien gebildet werden, ist dem StarView-Handbuch und den dazugehrigen +Beispielen zu entnehmen. Der Aufruf des Resourcecompilers lautet in diesem Fall:
+Aga
+Aliownrc.res: ownrc.src ownrc.hrc
+ rsc -fsownrc.rc -fpownrc.srs
+ -foownrc.res -flownrc.lst ownrc.src
+Aga
+Agaownrc.src ist die Eingabedatei des rsc-Compilers.
+ownrc.srs ist ein Zwischenformat des rsc-Compilers.
+ownrc.lst ist die Listingdatei des rsc-Compilers.
+ownrc.rc ist die Textdatei, die als Eingabe des systemspezifischen Compilers dient.
+ownrc.res ist die binre Resourcedatei.
+
+Speziell fr MS-Windows gilt, da die Resourcedatei an die ".exe"-Datei angebunden +werden kann.
+Aga
+Ali rc -k ownrc.res ownrc.exe
+Aga
+AgaMit dieser Zeile wird die Resource an die ".exe"-Datei angebunden.
+Aga
+Au1paSyntax
+Aga
+Af1Compiler Anweisungen
+Aga#pragma CHARSET IBMPC
+#pragma CHARSET ANSI
+#pragma CHARSET MAC
+Mit diesen Optionen kann angegeben werden, in welchem Zeichensatz die Strings +vorliegen. Der Compiler nimmt dann eine Konvertierung in das Zielsystem vor. Als +Default wird vorausgesetzt, da die Datei im Zeichensatz des Zielsystems vorliegt.
+
+Af1Default Preprozessor-Syntax
+AliPrepDefinition:
+ { IncludeDefinition }
+ [{ DefineDefinition }]
+
+IncludeDefinition:
+ '#' include '<' Dateiname '>' |
+ '#' include String
+Ali
+DefineDefinition:
+ '#' define SYMBOL NumberExpression
+
+Af1Klass-Syntax
+AliResourceDefinition:
+Ali [ PrepDefinition ]
+ { ClassDefinition }
+
+ClassDefinition:
+ ClassHeader ClassBody ';'
+ ClassHeader ';' |
+ NumberExpression ';' |
+ TupelExpression ';' |
+ CONSTNAME ';' |
+ Boolean ';' |
+ String ';'
+
+ClassHeader:
+ CLASSNAME [ Identifier ] [ ',' | '<' Identifier ]
+pa
+ClassBody:
+ '{'
+ {
+ ClassDefinition |
+ VariableDefiniton
+ }
+ '}'
+
+VariableDefinition:
+ VARIABLENAME '=' ClassDefinition |
+ VARIABLENAME '=' '{' { ClassDefinition } '}' ';'
+
+TupelExpression:
+ [ ClassDefinition ] '(' { ClassDefinition } ')'
+
+NumberExpression:
+ [ '-' | '+' ] Number |
+ NumberExpression '+' | '-' | '*' | '/'
+ NumberExpression |
+ [ '-' | '+' ] '(' NumberExpression ')'
+
+Identifier:
+ NumberExpression |
+ Symbol
+
+Number:
+ { DEZIMALZIFFER } |
+ '0' 'x' { HEXADEZIMALZIFFER }
+
+Boolean:
+ TRUE | FALSE
+
+AgaString:
+Aga Mit "\57" knnen bestimmte Zeichenwerte angegeben werden.
+ Der Backslash wird durch "\\" und das Anfhrungszeichen durch "\""
+ angegeben. Die Zahl hinter dem Backslash wird Oktal interpretiert.
+Aga
+Au1paKlassen-Erklrung: Resource -> StarView
+Aga
+In diesem Abschnitt wird anhand von vollstndigen Beispielen erklrt, was fr Daten +in welchen StarView-Klassen in der Resource definiert werden knnen.
+
+Die Resource ist wie StarView hierarchisch aufgebaut. Das heit, alles in einer hheren +Hierarchiestufe Enthaltene wird in eine tiefere bertragen. Die Namen im nach +folgenden Diagramm sind die Namen der Schlsselwrter in der Resource, mit Aus +nahme von SystemWindow und Edit.
+
+Af1Hierarchie:
+Aga
+AgaResource
+ String
+ Icon
+ Bitmap
+ Pointer
+ Brush
+ Color
+ Font
+ Pen
+ MapMode
+ Accelerator
+ AcceleratorKey
+ Menu
+ MenuItem
+ MessBox
+ SysMessBox
+ InfoBox
+ WarningBox
+ ErrorBox
+ QueryBox
+ OutputDevice
+ Window
+ [SystemWindow]
+ WorkWindow
+ MDIWindow
+ [Dialog]
+ ModelessDialog
+ ModalDialog
+ Control
+ Button
+ CheckBox
+ AutoCheckBox
+ PushButton
+ DefPushButton
+ RadioButton
+ AutoRadioButton
+ TriStateBox
+ AutoTriStateBox
+ [Edit]
+ SingleLineEdit
+ MultiLineEdit
+ ScrollBar
+ AutoScrollBar
+ ListBox
+ DropDownListBox
+ ComboBox
+ DropDownComboBox
+ FixedText
+ FixedIcon
+ FixedBitmap
+ GroupBox
+
+Alle Daten, die in Button angegeben werden, knnen auch in PushButton oder +CheckBox angegeben werden. Entsprechendes gilt z.B. fr Daten in ListBox, die auch +in ComboBox angegeben werden knnen. Eine genauere Erklrung folgt nach den +Erluterungen der einzelnen Resourcetypen.
+Aga
+Af1paResource Resource
+Aga
+Diese Resource definiert Daten fr die StarView-Klasse Resource.
+
+AgaBeispiel:
+Aga
+Ali Resource
+ {
+ Comment = "Dies ist ein Kommentar.";
+ SingleLineEdit 1
+ {
+ Text = "Editfeld";
+ };
+ PushButton 1
+ {
+ Check = TRUE;
+ };
+ String 1 "Vorname";
+ String 2 "Nachname";
+ String 3 "Adresse";
+ String 4 "Telefon";
+ // Zwei Strings angehaengt
+ EXTRADATA = { 2; // Anzahl der Strings
+ "Hallo"; "Markus";
+ };
+ // Vier short angehaengt
+ EXTRADATA = { 4; // Anzahl der Zahlen
+ 1; 100; 5; 12;
+ };
+ };
+Aga
+In dieser Klasse knnen nur lokale Resourcen definiert werden.
+
+Wie das Schlsselwort EXTRADATA verwendet wird lesen sie bitte im Kapitel +"Spezielle Resource-Konstrukte" nach.
+
+Nach dem Schlsselwort COMMENT kann ein Kommentar angegeben werden. Unter +StarView hat diese Angabe keine Funktion. Sie dient zum Beschreiben von Resourcen, +da der Designeditor alle anderen Kommentare lscht.
+
+AgaDefault:
+Aga
+Ali Resource {};
+Aga
+Af1Resource String
+Aga
+Diese Resource definiert Daten fr die StarView-Klasse String.
+
+AgaBeispiel:
+Aga
+Ali String 1000
+ {
+ Text = "Hello World";
+ };
+Aga
+Als abkrzende Schreibweise ist auch
+Ali String 1000 "Hello World";
+Agaerlaubt.
+Aga
+Af1paResource Icon
+Aga
+Diese Resource definiert Daten fr die StarView-Klasse Icon.
+
+AgaBeispiel:
+Aga
+Ali Icon
+ {
+ Predefine = ICON_DEFAULT;
+ };
+Aga
+Nach dem Schlsselwort PREDEFINE wird ein Icon benannt, das schon in StarView +vorhanden ist. Anstelle von ICON_DEFAULT kann auch ICON_INFORMATION, +ICON_EXCLAMATION, ICON_STOP oder ICON_QUERY geschrieben werden. +Wie diese Icons aussehen, kann im StarView-Handbuch unter der Klasse Icon nach +gelesen werden.
+
+AgaBeispiel:
+Aga
+Ali Icon
+ {
+ File = "Icon.ico";
+ //Nur fuer MAC
+ Type = ICON_CICN;
+ Identifier = 1000;
+ };
+Aga
+Nach dem Schlsselwort FILE wird ein Dateiname angegeben, der auf eine Datei ver +weist, die ein Icon enthlt. Diese Datei ist systemabhngig.
+
+Nach dem Schlsselwort TYPE wird der Typ des Icons angegeben. Es knnen +ICON_ICON und ICON_CICN als Typen angegeben werden. ICON_ICON verweist +auf den Mac-Resourcetyp 'ICON' und ICON_CICN auf den Typ 'cicn'. Diese Angabe +wird nur fr den Mac bentigt.
+
+Nach dem Schlsselwort IDENTIFIER wird der Identifier des Icons in der durch FILE +spezifizierten Datei angegegeben. Diese Angabe wird nur fr den Mac bentigt.
+
+Werden PREDEFINE und FILE angegeben, wird eins der beiden Schlsselwrter +gewhlt.
+
+AgaDefault:
+Aga
+Ali Icon
+ {
+ Predefine = ICON_DEFAULT;
+ };
+Aga
+Fr IDENTIFIER und TYPE gibt es keinen Default.
+Af1paResource Bitmap
+Aga
+Diese Resource definiert Daten fr die StarView-Klasse Bitmap.
+Aga
+AgaBeispiel:
+Aga
+Ali Bitmap
+ {
+ File = "Bitmap.bmp";
+ // Nur fuer Mac
+ //TYPE = ; Es gibt nur einen Typ
+ Identifier = 1000;
+ };
+Aga
+Nach dem Schlsselwort FILE wird ein Dateiname angegeben, der auf eine Datei ver +weist, die eine Bitmap enthlt. Diese Datei ist systemabhngig.
+
+Nach dem Schlsselwort TYPE wird der Typ der Bitmap angegeben. Dieses +Schlsselwort ist fr zuknftige Erweiterungen. Der Mac-Resourcetyp ist 'PICT'. +Diese Angabe wird nur fr den Mac bentigt.
+
+Nach dem Schlsselwort IDENTIFIER wird der Identifier der Bitmap in der durch +FILE spezifizierten Datei angegegeben. Diese Angabe wird nur fr den Mac bentigt.
+
+AgaDefault:
+Aga
+Ali Bitmap
+ {
+ File = "";
+ };
+Aga
+Der Default ergibt immer einen Fehler. Fr IDENTIFIER und TYPE gibt es keinen +Default.
+
+Af1paResource Pointer
+Aga
+Diese Resource definiert Daten fr die StarView-Klasse Pointer.
+
+AgaBeispiel:
+Aga
+Ali Pointer
+ {
+ Predefine = POINTER_ARROW;
+ };
+Aga
+Nach dem Schlsselwort PREDEFINE wird ein Pointer benannt, der schon in +StarView vorhanden ist. Anstelle von POINTER_ARROW kann auch +POINTER_WAIT, POINTER_CROSS oder POINTER_BEAM geschrieben werden. +Wie diese Pointer aussehen, ist im StarView-Handbuch unter der Klasse Pointer +nachzulesen.
+
+AgaBeispiel:
+Aga
+Ali Pointer
+ {
+ File = "Pointer.pnt";
+ // Nur fuer Mac
+ Identifier = 1000;
+ };
+Aga
+Nach dem Schlsselwort FILE wird ein Dateiname angegeben, der auf eine Datei ver +weist, die einen Pointer enthlt. Diese Datei ist systemabhngig.
+
+Nach dem Schlsselwort IDENTIFIER wird der Identifier des Pointers in der durch +FILE spezifizierten Datei angegegeben. Diese Angabe wird nur fr den Mac bentigt.
+
+Nach dem Schlsselwort TYPE wird der Typ des Pointers angegeben. Dieses +Schlsselwort ist fr zuknftige Erweiterungen. Der Mac-Resourcetyp ist 'CURS'. +Diese Angabe wird nur fr den Mac bentigt.
+
+Werden PREDEFINE und FILE angegeben, wird eine der beiden Mglichkeiten +ausgewhlt.
+
+AgaDefault:
+Aga
+Ali Pointer
+ {
+ Predefine = POINTER_ARROW;
+ };
+Aga
+Fr IDENTIFIER und TYPE gibt es keinen Default.
+
+
+Af1Resource Brush
+Aga
+Diese Resource definiert Daten fr die StarView-Klasse Brush.
+
+AgaBeispiel:
+Aga
+Ali Brush
+ {
+ Style = BRUSH_SOLID;
+ Transparent = TRUE;
+ BrushColor = Color
+ {
+ RGB = (0, 0, 0);
+ };
+ FillColor = Color
+ {
+ RGB = (65535, 65535, 65535);
+ };
+ };
+Aga
+Nach dem Schlsselwort STYLE wird der Stil einer Brush benannt. Die Stile sind in +StarView vordefiniert. Anstelle von BRUSH_SOLID kann auch
+BRUSH_HORZ, BRUSH_VERT, BRUSH_CROSS,
+BRUSH_DIAGCROSS, +BRUSH_UPDIAG, BRUSH_DOWNDIAG,
+BRUSH_BITMAP, BRUSH_25, BRUSH_50,
+BRUSH_75, BRUSH_NULL geschrieben werden. Wie diese Stile +aussehen, ist im StarView-Handbuch unter der Klasse Brush nachzulesen.
+
+Nach dem Schlsselwort TRANSPARENT kann TRUE oder FALSE angegeben +werden. FALSE bedeutet, da die Brush transparent ist, bei TRUE wird die Brush mit +der Fllfarbe hinterlegt.
+Aga
+Die Farbe BRUSHCOLOR ist die Farbe des Musters.
+Die Farbe FILLCOLOR ist die Farbe in den Lcken innerhalb des Musters.
+
+AgaBeispiel:
+Aga
+Ali Brush
+ {
+ Bitmap
+ {
+ File = "Bitmap.bmp";
+ };
+ };
+Aga
+Die angegebene Bitmap wird als Brush verwendet. Die Color- und Style-Eintrge sind +wirkungslos. Das Format der Bitmap ist dem StarView-Handbuch zu entnehmen.
+
+Wird BITMAP in Kombination mit FILLCOLOR, BRUSHCOLOR oder STYLE +verwendet, wird eine der Mglichkeiten gewhlt.
+
+AgaDefault:
+Aga
+Ali Brush
+ {
+ Style = BRUSH_SOLID;
+ Transparent = FALSE;
+ };
+Aga
+Welche Defaults fr FILLCOLOR und BRUSHCOLOR verwendet werden, ist im +StarView-Handbuch unter der Klasse Brush nachzulesen.
+Au2
+Af1paResource Color
+Aga
+Diese Resource definiert Daten fr die StarView-Klasse Color.
+
+AgaBeispiel:
+Aga
+Ali Color
+ {
+ RGB = ( 32768, 0, 32768);
+ };
+Aga
+Nach dem Schlsselwort RGB wird der Rot-, Grn- und Blauanteil einer Farbe defi +niert. Das erste Element im Tupel steht fr Rot, das zweite fr Grn und das dritte fr +Blau. Die Intensitt kann mit Werten im Bereich von 0 bis 65535 angegeben werden.
+
+AgaBeispiel:
+Aga
+Ali Color
+ {
+ Red = 1;
+ Green = 2;
+ Blue = 3;
+ };
+Aga
+Durch das Schlsselwort RED wird die Rotanteil bestimmt.
+Durch das Schlsselwort GREEN wird die Grnanteil bestimmt.
+Durch das Schlsselwort BLUE wird die Blauanteil bestimmt.
+Aga
+Beispiel:
+Aga
+Ali Color
+ {
+ Predefine = COL_BLACK;
+ };
+Aga
+AgapaNach dem Schlsselwort PREDEFINE wird eine Farbe benannt. Die Farben sind in +StarView vordefiniert. Anstelle von COL_BLACK kann auch
+COL_BLUE, COL_GREEN, + COL_CYAN,
+COL_RED, COL_MAGENTA, COL_BROWN,
+COL_GRAY, COL_LIGTHGRAY, COL_LIGHTBLUE,
+COL_LIGHTGREEN, COL_LIGHTCYAN, COL_LIGHTRED, +COL_LIGHTMAGENTA, COL_YELLOW, COL_WHITE,
+COL_MENUBAR, COL_MENUBARTEXT, +COL_POUPMENU,
+COL_POPUPMENUTEXT, COL_3DTEXT, COL_3DFACE,
+COL_3DLIGHT, COL_3DSHADOW, COL_USER
+geschrieben werden. Wie diese Farben aussehen, ist im StarView-Handbuch unter der +Klasse Color nachzulesen.
+Aga
+Default:
+Aga
+Ali Color
+ {
+ Predefine = COL_USER; // RGB gltig
+ RGB = (0, 0, 0); // schwarz
+ };
+Aga
+Af1paResource Font
+Aga
+Diese Resource definiert die Daten fr die StarView-Klasse Font.
+
+AgaBeispiel:
+Aga
+Ali Font
+ {
+ Family = FAMILY_DECORATIVE;
+ Weight = WEIGHT_DONTKNOW;
+ CharSet = CHARSET_ANSI;
+ Pitch = PITCH_FIXED;
+ Align = ALIGN_BOTTOM;
+ Height = 12;
+ Width = 6;
+ CharOrientation = 0;
+ LineOrientation = 0;
+ Italic = TRUE;
+ Underline = TRUE;
+ StrikeOut = TRUE;
+ Transparent = TRUE;
+ Shadow = TRUE;
+ Outline = TRUE;
+ Text = "FontName";
+ FontColor = Color { RGB = ( 0, 0, 0 ); };
+ FillColor = Color { Predefine = COL_RED; };
+ };
+Aga
+AgaNach dem Schlsselwort FAMILY wird eine Font-Familie benannt. Die Font-Familien +sind in StarView vordefiniert. Anstelle von FAMILY_DECORATIVE kann auch +FAMILY_SCRIPT, FAMILY_MODERN, FAMILY_ROMAN, FAMILY_SWISS, +FAMILY_SYSTEM oder FAMILY_DONTCARE geschrieben werden. Was diese +Font-Familien bewirken, ist im StarView-Handbuch unter der Klasse Font +nachzulesen.
+Aga
+AgaNach dem Schlsselwort WEIGHT wird ein weiteres Attribut des Fonts benannt. Diese +Attribute sind in StarView vordefiniert. Anstelle von WEIGHT_DONTKNOW kann +auch WEIGHT_LIGHT, WEIGHT_NORMAL oder WEIGHT_BOLD geschrieben +werden. Was dieses Attribut bewirkt, ist im StarView-Handbuch unter der Klasse Font +nachzulesen.
+Aga
+AgaNach dem Schlsselwort CHARSET wird der Zeichensatz des Fonts benannt. Anstelle +von CHARSET_ANSI kann auch CHARSET_DONTKNOW, CHARSET_IBMPC, +CHARSET_MAC oder CHARSET_SYMBOL geschrieben werden.
+Aga
+paNach dem Schlsselwort PITCH wird ein weiteres Attribut des Fonts benannt. Anstelle +von PITCH_FIXED kann auch PITCH_DONTKNOW oder PITCH_VARIABLE +geschrieben werden.
+Aga
+Nach dem Schlsselwort ALIGN wird die Ausrichtung des Fonts benannt. Anstelle +von ALIGN_BOTTOM kann auch ALIGN_TOP oder ALIGN_BASELINE geschrie +ben werden.
+Aga
+Nach dem Schlsselwort HEIGHT wird die Hhe eines Fonts angegeben. Der Zahlen +bereich umfat Werte von 0 bis 65535.
+
+Nach dem Schlsselwort WIDTH wird die Breite eines Fonts angegeben. Der Zahlen +bereich umfat Werte von 0 bis 65535.
+
+Nach dem Schlsselwort CHARORIENTATION wird die Drehung der Zeichen ange +geben. Die Angabe der Drehung erfolgt in Zehntelgrad. Der Zahlenbereich umfat +Werte von 0 bis 3600.
+
+Nach dem Schlsselwort LINEORIENTATION wird die Drehung der Ausgabezeile +angegeben. Die Angabe der Drehung erfolgt in Zehntelgrad. Der Zahlenbereich umfat +Werte von 0 bis 3600.
+
+Nach dem Schlsselwort ITALIC kann TRUE oder FALSE angegeben werden. Bei +TRUE handelt es sich um einen kursiven Font, bei FALSE um einen nicht kursiven +Font.???
+
+Nach dem Schlsselwort UNDERLINE kann TRUE oder FALSE angegeben werden. +Bei TRUE handelt es sich um einen unterstrichenen Font, bei FALSE ist der Font nicht +unterstrichen.
+
+Nach dem Schlsselwort STRIKEOUT kann TRUE oder FALSE angegeben werden. +Bei TRUE handelt es sich um einen durchgestrichenen Font, bei FALSE ist der Font +nicht durchgestrichen.
+
+Nach dem Schlsselwort TRANSPARENT kann TRUE oder FALSE angegeben +werden. Bei TRUE werden die Zeichen mit der Fllfarbe ausgefllt, bei FALSE +werden die Zeichen nicht ausgefllt.
+
+Nach dem Schlsselwort SHADOW kann TRUE oder FALSE angegeben werden. Bei +TRUE werden die Zeichen mit Schatten ausgegeben, bei FALSE gibt es keinen +Schatten.
+
+Nach dem Schlsselwort OUTLINE kann TRUE oder FALSE angegeben werden. Bei +TRUE wird nur der Umriss der Zeichen ausgegeben, bei FALSE werden die Zeichen +normal dargestellt.
+
+Nach dem Schlsselwort TEXT wird der Name des Fonts angegeben.
+
+Die Farbe FONTCOLOR ist die Farbe des Fonts.
+Die Farbe FILLCOLOR ist die Farbe der Lcken zwischen den Zeichen.
+
+AgapaDefault:
+Aga
+Ali Font
+ {
+ Family = FAMILY_DONTKNOW;
+ Weight = WEIGHT_NORMAL;
+ CharSet = CHARSET_DONTKNOW;
+ Pitch = PITCH_DONTKNOW;
+ Align = ALIGN_TOP;
+ Height = 0;
+ Width = 0;
+ CharOrientation = 0;
+ LineOrientation = 0;
+ Italic = FALSE;
+ Underline = FALSE;
+ StrikeOut = FALSE;
+ Transparent = FALSE;
+ Shadow = FALSE;
+ OutLine = FALSE;
+ Text = "";
+ };
+Aga
+Welche Defaults fr FONTCOLOR und FILLCOLOR verwendet werden, ist im +StarView-Handbuch unter der Klasse Font nachzulesen.
+Au2
+Af1paResource Pen
+Aga
+Diese Resource definiert die Daten fr die StarView-Klasse Pen.
+
+AgaBeispiel:
+Aga
+Ali Pen
+ {
+ Width = 1;
+ Style = PEN_DASH;
+ PenColor = Color
+ {
+ Predefine = COL_BLACK;
+ };
+ };
+Aga
+Hinter dem Schlsselwort WIDTH wird die Breite des Stiftes angegeben. Der Zahlen +bereich umfat Werte von 0 bis 65536.
+Hinter dem Schlsselwort Style wird der Linientyp des Stiftes angegeben. Die Typen +sind in StarView vordefiniert. Anstelle von PEN_DASH kann auch PEN_NULL, +PEN_SOLID, PEN_DOT oder PEN_DASHDOT geschrieben werden. Wie diese +Typen aussehen, ist im StarView-Handbuch unter der Klasse Pen nachzulesen.
+Aga
+Default:
+Aga
+Ali Pen
+ {
+ Width = 0;
+ Style = PEN_NULL;
+ PenColor = Color;
+ {
+ RGB = (0, 0, 0);
+ };
+ };
+Aga
+Af1paResource MapMode
+Aga
+Diese Resource definiert Daten fr die StarView-Klasse MapMode.
+
+AgaBeispiel:
+Aga
+Ali MapMode
+ {
+ MapUnit = MAP_SYSFONT;
+ X = 20;
+ Y = 30;
+ xScale = ( 2, 1 );
+ yScale = ( 1, 1 );
+ };
+Aga
+Nach dem Schlsselwort MAPUNIT wird eine Einheit des Koordinatensystems defi +niert. Die Einheiten sind in StarView vordefiniert. Anstelle von MAP_SYSFONT kann +auch MAP_100TH_MM, MAP_10TH_MM, MAP_MM, MAP_CM, +MAP_1000TH_INCH, MAP_100TH_INCH, MAP_10TH_INCH, MAP_INCH, +MAP_POINT, MAP_TWIP, MAP_PIXEL oder MAP_APPFONT geschrieben +werden. Was dies fr Einheiten sind, ist im StarView-Handbuch unter der Klasse +MapMode nachzulesen.
+
+Nach den Schlsselwrtern X und Y wird der Ursprung des Koordinatensystems ange +geben. Die Einheiten sind die nach MapUnit definierten. Der Zahlenbereich umfat +Werte von 0 bis 65535.
+
+Nach den Schlsselwrtern XSCALE und YSCALE wird der Streckungsfaktor des +Koordinatensystems in x- bzw. in y-Richtung angegeben. Der Zahlenbereich umfat +Werte von -32768 bis 32767.
+
+AgaDefault:
+Aga
+Ali MapMode
+ {
+ MapUnit = MAP_APPFONT;
+ X = 0;
+ Y = 0;
+ xScale = ( 1, 1 );
+ yScale = ( 1, 1 );
+ };
+Aga
+Af1paResource Accelerator
+Aga
+Diese Resource definiert die Daten der StarView-Klasse Accelerator.
+
+AgaBeispiel:
+Aga
+Ali Accelerator
+ {
+ HelpText = "Hilfetext";
+ KeyList =
+ {
+ AcceleratorKey
+ {
+ Identifier = 1;
+ Disable = FALSE;
+ Modifier1 = TRUE;
+ Code = KEY_D;
+ };
+ AcceleratorKey
+ {
+ Identifier = 2;
+ Disable = FALSE;
+ Modifier1 = TRUE;
+ Code = KEY_F1;
+ };
+ };
+ };
+Aga
+Nach dem Schlsselwort HELPTEXT wird der Hilfetext des Accelerators angegeben.
+
+Im Accelerator knnen beliebig viele Acceleratortasten angegeben werden.
+
+AgaDefault:
+Aga
+Ali Accelerator
+ {
+ HelpText = "";
+ };
+Aga
+Af1paResource AcceleratorKey
+Aga
+Diese Resource definiert keine Daten einer StarView-Klasse. Diese Resource kann bei +der Methode InsertAccelerator() der Klasse Accelerator angegeben werden.
+
+Um diese Beschreibung verstehen zu knnen, ist es unbedingt notwendig, im +StarView-Handbuch die Beschreibung der Klassen Accelerator und KeyCode zu lesen.
+
+AgaBeispiel:
+Aga
+Ali AcceleratorKey
+ {
+ Identifier = 1;
+ Disable = FALSE;
+ Shift = TRUE;
+ Modifier1 = TRUE;
+ Modifier2 = TRUE;
+ Code = KEY_A;
+ SubAccelerator = Accelerator
+ {
+ KeyList = {
+ AcceleratorKey{ ... };
+ AcceleratorKey{ ... };
+ };
+ };
+ };
+Aga
+Nach dem Schlsselwort IDENTIFIER wird eine Zahl angegeben, die zur Identifi +kation dient. Der Definitionsbereich umfat Werte von 1 bis 65535.
+
+Nach dem Schlsselwort DISABLE kann TRUE oder FALSE angegeben werden. Bei +TRUE ist die Acceleratortaste inaktiv, bei FALSE aktiv.
+
+Nach dem Schlsselwort SHIFT kann TRUE oder FALSE angegeben werden. Bei +TRUE wird der Modifier KEY_SHIFT zum Keycode gesetzt, FALSE hat keine Bedeu +tung.
+paNach dem Schlsselwort MODIFIER1 kann TRUE oder FALSE angegeben werden. +Bei TRUE wird der Modifier KEY_MOD1 zum Keycode gesetzt, FALSE hat keine +Bedeutung.
+
+Nach dem Schlsselwort MODIFIER2 kann TRUE oder FALSE angegeben werden. +Bei TRUE wird der Modifier KEY_MOD2 zum Keycode gesetzt, FALSE hat keine +Bedeutung.
+
+AgaNach dem Schlsselwort CODE wird ein Tastencode angegeben. Die Tastencodes sind +in StarView vordefiniert. Anstelle von KEY_A kann auch ein Wert aus
+KEY_0 ... KEY_9, KEY_A ... KEY_Z, KEY_F1 ... KEY_F24, KEY_DOWN, +KEY_UP, KEY_LEFT, KEY_RIGHT, KEY_HOME, KEY_END, KEY_PAGEUP, +KEY_PAGEDOWN, KEY_RETURN, KEY_ESCAPE, KEY_TAB, KEY_SPACE, +KEY_BACKSPACE, KEY_INSERT, KEY_DELETE, KEY_NUMLOCK, +KEY_SHIFTLOCK oder KEY_SCROLLLOCK geschrieben werden.
+Aga
+In einer Acceleratortaste kann genau ein Accelerator definiert werden. Dieser +Accelerator wird an die Acceleratortaste angehngt.
+Aga
+AgaDefault:
+Aga
+Ali AcceleratorKey
+ {
+ Identifier = nId; //nicht definiert
+ DISABLE = FALSE;
+ Shift = FALSE;
+ Modifier1 = FALSE;
+ Modifier2 = FALSE;
+ Code = nKey; // nicht definiert
+ };
+Aga
+Fr nId und nKey gibt es keinen definierten Default.
+Au2
+Af1paResource Menu
+Aga
+Diese Resource definiert die Daten der StarView-Klassen PopupMenu und MenuBar.
+
+AgaBeispiel:
+Aga
+Ali Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Text = "Laden";
+ Identifier = 1;
+ };
+ MenuItem
+ {
+ Text = "Speichern";
+ Identifier = 2;
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Text = "Beenden";
+ Identifier = 3;
+ };
+ };
+ };
+Aga
+In Menu knnen beliebig viele Men-Items angegeben werden. Sie werden in der +Reihenfolge, in der sie aufgeschrieben werden, im Men aufgefhrt.
+
+Nach dem Schlsselwort SEPARATOR kann TRUE oder FALSE angegeben werden. +Bei TRUE werden Men-Items visuell voneinander getrennt.
+
+AgaDefault:
+Aga
+Ali Menu {};
+Aga
+Af1paResource MenuItem
+Aga
+Diese Resource definiert keine Daten einer StarView-Klasse. Diese Resource kann bei +der Methode InsertItem() der Klasse Menu angegeben werden.
+
+AgaBeispiel:
+Aga
+Ali MenuItem
+ {
+ Text = "MenuItem";
+ HelpText = "Hilfetext";
+ Identifier = 1;
+ HelpId = 1001:
+ Check = TRUE;
+ Disable = TRUE;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem{ ... };
+ MenuItem{ ... };
+ };
+ };
+ };
+Aga
+Nach dem Schlsselwort TEXT wird der Text des Men-Items angegeben.
+
+Nach dem Schlsselwort HELPTEXT wird der Hilfetext des Men-Items angegeben.
+
+Nach dem Schlsselwort IDENTIFIER wird eine Zahl angegeben, die zur Identifi +kation dient. Der Definitionsbereich umfat Werte von 1 bis 65535.
+
+Nach dem Schlsselwort HELPID wird eine Zahl angegeben. Diese Zahl ist ein +Hilfeidentifier (eine Referenz ins Hilfesystem). Der Definitionsbereich umfat Werte +von 0 bis 4294967295. Es knnen auch die vordefinierten Werte HELP_INDEX und +HELP_HELPONHELP benutzt werden.
+
+Nach dem Schlsselwort CHECK kann TRUE oder FALSE angegeben werden. Bei +TRUE hat das Men-Item eine Auswahlmarkierung, bei FALSE hat es keine Auswahl +markierung.
+
+Nach dem Schlsselwort DISABLE kann TRUE oder FALSE angegeben werden. Bei +TRUE ist der Zugriff auf das Men-Item nicht mglich, bei FALSE ist der Zugriff +mglich.
+
+In einem Men-Item kann genau ein Men definiert werden. Dieses Men wird an das +Men-Item angehngt (SubMenu).
+
+AgaBeispiel:
+Aga
+Ali MenuItem
+ {
+ Identifier = 1;
+ ItemBitmap = Bitmap
+ {
+ File = "bitmap.bmp";
+ };
+ };
+Aga
+Anstelle eines Textes wird in dem Men-Item diese Bitmap ausgegeben.
+
+AgaBeispiel:
+Aga
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+
+Das Men-Item verhlt sich wie ein Separator (siehe Menu).
+
+Werden TEXT, SEPARATOR oder BITMAP gleichzeitig verwendet, wird eine der +drei Mglichkeiten gewhlt.
+
+AgaDefault:
+Aga
+Ali MenuItem
+ {
+ Text = "";
+ HelpText = "";
+ Identifier = nId; //nicht definiert
+ HelpId = 0;
+ Check = FALSE;
+ Disable = TRUE;
+ };
+Aga
+Fr nId gibt es keinen definierten Default.
+Au2
+Af1paResource MessBox
+Aga
+Diese Resource definiert die Daten der StarView-Klasse MessBox.
+
+AgaBeispiel:
+Aga
+Ali MessBox
+ {
+ Title = "Ich bin eine Messagebox.";
+ Message = "Guten Morgen";
+ HelpText = "Hilfe";
+ Buttons = WB_OK;
+ DefaultButton = WB_DEF_OK;
+ HelpId = 1;
+ };
+Aga
+Der Text nach dem Schlsselwort TITLE wird der Titel der Box. Einige Boxen haben +einen festen Titel. Welche dies sind, ist dem StarView-Handbuch zu entnehmen.
+
+Der Text nach dem Schlsselwort MESSAGE wird in der Messagebox angezeigt.
+
+Nach dem Schlsselwort HELPTEXT wird der Hilfetext angegeben. Was diese Text +angabe bewirkt, ist dem StarView-Handbuch unter der Klasse Window zu entnehmen.
+
+Nach dem Schlsselwort BUTTONS wird angegeben, welche Buttons in der +Messagebox angezeigt werden sollen. Die Werte sind in StarView vordefiniert. Im +StarView-Handbuch unter der Klasse MessBox ist nachzulesen, wann welche Buttons +angezeigt werden. Anstelle von WB_OK kann auch WB_OK_CANCEL, +WB_YES_NO, WB_YES_NO_CANCEL, oder WB_RETRY_CANCEL angegeben +werden.
+
+Nach dem Schlsselwort DEFAULTBUTTON wird angegeben, welcher Button in der +Messagebox der Default-Button ist. Anstelle von WB_DEF_OK kann auch +WB_DEF_CANCEL, WB_DEF_RETRY, WB_DEF_YES, oder WB_DEF_CANCEL +geschrieben werden.
+
+Nach dem Schlsselwort HELPID wird eine Zahl angegeben. Diese Zahl ist ein +Hilfeidentifier (eine Referenz ins Hilfesystem). Der Definitionsbereich umfat Werte +von 0 bis 4294967295. Es knnen auch die vordefinierten Werte HELP_INDEX und +HELP_HELPONHELP benutzt werden.
+
+AgaDefault:
+Aga
+Ali MessBox
+ {
+ Title = "";
+ Message = "";
+ HelpText = "";
+ Buttons = WB_OK;
+ HelpId = 0;
+ };
+Aga
+AgaWird kein Default-Button angegeben, dann wird vom System einer ausgewhlt.
+Aga
+
+
+Af1Resource SysMessBox
+Aga
+Diese Resource definiert die Daten der StarView-Klasse SysMessBox.
+
+AgaBeispiel:
+Aga
+Ali SysMessBox {};
+Aga
+Nur der Typ des Fensters ist entscheidend, es sind keine zustzlichen Angaben +mglich.
+
+Af1Resource InfoBox
+Aga
+Diese Resource definiert die Daten der StarView-Klasse InfoBox.
+
+AgaBeispiel:
+Aga
+Ali InfoBox {};
+Aga
+Nur der Typ des Fensters ist entscheidend, es sind keine zustzlichen Angaben +mglich.
+
+Af1Resource WarningBox
+Aga
+Diese Resource definiert die Daten der StarView-Klasse WarningBox.
+
+AgaBeispiel:
+Aga
+Ali WarningBox {};
+Aga
+Nur der Typ des Fensters ist entscheidend, es sind keine zustzlichen Angaben +mglich.
+
+Af1Resource ErrorBox
+Aga
+Diese Resource definiert die Daten der StarView-Klasse ErrorBox.
+
+AgaBeispiel:
+Aga
+Ali ErrorBox {};
+Aga
+Nur der Typ des Fensters ist entscheidend, es sind keine zustzlichen Angaben +mglich.
+
+Af1Resource QueryBox
+Aga
+Diese Resource definiert die Daten der StarView-Klasse QueryBox.
+
+AgaBeispiel:
+Aga
+Ali QueryBox {};
+Aga
+Nur der Typ des Fensters ist entscheidend, es sind keine zustzlichen Angaben +mglich.
+
+Af1paResource OutputDevice
+Aga
+Diese Resource definiert Daten der StarView-Klasse OutputDevice.
+
+AgaBeispiel:
+Aga
+Ali OutputDevice
+ {
+ OutputPen = Pen
+ {
+ Width = 2;
+ };
+ BackGroundBrush = Brush
+ {
+ Style = BRUSH_CROSS;
+ };
+ FillInBrush = Brush
+ {
+ Style = BRUSH_SOLID;
+ };
+ OutputFont = Font
+ {
+ Height = 12;
+ Width = 8;
+ Text = "Helvetica";
+ };
+ OutputMapMode = MapMode
+ {
+ MapUnit = MAP_MM;
+ };
+ };
+Aga
+paMit OUTPUTPEN kann der Default-Pen des Output-Devices angegeben werden.
+
+Mit der Brush BACKGROUNDBRUSH wird die Default-Background-Brush??? des +Output-Devices angegeben.
+
+Mit der Brush FILLINBRUSH wird die Default-Fill-In-Brush??? des Output-Devices +angegeben.
+
+Mit FONT wird der Default-Font des Output-Devices angegeben.
+Mit OUTPUTMAPMODE wird der Default-Mapping-Mode des Output-Devices ange +geben.
+Aga
+Default:
+Aga
+Ali OutputDevice {};
+Aga
+Welche Defaults in diesem Fall fr Pen, Brush, Font und MapMode verwendet +werden, ist dem StarView-Handbuch unter der Klasse OutputDevice zu entnehmen.
+
+Af1paResource Window
+Aga
+Diese Resource definiert die Daten der StarView-Klasse Window.
+
+AgaBeispiel:
+Aga
+Ali Window
+ {
+ Pos = MAP_MM( 0, 0 );
+ Size = MAP_MM( 100, 50 );
+ Text = "Fenstertext";
+ HelpText = "";
+ HelpId = 1001;
+ Border = TRUE;
+ Hide = TRUE;
+ ClipChildren = TRUE;
+ Disable = TRUE;
+ WindowPointer = Pointer
+ {
+ Predefine = POINTER_CROSS;
+ };
+Ali };
+Aga
+Nach dem Schlsselwort POS wird die Position des Fensters angegeben. Ob die +Positionierung relativ zu einem anderen Fenster erfolgt, ist dem StarView-Handbuch +unter der Klasse Window zu entnehmen. Die MapUnit MAP_MM ist die Einheit fr +die im Tupel folgende x- und y-Position. Anstelle von MAP_MM kann eine beliebige +MapUnit angegeben werden, diese Angabe kann auch weggelassen werden. Der +Zahlenbereich umfat Werte von -32768 bis 32767.
+
+Nach dem Schlsselwort SIZE wird die Gre des Fensters angegeben. Die MapUnit +MAP_MM ist die Einheit fr die im Tupel folgende Breiten- und Hhenangabe. +Anstelle von MAP_MM kann eine beliebige MapUnit angegeben werden, diese +Angabe kann auch weggelassen werden. Der Zahlenbereich umfat Werte von -32768 +bis 32767.
+
+Nach dem Schlsselwort TEXT wird der Fenstertext angegeben. Was diese Text +angabe bewirkt, ist dem StarView-Handbuch unter der Klasse Window zu entnehmen.
+
+Nach dem Schlsselwort HELPTEXT wird der Hilfetext angegeben. Was diese Text +angabe bewirkt, ist dem StarView-Handbuch unter der Klasse Window zu entnehmen.
+
+Nach dem Schlsselwort HELPID wird eine Zahl angegeben. Diese Zahl ist ein +Hilfeidentifier (eine Referenz ins Hilfesystem). Der Definitionsbereich umfat Werte +von 0 bis 4294967295. Es knnen auch die vordefinierten Werte HELP_INDEX und +HELP_HELPONHELP benutzt werden.
+
+Nach dem Schlsselwort BORDER kann TRUE oder FALSE angegeben werden. Bei +TRUE erhlt das Fenster einen Rahmen, FALSE hat keine Bedeutung.
+
+Nach dem Schlsselwort HIDE kann TRUE oder FALSE angegeben werden. Bei +TRUE ist das Fenster nach dem Erzeugen nicht sichtbar, bei FALSE ist es sichtbar +(Parent-Beziehung beachten!).
+
+Nach dem Schlsselwort CLIPCHILDREN kann TRUE oder FALSE angegeben +werden. Bei TRUE werden die ChildWindows beim Zeichnen des Parents nicht +berschrieben, bei FALSE werden sie berschrieben.
+
+Nach dem Schlsselwort DISABLE kann TRUE oder FALSE angegeben werden. Bei +TRUE ist der Zugriff auf das Fenster nicht mglich, bei FALSE ist der Zugriff mglich +(Parent-Beziehung beachten!).
+
+
+Mit WINDOWPOINTER wird der Default-Pointer des Fensters angegeben.
+
+AgaBeispiel:
+Aga
+Ali Window
+ {
+ PosSize = MAP_MM( 0, 0, 100, 50 );
+ TEXT = "Fenstertext";
+ };
+Aga
+Nach dem Schlsselwort POSSIZE werden die Position und die Gre des Fensters +angegeben. Fr die MapUnit gilt das gleiche wie bei POS und SIZE. Der +Zahlenbereich umfat Werte von -32768 bis 32767.
+
+Wird POSSIZE zusammen mit POS und SIZE verwendet, wird eine der Mglichkeiten +ausgewhlt.
+
+AgaDefault:
+Aga
+Ali Window
+ {
+ HelpId = 0;
+ Border = FALSE;
+ Hide = FALSE;
+ ClipChildren = FALSE;
+ Disable = FALSE;
+ };
+Aga
+Fr WindowPointer, Text, HelpText, Pos und Size werden die Systemdefaults +verwendet. Welche Defaults verwendet werden, ist dem StarView-Handbuch unter der +Klasse Window zu entnehmen.
+Af1
+
+Resource SystemWindow
+Aga
+Dieses Schlsselwort kann nicht angegeben werden.
+
+Um diese Beschreibung verstehen zu knnen, ist es unbedingt notwendig, im +StarView-Handbuch die Beschreibung der Klasse SystemWindow und aller von ihr +abgeleiteten Klassen zu lesen.
+
+AgaBeispiel:
+Aga
+Ali [SystemWindow]
+ {
+ Sizeable = TRUE;
+ Moveable = TRUE;
+ Minimize = TRUE;
+ Maximize = TRUE;
+ Closeable = TRUE;
+ App = TRUE;
+ OutputSize = TRUE;
+ WinChilds =
+ {
+ FText
+ {
+ PosSize = MAP_SYSFONT( 0, 0, 80, 10 );
+ Text = "Name:";
+ };
+ };
+ DefPushButton 1
+ {
+ Text = "Ok";
+ };
+ PushButton 2
+ {
+ Text = "Cancel";
+ };
+ SingleLineEdit 3
+ {
+ PosSize = MAP_SYSFONT( 80, 0, 120, 10 );
+ };
+ };
+Aga
+Nach dem Schlsselwort SIZEABLE kann TRUE oder FALSE angegeben werden. Bei +TRUE kann das Fenster vergrert und verkleinert werden, bei FALSE kann die Gre +nicht verndert werden.
+
+Nach dem Schlsselwort MOVEABLE kann TRUE oder FALSE angegeben werden. +Bei TRUE kann das Fenster bewegt werden, bei FALSE kann es nicht bewegt werden.
+
+Nach dem Schlsselwort MINIMIZE kann TRUE oder FALSE angegeben werden. Bei +TRUE kann das Fenster minimiert werden, bei FALSE kann es nicht minimiert +werden.
+
+Nach dem Schlsselwort MAXIMIZE kann TRUE oder FALSE angegeben werden. +Bei TRUE kann das Fenster maximiert werden, bei FALSE kann es nicht maximiert +werden.
+
+Nach dem Schlsselwort CLOSEABLE kann TRUE oder FALSE angegeben werden. +Bei TRUE kann das Fenster geschlossen werden, bei FALSE kann es nicht geschlos +sen werden.
+
+Nach dem Schlsselwort APPLICATION kann TRUE oder FALSE angegeben +werden. TRUE bedeutet, da das Fenster das Applikationsfenster ist, FALSE hat keine +Bedeutung.
+
+Nach dem Schlsselwort OUTPUTSIZE kann TRUE oder FALSE angegeben werden. +Bei TRUE ist bezieht sich die Grenangabe auf die "OutputSize" des Fensters.
+
+Nach dem Schlsselwort WINCHILDS wird ein Textfenster angelegt. Dieses Fenster +wird automatisch erzeugt. Anstelle von FTEXT kann jede in der Hierarchie unter +Window stehende Resource angegeben werden.
+
+Nach dem Schlsselwort PUSHBUTTON 1 wird ein Button definiert. Auf diese +Resource kann ber den Identifier 1 zugegriffen werden. Der Identifier kann im +Bereich von 1 bis 255 liegen. Anstelle von PushButton kann jede in der Hierarchie +unter Resource stehende Resource angegeben werden.
+
+AgapaDefault:
+Aga
+Ali [SystemWindow] 7
+ {
+ Sizeable = FALSE;
+ Moveable = FALSE;
+ Minimize = FALSE;
+ Maximize = FALSE;
+ Closeable = FALSE;
+ App = FALSE;
+ OutputSize = FALSE;
+ };
+Aga
+Af1paResource WorkWindow
+Aga
+Diese Resource definiert die Daten der StarView-Klasse WorkWindow.
+
+AgaBeispiel:
+Aga
+Ali WorkWindow
+ {
+ Show = MAXIMIZE;
+ WorkWindowIcon = Icon
+ {
+ Predefine = ICON_STOP;
+ };
+ };
+Aga
+Nach dem Schlsselwort SHOW wird angegeben, wie das Fenster angezeigt wird. +Anstelle von MAXIMIZE kann auch NORMAL und MINIMIZE angegeben werden. +MAXIMIZE bedeutet, da das Fenster so gro wie mglich dargestellt wird, bei +MINIMIZE wird das Fenster so klein wie mglich dargestellt (iconic). NORMAL +bedeutet, da das Fenster in den angegebenen Koordinaten dargestellt wird.
+
+WorkWindowIcon ist das Sinnbild, das dargestellt wird, wenn das Fenster minimiert +wird.
+
+AgaDefault:
+Aga
+Ali WorkWindow
+ {
+ Show = NORMAL;
+ };
+Aga
+Was angezeigt wird, wenn kein Icon angegeben wird, ist im StarView-Handbuch unter +der Klasse WorkWindow nachzulesen.
+
+Af1paResource MDIWindow
+Aga
+Diese Resource definiert die Daten der StarView-Klasse MDIWindow.
+
+AgaBeispiel:
+Aga
+Ali MDIWindow {};
+Aga
+Es ist nur der Typ des Fensters entscheidend, es sind keine zustzlichen Angaben mg +lich.
+Au2
+
+Af1Resource Dialog
+Aga
+Diese Schlsselwort kann nicht angegeben werden.
+Diese Resource definiert die Daten der StarView-Klasse Dialog.
+
+AgaBeispiel:
+Aga
+Ali [Dialog] {};
+Aga
+Es ist nur der Typ des Fensters entscheidend, es sind keine zustzlichen Angaben mg +lich.
+Au2
+
+Af1Resource ModelessDialog
+Aga
+Diese Resource definiert die Daten der StarView-Klasse ModelessDialog.
+
+AgaBeispiel:
+Aga
+Ali ModelessDialog {};
+Aga
+Es ist nur der Typ des Fensters entscheidend, es sind keine zustzlichen Angaben mg +lich.
+Au2
+pa
+Af1Resource ModalDialog
+Aga
+Diese Resource definiert die Daten der StarView-Klasse ModalDialog.
+
+AgaBeispiel:
+Aga
+Ali ModalDialog
+ {
+ SysModal = TRUE;
+ };
+Aga
+Nach den Schlsselwort SYSMODAL kann TRUE oder FALSE angegeben werden. +Wird FALSE angegeben, dann ist die Dialogbox applikationsmodal, sonst +systemmodal.
+
+Systemmodal bedeutet, da das ganze System angehalten wird und nur in dieser +Dialogbox gearbeitet werden kann. Applikationsmodal bedeutet, da die Applikation +angehalten wird und applikationsweit nur in dieser Dialogbox gearbeitet werden kann. +Weiteres siehe StarView-Handbuch bei den Klassen Dialog, ModalDialog und +ModelessDialog.
+
+AgaDefault:
+Aga
+Ali ModalDialog
+ {
+ SysModal = FALSE;
+ };
+Af1paResource Control
+Aga
+Diese Resource definiert die Daten der StarView-Klasse Control.
+
+AgaBeispiel:
+Aga
+Ali Control
+ {
+ TabStop = TRUE;
+ Group = TRUE;
+ };
+Aga
+Nach dem Schlsselwort TABSTOP kann TRUE oder FALSE angegeben werden. Bei +TRUE ist das Tabstop-Attribut gesetzt, bei FALSE ist es nicht gesetzt.
+
+Nach dem Schlsselwort GROUP kann TRUE oder FALSE angegeben werden. Bei +TRUE ist das Group-Attribut gesetzt, bei FALSE ist es nicht gesetzt.
+
+Was diese Attribute bewirken, ist im StarView-Handbuch unter den Klassen Control +und Dialog nachzulesen.
+
+AgaDefault:
+Aga
+Ali Control
+ {
+ TabStop = FALSE;
+ Group = FALSE;
+ };
+Aga
+Af1Resource Button
+Aga
+Diese Resource definiert die Daten der StarView-Klasse Button.
+
+AgaBeispiel:
+Aga
+Ali Button {};
+
+AgaNur der Typ des Fensters ist entscheidend, es sind keine zustzlichen Angaben +mglich.
+
+
+Af1paResource CheckBox
+Aga
+Diese Resource definiert die Daten der StarView-Klasse CheckBox.
+
+Beispiel:
+Aga
+Ali CheckBox
+ {
+ Check = TRUE;
+ };
+Aga
+Nach dem Schlsselwort CHECK kann TRUE oder FALSE angegeben werden. Bei +TRUE wird ein Button als angeklickt gekennzeichnet. Dies gilt nur fr Buttons, bei +denen solch eine Kennzeichnung vorgesehen ist.
+
+AgaDefault:
+Aga
+Ali CheckBox
+ {
+ Check = FALSE;
+ };
+Aga
+Af1Resource AutoCheckBox
+Aga
+Diese Resource definiert die Daten der StarView-Klasse AutoCheckBox.
+
+AgaBeispiel:
+Aga
+Ali AutoCheckBox {};
+Aga
+Nur der Typ des Fensters ist entscheidend, es sind keine zustzlichen Angaben +mglich.
+
+Af1Resource PushButton
+Aga
+Diese Resource definiert die Daten der StarView-Klasse PushButton.
+
+AgaBeispiel:
+Aga
+Ali PushButton {};
+Aga
+Nur der Typ des Fensters ist entscheidend, es sind keine zustzlichen Angaben +mglich.
+Af1Resource DefPushButton
+Aga
+Diese Resource definiert die Daten der StarView-Klasse DefPushButton.
+
+AgaBeispiel:
+Aga
+Ali DefPushButton {};
+Aga
+Nur der Typ des Fensters ist entscheidend, es sind keine zustzlichen Angaben +mglich.
+
+Af1Resource RadioButton
+Aga
+Diese Resource definiert die Daten der StarView-Klasse RadioButton.
+
+Beispiel:
+Aga
+Ali RadioButton
+ {
+ Check = TRUE;
+ };
+Aga
+Nach dem Schlsselwort CHECK kann TRUE oder FALSE angegeben werden. Bei +TRUE wird ein Button als angeklickt gekennzeichnet. Dies gilt nur fr Buttons, bei +denen solch eine Kennzeichnung vorgesehen ist.
+
+AgaDefault:
+Aga
+Ali RadioButton
+ {
+ Check = FALSE;
+ };
+Aga
+Af1Resource AutoRadioButton
+Aga
+Diese Resource definiert die Daten der StarView-Klasse AutoRadioButton.
+
+AgaBeispiel:
+Aga
+Ali AutoRadioButton {};
+Aga
+Nur der Typ des Fensters ist entscheidend, es sind keine zustzlichen Angaben +mglich.
+Au2
+Af1Resource TriStateBox
+Aga
+Diese Resource definiert die Daten der StarView-Klasse TriStateBox.
+
+Beispiel:
+Aga
+Ali TriStateBox
+ {
+ TriStateDisable = TRUE;
+ TriState = STATE_CHECK;
+ };
+Aga
+Nach dem Schlsselwort TRISTATEDISABLE kann TRUE oder FALSE angegeben +werden. Bei TRUE knnen nur die Zustande STATE_CHECK und +STATE_NOCHECK eingenommen werden, sonst ist noch der Zustand +STATE_DONTKNOW mglich.
+
+Nach dem Schlsselwort TRISTATE kann STATE_NOCHECK, STATE_CHECK +und STATE_DONTKNOW angegeben werden.
+
+AgaDefault:
+Aga
+Ali TriStateBox
+ {
+ TriStateDisable = FALSE;
+ TriState = STATE_NOCHECK;
+ };
+Aga
+Af1Resource AutoTriStateBox
+Aga
+Diese Resource definiert die Daten der StarView-Klasse AutoTriStateBox.
+
+AgaBeispiel:
+Aga
+Ali AutoTriStateBox {};
+Aga
+Nur der Typ des Fensters ist entscheidend, es sind keine zustzlichen Angaben +mglich.
+Af1paResource Edit
+Aga
+Dieses Schlsselwort kann nicht angegeben werden.
+Diese Resource definiert die Daten der StarView-Klasse Edit.
+
+AgaBeispiel:
+Aga
+Ali [Edit]
+ {
+ Center = TRUE;
+ Left = FALSE;
+ Right = FALSE;
+ MaxTextLength = 10;
+ };
+Aga
+Nach dem Schlsselwort LEFT kann TRUE oder FALSE angegeben werden. Bei +TRUE wird der Text linksbndig ausgegeben.
+
+Nach dem Schlsselwort CENTER kann TRUE oder FALSE angegeben werden. Bei +TRUE wird der Text zentriert ausgegeben.
+
+Nach dem Schlsselwort RIGHT kann TRUE oder FALSE angegeben werden. Bei +TRUE wird der Text rechtsbndig ausgegeben.
+
+Werden LEFT, CENTER und RIGHT auf TRUE gesetzt, wird eine der Mglichkeiten +ausgewhlt. Sind sie alle FALSE, wird der Text linksbndig ausgegeben.
+
+Nach dem Schlsselwort MAXTEXTLENGTH wird die maximale Anzahl der Ein +gabezeichen festgelegt. Ist der Wert = 0, knnen beliebig viele Zeichen eingegeben +werden. Der Definitionsbereich umfat Werte von 0 bis 65535.
+
+AgaDefault:
+Aga
+Ali [Edit]
+ {
+ Left = FALSE;
+ Center = FALSE;
+ Right = FALSE;
+ MaxTextLength = 0;
+ };
+Af1paResource SingleLineEdit
+Aga
+Diese Resource definiert die Daten der StarView-Klasse SingleLineEdit.
+
+AgaBeispiel:
+Aga
+Ali SingleLineEdit {};
+Aga
+Nur der Typ des Fensters ist entscheidend, es sind keine zustzlichen Angaben +mglich.
+Au2
+Af1paResource MultiLineEdit
+Aga
+Diese Resource definiert die Daten der StarView-Klasse MultiLineEdit.
+
+AgaBeispiel:
+Aga
+Ali MultiLineEdit
+ {
+ HScroll = TRUE;
+ VScroll = TRUE;
+ };
+Aga
+Nach dem Schlsselwort HSCROLL kann TRUE oder FALSE angegeben werden. Bei +TRUE wird nach links gescrollt, wenn bei der Eingabe der rechte Rand erreicht ist.
+
+Nach dem Schlsselwort VSCROLL kann TRUE oder FALSE angegeben werden. Bei +TRUE wird nach unten gescrollt, wenn bei der Eingabe der untere Rand erreicht ist.
+
+AgaDefault:
+Aga
+Ali MultiLineEdit
+ {
+ HSCROLL = FALSE;
+ VSCROLL = FALSE;
+ };
+Aga
+Af1paResource ScrollBar
+Aga
+Diese Resource definiert die Daten der StarView-Klasse ScrollBar.
+
+AgaBeispiel:
+Aga
+Ali ScrollBar
+ {
+ MinPos = 1;
+ MaxPos = 112;
+ ThumbPos = 30;
+ PageSize = 8;
+ LineSize = 2;
+ HSCROLL = TRUE;
+ VSCROLL = FALSE;
+ };
+Aga
+Nach dem Schlsselwort MINPOS wird die minimale Position des Thumbs angegeben. +Der Definitionsbereich umfat Werte von -32768 - 32767.
+
+Nach dem Schlsselwort MAXPOS wird die maximale Position des Thumbs +angegeben. Der Definitionsbereich umfat Werte von -32768 - 32767.
+
+Nach dem Schlsselwort THUMBPOS wird die Position des Thumbs angegeben. Der +Definitionsbereich umfat Werte von -32768 - 32767.
+
+Nach dem Schlsselwort PAGESIZE wird die Vernderung bei seitenweisem Scrollen +angegeben. Der Definitionsbereich umfat Werte von -32768 - 32767.
+
+Nach dem Schlsselwort LINESIZE wird die Vernderung bei schrittweisem Scrollen +angegeben. Der Definitionsbereich umfat Werte von -32768 - 32767.
+
+Nach dem Schlsselwort HSCROLL kann TRUE oder FALSE angegeben werden. Bei +TRUE bekommt man eine horizontale Scrollbar.
+
+Nach dem Schlsselwort VSCROLL kann TRUE oder FALSE angegeben werden. Bei +TRUE bekommt man eine vertikale Scrollbar.
+pa
+AgaDefault:
+Aga
+Ali ScrollBar
+ {
+ MinPos = 0;
+ MaxPos = 100;
+ ThumbPos = 0;
+ PageSize = 10;
+ LineSize = 1;
+ VSCROLL = FALSE;
+ HSCROLL = FALSE;
+ };
+Aga
+Aga
+Af1Resource AutoScrollBar
+Aga
+Diese Resource definiert die Daten der StarView-Klasse AutoScrollBar.
+Aga
+AgaBeispiel:
+Aga
+Ali AutoScrollBar {};
+Aga
+Nur der Typ des Fensters ist entscheidend, es sind keine zustzlichen Angaben +mglich.
+
+Af1paResource ListBox
+Aga
+Diese Resource definiert die Daten der StarView-Klasse ListBox.
+
+AgaBeispiel:
+Aga
+Ali ListBox
+ {
+ Sort = TRUE;
+ CurPos = 3;
+ StringList =
+ {
+ "Ich"; "bin"; "eine"; "ListBox.";
+ };
+ StringList =
+ {
+ "Beliebig"; "viele"; "StringLists.";
+ };
+ };
+Aga
+Nach dem Schlsselwort SORT kann TRUE oder FALSE angegeben werden. Bei +TRUE werden die Strings in der Listbox sortiert, bei FALSE werden sie in der Reihen +folge ausgegeben, in der sie aufgeschrieben werden.
+
+Nach dem Schlsselwort CURPOS wird die Position eines Strings angegeben. Der +Definitionsbereich umfat Werte von 0 - 32535. Der String, der an der angegebenen +Position in der Listbox steht, wird selektiert. Hat die Listbox weniger Eintrge, wird +der ???String selektiert.
+
+Nach dem Schlsselwort STRINGLIST knnen Strings angegeben werden. Die Strings +werden in der Reihenfolge in die Listbox gestellt, in der sie angegeben werden.
+
+AgaDefault:
+Aga
+Ali ListBox
+ {
+ Sort = FALSE;
+ CurPos = 0;
+ };
+Aga
+Wird STRINGLIST ausgelassen, stehen keine Strings in der Listbox.
+
+Af1paResource DropDownListBox
+Aga
+Diese Resource definiert die Daten der StarView-Klasse DropDownListBox.
+
+AgaBeispiel:
+Aga
+Ali DropDownListBox {};
+Aga
+Nur der Typ des Fensters ist entscheidend, es sind keine zustzlichen Angaben +mglich.
+
+Af1Resource ComboBox
+Aga
+Diese Resource definiert die Daten der StarView-Klasse ComboBox.
+
+AgaBeispiel:
+Aga
+Ali ComboBox
+ {
+ MaxTextLength = 10;
+ };
+Aga
+Nach dem Schlsselwort MAXTEXTLENGTH wird die maximale Anzahl der Ein +gabezeichen festgelegt. Ist der Wert = 0, knnen beliebig viele Zeichen eingegeben +werden. Der Definitionsbereich umfat Werte von 0 bis 65535.
+
+Default:
+
+Ali ComboBox
+ {
+ MaxTextLength = 0;
+ };
+Aga
+Af1Resource DropDownComboBox
+Aga
+Diese Resource definiert die Daten der StarView-Klasse DropDownComboBox.
+
+AgaBeispiel:
+Aga
+Ali DropDownComboBox {};
+Aga
+Nur der Typ des Fensters ist entscheidend, es sind keine zustzlichen Angaben +mglich.
+
+
+Af1Resource FixedText
+Aga
+Diese Resource definiert die Daten der StarView-Klasse FixedText.
+
+AgaBeispiel:
+Aga
+Ali FixedText
+ {
+ Right = TRUE;
+ };
+Aga
+AgaNach dem Schlsselwort LEFT kann TRUE oder FALSE angegeben werden. Bei +TRUE wird der Text linksbndig ausgegeben.
+
+Nach dem Schlsselwort CENTER kann TRUE oder FALSE angegeben werden. Bei +TRUE wird der Text zentriert ausgegeben.
+
+Nach dem Schlsselwort RIGHT kann TRUE oder FALSE angegeben werden. Bei +TRUE wird der Text rechtsbndig ausgegeben.
+
+Werden LEFT, CENTER und RIGHT auf TRUE gesetzt, wird eine der Mglichkeiten +ausgewhlt. Sind sie alle FALSE, wird der Text linksbndig ausgegeben.
+
+AgaDefault:
+Aga
+Ali FixedText
+ {
+ Left = FALSE;
+ Center = FALSE;
+ Right = FALSE;
+ };
+Aga
+
+Af1Resource FixedIcon
+Aga
+Diese Resource definiert die Daten der StarView-Klasse FixedIcon.
+
+AgaBeispiel:
+Aga
+Ali FixedIcon
+ {
+ Fixed = Icon { Predefine = ICON_QUERY; };
+ };
+Aga
+AgaNach dem Schlsselwort FIXED kann ein Icon angeben werden. Dieses Icon wird in +dem Control zentriert ausgegeben.
+
+AgaDefault:
+Aga
+Ali FixedIcon
+ {
+ Fixed = Icon{};
+ };
+Aga
+
+Af1Resource FixedBitmap
+Aga
+Diese Resource definiert die Daten der StarView-Klasse FixedBitmap.
+
+AgaBeispiel:
+Aga
+Ali FixedBitmap
+ {
+ Fixed = Bitmap { File = "schmett.bmp"; };
+ };
+Aga
+AgaNach dem Schlsselwort FIXED kann eine Bitmap angeben werden. Diese Bitmap +wird in dem Control zentriert ausgegeben.
+
+AgaDefault:
+Aga
+Ali FixedBitmap
+ {
+ Fixed = Bitmap{};
+ };
+Aga
+
+Af1Resource GroupBox
+Aga
+Diese Resource definiert die Daten der StarView-Klasse GroupBox.
+
+AgaBeispiel:
+Aga
+Ali GroupBox {};
+Aga
+Nur der Typ des Fensters ist entscheidend, es sind keine zustzlichen Angaben +mglich.
+paSpezielle Resource-Konstrukte
+Aga
+Af1Globale, lokale Resourcen
+Aga
+Globale Resourcen sind Resourcen, die auerhalb jeder anderen Resource definiert +sind. Lokale Resourcen sind innerhalb einer anderen Resource definiert. Lokale +Resourcen mssen einen Identifier im Bereich von 1 bis 255 haben, globale Resourcen +einen Identifier im Bereich von 256 bis 32767.
+
+AgaBeispiel:
+Aga
+AliWindow 1000
+{
+ Text = "Info";
+ DefPushButton 1
+ {
+ Text = "Ok";
+ };
+};
+Aga
+In diesem Fall ist WINDOW 1000 eine globale Resource und DEFPUSHBUTTON 1 +eine lokale Resource.
+
+Af1paReferenzen
+Aga
+Wird eine Resource mehr als nur einmal bentigt, so kann diese Resource als globale +Resource definiert und an anderer Stelle darauf verwiesen werden.
+
+AgaBeispiel:
+Aga
+AliDefPushButton 1000
+{
+ Text = "Ok";
+};
+Window 1000
+{
+ Text = "Info";
+ DefPushButton 1, 1000;
+};
+Aga
+Die Konstruktion DEFPUSHBUTTON 1, 1000 ist eine Referenz auf den +DefPushButton 1000, wobei 1 die ID innerhalb der Window-Resource ist. Das heit, +im Programm greift man ber die ID 1 auf diese Resource zu.
+
+Eine Referenz kann immer angegeben werden, wenn eine Resource-Definition erwartet +wird. Beim Erstellen einer ".rc"-Datei mssen alle Referenzen aufgelst werden +knnen.
+
+Af1Lokale Resourcen
+Aga
+Lokale Resourcen knnen in jeder Resource-Definition angegeben werden.
+
+Af1Beispiel:
+Aga
+AliWindow 1000
+{
+ Text = "Info";
+ PushButton 1, 1000;
+ DefPushButton 2, 1001;
+ SingleLineEdit 3, 1002;
+ Color 4 { RGB = (0, 0, 0); };
+ Color 5 { RGB = (65535, 0, 0); };
+};
+Aga
+In diesem Beispiel sind drei Controls und zwei Farben als lokale Resource angegeben. +Auf die Resourcen kann ber die Identifier 1 bis 5 zugegriffen werden.
+Af1paBenutzerdaten
+Aga
+Mit Hilfe der EXTRADATA-Konstruktion knnen in einer Resource beliebige Daten +definiert werden.
+
+Beispiel:
+
+AliWindow 1000
+{
+ Text = "Info";
+ ExtraData =
+ {
+ "Hallo"; 1; -10;
+ };
+ ExtraData =
+ {
+ 1; 2; 3; 4;
+ };
+Ali};
+Aga
+Nach dem Schlsselwort EXTRADATA knnen Strings und ganze Zahlen angegeben +werden. Der Definitionsbereich der Zahlen reicht von -32536 bis 32535.
+
+In der Resource stehen die Daten in folgendem Format:
+Aga
+Apl- Die Benutzerdaten werden hinter die vordefinierten Daten geschrieben.
+- Sie werden in der Reihenfolge abgelegt, in der sie aufgeschrieben worden sind.
+- Strings sind Null-terminiert. Sie belegen immer eine gerade Anzahl von Bytes im +Speicher. Der bentigte Platz errechnet sich also wie folgt:
+ Platzbedarf = Stringlnge + 1 + ( Stringlnge + 1 ) MOD 2;
+ benutzen Sie die Methode GetStringSizeRes() der Klasse Resource.
+- Zahlen sind zwei Byte lang und processorspezifisch gedreht.
+Aga
+Af1paDefault-Initialisierung
+Aga
+Beim Angeben einer Resource ist diese mit bestimmten Werten vorbesetzt. Die +Resource kann aber auch durch eine andere globale Resource initialisiert werden, so +da die Resource die Daten der globalen Resource enthlt.
+
+Beispiel:
+
+AliWindow 1000
+{
+ Text = "Info";
+ PosSize = MAP_SYSFONT( 0, 0, 160, 40 );
+ Border = TRUE;
+ Moveable = TRUE;
+ Closeable = TRUE;
+ DefPushButton 1, 1000;
+ ExtraData = { 10; };
+};
+Window 1001 < Window 1000
+{
+ Moveable = FALSE;
+ FixedText 2
+ { // Fuzeile
+ Disable = TRUE;
+ Size = MAP_SYSFONT( 160, 4 );
+ };
+};
+Aga
+Das WINDOW 1001 bernimmt alle Daten von WINDOW 1000, definiert noch eine +lokale Resource hinzu und ndert das MOVEABLE-Attribut. Es werden auch alle +lokalen Resourcen und alle Benutzerdaten bernommen. Bei den lokalen Resourcen +kann es leicht zu Identifier-Konflikten kommen. Es ist zu beachten, da die Resource, +von der die Daten bernommen werden sollen, von beliebigem Typ sein kann. Es +werden alle Daten ab der gemeinsamen Superklasse bernommen. Das heit von der +Klasse Resource werden immer alle Daten bernommen.
+
+
+Au1paFehlermeldungen
+Aga
+Af1Aufbau der Fehlermeldung:
+AgaDie Ausgabe der Fehler hat folgendes Format:
+1. Zeile in der der Fehler aufgetreten ist.
+2. Position an der der Fehler aufgetreten ist.
+3. Fehlernummer: Error ( Typ, Identifier ): Fehlermeldung.
+
+Afp256 Allgemeiner Fehler, dieser Fehler kann nicht nicht +genauer spezifiziert werden.
+257 Eine virtuelle Methode die in der abgeleiteten Klasse +nicht implementiert ist. Siehe Methoden der Klasse +RscInst: SetString(), SetNumber .... Man kann die +Fehlermeldung als Typfehler betrachten, das heit +dieser Typ darf nicht verwendet werden.
+258 Die Datei mit dem angegebenen Namen konnte nicht +geffnet werden.
+259 Es konnte kein Zeichen generiert werden. Zum Beispiel +kann '\333' nicht in ein Zeichen umgewandelt werden.
+260 Interner Fehler, eine Methode soll auf eine ungltige +Instanz angewendet werden.
+261 Es wird eine Kommandozeilenhilfe ausgegeben (rsc -h).
+262 Es wurde keine Eingabedatei angegeben.
+263 In der Kommandozeile wurde ein unbekannter Schalter +verwendet.
+264 Referenzen werden nur bis zu einer bestimmten Tiefe +aufgelst. Der Fehler bedeutet, das Referenzen rekursiv +definiert wurden oder da sie zu tief verschachtelt sind.
+512 Allgemeiner Fehler.
+513 Es wurde versucht eine Zahl einzusetzen, die auerhalb +des Wertebereichs liegt.
+528 Allgemeiner Fehler.
+544 Allgemeiner Fehler.
+578 Allgemeiner Fehler.
+579 Allgemeiner Fehler.
+580 Es wurde versucht eine Resourcrinstanz mit falschem +Typ verwendet.
+608 Allgemeiner Fehler.
+609 Allgemeiner Fehler.
+610 Fr ein Makro soll eine Name verwendet werden, der +schon belegt ist. Namen knnen zum Beispiel schon fr +Variablen vergeben sein.
+640 Allgemeiner Fehler.
+641 Zwei globale Resourcen haben den gleichen Identifier.
+642 Der verwendete Typ ist nicht erlaubt.
+643 Die Variable darf hier nicht verwendet werden.
+644 Der Zahlenwert ist auerhalb von [0, 0xFFFF].
+645 Der Zahlenwert ist auerhalb von [0, 0x7FFF].
+646 Defaultresource wurde nicht gefunden. Eine +Resourceinstanz kann mit einer anderen initialisiert +werden. Diese ander Instanz wurde nicht gefunden.
+647 An dieser Stelle ist die Angabe einer Referenz verboten.
+648 Ein Makroname soll doppelt vergeben werden.
+649 Die Angabe einer Defaultresource ist verboten.
+650 Ein Identifier mu Angegeben werden.
+651 Es sollte durch Null geteilt werden.
+652 Fehler in der Pragmaanweisung.
+653 Das Makro wurde durch weitere Makro's erklrt, die +nicht in den entsprechenden Include-Dateien stehen.
+
+Es folgen Warnungen.
+4098 Resourcen die sich innerhalb einer anderen Resource +befinden (Unterresourcen) haben ein Identifier ber 255.
+4099 Globale Resourcen haben einen Identifier unter 256.
+4100 Die Unterresource werden nicht beachtet. Das bedeutet, +da auf diese Resourcen zur Laufzeit nicht zugegriffen +werden kann.
+4101 Die Resourcen haben einen keinen Identifier. Auf diese +Resourcen kann zur Laufzeit nicht zugegriffen werden.
+4102 Beim schreiben ein rc-Datei konnte eine Stringreferenz +nicht aufgelst werden.
+4103 Beim schreiben ein rc-Datei konnte eine Referenz nicht +aufgelst werden. Wenn auf Unterresourcen zugegriffen +wird, die sich in der referenzierten Resource befinden, +dann kann ein Laufzeitfehler auftreten.
+4104 Zwei Unterresource mit gleichem Typ haben den +gleichen Identifier.
+
+SsvAgaPA
+Au0Stichwortverzeichnis
+Aga
+AsvCompiler Anweisungen 16
+Resource Accelerator 33
+Resource AcceleratorKey 34
+Resource AutoCheckBox 50
+Resource AutoRadioButton 51
+Resource AutoScrollBar 55
+Resource Bitmap 22
+Resource Brush 24
+Resource CheckBox 50
+Resource Color 26
+Resource ComboBox 57
+Resource DefPushButton 51
+Resource DialogBox 48
+Resource DropDownComboBox 57
+Resource DropDownListBox 57
+Resource FixedText 58
+Resource Font 28
+Resource GroupBox 58
+Resource Icon 21
+Resource ListBox 56
+Resource MapMode 32
+Resource MDIWindow 48
+Resource Menu 36
+Resource MenuItem 37
+Resource MessageBox 39
+Resource MultiLineEdit 53
+Resource OutputDevice 40
+Resource Pen 31
+Resource Pointer 22
+Resource PushButton 50
+Resource RadioButton 51
+Resource Resource 20
+Resource ScrollBar 54
+Resource SingleLineEdit 52
+Resource String 20
+Resource SystemWindow 44
+Resource Window 42
+Resource WorkWindow 47
+Resource Button 49
+Resource Control 49
+
+Aga
+
\ No newline at end of file diff --git a/rsc/doku/feinkonz.43/rscerror.doc b/rsc/doku/feinkonz.43/rscerror.doc new file mode 100644 index 000000000000..f6e48c96237d --- /dev/null +++ b/rsc/doku/feinkonz.43/rscerror.doc @@ -0,0 +1,2119 @@ +.\\\ WRITER 6 \\\
+S:\APP\SW5\STARLAB.LAY
+R:\SW55N\TREIBER\PS.GPM
+12
+00000
+00010
+01394
+00001
+00001
+00001
+00002
+00002
+00000
+00000
+00000
+00000
+Markus Meyer
+Spezifikation
+Rsc-Compiler
+Fehlerbehandlung
+
+
+
+
+
+
+0
+16836
+11338
+0
+0
+JA
+3
+75
+0
+20
+0
+0
+0
+0
+0
+0
+0
+JA
+
+
+
+9
+20
+4
+Helvetica 14 Pt
+H1
+97
+20
+0
+
+Helvetica 12 Pt
+H2
+65
+23
+0
+
+Helvetia 10 Pt
+H3
+65
+20
+0
+
+Courier 10 Pt
+C1
+1
+23
+0
+
+Helvetica 14 Pt Fett
+F1
+65
+27
+2
+
+Helvetica 12 Pt Fett
+F2
+65
+23
+2
+
+Helvetia 10 Pt Fett
+F3
+65
+20
+0
+
+Tasten
+T1
+129
+27
+0
+
+Grundschrift
+GA
+97
+20
+0
+
+Grund - Absatzlayout V1.5-LSLP8
+GA
+0
+0
+0
+0
+9
+97
+20
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+Grundabsatzlayout-rechtsbndig
+GR
+0
+0
+0
+0
+9
+35
+20
+0
+2
+0
+1
+NEIN
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+Listing
+LI
+0
+0
+0
+0
+0
+1
+23
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+berschrift
+U0
+0
+0
+0
+0
+5
+35
+28
+2
+1
+0
+1
+NEIN
+NEIN
+JA
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+berschrift X.
+U1
+0
+0
+0
+0
+5
+35
+28
+2
+1
+0
+1
+NEIN
+NEIN
+JA
+240
+1
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+berschrift X.X.
+U2
+0
+0
+0
+0
+6
+35
+24
+2
+1
+0
+1
+NEIN
+NEIN
+JA
+240
+2
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+berschrift X.X.X.
+U3
+0
+0
+0
+0
+6
+35
+20
+2
+1
+0
+1
+NEIN
+NEIN
+JA
+240
+3
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+berschrift X.X.X.X.
+U4
+0
+0
+0
+0
+7
+35
+20
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+4
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+berschrift X.X.X.X.X.
+U5
+0
+0
+0
+0
+7
+35
+20
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+5
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+Einrckung 4 Sp / 4 Sp
+E1
+576
+576
+0
+0
+9
+35
+20
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+Einrckung 8 Sp / 8 Sp
+E2
+1150
+1150
+0
+0
+9
+35
+20
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+Einrckung 0 Sp / 4 Sp
+E3
+0
+564
+0
+0
+9
+35
+20
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+Einrckung 4 Sp / 8 Sp
+E4
+564
+1150
+0
+0
+9
+35
+20
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+Funktionsparameter
+FP
+0
+2891
+0
+0
+9
+35
+20
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+Inhaltsverzeichnis
+IV
+0
+0
+0
+0
+9
+35
+20
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+1
+7653
+0
+0
+Stichwortverzeichnis
+SV
+0
+0
+0
+0
+9
+35
+20
+0
+1
+141
+1
+JA
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+1
+3744
+1
+0
+Fettschrift einzeilig
+F1
+0
+0
+0
+0
+7
+65
+20
+2
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+Punktliste
+PL
+0
+564
+0
+0
+9
+35
+20
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+566
+0
+0
+1133
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+Fuzeile
+FZ
+0
+0
+0
+0
+3
+97
+20
+2
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+1
+7200
+1
+0
+Kopfzeile
+KZ
+0
+0
+0
+0
+3
+97
+20
+2
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+1
+7920
+1
+0
+Grund-Seitenlayout
+GS
+566
+609
+2436
+679
+1416
+1416
+0
+0
+1
+NEIN
+0
+0
+
+AkzBf3#_PFAD##_TEXTNAME# 6-#_S#-
+Bf3
+
+AfzBf3$Date: 22 Jan 1992 12:40:36 $ $Revision: 1.1 $
+
+Stichwortverzeichnis
+SV
+566
+609
+2437
+680
+1416
+1416
+566
+0
+2
+NEIN
+0
+0
+
+AliBf3Stichwortverzeichnis
+AliBf3 +
+
+Ali6Bf3- #_S# -B00
+
+GS - ohne Fuzeile
+KF
+566
+609
+2437
+680
+1416
+1416
+0
+0
+1
+NEIN
+0
+0
+
+AliBf3#_KATEGORIE# / #_THEMA2#
+AliBf3
+
+Ali
+
+Inhaltsverzeichnis
+IV
+566
+609
+2437
+680
+1416
+1416
+0
+0
+1
+NEIN
+0
+0
+
+AliBf3Inhaltsverzeichnis
+AliBf3 +
+
+Ali
+
+
+
+
+0
+
+0
+
+SkfAga
+
+
+
+
+
+
+
+
+
+Au0 #_KATEGORIE#
+Aga
+
+Au0 #_THEMA2#
+Aga
+
+Au0
+Aga
+
+
+
+
+
+
+
+
+
+
+
+
+Au0 #_AUTOR#
+Aga
+
+Au0 STAR DIVISION / STAR LAB Hamburg
+Aga
+
+Au0 Stand: $Date: 22 Jan 1992 12:40:36 $
+Aga
+
+Sgs
+SkfAgaPA
+
+
+Au0#_KATEGORIE#
+Aga
+
+
+AfpDokumentenname #_THEMA2#
+Aga
+AfpProjektname #_THEMA1#
+Aga
+AfpVersionsnummer $Revision: 1.1 $
+Aga
+
+Afperstellt 16. September 1991
+Aga
+Afpgendert $Date: 22 Jan 1992 12:40:36 $
+Aga
+
+AfpDateiname #_PFAD##_TEXTNAME#
+Aga
+
+AfpAutor #_AUTOR#
+Aga
+AfpBearbeiter $Author: MM $
+Aga
+AfpQualittskontrolle
+Aga
+
+AfpStatus XX in Arbeit
+Afp !__ fertiggestellt
+Afp !__ abgenommen
+Afp !__ freigegeben
+Aga
+
+AfpVertraulich __ Ja XX Nein
+Aga
+
+AfpCopyright (C) Star Division 1990
+Aga
+Sgspa
+Au1#1 Einleitung
+Aga
+In diesem Dokument werden die Klassen beschrieben, die die Fehlerbehandlung organisieren.
+
+Hinweise zur Implementation
+Bevor eine dieser Klassen benutzt wird, mu die Funktion InitRscCompiler aufgerufen werden.
+AgaPA
+Au1#2 Klassenbeschreibung
+Aga
+AgaERRTYPE:
+Diese Klasse enthlt eine Fehler- oder eine Warnungsnummer.
+
+RscError:
+Diese Klasse bernimmt die Ausgabe der Fehlermeldungen.
+
+Au1#3 Globale Funktionen
+Aga
+RscExit():
+Die Funktion mu von jedem Programm implementiert werden, die Klassen aus dem rsc-System +benutzen. Die Funktion bedeutet, da das Programm sofort beendet werden mu, weil ein +scherwiegender Programmfehler aufgetreten ist.
+
+SivPA
+
+Au0Inhaltsverzeichnis
+Aga
+Aiv1. Einleitung M3
+2. Klassenbeschreibung D4
+3. Globale Funktionen E4
+ERRTYPE S6
+RscError R10
+::RscExit() O15
+Stichwortverzeichnis F17
+Sgs
+Au0
+Aga
+Au0PAERRTYPE
+Aga
+Aliclass ERRTYPE {
+public:
+ ERRTYPE();
+ ERRTYPE( USHORT nErr );
+ ERRTYPE& operator = ( const ERRTYPE & rError );
+ operator USHORT();
+ BOOL IsError();
+ BOOL IsOk();
+ BOOL IsWarning();
+ void Clear();
+};
+
+#define ERR_OK
+#define ERR_ERROREND
+#define ERR_WARNING
+#define ERR_WARNINGEND
+Aga
+Af1Beschreibung
+Aga
+Eine Instanz dieser Klassen enthlt entweder eine Fehler- oder eine Warnungsnummer oder keines von +beiden. Zu beachten ist, da eine Fehlernummer nicht berschrieben werden kann (!der erste Fehler ist +interressant ).
+
+Af1Anmerkungen
+AgaWarnungen werden von Fehlernummern berschrieben, aber nicht von Warnungsnummern.
+
+Af1Querverweise
+Aga
+Klasse: RscError.
+
+Af1Beispiel
+Aga
+Ali.....
+ERRTYPE aError;
+
+aError = ERR_OPENFILE;
+aError = ERR_ERROR;
+if( ERR_OPENFILE == aError )
+ printf( "Fehler: Datei kann nicht gffnet werden!\n" );
+else
+ printf( "Fehler: Allgemeiner Fehler!\n");
+.....
+Aga
+AgaDie Ausgabe heit:
+Fehler: Datei kann nicht geffnet werden!
+
+Au0PAERRTYPE::ERRTYPE()
+Aga
+AliERRTYPE::ERRTYPE();
+ERRTYPE::ERRTYPE( USHORT nErrNo );
+ERRTYPE::ERRTYPE( const ERRTYPE & rError );
+Aga
+Af1Beschreibung
+Aga
+Die wird eine Instanz ERRTYPE erzeugt.
+
+Af1Parameter
+Aga
+AfpnErrNo diese Zahl ist der Fehler der in die Instanz eingetragen wird.
+rError aus dieser Instanz wird der Fehler bernommen.
+Aga
+Af1Anmerkungen
+Aga
+Wird der leere Konstruktor verwendet, dann ist die Fehlernummer ERR_OK. Die Methode IsOk() +liefert TRUE.
+
+Af1Querverweise
+Aga
+Klassen: RscError
+Methoden: IsError(), IsOk(), Clear().
+
+Af1Beispiel
+AgaHier wird gezeigt wie Fehler zugewiesen und berschrieben werden.
+
+AliERRTYPE aErr;
+printf( aErr.IsOk() ? "TRUE", "FALSE" ); //Ausg.: TRUE
+aErr = WRN_LOCALID; //Warnung zuweisen
+printf( aErr.IsOk() ? "TRUE", "FALSE" ); //Ausg.: TRUE
+printf( aErr.IsWarning() ? "TRUE", "FALSE" );//Ausg.: TRUE
+printf( aErr.IsError() ? "TRUE", "FALSE" ); //Ausg.: FALSE
+aErr = ERR_ERROR; //Fehler zuweisen
+printf( aErr.IsOk() ? "TRUE", "FALSE" ); //Ausg.: FALSE
+printf( aErr.IsWarning() ? "TRUE", "FALSE" );//Ausg.: FALSE
+printf( aErr.IsError() ? "TRUE", "FALSE" ); //Ausg.: TRUE
+aErr = ERR_OK; //Fehler aufheben geht so nicht
+printf( aErr.IsOk() ? "TRUE", "FALSE" ); //Ausg.: FALSE
+printf( aErr.IsError() ? "TRUE", "FALSE" ); //Ausg.: TRUE
+aError.Clear(); //Fehler aufheben
+printf( aErr.IsOk() ? "TRUE", "FALSE" ); //Ausg.: TRUE
+printf( aErr.IsError() ? "TRUE", "FALSE" ); //Ausg.: FALSE
+Aga
+Aga
+Aga
+Au0ERRTYPE::operator =()
+Aga
+AliERRTYPE & ERRTYPE::operator &( const ERRTYPE & rErr );
+Aga
+Af1Beschreibung
+Aga
+Der Zuweisungsoperator kopiert den Fehler oder die Warnung von rErr in die Instanz. Ein kopieren +findet nicht statt, wenn in der Instanz schon ein Fehler eingetragen wurde.
+
+Af1Parameter
+Aga
+AfprErr aus dieser Instanz wird der Fehler bernommen.
+Aga
+Af1Return-Werte
+Aga
+Die eigene Instanz wird zurckgeliefert.
+
+Af1Querverweise
+Aga
+Methoden: operator USHORT().
+
+Af1Beispiel
+Aga
+AliERRTYPE aError( ERR_RSCRANGE );
+printf( ERR_RSCRANGE == aError ? "TRUE" : "FALSE" );
+ //Ausgabe: TRUE
+//Versuch den Fehler zu ueberschreiben (geht nicht)
+aError = ERRTYPE( ERR_ERROR );
+printf( ERR_ERROR == aError ? "TRUE" : "FALSE" );
+ //Ausgabe: FALSE
+aError.Clear();
+aError = ERRTYPE( ERR_ERROR );
+printf( ERR_ERROR == aError ? "TRUE" : "FALSE" );
+ //Ausgabe: TRUE
+Aga
+Aga
+Aga
+Au0ERRTYPE::operator USHORT()
+Aga
+AliERRTYPE::operator USHORT();
+Aga
+Af1Return-Werte
+Aga
+Die Fehlernummer in der Instanz wird zurckgeliefert.
+
+Af1Querverweise
+Aga
+Methoden: operator =().
+
+Aga
+Aga
+Au0ERRTYPE::IsError()
+Aga
+AliBOOL ERRTYPE::IsError();
+Aga
+Af1Beschreibung
+Aga
+Diese Methode zeigt an ob in der Instanz eine Fehlernummer steht, die einen Fehler anzeigt.
+
+Af1Return-Werte
+Aga
+AfpTRUE wenn die Fehlernummer im Bereich [0, ERR_ERROREND] liegt.
+FALSE wenn die Fehlernummer im Bereich ]ERR_ERROREND, 0xFFFF +"] liegt.
+Aga
+Af1Querverweise
+Aga
+Methoden: IsOk(), IsWarning(), Clear().
+Aga
+Aga
+Aga
+Au0ERRTYPE::IsOk()
+Aga
+AliBOOL ERRTYPE::IsOk();
+Aga
+Af1Beschreibung
+Aga
+Diese Methode zeigt an ob in der Instanz eine Fehlernummer steht, die keinen Fehler anzeigt.
+
+Af1Return-Werte
+Afp
+TRUE wenn die Fehlernummer im Bereich ]ERR_ERROREND, +"0xFFFF] liegt.
+FALSE wenn die Fehlernummer im Bereich [0, ERR_ERROREND] liegt.
+Aga
+Af1Querverweise
+Aga
+Methoden: IsError(), IsWarning(), Clear().
+Aga
+Aga
+Aga
+Au0ERRTYPE::IsWarning()
+Aga
+AliBOOL ERRTYPE::IsWarning();
+Aga
+Af1Beschreibung
+Aga
+Diese Methode zeigt an ob in der Instanz eine Fehlernummer steht, die einen Warnung anzeigt.
+
+Af1Return-Werte
+Afp
+TRUE wenn die Fehlernummer im Bereich [ERR_WARNING, +"ERR_WARNINGEND] liegt.
+FALSE wenn die Fehlernummer in einem anderen Bereich liegt.
+Aga
+Af1Querverweise
+Aga
+Methoden: IsOk(), IsError(), Clear().
+Aga
+Aga
+
+Au0ERRTYPE::Clear()
+Aga
+Alivoid ERRTYPE::Clear();
+Aga
+Af1Beschreibung
+Aga
+Die Fehlernummer wird auf ERR_OK gesetzt. Das heit die Methode IsOk() liefert TRUE zurck.
+Aga
+Aga
+Au0PARscError
+Aga
+Ali#define ERR_ERROR 0x0100
+#define ERR_UNKNOWN_METHOD 0x0101
+#define ERR_OPENFILE 0x0102
+#define ERR_NOCHAR 0x0103
+#define ERR_NORSCINST 0x0104
+#define ERR_USAGE 0x0105
+#define ERR_NOINPUT 0x0106
+#define ERR_UNKNOWNSW 0x0107
+#define ERR_REFTODEEP 0x0108
+
+#define ERR_RSCRANGE 0x0200
+ #define ERR_RSCRANGE_OUTDEFSET (ERR_RSCRANGE +1 )
+#define ERR_RSCENUM 0x0210
+#define ERR_RSCFLAG 0x0220
+#define ERR_RSCCONT 0x0240
+ #define ERR_CONT_INVALIDPOS (ERR_RSCCONT +1 )
+ #define ERR_CONT_INVALIDTYPE (ERR_RSCCONT +2 )
+#define ERR_RSCCMPED 0x0250
+#define ERR_RSCINST 0x0260
+ #define ERR_RSCINST_NOVARNAME (ERR_RSCINST +1 )
+ #define ERR_RSCINST_RESERVEDNAME (ERR_RSCINST +2 )
+#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 )
+ #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 WRN_LOCALID (ERR_WARNING +1 )
+ #define WRN_GLOBALID (ERR_WARNING +2 )
+ #define WRN_SUBINMEMBER (ERR_WARNING +3 )
+ #define WRN_CONT_NOID (ERR_WARNING +4 )
+ #define WRN_STR_REFNOTFOUND (ERR_WARNING +5 )
+ #define WRN_MGR_REFNOTFOUND (ERR_WARNING +6 )
+ #define WRN_CONT_DOUBLEID (ERR_WARNING +7 )
+
+class RscError{
+public:
+ USHORT nErrors;// Anzahl der Fehler
+ RscError();
+ void SetListFile( FILE * fList );
+ virtual void StdOut( const char * );
+ virtual void LstOut( const char * );
+ virtual void Error( ERRTYPE nError, RscTop* pClass,
+ const RscId &aId,
+ const char * pMessage = NULL );
+ virtual void FatalError( ERRTYPE nError, const RscId
+ &aId, const char * pMessage = NULL );
+};
+Aga
+Af1Beschreibung
+Aga
+In dieser Klasse werden Fehlermeldungen ausgegeben. Die Fehlermeldungen werden zur +Standartausgabe geschickt und in eine Listing-Datei geschrieben. Nach Aufruf der Methode +FatalError() wird die Funktion RscExit() aufgerufen. Diese sollte das Programm terminieren.
+Die Ausgabe der Fehler hat folgendes Format:
+1. Zeile in der der Fehler aufgetreten ist.
+2. Position an der der Fehler aufgetreten ist.
+3. Fehlernummer: Error ( Typ, Identifier ): Fehlermeldung.
+
+Af1Ausnahmen
+Aga
+Die Ausgabe wird unter MS-Windows nicht nach "stdout" umgeleitet, sondern sie wird unterdrckt.
+
+Af1Anmerkungen
+Aga
+Die Klasse tauscht Zeilennummern, Zeilen usw. ber globale Variable mit dem Parser aus. Aus diesem +Grund darf der Parser nicht rekursiv aufgerufen werden.
+Wenn ein Fehler am Ende einer Zeile bemerkt wird, wird hufig die Zeile nach der Fehlerhaften +angezeigt.
+
+Af1Querverweise
+Aga
+Klassen: RscTypCont, ERRTYPE, RscId, RscFileInst, alle Rsc... Klassen.
+Funktionen: ::RscExit(), ::parser(), ::MacroParser(), ::IncludeParser().
+
+Af1Beispiel
+AgaImplementation der Standartausgabe unter MS-Windows.
+
+Ali.....
+class WinError :: public RscError{
+ ListBox * pOutput;
+public:
+ WinError( ListBox * pListBox ) : RscError(){
+ pOutput = pListBox;
+ }
+ void StdOut( const char * pStr ){
+ //fuer gute Ausgabeformatierung muesste auf RETURN
+ //geachtet werden
+ pOutput.Insert( pStr, LISTBOX_APPEND );
+ }
+};
+.....
+Agapa
+
+Au0Fehlernummern
+Aga
+AfpERR_ERROR Allgemeiner Fehler, dieser Fehler kann nicht nicht genauer +"spezifiziert werden.
+ERR_UNKNOWN_METHOD Eine virtuelle Methode die in der abgeleiteten Klasse nicht +"implementiert ist. Siehe Methoden der Klasse RscInst: SetString(), +"SetNumber .... Man kann die Fehlermeldung als Typfehler +"betrachten, das heit dieser Typ darf nicht verwendet werden.
+ERR_OPENFILE Die Datei mit dem angegebenen Namen konnte nicht geffnet +"werden.
+ERR_NOCHAR Es konnte kein Zeichen generiert werden. Zum Beispiel kann +"'\333' nicht in ein Zeichen umgewandelt werden.
+ERR_NORSCINST Interner Fehler, eine Methode soll auf eine ungltige Instanz +"angewendet werden.
+ERR_NOINPUT Es wurde keine Eingabedatei angegeben.
+ERR_USAGE Es wird eine Kommandozeilenhilfe ausgegeben (rsc -h).
+ERR_UNKNOWNSW In der Kommandozeile wurde ein unbekannter Schalter +"verwendet.
+ERR_REFTODEEP Referenzen werden nur bis zu einer bestimmten Tiefe aufgelst. +"Der Fehler bedeutet, das Referenzen rekursiv definiert wurden +"oder da sie zu tief verschachtelt sind.
+ERR_RSCRANGE In der Klasse RscRange ist ein Fehler aufgetreten.
+ERR_RSCRANGE_OUTDEFSET In eine RscRange-Instanz wurde versucht eine Zahl einzusetzen, +"die auerhalb des Wertebereichs liegt.
+ERR_RSCENUM In der Klasse RscEnum ist ein Fehler aufgetreten.
+ERR_RSCFLAG In der Klasse RscFlag ist ein Fehler aufgetreten.
+ERR_RSCCONT In der Klasse RscCont ist ein Fehler aufgetreten.
+ERR_CONT_INVALIDPOS In einer RscCont-Instanz wurde auf eine Position zugegriffen, auf +"der sich keine Instanz befunden hat.
+ERR_CONT_INVALIDTYPE
In einer RscCont-Instanz wurde versucht eine Instanz mit +"falschem Typ einzusetzen.
+ERR_RSCINST In der Klasse RscInst ist ein Fehler aufgetreten.
+ERR_RSCINST_NOVARNAME Eine Methode der Klasse RscInst die einen Variablennamen als +"Parameter bentigt stellt fest, das dieser Name in der +"entsprechenden Instanz nicht als Variable definiert ist. Vermutlich +"hat die RscInst-Instanz einen anderen Typ als erwartet.
+ERR_RSCINST_RESERVEDNAME Fr ein Makro soll eine Name verwendet werden, der +"schon belegt ist. Namen knnen zum Beispiel schon fr Variablen +"vergeben sein.
+Aga
+Es folgen Fehler die beim Parsen auftreten knnen.
+AfpERR_YACC Allgemeiner Fehler der beim Parsen aufgetreten ist.
+ERR_DOUBLEID Zwei globale Resourcen haben den gleichen Identifier.
+ERR_FALSETYPE Der verwendete Typ ist nicht erlaubt.
+ERR_NOVARIABLENAME Die Variable darf hier nicht verwendet werden.
+ERR_USHORTRANGE Der Zahlenwert ist auerhalb von [0, 0xFFFF].
+ERR_IDRANGE Der Zahlenwert ist auerhalb von [0, 0x7FFF].
+ERR_NOCOPYOBJ Defaultresource wurde nicht gefunden. Eine Resourceinstanz kann +"mit einer anderen initialisiert werden. Diese ander Instanz wurde +"nicht gefunden.
+ERR_REFNOTALLOWED An dieser Stelle ist die Angabe einer Referenz verboten.
+ERR_DOUBLEDEFINE Ein Makroname soll doppelt vergeben werden.
+ERR_COPYNOTALLOWED Die Angabe einer Defaultresource ist verboten.
+ERR_IDEXPECTED Ein Identifier mu Angegeben werden.
+ERR_ZERODIVISION Es sollte durch Null geteilt werden.
+ERR_PRAGMA Bei der Angabe eines Pragmas ist ein Fehler aufgetreten.
+ERR_DECLAREDEFINE Ein Makro mit dieser Deklaration kann nicht erstellt werden. +"Entweder eine rekursive Definition oder die verwendeten Makros +"sind nicht in der Abhngigkeitsliste.
+Aga
+Es folgen Warnungen.
+AfpWRN_LOCALID Resourcen die sich innerhalb einer anderen Resource befinden +"(Unterresourcen) haben ein Identifier ber 255.
+WRN_GLOBALID Globale Resourcen haben einen Identifier unter 256.
+WRN_SUBINMEMBER Die Unterresource werden nicht beachtet. Das bedeutet, da auf +"diese Resourcen zur Laufzeit nicht zugegriffen werden kann.
+WRN_CONT_NOID Die Resourcen haben einen ungltigen Identifier. Auf diese +"Resourcen kann zur Laufzeit nicht zugegriffen werden.
+WRN_STR_REFNOTFOUND Beim schreiben ein rc-Datei konnte eine Stringreferenz nicht +"aufgelst werden.
+WRN_MGR_REFNOTFOUND Beim schreiben ein rc-Datei konnte eine Referenz nicht aufgelst +"werden. Wenn auf Unterresourcen zugegriffen wird, die sich in +"der referenzierten Resource befinden, dann kann ein +"Laufzeitfehler auftreten.
+WRN_CONT_DOUBLEID Zwei Unterresource haben den gleichen Identifier.
+Aga
+
+
+Au0RscError::RscError()
+Aga
+AliRscError::RscError();
+Aga
+Af1Beschreibung
+Aga
+Eine Instanz wird erzeugt. Der Fehlerzhler wird auf Null gesetzt.
+
+Aga
+Aga
+Au0RscError::SetListFile()
+Aga
+Alivoid RscError::SetListFile( FILE * fLstFile );
+Aga
+Af1Beschreibung
+Aga
+Es wird eine Datei angegeben in die das Listing und die Fehlermeldungen geschrieben werden. +fListing darf auch NULL sein, dann wird kein Listing erzeugt.
+
+Af1Parameter
+Aga
+AfpfLstFile Dies ist die Datei in die geschrieben wird.
+Aga
+Af1Anmerkung
+Aga
+Fr das ffnen und Schlieen ist der Aufrufer verantwortlich.
+
+Aga
+Aga
+Au0RscError::StdOut()
+Aga
+Alivirtual void RscError::StdOut( const char * pStr );
+Aga
+Af1Beschreibung
+Aga
+Alle Zeichenketten werden nach stdout geschrieben.
+
+Af1Parameter
+Aga
+AfppStr Dies ist die Zeichenkette die geschrieben wird.
+Aga
+Af1Ausnahmen
+Aga
+Unter MS-Windows wird nicht nach stdout ausgegeben.
+Aga
+Aga
+Aga
+Au0RscError::StdLst()
+Aga
+Alivirtual void RscError::StdLst( const char * pStr );
+Aga
+Af1Beschreibung
+Aga
+Alle Zeichenketten werden in die Listing-Datei geschrieben.
+
+Af1Parameter
+Aga
+AfppStr Dies ist die Zeichenkette die geschrieben wird.
+Aga
+Af1Ausnahmen
+Aga
+Wenn keine Listing-Datei angegeben ist passiert nichts.
+Aga
+Querverweise
+
+Methoden: SetListFile().
+
+Aga
+
+Au0RscError::Error()
+Aga
+Alivirtual void RscError::Error( ERRTYPE aError,
+ RscTop * pClass,
+ const RscId & rId,
+ const char * pMess = NULL );
+Aga
+Af1Beschreibung
+Aga
+Mit dieser Methode werden Fehler- und Warnungsmeldungen ausgegeben. Die Methode benutzt die +Methoden StdOut() und LstOut(). Wenn eine Fehlermeldung vorliegt wird der Fehlerzhler um eins +erhht.
+
+Af1Parameter
+Aga
+AfpaError Hierin ist die Fehlernummer gespeichert. ber diese wird der +"Fehlertext ermittelt.
+pClass Dies ist der Typ der Resourceinstanz, in der der Fehler aufgetreten +"ist. pClass darf NULL sein.
+rId Dies ist der Identifier der Resourceinstanz, in der der Fehler +"aufgetreten ist.
+pMess Dies ist der Fehlertext. pMess darf NULL sein.
+Aga
+Aga
+Aga
+Au0RscError::FatalError()
+Aga
+Alivirtual void RscError::FatalError( ERRTYPE aError,
+ const RscId & rId,
+ const char * pMess = NULL );
+Aga
+Af1Beschreibung
+Aga
+Mit dieser Methode werden schwerwiegende Fehler angezeigt. Die Methode benutzt die Methoden +StdOut() und LstOut(). Die Funktion RscExit( 1 ) wird gerufen, diese sollte das Programm beenden.
+
+Af1Parameter
+Aga
+AfpaError Hierin ist die Fehlernummer gespeichert. ber diese wird der +"Fehlertext ermittelt.
+rId Dies ist der Identifier der Resourceinstanz, in der der Fehler +"aufgetreten ist.
+pMess Dies ist der Fehlertext. pMess darf NULL sein.
+Aga
+Aga
+Aga
+Au0::RscExit()
+Aga
+Alivoid RscExit( USHORT nExit );
+Aga
+Af1Beschreibung
+Aga
+Diese Methode wird gerufen wenn ein schwerwiegende Fehler aufgetreten ist. Das Programm mu +beendet werden.
+Fehlernummer:
+Afp1 Die Funktion FatalError() wurde aufgerufen.
+10 Mit den c-Funktionen alloc() oder realloc() wird kein Speicher +"mehr zur Verfgung gestellt.
+11 Hashtabelle luft ber.
+12 Es wird mehr als 64k -1 Byte Speicher angefordert.
+13 In einem internen Zeichenkettenfeld ist nicht genug Platz.
+14 Es wird ein Objekt gelscht auf das noch mindestens eine +"Referenz besteht.
+16 Maximal 32 Variablen pro Klasse erlaubt.
+Aga
+Af1Parameter
+Aga
+AfpnExit Mit Hilfe dieser Zahl wird der aufgetreten Fehler etwas genauer +"beschrieben.
+Aga
+Af1Beispiel
+Aga
+Alivoid RscExit( USHORT nExit ){
+ if( nExit )
+ printf( "Program exit ist %d\n" nExit );
+ exit( nExit );
+};
+Aga
+Aga
+Aga
+
+
+SsvAgaPA
+Au0Stichwortverzeichnis
+Aga
+Asv::RscExit() 15
+ERRTYPE::Clear() 9
+ERRTYPE::ERRTYPE() 7
+ERRTYPE::IsError() 8
+ERRTYPE::IsOk() 9
+ERRTYPE::IsWarning() 9
+ERRTYPE::operator =() 7
+ERRTYPE::operator USHORT() 8
+ERRTYPE #6
+Fehlernummern 12
+RscError !10
+RscError::Error() 14
+RscError::FatalError() 15
+RscError::RscError() 13
+RscError::SetListFile() 13
+RscError::StdLst() 14
+RscError::StdOut() 13
+
+Aga
+
\ No newline at end of file diff --git a/rsc/doku/feinkonz.43/rscinst.doc b/rsc/doku/feinkonz.43/rscinst.doc new file mode 100644 index 000000000000..88a2cc475bd2 --- /dev/null +++ b/rsc/doku/feinkonz.43/rscinst.doc @@ -0,0 +1,4138 @@ +.\\\ WRITER 6 \\\
+S:\APP\SW5\STARLAB.LAY
+R:\SW55N\TREIBER\PS.GPM
+12
+00000
+00010
+01394
+00001
+00001
+00001
+00002
+00002
+00000
+00000
+00000
+00000
+Markus Meyer
+Spezifikation
+Rsc-Compiler
+Schnittstelle
+
+
+
+
+
+
+0
+16836
+11338
+0
+0
+JA
+3
+75
+0
+20
+0
+0
+0
+0
+0
+0
+0
+JA
+
+
+
+9
+20
+4
+Helvetica 14 Pt
+H1
+97
+20
+0
+
+Helvetica 12 Pt
+H2
+65
+23
+0
+
+Helvetia 10 Pt
+H3
+65
+20
+0
+
+Courier 10 Pt
+C1
+1
+23
+0
+
+Helvetica 14 Pt Fett
+F1
+65
+27
+2
+
+Helvetica 12 Pt Fett
+F2
+65
+23
+2
+
+Helvetia 10 Pt Fett
+F3
+65
+20
+0
+
+Tasten
+T1
+129
+27
+0
+
+Grundschrift
+GA
+97
+20
+0
+
+Grund - Absatzlayout V1.5-LSLP8
+GA
+0
+0
+0
+0
+9
+97
+20
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+Grundabsatzlayout-rechtsbndig
+GR
+0
+0
+0
+0
+9
+35
+20
+0
+2
+0
+1
+NEIN
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+Listing
+LI
+0
+0
+0
+0
+0
+1
+23
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+berschrift
+U0
+0
+0
+0
+0
+5
+35
+28
+2
+1
+0
+1
+NEIN
+NEIN
+JA
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+berschrift X.
+U1
+0
+0
+0
+0
+5
+35
+28
+2
+1
+0
+1
+NEIN
+NEIN
+JA
+240
+1
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+berschrift X.X.
+U2
+0
+0
+0
+0
+6
+35
+24
+2
+1
+0
+1
+NEIN
+NEIN
+JA
+240
+2
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+berschrift X.X.X.
+U3
+0
+0
+0
+0
+6
+35
+20
+2
+1
+0
+1
+NEIN
+NEIN
+JA
+240
+3
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+berschrift X.X.X.X.
+U4
+0
+0
+0
+0
+7
+35
+20
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+4
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+berschrift X.X.X.X.X.
+U5
+0
+0
+0
+0
+7
+35
+20
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+5
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+Einrckung 4 Sp / 4 Sp
+E1
+576
+576
+0
+0
+9
+35
+20
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+Einrckung 8 Sp / 8 Sp
+E2
+1150
+1150
+0
+0
+9
+35
+20
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+Einrckung 0 Sp / 4 Sp
+E3
+0
+564
+0
+0
+9
+35
+20
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+Einrckung 4 Sp / 8 Sp
+E4
+564
+1150
+0
+0
+9
+35
+20
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+Funktionsparameter
+FP
+0
+2891
+0
+0
+9
+35
+20
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+Inhaltsverzeichnis
+IV
+0
+0
+0
+0
+9
+35
+20
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+1
+7653
+0
+0
+Stichwortverzeichnis
+SV
+0
+0
+0
+0
+9
+35
+20
+0
+1
+141
+1
+JA
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+1
+3744
+1
+0
+Fettschrift einzeilig
+F1
+0
+0
+0
+0
+7
+65
+20
+2
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+576
+0
+0
+1152
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+Punktliste
+PL
+0
+564
+0
+0
+9
+35
+20
+0
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+13
+566
+0
+0
+1133
+0
+0
+1728
+0
+0
+2304
+0
+0
+2880
+0
+0
+3456
+0
+0
+4032
+0
+0
+4608
+0
+0
+5184
+0
+0
+5760
+0
+0
+6336
+0
+0
+6912
+0
+0
+7488
+0
+0
+Fuzeile
+FZ
+0
+0
+0
+0
+3
+97
+20
+2
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+1
+7200
+1
+0
+Kopfzeile
+KZ
+0
+0
+0
+0
+3
+97
+20
+2
+1
+0
+1
+NEIN
+NEIN
+NEIN
+240
+0
+0
+16
+0
+0
+0
+0
+0
+0
+0
+NEIN
+
+1
+7920
+1
+0
+Grund-Seitenlayout
+GS
+566
+609
+2436
+679
+1416
+1416
+0
+0
+1
+NEIN
+0
+0
+
+AkzBf3#_PFAD##_TEXTNAME# 6-#_S#-
+Bf3
+
+AfzBf3$Date: 05 Feb 1992 08:23:58 $ $Revision: 1.7 $
+
+Stichwortverzeichnis
+SV
+566
+609
+2437
+680
+1416
+1416
+566
+0
+2
+NEIN
+0
+0
+
+AliBf3Stichwortverzeichnis
+AliBf3 +
+
+Ali6Bf3- #_S# -B00
+
+GS - ohne Fuzeile
+KF
+566
+609
+2437
+680
+1416
+1416
+0
+0
+1
+NEIN
+0
+0
+
+AliBf3#_KATEGORIE# / #_THEMA2#
+AliBf3
+
+Ali
+
+Inhaltsverzeichnis
+IV
+566
+609
+2437
+680
+1416
+1416
+0
+0
+1
+NEIN
+0
+0
+
+AliBf3Inhaltsverzeichnis
+AliBf3 +
+
+Ali
+
+
+
+
+0
+
+0
+
+SkfAga
+
+
+
+
+
+
+
+
+
+Au0 #_KATEGORIE#
+Aga
+
+Au0 #_THEMA2#
+Aga
+
+Au0
+Aga
+
+
+
+
+
+
+
+
+
+
+
+
+Au0 #_AUTOR#
+Aga
+
+Au0 STAR DIVISION / STAR LAB Hamburg
+Aga
+
+Au0 Stand: $Date: 05 Feb 1992 08:23:58 $
+Aga
+
+Sgs
+SkfAgaPA
+
+
+Au0#_KATEGORIE#
+Aga
+
+
+AfpDokumentenname #_THEMA2#
+Aga
+AfpProjektname #_THEMA1#
+Aga
+AfpVersionsnummer $Revision: 1.7 $
+Aga
+
+Afperstellt 02. April 1990
+Aga
+Afpgendert $Date: 05 Feb 1992 08:23:58 $
+Aga
+
+AfpDateiname #_PFAD##_TEXTNAME#
+Aga
+
+AfpAutor #_AUTOR#
+Aga
+AfpBearbeiter $Author: MM $
+Aga
+AfpQualittskontrolle
+Aga
+
+AfpStatus XX in Arbeit
+Afp !__ fertiggestellt
+Afp !__ abgenommen
+Afp !__ freigegeben
+Aga
+
+AfpVertraulich __ Ja XX Nein
+Aga
+
+AfpCopyright (C) Star Division 1990
+Aga
+Sivpa
+
+Au0Inhaltsverzeichnis
+Aga
+Aiv
+1 Einleitung N4
+2 Klassenbaum M5
+3 Klassenbeschreibung E5
+RscDataBase O6
+RscHrc T14
+RscSrc T24
+RscInst S31
+RscInstCopy O50
+Stichwortverzeichnis F53
+
+Sgs
+Au1pa#1 Einleitung
+Aga
+In diesem Dokument werden die Klassen beschrieben, mit denen die vom Rsc-Compiler erstellte +Datenbasis verndert werden knnen. Als Beispiel sei hier der Design-Editor genannt.
+Um das Verstndnis zu erleichtern, ist es hilfreich die Benutzerbeschreibung des Rsc-Compilers zu +lesen.
+
+Hinweise zur Implementation
+
+Die in diesem Dokument beschriebenen Klassen weisen einen hohen Grad an gegenseitigen +Abhngigkeiten auf. Daher mu bei der Anwendung einiger Methoden auf diese Zusammenhnge +besonders geachtet werden. Ein genaues lesen der Dokumentation ist unumgnglich. Zum Beispiel ist +das Lschen einer Instanz nicht immer mglich, da noch Referenzen auf sie bestehen. Diese +Schnittstelle ist darauf ausgelegt, da auf die Daten im Dialogbetrieb zugegriffen wird. Das heit, sie +ist auf bersichtlichkeit und Fehlererkennung nicht aber auf Speicher- und Geschwindigkeitseffizienz +ausgelegt.
+Bevor eine dieser Klassen benutzt wird, mu die InitRscCompiler() Funktion aufgerufen werden.
+Agapa
+Au1#2 Klassenbaum
+Aga
+RscDataBase
+RscHrc -> RscSrc
+RscInst -> RscInstCopy
+
+
+Au1#3 Klassenbeschreibung
+Aga
+AgaRscDataBase:
+
+Diese Klasse stellt Methoden zur Verfgung mit denen ein Resourceprojekt verwaltet werden kann, +wie zum Beispiel das Anlegen einer neuen Datei oder zu einem Klassennamen den Klassentyp +erzeugen.
+
+AgaRscHrc:
+
+Diese Klasse stellt Methoden zur Verfgung mit denen dateiabhngige Informationen und Daten aus +der Datenbasis gewonnen werden knnen. Es handelt sich hierbei hauptschlich um Makros. Diese +Klasse ist als Sicht auf eine hrc-Datei zu verstehen. Die Daten stehen in der Datenbasis.
+
+AgaRscSrc:
+
+Diese Klasse stellt Methoden zur Verfgung mit denen dateiabhngige Informationen und Daten aus +der Datenbasis gewonnen werden knnen. Diese Klasse ist als Sicht auf eine src-Datei zu verstehen. +Die Daten stehen in der Datenbasis.
+
+RscInst:
+
+Eine RscInst reprsentiert eine Referenz auf eine Resourceinstanz, wie zum Beispiel Farbe oder Breite. +Eine Resourceinstanz kann weitere Resourceinstanzen enthalten.
+
+RscInstCopy:
+
+Diese Instanz reprsentiert eine Kopie einer Resourceinstanz.
+
+Au0PARscDataBase
+Aga
+Aliclass RscDataBase {
+protected:
+ RscCmdLine * pCmdLine;
+ RscTypCont * pTC;
+public:
+ RscDataBase( RscError * );
+ ~RscDataBase();
+ RscTop* GetClassType( HASHID nClassName );
+ BOOL MakeConsistent( RscInconsList * pList );
+ RscFileTab * GetFileTab();
+ RscFile * GetFileStruct( ULONG lFileKey );
+ RscStrList * GetPathList();
+ ULONG AddSrcFile( const String & rFileName );
+ ULONG AddHrcFile( const String & rFileName );
+ void ScanForIncFiles( ULONG lFileKey );
+ void RemoveFile( ULONG lKey );
+ RscDefine * FindDef( const String & rName );
+ ULONG GetFileKey( const String & rFileName );
+};
+Aga
+Af1Beschreibung
+Aga
+Diese Klasse enthlt die Klassen RscCmdLine und RscTypCont.
+Die Klasse RscCmdLine enthlt die Steuerinformation fr den Compiler. Die Klasse RscTypCont +enthlt die vom Compiler erstellte DatenBasis.
+Diese Klasse lst folgende Aufgaben:
+ 1. Das berprfen der Konsistenz der Datenbasis.
+ 2. Das Bearbeiten der Projektstruktur.
+
+Af1Anmerkungen
+Aga
+Fr einige Methoden der Klasse RscDataBase gilt, da sie eventuell auf alle existierenden +Resourceinstanzen zugreifen mssen. Wenn zum Beispiel die Konsistenz der Datenbasis berprft +wird, kann dies nur ber die Objekte in der Datenbasis geschehen.
+
+Af1Querverweise
+Aga
+Klassen: RscCmdLine, RscTypCont, RscFile, RscDefList, RscError, RscId, RscHrc, RscSrc.
+Methoden: HashId, GetHashString.
+
+Af1Beispiel
+Aga
+Im Beispiel wird der einer Resource erfragt.
+Ali.....
+Ali// statische Datenstrukturen initialisieren
+InitRscCompiler();
+.....
+RscError aErrorHandle; // Fehlerbehandlung
+RscDataBase aCmpInst( &aErrorHandle ); // Datenbasis
+RscTop* pClassTyp; // ein Klassentyp
+
+// Typ einer Resource aus dem Namen der Klasse erzeugen
+pClassTyp = aCmpInst.GetClassType( HashId( "Color" ) );
+Ali.....
+
+Au0PARscDataBase::RscDataBase()
+Aga
+AliRscDataBase::RscDataBase( RscError * pErrorHandler );
+Aga
+Af1Beschreibung
+Aga
+Diese Methode erzeugt eine Instanz der Klasse RscDataBase. Der Scope von dieser Instanz mu +innerhalb des Scopes von pErrorHandler liegen.
+
+Af1Parameter
+Aga
+AfppErrorHandler Ein Zeiger auf einen Fehlerhandler. Durch ableiten von der Klasse +"RscError kann ein eigener Fehlermechanismus entwickelt werden.
+Aga
+Af1Querverweise
+Aga
+Klasse: RscError
+
+Af1Beispiel
+Aga
+Ali.....
+RscError aErrorHandler;
+RscDataBase aCmpInst( &aErrorHandle );
+.....
+Aga
+Aga
+Aga
+Au0RscDataBase::RscDataBase()
+Aga
+AliRscDataBase::~RscDataBase();
+Aga
+Af1Beschreibung
+Aga
+Lscht die Membervariablen pCmdLine und pTC.
+
+Af1Anmerkungen
+Aga
+Es drfen keine Resourceinstanzen, die mit Hilfe dieser Instanz erzeugt worden sind, mehr existieren.
+
+Af1Querverweise
+Aga
+Klassen: RscInst, RscCmdLine, RscTypCont, RscIncList, RscHrc, RscSrc.
+
+Aga
+Aga
+Au0RscDataBase::GetClassType()
+Aga
+AliRscTop * RscDataBase::GetClassType( HASHID aClassName );
+Aga
+Af1Beschreibung
+Aga
+Aus dem Namen einer Klasse wird der Typ einer Klasse generiert. Der Typ bezieht sich nur auf die +RscDataBase-Instanz von der er erzeugt wurde.
+
+Af1Parameter
+Aga
+AfpaClassName ist der Name der Klasse.
+Aga
+Af1Return-Werte
+Aga
+Der Typ der Klasse wird zurckgeliefert. Wird unter dem Namen keine Klasse gefunden, dann wird +NULL zurckgeliefert.
+
+Af1Anmerkungen
+Aga
+Wenn aus gleichen Namen zweier unterschiedlicher Instanzen Typen erzeugt werden, dann sind diese +unterschiedlich.
+
+Af1Beispiel
+Aga
+Ali.....
+HASHID aClassName = HashId( "Color" );
+RscTop * aType1 = aCmpInst1.GetClassType( aClassName );
+RscTop * aType2 = aCmpInst2.GetClassType( aClassName );
+RscTop * aType3 = aCmpInst2.GetClassType( aClassName );
+.....
+Aga
+aType1 ist ungleich zu aType2.
+aType2 ist gleich zu aType3.
+
+Aga
+Aga
+Au0RscDataBase::MakeConsistent()
+Aga
+AliBOOL RscDataBase::MakeConsistent( RscInconsList * pList );
+Aga
+Af1Beschreibung
+Aga
+Es ist mglich, da durch Vernderungen von Makros die Datenbasis inkonsistent wird. Mit dieser +Methode wird versucht, die Datenbasis wieder in einen konsistenten Zustand zu versetzen. Dies kann +aber auch scheitern, wenn zum Beispiel der Wertebereich einer Variablen verlassen wird oder die + Identifier von Resourceinstanzen den gleichen Wert haben. pList enthlt die Makros bei denen es +Inkonsistenzen gibt.
+
+Af1Parameter
+Aga
+AfppList ist ein Zeiger auf eine Liste von Makro-Paaren. pList darf auch +"NULL sein.
+Aga
+Af1Return-Werte
+Aga
+AfpTRUE die Datenbasis ist wieder konsistent.
+FALSE es konnte kein konsistenter Zustand hergestellt werden.
+Aga
+Af1Anmerkungen
+Aga
+Wenn die Datenbasis inkonsistent ist, drfen auf ihr keine Operationen ausgefhrt werden.
+
+Af1Querverweise
+Aga
+Klassen: RscInconsList.
+Methoden: RscInst::IsConsistent.
+
+Af1Beispiel
+Aga
+Ali...
+RscDataBase *pDataBase = new ...; // DatenBasis
+RscSrc aSrc( ... ); //entspricht einer .src Datei
+RscDefine * pDef1, *pDef2; //Makros
+
+aSrc.NewDef( "DEF1", 1000, LIST_APPEND ); //Makro erzeugen
+aSrc.NewDef( "DEF2", 1001, LIST_APPEND ); //Makro erzeugen
+pDef1 = aSrc.FindDef( "DEF1" ); //Makro holen
+pDef2 = aSrc.FindDef( "DEF2" ); //Makro holen
+
+/* aStrInst enthlt eine gltige String-Instanz */
+//String-Instanz unter Id mit Wert 1000 einsetzen
+AliaSrc.SetRscInst( RscId( pDef1 ), aStrInst );
+//String-Instanz unter Id mit Wert 1001 einsetzen
+AliaSrc.SetRscInst( RscId( pDef2 ), aStrInst );
+//aendern des Makro-Wertes
+aSrc.ChangeDef( "DEF2", 1000 );
+//Datenbasis ueberpruefen
+if( pDataBase->MakeConsistent( NULL ) )
+ printf( "Konsistent" );
+else
+ printf( "Inkonsistent" );
+Aga
+Die Ausgabe ist 'Inkonsistent', weil in der Datenbasis zwei String-Instanzen mit dem Identifier 1000 +existieren.
+Aga
+Aga
+Au0RscDataBase::GetFileTab()
+Aga
+AliRscFileTab * RscDataBase::GetFileTab();
+Aga
+Af1Beschreibung
+Aga
+Die interne Struktur der Makro- und Dateiverwaltung wird zurckgeliefert.
+
+Af1Return-Werte
+Aga
+Es wird ein Zeiger auf die Struktur der Projektverwaltung zurckgeliefert.
+Aga
+Af1Querverweise
+Aga
+Klassen: RscFileTab.
+Aga
+Aga
+Aga
+Au0RscDataBase::GetFileStruct()
+Aga
+AliRscFile * RscDataBase::GetFileStruct( ULONG lFileKey );
+Aga
+Af1Beschreibung
+Aga
+Auf die interne Darstellung der Daten einer Datei wird ber einen Schlssel zugegriffen. Mit Hilfe +dieses Schlssels kann man einen Zeiger auf die interne Datenstruktur bekommen.
+
+Af1Parameter
+Aga
+AfplFileKey Schlssel der Datei.
+Aga
+Af1Return-Werte
+Aga
+Zeiger auf interne Struktur.
+Aga
+Af1Querverweise
+Aga
+Klassen: RscFile, RscFileTab.
+Methoden: GetKey().
+Aga
+Aga
+Aga
+Au0RscDataBase::GetPathList()
+Aga
+AliRscStrList * RscDataBase::GetPathList();
+Aga
+Af1Beschreibung
+Aga
+Diese Methode gibt einen Zeiger auf eine Liste mit Pfadnamen zurck. Diese Liste kann verndert +werden. Die nderungen wirken sich sofort auf den Suchpfad aus.
+
+Af1Return-Werte
+Aga
+Es wird die PfadListe zurckgeliefert.
+
+Af1Beispiel
+Aga//veraendern der Pfadliste
+
+AliRscDataBase aBase( ... ); //Datenbasis
+
+// Pfadliste holen
+RscStrList * pPathLst = aBase.GetPathList();
+//Pfad hinzufuegen
+pPathList->Insert( String( "c:\demo\resource" ) );
+Aga
+Aga
+Au0
+Au0RscDataBase::AddSrcFile()
+Aga
+AliULONG RscDataBase::AddSrcFile( const String & rName );
+Aga
+Af1Beschreibung
+Aga
+Diese Methode stellt eine Src-Datei in die Projektverwaltung.
+
+Af1Parameter
+Aga
+AfprName Dies ist der Name der Datei.
+Aga
+Af1Return-Werte
+Aga
+Es wird der Schlssel der Datei zurckgeliefert.
+Aga
+Af1Anmerkungen
+Aga
+Wenn es eine Datei unter diesem Namen gibt, dann wird der Schlssel dieser Datei zurckgegeben.
+
+Af1Querverweise
+Aga
+Klassen: RscFileTab.
+
+Aga
+Aga
+Au0RscDataBase::AddHrcFile()
+Aga
+AliULONG RscDataBase::AddHrcFile( const String & rName );
+Aga
+Af1Beschreibung
+Aga
+Diese Methode stellt eine Hrc-Datei in die Projektverwaltung.
+
+Af1Parameter
+Aga
+AfprName Dies ist der Name der Datei.
+Aga
+Af1Return-Werte
+Aga
+Es wird der Schlssel der Datei zurckgeliefert.
+Aga
+Af1Anmerkungen
+Aga
+Wenn es eine Datei unter diesem Namen gibt, dann wird der Schlssel dieser Datei zurckgegeben.
+
+Af1Querverweise
+Aga
+Klassen: RscFileTab.
+
+Aga
+
+Au0RscDataBase::ScanForIncFiles()
+Aga
+Alivoid RscDataBase::ScanForIncFiles( ULONG lFileKey );
+Aga
+Af1Beschreibung
+Aga
+Diese Methode durchsucht die Datei nach Include-Anweisungen. Die Dateien werden in die +Abhngigkeitsliste von der Datei mit dem Schlssel lFileKey eingetragen. Die Dateien werden in die +Projektverwaltung gestellt.
+
+Af1Anmerkungen
+Aga
+Kann die Datei nicht geffnet werden dann wird die Abhngigkeitsliste nicht gendert. +Preprozessoranweisungen wie #ifdef... werden nicht beachtet. C- und C++-Kommentare werden +beachtet.
+
+Af1Querverweise
+Aga
+Klassen: RscCompiler.
+Methoden: RscCompiler::IncludeParser().
+Aga
+Aga
+
+Au0RscDataBase::RemoveFile()
+Aga
+Alivoid RscDataBase::RemoveFile( ULONG lFileKey );
+Aga
+Af1Beschreibung
+Aga
+Die Datei wird aus der Projektverwaltung gelscht. Alle dieser Datei zugeordneten Makros und +Resource-Instanzen werden gelscht. Alle Verweise auf diese Datei werden gelscht.
+
+Af1Parameter
+Aga
+AfplFileKey Schlssel der Datei.
+Aga
+Af1Anmerkungen
+Aga
+Diese Datei wird auch aus den Abhngigkeitslisten der anderen Dateien gelscht. Wenn +Abhngigkeiten auf Makros bestehen, dann werden sie durch Zahlen ersetzt.
+
+Af1Querverweise
+Aga
+Klassen: RscFile, RscFileTab.
+Methoden: RscTypCont::WriteSrc().
+
+Aga
+Aga
+Au0RscDataBase::FindDef()
+Aga
+AliRscDefine * RscDataBase::FindDef( const String & rName );
+Aga
+Af1Beschreibung
+Aga
+Mit dieser Methode kann ein Makro ber seinen Namen gefunden werden.
+
+Af1Parameter
+Aga
+AfprName ist der Name des Makros.
+Aga
+Af1Return-Werte
+Aga
+Es wird ein Zeiger auf das Makro mit Namen rName zurckgegeben.
+AfpNULL Es wurde kein Makro gefunden.
+Aga
+Af1Querverweise
+Aga
+Klassen: RscFileTab.
+
+Aga
+Aga
+Au0RscDataBase::GetFileKey()
+Aga
+AliULONG RscDataBase::GetFileKey( const String & rFileName );
+Aga
+Af1Beschreibung
+Aga
+Diese Methode sucht in der Projektverwaltung nach einem Datei mit Namen "rFileName".
+Wenn eine Datei unter diesem Namen in der Projektverwaltung steht wird der Schlssel dieser Datei +zurckgegeben.
+
+Af1Parameter
+Aga
+AfprFileKey Der Dateiname nach dem gesucht wird.
+Aga
+Af1Return-Werte
+Aga
+Es wird die Schlssel der Datei zurckgeliefert.
+AfpNOFILE_INDEX dieser Wert zeigt an, da der Dateiname nicht gefunden wurde.
+Aga
+Af1Anmerkungen
+Aga
+Gro-und Kleinschreibung wird bei der Suche beachtet.
+
+Af1Querverweise
+Aga
+Klassen: RscFileTab.
+
+Aga
+Aga
+Au0PARscHrc
+Aga
+Aliclass RscHrc {
+protected:
+ ULONG lFileKey;//Schluessel der Datei
+public:
+ RscHrc( RscDataBase *, ULONG lKey );
+ ~RscHrc();
+ ERRTYPE ReadFile();
+ ULONG GetFileKey();
+ void SetDirty();
+ BOOL IsDirty();
+ void SetPathName( const String & );
+ String GetPathName();
+ void SetFileName( const String & );
+ String GetPathName();
+ void InsertDepend( ULONG lKey, ULONG lPos );
+ RscDefineList * GetDefineList();
+ RscDefine * FindDef( const String & );
+ ERRTYPE NewDef( const String & rName,
+ long lValue, ULONG lPos );
+ ERRTYPE NewDef( const String & rName,
+ const String & rMacro,
+ ULONG lPos );
+ ERRTYPE ChangeDef( const String & rName,
+ long lValue );
+ ERRTYPE ChangeDef( const String & rName,
+ const String & rMacro );
+ BOOL IsDefUsed( const String & rName );
+ void DeleteDef( const String & rName );
+ ERRTYPE ChangeDefName( const String & rName,
+ const String & rNewName );
+
+ RscFile * GetFileStruct();
+ RscDependList * GetDependList();
+ ERRTYPE WriteFile();
+};
+Aga
+Af1Beschreibung
+AgaDiese Klasse enthlt nur eine Referenz auf eine andere Klasse. Alle Operation werden also auf der +referenzierten Klasse durchgefhrt. Diese Klasse ist nur eine Schnittstelle. Diese Klasse stellt eine +Sicht auf eine hrc-Datei dar.
+
+Diese Klasse lst folgende Aufgaben:
+ 1. Das Verwalten der Abhngigkeitsliste einer Datei.
+ 2. Das Verwalten der Makros in dieser Datei.
+ 3. Das Schreiben von ".hrc"-Dateien.
+
+Af1Querverweise
+Aga
+Klassen: RscTypCont, RscDependList, RscDefList, RscError, RscId.
+
+Au0PARscHrc::RscHrc()
+Aga
+AliRscHrc::RscHrc( RscDataBase * pDataBase, ULONG lKey );
+Aga
+Af1Beschreibung
+Aga
+Diese Methode erzeugt eine Instanz der Klasse RscHrc. Der Scope von dieser Instanz mu innerhalb +des Scopes von pDataBase liegen.
+
+Af1Parameter
+Aga
+AfppDataBase Ein Zeiger auf eine Datenbasis.
+lKey Ist der Schlssel einer Datei.
+Aga
+Af1Querverweise
+Aga
+Klassen RscError, RscSrc, RscFileTab.
+
+Af1Beispiel
+Aga
+Ali.....
+/* aSrc ist ein bestehende Instanz der Klasse RscSrc */
+//Abhaengigkeitsliste holen
+RscDependList * pDepLst = aSrc.GetDependList();
+//Erstes Element holen
+RscDepend * pDep = pDepList->First();
+//Hrc-Instanz erzeugen, aHrc ist die Repraesentation der
+//ersten Datei in der Abhaengigkeitsliste
+RscHrc aHrc( pDataBase, pDep->GetFilekey() );
+.....
+Aga
+Aga
+Au0RscHrc::~RscHrc()
+Aga
+AliRscHrc::~RscHrc();
+Aga
+Af1Beschreibung
+Aga
+Der Destruktor hat keine Funktion.
+
+Aga
+Aga
+Au0RscHrc::ReadFile()
+Aga
+AliERRTYPE RscHrc::ReadFile();
+Aga
+Af1Beschreibung
+Aga
+Es wird eine Datei eingelesen. Es wird in der Abhngigkeitsliste berprft ob alle Dateien geladen +sind, sind sie nicht geladen, werden sie zuerst eingelesen. Tritt ein fehler auf, wurde die Fehlerhafte +Datei nicht eingelesen. Der Fehler innerhalb der Datei mu mit einem Editor verbessert werden (siehe +Rsc-Compiler Benutzerhandbuch).
+
+Af1Return-Werte
+Aga
+AfpERRTYPE.IsOk() Es ist kein Fehler aufgetreten.
+AfpERR_OPENFILE Die Datei konnte nicht gffnet werden.
+anderer Wert Siehe Klasse RscError.
+Aga
+Af1Anmerkungen
+Aga
+Es sollte sichergestellt sein, da die Datei mit dem Rsc-Compiler ohne Preprozessor bersetzt werden +kann. Es knnen aber trotzdem Fehler auftreten wie zum Beispiel Identifierkonflikte mit vorher +eingelesener Datei, oder die Include-Dateien wurden vorher nicht eingelesen (#define kann nicht +aufgelst werden).
+
+Af1Querverweise
+Aga
+Klassen: RscError, RscCompiler.
+
+Aga
+
+Au0RscHrc::GetFileKey()
+Aga
+AliULONG RscHrc::GetFileKey();
+Aga
+Af1Return-Werte
+Aga
+Liefert den Schlssel der Datei zurck.
+Aga
+Aga
+Aga
+Au0RscHrc::SetDirty()
+Aga
+Alivoid RscHrc::SetDirty( BOOL bSet );
+Aga
+Af1Beschreibung
+Aga
+Es wird das Attribut Dirty gesetzt. Das Attribut Dirty bewirkt nichts.
+
+Af1Parameter
+Aga
+AfpbSet Ist der Wert auf den das Attribut gesetzt werden soll.
+Aga
+Af1Querverweise
+Aga
+Methoden: IsDirty().
+
+Aga
+Aga
+Au0RscHrc::IsDirty()
+Aga
+AliBOOL RscHrc::IsDirty();
+Aga
+Af1Beschreibung
+Aga
+Gibt an ob das Attribut Dirty gesetzt ist.
+
+Af1Return-Werte
+Aga
+AfpTRUE Dirty ist gesetzt.
+FALSE Dirty ist nicht gesetzt.
+Aga
+Aga
+Au0RscHrc::SetPathName()
+Aga
+Alivoid RscHrc::SetPathName( const String & rPath );
+Aga
+Af1Beschreibung
+Aga
+Der Pfadname der Datei, die durch diese Instanz reprsentiert wird, wird gendert. Der Pfadname ist +der Name, unter dem die Datei gespeichert wird.
+
+Af1Parameter
+Aga
+AfprPath Der Pfadname der Datei.
+Aga
+Af1Querverweise
+Aga
+Klassen: RscFile.
+Methoden: GetPathname(), SetFileName(), GetFileName()
+
+Aga
+Aga
+Au0RscHrc::GetPathName()
+Aga
+AliString RscHrc::GetPathName();
+Aga
+Af1Return-Werte
+Aga
+Der Pfadname der Datei wird zurckgeliefert.
+Aga
+Af1Querverweise
+Aga
+Klassen: RscFile.
+Methoden: SetPathName(), SetFileName(), GetFileName().
+
+Aga
+Aga
+Au0RscHrc::SetFileName()
+Aga
+Alivoid RscHrc::SetFileName( const String & rPath );
+Aga
+Af1Beschreibung
+Aga
+Der Name der Datei, die durch diese Instanz reprsentiert wird, wird gendert. Unter diesem Namen +wird die Datei zum Beispiel in den "#include <Name>" Anweisungen verwendet.
+
+Af1Parameter
+Aga
+AfprPath Der Name der Datei.
+Aga
+Af1Querverweise
+Aga
+Klassen: RscFile.
+Methoden: SetPathName(), GetPathname(), GetFileName()
+
+Aga
+Aga
+Au0RscHrc::GetFileName()
+Aga
+AliString RscHrc::GetFileName();
+Aga
+Af1Return-Werte
+Aga
+Der Name der Datei wird zurckgeliefert.
+Aga
+Af1Querverweise
+Aga
+Klassen: RscFile.
+Methoden: SetPathName(), GetPathName(), SetFileName().
+
+Aga
+Aga
+Aga
+Au0RscHrc::InsertDepend()
+Aga
+Alivoid RscHrc::InsertDepend( ULONG lFileKey, ULONG lPos );
+Aga
+Af1Beschreibung
+Aga
+Eine neue Include-Datei wird in die Abhngigkeitsliste eingefgt.
+
+Af1Parameter
+Aga
+AfplFileKey Dies ist der Schlssel der Include-Datei.
+lPos An dieser Position wird der Schlssel in die Abhngigkeitsliste +"eingefgt.
+Aga
+Af1Return-Werte
+Aga
+Es wird der Schlssel der Datei zurckgeliefert.
+
+Af1Anmerkungen
+Aga
+Wenn eine Include-Datei unter diesem Schlssel schon in der Abhngigkeitsliste steht, wird er nicht +noch einmal eingetragen.
+
+Af1Querverweise
+Aga
+Klassen: RscFile.
+Methoden: FillIncList().
+
+Aga
+Aga
+Au0RscHrc::GetDefineList()
+Aga
+AliRscDefineList * RscHrc::GetDefineList();
+Aga
+Af1Beschreibung
+Aga
+In jeder Hrc-Datei gibt es Makros. Diese Makros werden in eine RscDefineList gestellt.
+
+Af1Return-Werte
+Aga
+Es wird ein Zeiger auf die Makro-Liste zurckgeliefert.
+
+Af1Querverweise
+Aga
+Klassen: RscDefineList.
+
+Aga
+Aga
+Au0RscHrc::FindDef()
+Aga
+AliRscDefine * RscHrc::FindDef( const String & rName );
+Aga
+Beschreibung
+Aga
+Mit dieser Methode kann ein Makro ber seinen Namen gefunden werden. Es wird nur in dieser Datei +oder in den Dateien gesucht, von denen diese Datei abhngt.
+
+Af1Parameter
+Aga
+AfprName ist der Name des Makros.
+Aga
+Af1Return-Werte
+Aga
+Es wird ein Zeiger auf das Makro mit Namen rName zurckgegeben.
+AfpNULL Es wurde kein Makro gefunden.
+Aga
+Af1Querverweise
+Aga
+Klassen: RscFileTab.
+
+Af1Beispiel
+Aga
+Ali//Dateiname = t.src
+...
+#include <t1.hrc>
+#include <t2.hrc>
+
+#define TEST 1
+Aga
+Wenn aHrc2 die Datei t2.hrc reprsentiert, dann werden die Makros in t2.hrc und t1.hrc gesucht. Sie +werden nicht in t.src gesucht.
+
+Aga
+Aga
+Au0RscHrc::NewDef()
+Aga
+AliERRTYPE RscHrc::NewDef( const String & rName,
+ long lValue, ULONG lPos );
+ERRTYPE RscHrc::NewDef( const String & rName,
+ const String & rMacro,
+ ULONG lPos );
+Aga
+Af1Beschreibung
+Aga
+Mit dieser Methode knnen neue Makros angelegt werden. Die Makros werden der Datei zugeordnet, +die durch diese Instanz reprsentiert wird.
+
+Af1Parameter
+Aga
+AfprName Ist der Name des neuen Makros.
+lValue Ist der Wert des neuen Makros.
+rMacro Ist ein String der ausgewertet wird.
+lPos gibt die Position an, an welcher das Makro eingefgt werden soll.
+Aga
+Af1Return-Werte
+Aga
+In ERRTYPE steht, ob ein Fehler aufgetreten ist und um welchen es sich handelt.
+
+Af1Anmerkungen
+Aga
+Durch rMacro knnen Makros auch wieder durch Makros erklrt werden. Es wird sichergestellt, da +nur Makros verwendet werden, die vorher deklariert wurden. Ob sie vorher deklariert wurden, wird +anhand der Abhngigkeitslisten entschieden.
+
+Af1Querverweise
+Aga
+Klassen: RscFileTab.
+Methoden: ::MacroParser().
+
+Af1Beispiel
+Aga
+Ali//Datei demo.hrc in Projektverwaltung
+lFileKey = pBase->AddHrcFile( "demo.hrc" );
+//Sicht auf demo.hrc
+RscHrc aHrc( pBase, lFileKey );
+//Makro erzeugen
+aHrc.NewDef( String( "BASE" ), 1000 );
+//Makro erzeugen
+aHrc.NewDef( String( "DEF_TEST" ), String( "1000 + 2" ) );
+//Makro erzeugen
+aHrc.NewDef( String( "MENU_FILE" ),String( "BASE + 100" ));
+Aga
+Aga
+Aga
+Au0RscHrc::ChangeDef()
+Aga
+AliERRTYPE RscHrc::ChangeDef( const String & rName,
+ const String & rMacro );
+ERRTYPE RscHrc::ChangeDef( const String & rName,
+ long lValue );
+Aga
+Af1Beschreibung
+Aga
+Mit dieser Methode knnen Makros gendert werden.
+
+Af1Parameter
+Aga
+AfprName Ist der Name des neuen Makros.
+rMacro Ist ein String der ausgewertet wird.
+lValue Ist der Wert des genderten Makros.
+Aga
+Af1Return-Werte
+Aga
+In ERRTYPE steht, ob ein Fehler aufgetreten ist und um welchen es sich handelt.
+
+Af1Anmerkungen
+Aga
+Durch rMacro knnen Makros auch wieder durch Makros erklrt werden. Es wird sichergestellt, da +nur Makros verwendet werden, die vorher deklariert wurden. Ob sie vorher deklariert wurden, wird +anhand der Abhngigkeitslisten entschieden.
+
+Af1Querverweise
+Aga
+Klassen: RscFileTab.
+Methoden: ::MacroParser(), NewDef().
+
+Af1Beispiel
+Aga
+Ali//Datei demo.hrc in Projektverwaltung
+lFileKey = pBase->AddHrcFile( "demo.hrc" );
+//Sicht auf demo.hrc
+RscHrc aHrc( pBase, lFileKey );
+//Makro erzeugen
+aHrc.NewDef( String( "BASE" ), 1000 );
+//Makro erzeugen
+aHrc.NewDef( String( "DEF_TEST" ), String( "1000 + 2" ) );
+//Makro aendern
+aHrc.ChangeDef( String( "DEF_TEST" ),
+ String( "BASE + 100" ) );
+Aga
+Aga
+Aga
+Au0RscHrc::IsDefUsed()
+Aga
+AliBOOL RscHrc::IsDefUsed( const String & rName );
+Aga
+Af1Beschreibung
+Aga
+Mit dieser Methode kann festgestellt werden ob ein Makro noch bentigt wird. Es wird bentigt, wenn +Referenzen bestehen, z.B. das Makro wird zur Definition von anderen Makros verwendet.
+
+Af1Parameter
+Aga
+AfprName Ist der Name des Makros.
+Aga
+Af1Return-Werte
+Aga
+AfpTRUE Das Makro wird noch bentigt.
+FALSE Das Makro wird nicht mehr bentigt.
+Aga
+Af1Querverweise
+Aga
+Klassen: RscFileTab.
+
+Aga
+
+Au0RscHrc::DeleteDef()
+Aga
+Alivoid RscHrc::DeleteDef( const String & rName );
+Aga
+Af1Beschreibung
+Aga
+Das Makro mit dem Namen rName wird gelscht.
+
+Af1Parameter
+Aga
+AfprName Ist der Name des Makros.
+Aga
+Af1Querverweise
+Aga
+Klassen: RscFileTab.
+
+Aga
+Aga
+Au0RscHrc::ChangeDefName()
+Aga
+AliERRTYPE RscHrc::ChangeDefName( const String & rName,
+ const String & rNewName );
+Aga
+Af1Beschreibung
+Aga
+Der Name des Makros wird umbenannt. Existiert der neue Name schon, oder ist der neue Name ein +reserviertes Wort, wird ein Fehler zurckgeliefert.
+
+Af1Parameter
+Aga
+AfprName Der Name des Makros.
+rNewName Der neue Name des Makros.
+Aga
+Af1Return-Werte
+Aga
+In ERRTYPE steht, ob ein Fehler aufgetreten ist und um welchen es sich handelt.
+
+Af1Anmerkungen
+Aga
+Alle Objekte oder Makros, die das umbenannte Makro benutzen, enthalten den neuen Namen.
+
+Af1Querverweise
+Aga
+Klassen: RscFileTab.
+
+Aga
+
+Au0RscHrc::GetFileStruct()
+Aga
+AliRscFile * RscHrc::GetFileStruct();
+Aga
+Af1Return-Werte
+Aga
+Liefert einen Zeiger auf die interne Datenstruktur..
+
+Af1Querverweise
+Aga
+Klassen: RscFile, RscFileTab.
+Aga
+Aga
+
+Au0RscHrc::GetDependList()
+Aga
+AliRscDependList * RscHrc::GetDependList();
+Aga
+Af1Beschreibung
+Aga
+Mit dieser Methode bekommt man die Abhngigkeitsliste der Datei.
+
+Af1Return-Werte
+Aga
+Die Methode liefert einen Zeiger auf die Abhngigkeitsliste zurck.
+Aga
+Af1Anmerkungen
+Aga
+Die Datei ist selbst als letztes Element in der Liste vermerkt.
+
+Af1Querverweise
+Aga
+Klassen: RscFile, RscFileTab.
+
+Aga
+Aga
+Au0RscHrc::WriteFile()
+Aga
+AliERRTYPE RscHrc::WriteFile();
+Aga
+Af1Beschreibung
+Aga
+Diese Methode schreibt eine Datei im src-Format. Alle Resourceinstanzen die zu dieser Datei gehren +werden geschrieben. Es werden auch alle zugehrigen Makros geschrieben. Ein Datei ohne +Resourceinstanzen ist eine hrc-Datei. Der Name unter dem die Datei geschrieben wird ist der +Pfadname.
+
+Aga
+Af1Return-Werte
+Aga
+AfpERRTYPE.IsOk() Die Daten wurden in die entsprechende Datei geschrieben.
+Afpanderer Wert Es ist ein Fehler aufgetreten. Die angegebene Datei wurde +"eventuell unvollstndig geschrieben.
+Aga
+Af1Querverweise
+Aga
+Klassen: RscTypCont.
+Methoden: RscTypCont::WriteSrc(), RscDefineList::WriteAll(), SetPathName().
+
+Aga
+Au0PARscSrc
+Aga
+Aliclass RscSrc {
+public:
+ RscSrc( RscDataBase * pDataBase, ULONG lKey );
+ ~RscSrc();
+ RscInstCopy CreateRscInst( RscTop * pClass );
+ ERRTYPE DeleteRscInst( RscTop * pTypeClass,
+ RscId & rName );
+ ERRTYPE SetRscInst( RscId & rInstName, RscInstCopy & );
+ RscInst GetRscInst( RscTop * pClass, RscId & rInst );
+ void FillNameIdList( REResourceList * pList );
+ ERRTYPE WriteCxxFile( const String &,
+ const String & rHxxFile );
+ ERRTYPE WriteHxxFile( const String & );
+};
+Aga
+Af1Beschreibung
+Aga
+Diese Klasse lst folgende Aufgaben:
+ 1. Das Einlesen der Include-Dateien und der ".src"-Datei mit Erstellung der Datenbasis.
+ 2. Das Erzeugen von Resourceinstanzen.
+ 3. Das Finden und Herausgeben von Resourceinstanzen.
+ 4. Das Einsetzen von Resourceinstanzen.
+ 5. Das Schreiben von ".cxx"- und ".hxx"-Dateien.
+
+Af1Anmerkungen
+Aga
+Die von einer Instanz dieser Klasse herausgegebenen Resourceinstanzen sind von der Verwendeten +Datenbasis abhngig, das heit bevor die Datenbasis gelscht wird, mssen alle Resourceinstanzen +gelscht oder wieder eingesetzt worden sein.
+
+Af1Querverweise
+Aga
+Klassen: RscTypCont, RscError, RscId, RscDataBase.
+Methoden: HashId, GetHashString.
+
+Af1Beispiel
+Aga
+Auszug aus der test.src Datei.
+Ali.....
+Color 1000 {
+ Red = 0; //kein Rotanteil
+ Green = 65535;
+ Blue = 65535;
+};
+.....
+
+AgaAuszug aus der ".cxx" Datei.
+Ali.....
+// Compilers initialisieren
+InitRscCompiler();
+.....
+RscError aErrorHandle; // Fehlerbehandlung
+RscdataBase aBase( aErrorHandle ); // Datenbasis erzeugen
+//src-Datei
+RscSrc aSrc( &aBase,
+ aBase->AddSrcFile( "test.src" ) );
+RscInst aInst; // eine ResourceInstanz
+RscTop* pClassTyp; // ein Klassentyp
+
+// Einlesen der Resourcedatei test.src
+aSrc.ReadFile();
+// Typ einer Resource aus dem Namen erzeugen
+pClassTyp = aBase.GetClassType( HashId( "Color" ) );
+// Instanz holen
+aInst = aSrc.GetRscInst( pClassTyp, RscId( 1000 ) );
+// Instanz verndern
+aInst.SetNumber( HashId( "Red" ), 65535 );
+// Da es sich bei aInst nur um eine Referenz in die
+// Datenbasis handelt, werden die Aenderungen sofort
+// uebernommen.
+
+// Vernderte test.src Datei schreiben
+aSrc.WriteFile();
+.....
+
+AgaAuszug aus der vernderten test.src Datei.
+Alle Kommentare werden gelscht. Bei Preprozessoranweisungen wie #include oder #define kommt +es zu Reihenfolgenderungen.
+
+Ali.....
+Color 1000 {
+ Red = 65535;
+ Green = 65535;
+ Blue = 65535;
+};
+.....
+Aga
+
+Au0PARscSrc::RscSrc()
+Aga
+AliRscSrc::RscSrc( RscDataBase * pDataBase,
+ ULONG lFileKey );
+Aga
+Af1Beschreibung
+Aga
+Diese Methode erzeugt eine Instanz der Klasse RscSrc. Der Scope von dieser Instanz mu innerhalb +des Scopes von pDataBase liegen.
+
+Af1Parameter
+Aga
+AfppDataBase Ein Zeiger auf eine Datenbasis.
+lFileKey Der Schlssel einer Datei.
+Aga
+Af1Querverweise
+Aga
+Klasse: RscError
+
+Af1Beispiel
+Aga
+Ali.....
+RscDataBase aDataBase(...);
+RscSrc aCmpInst( &aDataBase,
+ aDataBase.AddSrcFile( "t.src" ) );
+.....
+Aga
+Aga
+Aga
+Au0RscSrc::RscSrc()
+Aga
+AliRscSrc::~RscSrc();
+Aga
+Af1Beschreibung
+Aga
+Diese Methode hat keine Funktion.
+
+Aga
+Aga
+Au0RscSrc::CreateRscInst()
+Aga
+AliRscInstCopy RscSrc::CreateRscInst( RscTop * pClass );
+Aga
+Af1Beschreibung
+Aga
+Diese Methode erzeugt eine Instanz vom Typ pClass.
+
+Af1Parameter
+Aga
+AfppClass ist der Typ der Resource, die erzeugt werden soll.
+Aga
+Af1Return-Werte
+Aga
+Es wird eine RscInstCopy Instanz zurckgeliefert.
+
+Af1Anmerkungen
+Aga
+Ist der Typ der Klasse nicht bekannt, dann wird eine ungltige RscInstCopy zurckgeliefert.
+
+Af1Querverweise
+Aga
+Klasse: RscInst, RscInstCopy.
+Methoden: RscInst::IsInst(), RscDataBase::GetClassType().
+
+Af1Beispiel
+Aga
+Ali.....
+RscInstCopy aColInst;
+RscTop * pColorType =
+ aBase.GetClassType( HashId( "Color" ) );
+
+// Resourceinstanz einer Farbe erzeugen
+aColInst = aCmpInst.CreateRscInst( pColorType );
+if( !aColInst.IsInst() )
+ printf( "Farbinstanz konnte nicht erzeugt werden!" );
+.....
+Aga
+Aga
+
+Au0RscSrc::DeleteRscInst()
+Aga
+AliERRTYPE RscSrc::DeleteRscInst( RscTop * pClass,
+ RscId & rInstName );
+Aga
+Af1Beschreibung
+Aga
+Diese Methode lscht Resourceinstanz mit dem Namen rInstName aus der Datenbasis.
+
+Af1Parameter
+Aga
+AfppClass ist der Typ der Resourceinstanz.
+rInstName ist der Identifier der Resourceinstanz, die gelscht werden soll.
+Aga
+Af1Return-Werte
+Aga
+Zeigt an ob ein Fehler und welcher Fehler aufgetreten ist.
+Aga
+Af1Querverweise
+Aga
+Klasse: RscId, RscError.
+
+Aga
+Aga
+Aga
+Au0RscSrc::SetRscInst()
+Aga
+AliERRTYPE RscSrc::SetRscInst( RscId & rInstName,
+ RscInstCopy & rInst );
+Aga
+Af1Beschreibung
+Aga
+Diese Methode setzt die Daten einer Instanz unter dem Namen rInstName in die Datenbasis ein. Ist +eine andere Instanz unter diesem Namen gespeichert, wird sie gelscht.
+
+Af1Parameter
+Aga
+AfprInstName Identifier der Instanz.
+AfprInst Die Daten aus dieser Instanz werden in die Datenbasis eingesetzt.
+Aga
+Af1Return-Werte
+Aga
+AfpERRTYPE.IsOk() die Instanz wurde eingesetzt.
+anderer Wert Es ist ein Fehler aufgetreten.
+Aga
+Af1Anmerkungen
+Aga
+Die Identifikation einer Instanz erfolgt ber den Typ und den Namen. Wird ein Fehler zurckgegeben, +dann wurde die Instanz nicht eingesetzt.
+
+Af1Querverweise
+Aga
+Klassen: RscInstCopy, RscId.
+Methode: RscDataBase::DeleteRscInst(), GetRscInst().
+
+Af1Beispiel
+Aga
+Ali.....
+RscId aWindowName;// Identifier eines Fensters
+RscInst aWindow; // Instanz eines Fensters
+.....
+//Instanz einsetzen und die Alte lschen, falls vorhanden
+aCmpInst.SetRscInst( aWindowName, aWindow );
+Aga
+Aga
+Aga
+Au0RscSrc::GetRscInst()
+Aga
+AliRscInst RscSrc::GetRscInst( RscTop * pClass,
+ RscId & rInstName );
+Aga
+Af1Beschreibung
+Aga
+Diese Methode holt eine RscInst Instanz aus der Datenbasis.
+
+Af1Parameter
+Aga
+AfppClass der Typ der Instanz.
+AfprInstName der Identifier der Instanz.
+Aga
+Af1Return-Werte
+Aga
+Es wird eine RscInst Intanz zurckgeliefert.
+
+Af1Anmerkungen
+Aga
+Wenn unter dem Typ und Namen keine Instanz zu finden ist, dann ist die zurckgelieferte Instanz +ungltig.
+
+Af1Querverweise
+Aga
+Klassen: RscInst, RscId.
+
+Af1Beispiel
+Aga
+AliRscId aWindowName;// Identifier eines Fensters
+RscInst aWindow; // Instanz eines Fensters
+RscTop * pClassType;
+.....
+// Klassentyp holen
+pClassType = aBase.GetClassType( HashId( "Window" ) );
+// Instanz holen
+aWindow = aCmpInst.GetRscInst( aWindowName, pClassType ) );
+// Instanz gefunden
+if( aWindow.IsInst() )
+ printf( "Instanz gefunden!" );
+....
+Aga
+Aga
+Aga
+Au0RscSrc::FillNameIdList()
+Aga
+Alivoid RscSrc::FillNameIdList( REResourceList * pList );
+Aga
+Af1Beschreibung
+Aga
+Fllt eine Liste mit den Namen und Typen von Resourceinstanzen, die in der Datenbasis stehen.
+
+Af1Parameter
+Aga
+AfppList Dies ist die Liste, die gefllt wird.
+Aga
+Af1Anmerkungen
+Aga
+pList ist eine Liste von Listen. Resourceinstanzen knnen beliebige weitere Resourceinstanzen +beinhalten. Die Liste spiegelt diese Verschachtelung wieder.
+
+Af1Querverweise
+Aga
+Klasse: REResourceList.
+
+Af1Beispiel
+Aga
+Ali// Resourcedatei
+Window 1000 {
+ .....
+ PushButton 1 { ..... };
+ String 1 { ..... };
+ String 2 { ..... };
+};
+AliWindow 1001 { ..... };
+WorkWindow 1000 {
+ .....
+ String 1 { ..... };
+};
+AgaEine von diesen Resourcen erzeugte Liste htte folgende Struktur:
+Window 1000
+ PushButton 1
+ String 1
+ String 2
+Window 1001
+WorkWindow 1000
+ String 1
+Aga
+
+Au0RscSrc::Write...File()
+Aga
+AliERRTYPE RscSrc::WriteCxxFile( const String & rFileName
+ const String & rHxxName );
+ERRTYPE RscSrc::WriteHxxFile( const String & rFileName );
+Aga
+Af1Beschreibung
+Aga
+Diese Methoden schreiben ein entsprechendes Format, der in der Datenbasis stehenden +Resourceinstanzen, in die Dateien. WriteHxxFile schreibt die Include-Datei fr die ".cxx"-Dateien.
+
+Af1Parameter
+Aga
+AfprFileName Dies ist der Name der Datei in die das entsprechende Format +"geschrieben werden soll.
+rHxxName Dies ist der Name "hxx"-Datei, die von der "cxx"-Datei eingefgt +"wird.
+Aga
+Af1Return-Werte
+Aga
+AfpERRTYPE.IsOk() Das Format wurde in die entsprechende Datei geschrieben.
+Afpanderer Wert Es ist ein Fehler aufgetreten. Die angegebene Datei wurde +"eventuell unvollstndig geschrieben.
+Aga
+Aga
+Au0PARscInst
+Aga
+Aliclass RscInst {
+public:
+ RSCINST aInst;
+ RscInst();
+ RscInst( const RscInst & rInst );
+ RscInst( RSCINST aTmpI );
+ RscInst& operator = ( const RscInst& rRscInst );
+ ~RscInst();
+ void OverWrite( RscInstCopy & rInst );
+ BOOL 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,
+ RscId & rName );
+ ERRTYPE DeletePosEle( USHORT nPos );
+ ERRTYPE SetVar( HASHID nVarName,
+ RscInstCopy & rInst );
+ ERRTYPE SetConst( HASHID nConstId );
+ ERRTYPE SetBool( BOOL bSet );
+ ERRTYPE SetNumber( long lValue );
+ ERRTYPE SetString( const char * pStr );
+ ERRTYPE SetRef( const RscId & rRscId );
+ ERRTYPE SetDefault( HASHID nVarName );
+
+ RscInst& GetVar( HASHID nVarName );
+ HASHID GetConst();
+ USHORT GetConstPos();
+ BOOL GetBool();
+ long GetNumber();
+ const char * GetString();
+ RscId GetRef();
+ BOOL IsDefault( HASHID nVarName );
+ BOOL IsConsistent( RscInconsList * pList );
+
+ HASHID GetClassEnum( USHORT nPos );
+ RscTop * GetClassType();
+ HASHID GetClassName();
+ ERRTYPE WriteRc( RscWriteRc & aMem );
+};
+Aga
+Af1Beschreibung
+Aga
+Diese Klasse stellt Methoden zur Verfgung, mit denen Resourceinstanzen erzeugt, verndern und +gelscht werden knnen. Das Erzeugen von Instanzen erfolgt immer impliziet. Das heit beim +Anfordern einer Instanz wird sie erzeugt, wenn sie nicht vorhanden war.
+
+Af1Ausnahmen
+Aga
+Eine Ausname bildet die Methode GetPosEle, wenn an der angegebenen Stelle keine Instanz steht, so +wird eine ungltige Instanz zurckgeliefert.
+
+Af1Anmerkungen
+Aga
+Die Implementation ist nicht auf Geschwindigkeit und Speicherbedarf optimiert.
+
+Af1Querverweise
+Aga
+Klassen: RscDataBase, RscHrc, RscSrc, RSCINST, RscTop, RscId.
+
+Af1Beispiel
+AgaDas Beispiel zeigt, wie der Wert einer Variablen gendert wird
+Ali.....
+RscInst aWindow;
+RscInst aBorder;
+RscTop* pWindowType;
+
+// Typ des Klasse Window
+pWindowType = aDataBase.GetClassType( HashId( "Window" ) );
+// Exemplar der Klasse Window erzeugen
+aWindow = aCompilerInst.CreateRscInst( pWindowType );
+// Exemplar mit Namen "Border" holen
+aBorder = aWindow.GetVar( HashId( "Border" ) );
+// Wert auf TRUE setzen
+aBorder.SetBool( TRUE );
+.....
+Aga
+Au0PARscInst::RscInst()
+Aga
+AliRscInst::RscInst();
+RscInst::RscInst( const RscInst & rInst );
+RscInst::RscInst( RSCINST aTmpI );
+
+Af1Beschreibung
+Aga
+Diese Instanz beinhaltet nur eine Referenz auf die Resourcedaten.
+
+Af1Parameter
+Aga
+AfprInst ist die Instanz, aus der die Referenz bernommen wird.
+aTmpI Aus dieser Instanz wird eine RscInst erzeugt.
+
+Af1Anmerkungen
+Aga
+RscInst hat zwei verschiedene Zustnde die mit der Methode IsInst() abgefragt werden knnen. Liefert +IsInst() TRUE zurck, dann ist es eine gltige Instanz. Anderenfalls ist die Instanz ungltig und alle +Methoden liefern Fehler oder weitere ungltige Instanzen.
+
+Af1Querverweise
+Aga
+Klassen: RSCINST, ERRTYPE.
+Methoden: IsInst(), GetClassType().
+
+Aga
+Aga
+Au0RscInst::operator = ()
+Aga
+AliRscInst & RscInst::operator = ( const RscInst & rInst );
+Aga
+Af1Beschreibung
+Aga
+Es werden die Referenzen von rInst bernommen.
+
+Af1Parameter
+Aga
+AfprInst Intanz von dem die Referenzen bernommen werden.
+Aga
+Af1Return-Werte
+Aga
+Es wird die eigene Instanz zurckgeliefert.
+Aga
+Aga
+Aga
+
+Au0RscInst::~RscInst()
+Aga
+AliRscInst::~RscInst();
+Aga
+Af1Beschreibung
+Aga
+Im Destruktor passiert nichts.
+
+Aga
+Aga
+Au0RscInst::OverWrite()
+Aga
+Alivoid RscInst::OverWrite( RscInstCopy & rInst );
+Aga
+Af1Beschreibung
+Aga
+Die Daten in der Instanz werden mit den Daten in rInst berschrieben.
+
+Af1Parameter
+Aga
+AfprInst ist die Instanz, deren Daten eingesetzt werden.
+Aga
+Af1Anmerkungen
+Aga
+Stimmen die Typen nicht berein, werden die Daten der gemeinsamen Oberklassen bernommen. Die +anderen Daten werden auf Default gesetzt.
+
+Af1Querverweise
+Aga
+Klasse: RscTop.
+Methode: RscInstCopy::RscInstCopy(), RscTop::Create().
+
+Aga
+Aga
+Au0RscInst::IsInst()
+Aga
+AliBOOL RscInst::IsInst();
+Aga
+Af1Beschreibung
+Aga
+Zeigt an ob eine gltige Instanz vorligt.
+
+Af1Return-Werte
+Aga
+AfpTRUE heit, es liegt eine gltige Instanz vor.
+FALSE heit, es liegt keine gltige Instanz vor.
+Aga
+Af1Querverweise
+Aga
+Klasse: RSCINST
+Methode: RSCINST::IsInst();
+
+Aga
+Aga
+Au0RscInst::SetElement()
+Aga
+AliERRTYPE RscInst::SetElement( const RscId & rName,
+ RscInstCopy & rInst);
+Aga
+Af1Beschreibung
+Aga
+Die Methode fgt eine Resourceinstanz unter dem Namen rName ein.
+
+Af1Parameter
+Aga
+AfprInst ist die Instanz die eingefgt werden soll.
+AfprName ist der Identifier unter dem die Instanz eingefgt wird.
+Aga
+Af1Return-Werte
+Aga
+AfpERRTYPE.IsOk() bedeutet, die Instanz wurde Eingefgt.
+anderer Wert bedeutet, da ein Fehler aufgetreten ist.
+Aga
+Af1Anmerkungen
+Aga
+Wenn in der Liste unter diesem Namen und Typ schon eine Instanz steht, wird die Instanz gelscht +und die neue Instanz wird an der gleichen Stelle eingefgt. Wenn rName keine gltige Id enthlt, wird +die Instanz am Ende angefgt.
+
+Af1Querverweise
+Aga
+Klassen: ERRTYPE, RscId, RSCINST.
+Methoden: SetPosEle(), RscId::IsId().
+
+Aga
+Aga
+Au0RscInst::SetPosEle()
+Aga
+AliERRTYPE RscInst::SetPosEle( USHORT nPos,
+ RscInstCopy & rInst );
+Aga
+Af1Beschreibung
+Aga
+An der Position nPos wird eine Resourceinstanz durch rInst ersetzt.
+
+Af1Parameter
+Aga
+AfprInst ist die Instanz die an die Position nPos gesetzt wird.
+nPos ist die Position an die die Instanz gesetzt wird.
+Aga
+Af1Return-Werte
+Aga
+AfpERRTYPE.IsOk() bedeutet, die Instanz auf nPos wurde ersetzt.
+andere Wert bedeutet, die Instanz wurde nicht ersetzt.
+Aga
+Af1Anmerkungen
+Aga
+Wenn ein Fehler zurckgeliefert wird, so heit das meistens, da an der Position nPos keine +Reourceinstanz steht.
+
+Af1Querverweise
+Aga
+Klassen: ERRTYPE, RSCINST.
+
+Aga
+Aga
+Au0RscInst::SetPosRscId()
+Aga
+AliERRTYPE RscInst::SetPosRscId( USHORT nPos,
+ const RscId & rId );
+Aga
+Af1Beschreibung
+Aga
+An der Position nPos wird der Identifier durch rId ersetzt.
+
+Af1Parameter
+Aga
+AfprId ist die Id die an die Position nPos gesetzt wird.
+nPos ist die Position, an die die Id gesetzt wird.
+Aga
+Af1Return-Werte
+Aga
+AfpERRTYPE.IsOk() bedeutet, die Id auf nPos wurde ersetzt.
+andere Wert bedeutet, die Id wurde nicht ersetzt.
+Aga
+Af1Anmerkungen
+Aga
+Wenn ein Fehler zurckgeliefert wird, so heit das meistens, da an der Position nPos keine +Reourceinstanz steht.
+
+Af1Querverweise
+Aga
+Klassen: ERRTYPE, RSCINST.
+
+Aga
+Aga
+
+Aga
+Au0RscInst::GetInfoEle()
+Aga
+AliSUBINFO_STRUCT RscInst::GetInfoEle( USHORT nPos );
+Aga
+Af1Beschreibung
+Aga
+Es wird Information ber die Resourceinstanz, die auf nPos steht, zurckgeliefert.
+
+Af1Parameter
+Aga
+AfpnPos ist die Position der Resourceinstanz.
+Aga
+Af1Return-Werte
+Aga
+Die Information ber die Resourceinstanz wird zurckgeliefert.
+
+Af1Anmerkungen
+Aga
+Steht an der Stelle nPos keine Resourceinstanz, dann ist der Inhalt undefiniert.
+
+Af1Querverweise
+Aga
+Klassen: SUBINFO_STRUCT, RSCINST.
+
+Aga
+
+Au0RscInst::GetCount()
+Aga
+AliUSHORT RscInst::GetCount();
+Aga
+Af1Beschreibung
+Aga
+Gibt die Anzahl der Resourceinstanzen zurck, die in der Liste gespeichert sind.
+
+Af1Return-Werte
+Aga
+Es wird die Anzahl der Resourceinstanzen zurckgeliefert.
+
+Af1Querverweise
+Aga
+Klasse: RSCINST.
+
+Aga
+Aga
+Au0RscInst::GetElement()
+Aga
+AliRscInst RscInst::GetElement( RscTop * pClass,
+ const RscId & rName );
+Aga
+Af1Beschreibung
+Aga
+Diese Methode liefert eine Referenz auf die Daten der Instanz zurck, die unter diesem Namen in der +Liste steht. Wenn unter diesem Namen keine Instanz steht, dann wir sie erzeugt.
+
+Af1Parameter
+Aga
+AfppClass ist der Typ der Instanz.
+rName ist der Identifier der Instanz.
+Aga
+Af1Return-Werte
+Aga
+Es wird eine Instanz zurckgeliefert.
+
+Af1Anmerkungen
+Aga
+Besteht in der Liste eine Einschrnkung auf bestimmte Resourceinstanzen, zum Beispiel nur Instanzen +vom Typ Window oder abgeleitete Typen, dann kann es vorkommen, da eine ungltige Instanz +zurckgeliefert wird.
+
+Af1Querverweise
+Aga
+Klassen: RscTop, RscId.
+Methode: IsInst().
+
+Aga
+Aga
+Au0RscInst::GetPosEle()
+Aga
+AliRscInst RscInst::GetPosEle( USHORT nPos );
+Aga
+Af1Beschreibung
+Aga
+Es wird eine Referenz auf die Daten der Instanz an der angegebenen Stelle zurckgeliefert.
+
+Af1Parameter
+Aga
+AfpnPos ist die Position der Resourceinstanz.
+Aga
+Af1Return-Werte
+Aga
+Es wird eine Resourceinstanz zurckgeliefert.
+
+Af1Anmerkungen
+Aga
+Wenn an der Position keine Instanz steht, dann wird eine ungltige Instanz zurckgeliefert.
+
+Af1Querverweise
+Aga
+Klasse: RscInst.
+Methode: IsInst().
+Aga
+Aga
+Aga
+Au0RscInst::MovePosEle()
+Aga
+AliERRTYPE RscInst::MovePosEle( USHORT nDestPos
+ USHORT nSourcePos );
+Aga
+Af1Beschreibung
+Aga
+In einem Feld wird die Resourceinstanz an der Position nSourcePos an die Stelle nDestPos +verschoben.
+
+Af1Parameter
+Aga
+AfpnDestPos An dieser Position wird die Instanz eingefgt.
+nSourcePos Von dieser Position wird die Instanz genommen.
+Aga
+Af1Return-Werte
+Aga
+Es wird ein Fehler zurckgegeben, wenn nSourcePos oder nDestPos ungltige Positionen sind.
+Aga
+Aga +0
+Aga
+Au0RscInst::DeleteElement()
+Aga
+AliERRTYPE RscInst::DeleteElement( RscTop * pClass,
+ RscId& rName );
+Aga
+Af1Beschreibung
+Aga
+In der Liste wird die erste Resourceinstanz mit dem entsprechenden Namen und dem Typ gelscht.
+
+Af1Parameter
+Aga
+AfppClass ist der Typ der Resourceinstanz.
+rName ist der Identifier der Resourceinstanz.
+Aga
+Af1Return-Werte
+Aga
+Gibt es keinen Fehler, dann wurde die Resourceinstanz gelscht.
+Aga
+Af1Querverweise
+Aga
+Klassen: RscTop, RscId.
+
+Aga
+Aga
+Au0RscInst::DeletePosEle()
+Aga
+AliERRTYPE RscInst::DeletePosEle( USHORT nPos );
+Aga
+Af1Beschreibung
+Aga
+Die Resourceinstanz an der Stelle nPos wird gelscht.
+
+Af1Parameter
+Aga
+AfpnPos ist die Position der Resourceinstanz.
+Aga
+Af1Return-Werte
+Aga
+Gibt es keinen Fehler, dann wurde die Resourseinstanz gelscht.
+Aga
+Aga
+Aga
+Au0RscInst::SetVar()
+Aga
+AliERRTYPE RscInst::SetVar( HASHID nVarName,
+ RscInstCopy & rInst );
+Aga
+Af1Beschreibung
+Aga
+In die Variable mit Namen nVarName wird die Resourceinstanz rInst eingesetzt.
+
+Af1Parameter
+Aga
+AfpnVarName ist der Name der Variablen.
+rInst ist die Instanz, die eingesetzt wird.
+Aga
+Af1Return-Werte
+Aga
+AgaGibt es keinen Fehler, wurde die Instanz eingesetzt.
+Aga
+Af1Anmerkungen
+Aga
+Ein Fehler tritt auf, wenn der Variablentyp und der Instanztyp nicht bereinstimmen.
+
+Af1Querverweise
+Aga
+Klasse: RscTop.
+Methode: GetVar().
+
+Aga
+Aga
+Au0RscInst::SetConst()
+Aga
+AliERRTYPE RscInst::SetConst( HASHID nConst );
+Aga
+Af1Beschreibung
+Aga
+In die Instanz wird die Konstante nConst eingesetzt.
+
+Af1Parameter
+Aga
+AfpnConst ist die Konstante, die eingesetzt wird.
+Aga
+Af1Return-Werte
+Aga
+Gibt es keinen Fehler, wurde die Konstante eingesetzt.
+Aga
+Af1Querverweise
+Aga
+Klassen: RscTop.
+Methoden: GetConst().
+
+Af1Beispiel
+Aganderung einer Konstanten.
+
+AliRscInstCopy aColorInst;
+RscInst aConst;
+RscTop* pColorType;
+.....
+// Erzeuge Farbinstanz
+aColorInst = aCmpInst.CreateRscInst( pColorType );
+//Const-Instanz holen
+aConst = aColorInst.GetVar( HashId( "Predefined" ) );
+// Farbe auf blau setzten
+aConst.SetConst( HashId( "COL_BLUE" ) );
+// Die gleiche Wirkung haette
+// aConst.SetNumber( COL_BLUE );
+// wobei COL_BLUE in sv.hxx definiert ist
+
+Aga
+Aga
+Au0RscInst::SetBool()
+Aga
+AliERRTYPE RscInst::SetBool( BOOL bVal );
+Aga
+Af1Beschreibung
+Aga
+In die Instanz wird der Wert bVal eingesetzt.
+
+Af1Parameter
+Aga
+AfpbVal ist der Wert, der eingesetzt wird.
+Aga
+Af1Return-Werte
+Aga
+AgaGibt es keinen Fehler, wurde der Wert eingesetzt.
+Aga
+Af1Querverweise
+Aga
+Klassen: RscTop.
+Methoden: GetBool().
+
+Af1Beispiel
+Agandern eines Wahrheitswertes.
+
+AliRscInstCopy aWindowInst;
+RscInst aBool;
+RscTop* pWindowType;
+.....
+// Erzeuge Windowinstanz
+aWindowInst = aCmpInst.CreateRscInst( pWindowType );
+aBool = aWindowInst.GetVar( HashId( "Border" ) );
+// Fensterattribut Rand setzen
+aBool.SetBool( TRUE );
+
+Aga
+Aga
+Au0RscInst::SetNumber()
+Aga
+AliERRTYPE RscInst::SetNumber( long lVal );
+Aga
+Af1Beschreibung
+Aga
+In die Instanz wird der Wert lVal eingesetzt.
+
+Af1Parameter
+Aga
+AfplVal ist der Wert, der eingesetzt wird.
+Aga
+Af1Return-Werte
+Aga
+AgaGibt es keinen Fehler, wurde die Zahl eingesetzt.
+Aga
+Af1Querverweise
+Aga
+Klassen: RscTop.
+Methoden: GetNumber().
+
+Af1Beispiel
+Agandern eines Zahlenwertes.
+
+AliRscInstCopy aColorInst;
+RscInst aNumber;
+RscTop* pColorType;
+.....
+// Erzeuge Farbinstanz
+aColorInst = aCmpInst.CreateRscInst( pColorType );
+aNumber = aColorInst.GetVar( HashId( "RED" ) );
+// volle Rotintensitt
+aNumber.SetNumber( 0xFFFF );
+
+Aga
+
+Au0RscInst::SetString()
+Aga
+AliERRTYPE RscInst::SetString( const char * pStr );
+Aga
+Af1Beschreibung
+Aga
+In die Instanz wird der String pStr eingesetzt.
+
+Af1Parameter
+Aga
+AfppStr ist der String, der eingesetzt wird.
+Aga
+Af1Return-Werte
+Aga
+AgaGibt es keinen Fehler, wurde der String eingesetzt.
+Aga
+Af1Querverweise
+Aga
+Klassen: RscTop.
+Methoden: GetString();
+
+Af1Beispiel
+Agandern einer Zeichenkette.
+
+AliRscInstCopy aFontInst;
+RscInst aStr;
+RscTop* pFontType;
+.....
+// Erzeuge Fontinstanz
+aFontInst = aCmpInst.CreateRscInst( pFontType );
+aStr = aFontInst.GetVar( HashId( "Text" ) );
+// Fontnamen setzen
+aStr.SetString( "Helvetica" );
+
+Aga
+
+Au0RscInst::SetRef()
+Aga
+AliERRTYPE RscInst::SetRef( const RscId & rRefName );
+Aga
+Af1Beschreibung
+Aga
+Beim Schreiben der verschiedenen Dateien wird nicht die Resourceinstanz verwendet, sondern eine +Resourceinstanz vom selben Typ mit dem Namen rRefName. Diese Instanz wird in der Datenbasis +gesucht.
+
+Af1Parameter
+Aga
+AfprRefName ist der Identifier der referenzierten Instanz.
+Aga
+Af1Return-Werte
+Aga
+AgaGibt es keinen Fehler, wurde die Referenz eingesetzt.
+
+Af1Anmerkungen
+Aga
+Die referenzierte Instanz wird nur in der ersten Ebene der Datenbasis gesucht.
+Mit SetRef( RscId() ), werden die Referenzen wieder aufgehoben.
+
+Af1Querverweise
+Aga
+Klassen: RscTop, RscId.
+Methoden: GetRef().
+
+Af1Beispiel
+Aga
+Aga
+Aga
+Au0RscInst::SetDefault()
+Aga
+AliERRTYPE RscInst::SetDefault( HASHID nVarName );
+Aga
+Af1Beschreibung
+Aga
+Die Instanz hinter der Variable nVarName wird auf ihre Defaultwerte gesetzt.
+
+Af1Parameter
+Aga
+AfpnVarName ist der Name der Variablen.
+Aga
+Af1Return-Werte
+Aga
+AgaGibt es keinen Fehler, wurde die Instanz nicht auf Default gesetzt.
+
+Af1Querverweise
+Aga
+Klassen: RscTop.
+Methoden: IsDefault().
+
+Af1Beispiel
+Aga
+AliRscInst aColorInst;
+RscTop* pColorType;
+.....
+// Hole Farbinstanz
+aColorInst = aCmpInst.GetRscInst( pColorType,
+ RscId( 1000 ) );
+// Rot auf Default setzten
+aColorInst.SetDefault( HashId( "Red" ) );
+
+Aga
+
+
+Au0RscInst::GetVar()
+Aga
+AliRscInst RscInst::GetVar( HASHID nVarName );
+Aga
+Af1Beschreibung
+Aga
+Die Methode liefert eine Kopie des Inhaltes der Variablen nVarName.
+
+Af1Parameter
+Aga
+AfpnVarName ist der Name der Variablen.
+Aga
+Af1Return-Werte
+Aga
+Es wird eine Resourceinstanz zurckgeliefert.
+
+Af1Anmerkungen
+Aga
+Existiert keine Variable unter diesem Namen, dann wird eine ungltige Instanz zurckgeliefert.
+
+Af1Querverweise
+Aga
+Klassen: RscTop.
+Methoden: SetVar().
+
+Aga
+
+Au0RscInst::GetConst()
+Aga
+AliHASHID RscInst::GetConst();
+Aga
+Af1Beschreibung
+Aga
+Die Methode liefert die Instanz als Konstante.
+
+Af1Return-Werte
+Aga
+Der Wert der Konstanten.
+Kann die Instanz nicht in eine Konstante umgewandelt werden, wird HASH_NONAME +zurckgeliefert.
+
+Af1Querverweise
+Aga
+Klassen: RscTop.
+Methoden: SetConst().
+
+Aga
+
+Au0RscInst::GetBool()
+Aga
+AliBOOL RscInst::GetBool();
+Aga
+Af1Beschreibung
+Aga
+Die Methode liefert die Instanz als Wahrheitswert.
+
+Af1Return-Werte
+Aga
+Es wird ein boolscher Wert zurckgeliefert.
+Kann die Instanz nicht in einen Wahrheitswert umgewandelt werden, wird FALSE zurckgeliefert.
+
+Af1Querverweise
+Aga
+Klassen: RscTop.
+Methoden: SetBool().
+
+Aga
+
+Au0RscInst::GetNumber()
+Aga
+Alilong RscInst::GetNumber();
+Aga
+Af1Beschreibung
+Aga
+Die Methode liefert die Instanz als Zahl.
+
+Af1Return-Werte
+Aga
+Es wird ein Wert zurckgeliefert.
+Kann die Instanz nicht in ein Zahl umgewandelt werden, wird 0 zurckgeliefert.
+
+Af1Querverweise
+Aga
+Klassen: RscTop.
+Methoden: SetNumber().
+
+Aga
+
+Au0RscInst::GetString()
+Aga
+Aliconst char * RscInst::GetVar();
+Aga
+Af1Beschreibung
+Aga
+Die Methode liefert die Instanz als String.
+
+Af1Return-Werte
+Aga
+Es wird ein Zeiger auf eine Zeichenkette zurckgeliefert.
+Kann die Instanz nicht in einen String umgewandelt werden, wird NULL zurckgeliefert.
+
+Af1Querverweise
+Aga
+Klassen: RscTop.
+Methoden: SetString().
+
+Aga
+
+Au0RscInst::GetRef()
+Aga
+AliRscId RscInst::GetRef();
+Aga
+Af1Beschreibung
+Aga
+Ist in der Instanz eine Referenz eingetragen, wird diese zurckgegeben.
+
+Af1Return-Werte
+Aga
+Es wird der Identifier der Referenz zurckgeliefert.
+
+Af1Anmerkungen
+Aga
+Der zurckgelieferte Identifier kann ungltig sein. Das ist der Fall, wenn keine Referenz besteht.
+
+Af1Querverweise
+Aga
+Klassen: RscTop, RscId.
+Methode: IsId(), SetDefault().
+
+Aga
+
+Au0RscInst::IsDefault()
+Aga
+AliBOOL RscInst::IsDefault( HASHID nVarName );
+Aga
+Af1Beschreibung
+Aga
+Stellt fest ob die genannte Variable noch die Defaulteinstellung besitzt.
+
+Af1Parameter
+Aga
+AfpnVarName ist der Name der Variablen.
+Aga
+Af1Return-Werte
+Aga
+AfpTRUE bedeutet, die Variable hat die Defaulteinstellung.
+FALSE bedeutet, sie wurde verndert.
+Aga
+Af1Querverweise
+Aga
+Methoden: SetDefault().
+
+Aga
+
+Au0RscInst::IsConsistent()
+Aga
+AliBOOL RscInst::IsConsistent( RscInconsList * pList );
+Aga
+Af1Beschreibung
+Aga
+Die Methode berprft ob diese Instanz noch konsistent ist.
+
+Af1Parameter
+Aga
+AfppList Eine Liste die mit den RscId-Objekten gefllt wird, die +"Inkonsistenzen hervorrufen. pList darf Null sein.
+Aga
+Af1Return-Werte
+Aga
+AfpTRUE bedeutet die Instanz ist konsistent.
+FALSE bedeutet die Instanz ist inkonsistent.
+Aga
+Af1Anmerkungen
+Aga
+Ein RscId-Objekt kann aus Objekten zusammengesetzt sein, die global verndert werden knnen. +Nach einer solchen Vernderung mu die Konsistenz berprft werden.
+
+Af1Querverweise
+Aga
+Klassen: RscId, RscHrc, RscFileTab.
+Mehtoden: RscDataBase::MakeConsistent(), RscTop::IsConsistent().
+
+Aga
+Au0
+Au0RscInst::GetClassEnum()
+Aga
+AliHASHID RscInst::GetClassEnum( USHORT nPos );
+Aga
+Af1Beschreibung
+Aga
+Diese Methode liefert den Namen der Konstanten zurck, die in einem Aufzhlungstyp an der Position +nPos definiert ist.
+
+Af1Parameter
+Aga
+AfpnPos Position der Konstante.
+Aga
+Af1Return-Werte
+Aga
+AfpHASH_NONAME Dieser Wert wird zurckgeliefert, wenn der Variablentyp kein +"Aufzhlungstyp war oder wenn nPos >= der Anzahl der +"Konstanten.
+AgaSonst wird der Name der Konstanten zurckgeliefert.
+Aga
+Af1Beispiel
+Aga
+Das Beispiel zeigt wie die Namen eine Aufzhlungstypen ermittelt werden knnen.
+AgaVariable ist ein Aufzhlungstyp mit den Werten COL_WHITE, COL_RED und COL_BLACK. Die +Konstanten haben die Name "White", "Red", "Black".
+Der Variablenname ist "Predefined".
+Die Klasse, in der diese Variable definiert ist, heit "Color".
+Ali
+HASHID nConstName;
+HASHID nVarName;
+RscInst aColorInst;
+RscInst aConst;
+USHORT i;
+
+nVarName = HashId( "Predefined" ); //Variablennamen setzen
+// pCmpEd ist eine Compiler-Instanz
+aColorInst = pCmpEd->CreateRscInst(
+ pCmpEd->GetClassType( HashId( "Color" ) ) );
+ if( aColorInst.IsInst() ){ //Instanz wurde erzeugt
+ aConst = aColorInst.GetVar( nVarName );
+ i = 0;
+ nConstName = aConst.GetClassEnum( i );
+ while( HASH_NONAME != nConstName ){
+ printf( "%s\n", GetHashString( nConstName ) );
+ i++;
+ nConstName = aConst.GetClassEnum( i );
+ }
+}
+Aga
+Die Ausgabe ist:
+White
+Red
+Black
+Aga
+
+Au0RscInst::GetTypeClass()
+Aga
+AliRscTop * RscInst::GetTypeClass();
+Aga
+Af1Beschreibung
+Aga
+Diese Methode liefert den Typ der Instanz zurck.
+
+Af1Return-Werte
+Aga
+Der Typ der Instanz wird zurckgeliefert.
+
+Aga
+
+Au0RscInst::GetClassName()
+Aga
+AliHASHID RscInst::GetClassName();
+Aga
+Af1Beschreibung
+Aga
+Diese Methode liefert den Namen einer Klasse.
+
+Af1Return-Werte
+Aga
+AfpHASH_NONAME Dieser Wert wird zurckgeliefert, wenn die Klasse keinen Namen +"hat.
+AgaAnsonsten wird der Name der Klasse zurckgeliefert.
+
+Af1Beispiel
+AgaDiese Funktion gibt zu einer Instanz den Klassennamen aus.
+
+Alivoid PrintClassName( RscInst & rInst ){
+// rInst, Instanz deren Klassenname ausgegeben werden soll
+HASHID nClassName;
+
+nClassName = rInst.GetClassName(); // Klassenname holen
+if( HASH_NONAME == nClassName )
+ printf( "Kein Klassenname\n" );
+else
+ printf( "%s\n", GetHashString( nClassName ) );
+}
+Aga
+Aga
+Au0
+Au0RscInst::WriteRc()
+Aga
+AliERRTYPE RscInst::WriteRc( RscWriteRc & aMem );
+Aga
+Af1Beschreibung
+Aga
+Diese Methode erzeugt eine Resource im StarView Resourceformat. Mit dieser Resource kann der +Resourcekonstruktor der entsprechenden Klasse gerufen werden.
+
+Af1Parameter
+Aga
+AfpaMem ist die Instanz, die die Resourcedaten enthlt.
+Aga
+Af1Return-Werte
+Aga
+AfpERRTYPE.IsOk() bedeutet, da in aMem eine korrekte Resource steht.
+anderer Wert bedeutet, das Format ist nicht korrekt.
+Aga
+Af1Ausnahmen
+Aga
+Die System abhngigen Resourcen Icon, Bitmap und Pointer werden nicht vollstndig geschrieben. +Um einen Programmfehler zu vermeiden, mssen die StarView-Klassen entsprechend abgesichert sein.
+
+Af1Anmerkungen
+Aga
+Die Referenzen mssen zum Zeitpunkt von WriteRc aufgelst werden knnen. Knnen sie nicht +aufgelst werden, werden die Daten der Instanz benutzt, in der die Referenz angegeben ist.
+
+Af1Querverweise
+Aga
+Klassen: RscWriteRc, ERRTYPE.
+
+Af1Beispiel
+Aga
+AliRscInst aColor;
+RscTop* pColorType;
+Color aSvColor;
+
+// Farbinstanz erzeugen
+aColor = aCmpInst.CreateColor( pColorType );
+// Farbe auf Gelb setzten
+AliaColor.SetConst( HashId( "Predefined" ),
+ HashId( "COL_YELLOW" ) );
+
+RscWriteRc aMem;
+if( aColor.WriteRc( aMem ).IsOk() ){
+ aSvColor = Color( RscId( aMem.GetRes() ) );
+ .....
+};
+Aga
+
+Aga
+Au0PARscInstCopy
+Aga
+Aliclass RscInstCopy {
+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();
+};
+Aga
+Af1Beschreibung
+Aga
+Mit Hilfe dieser Klasse wird eine Kopie einer Resourceinstanz angefertigt. Die Kopie enthlt keine +Referenz in die Datenbasis. Es kann somit auch nicht zu einem Fehler kommen, wenn eine +Resourceinstanz in der Datenbasis gelscht wird. Solch ein Fehler kann bei einer Instanz der Klasse +RscInst auftreten.
+
+Af1Anmerkung
+Aga
+Alle Makros die in der Datenbasis gendert werden, ndern sich auch in dieser Instanz. Mit der +Methode IsConsistent() kann diese Instanz auf Konsistenz berprft werden.
+
+Af1Querverweise
+Aga
+Klassen: RscDataBase, RscHrc, RscSrc, RSCINST, RscTop, RscId.
+
+Af1Beispiel
+AgaDas Beispiel zeigt, wie der Wert einer Variablen gendert wird
+Ali.....
+RscInstCopy aWindow;
+RscInstCopy aBorder;
+RscTop* pWindowType;
+
+// Typ des Klasse Window
+pWindowType = aDataBase.GetClassType( HashId( "Window" ) );
+// Exemplar der Klasse Window erzeugen
+aWindow = aCompilerInst.CreateRscInst( pWindowType );
+// Exemplar mit Namen "Border" holen
+aBorder = aWindow.GetVar( HashId( "Border" ) );
+// Wert auf TRUE setzen
+aBorder.SetBool( TRUE );
+// wieder in aWindow einsetzen
+aWindow.SetVar( HashId( "Border" ), aBorder );
+.....
+Aga
+Au0PARscInstCopy::RscInstCopy()
+Aga
+AliRscInstCopy::RscInstCopy();
+RscInstCopy::RscInstCopy( const RscInst & rInst );
+RscInstCopy::RscInstCopy( const RscInstCopy & rInst );
+RscInstCopy::RscInstCopy( RSCINST aTmpI );
+RscInstCopy::RscInstCopy( RscTop * pNewType,
+ const RscInst & rInst );
+Aga
+Af1Beschreibung
+Aga
+Im Konstruktor wird eine Instanz erzeugt oder kopiert.
+
+Af1Parameter
+Aga
+AfprInst ist die Instanz, die kopiert wird.
+aTmpI Aus dieser Instanz wird eine RscInstCopy erzeugt.
+pNewType Wenn dieser Konstruktor verwendet wird, wird eine Instanz mit +"Typ pNewType erzeugt. Alle Daten ab der ersten gemeinsamen +"Oberklasse von rInst und pNewType werden bernommen.
+Aga
+Af1Querverweise
+Aga
+Klassen: RSCINST, ERRTYPE.
+Methoden: IsInst(), GetClassType().
+
+Af1Beispiel
+AgaEs wird gezeigt wie aus einer Button-Instanz eine Edit-Instanz erzeugt wird.
+
+AliRscInstCopy aButton;
+RscInstCopy aEdit;
+RscTop * pEditType =
+ aDataBase.GetClassType( HashId( "Edit" ) );
+//Voraussetzung: In aButton ist gltige Button-Instanz
+//Erzeuge Edit-Instanz
+aEdit = RscInstCopy( pEditType, aButton );
+Aga
+Alle Daten oberhalb von der Klasse Control wurden nach aEdit kopiert.
+Aga
+Aga
+
+Au0RscInstCopy::operator = ()
+Aga
+AliRscInstCopy & RscInstCopy::operator =
+ ( const RscInst & rInst );
+RscInstCopy & RscInstCopy::operator =
+ ( const RscInstCopy & rInst );
+Aga
+Af1Beschreibung
+Aga
+Es werden die Daten von rInst in die Instanzdaten kopiert.
+
+Af1Parameter
+Aga
+AfprInst Intanz von dem die Daten bernommen werden.
+Aga
+Af1Return-Werte
+Aga
+Es wird die eigene Instanz zurckgeliefert.
+Aga
+Aga
+Aga
+
+Au0RscInstCopy::~RscInstCopy()
+Aga
+AliRscInstCopy::~RscInstCopy();
+Aga
+Af1Beschreibung
+Aga
+Die Daten in der Instanz werden gelscht.
+
+Aga
+Aga
+SsvPA
+Au0Stichwortverzeichnis
+Aga
+Asv
+RscDataBase 6
+RscDataBase::AddHrcFile() 11
+RscDataBase::AddSrcFile() 10
+RscDataBase::FindDef() 12
+RscDataBase::GetClassType() 7
+RscDataBase::GetFileKey() 12
+RscDataBase::GetFileStruct() 9
+RscDataBase::GetFileTab() 9
+RscDataBase::GetPathList() 10
+RscDataBase::MakeConsistent()
8
+RscDataBase::RemoveFile() 12
+RscDataBase::RscDataBase() 7
+RscDataBase::ScanForIncFiles() 11
+RscHrc #14
+RscHrc::ChangeDef() 20
+RscHrc::ChangeDefName() 22
+RscHrc::DeleteDef() 21
+RscHrc::FindDef() 19
+RscHrc::GetDefineList() 18
+RscHrc::GetDependList() 23
+RscHrc::GetFileKey() 16
+RscHrc::GetFileName() 18
+RscHrc::GetFileStruct() 22
+RscHrc::GetPathName() 17
+RscHrc::InsertDepend() 18
+RscHrc::IsDefUsed() 21
+RscHrc::IsDirty() 16
+RscHrc::NewDef() 19
+RscHrc::ReadFile() 15
+RscHrc::RscHrc() 15
+RscHrc::SetDirty() 16
+RscHrc::SetFileName() 17
+RscHrc::SetPathName() 17
+RscHrc::WriteFile() 23
+RscHrc::~RscHrc() 15
+RscInst "31
+RscInst::DeleteElement() 38
+RscInst::DeletePosEle() 39
+RscInst::GetBool() 44
+RscInst::GetClassEnum() 46
+RscInst::GetClassName() 48
+RscInst::GetConst() 44
+RscInst::GetCount() 36
+RscInst::GetElement() 37
+RscInst::GetInfoEle() 36
+RscInst::GetNumber() 44
+RscInst::GetPosEle() 37
+RscInst::GetRef() 45
+RscInst::GetString() 45
+RscInst::GetTypeClass() 47
+RscInst::GetVar() 43
+RscInst::IsConsistent() 46
+RscInst::IsDefault() 46
+RscInst::IsInst() 34
+RscInst::MovePosEle() 38
+RscInst::operator = () 33
+RscInst::OverWrite() 34
+RscInst::RscInst() 33
+RscInst::SetBool() 40
+RscInst::SetConst() 39
+RscInst::SetDefault() 43
+RscInst::SetElement() 34
+RscInst::SetNumber() 41
+RscInst::SetPosEle() 35
+RscInst::SetPosRscId() 35
+RscInst::SetRef() 42
+RscInst::SetString() 41
+RscInst::SetVar() 39
+RscInst::WriteRc() 48
+RscInst::~RscInst() 33
+RscInstCopy 50
+RscInstCopy::operator = () 51
+RscInstCopy::RscInstCopy() 51
+RscInstCopy::~RscInstCopy() 52
+RscSrc #24
+RscSrc::CreateRscInst() 26
+RscSrc::DeleteRscInst() 27
+RscSrc::FillNameIdList() 29
+RscSrc::GetRscInst() 28
+RscSrc::RscSrc() 26
+RscSrc::SetRscInst() 27
+RscSrc::Write...File() 30
+
+Aga
+
\ No newline at end of file diff --git a/rsc/doku/schriftw.16/change.doc b/rsc/doku/schriftw.16/change.doc new file mode 100644 index 000000000000..4a2120bd1d3c --- /dev/null +++ b/rsc/doku/schriftw.16/change.doc @@ -0,0 +1,1105 @@ +.\\\ WRITER 5 \\\
+S:\APP\SW5\STARLAB.LAY
+S:\APP\SW5\TREIBER\PS.BIN
+12
+00012
+00010
+00940
+00001
+00001
+00001
+00002
+00002
+00000
+00000
+00000
+00000
+N 383284761 Mm
+S 383284859 484 116 4
+D 0 0
+N 383996714 Mm
+S 383996741 494 117 4
+D 0 0
+N 384006675 Mm
+S 384006697 502 117 4
+D 0 0
+N 384133637 Mm
+S 384133699 502 117 3
+D 384133693 3 PostScript
+
+
+
+
+
+
+
+
+
+
+16836
+11338
+0
+0
+JA
+0
+0
+0
+JA
+
+
+
+9
+20
+4
+Helvetica 14 Pt
+H1
+97
+20
+0
+Helvetica 12 Pt
+H2
+65
+23
+0
+Helvetia 10 Pt
+H3
+65
+20
+0
+Courier 10 Pt
+C1
+1
+23
+0
+Helvetica 14 Pt Fett
+F1
+65
+27
+2
+Helvetica 12 Pt Fett
+F2
+65
+23
+2
+Helvetia 10 Pt Fett
+F3
+65
+20
+0
+Tasten
+T1
+129
+27
+0
+Grundschrift
+GA
+97
+20
+0
+Grund - Absatzlayout V1.5-LSLP8
+GA
+0
+0
+0
+0
+9
+97
+20
+0
+1
+0
+1
+0
+NEIN
+NEIN
+240
+0
+13
+576
+0
+1152
+0
+1728
+0
+2304
+0
+2880
+0
+3456
+0
+4032
+0
+4608
+0
+5184
+0
+5760
+0
+6336
+0
+6912
+0
+7488
+0
+Grundabsatzlayout-rechtsbndig
+GR
+0
+0
+0
+0
+9
+35
+20
+0
+2
+0
+1
+0
+NEIN
+NEIN
+240
+0
+13
+576
+0
+1152
+0
+1728
+0
+2304
+0
+2880
+0
+3456
+0
+4032
+0
+4608
+0
+5184
+0
+5760
+0
+6336
+0
+6912
+0
+7488
+0
+Listing
+LI
+0
+0
+0
+0
+0
+1
+23
+0
+1
+0
+1
+0
+NEIN
+NEIN
+240
+0
+13
+576
+0
+1152
+0
+1728
+0
+2304
+0
+2880
+0
+3456
+0
+4032
+0
+4608
+0
+5184
+0
+5760
+0
+6336
+0
+6912
+0
+7488
+0
+berschrift
+U0
+0
+0
+0
+0
+5
+35
+28
+2
+1
+0
+1
+0
+NEIN
+JA
+240
+0
+13
+576
+0
+1152
+0
+1728
+0
+2304
+0
+2880
+0
+3456
+0
+4032
+0
+4608
+0
+5184
+0
+5760
+0
+6336
+0
+6912
+0
+7488
+0
+berschrift X.
+U1
+0
+0
+0
+0
+5
+35
+28
+2
+1
+0
+1
+0
+NEIN
+JA
+240
+1
+13
+576
+0
+1152
+0
+1728
+0
+2304
+0
+2880
+0
+3456
+0
+4032
+0
+4608
+0
+5184
+0
+5760
+0
+6336
+0
+6912
+0
+7488
+0
+berschrift X.X.
+U2
+0
+0
+0
+0
+6
+35
+24
+2
+1
+0
+1
+0
+NEIN
+JA
+240
+2
+13
+576
+0
+1152
+0
+1728
+0
+2304
+0
+2880
+0
+3456
+0
+4032
+0
+4608
+0
+5184
+0
+5760
+0
+6336
+0
+6912
+0
+7488
+0
+berschrift X.X.X.
+U3
+0
+0
+0
+0
+6
+35
+20
+2
+1
+0
+1
+0
+NEIN
+JA
+240
+3
+13
+576
+0
+1152
+0
+1728
+0
+2304
+0
+2880
+0
+3456
+0
+4032
+0
+4608
+0
+5184
+0
+5760
+0
+6336
+0
+6912
+0
+7488
+0
+berschrift X.X.X.X.
+U4
+0
+0
+0
+0
+7
+35
+20
+0
+1
+0
+1
+0
+NEIN
+NEIN
+240
+4
+13
+576
+0
+1152
+0
+1728
+0
+2304
+0
+2880
+0
+3456
+0
+4032
+0
+4608
+0
+5184
+0
+5760
+0
+6336
+0
+6912
+0
+7488
+0
+berschrift X.X.X.X.X.
+U5
+0
+0
+0
+0
+7
+35
+20
+0
+1
+0
+1
+0
+NEIN
+NEIN
+240
+5
+13
+576
+0
+1152
+0
+1728
+0
+2304
+0
+2880
+0
+3456
+0
+4032
+0
+4608
+0
+5184
+0
+5760
+0
+6336
+0
+6912
+0
+7488
+0
+Einrckung 4 Sp / 4 Sp
+E1
+576
+576
+0
+0
+9
+35
+20
+0
+1
+0
+1
+0
+NEIN
+NEIN
+240
+0
+13
+576
+0
+1152
+0
+1728
+0
+2304
+0
+2880
+0
+3456
+0
+4032
+0
+4608
+0
+5184
+0
+5760
+0
+6336
+0
+6912
+0
+7488
+0
+Einrckung 8 Sp / 8 Sp
+E2
+1150
+1150
+0
+0
+9
+35
+20
+0
+1
+0
+1
+0
+NEIN
+NEIN
+240
+0
+13
+576
+0
+1152
+0
+1728
+0
+2304
+0
+2880
+0
+3456
+0
+4032
+0
+4608
+0
+5184
+0
+5760
+0
+6336
+0
+6912
+0
+7488
+0
+Einrckung 0 Sp / 4 Sp
+E3
+0
+564
+0
+0
+9
+35
+20
+0
+1
+0
+1
+0
+NEIN
+NEIN
+240
+0
+13
+576
+0
+1152
+0
+1728
+0
+2304
+0
+2880
+0
+3456
+0
+4032
+0
+4608
+0
+5184
+0
+5760
+0
+6336
+0
+6912
+0
+7488
+0
+Einrckung 4 Sp / 8 Sp
+E4
+564
+1150
+0
+0
+9
+35
+20
+0
+1
+0
+1
+0
+NEIN
+NEIN
+240
+0
+13
+576
+0
+1152
+0
+1728
+0
+2304
+0
+2880
+0
+3456
+0
+4032
+0
+4608
+0
+5184
+0
+5760
+0
+6336
+0
+6912
+0
+7488
+0
+Funktionsparameter
+FP
+0
+2891
+0
+0
+9
+35
+20
+0
+1
+0
+1
+0
+NEIN
+NEIN
+240
+0
+13
+576
+0
+1152
+0
+1728
+0
+2304
+0
+2880
+0
+3456
+0
+4032
+0
+4608
+0
+5184
+0
+5760
+0
+6336
+0
+6912
+0
+7488
+0
+Inhaltsverzeichnis
+IV
+0
+0
+0
+0
+9
+35
+20
+0
+1
+0
+1
+0
+NEIN
+NEIN
+240
+0
+1
+7653
+0
+Stichwortverzeichnis
+SV
+0
+0
+0
+0
+9
+35
+20
+0
+1
+141
+1
+32
+NEIN
+NEIN
+240
+0
+1
+3744
+1
+Fettschrift einzeilig
+F1
+0
+0
+0
+0
+7
+65
+20
+2
+1
+0
+1
+0
+NEIN
+NEIN
+240
+0
+13
+576
+0
+1152
+0
+1728
+0
+2304
+0
+2880
+0
+3456
+0
+4032
+0
+4608
+0
+5184
+0
+5760
+0
+6336
+0
+6912
+0
+7488
+0
+Punktliste
+PL
+0
+564
+0
+0
+9
+35
+20
+0
+1
+0
+1
+0
+NEIN
+NEIN
+240
+0
+13
+566
+0
+1133
+0
+1728
+0
+2304
+0
+2880
+0
+3456
+0
+4032
+0
+4608
+0
+5184
+0
+5760
+0
+6336
+0
+6912
+0
+7488
+0
+Fuzeile
+FZ
+0
+0
+0
+0
+3
+97
+20
+2
+1
+0
+1
+0
+NEIN
+NEIN
+240
+0
+1
+7200
+1
+Kopfzeile
+KZ
+0
+0
+0
+0
+3
+97
+20
+2
+1
+0
+1
+0
+NEIN
+NEIN
+240
+0
+1
+7920
+1
+Grund-Seitenlayout
+GS
+566
+849
+2436
+679
+1416
+1416
+0
+0
+1
+0
+0
+0
+AkzBf3#_PFAD##_TEXTNAME# $-#_S#-
+Bf3
+
+AfzBf3$Date: 05 Jul 1991 13:18:52 $ $Revision: 1.1 $
+
+Stichwortverzeichnis
+SV
+566
+849
+2437
+680
+1416
+1416
+566
+0
+2
+0
+0
+0
+AliBf3Stichwortverzeichnis
+AliBf3 +
+
+Ali6Bf3- #_S# -B00
+
+GS - ohne Fuzeile
+KF
+566
+849
+2437
+680
+1416
+1416
+0
+0
+1
+0
+0
+0
+AliBf3#_KATEGORIE# / #_THEMA2#
+AliBf3
+
+Ali
+
+Inhaltsverzeichnis
+IV
+566
+849
+2437
+680
+1416
+1416
+0
+0
+1
+0
+0
+0
+AliBf3Inhaltsverzeichnis
+AliBf3 +
+
+Ali
+
+
+
+
+0
+
+0
+
+Au0nderungen von der rsc-Compilerversion 1.12 zur Version 1.13
+
+Aga- Die Lnge eines Strings in den Extradaten hat sich verndert.
+- Das Schlsselwort RESOURCE kann angegeben werden.
+- Die Klasse InfoBox wurde gestrichen, sie kann ber MessageBox definiert werden.
+- Die Klasse String kann jetzt als lokale Resource angegeben werden.
+- Die Abkrzung ID fr IDENTIFIER wurde gestrichen.
+- Anstelle von ENABLE gibt es jetzt DISABLE mit gegenteiliger Bedeutung.
+- Anstelle von VISIBLE gibt es jetzt HIDE mit gegenteiliger Bedeutung.
+- Jede Konstruktion mit Hilfen von AUTO_ID wurde gestrichen.
+- Anstelle von Justify = LEFT oder CENTER oder RIGHT wird jetzt Left = TRUE oder Center = +TRUE oder Right = TRUE geschrieben.
+- Innerhalb der Klasse Brush heit es statt
+ Color BRUSHCOLOR {...}; jetzt
+ BrushColor = Color { ... };
+ und statt
+ Color FILLCOLOR { ... }; jetzt
+ FillColor = Color { ... };
+- Innerhalb der Klass Pen heit es statt
+ Color { ... }; jetzt
+ PenColor = Color { ... };
+- Innerhalb der Klasse MapMode sind die Schlsselwrter HORIZONTALSCALE und +VERTICALSCAL weggefallen. XSCALE und YSCALE sind jetzt Tupel.
+- Innerhalb der Klasse Accelerator heit es statt
+ Accelerator {
+ AcceleratorKey { ... };
+ AcceleratorKey { ... };
+ .
+ .
+ .
+ }; jetzt
+ Accelerator {
+ KeyList = {
+ AcceleratorKey { ... };
+ AcceleratorKey { ... };
+ };
+ };
+- Innerhalb der Klasse AcceleratorKey heit es statt
+ AcceleratorKey {
+ Accelerator { ... };
+ }; jetzt
+ AcceleratorKey {
+ SubAccelerator = Accelerator { ... };
+ };
+- Innerhalb der Klasse OutputDevice heit es statt
+ OutputDevice {
+ Pen { ... };
+ Brush BACKGROUNDBRUSH { ... };
+ Brush FILLINBRUSH { ... };
+ Font { ... };
+ MapMode { ... };
+ }; jetzt
+ OutputDevice {
+ OutputPen = Pen { ... };
+ BackGroundBrush = Brush { ... };
+ FillInBrush = Brush { ... };
+ OutputFont = Font { ... };
+ OutputMapMode = MapMode { ... };
+ };
+- Innerhalb der Klasse Window heit es statt
+ Window {
+ Pointer { ... };
+ }; jetzt
+ WindowPointer = Pointer { ... };
+- Das Schlsselwort FOCUS wurde gestrichen.
+- Windows die automatisch geladen werden sollen werden jetzt durch
+ Window {
+ WinChilds = {
+ FixedText { ... };
+ FixedText { ... };
+ };
+ }; spezifiziert.
+- Innerhalb der Klasse WorkWindow heit es statt
+ WorkWindow {
+ Icon { ... };
+ }; jetzt
+ WorkWindow {
+ WorkWindowIcon = Icon { ... };
+ };
+- In der Klasse DialogBox wird
+ Mode = SYSTEMMODAL oder Mode = APPLICATIONMODAL durch
+ AppModal = TRUE oder SysModal = TRUE ersetzt.
+
+- Innerhalb der Klasse Menu heit es statt
+ Menu {
+ MenuItem { ... };
+ MenuItem { ... };
+ .
+ .
+ .
+ }; jetzt
+ Menu {
+ ItemList = {
+ MenuItem { ... };
+ MenuItem { ... };
+ };
+ };
+und statt
+ Menu { ... Separator; ... }; jetzt
+ Menu { ...
+ MenuItem { Seperator = TRUE; };
+ ...
+ };
+- Innerhalb der Klasse MenuItem heit es statt
+ MenuItem {
+ Menu { ... };
+ }; jetzt
+ MenuItem {
+ SubMenu = Menu { ... };
+ };
+- Innerhalb der Klasse ListBox heit es statt
+ ListBox {
+ StringList = "Ich", "heie", "Eddie";
+ }; jetzt
+ ListBox {
+ StringList = { "Ich"; "heie"; "Eddie"; };
+ };
+
\ No newline at end of file diff --git a/rsc/inc/pch/precompiled_rsc.cxx b/rsc/inc/pch/precompiled_rsc.cxx new file mode 100644 index 000000000000..2f62f82c5896 --- /dev/null +++ b/rsc/inc/pch/precompiled_rsc.cxx @@ -0,0 +1,32 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: precompiled_rsc.cxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_rsc.hxx" + diff --git a/rsc/inc/pch/precompiled_rsc.hxx b/rsc/inc/pch/precompiled_rsc.hxx new file mode 100644 index 000000000000..01886ac647cf --- /dev/null +++ b/rsc/inc/pch/precompiled_rsc.hxx @@ -0,0 +1,35 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: precompiled_rsc.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): Generated on 2006-09-01 17:49:55.014369 + +#ifdef PRECOMPILED_HEADERS +#endif + diff --git a/rsc/inc/rscall.h b/rsc/inc/rscall.h new file mode 100644 index 000000000000..e3abe2673de7 --- /dev/null +++ b/rsc/inc/rscall.h @@ -0,0 +1,115 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscall.h,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _RSCALL_H +#define _RSCALL_H + +#include <tools/string.hxx> +#include <rsctools.hxx> +#include <rscerror.h> +#include <rscdef.hxx> +#include <rschash.hxx> +#include <rtl/alloc.h> + +/******************* 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 RscTop; +class RscTypCont; +class RscIncList; + +/******************* G l o b a l V a r i a b l e s *********************/ +extern ByteString* pStdParType; +extern ByteString* pStdPar1; +extern ByteString* pStdPar2; +extern ByteString* pWinParType; +extern ByteString* pWinPar1; +extern ByteString* pWinPar2; +extern sal_uInt32 nRefDeep; +extern sal_uInt32 nRsc_XYMAPMODEId; +extern sal_uInt32 nRsc_WHMAPMODEId; +extern sal_uInt32 nRsc_X; +extern sal_uInt32 nRsc_Y; +extern sal_uInt32 nRsc_WIDTH; +extern sal_uInt32 nRsc_HEIGHT; +extern sal_uInt32 nRsc_DELTALANG; +extern sal_uInt32 nRsc_DELTASYSTEM; +extern sal_uInt32 nRsc_EXTRADATA; +extern AtomContainer* pHS; + +/******************* 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, Atom ); + +/******************* 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 + sal_uInt32 nPos; // Position der Resource + RscTop * pClass; // Klasse des Eintrages +}; + +/******************* F u n c t i o n *************************************/ +void InitRscCompiler(); + +#endif // _RSCALL_H diff --git a/rsc/inc/rscarray.hxx b/rsc/inc/rscarray.hxx new file mode 100644 index 000000000000..b9269d6460a8 --- /dev/null +++ b/rsc/inc/rscarray.hxx @@ -0,0 +1,139 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscarray.hxx,v $ + * $Revision: 1.8 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _RSCARRAY_HXX +#define _RSCARRAY_HXX + +#include <rscall.h> +#include <rscerror.h> +#include <rsctop.hxx> + +class RscEnum; + +/******************* R s c A r r a y ************************************/ +class RscInstNode : public IdNode +{ + sal_uInt32 nTypeId; +protected: + using NameNode::Search; +public: + RSCINST aInst; + RscInstNode( sal_uInt32 nId ); + ~RscInstNode(); + virtual sal_uInt32 GetId() const; + RscInstNode * Left() const { return (RscInstNode *)pLeft ; }; + RscInstNode * Right() const{ return (RscInstNode *)pRight ; }; + RscInstNode * Search( sal_uInt32 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 + sal_uInt32 nSize; // Groesse der Instanzdaten dieser Klasse + // mit Superklassen + sal_uInt32 nOffInstData;// Offset auf eigen Instanzdaten + void WriteSrcArray( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); +public: + RscArray( Atom nId, sal_uInt32 nTypId, + RscTop * pSuper, RscEnum * pTypeClass ); + ~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, INT32 lValue, + RscTop * pCreateClass, + RSCINST * pGetInst ); + virtual ERRTYPE GetArrayEle( const RSCINST & rInst, Atom nId, + RscTop * pCreateClass, + RSCINST * pGetInst ); + + // Gibt die Groesse der Klasse in Bytes + sal_uInt32 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, sal_uInt32 nTab, + const RscId & aId, const char * ); + void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); + ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, BOOL bExtra ); + virtual void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, + const char * ); +}; + +class RscClassArray : public RscArray +{ +public: + RscClassArray( Atom nId, sal_uInt32 nTypId, + RscTop * pSuper, RscEnum * pTypeClass ); + ~RscClassArray(); + virtual void WriteSrcHeader( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, + const RscId & aId, const char * ); + void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); + virtual ERRTYPE WriteRcHeader( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, const RscId & aId, + sal_uInt32 nDeep, BOOL bExtra ); +}; + + +class RscLangArray : public RscArray +{ +public: + RscLangArray( Atom nId, sal_uInt32 nTypId, + RscTop * pSuper, RscEnum * pTypeClass ); + 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..ad077b4233a4 --- /dev/null +++ b/rsc/inc/rscclass.hxx @@ -0,0 +1,142 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscclass.hxx,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _RSCCLASS_HXX +#define _RSCCLASS_HXX + +#include <rscall.h> +#include <rscerror.h> +#include <rschash.hxx> +#include <rsctop.hxx> + +/******************* R s c C l a s s *************************************/ +class RscClass : public RscTop +{ +protected: + struct RscClassInst{ + ULONG nVarDflt; + }; + struct VARTYPE_STRUCT { + Atom nVarName; // Variablenname + RSCVAR nVarType; // Variablentyp + sal_uInt32 nMask; // Maskierungsbit + sal_uInt32 nOffset; // Beginn der Instanzdaten + RscTop * pClass; // Klasse + CLASS_DATA pDefault; // Zeiger auf DefaultDaten + Atom nDataBaseName;//Name fuer Fremddatenbereich + }; + sal_uInt32 nSuperSize; // Groesse der Instanzdaten der SuperKl. + sal_uInt32 nSize; // Groesse der Instanzdaten dieser Klasse + // mit Superklassen + sal_uInt32 nEntries; // Eintraege in pVarTypeList + VARTYPE_STRUCT * pVarTypeList; // Variablenliste + RSCINST GetInstData( CLASS_DATA pData, sal_uInt32 nEle, + BOOL bGetCopy = FALSE ); + CLASS_DATA GetDfltData( sal_uInt32 nEle ); + BOOL IsDflt( CLASS_DATA pData, sal_uInt32 nEle ); + BOOL IsValueDflt( CLASS_DATA pData, sal_uInt32 nEle ); + void SetVarDflt( CLASS_DATA pData, sal_uInt32 nEle, + BOOL bSet ); + INT32 GetCorrectValues( const RSCINST & rInst, sal_uInt32 nVarPos, + sal_uInt32 nTupelIdx, RscTypCont * pTC ); +public: + RscClass( Atom nId, sal_uInt32 nTypId, RscTop * pSuperCl ); + ~RscClass(); + + virtual RSCCLASS_TYPE GetClassType() const; + + void Pre_dtor(); + ERRTYPE SetVariable( Atom nVarName, RscTop * pClass, + RSCINST * pDflt, + RSCVAR nVarType, sal_uInt32 nMask, + Atom nDataBaseName ); + virtual void EnumVariables( void * pData, VarEnumCallbackProc ); + RSCINST GetVariable( const RSCINST & rInst, Atom nVarName, + const RSCINST & rInitInst, + BOOL nInitDflt = FALSE, + RscTop * pCreateClass = NULL ); + RSCINST GetCopyVar( const RSCINST & rInst, Atom nVarName ); + + // Gibt die Groesse der Klasse in Bytes + sal_uInt32 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, Atom nVarId ); + using RscTop::GetDefault; + RSCINST GetDefault( Atom nVarId ); + + RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, BOOL ); + void Destroy( const RSCINST & rInst ); + void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); + ERRTYPE WriteInstRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, BOOL bExtra ); + ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, 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( Atom nId, sal_uInt32 nTypId, RscTop * pSuper ); + ERRTYPE WriteSysDependRc( const RSCINST &, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, BOOL bExtra, + BOOL bFirst = FALSE ); + ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, BOOL bExtra ); +}; + +class RscFirstSysDepend : public RscSysDepend +{ +public: + RscFirstSysDepend( Atom nId, sal_uInt32 nTypId, + RscTop * pSuper ); + ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, BOOL bExtra ); +}; + +class RscTupel : public RscClass +{ +public: + RscTupel( Atom nId, sal_uInt32 nTypId, RscTop * pSuper ); + RSCINST GetTupelVar( const RSCINST & rInst, sal_uInt32 nPos, + const RSCINST & rInitInst ); + void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); +}; + +#endif //_RSCCLASS_HXX diff --git a/rsc/inc/rscclobj.hxx b/rsc/inc/rscclobj.hxx new file mode 100644 index 000000000000..ab31de2eaf32 --- /dev/null +++ b/rsc/inc/rscclobj.hxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscclobj.hxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _RSCCLOBJ_HXX +#define _RSCCLOBJ_HXX + +#include <rsctree.hxx> +#include <rscdef.hxx> +#include <rscall.h> + +/****************** 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 +protected: + using NameNode::Search; + +public: + using NameNode::Insert; + + ObjNode( const RscId & rId, CLASS_DATA pData, ULONG lKey ); + ObjNode * DelObjNode( RscTop * pClass, ULONG lFileKey ); + sal_uInt32 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{ + Atom nTypNameId; // index of a Name in a hashtabel +protected: + using NameNode::Search; + +public: + using NameNode::Insert; + + ObjNode* pObjBiTree; // Zeiger auf Objektbaum + RefNode( Atom nTyp ); + sal_uInt32 GetId() const; + RefNode* Search( Atom 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..27a0b5453326 --- /dev/null +++ b/rsc/inc/rscconst.hxx @@ -0,0 +1,113 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscconst.hxx,v $ + * $Revision: 1.8 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _RSCCONST_HXX +#define _RSCCONST_HXX + +#include <rscall.h> +#include <rscerror.h> +#include <rschash.hxx> +#include <rsctop.hxx> + +/******************* R s c C o n s t *************************************/ +class RscConst : public RscTop +{ +protected: + struct VarEle { + Atom nId; // Name der Konstante + INT32 lValue; // Wert der Konstante + }; + VarEle * pVarArray; // Zeiger auf das Feld mit Konstanten + sal_uInt32 nEntries; // Anzahle der Eintraege im Feld +public: + RscConst( Atom nId, sal_uInt32 nTypId ); + ~RscConst(); + virtual RSCCLASS_TYPE GetClassType() const; + sal_uInt32 GetEntryCount() const { return nEntries; } + // Die erlaubten Werte werden gesetzt + ERRTYPE SetConstant( Atom nVarName, INT32 lValue ); + Atom GetConstant( sal_uInt32 nPos ); + BOOL GetConstValue( Atom nConstId, INT32 * pVal ) const; + BOOL GetValueConst( INT32 nValue, Atom * pConstId ) const; + sal_uInt32 GetConstPos( Atom 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 { + sal_uInt32 nValue; // Position der Konstanten im Array + BOOL bDflt; // Ist Default + }; + sal_uInt32 nSize; +public: + RscEnum( Atom nId, sal_uInt32 nTypId ); + RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, BOOL ); + sal_uInt32 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, Atom nValueId, + INT32 nValue ); + ERRTYPE SetNumber( const RSCINST & rInst, INT32 nValue ); + ERRTYPE GetConst( const RSCINST & rInst, Atom * ); + ERRTYPE GetNumber( const RSCINST & rInst, INT32 * nValue ); + void WriteSrc( const RSCINST &rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); + ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, BOOL bExtra ); +}; + +class RscNameTable; + +sal_uInt32 GetLangId( const ByteString& alang); + +class RscLangEnum : public RscEnum +{ + long mnLangId; +public: + RscLangEnum(); + + void Init( RscNameTable& rNames ); + + Atom AddLanguage( const char* pLang, RscNameTable& rNames ); +}; + +#endif // _RSCCONST_HXX diff --git a/rsc/inc/rsccont.hxx b/rsc/inc/rsccont.hxx new file mode 100644 index 000000000000..e5a509205afc --- /dev/null +++ b/rsc/inc/rsccont.hxx @@ -0,0 +1,156 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rsccont.hxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _RSCCONT_HXX +#define _RSCCONT_HXX + +#include <rscall.h> +#include <rscerror.h> +#include <rsctop.hxx> + +/******************* 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 { + sal_uInt32 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 + sal_uInt32 nSize; // Groesse der Instanzdaten dieser Klasse + // mit Superklassen + sal_uInt32 nOffInstData;// Offset auf eigen Instanzdaten + void DestroyElements( RscBaseContInst * pClassData ); + RSCINST SearchElePos( const RSCINST & rInst, const RscId & rEleName, + RscTop * pClass, sal_uInt32 nPos ); +protected: + void ContWriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); + ERRTYPE ContWriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, BOOL bExtra ); + void ContWriteRcAccess( FILE * fOutput, RscTypCont * pTC, + const char *, BOOL nWriteSize ); +public: + RscBaseCont( Atom nId, sal_uInt32 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 ); + sal_uInt32 GetCount( const RSCINST & rInst ); + RSCINST GetPosEle( const RSCINST & rInst, sal_uInt32 nPos ); + ERRTYPE MovePosEle( const RSCINST & rInst, sal_uInt32 nDestPos, + sal_uInt32 nSourcePos ); + virtual ERRTYPE SetPosRscId( const RSCINST & rInst, sal_uInt32 nPos, + const RscId & rRscId); + SUBINFO_STRUCT GetInfoEle( const RSCINST & rInst, sal_uInt32 nPos ); + ERRTYPE SetString( const RSCINST &, const char * pStr ); + ERRTYPE SetNumber( const RSCINST &, INT32 lValue ); + ERRTYPE SetBool( const RSCINST & rInst, BOOL bValue ); + ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId, + INT32 nValue ); + ERRTYPE SetRef( const RSCINST & rInst, const RscId & rRefId ); + + // Gibt die Groesse der Klasse in Bytes + sal_uInt32 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, sal_uInt32 nPos ); + + void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); + ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32 , 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( Atom nId, sal_uInt32 nTypId, + RscTop * pSuper = NULL, + BOOL bNoId = TRUE ); + void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); +}; + +/******************* R s c C o n t ***************************************/ +class RscCont : public RscContWriteSrc { +public: + RscCont( Atom nId, sal_uInt32 nTypId, + RscTop * pSuper = NULL, + BOOL bNoId = TRUE ); + ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, 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( Atom nId, sal_uInt32 nTypId, + RscTop * pSuper = NULL, + BOOL bNoId = TRUE ); + ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, BOOL bExtra ); +}; + +#endif //_RSCCONT_HXX diff --git a/rsc/inc/rscdb.hxx b/rsc/inc/rscdb.hxx new file mode 100644 index 000000000000..53bde7298485 --- /dev/null +++ b/rsc/inc/rscdb.hxx @@ -0,0 +1,362 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscdb.hxx,v $ + * $Revision: 1.17 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _RSCDB_HXX +#define _RSCDB_HXX + +#include <rscall.h> +#include <rsckey.hxx> +#include <rscconst.hxx> +#include <rscflag.hxx> +#include <rscrange.hxx> +#include <rscstr.hxx> +#include <rscarray.hxx> +#include <rscdef.hxx> + +#include <vector> +#include <map> + +class RscError; +class REResourceList; +class RscTupel; +class RscCont; +class RscCmdLine; + +struct WriteRcContext +{ + FILE * fOutput; + rtl::OString aOutputRc; + rtl::OString aOutputSysList; + RscCmdLine* pCmdLine; +}; + +/****************** R s c T y p C o n ************************************/ +// Liste die alle Basistypen enthaelt +DECLARE_LIST( RscBaseList, RscTop * ) + +// Tabelle fuer Systemabhaengige Resourcen +struct RscSysEntry +{ + sal_uInt32 nKey; + sal_uInt32 nRscTyp; + ByteString aFileName; + sal_uInt32 nTyp; + sal_uInt32 nRefId; +}; +DECLARE_LIST( RscSysList, RscSysEntry * ) + +class RscTypCont +{ + CharSet nSourceCharSet; + sal_uInt32 nMachineId; // Globaler Maschinentyp + RSCBYTEORDER_TYPE nByteOrder; // Intel oder + ByteString aLanguage; // output language + std::vector< sal_uInt32 > aLangFallbacks; // language fallback list (entry 0 is language itself) + ByteString aSearchPath; // Suchen der Bitmap, Icon, Pointer + ByteString aSysSearchPath; // aSearchPath plus language specific paths + sal_uInt32 nUniqueId; // eindeutiger Id fuer Systemresourcen + ULONG nFilePos; // Position in der Datei ( MTF ) + sal_uInt32 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 + + Atom nWinBitVarId; // Name der Winbitvariablen + Atom nBorderId; + Atom nHideId; + Atom nClipChildrenId; + Atom nSizeableId; + Atom nMoveableId; + Atom nMinimizeId; + Atom nMaximizeId; + Atom nCloseableId; + Atom nAppId; + Atom nTabstopId; + Atom nGroupId; + Atom nSysmodalId; + Atom nLeftId; + Atom nCenterId; + Atom nRightId; + Atom nTopId; + Atom nVCenterId; + Atom nBottomId; + Atom nHScrollId; + Atom nVScrollId; + Atom nSortId; + Atom nDefaultId; + Atom nSVLookId; + Atom nRepeatId; + Atom nDropDownId; + Atom nPassWordId; + Atom nReadOnlyId; + Atom nAutoSizeId; + Atom nSpinId; + Atom nTabControlId; + Atom nSimpleModeId; + Atom nDragId; + Atom nScrollId; + Atom nZoomableId; + Atom nHideWhenDeactivateId; + Atom nAutoHScrollId; + Atom nAutoVScrollId; + Atom nDDExtraWidthId; + Atom nWordBreakId; + Atom nLeftLabelId; + Atom nHasLinesId; + Atom nHasButtonsId; + Atom nRectStyleId; + Atom nLineSpacingId; + Atom nSmallStyleId; + Atom nEnableResizingId; + Atom nDockableId; + Atom nScaleId; + Atom nIgnoreTabId; + Atom nNoSplitDrawId; + Atom nTopImageId; + Atom nNoLabelId; + Atom nVertId; + Atom nSingleLineId; + Atom nSysWinId; + + void Init(); // Initialisiert Klassen und Tabelle + void SETCONST( RscConst *, const char *, UINT32 ); + void SETCONST( RscConst *, Atom, UINT32 ); + RscEnum * InitLangType(); + RscEnum * InitFieldUnitsType(); + 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, RscCont * pStrLst ); + 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 * InitClassCheckBox( 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 * InitClassRadioButton( RscTop * pSuper ); + 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 ); + + RscTop * InitClassPatternFormatter( RscTop * pSuper ); + RscTop * InitClassNumericFormatter( RscTop * pSuper ); + RscTop * InitClassMetricFormatter( RscTop * pSuper, + RscEnum * pFieldUnits ); + RscTop * InitClassCurrencyFormatter( RscTop * pSuper, + RscEnum * pFieldUnits ); + RscTop * InitClassDateFormatter( RscTop * pSuper, RscTop * pClassDate ); + RscTop * InitClassTimeFormatter( RscTop * pSuper, RscTop * pClassTime, + RscEnum * pTimeFieldFormat ); + + RscTop * InitClassSpinField( RscTop * pSuper ); + RscTop * InitClassPatternField( RscTop * pSuper ); + RscTop * InitClassNumericField( RscTop * pSuper ); + RscTop * InitClassMetricField( RscTop * pSuper ); + RscTop * InitClassCurrencyField( const char * pClassName, sal_uInt32 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, sal_uInt32 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, + Atom 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; + RscLangEnum aLangType; + RscLangArray aLangString; + RscLangArray aLangShort; + + Atom nAcceleratorType; + + RscError* pEH; // Fehlerhandler + RscNameTable aNmTb; // Tabelle fuer Namen + RscFileTab aFileTab; // Tabelle der Dateinamen + sal_uInt32 nFlags; + std::map<sal_uInt64, ULONG> aIdTranslator; //Ordnet Resourcetypen und Id's einen Id zu + //(unter PM), oder eine Dateiposition (MTF) + + RscTypCont( RscError *, RSCBYTEORDER_TYPE, const ByteString & rSearchPath, sal_uInt32 nFlags ); + ~RscTypCont(); + + Atom AddLanguage( const char* ); + + 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; } + ByteString ChangeLanguage( const ByteString& rNewLang ); + const std::vector< sal_uInt32 >& GetFallbacks() const + { return aLangFallbacks; } + + RSCBYTEORDER_TYPE GetByteOrder() const { return nByteOrder; } + CharSet GetSourceCharSet() const { return nSourceCharSet; } + CharSet SetSourceCharSet( CharSet aCharSet ) + { + CharSet aOld = nSourceCharSet; + nSourceCharSet = aCharSet; + return aOld; + } + void SetSearchPath( const ByteString & rStr) { aSearchPath = rStr; } + ByteString GetSearchPath() const { return aSearchPath; } + void SetSysSearchPath( const ByteString& rStr ) { aSysSearchPath = rStr; } + ByteString GetSysSearchPath() const { return aSysSearchPath; } + void InsertType( RscTop * pType ) + { + aBaseLst.Insert( pType, LIST_APPEND ); + } + RscTop * SearchType( Atom nTypId ); + RscTop * Search( Atom typ ); + CLASS_DATA Search( Atom typ, const RscId & rId ); + void Delete( Atom typ, const RscId & rId ); + // loescht alle Resourceobjekte diese Datei + void Delete( ULONG lFileKey ); + RscTop * GetRoot() { return( pRoot ); }; + sal_uInt32 PutSysName( sal_uInt32 nRscTyp, char * pName, sal_uInt32 nConst, + sal_uInt32 nId, BOOL bFirst ); + void ClearSysNames(); + ERRTYPE WriteRc( WriteRcContext& rContext ); + 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 ); + sal_uInt32 PutTranslatorKey( sal_uInt64 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..dc0e79cd4514 --- /dev/null +++ b/rsc/inc/rscdef.hxx @@ -0,0 +1,277 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscdef.hxx,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _RSCDEF_HXX +#define _RSCDEF_HXX + +#ifndef _TOOLS_UNQIDX_HXX +#include <tools/unqidx.hxx> +#endif +#include <rsctree.hxx> + +/****************** 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; + unsigned short 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( INT32 lValue ){ + aExp.aLong.nHi = (short)(lValue >> 16); + aExp.aLong.nLo = (unsigned short)lValue; + cType = RSCEXP_LONG; + } + INT32 GetLong() const{ + return aExp.aLong.nLo | + ((INT32)aExp.aLong.nHi << 16); + } + BOOL Evaluate( INT32 * 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 + INT32 GetNumber() const; + void Create( const RscExpType & rExpType ); + void Create(){ aExp.cType = RSCEXP_NOTHING; } + + RscId() { Create(); } + + RscId( RscDefine * pEle ); + RscId( INT32 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 INT32() 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 + sal_uInt32 nRefCount; // Wieviele Referenzen auf dieses Objekt + INT32 lId; // Identifier + RscExpression * pExp; // Ausdruck +protected: + + RscDefine( ULONG lFileKey, const ByteString & rDefName, + INT32 lDefId ); + RscDefine( ULONG lFileKey, const ByteString & rDefName, + RscExpression * pExpression ); + ~RscDefine(); + void IncRef(){ nRefCount++; } + sal_uInt32 GetRefCount() const { return nRefCount; } + void DecRef(); + void DefineToNumber(); + void SetName( const ByteString & rNewName ){ aName = rNewName; } + void ChangeMacro( RscExpression * pExpression ); + void ChangeMacro( INT32 lIdentifier ); + + using StringNode::Search; +public: + RscDefine * Search( const char * ); + ULONG GetFileKey() const { return lFileKey; } + BOOL Evaluate(); + INT32 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, + INT32 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( INT32 * 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, + INT32 lId, ULONG lPos ); + RscDefine * NewDef( ULONG lKey, const ByteString & rDefName, + RscExpression *, ULONG lPos ); + + BOOL ChangeDef( const ByteString & rDefName, INT32 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..a957e2c7b202 --- /dev/null +++ b/rsc/inc/rscerror.h @@ -0,0 +1,165 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscerror.h,v $ + * $Revision: 1.8 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _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 0xFFFFFFFF + +#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_RENAMEFILE 0x010B // Return +#define ERR_NOIMAGE 0x010C // 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 { + sal_uInt32 nError; +public: + ERRTYPE() { nError = ERR_OK; } + ERRTYPE( sal_uInt32 nErr ) { nError = nErr; } + ERRTYPE( const ERRTYPE & rErr ) { nError = rErr.nError; }; + ERRTYPE& operator = ( const ERRTYPE & rError ); + operator sal_uInt32() 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; + +enum RscVerbosity +{ + RscVerbositySilent = 0, + RscVerbosityNormal = 1, + RscVerbosityVerbose = 2 +}; + +class RscError +{ + FILE * fListing; + RscVerbosity m_verbosity; + + void WriteError( const ERRTYPE& rError, const char * pMessage ); + void StdLstOut( const char * pStr ); + void StdLstErr( const char * pStr ); + void ErrorFormat( const ERRTYPE& rError, RscTop * pClass, + const RscId & aId ); +public: + sal_uInt32 nErrors;// Anzahl der Fehler + RscError( RscVerbosity _verbosity ) { + fListing = NULL; + nErrors = 0; + m_verbosity = _verbosity; + }; + void SetListFile( FILE * fList ){ + fListing = fList; + }; + FILE * GetListFile(){ + return fListing; + }; + RscVerbosity GetVerbosity() const { return m_verbosity; } + virtual void StdOut( const char *, const RscVerbosity _verbosityLevel = RscVerbosityNormal ); + virtual void StdErr( 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..7dfb78c953e1 --- /dev/null +++ b/rsc/inc/rscflag.hxx @@ -0,0 +1,109 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscflag.hxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _RSCFLAG_HXX +#define _RSCFLAG_HXX + +#include <rscall.h> +#include <rscerror.h> +#include <rschash.hxx> +#include <rscconst.hxx> + +/******************* R s c F l a g ***************************************/ +class RscFlag : public RscConst { + struct RscFlagInst{ + sal_uInt32 nFlags; + sal_uInt32 nDfltFlags; + }; + RSCINST CreateBasic( RSCINST * pInst ); +public: + RscFlag( Atom nId, sal_uInt32 nTypId ); + RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, BOOL ); + RSCINST CreateClient( RSCINST * pInst, const RSCINST & rDflt, + BOOL bOwnClass, Atom nConsId ); + sal_uInt32 Size(); + + virtual void SetToDefault( const RSCINST & rInst ); + BOOL IsDefault( const RSCINST & rInst ); + BOOL IsDefault( const RSCINST & rInst, Atom nConstId ); + + // Ist das Flag gesetzt + BOOL IsSet( const RSCINST & rInst, Atom nConstId ); + + // Als Default setzen + BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef, + Atom nConstId ); + + ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId, + INT32 nValue ); + ERRTYPE SetNotConst( const RSCINST & rInst, Atom nConstId ); + void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); + ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, BOOL bExtra ); +}; + +/******************* R s c C l i e n t ***********************************/ +class RscClient : public RscTop +{ + RscFlag * pRefClass; //Klasse die als Server benutzt wird + Atom nConstId; //Id des zu setzenden Wertes +public: + RscClient( Atom nId, sal_uInt32 nTypId, RscFlag * pClass, + Atom nConstantId ); + virtual RSCCLASS_TYPE GetClassType() const; + RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, BOOL ); + sal_uInt32 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, sal_uInt32 nTab, const char * ); +}; + +#endif // _RSCFLAG_HXX diff --git a/rsc/inc/rschash.hxx b/rsc/inc/rschash.hxx new file mode 100644 index 000000000000..a678bd9b5101 --- /dev/null +++ b/rsc/inc/rschash.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rschash.hxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _RSCHASH_HXX +#define _RSCHASH_HXX + +#include <sal/types.h> +#include <rtl/string.hxx> +#include <hash_map> + +typedef sal_uInt32 Atom; + +#define InvalidAtom Atom( ~0 ) + +class AtomContainer +{ + Atom m_nNextID; + std::hash_map< rtl::OString, Atom, rtl::OStringHash > m_aStringToID; + std::hash_map< Atom, rtl::OString > m_aIDToString; + + public: + AtomContainer(); + ~AtomContainer(); + + Atom getID( const rtl::OString& rStr, bool bOnlyIfExists = false ); + const rtl::OString& getString( Atom nAtom ); + +}; + +#endif // _RSCHASH_HXX + diff --git a/rsc/inc/rscinst.hxx b/rsc/inc/rscinst.hxx new file mode 100644 index 000000000000..85c641aa3333 --- /dev/null +++ b/rsc/inc/rscinst.hxx @@ -0,0 +1,247 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscinst.hxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _RSCINST_HXX +#define _RSCINST_HXX + +#include <rscall.h> +#include <rscerror.h> +#include <rsctools.hxx> + +/******************* 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 *******************/ +Atom HashId( const char * ); // Gibt zu einem String eine HashId +const char * GetHashString( Atom ); // Gibt zu einer Atom 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( sal_uInt32 nPos, RscInstCopy & rInst ); + ERRTYPE SetPosRscId( sal_uInt32 nPos, const RscId & rId ); + SUBINFO_STRUCT GetInfoEle( sal_uInt32 nPos ); + sal_uInt32 GetCount(); + RscInst GetElement( RscTop * pClass, const RscId & rName ); + RscInst GetPosEle( sal_uInt32 nPos ); + ERRTYPE MovePosEle( sal_uInt32 nDestPos, sal_uInt32 nSourcePos ); + ERRTYPE DeleteElement( RscTop * pClass, const RscId & rName ); + ERRTYPE DeletePosEle( sal_uInt32 nPos ); + + ERRTYPE SetVar( Atom nVarName, RscInstCopy & rInst ); + ERRTYPE SetConst( Atom nVarName, Atom nConstId ); + ERRTYPE SetBool( Atom nVarName, BOOL ); + + // Hack fuer X, Y, Width, Height + static ERRTYPE SetCorrectValues( RSCINST & rInst, RSCINST & rVarInst, + INT32 lValue, sal_uInt32 nTupelIdx ); + ERRTYPE SetNumber( Atom nVarName, INT32 ); + + ERRTYPE SetString( Atom nVarName, const char * ); + ERRTYPE SetConst( Atom nConstId ); + ERRTYPE SetBool( BOOL ); + ERRTYPE SetNumber( INT32 ); + ERRTYPE SetString( const char * ); + ERRTYPE SetRef( const RscId & rRscId ); + ERRTYPE SetDefault( Atom nVarName ); + + RscInst GetVar( Atom nVarName ); + Atom GetConst( Atom nVarName = InvalidAtom ); + sal_uInt32 GetConstPos( Atom nVarName = InvalidAtom ); + BOOL GetBool( Atom nVarName = InvalidAtom ); + + // Hack fuer X, Y, Width, Height + static INT32 GetCorrectValues( RSCINST & rInst, RSCINST & rVarInst, + sal_uInt32 nTupelIdx ); + INT32 GetNumber( Atom nVarName = InvalidAtom ); + + const char *GetString( Atom nVarName = InvalidAtom ); + RscId GetRef(); + BOOL IsDefault( Atom nVarName ); + BOOL IsConsistent( RscInconsList * pList ); + + Atom GetClassEnum( Atom nVarName, sal_uInt32 nPos ); + Atom GetClassEnum( sal_uInt32 nPos ); + RscTop * GetClassType(){ return aInst.pClass; }; + Atom 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( Atom nId ); + Atom GetLanguage() const; + + ByteString GetPath() const; + void SetPath( const ByteString & rPath ); + // Konvertiert einen Namen in einen Typ + RscTop* GetClassType( Atom 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, INT32 lValue, + ULONG lPos ); + ERRTYPE NewDef( const ByteString & rMacroName, const ByteString & rMacro, + ULONG lPos ); + ERRTYPE ChangeDef( const ByteString & rMacroName, INT32 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..0fc0ac0c1366 --- /dev/null +++ b/rsc/inc/rsckey.hxx @@ -0,0 +1,64 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rsckey.hxx,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _RSCKEY_HXX +#define _RSCKEY_HXX + +/****************** C l a s s F o r w a r d s **************************/ +class RscTop; + +#include <rscall.h> + +typedef struct { + Atom nName; + sal_uInt32 nTyp; + long yylval; +} KEY_STRUCT; + +class RscNameTable { + BOOL bSort; //soll bei jedem einfuegen sortiert werden? + sal_uInt32 nEntries; //Anzahl der Eintr�ge + KEY_STRUCT * pTable; +public: + RscNameTable(); + ~RscNameTable(); + void SetSort( BOOL bSorted = TRUE ); + Atom Put( Atom nName, sal_uInt32 nTyp, long nValue ); + Atom Put( Atom nName, sal_uInt32 nTyp ); + Atom Put( const char * pName, sal_uInt32 nTyp, long nValue ); + Atom Put( const char * pName, sal_uInt32 nTyp ); + Atom Put( Atom nName, sal_uInt32 nTyp, RscTop * pClass ); + Atom Put( const char * pName, sal_uInt32 nTyp, RscTop * pClass ); + + // TRUE, wurde gefunden + BOOL Get( Atom 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..df20562547e5 --- /dev/null +++ b/rsc/inc/rsclst.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rsclst.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _RSCLST_HXX +#define _RSCLST_HXX + +#ifndef _TOOLS_LIST_HXX +#include <tools/list.hxx> +#endif +#include <rscall.h> + +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..2af5b01d115f --- /dev/null +++ b/rsc/inc/rscmgr.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscmgr.hxx,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _RSCMGR_HXX +#define _RSCMGR_HXX + +#include <rscall.h> +#include <rscerror.h> +#include <rschash.hxx> +#include <rsctop.hxx> +#include <rscclass.hxx> + +/******************* 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, sal_uInt32 nDeep = 0 ); +public: + RscMgr( Atom nId, sal_uInt32 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 ); + sal_uInt32 Size(); + void WriteSrcHeader( const RSCINST & aInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, + const RscId & rId, const char * ); + + void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); + ERRTYPE WriteRcHeader( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, const RscId & rId, + sal_uInt32, BOOL bExtra ); + ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, 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..d390153e8232 --- /dev/null +++ b/rsc/inc/rscpar.hxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscpar.hxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _RSCPAR_HXX +#define _RSCPAR_HXX + +#include <rsctools.hxx> +#include <rscerror.h> + +/****************** 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 + sal_uInt32 nErrorLine; // Zeile des ersten Fehlers + sal_uInt32 nErrorPos; // Position des ersten Fehlers + BOOL bIncLine; // Muss Zeilennummer incrementiert werden + sal_uInt32 nLineNo; // Zeile in der Eingabedatei + ULONG lFileIndex; // Index auf Eingabedatei + ULONG lSrcIndex; // Index auf Basisdatei + FILE * fInputFile; // Eingabedatei + char * pInput; // Lesepuffer + sal_uInt32 nInputBufLen; // Laenge des Lesepuffers + sal_uInt32 nInputPos; // Position im Lesepuffer + sal_uInt32 nInputEndPos;// Ende im Lesepuffer + char * pLine; // Zeile + sal_uInt32 nLineBufLen;//Lange des Zeilenpuffres + sal_uInt32 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 ); + RscFileInst( RscTypCont * pTC, ULONG lIndexSrc, + ULONG lFileIndex, const ByteString & ); + ~RscFileInst(); + BOOL IsEof() const { return bEof; } + void SetFileIndex( ULONG lFIndex ) { lFileIndex = lFIndex; } + ULONG GetFileIndex() { return( lFileIndex ); } + ULONG GetSrcIndex() { return( lSrcIndex ); } + void SetLineNo( sal_uInt32 nLine ) { nLineNo = nLine; } + sal_uInt32 GetLineNo() { return( nLineNo ); } + sal_uInt32 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; } + sal_uInt32 GetErrorLine() { return nErrorLine; } + sal_uInt32 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..d702bef12586 --- /dev/null +++ b/rsc/inc/rscrange.hxx @@ -0,0 +1,212 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscrange.hxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _RSCRANGE_HXX +#define _RSCRANGE_HXX + +#include <rscall.h> +#include <rscerror.h> +#include <rschash.hxx> +#include <rsctop.hxx> + +/******************* R s c R a n g e *************************************/ +class RscRange : public RscTop +{ +protected: + struct RscRangeInst { + sal_uInt16 nValue; // nValue = Ausgangswert - nMin + BOOL bDflt; // Ist Default + }; + INT32 nMin; // Minimum des Bereiches + INT32 nMax; // Maximum des Bereiches + sal_uInt32 nSize; +public: + RscRange( Atom nId, sal_uInt32 nTypId ); + virtual RSCCLASS_TYPE GetClassType() const; + RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, BOOL ); + // Der zulaessige Bereich wird gesetzt + ERRTYPE SetRange( INT32 nMinimum, INT32 nMaximum ); + // Gibt die Groesse der Klasse in Bytes + sal_uInt32 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 &, INT32 ); + ERRTYPE GetNumber( const RSCINST &, INT32 * ); + void WriteSrc( const RSCINST &, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); + ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, 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 + { + INT32 nValue; // nValue = Ausgangswert - nMin + BOOL bDflt; // Ist Default + }; + INT32 nMin; // Minimum des Bereiches + INT32 nMax; // Maximum des Bereiches + sal_uInt32 nSize; +public: + RscLongRange( Atom nId, sal_uInt32 nTypId ); + virtual RSCCLASS_TYPE GetClassType() const; + RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, BOOL ); + // Der zulaessige Bereich wird gesetzt + ERRTYPE SetRange( INT32 nMinimum, INT32 nMaximum ); + // Gibt die Groesse der Klasse in Bytes + sal_uInt32 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 &, INT32 ); + ERRTYPE GetNumber( const RSCINST &, INT32 * ); + void WriteSrc( const RSCINST &, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); + ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, 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( Atom nId, sal_uInt32 nTypId ); + + ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId, + INT32 nValue ); +}; + +/******************* R s c I d R a n g e ***********************************/ +class RscIdRange : public RscTop +{ + sal_uInt32 nSize; +protected: + INT32 nMin; // Minimum des Bereiches + INT32 nMax; // Maximum des Bereiches +public: + RscIdRange( Atom nId, sal_uInt32 nTypId ); + virtual RSCCLASS_TYPE GetClassType() const; + // Der zulaessige Bereich wird gesetzt + ERRTYPE SetRange( INT32 nMinimum, INT32 nMaximum ){ + nMin = nMinimum; + nMax = nMaximum; + return ERR_OK; + } + RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, BOOL ); + void Destroy( const RSCINST & rInst ); + sal_uInt32 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 &, INT32 ); + ERRTYPE GetNumber( const RSCINST &, INT32 * ); + ERRTYPE SetRef( const RSCINST &, const RscId & rRscId ); + ERRTYPE GetRef( const RSCINST & rInst, RscId * ); + void WriteSrc( const RSCINST &, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); + ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, 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( Atom nId, sal_uInt32 nTypId ); + virtual RSCCLASS_TYPE GetClassType() const; + // Der zulaessige Bereich wird gesetzt + ERRTYPE SetRange( INT32, INT32 ){ + return( ERR_UNKNOWN_METHOD ); + }; + ERRTYPE SetBool( const RSCINST & rInst, BOOL b ){ + return( SetNumber( rInst, (INT32)b ) ); + }; + ERRTYPE GetBool( const RSCINST & rInst, BOOL * pB){ + INT32 l; + GetNumber( rInst, &l ); + *pB = (0 != l); + return( ERR_OK ); + }; + void WriteSrc( const RSCINST &, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, const char * ); + void WriteRcAccess( FILE * fOutput, RscTypCont * pTC, + const char * ); + +}; + +class RscBreakRange : public RscRange { + INT32 nOutRange; +public: + RscBreakRange( Atom nId, sal_uInt32 nTypId ); + void SetOutRange( INT32 nNumber ){ + nOutRange = nNumber; + } + RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, BOOL ); + ERRTYPE SetNumber( const RSCINST &, INT32 ); +}; + +#endif // _RSCRANGE_HXX diff --git a/rsc/inc/rscrsc.hxx b/rsc/inc/rscrsc.hxx new file mode 100644 index 000000000000..128a956e51f5 --- /dev/null +++ b/rsc/inc/rscrsc.hxx @@ -0,0 +1,141 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscrsc.hxx,v $ + * $Revision: 1.13 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _RSCRSC_HXX +#define _RSCRSC_HXX + +#ifndef RSCALL_H +#include <rscall.h> +#endif +#ifndef RSCERROR_H +#include <rscerror.h> +#endif +#ifndef RSCTOOLS_HXX +#include <rsctools.hxx> +#endif + +#include <list> + +class RscTypCont; +class DirEntry; + +/****************** 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 + RSCBYTEORDER_TYPE nByteOrder; + unsigned short nCommands; // Steuerbits + ByteString aOutputLst; // Name der List-Ausgabedatei + ByteString aOutputSrs; // Name der Srs-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 + ByteString aTouchFile; // create this file when done in rsc2 + ByteString aILDir; + + struct OutputFile + { + ByteString aLangName; // language name + ByteString aOutputRc; // target file + ByteString aLangSearchPath; // language specific search path + ::std::list< ByteString > aSysSearchDirs; // pathes to search for images + + OutputFile() {} + }; + + std::list<OutputFile> m_aOutputFiles; + std::list< std::pair< rtl::OString, rtl::OString > > m_aReplacements; + + RscCmdLine( int argc, char ** argv, RscError * pEH ); + RscCmdLine(); + + ~RscCmdLine(); + + ::rtl::OString substitutePaths( const ::rtl::OString& rIn ); +}; +/****************** R s c ************************************************/ + +struct WriteRcContext; + +class RscCompiler +{ +private: + RscStrList aTmpFileList; // Liste der Tmp-Dateien + 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 ); + + bool GetImageFilePath( const RscCmdLine::OutputFile& rOutputFile, + const WriteRcContext& rContext, + const ByteString& rBaseFileName, + ByteString& rImagePath, + FILE* pSysListFile ); + void PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile, + const WriteRcContext& rContext, + const DirEntry& rSrsInPath, + const DirEntry& rSrsOutPath ); + +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, const RscCmdLine::OutputFile* pOutputFile, const WriteRcContext* pContext ); + 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..e46a0225e394 --- /dev/null +++ b/rsc/inc/rscsfx.hxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscsfx.hxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _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..0a6efbac4979 --- /dev/null +++ b/rsc/inc/rscstr.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscstr.hxx,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _RSCSTR_HXX +#define _RSCSTR_HXX + +#include <rscall.h> +#include <rscerror.h> +#include <rschash.hxx> +#include <rsctop.hxx> + +/******************* 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 + }; + sal_uInt32 nSize; +public: + RscString( Atom nId, sal_uInt32 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 ); + sal_uInt32 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 &, const 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, sal_uInt32 nTab, const char * ); + ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32, 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..fd8e49135eb0 --- /dev/null +++ b/rsc/inc/rsctools.hxx @@ -0,0 +1,224 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rsctools.hxx,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +struct RSHEADER_TYPE; +class RscPtrPtr; + +#ifndef _RSCTOOLS_HXX +#define _RSCTOOLS_HXX + +#ifdef UNX +#include <stdlib.h> +#endif +#include <stdio.h> +#include <tools/string.hxx> +#include <tools/list.hxx> + +/******************* T y p e s *******************************************/ +// 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 ( const char * pInput, const char * pExt ); +ByteString OutputFile( ByteString aInput, const char * ext ); +char * ResponseFile( RscPtrPtr * ppCmd, char ** ppArgv, + sal_uInt32 nArgc ); +void RscExit( sal_uInt32 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 ); +char* rsc_strdup( const char* ); + +/****************** 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 P t r P t r ************************************/ +class RscPtrPtr +{ + sal_uInt32 nCount; + void ** pMem; +public: + RscPtrPtr(); + ~RscPtrPtr(); + void Reset(); + sal_uInt32 Append( void * ); + sal_uInt32 Append( char * pStr ){ + return( Append( (void *)pStr ) ); + }; + sal_uInt32 GetCount(){ return( nCount ); }; + void * GetEntry( sal_uInt32 nEle ); + void ** GetBlock(){ return( pMem ); }; +}; + +/****************** R s c W r i t e R c **********************************/ +class RscWriteRc +{ + sal_uInt32 nLen; + BOOL bSwap; + RSCBYTEORDER_TYPE nByteOrder; + char * pMem; + char * GetPointer( sal_uInt32 nSize ); +public: + RscWriteRc( RSCBYTEORDER_TYPE nOrder = RSC_SYSTEMENDIAN ); + ~RscWriteRc(); + sal_uInt32 IncSize( sal_uInt32 nSize );// gibt die vorherige Groesse + void * GetBuffer() + { + return GetPointer( 0 ); + } + sal_uInt16 GetShort( sal_uInt32 nPos ) + { + sal_uInt16 nVal = 0; + char* pFrom = GetPointer(nPos); + char* pTo = (char*)&nVal; + *pTo++ = *pFrom++; + *pTo++ = *pFrom++; + return bSwap ? SWAPSHORT( nVal ) : nVal; + } + sal_uInt32 GetLong( sal_uInt32 nPos ) + { + sal_uInt32 nVal = 0; + char* pFrom = GetPointer(nPos); + char* pTo = (char*)&nVal; + *pTo++ = *pFrom++; + *pTo++ = *pFrom++; + *pTo++ = *pFrom++; + *pTo++ = *pFrom++; + return bSwap ? SWAPLONG( nVal ) : nVal; + } + char * GetUTF8( sal_uInt32 nPos ) + { + return GetPointer( nPos ); + } + + + RSCBYTEORDER_TYPE GetByteOrder() const { return nByteOrder; } + sal_uInt32 Size(){ return( nLen ); }; + void Put( sal_uInt64 lVal ) + { + union + { + sal_uInt64 lVal64; + sal_uInt32 aVal32[2]; + }; + lVal64 = lVal; + if( bSwap ) + { + Put( aVal32[1] ); + Put( aVal32[0] ); + } + else + { + Put( aVal32[0] ); + Put( aVal32[1] ); + } + } + void Put( sal_Int32 lVal ) + { + union + { + sal_uInt32 lVal32; + sal_uInt16 aVal16[2]; + }; + lVal32 = lVal; + + if( bSwap ) + { + Put( aVal16[1] ); + Put( aVal16[0] ); + } + else + { + Put( aVal16[0] ); + Put( aVal16[1] ); + } + } + void Put( sal_uInt32 nValue ) + { Put( (sal_Int32)nValue ); } + void Put( sal_uInt16 nValue ); + void Put( sal_Int16 nValue ) + { Put( (sal_uInt16)nValue ); } + void PutUTF8( char * pData ); + + void PutAt( sal_uInt32 nPos, INT32 lVal ) + { + union + { + sal_uInt32 lVal32; + sal_uInt16 aVal16[2]; + }; + lVal32 = lVal; + + if( bSwap ) + { + PutAt( nPos, aVal16[1] ); + PutAt( nPos + 2, aVal16[0] ); + } + else + { + PutAt( nPos, aVal16[0] ); + PutAt( nPos + 2, aVal16[1] ); + } + } + void PutAt( sal_uInt32 nPos, sal_uInt32 lVal ) + { + PutAt( nPos, (INT32)lVal); + } + void PutAt( sal_uInt32 nPos, short nVal ) + { + PutAt( nPos, (sal_uInt16)nVal ); + } + void PutAt( sal_uInt32 nPos, sal_uInt16 nVal ) + { + if( bSwap ) + nVal = SWAPSHORT( nVal ); + char* pTo = GetPointer( nPos ); + char* pFrom = (char*)&nVal; + *pTo++ = *pFrom++; + *pTo++ = *pFrom++; + } +}; + +#endif // _RSCTOOLS_HXX diff --git a/rsc/inc/rsctop.hxx b/rsc/inc/rsctop.hxx new file mode 100644 index 000000000000..c651ae9d8a78 --- /dev/null +++ b/rsc/inc/rsctop.hxx @@ -0,0 +1,250 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rsctop.hxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _RSCTOP_HXX +#define _RSCTOP_HXX + +#include <rscerror.h> +#include <rsctools.hxx> +#include <rschash.hxx> +#include <rscclobj.hxx> + +/****************** T Y P E S ********************************************/ +typedef sal_uInt32 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; + sal_uInt32 nTypId; + RscTop * pRefClass; + +protected: + RscTop( Atom nId, sal_uInt32 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 + sal_uInt32 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 Atom GetConstant( sal_uInt32 ); + + virtual RscTop * GetTypeClass() const; + + // Gibt die Groesse der Klasse in Bytes + virtual sal_uInt32 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( Atom nVarName, RscTop * pClass, + RSCINST * pDflt = NULL, + RSCVAR nVarType = 0, sal_uInt32 nMask = 0, + Atom nDataBaseName = InvalidAtom ); + + // 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, Atom nVarName, + const RSCINST & rInitInst, + BOOL nInitDflt = FALSE, + RscTop * pCreateClass = NULL ); + virtual RSCINST GetCopyVar( const RSCINST & rInst, Atom nVarName ); + + virtual RSCINST GetTupelVar( const RSCINST & rInst, sal_uInt32 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, INT32 lValue, + RscTop * pCreateClass, + RSCINST * pGetInst ); + + // Liefert Instanz aus einem Feld zurueck + // pGetInst im return kann NULL sein + virtual ERRTYPE GetArrayEle( const RSCINST & rInst, Atom 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, sal_uInt32 nPos ); + + // verschiebt eine Instanz + virtual ERRTYPE MovePosEle( const RSCINST & rInst, sal_uInt32 nDestPos, + sal_uInt32 nSourcePos ); + + // aendert RscId an Position + virtual ERRTYPE SetPosRscId( const RSCINST & rInst, sal_uInt32 nPos, + const RscId & rRscId); + + // Liefert Information ueber Instanz + // an der Position zurueck + virtual SUBINFO_STRUCT GetInfoEle( const RSCINST & rInst, sal_uInt32 nPos ); + + // Anzahl der Eintraege + virtual sal_uInt32 GetCount( const RSCINST & rInst ); + + // Eine Zuweisung an eine Variable + virtual ERRTYPE SetNumber( const RSCINST & rInst, INT32 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, Atom nValueId, + INT32 nValue ); + + // Eine Zuweisung an eine Variable + virtual ERRTYPE SetNotConst( const RSCINST & rInst, Atom nId ); + + virtual ERRTYPE SetString( const RSCINST & rInst, const char * pStr ); + + virtual ERRTYPE GetNumber( const RSCINST & rInst, INT32 * pN ); + + virtual ERRTYPE GetBool( const RSCINST & rInst, BOOL * pB ); + + virtual ERRTYPE GetConst( const RSCINST & rInst, Atom * 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, Atom nVarId ); + + // Default zu einer Variablen holen + virtual RSCINST GetDefault( Atom nVarId ); + + virtual void Delete( const RSCINST & rInst, RscTop * pClass, + const RscId & rId ); + + virtual void DeletePos( const RSCINST & rInst, sal_uInt32 nPos ); + + // Schreibt den Kopf und das Ende einer Resource + // Script Datei + virtual void WriteSrcHeader( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab, + const RscId & aId, const char * ); + virtual void WriteSrc( const RSCINST & rInst, FILE * fOutput, + RscTypCont * pTC, sal_uInt32 nTab,const char * ); + virtual ERRTYPE WriteRcHeader( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, const RscId & aId, + sal_uInt32 nDeep, BOOL bExtra ); + virtual ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont * pTC, sal_uInt32 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..4893ad3fd292 --- /dev/null +++ b/rsc/inc/rsctree.hxx @@ -0,0 +1,121 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rsctree.hxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _RSCTREE_HXX +#define _RSCTREE_HXX + +#include <tools/link.hxx> +#include <rsctools.hxx> + +/****************** 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, sal_uInt32 * 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; +protected: + using NameNode::Search; + +public: + + IdNode* Search( sal_uInt32 nTypName ) const; + virtual sal_uInt32 GetId() const; +}; + +/*************************************************************************/ +class StringNode : public NameNode +{ + virtual COMPARE Compare( const NameNode * ) const; + virtual COMPARE Compare( const void * ) const; + +protected: + using NameNode::Search; + + 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/inc/vclrsc.hxx b/rsc/inc/vclrsc.hxx new file mode 100644 index 000000000000..2704fced5c01 --- /dev/null +++ b/rsc/inc/vclrsc.hxx @@ -0,0 +1,348 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vclrsc.hxx,v $ + * $Revision: 1.12 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _TOOLS_VCLRSC_HXX +#define _TOOLS_VCLRSC_HXX + +#include <sal/types.h> +#include <tools/solar.h> + +// --------------- +// - Window-Bits - +// --------------- + +// from vcl/inc/wintypes.hxx +typedef sal_Int64 WinBits; + +// Window-Bits fuer Window +#define WB_CLIPCHILDREN ((WinBits)0x00000001) +#define WB_DIALOGCONTROL ((WinBits)0x00000002) +#define WB_NODIALOGCONTROL ((WinBits)0x00000004) +#define WB_BORDER ((WinBits)0x00000008) +#define WB_NOBORDER ((WinBits)0x00000010) +#define WB_SIZEABLE ((WinBits)0x00000020) +#define WB_3DLOOK ((WinBits)0x00000040) +#define WB_AUTOSIZE ((WinBits)0x00000080) + +// Window-Bits fuer SystemWindows +#define WB_MOVEABLE ((WinBits)0x00000100) +#define WB_ROLLABLE ((WinBits)0x00000200) +#define WB_CLOSEABLE ((WinBits)0x00000400) +#define WB_STANDALONE ((WinBits)0x00000800) +#define WB_APP ((WinBits)0x00001000) +#define WB_PINABLE ((WinBits)0x00002000) +#define WB_SYSTEMWINDOW ((WinBits)0x40000000) +#define WB_SIZEMOVE (WB_SIZEABLE | WB_MOVEABLE) + +// Standard-Window-Bits fuer ChildWindows +#define WB_TABSTOP ((WinBits)0x00000100) +#define WB_NOTABSTOP ((WinBits)0x00000200) +#define WB_GROUP ((WinBits)0x00000400) +#define WB_NOGROUP ((WinBits)0x00000800) +#define WB_HORZ ((WinBits)0x00001000) +#define WB_VERT ((WinBits)0x00002000) +#define WB_LEFT ((WinBits)0x00004000) +#define WB_CENTER ((WinBits)0x00008000) +#define WB_RIGHT ((WinBits)0x00010000) +#define WB_TOP ((WinBits)0x00020000) +#define WB_VCENTER ((WinBits)0x00040000) +#define WB_BOTTOM ((WinBits)0x00080000) +#define WB_DRAG ((WinBits)0x00100000) +#define WB_SPIN ((WinBits)0x00200000) +#define WB_REPEAT ((WinBits)0x00400000) +#define WB_NOPOINTERFOCUS ((WinBits)0x00800000) +#define WB_WORDBREAK ((WinBits)0x01000000) +#define WB_NOLABEL ((WinBits)0x02000000) +#define WB_SORT ((WinBits)0x04000000) +#define WB_DROPDOWN ((WinBits)0x08000000) +#define WB_AUTOHSCROLL ((WinBits)0x10000000) +#define WB_DOCKABLE ((WinBits)0x20000000) +#define WB_AUTOVSCROLL ((WinBits)0x40000000) + +#define WB_HIDE ((WinBits)0x80000000) +#define WB_HSCROLL WB_HORZ +#define WB_VSCROLL WB_VERT +#define WB_TOPIMAGE WB_TOP + +// Window-Bits for PushButtons +#define WB_DEFBUTTON ((WinBits)0x10000000) +#define WB_NOLIGHTBORDER ((WinBits)0x20000000) +#define WB_RECTSTYLE ((WinBits)0x08000000) +#define WB_SMALLSTYLE ((WinBits)0x04000000) + +// Window-Bits for FixedText +#define WB_INFO ((WinBits)0x20000000) +#define WB_PATHELLIPSIS ((WinBits)0x00100000) + +// Window-Bits for Edit +#define WB_PASSWORD ((WinBits)0x01000000) +#define WB_READONLY ((WinBits)0x02000000) +#define WB_NOHIDESELECTION ((WinBits)SAL_CONST_INT64(0x1000000000)) + +// Window-Bits for MultiLineEdit +#define WB_IGNORETAB ((WinBits)0x20000000) + +// Window-Bits for ListBox and MultiListBox +#define WB_SIMPLEMODE ((WinBits)0x20000000) + +// Window-Bits for FixedBitmap +#define WB_FAST ((WinBits)0x04000000) +#define WB_SCALE ((WinBits)0x08000000) +#define WB_TOPLEFTVISIBLE ((WinBits)0x10000000) + +// Window-Bits for ToolBox +#define WB_LINESPACING ((WinBits)0x01000000) +#define WB_SCROLL ((WinBits)0x02000000) + +// Window-Bits for TabControl +#define WB_SINGLELINE ((WinBits)0x02000000) + +// Window-Bits for DockingWindows +#define WB_DOCKBORDER ((WinBits)0x00001000) + +// Window-Bits for SplitWindow +#define WB_NOSPLITDRAW ((WinBits)0x01000000) +#define WB_FLATSPLITDRAW ((WinBits)0x02000000) + +// Window-Bits for MessageBoxen +#define WB_OK ((WinBits)0x00100000) +#define WB_OK_CANCEL ((WinBits)0x00200000) +#define WB_YES_NO ((WinBits)0x00400000) +#define WB_YES_NO_CANCEL ((WinBits)0x00800000) +#define WB_RETRY_CANCEL ((WinBits)0x01000000) +#define WB_DEF_OK ((WinBits)0x02000000) +#define WB_DEF_CANCEL ((WinBits)0x04000000) +#define WB_DEF_RETRY ((WinBits)0x08000000) +#define WB_DEF_YES ((WinBits)0x10000000) +#define WB_DEF_NO ((WinBits)0x20000000) +#define WB_ABORT_RETRY_IGNORE ((WinBits)SAL_CONST_INT64(0x1000000000)) +#define WB_DEF_IGNORE ((WinBits)SAL_CONST_INT64(0x2000000000)) + +// Standard-WinBits +#define WB_STDWORK (WB_SIZEMOVE | WB_CLOSEABLE) +#define WB_STDMDI (WB_CLOSEABLE) +#define WB_STDDOCKWIN (WB_DOCKABLE | WB_MOVEABLE | WB_CLOSEABLE) +#define WB_STDFLOATWIN (WB_SIZEMOVE | WB_CLOSEABLE | WB_ROLLABLE) +#define WB_STDDIALOG (WB_MOVEABLE | WB_CLOSEABLE) +#define WB_STDMODELESS (WB_STDDIALOG) +#define WB_STDMODAL (WB_STDDIALOG) +#define WB_STDTABDIALOG (WB_STDDIALOG) +#define WB_STDTABCONTROL 0 + +// For TreeListBox +#define WB_HASBUTTONS ((WinBits)0x00800000) +#define WB_HASLINES ((WinBits)0x01000000) +#define WB_HASLINESATROOT ((WinBits)0x02000000) + +// -------------- +// - Help-Types - +// -------------- + +// from vcl/inc/help.hxx +#define OOO_HELP_INDEX ((ULONG)0xFFFFFFFF) +#define OOO_HELP_HELPONHELP ((ULONG)0xFFFFFFFE) + +// -------------- +// - FieldTypes - +// -------------- + +// from vcl/inc/fldunit.hxx +enum FieldUnit { FUNIT_NONE, FUNIT_MM, FUNIT_CM, FUNIT_M, FUNIT_KM, + FUNIT_TWIP, FUNIT_POINT, FUNIT_PICA, + FUNIT_INCH, FUNIT_FOOT, FUNIT_MILE, FUNIT_CUSTOM, + FUNIT_PERCENT, FUNIT_100TH_MM }; + + +// from vcl/inc/vclenum.hxx +#ifndef ENUM_TIMEFIELDFORMAT_DECLARED +#define ENUM_TIMEFIELDFORMAT_DECLARED + +enum TimeFieldFormat {TIMEF_NONE, TIMEF_SEC, TIMEF_100TH_SEC, TIMEF_SEC_CS, TimeFieldFormat_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; + +#endif + +// ----------------- +// - KeyCode-Types - +// ----------------- +#include <com/sun/star/awt/Key.hpp> +#include <com/sun/star/awt/KeyGroup.hpp> + +#define KEY_CODE ((sal_uInt16)0x0FFF) + +// Modifier-Tasten +#define KEY_SHIFT ((sal_uInt16)0x1000) +#define KEY_MOD1 ((sal_uInt16)0x2000) +#define KEY_MOD2 ((sal_uInt16)0x4000) +#define KEY_MOD3 ((sal_uInt16)0x8000) +#define KEY_MODTYPE ((sal_uInt16)0xF000) +#define KEY_ALLMODTYPE ((sal_uInt16)0xF000) + + +// from vcl/inc/vclenum.hxx +#ifndef ENUM_KEYFUNCTYPE_DECLARED +#define ENUM_KEYFUNCTYPE_DECLARED + +enum KeyFuncType { KEYFUNC_DONTKNOW, KEYFUNC_NEW, KEYFUNC_OPEN, KEYFUNC_SAVE, + KEYFUNC_SAVEAS, KEYFUNC_PRINT, KEYFUNC_CLOSE, KEYFUNC_QUIT, + KEYFUNC_CUT, KEYFUNC_COPY, KEYFUNC_PASTE, KEYFUNC_UNDO, + KEYFUNC_REDO, KEYFUNC_DELETE, KEYFUNC_REPEAT, KEYFUNC_FIND, + KEYFUNC_FINDBACKWARD, KEYFUNC_PROPERTIES, KEYFUNC_FRONT, + KeyFuncType_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; + +#endif + +// ------------ +// - TriState - +// ------------ + +// from vcl/inc/wintypes.hxx +enum TriState { STATE_NOCHECK, STATE_CHECK, STATE_DONTKNOW }; + +// ----------------- +// - MapMode-Types - +// ----------------- + +// from vcl/inc/mapmod.hxx +enum MapUnit { MAP_100TH_MM, MAP_10TH_MM, MAP_MM, MAP_CM, + MAP_1000TH_INCH, MAP_100TH_INCH, MAP_10TH_INCH, MAP_INCH, + MAP_POINT, MAP_TWIP, MAP_PIXEL, MAP_SYSFONT, MAP_APPFONT, + MAP_RELATIVE, MAP_REALAPPFONT }; + +// Das Resourcesystem benutzt den Wert 0xFFFF (freihalten) + + +// -------------------------- +// - Bits fuer ToolBoxItems - +// -------------------------- + +// from vcl/inc/toolbox.hxx +typedef sal_uInt16 ToolBoxItemBits; + +#define TIB_CHECKABLE ((ToolBoxItemBits)0x0001) +#define TIB_RADIOCHECK ((ToolBoxItemBits)0x0002) +#define TIB_AUTOCHECK ((ToolBoxItemBits)0x0004) +#define TIB_LEFT ((ToolBoxItemBits)0x0008) +#define TIB_AUTOSIZE ((ToolBoxItemBits)0x0010) +#define TIB_DROPDOWN ((ToolBoxItemBits)0x0020) +#define TIB_REPEAT ((ToolBoxItemBits)0x0040) + +enum ButtonType { BUTTON_SYMBOL, BUTTON_TEXT, BUTTON_SYMBOLTEXT }; + +enum ToolBoxItemType { TOOLBOXITEM_DONTKNOW, TOOLBOXITEM_BUTTON, + TOOLBOXITEM_SPACE, TOOLBOXITEM_SEPARATOR, + TOOLBOXITEM_BREAK }; + + +// --------------- +// - BorderStyle - +// --------------- + +typedef sal_uInt16 WindowBorderStyle; + +#define WINDOW_BORDER_NORMAL ((WindowBorderStyle)0x0001) +#define WINDOW_BORDER_MONO ((WindowBorderStyle)0x0002) +#define WINDOW_BORDER_ACTIVE ((WindowBorderStyle)0x0004) +#define WINDOW_BORDER_DOUBLEOUT ((WindowBorderStyle)0x0008) +#define WINDOW_BORDER_MENU ((WindowBorderStyle)0x0010) +#define WINDOW_BORDER_NOBORDER ((WindowBorderStyle)0x1000) + +// --------------- +// - WindowAlign - +// --------------- + +// from vcl/inc/wintypes.hxx +enum WindowAlign { WINDOWALIGN_LEFT, WINDOWALIGN_TOP, WINDOWALIGN_RIGHT, WINDOWALIGN_BOTTOM }; +enum ImageAlign { IMAGEALIGN_LEFT, IMAGEALIGN_TOP, IMAGEALIGN_RIGHT, IMAGEALIGN_BOTTOM }; + +// -------------- +// - Menu-Types - +// -------------- + +// from vcl/inc/menu.hxx +enum MenuItemType { MENUITEM_DONTKNOW, MENUITEM_STRING, MENUITEM_IMAGE, + MENUITEM_STRINGIMAGE, MENUITEM_SEPARATOR }; + +typedef sal_uInt16 MenuItemBits; + +#define MIB_CHECKABLE ((MenuItemBits)0x0001) +#define MIB_RADIOCHECK ((MenuItemBits)0x0002) +#define MIB_AUTOCHECK ((MenuItemBits)0x0004) +#define MIB_ABOUT ((MenuItemBits)0x0008) +#define MIB_HELP ((MenuItemBits)0x0010) +#define MIB_POPUPSELECT ((MenuItemBits)0x0020) + +// ---------------- +// - Symbol-Types - +// ---------------- + +// from vcl/inc/symbol.hxx +typedef sal_uInt16 SymbolType; +#define SYMBOL_DONTKNOW ((SymbolType)0) +#define SYMBOL_IMAGE ((SymbolType)1) +#define SYMBOL_ARROW_UP ((SymbolType)2) +#define SYMBOL_ARROW_DOWN ((SymbolType)3) +#define SYMBOL_ARROW_LEFT ((SymbolType)4) +#define SYMBOL_ARROW_RIGHT ((SymbolType)5) +#define SYMBOL_SPIN_UP ((SymbolType)6) +#define SYMBOL_SPIN_DOWN ((SymbolType)7) +#define SYMBOL_SPIN_LEFT ((SymbolType)8) +#define SYMBOL_SPIN_RIGHT ((SymbolType)9) +#define SYMBOL_FIRST ((SymbolType)10) +#define SYMBOL_LAST ((SymbolType)11) +#define SYMBOL_PREV ((SymbolType)12) +#define SYMBOL_NEXT ((SymbolType)13) +#define SYMBOL_PAGEUP ((SymbolType)14) +#define SYMBOL_PAGEDOWN ((SymbolType)15) +#define SYMBOL_PLAY ((SymbolType)16) +#define SYMBOL_REVERSEPLAY ((SymbolType)17) +#define SYMBOL_RECORD ((SymbolType)18) +#define SYMBOL_STOP ((SymbolType)19) +#define SYMBOL_PAUSE ((SymbolType)20) +#define SYMBOL_WINDSTART ((SymbolType)21) +#define SYMBOL_WINDEND ((SymbolType)22) +#define SYMBOL_WINDBACKWARD ((SymbolType)23) +#define SYMBOL_WINDFORWARD ((SymbolType)24) +#define SYMBOL_CLOSE ((SymbolType)25) +#define SYMBOL_ROLLUP ((SymbolType)26) +#define SYMBOL_ROLLDOWN ((SymbolType)27) +#define SYMBOL_CHECKMARK ((SymbolType)28) +#define SYMBOL_RADIOCHECKMARK ((SymbolType)29) +#define SYMBOL_SPIN_UPDOWN ((SymbolType)30) +#define SYMBOL_FLOAT ((SymbolType)31) +#define SYMBOL_DOCK ((SymbolType)32) +#define SYMBOL_HIDE ((SymbolType)33) +#define SYMBOL_HELP ((SymbolType)34) +#define SYMBOL_OS2CLOSE ((SymbolType)35) +#define SYMBOL_OS2FLOAT ((SymbolType)36) +#define SYMBOL_OS2HIDE ((SymbolType)37) + +#define SYMBOL_NOSYMBOL (SYMBOL_DONTKNOW) + +#endif diff --git a/rsc/prj/build.lst b/rsc/prj/build.lst new file mode 100644 index 000000000000..a26b9a055b60 --- /dev/null +++ b/rsc/prj/build.lst @@ -0,0 +1,9 @@ +r rsc : tools NULL +r rsc usr1 - all rsc_mkout NULL +r rsc\source\misc nmake - all rsc_misc NULL +r rsc\source\tools nmake - all rsc_tool NULL +r rsc\source\res nmake - all rsc_res NULL +r rsc\source\parser nmake - all rsc_pars NULL +r rsc\source\rsc nmake - all rsc_rsc NULL +r rsc\source\rscpp nmake - all rsc_cpp NULL +r rsc\source\prj nmake - all rsc_sprj rsc_misc rsc_pars rsc_res rsc_rsc rsc_tool NULL diff --git a/rsc/prj/d.lst b/rsc/prj/d.lst new file mode 100644 index 000000000000..e59c9b2e9f3a --- /dev/null +++ b/rsc/prj/d.lst @@ -0,0 +1,9 @@ +..\%__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 +..\%__SRC%\bin\rscpp.exe %_DEST%\bin%_EXT%\rscpp.exe +..\%__SRC%\bin\rscpp %_DEST%\bin%_EXT%\rscpp + +mkdir: %_DEST%\inc%_EXT%\rsc +..\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..b639e70317a9 --- /dev/null +++ b/rsc/source/misc/makefile.mk @@ -0,0 +1,49 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.4 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=rsc +TARGET=rscmis + +# --- Settings ------------------------------------------------------ + +.INCLUDE : settings.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..7fdadc7419ef --- /dev/null +++ b/rsc/source/misc/rscdbl.cxx @@ -0,0 +1,122 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscdbl.cxx,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" + +#include <stdio.h> +#include <rscdb.hxx> +#include <rscall.h> +#include <rschash.hxx> +#include <rsctree.hxx> +#include <rsctop.hxx> +#include "rsclst.hxx" + +/************************************************************************* +|* +|* RscTypCont::FillNameIdList() +|* +|* Beschreibung +|* Ersterstellung MM 07.05.91 +|* Letzte Aenderung MM 30.05.91 +|* +*************************************************************************/ +REResourceList * InsertList( Atom nClassName, const RscId& rId, + REResourceList * pList ){ + REResourceList * pSubList; + const char * pStrClass; + ByteString aStrClass; + + pStrClass = pHS->getString( nClassName ).getStr(); + if( pStrClass ) + aStrClass = pStrClass; + else + aStrClass = ByteString::CreateFromInt32( (long)nClassName ); + + pSubList = new REResourceList( pList, aStrClass, rId ); + + pList->Insert( pSubList, 0xFFFFFFFF ); + return( pSubList ); +} + +void FillSubList( RSCINST & rInst, REResourceList * pList ) +{ + sal_uInt32 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..f2b549e84049 --- /dev/null +++ b/rsc/source/misc/rsclst.cxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rsclst.cxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" + +#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..818e2066c221 --- /dev/null +++ b/rsc/source/parser/erscerr.cxx @@ -0,0 +1,519 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: erscerr.cxx,v $ + * $Revision: 1.15 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +#include <stdlib.h> +#include <stdio.h> + +#include <tools/rcid.h> +#include <rschash.hxx> +#include <rscerror.h> +#include <rscall.h> +#include <rscdb.hxx> +#include <rscpar.hxx> + +#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, const RscVerbosity _verbosityLevel ) +{ + if ( m_verbosity >= _verbosityLevel ) + { + if( pStr ){ + printf( "%s", pStr ); + fflush( stdout ); + } + } +} + +/************************************************************************* +|* +|* RscError::StdErr(); +|* +|* Beschreibung +|* Ersterstellung PL 11/07/2001 +|* Letzte Aenderung PL 11/07/2001 +|* +*************************************************************************/ +void RscError::StdErr( const char * pStr ) +{ +#ifndef WIN + if( pStr ) + fprintf( stderr, "%s", pStr ); +#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::StdLstErr(); +|* +|* Beschreibung +|* Ersterstellung PL 11/07/2001 +|* Letzte Aenderung PL 11/07/2001 +|* +*************************************************************************/ +void RscError::StdLstErr( const char * pStr ){ + StdErr( 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: { + StdLstErr( "!! " ); + if( 1 == nErrors ) + StdLstErr( ByteString::CreateFromInt32( nErrors ).GetBuffer() ); + else + StdLstErr( ByteString::CreateFromInt32( (nErrors -1) ).GetBuffer() ); + StdLstErr( " Error" ); + StdLstErr( " found!!" ); + } + break; + + case ERR_UNKNOWN_METHOD: + StdLstErr( "The used type is not allowed." ); + break; + + case ERR_OPENFILE: + StdLstErr( "This file <" ); + StdLstErr( pMessage ); + StdLstErr( "> cannot be opened." ); + break; + + case ERR_RENAMEFILE: + StdLstErr( "rename <" ); + StdLstErr( pMessage ); + StdLstErr( "> s not possible." ); + break; + + case ERR_FILESIZE: + StdLstErr( "Wrong file <" ); + StdLstErr( pMessage ); + StdLstErr( "> length." ); + break; + + case ERR_FILEFORMAT: + StdLstErr( "Wrong file type <" ); + StdLstErr( pMessage ); + StdLstErr( ">." ); + break; + + case ERR_NOCHAR: + StdLstErr( "Character: '\\xxx'; The value xxx is greater than 255."); + break; + + case ERR_NORSCINST: + StdLstErr( "Internal error, instance invalid."); + break; + + + case ERR_NOINPUT: + StdLstErr( "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( "-rsc2=<filename> Specify the location for rsc2.\n" ); + StdLstOut( "No longer existent: -rc<filename> Use a different system resource compiler.\n" ); + StdLstOut( "-fs=<filename> Name of the .res file.\n" ); + StdLstOut( "-lip=<path> additional search path for system dependant files\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( "-ft=<filename> Touch a file when done in rsc2 (for dependencies)\n" ); + StdLstOut( "-fr=<filename> Ressource constructor .cxx-file.\n" ); + StdLstOut( "-fx=<filename> Name of .src-file.\n" ); + StdLstOut( "-oil=<dir> Output directory for image list files\n" ); + StdLstOut( "-r<ENV>=<path> replace <path> by <ENV> in image list files\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" ); + StdLstOut( "\nwhen creating multiple .res files in one pass, please give these\n" ); + StdLstOut( "options in consecutive blocks:\n" ); + StdLstOut( "-lg<language> -fs<filename> [-lip<path> [-lip<path>] ]\n" ); + StdLstOut( "a new block begins when either -lg or -fs is used again.\n" ); + break; + + case ERR_UNKNOWNSW: + StdLstErr( "Unknown switch <" ); + StdLstErr( pMessage ); + StdLstErr( ">." ); + break; + + case ERR_REFTODEEP: + StdLstErr( "Too many reference levels have been used (see Switch -RefDeep)." ); + break; + + case ERR_CONT_INVALIDPOS: + StdLstErr( "Internal error, Container class: invalid position." ); + break; + + case ERR_CONT_INVALIDTYPE: + StdLstErr( "Invalid type <" ); + StdLstErr( pMessage ); + StdLstErr( ">." ); + break; + + case ERR_ARRAY_INVALIDINDEX: + StdLstErr( "Internal error, Array class: invalid index." ); + break; + + case ERR_RSCINST_NOVARNAME: + StdLstErr( "Internal error, invalid name of variable." ); + break; + + case ERR_YACC: + StdLstErr( pMessage ); + break; + + case ERR_DOUBLEID: + StdLstErr( "Two global resources have the same identifier." ); + break; + + case ERR_FALSETYPE: + StdLstErr( "Wrong type <" ); + StdLstErr( pMessage ); + StdLstErr( ">." ); + break; + + case ERR_NOVARIABLENAME: + StdLstErr( "The variable <" ); + StdLstErr( pMessage ); + StdLstErr( "> must not be used here." ); + break; + + case ERR_RSCRANGE_OUTDEFSET: + StdLstErr( "The used value is not in the expected domain." ); + break; + + case ERR_USHORTRANGE: + StdLstErr( "Value is <" ); + StdLstErr( pMessage ); + StdLstErr( "> the allowed domain is from 0 up to 65535." ); + break; + + case ERR_IDRANGE: + StdLstErr( "Value is <" ); + StdLstErr( pMessage ); + StdLstErr( "> the allowed domain is from 1 up to 32767." ); + break; + + case ERR_NOCOPYOBJ: + StdLstErr( "Default resource <" ); + StdLstErr( pMessage ); + StdLstErr( "> not found." ); + break; + + case ERR_REFNOTALLOWED: + StdLstErr( "The use of a reference is not allowed." ); + break; + + case ERR_COPYNOTALLOWED: + StdLstErr( "The use of a default resource is not allowed." ); + break; + + case ERR_IDEXPECTED: + StdLstErr( "An identifier needs to be specified." ); + break; + + case ERR_DOUBLEDEFINE: + StdLstErr( "The symbol <" ); + StdLstErr( pMessage ); + StdLstErr( "> is defined twice." ); + break; + + case ERR_RSCINST_RESERVEDNAME: + StdLstErr( "The symbol <" ); + StdLstErr( pMessage ); + StdLstErr( "> is a reserved name." ); + break; + + case ERR_ZERODIVISION: + StdLstErr( "Attempt to divide by zero." ); + break; + + case ERR_PRAGMA: + StdLstErr( "Error in a #pragma statement." ); + break; + + case ERR_DECLAREDEFINE: + StdLstErr( "Error in the declaration part of the macro." ); + break; + + case ERR_NOTYPE: + StdLstErr( "type expected." ); + break; + + case ERR_NOIMAGE: + StdLstErr( "The image(s) <" ); + StdLstErr( pMessage ); + StdLstErr( "> could not be found." ); + break; + +/****************** W A R N I N G S **************************************/ + case WRN_LOCALID: + StdLstErr( "Sub resources should have an identifier < 256." ); + break; + + case WRN_GLOBALID: + StdLstErr( "Global resources should have an identifier >= 256." ); + break; + + case WRN_SUBINMEMBER: + StdLstErr( "Sub resources are ignored." ); + break; + + case WRN_CONT_NOID: + StdLstErr( "Resources without name are ignored." ); + break; + + case WRN_CONT_DOUBLEID: + StdLstErr( "Two local resources have the same identifier." ); + break; + + case WRN_STR_REFNOTFOUND: + StdLstErr( "String reference <" ); + StdLstErr( pMessage ); + StdLstErr( " > could not be resolved." ); + break; + + case WRN_MGR_REFNOTFOUND: + StdLstErr( "Reference <" ); + StdLstErr( pMessage ); + StdLstErr( " > could not be resolved." ); + break; + + default: + if( pMessage ){ + StdLstErr( "\nMessage: " ); + StdLstErr( 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 ]; + sal_uInt32 i; + + if( pFI ) + { + pFI->SetError( rError ); + StdErr( "\n" ); + StdErr( pFI->GetLine() ); + StdErr( "\n" ); + // Fehlerposition anzeigen + for( i = 0; (i +1) < pFI->GetScanPos(); i++ ) + StdLstErr( " " ); + LstOut( " ^" ); //Zeilennummern beachten + StdErr( "^" ); + StdLstErr( "\n" ); + } + StdLstErr( "f" ); + sprintf( buf, "%u", (unsigned int)rError ); + StdLstErr( buf ); + + if( pFI && pTC ){ + StdLstErr( ": \"" ); + StdLstErr( pTC->aFileTab.Get( pFI->GetFileIndex() )->aFileName.GetBuffer() ); + StdLstErr( "\", line " ); + sprintf( buf, "%u", (unsigned int)pFI->GetLineNo() ); + StdLstErr( buf ); + } + + if( rError.IsError() ) + StdLstErr( ": Error" ); + else + StdLstErr( ": Warning" ); + + if( pClass || aId.IsId() ) + { + StdLstErr( " in the object (" ); + if( pClass ) + { + StdLstErr( "Type: " ); + StdLstErr( pHS->getString( pClass->GetId() ).getStr() ); + if( aId.IsId() ) + StdLstErr( ", " ); + } + if( aId.IsId() ) + StdLstErr( aId.GetName().GetBuffer() ); + StdLstErr( "):\n" ); + } + else + StdLstErr( ": " ); +} + +/************************************************************************* +|* +|* 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 == rError ) // Keine Warning erzeugen + return; + if( rError.IsError() ) + nErrors++; + if( rError.IsError() || rError.IsWarning() ){ + ErrorFormat( rError, pClass, aId ); + WriteError( rError, pMessage ); + StdLstErr( "\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 != rError ){ + nErrors++; + ErrorFormat( rError, NULL, aId ); + WriteError( rError, pMessage ); + StdLstErr( "\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..68c12479261b --- /dev/null +++ b/rsc/source/parser/makefile.mk @@ -0,0 +1,82 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.7 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PROJECTPCH=parser +PROJECTPCHSOURCE=parser +PRJNAME=rsc +TARGET=rscpar + +# --- Settings ----------------------------------------------------- + +#prjpch=T + +ENABLE_EXCEPTIONS=true + +.INCLUDE : settings.mk + +# --- Files -------------------------------------------------------- + +YACCTARGET= $(INCCOM)$/yyrscyacc.cxx +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 + +$(OBJ)$/rscibas.obj : $(YACCTARGET) +$(OBJ)$/rscinit.obj : $(YACCTARGET) +$(OBJ)$/rscicpx.obj : $(YACCTARGET) +$(OBJ)$/rsclex.obj : $(YACCTARGET) +$(OBJ)$/rscyacc.obj : $(YACCTARGET) + diff --git a/rsc/source/parser/parser.cxx b/rsc/source/parser/parser.cxx new file mode 100644 index 000000000000..a5b6da55d1f3 --- /dev/null +++ b/rsc/source/parser/parser.cxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: parser.cxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +#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..10651edd76c1 --- /dev/null +++ b/rsc/source/parser/parser.hxx @@ -0,0 +1,29 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: parser.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ diff --git a/rsc/source/parser/rscdb.cxx b/rsc/source/parser/rscdb.cxx new file mode 100644 index 000000000000..65ad139963eb --- /dev/null +++ b/rsc/source/parser/rscdb.cxx @@ -0,0 +1,1117 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscdb.cxx,v $ + * $Revision: 1.17 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +/****************** I N C L U D E S **************************************/ +// C and C++ Includes. +#include <ctype.h> // isdigit(), isalpha() +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <tools/fsys.hxx> +#include <tools/rc.h> +#include <tools/isofallback.hxx> +#include <rtl/strbuf.hxx> + +// Programmabhaengige Includes. +#include <rsctree.hxx> +#include <rsctop.hxx> +#include <rscmgr.hxx> +#include <rscdb.hxx> +#include <rscrsc.hxx> + +using namespace rtl; + +/************************************************************************* +|* +|* RscTypCont :: RscTypCont +|* +|* Beschreibung RES.DOC +|* Ersterstellung MM 22.03.90 +|* Letzte Aenderung MM 27.06.90 +|* +*************************************************************************/ +RscTypCont :: RscTypCont( RscError * pErrHdl, + RSCBYTEORDER_TYPE nOrder, + const ByteString & rSearchPath, + sal_uInt32 nFlagsP ) + : + nSourceCharSet( RTL_TEXTENCODING_UTF8 ), + nByteOrder( nOrder ), + aSearchPath( rSearchPath ), + aBool( pHS->getID( "BOOL" ), RSC_NOTYPE ), + aShort( pHS->getID( "short" ), RSC_NOTYPE ), + aUShort( pHS->getID( "USHORT" ), RSC_NOTYPE ), + aLong( pHS->getID( "long" ), RSC_NOTYPE ), + aEnumLong( pHS->getID( "enum_long" ), RSC_NOTYPE ), + aIdUShort( pHS->getID( "IDUSHORT" ), RSC_NOTYPE ), + aIdNoZeroUShort( pHS->getID( "IDUSHORT" ), RSC_NOTYPE ), + aNoZeroShort( pHS->getID( "NoZeroShort" ), RSC_NOTYPE ), + a1to12Short( pHS->getID( "MonthShort" ), RSC_NOTYPE ), + a0to23Short( pHS->getID( "HourShort" ), RSC_NOTYPE ), + a1to31Short( pHS->getID( "DayShort" ), RSC_NOTYPE ), + a0to59Short( pHS->getID( "MinuteShort" ), RSC_NOTYPE ), + a0to99Short( pHS->getID( "_0to59Short" ), RSC_NOTYPE ), + a0to9999Short( pHS->getID( "YearShort" ), RSC_NOTYPE ), + aIdLong( pHS->getID( "IDLONG" ), RSC_NOTYPE ), + aString( pHS->getID( "Chars" ), RSC_NOTYPE ), + aWinBits( pHS->getID( "WinBits" ), RSC_NOTYPE ), + aLangType(), + aLangString( pHS->getID( "Lang_Chars" ), RSC_NOTYPE, &aString, &aLangType ), + aLangShort( pHS->getID( "Lang_short" ), RSC_NOTYPE, &aShort, &aLangType ), + nAcceleratorType( 0 ), + nFlags( nFlagsP ) +{ + nUniqueId = 256; + nPMId = RSC_VERSIONCONTROL +1; //mindestens einen groesser + pEH = pErrHdl; + Init(); +} + +static sal_uInt32 getLangIdAndShortenLocale( RscTypCont* pTypCont, + rtl::OString& rLang, + rtl::OString& rCountry, + rtl::OString& rVariant ) +{ + rtl::OStringBuffer aLangStr( 64 ); + aLangStr.append( rLang.toAsciiLowerCase() ); + if( rCountry.getLength() ) + { + aLangStr.append( '-' ); + aLangStr.append( rCountry.toAsciiUpperCase() ); + } + if( rVariant.getLength() ) + { + aLangStr.append( '-' ); + aLangStr.append( rVariant ); + } + rtl::OString aL( aLangStr.makeStringAndClear() ); + sal_uInt32 nRet = GetLangId( aL ); + if( nRet == 0 ) + { + pTypCont->AddLanguage( aL ); + nRet = GetLangId( aL ); + } + if( rVariant.getLength() ) + rVariant = rtl::OString(); + else if( rCountry.getLength() ) + rCountry = rtl::OString(); + else + rLang = rtl::OString(); +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, " %s (0x%hx)", aL.getStr(), nRet ); +#endif + return nRet; +} + +ByteString RscTypCont::ChangeLanguage( const ByteString& rNewLang ) +{ + ByteString aRet = aLanguage; + aLanguage = rNewLang; + + rtl::OString aLang = aLanguage; + rtl::OString aLg, aCountry, aVariant; + sal_Int32 nIndex = 0; + aLg = aLang.getToken( 0, '-', nIndex ); + if( nIndex != -1 ) + aCountry = aLang.getToken( 0, '-', nIndex ); + if( nIndex != -1 ) + aVariant = aLang.copy( nIndex ); + + bool bAppendEnUsFallback = + ! (rNewLang.EqualsIgnoreCaseAscii( "en-US" ) || + rNewLang.EqualsIgnoreCaseAscii( "x-no-translate" ) ); + +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "RscTypCont::ChangeLanguage:" ); +#endif + aLangFallbacks.clear(); + + do + { + aLangFallbacks.push_back(getLangIdAndShortenLocale( this, aLg, aCountry, aVariant ) ); + } while( aLg.getLength() ); + + if( bAppendEnUsFallback ) + { + aLg = "en"; + aCountry = "US"; + aVariant = rtl::OString(); + aLangFallbacks.push_back( getLangIdAndShortenLocale( this, aLg, aCountry, aVariant ) ); + } + +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "\n" ); +#endif + + return aRet; +} + +Atom RscTypCont::AddLanguage( const char* pLang ) +{ + return aLangType.AddLanguage( pLang, aNmTb ); +} + + +/************************************************************************* +|* +|* 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() ) ); + rtl_freeMemory( 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 ); + rtl_freeMemory( 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; + }; +} + +void RscTypCont::ClearSysNames() +{ + RscSysEntry * pSysEntry; + while( NULL != (pSysEntry = aSysLst.Remove()) ){ + delete pSysEntry; + }; +} + +//======================================================================= +RscTop * RscTypCont::SearchType( Atom nId ) +/* [Beschreibung] + + Sucht eine Basistyp nId; +*/ +{ + if( nId == InvalidAtom ) + 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( Atom nRT ){ + return( (RscTop *)pRoot->Search( nRT ) ); +} + +CLASS_DATA RscTypCont :: Search( Atom 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( Atom 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() ) ); + rtl_freeMemory( pObjNode->GetRscObj() ); + } + delete pObjNode; + } + } + } +} + +/************************************************************************* +|* +|* RscTypCont :: PutSysName() +|* +|* Beschreibung RES.DOC +|* Ersterstellung MM 22.03.90 +|* Letzte Aenderung MM 27.06.90 +|* +*************************************************************************/ +sal_uInt32 RscTypCont :: PutSysName( sal_uInt32 nRscTyp, char * pFileName, + sal_uInt32 nConst, sal_uInt32 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 +|* +*************************************************************************/ +void RscEnumerateObj :: WriteRcFile( RscWriteRc & rMem, FILE * fOut ){ + // Definition der Struktur, aus denen die Resource aufgebaut ist + /* + struct RSHEADER_TYPE{ + sal_uInt32 nId; // Identifier der Resource + sal_uInt32 nRT; // Resource Typ + sal_uInt32 nGlobOff; // Globaler Offset + sal_uInt32 nLocalOff; // Lokaler Offset + } aHeader; + */ + + sal_uInt32 nId = rMem.GetLong( 0 ); + sal_uInt32 nRT = rMem.GetLong( 4 ); + + // Tabelle wird entsprechend gefuellt + pTypCont->PutTranslatorKey( (sal_uInt64(nRT) << 32) + sal_uInt64(nId) ); + + if( nRT == RSC_VERSIONCONTROL ) + { // kommt immmer als letztes + INT32 nCount = pTypCont->aIdTranslator.size(); + // groesse der Tabelle + UINT32 nSize = (nCount * (sizeof(sal_uInt64)+sizeof(INT32))) + sizeof(INT32); + + rMem.Put( nCount ); //Anzahl speichern + for( std::map< sal_uInt64, ULONG >::const_iterator it = + pTypCont->aIdTranslator.begin(); it != pTypCont->aIdTranslator.end(); ++it ) + { + // Schluessel schreiben + rMem.Put( it->first ); + // Objekt Id oder Position schreiben + rMem.Put( (INT32)it->second ); + } + 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( WriteRcContext& rContext ) +{ + ERRTYPE aError; + RscEnumerateRef aEnumRef( this, pRoot, rContext.fOutput ); + + aIdTranslator.clear(); + nFilePos = 0; + nPMId = RSCVERSION_ID +1; //mindestens einen groesser + + aError = aEnumRef.WriteRc(); + + // version control + RscWriteRc aMem( nByteOrder ); + aVersion.pClass->WriteRcHeader( aVersion, aMem, this, RscId( RSCVERSION_ID ), 0, TRUE ); + aEnumRef.aEnumObj.WriteRcFile( aMem, rContext.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 ); + + unsigned char aUTF8BOM[3] = { 0xef, 0xbb, 0xbf }; + fwrite( aUTF8BOM, sizeof(unsigned char), sizeof(aUTF8BOM)/sizeof(aUTF8BOM[0]), 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 <tools/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( sal_uInt32 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 ) ); +} + +sal_uInt32 RscTypCont::PutTranslatorKey( sal_uInt64 nKey ) +{ + aIdTranslator[ nKey ] = nFilePos; + return nPMId++; +} diff --git a/rsc/source/parser/rscibas.cxx b/rsc/source/parser/rscibas.cxx new file mode 100644 index 000000000000..75f558398bb5 --- /dev/null +++ b/rsc/source/parser/rscibas.cxx @@ -0,0 +1,714 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscibas.cxx,v $ + * $Revision: 1.16 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" + +/****************** I N C L U D E S **************************************/ +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <i18npool/mslangid.hxx> +#include <tools/rc.h> +#include <tools/color.hxx> + +#include <vclrsc.hxx> +#include <rscconst.hxx> +#include <rscarray.hxx> +#include <rscclass.hxx> +#include <rsccont.hxx> +#include <rscdb.hxx> + + +#include "rsclex.hxx" +#include <yyrscyacc.hxx> + +#include <hash_map> + +/****************** M A C R O S ******************************************/ +void RscTypCont::SETCONST( RscConst * pClass, const char * szString, UINT32 nVal ) +{ +#if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, "setconst : %s\n", szString ); +#endif + pClass->SetConstant( aNmTb.Put( szString, + CONSTNAME, nVal ), nVal ); +} + +void RscTypCont::SETCONST( RscConst * pClass, Atom nName, UINT32 nVal ) +{ +#if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, "setconst hash: %u\n", (unsigned int)nName ); +#endif + pClass->SetConstant( aNmTb.Put( nName, + CONSTNAME, nVal ), nVal ); +} + +/****************** C O D E **********************************************/ +/************************************************************************* +|* RscTypCont::InitLangType() +|* +|* Beschreibung +*************************************************************************/ + +typedef std::hash_map< rtl::OString, sal_uInt32, rtl::OStringHash > langmap; +static langmap ULong_Iso_map; + +sal_uInt32 GetLangId( const ByteString& aLang ) +{ + langmap::iterator pIter = ULong_Iso_map.find( aLang ); + if ( pIter != ULong_Iso_map.end()) + return pIter->second; + return 0; +} + +void RscLangEnum::Init( RscNameTable& rNames ) +{ + SetConstant( rNames.Put( "SYSTEM", CONSTNAME, (long)LANGUAGE_SYSTEM ), LANGUAGE_SYSTEM ); + SetConstant( rNames.Put( "DONTKNOW", CONSTNAME, LANGUAGE_DONTKNOW ), LANGUAGE_DONTKNOW ); + + sal_Int32 nIndex = 0; + mnLangId = 0x400; // stay away from selfdefined... + char csep = '-'; + const MsLangId::IsoLangEntry* pLangEntry; + ByteString aCountry, aLang; + + while ( NULL != ( pLangEntry = MsLangId::getIsoLangEntry( nIndex )) && ( pLangEntry->mnLang != LANGUAGE_DONTKNOW )) + { +#if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, "ISO Language in : %d %d %s\n", + (int)nIndex, + pLangEntry->mnLang, + MsLangId::convertLanguageToIsoByteString( pLangEntry->mnLang ).getStr() ); +#endif + aLang = pLangEntry->maLangStr; + aCountry = pLangEntry->maCountry; + if ( aLang.EqualsIgnoreCaseAscii( aCountry ) || ! aCountry.Len() ) + { + SetConstant( rNames.Put( aLang.GetBuffer(), CONSTNAME, mnLangId ), mnLangId ); + if ( ! GetLangId( aLang )) + ULong_Iso_map[ aLang ] = mnLangId; +#if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, "ISO Language out: %s 0x%lx\n", aLang.GetBuffer(), mnLangId ); +#endif + mnLangId++; + } + else + { + SetConstant( rNames.Put( aLang.GetBuffer(), CONSTNAME, mnLangId ), mnLangId ); + if ( ! GetLangId( aLang )) + ULong_Iso_map[ aLang ] = mnLangId; +#if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, "ISO Language out: %s 0x%lx", aLang.GetBuffer(), mnLangId ); +#endif + mnLangId++; + aLang += csep; + aLang += aCountry.ToUpperAscii(); + SetConstant( rNames.Put( aLang.GetBuffer(), CONSTNAME, mnLangId ), mnLangId ); + if ( ! GetLangId( aLang )) + ULong_Iso_map[ aLang ] = mnLangId; +#if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, " %s 0x%lx\n", aLang.GetBuffer(), mnLangId ); +#endif + mnLangId++; +// hack - survive "x-no-translate" + if ( aLang == "en-US" ) + { +// SetConstant( rNames.Put( "x-no-translate", CONSTNAME, mnLangId ), mnLangId ); +// mnLangId++; + SetConstant( rNames.Put( "x-comment", CONSTNAME, mnLangId ), mnLangId ); + mnLangId++; + } + } + nIndex++; + } + + ByteString aEnvIsoTokens = getenv( "RSC_LANG_ISO" ); + if ( aEnvIsoTokens.Len() ) + { + ByteString aIsoToken; + sal_uInt16 nTokenCounter = 0; + sal_Bool bOneMore = 1; + while ( bOneMore ) + { + aIsoToken = aEnvIsoTokens.GetToken( nTokenCounter, ' ' ); + if ( aIsoToken.Len() ) + { + SetConstant( rNames.Put( aIsoToken.GetBuffer(), CONSTNAME, mnLangId ), mnLangId ); + if ( ! GetLangId( aIsoToken )) + ULong_Iso_map[ aIsoToken ] = mnLangId; +#if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, "Env ISO Language out: %s 0x%lx\n", aIsoToken.GetBuffer(), mnLangId ); +#endif + mnLangId++; + } + else + bOneMore = 0; + nTokenCounter++; + } + } + + SetConstant( rNames.Put( "LANGUAGE_USER1", CONSTNAME, LANGUAGE_USER1 ), LANGUAGE_USER1 ); + SetConstant( rNames.Put( "LANGUAGE_USER2", CONSTNAME, LANGUAGE_USER2 ), LANGUAGE_USER2 ); + SetConstant( rNames.Put( "LANGUAGE_USER3", CONSTNAME, LANGUAGE_USER3 ), LANGUAGE_USER3 ); + SetConstant( rNames.Put( "LANGUAGE_USER4", CONSTNAME, LANGUAGE_USER4 ), LANGUAGE_USER4 ); + SetConstant( rNames.Put( "LANGUAGE_USER5", CONSTNAME, LANGUAGE_USER5 ), LANGUAGE_USER5 ); + SetConstant( rNames.Put( "LANGUAGE_USER6", CONSTNAME, LANGUAGE_USER6 ), LANGUAGE_USER6 ); + SetConstant( rNames.Put( "LANGUAGE_USER7", CONSTNAME, LANGUAGE_USER7 ), LANGUAGE_USER7 ); + SetConstant( rNames.Put( "LANGUAGE_USER8", CONSTNAME, LANGUAGE_USER8 ), LANGUAGE_USER8 ); + SetConstant( rNames.Put( "EXTERN", CONSTNAME, LANGUAGE_USER9 ), LANGUAGE_USER9 ); +} + +Atom RscLangEnum::AddLanguage( const char* pLang, RscNameTable& rNames ) +{ + Atom nResult = 0; + KEY_STRUCT aStruct; + if( ! rNames.Get( nResult = pHS->getID( pLang ), &aStruct ) ) + { + SetConstant( nResult = rNames.Put( pLang, CONSTNAME, mnLangId ), mnLangId ); + // insert new lang to ULong_Iso_map + rtl::OString aLang( pLang ); + if ( ! GetLangId( aLang )) + ULong_Iso_map[ aLang ] = mnLangId; + // increase id counter + mnLangId++; + } + #if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, "AddLanguage( %s ) = 0x%lx\n", pLang, nResult ); + #endif + return nResult; +} + +RscEnum * RscTypCont::InitLangType() +{ + aLangType.Init( aNmTb ); + return( &aLangType ); +} + +/************************************************************************* +|* +|* RscTypCont::InitFieldUnitsType() +|* +|* Beschreibung +|* Ersterstellung MM 22.03.91 +|* Letzte Aenderung MM 27.06.91 +|* +*************************************************************************/ +RscEnum * RscTypCont::InitFieldUnitsType() +{ + RscEnum * pFieldUnits; + pFieldUnits = new RscEnum( pHS->getID( "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 ); + SETCONST( pFieldUnits, "FUNIT_PERCENT", FUNIT_PERCENT ); + + return pFieldUnits; +} + +/************************************************************************* +|* +|* RscTypCont::InitTimeFieldFormat() +|* +|* Beschreibung +|* Ersterstellung MM 22.03.91 +|* Letzte Aenderung MM 27.06.91 +|* +*************************************************************************/ +RscEnum * RscTypCont::InitTimeFieldFormat() +{ + RscEnum * pTimeFieldFormat; + pTimeFieldFormat = new RscEnum( pHS->getID( "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->getID( "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->getID( "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->getID( "EnumKey" ), RSC_NOTYPE ); + + SETCONST( pKey, "KEY_0", com::sun::star::awt::Key::NUM0 ); + SETCONST( pKey, "KEY_1", com::sun::star::awt::Key::NUM1 ); + SETCONST( pKey, "KEY_2", com::sun::star::awt::Key::NUM2 ); + SETCONST( pKey, "KEY_3", com::sun::star::awt::Key::NUM3 ); + SETCONST( pKey, "KEY_4", com::sun::star::awt::Key::NUM4 ); + SETCONST( pKey, "KEY_5", com::sun::star::awt::Key::NUM5 ); + SETCONST( pKey, "KEY_6", com::sun::star::awt::Key::NUM6 ); + SETCONST( pKey, "KEY_7", com::sun::star::awt::Key::NUM7 ); + SETCONST( pKey, "KEY_8", com::sun::star::awt::Key::NUM8 ); + SETCONST( pKey, "KEY_9", com::sun::star::awt::Key::NUM9 ); + + SETCONST( pKey, "KEY_A", com::sun::star::awt::Key::A ); + SETCONST( pKey, "KEY_B", com::sun::star::awt::Key::B ); + SETCONST( pKey, "KEY_C", com::sun::star::awt::Key::C ); + SETCONST( pKey, "KEY_D", com::sun::star::awt::Key::D ); + SETCONST( pKey, "KEY_E", com::sun::star::awt::Key::E ); + SETCONST( pKey, "KEY_F", com::sun::star::awt::Key::F ); + SETCONST( pKey, "KEY_G", com::sun::star::awt::Key::G ); + SETCONST( pKey, "KEY_H", com::sun::star::awt::Key::H ); + SETCONST( pKey, "KEY_I", com::sun::star::awt::Key::I ); + SETCONST( pKey, "KEY_J", com::sun::star::awt::Key::J ); + SETCONST( pKey, "KEY_K", com::sun::star::awt::Key::K ); + SETCONST( pKey, "KEY_L", com::sun::star::awt::Key::L ); + SETCONST( pKey, "KEY_M", com::sun::star::awt::Key::M ); + SETCONST( pKey, "KEY_N", com::sun::star::awt::Key::N ); + SETCONST( pKey, "KEY_O", com::sun::star::awt::Key::O ); + SETCONST( pKey, "KEY_P", com::sun::star::awt::Key::P ); + SETCONST( pKey, "KEY_Q", com::sun::star::awt::Key::Q ); + SETCONST( pKey, "KEY_R", com::sun::star::awt::Key::R ); + SETCONST( pKey, "KEY_S", com::sun::star::awt::Key::S ); + SETCONST( pKey, "KEY_T", com::sun::star::awt::Key::T ); + SETCONST( pKey, "KEY_U", com::sun::star::awt::Key::U ); + SETCONST( pKey, "KEY_V", com::sun::star::awt::Key::V ); + SETCONST( pKey, "KEY_W", com::sun::star::awt::Key::W ); + SETCONST( pKey, "KEY_X", com::sun::star::awt::Key::X ); + SETCONST( pKey, "KEY_Y", com::sun::star::awt::Key::Y ); + SETCONST( pKey, "KEY_Z", com::sun::star::awt::Key::Z ); + + SETCONST( pKey, "KEY_F1", com::sun::star::awt::Key::F1 ); + SETCONST( pKey, "KEY_F2", com::sun::star::awt::Key::F2 ); + SETCONST( pKey, "KEY_F3", com::sun::star::awt::Key::F3 ); + SETCONST( pKey, "KEY_F4", com::sun::star::awt::Key::F4 ); + SETCONST( pKey, "KEY_F5", com::sun::star::awt::Key::F5 ); + SETCONST( pKey, "KEY_F6", com::sun::star::awt::Key::F6 ); + SETCONST( pKey, "KEY_F7", com::sun::star::awt::Key::F7 ); + SETCONST( pKey, "KEY_F8", com::sun::star::awt::Key::F8 ); + SETCONST( pKey, "KEY_F9", com::sun::star::awt::Key::F9 ); + SETCONST( pKey, "KEY_F10", com::sun::star::awt::Key::F10 ); + SETCONST( pKey, "KEY_F11", com::sun::star::awt::Key::F11 ); + SETCONST( pKey, "KEY_F12", com::sun::star::awt::Key::F12 ); + SETCONST( pKey, "KEY_F13", com::sun::star::awt::Key::F13 ); + SETCONST( pKey, "KEY_F14", com::sun::star::awt::Key::F14 ); + SETCONST( pKey, "KEY_F15", com::sun::star::awt::Key::F15 ); + SETCONST( pKey, "KEY_F16", com::sun::star::awt::Key::F16 ); + SETCONST( pKey, "KEY_F17", com::sun::star::awt::Key::F17 ); + SETCONST( pKey, "KEY_F18", com::sun::star::awt::Key::F18 ); + SETCONST( pKey, "KEY_F19", com::sun::star::awt::Key::F19 ); + SETCONST( pKey, "KEY_F20", com::sun::star::awt::Key::F20 ); + SETCONST( pKey, "KEY_F21", com::sun::star::awt::Key::F21 ); + SETCONST( pKey, "KEY_F22", com::sun::star::awt::Key::F22 ); + SETCONST( pKey, "KEY_F23", com::sun::star::awt::Key::F23 ); + SETCONST( pKey, "KEY_F24", com::sun::star::awt::Key::F24 ); + SETCONST( pKey, "KEY_F25", com::sun::star::awt::Key::F25 ); + SETCONST( pKey, "KEY_F26", com::sun::star::awt::Key::F26 ); + + SETCONST( pKey, "KEY_DOWN", com::sun::star::awt::Key::DOWN ); + SETCONST( pKey, "KEY_UP", com::sun::star::awt::Key::UP ); + SETCONST( pKey, "KEY_LEFT", com::sun::star::awt::Key::LEFT ); + SETCONST( pKey, "KEY_RIGHT", com::sun::star::awt::Key::RIGHT ); + SETCONST( pKey, "KEY_HOME", com::sun::star::awt::Key::HOME ); + SETCONST( pKey, "KEY_END", com::sun::star::awt::Key::END ); + SETCONST( pKey, "KEY_PAGEUP", com::sun::star::awt::Key::PAGEUP ); + SETCONST( pKey, "KEY_PAGEDOWN", com::sun::star::awt::Key::PAGEDOWN ); + + SETCONST( pKey, "KEY_RETURN", com::sun::star::awt::Key::RETURN ); + SETCONST( pKey, "KEY_ESCAPE", com::sun::star::awt::Key::ESCAPE ); + SETCONST( pKey, "KEY_TAB", com::sun::star::awt::Key::TAB ); + SETCONST( pKey, "KEY_BACKSPACE", com::sun::star::awt::Key::BACKSPACE ); + SETCONST( pKey, "KEY_SPACE", com::sun::star::awt::Key::SPACE ); + SETCONST( pKey, "KEY_INSERT", com::sun::star::awt::Key::INSERT ); + SETCONST( pKey, "KEY_DELETE", com::sun::star::awt::Key::DELETE ); + + SETCONST( pKey, "KEY_ADD", com::sun::star::awt::Key::ADD ); + SETCONST( pKey, "KEY_SUBTRACT", com::sun::star::awt::Key::SUBTRACT ); + SETCONST( pKey, "KEY_MULTIPLY", com::sun::star::awt::Key::MULTIPLY ); + SETCONST( pKey, "KEY_DIVIDE", com::sun::star::awt::Key::DIVIDE ); + SETCONST( pKey, "KEY_POINT", com::sun::star::awt::Key::POINT ); + SETCONST( pKey, "KEY_COMMA", com::sun::star::awt::Key::COMMA ); + SETCONST( pKey, "KEY_LESS", com::sun::star::awt::Key::LESS ); + SETCONST( pKey, "KEY_GREATER", com::sun::star::awt::Key::GREATER ); + SETCONST( pKey, "KEY_EQUAL", com::sun::star::awt::Key::EQUAL ); + + SETCONST( pKey, "KEY_OPEN", com::sun::star::awt::Key::OPEN ); + SETCONST( pKey, "KEY_CUT", com::sun::star::awt::Key::CUT ); + SETCONST( pKey, "KEY_COPY", com::sun::star::awt::Key::COPY ); + SETCONST( pKey, "KEY_PASTE", com::sun::star::awt::Key::PASTE ); + SETCONST( pKey, "KEY_UNDO", com::sun::star::awt::Key::UNDO ); + SETCONST( pKey, "KEY_REPEAT", com::sun::star::awt::Key::REPEAT ); + SETCONST( pKey, "KEY_FIND", com::sun::star::awt::Key::FIND ); + SETCONST( pKey, "KEY_PROPERTIES", com::sun::star::awt::Key::PROPERTIES ); + SETCONST( pKey, "KEY_FRONT", com::sun::star::awt::Key::FRONT ); + SETCONST( pKey, "KEY_CONTEXTMENU", com::sun::star::awt::Key::CONTEXTMENU ); + SETCONST( pKey, "KEY_HELP", com::sun::star::awt::Key::HELP ); + SETCONST( pKey, "KEY_HANGUL_HANJA", com::sun::star::awt::Key::HANGUL_HANJA ); + SETCONST( pKey, "KEY_DECIMAL", com::sun::star::awt::Key::DECIMAL ); + SETCONST( pKey, "KEY_TILDE", com::sun::star::awt::Key::TILDE ); + SETCONST( pKey, "KEY_QUOTELEFT", com::sun::star::awt::Key::QUOTELEFT ); + + 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->getID( "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->getID( "EnumMessButtons" ), RSC_NOTYPE ); + SETCONST( pMessButtons, "WB_OK", sal::static_int_cast<UINT32>(WB_OK) ); + SETCONST( pMessButtons, "WB_OK_CANCEL", sal::static_int_cast<UINT32>(WB_OK_CANCEL) ); + SETCONST( pMessButtons, "WB_YES_NO", sal::static_int_cast<UINT32>(WB_YES_NO) ); + SETCONST( pMessButtons, "WB_YES_NO_CANCEL", sal::static_int_cast<UINT32>(WB_YES_NO_CANCEL) ); + SETCONST( pMessButtons, "WB_RETRY_CANCEL", sal::static_int_cast<UINT32>(WB_RETRY_CANCEL) ); + SETCONST( pMessButtons, "WB_ABORT_RETRY_IGNORE", sal::static_int_cast<UINT32>(WB_ABORT_RETRY_IGNORE) ); + 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->getID( "EnumMessDefButton" ), + RSC_NOTYPE ); + + SETCONST( pMessDefButton, "WB_DEF_OK", sal::static_int_cast<UINT32>(WB_DEF_OK) ); + SETCONST( pMessDefButton, "WB_DEF_CANCEL", sal::static_int_cast<UINT32>(WB_DEF_CANCEL) ); + SETCONST( pMessDefButton, "WB_DEF_RETRY", sal::static_int_cast<UINT32>(WB_DEF_RETRY) ); + SETCONST( pMessDefButton, "WB_DEF_YES", sal::static_int_cast<UINT32>(WB_DEF_YES) ); + SETCONST( pMessDefButton, "WB_DEF_NO", sal::static_int_cast<UINT32>(WB_DEF_NO) ); + SETCONST( pMessDefButton, "WB_DEF_IGNORE", sal::static_int_cast<UINT32>(WB_DEF_IGNORE) ); + return( pMessDefButton ); +} + +/************************************************************************* +|* +|* RscTypCont::InitGeometry() +|* +|* Beschreibung +|* Ersterstellung MM 24.05.91 +|* Letzte Aenderung MM 24.05.91 +|* +*************************************************************************/ +RscTupel * RscTypCont::InitGeometry() +{ + RscTop * pTupel; + Atom nId; + + // Clientvariablen einfuegen + pTupel = new RscTupel( pHS->getID( "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->getID( "Lang_TupelGeometry" ), RSC_NOTYPE, pGeo, &aLangType ); +} + +/************************************************************************* +|* +|* RscTypCont::InitStringList() +|* +|* Beschreibung +|* Ersterstellung MM 24.05.91 +|* Letzte Aenderung MM 24.05.91 +|* +*************************************************************************/ +RscCont * RscTypCont::InitStringList() +{ + RscCont * pCont; + + pCont = new RscCont( pHS->getID( "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->getID( "Lang_CharsList" ), + RSC_NOTYPE, pStrLst, &aLangType ); +} + +/************************************************************************* +|* +|* RscTypCont::InitStringTupel() +|* +|* Beschreibung +|* Ersterstellung MM 24.05.91 +|* Letzte Aenderung MM 24.05.91 +|* +*************************************************************************/ +RscTupel * RscTypCont::InitStringTupel() +{ + RscTop * pTupel; + Atom nId; + + // Clientvariablen einfuegen + pTupel = new RscTupel( pHS->getID( "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; + Atom nId; + + // Clientvariablen einfuegen + pTupel = new RscTupel( pHS->getID( "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->getID( "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->getID( "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->getID( "Lang_CharsCharsTupel" ), + RSC_NOTYPE, pStrTupelLst, &aLangType ); +} + +/************************************************************************* +|* +|* RscTypCont::InitLangStringLongTupelList() +|* +|* Beschreibung +|* Ersterstellung MM 24.05.91 +|* Letzte Aenderung MM 24.05.91 +|* +*************************************************************************/ +RscArray * RscTypCont::InitLangStringLongTupelList( RscCont * pStrLongTupelLst ) +{ + return new RscArray( pHS->getID( "Lang_CharsLongTupelList" ), + RSC_NOTYPE, pStrLongTupelLst, &aLangType ); +} + diff --git a/rsc/source/parser/rscicpx.cxx b/rsc/source/parser/rscicpx.cxx new file mode 100644 index 000000000000..e59a1e056f4b --- /dev/null +++ b/rsc/source/parser/rscicpx.cxx @@ -0,0 +1,2392 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscicpx.cxx,v $ + * $Revision: 1.17 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" + +/****************** I N C L U D E S **************************************/ +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> + +#include <tools/rc.h> + +#include <vclrsc.hxx> +#include <rscmgr.hxx> +#include <rscclass.hxx> +#include <rsccont.hxx> +#include <rscdb.hxx> +#include <rscsfx.hxx> + +#include "rsclex.hxx" +#include <yyrscyacc.hxx> + +/************************************************************************* +|* RscTypCont::InsWinBit() +*************************************************************************/ +void RscTypCont::InsWinBit( RscTop * pClass, const ByteString & rName, + Atom nVal ) +{ + RscClient * pClient; + + // Clientvariablen einfuegen + aBaseLst.Insert( + pClient = new RscClient( pHS->getID( "BOOL" ), RSC_NOTYPE, + &aWinBits, nVal ), + LIST_APPEND ); + Atom 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; + Atom nId; + + aBaseLst.Insert( pClass = + new RscBaseCont( InvalidAtom, RSC_NOTYPE, NULL, FALSE ), + LIST_APPEND ); + + nId = pHS->getID( "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->getID( "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 ){ + Atom nId; + RscTop * pClassString; + + nId = pHS->getID( "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 ){ + Atom nId; + RscTop * pClassBitmap; + + nId = pHS->getID( "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 ){ + Atom nId; + RscTop * pClassColor; + + // Klasse anlegen + nId = pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassImage; + + // Klasse anlegen + nId = pHS->getID( "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, RscCont * pStrLst ) +{ + Atom nId; + RscTop * pClassImageList; + + // Klasse anlegen + nId = pHS->getID( "ImageList" ); + pClassImageList = new RscClass( nId, RSC_IMAGELIST, pSuper ); + pClassImageList->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + aNmTb.Put( nId, CLASSNAME, pClassImageList ); + + nId = aNmTb.Put( "Prefix", VARNAME ); + pClassImageList->SetVariable( nId, &aString ); + + nId = aNmTb.Put( "MaskColor", VARNAME ); + pClassImageList->SetVariable( nId, pClassColor, NULL, + VAR_SVDYNAMIC, RSC_IMAGELIST_MASKCOLOR ); + + RscCont * pCont = new RscCont( pHS->getID( "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( "FileList", VARNAME ); + pClassImageList->SetVariable( nId, pStrLst ); + + 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 ) +{ + Atom nId; + RscTop * pClassWindow; + + // Klasse anlegen + nId = pHS->getID( "Window" ); + pClassWindow = new RscClass( nId, RSC_WINDOW, pSuper ); + pClassWindow->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassWindow ); + + // Variablen anlegen + { + RscFlag * pFlag; + RscClient * pClient; + Atom nVarId, nDisableId, nOutputSizeId; + + aBaseLst.Insert( pFlag = new RscFlag( pHS->getID( "FlagWndExtra" ), + RSC_NOTYPE ), + LIST_APPEND ); + + // Konstanten in Tabelle stellen + nDisableId = pHS->getID( "RSWND_DISABLE" ); + SETCONST( pFlag, nDisableId, RSWND_DISABLED ); + nOutputSizeId = pHS->getID( "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->getID( "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->getID( "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 ); + + // BorderStyle + RscEnum* pBorderStyleEnum = new RscEnum( pHS->getID( "WindowBorderStyle" ), RSC_NOTYPE ); + aBaseLst.Insert( pBorderStyleEnum, LIST_APPEND ); + + // Konstanten in Tabelle stellen + SETCONST( pBorderStyleEnum, pHS->getID( "WINDOW_BORDER_NORMAL" ), WINDOW_BORDER_NORMAL ); + SETCONST( pBorderStyleEnum, pHS->getID( "WINDOW_BORDER_MONO" ), WINDOW_BORDER_MONO ); + SETCONST( pBorderStyleEnum, pHS->getID( "WINDOW_BORDER_ACTIVE" ), WINDOW_BORDER_ACTIVE ); + SETCONST( pBorderStyleEnum, pHS->getID( "WINDOW_BORDER_DOUBLEOUT" ), WINDOW_BORDER_DOUBLEOUT ); + SETCONST( pBorderStyleEnum, pHS->getID( "WINDOW_BORDER_MENU" ), WINDOW_BORDER_MENU ); + SETCONST( pBorderStyleEnum, pHS->getID( "WINDOW_BORDER_NOBORDER" ), WINDOW_BORDER_NOBORDER ); + + // Variable einfuegen + nId = aNmTb.Put( "BorderStyle", VARNAME ); + pClassWindow->SetVariable( nId, pBorderStyleEnum, NULL, + 0, + WINDOW_BORDER_STYLE ); + + return( pClassWindow ); +} + +/************************************************************************* +|* RscTypCont::InitClassSystemWindow() +*************************************************************************/ +RscTop * RscTypCont::InitClassSystemWindow( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassSystemWindow; + + // Klasse anlegen + nId = pHS->getID( "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) + INS_WINBIT(pClassSystemWindow,SysWin) + + return pClassSystemWindow ; +} + +/************************************************************************* +|* RscTypCont::InitClassWorkWindow() +*************************************************************************/ +RscTop * RscTypCont::InitClassWorkWindow( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassWorkWindow; + + // Klasse anlegen + nId = pHS->getID( "WorkWindow" ); + pClassWorkWindow = new RscClass( nId, RSC_WORKWIN, pSuper ); + pClassWorkWindow->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassWorkWindow ); + + // Variablen anlegen + { + Atom nVarId; + RscEnum * pShow; + + aBaseLst.Insert( pShow = new RscEnum( pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassDialog; + + // Klasse anlegen + nId = pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassDialog; + + // Klasse anlegen + nId = pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassControl; + + // Klasse anlegen + nId = pHS->getID( "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::InitClassCheckBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassCheckBox( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassCheckBox; + + // Klasse anlegen + nId = pHS->getID( "CheckBox" ); + pClassCheckBox = new RscClass( nId, RSC_CHECKBOX, pSuper ); + pClassCheckBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassCheckBox ); + + // Variablen anlegen + INS_WINBIT( pClassCheckBox, WordBreak ) + INS_WINBIT( pClassCheckBox, Top ) + INS_WINBIT( pClassCheckBox, VCenter ) + INS_WINBIT( pClassCheckBox, Bottom ) + + nId = aNmTb.Put( "Check", VARNAME ); + pClassCheckBox->SetVariable( nId, &aBool ); + + return pClassCheckBox; +} + +/************************************************************************* +|* RscTypCont::InitClassPushButton() +*************************************************************************/ +RscTop * RscTypCont::InitClassPushButton( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassPushButton; + + // Klasse anlegen + nId = pHS->getID( "PushButton" ); + pClassPushButton = new RscClass( nId, RSC_PUSHBUTTON, pSuper ); + pClassPushButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassPushButton ); + + InsWinBit( pClassPushButton, "DefButton", nDefaultId ); + INS_WINBIT( pClassPushButton, Top ) + INS_WINBIT( pClassPushButton, VCenter ) + INS_WINBIT( pClassPushButton, Bottom ) + + return pClassPushButton; +} + +/************************************************************************* +|* RscTypCont::InitClassTriStateBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassTriStateBox( RscTop * pSuper, + RscEnum * pTriState ) +{ + Atom nId; + RscTop * pClassTriStateBox; + + nId = pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassMenuButton; + + nId = pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassImageButton; + + // Klasse anlegen + nId = pHS->getID( "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 + { + Atom nVarId; + RscEnum * pSymbol; + + aBaseLst.Insert( pSymbol = new RscEnum( pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassEdit; + + // Klasse anlegen + nId = pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassMultiLineEdit; + + // Klasse anlegen + nId = pHS->getID( "MultiLineEdit" ); + pClassMultiLineEdit = new RscClass( nId, RSC_MULTILINEEDIT, pSuper ); + pClassMultiLineEdit->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassMultiLineEdit ); + + INS_WINBIT( pClassMultiLineEdit, HScroll ); + INS_WINBIT( pClassMultiLineEdit, VScroll ); + INS_WINBIT( pClassMultiLineEdit, IgnoreTab ); + INS_WINBIT( pClassMultiLineEdit, AutoVScroll ) + + return pClassMultiLineEdit; +} + +/************************************************************************* +|* RscTypCont::InitClassScrollBar() +*************************************************************************/ +RscTop * RscTypCont::InitClassScrollBar( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassScrollBar; + + // Klasse anlegen + nId = pHS->getID( "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 ); + + INS_WINBIT( pClassScrollBar, HScroll ); + INS_WINBIT( pClassScrollBar, VScroll ); + INS_WINBIT( pClassScrollBar, Drag ) + + return pClassScrollBar; +} + +/************************************************************************* +|* RscTypCont::InitClassListBox() +*************************************************************************/ +RscTop * RscTypCont::InitClassListBox( RscTop * pSuper, RscArray * pStrLst ) +{ + Atom nId; + RscTop * pClassListBox; + + // Klasse anlegen + nId = pHS->getID( "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) + INS_WINBIT(pClassListBox,HScroll); + INS_WINBIT(pClassListBox,VScroll); + 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 ) +{ + Atom nId; + RscTop * pClassMultiListBox; + + // Klasse anlegen + nId = pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassComboBox; + + // Klasse anlegen + nId = pHS->getID( "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) + INS_WINBIT(pClassComboBox,HScroll); + INS_WINBIT(pClassComboBox,VScroll); + INS_WINBIT(pClassComboBox,AutoSize) + INS_WINBIT(pClassComboBox,AutoHScroll) + INS_WINBIT(pClassComboBox,DDExtraWidth) + + nId = aNmTb.Put( "StringList", VARNAME ); + pClassComboBox->SetVariable( nId, pStrLst ); + + return pClassComboBox; +} + +/************************************************************************* +|* RscTypCont::InitClassFixedText() +*************************************************************************/ +RscTop * RscTypCont::InitClassFixedText( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassFixedText; + + // Klasse anlegen + nId = pHS->getID( "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) + INS_WINBIT(pClassFixedText,Top) + INS_WINBIT(pClassFixedText,VCenter) + INS_WINBIT(pClassFixedText,Bottom) + + return pClassFixedText; +} + +/************************************************************************* +|* RscTypCont::InitClassFixedBitmap() +*************************************************************************/ +RscTop * RscTypCont::InitClassFixedBitmap( RscTop * pSuper, RscTop * pClassBitmap ) +{ + Atom nId; + RscTop * pClassFixedBitmap; + + // Klasse anlegen + nId = pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassFixedImage; + + // Klasse anlegen + nId = pHS->getID( "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::InitClassRadioButton( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassRadioButton; + + // Klasse anlegen + nId = pHS->getID( "RadioButton" ); + pClassRadioButton = new RscClass( nId, RSC_RADIOBUTTON, pSuper ); + pClassRadioButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + aNmTb.Put( nId, CLASSNAME, pClassRadioButton ); + + // Variablen anlegen + INS_WINBIT( pClassRadioButton, WordBreak ) + INS_WINBIT( pClassRadioButton, Top ) + INS_WINBIT( pClassRadioButton, VCenter ) + INS_WINBIT( pClassRadioButton, Bottom ) + + nId = aNmTb.Put( "Check", VARNAME ); + pClassRadioButton->SetVariable( nId, &aBool ); + + return pClassRadioButton; +} + +/************************************************************************* +|* RscTypCont::InitClassImageRadioButton() +*************************************************************************/ +RscTop * RscTypCont::InitClassImageRadioButton( RscTop * pSuper, RscTop * pClassImage ) +{ + Atom nId; + RscTop * pClassImageRadioButton; + + // Klasse anlegen + nId = pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassKeyCode; + + // Klasse anlegen + nId = pHS->getID( "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; + Atom nVarId, nShiftId, nMod1Id, nMod2Id; + + aBaseLst.Insert( pFlag = new RscFlag( pHS->getID( "FlagKeyModifier" ), + RSC_NOTYPE ), + LIST_APPEND ); + + // Konstanten in Tabelle stellen + nShiftId = pHS->getID( "KEY_SHIFT" ); + SETCONST( pFlag, nShiftId, KEY_SHIFT ); + nMod1Id = pHS->getID( "KEY_MOD1" ); + SETCONST( pFlag, nMod1Id, KEY_MOD1 ); + nMod2Id = pHS->getID( "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->getID( "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->getID( "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->getID( "BOOL" ), RSC_NOTYPE, + pFlag, nMod2Id ), + LIST_APPEND ); + nId = aNmTb.Put( "Modifier2", VARNAME ); + pClassKeyCode->SetVariable( nId, pClient, NULL, + VAR_NODATAINST, 0, nVarId ); + } + { + Atom nVarId; + RscEnum * pKeyFunc; + + aBaseLst.Insert( pKeyFunc = new RscEnum( pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassAccelItem; + + // Klasse anlegen + nId = pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassAccel; + + // Klasse anlegen + nId = pHS->getID( "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->getID( "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 ) +{ + Atom nId; + RscTop * pClassMenuItem; + + // Klasse anlegen + nId = pHS->getID( "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; + Atom nVarId, nAutoCheckId, nRadioCheckId; + Atom nCheckableId, nAboutId, nHelpId; + + aBaseLst.Insert( pFlag = new RscFlag( pHS->getID( "FlagMenuState" ), + RSC_NOTYPE ), + LIST_APPEND ); + + // Konstanten in Tabelle stellen + nCheckableId = pHS->getID( "MIB_CHECKABLE" ); + SETCONST( pFlag, nCheckableId, MIB_CHECKABLE ); + nAutoCheckId = pHS->getID( "MIB_AUTOCHECK" ); + SETCONST( pFlag, nAutoCheckId, MIB_AUTOCHECK ); + nRadioCheckId = pHS->getID( "MIB_RADIOCHECK" ); + SETCONST( pFlag, nRadioCheckId, MIB_RADIOCHECK ); + nAboutId = pHS->getID( "MIB_ABOUT" ); + SETCONST( pFlag, nAboutId, MIB_ABOUT ); + nHelpId = pHS->getID( "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->getID( "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->getID( "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->getID( "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->getID( "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->getID( "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 ) +{ + Atom nId; + RscTop * pClassMenu; + + // Klasse anlegen + nId = pHS->getID( "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->getID( "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 ) +{ + Atom nId; + RscTop * pClassMessBox; + + // Klasse anlegen + nId = pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassSplitter; + + // Klasse anlegen + nId = pHS->getID( "Splitter" ); + pClassSplitter = new RscClass( nId, RSC_SPLITTER, pSuper ); + pClassSplitter->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + aNmTb.Put( nId, CLASSNAME, pClassSplitter ); + + INS_WINBIT(pClassSplitter,HScroll); + INS_WINBIT(pClassSplitter,VScroll); + + return pClassSplitter; +} + +/************************************************************************* +|* RscTypCont::InitClassSplitWindow() +*************************************************************************/ +RscTop * RscTypCont::InitClassSplitWindow( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassSplitWindow; + + // Klasse anlegen + nId = pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassTime; + + // Klasse anlegen + nId = pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassDate; + + // Klasse anlegen + nId = pHS->getID( "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::InitClassPatternFormatter() +*************************************************************************/ +RscTop * RscTypCont::InitClassPatternFormatter( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassPattern; + + // Klasse anlegen + nId = pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassNumeric; + + // Klasse anlegen + nId = pHS->getID( "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( "DecimalDigits", VARNAME ); + pClassNumeric->SetVariable( nId, &aUShort, NULL, + 0, NUMERICFORMATTER_DECIMALDIGITS ); + nId = aNmTb.Put( "Value", VARNAME ); + pClassNumeric->SetVariable( nId, &aIdLong, NULL, + 0, NUMERICFORMATTER_VALUE ); + nId = aNmTb.Put( "NoThousandSep", VARNAME ); + pClassNumeric->SetVariable( nId, &aBool, NULL, + 0, NUMERICFORMATTER_NOTHOUSANDSEP ); + + return pClassNumeric; +} + +/************************************************************************* +|* RscTypCont::InitClassMetricFormatter() +*************************************************************************/ +RscTop * RscTypCont::InitClassMetricFormatter( RscTop * pSuper, + RscEnum * pFieldUnits ) +{ + Atom nId; + RscTop * pClassMetric; + + // Klasse anlegen + nId = pHS->getID( "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 */) +{ + Atom nId; + RscTop * pClassCurrency; + + // Klasse anlegen + nId = pHS->getID( "CurrencyFormatter" ); + pClassCurrency = new RscClass( nId, RSC_NOTYPE, pSuper ); + pClassCurrency->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType ); + + return pClassCurrency; +} + +/************************************************************************* +|* RscTypCont::InitClassDateFormatter() +*************************************************************************/ +RscTop * RscTypCont::InitClassDateFormatter( RscTop * pSuper, + RscTop * pClassDate ) +{ + Atom nId; + RscTop * pClassDateF; + + // Klasse anlegen + nId = pHS->getID( "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( "Value", VARNAME ); + pClassDateF->SetVariable( nId, pClassDate, NULL, + 0, DATEFORMATTER_VALUE ); + + return pClassDateF; +} + +/************************************************************************* +|* RscTypCont::InitClassTimeFormatter() +*************************************************************************/ +RscTop * RscTypCont::InitClassTimeFormatter( RscTop * pSuper, + RscTop * pClassTime, + RscEnum * pTimeFieldFormat ) +{ + Atom nId; + RscTop * pClassTimeF; + + // Klasse anlegen + nId = pHS->getID( "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( "Value", VARNAME ); + pClassTimeF->SetVariable( nId, pClassTime, NULL, + 0, TIMEFORMATTER_VALUE ); + + return pClassTimeF; +} + +/************************************************************************* +|* RscTypCont::InitClassSpinField() +*************************************************************************/ +RscTop * RscTypCont::InitClassSpinField( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassSpinField; + + // Klasse anlegen + nId = pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassPatternField; + + // Klasse anlegen + nId = pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassNumericField; + + // Klasse anlegen + nId = pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassMetricField; + + // Klasse anlegen + nId = pHS->getID( "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, + sal_uInt32 nRT, + RscTop * pSuper +) +{ + Atom nId; + RscTop * pClassCurrencyField; + + // Klasse anlegen + nId = pHS->getID( 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 ) +{ + Atom nId; + RscTop * pClassDateField; + + // Klasse anlegen + nId = pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassTimeField; + + // Klasse anlegen + nId = pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassPatternBox; + + // Klasse anlegen + nId = pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassNumericBox; + + // Klasse anlegen + nId = pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassMetricBox; + + // Klasse anlegen + nId = pHS->getID( "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, + sal_uInt32 nRT, + RscTop * pSuper +) +{ + Atom nId; + RscTop * pClassCurrencyBox; + + // Klasse anlegen + nId = pHS->getID( 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*/ ) +{ + Atom nId; + RscTop * pClassDateBox; + + // Klasse anlegen + nId = pHS->getID( "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*/ ) +{ + Atom nId; + RscTop * pClassTimeBox; + + // Klasse anlegen + nId = pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassDockWindow; + + // Klasse anlegen + nId = pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassToolBoxItem; + + // Klasse anlegen + nId = pHS->getID( "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->getID( "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; + Atom l_nVarId, l_nAutoCheckId, l_nRadioCheckId, l_nCheckableId, l_nLeftId, l_nAutoSizeId, l_nDropDownId; + + aBaseLst.Insert( pFlag = new RscFlag( pHS->getID( "FlagToolBoxState" ), + RSC_NOTYPE ), + LIST_APPEND ); + + // Konstanten in Tabelle stellen + l_nCheckableId = pHS->getID( "TIB_CHECKABLE" ); + SETCONST( pFlag, l_nCheckableId, TIB_CHECKABLE ); + l_nAutoCheckId = pHS->getID( "TIB_AUTOCHECK" ); + SETCONST( pFlag, l_nAutoCheckId, TIB_AUTOCHECK ); + l_nRadioCheckId = pHS->getID( "TIB_RADIOCHECK" ); + SETCONST( pFlag, l_nRadioCheckId, TIB_RADIOCHECK ); + l_nLeftId = pHS->getID( "TIB_LEFT" ); + SETCONST( pFlag, l_nLeftId, TIB_LEFT ); + l_nAutoSizeId = pHS->getID( "TIB_AUTOSIZE" ); + SETCONST( pFlag, l_nAutoSizeId, TIB_AUTOSIZE ); + l_nDropDownId = pHS->getID( "TIB_DROPDOWN" ); + SETCONST( pFlag, l_nDropDownId, TIB_DROPDOWN ); + + // Variable einfuegen + l_nVarId = aNmTb.Put( "_ToolBoxItemFlags", VARNAME ); + pClassToolBoxItem->SetVariable( l_nVarId, pFlag, NULL, + VAR_HIDDEN | VAR_NOENUM, + RSC_TOOLBOXITEM_STATUS ); + + // Clientvariablen einfuegen + aBaseLst.Insert( + pClient = new RscClient( pHS->getID( "BOOL" ), RSC_NOTYPE, + pFlag, l_nCheckableId ), LIST_APPEND ); + nId = aNmTb.Put( "Checkable", VARNAME ); + pClassToolBoxItem->SetVariable( nId, pClient, NULL, VAR_NODATAINST, 0, l_nVarId ); + + aBaseLst.Insert( + pClient = new RscClient( pHS->getID( "BOOL" ), RSC_NOTYPE, + pFlag, l_nAutoCheckId ), LIST_APPEND ); + nId = aNmTb.Put( "AutoCheck", VARNAME ); + pClassToolBoxItem->SetVariable( nId, pClient, NULL, VAR_NODATAINST, 0, l_nVarId ); + + aBaseLst.Insert( + pClient = new RscClient( pHS->getID( "BOOL" ), RSC_NOTYPE, + pFlag, l_nRadioCheckId ), LIST_APPEND ); + nId = aNmTb.Put( "RadioCheck", VARNAME ); + pClassToolBoxItem->SetVariable( nId, pClient, NULL, VAR_NODATAINST, 0, l_nVarId ); + + aBaseLst.Insert( + pClient = new RscClient( pHS->getID( "BOOL" ), RSC_NOTYPE, + pFlag, l_nLeftId ), LIST_APPEND ); + nId = aNmTb.Put( "Left", VARNAME ); + pClassToolBoxItem->SetVariable( nId, pClient, NULL, VAR_NODATAINST, 0, l_nVarId ); + + aBaseLst.Insert( + pClient = new RscClient( pHS->getID( "BOOL" ), RSC_NOTYPE, + pFlag, l_nAutoSizeId ), LIST_APPEND ); + nId = aNmTb.Put( "AutoSize", VARNAME ); + pClassToolBoxItem->SetVariable( nId, pClient, NULL, VAR_NODATAINST, 0, l_nVarId ); + + aBaseLst.Insert( + pClient = new RscClient( pHS->getID( "BOOL" ), RSC_NOTYPE, + pFlag, l_nDropDownId ), LIST_APPEND ); + nId = aNmTb.Put( "DropDown", VARNAME ); + pClassToolBoxItem->SetVariable( nId, pClient, NULL, VAR_NODATAINST, 0, l_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 ) +{ + Atom nId; + RscTop * pClassToolBox; + + // Klasse anlegen + nId = pHS->getID( "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->getID( "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->getID( "EnumToolBoxAlign" ), + RSC_NOTYPE ), LIST_APPEND ); + SETCONST( pEnum, "BOXALIGN_TOP", WINDOWALIGN_TOP ); + SETCONST( pEnum, "BOXALIGN_LEFT", WINDOWALIGN_LEFT ); + SETCONST( pEnum, "BOXALIGN_RIGHT", WINDOWALIGN_RIGHT ); + SETCONST( pEnum, "BOXALIGN_BOTTOM", WINDOWALIGN_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 ); + { + RscLangArray* pLA; + RscCont * pCont; + + aBaseLst.Insert( pCont = new RscCont( pHS->getID( "ContToolBoxItem" ), + RSC_NOTYPE ), + LIST_APPEND ); + pCont->SetTypeClass( pClassToolBoxItem ); + aBaseLst.Insert( pLA = new RscLangArray( pHS->getID( "LangContToolBoxItem" ), + RSC_NOTYPE, + pCont, + &aLangType ), + LIST_APPEND ); + nId = aNmTb.Put( "ItemList", VARNAME ); + pClassToolBox->SetVariable( nId, pLA, NULL, 0, + RSC_TOOLBOX_ITEMLIST ); + } + INS_WINBIT(pClassToolBox,Scroll) + INS_WINBIT(pClassToolBox,LineSpacing) + INS_WINBIT(pClassToolBox,RectStyle) + INS_WINBIT(pClassToolBox,Tabstop) + + return pClassToolBox; +} + +/************************************************************************* +|* RscTypCont::InitClassStatusBar() +*************************************************************************/ +RscTop * RscTypCont::InitClassStatusBar( RscTop * pSuper ) +{ + Atom nId; + RscTop * pClassStatusBar; + + // Klasse anlegen + nId = pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassMoreButton; + + // Klasse anlegen + nId = pHS->getID( "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 ) +{ + Atom nId; + RscTop * pClassFloatingWindow; + + // Klasse anlegen + nId = pHS->getID( "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*/ ) +{ + Atom nId; + RscTop * pClassTabControlItem; + + // Klasse anlegen + nId = pHS->getID( "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, &aIdLong, NULL, 0, + RSC_TABCONTROLITEM_PAGERESID ); + + return pClassTabControlItem; +} + +/************************************************************************* +|* RscTypCont::InitClassTabControl() +*************************************************************************/ +RscTop * RscTypCont::InitClassTabControl( RscTop * pSuper, + RscTop * pClassTabControlItem ) +{ + Atom nId; + RscTop * pClassTabControl; + + // Klasse anlegen + nId = pHS->getID( "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->getID( "ContTabControlItem" ), + RSC_NOTYPE ), + LIST_APPEND ); + pCont->SetTypeClass( pClassTabControlItem ); + nId = aNmTb.Put( "PageList", VARNAME ); + pClassTabControl->SetVariable( nId, pCont, NULL, 0, + RSC_TABCONTROL_ITEMLIST ); + + INS_WINBIT( pClassTabControl, SingleLine ); + INS_WINBIT( pClassTabControl, DropDown ); + } + + return pClassTabControl; +} + +/************************************************************************* +|* RscTypCont::InitClassSfxFamilyStyleItem() +*************************************************************************/ +RscTop * RscTypCont::InitClassSfxStyleFamilyItem( RscTop * pSuper, + RscTop * pClassBitmap, + RscTop * pClassImage, + RscArray * pStrLst ) +{ + Atom nId; + RscTop * pClassSfxFamilyStyleItem; + + // Klasse anlegen + nId = pHS->getID( "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->getID( "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 ) +{ + Atom nId; + RscTop * pClassSfxTemplateDialog; + + // Klasse anlegen + nId = pHS->getID( "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->getID( "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 ) +{ + Atom nId; + RscTop * pClassSfxSlotInfo; + + // Klasse anlegen + nId = pHS->getID( "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..c2908cafe95a --- /dev/null +++ b/rsc/source/parser/rscinit.cxx @@ -0,0 +1,944 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscinit.cxx,v $ + * $Revision: 1.18 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" + +/****************** I N C L U D E S **************************************/ +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> + +#include <tools/rc.h> + +#include <vclrsc.hxx> + +// Programmabhaengige Includes. +#include <rsctree.hxx> +#include <rsctop.hxx> +#include <rscrange.hxx> +#include <rscconst.hxx> +#include <rscflag.hxx> +#include <rscstr.hxx> +#include <rsccont.hxx> +#include <rscmgr.hxx> +#include <rscclass.hxx> +#include <rsckey.hxx> +#include <rscdb.hxx> + +#include "rsclex.hxx" +#include <yyrscyacc.hxx> + +/****************** 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->getID( "TEXT" ), + RSCINST() ); + aStr.pClass->SetString( aStr, pHS->getString( pClass->GetId() ).getStr() ); + } + NameToVerCtrl( aVersion, (RscTop *)pClass->Right(), pClassString ); + } +} + +/************************************************************************* +|* +|* RscTypCont::Init() +|* +|* Beschreibung +|* Ersterstellung MM 22.03.91 +|* Letzte Aenderung MM 27.06.91 +|* +*************************************************************************/ +void RscTypCont::Init() +{ + RscEnum * pFieldUnits; + 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 * 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; + + Atom nId; + + aNmTb.SetSort( FALSE ); +{ + /********** C O M P I L E R T Y P E N ******************************/ + aNmTb.Put( "LINE", LINE, (long)0 ); + aNmTb.Put( "NOT", NOT, (long)0 ); + aNmTb.Put( "DEFINE", DEFINE, (long)0 ); + aNmTb.Put( "INCLUDE", INCLUDE, (long)0 ); + aNmTb.Put( "DEFAULT", DEFAULT, (long)0 ); + aNmTb.Put( "class", CLASS, (long)0 ); + aNmTb.Put( "extendable", EXTENDABLE, (long)0 ); + aNmTb.Put( "writeifset", WRITEIFSET, (long)0 ); + +/* Werte fuer Aufzaehlungstypen */ + aNmTb.Put( "TRUE", BOOLEAN, (long)TRUE ); + aNmTb.Put( "FALSE", BOOLEAN, (long)FALSE ); + +/* Vordefinierte HilfeId's */ + aNmTb.Put( "HELP_INDEX", NUMBER, OOO_HELP_INDEX ); + aNmTb.Put( "HELP_HELPONHELP", NUMBER, OOO_HELP_HELPONHELP ); + + aNmTb.Put( "XSCALE", XSCALE , (long)0 ); + aNmTb.Put( "YSCALE", YSCALE , (long)0 ); + aNmTb.Put( "RGB", RGB , (long)0 ); + aNmTb.Put( "POSSIZE", GEOMETRY, (long)0 ); + aNmTb.Put( "POS", POSITION, (long)0 ); + aNmTb.Put( "SIZE", DIMENSION, (long)0 ); + aNmTb.Put( "ZoomInOutputSize", INZOOMOUTPUTSIZE,(long)0 ); + aNmTb.Put( "FloatingPos", 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( SAL_MIN_INT32, SAL_MAX_INT32 ); + aEnumLong.SetRange( SAL_MIN_INT32, SAL_MAX_INT32 ); + + /********** 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( SAL_MIN_INT32, SAL_MAX_INT32 ); +} +{ + /********** W I N B I T S F L A G ************************************/ + // Variablenname fuer WinBits + nWinBitVarId = aNmTb.Put( "_WinBits", VARNAME ); + + // Windows + nBorderId = pHS->getID( "WB_BORDER" ); + aWinBits.SetConstant( nBorderId, sal::static_int_cast<INT32>(WB_BORDER) ); + nHideId = pHS->getID( "WB_HIDE" ); + aWinBits.SetConstant( nHideId, sal::static_int_cast<INT32>(WB_HIDE) ); + nClipChildrenId = pHS->getID( "WB_CLIPCHILDREN" ); + aWinBits.SetConstant( nClipChildrenId, sal::static_int_cast<INT32>(WB_CLIPCHILDREN) ); + nSizeableId = pHS->getID( "WB_SIZEABLE" ); + aWinBits.SetConstant( nSizeableId, sal::static_int_cast<INT32>(WB_SIZEABLE) ); + nMoveableId = pHS->getID( "WB_MOVEABLE" ); + aWinBits.SetConstant( nMoveableId, sal::static_int_cast<INT32>(WB_MOVEABLE) ); + nMinimizeId = pHS->getID( "WB_MINABLE" ); + aWinBits.SetConstant( nMinimizeId, 0 /*WB_MINABLE*/ ); + nMaximizeId = pHS->getID( "WB_MAXABLE" ); + aWinBits.SetConstant( nMaximizeId, 0 /*WB_MAXABLE*/ ); + nCloseableId = pHS->getID( "WB_CLOSEABLE" ); + aWinBits.SetConstant( nCloseableId, sal::static_int_cast<INT32>(WB_CLOSEABLE) ); + nAppId = pHS->getID( "WB_APP" ); + aWinBits.SetConstant( nAppId, sal::static_int_cast<INT32>(WB_APP) ); + nTabstopId = pHS->getID( "WB_TABSTOP" ); + aWinBits.SetConstant( nTabstopId, sal::static_int_cast<INT32>(WB_TABSTOP) ); + nGroupId = pHS->getID( "WB_GROUP" ); + aWinBits.SetConstant( nGroupId, sal::static_int_cast<INT32>(WB_GROUP) ); + nSysmodalId = pHS->getID( "WB_SYSMODAL" ); + aWinBits.SetConstant( nSysmodalId, 0 /*WB_SYSMODAL*/ ); +} +{ + nLeftId = pHS->getID( "WB_LEFT" ); + aWinBits.SetConstant( nLeftId, sal::static_int_cast<INT32>(WB_LEFT) ); + nCenterId = pHS->getID( "WB_CENTER" ); + aWinBits.SetConstant( nCenterId, sal::static_int_cast<INT32>(WB_CENTER) ); + nRightId = pHS->getID( "WB_RIGHT" ); + aWinBits.SetConstant( nRightId, sal::static_int_cast<INT32>(WB_RIGHT) ); + nTopId = pHS->getID( "WB_TOP" ); + aWinBits.SetConstant( nTopId, sal::static_int_cast<INT32>(WB_TOP) ); + nVCenterId = pHS->getID( "WB_VCENTER" ); + aWinBits.SetConstant( nVCenterId, sal::static_int_cast<INT32>(WB_VCENTER) ); + nBottomId = pHS->getID( "WB_BOTTOM" ); + aWinBits.SetConstant( nBottomId, sal::static_int_cast<INT32>(WB_BOTTOM) ); + nHScrollId = pHS->getID( "WB_HSCROLL" ); + aWinBits.SetConstant( nHScrollId, sal::static_int_cast<INT32>(WB_HSCROLL) ); + nVScrollId = pHS->getID( "WB_VSCROLL" ); + aWinBits.SetConstant( nVScrollId, sal::static_int_cast<INT32>(WB_VSCROLL) ); + nSortId = pHS->getID( "WB_SORT" ); + aWinBits.SetConstant( nSortId, sal::static_int_cast<INT32>(WB_SORT) ); + nDefaultId = pHS->getID( "WB_DEFBUTTON" ); + aWinBits.SetConstant( nDefaultId, sal::static_int_cast<INT32>(WB_DEFBUTTON) ); + nRepeatId = pHS->getID( "WB_REPEAT" ); + aWinBits.SetConstant( nRepeatId, sal::static_int_cast<INT32>(WB_REPEAT) ); + nSVLookId = pHS->getID( "WB_SVLOOK" ); + aWinBits.SetConstant( nSVLookId, sal::static_int_cast<INT32>(WB_3DLOOK) ); + nDropDownId = pHS->getID( "WB_DROPDOWN" ); + aWinBits.SetConstant( nDropDownId, sal::static_int_cast<INT32>(WB_DROPDOWN) ); + nPassWordId = pHS->getID( "WB_PASSWORD" ); + aWinBits.SetConstant( nPassWordId, sal::static_int_cast<INT32>(WB_PASSWORD) ); + nReadOnlyId = pHS->getID( "WB_READONLY" ); + aWinBits.SetConstant( nReadOnlyId, sal::static_int_cast<INT32>(WB_READONLY) ); + nAutoSizeId = pHS->getID( "WB_AUTOSIZE" ); + aWinBits.SetConstant( nAutoSizeId, sal::static_int_cast<INT32>(WB_AUTOSIZE) ); + nSpinId = pHS->getID( "WB_SPIN" ); + aWinBits.SetConstant( nSpinId, sal::static_int_cast<INT32>(WB_SPIN) ); + nTabControlId = pHS->getID( "WB_DIALOGCONTROL" ); + aWinBits.SetConstant( nTabControlId, sal::static_int_cast<INT32>(WB_DIALOGCONTROL) ); + nSimpleModeId = pHS->getID( "WB_SIMPLEMODE" ); + aWinBits.SetConstant( nSimpleModeId, sal::static_int_cast<INT32>(WB_SIMPLEMODE) ); + nDragId = pHS->getID( "WB_DRAG" ); + aWinBits.SetConstant( nDragId, sal::static_int_cast<INT32>(WB_DRAG) ); + nScrollId = pHS->getID( "WB_SCROLL" ); + aWinBits.SetConstant( nScrollId, sal::static_int_cast<INT32>(WB_SCROLL) ); + nZoomableId = pHS->getID( "WB_ZOOMABLE" ); + aWinBits.SetConstant( nZoomableId, sal::static_int_cast<INT32>(WB_ROLLABLE) ); + nHideWhenDeactivateId = pHS->getID( "WB_HIDEWHENDEACTIVATE" ); + aWinBits.SetConstant( nHideWhenDeactivateId, 0 /*WB_HIDEWHENDEACTIVATE*/ ); + nAutoHScrollId = pHS->getID( "WB_AUTOHSCROLL" ); + aWinBits.SetConstant( nAutoHScrollId, sal::static_int_cast<INT32>(WB_AUTOHSCROLL) ); + nAutoVScrollId = pHS->getID( "WB_AUTOVSCROLL" ); + aWinBits.SetConstant( nAutoVScrollId, sal::static_int_cast<INT32>(WB_AUTOVSCROLL) ); + nDDExtraWidthId = pHS->getID( "WB_DDEXTRAWIDTH" ); + aWinBits.SetConstant( nDDExtraWidthId, 0 /*WB_DDEXTRAWIDTH*/ ); + nWordBreakId = pHS->getID( "WB_WORDBREAK" ); + aWinBits.SetConstant( nWordBreakId, sal::static_int_cast<INT32>(WB_WORDBREAK) ); + nLeftLabelId = pHS->getID( "WB_LEFTLABEL" ); + aWinBits.SetConstant( nLeftLabelId, 0 /*WB_LEFTLABEL*/ ); + nHasLinesId = pHS->getID( "WB_HASLINES" ); + aWinBits.SetConstant( nHasLinesId, sal::static_int_cast<INT32>(WB_HASLINES) ); + nHasButtonsId = pHS->getID( "WB_HASBUTTONS" ); + aWinBits.SetConstant( nHasButtonsId, sal::static_int_cast<INT32>(WB_HASBUTTONS) ); + nRectStyleId = pHS->getID( "WB_RECTSTYLE" ); + aWinBits.SetConstant( nRectStyleId, sal::static_int_cast<INT32>(WB_RECTSTYLE) ); + nLineSpacingId = pHS->getID( "WB_LINESPACING" ); + aWinBits.SetConstant( nLineSpacingId, sal::static_int_cast<INT32>(WB_LINESPACING) ); + nSmallStyleId = pHS->getID( "WB_SMALLSTYLE" ); + aWinBits.SetConstant( nSmallStyleId, sal::static_int_cast<INT32>(WB_SMALLSTYLE) ); + nEnableResizingId = pHS->getID( "WB_ENABLERESIZING" ); + aWinBits.SetConstant( nEnableResizingId, 0 /*WB_ENABLERESIZING*/ ); + nDockableId = pHS->getID( "WB_DOCKABLE" ); + aWinBits.SetConstant( nDockableId, sal::static_int_cast<INT32>(WB_DOCKABLE) ); + nScaleId = pHS->getID( "WB_SCALE" ); + aWinBits.SetConstant( nScaleId, sal::static_int_cast<INT32>(WB_SCALE) ); + nIgnoreTabId = pHS->getID( "WB_IGNORETAB" ); + aWinBits.SetConstant( nIgnoreTabId, sal::static_int_cast<INT32>(WB_IGNORETAB) ); + nNoSplitDrawId = pHS->getID( "WB_NOSPLITDRAW" ); + aWinBits.SetConstant( nNoSplitDrawId, sal::static_int_cast<INT32>(WB_NOSPLITDRAW) ); + nTopImageId = pHS->getID( "WB_TOPIMAGE" ); + aWinBits.SetConstant( nTopImageId, sal::static_int_cast<INT32>(WB_TOPIMAGE) ); + nNoLabelId = pHS->getID( "WB_NOLABEL" ); + aWinBits.SetConstant( nNoLabelId, sal::static_int_cast<INT32>(WB_NOLABEL) ); + nVertId = pHS->getID( "WB_VERT" ); + aWinBits.SetConstant( nVertId, sal::static_int_cast<INT32>(WB_VERT) ); + nSingleLineId = pHS->getID( "WB_SINGLELINE" ); + aWinBits.SetConstant( nSingleLineId, sal::static_int_cast<INT32>(WB_SINGLELINE) ); + nSysWinId = pHS->getID( "WB_SYSTEMWINDOW" ); + aWinBits.SetConstant( nSysWinId, sal::static_int_cast<INT32>(WB_SYSTEMWINDOW) ); +} +{ + /********** I n i t B a s i c T y p e s **************************/ + InitLangType(); + aBaseLst.Insert( pFieldUnits = InitFieldUnitsType(), 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->getID( "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->getID( "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, pStringLongTupelList ); + 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->getID( "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->getID( "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 ******************************************/ + pClassCheckBox = InitClassCheckBox( pClassButton ); + pRoot->Insert( pClassCheckBox ); + + /********** 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->getID( "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->getID( "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->getID( "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 ************************************/ + pClassRadioButton = InitClassRadioButton( pClassButton ); + pRoot->Insert( pClassRadioButton ); + + /********** I m a g e R a d i o B u t t o n **************************/ + nId = pHS->getID( "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->getID( "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->getID( "LangKeyCode" ), + RSC_KEYCODE, pClassKeyCode, &aLangType ); + 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 ); + nAcceleratorType = pClassAccel->GetId(); + + /********** 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->getID( "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->getID( "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->getID( "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->getID( "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->getID( "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->getID( "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 ); + pRoot->Insert( pClassDate ); +} +{ + /********** 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 ); + 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 ); + 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 ); + 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 ); + 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, + 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 ); + 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 ); + 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 ); + 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 ); + 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, + 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->getID( "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->getID( "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->getID( "FixedLine" ); + pClassFixedLine = + new RscClass( nId, RSC_FIXEDLINE, pClassControl ); + pClassFixedLine->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType ); + + INS_WINBIT(pClassFixedLine,Vert) + + aNmTb.Put( nId, CLASSNAME, pClassFixedLine ); + pRoot->Insert( pClassFixedLine ); + + /********** S C R O L L B A R B O X **********************************/ + // Klasse anlegen + nId = pHS->getID( "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..5baba631174e --- /dev/null +++ b/rsc/source/parser/rsckey.cxx @@ -0,0 +1,217 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rsckey.cxx,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +/****************** I N C L U D E S **************************************/ +#include <stdlib.h> +#include <stdio.h> +#include <ctype.h> +#include <string.h> +#include <rscall.h> +#include <rsctools.hxx> +#include <rschash.hxx> +#include <rsckey.hxx> + +#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 ) + rtl_freeMemory( 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 +|* +*************************************************************************/ +Atom RscNameTable::Put( Atom nName, sal_uInt32 nTyp, long nValue ){ + if( pTable ) + pTable = (KEY_STRUCT *) + rtl_reallocateMemory( (void *)pTable, + ((nEntries +1) * sizeof( KEY_STRUCT )) ); + else + pTable = (KEY_STRUCT *) + rtl_allocateMemory( ((nEntries +1) + * sizeof( KEY_STRUCT )) ); + pTable[ nEntries ].nName = nName; + pTable[ nEntries ].nTyp = nTyp; + pTable[ nEntries ].yylval = nValue; + nEntries++; + if( bSort ) + SetSort(); + return( nName ); +}; + +Atom RscNameTable::Put( const char * pName, sal_uInt32 nTyp, long nValue ) +{ + return( Put( pHS->getID( pName ), nTyp, nValue ) ); +}; + +Atom RscNameTable::Put( Atom nName, sal_uInt32 nTyp ) +{ + return( Put( nName, nTyp, (long)nName ) ); +}; + +Atom RscNameTable::Put( const char * pName, sal_uInt32 nTyp ) +{ + Atom nId; + + nId = pHS->getID( pName ); + return( Put( nId, nTyp, (long)nId ) ); +}; + +Atom RscNameTable::Put( Atom nName, sal_uInt32 nTyp, RscTop * pClass ) +{ + return( Put( nName, nTyp, (long)pClass ) ); +}; + +Atom RscNameTable::Put( const char * pName, sal_uInt32 nTyp, RscTop * pClass ) +{ + return( Put( pHS->getID( pName ), nTyp, (long)pClass ) ); +}; + +/************************************************************************* +|* +|* RscNameTable::Get() +|* +|* Beschreibung RES.DOC +|* Ersterstellung MM 28.02.91 +|* Letzte Aenderung MM 28.02.91 +|* +*************************************************************************/ +BOOL RscNameTable::Get( Atom nName, KEY_STRUCT * pEle ){ + KEY_STRUCT * pKey = NULL; + KEY_STRUCT aSearchName; + sal_uInt32 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..8c34637fa304 --- /dev/null +++ b/rsc/source/parser/rsclex.cxx @@ -0,0 +1,445 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rsclex.cxx,v $ + * $Revision: 1.13 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <ctype.h> +#include <limits.h> + +#ifdef _RSCERROR_H +#include <rscerror.h> +#endif +#include <rschash.hxx> +#include <rscdb.hxx> +#include <rsctop.hxx> +#include <rsckey.hxx> +#include <rscpar.hxx> +#include <rscdef.hxx> + +#include "rsclex.hxx" +#include <yyrscyacc.hxx> + +#include <rtl/textcvt.h> +#include <rtl/textenc.h> + +using namespace rtl; + +const char* StringContainer::putString( const char* pString ) +{ + OString aString( static_cast<const sal_Char*>(pString) ); + std::pair< + std::hash_set< OString, OStringHash >::iterator, + bool > aInsert = + m_aStrings.insert( aString ); + + return aInsert.first->getStr(); +} + +/*************************************************************************/ +int c; +BOOL bLastInclude;// War letztes Symbol INCLUDE +RscFileInst* pFI; +RscTypCont* pTC; +RscExpression * pExp; +struct KeyVal { + int nKeyWord; + YYSTYPE aYYSType; +} aKeyVal[ 1 ]; +BOOL bTargetDefined; + +StringContainer* pStringContainer = NULL; + + +/****************** C O D E **********************************************/ +UINT32 GetNumber(){ + UINT32 l = 0; + UINT32 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 > 0x7fffffff ) //Oberstes bit gegebenenfalls abschneiden; + l &= 0x7fffffff; + + return( l ); +} + +int MakeToken( YYSTYPE * pTokenVal ){ + int c1; + 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 ){ + OStringBuffer aBuf( 256 ); + c = pFI->GetFastChar(); + while( '>' != c && !pFI->IsEof() ) + { + aBuf.append( sal_Char(c) ); + c = pFI->GetFastChar(); + }; + c = pFI->GetFastChar(); + pTokenVal->string = const_cast<char*>(pStringContainer->putString( aBuf.getStr() )); + return( INCLUDE_STRING ); + }; + } + + if( c == '"' ) + { + OStringBuffer aBuf( 256 ); + BOOL bDone = FALSE; + while( !bDone && !pFI->IsEof() && c ) + { + c = pFI->GetFastChar(); + if( c == '"' ) + { + c = pFI->GetFastChar(); + if( c == '"' ) + { + aBuf.append( '"' ); + aBuf.append( '"' ); + } + else + bDone = TRUE; + } + else if( c == '\\' ) + { + aBuf.append( '\\' ); + c = pFI->GetFastChar(); + if( c ) + aBuf.append( sal_Char(c) ); + } + else + aBuf.append( sal_Char(c) ); + } + pStr = pTokenVal->string = const_cast<char*>(pStringContainer->putString( aBuf.getStr() )); + return( STRING ); + } + if (isdigit (c)){ + pTokenVal->value = GetNumber(); + return( NUMBER ); + } + + if( isalpha (c) || (c == '_') ){ + Atom nHashId; + OStringBuffer aBuf( 256 ); + + while( isalnum (c) || (c == '_') || (c == '-') ) + { + aBuf.append( sal_Char(c) ); + c = pFI->GetFastChar(); + } + + nHashId = pHS->getID( aBuf.getStr(), true ); + if( InvalidAtom != 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; + }; + + return( aKey.nTyp ); + } + else + { + pTokenVal->string = const_cast<char*>(pStringContainer->putString( aBuf.getStr() )); + return( SYMBOL ); + } + } + else{ // Symbol + RscDefine * pDef; + + pDef = pTC->aFileTab.FindDef( aBuf.getStr() ); + if( pDef ){ + pTokenVal->defineele = pDef; + + return( RSCDEFINE ); + } + + pTokenVal->string = const_cast<char*>(pStringContainer->putString( aBuf.getStr() )); + 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 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; + pStringContainer = new StringContainer(); + pExp = NULL; //fuer MacroParser + bTargetDefined = FALSE; + + // Anfangszeichen initialisieren + bLastInclude = FALSE; + c = pFI->GetFastChar(); +} + +void EndParser(){ + // Stack abraeumen + while( ! S.IsEmpty() ) + S.Pop(); + + // free string container + delete pStringContainer; + pStringContainer = NULL; + + if( pExp ) + delete pExp; + pTC = NULL; + pFI = 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 ); + }; + }; + }; + nToken = MakeToken( &aYYSType ); + }; + + EndParser(); +} + +ERRTYPE parser( RscFileInst * pFileInst ) +{ + ERRTYPE aError; + + InitParser( pFileInst ); + + aError = yyparse(); + + EndParser(); + + // yyparser gibt 0 zurueck, wenn erfolgreich + if( 0 == 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 == 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..63afd0b208c7 --- /dev/null +++ b/rsc/source/parser/rsclex.hxx @@ -0,0 +1,131 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rsclex.hxx,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include <tools/stack.hxx> + +#include <hash_set> +#include <rtl/strbuf.hxx> +#include <rtl/string.hxx> + +// a buffer for unique strings +class StringContainer +{ + std::hash_set< rtl::OString, rtl::OStringHash > m_aStrings; +public: + StringContainer() {} + ~StringContainer() {} + + const char* putString( const char* pString ); +}; + + +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; +}; + +/************** O b j e c t s t a c k ************************************/ +struct Node { + Node* pPrev; + RSCINST aInst; + sal_uInt32 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--; } + sal_uInt32 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 ( 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 ) || (_MSC_VER >= 1400) +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; + +extern RscTypCont* pTC; +extern RscFileInst * pFI; +extern RscExpression * pExp; +extern ObjectStack S; +extern StringContainer* pStringContainer; diff --git a/rsc/source/parser/rscpar.cxx b/rsc/source/parser/rscpar.cxx new file mode 100644 index 000000000000..dcee424bfdce --- /dev/null +++ b/rsc/source/parser/rscpar.cxx @@ -0,0 +1,242 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscpar.cxx,v $ + * $Revision: 1.9 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +/****************** I N C L U D E S **************************************/ +// C and C++ Includes. +#include <string.h> +#include <rscpar.hxx> +#include <rscdb.hxx> + +/****************** 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() +{ + nLineNo = 0; + nLineBufLen = 256; + pLine = (char *)rtl_allocateMemory( 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 ) +{ + pTypCont = pTC; + Init(); + + lFileIndex = lFIndex; + lSrcIndex = lIndexSrc; + fInputFile = fFile; + + //Status: Zeiger am Ende des Lesepuffers + nInputPos = nInputEndPos = nInputBufLen = READBUFFER_MAX; + pInput = (char *)rtl_allocateMemory( nInputBufLen ); +} + +RscFileInst::RscFileInst( RscTypCont * pTC, ULONG lIndexSrc, + ULONG lFIndex, const ByteString& rBuf ) +{ + pTypCont = pTC; + Init(); + lFileIndex = lFIndex; + lSrcIndex = lIndexSrc; + fInputFile = NULL; + nInputPos = 0; + nInputEndPos = rBuf.Len(); + + // Muss groesser sein wegen Eingabeende bei nInputBufLen < nInputEndPos + nInputBufLen = nInputEndPos +1; + pInput = (char *)rtl_allocateMemory( 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 ) + rtl_freeMemory( pInput ); + if( pLine ) + rtl_freeMemory( 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 + sal_uInt32 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 = (char*)rtl_reallocateMemory( 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++ ]; + if( nLen > 2 ) + { + if( (unsigned char)pLine[nLen-3] == 0xef && + (unsigned char)pLine[nLen-2] == 0xbb && + (unsigned char)pLine[nLen-1] == 0xbf ) + { + nLen -= 3; + } + } + } + }; + }; + + // Abbruch ueber EOF + pLine[ nLen ] = '\0'; + +END: + if( pTypCont->pEH->GetListFile() ){ + char buf[ 10 ]; + + sprintf( buf, "%5d ", (int)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..8da3de9bf2b3 --- /dev/null +++ b/rsc/source/parser/rscyacc.cxx @@ -0,0 +1,274 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscyacc.cxx,v $ + * $Revision: 1.10 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +#include <stdio.h> +#include <ctype.h> +#include <string.h> + +#include <tools/rc.h> +#include <rscerror.h> +#include <rsctools.hxx> +#include <rscclass.hxx> +#include <rsccont.hxx> +#include <rsctree.hxx> +#include <rscdb.hxx> +#include <rscdef.hxx> +#include <rscpar.hxx> + +#include "rsclex.hxx" + +/************** V a r i a b l e n ****************************************/ +ObjectStack S; +RscTop * pCurClass; +sal_uInt32 nCurMask; +char szErrBuf[ 100 ]; + +/************** H i l f s F u n k t i o n e n ****************************/ +RSCINST GetVarInst( const RSCINST & rInst, const char * pVarName ) +{ + RSCINST aInst; + + aInst = rInst.pClass->GetVariable( rInst, pHS->getID( pVarName ), + RSCINST() ); + + if( !aInst.pData ) + pTC->pEH->Error( ERR_NOVARIABLENAME, rInst.pClass, RscId() ); + + return( aInst ); +} + +void SetNumber( const RSCINST & rInst, const char * pVarName, INT32 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, const char * pVarName, + Atom nValueId, INT32 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, const char * pVarName, const 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() ){ + INT32 lValue; + + if( !aExpType.Evaluate( &lValue ) ) + pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() ); + if( lValue < 1 || lValue > (INT32)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->getString( 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->getString( pHeader->pClass->GetId() ) ); + } + else + { + if( S.IsEmpty() ) + { + if( (INT32)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( ".", RscVerbosityVerbose ); + + 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( (INT32)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 == aError ) + pTC->pEH->Error( aError, S.Top().pClass, aName1, + pHS->getString( 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_Atom 0 +#define TYPE_RESID 1 + +#ifdef UNX +#define YYMAXDEPTH 2000 +#else +#ifdef W30 +#define YYMAXDEPTH 300 +#else +#define YYMAXDEPTH 800 +#endif +#endif + +#if defined _MSC_VER +#pragma warning(push, 1) +#pragma warning(disable:4129 4273 4701) +#endif +#include "yyrscyacc.cxx" +#if defined _MSC_VER +#pragma warning(pop) +#endif + diff --git a/rsc/source/parser/rscyacc.y b/rsc/source/parser/rscyacc.y new file mode 100644 index 000000000000..032e77517799 --- /dev/null +++ b/rsc/source/parser/rscyacc.y @@ -0,0 +1,1121 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: header.hxx,v $ + * $Revision: 1.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +%{ +#if defined __GNUC__ +#pragma GCC system_header +#elif defined __SUNPRO_CC +#pragma disable_warn +#endif +%} + +/* Compilerstack */ + +%union { + Atom varid; + struct { + Atom hashid; + INT32 nValue; + } constname; + RscTop * pClass; + RSCHEADER header; + struct { + CLASS_DATA pData; + RscTop * pClass; + } instance; + INT32 value; + USHORT ushort; + short exp_short; + char * string; + BOOL svbool; + REF_ENUM copyref; + RscDefine * defineele; + CharSet charset; + RscExpType macrostruct; +} + +/* Token */ +%token <value> NUMBER +%token <string> SYMBOL +%token <defineele> RSCDEFINE +%token <string> STRING +%token <string> INCLUDE_STRING +%token <character> CHARACTER +%token <svbool> BOOLEAN + +%token LINE +%token AUTO_ID +%token NOT +%token XSCALE +%token YSCALE +%token RGB +%token GEOMETRY +%token POSITION +%token DIMENSION +%token INZOOMOUTPUTSIZE +%token FLOATINGPOS +%token DEFINE +%token INCLUDE +%token MACROTARGET +%token DEFAULT + + +%token <pClass> CLASSNAME +%token <varid> VARNAME +%token <constname> CONSTNAME +%token CLASS +%token EXTENDABLE +%token WRITEIFSET + + +%type <macrostruct> macro_expression +%type <macrostruct> id_expression +%type <value> long_expression +%type <string> string_multiline + +%type <pClass> type +%type <pClass> type_base +%type <header> class_header_body +%type <header> class_header +%type <header> var_header_class +%type <copyref> copy_ref +%type <ushort> type_flags + + +%left '|' +%left '&' +%left LEFTSHIFT RIGHTSHIFT +%left '+' '-' +%left '*' '/' +%left UNARYMINUS +%left UNARYPLUS +%left ',' +%left '(' ')' + + +/* Grammatik */ + +%start resource_definitions + +%% + +/********************** D E F I N I T I O N S ****************************/ +resource_definitions + : + | resource_definitions resource_definition + | MACROTARGET macro_expression + { + RscExpType aExpType; + INT32 lValue; + + aExpType.cType = RSCEXP_NOTHING; + pExp = new RscExpression( aExpType, '+', $2 ); + if( !pExp->Evaluate( &lValue ) ) + pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() ); + } + ; + +resource_definition + : line_number + | '#' DEFINE SYMBOL macro_expression + { + BOOL bError = FALSE; + + if( $4.IsNumber() ){ + if( !pTC->aFileTab.NewDef( pFI->GetFileIndex(), + ByteString( $3 ), + $4.GetLong(), LIST_APPEND ) ) + bError = TRUE; + } + else if( $4.IsDefinition() ){ + RscExpType aExpType; + RscExpression * pExpr; + + aExpType.cType = RSCEXP_NOTHING; + aExpType.SetLong( 0 ); + aExpType.cType = RSCEXP_LONG; + pExpr = new RscExpression( aExpType, '+', $4 ); + + if( !pTC->aFileTab.NewDef( pFI->GetFileIndex(), + ByteString( $3 ), pExpr, LIST_APPEND ) ) + bError = TRUE; + } + else if( $4.IsExpression() ){ + if( !pTC->aFileTab.NewDef( pFI->GetFileIndex(), + ByteString( $3 ), $4.aExp.pExp, + LIST_APPEND ) ) + bError = TRUE; + } + + if( bError ){ + pTC->pEH->Error( ERR_DECLAREDEFINE, NULL, RscId(), $3 ); + } + } + | '#' DEFINE RSCDEFINE macro_expression + { + pTC->pEH->Error( ERR_DOUBLEDEFINE, NULL, RscId(), $3->GetName().GetBuffer() ); + } + | '#' INCLUDE STRING + { + } + | '#' INCLUDE INCLUDE_STRING + { + } + | class_definition ';' + { +#ifdef D40 + void * pMem; + pMem = rtl_allocateMemory( 20000 ); + rtl_freeMemory( pMem ); +#endif + } + | new_class_definition_header '{' new_class_definition_body '}' ';' + | new_class_definition_header ';' + ; + +new_class_definition_header + : CLASS SYMBOL id_expression ':' CLASSNAME + { + INT32 lType; + + $3.Evaluate( &lType ); + + // Klasse anlegen + Atom nId = pHS->getID( $2 ); + pCurClass = new RscClass( nId, lType, $5 ); + nCurMask = 1; + pTC->aNmTb.Put( nId, CLASSNAME, pCurClass ); + pTC->GetRoot()->Insert( pCurClass ); + } + | CLASS CLASSNAME id_expression ':' CLASSNAME + { + pCurClass = $2; + nCurMask = 1; + } + ; + +new_class_definition_body + : + | property_definition ';' new_class_definition_body + ; + +property_definition + : type_flags type SYMBOL + { + // Variable anlegen + Atom nId = pTC->aNmTb.Put( $3, VARNAME ); + pCurClass->SetVariable( nId, $2, NULL, $1, nCurMask ); + nCurMask <<= 1; + } + | type_flags type VARNAME + { + pCurClass->SetVariable( $3, $2, NULL, $1, nCurMask ); + nCurMask <<= 1; + } + ; + +type_flags + : type_flags EXTENDABLE + { + $$ = $1 | VAR_EXTENDABLE; + } + | type_flags WRITEIFSET + { + $$ = $1 | VAR_SVDYNAMIC; + } + | + { + $$ = 0; + } + ; + +type + : type_base + { + $$ = $1; + } + | type_base '[' ']' + { + if( $1 ) + { + ByteString aTypeName = pHS->getString( $1->GetId() ); + aTypeName += "[]"; + $$ = pTC->SearchType( pHS->getID( aTypeName.GetBuffer(), true ) ); + if( !$$ ) + { + RscCont * pCont; + pCont = new RscCont( pHS->getID( aTypeName.GetBuffer() ), RSC_NOTYPE ); + pCont->SetTypeClass( $1 ); + pTC->InsertType( pCont ); + $$ = pCont; + } + } + else + $$ = NULL; + } + ; + +type_base + : CLASSNAME + { + $$ = $1; + } + | SYMBOL + { + RscTop * pType = pTC->SearchType( pHS->getID( $1, true ) ); + if( !pType ) + pTC->pEH->Error( ERR_NOTYPE, pCurClass, RscId() ); + $$ = pType; + } + ; + +class_definition + : class_header class_body + { + if( TYPE_REF == $1.nTyp ) + pTC->pEH->Error( ERR_REFNOTALLOWED, S.Top().pClass, + RscId( $1.nName1 ) ); + S.Pop(); + } + | class_header + { + ERRTYPE aError; + RscId aRscId( $1.nName1 ); + + if( TYPE_NOTHING == $1.nTyp && aRscId.IsId() ) + aError = S.Top().pClass->SetRef( S.Top(), aRscId ); + else if( TYPE_COPY == $1.nTyp ) + aError = ERR_COPYNOTALLOWED; + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, aRscId ); + S.Pop(); + } + ; + +class_header + : class_header_body + { + if( !DoClassHeader( &$1, FALSE ) ) + return( ERR_ERROR ); + $$ = $1; + } + ; + +copy_ref + : '<' + { + $$ = TYPE_COPY; + } + | ',' + { + $$ = TYPE_REF; + } + ; + +class_header_body + : CLASSNAME id_expression copy_ref CLASSNAME id_expression + { + $$.pClass = $1; + $$.nName1 = $2; + $$.nTyp = $3; + $$.pRefClass = $4; + $$.nName2 = $5; + } + | CLASSNAME id_expression copy_ref id_expression + { + $$.pClass = $1; + $$.nName1 = $2; + $$.nTyp = $3; + $$.pRefClass = NULL; + $$.nName2 = $4; + } + | CLASSNAME id_expression + { + $$.pClass = $1; + $$.nName1 = $2; + $$.nTyp = TYPE_NOTHING; + $$.pRefClass = NULL; + $$.nName2.cType = RSCEXP_NOTHING; + } + | CLASSNAME copy_ref id_expression + { + $$.pClass = $1; + $$.nName1.cType = RSCEXP_NOTHING; + $$.nTyp = $2; + $$.pRefClass = NULL; + $$.nName2 = $3; + } + | CLASSNAME copy_ref CLASSNAME id_expression + { + $$.pClass = $1; + $$.nName1.cType = RSCEXP_NOTHING; + $$.nTyp = $2; + $$.pRefClass = $3; + $$.nName2 = $4; + } + | CLASSNAME + { + $$.pClass = $1; + $$.nName1.cType = RSCEXP_NOTHING; + $$.nTyp = TYPE_NOTHING; + $$.nName2.cType = RSCEXP_NOTHING; + } + ; + +class_body + : '{' var_definitions '}' + | '{' '}' + | string_multiline + { + SetString( S.Top(), "TEXT", $1 ); + } + ; + +var_definitions + : var_definition + | var_definitions var_definition + ; + +xy_mapmode + : CONSTNAME + { + SetConst( S.Top(), "_XYMAPMODE", $1.hashid, $1.nValue ); + } + | + ; + +wh_mapmode + : CONSTNAME + { + SetConst( S.Top(), "_WHMAPMODE", $1.hashid, $1.nValue ); + } + | + ; + +xywh_mapmode + : CONSTNAME + { + SetConst( S.Top(), "_XYMAPMODE", $1.hashid, $1.nValue ); + SetConst( S.Top(), "_WHMAPMODE", $1.hashid, $1.nValue ); + } + | + ; + +var_definition + : line_number + | var_header var_body ';' + { + S.Pop(); + } + | class_definition ';' + | var_header_class class_body ';' + { + if( TYPE_REF == $1.nTyp ) + pTC->pEH->Error( ERR_REFNOTALLOWED, S.Top().pClass, + RscId( $1.nName1 ) ); + + if( S.Top().pClass->GetCount( S.Top() ) ) + pTC->pEH->Error( WRN_SUBINMEMBER, S.Top().pClass, + RscId( $1.nName1 ) ); + + S.Pop(); + } + | var_header_class ';' + { + ERRTYPE aError; + RscId aRscId( $1.nName1 ); + + if( TYPE_NOTHING == $1.nTyp && aRscId.IsId() ) + aError = S.Top().pClass->SetRef( S.Top(), aRscId ); + else if( TYPE_COPY == $1.nTyp ) + aError = ERR_COPYNOTALLOWED; + if( S.Top().pClass->GetCount( S.Top() ) ) + aError = WRN_SUBINMEMBER; + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, aRscId ); + + S.Pop(); + } + | XSCALE '=' '(' long_expression ',' long_expression ')' ';' + { + SetNumber( S.Top(), "_XNUMERATOR", $4 ); + SetNumber( S.Top(), "_XDENOMINATOR", $6 ); + } + | YSCALE '=' '(' long_expression ',' long_expression ')' ';' + { + SetNumber( S.Top(), "_YNUMERATOR", $4 ); + SetNumber( S.Top(), "_YDENOMINATOR", $6 ); + } + | RGB '=' '(' long_expression ',' long_expression + ',' long_expression ')' ';' + { + SetNumber( S.Top(), "RED", $4 ); + SetNumber( S.Top(), "GREEN", $6 ); + SetNumber( S.Top(), "BLUE", $8 ); + } + | GEOMETRY '=' xywh_mapmode '(' long_expression ',' long_expression ',' + long_expression ',' long_expression ')' ';' + { + SetNumber( S.Top(), "_X", $5 ); + SetNumber( S.Top(), "_Y", $7 ); + SetNumber( S.Top(), "_WIDTH", $9 ); + SetNumber( S.Top(), "_HEIGHT", $11 ); + } + | POSITION '=' xy_mapmode '(' long_expression ',' long_expression + ')' ';' + { + SetNumber( S.Top(), "_X", $5 ); + SetNumber( S.Top(), "_Y", $7 ); + } + | DIMENSION '=' wh_mapmode '(' long_expression ',' long_expression + ')' ';' + { + SetNumber( S.Top(), "_WIDTH", $5 ); + SetNumber( S.Top(), "_HEIGHT", $7 ); + } + | INZOOMOUTPUTSIZE '=' CONSTNAME '(' long_expression ',' long_expression + ')' ';' + { + SetConst( S.Top(), "_ZOOMINMAPMODE", $3.hashid, $3.nValue ); + SetNumber( S.Top(), "_ZOOMINWIDTH", $5 ); + SetNumber( S.Top(), "_ZOOMINHEIGHT", $7 ); + } + | INZOOMOUTPUTSIZE '=' '(' long_expression ',' long_expression ')' ';' + { + SetNumber( S.Top(), "_ZOOMINWIDTH", $4 ); + SetNumber( S.Top(), "_ZOOMINHEIGHT", $6 ); + } + | FLOATINGPOS '=' CONSTNAME '(' long_expression ',' long_expression + ')' ';' + { + SetConst( S.Top(), "_FLOATINGPOSMAPMODE", $3.hashid, $3.nValue ); + SetNumber( S.Top(), "_FLOATINGPOSX", $5 ); + SetNumber( S.Top(), "_FLOATINGPOSY", $7 ); + } + | FLOATINGPOS '=' '(' long_expression ',' long_expression ')' ';' + { + SetNumber( S.Top(), "_FLOATINGPOSX", $4 ); + SetNumber( S.Top(), "_FLOATINGPOSY", $6 ); + } + ; + +var_header_class + : VARNAME '=' class_header_body + { + RSCINST aInst; + + aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST(), FALSE, $3.pClass ); + + if( aInst.pData ) + S.Push( aInst ); + else + { + pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(), + pHS->getString( $1 ) ); + return( ERR_ERROR ); + }; + + if( !DoClassHeader( &$3, TRUE ) ) + return( ERR_ERROR ); + $$ = $3; + } + | VARNAME '[' CONSTNAME ']' '=' class_header_body + { + RSCINST aInst; + + aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() ); + + if( aInst.pData ) + { + ERRTYPE aError; + RSCINST aIdxInst; + + aError = aInst.pClass->GetArrayEle( aInst, $3.hashid, NULL, &aIdxInst ); + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + if( aError.IsError() ) + return( ERR_ERROR ); + S.Push( aIdxInst ); + } + else + { + pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(), + pHS->getString( $1 ) ); + return( ERR_ERROR ); + }; + if( !DoClassHeader( &$6, TRUE ) ) + return( ERR_ERROR ); + $$ = $6; + } + | VARNAME '[' SYMBOL ']' '=' class_header_body + { + RSCINST aInst; + + aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() ); + + if( aInst.pData ) + { + long nNewLang = pTC->AddLanguage( $3 ); + ERRTYPE aError; + RSCINST aIdxInst; + + aError = aInst.pClass->GetArrayEle( aInst, nNewLang, NULL, &aIdxInst ); + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + if( aError.IsError() ) + return( ERR_ERROR ); + S.Push( aIdxInst ); + } + else + { + pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(), + pHS->getString( $1 ) ); + return( ERR_ERROR ); + }; + if( !DoClassHeader( &$6, TRUE ) ) + return( ERR_ERROR ); + $$ = $6; + } + ; + +var_header + : VARNAME '=' + { + RSCINST aInst; + + aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() ); + + if( aInst.pData ) + S.Push( aInst ); + else{ + pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(), + pHS->getString( $1 ) ); + return( ERR_ERROR ); + }; + } + | VARNAME '[' CONSTNAME ']' '=' + { + RSCINST aInst; + + aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() ); + + if( aInst.pData ) + { + ERRTYPE aError; + RSCINST aIdxInst; + + aError = aInst.pClass->GetArrayEle( aInst, $3.hashid, NULL, &aIdxInst ); + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + if( aError.IsError() ) + return( ERR_ERROR ); + S.Push( aIdxInst ); + } + else{ + pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(), + pHS->getString( $1 ) ); + return( ERR_ERROR ); + }; + } + | VARNAME '[' SYMBOL ']' '=' + { + RSCINST aInst; + + aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() ); + + if( aInst.pData ) + { + long nNewLang = pTC->AddLanguage( $3 ); + ERRTYPE aError; + RSCINST aIdxInst; + + aError = aInst.pClass->GetArrayEle( aInst, nNewLang, NULL, &aIdxInst ); + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + if( aError.IsError() ) + return( ERR_ERROR ); + S.Push( aIdxInst ); + } + else{ + pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(), + pHS->getString( $1 ) ); + return( ERR_ERROR ); + }; + } + ; +tupel_header0 + : + { + RSCINST aInst; + + aInst = S.Top().pClass->GetTupelVar( S.Top(), 0, RSCINST() ); + if( aInst.pData ) + S.Push( aInst ); + else + { + pTC->pEH->Error( ERR_NOTUPELNAME, S.Top().pClass, RscId() ); + return( ERR_ERROR ); + }; + } + ; + +tupel_header1 + : + { + RSCINST aInst; + + aInst = S.Top().pClass->GetTupelVar( S.Top(), 1, RSCINST() ); + if( aInst.pData ) + S.Push( aInst ); + else + { + pTC->pEH->Error( ERR_NOTUPELNAME, S.Top().pClass, RscId() ); + return( ERR_ERROR ); + }; + } + ; + +tupel_header2 + : + { + RSCINST aInst; + + aInst = S.Top().pClass->GetTupelVar( S.Top(), 2, RSCINST() ); + if( aInst.pData ) + S.Push( aInst ); + else + { + pTC->pEH->Error( ERR_NOTUPELNAME, S.Top().pClass, RscId() ); + return( ERR_ERROR ); + }; + } + ; + +tupel_header3 + : + { + RSCINST aInst; + + aInst = S.Top().pClass->GetTupelVar( S.Top(), 3, RSCINST() ); + if( !aInst.pData ) + { + pTC->pEH->Error( ERR_NOTUPELNAME, S.Top().pClass, RscId() ); + return( ERR_ERROR ); + }; + S.Push( aInst ); + } + ; + +tupel_body + : var_body + { + S.Pop(); + } + ; + +var_list_header + : + { + ERRTYPE aError; + RSCINST aInst; + + aError = S.Top().pClass->GetElement( S.Top(), RscId(), + NULL, RSCINST(), &aInst ); + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + if( aError.IsError() ) + { // unbedingt Instanz auf den Stack bringen + aInst = S.Top().pClass->Create( NULL, RSCINST() ); + } + S.Push( aInst ); + } + ; + +list_body + : var_bodycomplex + { + S.Pop(); + } + ; + +list_header + : + { + sal_uInt32 nCount = S.Top().pClass->GetCount( S.Top() ); + sal_uInt32 i; + + for( i = nCount; i > 0; i-- ) + S.Top().pClass->DeletePos( S.Top(), i -1 ); + } + ; + +list + : list var_list_header list_body ';' + | list var_bodysimple ';' + | list class_definition ';' + | list line_number + | + ; + +var_bodysimple + : macro_expression + { + INT32 l; + ERRTYPE aError; + + if( !$1.Evaluate( &l ) ) + pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() ); + else + { + aError = S.Top().pClass->SetRef( S.Top(), RscId( $1 ) ); + if( aError.IsError() ) + { + aError.Clear(); + aError = S.Top().pClass->SetNumber( S.Top(), l ); + } + if( aError.IsError() ) + { // Aufwaertskompatible, Tupel probieren + RSCINST aInst = GetFirstTupelEle( S.Top() ); + if( aInst.pData ) + { + aError.Clear(); // Fehler zuruecksetzen + aError = aInst.pClass->SetRef( aInst, RscId( $1 ) ); + if( aError.IsError() ) + { + aError.Clear(); + aError = aInst.pClass->SetNumber( aInst, l ); + } + } + } + } + + if( $1.IsExpression() ) + delete $1.aExp.pExp; + + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + } + | CONSTNAME + { + ERRTYPE aError; + aError = S.Top().pClass->SetConst( S.Top(), $1.hashid, $1.nValue ); + if( aError.IsError() ) + { // Aufwaertskompatible, Tupel probieren + RSCINST aInst = GetFirstTupelEle( S.Top() ); + if( aInst.pData ) + { + aError.Clear(); // Fehler zuruecksetzen + aError = aInst.pClass->SetConst( aInst, $1.hashid, $1.nValue ); + } + } + + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + } + | NOT CONSTNAME + { + ERRTYPE aError; + aError = S.Top().pClass->SetNotConst( S.Top(), $2.hashid ); + if( aError.IsError() ) + { // Aufwaertskompatible, Tupel probieren + RSCINST aInst = GetFirstTupelEle( S.Top() ); + if( aInst.pData ) + { + aError.Clear(); // Fehler zuruecksetzen + aError = aInst.pClass->SetNotConst( aInst, $2.hashid ); + } + } + + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + } + | BOOLEAN + { + ERRTYPE aError; + aError = S.Top().pClass->SetBool( S.Top(), $1 ); + if( aError.IsError() ) + { // Aufwaertskompatible, Tupel probieren + RSCINST aInst = GetFirstTupelEle( S.Top() ); + if( aInst.pData ) + { + aError.Clear(); // Fehler zuruecksetzen + aError = aInst.pClass->SetBool( aInst, $1 ); + } + } + + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + } + | string_multiline + { + ERRTYPE aError; + aError = S.Top().pClass->SetString( S.Top(), $1 ); + if( aError.IsError() ) + { // Aufwaertskompatible, Tupel probieren + RSCINST aInst = GetFirstTupelEle( S.Top() ); + if( aInst.pData ) + { + aError.Clear(); // Fehler zuruecksetzen + aError = aInst.pClass->SetString( aInst, $1 ); + } + } + + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + } + | DEFAULT + ; + +var_bodycomplex + : '{' list_header list '}' + | '<' tupel_header0 tupel_body ';' '>' + | '<' tupel_header0 tupel_body ';' tupel_header1 tupel_body ';' '>' + | '<' tupel_header0 tupel_body ';' tupel_header1 tupel_body ';' + tupel_header2 tupel_body ';' '>' + | '<' tupel_header0 tupel_body ';' tupel_header1 tupel_body ';' + tupel_header2 tupel_body ';' tupel_header3 tupel_body ';' '>' + ; + +var_body + : var_bodysimple + | var_bodycomplex + ; + +/********************** work on yacc stack *******************************/ +string_multiline + : STRING + { + $$ = $1; + } + | string_multiline STRING + { + rtl::OStringBuffer aBuf( 256 ); + aBuf.append( $1 ); + aBuf.append( $2 ); + $$ = (char*)pStringContainer->putString( aBuf.getStr() ); + } + ; + +long_expression + : macro_expression + { + if( !$1.Evaluate( &$$ ) ) + pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() ); + if( $1.IsExpression() ) + delete $1.aExp.pExp; + } + ; + +macro_expression + : RSCDEFINE + { + $$.cType = RSCEXP_DEF; + $$.aExp.pDef = $1; + } + | NUMBER + { + $$.cType = RSCEXP_LONG; + $$.SetLong( $1 ); + } + | '-' macro_expression %prec UNARYMINUS + { + if( $2.IsNumber() ){ + $$.cType = $2.cType; + $$.SetLong( - $2.GetLong() ); + } + else{ + RscExpType aLeftExp; + + aLeftExp.cType = RSCEXP_NOTHING; + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( aLeftExp, '-', $2 ); + } + } + | '+' macro_expression %prec UNARYPLUS + { + $$ = $2; + } + | macro_expression '+' macro_expression + { + if( $1.IsNumber() && $3.IsNumber() ){ + $$.cType = RSCEXP_LONG; + $$.SetLong( $1.GetLong() + $3.GetLong() ); + } + else{ + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, '+', $3 ); + } + } + | macro_expression '-' macro_expression + { + if( $1.IsNumber() && $3.IsNumber() ){ + $$.cType = RSCEXP_LONG; + $$.SetLong( $1.GetLong() - $3.GetLong() ); + } + else{ + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, '-', $3 ); + } + } + | macro_expression '*' macro_expression + { + if( $1.IsNumber() && $3.IsNumber() ){ + $$.cType = RSCEXP_LONG; + $$.SetLong( $1.GetLong() * $3.GetLong() ); + } + else{ + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, '*', $3 ); + } + } + | macro_expression '/' macro_expression + { + if( $1.IsNumber() && $3.IsNumber() ){ + if( 0 == $3.GetLong() ){ + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, '/', $3 ); + } + else{ + $$.cType = RSCEXP_LONG; + $$.SetLong( $1.GetLong() / $3.GetLong() ); + } + } + else{ + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, '/', $3 ); + } + } + | macro_expression '&' macro_expression + { + if( $1.IsNumber() && $3.IsNumber() ){ + $$.cType = RSCEXP_LONG; + $$.SetLong( $1.GetLong() & $3.GetLong() ); + } + else{ + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, '&', $3 ); + } + } + | macro_expression '|' macro_expression + { + if( $1.IsNumber() && $3.IsNumber() ){ + $$.cType = RSCEXP_LONG; + $$.SetLong( $1.GetLong() | $3.GetLong() ); + } + else{ + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, '|', $3 ); + } + } + | '(' macro_expression ')' + { + $$ = $2; + } + | macro_expression LEFTSHIFT macro_expression + { + if( $1.IsNumber() && $3.IsNumber() ){ + $$.cType = RSCEXP_LONG; + $$.SetLong( $1.GetLong() << $3.GetLong() ); + } + else{ + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, 'l', $3 ); + } + } + | macro_expression RIGHTSHIFT macro_expression + { + if( $1.IsNumber() && $3.IsNumber() ){ + $$.cType = RSCEXP_LONG; + $$.SetLong( $1.GetLong() >> $3.GetLong() ); + } + else{ + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, 'r', $3 ); + } + } + ; + +id_expression + : id_expression line_number + | macro_expression + { // pExpession auswerten und loeschen + if( RSCEXP_EXP == $1.cType ){ + INT32 lValue; + + if( !$1.Evaluate( &lValue ) ) + pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() ); + delete $1.aExp.pExp; + $$.cType = RSCEXP_LONG; + $$.SetLong( lValue ); + } + else + $$ = $1; + } + ; + +DUMMY_NUMBER + : NUMBER + { + } + | + { + } + ; + +line_number + : '#' LINE NUMBER STRING + { + RscFile * pFName; + + pFI->SetLineNo( $3 ); + pFI->SetFileIndex( pTC->aFileTab.NewCodeFile( ByteString( $4 ) ) ); + pFName = pTC->aFileTab.Get( pFI->GetFileIndex() ); + pFName->bLoaded = TRUE; + pFName->bScanned = TRUE; + } + | '#' NUMBER STRING DUMMY_NUMBER + { + RscFile * pFName; + + pFI->SetLineNo( $2 ); + pFI->SetFileIndex( pTC->aFileTab.NewCodeFile( ByteString( $3 ) ) ); + pFName = pTC->aFileTab.Get( pFI->GetFileIndex() ); + pFName->bLoaded = TRUE; + pFName->bScanned = TRUE; + } + | '#' NUMBER + { + pFI->SetLineNo( $2 ); + } + ; + + + + diff --git a/rsc/source/prj/gui.cxx b/rsc/source/prj/gui.cxx new file mode 100644 index 000000000000..6bf466348d1b --- /dev/null +++ b/rsc/source/prj/gui.cxx @@ -0,0 +1,136 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: gui.cxx,v $ + * $Revision: 1.11 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" + +#include <stdlib.h> +#include <stdio.h> +#include <rscrsc.hxx> +#include <rscdb.hxx> + +/*************** 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( OS2 ) && ( defined( TCPP ) || defined ( GCC )) ) || defined (WTC) || defined (MTW) || defined(__MINGW32__) + void ExitProgram( void ){ +#else +#if defined( CSET ) + void _Optlink ExitProgram( void ){ +#else + void cdecl ExitProgram( void ){ +#endif +#endif + if( pRscCompiler ) + delete pRscCompiler; +} + +RscVerbosity lcl_determineVerbosity( int argc, char ** argv ) +{ + for ( int i = 0; i < argc; ++i ) + { + if ( argv[i] == NULL ) + continue; + if ( rsc_stricmp( argv[i], "-verbose" ) == 0 ) + return RscVerbosityVerbose; + if ( rsc_stricmp( argv[i], "-quiet" ) == 0 ) + return RscVerbositySilent; + } + return RscVerbosityNormal; +} + +#if defined( UNX ) || ( defined( OS2 ) && ( defined( CSET ) || defined ( GCC ))) || defined (WTC) || defined(ICC) || defined(__MINGW32__) +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 +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "debugging %s\n", argv[0] ); +#endif + + ERRTYPE aError; + + InitRscCompiler(); + RscError* pErrHdl = new RscError( lcl_determineVerbosity( argc, argv ) ); +#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->nByteOrder, + 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( sal_uInt32 nExit ) +{ + if( nExit ) + printf( "Program exit is %ud\n", (unsigned int)nExit ); + exit( nExit ); +} diff --git a/rsc/source/prj/makefile.mk b/rsc/source/prj/makefile.mk new file mode 100644 index 000000000000..1e58270aa67c --- /dev/null +++ b/rsc/source/prj/makefile.mk @@ -0,0 +1,83 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.8 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=rsc +TARGETTYPE=CUI +TARGET=rsc +LIBTARGET=NO + +# --- Settings ----------------------------------------------------------- + +.INCLUDE : settings.mk + +# --- Files -------------------------------------------------------------- + +OBJFILES= $(OBJ)$/gui.obj \ + $(OBJ)$/start.obj + +APP1TARGET= rsc +APP1STDLIBS=$(TOOLSLIB) $(I18NISOLANGLIB) $(VOSLIB) $(SALLIB) # $(RTLLIB) +APP1LIBS= $(LB)$/rsctoo.lib +APP1OBJS= $(OBJ)$/start.obj +.IF "$(GUI)" != "OS2" +# why not this way? +APP1STACK=64000 +#APP1STACK=32768 +.ENDIF +APP1RPATH=NONE + +APP2TARGET= rsc2 +.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) $(I18NISOLANGLIB) $(VOSLIB) $(SALLIB) # $(RTLLIB) +.ENDIF +APP2LIBS= $(LB)$/rsctoo.lib \ + $(LB)$/rscres.lib \ + $(LB)$/rscpar.lib \ + $(LB)$/rscrsc.lib \ + $(LB)$/rscmis.lib +APP2OBJS= $(OBJ)$/gui.obj +.IF "$(GUI)" != "OS2" +# why not this way? +APP2STACK=64000 +#APP2STACK=32768 +.ENDIF +APP2RPATH=NONE + +# --- Targets ------------------------------------------------------------ + +.INCLUDE : target.mk + diff --git a/rsc/source/prj/start.cxx b/rsc/source/prj/start.cxx new file mode 100644 index 000000000000..df4ce12200c5 --- /dev/null +++ b/rsc/source/prj/start.cxx @@ -0,0 +1,491 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: start.cxx,v $ + * $Revision: 1.13 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" + +#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 // UNX + +#include <io.h> +#include <process.h> +#if defined ( OS2 ) && !defined ( GCC ) +#include <direct.h> +#endif +#if !defined ( CSET ) && !defined ( OS2 ) +#include <dos.h> +#endif + +#endif // UNX +#include <rsctools.hxx> +#include <rscerror.h> +#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(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; + int i, nExit; + FILE* fRspFile = NULL; + ByteString aRspFileName; + + if( bResponse ) + { + aRspFileName = ::GetTmpFileName(); + fRspFile = fopen( aRspFileName.GetBuffer(), "w" ); + } + + if( !fRspFile ) + aNewCmdL.Append( rsc_strdup( rPrePro.GetBuffer() ) ); + + bool bVerbose = false; + for( i = 1; i < int(pCmdLine->GetCount() -1); i++ ) + { + if ( 0 == rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-verbose" ) ) + { + bVerbose = true; + continue; + } + 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( rsc_strdup( (char *)pCmdLine->GetEntry( i ) ) ); + } + } + + aNewCmdL.Append( rsc_strdup( rInput.GetBuffer() ) ); + aNewCmdL.Append( rsc_strdup( rOutput.GetBuffer() ) ); + aNewCmdL.Append( (void *)0 ); + + if ( bVerbose ) + { + printf( "Preprocessor commandline: " ); + for( i = 0; i < (int)(pCmdL->GetCount() -1); i++ ) + { + printf( " " ); + printf( "%s", (const char *)pCmdL->GetEntry( i ) ); + } + printf( "\n" ); + } + + if( fRspFile ) + { + aRespCmdL.Append( rsc_strdup( rPrePro.GetBuffer() ) ); + ByteString aTmpStr( '@' ); + aTmpStr += aRspFileName; + aRespCmdL.Append( rsc_strdup( aTmpStr.GetBuffer() ) ); + aRespCmdL.Append( (void *)0 ); + + pCmdL = &aRespCmdL; + for( i = 0; i < (int)(aNewCmdL.GetCount() -1); i++ ) + { +#ifdef OS2 + fprintf( fRspFile, "%s\n", (const char *)aNewCmdL.GetEntry( i ) ); +#else + fprintf( fRspFile, "%s ", (const char *)aNewCmdL.GetEntry( i ) ); +#endif + } + fclose( fRspFile ); + + if ( bVerbose ) + { + printf( "Preprocessor startline: " ); + for( i = 0; i < (int)(pCmdL->GetCount() -1); i++ ) + { + printf( " " ); + printf( "%s", (const char *)pCmdL->GetEntry( i ) ); + } + printf( "\n" ); + } + } + +#if ((defined OS2 || defined WNT) && (defined TCPP || defined tcpp)) || defined UNX || defined OS2 + 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 ) + #if OSL_DEBUG_LEVEL > 5 + fprintf( stderr, "leaving response file %s\n", aRspFileName.GetBuffer() ); + #else + unlink( aRspFileName.GetBuffer() ); + #endif + if ( nExit ) + return FALSE; + + return TRUE; +} + + +/************************************************************************* +|* CallRsc2 +|* +|* Beschreibung +*************************************************************************/ +static BOOL CallRsc2( ByteString aRsc2Name, + RscStrList * pInputList, + ByteString aSrsName, + RscPtrPtr * pCmdLine ) +{ + int i, nExit; + ByteString* pString; + ByteString aRspFileName; // Response-Datei + FILE * fRspFile; // Response-Datei + + aRspFileName = ::GetTmpFileName(); + fRspFile = fopen( aRspFileName.GetBuffer(), "w" ); + + RscVerbosity eVerbosity = RscVerbosityNormal; + if( fRspFile ) + { + for( i = 1; i < (int)(pCmdLine->GetCount() -1); i++ ) + { + if ( !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-verbose" ) ) + { + eVerbosity = RscVerbosityVerbose; + continue; + } + if ( !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-quiet" ) ) + { + eVerbosity = RscVerbositySilent; + continue; + } + if( !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-fp=", 4 ) + || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-fo=", 4 ) + || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-pp=", 4 ) + || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-rsc2=", 6 ) + || !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" ) + // Am I the only one that thinks the following line inludes all the tests before? + || ( '-' != *(char *)pCmdLine->GetEntry( i ) ) ) + { + } + else +#ifdef OS2 + fprintf( fRspFile, "%s\n", +#else + fprintf( fRspFile, "%s ", +#endif + (const char *)pCmdLine->GetEntry( i ) ); + }; + +#ifdef OS2 + fprintf( fRspFile, "%s\n", aSrsName.GetBuffer() ); +#else + fprintf( fRspFile, aSrsName.GetBuffer() ); +#endif + + pString = pInputList->First(); + while( pString ) + { +#ifdef OS2 + fprintf( fRspFile, "%s\n", pString->GetBuffer() ); +#else + fprintf( fRspFile, " %s", pString->GetBuffer() ); +#endif + pString = pInputList->Next(); + }; + + fclose( fRspFile ); + }; + + RscPtrPtr aNewCmdL; // Kommandozeile + aNewCmdL.Append( rsc_strdup( aRsc2Name.GetBuffer() ) ); + ByteString aTmpStr( '@' ); + aTmpStr += aRspFileName; + aNewCmdL.Append( rsc_strdup( aTmpStr.GetBuffer() ) ); + aNewCmdL.Append( (void *)0 ); + + if ( eVerbosity >= RscVerbosityVerbose ) + { + printf( "Rsc2 commandline: " ); + printf( "%s", (const char *)aNewCmdL.GetEntry( 0 ) ); + printf( " " ); + printf( "%s", (const char *)aNewCmdL.GetEntry( 1 ) ); + printf( "\n" ); + } + +#if ((defined OS2 || defined WNT) && (defined TCPP || defined tcpp)) || defined UNX || defined OS2 + 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 ) + #if OSL_DEBUG_LEVEL > 5 + fprintf( stderr, "leaving response file %s\n", aRspFileName.GetBuffer() ); + #else + unlink( aRspFileName.GetBuffer() ); + #endif + if( nExit ) + return( FALSE ); + return( TRUE ); +} + +/************************************************************************* +|* +|* main() +|* +|* Beschreibung +|* Ersterstellung MM 05.09.91 +|* Letzte Aenderung MM 05.09.91 +|* +*************************************************************************/ +#if defined UNX || (defined OS2 && (defined CSET || defined GCC )) || defined WTC || defined MTW || defined ICC || defined(__MINGW32__) +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 aSolarbin(getenv("SOLARBINDIR")); + ByteString aDelim("/"); + ByteString aPrePro; //( aSolarbin + aDelim + ByteString("rscpp")); + ByteString aRsc2Name; //( aSolarbin + aDelim + ByteString("rsc2")); + ByteString aSrsName; + ByteString aResName; + RscStrList aInputList; + RscStrList aTmpList; + char * pStr; + char ** ppStr; + RscPtrPtr aCmdLine; // Kommandozeile + sal_uInt32 i; + ByteString* pString; + + aPrePro = aSolarbin; + aPrePro += aDelim; + aPrePro += ByteString("rscpp"); + + aRsc2Name = aSolarbin; + aRsc2Name += aDelim; + aRsc2Name += ByteString("rsc2"); + + 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 < (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=", 3 ) ) + { // anderer Name fuer den Preprozessor + aPrePro = (*ppStr) + 4; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "rsc2=", 5 ) ) + { // Accept alternate name for the rsc2 compiler + aRsc2Name = (*ppStr) + 6; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "fo=", 3 ) ) + { // anderer Name fuer .res-file + aResName = (*ppStr) + 4; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "fp=", 3 ) ) + { // 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( ! 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, &aCmdLine ) ) + { + if( !bHelp ) + { + printf( "Error starting rsc2 compiler\n" ); + bError = TRUE; + } + }; + }; + + pString = aTmpList.First(); + while( pString ) + { + #if OSL_DEBUG_LEVEL > 5 + fprintf( stderr, "leaving temp file %s\n", pString->GetBuffer() ); + #else + unlink( pString->GetBuffer() ); + #endif + pString = aTmpList.Next(); + }; + + return( bError ); +} + +void RscExit( sal_uInt32 nExit ) +{ + if( nExit ) + printf( "Program exit is %d\n", (int)nExit ); + exit( nExit ); +} diff --git a/rsc/source/res/makefile.mk b/rsc/source/res/makefile.mk new file mode 100644 index 000000000000..adae87f4954b --- /dev/null +++ b/rsc/source/res/makefile.mk @@ -0,0 +1,65 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.5 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=rsc +TARGET=rscres + +# --- Settings ------------------------------------------------------ + +.INCLUDE : settings.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..de5850c48d9c --- /dev/null +++ b/rsc/source/res/rscall.cxx @@ -0,0 +1,67 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscall.cxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +/****************** I N C L U D E S **************************************/ + +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> + +// Programmabhaengige Includes. +#include <rscall.h> +#include <rsckey.hxx> + +Atom nRsc_XYMAPMODEId = InvalidAtom; +Atom nRsc_WHMAPMODEId = InvalidAtom; +Atom nRsc_X = InvalidAtom; +Atom nRsc_Y = InvalidAtom; +Atom nRsc_WIDTH = InvalidAtom; +Atom nRsc_HEIGHT = InvalidAtom; +Atom nRsc_DELTALANG = InvalidAtom; +Atom nRsc_DELTASYSTEM = InvalidAtom; +Atom nRsc_EXTRADATA = InvalidAtom; + +void InitRscCompiler() +{ + 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 = InvalidAtom; + nRsc_WHMAPMODEId = InvalidAtom; + pHS = new AtomContainer(); +}; + diff --git a/rsc/source/res/rscarray.cxx b/rsc/source/res/rscarray.cxx new file mode 100644 index 000000000000..78a9ea488042 --- /dev/null +++ b/rsc/source/res/rscarray.cxx @@ -0,0 +1,731 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscarray.cxx,v $ + * $Revision: 1.8 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +/****************** I N C L U D E S **************************************/ + +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +// Programmabhaengige Includes. +#include <rscconst.hxx> +#ifndef _RSCSARRAY_HXX +#include <rscarray.hxx> +#endif +#include <rscdb.hxx> + +/****************** 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( sal_uInt32 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 ); + rtl_freeMemory( aInst.pData ); + } +} + +/************************************************************************* +|* +|* RscInstNode::GetId() +|* +|* Beschreibung +|* Ersterstellung MM 06.08.91 +|* Letzte Aenderung MM 06.08.91 +|* +*************************************************************************/ +sal_uInt32 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( Atom nId, sal_uInt32 nTypeId, RscTop * pSuper, RscEnum * pTypeCl ) + : RscTop( nId, nTypeId, pSuper ) +{ + pTypeClass = pTypeCl; + nOffInstData = RscTop::Size(); + nSize = nOffInstData + ALIGNED_SIZE( sizeof( RscArrayInst ) ); +} + +/************************************************************************* +|* +|* 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) rtl_allocateMemory( 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, + INT32 lValue, + RscTop * pCreateClass, + RSCINST * pGetInst +) +{ + RscArrayInst * pClassData; + RscInstNode * pNode; + + pClassData = (RscArrayInst *)(rInst.pData + nOffInstData); + + ERRTYPE aError; + + Atom nId; + if( !pTypeClass->GetValueConst( sal_uInt32(lValue), &nId ) ) + { // nicht gefunden + return ERR_ARRAY_INVALIDINDEX; + } + + if( pClassData->pNode ) + pNode = pClassData->pNode->Search( sal_uInt32(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( sal_uInt32(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, + Atom 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, sal_uInt32 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 ) + { + std::vector< sal_uInt32 >::const_iterator it; + for( it = pTC->GetFallbacks().begin(); !pNode && it != pTC->GetFallbacks().end(); ++it ) + pNode = pClassData->pNode->Search( *it ); + } + + 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, + sal_uInt32 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( sal_uInt32 n = 0; n < nTab; n++ ) + fputc( '\t', fOutput ); + + Atom nIdxId; + pTypeClass->GetValueConst( pNode->GetId(), &nIdxId ); + fprintf( fOutput, "%s[ %s ] = ", pVarName, pHS->getString( nIdxId ).getStr() ); + 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, sal_uInt32 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, sal_uInt32 nTab, + const char * pVarName ) +{ + WriteSrcArray( rInst, fOutput, pTC, nTab, pVarName ); +} + +/************************************************************************* +|* RscArray::WriteRc() +|* +|* Beschreibung +*************************************************************************/ +ERRTYPE RscArray::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, + RscTypCont * pTC, sal_uInt32 nDeep, BOOL bExtra ) +{ + ERRTYPE aError; + RscArrayInst * pClassData; + RscInstNode * pNode = NULL; + + pClassData = (RscArrayInst *)(rInst.pData + nOffInstData); + + if( pClassData->pNode ) + { +#if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, "RscArray::WriteRc: Fallback " ); +#endif + std::vector< sal_uInt32 >::const_iterator it; + for( it = pTC->GetFallbacks().begin(); !pNode && it != pTC->GetFallbacks().end(); ++it ) + { + pNode = pClassData->pNode->Search( *it ); +#if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, " 0x%hx", *it ); +#endif + } +#if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, "\n" ); +#endif + } + + 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( Atom nId, sal_uInt32 nTypeId, RscTop * pSuper, + RscEnum * pTypeCl ) + : RscArray( nId, nTypeId, pSuper, pTypeCl ) +{ +} + +/************************************************************************* +|* +|* 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, sal_uInt32 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, sal_uInt32 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, + sal_uInt32 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( Atom nId, sal_uInt32 nTypeId, RscTop * pSuper, + RscEnum * pTypeCl ) + : RscArray( nId, nTypeId, pSuper, pTypeCl ) +{ +} + +/************************************************************************* +|* +|* 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..0ce745ec1640 --- /dev/null +++ b/rsc/source/res/rscclass.cxx @@ -0,0 +1,1264 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscclass.cxx,v $ + * $Revision: 1.10 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +/****************** I N C L U D E S **************************************/ + +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +// Programmabhaengige Includes. +#include <rscdb.hxx> +#include <rscclass.hxx> + +#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( Atom nId, sal_uInt32 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() +{ + sal_uInt32 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 ) ); + rtl_freeMemory( 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 ) + rtl_freeMemory( (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, + sal_uInt32 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( sal_uInt32 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, sal_uInt32 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, sal_uInt32 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 +) +{ + sal_uInt32 i; + CLASS_DATA * ppData; + RSCINST aInst; + RSCINST aMemInst, aDfltI; + + if( !pInst ) + { + aInst.pClass = this; + aInst.pData = (CLASS_DATA) rtl_allocateMemory( 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 = ~((ULONG)0); + + 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 * pInstance = (RSCINST *) + (aInst.pData + pVarTypeList[ i ].nOffset ); + pInstance->pClass = pVarTypeList[ i ].pClass; + ppData = &pInstance->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 ) +{ + sal_uInt32 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 + rtl_freeMemory( aTmpI.pData ); + }; + }; + } + }; +} + +/************************************************************************* +|* +|* RscClass::SetVariable() +|* +|* Beschreibung +|* +*************************************************************************/ +ERRTYPE RscClass::SetVariable +( + Atom nVarName, + RscTop * pClass, + RSCINST * pDflt, + RSCVAR nVarType, + sal_uInt32 nMask, + Atom nDataBaseName +) +{ + if( pVarTypeList ) + pVarTypeList = (VARTYPE_STRUCT *) + rtl_reallocateMemory( (void *)pVarTypeList, + ((nEntries +1) * sizeof( VARTYPE_STRUCT )) ); + else + pVarTypeList = (VARTYPE_STRUCT *) + rtl_allocateMemory( ((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 ) +{ + sal_uInt32 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, + Atom nVarName, + const RSCINST & rInitInst, + BOOL bInitDflt, + RscTop * pCreateClass +) +{ + sal_uInt32 i = 0; + RSCINST aTmpI; + + 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 aDefInst = rInitInst; + if( !aDefInst.IsInst() && bInitDflt ) + { + // mit dem Variablen-Default besetzen + aDefInst.pData = pVarTypeList[ i ].pDefault; + aDefInst.pClass = pVarTypeList[ i ].pClass; + } + + aTmpI = GetInstData( rInst.pData, i ); + if( aTmpI.IsInst() ) + { + if( aDefInst.IsInst() ) + { + aTmpI.pClass->Destroy( aTmpI ); + aTmpI.pClass->Create( &aTmpI, aDefInst ); + } + } + 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, aDefInst ); + else + *pInst = aTmpI.pClass->Create( NULL, aDefInst ); + aTmpI = *pInst; + } + else + { + CLASS_DATA * ppData + = (CLASS_DATA *)(rInst.pData + pVarTypeList[ i ].nOffset); + aTmpI = aTmpI.pClass->Create( NULL, aDefInst ); + *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, + Atom nVarName +) +{ + sal_uInt32 i = 0; + RSCINST aVarI; + + 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 ) +{ + sal_uInt32 i = 0; + 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 ) +{ + sal_uInt32 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 = ~((ULONG)0); // alles auf Default + + RscTop::SetToDefault( rInst ); +} + +/************************************************************************* +|* +|* RscClass::IsDefault() +|* +|* Beschreibung +|* +*************************************************************************/ +BOOL RscClass::IsDefault( const RSCINST & rInst ) +{ + sal_uInt32 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( Atom nVarId ) +{ + sal_uInt32 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, sal_uInt32 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 ) +{ + sal_uInt32 i = 0; + 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, Atom nVarName ) +{ + sal_uInt32 i = 0; + RSCINST aTmpI; + + 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, + sal_uInt32 nTab, + const char * pVarName +) +{ + sal_uInt32 i = 0, n = 0; + 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() ) + { + const char * pName = pHS->getString( pVarTypeList[ i ].nVarName ).getStr(); + + 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 +|* +*************************************************************************/ +INT32 RscClass::GetCorrectValues +( + const RSCINST & rInst, + sal_uInt32 nVarPos, + sal_uInt32 nTupelIdx, + RscTypCont * pTC +) +{ + INT32 nLang = 0; + INT32 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 = (INT32)aMem.GetShort( nTupelIdx * sizeof(sal_uInt16) ); + } + + return nLang + nBaseValue; +} + +ERRTYPE RscClass::WriteInstRc +( + const RSCINST & rInst, + RscWriteRc & rMem, + RscTypCont * pTC, + sal_uInt32 nDeep, + BOOL bExtra +) +{ + sal_uInt32 i = 0; + ERRTYPE aError; + RSCINST aTmpI; + sal_uInt32 nMaskOff = 0;// 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( sal_uInt32(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 ); + } + sal_uInt32 nMask = rMem.GetLong( 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, + sal_uInt32 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 ); + + sal_uInt32 i; + // Wenn eine Variable Maskierung hat, dann Maskenfeld + fprintf( fOutput, "\t//%s\n", pHS->getString( GetId() ).getStr() ); + for( i = 0; i < nEntries; i++ ) + { + fprintf( fOutput, "\t%s", pHS->getString( pVarTypeList[ i ].nVarName ).getStr() ); + sal_uInt32 n = strlen( pHS->getString( pVarTypeList[ i ].nVarName ).getStr() ); + while( n < 20 ) + { + putc( ' ', fOutput ); + n++; + } + fprintf( fOutput, " = %s;\n", + pHS->getString( pVarTypeList[ i ].pClass->GetId() ).getStr() ); + }; +} + +//================================================================== +void RscClass::WriteRcAccess +( + FILE * fOutput, + RscTypCont * /*pTC*/, + const char * pName +) +{ + fprintf( fOutput, "\t\tSet%s( %s ", pName, pHS->getString( GetId() ).getStr() ); + 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() != InvalidAtom ) + { + // Konstruktor + fprintf( fOutput, "%s::%s%s bFreeResource )", + pHS->getString( GetId() ).getStr(), + pHS->getString( GetId() ).getStr(), + aCallParType.GetBuffer() ); + if( GetSuperClass() ) + { + // Superaufruf + fprintf( fOutput, "\n\t: %s", pHS->getString( GetSuperClass()->GetId() ).getStr() ); + fprintf( fOutput, "%s", GetSuperClass()->aCallPar1.GetBuffer() ); + fprintf( fOutput, " rResId.SetRT2( 0x%lx ) )", + sal::static_int_cast< unsigned long >(GetTypId()) ); + } + fprintf( fOutput, "\n{\n" ); + fprintf( fOutput, "\tsal_uInt32\tnObjMask;\n" ); + fprintf( fOutput, "\tsal_uInt32\tnOffset = 0;\n" ); + fprintf( fOutput, "\tBYTE *\tpResData;\n\n" ); + fprintf( fOutput, "\tpResData = (BYTE *)GetClassRes();\n\n" ); + fprintf( fOutput, "\tnObjMask = *(sal_uInt32*)pResData;\n" ); + fprintf( fOutput, "\tnOffset += 4;\n\n" ); + + for( sal_uInt32 i = 0; i < nEntries; i++ ) + { + if( !((VAR_NODATAINST | VAR_NORC) & pVarTypeList[ i ].nVarType )) + { + fprintf( fOutput, "\tif( nObjMask & 0x%lx )\n\t{\n", + sal::static_int_cast< unsigned long >( + pVarTypeList[ i ].nMask) ); + + pVarTypeList[ i ].pClass->WriteRcAccess( fOutput, pTC, + pHS->getString( pVarTypeList[ i ].nVarName ).getStr() ); + + 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( Atom nId, sal_uInt32 nTypeId, RscTop * pSuper ) + : RscClass( nId, nTypeId, pSuper ) +{} + +/************************************************************************* +|* +|* RscSysDepend::WriteRc() +|* +|* Beschreibung +|* +*************************************************************************/ +ERRTYPE RscSysDepend::WriteSysDependRc( const RSCINST & rInst, RscWriteRc & rMem, + RscTypCont * pTC, sal_uInt32 nDeep, BOOL bExtra, BOOL bFirst ) +{ + sal_uInt32 nId = 0xFFFFFFFF; + ERRTYPE aError; + RSCINST aFileName; + + //Instanz mit dem Dateinamen "FILENAME" holen + aFileName = RscClass::GetCopyVar( rInst, pHS->getID( "FILE", true ) ); + if( aFileName.IsInst() ) + { + RscWriteRc aTmpMem; + aError = aFileName.pClass->WriteRcHeader( aFileName, aTmpMem, pTC, + RscId(), nDeep, bExtra ); + // Obsolete - need changes in VCL + rMem.Put( sal_uInt32(0) ); + + // Identifier schreiben + if( aTmpMem.Size() && pTC && (*aTmpMem.GetUTF8( 0 ) != '\0') ) + { + nId = pTC->PutSysName( rInst.pClass->GetTypId(), + aTmpMem.GetUTF8( 0 ), + 0, 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, sal_uInt32 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( Atom nId, sal_uInt32 nTypeId, + RscTop * pSuper ) + : RscSysDepend( nId, nTypeId, pSuper ) +{} + +/************************************************************************* +|* +|* RscFirstSysDepend::WriteRc() +|* +|* Beschreibung +|* +*************************************************************************/ +ERRTYPE RscFirstSysDepend::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, + RscTypCont * pTC, sal_uInt32 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( Atom nId, sal_uInt32 nTypeId, RscTop * pSuper ) + : RscClass( nId, nTypeId, pSuper ) +{} + +/************************************************************************* +|* +|* RscTupel::GetTupelVar() +|* +|* Beschreibung +|* +*************************************************************************/ +RSCINST RscTupel::GetTupelVar( const RSCINST & rInst, sal_uInt32 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, sal_uInt32 nTab, + const char * pVarName ) +{ + sal_uInt32 i = 0; + 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..d114ae534f5d --- /dev/null +++ b/rsc/source/res/rscclobj.cxx @@ -0,0 +1,230 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscclobj.cxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +/****************** I N C L U D E S **************************************/ + +// C and C++ Includes. + +// Solar Definitionen +#include <tools/solar.h> + +// Programmabhaengige Includes. +#include <rscclobj.hxx> +#include <rsctop.hxx> + +/****************** 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( Atom nTyp ){ + pObjBiTree = 0; + nTypNameId = nTyp; +} + +/************************************************************************* +|* +|* RefNode::GetId() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +sal_uInt32 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() ) ); + rtl_freeMemory( 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 +|* +*************************************************************************/ +sal_uInt32 ObjNode::GetId() const +{ + return( (sal_uInt32)(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..75d5cd4bb609 --- /dev/null +++ b/rsc/source/res/rscconst.cxx @@ -0,0 +1,418 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscconst.cxx,v $ + * $Revision: 1.12 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +/****************** I N C L U D E S **************************************/ + +// C and C++ Includes. +#include <cstdlib> +#include <cstdio> +#include <cstring> + +// Solar Definitionen +#include <tools/solar.h> + +// Programmabhaengige Includes. +#include <rscconst.hxx> +#include <rscall.h> +#include <rschash.hxx> +#include <tools/resid.hxx> + +/****************** 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( Atom nId, sal_uInt32 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 ) + rtl_freeMemory( (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( Atom nVarName, INT32 lValue ){ + if( pVarArray ) + pVarArray = (VarEle *) + rtl_reallocateMemory( (void *)pVarArray, + ((nEntries +1) * sizeof( VarEle )) ); + else + pVarArray = (VarEle *) + rtl_allocateMemory( ((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 +|* +*************************************************************************/ +Atom RscConst::GetConstant( sal_uInt32 nPos ){ + if( nPos < nEntries ) + return pVarArray[ nPos ].nId; + return( InvalidAtom ); +} + +/************************************************************************* +|* +|* RscConst::GetConstValue() +|* +|* Beschreibung +|* Ersterstellung MM 15.05.91 +|* Letzte Aenderung MM 15.05.91 +|* +*************************************************************************/ +BOOL RscConst::GetConstValue( Atom nConst, INT32 * pValue ) const +{ + sal_uInt32 i = 0; + + 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, Atom * pConst ) const +{ + sal_uInt32 i = 0; + + 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 +|* +*************************************************************************/ +sal_uInt32 RscConst::GetConstPos( Atom nConst ) +{ + sal_uInt32 i = 0; + + 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 ); + + sal_uInt32 i = 0; + // Wenn eine Variable Maskierung hat, dann Maskenfeld + fprintf( fOutput, "\t" ); + for( i = 0; i < nEntries; i++ ) + { + fprintf( fOutput, "%s, ", pHS->getString( pVarArray[ i ].nId ).getStr() ); + if( 3 == (i % 4) && i < sal_uInt32(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->getString( GetId() ).getStr() ); + 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( Atom nId, sal_uInt32 nTypeId ) + : RscConst( nId, nTypeId ) +{ + 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, Atom nConst, INT32 /*nVal*/ ) +{ + sal_uInt32 i = 0; + + 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 ) +{ + sal_uInt32 i = 0; + + for( i = 0; i < nEntries; i++ ){ + if( (INT32)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, Atom * 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, INT32 * 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) + rtl_allocateMemory( 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 *, sal_uInt32, const char * ) +{ + fprintf( fOutput, "%s", pHS->getString( + pVarArray[ ((RscEnumInst *)rInst.pData)->nValue ].nId ).getStr() ); +} + +/************************************************************************* +|* +|* RscEnum::WriteRc() +|* +|* Beschreibung +|* Ersterstellung MM 15.04.91 +|* Letzte Aenderung MM 15.04.91 +|* +*************************************************************************/ +ERRTYPE RscEnum::WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont *, sal_uInt32, BOOL ) +{ + aMem.Put( (INT32)pVarArray[ ((RscEnumInst *)rInst.pData)->nValue ].lValue ); + return( ERR_OK ); +} + +RscLangEnum::RscLangEnum() + : RscEnum( pHS->getID( "LangEnum" ), RSC_NOTYPE ), + mnLangId( 0x400 ) +{ +} diff --git a/rsc/source/res/rsccont.cxx b/rsc/source/res/rsccont.cxx new file mode 100644 index 000000000000..ffaac1c458a9 --- /dev/null +++ b/rsc/source/res/rsccont.cxx @@ -0,0 +1,1182 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rsccont.cxx,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +/****************** I N C L U D E S **************************************/ + +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +// Programmabh�ngige Includes. +#include <rsccont.hxx> + +#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 ); + rtl_freeMemory( 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( Atom nId, sal_uInt32 nTypeId, RscTop * pSuper, + BOOL bNoIdent ) + : RscTop( nId, nTypeId, pSuper ), + nSize( 0 ) +{ + 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 ) +{ + sal_uInt32 i = 0; + + if( pClassData->nEntries ){ + for( i = 0; i < pClassData->nEntries; i++ ){ + pClassData->pEntries[ i ].Destroy(); + }; + rtl_freeMemory( 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 ) +{ + sal_uInt32 i = 0; + RSCINST aInst; + RscBaseContInst * pClassData; + + if( !pInst ){ + aInst.pClass = this; + aInst.pData = (CLASS_DATA) rtl_allocateMemory( 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 *)rtl_allocateMemory( 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, sal_uInt32 nPos ) +{ + sal_uInt32 i = 0; + 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 *)rtl_reallocateMemory( pClassData->pEntries, + sizeof( ENTRY_STRUCT ) * (pClassData->nEntries +1) ); + } + else { + pClassData->pEntries = + (ENTRY_STRUCT *)rtl_allocateMemory( 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 +|* +*************************************************************************/ +sal_uInt32 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, sal_uInt32 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, sal_uInt32 nDestPos, + sal_uInt32 nSourcePos ) +{ + ERRTYPE aError; + RscBaseContInst * pClassData; + + pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); + + if( (nDestPos < pClassData->nEntries) && (nSourcePos < pClassData->nEntries) ){ + ENTRY_STRUCT aEntry; + int nInc = 1; + sal_uInt32 i = 0; + + // 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, sal_uInt32 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, sal_uInt32 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, const 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, INT32 lValue ){ + RscBaseContInst * pClassData; + RSCINST aTmpI; + ERRTYPE aError; + INT32 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, + Atom nValueId, + INT32 lValue +) +{ + RscBaseContInst * pClassData; + RSCINST aTmpI; + ERRTYPE aError; + Atom 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 ){ + sal_uInt32 i = 0; + 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( (INT32)pClassData->pEntries[ i ].aName > 0x7FFF + || (INT32)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 ) +{ + sal_uInt32 i = 0; + 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 ){ + sal_uInt32 i = 0; + 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 ) +{ + sal_uInt32 i = 0; + 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, sal_uInt32 nPos ){ + RscBaseContInst * pClassData; + sal_uInt32 i = 0; + + 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, sal_uInt32 nTab, + const char * pVarName ) +{ + sal_uInt32 i = 0, t = 0; + 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, sal_uInt32 nDeep, BOOL bExtra ) +{ + sal_uInt32 i = 0; + 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\tsal_uInt32 nItems = *(sal_uInt32 *)(pResData+nOffset) );\n" ); + fprintf( fOutput, "\t\tnOffset += sizeof( sal_uInt32 );\n" ); + + fprintf( fOutput, "\t\t// Items hinzufuegen\n" ); + fprintf( fOutput, "\t\tfor( sal_uInt32 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->getString( GetId() ).getStr() ); + 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, sal_uInt32 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, sal_uInt32 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 ) +{ + sal_uInt32 i = 0; + 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 ) +{ + sal_uInt32 i = 0; + 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( Atom nId, sal_uInt32 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, sal_uInt32 nTab, + const char * pVarName ) +{ + sal_uInt32 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( Atom nId, sal_uInt32 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, sal_uInt32 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( Atom nId, sal_uInt32 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, sal_uInt32 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..e57501069c7a --- /dev/null +++ b/rsc/source/res/rscflag.cxx @@ -0,0 +1,493 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscflag.cxx,v $ + * $Revision: 1.8 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +/****************** I N C L U D E S **************************************/ + +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <rscflag.hxx> + +/****************** 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( Atom nId, sal_uInt32 nTypeId ) + : RscConst( nId, nTypeId ) +{} + +/************************************************************************* +|* +|* 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 +|* +*************************************************************************/ +sal_uInt32 RscFlag::Size() +{ + return( ALIGNED_SIZE( sizeof( RscFlagInst ) * + ( 1 + (nEntries -1) / (sizeof( sal_uInt32 ) * 8) ) ) ); +} + +/************************************************************************* +|* +|* RscFlag::SetNotConst() +|* +|* Beschreibung +|* Ersterstellung MM 03.04.91 +|* Letzte Aenderung MM 03.04.91 +|* +*************************************************************************/ +ERRTYPE RscFlag::SetNotConst( const RSCINST & rInst, Atom nConst ) +{ + sal_uInt32 i = 0, nFlag = 0; + + if( nEntries != (i = GetConstPos( nConst )) ){ + nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) ); + i = i / (sizeof( sal_uInt32 ) * 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, Atom nConst, INT32 /*nVal*/ ) +{ + sal_uInt32 i = 0, nFlag = 0; + + if( nEntries != (i = GetConstPos( nConst )) ){ + nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) ); + i = i / (sizeof( sal_uInt32 ) * 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) rtl_allocateMemory( 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 ); + sal_uInt32 i = 0; + + 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 = 0xFFFFFFFF; + } + }; + + 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, Atom nConstId ) +{ + RSCINST aInst = CreateBasic( pInst ); + sal_uInt32 i = 0, nFlag = 0; + + if( !bOwnClass && rDfltI.IsInst() ) + bOwnClass = rDfltI.pClass->InHierarchy( this ); + + if( nEntries != (i = GetConstPos( nConstId )) ){ + nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) ); + i = i / (sizeof( sal_uInt32 ) * 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 ) +{ + sal_uInt32 i = 0; + + for( i = 0; i < Size() / sizeof( RscFlagInst ); i++ ) + ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags = 0xFFFFFFFF; +} + +/************************************************************************* +|* +|* RscFlag::IsDlft() +|* +|* Beschreibung +|* Ersterstellung MM 03.04.91 +|* Letzte Aenderung MM 03.04.91 +|* +*************************************************************************/ +BOOL RscFlag::IsDefault( const RSCINST & rInst ) +{ + sal_uInt32 i = 0; + + for( i = 0; i < Size() / sizeof( RscFlagInst ); i++ ) + if( ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags != 0xFFFFFFFF ) + return( FALSE ); + return( TRUE ); +} + +BOOL RscFlag::IsDefault( const RSCINST & rInst, Atom nConstId ) +{ + sal_uInt32 i = 0, nFlag = 0; + + if( nEntries != (i = GetConstPos( nConstId )) ){ + nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) ); + i = i / (sizeof( sal_uInt32 ) * 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, + Atom nConstId ) +{ + sal_uInt32 i = 0, nFlag = 0; + + if( nEntries != (i = GetConstPos( nConstId )) ){ + nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) ); + i = i / (sizeof( sal_uInt32 ) * 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 ) +{ + sal_uInt32 i = 0; + + if( pDef ){ + sal_uInt32 Flag = 0, nIndex = 0; + + Flag = 1; + for( i = 0; i < nEntries; i++ ){ + nIndex = i / (sizeof( sal_uInt32 ) * 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, Atom nConstId ) +{ + sal_uInt32 i = 0, nFlag = 0; + + if( nEntries != (i = GetConstPos( nConstId )) ){ + nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) ); + i = i / (sizeof( sal_uInt32 ) * 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 *, sal_uInt32, const char * ) +{ + sal_uInt32 i = 0, Flag = 0, nIndex = 0; + BOOL bComma = FALSE; + + Flag = 1; + for( i = 0; i < nEntries; i++ ){ + nIndex = i / (sizeof( sal_uInt32 ) * 8); + if( !( ((RscFlagInst *)rInst.pData)[ nIndex ].nDfltFlags & Flag) ){ + if( bComma ) + fprintf( fOutput, ", " ); + if( ((RscFlagInst *)rInst.pData)[ nIndex ].nFlags & Flag ) + fprintf( fOutput, "%s", pHS->getString( pVarArray[ i ].nId ).getStr() ); + else{ + fprintf( fOutput, "not " ); + fprintf( fOutput, "%s", pHS->getString( pVarArray[ i ].nId ).getStr() ); + } + 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 *, sal_uInt32, BOOL ) +{ + INT32 lVal = 0; + sal_uInt32 i = 0, Flag = 0, nIndex = 0; + + Flag = 1; + for( i = 0; i < nEntries; i++ ){ + nIndex = i / (sizeof( sal_uInt32 ) * 8); + if( ((RscFlagInst *)rInst.pData)[ nIndex ].nFlags & Flag ) + lVal |= pVarArray[ i ].lValue; + + Flag <<= 1; + if( !Flag ) + Flag = 1; + }; + + aMem.Put( (INT32)lVal ); + return( ERR_OK ); +} + +/************************************************************************* +|* +|* RscClient::RscClient() +|* +|* Beschreibung +|* Ersterstellung MM 08.04.91 +|* Letzte Aenderung MM 08.04.91 +|* +*************************************************************************/ +RscClient::RscClient( Atom nId, sal_uInt32 nTypeId, RscFlag * pClass, + Atom 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 *, sal_uInt32, 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..c756fc894b57 --- /dev/null +++ b/rsc/source/res/rscmgr.cxx @@ -0,0 +1,720 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscmgr.cxx,v $ + * $Revision: 1.9 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +/****************** 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. +#include <rscmgr.hxx> +#include <rscdb.hxx> + +/****************** 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( Atom nId, sal_uInt32 nTypeId, RscTop * pSuperCl ) + : RscClass( nId, nTypeId, pSuperCl ) +{ +} + +/************************************************************************* +|* +|* RscMgr::Size() +|* +|* Beschreibung +|* Ersterstellung MM 26.04.91 +|* Letzte Aenderung MM 26.04.91 +|* +*************************************************************************/ +sal_uInt32 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) rtl_allocateMemory( 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, sal_uInt32 nTab, + const RscId & rId, const char * pVarName ) +{ + RscMgrInst * pClassData; + sal_uInt32 i; + + pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); + + fprintf( fOutput, "%s %s", + pHS->getString( rInst.pClass->GetId() ).getStr(), + (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 *, sal_uInt32, + 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, + sal_uInt32 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->getString( rInst.pClass->GetId() ).getStr() ); + 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 + { + sal_uInt32 nOldSize; + sal_uInt32 nLocalSize; + + nOldSize = rMem.IncSize( 16 /*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 + sal_uInt32 nRT; // Resource Typ + sal_uInt32 nGlobOff; // Globaler Offset + sal_uInt32 nLocalOff; // Lokaler Offset + }; + */ + sal_uInt32 nID = rId; + rMem.PutAt( nOldSize, nID ); + rMem.PutAt( nOldSize +4, (sal_uInt32)rInst.pClass->GetTypId() ); + rMem.PutAt( nOldSize +8, (sal_uInt32)(rMem.Size() - nOldSize) ); + rMem.PutAt( nOldSize +12, (sal_uInt32)(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 *, sal_uInt32, 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->getString( pClass->GetId() ).getStr(); + 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->getString( rInst.pClass->GetId() ).getStr() ); + 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 if (pTC) + { + fprintf( fOutput, "class %s", + MakeName( pTC, rInst.pClass, + rId.GetName() ).GetBuffer() ); + fprintf( fOutput, " : public %s", + pHS->getString( rInst.pClass->GetId() ).getStr() ); + 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->getString( rInst.pClass->GetId() ).getStr() ); + 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->getString( rInst.pClass->GetId() ).getStr() ); + 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 if (pTC) + { + 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->getString( rInst.pClass->GetId() ).getStr() ); + 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 ) +{ + 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, sal_uInt32 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..4e265eeb3df7 --- /dev/null +++ b/rsc/source/res/rscrange.cxx @@ -0,0 +1,853 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscrange.cxx,v $ + * $Revision: 1.11 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +/****************** 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. +#include <rscrange.hxx> + +/****************** D E F I N E S ****************************************/ +/****************** 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( Atom nId, sal_uInt32 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( INT32 nMinimum, INT32 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, INT32 nValue ) +{ + if( nMax < nValue || nMin > nValue ) + return( ERR_RSCRANGE_OUTDEFSET ); + ((RscRangeInst *)rInst.pData)->nValue = (sal_uInt16)( 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, INT32 * 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) + rtl_allocateMemory( 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 = (sal_uInt16)(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 *, sal_uInt32, const char * ) +{ + fprintf( fOutput, "%ld", long( ((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 *, sal_uInt32, BOOL ) +{ + if( nMin >= 0 ) + { + sal_uInt16 n; + n = (sal_uInt16)(((RscRangeInst *)rInst.pData)->nValue + nMin); + aMem.Put( n ); + } + else + { + sal_Int16 n; + n = (sal_Int16)(((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, "*(sal_uInt32 *)(pResData+nOffset) );\n" ); + else + fprintf( fOutput, "*(sal_Int32 *)(pResData+nOffset) );\n" ); + fprintf( fOutput, "\t\tnOffset += sizeof( sal_uInt32 );\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( Atom nId, sal_uInt32 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( INT32 nMinimum, INT32 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( INT32 ) ); + + return FALSE; +} + +/************************************************************************* +|* +|* RscLongRange::SetNumber() +|* +|* Beschreibung +|* Ersterstellung MM 18.07.94 +|* Letzte Aenderung MM 18.07.94 +|* +*************************************************************************/ +ERRTYPE RscLongRange::SetNumber( const RSCINST & rInst, INT32 nValue ) +{ + if( nMax < nValue || nMin > nValue ) + return( ERR_RSCRANGE_OUTDEFSET ); + void * pData = &((RscLongRangeInst*)rInst.pData)->nValue; + memmove( pData, &nValue, sizeof( INT32 ) ); + ((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, INT32 * pN ) +{ + memmove( pN, &((RscLongRangeInst*)rInst.pData)->nValue, + sizeof( INT32 ) ); + 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) + rtl_allocateMemory( sizeof( RscLongRangeInst ) ); + } + else + aInst = *pInst; + if( !bOwnClass && rDflt.IsInst() ) + bOwnClass = rDflt.pClass->InHierarchy( this ); + + if( bOwnClass ) + memmove( aInst.pData, rDflt.pData, sizeof( RscLongRangeInst ) ); + else + { + INT32 lDflt; + if( 0L >= nMin && 0L <= nMax ) + lDflt = 0; + else + lDflt = nMin; + void * pData = &((RscLongRangeInst*)aInst.pData)->nValue; + memmove( pData, &lDflt, sizeof( INT32 ) ); + ((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 *, sal_uInt32, const char * ) +{ + INT32 lVal; + GetNumber( rInst, &lVal ); + fprintf( fOutput, "%d", static_cast<int>(lVal) ); +} + +/************************************************************************* +|* +|* RscLongRange::WriteRc() +|* +|* Beschreibung +|* Ersterstellung MM 18.07.94 +|* Letzte Aenderung MM 18.04.94 +|* +*************************************************************************/ +ERRTYPE RscLongRange::WriteRc( const RSCINST & rInst, RscWriteRc & aMem, + RscTypCont *, sal_uInt32, BOOL ) +{ + INT32 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" ); + 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( Atom nId, sal_uInt32 nTypeId ) + : RscLongRange( nId, nTypeId ) +{ +} + +/************************************************************************* +|* RscLongEnumRange::SetConst() +|* +|* Beschreibung +*************************************************************************/ +ERRTYPE RscLongEnumRange::SetConst( const RSCINST & rInst, Atom /*nConst*/, + INT32 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( Atom nId, sal_uInt32 nTypeId ) + : RscTop( nId, nTypeId ) +{ + nSize = ALIGNED_SIZE( sizeof( RscId ) ); + nMin = nMax = 0; +} + +/************************************************************************* +|* +|* 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)rtl_allocateMemory( 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( 0 >= nMin && 0 <= nMax ) + *pClassData = RscId( (INT32)0 ); + 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, INT32 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, INT32 * 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 *, sal_uInt32, 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 *, sal_uInt32, BOOL ) +{ + INT32 lVal = ((RscId*)rInst.pData)->GetNumber(); + + aMem.Put( (INT32)lVal ); + + return( ERR_OK ); +} + +//======================================================================= +void RscIdRange::WriteRcAccess +( + FILE * fOutput, + RscTypCont * /*pTC*/, + const char * pName +) +{ + fprintf( fOutput, "\t\tSet%s( ", pName ); + fprintf( fOutput, "GetLong( pResData+nOffset ) );\n" ); + fprintf( fOutput, "\t\tnOffset += sizeof( INT32 );\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( Atom nId, sal_uInt32 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 *, sal_uInt32, const char * ) +{ + INT32 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" ); + 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( Atom nId, sal_uInt32 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, INT32 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; + INT32 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..5130bb126b58 --- /dev/null +++ b/rsc/source/res/rscstr.cxx @@ -0,0 +1,404 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscstr.cxx,v $ + * $Revision: 1.8 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +/****************** I N C L U D E S **************************************/ + +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +// Programmabh�ngige Includes. +#include <rscdb.hxx> +#include <rscstr.hxx> + +#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( Atom nId, sal_uInt32 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, const char * pStr ){ + char * pTmp; + ERRTYPE aError; + + if( aError.IsOk() ){ + ((RscStringInst *)rInst.pData)->bDflt = FALSE; + + pTmp = ((RscStringInst *)rInst.pData)->pStr; + if( pTmp ){ + rtl_freeMemory( pTmp ); + pTmp = NULL; + } + + if( pStr ){ + sal_uInt32 nLen = strlen( pStr ) +1; + pTmp = (char *)rtl_allocateMemory( 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) + rtl_allocateMemory( 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 ) + rtl_freeMemory( ((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; + } + 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 *, sal_uInt32, 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(); + sal_uInt32 n = 0; + sal_uInt32 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, "\"\"" ); + } +} + +/************************************************************************* +|* +|* RscString::WriteRc() +|* +|* Beschreibung +|* Ersterstellung MM 15.04.91 +|* Letzte Aenderung MM 15.04.91 +|* +*************************************************************************/ +ERRTYPE RscString::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, + RscTypCont * pTC, sal_uInt32 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->getString( pRefClass->GetId() ).getStr() ); + 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 && pTC ) + { + char * pStr = RscChar::MakeUTF8( ((RscStringInst *)rInst.pData)->pStr, + pTC->GetSourceCharSet() ); + rMem.PutUTF8( pStr ); + rtl_freeMemory( pStr ); + } + else + 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..fd30e5218042 --- /dev/null +++ b/rsc/source/res/rsctop.cxx @@ -0,0 +1,997 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rsctop.cxx,v $ + * $Revision: 1.8 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +/****************** I N C L U D E S **************************************/ + +// C and C++ Includes. +#include <stdio.h> +#include <string.h> + +// Solar Definitionen +#include <tools/solar.h> +#include <rsctop.hxx> +/****************** 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( Atom nId, sal_uInt32 nTypIdent, RscTop * pSuperCl ) + : RefNode( nId ) + , pSuperClass( pSuperCl ) + , nTypId( nTypIdent ) +{ + 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 ); + rtl_freeMemory( aDfltInst.pData ); + aDfltInst = RSCINST(); + }; +} + +/************************************************************************* +|* +|* RscTop::GetConstant() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +Atom RscTop :: GetConstant( sal_uInt32 ){ + return InvalidAtom; +} + +/************************************************************************* +|* +|* 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 +|* +*************************************************************************/ +sal_uInt32 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( Atom nVarName, RscTop * pClass, + RSCINST * pDflt, RSCVAR nVarType, sal_uInt32 nMask, + Atom 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, + Atom 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, Atom 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, sal_uInt32 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, + Atom 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, + INT32 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, sal_uInt32 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, sal_uInt32 nDestPos, + sal_uInt32 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, sal_uInt32 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, sal_uInt32 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 +|* +*************************************************************************/ +sal_uInt32 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, INT32 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, Atom nId, INT32 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, Atom 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, const 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, INT32 * 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, Atom * 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, Atom nVarId ){ + if( pSuperClass ) + pSuperClass->SetDefault( rInst, nVarId ); +} + +/************************************************************************* +|* +|* RscTop::GetDefault() +|* +|* Beschreibung +|* Ersterstellung MM 29.10.91 +|* Letzte Aenderung MM 29.10.91 +|* +*************************************************************************/ +RSCINST RscTop::GetDefault( Atom 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, sal_uInt32 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, sal_uInt32 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, sal_uInt32 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, + sal_uInt32 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, sal_uInt32 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() != InvalidAtom ) + { + fprintf( fOutput, "class %s \n{\n", pHS->getString( GetId() ).getStr() ); + 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() != InvalidAtom ) + { + fprintf( fOutput, "\t\t//%s %s\n", + pHS->getString( GetId() ).getStr(), 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..89abd22207d9 --- /dev/null +++ b/rsc/source/rsc/makefile.mk @@ -0,0 +1,45 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.7 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=rsc +TARGET=rscrsc + +# --- Settings ------------------------------------------------------- + +ENABLE_EXCEPTIONS=true + +.INCLUDE : settings.mk + +OBJFILES= $(OBJ)$/rsc.obj + +.INCLUDE : target.mk diff --git a/rsc/source/rsc/rsc.cxx b/rsc/source/rsc/rsc.cxx new file mode 100644 index 000000000000..934c41d5e9a9 --- /dev/null +++ b/rsc/source/rsc/rsc.cxx @@ -0,0 +1,1389 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rsc.cxx,v $ + * $Revision: 1.29 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +/****************************************************************/ +/* Include File */ +/****************************************************************/ + +#include <stdlib.h> +#include <stdio.h> +#include <fcntl.h> + +#ifdef UNX +#include <unistd.h> +#include <sys/wait.h> +#include <sys/stat.h> +#else +#include <io.h> +#include <process.h> +#include <direct.h> +#endif + +#include <string.h> +#include <ctype.h> +#include <errno.h> + +#if defined( PM2 ) && defined( ZTC ) +#include <svpm.h> +#ifndef unlink +#define unlink( p ) DosDelete( (PSZ)(const char*)p ) +#endif +#endif + +#include <tools/fsys.hxx> +#include <tools/stream.hxx> +#include <rscerror.h> +#include <rsctop.hxx> +#include <rscdb.hxx> +#include <rscpar.hxx> +#include <rscrsc.hxx> +#include <rschash.hxx> + +#include <osl/file.h> +#include <osl/process.h> +#include <rtl/strbuf.hxx> +#include <rtl/tencinfo.h> +#include <rtl/textenc.h> + +#include <vector> + + +using namespace rtl; + +/*************** F o r w a r d s *****************************************/ +/*************** G l o b a l e V a r i a b l e n **********************/ +ByteString* pStdParType = NULL; +ByteString* pStdPar1 = NULL; +ByteString* pStdPar2 = NULL; +ByteString* pWinParType = NULL; +ByteString* pWinPar1 = NULL; +ByteString* pWinPar2 = NULL; +sal_uInt32 nRefDeep = 10; +AtomContainer* pHS = NULL; + + +/*************** 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() +{ + nCommands = 0; + nByteOrder = RSC_BIGENDIAN; + + DirEntry aEntry; + aPath = ByteString( aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US ); //Immer im Aktuellen Pfad suchen + m_aOutputFiles.clear(); + m_aOutputFiles.push_back( OutputFile() ); +} + +/************************************************************************* +|* +|* 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( int argc, char ** argv, RscError * pEH ) +{ + char * pStr; + char ** ppStr; + RscPtrPtr aCmdLine; // Kommandozeile + ByteString aString; + sal_uInt32 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 < (aCmdLine.GetCount() -1) ) + { +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "CmdLineArg: \"%s\"\n", *ppStr ); +#endif + 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 = 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_strnicmp( (*ppStr) + 1, "sub", 3 ) ) + { + const char* pEqual; + for( pEqual = (*ppStr)+4; *pEqual && *pEqual != '='; ++pEqual ) + ; + if( *pEqual ) + { + const ByteString aSPath( pEqual + 1 ); + DirEntry aSDir( String( aSPath, RTL_TEXTENCODING_ASCII_US ) ); + + m_aReplacements.push_back( std::pair< OString, OString >( OString( (*ppStr)+4, pEqual - *ppStr - 4 ), + ByteString( aSDir.GetFull(), RTL_TEXTENCODING_ASCII_US ) ) ); + } + } + 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=", 3 ) ) + { // anderer Name fuer .rc-file + if( m_aOutputFiles.back().aOutputRc.Len() ) + m_aOutputFiles.push_back( OutputFile() ); + m_aOutputFiles.back().aOutputRc = (*ppStr) + 4; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "lip=", 4 ) ) + { // additional language specific include for system dependent files + const ByteString aSysSearchDir( (*ppStr)+5 ); + DirEntry aSysDir( String( aSysSearchDir, RTL_TEXTENCODING_ASCII_US ) ); + + m_aOutputFiles.back().aSysSearchDirs.push_back( ByteString( aSysDir.GetFull(), RTL_TEXTENCODING_ASCII_US ) ); + + if( m_aOutputFiles.back().aLangSearchPath.Len() ) + m_aOutputFiles.back().aLangSearchPath.Append( ByteString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US ) ); + + m_aOutputFiles.back().aLangSearchPath.Append( aSysSearchDir ); + } + else if( !rsc_strnicmp( (*ppStr) + 1, "fp=", 3 ) ) + { // anderer Name fuer .srs-file + aOutputSrs = (*ppStr) + 4; + bOutputSrsIsSet = TRUE; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "fl=", 3 ) ) + { // Name fuer listing-file + aOutputLst = (*ppStr) + 4; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "fh=", 3 ) ) + { // Name fuer .hxx-file + aOutputHxx = (*ppStr) + 4; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "fc=", 3 ) ) + { // Name fuer .cxx-file + aOutputCxx = (*ppStr) + 4; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "fr=", 3 ) ) + { // Name fuer .cxx-file der Ressource Konstruktoren + aOutputRcCtor = (*ppStr) + 4; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "fx=", 3 ) ) + { // Name fuer .src-file + aOutputSrc = (*ppStr) + 4; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "ft=", 3 ) ) + { // touch file + aTouchFile = (*ppStr) + 4; + } + else if( !rsc_strnicmp( (*ppStr) + 1, "oil=", 4 ) ) + { + aILDir = (*ppStr) + 5; + } + 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 ) ) + { + // ignore (was an option once) + } + else if( !rsc_stricmp( (*ppStr) + 1, "lg" ) ) + { + m_aOutputFiles.back().aLangName = ByteString(); + } + else if( !rsc_strnicmp( (*ppStr) + 1, "lg", 2 ) ) + { + if( m_aOutputFiles.back().aLangName.Len() ) + m_aOutputFiles.push_back( OutputFile() ); + m_aOutputFiles.back().aLangName = ByteString( (*ppStr)+3 ); + } + 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() ) + { + ::std::list<OutputFile>::iterator it; + for( it = m_aOutputFiles.begin(); it != m_aOutputFiles.end(); ++it ) + { + if( ! it->aOutputRc.Len() ) + it->aOutputRc = ::OutputFile( *aInputList.First(), "rc" ); + } + if( ! bOutputSrsIsSet ) + aOutputSrs = ::OutputFile( *aInputList.First(), "srs" ); + } + else if( !(nCommands & PRINTSYNTAX_FLAG) ) + pEH->FatalError( ERR_NOINPUT, RscId() ); +} + +/************************************************************************* +|* +|* 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; +} + +/************************************************************************* +|* +|* RscCmdLine::substitutePaths() +|* +*************************************************************************/ + +OString RscCmdLine::substitutePaths( const OString& rIn ) +{ + // prepare return value + OStringBuffer aRet( 256 ); + std::list< std::pair< OString, OString > >::const_iterator last_match = m_aReplacements.end(); + + // search for longest replacement match + for( std::list< std::pair< OString, OString > >::const_iterator repl = m_aReplacements.begin(); repl != m_aReplacements.end(); ++repl ) + { + if( rIn.compareTo( repl->second, repl->second.getLength() ) == 0 ) // path matches + { + if( last_match == m_aReplacements.end() || last_match->second.getLength() < repl->second.getLength() ) + last_match = repl; + } + } + + // copy replacement found and rest of rIn + sal_Int32 nIndex = 0; + if( last_match != m_aReplacements.end() ) + { + aRet.append( "%" ); + aRet.append( last_match->first ); + aRet.append( "%" ); + nIndex = last_match->second.getLength(); + } + aRet.append( rIn.copy( nIndex ) ); + + return aRet.makeStringAndClear(); +} + +/*************** 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( 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 ); + } + }; + + if ( pTC->pEH->GetVerbosity() >= RscVerbosityVerbose ) + { + 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 = 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 ", RscVerbosityVerbose ); + pTC->pEH->StdOut( pCL->aOutputSrs.GetBuffer(), RscVerbosityVerbose ); + pTC->pEH->StdOut( ".\n", RscVerbosityVerbose ); + + // 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 ", RscVerbosityVerbose ); + pTC->pEH->StdOut( pCL->aOutputHxx.GetBuffer(), RscVerbosityVerbose ); + pTC->pEH->StdOut( ".\n", RscVerbosityVerbose ); + + // 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 ", RscVerbosityVerbose ); + pTC->pEH->StdOut( pCL->aOutputCxx.GetBuffer(), RscVerbosityVerbose ); + pTC->pEH->StdOut( ".\n", RscVerbosityVerbose ); + + // 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 ", RscVerbosityVerbose ); + pTC->pEH->StdOut( pCL->aOutputRcCtor.GetBuffer(), RscVerbosityVerbose ); + pTC->pEH->StdOut( ".\n", RscVerbosityVerbose ); + + // 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( pCL->aTouchFile.Len() ) + { + FILE* fp = fopen( pCL->aTouchFile.GetBuffer(), "w" ); + if( fp ) + { + fprintf( fp, "Done\n" ); + fclose( fp ); + } + else + pTC->pEH->FatalError( ERR_OPENFILE, RscId(), pCL->aTouchFile.GetBuffer() ); + } +} + +/************************************************************************* +|* +|* 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 ); + + 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, + const RscCmdLine::OutputFile* pOutputFile, + const WriteRcContext* pContext ) +{ + 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(), pOutputFile, pContext ); + pFName->Seek( pDep ); + pDep = pFName->Next(); + } + + if( aError.IsError() ) + pFName->bLoaded = FALSE; //bei Fehler nicht geladenen + else + { + String aTmpName( ::GetTmpFileName(), RTL_TEXTENCODING_ASCII_US ); + DirEntry aTmpPath( aTmpName ), aSrsPath( String( pFName->aPathName.GetBuffer(), RTL_TEXTENCODING_ASCII_US ) ); + + aTmpPath.ToAbs(); + aSrsPath.ToAbs(); + + if( pContext && pOutputFile ) + PreprocessSrsFile( *pOutputFile, *pContext, aSrsPath, aTmpPath ); + else + aSrsPath.CopyTo( aTmpPath, FSYS_ACTION_COPYFILE ); + + ByteString aParseFile( aTmpPath.GetFull(), RTL_TEXTENCODING_ASCII_US ); + finput = fopen( aParseFile.GetBuffer(), "r" ); + + if( !finput ) + { + pTC->pEH->Error( ERR_OPENFILE, NULL, RscId(), pFName->aPathName.GetBuffer() ); + aError = ERR_OPENFILE; + } + else + { + RscFileInst aFileInst( pTC, lFileKey, lFileKey, finput ); + + pTC->pEH->StdOut( "reading file ", RscVerbosityVerbose ); + pTC->pEH->StdOut( aParseFile.GetBuffer(), RscVerbosityVerbose ); + pTC->pEH->StdOut( " ", RscVerbosityVerbose ); + + aError = ::parser( &aFileInst ); + if( aError.IsError() ) + pTC->Delete( lFileKey );//Resourceobjekte loeschen + pTC->pEH->StdOut( "\n", RscVerbosityVerbose ); + fclose( finput ); + }; + + aTmpPath.Kill(); + }; + }; + + return( aError ); +} + +/************************************************************************* +|* +|* RscCompiler :: Link() +|* +|* Beschreibung +|* Ersterstellung MM 07.02.91 +|* Letzte Aenderung MM 07.02.91 +|* +*************************************************************************/ + +static OString do_prefix( const char* pPrefix, const OUString& rFile ) +{ + OStringBuffer aBuf(256); + aBuf.append( pPrefix ); + aBuf.append( ":" ); + aBuf.append( OUStringToOString( rFile, RTL_TEXTENCODING_MS_1252 ) ); + return aBuf.makeStringAndClear(); +} + +ERRTYPE RscCompiler::Link() +{ + FILE * foutput; + ERRTYPE aError; + RscFile* pFName; + +#ifdef UNX +#define PATHSEP '/' +#else +#define PATHSEP '\\' +#endif + + if( !(pCL->nCommands & NOLINK_FLAG) ) + { + ::std::list<RscCmdLine::OutputFile>::const_iterator it; + + for( it = pCL->m_aOutputFiles.begin(); it != pCL->m_aOutputFiles.end(); ++it ) + { + // cleanup nodes + for( pFName = pTC->aFileTab.First(); pFName && aError.IsOk(); pFName = pTC->aFileTab.Next() ) + { + if( !pFName->IsIncFile() ) + { + pTC->Delete( pTC->aFileTab.GetIndex( pFName ) ); + pTC->aFileTab.Seek( pFName ); + pFName->bLoaded = FALSE; + } + } + + // rc-Datei schreiben + ByteString aDir( it->aOutputRc ); + aDir.SetToken( aDir.GetTokenCount( PATHSEP )-1, PATHSEP, ByteString() ); + if( ! aDir.Len() ) + { + char aBuf[1024]; + if( getcwd( aBuf, sizeof( aBuf ) ) ) + { + aDir = aBuf; + aDir.Append( PATHSEP ); + } + } + // work dir for absolute Urls + OUString aCWD, aTmpUrl; + osl_getProcessWorkingDir( &aCWD.pData ); + + // get two temp file urls + OString aRcTmp, aSysListTmp, aSysList; + OUString aSysPath, aUrlDir; + aSysPath = OStringToOUString( aDir, RTL_TEXTENCODING_MS_1252 ); + if( osl_getFileURLFromSystemPath( aSysPath.pData, &aUrlDir.pData ) != osl_File_E_None ) + pTC->pEH->FatalError( ERR_OPENFILE, RscId(), do_prefix( "url conversion", aUrlDir ) ); + + if( osl_getAbsoluteFileURL( aCWD.pData, aUrlDir.pData, &aTmpUrl.pData ) != osl_File_E_None ) + pTC->pEH->FatalError( ERR_OPENFILE, RscId(), do_prefix( "absolute url", aUrlDir ) ); + aUrlDir = aTmpUrl; + + // create temp file for rc target + if( osl_createTempFile( aUrlDir.pData, NULL, &aTmpUrl.pData ) != osl_File_E_None ) + pTC->pEH->FatalError( ERR_OPENFILE, RscId(), do_prefix( "temp file creation", aUrlDir ) ); + + if( osl_getSystemPathFromFileURL( aTmpUrl.pData, &aSysPath.pData ) != osl_File_E_None ) + pTC->pEH->FatalError( ERR_OPENFILE, RscId(), do_prefix( "sys path conversion", aTmpUrl ) ); + aRcTmp = OUStringToOString( aSysPath, RTL_TEXTENCODING_MS_1252 ); + + if ( NULL == (fExitFile = foutput = fopen( aRcTmp.getStr(), "wb" )) ) + pTC->pEH->FatalError( ERR_OPENFILE, RscId(), aRcTmp.getStr() ); + + // make absolute path from IL dir (-oil switch) + // if no -oil was given, use the same dir as for rc file + if( pCL->aILDir.Len() ) + { + aSysPath = OStringToOUString( pCL->aILDir, RTL_TEXTENCODING_MS_1252 ); + if( osl_getFileURLFromSystemPath( aSysPath.pData, &aTmpUrl.pData ) != osl_File_E_None ) + pTC->pEH->FatalError( ERR_OPENFILE, RscId(), do_prefix( "url conversion", aSysPath ) ); + if( osl_getAbsoluteFileURL( aCWD.pData, aTmpUrl.pData, &aUrlDir.pData ) != osl_File_E_None ) + pTC->pEH->FatalError( ERR_OPENFILE, RscId(), do_prefix( "absolute url", aTmpUrl ) ); + } + + if( osl_getSystemPathFromFileURL( aUrlDir.pData, &aSysPath.pData ) != osl_File_E_None ) + pTC->pEH->FatalError( ERR_OPENFILE, RscId(), do_prefix( "sys path conversion", aUrlDir ) ); + + aSysList = OUStringToOString( aSysPath, RTL_TEXTENCODING_MS_1252 ); + aSysList = aSysList + "/"; + xub_StrLen nLastSep = it->aOutputRc.SearchBackward( PATHSEP ); + if( nLastSep == STRING_NOTFOUND ) + nLastSep = 0; + xub_StrLen nLastPt = it->aOutputRc.Search( '.', nLastSep ); + if( nLastPt == STRING_NOTFOUND ) + nLastPt = it->aOutputRc.Len()+1; + aSysList = aSysList + it->aOutputRc.Copy( nLastSep+1, nLastPt - nLastSep-1 ); + aSysList = aSysList + ".ilst"; + // create temp file for sys list target + if( osl_createTempFile( aUrlDir.pData, NULL, &aTmpUrl.pData ) != osl_File_E_None ) + pTC->pEH->FatalError( ERR_OPENFILE, RscId(), do_prefix( "temp file creation", aUrlDir ) ); + + if( osl_getSystemPathFromFileURL( aTmpUrl.pData, &aSysPath.pData ) != osl_File_E_None ) + pTC->pEH->FatalError( ERR_OPENFILE, RscId(), do_prefix( "sys path conversion", aTmpUrl ) ); + aSysListTmp = OUStringToOString( aSysPath, RTL_TEXTENCODING_MS_1252 ); + + pTC->pEH->StdOut( "Generating .rc file\n" ); + + rtl_TextEncoding aEnc = RTL_TEXTENCODING_UTF8; + //if( it->aLangName.CompareIgnoreCaseToAscii( "de", 2 ) == COMPARE_EQUAL ) + // aEnc = RTL_TEXTENCODING_MS_1252; + + // Schreibe Datei + sal_Char cSearchDelim = ByteString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US ).GetChar( 0 ); + sal_Char cAccessDelim = ByteString( DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US ).GetChar( 0 ); + pTC->ChangeLanguage( it->aLangName ); + pTC->SetSourceCharSet( aEnc ); + pTC->ClearSysNames(); + ByteString aSysSearchPath( it->aLangSearchPath ); + xub_StrLen nIndex = 0; + ByteString aSearchPath = pTC->GetSearchPath(); + while( nIndex != STRING_NOTFOUND ) + { + ByteString aToken = aSearchPath.GetToken( 0, cSearchDelim, nIndex ); + if( aSysSearchPath.Len() ) + aSysSearchPath.Append( cSearchDelim ); + aSysSearchPath.Append( aToken ); + aSysSearchPath.Append( cAccessDelim ); + aSysSearchPath.Append( it->aLangName ); + aSysSearchPath.Append( cSearchDelim ); + aSysSearchPath.Append( aToken ); + } +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "setting search path for language %s: %s\n", it->aLangName.GetBuffer(), aSysSearchPath.GetBuffer() ); +#endif + pTC->SetSysSearchPath( aSysSearchPath ); + + WriteRcContext aContext; + + aContext.fOutput = foutput; + aContext.aOutputRc = it->aOutputRc; + aContext.aOutputSysList = aSysListTmp; + aContext.pCmdLine = pCL; + + // create empty sys list + if( aContext.aOutputSysList.getLength() ) + { + FILE* pSysListFile = fopen( aContext.aOutputSysList.getStr(), "wb" ); + + if( !pSysListFile ) + pTC->pEH->FatalError( ERR_OPENFILE, RscId(), aContext.aOutputSysList.getStr() ); + else + fclose( pSysListFile ); + } + + // parse files for specific language + for( pFName = pTC->aFileTab.First(); pFName && aError.IsOk(); pFName = pTC->aFileTab.Next() ) + { + if( !pFName->IsIncFile() ) + { + aError = ParseOneFile( pTC->aFileTab.GetIndex( pFName ), &*it, &aContext ); + pTC->aFileTab.Seek( pFName ); + } + }; + + aError = pTC->WriteRc( aContext ); + + fclose( foutput ); + fExitFile = NULL; + unlink( it->aOutputRc.GetBuffer() ); + if( rename( aRcTmp.getStr(), it->aOutputRc.GetBuffer() ) ) + { + OStringBuffer aBuf; + aBuf.append( aRcTmp ); + aBuf.append( " -> " ); + aBuf.append( it->aOutputRc ); + pTC->pEH->FatalError( ERR_RENAMEFILE, RscId(), aBuf.getStr() ); + } + else + { +#ifdef UNX + chmod( it->aOutputRc.GetBuffer(), S_IRWXU | S_IRWXG | S_IROTH ); +#endif + } + + unlink( aSysList.getStr() ); + if( rename( aSysListTmp.getStr(), aSysList.getStr() ) ) + { + OStringBuffer aBuf; + aBuf.append( aSysListTmp ); + aBuf.append( " -> " ); + aBuf.append( aSysList ); + pTC->pEH->FatalError( ERR_RENAMEFILE, RscId(), aBuf.getStr() ); + } + else + { +#ifdef UNX + chmod( aSysList.getStr(), S_IRWXU | S_IRWXG | S_IROTH ); +#endif + } + } + } + else + { + // parse files + for( pFName = pTC->aFileTab.First(); pFName && aError.IsOk(); pFName = pTC->aFileTab.Next() ) + { + if( !pFName->IsIncFile() ) + { + aError = ParseOneFile( pTC->aFileTab.GetIndex( pFName ), NULL, NULL ); + pTC->aFileTab.Seek( pFName ); + } + }; + } + + // 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 ); +} + +/************************************************************************* +|* +|* GetImageFilePath() +|* +|*************************************************************************/ + +bool RscCompiler::GetImageFilePath( const RscCmdLine::OutputFile& rOutputFile, + const WriteRcContext& rContext, + const ByteString& rBaseFileName, + ByteString& rImagePath, + FILE* pSysListFile ) +{ + ::std::list< ByteString > aFileNames; + bool bFound = false; + + ByteString aFileName( rBaseFileName ); + aFileNames.push_back( aFileName += ".png" ); + + aFileName = rBaseFileName; + aFileNames.push_back( aFileName += ".bmp" ); + + ::std::list< ByteString >::iterator aFileIter( aFileNames.begin() ); + + while( ( aFileIter != aFileNames.end() ) && !bFound ) + { + ::std::list< ByteString >::const_iterator aDirIter( rOutputFile.aSysSearchDirs.begin() ); + + while( ( aDirIter != rOutputFile.aSysSearchDirs.end() ) && !bFound ) + { + const DirEntry aPath( String( *aDirIter, RTL_TEXTENCODING_ASCII_US ) ); + DirEntry aRelPath( aPath ); + DirEntry aAbsPath( aRelPath += DirEntry( String( *aFileIter, RTL_TEXTENCODING_ASCII_US ) ) ); + + aAbsPath.ToAbs(); + const FileStat aFS( aAbsPath.GetFull() ); + +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "Searching image: %s\n", ByteString( aRelPath.GetFull(), RTL_TEXTENCODING_ASCII_US ).GetBuffer() ); +#endif + + if( aFS.IsKind( FSYS_KIND_FILE ) ) + { + std::list< std::pair< OString, OString > >::const_iterator aReplIter( rContext.pCmdLine->m_aReplacements.begin() ); + String aStr( aRelPath.GetFull() ); + OString aRelPathStr( aStr.GetBuffer(), aStr.Len(), RTL_TEXTENCODING_ASCII_US ); + + while( ( aReplIter != rContext.pCmdLine->m_aReplacements.end() ) && !bFound ) + { + ByteString aSearch( aReplIter->second ); + aSearch.ToLowerAscii(); + ByteString aSearchIn( aRelPathStr ); + aSearchIn.ToLowerAscii(); + if( aSearchIn.Search( aSearch ) == 0 ) + { + sal_Int32 nCopyPos = aReplIter->second.getLength(), nLength = aRelPathStr.getLength(); + const sal_Char* pChars = aRelPathStr.getStr(); + + while( ( nCopyPos < nLength ) && ( pChars[ nCopyPos ] == '/' || pChars[ nCopyPos ] == '\\' || pChars[ nCopyPos ] == ':' ) ) + { + ++nCopyPos; + } + + if( nCopyPos < nLength ) + rImagePath = aRelPathStr.copy( nCopyPos ).replace( '\\', '/' ); + + bFound = true; + } + + ++aReplIter; + } + + if( bFound && pSysListFile ) + { + DirEntry aSysPath( String( *aDirIter, RTL_TEXTENCODING_ASCII_US ) ); + String aSysPathFull( ( aSysPath += DirEntry( String( *aFileIter, RTL_TEXTENCODING_ASCII_US ) ) ).GetFull() ); + OString aSysPathStr( aSysPathFull.GetBuffer(), aSysPathFull.Len(), RTL_TEXTENCODING_ASCII_US ); + + fprintf( pSysListFile, "%s\n", rContext.pCmdLine->substitutePaths( aSysPathStr ).getStr() ); + } + +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "ImagePath to add: %s\n", rImagePath.GetBuffer() ); +#endif + } + + ++aDirIter; + } + + ++aFileIter; + } + + return bFound; +} + +// ------------------------------------------------------------------------------ + +void RscCompiler::PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile, + const WriteRcContext& rContext, + const DirEntry& rSrsInPath, + const DirEntry& rSrsOutPath ) +{ + SvFileStream aIStm( rSrsInPath.GetFull(), STREAM_READ ); + SvFileStream aOStm( rSrsOutPath.GetFull(), STREAM_WRITE | STREAM_TRUNC ); + ::std::vector< ByteString > aMissingImages; + FILE* pSysListFile = rContext.aOutputSysList.getLength() ? fopen( rContext.aOutputSysList.getStr(), "ab" ) : NULL; + bool bRet = true; + + if( !aIStm.GetError() && !aOStm.GetError() ) + { + ByteString aLine, aFilePath; + + while( aIStm.ReadLine( aLine ) ) + { + if( ( aLine.GetTokenCount( '=' ) == 2 ) && + ( aLine.GetToken( 0, '=' ).Search( "File" ) != STRING_NOTFOUND ) ) + { + ByteString aBaseFileName( aLine.GetToken( 1, '"' ).GetToken( 0, '.' ) ); + + if( GetImageFilePath( rOutputFile, rContext, aBaseFileName, aFilePath, pSysListFile ) ) + ( ( aLine = "File = \"" ) += aFilePath ) += "\";"; + else + aMissingImages.push_back( aBaseFileName ); + + aOStm.WriteLine( aLine ); + } + else if( aLine.Search( "ImageList" ) != STRING_NOTFOUND ) + { + ::std::vector< ::std::pair< ByteString, sal_Int32 > > aEntryVector; + + aOStm.WriteLine( aLine ); + + if( aLine.Search( ';' ) == STRING_NOTFOUND ) + { + const sal_uInt32 nImgListStartPos = aIStm.Tell(); + + do + { + if( !aIStm.ReadLine( aLine ) ) + break; + } + while( aLine.Search( "Prefix" ) == STRING_NOTFOUND ); + + const ByteString aPrefix( aLine.GetToken( 1, '"' ) ); + aIStm.Seek( nImgListStartPos ); + + do + { + if (!aIStm.ReadLine( aLine ) ) + break; + } + while( aLine.Search( "IdList" ) == STRING_NOTFOUND ); + + // scan all ids and collect images + while( aLine.Search( '}' ) == STRING_NOTFOUND ) + { + if( !aIStm.ReadLine( aLine ) ) + break; + + aLine.EraseLeadingChars( ' ' ); + aLine.EraseLeadingChars( '\t' ); + aLine.EraseAllChars( ';' ); + + if( aLine.IsNumericAscii() ) + { + ByteString aBaseFileName( aPrefix ); + sal_Int32 nNumber = atoi( aLine.GetBuffer() ); + + if( nNumber < 10000 ) + aBaseFileName += ByteString::CreateFromInt32( 0 ); + + if( GetImageFilePath( rOutputFile, rContext, aBaseFileName += aLine , aFilePath, pSysListFile ) ) + aEntryVector.push_back( ::std::make_pair< ByteString, sal_Int32 >( aFilePath, nNumber ) ); + else + aMissingImages.push_back( aBaseFileName ); + } + } + + const sal_uInt32 nImgListEndPos = aIStm.Tell(); + aIStm.Seek( nImgListStartPos ); + while( aIStm.Tell() < nImgListEndPos ) + { + aIStm.ReadLine( aLine ); + + if( aLine.Search( "IdList" ) != STRING_NOTFOUND ) + { + while( aLine.Search( '}' ) == STRING_NOTFOUND ) + aIStm.ReadLine( aLine ); + } + else + aOStm.WriteLine( aLine ); + } + + aOStm.WriteLine( "FileList = {" ); + + for( sal_uInt32 i = 0; i < aEntryVector.size(); ++i ) + { + ByteString aEntryString( "< \"" ); + + aEntryString += aEntryVector[ i ].first; + aEntryString += "\"; "; + aEntryString += ByteString::CreateFromInt32( aEntryVector[ i ].second ); + aEntryString += "; >;"; + + aOStm.WriteLine( aEntryString ); + } + + aOStm.WriteLine( "};" ); + } + else + aOStm.WriteLine( aLine ); + } + else + aOStm.WriteLine( aLine ); + } + } + else + bRet = false; + + if( aMissingImages.size() > 0 ) + { + ByteString aImagesStr; + + for( sal_uInt32 i = 0; i < aMissingImages.size(); ++i ) + { + if( i ) + aImagesStr += ' '; + + aImagesStr += aMissingImages[ i ]; + } + + pTC->pEH->FatalError( ERR_NOIMAGE, RscId(), aImagesStr.GetBuffer() ); + } + + if( pSysListFile ) + fclose( pSysListFile ); +} diff --git a/rsc/source/rscpp/cpp.h b/rsc/source/rscpp/cpp.h new file mode 100644 index 000000000000..18f7336cf50d --- /dev/null +++ b/rsc/source/rscpp/cpp.h @@ -0,0 +1,418 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cpp.h,v $ + * $Revision: 1.8 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef TRUE +#define TRUE 1 +#define FALSE 0 +#endif + +/* in cpp1.c: file-pointer auf stdout oder file */ +extern FILE *pCppOut; /* BP */ +#define PUTCHAR( d ) fprintf( pCppOut, "%c", (d) ) /* BP */ +#if OSL_DEBUG_LEVEL > 1 +extern FILE *pDefOut; /* ER */ +#ifdef EVALDEFS +#define NEVALBUF 2048 +#endif +#endif + +/* limit for reading commandfiles */ +#define PARALIMIT 100 + +#ifndef EOS +/* + * This is predefined in Decus C + */ +#define EOS '\0' /* End of string */ +#endif +#define EOF_CHAR 0 /* Returned by get() on eof */ +#define NULLST ((char *) NULL) /* Pointer to nowhere (linted) */ +#define DEF_NOARGS (-1) /* #define foo vs #define foo() */ + +/* + * The following may need to change if the host system doesn't use ASCII. + */ +#define DEF_MAGIC 0x1D /* Magic for #defines */ +#define TOK_SEP 0x1E /* Token concatenation delim. */ +#define COM_SEP 0x1F /* Magic comment separator */ + +#ifdef EBCDIC +#define HT 0x05 /* horizontal tab */ +#define NL 0x15 /* new line */ +#define CR 0x0D /* carriage return */ +#define DEL 0x07 +#else +#define HT 0x09 /* horizontal tab */ +#define NL 0x0A /* new line */ +#define CR 0x0D /* carriage return */ +#define DEL 0x7F +#endif + + +#ifdef SOLAR +#define MAC_PARM 0x01 /* Macro formals start here */ +#else +/* + * Note -- in Ascii, the following will map macro formals onto DEL + the + * C1 control character region (decimal 128 .. (128 + PAR_MAC)) which will + * be ok as long as PAR_MAC is less than 33). Note that the last PAR_MAC + * value is reserved for string substitution. + */ + +#define MAC_PARM DEL /* Macro formals start here */ +#if PAR_MAC >= 33 + assertion fails -- PAR_MAC is not less than 33 +#endif +#endif +#define LASTPARM (PAR_MAC - 1) + +/* + * Character type codes. + */ + +#define INV 0 /* Invalid, must be zero */ +#define OP_EOE INV /* End of expression */ +#define DIG 1 /* Digit */ +#define LET 2 /* Identifier start */ +#define FIRST_BINOP OP_ADD +#define OP_ADD 3 +#define OP_SUB 4 +#define OP_MUL 5 +#define OP_DIV 6 +#define OP_MOD 7 +#define OP_ASL 8 +#define OP_ASR 9 +#define OP_AND 10 /* &, not && */ +#define OP_OR 11 /* |, not || */ +#define OP_XOR 12 +#define OP_EQ 13 +#define OP_NE 14 +#define OP_LT 15 +#define OP_LE 16 +#define OP_GE 17 +#define OP_GT 18 +#define OP_ANA 19 /* && */ +#define OP_ORO 20 /* || */ +#define OP_QUE 21 /* ? */ +#define OP_COL 22 /* : */ +#define OP_CMA 23 /* , (relevant?) */ +#define LAST_BINOP OP_CMA /* Last binary operand */ +/* + * The following are unary. + */ +#define FIRST_UNOP OP_PLU /* First Unary operand */ +#define OP_PLU 24 /* + (draft ANSI standard) */ +#define OP_NEG 25 /* - */ +#define OP_COM 26 /* ~ */ +#define OP_NOT 27 /* ! */ +#define LAST_UNOP OP_NOT +#define OP_LPA 28 /* ( */ +#define OP_RPA 29 /* ) */ +#define OP_END 30 /* End of expression marker */ +#define OP_MAX (OP_END + 1) /* Number of operators */ +#define OP_FAIL (OP_END + 1) /* For error returns */ + +/* + * The following are for lexical scanning only. + */ + +#define QUO 65 /* Both flavors of quotation */ +#define DOT 66 /* . might start a number */ +#define SPA 67 /* Space and tab */ +#define BSH 68 /* Just a backslash */ +#define END 69 /* EOF */ + +/* + * These bits are set in ifstack[] + */ +#define WAS_COMPILING 1 /* TRUE if compile set at entry */ +#define ELSE_SEEN 2 /* TRUE when #else processed */ +#define TRUE_SEEN 4 /* TRUE when #if TRUE processed */ + +/* + * Define bits for the basic types and their adjectives + */ + +#define T_CHAR 1 +#define T_INT 2 +#define T_FLOAT 4 +#define T_DOUBLE 8 +#define T_SHORT 16 +#define T_LONG 32 +#define T_SIGNED 64 +#define T_UNSIGNED 128 +#define T_PTR 256 /* Pointer */ +#define T_FPTR 512 /* Pointer to functions */ + +/* + * The DEFBUF structure stores information about #defined + * macros. Note that the defbuf->repl information is always + * in malloc storage. + */ + +typedef struct defbuf { + struct defbuf *link; /* Next define in chain */ + char *repl; /* -> replacement */ + int hash; /* Symbol table hash */ + int nargs; /* For define(args) */ + char name[1]; /* #define name */ +} DEFBUF; + +/* + * The FILEINFO structure stores information about open files + * and macros being expanded. + */ + +typedef struct fileinfo { + char *bptr; /* Buffer pointer */ + int line; /* for include or macro */ + FILE *fp; /* File if non-null */ + struct fileinfo *parent; /* Link to includer */ + char *filename; /* File/macro name */ + char *progname; /* From #line statement */ + unsigned int unrecur; /* For macro recursion */ + char buffer[1]; /* current input line */ +} FILEINFO; + +/* + * The SIZES structure is used to store the values for #if sizeof + */ + +typedef struct sizes { + short bits; /* If this bit is set, */ + int size; /* this is the datum size value */ + int psize; /* this is the pointer size */ +} SIZES; +/* + * nomacarg is a built-in #define on Decus C. + */ + +#ifdef nomacarg +#define cput output /* cput concatenates tokens */ +#else +#if COMMENT_INVISIBLE +#define cput(c) { if (c != TOK_SEP && c != COM_SEP) PUTCHAR(c); } +#else +#define cput(c) { if (c != TOK_SEP) PUTCHAR(c); } +#endif +#endif + +#ifndef nomacarg +#define streq(s1, s2) (strcmp(s1, s2) == 0) +#endif + +/* + * Error codes. VMS uses system definitions. + * Decus C codes are defined in stdio.h. + * Others are cooked to order. + */ + +#if HOST == SYS_VMS +#include <ssdef.h> +#include <stsdef.h> +#define IO_NORMAL (SS$_NORMAL | STS$M_INHIB_MSG) +#define IO_ERROR SS$_ABORT +#endif +/* + * Note: IO_NORMAL and IO_ERROR are defined in the Decus C stdio.h file + */ +#ifndef IO_NORMAL +#define IO_NORMAL 0 +#endif +#ifndef IO_ERROR +#define IO_ERROR 1 +#endif + +/* + * Externs + */ + +extern int line; /* Current line number */ +extern int wrongline; /* Force #line to cc pass 1 */ +extern char type[]; /* Character classifier */ +extern char token[IDMAX + 1]; /* Current input token */ +extern int instring; /* TRUE if scanning string */ +extern int inmacro; /* TRUE if scanning #define */ +extern int errors; /* Error counter */ +extern int recursion; /* Macro depth counter */ +extern char ifstack[BLK_NEST]; /* #if information */ +#define compiling ifstack[0] +extern char *ifptr; /* -> current ifstack item */ +extern char *incdir[NINCLUDE]; /* -i directories */ +extern char **incend; /* -> active end of incdir */ +extern int cflag; /* -C option (keep comments) */ +extern int eflag; /* -E option (ignore errors) */ +extern int nflag; /* -N option (no pre-defines) */ +extern int rec_recover; /* unwind recursive macros */ +extern char *preset[]; /* Standard predefined symbols */ +extern char *magic[]; /* Magic predefined symbols */ +extern FILEINFO *infile; /* Current input file */ +extern char work[NWORK + 1]; /* #define scratch */ +extern char *workp; /* Free space in work */ +#if OSL_DEBUG_LEVEL > 1 +extern int debug; /* Debug level */ +/* ER dump & evaluate #define's */ +extern int bDumpDefs; /* TRUE if #define's dump req. */ +extern int bIsInEval; /* TRUE if #define dumping now */ +#ifdef EVALDEFS +extern char EvalBuf[NEVALBUF + 1]; /* evaluation buffer */ +extern int nEvalOff; /* offset to free buffer pos */ +#endif +#endif +extern int keepcomments; /* Don't remove comments if set */ +extern SIZES size_table[]; /* For #if sizeof sizes */ + +#ifdef NOMAIN /* BP */ +#ifndef _NO_PROTO +int start_cpp( int argc, char *argv[] ); +#endif +#define MAIN start_cpp /* fuer die cpp.lib muss main() geandert werden */ +#else +#ifdef WNT +#define MAIN __cdecl main +#else +#define MAIN main +#endif +#endif + + +void InitCpp1(); +void InitCpp2(); +void InitCpp3(); +void InitCpp4(); +void InitCpp5(); +void InitCpp6(); + +#define HELLO() fprintf( stderr, "[Hello at %s, %d] ", __FILE__, __LINE__ ) + +#ifndef _STDIO_H +#include <stdio.h> +#endif + +#ifndef _STDLIB_H +#include <stdlib.h> +#endif + +#ifndef _STRING_H +#include <string.h> +#endif + +/* cpp1.c */ +void output( int c ); +void sharp(); +void cppmain(); +#if OSL_DEBUG_LEVEL > 1 +#ifdef EVALDEFS +int outputEval( int c ); +#endif +#endif + + +/* cpp2.c */ +int control( int counter ); +void doinclude(); +void dodefine(); +void doif( int hash ); +int openinclude( char *, int ); +int hasdirectory(char *, char * ); +int openfile( char * ); + +/* cpp3.c */ +int openfiles( char *filename ); +void addfile( FILE *fp, char *filename ); +void setincdirs(); +int AddInclude( char *pIncStr ); +int getredirection( int argc, char **argv ); +void zap_uc( char *ap ); + +void initdefines(); +int dooptions( int argc, char *argv[] ); +int readoptions(char* filename, char*** pfargv); + +/* cpp4.c */ +void dodefines(); +void checkparm( int c, DEFBUF *dp ); +int expcollect(); +void expstuff( DEFBUF *dp ); + +#if STRING_FORMAL +void stparmscan( int delim, DEFBUF *dp); +#else +void stparmscan( int delim); +#endif +#if OSL_DEBUG_LEVEL > 1 +void dumpparm( char *why ); +#endif + +void doundef(); +void textput( char *text ); +void charput( int c ); +void expand( DEFBUF *tokenp ); + +/* cpp5.c */ +int eval(); +int evallex(int); +int *evaleval(int *, int, int ); +int evalchar(int); +int dosizeof(); +int evalnum( int c ); +int bittest( int ); + +/* cpp6.c */ + +void skipnl(); +int skipws(); +void scanid( int c ); +int macroid( int c ); +int catenate(); +int scanstring( int c, void (*outfun)( int c ) ); +void scannumber( int c, void (*outfun)( int c ) ); +void save( int c ); +char *savestring( char *text ); +FILEINFO *getfile( int bufsize, char *name); +char *getmem( int size ); +DEFBUF *lookid( int c ); +DEFBUF *defendel( char *name, int delete ); +void dunpdef( char *why ); +void dumpadef( char *why, DEFBUF *dp); +int get(); +int cget(); +void unget(); +void ungetstring( char *text ); +void cerror( char *format, char *sarg); +void cwarn( char *format, char *sarg); +void cfatal( char *format, char *sarg); +void cierror( char *format, int n); +void ciwarn( char *format, int n); +#if OSL_DEBUG_LEVEL > 1 +void dumpdef( char *why ); +void dumpadef( char *why, DEFBUF *dp ); +#endif diff --git a/rsc/source/rscpp/cpp1.c b/rsc/source/rscpp/cpp1.c new file mode 100644 index 000000000000..e3ac953a83c7 --- /dev/null +++ b/rsc/source/rscpp/cpp1.c @@ -0,0 +1,619 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cpp1.c,v $ + * $Revision: 1.11 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <stdio.h> +#include <ctype.h> +#include "cppdef.h" +#include "cpp.h" + +FILE *pCppOut = NULL; +FILE *pCppIn = NULL; + +#if OSL_DEBUG_LEVEL > 1 +FILE *pDefOut = NULL; /* ER evtl. #define's dump */ +#endif + +#ifdef B200 +/* BP, 25.07.91, einzige Moeglichkeit unter BC Stack und Heap festzusetzen */ +extern unsigned _stklen = 24000; +extern unsigned _heaplen = 30000; +#endif + + + +/* + * Commonly used global variables: + * line is the current input line number. + * wrongline is set in many places when the actual output + * line is out of sync with the numbering, e.g, + * when expanding a macro with an embedded newline. + * + * token holds the last identifier scanned (which might + * be a candidate for macro expansion). + * errors is the running cpp error counter. + * infile is the head of a linked list of input files (extended by + * #include and macros being expanded). infile always points + * to the current file/macro. infile->parent to the includer, + * etc. infile->fd is NULL if this input stream is a macro. + */ +int line; /* Current line number */ +int wrongline; /* Force #line to compiler */ +char token[IDMAX + 1]; /* Current input token */ +int errors; /* cpp error counter */ +FILEINFO *infile = NULL; /* Current input file */ +#if OSL_DEBUG_LEVEL > 1 +int debug; /* TRUE if debugging now */ +int bDumpDefs; /* TRUE if #define's dump req. */ +#ifdef EVALDEFS +int bIsInEval; /* TRUE if #define eval now */ +char EvalBuf[NEVALBUF + 1]; /* evaluation buffer */ +int nEvalOff = 0; /* offset to free buffer pos */ +#endif +#endif +/* + * This counter is incremented when a macro expansion is initiated. + * If it exceeds a built-in value, the expansion stops -- this tests + * for a runaway condition: + * #define X Y + * #define Y X + * X + * This can be disabled by falsifying rec_recover. (Nothing does this + * currently: it is a hook for an eventual invocation flag.) + */ +int recursion; /* Infinite recursion counter */ +int rec_recover = TRUE; /* Unwind recursive macros */ + +/* + * instring is set TRUE when a string is scanned. It modifies the + * behavior of the "get next character" routine, causing all characters + * to be passed to the caller (except <DEF_MAGIC>). Note especially that + * comments and \<newline> are not removed from the source. (This + * prevents cpp output lines from being arbitrarily long). + * + * inmacro is set by #define -- it absorbs comments and converts + * form-feed and vertical-tab to space, but returns \<newline> + * to the caller. Strictly speaking, this is a bug as \<newline> + * shouldn't delimit tokens, but we'll worry about that some other + * time -- it is more important to prevent infinitly long output lines. + * + * instring and inmarcor are parameters to the get() routine which + * were made global for speed. + */ +int instring = FALSE; /* TRUE if scanning string */ +int inmacro = FALSE; /* TRUE if #defining a macro */ + +/* + * work[] and workp are used to store one piece of text in a temporay + * buffer. To initialize storage, set workp = work. To store one + * character, call save(c); (This will fatally exit if there isn't + * room.) To terminate the string, call save(EOS). Note that + * the work buffer is used by several subroutines -- be sure your + * data won't be overwritten. The extra byte in the allocation is + * needed for string formal replacement. + */ +char work[NWORK + 1]; /* Work buffer */ +char *workp; /* Work buffer pointer */ + +/* + * keepcomments is set TRUE by the -C option. If TRUE, comments + * are written directly to the output stream. This is needed if + * the output from cpp is to be passed to lint (which uses commands + * embedded in comments). cflag contains the permanent state of the + * -C flag. keepcomments is always falsified when processing #control + * commands and when compilation is supressed by a false #if + * + * If eflag is set, CPP returns "success" even if non-fatal errors + * were detected. + * + * If nflag is non-zero, no symbols are predefined except __LINE__. + * __FILE__, and __DATE__. If nflag > 1, absolutely no symbols + * are predefined. + */ +int keepcomments = FALSE; /* Write out comments flag */ +int cflag = FALSE; /* -C option (keep comments) */ +int eflag = FALSE; /* -E option (never fail) */ +int nflag = 0; /* -N option (no predefines) */ + +/* + * ifstack[] holds information about nested #if's. It is always + * accessed via *ifptr. The information is as follows: + * WAS_COMPILING state of compiling flag at outer level. + * ELSE_SEEN set TRUE when #else seen to prevent 2nd #else. + * TRUE_SEEN set TRUE when #if or #elif succeeds + * ifstack[0] holds the compiling flag. It is TRUE if compilation + * is currently enabled. Note that this must be initialized TRUE. + */ +char ifstack[BLK_NEST] = { TRUE }; /* #if information */ +char *ifptr = ifstack; /* -> current ifstack[] */ + +/* + * incdir[] stores the -i directories (and the system-specific + * #include <...> directories. + */ +char *incdir[NINCLUDE]; /* -i directories */ +char **incend = incdir; /* -> free space in incdir[] */ + +/* + * This is the table used to predefine target machine and operating + * system designators. It may need hacking for specific circumstances. + * Note: it is not clear that this is part of the Ansi Standard. + * The -N option supresses preset definitions. + */ +char *preset[] = { /* names defined at cpp start */ +#ifdef MACHINE + MACHINE, +#endif +#ifdef SYSTEM + SYSTEM, +#endif +#ifdef COMPILER + COMPILER, +#endif +#if OSL_DEBUG_LEVEL > 1 + "decus_cpp", /* Ourselves! */ +#endif + NULL /* Must be last */ +}; + +/* + * The value of these predefined symbols must be recomputed whenever + * they are evaluated. The order must not be changed. + */ +char *magic[] = { /* Note: order is important */ + "__LINE__", + "__FILE__", + NULL /* Must be last */ +}; + +static char *sharpfilename = NULL; + +int nRunde = 0; + +void InitCpp1() +{ + int i; + /* BP */ + /* in der LIB-Version muessen alle Variablen initialisiert werden */ + + line = wrongline = errors = recursion = 0; + for( i = 0; i < IDMAX; i++ ) + token[ i ] = 0; + + for( i = 0; i < NWORK; i++ ) + work[ i ] = 0; + + for( i = 0; i < NINCLUDE; i++ ) + incdir[ i ] = NULL; + + workp = NULL; + for( i = 0; i < BLK_NEST; i++ ) + ifstack[ i ] = TRUE; + ifptr = ifstack; + + pCppOut = stdout; + pCppIn = stdin; +#if OSL_DEBUG_LEVEL > 1 + debug = 0; + bDumpDefs = 0; + pDefOut = stdout; +#ifdef EVALDEFS + bIsInEval = 0; + for( i = 0; i < NEVALBUF; i++ ) + EvalBuf[ i ] = 0; + nEvalOff = 0; +#endif +#endif + rec_recover = TRUE; + infile = NULL; + instring = inmacro = keepcomments = cflag = eflag = FALSE; + nflag = 0; + incend = incdir; + sharpfilename = NULL; + /* BP */ +} + +int MAIN(int argc, char** argv) +{ + register int i; + char **useargv, **pfargv; + + +if( nRunde == 0 ) +{ + pCppIn = stdin; + pCppOut = stdout; +} + +nRunde++; + InitCpp1(); + InitCpp2(); + InitCpp3(); + InitCpp4(); + InitCpp5(); + InitCpp6(); + +#if HOST == SYS_VMS + argc = getredirection(argc, argv); /* vms >file and <file */ +#endif + initdefines(); /* O.S. specific def's */ + if ( argv[argc-1][0] == '@' ) + { + i = readoptions( argv[1], &pfargv ); /* Command file */ + useargv=pfargv; + } + else + { + i = dooptions(argc, argv); /* Command line -flags */ + useargv=argv; + } + switch (i) { +#if OSL_DEBUG_LEVEL > 1 + case 4: + if ( bDumpDefs ) + { + /* + * Get defBase file, "-" means use stdout. + */ + if (!streq(useargv[3], "-")) { +#if HOST == SYS_VMS + /* + * On vms, reopen stdout with "vanilla rms" attributes. + */ + if ((i = creat(useargv[3], 0, "rat=cr", "rfm=var")) == -1 + || dup2(i, fileno(stdout)) == -1) { +#else +/* alt if (freopen(useargv[3], "w", stdout) == NULL) { */ + + pDefOut = fopen( useargv[3], "w" ); + if( pDefOut == NULL ) { +#endif + perror(useargv[3]); + cerror("Can't open output file \"%s\"", useargv[3]); + exit(IO_ERROR); + } + } /* Continue by opening output */ + } +/* OSL_DEBUG_LEVEL > 1 */ +#endif + case 3: + /* + * Get output file, "-" means use stdout. + */ + if (!streq(useargv[2], "-")) { +#if HOST == SYS_VMS + /* + * On vms, reopen stdout with "vanilla rms" attributes. + */ + if ((i = creat(useargv[2], 0, "rat=cr", "rfm=var")) == -1 + || dup2(i, fileno(stdout)) == -1) { +#else +/* alt if (freopen(useargv[2], "w", stdout) == NULL) { */ + + pCppOut = fopen( useargv[2], "w" ); + if( pCppOut == NULL ) { +#endif + perror(useargv[2]); + cerror("Can't open output file \"%s\"", useargv[2]); + exit(IO_ERROR); + } + } /* Continue by opening input */ + case 2: /* One file -> stdin */ + /* + * Open input file, "-" means use stdin. + */ + if (!streq(useargv[1], "-")) { +/* alt: if (freopen(useargv[1], "r", stdin) == NULL) { */ + pCppIn = fopen( useargv[1], "r" ); + if( pCppIn == NULL) { + perror(useargv[1]); + cerror("Can't open input file \"%s\"", useargv[1]); + exit(IO_ERROR); + } + strcpy(work, useargv[1]); /* Remember input filename */ + break; + } /* Else, just get stdin */ + case 0: /* No args? */ + case 1: /* No files, stdin -> stdout */ +#if (HOST == SYS_UNIX) || (HOST == SYS_UNKNOWN) + work[0] = EOS; /* Unix can't find stdin name */ +#else + fgetname(stdin, work); /* Vax-11C, Decus C know name */ +#endif + break; + + default: + exit(IO_ERROR); /* Can't happen */ + } +/* if ( pfargv ) + { + for ( j=0;j++;j < PARALIMIT ) + { + if (pfargv[j]!=0) + free(pfargv[j]); + } + free(pfargv); + } +*/ + + setincdirs(); /* Setup -I include directories */ + addfile( pCppIn, work); /* "open" main input file */ +#if OSL_DEBUG_LEVEL > 1 + if (debug > 0 || bDumpDefs) + dumpdef("preset #define symbols"); +#endif + if( pCppIn != stdin ) + rewind( pCppIn ); + + cppmain(); /* Process main file */ + + if ((i = (ifptr - &ifstack[0])) != 0) { +#if OLD_PREPROCESSOR + ciwarn("Inside #ifdef block at end of input, depth = %d", i); +#else + cierror("Inside #ifdef block at end of input, depth = %d", i); +#endif + } +#if OSL_DEBUG_LEVEL > 1 + if( pDefOut != stdout && pDefOut != stderr ) + fclose( pDefOut ); +#endif + if( pCppOut != stdout && pCppOut != stderr ) + fclose( pCppOut ); + + if (errors > 0) { + fprintf(stderr, (errors == 1) + ? "%d error in preprocessor\n" + : "%d errors in preprocessor\n", errors); + if (!eflag) + exit(IO_ERROR); + } +#ifdef NOMAIN /* BP */ /* kein exit im der LIB-Version */ + return( IO_NORMAL ); +#else + exit(IO_NORMAL); /* No errors or -E option set */ +#endif + +} + +FILE_LOCAL +void cppmain() +/* + * Main process for cpp -- copies tokens from the current input + * stream (main file, include file, or a macro) to the output + * file. + */ +{ + register int c; /* Current character */ + register int counter; /* newlines and spaces */ + + /* + * Explicitly output a #line at the start of cpp output so + * that lint (etc.) knows the name of the original source + * file. If we don't do this explicitly, we may get + * the name of the first #include file instead. + * We also seem to need a blank line following that first #line. + */ +#ifdef EVALDEFS + if ( !bIsInEval ) +#endif + { + sharp(); + PUTCHAR('\n'); + } + /* + * This loop is started "from the top" at the beginning of each line + * wrongline is set TRUE in many places if it is necessary to write + * a #line record. (But we don't write them when expanding macros.) + * + * The counter variable has two different uses: at + * the start of a line, it counts the number of blank lines that + * have been skipped over. These are then either output via + * #line records or by outputting explicit blank lines. + * When expanding tokens within a line, the counter remembers + * whether a blank/tab has been output. These are dropped + * at the end of the line, and replaced by a single blank + * within lines. + */ + for (;;) { + counter = 0; /* Count empty lines */ + for (;;) { /* For each line, ... */ + while (type[(c = get())] == SPA) /* Skip leading blanks */ + ; /* in this line. */ + if (c == '\n') /* If line's all blank, */ + ++counter; /* Do nothing now */ + else if (c == '#') { /* Is 1st non-space '#' */ + keepcomments = FALSE; /* Don't pass comments */ + counter = control(counter); /* Yes, do a #command */ + keepcomments = (cflag && compiling); + } + else if (c == EOF_CHAR) /* At end of file? */ + { + break; + } + else if (!compiling) { /* #ifdef false? */ + skipnl(); /* Skip to newline */ + counter++; /* Count it, too. */ + } + else { + break; /* Actual token */ + } + } + if (c == EOF_CHAR) /* Exit process at */ + break; /* End of file */ + /* + * If the loop didn't terminate because of end of file, we + * know there is a token to compile. First, clean up after + * absorbing newlines. counter has the number we skipped. + */ + if ((wrongline && infile->fp != NULL) || counter > 4) + sharp(); /* Output # line number */ + else { /* If just a few, stuff */ + while (--counter >= 0) /* them out ourselves */ + PUTCHAR('\n'); + } + /* + * Process each token on this line. + */ + unget(); /* Reread the char. */ + for (;;) { /* For the whole line, */ + do { /* Token concat. loop */ + for (counter = 0; (type[(c = get())] == SPA);) { +#if COMMENT_INVISIBLE + if (c != COM_SEP) + counter++; +#else + counter++; /* Skip over blanks */ +#endif + } + if (c == EOF_CHAR || c == '\n') + goto end_line; /* Exit line loop */ + else if (counter > 0) /* If we got any spaces */ + PUTCHAR(' '); /* Output one space */ + c = macroid(c); /* Grab the token */ + } while (type[c] == LET && catenate()); + if (c == EOF_CHAR || c == '\n') /* From macro exp error */ + goto end_line; /* Exit line loop */ + switch (type[c]) { + case LET: + fputs(token, pCppOut); /* Quite ordinary token */ +#ifdef EVALDEFS + { + int len; + if ( bIsInEval + && nEvalOff + (len=strlen(token)) < NEVALBUF ) + { + strcpy( &EvalBuf[nEvalOff], token ); + nEvalOff += len; + } + } +#endif + break; + + + case DIG: /* Output a number */ + case DOT: /* Dot may begin floats */ +#ifdef EVALDEFS + if ( bIsInEval ) + scannumber(c, outputEval); + else + scannumber(c, output); +#else + scannumber(c, output); +#endif + break; + + case QUO: /* char or string const */ + scanstring(c, output); /* Copy it to output */ + break; + + default: /* Some other character */ + cput(c); /* Just output it */ +#ifdef EVALDEFS + if ( bIsInEval && nEvalOff < NEVALBUF ) + EvalBuf[nEvalOff++] = c; +#endif + break; + } /* Switch ends */ + } /* Line for loop */ +end_line: if (c == '\n') { /* Compiling at EOL? */ + PUTCHAR('\n'); /* Output newline, if */ + if (infile->fp == NULL) /* Expanding a macro, */ + wrongline = TRUE; /* Output # line later */ + } + } /* Continue until EOF */ +#ifdef EVALDEFS + if ( bIsInEval ) + EvalBuf[nEvalOff++] = '\0'; +#endif +} + +void output(int c) +/* + * Output one character to stdout -- output() is passed as an + * argument to scanstring() + */ +{ +#if COMMENT_INVISIBLE + if (c != TOK_SEP && c != COM_SEP) +#else + if (c != TOK_SEP) +#endif +/* alt: PUTCHAR(c); */ + PUTCHAR(c); +} + +#ifdef EVALDEFS +outputEval(c) +int c; +/* + * Output one character to stdout -- output() is passed as an + * argument to scanstring() + */ +{ +#if COMMENT_INVISIBLE + if (c != TOK_SEP && c != COM_SEP) +#else + if (c != TOK_SEP) +#endif +/* alt: PUTCHAR(c); */ + { + PUTCHAR(c); + if ( bIsInEval && nEvalOff < NEVALBUF ) + EvalBuf[nEvalOff++] = c; + } +} +#endif + + +FILE_LOCAL +void sharp() +/* + * Output a line number line. + */ +{ + register char *name; + + if (keepcomments) /* Make sure # comes on */ + PUTCHAR('\n'); /* a fresh, new line. */ + fprintf( pCppOut, "#%s %d", LINE_PREFIX, line); + if (infile->fp != NULL) { + name = (infile->progname != NULL) + ? infile->progname : infile->filename; + if (sharpfilename == NULL + || (sharpfilename != NULL && !streq(name, sharpfilename)) ) { + if (sharpfilename != NULL) + free(sharpfilename); + sharpfilename = savestring(name); + fprintf( pCppOut, " \"%s\"", name); + } + } + PUTCHAR('\n'); + wrongline = FALSE; +} diff --git a/rsc/source/rscpp/cpp2.c b/rsc/source/rscpp/cpp2.c new file mode 100644 index 000000000000..de2664c3a7a7 --- /dev/null +++ b/rsc/source/rscpp/cpp2.c @@ -0,0 +1,628 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cpp2.c,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <stdio.h> +#include <ctype.h> +#include "cppdef.h" +#include "cpp.h" +#if HOST == SYS_VMS +/* + * Include the rms stuff. (We can't just include rms.h as it uses the + * VaxC-specific library include syntax that Decus CPP doesn't support. + * By including things by hand, we can CPP ourself.) + */ +#include <nam.h> +#include <fab.h> +#include <rab.h> +#include <rmsdef.h> +#endif + +/* + * Generate (by hand-inspection) a set of unique values for each control + * operator. Note that this is not guaranteed to work for non-Ascii + * machines. CPP won't compile if there are hash conflicts. + */ + +#define L_assert ('a' + ('s' << 1)) +#define L_define ('d' + ('f' << 1)) +#define L_elif ('e' + ('i' << 1)) +#define L_else ('e' + ('s' << 1)) +#define L_endif ('e' + ('d' << 1)) +#define L_if ('i' + (EOS << 1)) +#define L_ifdef ('i' + ('d' << 1)) +#define L_ifndef ('i' + ('n' << 1)) +#define L_include ('i' + ('c' << 1)) +#define L_line ('l' + ('n' << 1)) +#define L_nogood (EOS + (EOS << 1)) /* To catch #i */ +#define L_pragma ('p' + ('a' << 1)) +#define L_undef ('u' + ('d' << 1)) +#define L_error ('e' + ('r' << 1)) /* BP 5.3.92, #error */ +#define MAXLINE 80 /* BP 5.3.92, #error */ +#if OSL_DEBUG_LEVEL > 1 +#define L_debug ('d' + ('b' << 1)) /* #debug */ +#define L_nodebug ('n' + ('d' << 1)) /* #nodebug */ +#endif + + +void InitCpp2() +{ + +} + + +int +control(int counter) +/* + * Process #control lines. Simple commands are processed inline, + * while complex commands have their own subroutines. + * + * The counter is used to force out a newline before #line, and + * #pragma commands. This prevents these commands from ending up at + * the end of the previous line if cpp is invoked with the -C option. + */ +{ + register int c; + register char *tp; + register int hash; + char *ep; + + c = skipws(); + if (c == '\n' || c == EOF_CHAR) + return (counter + 1); + if (!isdigit(c)) + scanid(c); /* Get #word to token[] */ + else { + unget(); /* Hack -- allow #123 as a */ + strcpy(token, "line"); /* synonym for #line 123 */ + } + hash = (token[1] == EOS) ? L_nogood : (token[0] + (token[2] << 1)); + switch (hash) { + case L_assert: tp = "assert"; break; + case L_define: tp = "define"; break; + case L_elif: tp = "elif"; break; + case L_else: tp = "else"; break; + case L_endif: tp = "endif"; break; + case L_if: tp = "if"; break; + case L_ifdef: tp = "ifdef"; break; + case L_ifndef: tp = "ifndef"; break; + case L_include: tp = "include"; break; + case L_line: tp = "line"; break; + case L_pragma: tp = "pragma"; break; + case L_undef: tp = "undef"; break; + case L_error: tp = "error"; break; +#if OSL_DEBUG_LEVEL > 1 + case L_debug: tp = "debug"; break; + case L_nodebug: tp = "nodebug"; break; +#endif + default: hash = L_nogood; + case L_nogood: tp = ""; break; + } + if (!streq(tp, token)) + hash = L_nogood; + /* + * hash is set to a unique value corresponding to the + * control keyword (or L_nogood if we think it's nonsense). + */ + if (infile->fp == NULL) + cwarn("Control line \"%s\" within macro expansion", token); + if (!compiling) { /* Not compiling now */ + switch (hash) { + case L_if: /* These can't turn */ + case L_ifdef: /* compilation on, but */ + case L_ifndef: /* we must nest #if's */ + if (++ifptr >= &ifstack[BLK_NEST]) + goto if_nest_err; + *ifptr = 0; /* !WAS_COMPILING */ + case L_line: /* Many */ + /* + * Are pragma's always processed? + */ + case L_pragma: /* options */ + case L_include: /* are uninteresting */ + case L_define: /* if we */ + case L_undef: /* aren't */ + case L_assert: /* compiling. */ + case L_error: /* BP 5.3.92, #error */ +dump_line: skipnl(); /* Ignore rest of line */ + return (counter + 1); + } + } + /* + * Make sure that #line and #pragma are output on a fresh line. + */ + if (counter > 0 && (hash == L_line || hash == L_pragma)) { + PUTCHAR('\n'); + counter--; + } + switch (hash) { + case L_line: + /* + * Parse the line to update the line number and "progname" + * field and line number for the next input line. + * Set wrongline to force it out later. + */ + c = skipws(); + workp = work; /* Save name in work */ + while (c != '\n' && c != EOF_CHAR) { + save(c); + c = get(); + } + unget(); + save(EOS); + /* + * Split #line argument into <line-number> and <name> + * We subtract 1 as we want the number of the next line. + */ + line = atoi(work) - 1; /* Reset line number */ + for (tp = work; isdigit(*tp) || type[(int)*tp] == SPA; tp++) + ; /* Skip over digits */ + if (*tp != EOS) { /* Got a filename, so: */ + if (*tp == '"' && (ep = strrchr(tp + 1, '"')) != NULL) { + tp++; /* Skip over left quote */ + *ep = EOS; /* And ignore right one */ + } + if (infile->progname != NULL) /* Give up the old name */ + free(infile->progname); /* if it's allocated. */ + infile->progname = savestring(tp); + } + wrongline = TRUE; /* Force output later */ + break; + + case L_include: + doinclude(); + break; + + case L_define: + dodefine(); + break; + + case L_undef: + doundef(); + break; + + case L_else: + if (ifptr == &ifstack[0]) + goto nest_err; + else if ((*ifptr & ELSE_SEEN) != 0) + goto else_seen_err; + *ifptr |= ELSE_SEEN; + if ((*ifptr & WAS_COMPILING) != 0) { + if (compiling || (*ifptr & TRUE_SEEN) != 0) + compiling = FALSE; + else { + compiling = TRUE; + } + } + break; + + case L_elif: + if (ifptr == &ifstack[0]) + goto nest_err; + else if ((*ifptr & ELSE_SEEN) != 0) { +else_seen_err: cerror("#%s may not follow #else", token); + goto dump_line; + } + if ((*ifptr & (WAS_COMPILING | TRUE_SEEN)) != WAS_COMPILING) { + compiling = FALSE; /* Done compiling stuff */ + goto dump_line; /* Skip this clause */ + } + doif(L_if); + break; + + case L_if: + case L_ifdef: + case L_ifndef: + if (++ifptr >= &ifstack[BLK_NEST]) +if_nest_err: cfatal("Too many nested #%s statements", token); + *ifptr = WAS_COMPILING; + doif(hash); + break; + + case L_endif: + if (ifptr == &ifstack[0]) { +nest_err: cerror("#%s must be in an #if", token); + goto dump_line; + } + if (!compiling && (*ifptr & WAS_COMPILING) != 0) + wrongline = TRUE; + compiling = ((*ifptr & WAS_COMPILING) != 0); + --ifptr; + break; + + case L_assert: + if (eval() == 0) + cerror("Preprocessor assertion failure", NULLST); + break; + + case L_pragma: + /* + * #pragma is provided to pass "options" to later + * passes of the compiler. cpp doesn't have any yet. + */ + fprintf( pCppOut, "#pragma "); + while ((c = get()) != '\n' && c != EOF_CHAR) + cput(c); + unget(); + break; + +#if OSL_DEBUG_LEVEL > 1 + case L_debug: + if (debug == 0) + dumpdef("debug set on"); + debug++; + break; + + case L_nodebug: + debug--; + break; +#endif + case L_error: /* BP 5.3.92, #error */ + { + fprintf( pCppOut, "cpp: line %u, Error directive: ", line ); + while ((c = get()) != '\n' && c != EOF_CHAR) + cput(c); + fprintf( pCppOut, "\n" ); + exit( 1 ); + break; + } + default: + /* + * Undefined #control keyword. + * Note: the correct behavior may be to warn and + * pass the line to a subsequent compiler pass. + * This would allow #asm or similar extensions. + */ + cerror("Illegal # command \"%s\"", token); + break; + } + if (hash != L_include) { +#if OLD_PREPROCESSOR + /* + * Ignore the rest of the #control line so you can write + * #if foo + * #endif foo + */ + goto dump_line; /* Take common exit */ +#else + if (skipws() != '\n') { + cwarn("Unexpected text in #control line ignored", NULLST); + skipnl(); + } +#endif + } + return (counter + 1); +} + +FILE_LOCAL +void doif(int hash) +/* + * Process an #if, #ifdef, or #ifndef. The latter two are straightforward, + * while #if needs a subroutine of its own to evaluate the expression. + * + * doif() is called only if compiling is TRUE. If false, compilation + * is always supressed, so we don't need to evaluate anything. This + * supresses unnecessary warnings. + */ +{ + register int c; + register int found; + + if ((c = skipws()) == '\n' || c == EOF_CHAR) { + unget(); + goto badif; + } + if (hash == L_if) { + unget(); + found = (eval() != 0); /* Evaluate expr, != 0 is TRUE */ + hash = L_ifdef; /* #if is now like #ifdef */ + } + else { + if (type[c] != LET) /* Next non-blank isn't letter */ + goto badif; /* ... is an error */ + found = (lookid(c) != NULL); /* Look for it in symbol table */ + } + if (found == (hash == L_ifdef)) { + compiling = TRUE; + *ifptr |= TRUE_SEEN; + } + else { + compiling = FALSE; + } + return; + +badif: cerror("#if, #ifdef, or #ifndef without an argument", NULLST); +#if !OLD_PREPROCESSOR + skipnl(); /* Prevent an extra */ + unget(); /* Error message */ +#endif + return; +} + +FILE_LOCAL +void doinclude() +/* + * Process the #include control line. + * There are three variations: + * #include "file" search somewhere relative to the + * current source file, if not found, + * treat as #include <file>. + * #include <file> Search in an implementation-dependent + * list of places. + * #include token Expand the token, it must be one of + * "file" or <file>, process as such. + * + * Note: the November 12 draft forbids '>' in the #include <file> format. + * This restriction is unnecessary and not implemented. + */ +{ + register int c; + register int delim; +#if HOST == SYS_VMS + char def_filename[NAM$C_MAXRSS + 1]; +#endif + + delim = macroid(skipws()); + if (delim != '<' && delim != '"') + goto incerr; + if (delim == '<') + delim = '>'; + workp = work; + instring = TRUE; /* Accept all characters */ +#ifdef CONTROL_COMMENTS_NOT_ALLOWED + while ((c = get()) != '\n' && c != EOF_CHAR) + save(c); /* Put it away. */ + unget(); /* Force nl after includee */ + /* + * The draft is unclear if the following should be done. + */ + while (--workp >= work && *workp == ' ') + ; /* Trim blanks from filename */ + if (*workp != delim) + goto incerr; +#else + while ((c = get()) != delim && c != EOF_CHAR) + save(c); +#endif + *workp = EOS; /* Terminate filename */ + instring = FALSE; +#if HOST == SYS_VMS + /* + * Assume the default .h filetype. + */ + if (!vmsparse(work, ".H", def_filename)) { + perror(work); /* Oops. */ + goto incerr; + } + else if (openinclude(def_filename, (delim == '"'))) + return; +#else + if (openinclude(work, (delim == '"'))) + return; +#endif + /* + * No sense continuing if #include file isn't there. + */ + cfatal("Cannot open include file \"%s\"", work); + +incerr: cerror("#include syntax error", NULLST); + return; +} + +FILE_LOCAL int +openinclude(char* filename, int searchlocal) +/* + * Actually open an include file. This routine is only called from + * doinclude() above, but was written as a separate subroutine for + * programmer convenience. It searches the list of directories + * and actually opens the file, linking it into the list of + * active files. Returns TRUE if the file was opened, FALSE + * if openinclude() fails. No error message is printed. + */ +{ + register char **incptr; +#if HOST == SYS_VMS +#if NFWORK < (NAM$C_MAXRSS + 1) + << error, NFWORK is not greater than NAM$C_MAXRSS >> +#endif +#endif + char tmpname[NFWORK]; /* Filename work area */ + + if (searchlocal) { + /* + * Look in local directory first + */ +#if HOST == SYS_UNIX + /* + * Try to open filename relative to the directory of the current + * source file (as opposed to the current directory). (ARF, SCK). + */ + if (filename[0] != '/' + && hasdirectory(infile->filename, tmpname)) + strcat(tmpname, filename); + else { + strcpy(tmpname, filename); + } +#else + if (!hasdirectory(filename, tmpname) + && hasdirectory(infile->filename, tmpname)) + strcat(tmpname, filename); + else { + strcpy(tmpname, filename); + } +#endif + if (openfile(tmpname)) + return (TRUE); + } + /* + * Look in any directories specified by -I command line + * arguments, then in the builtin search list. + */ + for (incptr = incdir; incptr < incend; incptr++) { + if (strlen(*incptr) + strlen(filename) >= (NFWORK - 1)) + cfatal("Filename work buffer overflow", NULLST); + else { +#if HOST == SYS_UNIX + if (filename[0] == '/') + strcpy(tmpname, filename); + else { + sprintf(tmpname, "%s/%s", *incptr, filename); + } +#elif HOST == SYS_UNKNOWN + if (filename[0] == '\\') + strcpy(tmpname, filename); + else { + sprintf(tmpname, "%s\\%s", *incptr, filename); + } +#else + if (!hasdirectory(filename, tmpname)) + sprintf(tmpname, "%s%s", *incptr, filename); +#endif + if (openfile(tmpname)) + return (TRUE); + } + } + return (FALSE); +} + +FILE_LOCAL int +hasdirectory(char* source, char* result) +/* + * If a device or directory is found in the source filename string, the + * node/device/directory part of the string is copied to result and + * hasdirectory returns TRUE. Else, nothing is copied and it returns FALSE. + */ +{ +#if HOST == SYS_UNIX + register char *tp; + + if ((tp = strrchr(source, '/')) == NULL) + return (FALSE); + else { + strncpy(result, source, tp - source + 1); + result[tp - source + 1] = EOS; + return (TRUE); + } +#else +#if HOST == SYS_VMS + if (vmsparse(source, NULLST, result) + && result[0] != EOS) + return (TRUE); + else { + return (FALSE); + } +#else + /* + * Random DEC operating system (RSX, RT11, RSTS/E) + */ + register char *tp; + + if ((tp = strrchr(source, ']')) == NULL + && (tp = strrchr(source, ':')) == NULL) + return (FALSE); + else { + strncpy(result, source, tp - source + 1); + result[tp - source + 1] = EOS; + return (TRUE); + } +#endif +#endif +} + +#if HOST == SYS_VMS + +/* + * EXP_DEV is set if a device was specified, EXP_DIR if a directory + * is specified. (Both set indicate a file-logical, but EXP_DEV + * would be set by itself if you are reading, say, SYS$INPUT:) + */ +#define DEVDIR (NAM$M_EXP_DEV | NAM$M_EXP_DIR) + +FILE_LOCAL int +vmsparse(source, defstring, result) +char *source; +char *defstring; /* non-NULL -> default string. */ +char *result; /* Size is at least NAM$C_MAXRSS + 1 */ +/* + * Parse the source string, applying the default (properly, using + * the system parse routine), storing it in result. + * TRUE if it parsed, FALSE on error. + * + * If defstring is NULL, there are no defaults and result gets + * (just) the node::[directory] part of the string (possibly "") + */ +{ + struct FAB fab = cc$rms_fab; /* File access block */ + struct NAM nam = cc$rms_nam; /* File name block */ + char fullname[NAM$C_MAXRSS + 1]; + register char *rp; /* Result pointer */ + + fab.fab$l_nam = &nam; /* fab -> nam */ + fab.fab$l_fna = source; /* Source filename */ + fab.fab$b_fns = strlen(source); /* Size of source */ + fab.fab$l_dna = defstring; /* Default string */ + if (defstring != NULLST) + fab.fab$b_dns = strlen(defstring); /* Size of default */ + nam.nam$l_esa = fullname; /* Expanded filename */ + nam.nam$b_ess = NAM$C_MAXRSS; /* Expanded name size */ + if (sys$parse(&fab) == RMS$_NORMAL) { /* Parse away */ + fullname[nam.nam$b_esl] = EOS; /* Terminate string */ + result[0] = EOS; /* Just in case */ + rp = &result[0]; + /* + * Remove stuff added implicitly, accepting node names and + * dev:[directory] strings (but not process-permanent files). + */ + if ((nam.nam$l_fnb & NAM$M_PPF) == 0) { + if ((nam.nam$l_fnb & NAM$M_NODE) != 0) { + strncpy(result, nam.nam$l_node, nam.nam$b_node); + rp += nam.nam$b_node; + *rp = EOS; + } + if ((nam.nam$l_fnb & DEVDIR) == DEVDIR) { + strncpy(rp, nam.nam$l_dev, nam.nam$b_dev + nam.nam$b_dir); + rp += nam.nam$b_dev + nam.nam$b_dir; + *rp = EOS; + } + } + if (defstring != NULLST) { + strncpy(rp, nam.nam$l_name, nam.nam$b_name + nam.nam$b_type); + rp += nam.nam$b_name + nam.nam$b_type; + *rp = EOS; + if ((nam.nam$l_fnb & NAM$M_EXP_VER) != 0) { + strncpy(rp, nam.nam$l_ver, nam.nam$b_ver); + rp[nam.nam$b_ver] = EOS; + } + } + return (TRUE); + } + return (FALSE); +} +#endif + diff --git a/rsc/source/rscpp/cpp3.c b/rsc/source/rscpp/cpp3.c new file mode 100644 index 000000000000..2ae1265d630f --- /dev/null +++ b/rsc/source/rscpp/cpp3.c @@ -0,0 +1,604 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cpp3.c,v $ + * $Revision: 1.17 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#if defined(_MSC_VER) && (_MSC_VER > 1310) +#define _USE_32BIT_TIME_T +#endif + +#include <stdio.h> +#ifdef UNX +#include <stdlib.h> +#endif +#include <ctype.h> +#include "cppdef.h" +#include "cpp.h" + +#include "time.h" /* BP */ + +#ifndef _STRING_H +#include <string.h> +#endif + +#ifndef _NO_PROTO +int AddInclude( char *pIncStr ); /* BP, 11.09.91, Forward-Deklaration */ +#endif + +#if (OSL_DEBUG_LEVEL > 1) && (HOST == SYS_VMS || HOST == SYS_UNIX) +#include <signal.h> +#endif + +void InitCpp3() +{ +} + + +int +openfile(char* filename) +/* + * Open a file, add it to the linked list of open files. + * This is called only from openfile() above. + */ +{ + register FILE *fp; + + if ((fp = fopen(filename, "r")) == NULL) { +#if OSL_DEBUG_LEVEL > 1 + if ( debug || !bDumpDefs ) + perror(filename); +#endif + return (FALSE); + } +#if OSL_DEBUG_LEVEL > 1 + if (debug) + fprintf(stderr, "Reading from \"%s\"\n", filename); +#endif + addfile(fp, filename); + return (TRUE); +} + +void addfile(FILE* fp, char* filename) +/* + * Initialize tables for this open file. This is called from openfile() + * above (for #include files), and from the entry to cpp to open the main + * input file. It calls a common routine, getfile() to build the FILEINFO + * structure which is used to read characters. (getfile() is also called + * to setup a macro replacement.) + */ +{ + register FILEINFO *file; +/* #ifndef _NO_PROTO */ + extern FILEINFO *getfile( int bufsize, char *filename ); /* BP */ +/* #endif */ + file = getfile(NBUFF, filename); + file->fp = fp; /* Better remember FILE * */ + file->buffer[0] = EOS; /* Initialize for first read */ + line = 1; /* Working on line 1 now */ + wrongline = TRUE; /* Force out initial #line */ +} + +void setincdirs() +/* + * Append system-specific directories to the include directory list. + * Called only when cpp is started. + */ +{ + +#ifdef CPP_INCLUDE + *incend++ = CPP_INCLUDE; +#define IS_INCLUDE 1 +#else +#define IS_INCLUDE 0 +#endif + +#if HOST == SYS_UNIX + *incend++ = "/usr/include"; +#define MAXINCLUDE (NINCLUDE - 1 - IS_INCLUDE) +#endif + +#if HOST == SYS_VMS + extern char *getenv(); + + if (getenv("C$LIBRARY") != NULL) + *incend++ = "C$LIBRARY:"; + *incend++ = "SYS$LIBRARY:"; +#define MAXINCLUDE (NINCLUDE - 2 - IS_INCLUDE) +#endif + +#if HOST == SYS_RSX + extern int $$rsts; /* TRUE on RSTS/E */ + extern int $$pos; /* TRUE on PRO-350 P/OS */ + extern int $$vms; /* TRUE on VMS compat. */ + + if ($$pos) { /* P/OS? */ + *incend++ = "SY:[ZZDECUSC]"; /* C #includes */ + *incend++ = "LB:[1,5]"; /* RSX library */ + } + else if ($$rsts) { /* RSTS/E? */ + *incend++ = "SY:@"; /* User-defined account */ + *incend++ = "C:"; /* Decus-C library */ + *incend++ = "LB:[1,1]"; /* RSX library */ + } + else if ($$vms) { /* VMS compatibility? */ + *incend++ = "C:"; + } + else { /* Plain old RSX/IAS */ + *incend++ = "LB:[1,1]"; + } +#define MAXINCLUDE (NINCLUDE - 3 - IS_INCLUDE) +#endif + +#if HOST == SYS_RT11 + extern int $$rsts; /* RSTS/E emulation? */ + + if ($$rsts) + *incend++ = "SY:@"; /* User-defined account */ + *incend++ = "C:"; /* Decus-C library disk */ + *incend++ = "SY:"; /* System (boot) disk */ +#define MAXINCLUDE (NINCLUDE - 3 - IS_INCLUDE) +#endif + +#if HOST == SYS_UNKNOWN +/* + * BP: 25.07.91, Kontext: GenMake + * Unter DOS wird nun auch die Environment-Variable INCLUDE ausgewetet. + * Es kommt erschwerend hinzu, dass alle Eintraege, die mit ';' getrennt + * sind, mit in die Liste aufenommen werden muessen. + * Dies wird mit der Funktion strtok() realisiert. + * Vorsicht bei der Benutzung von malloc !!! + * In savestring wird naemlich getmem() verwendet. Vermutlich kommen sich + * die beiden Funktion in die Quere. Als ich malloc statt savestring + * verwendete knallte es in strcpy() ! + */ + +#if !defined( ZTC ) && !defined( WNT ) && !defined(BLC) && ! defined UNX && ! defined OS2 + extern char *getenv( char *pStr ); /* BP */ +#endif + char *pIncGetEnv = NULL; /* Pointer auf INCLUDE */ + + if ( ( pIncGetEnv = getenv("INCLUDE") ) != NULL ) + AddInclude( pIncGetEnv ); + +#define MAXINCLUDE (NINCLUDE - 3 - IS_INCLUDE) +#endif + + +} + +/* BP: 11.09.91, Kontext: Erweiterung des INCLUDE-Services + * Bislang konnte der cpp keine Include-Angaben in der Kommandozeile + * vertragen, bei denen die directries mit ';' getrennt wurden. + * Dies ist auch verstaendlich, da dieses cpp fuer UNIX-Systeme + * massgeschneidert wurde und in UNI die ';' als Zeichen zum Abschluss + * von Kommandos gilt. + */ + +int AddInclude( char* pIncStr ) +{ + char *pIncEnv = NULL; /* Kopie des INCLUDE */ + char *pIncPos; /* wandert zum naechsten */ + + pIncEnv = savestring( pIncStr ); + pIncPos = strtok( pIncEnv, ";" ); + + while( pIncPos != NULL ) + { + if (incend >= &incdir[MAXINCLUDE]) + cfatal("Too many include directories", NULLST); + *incend++ = pIncPos; + pIncPos = strtok( NULL, ";" ); + } + return( 1 ); +} + + + + +int +dooptions(int argc, char** argv) +/* + * dooptions is called to process command line arguments (-Detc). + * It is called only at cpp startup. + */ +{ + register char *ap; + register DEFBUF *dp; + register int c; + int i, j; + char *arg; + SIZES *sizp; /* For -S */ + int size; /* For -S */ + int isdatum; /* FALSE for -S* */ + int endtest; /* For -S */ + + for (i = j = 1; i < argc; i++) { + arg = ap = argv[i]; + + if (*ap++ != '-' || *ap == EOS) + { + argv[j++] = argv[i]; + } + else { + c = *ap++; /* Option byte */ + if (islower(c)) /* Normalize case */ + c = toupper(c); + switch (c) { /* Command character */ + case 'C': /* Keep comments */ + cflag = TRUE; + keepcomments = TRUE; + break; + + case 'D': /* Define symbol */ +#if HOST != SYS_UNIX +/* zap_uc(ap); */ /* Force define to U.C. */ +#endif + /* + * If the option is just "-Dfoo", make it -Dfoo=1 + */ + while (*ap != EOS && *ap != '=') + ap++; + if (*ap == EOS) + ap = "1"; + else + *ap++ = EOS; + /* + * Now, save the word and its definition. + */ + dp = defendel(argv[i] + 2, FALSE); + dp->repl = savestring(ap); + dp->nargs = DEF_NOARGS; + break; + + case 'E': /* Ignore non-fatal */ + eflag = TRUE; /* errors. */ + break; + + case 'I': /* Include directory */ + AddInclude( ap ); /* BP, 11.09.91 */ + break; + + case 'N': /* No predefineds */ + nflag++; /* Repeat to undefine */ + break; /* __LINE__, etc. */ + + case 'S': + sizp = size_table; + if (0 != (isdatum = (*ap != '*'))) /* If it's just -S, */ + endtest = T_FPTR; /* Stop here */ + else { /* But if it's -S* */ + ap++; /* Step over '*' */ + endtest = 0; /* Stop at end marker */ + } + while (sizp->bits != endtest && *ap != EOS) { + if (!isdigit(*ap)) { /* Skip to next digit */ + ap++; + continue; + } + size = 0; /* Compile the value */ + while (isdigit(*ap)) { + size *= 10; + size += (*ap++ - '0'); + } + if (isdatum) + sizp->size = size; /* Datum size */ + else + sizp->psize = size; /* Pointer size */ + sizp++; + } + if (sizp->bits != endtest) + cwarn("-S, too few values specified in %s", argv[i]); + else if (*ap != EOS) + cwarn("-S, too many values, \"%s\" unused", ap); + break; + + case 'U': /* Undefine symbol */ +#if HOST != SYS_UNIX +/* zap_uc(ap);*/ +#endif + if (defendel(ap, TRUE) == NULL) + cwarn("\"%s\" wasn't defined", ap); + break; + +#if OSL_DEBUG_LEVEL > 1 + case 'X': /* Debug */ + debug = (isdigit(*ap)) ? atoi(ap) : 1; +#if (HOST == SYS_VMS || HOST == SYS_UNIX) + signal(SIGINT, (void (*)(int)) abort); /* Trap "interrupt" */ +#endif + fprintf(stderr, "Debug set to %d\n", debug); + break; +#endif + +#if OSL_DEBUG_LEVEL > 1 + case 'P': /* #define's dump */ + bDumpDefs = 1; + fprintf(stderr, "Dump #define's is on\n"); + break; +#endif + + default: /* What is this one? */ + cwarn("Unknown option \"%s\"", arg); + fprintf(stderr, "The following options are valid:\n\ + -C\t\t\tWrite source file comments to output\n\ + -Dsymbol=value\tDefine a symbol with the given (optional) value\n\ + -Idirectory\t\tAdd a directory to the #include search list\n\ + -N\t\t\tDon't predefine target-specific names\n\ + -Stext\t\tSpecify sizes for #if sizeof\n\ + -Usymbol\t\tUndefine symbol\n"); +#if OSL_DEBUG_LEVEL > 1 + fprintf(stderr, " -Xvalue\t\tSet internal debug flag\n"); + fprintf(stderr, " -P\t\t\tdump #define's\n"); +#endif + break; + } /* Switch on all options */ + } /* If it's a -option */ + } /* For all arguments */ +#if OSL_DEBUG_LEVEL > 1 + if ( (bDumpDefs ? j > 4 : j > 3) ) { +#else + if (j > 3) { +#endif + cerror( + "Too many file arguments. Usage: cpp [input [output]]", + NULLST); + } + return (j); /* Return new argc */ +} + +int +readoptions(char* filename, char*** pfargv) +{ + FILE *fp; + int c; + int bInQuotes = 0; + char optbuff[1024], *poptbuff; + int fargc=0, back; + char *fargv[PARALIMIT], **pfa; + + pfa=*pfargv=malloc(sizeof(fargv)); + + poptbuff=&optbuff[0]; + filename++; + if ((fp = fopen(filename, "r")) == NULL) { +#if OSL_DEBUG_LEVEL > 1 + if ( debug || !bDumpDefs ) + perror(filename); +#endif + return (FALSE); + } + do + { + /* + * #i27914# double ticks '"' now have a duplicate function: + * 1. they define a string ( e.g. -DFOO="baz" ) + * 2. a string can contain spaces, so -DFOO="baz zum" defines one + * argument no two ! + */ + c=fgetc(fp); + if ( c != ' ' && c != CR && c != NL && c != HT && c != EOF) + { + *poptbuff++=(char)c; + if( c == '"' ) + bInQuotes = ~bInQuotes; + } + else + { + if( c != EOF && bInQuotes ) + *poptbuff++=(char)c; + else + { + *poptbuff=EOS; + if (strlen(optbuff)>0) + { + pfa[fargc+1]=malloc(strlen(optbuff)+1); + strcpy(pfa[fargc+1],optbuff); + fargc++; + pfa[fargc+1]=0; + poptbuff=&optbuff[0]; + } + } + } + } + while ( c != EOF ); + + fclose(fp); + back=dooptions(fargc+1,pfa); + + return (back); +} + + + +#if HOST != SYS_UNIX +FILE_LOCAL void +zap_uc(char* ap) +/* + * Dec operating systems mangle upper-lower case in command lines. + * This routine forces the -D and -U arguments to uppercase. + * It is called only on cpp startup by dooptions(). + */ +{ + while (*ap != EOS) { + /* + * Don't use islower() here so it works with Multinational + */ + if (*ap >= 'a' && *ap <= 'z') + *ap = (char)toupper(*ap); + ap++; + } +} +#endif + +void initdefines() +/* + * Initialize the built-in #define's. There are two flavors: + * #define decus 1 (static definitions) + * #define __FILE__ ?? (dynamic, evaluated by magic) + * Called only on cpp startup. + * + * Note: the built-in static definitions are supressed by the -N option. + * __LINE__, __FILE__, and __DATE__ are always present. + */ +{ + register char **pp; + register char *tp; + register DEFBUF *dp; + int i; + long tvec; + +#if !defined( ZTC ) && !defined( WNT ) && !defined(BLC) && !defined(G3) + extern char *ctime(); +#endif + + /* + * Predefine the built-in symbols. Allow the + * implementor to pre-define a symbol as "" to + * eliminate it. + */ + if (nflag == 0) { + for (pp = preset; *pp != NULL; pp++) { + if (*pp[0] != EOS) { + dp = defendel(*pp, FALSE); + dp->repl = savestring("1"); + dp->nargs = DEF_NOARGS; + } + } + } + /* + * The magic pre-defines (__FILE__ and __LINE__ are + * initialized with negative argument counts. expand() + * notices this and calls the appropriate routine. + * DEF_NOARGS is one greater than the first "magic" definition. + */ + if (nflag < 2) { + for (pp = magic, i = DEF_NOARGS; *pp != NULL; pp++) { + dp = defendel(*pp, FALSE); + dp->nargs = --i; + } +#if OK_DATE + /* + * Define __DATE__ as today's date. + */ + dp = defendel("__DATE__", FALSE); + dp->repl = tp = getmem(27); + dp->nargs = DEF_NOARGS; + time( (time_t*)&tvec); + *tp++ = '"'; + strcpy(tp, ctime((const time_t*)&tvec)); + tp[24] = '"'; /* Overwrite newline */ +#endif + } +} + +#if HOST == SYS_VMS +/* + * getredirection() is intended to aid in porting C programs + * to VMS (Vax-11 C) which does not support '>' and '<' + * I/O redirection. With suitable modification, it may + * useful for other portability problems as well. + */ + +int +getredirection(argc, argv) +int argc; +char **argv; +/* + * Process vms redirection arg's. Exit if any error is seen. + * If getredirection() processes an argument, it is erased + * from the vector. getredirection() returns a new argc value. + * + * Warning: do not try to simplify the code for vms. The code + * presupposes that getredirection() is called before any data is + * read from stdin or written to stdout. + * + * Normal usage is as follows: + * + * main(argc, argv) + * int argc; + * char *argv[]; + * { + * argc = getredirection(argc, argv); + * } + */ +{ + register char *ap; /* Argument pointer */ + int i; /* argv[] index */ + int j; /* Output index */ + int file; /* File_descriptor */ + extern int errno; /* Last vms i/o error */ + + for (j = i = 1; i < argc; i++) { /* Do all arguments */ + switch (*(ap = argv[i])) { + case '<': /* <file */ + if (freopen(++ap, "r", stdin) == NULL) { + perror(ap); /* Can't find file */ + exit(errno); /* Is a fatal error */ + } + break; + + case '>': /* >file or >>file */ + if (*++ap == '>') { /* >>file */ + /* + * If the file exists, and is writable by us, + * call freopen to append to the file (using the + * file's current attributes). Otherwise, create + * a new file with "vanilla" attributes as if the + * argument was given as ">filename". + * access(name, 2) returns zero if we can write on + * the specified file. + */ + if (access(++ap, 2) == 0) { + if (freopen(ap, "a", stdout) != NULL) + break; /* Exit case statement */ + perror(ap); /* Error, can't append */ + exit(errno); /* After access test */ + } /* If file accessable */ + } + /* + * On vms, we want to create the file using "standard" + * record attributes. creat(...) creates the file + * using the caller's default protection mask and + * "variable length, implied carriage return" + * attributes. dup2() associates the file with stdout. + */ + if ((file = creat(ap, 0, "rat=cr", "rfm=var")) == -1 + || dup2(file, fileno(stdout)) == -1) { + perror(ap); /* Can't create file */ + exit(errno); /* is a fatal error */ + } /* If '>' creation */ + break; /* Exit case test */ + + default: + argv[j++] = ap; /* Not a redirector */ + break; /* Exit case test */ + } + } /* For all arguments */ + argv[j] = NULL; /* Terminate argv[] */ + return (j); /* Return new argc */ +} +#endif diff --git a/rsc/source/rscpp/cpp4.c b/rsc/source/rscpp/cpp4.c new file mode 100644 index 000000000000..f449f03c904b --- /dev/null +++ b/rsc/source/rscpp/cpp4.c @@ -0,0 +1,638 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cpp4.c,v $ + * $Revision: 1.9 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <stdio.h> +#include <ctype.h> +#include "cppdef.h" +#include "cpp.h" +/* + * parm[], parmp, and parlist[] are used to store #define() argument + * lists. nargs contains the actual number of parameters stored. + */ +static char parm[NPARMWORK + 1]; /* define param work buffer */ +static char *parmp; /* Free space in parm */ +static char *parlist[LASTPARM]; /* -> start of each parameter */ +static int nargs; /* Parameters for this macro */ + +void InitCpp4() +{ + int i; + for( i = 0; i < NPARMWORK; i++ ) + parm[ i ] = 0; + for( i = 0; i < LASTPARM; i++ ) + parlist[ i ] = NULL; + + nargs = 0; +} + + +void dodefine() +/* + * Called from control when a #define is scanned. This module + * parses formal parameters and the replacement string. When + * the formal parameter name is encountered in the replacement + * string, it is replaced by a character in the range 128 to + * 128+NPARAM (this allows up to 32 parameters within the + * Dec Multinational range). If cpp is ported to an EBCDIC + * machine, you will have to make other arrangements. + * + * There is some special case code to distinguish + * #define foo bar + * from #define foo() bar + * + * Also, we make sure that + * #define foo foo + * expands to "foo" but doesn't put cpp into an infinite loop. + * + * A warning message is printed if you redefine a symbol to a + * different text. I.e, + * #define foo 123 + * #define foo 123 + * is ok, but + * #define foo 123 + * #define foo +123 + * is not. + * + * The following subroutines are called from define(): + * checkparm called when a token is scanned. It checks through the + * array of formal parameters. If a match is found, the + * token is replaced by a control byte which will be used + * to locate the parameter when the macro is expanded. + * textput puts a string in the macro work area (parm[]), updating + * parmp to point to the first free byte in parm[]. + * textput() tests for work buffer overflow. + * charput puts a single character in the macro work area (parm[]) + * in a manner analogous to textput(). + */ +{ + register int c; + register DEFBUF *dp; /* -> new definition */ + int isredefine; /* TRUE if redefined */ + char *old = 0; /* Remember redefined */ + + if (type[(c = skipws())] != LET) + goto bad_define; + isredefine = FALSE; /* Set if redefining */ + if ((dp = lookid(c)) == NULL) /* If not known now */ + dp = defendel(token, FALSE); /* Save the name */ + else { /* It's known: */ + isredefine = TRUE; /* Remember this fact */ + old = dp->repl; /* Remember replacement */ + dp->repl = NULL; /* No replacement now */ + } + parlist[0] = parmp = parm; /* Setup parm buffer */ + if ((c = get()) == '(') { /* With arguments? */ + nargs = 0; /* Init formals counter */ + do { /* Collect formal parms */ + if (nargs >= LASTPARM) + cfatal("Too many arguments for macro", NULLST); + else if ((c = skipws()) == ')') + break; /* Got them all */ + else if (type[c] != LET) /* Bad formal syntax */ + goto bad_define; + scanid(c); /* Get the formal param */ + parlist[nargs++] = parmp; /* Save its start */ + textput(token); /* Save text in parm[] */ + } while ((c = skipws()) == ','); /* Get another argument */ + if (c != ')') /* Must end at ) */ + goto bad_define; + c = ' '; /* Will skip to body */ + } + else { + /* + * DEF_NOARGS is needed to distinguish between + * "#define foo" and "#define foo()". + */ + nargs = DEF_NOARGS; /* No () parameters */ + } + if (type[c] == SPA) /* At whitespace? */ + c = skipws(); /* Not any more. */ + workp = work; /* Replacement put here */ + inmacro = TRUE; /* Keep \<newline> now */ + while (c != EOF_CHAR && c != '\n') { /* Compile macro body */ +#if OK_CONCAT +#if COMMENT_INVISIBLE + if (c == COM_SEP) { /* Token concatenation? */ + save(TOK_SEP); /* Stuff a delimiter */ + c = get(); +#else + if (c == '#') { /* Token concatenation? */ + while (workp > work && type[(int)workp[-1]] == SPA) + --workp; /* Erase leading spaces */ + save(TOK_SEP); /* Stuff a delimiter */ + c = skipws(); /* Eat whitespace */ +#endif + if (type[c] == LET) /* Another token here? */ + ; /* Stuff it normally */ + else if (type[c] == DIG) { /* Digit string after? */ + while (type[c] == DIG) { /* Stuff the digits */ + save(c); + c = get(); + } + save(TOK_SEP); /* Delimit 2nd token */ + } + else { +#if ! COMMENT_INVISIBLE + ciwarn("Strange character after # (%d.)", c); +#endif + } + continue; + } +#endif + switch (type[c]) { + case LET: + checkparm(c, dp); /* Might be a formal */ + break; + + case DIG: /* Number in mac. body */ + case DOT: /* Maybe a float number */ + scannumber(c, save); /* Scan it off */ + break; + + case QUO: /* String in mac. body */ +#if STRING_FORMAL + stparmscan(c, dp); /* Do string magic */ +#else + stparmscan(c); +#endif + break; + + case BSH: /* Backslash */ + save('\\'); + if ((c = get()) == '\n') + wrongline = TRUE; + save(c); + break; + + case SPA: /* Absorb whitespace */ + /* + * Note: the "end of comment" marker is passed on + * to allow comments to separate tokens. + */ + if (workp[-1] == ' ') /* Absorb multiple */ + break; /* spaces */ + else if (c == '\t') + c = ' '; /* Normalize tabs */ + /* Fall through to store character */ + default: /* Other character */ + save(c); + break; + } + c = get(); + } + inmacro = FALSE; /* Stop newline hack */ + unget(); /* For control check */ + if (workp > work && workp[-1] == ' ') /* Drop trailing blank */ + workp--; + *workp = EOS; /* Terminate work */ + dp->repl = savestring(work); /* Save the string */ + dp->nargs = nargs; /* Save arg count */ +#if OSL_DEBUG_LEVEL > 1 + if (debug) + dumpadef("macro definition", dp); + else if (bDumpDefs) + dumpadef(NULL, dp); +#endif + if (isredefine) { /* Error if redefined */ + if ((old != NULL && dp->repl != NULL && !streq(old, dp->repl)) + || (old == NULL && dp->repl != NULL) + || (old != NULL && dp->repl == NULL)) { +#ifdef STRICT_UNDEF + cerror("Redefining defined variable \"%s\"", dp->name); +#else + cwarn("Redefining defined variable \"%s\"", dp->name); +#endif + } + if (old != NULL) /* We don't need the */ + free(old); /* old definition now. */ + } + return; + +bad_define: + cerror("#define syntax error", NULLST); + inmacro = FALSE; /* Stop <newline> hack */ +} + +void checkparm(int c, DEFBUF* dp) +/* + * Replace this param if it's defined. Note that the macro name is a + * possible replacement token. We stuff DEF_MAGIC in front of the token + * which is treated as a LETTER by the token scanner and eaten by + * the output routine. This prevents the macro expander from + * looping if someone writes "#define foo foo". + */ +{ + register int i; + register char *cp; + + scanid(c); /* Get parm to token[] */ + for (i = 0; i < nargs; i++) { /* For each argument */ + if (streq(parlist[i], token)) { /* If it's known */ +#ifdef SOLAR + save(DEL); +#endif + save(i + MAC_PARM); /* Save a magic cookie */ + return; /* And exit the search */ + } + } + if (streq(dp->name, token)) /* Macro name in body? */ + save(DEF_MAGIC); /* Save magic marker */ + for (cp = token; *cp != EOS;) /* And save */ + save(*cp++); /* The token itself */ +} + +#if STRING_FORMAL +void stparmscan(delim, dp) +int delim; +register DEFBUF *dp; +/* + * Scan the string (starting with the given delimiter). + * The token is replaced if it is the only text in this string or + * character constant. The algorithm follows checkparm() above. + * Note that scanstring() has approved of the string. + */ +{ + register int c; + + /* + * Warning -- this code hasn't been tested for a while. + * It exists only to preserve compatibility with earlier + * implementations of cpp. It is not part of the Draft + * ANSI Standard C language. + */ + save(delim); + instring = TRUE; + while ((c = get()) != delim + && c != '\n' + && c != EOF_CHAR) { + if (type[c] == LET) /* Maybe formal parm */ + checkparm(c, dp); + else { + save(c); + if (c == '\\') + save(get()); + } + } + instring = FALSE; + if (c != delim) + cerror("Unterminated string in macro body", NULLST); + save(c); +} +#else +void stparmscan(int delim) +/* + * Normal string parameter scan. + */ +{ + register char *wp; + register int i; + + wp = workp; /* Here's where it starts */ + if (!scanstring(delim, save)) + return; /* Exit on scanstring error */ + workp[-1] = EOS; /* Erase trailing quote */ + wp++; /* -> first string content byte */ + for (i = 0; i < nargs; i++) { + if (streq(parlist[i], wp)) { +#ifdef SOLAR + *wp++ = DEL; + *wp++ = MAC_PARM + PAR_MAC; /* Stuff a magic marker */ + *wp++ = (char)(i + MAC_PARM); /* Make a formal marker */ + *wp = wp[-4]; /* Add on closing quote */ + workp = wp + 1; /* Reset string end */ +#else + *wp++ = MAC_PARM + PAR_MAC; /* Stuff a magic marker */ + *wp++ = (i + MAC_PARM); /* Make a formal marker */ + *wp = wp[-3]; /* Add on closing quote */ + workp = wp + 1; /* Reset string end */ +#endif + return; + } + } + workp[-1] = wp[-1]; /* Nope, reset end quote. */ +} +#endif + +void doundef() +/* + * Remove the symbol from the defined list. + * Called from the #control processor. + */ +{ + register int c; + + if (type[(c = skipws())] != LET) + cerror("Illegal #undef argument", NULLST); + else { + scanid(c); /* Get name to token[] */ + if (defendel(token, TRUE) == NULL) { +#ifdef STRICT_UNDEF + cwarn("Symbol \"%s\" not defined in #undef", token); +#endif + } + } +} + +void textput(char* text) +/* + * Put the string in the parm[] buffer. + */ +{ + register int size; + + size = strlen(text) + 1; + if ((parmp + size) >= &parm[NPARMWORK]) + cfatal("Macro work area overflow", NULLST); + else { + strcpy(parmp, text); + parmp += size; + } +} + +void charput(int c) +/* + * Put the byte in the parm[] buffer. + */ +{ + if (parmp >= &parm[NPARMWORK]) + cfatal("Macro work area overflow", NULLST); + else { + *parmp++ = (char)c; + } +} + +/* + * M a c r o E x p a n s i o n + */ + +static DEFBUF *macro; /* Catches start of infinite macro */ + +void expand(DEFBUF* tokenp) +/* + * Expand a macro. Called from the cpp mainline routine (via subroutine + * macroid()) when a token is found in the symbol table. It calls + * expcollect() to parse actual parameters, checking for the correct number. + * It then creates a "file" containing a single line containing the + * macro with actual parameters inserted appropriately. This is + * "pushed back" onto the input stream. (When the get() routine runs + * off the end of the macro line, it will dismiss the macro itself.) + */ +{ + register int c; + register FILEINFO *file; +#ifndef ZTC /* BP */ + extern FILEINFO *getfile(); +#endif + +#if OSL_DEBUG_LEVEL > 1 + if (debug) + dumpadef("expand entry", tokenp); +#endif + /* + * If no macro is pending, save the name of this macro + * for an eventual error message. + */ + if (recursion++ == 0) + macro = tokenp; + else if (recursion == RECURSION_LIMIT) { + cerror("Recursive macro definition of \"%s\"", tokenp->name); + fprintf(stderr, "(Defined by \"%s\")\n", macro->name); + if (rec_recover) { + do { + c = get(); + } while (infile != NULL && infile->fp == NULL); + unget(); + recursion = 0; + return; + } + } + /* + * Here's a macro to expand. + */ + nargs = 0; /* Formals counter */ + parmp = parm; /* Setup parm buffer */ + switch (tokenp->nargs) { + case (-2): /* __LINE__ */ + sprintf(work, "%d", line); + ungetstring(work); + break; + + case (-3): /* __FILE__ */ + for (file = infile; file != NULL; file = file->parent) { + if (file->fp != NULL) { + sprintf(work, "\"%s\"", (file->progname != NULL) + ? file->progname : file->filename); + ungetstring(work); + break; + } + } + break; + + default: + /* + * Nothing funny about this macro. + */ + if (tokenp->nargs < 0) + cfatal("Bug: Illegal __ macro \"%s\"", tokenp->name); + while ((c = skipws()) == '\n') /* Look for (, skipping */ + wrongline = TRUE; /* spaces and newlines */ + if (c != '(') { + /* + * If the programmer writes + * #define foo() ... + * ... + * foo [no ()] + * just write foo to the output stream. + */ + unget(); + cwarn("Macro \"%s\" needs arguments", tokenp->name); + fputs(tokenp->name, pCppOut ); + return; + } + else if (expcollect()) { /* Collect arguments */ + if (tokenp->nargs != nargs) { /* Should be an error? */ + cwarn("Wrong number of macro arguments for \"%s\"", + tokenp->name); + } +#if OSL_DEBUG_LEVEL > 1 + if (debug) + dumpparm("expand"); +#endif + } /* Collect arguments */ + case DEF_NOARGS: /* No parameters just stuffs */ + expstuff(tokenp); /* Do actual parameters */ + } /* nargs switch */ +} + +FILE_LOCAL int +expcollect() +/* + * Collect the actual parameters for this macro. TRUE if ok. + */ +{ + register int c; + register int paren; /* For embedded ()'s */ + for (;;) { + paren = 0; /* Collect next arg. */ + while ((c = skipws()) == '\n') /* Skip over whitespace */ + wrongline = TRUE; /* and newlines. */ + if (c == ')') { /* At end of all args? */ + /* + * Note that there is a guard byte in parm[] + * so we don't have to check for overflow here. + */ + *parmp = EOS; /* Make sure terminated */ + break; /* Exit collection loop */ + } + else if (nargs >= LASTPARM) + cfatal("Too many arguments in macro expansion", NULLST); + parlist[nargs++] = parmp; /* At start of new arg */ + for (;; c = cget()) { /* Collect arg's bytes */ + if (c == EOF_CHAR) { + cerror("end of file within macro argument", NULLST); + return (FALSE); /* Sorry. */ + } + else if (c == '\\') { /* Quote next character */ + charput(c); /* Save the \ for later */ + charput(cget()); /* Save the next char. */ + continue; /* And go get another */ + } + else if (type[c] == QUO) { /* Start of string? */ + scanstring(c, charput); /* Scan it off */ + continue; /* Go get next char */ + } + else if (c == '(') /* Worry about balance */ + paren++; /* To know about commas */ + else if (c == ')') { /* Other side too */ + if (paren == 0) { /* At the end? */ + unget(); /* Look at it later */ + break; /* Exit arg getter. */ + } + paren--; /* More to come. */ + } + else if (c == ',' && paren == 0) /* Comma delimits args */ + break; + else if (c == '\n') /* Newline inside arg? */ + wrongline = TRUE; /* We'll need a #line */ + charput(c); /* Store this one */ + } /* Collect an argument */ + charput(EOS); /* Terminate argument */ +#if OSL_DEBUG_LEVEL > 1 + if (debug) + fprintf( pCppOut, "parm[%d] = \"%s\"\n", nargs, parlist[nargs - 1]); +#endif + } /* Collect all args. */ + return (TRUE); /* Normal return */ +} + +FILE_LOCAL +void expstuff(DEFBUF* tokenp) +/* + * Stuff the macro body, replacing formal parameters by actual parameters. + */ +{ + register int c; /* Current character */ + register char *inp; /* -> repl string */ + register char *defp; /* -> macro output buff */ + int size; /* Actual parm. size */ + char *defend; /* -> output buff end */ + int string_magic; /* String formal hack */ + FILEINFO *file; /* Funny #include */ +#ifndef ZTC /* BP */ + extern FILEINFO *getfile(); +#endif + + file = getfile(NBUFF, tokenp->name); + inp = tokenp->repl; /* -> macro replacement */ + defp = file->buffer; /* -> output buffer */ + defend = defp + (NBUFF - 1); /* Note its end */ + if (inp != NULL) { + while ((c = (*inp++ & 0xFF)) != EOS) { +#ifdef SOLAR + if (c == DEL) { + c = (*inp++ & 0xFF); +#else + if (c >= MAC_PARM && c <= (MAC_PARM + PAR_MAC)) { +#endif + string_magic = (c == (MAC_PARM + PAR_MAC)); + if (string_magic) + c = (*inp++ & 0xFF); + /* + * Replace formal parameter by actual parameter string. + */ + if ((c -= MAC_PARM) < nargs) { + size = strlen(parlist[c]); + if ((defp + size) >= defend) + goto nospace; + /* + * Erase the extra set of quotes. + */ + if (string_magic && defp[-1] == parlist[c][0]) { + strcpy(defp-1, parlist[c]); + defp += (size - 2); + } + else { + strcpy(defp, parlist[c]); + defp += size; + } + } + } + else if (defp >= defend) { +nospace: cfatal("Out of space in macro \"%s\" arg expansion", + tokenp->name); + } + else { + *defp++ = (char)c; + } + } + } + *defp = EOS; +#if OSL_DEBUG_LEVEL > 1 + if (debug > 1) + fprintf( pCppOut, "macroline: \"%s\"\n", file->buffer); +#endif +} + +#if OSL_DEBUG_LEVEL > 1 +void dumpparm(char* why) +/* + * Dump parameter list. + */ +{ + register int i; + + fprintf( pCppOut, "dump of %d parameters (%d bytes total) %s\n", + nargs, parmp - parm, why); + for (i = 0; i < nargs; i++) { + fprintf( pCppOut, "parm[%d] (%d) = \"%s\"\n", + i + 1, strlen(parlist[i]), parlist[i]); + } +} +#endif diff --git a/rsc/source/rscpp/cpp5.c b/rsc/source/rscpp/cpp5.c new file mode 100644 index 000000000000..2828a7a19055 --- /dev/null +++ b/rsc/source/rscpp/cpp5.c @@ -0,0 +1,932 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cpp5.c,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <stdio.h> +#include <ctype.h> +#include "cppdef.h" +#include "cpp.h" + +/* + * Evaluate an #if expression. + */ + +static char *opname[] = { /* For debug and error messages */ +"end of expression", "val", "id", + "+", "-", "*", "/", "%", + "<<", ">>", "&", "|", "^", + "==", "!=", "<", "<=", ">=", ">", + "&&", "||", "?", ":", ",", + "unary +", "unary -", "~", "!", "(", ")", "(none)", +}; + +/* + * opdope[] has the operator precedence: + * Bits + * 7 Unused (so the value is always positive) + * 6-2 Precedence (000x .. 017x) + * 1-0 Binary op. flags: + * 01 The binop flag should be set/cleared when this op is seen. + * 10 The new value of the binop flag. + * Note: Expected, New binop + * constant 0 1 Binop, end, or ) should follow constants + * End of line 1 0 End may not be preceeded by an operator + * binary 1 0 Binary op follows a value, value follows. + * unary 0 0 Unary op doesn't follow a value, value follows + * ( 0 0 Doesn't follow value, value or unop follows + * ) 1 1 Follows value. Op follows. + */ + +static char opdope[OP_MAX] = { + 0001, /* End of expression */ + 0002, /* Digit */ + 0000, /* Letter (identifier) */ + 0141, 0141, 0151, 0151, 0151, /* ADD, SUB, MUL, DIV, MOD */ + 0131, 0131, 0101, 0071, 0071, /* ASL, ASR, AND, OR, XOR */ + 0111, 0111, 0121, 0121, 0121, 0121, /* EQ, NE, LT, LE, GE, GT */ + 0061, 0051, 0041, 0041, 0031, /* ANA, ORO, QUE, COL, CMA */ +/* + * Unary op's follow + */ + 0160, 0160, 0160, 0160, /* NEG, PLU, COM, NOT */ + 0170, 0013, 0023, /* LPA, RPA, END */ +}; +/* + * OP_QUE and OP_RPA have alternate precedences: + */ +#define OP_RPA_PREC 0013 +#define OP_QUE_PREC 0034 + +/* + * S_ANDOR and S_QUEST signal "short-circuit" boolean evaluation, so that + * #if FOO != 0 && 10 / FOO ... + * doesn't generate an error message. They are stored in optab.skip. + */ +#define S_ANDOR 2 +#define S_QUEST 1 + +typedef struct optab { + char op; /* Operator */ + char prec; /* Its precedence */ + char skip; /* Short-circuit: TRUE to skip */ +} OPTAB; +static int evalue; /* Current value from evallex() */ + +#ifdef nomacargs +FILE_LOCAL int +isbinary(op) +register int op; +{ + return (op >= FIRST_BINOP && op <= LAST_BINOP); +} + +FILE_LOCAL int +isunary(op) +register int op; +{ + return (op >= FIRST_UNOP && op <= LAST_UNOP); +} +#else +#define isbinary(op) (op >= FIRST_BINOP && op <= LAST_BINOP) +#define isunary(op) (op >= FIRST_UNOP && op <= LAST_UNOP) +#endif + +/* + * The following definitions are used to specify basic variable sizes. + */ + +#ifndef S_CHAR +#define S_CHAR (sizeof (char)) +#endif +#ifndef S_SINT +#define S_SINT (sizeof (short int)) +#endif +#ifndef S_INT +#define S_INT (sizeof (int)) +#endif +#ifndef S_LINT +#define S_LINT (sizeof (long int)) +#endif +#ifndef S_FLOAT +#define S_FLOAT (sizeof (float)) +#endif +#ifndef S_DOUBLE +#define S_DOUBLE (sizeof (double)) +#endif +#ifndef S_PCHAR +#define S_PCHAR (sizeof (char *)) +#endif +#ifndef S_PSINT +#define S_PSINT (sizeof (short int *)) +#endif +#ifndef S_PINT +#define S_PINT (sizeof (int *)) +#endif +#ifndef S_PLINT +#define S_PLINT (sizeof (long int *)) +#endif +#ifndef S_PFLOAT +#define S_PFLOAT (sizeof (float *)) +#endif +#ifndef S_PDOUBLE +#define S_PDOUBLE (sizeof (double *)) +#endif +#ifndef S_PFPTR +#define S_PFPTR (sizeof (int (*)())) +#endif + +typedef struct types { + short type; /* This is the bit if */ + char *name; /* this is the token word */ +} TYPES; + +static TYPES basic_types[] = { + { T_CHAR, "char", }, + { T_INT, "int", }, + { T_FLOAT, "float", }, + { T_DOUBLE, "double", }, + { T_SHORT, "short", }, + { T_LONG, "long", }, + { T_SIGNED, "signed", }, + { T_UNSIGNED, "unsigned", }, + { 0, NULL, }, /* Signal end */ +}; + +/* + * Test_table[] is used to test for illegal combinations. + */ +static short test_table[] = { + T_FLOAT | T_DOUBLE | T_LONG | T_SHORT, + T_FLOAT | T_DOUBLE | T_CHAR | T_INT, + T_FLOAT | T_DOUBLE | T_SIGNED | T_UNSIGNED, + T_LONG | T_SHORT | T_CHAR, + 0 /* end marker */ +}; + +/* + * The order of this table is important -- it is also referenced by + * the command line processor to allow run-time overriding of the + * built-in size values. The order must not be changed: + * char, short, int, long, float, double (func pointer) + */ +SIZES size_table[] = { + { T_CHAR, S_CHAR, S_PCHAR }, /* char */ + { T_SHORT, S_SINT, S_PSINT }, /* short int */ + { T_INT, S_INT, S_PINT }, /* int */ + { T_LONG, S_LINT, S_PLINT }, /* long */ + { T_FLOAT, S_FLOAT, S_PFLOAT }, /* float */ + { T_DOUBLE, S_DOUBLE, S_PDOUBLE }, /* double */ + { T_FPTR, 0, S_PFPTR }, /* int (*()) */ + { 0, 0, 0 }, /* End of table */ +}; + + +void InitCpp5() +{ + +} + + + +int +eval() +/* + * Evaluate an expression. Straight-forward operator precedence. + * This is called from control() on encountering an #if statement. + * It calls the following routines: + * evallex Lexical analyser -- returns the type and value of + * the next input token. + * evaleval Evaluate the current operator, given the values on + * the value stack. Returns a pointer to the (new) + * value stack. + * For compatiblity with older cpp's, this return returns 1 (TRUE) + * if a syntax error is detected. + */ +{ + register int op; /* Current operator */ + register int *valp; /* -> value vector */ + register OPTAB *opp; /* Operator stack */ + int prec; /* Op precedence */ + int binop; /* Set if binary op. needed */ + int op1; /* Operand from stack */ + int skip; /* For short-circuit testing */ + int value[NEXP]; /* Value stack */ + OPTAB opstack[NEXP]; /* Operand stack */ +#ifndef ZTC /* BP */ + extern int *evaleval(); /* Does actual evaluation */ +#endif + valp = value; + opp = opstack; + opp->op = OP_END; /* Mark bottom of stack */ + opp->prec = opdope[OP_END]; /* And its precedence */ + opp->skip = 0; /* Not skipping now */ + binop = 0; +again: ; +#ifdef DEBUG_EVAL + fprintf( pCppOut, "In #if at again: skip = %d, binop = %d, line is: %s", + opp->skip, binop, infile->bptr); +#endif + if ((op = evallex(opp->skip)) == OP_SUB && binop == 0) + op = OP_NEG; /* Unary minus */ + else if (op == OP_ADD && binop == 0) + op = OP_PLU; /* Unary plus */ + else if (op == OP_FAIL) + return (1); /* Error in evallex */ +#ifdef DEBUG_EVAL + fprintf( pCppOut, "op = %s, opdope = %03o, binop = %d, skip = %d\n", + opname[op], opdope[op], binop, opp->skip); +#endif + if (op == DIG) { /* Value? */ + if (binop != 0) { + cerror("misplaced constant in #if", NULLST); + return (1); + } + else if (valp >= &value[NEXP-1]) { + cerror("#if value stack overflow", NULLST); + return (1); + } + else { +#ifdef DEBUG_EVAL + fprintf( pCppOut, "pushing %d onto value stack[%d]\n", + evalue, valp - value); +#endif + *valp++ = evalue; + binop = 1; + } + goto again; + } + else if (op > OP_END) { + cerror("Illegal #if line", NULLST); + return (1); + } + prec = opdope[op]; + if (binop != (prec & 1)) { + cerror("Operator %s in incorrect context", opname[op]); + return (1); + } + binop = (prec & 2) >> 1; + for (;;) { +#ifdef DEBUG_EVAL + fprintf( pCppOut, "op %s, prec %d., stacked op %s, prec %d, skip %d\n", + opname[op], prec, opname[opp->op], opp->prec, opp->skip); +#endif + if (prec > opp->prec) { + if (op == OP_LPA) + prec = OP_RPA_PREC; + else if (op == OP_QUE) + prec = OP_QUE_PREC; + op1 = opp->skip; /* Save skip for test */ + /* + * Push operator onto op. stack. + */ + opp++; + if (opp >= &opstack[NEXP]) { + cerror("expression stack overflow at op \"%s\"", + opname[op]); + return (1); + } + opp->op = (char)op; + opp->prec = (char)prec; + skip = (valp[-1] != 0); /* Short-circuit tester */ + /* + * Do the short-circuit stuff here. Short-circuiting + * stops automagically when operators are evaluated. + */ + if ((op == OP_ANA && !skip) + || (op == OP_ORO && skip)) + opp->skip = S_ANDOR; /* And/or skip starts */ + else if (op == OP_QUE) /* Start of ?: operator */ + opp->skip = (char)((op1 & S_ANDOR) | ((!skip) ? S_QUEST : 0)); + else if (op == OP_COL) { /* : inverts S_QUEST */ + opp->skip = (char)((op1 & S_ANDOR) + | (((op1 & S_QUEST) != 0) ? 0 : S_QUEST)); + } + else { /* Other ops leave */ + opp->skip = (char)op1; /* skipping unchanged. */ + } +#ifdef DEBUG_EVAL + fprintf( pCppOut, "stacking %s, valp[-1] == %d at %s", + opname[op], valp[-1], infile->bptr); + dumpstack(opstack, opp, value, valp); +#endif + goto again; + } + /* + * Pop operator from op. stack and evaluate it. + * End of stack and '(' are specials. + */ + skip = opp->skip; /* Remember skip value */ + switch ((op1 = opp->op)) { /* Look at stacked op */ + case OP_END: /* Stack end marker */ + if (op == OP_EOE) + return (valp[-1]); /* Finished ok. */ + goto again; /* Read another op. */ + + case OP_LPA: /* ( on stack */ + if (op != OP_RPA) { /* Matches ) on input */ + cerror("unbalanced paren's, op is \"%s\"", opname[op]); + return (1); + } + opp--; /* Unstack it */ + /* goto again; -- Fall through */ + + case OP_QUE: + goto again; /* Evaluate true expr. */ + + case OP_COL: /* : on stack. */ + opp--; /* Unstack : */ + if (opp->op != OP_QUE) { /* Matches ? on stack? */ + cerror("Misplaced '?' or ':', previous operator is %s", + opname[(int)opp->op]); + return (1); + } + /* + * Evaluate op1. + */ + default: /* Others: */ + opp--; /* Unstack the operator */ +#ifdef DEBUG_EVAL + fprintf( pCppOut, "Stack before evaluation of %s\n", opname[op1]); + dumpstack(opstack, opp, value, valp); +#endif + valp = evaleval(valp, op1, skip); +#ifdef DEBUG_EVAL + fprintf( pCppOut, "Stack after evaluation\n"); + dumpstack(opstack, opp, value, valp); +#endif + } /* op1 switch end */ + } /* Stack unwind loop */ +} + +FILE_LOCAL int +evallex(int skip) +/* + * Return next eval operator or value. Called from eval(). It + * calls a special-purpose routines for 'char' strings and + * numeric values: + * evalchar called to evaluate 'x' + * evalnum called to evaluate numbers. + */ +{ + register int c, c1, t; + +again: do { /* Collect the token */ + c = skipws(); + if ((c = macroid(c)) == EOF_CHAR || c == '\n') { + unget(); + return (OP_EOE); /* End of expression */ + } + } while ((t = type[c]) == LET && catenate()); + if (t == INV) { /* Total nonsense */ + if (!skip) { + if (isascii(c) && isprint(c)) + cierror("illegal character '%c' in #if", c); + else + cierror("illegal character (%d decimal) in #if", c); + } + return (OP_FAIL); + } + else if (t == QUO) { /* ' or " */ + if (c == '\'') { /* Character constant */ + evalue = evalchar(skip); /* Somewhat messy */ +#ifdef DEBUG_EVAL + fprintf( pCppOut, "evalchar returns %d.\n", evalue); +#endif + return (DIG); /* Return a value */ + } + cerror("Can't use a string in an #if", NULLST); + return (OP_FAIL); + } + else if (t == LET) { /* ID must be a macro */ + if (streq(token, "defined")) { /* Or defined name */ + c1 = c = skipws(); + if (c == '(') /* Allow defined(name) */ + c = skipws(); + if (type[c] == LET) { + evalue = (lookid(c) != NULL); + if (c1 != '(' /* Need to balance */ + || skipws() == ')') /* Did we balance? */ + return (DIG); /* Parsed ok */ + } + cerror("Bad #if ... defined() syntax", NULLST); + return (OP_FAIL); + } + else if (streq(token, "sizeof")) /* New sizeof hackery */ + return (dosizeof()); /* Gets own routine */ + /* + * The Draft ANSI C Standard says that an undefined symbol + * in an #if has the value zero. We are a bit pickier, + * warning except where the programmer was careful to write + * #if defined(foo) ? foo : 0 + */ +#ifdef STRICT_UNDEF + if (!skip) + cwarn("undefined symbol \"%s\" in #if, 0 used", token); +#endif + evalue = 0; + return (DIG); + } + else if (t == DIG) { /* Numbers are harder */ + evalue = evalnum(c); +#ifdef DEBUG_EVAL + fprintf( pCppOut, "evalnum returns %d.\n", evalue); +#endif + } + else if (strchr("!=<>&|\\", c) != NULL) { + /* + * Process a possible multi-byte lexeme. + */ + c1 = cget(); /* Peek at next char */ + switch (c) { + case '!': + if (c1 == '=') + return (OP_NE); + break; + + case '=': + if (c1 != '=') { /* Can't say a=b in #if */ + unget(); + cerror("= not allowed in #if", NULLST); + return (OP_FAIL); + } + return (OP_EQ); + + case '>': + case '<': + if (c1 == c) + return ((c == '<') ? OP_ASL : OP_ASR); + else if (c1 == '=') + return ((c == '<') ? OP_LE : OP_GE); + break; + + case '|': + case '&': + if (c1 == c) + return ((c == '|') ? OP_ORO : OP_ANA); + break; + + case '\\': + if (c1 == '\n') /* Multi-line if */ + goto again; + cerror("Unexpected \\ in #if", NULLST); + return (OP_FAIL); + } + unget(); + } + return (t); +} + +FILE_LOCAL int +dosizeof() +/* + * Process the sizeof (basic type) operation in an #if string. + * Sets evalue to the size and returns + * DIG success + * OP_FAIL bad parse or something. + */ +{ + register int c; + register TYPES *tp; + register SIZES *sizp; + register short *testp; + short typecode; + + if ((c = skipws()) != '(') + goto nogood; + /* + * Scan off the tokens. + */ + typecode = 0; + while (0 != (c = skipws())) { + if ((c = macroid(c)) == EOF_CHAR || c == '\n') + goto nogood; /* End of line is a bug */ + else if (c == '(') { /* thing (*)() func ptr */ + if (skipws() == '*' + && skipws() == ')') { /* We found (*) */ + if (skipws() != '(') /* Let () be optional */ + unget(); + else if (skipws() != ')') + goto nogood; + typecode |= T_FPTR; /* Function pointer */ + } + else { /* Junk is a bug */ + goto nogood; + } + } + else if (type[c] != LET) /* Exit if not a type */ + break; + else if (!catenate()) { /* Maybe combine tokens */ + /* + * Look for this unexpandable token in basic_types. + * The code accepts "int long" as well as "long int" + * which is a minor bug as bugs go (and one shared with + * a lot of C compilers). + */ + for (tp = basic_types; tp->name != NULLST; tp++) { + if (streq(token, tp->name)) + break; + } + if (tp->name == NULLST) { + cerror("#if sizeof, unknown type \"%s\"", token); + return (OP_FAIL); + } + typecode |= tp->type; /* Or in the type bit */ + } + } + /* + * We are at the end of the type scan. Chew off '*' if necessary. + */ + if (c == '*') { + typecode |= T_PTR; + c = skipws(); + } + if (c == ')') { /* Last syntax check */ + for (testp = test_table; *testp != 0; testp++) { + if (!bittest(typecode & *testp)) { + cerror("#if ... sizeof: illegal type combination", NULLST); + return (OP_FAIL); + } + } + /* + * We assume that all function pointers are the same size: + * sizeof (int (*)()) == sizeof (float (*)()) + * We assume that signed and unsigned don't change the size: + * sizeof (signed int) == (sizeof unsigned int) + */ + if ((typecode & T_FPTR) != 0) /* Function pointer */ + typecode = T_FPTR | T_PTR; + else { /* Var or var * datum */ + typecode &= ~(T_SIGNED | T_UNSIGNED); + if ((typecode & (T_SHORT | T_LONG)) != 0) + typecode &= ~T_INT; + } + if ((typecode & ~T_PTR) == 0) { + cerror("#if sizeof() error, no type specified", NULLST); + return (OP_FAIL); + } + /* + * Exactly one bit (and possibly T_PTR) may be set. + */ + for (sizp = size_table; sizp->bits != 0; sizp++) { + if ((typecode & ~T_PTR) == sizp->bits) { + evalue = ((typecode & T_PTR) != 0) + ? sizp->psize : sizp->size; + return (DIG); + } + } /* We shouldn't fail */ + cierror("#if ... sizeof: bug, unknown type code 0x%x", typecode); + return (OP_FAIL); + } + +nogood: unget(); + cerror("#if ... sizeof() syntax error", NULLST); + return (OP_FAIL); +} + +FILE_LOCAL int +bittest(int value) +/* + * TRUE if value is zero or exactly one bit is set in value. + */ +{ +#if (4096 & ~(-4096)) == 0 + return ((value & ~(-value)) == 0); +#else + /* + * Do it the hard way (for non 2's complement machines) + */ + return (value == 0 || value ^ (value - 1) == (value * 2 - 1)); +#endif +} + +FILE_LOCAL int +evalnum(int c) +/* + * Expand number for #if lexical analysis. Note: evalnum recognizes + * the unsigned suffix, but only returns a signed int value. + */ +{ + register int value; + register int base; + register int c1; + + if (c != '0') + base = 10; + else if ((c = cget()) == 'x' || c == 'X') { + base = 16; + c = cget(); + } + else base = 8; + value = 0; + for (;;) { + c1 = c; + if (isascii(c) && isupper(c1)) + c1 = tolower(c1); +#ifdef EBCDIC + if (c1 <= 'f') +#else + if (c1 >= 'a') +#endif + c1 -= ('a' - 10); + else c1 -= '0'; + if (c1 < 0 || c1 >= base) + break; + value *= base; + value += c1; + c = cget(); + } + if (c == 'u' || c == 'U') /* Unsigned nonsense */ + c = cget(); + unget(); + return (value); +} + +FILE_LOCAL int +evalchar(int skip) +/* + * Get a character constant + */ +{ + register int c; + register int value; + register int count; + + instring = TRUE; + if ((c = cget()) == '\\') { + switch ((c = cget())) { + case 'a': /* New in Standard */ +#if ('a' == '\a' || '\a' == ALERT) + value = ALERT; /* Use predefined value */ +#else + value = '\a'; /* Use compiler's value */ +#endif + break; + + case 'b': + value = '\b'; + break; + + case 'f': + value = '\f'; + break; + + case 'n': + value = '\n'; + break; + + case 'r': + value = '\r'; + break; + + case 't': + value = '\t'; + break; + + case 'v': /* New in Standard */ +#if ('v' == '\v' || '\v' == VT) + value = VT; /* Use predefined value */ +#else + value = '\v'; /* Use compiler's value */ +#endif + break; + + case 'x': /* '\xFF' */ + count = 3; + value = 0; + while ((((c = get()) >= '0' && c <= '9') + || (c >= 'a' && c <= 'f') + || (c >= 'A' && c <= 'F')) + && (--count >= 0)) { + value *= 16; +#ifdef EBCDIC + value += (c <= '9') ? (c - '0') : ((c & 0xF) + 9); +#else + value += (c >= '0') ? (c - '0') : ((c & 0xF) + 9); +#endif + } + unget(); + break; + + default: + if (c >= '0' && c <= '7') { + count = 3; + value = 0; + while (c >= '0' && c <= '7' && --count >= 0) { + value *= 8; + value += (c - '0'); + c = get(); + } + unget(); + } + else value = c; + break; + } + } + else if (c == '\'') + value = 0; + else value = c; + /* + * We warn on multi-byte constants and try to hack + * (big|little)endian machines. + */ +#if BIG_ENDIAN + count = 0; +#endif + while ((c = get()) != '\'' && c != EOF_CHAR && c != '\n') { + if (!skip) + ciwarn("multi-byte constant '%c' isn't portable", c); +#if BIG_ENDIAN + count += BITS_CHAR; + value += (c << count); +#else + value <<= BITS_CHAR; + value += c; +#endif + } + instring = FALSE; + return (value); +} + +FILE_LOCAL int * +evaleval(int* valp, int op, int skip) +/* + * Apply the argument operator to the data on the value stack. + * One or two values are popped from the value stack and the result + * is pushed onto the value stack. + * + * OP_COL is a special case. + * + * evaleval() returns the new pointer to the top of the value stack. + */ +{ + register int v1, v2 = 0; + + if (isbinary(op)) + v2 = *--valp; + v1 = *--valp; +#ifdef DEBUG_EVAL + fprintf( pCppOut, "%s op %s", (isbinary(op)) ? "binary" : "unary", + opname[op]); + if (isbinary(op)) + fprintf( pCppOut, ", v2 = %d.", v2); + fprintf( pCppOut, ", v1 = %d.\n", v1); +#endif + switch (op) { + case OP_EOE: + break; + + case OP_ADD: + v1 += v2; + break; + + case OP_SUB: + v1 -= v2; + break; + + case OP_MUL: + v1 *= v2; + break; + + case OP_DIV: + case OP_MOD: + if (v2 == 0) { + if (!skip) { + cwarn("%s by zero in #if, zero result assumed", + (op == OP_DIV) ? "divide" : "mod"); + } + v1 = 0; + } + else if (op == OP_DIV) + v1 /= v2; + else + v1 %= v2; + break; + + case OP_ASL: + v1 <<= v2; + break; + + case OP_ASR: + v1 >>= v2; + break; + + case OP_AND: + v1 &= v2; + break; + + case OP_OR: + v1 |= v2; + break; + + case OP_XOR: + v1 ^= v2; + break; + + case OP_EQ: + v1 = (v1 == v2); + break; + + case OP_NE: + v1 = (v1 != v2); + break; + + case OP_LT: + v1 = (v1 < v2); + break; + + case OP_LE: + v1 = (v1 <= v2); + break; + + case OP_GE: + v1 = (v1 >= v2); + break; + + case OP_GT: + v1 = (v1 > v2); + break; + + case OP_ANA: + v1 = (v1 && v2); + break; + + case OP_ORO: + v1 = (v1 || v2); + break; + + case OP_COL: + /* + * v1 has the "true" value, v2 the "false" value. + * The top of the value stack has the test. + */ + v1 = (*--valp) ? v1 : v2; + break; + + case OP_NEG: + v1 = (-v1); + break; + + case OP_PLU: + break; + + case OP_COM: + v1 = ~v1; + break; + + case OP_NOT: + v1 = !v1; + break; + + default: + cierror("#if bug, operand = %d.", op); + v1 = 0; + } + *valp++ = v1; + return (valp); +} + +#ifdef DEBUG_EVAL +dumpstack(opstack, opp, value, valp) +OPTAB opstack[NEXP]; /* Operand stack */ +register OPTAB *opp; /* Operator stack */ +int value[NEXP]; /* Value stack */ +register int *valp; /* -> value vector */ +{ + fprintf( pCppOut, "index op prec skip name -- op stack at %s", infile->bptr); + while (opp > opstack) { + fprintf( pCppOut, " [%2d] %2d %03o %d %s\n", opp - opstack, + opp->op, opp->prec, opp->skip, opname[opp->op]); + opp--; + } + while (--valp >= value) { + fprintf( pCppOut, "value[%d] = %d\n", (valp - value), *valp); + } +} +#endif + diff --git a/rsc/source/rscpp/cpp6.c b/rsc/source/rscpp/cpp6.c new file mode 100644 index 000000000000..4af7cd79c4c7 --- /dev/null +++ b/rsc/source/rscpp/cpp6.c @@ -0,0 +1,1151 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cpp6.c,v $ + * $Revision: 1.9 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <stdio.h> +#include <ctype.h> +#include <string.h> +#include "cppdef.h" +#include "cpp.h" + +/*ER evaluate macros to pDefOut */ + +/* + * skipnl() skips over input text to the end of the line. + * skipws() skips over "whitespace" (spaces or tabs), but + * not skip over the end of the line. It skips over + * TOK_SEP, however (though that shouldn't happen). + * scanid() reads the next token (C identifier) into token[]. + * The caller has already read the first character of + * the identifier. Unlike macroid(), the token is + * never expanded. + * macroid() reads the next token (C identifier) into token[]. + * If it is a #defined macro, it is expanded, and + * macroid() returns TRUE, otherwise, FALSE. + * catenate() Does the dirty work of token concatenation, TRUE if it did. + * scanstring() Reads a string from the input stream, calling + * a user-supplied function for each character. + * This function may be output() to write the + * string to the output file, or save() to save + * the string in the work buffer. + * scannumber() Reads a C numeric constant from the input stream, + * calling the user-supplied function for each + * character. (output() or save() as noted above.) + * save() Save one character in the work[] buffer. + * savestring() Saves a string in malloc() memory. + * getfile() Initialize a new FILEINFO structure, called when + * #include opens a new file, or a macro is to be + * expanded. + * getmem() Get a specified number of bytes from malloc memory. + * output() Write one character to stdout (calling PUTCHAR) -- + * implemented as a function so its address may be + * passed to scanstring() and scannumber(). + * lookid() Scans the next token (identifier) from the input + * stream. Looks for it in the #defined symbol table. + * Returns a pointer to the definition, if found, or NULL + * if not present. The identifier is stored in token[]. + * defnedel() Define enter/delete subroutine. Updates the + * symbol table. + * get() Read the next byte from the current input stream, + * handling end of (macro/file) input and embedded + * comments appropriately. Note that the global + * instring is -- essentially -- a parameter to get(). + * cget() Like get(), but skip over TOK_SEP. + * unget() Push last gotten character back on the input stream. + * cerror(), cwarn(), cfatal(), cierror(), ciwarn() + * These routines format an print messages to the user. + * cerror & cwarn take a format and a single string argument. + * cierror & ciwarn take a format and a single int (char) argument. + * cfatal takes a format and a single string argument. + */ + +/* + * This table must be rewritten for a non-Ascii machine. + * + * Note that several "non-visible" characters have special meaning: + * Hex 1D DEF_MAGIC -- a flag to prevent #define recursion. + * Hex 1E TOK_SEP -- a delimiter for token concatenation + * Hex 1F COM_SEP -- a zero-width whitespace for comment concatenation + */ +#if TOK_SEP != 0x1E || COM_SEP != 0x1F || DEF_MAGIC != 0x1D + << error type table is not correct >> +#endif + +#if OK_DOLLAR +#define DOL LET +#else +#define DOL 000 +#endif + +#ifdef EBCDIC + +char type[256] = { /* Character type codes Hex */ + END, 000, 000, 000, 000, SPA, 000, 000, /* 00 */ + 000, 000, 000, 000, 000, 000, 000, 000, /* 08 */ + 000, 000, 000, 000, 000, 000, 000, 000, /* 10 */ + 000, 000, 000, 000, 000, LET, 000, SPA, /* 18 */ + 000, 000, 000, 000, 000, 000, 000, 000, /* 20 */ + 000, 000, 000, 000, 000, 000, 000, 000, /* 28 */ + 000, 000, 000, 000, 000, 000, 000, 000, /* 30 */ + 000, 000, 000, 000, 000, 000, 000, 000, /* 38 */ + SPA, 000, 000, 000, 000, 000, 000, 000, /* 40 */ + 000, 000, 000, DOT, OP_LT,OP_LPA,OP_ADD, OP_OR, /* 48 .<(+| */ +OP_AND, 000, 000, 000, 000, 000, 000, 000, /* 50 & */ + 000, 000,OP_NOT, DOL,OP_MUL,OP_RPA, 000,OP_XOR, /* 58 !$*);^ */ +OP_SUB,OP_DIV, 000, 000, 000, 000, 000, 000, /* 60 -/ */ + 000, 000, 000, 000,OP_MOD, LET, OP_GT,OP_QUE, /* 68 ,%_>? */ + 000, 000, 000, 000, 000, 000, 000, 000, /* 70 */ + 000, 000,OP_COL, 000, 000, QUO, OP_EQ, QUO, /* 78 `:#@'=" */ + 000, LET, LET, LET, LET, LET, LET, LET, /* 80 abcdefg */ + LET, LET, 000, 000, 000, 000, 000, 000, /* 88 hi */ + 000, LET, LET, LET, LET, LET, LET, LET, /* 90 jklmnop */ + LET, LET, 000, 000, 000, 000, 000, 000, /* 98 qr */ + 000,OP_NOT, LET, LET, LET, LET, LET, LET, /* A0 ~stuvwx */ + LET, LET, 000, 000, 000, 000, 000, 000, /* A8 yz [ */ + 000, 000, 000, 000, 000, 000, 000, 000, /* B0 */ + 000, 000, 000, 000, 000, 000, 000, 000, /* B8 ] */ + 000, LET, LET, LET, LET, LET, LET, LET, /* C0 {ABCDEFG */ + LET, LET, 000, 000, 000, 000, 000, 000, /* C8 HI */ + 000, LET, LET, LET, LET, LET, LET, LET, /* D0 }JKLMNOP */ + LET, LET, 000, 000, 000, 000, 000, 000, /* D8 QR */ + BSH, 000, LET, LET, LET, LET, LET, LET, /* E0 \ STUVWX */ + LET, LET, 000, 000, 000, 000, 000, 000, /* E8 YZ */ + DIG, DIG, DIG, DIG, DIG, DIG, DIG, DIG, /* F0 01234567 */ + DIG, DIG, 000, 000, 000, 000, 000, 000, /* F8 89 */ +}; + +#else + +char type[256] = { /* Character type codes Hex */ + END, 000, 000, 000, 000, 000, 000, 000, /* 00 */ + 000, SPA, 000, 000, 000, 000, 000, 000, /* 08 */ + 000, 000, 000, 000, 000, 000, 000, 000, /* 10 */ + 000, 000, 000, 000, 000, LET, 000, SPA, /* 18 */ + SPA,OP_NOT, QUO, 000, DOL,OP_MOD,OP_AND, QUO, /* 20 !"#$%&' */ +OP_LPA,OP_RPA,OP_MUL,OP_ADD, 000,OP_SUB, DOT,OP_DIV, /* 28 ()*+,-./ */ + DIG, DIG, DIG, DIG, DIG, DIG, DIG, DIG, /* 30 01234567 */ + DIG, DIG,OP_COL, 000, OP_LT, OP_EQ, OP_GT,OP_QUE, /* 38 89:;<=>? */ + 000, LET, LET, LET, LET, LET, LET, LET, /* 40 @ABCDEFG */ + LET, LET, LET, LET, LET, LET, LET, LET, /* 48 HIJKLMNO */ + LET, LET, LET, LET, LET, LET, LET, LET, /* 50 PQRSTUVW */ + LET, LET, LET, 000, BSH, 000,OP_XOR, LET, /* 58 XYZ[\]^_ */ + 000, LET, LET, LET, LET, LET, LET, LET, /* 60 `abcdefg */ + LET, LET, LET, LET, LET, LET, LET, LET, /* 68 hijklmno */ + LET, LET, LET, LET, LET, LET, LET, LET, /* 70 pqrstuvw */ + LET, LET, LET, 000, OP_OR, 000,OP_NOT, 000, /* 78 xyz{|}~ */ + 000, 000, 000, 000, 000, 000, 000, 000, /* 80 .. FF */ + 000, 000, 000, 000, 000, 000, 000, 000, /* 80 .. FF */ + 000, 000, 000, 000, 000, 000, 000, 000, /* 80 .. FF */ + 000, 000, 000, 000, 000, 000, 000, 000, /* 80 .. FF */ + 000, 000, 000, 000, 000, 000, 000, 000, /* 80 .. FF */ + 000, 000, 000, 000, 000, 000, 000, 000, /* 80 .. FF */ + 000, 000, 000, 000, 000, 000, 000, 000, /* 80 .. FF */ + 000, 000, 000, 000, 000, 000, 000, 000, /* 80 .. FF */ +}; + +#endif + + +/* + * C P P S y m b o l T a b l e s + */ + +/* + * SBSIZE defines the number of hash-table slots for the symbol table. + * It must be a power of 2. + */ +#ifndef SBSIZE +#define SBSIZE 64 +#endif +#define SBMASK (SBSIZE - 1) +#if (SBSIZE ^ SBMASK) != ((SBSIZE * 2) - 1) + << error, SBSIZE must be a power of 2 >> +#endif + + +static DEFBUF *symtab[SBSIZE]; /* Symbol table queue headers */ + +void InitCpp6() +{ + int i; + for( i = 0; i < SBSIZE; i++ ) + symtab[ i ] = NULL; +} + + + +void skipnl() +/* + * Skip to the end of the current input line. + */ +{ + register int c; + + do { /* Skip to newline */ + c = get(); + } while (c != '\n' && c != EOF_CHAR); +} + +int +skipws() +/* + * Skip over whitespace + */ +{ + register int c; + + do { /* Skip whitespace */ + c = get(); +#if COMMENT_INVISIBLE + } while (type[c] == SPA || c == COM_SEP); +#else + } while (type[c] == SPA); +#endif + return (c); +} + +void scanid(int c) +/* + * Get the next token (an id) into the token buffer. + * Note: this code is duplicated in lookid(). + * Change one, change both. + */ +{ + register char *bp; + + if (c == DEF_MAGIC) /* Eat the magic token */ + c = get(); /* undefiner. */ + bp = token; + do { + if (bp < &token[IDMAX]) /* token dim is IDMAX+1 */ + *bp++ = (char)c; + c = get(); + } while (type[c] == LET || type[c] == DIG); + unget(); + *bp = EOS; +} + +int +macroid(int c) +/* + * If c is a letter, scan the id. if it's #defined, expand it and scan + * the next character and try again. + * + * Else, return the character. If type[c] is a LET, the token is in token. + */ +{ + register DEFBUF *dp; + + if (infile != NULL && infile->fp != NULL) + recursion = 0; + while (type[c] == LET && (dp = lookid(c)) != NULL) { + expand(dp); + c = get(); + } + return (c); +} + +int +catenate() +/* + * A token was just read (via macroid). + * If the next character is TOK_SEP, concatenate the next token + * return TRUE -- which should recall macroid after refreshing + * macroid's argument. If it is not TOK_SEP, unget() the character + * and return FALSE. + */ +{ + register int c; + register char *token1; + +#if OK_CONCAT + if (get() != TOK_SEP) { /* Token concatenation */ + unget(); + return (FALSE); + } + else { + token1 = savestring(token); /* Save first token */ + c = macroid(get()); /* Scan next token */ + switch(type[c]) { /* What was it? */ + case LET: /* An identifier, ... */ + if (strlen(token1) + strlen(token) >= NWORK) + cfatal("work buffer overflow doing %s #", token1); + sprintf(work, "%s%s", token1, token); + break; + + case DIG: /* A digit string */ + strcpy(work, token1); + workp = work + strlen(work); + do { + save(c); + } while ((c = get()) != TOK_SEP); + /* + * The trailing TOK_SEP is no longer needed. + */ + save(EOS); + break; + + default: /* An error, ... */ +#if ! COMMENT_INVISIBLE + if (isprint(c)) + cierror("Strange character '%c' after #", c); + else + cierror("Strange character (%d.) after #", c); +#endif + strcpy(work, token1); + unget(); + break; + } + /* + * work has the concatenated token and token1 has + * the first token (no longer needed). Unget the + * new (concatenated) token after freeing token1. + * Finally, setup to read the new token. + */ + free(token1); /* Free up memory */ + ungetstring(work); /* Unget the new thing, */ + return (TRUE); + } +#else + return (FALSE); /* Not supported */ +#endif +} + +int +scanstring(int delim, +#ifndef _NO_PROTO +void (*outfun)( int ) /* BP */ /* Output function */ +#else +void (*outfun)() /* BP */ +#endif +) +/* + * Scan off a string. Warning if terminated by newline or EOF. + * outfun() outputs the character -- to a buffer if in a macro. + * TRUE if ok, FALSE if error. + */ +{ + register int c; + + instring = TRUE; /* Don't strip comments */ + (*outfun)(delim); + while ((c = get()) != delim + && c != '\n' + && c != EOF_CHAR) { + + if (c != DEF_MAGIC) + (*outfun)(c); + if (c == '\\') + (*outfun)(get()); + } + instring = FALSE; + if (c == delim) { + (*outfun)(c); + return (TRUE); + } + else { + cerror("Unterminated string", NULLST); + unget(); + return (FALSE); + } +} + +void scannumber(int c, +#ifndef _NO_PROTO +register void (*outfun)( int ) /* BP */ /* Output/store func */ +#else +register void (*outfun)() /* BP */ +#endif +) +/* + * Process a number. We know that c is from 0 to 9 or dot. + * Algorithm from Dave Conroy's Decus C. + */ +{ + register int radix; /* 8, 10, or 16 */ + int expseen; /* 'e' seen in floater */ + int signseen; /* '+' or '-' seen */ + int octal89; /* For bad octal test */ + int dotflag; /* TRUE if '.' was seen */ + + expseen = FALSE; /* No exponent seen yet */ + signseen = TRUE; /* No +/- allowed yet */ + octal89 = FALSE; /* No bad octal yet */ + radix = 10; /* Assume decimal */ + if ((dotflag = (c == '.')) != FALSE) { /* . something? */ + (*outfun)('.'); /* Always out the dot */ + if (type[(c = get())] != DIG) { /* If not a float numb, */ + unget(); /* Rescan strange char */ + return; /* All done for now */ + } + } /* End of float test */ + else if (c == '0') { /* Octal or hex? */ + (*outfun)(c); /* Stuff initial zero */ + radix = 8; /* Assume it's octal */ + c = get(); /* Look for an 'x' */ + if (c == 'x' || c == 'X') { /* Did we get one? */ + radix = 16; /* Remember new radix */ + (*outfun)(c); /* Stuff the 'x' */ + c = get(); /* Get next character */ + } + } + for (;;) { /* Process curr. char. */ + /* + * Note that this algorithm accepts "012e4" and "03.4" + * as legitimate floating-point numbers. + */ + if (radix != 16 && (c == 'e' || c == 'E')) { + if (expseen) /* Already saw 'E'? */ + break; /* Exit loop, bad nbr. */ + expseen = TRUE; /* Set exponent seen */ + signseen = FALSE; /* We can read '+' now */ + radix = 10; /* Decimal exponent */ + } + else if (radix != 16 && c == '.') { + if (dotflag) /* Saw dot already? */ + break; /* Exit loop, two dots */ + dotflag = TRUE; /* Remember the dot */ + radix = 10; /* Decimal fraction */ + } + else if (c == '+' || c == '-') { /* 1.0e+10 */ + if (signseen) /* Sign in wrong place? */ + break; /* Exit loop, not nbr. */ + /* signseen = TRUE; */ /* Remember we saw it */ + } + else { /* Check the digit */ + switch (c) { + case '8': case '9': /* Sometimes wrong */ + octal89 = TRUE; /* Do check later */ + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + break; /* Always ok */ + + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + if (radix == 16) /* Alpha's are ok only */ + break; /* if reading hex. */ + default: /* At number end */ + goto done; /* Break from for loop */ + } /* End of switch */ + } /* End general case */ + (*outfun)(c); /* Accept the character */ + signseen = TRUE; /* Don't read sign now */ + c = get(); /* Read another char */ + } /* End of scan loop */ + /* + * When we break out of the scan loop, c contains the first + * character (maybe) not in the number. If the number is an + * integer, allow a trailing 'L' for long and/or a trailing 'U' + * for unsigned. If not those, push the trailing character back + * on the input stream. Floating point numbers accept a trailing + * 'L' for "long double". + */ +done: if (dotflag || expseen) { /* Floating point? */ + if (c == 'l' || c == 'L') { + (*outfun)(c); + c = get(); /* Ungotten later */ + } + } + else { /* Else it's an integer */ + /* + * We know that dotflag and expseen are both zero, now: + * dotflag signals "saw 'L'", and + * expseen signals "saw 'U'". + */ + for (;;) { + switch (c) { + case 'l': + case 'L': + if (dotflag) + goto nomore; + dotflag = TRUE; + break; + + case 'u': + case 'U': + if (expseen) + goto nomore; + expseen = TRUE; + break; + + default: + goto nomore; + } + (*outfun)(c); /* Got 'L' or 'U'. */ + c = get(); /* Look at next, too. */ + } + } +nomore: unget(); /* Not part of a number */ + if (octal89 && radix == 8) + cwarn("Illegal digit in octal number", NULLST); +} + +void save(int c) +{ + if (workp >= &work[NWORK]) { + work[NWORK-1] = '\0'; + cfatal("Work buffer overflow: %s", work); + } + else *workp++ = (char)c; +} + +char * +savestring(char* text) +/* + * Store a string into free memory. + */ +{ + register char *result; + + result = getmem(strlen(text) + 1); + strcpy(result, text); + return (result); +} + +FILEINFO * +getfile(int bufsize, char* name) +/* + * Common FILEINFO buffer initialization for a new file or macro. + */ +{ + register FILEINFO *file; + register int size; + + size = strlen(name); /* File/macro name */ + file = (FILEINFO *) getmem(sizeof (FILEINFO) + bufsize + size); + file->parent = infile; /* Chain files together */ + file->fp = NULL; /* No file yet */ + file->filename = savestring(name); /* Save file/macro name */ + file->progname = NULL; /* No #line seen yet */ + file->unrecur = 0; /* No macro fixup */ + file->bptr = file->buffer; /* Initialize line ptr */ + file->buffer[0] = EOS; /* Force first read */ + file->line = 0; /* (Not used just yet) */ + if (infile != NULL) /* If #include file */ + infile->line = line; /* Save current line */ + infile = file; /* New current file */ + line = 1; /* Note first line */ + return (file); /* All done. */ +} + +char * +getmem(int size) +/* + * Get a block of free memory. + */ +{ + register char *result; + + if ((result = malloc((unsigned) size)) == NULL) + cfatal("Out of memory", NULLST); + return (result); +} + + +DEFBUF * +lookid(int c) +/* + * Look for the next token in the symbol table. Returns token in "token". + * If found, returns the table pointer; Else returns NULL. + */ +{ + register int nhash; + register DEFBUF *dp; + register char *np; + int temp = 0; + int isrecurse; /* For #define foo foo */ + + np = token; + nhash = 0; + if (0 != (isrecurse = (c == DEF_MAGIC))) /* If recursive macro */ + c = get(); /* hack, skip DEF_MAGIC */ + do { + if (np < &token[IDMAX]) { /* token dim is IDMAX+1 */ + *np++ = (char)c; /* Store token byte */ + nhash += c; /* Update hash value */ + } + c = get(); /* And get another byte */ + } while (type[c] == LET || type[c] == DIG); + unget(); /* Rescan terminator */ + *np = EOS; /* Terminate token */ + if (isrecurse) /* Recursive definition */ + return (NULL); /* undefined just now */ + nhash += (np - token); /* Fix hash value */ + dp = symtab[nhash & SBMASK]; /* Starting bucket */ + while (dp != (DEFBUF *) NULL) { /* Search symbol table */ + if (dp->hash == nhash /* Fast precheck */ + && (temp = strcmp(dp->name, token)) >= 0) + break; + dp = dp->link; /* Nope, try next one */ + } + return ((temp == 0) ? dp : NULL); +} + +DEFBUF * +defendel(char* name, int delete) +/* + * Enter this name in the lookup table (delete = FALSE) + * or delete this name (delete = TRUE). + * Returns a pointer to the define block (delete = FALSE) + * Returns NULL if the symbol wasn't defined (delete = TRUE). + */ +{ + register DEFBUF *dp; + register DEFBUF **prevp; + register char *np; + int nhash; + int temp; + int size; + + for (nhash = 0, np = name; *np != EOS;) + nhash += *np++; + size = (np - name); + nhash += size; + prevp = &symtab[nhash & SBMASK]; + while ((dp = *prevp) != (DEFBUF *) NULL) { + if (dp->hash == nhash + && (temp = strcmp(dp->name, name)) >= 0) { + if (temp > 0) + dp = NULL; /* Not found */ + else { + *prevp = dp->link; /* Found, unlink and */ + if (dp->repl != NULL) /* Free the replacement */ + free(dp->repl); /* if any, and then */ + free((char *) dp); /* Free the symbol */ + } + break; + } + prevp = &dp->link; + } + if (!delete) { + dp = (DEFBUF *) getmem(sizeof (DEFBUF) + size); + dp->link = *prevp; + *prevp = dp; + dp->hash = nhash; + dp->repl = NULL; + dp->nargs = 0; + strcpy(dp->name, name); + } + return (dp); +} + +#if OSL_DEBUG_LEVEL > 1 + +void dumpdef(char *why) +{ + register DEFBUF *dp; + register DEFBUF **syp; + FILE *pRememberOut = NULL; + + if ( bDumpDefs ) /*ER */ + { + pRememberOut = pCppOut; + pCppOut = pDefOut; + } + fprintf( pCppOut, "CPP symbol table dump %s\n", why); + for (syp = symtab; syp < &symtab[SBSIZE]; syp++) { + if ((dp = *syp) != (DEFBUF *) NULL) { + fprintf( pCppOut, "symtab[%d]\n", (syp - symtab)); + do { + dumpadef((char *) NULL, dp); + } while ((dp = dp->link) != (DEFBUF *) NULL); + } + } + if ( bDumpDefs ) + { + fprintf( pCppOut, "\n"); + pCppOut = pRememberOut; + } +} + +void dumpadef(char *why, register DEFBUF *dp) +{ + register char *cp; + register int c; + FILE *pRememberOut = NULL; + +/*ER dump #define's to pDefOut */ + if ( bDumpDefs ) + { + pRememberOut = pCppOut; + pCppOut = pDefOut; + } + fprintf( pCppOut, " \"%s\" [%d]", dp->name, dp->nargs); + if (why != NULL) + fprintf( pCppOut, " (%s)", why); + if (dp->repl != NULL) { + fprintf( pCppOut, " => "); + for (cp = dp->repl; (c = *cp++ & 0xFF) != EOS;) { +#ifdef SOLAR + if (c == DEL) { + c = *cp++ & 0xFF; + if( c == EOS ) break; + fprintf( pCppOut, "<%%%d>", c - MAC_PARM); + } +#else + if (c >= MAC_PARM && c <= (MAC_PARM + PAR_MAC)) + fprintf( pCppOut, "<%%%d>", c - MAC_PARM); +#endif + else if (isprint(c) || c == '\n' || c == '\t') + PUTCHAR(c); + else if (c < ' ') + fprintf( pCppOut, "<^%c>", c + '@'); + else + fprintf( pCppOut, "<\\0%o>", c); + } +/*ER evaluate macros to pDefOut */ +#ifdef EVALDEFS + if ( bDumpDefs && !bIsInEval && dp->nargs <= 0 ) + { + FILEINFO *infileSave = infile; + char *tokenSave = savestring( token ); + char *workSave = savestring( work ); + int lineSave = line; + int wronglineSave = wrongline; + int recursionSave = recursion; + FILEINFO *file; + EVALTYPE valEval; + + bIsInEval = 1; + infile = NULL; /* start from scrap */ + line = 0; + wrongline = 0; + *token = EOS; + *work = EOS; + recursion = 0; + file = getfile( strlen( dp->repl ), dp->name ); + strcpy( file->buffer, dp->repl ); + fprintf( pCppOut, " ===> "); + nEvalOff = 0; + cppmain(); /* get() frees also *file */ + valEval = 0; + if ( 0 == evaluate( EvalBuf, &valEval ) ) + { +#ifdef EVALFLOATS + if ( valEval != (EVALTYPE)((long)valEval ) ) + fprintf( pCppOut, " ==eval=> %f", valEval ); + else +#endif + fprintf( pCppOut, " ==eval=> %ld", (long)valEval ); + } + recursion = recursionSave; + wrongline = wronglineSave; + line = lineSave; + strcpy( work, workSave ); + free( workSave ); + strcpy( token, tokenSave ); + free( tokenSave ); + infile = infileSave; + bIsInEval = 0; + } +#endif + } + else { + fprintf( pCppOut, ", no replacement."); + } + PUTCHAR('\n'); + if ( bDumpDefs ) + pCppOut = pRememberOut; +} +#endif + +/* + * G E T + */ + +int +get() +/* + * Return the next character from a macro or the current file. + * Handle end of file from #include files. + */ +{ + register int c; + register FILEINFO *file; + register int popped; /* Recursion fixup */ + + popped = 0; +get_from_file: + if ((file = infile) == NULL) + return (EOF_CHAR); +newline: +#if 0 + fprintf( pCppOut, "get(%s), recursion %d, line %d, bptr = %d, buffer \"%s\"\n", + file->filename, recursion, line, + file->bptr - file->buffer, file->buffer); +#endif + /* + * Read a character from the current input line or macro. + * At EOS, either finish the current macro (freeing temp. + * storage) or read another line from the current input file. + * At EOF, exit the current file (#include) or, at EOF from + * the cpp input file, return EOF_CHAR to finish processing. + */ + if ((c = *file->bptr++ & 0xFF) == EOS) { + /* + * Nothing in current line or macro. Get next line (if + * input from a file), or do end of file/macro processing. + * In the latter case, jump back to restart from the top. + */ + if (file->fp == NULL) { /* NULL if macro */ + popped++; + recursion -= file->unrecur; + if (recursion < 0) + recursion = 0; + infile = file->parent; /* Unwind file chain */ + } + else { /* Else get from a file */ + if ((file->bptr = fgets(file->buffer, NBUFF, file->fp)) + != NULL) { +#if OSL_DEBUG_LEVEL > 1 + if (debug > 1) { /* Dump it to stdout */ + fprintf( pCppOut, "\n#line %d (%s), %s", + line, file->filename, file->buffer); + } +#endif + goto newline; /* process the line */ + } + else { + if( file->fp != stdin ) + fclose(file->fp); /* Close finished file */ + if ((infile = file->parent) != NULL) { + /* + * There is an "ungotten" newline in the current + * infile buffer (set there by doinclude() in + * cpp1.c). Thus, we know that the mainline code + * is skipping over blank lines and will do a + * #line at its convenience. + */ + wrongline = TRUE; /* Need a #line now */ + } + } + } + /* + * Free up space used by the (finished) file or macro and + * restart input from the parent file/macro, if any. + */ + free(file->filename); /* Free name and */ + if (file->progname != NULL) /* if a #line was seen, */ + free(file->progname); /* free it, too. */ + free((char *) file); /* Free file space */ + if (infile == NULL) /* If at end of file */ + return (EOF_CHAR); /* Return end of file */ + line = infile->line; /* Reset line number */ + goto get_from_file; /* Get from the top. */ + } + /* + * Common processing for the new character. + */ + if (c == DEF_MAGIC && file->fp != NULL) /* Don't allow delete */ + goto newline; /* from a file */ + if (file->parent != NULL) { /* Macro or #include */ + if (popped != 0) + file->parent->unrecur += popped; + else { + recursion -= file->parent->unrecur; + if (recursion < 0) + recursion = 0; + file->parent->unrecur = 0; + } + } +#if (HOST == SYS_UNIX) +/*ER*/ if (c == '\r') +/*ER*/ return get(); /* DOS fuck */ +#endif + if (c == '\n') /* Maintain current */ + ++line; /* line counter */ + if (instring) /* Strings just return */ + return (c); /* the character. */ + else if (c == '/') { /* Comment? */ + instring = TRUE; /* So get() won't loop */ +/*MM c++ comments */ +/*MM*/ c = get(); +/*MM*/ if ((c != '*') && (c != '/')) { /* Next byte '*'? */ + instring = FALSE; /* Nope, no comment */ + unget(); /* Push the char. back */ + return ('/'); /* Return the slash */ + } + if (keepcomments) { /* If writing comments */ + PUTCHAR('/'); /* Write out the */ + /* initializer */ +/*MM*/ if( '*' == c ) + PUTCHAR('*'); +/*MM*/ else +/*MM*/ PUTCHAR('/'); + + } +/*MM*/ if( '*' == c ){ + for (;;) { /* Eat a comment */ + c = get(); + test: if (keepcomments && c != EOF_CHAR) + cput(c); + switch (c) { + case EOF_CHAR: + cerror("EOF in comment", NULLST); + return (EOF_CHAR); + + case '/': + if ((c = get()) != '*') /* Don't let comments */ + goto test; /* Nest. */ +#ifdef STRICT_COMMENTS + cwarn("Nested comments", NULLST); +#endif + /* Fall into * stuff */ + case '*': + if ((c = get()) != '/') /* If comment doesn't */ + goto test; /* end, look at next */ + instring = FALSE; /* End of comment, */ + if (keepcomments) { /* Put out the comment */ + cput(c); /* terminator, too */ + } + /* + * A comment is syntactically "whitespace" -- + * however, there are certain strange sequences + * such as + * #define foo(x) (something) + * foo|* comment *|(123) + * these are '/' ^ ^ + * where just returning space (or COM_SEP) will cause + * problems. This can be "fixed" by overwriting the + * '/' in the input line buffer with ' ' (or COM_SEP) + * but that may mess up an error message. + * So, we peek ahead -- if the next character is + * "whitespace" we just get another character, if not, + * we modify the buffer. All in the name of purity. + */ + if (*file->bptr == '\n' + || type[*file->bptr & 0xFF] == SPA) + goto newline; +#if COMMENT_INVISIBLE + /* + * Return magic (old-fashioned) syntactic space. + */ + return ((file->bptr[-1] = COM_SEP)); +#else + return ((file->bptr[-1] = ' ')); +#endif + + case '\n': /* we'll need a #line */ + if (!keepcomments) + wrongline = TRUE; /* later... */ + default: /* Anything else is */ + break; /* Just a character */ + } /* End switch */ + } /* End comment loop */ + } + else{ /* c++ comment */ +/*MM c++ comment*/ + for (;;) { /* Eat a comment */ + c = get(); + if (keepcomments && c != EOF_CHAR) + cput(c); + if( EOF_CHAR == c ) + return (EOF_CHAR); + else if( '\n' == c ){ + instring = FALSE; /* End of comment, */ + return( c ); + } + } + } + } /* End if in comment */ + else if (!inmacro && c == '\\') { /* If backslash, peek */ + if ((c = get()) == '\n') { /* for a <nl>. If so, */ + wrongline = TRUE; + goto newline; + } + else { /* Backslash anything */ + unget(); /* Get it later */ + return ('\\'); /* Return the backslash */ + } + } + else if (c == '\f' || c == VT) /* Form Feed, Vertical */ + c = ' '; /* Tab are whitespace */ + else if (c == 0xef) /* eat up UTF-8 BOM */ + { + if((c = get()) == 0xbb) + { + if((c = get()) == 0xbf) + { + c = get(); + return c; + } + else + { + unget(); + unget(); + return 0xef; + } + } + else + { + unget(); + return 0xef; + } + } + return (c); /* Just return the char */ +} + +void unget() +/* + * Backup the pointer to reread the last character. Fatal error + * (code bug) if we backup too far. unget() may be called, + * without problems, at end of file. Only one character may + * be ungotten. If you need to unget more, call ungetstring(). + */ +{ + register FILEINFO *file; + + if ((file = infile) == NULL) + return; /* Unget after EOF */ + if (--file->bptr < file->buffer) + cfatal("Too much pushback", NULLST); + if (*file->bptr == '\n') /* Ungetting a newline? */ + --line; /* Unget the line number, too */ +} + +void ungetstring(char* text) +/* + * Push a string back on the input stream. This is done by treating + * the text as if it were a macro. + */ +{ + register FILEINFO *file; +#ifndef ZTC /* BP */ + extern FILEINFO *getfile(); +#endif + file = getfile(strlen(text) + 1, ""); + strcpy(file->buffer, text); +} + +int +cget() +/* + * Get one character, absorb "funny space" after comments or + * token concatenation + */ +{ + register int c; + + do { + c = get(); +#if COMMENT_INVISIBLE + } while (c == TOK_SEP || c == COM_SEP); +#else + } while (c == TOK_SEP); +#endif + return (c); +} + +/* + * Error messages and other hacks. The first byte of severity + * is 'S' for string arguments and 'I' for int arguments. This + * is needed for portability with machines that have int's that + * are shorter than char *'s. + */ + +static void domsg(char* severity, char* format, void* arg) +/* + * Print filenames, macro names, and line numbers for error messages. + */ +{ + register char *tp; + register FILEINFO *file; + + fprintf(stderr, "%sline %d, %s: ", MSG_PREFIX, line, &severity[1]); + if (*severity == 'S') + fprintf(stderr, format, (char *)arg); + else + fprintf(stderr, format, *((int *)arg) ); + putc('\n', stderr); + if ((file = infile) == NULL) + return; /* At end of file */ + if (file->fp != NULL) { + tp = file->buffer; /* Print current file */ + fprintf(stderr, "%s", tp); /* name, making sure */ + if (tp[strlen(tp) - 1] != '\n') /* there's a newline */ + putc('\n', stderr); + } + while ((file = file->parent) != NULL) { /* Print #includes, too */ + if (file->fp == NULL) + fprintf(stderr, "from macro %s\n", file->filename); + else { + tp = file->buffer; + fprintf(stderr, "from file %s, line %d:\n%s", + (file->progname != NULL) + ? file->progname : file->filename, + file->line, tp); + if (tp[strlen(tp) - 1] != '\n') + putc('\n', stderr); + } + } +} + +void cerror(char* format, char* sarg) +/* + * Print a normal error message, string argument. + */ +{ + domsg("SError", format, sarg); + errors++; +} + +void cierror(char* format, int narg) +/* + * Print a normal error message, numeric argument. + */ +{ + domsg("IError", format, &narg); + errors++; +} + +void cfatal(char* format, char* sarg) +/* + * A real disaster + */ +{ + domsg("SFatal error", format, sarg); + exit(IO_ERROR); +} + +void cwarn(char* format, char* sarg) +/* + * A non-fatal error, string argument. + */ +{ + domsg("SWarning", format, sarg); +} + +void ciwarn(char* format, int narg) +/* + * A non-fatal error, numeric argument. + */ +{ + domsg("IWarning", format, &narg); +} + diff --git a/rsc/source/rscpp/cppdef.h b/rsc/source/rscpp/cppdef.h new file mode 100644 index 000000000000..270cee88b2ba --- /dev/null +++ b/rsc/source/rscpp/cppdef.h @@ -0,0 +1,349 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cppdef.h,v $ + * $Revision: 1.9 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +/* + * This redundant definition of TRUE and FALSE works around + * a limitation of Decus C. + */ +#ifndef TRUE +#define TRUE 1 +#define FALSE 0 +#endif + +/* + * Define the HOST operating system. This is needed so that + * cpp can use appropriate filename conventions. + */ +#define SYS_UNKNOWN 0 +#define SYS_UNIX 1 +#define SYS_VMS 2 +#define SYS_RSX 3 +#define SYS_RT11 4 +#define SYS_LATTICE 5 +#define SYS_ONYX 6 +#define SYS_68000 7 + +#ifndef HOST +#ifdef unix +#define HOST SYS_UNIX +#else +#ifdef vms +#define HOST SYS_VMS +#else +#ifdef rsx +#define HOST SYS_RSX +#else +#ifdef rt11 +#define HOST SYS_RT11 +#endif +#endif +#endif +#endif +#endif + +#ifndef HOST +#define HOST SYS_UNKNOWN +#endif + +/* + * We assume that the target is the same as the host system + */ +#ifndef TARGET +#define TARGET HOST +#endif + +/* + * In order to predefine machine-dependent constants, + * several strings are defined here: + * + * MACHINE defines the target cpu (by name) + * SYSTEM defines the target operating system + * COMPILER defines the target compiler + * + * The above may be #defined as "" if they are not wanted. + * They should not be #defined as NULL. + * + * LINE_PREFIX defines the # output line prefix, if not "line" + * This should be defined as "" if cpp is to replace + * the "standard" C pre-processor. + * + * FILE_LOCAL marks functions which are referenced only in the + * file they reside. Some C compilers allow these + * to be marked "static" even though they are referenced + * by "extern" statements elsewhere. + * + * OK_DOLLAR Should be set TRUE if $ is a valid alphabetic character + * in identifiers (default), or zero if $ is invalid. + * Default is TRUE. + * + * OK_CONCAT Should be set TRUE if # may be used to concatenate + * tokens in macros (per the Ansi Draft Standard) or + * FALSE for old-style # processing (needed if cpp is + * to process assembler source code). + * + * OK_DATE Predefines the compilation date if set TRUE. + * Not permitted by the Nov. 12, 1984 Draft Standard. + * + * S_CHAR etc. Define the sizeof the basic TARGET machine word types. + * By default, sizes are set to the values for the HOST + * computer. If this is inappropriate, see the code in + * cpp3.c for details on what to change. Also, if you + * have a machine where sizeof (signed int) differs from + * sizeof (unsigned int), you will have to edit code and + * tables in cpp3.c (and extend the -S option definition.) + * + * CPP_LIBRARY May be defined if you have a site-specific include directory + * which is to be searched *before* the operating-system + * specific directories. + */ + +#if TARGET == SYS_LATTICE +/* + * We assume the operating system is pcdos for the IBM-PC. + * We also assume the small model (just like the PDP-11) + */ +#define MACHINE "i8086" +#define SYSTEM "pcdos" +#endif + +#if TARGET == SYS_ONYX +#define MACHINE "z8000" +#define SYSTEM "unix" +#endif + +#if TARGET == SYS_VMS +#define MACHINE "vax" +#define SYSTEM "vms" +#define COMPILER "vax11c" +#endif + +#if TARGET == SYS_RSX +#define MACHINE "pdp11" +#define SYSTEM "rsx" +#define COMPILER "decus" +#endif + +#if TARGET == SYS_RT11 +#define MACHINE "pdp11" +#define SYSTEM "rt11" +#define COMPILER "decus" +#endif + +#if TARGET == SYS_68000 || defined(M68000) || defined(m68000) || defined(m68k) +/* + * All three machine designators have been seen in various systems. + * Warning -- compilers differ as to sizeof (int). cpp3 assumes that + * sizeof (int) == 2 + */ +#define MACHINE "M68000", "m68000", "m68k" +#define SYSTEM "unix" +#endif + +#if TARGET == SYS_UNIX +#define SYSTEM "unix" +#ifdef pdp11 +#define MACHINE "pdp11" +#endif +#ifdef vax +#define MACHINE "vax" +#endif +#endif + +/* + * defaults + */ + +#ifndef MSG_PREFIX +#define MSG_PREFIX "cpp: " +#endif + +#ifndef LINE_PREFIX +#define LINE_PREFIX "" +#endif + +/* + * OLD_PREPROCESSOR forces the definition of OK_DOLLAR, OK_CONCAT, + * COMMENT_INVISIBLE, and STRING_FORMAL to values appropriate for + * an old-style preprocessor. + */ + +#ifndef OLD_PREPROCESSOR +#define OLD_PREPROCESSOR FALSE +#endif + +#if OLD_PREPROCESSOR +#define OK_DOLLAR FALSE +#define OK_CONCAT TRUE +#define COMMENT_INVISIBLE TRUE +#define STRING_FORMAL TRUE +#define IDMAX 63 /* actually, seems to be unlimited */ +#endif + +/* + * RECURSION_LIMIT may be set to -1 to disable the macro recursion test. + */ +#ifndef RECURSION_LIMIT +#define RECURSION_LIMIT 1000 +#endif + +/* + * BITS_CHAR may be defined to set the number of bits per character. + * it is needed only for multi-byte character constants. + */ +#ifndef BITS_CHAR +#define BITS_CHAR 8 +#endif + +/* + * BIG_ENDIAN is set TRUE on machines (such as the IBM 360 series) + * where 'ab' stores 'a' in the high-bits and 'b' in the low-bits. + * It is set FALSE on machines (such as the PDP-11 and Vax-11) + * where 'ab' stores 'a' in the low-bits and 'b' in the high-bits. + * (Or is it the other way around?) -- Warning: BIG_ENDIAN code is untested. + */ +#ifndef BIG_ENDIAN +#define BIG_ENDIAN FALSE +#endif + +/* + * COMMENT_INVISIBLE may be defined to allow "old-style" comment + * processing, whereby the comment becomes a zero-length token + * delimiter. This permitted tokens to be concatenated in macro + * expansions. This was removed from the Draft Ansi Standard. + */ +#ifndef COMMENT_INVISIBLE +#define COMMENT_INVISIBLE FALSE +#endif + +/* + * STRING_FORMAL may be defined to allow recognition of macro parameters + * anywhere in replacement strings. This was removed from the Draft Ansi + * Standard and a limited recognition capability added. + */ +#ifndef STRING_FORMAL +#define STRING_FORMAL FALSE +#endif + +/* + * OK_DOLLAR enables use of $ as a valid "letter" in identifiers. + * This is a permitted extension to the Ansi Standard and is required + * for e.g., VMS, RSX-11M, etc. It should be set FALSE if cpp is + * used to preprocess assembler source on Unix systems. OLD_PREPROCESSOR + * sets OK_DOLLAR FALSE for that reason. + */ +#ifndef OK_DOLLAR +#define OK_DOLLAR TRUE +#endif + +/* + * OK_CONCAT enables (one possible implementation of) token concatenation. + * If cpp is used to preprocess Unix assembler source, this should be + * set FALSE as the concatenation character, #, is used by the assembler. + */ +#ifndef OK_CONCAT +#define OK_CONCAT TRUE +#endif + +/* + * OK_DATE may be enabled to predefine today's date as a string + * at the start of each compilation. This is apparently not permitted + * by the Draft Ansi Standard. + */ +#ifndef OK_DATE +#define OK_DATE TRUE +#endif + +/* + * The following definitions are used to allocate memory for + * work buffers. In general, they should not be modified + * by implementors. + * + * PAR_MAC The maximum number of #define parameters (31 per Standard) + * Note: we need another one for strings. + * IDMAX The longest identifier, 31 per Ansi Standard + * NBUFF Input buffer size + * NWORK Work buffer size -- the longest macro + * must fit here after expansion. + * NEXP The nesting depth of #if expressions + * NINCLUDE The number of directories that may be specified + * on a per-system basis, or by the -I option. + * BLK_NEST The number of nested #if's permitted. + * NFWORK FileNameWorkBuffer (added by erAck, was NWORK) + */ + +#ifndef IDMAX +#define IDMAX 127 +#endif +#ifdef SOLAR +#define PAR_MAC (253 + 1) +#else +#define PAR_MAC (31 + 1) +#endif +/* ER 13.06.95 19:33 + da Makros im file->buffer expandiert werden, muss NBUFF mindestens NWORK sein +#define NWORK 4096 +#define NBUFF 4096 + */ +/* ER 13.06.95 20:05 NWORK wg. grooossen Makros in *.src erhoeht, + da wir bald 10 Sprachen haben werden gleich ordentlich reingehauen.. */ +#define NWORK 128000 +#define NBUFF NWORK +#define NFWORK 1024 +#define NEXP 128 +#define NINCLUDE 100 +#define NPARMWORK (NWORK * 2) +#define BLK_NEST 32 + + +#ifndef ALERT +#ifdef EBCDIC +#define ALERT '\057' +#else +#define ALERT '\007' /* '\a' is "Bell" */ +#endif +#endif + +#ifndef VT +#define VT '\013' /* Vertical Tab CTRL/K */ +#endif + + +#ifndef FILE_LOCAL +#ifdef decus +#define FILE_LOCAL static +#else +#ifdef vax11c +#define FILE_LOCAL static +#else +#define FILE_LOCAL /* Others are global */ +#endif +#endif +#endif + diff --git a/rsc/source/rscpp/cppmain.c b/rsc/source/rscpp/cppmain.c new file mode 100644 index 000000000000..5cf0b3a13b8c --- /dev/null +++ b/rsc/source/rscpp/cppmain.c @@ -0,0 +1,48 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cppmain.c,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define NOMAIN + +#include <stdio.h> +#include <ctype.h> +#include "cppdef.h" +#include "cpp.h" + +int main( argc, argv ) + int argc; + char *argv[]; +{ +#ifdef TSTCPP + ( start_cpp( argc, argv ) ); + puts("erster teil ist fertig" ); +#endif + return( start_cpp( argc, argv ) ); +} + diff --git a/rsc/source/rscpp/makefile.mk b/rsc/source/rscpp/makefile.mk new file mode 100644 index 000000000000..0cdcecdbbeb1 --- /dev/null +++ b/rsc/source/rscpp/makefile.mk @@ -0,0 +1,96 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.9 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* +PRJ=..$/.. + +TARGETTYPE=CUI +NO_DEFAULT_STL=TRUE + +PRJNAME=rsc +TARGET=rscpp + +.IF "$(cpp)" != "" +PRJNAME=CPP +TARGET=cpp +.ENDIF + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +CDEFS+=-DSOLAR + +.IF "$(cpp)" != "" +CDEFS+=-DNOMAIN +.ENDIF + +# --- Files -------------------------------------------------------- + +OBJFILES= \ + $(OBJ)$/cpp1.obj \ + $(OBJ)$/cpp2.obj \ + $(OBJ)$/cpp3.obj \ + $(OBJ)$/cpp4.obj \ + $(OBJ)$/cpp5.obj \ + $(OBJ)$/cpp6.obj \ + +.IF "$(cpp)" == "" +LIBSALCPPRT=$(0) +APP1TARGET= $(TARGET) +APP1LIBS=$(LB)$/$(TARGET).lib +.IF "$(GUI)" != "OS2" +APP1STACK=32768 +.ENDIF +.ENDIF + +.IF "$(GUI)"=="UNX" +CDEFS+=-Dunix +.ENDIF + +.IF "$(OS)$(CPU)"=="SOLARISI" +# cc: Sun C 5.5 Patch 112761-10 2004/08/10 +# Solaris x86 compiler ICE +# "cpp6.c", [get]:ube: internal error +# remove after compiler upgrade +NOOPTFILES=$(OBJ)$/cpp6.obj +.ENDIF + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + +cpp1.c: cppdef.h cpp.h +cpp2.c: cppdef.h cpp.h +cpp3.c: cppdef.h cpp.h +cpp4.c: cppdef.h cpp.h +cpp5.c: cppdef.h cpp.h +cpp6.c: cppdef.h cpp.h + + diff --git a/rsc/source/tools/makefile.mk b/rsc/source/tools/makefile.mk new file mode 100644 index 000000000000..afb4949abfc3 --- /dev/null +++ b/rsc/source/tools/makefile.mk @@ -0,0 +1,49 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.6 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=rsc +TARGET=rsctoo + +# --- Settings ------------------------------------------------------ + +ENABLE_EXCEPTIONS=true + +.INCLUDE : settings.mk + +OBJFILES= $(OBJ)$/rschash.obj \ + $(OBJ)$/rsctree.obj \ + $(OBJ)$/rsctools.obj \ + $(OBJ)$/rscchar.obj \ + $(OBJ)$/rscdef.obj + +.INCLUDE : target.mk diff --git a/rsc/source/tools/rscchar.cxx b/rsc/source/tools/rscchar.cxx new file mode 100644 index 000000000000..4f6c4ed7be5e --- /dev/null +++ b/rsc/source/tools/rscchar.cxx @@ -0,0 +1,332 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscchar.cxx,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +/****************** 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> +#include <rsctools.hxx> + +#include <rtl/textcvt.h> +#include <rtl/textenc.h> +#include <rtl/alloc.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 ]; + sal_uInt32 nOrgLen = 0; + + if( nMaxUniCodeBuf * 6 > 0x0FFFFF ) + 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 ) + { + sal_uInt16 nChar = 0; + int i = 0; + while( '0' <= *pStr && '7' >= *pStr && i != 3 ) + { + nChar = nChar * 8 + (BYTE)*pStr - (BYTE)'0'; + ++pStr; + i++; + } + if( nChar > 255 ) + { + rtl_freeMemory( pOrgStr ); + + // Wert zu gross, oder kein 3 Ziffern + return( NULL ); + } + c = (char)nChar; + pStr--; + } + else if( 'x' == *pStr ) + { + sal_uInt16 nChar = 0; + int 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 *)rtl_allocateMemory( nUniSize * 6 ); + rtl_convertUnicodeToText( hConv, 0, + pUniCode, nUniSize, + pUtf8, nUniSize * 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; + int 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; + int 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 > 0x0FFFFF ) + RscExit( 10 ); + + char * pUtf8 = (char *)rtl_allocateMemory( nMaxUtf8Len ); + rtl_TextToUnicodeConverter hConv = rtl_createUnicodeToTextConverter( RTL_TEXTENCODING_UTF8 ); + + sal_uInt32 nInfo; + sal_Size nSrcCvtBytes; + 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..8ce58cd56c48 --- /dev/null +++ b/rsc/source/tools/rscdef.cxx @@ -0,0 +1,1404 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rscdef.cxx,v $ + * $Revision: 1.7.14.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +/****************** I N C L U D E S **************************************/ + +// Programmuebergreifende Includes. +#include <rscdef.hxx> + +/****************** 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 +|* +*************************************************************************/ +INT32 RscId::GetNumber() const{ + INT32 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() ){ + INT32 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::INT32() +|* +|* Beschreibung +|* Ersterstellung MM 16.05.91 +|* Letzte Aenderung MM 16.05.91 +|* +*************************************************************************/ +RscId::operator INT32() 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, INT32 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( INT32 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, + INT32 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( INT32 * 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( INT32 * plValue ){ + INT32 lLeft; + INT32 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, + INT32 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, INT32 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 = 0; + + 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..cd4e0c3a9e05 --- /dev/null +++ b/rsc/source/tools/rschash.cxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rschash.cxx,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +#include <rschash.hxx> + +using namespace rtl; + +AtomContainer::AtomContainer() +{ + m_aStringToID[ OString() ] = 0; + m_aIDToString[ 0 ] = OString(); + m_nNextID = 1; +} + +AtomContainer::~AtomContainer() +{ +} + +Atom AtomContainer::getID( const OString& rStr, bool bOnlyIfExists ) +{ + OString aKey = rStr.toAsciiLowerCase(); + std::hash_map< OString, Atom, OStringHash >::const_iterator it = + m_aStringToID.find( aKey ); + if( it != m_aStringToID.end() ) + return it->second; + + if( bOnlyIfExists ) + return InvalidAtom; + + Atom aRet = m_nNextID; + m_aStringToID[ aKey ] = m_nNextID; + m_aIDToString[ m_nNextID ] = rStr; + m_nNextID++; + return aRet; +} + +const OString& AtomContainer::getString( Atom nAtom ) +{ + std::hash_map< Atom, OString >::const_iterator it = + m_aIDToString.find( nAtom ); + return (it != m_aIDToString.end()) ? it->second : m_aIDToString[0]; +} diff --git a/rsc/source/tools/rsctools.cxx b/rsc/source/tools/rsctools.cxx new file mode 100644 index 000000000000..f0a8c578ae1f --- /dev/null +++ b/rsc/source/tools/rsctools.cxx @@ -0,0 +1,495 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rsctools.cxx,v $ + * $Revision: 1.17 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +/****************** 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> + +#include <tools/fsys.hxx> + +// Include +#include <rscdef.hxx> +#include <rsctools.hxx> + +#include <osl/file.h> +#include <rtl/alloc.h> +#include <rtl/memory.h> + +#if defined (WIN) +#define ONLY_NEW +#endif + +using namespace rtl; + +/****************** 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 ); +} + +char* rsc_strdup( const char* pStr ) +{ + int nLen = strlen( pStr ); + char* pBuffer = (char*)rtl_allocateMemory( nLen+1 ); + rtl_copyMemory( pBuffer, pStr, nLen+1 ); + return pBuffer; +} + +/************************************************************************* +|* +|* 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() +{ + OUString aTmpURL, aTmpFile; + osl_createTempFile( NULL, NULL, &aTmpURL.pData ); + osl_getSystemPathFromFileURL( aTmpURL.pData, &aTmpFile.pData ); + return OUStringToOString( aTmpFile, RTL_TEXTENCODING_MS_1252 ); +} + +/********************************************************************/ +/* */ +/* Function : Append( ) */ +/* */ +/* Parameters : psw - pointer to a preprocessor switch */ +/* */ +/* Description : appends text files */ +/********************************************************************/ +BOOL Append( FILE * fDest, ByteString aTmpFile ) +{ +#define MAX_BUF 4096 + char szBuf[ MAX_BUF ]; + int 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 ( const char * pInput, const 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, const 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, sal_uInt32 nArgc ) +{ + FILE *fFile; + int nItems; + char szBuffer[4096]; // file buffer + sal_uInt32 i; + bool bInQuotes = false; + + // Programmname + ppCmd->Append( rsc_strdup( *ppArgv ) ); + 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 ] ) ) + { + /* + * #i27914# double ticks '"' now have a duplicate function: + * 1. they define a string ( e.g. -DFOO="baz" ) + * 2. a string can contain spaces, so -DFOO="baz zum" defines one + * argument no two ! + */ + unsigned int n = 0; + while( nItems && (!isspace( szBuffer[ n ] ) || bInQuotes) && + n +1 < sizeof( szBuffer ) ) + { + n++; + nItems = fread( &szBuffer[ n ], 1, + sizeof( char ), fFile ); + if( szBuffer[n] == '"' ) + bInQuotes = !bInQuotes; + } + szBuffer[ n ] = '\0'; + ppCmd->Append( rsc_strdup( szBuffer ) ); + } + nItems = fread( &szBuffer[ 0 ], 1, sizeof( char ), fFile ); + }; + + fclose( fFile ); + } + else + ppCmd->Append( rsc_strdup( *(ppArgv +i) ) ); + }; + ppCmd->Append( (void *)0 ); + return( NULL ); +} + + +/*************** 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(){ + sal_uInt32 i; + + if( pMem ){ + for( i = 0; i < nCount; i++ ){ + if( pMem[ i ] ) + rtl_freeMemory( pMem[ i ] ); + } + rtl_freeMemory( (void *)pMem ); + }; + nCount = 0; + pMem = NULL; +} + +/************************************************************************* +|* +|* RscPtrPtr :: Append() +|* +|* Beschreibung Haengt einen Eintrag an. +|* Ersterstellung MM 13.02.91 +|* Letzte Aenderung MM 13.02.91 +|* +*************************************************************************/ +sal_uInt32 RscPtrPtr :: Append( void * pBuffer ){ + if( !pMem ) + pMem = (void **)rtl_allocateMemory( (nCount +1) * sizeof( void * ) ); + else + pMem = (void **)rtl_reallocateMemory( (void *)pMem, + ((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( sal_uInt32 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 ) + rtl_freeMemory( pMem ); +} + +/************************************************************************* +|* +|* RscWriteRc :: IncSize() +|* +|* Beschreibung +|* Ersterstellung MM 15.04.91 +|* Letzte Aenderung MM 15.04.91 +|* +*************************************************************************/ +sal_uInt32 RscWriteRc :: IncSize( sal_uInt32 nSize ) +{ + nLen += nSize; + if( pMem ) + pMem = (char*)rtl_reallocateMemory( pMem, nLen ); + return( nLen - nSize ); +} + +/************************************************************************* +|* +|* RscWriteRc :: GetPointer() +|* +|* Beschreibung +|* Ersterstellung MM 15.04.91 +|* Letzte Aenderung MM 15.04.91 +|* +*************************************************************************/ +char * RscWriteRc :: GetPointer( sal_uInt32 nSize ) +{ + if( !pMem ) + pMem = (char *)rtl_allocateMemory( nLen ); + return( pMem + nSize ); +} + + +/************************************************************************* +|* +|* RscWriteRc :: Put() +|* +|* Beschreibung +|* Ersterstellung MM 15.04.91 +|* Letzte Aenderung MM 15.04.91 +|* +*************************************************************************/ +void RscWriteRc :: Put( sal_uInt16 nVal ) +{ + sal_uInt32 nOldLen; + + nOldLen = IncSize( sizeof( nVal ) ); + PutAt( nOldLen, nVal ); +} + +void RscWriteRc :: PutUTF8( char * pStr ) +{ + sal_uInt32 nStrLen = 0; + if( pStr ) + nStrLen = strlen( pStr ); + + sal_uInt32 n = nStrLen +1; + if( n % 2 ) + // align to 2 + n++; + + sal_uInt32 nOldLen = IncSize( n ); + rtl_copyMemory( 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..f1773fbdbb7f --- /dev/null +++ b/rsc/source/tools/rsctree.cxx @@ -0,0 +1,549 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rsctree.cxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_rsc.hxx" +/****************** I N C L U D E S **************************************/ + +// C and C++ Includes. +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +// Programmabh�ngige Includes. +#include <tools/link.hxx> +#include <rsctree.hxx> + +/****************** 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; + sal_uInt32 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 < (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. + int 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. + int 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. + int 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, sal_uInt32* 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; + int 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. + sal_uInt32 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( sal_uInt32 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() < (sal_uInt32)(((const IdNode *)pSearch)->GetId()) ) + return LESS; + else if( GetId() > (sal_uInt32)(((const IdNode *)pSearch)->GetId()) ) + return GREATER; + else + return EQUAL; +} + +COMPARE IdNode::Compare( const void * pSearch ) const{ +// pSearch ist ein Zeiger auf sal_uInt32 + + if( GetId() < *((const sal_uInt32 *)pSearch) ) + return LESS; + else if( GetId() > *((const sal_uInt32 *)pSearch) ) + return GREATER; + else + return EQUAL; +} + +/************************************************************************* +|* +|* IdNode::GetId() +|* +|* Beschreibung +|* Ersterstellung MM 23.09.91 +|* Letzte Aenderung MM 23.09.91 +|* +*************************************************************************/ +sal_uInt32 IdNode::GetId() const +{ + return( 0xFFFFFFFF ); +} + +/************************************************************************* +|* +|* 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 +{ + int 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 * + int nCmp = strcmp( aName.GetBuffer(), (const char *)pSearch ); + + if( nCmp < 0 ) + return LESS; + else if( nCmp > 0 ) + return GREATER; + else + return EQUAL; +} |