with System;   use System ;
with os2;      use os2;
with os2.jba;  use os2.jba;
with os2.dlg;  use os2.dlg;
with os2.pmcp; use os2.pmcp;
with Text_io;  use Text_io;
with builtin;  use builtin;
package body jbahlp is
package iol is new Modular_io(Ulong); use iol;
Null_Char : constant character := character'val(0);
procedure PrintField(field: FILEDLG) is
begin new_line; put("  F I L E D L G");
new_line; put(" Size of FILEDLG structure.        ");iol.put(field.cbSize);
new_line; put(" FDS_ flags. Alter behavior of dlg.");iol.put(field.fl);
new_line; put(" User defined field.               ");iol.put(field.ulUser);
new_line; put(" Result code from dialog dismissal.");iol.put(Ulong(field.lReturn)) ;
new_line; put(" System return code.               ");iol.put(Ulong(field.lSRC)) ;
new_line; put(" String to display in title bar.   ");
if field.pszTitle       = System.Null_Address then put(" Null" );
                                              else put(" Not 0"); end if;
new_line; put(" String to display in OK button.   ");
if field.pszOKButton    = System.Null_Address then put(" Null" );
                                              else put(" Not 0"); end if;
new_line; put(" Entry point to custom dialog proc.");
if field.pfnDlgProc     = System.Null_Address then put(" Null" );
                                              else put(" Not 0"); end if;

new_line; put(" Pointer to string containing   EA.");
if field.pszIType       = System.Null_Address then put(" Null" );
                                              else put(" Not 0"); end if;

new_line; put(" Pointer to Table                  ");
if field.papszITypeList = System.Null_Address then put(" Null" );
                                              else put(" Not 0"); end if;

new_line; put(" Pointer to string containing Drive");
if field.pszIDrive      = System.Null_Address then put(" Null" );
                                              else put(" Not 0"); end if;

new_line; put(" Pointer to Table  of Drivers      ");
if field.papszIDriveList= System.Null_Address then put(" Null" );
                                              else put(" Not 0"); end if;

new_line; put(" Custom File Dialog template.      ");iol.put(Ulong(field.hMod)) ;
new_line; put("Select File <");
for i in 1..256 loop exit when field.szFullFile(i) = Null_Char;
     put(field.szFullFile(i));
 end loop;
 put(">");
new_line; put(" Number of files selected          ");iol.put(field.ulFQFCount);
new_line; put(" Custom dialog id.                 ");iol.put(Ulong(field.usDlgId));
new_line; put(" X coordinate of the dialog        ");iol.put(Ulong(field.x));
new_line; put(" Y coordinate of the dialog        ");iol.put(Ulong(field.y));
-- new_line; put(" Selected file's EA Type.          ");iol.put(Ulong(field.sEAType));

end       PrintField;

procedure PrintApp(App : APPINFO ) is -- print appinfo struct
begin new_line; put(" A P P I N F O"); new_line;
put(" Hab ="); iol.put(Ulong(app.h_ab));
put(" Hmq ="); iol.put(Ulong(app.h_mq));
put(" Pid ="); iol.put(Ulong(app.p_id));
put_edit(" CmdArgC =",integer(app.CmdArgC)); new_line;
put(" Help="); iol.put(Ulong(app.hwndHelp));
put(" Main="); iol.put(Ulong(app.hwndMain));
put(" Save="); iol.put(Ulong(app.hwndSave)); new_line;
put("app.szPgmTitle <");
for i in 1..256 loop
    exit when  app.szPgmTitle(i) = Null_Char;
    put(app.szPgmTitle(i));
end loop; put(">"); new_line;
put("szMsgFile      <");
for i in 1..256 loop
    exit when  app.szMsgFile(i) = Null_Char;
    put(app.szMsgFile(i));
end loop; put(">"); new_line;
put("szCurMsgFile   <");
for i in 1..256 loop
    exit when  app.szCurMsgFile(i) = Null_Char;
    put(app.szCurMsgFile (i));
end loop; put(">"); new_line;
put("szHlpFile      <");
for i in 1..256 loop
    exit when  app.szHlpFile(i) = Null_Char;
    put(app.szHlpFile(i));
end loop; put(">"); new_line;
put("szCurHlpFile   <");
for i in 1..256 loop
    exit when  app.szCurHlpFile(i) = Null_Char;
    put(app.szCurHlpFile (i));
end loop; put(">") ;new_line;
put("szNxtHlpFile   <");
for i in 1..256 loop
    exit when  app.szNxtHlpFile(i) = Null_Char;
    put(app.szNxtHlpFile (i));
end loop; put(">"); new_line;
put(" Next =");iol.put(Ulong(app.hmodNxtHelp)); new_line;
put(" Code =");iol.put(Ulong(app.sExitCode)); new_line;
end printapp;

procedure PrintWindow(Win : Window ) is
begin  new_line; put("W I N D O W"); new_line;
put("sztype <");
for i in 1..21 loop
   exit when Win.szType(i) = Null_Char;
   put(Win.szType(i));
end loop ; put(">"); new_line;
put_edit("lID=",integer(Win.lID));
put(" h_wnd =");      iol.put(Ulong(Win.h_wnd ));
put(" hwndClient ="); iol.put(Ulong(Win.hwndClient));
put(" hwndParent ="); iol.put(Ulong(Win.hwndParent));
put(" h_Module =");   iol.put(Ulong(Win.h_Module ));
end PrintWindow ;
procedure PrintSWP(p:SWP) is
begin
new_line; put("          SWP record  ");
new_line;
put_edit(" fl=",integer(p.fl));
put_edit(" cy=",integer(p.cy ));
put_edit(" cx=",integer(p.cx ));
put_edit(" y =",integer(p.y ));
put_edit(" x =",integer(p.x ));
put_edit(" hwndInsertBehind=",integer(p.hwndInsertBehind ),10);
put_edit(" hwn=",integer(p.hwn),10);
put_edit(" ulReserved1=",integer(p.ulReserved1 ));
put_edit(" ulReserved2=",integer(p.ulReserved2  ));
end PrintSWP;

procedure PrintError(h_ab : hab ) is
rc   : errorid ;
pinf : perrinfo;
begin
 rc := WinGetLastError(h_ab) ;
 new_line ; put (" Last Error is " ); iol.put(item => rc, base => 16);
 pinf := WinGetErrorInfo(h_ab);
 new_line; put("               ErrorInfo Table");
 new_line; put("cbFixedErrInfo => ");iol.put(item =>pinf.cbFixedErrInfo, base => 16);
 new_line; put("idError        => ");iol.put(item =>pinf.idError       , base => 16);
 new_line; put("cDetailLevel   => ");iol.put(item =>pinf.cDetailLevel  , base => 16);
 new_line; put("offaoffszMsg   => ");iol.put(item =>pinf.offaoffszMsg  , base => 16);
 new_line; put("offBinaryData  => ");iol.put(item =>pinf.offBinaryData , base => 16);
end PrintError ;

end jbahlp;
