K538915@CZHRZU1A.BITNET.UUCP (02/02/87)
There seem to be quite a lot of people which missed my posting a few months
ago about getting OSS/CCD Personal Pascal programs to run with GDOS.
This is a post of a sample dummy program that shows how it should be done.
I'm working on a larger posting that will include this file and a lot of
other sample AES/VDI calls with a bit more documentation which should be
finished soon.
Simon Poole
K538915@CZHRZU1A.BITNET
-------------------Cut Here-----------------------------------------------
{*******************************************************************}
{* Sample code for starting a OSS/CCD pascal program correctly *}
{* with resident GDOS (pulled from UniTerm code (c) Simon Poole) *}
{* !!!!! pls use only as sample and do your own testing!!!!!!!!!!! *}
{*******************************************************************}
Program The_Correct_Way;
Const
{$I GEMCONST.PAS}
Type
{$I GEMTYPE.PAS}
{ Arrays for VDI and AES parameters/results }
Ctrl_Parms = Array[0..11] Of Integer;
Int_In_Parms = Array[0..15] Of Integer;
Int_Out_Parms = Array[0..45] Of Integer;
Pts_In_Parms = Array[0..11] Of Integer;
Pts_Out_Parms = Array[0..11] Of Integer;
Var
Control : Ctrl_Parms;
Int_In : Int_In_Parms;
Int_Out : Int_Out_Parms;
Pts_In : Pts_In_Parms;
Pts_Out : Pts_Out_Parms;
Graf_Handle : Integer;
{$I GEMSUBS.PAS}
{**************************************************************}
{* *}
{* CCD/OSS Pascal VDI trap handler *}
{* *}
{**************************************************************}
Procedure VDI_Call(Cmd, SubCmd : Integer; N_Ints, N_Pts : Integer;
Var Control : Ctrl_Parms;
Var Int_In : Int_In_Parms;
Var Int_Out : Int_Out_Parms;
Var Pts_In : Pts_In_Parms;
Var Pts_Out : Pts_Out_Parms;
Translate : boolean);
External;
{**************************************************************}
{* *}
{* This procedure sets the internal device handle *}
{* *}
{**************************************************************}
Procedure G_Set_Port(Handle : Integer);
External;
{**************************************************************}
{* *}
{* This function gets the internal device handle *}
{* *}
{**************************************************************}
Function Get_Port : Integer;
External;
Procedure OpenVirtualWorkStation(Var Handle,PixelX,PixelY,PixelW,PixelH,
Colors : Integer);
Var i : Integer;
Begin
For i := 0 To 9 Do Int_In[i] := 1;
Int_In[10] := 2;
VDI_Call(100,0,11,0,Control,Int_In,Int_Out,Pts_In,Pts_Out,False);
Handle := Control[6];
PixelX := Int_Out[0];
PixelY := Int_Out[1];
PixelW := Int_Out[3];
PixelH := Int_Out[4];
Colors := Int_Out[13];
End;
Procedure OpenWorkStation(Var Device : Integer);
Var i : Integer;
Begin
For i := 1 To 9 Do Int_In[i] := 1;
Int_In[0] := Device;
Int_In[10] := 2; {Raster coordinates}
VDI_Call(1,0,11,0,Control,Int_In,Int_Out,Pts_In,Pts_Out,False);
Device := Control[6];
End;
Procedure CloseVirtualWorkStation;
Var i : Integer;
Begin
VDI_Call(101,0,0,0,Control,Int_In,Int_Out,Pts_In,Pts_Out,False);
End;
Procedure CloseWorkStation;
Var i : Integer;
Begin
VDI_Call(2,0,0,0,Control,Int_In,Int_Out,Pts_In,Pts_Out,False);
End;
{**************************************************************}
{* *}
{* Replacement for Init_Gem *}
{* *}
{**************************************************************}
Function InitGEM : Integer;
Var Ap_Id : Integer;
Begin
Ap_Id := Init_Gem;
If Ap_Id >= 0 Then Begin {Appl_Init worked OK}
Graf_Handle := Graf_Hdl(Dummy,Dummy,Dummy,Dummy);
If Get_Port = 0 Then Begin {If the internal handle is 0}
G_Set_Port(Graf_Handle);{OSS messed it up! }
{The internal version failed, so do it ourselves }
OpenVirtualWorkStation(Graf_Handle,
Dummy,Dummy,Dummy,Dummy,Dummy);
{Set the internal handle to the correct value }
G_Set_Port(Graf_Handle);
End
End
InitGEM := Ap_Id
End;
{**************************************************************}
{* *}
{* Replacement for Exit_Gem *}
{* *}
{**************************************************************}
Procedure ExitGEM;
Begin
Exit_Gem;
{The following call should really only be used if GDOS is}
{really there, but it doesn't seem to hurt }
CloseVirtualWorkstation;
End;
Begin {Main}
If InitGEM >= 0 Then Begin
{Do something here}
ExitGEM
End
End.