This patch adds support for inline procedure names, a non-intrusive debug method supported by GSBug and NiftyList. See IIgs technote #103 for more information.

Setting bit 15 (0x8000) of the #pragma debug directive enables inline names. Inline names will not be generated for asm functions.

Unified diff:


==== cgi.pas (text) ====


@@ -307,6 +307,7 @@
    currentSegment,defaultSegment: segNameType; {current & default seg names}
    segmentKind: integer;                {kind field of segment (ored with start/data)}
    debugFlag: boolean;                  {generate debugger calls?}
+   debugStrFlag: boolean;               {gsbug/niftylist debug names?}
    dataBank: boolean;                   {save, restore data bank?}
    floatCard: integer;                  {0 -> SANE; 1 -> FPE}
    floatSlot: integer;                  {FPE slot}
@@ -764,6 +765,7 @@
 rangeCheck := false;                    {don't generate range checks}
 profileFlag := false;                   {don't generate profiling code}
 debugFlag := false;                     {don't generate debug code}
+debugStrFlag := false;                  {don't generate gsbug debug strings}
 traceBack := false;                     {don't generate traceback code}
 volatile := false;			{no volatile quialifiers found}
 



==== gen.pas (text) ====


@@ -4121,11 +4121,26 @@
    end; {GenDviMod}
 
 
-   procedure GenEnt;
+   procedure GenEnt(op: icptr);
+     var
+       i: integer;
+       len: integer;
 
    { Generate code for a pc_ent					}
 
    begin {GenEnt}
+   
+   if debugStrFlag then begin		{gsbug/niftylist debug string}
+     len := length(op^.lab^);
+     CnOut(m_brl);
+     CnOut2(len + 3);
+     CnOut2($7771);
+     CnOut(len);
+     for i := 1 to len do
+       CnOut(ord(op^.lab^[i]));
+   end;   
+   
+   
    if rangeCheck then begin		{if range checking is on, check for a stack overflow}
       GenNative(m_pea, immediate, localSize - returnSize - 1, nil, 0);
       GenCall(1);
@@ -5417,7 +5432,7 @@
    pc_cup: GenCup(op);
    pc_dec,pc_inc: GenIncDec(op, nil);
    pc_dvi,pc_mod,pc_udi,pc_uim: GenDviMod(op);
-   pc_ent: GenEnt;
+   pc_ent: GenEnt(op);
    pc_equ,pc_neq: GenEquNeq(op, op^.opcode, 0);
    pc_fjp,pc_tjp: GenFjpTjp(op);
    pc_geq,pc_grt,pc_leq,pc_les: GenCmp(op, op^.opcode, 0);



==== Scanner.pas (text) ====


@@ -2604,6 +2604,7 @@
                      profileFlag := odd(val >> 2);
                      traceBack   := odd(val >> 3);
                      checkStack  := odd(val >> 4);
+                     debugStrFlag := odd(val >> 15);
                      profileFlag := profileFlag or debugFlag;
                      if token.kind <> eolsy then
					  
==== Parser.pas (text) ====


@@ -3414,7 +3414,7 @@
       firstCompoundStatement := true;
       Gen0 (dc_pin);
       if not isAsm then
-         Gen0(pc_ent);
+		Gen1Name(pc_ent, 0, variable^.name);
       nextLocalLabel := 1;              {initialize GetLocalLabel}
       returnLabel := GenLabel;          {set up an exit point}
       tempList := nil;                  {initialize the work label list}