home *** CD-ROM | disk | FTP | other *** search
- (* ------------------------------------------------------ *)
- (* LINKDLG.PAS *)
- (* (c) 1993 te-wi Verlag, München *)
- (* ------------------------------------------------------ *)
- PROGRAM LinkDlg;
-
- {$A+,B-,D+,E+,F-,G-,I+,L+,N-,O-,P-,Q+,R+,S+,T-,V+,X+,Y+}
- {$M 16384,0,655360}
-
- USES Objects, Drivers, Views, Menus, MsgBox, Dialogs, App;
-
- CONST
- cmAbout = 101;
- cmTest = 102;
-
- (* ------------------------------------------------------ *)
-
- FUNCTION LinkOptDlg : pDialog;
- (* Da es jede Menge CheckBoxen und RadioButtons gibt, wurde
- bei der Vergabe der Shortcuts eingespart. Der Dialog
- sollte jedoch auch ohne Maus zu bedienen sein. Aus diesem
- Grund sind die RadioButtons mit Labels versehen, über
- die die entsprechenden Felder angewählt werden können.
- Die Checkboxen können über die Shortcuts manipuliert werden.
-
- Die Z-Ordnung bleibt unberührt: mit Tab kann der Anwedner
- die Felder wechseln. Aus Gründen der Anwenderfreundlichkeit
- sollten die mit [Tab] anzuwählenden Checkboxen abgesetzt werden.
-
- Die Reihenfolge der an den Dialog zu übergebenden Daten hängt
- ebenfalls von der Z-Ordnung (also der Reihenfolge der Subviews
- im Dialog) ab.
- *)
- VAR
- D : pDialog;
- C : pView;
- R : tRect;
- BEGIN
- R.Assign(0, 0, 75, 22);
- D := New(pDialog, Init(R, 'Linker Options'));
-
- WITH D^ DO BEGIN
- Options := Options OR ofCentered;
-
- R.Assign(3, 3, 33, 10);
- C := New(pCheckBoxes, Init(R,
- NewSItem('Map file with publics (/m)',
- NewSItem('No map file (/x)',
- NewSItem('Include line numbers (/l)',
- NewSItem('Detailed map od segs (/s)',
- NewSItem('Full debug information (/v)',
- NewSItem('Initialize all segments (/i)',
- NewSItem('Overlay switch (/o)',
- NIL)))))))));
- Insert(C);
- R.Assign(2, 2, 30, 3);
- Insert(New(pLabel, Init(R, '~D~ebug Information', C)));
-
- R.Assign(3, 12, 33, 14);
- C := New(pRadioButtons, Init(R,
- NewSItem('Expanded memory (/ye)',
- NewSItem('Extended memory (/yx)',
- NIL))));
- Insert(C);
- R.Assign(2, 11, 22, 12);
- Insert(New(pLabel, Init(R, '~M~emory swapping', C)));
-
- R.Assign(33, 3, 72, 10);
- C := New(pCheckBoxes, Init(R,
- NewSItem('No default libraries (/n)',
- NewSItem('Warn if duplicate symbols (/d)',
- NewSItem('Case significant in symbols (/c)',
- NewSItem('Ignore extended dictionary (/e)',
- NewSItem('Case sensitive exports (/C)',
- NewSItem('Enable 32-bit processing (/3)',
- NIL))))))));
- Insert(C);
- R.Assign(32, 2, 50, 3);
- Insert(New(pLabel, Init(R, '~L~ibraries', C)));
-
- R.Assign(33, 12, 72, 18);
- C := New(pRadioButtons, Init(R,
- NewSItem('COM for DOS (/Tdc)',
- NewSItem('EXE for DOS (/Tdx)',
- NewSItem('DLL for DOS (/Tdd)',
- NewSItem('COM for Windows (/Twc)',
- NewSItem('EXE for Windows (/Twx)',
- NewSItem('DLL for Windows (/Twd)',
- NIL))))))));
- Insert(C);
- R.Assign(32, 11, 50, 12);
- Insert(New(pLabel, Init(R, '~O~utput', C)));
-
- R.Assign(4, 19, 14, 21);
- Insert(New(pButton, Init(R, 'O~k~', cmOk, bfDefault)));
- Inc(R.A.X, 12); Inc(R.B.X, 12);
- Insert(New(pButton, Init(R, '~C~ancel', cmCancel, bfNormal)));
-
- END;
- LinkOptDlg := D;
- END;
-
- (* -------- Linker Options Data Transfer ---------------- *)
-
- TYPE
- LinkOptRec = RECORD
- DebugInfo : WORD;
- (* Map file with publics (/m) *)
- (* No map file (/x) *)
- (* Include line numbers (/l) *)
- (* Detailed map od segs (/s) *)
- (* Full debug information (/v) *)
- (* Initialize all segments (/i) *)
- (* Overlay switch (/o) *)
-
- MemSwap : WORD;
-
- (* Expanded memory (/ye) *)
- (* Extended memory (/yx) *)
-
- Libraries : WORD;
-
- (* No default libraries (/n) *)
- (* Warn if duplicate symbols (/d) *)
- (* Case significant in symbols (/c) *)
- (* Ignore extended dictionary (/e) *)
- (* Case sensitive exports (/C) *)
- (* Enable 32-bit processing (/3) *)
-
- Target : WORD;
-
- (* COM for DOS (/Tdc) *)
- (* EXE for DOS (/Tdx) *)
- (* DLL for DOS (/Tdd) *)
- (* COM for Windows (/Twc) *)
- (* EXE for Windows (/Twx) *)
- (* DLL for Windows (/Twd) *)
- END;
-
- (* --- Main Application Object -------------------------- *)
-
- TYPE
- tMyApp = OBJECT (tApplication)
- PROCEDURE InitMenuBar; VIRTUAL;
- PROCEDURE HandleEvent(VAR Event : tEvent); VIRTUAL;
- PRIVATE
- PROCEDURE DoTest;
- END;
-
- (* Utils *)
-
- FUNCTION HexByte(b : BYTE) : STRING;
- CONST
- H : ARRAY [0..15] OF CHAR = '0123456789ABCDEF';
- BEGIN
- HexByte[0] := #2;
- HexByte[1] := H[b DIV 16];
- HexByte[2] := H[b MOD 16];
- END;
-
- FUNCTION HexWord(w : WORD) : STRING;
- BEGIN
- HexWord := HexByte(w DIV 256) + HexByte(w MOD 256);
- END;
-
- FUNCTION Li2Str(Li : LONGINT) : STRING;
- VAR
- L : RECORD Hi, Lo : WORD; END ABSOLUTE Li;
- BEGIN
- Li2Str := HexWord(L.Lo) + HexWord(L.Hi);
- END;
- (* ----- *)
- PROCEDURE tMyApp.DoTest;
- VAR
- Data : LinkOptRec;
- S : STRING;
- BEGIN
- S := 'TLINK';
- (* Syntax: TLINK objfiles, exefile, mapfile, libfiles, deffile
- /L Specify library search paths
- *)
- WITH Data DO BEGIN
- DebugInfo := $0000;
- MemSwap := $0000;
- Libraries := $0000;
- Target := $0000;
- END;
- ExecuteDialog(LinkOptDlg, @Data);
- WITH Data DO BEGIN
- IF (DebugInfo AND 1) = 1 THEN S := S + ' /m';
- IF (DebugInfo AND 2) = 2 THEN S := S + ' /x';
- IF (DebugInfo AND 4) = 4 THEN S := S + ' /l';
- IF (DebugInfo AND 8) = 8 THEN S := S + ' /s';
- IF (DebugInfo AND 16) = 16 THEN S := S + ' /v';
- IF (DebugInfo AND 32) = 32 THEN S := S + ' /i';
- IF (DebugInfo AND 64) = 64 THEN S := S + ' /o';
- IF MemSwap = 0 THEN S := S + ' /ye' ELSE S := S + ' /yx';
- IF (Libraries AND 1) = 1 THEN S := S + ' /n';
- IF (Libraries AND 2) = 2 THEN S := S + ' /d';
- IF (Libraries AND 4) = 4 THEN S := S + ' /c';
- IF (Libraries AND 8) = 8 THEN S := S + ' /e';
- IF (Libraries AND 16) = 16 THEN S := S + ' /C';
- IF (Libraries AND 32) = 32 THEN S := S + ' /3';
- CASE Target OF
- 0 : S := S + ' /Tdc';
- 1 : S := S + ' /Tdx';
- 2 : S := S + ' /Tdd';
- 3 : S := S + ' /Twc';
- 4 : S := S + ' /Twx';
- 5 : S := S + ' /Twd';
- END;
- END;
- MessageBox(S, NIL, mfInformation + mfOkButton);
- END;
-
- PROCEDURE tMyApp.InitMenuBar;
- VAR
- R : tRect;
- BEGIN
- GetExtent(R);
- R.B.Y := R.A.Y + 1;
- MenuBar := New(pMenuBar, Init(R, NewMenu(
- NewSubMenu('~≡~', hcNoContext, NewMenu(
- NewItem('~T~est', '', kbNoKey, cmTest, hcNoContext,
- NewItem('~A~bout', '', kbNoKey, cmAbout, hcNoContext,
- NIL))),
- NIL))));
- END;
-
- PROCEDURE tMyApp.HandleEvent(VAR Event : tEvent);
- BEGIN
- inherited HandleEvent(Event);
-
- IF Event.What = evCommand THEN BEGIN
- CASE Event.Command OF
- cmTest : BEGIN
- DoTest;
- END;
- cmAbout : BEGIN
- MessageBox(#3'Turbo Vision Application',
- NIL, mfInformation OR mfOkButton);
- END;
- ELSE
- Exit;
- END;
- ClearEvent(Event);
- END;
- END;
-
- VAR
- anApp : tMyApp;
-
- BEGIN
- anApp.Init;
- anApp.Run;
- anApp.Done;
- END.
- (* ------------------------------------------------------ *)
- (* Ende von LINKDLG.PAS *)
-