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 ($8000) of the {$debug} directive enables inline names.

Unified Diff:

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


@@ -170,6 +170,7 @@
    codeGeneration: boolean;		{is code generation on?}
    commonSubexpression: boolean; 	{do common subexpression removal?}
    debugFlag: boolean;			{generate debugger calls?}
+   debugStrFlag: boolean;       {gsbug/niftylist debug names?}
    floatCard: integer;			{0 -> SANE; 1 -> FPE}
    floatSlot: integer;			{FPE slot}
    isDynamic: boolean;			{are segments dynamic?}
@@ -686,6 +687,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}
 
 registers := cLineOptimize;		{don't do register optimizations}



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


@@ -4089,11 +4089,28 @@
    end; {GenDviMod}
 
 
-   procedure GenEnt;
+   procedure GenEnt (op: icptr);
 
    { Generate code for a pc_ent					}
 
+   var
+     i: integer;
+     len: integer;
+
+
    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(129);
@@ -5644,7 +5661,7 @@
    pc_dec,pc_inc: GenIncDec(op, nil);
    pc_dif,pc_int,pc_uni: GenDifIntUni(op);
    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_fix: GenFix(op);
    pc_fjp,pc_tjp: GenFjpTjp(op);



==== scanner.pas (text) ====


@@ -691,6 +691,7 @@
    val := GetInteger;
    debugFlag := odd(val);
    profileFlag := (val & $0002) <> 0;
+   debugStrFlag := (val & $8000) <> 0;
    end; {DoDebug}
 
==== parser.pas (text) ====


@@ -4411,7 +4411,9 @@
     Gen0(dc_pin)
   else {imbeded procedure}
     Gen1(dc_lab, fprocp^.pfname);
-  Gen0(pc_ent);				{create a stack frame}
+  {Gen0(pc_ent);				{create a stack frame}
+  Gen1Nam(pc_ent, 0, fprocp^.name);
+  
   ResetTemp;				{forget old temporary variables}
 
   lcp := fprocp^.pfparms;		{generate code for passed parameters}