community.borland.com

Article #15134: Linking error message and font files.

 Technical Information Database

TI134D.txt   Linking error message and font files.
Category   :General Programming
Platform    :All
Product    :Pascal  All

Description:
This technical information  handout  describes how to link in the
ERROR.MSG, 4x6.FON, 8x8.FON and 14x9.FON  files  into  your *.EXE
file so that your  application  no longer needs these files to be
present on disk.  Please make these changes to  copies of your

GRAF3270.DVR   GRAFEGA.DVR  ERROR.MSG   14X9.FON
GRAFATT.DVR    GRAFHGC.DVR  4X6.FON     GDRIVER.PAS
GRAFCGA.DVR    GKERNEL.PAS  8X8.FON


First, you must  convert  the  ERROR.MSG,  4x6.FON,  8x8.FON, and
14x9.FON files to  the OBJ format.

Use  the BINOBJ.EXE utility to convert these  files  to  the  OBJ
format.

For example,

        BINOBJ ERROR.MSG ERROR.OBJ FakeErr 
        BINOBJ 4x6.FON  4x6.OBJ Font4x6 
        BINOBJ 8x8.FON  8x8.OBJ FakeFont 
        BINOBJ 14x9.FON  14x9.OBJ FakeFont 


Next, delete the  first  13  lines  of  code  from  the procedure
EnterGraphic in each of the  *.DVR and GDRIVER.PAS files with the
exception of GRAFATT.DVR  file.   In the GRAFATT.DVR file, delete
the first 15 lines of code instead. Also, in the GRAFCGA.DVR file
s



{$L 14x9}       { ADD }
procedure FakeFont; external;   { ADD }

procedure EnterGraphic;
{ Enter graphics mode }
...
...
begin
 if not FontLoaded then   { ADD }
  begin                   { ADD }
    Move(Mem[Seg(FakeFont):Ofs(FakeFont)], Font, SizeOf(Font));
                             {ADD}
     FontLoaded := true;     { ADD }
  end;                       { ADD }
....
.....
The rest of the EnterGraphic procedure remains the same.


The following changes should be made in the GKERNEL.PAS unit:

{$L 4x6 }                                          {NEW}
procedure Font4x6; external;                       {NEW}

{$L Error}                                         {NEW}
procedure FakeErr; external;                       {NEW}

procedure InitGraphic;
var
  Fil : file of CharArray;
  Tfile : text;
  Test : ^integer;
  Temp : WrkString;
  I : word;
  GTBCount : integer;                              {NEW}
  GTBch    : char;                                 {NEW}

  Function ErrorStr : WrkString;                   {NEW}
  begin                                            {NEW}
    temp := '';                                    {NEW}
    repeat                                         {NEW}
      GTBch := chr(mem[Seg(FakeErr):Ofs(FakeErr) + GTBcount]);
      if not ((GTBch = #10) or (GTBch = #13)) then {NEW}
        temp := temp + GTBch;                      {NEW}
      inc(GTBcount);                               {NEW}
    until(GTBch = #13);                            {NEW}
    ErrorStr := temp;                              {NEW}
  end; { Function ErrorStr }                       {NEW}

begin
  MessageGlb := true;
  BrkGlb := false;
  GrafModeGlb := false;
  GotoXY(1, 1);
  if not HardwarePresent then
  begin
    ClrScr;
    GotoXY(1, 2);
    WriteLn('Fatal  Error:  graphics hardware not  found  or  not
properly activated');
    Halt;
  end;
  GetMem(ErrorProc[0], 16);
  GetMem(ErrorCode[0], 24);
  ErrorProc[0]^ := 'InitGraphic';
  ErrorCode[0]^ := 'Error.MSG missing';
  GTBcount := 0;                                   {NEW}
  for I := 0 to MaxProcsGlb do                {MODIFIED}
    begin
      Temp := ErrorStr;                            {NEW}
      if I <> 0 then
        GetMem(ErrorProc[I], Length(Temp) + 1);
      ErrorProc[I]^ := Temp;
    end;
  for I := 0 to MaxErrsGlb do                 {MODIFIED}
    begin
      Temp := ErrorStr;                            {NEW}
      if I <> 0 then
        GetMem(ErrorCode[I], Length(Temp) + 1);
      ErrorCode[I]^ := Temp;
    end;
  PcGlb := ErrorStr;                          {MODIFIED}
  for I := 1 to MaxWorldsGlb do
    DefineWorld(I, 0, 0, XScreenMaxGlb, YMaxGlb);
  MaxWorldGlb := 1;
  for I := 1 to MaxWindowsGlb do
  begin
    DefineWindow(I, 0, 0, XMaxGlb, YMaxGlb);
    with Stack[I] do
    begin
      W.Size := 0;
      Contents := nil;
    end;
  end;
  MaxWindowGlb := 1;
  Move(mem[seg(Font4x6):ofs(Font4x6)],CharSet,Sizeof(CharSet));
  {NEW}

  Delete the next 12 lines of code.

  The rest of the code remains the same in the GKERNEL.PAS unit.
  BrkGlb := True;
  If RamScreenGlb Then
  ...
  ...

****************************************************************


Reference:


7/16/98 4:33:38 PM
 

Last Modified: 01-SEP-99