LCOV - code coverage report
Current view: top level - /mnt/build/buildbot/bld/build-lcov/gcc/m2/gm2-compiler-boot - M2DebugStack.c (source / functions) Coverage Total Hit
Test: gcc.info Lines: 0.0 % 406 0
Test Date: 2026-02-28 14:20:25 Functions: 0.0 % 35 0
Legend: Lines:     hit not hit

            Line data    Source code
       1              : /* do not edit automatically generated by mc from M2DebugStack.  */
       2              : /* M2DebugStack.mod display parameter stack.
       3              : 
       4              : Copyright (C) 2011-2026 Free Software Foundation, Inc.
       5              : Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
       6              : 
       7              : This file is part of GNU Modula-2.
       8              : 
       9              : GNU Modula-2 is free software; you can redistribute it and/or modify
      10              : it under the terms of the GNU General Public License as published by
      11              : the Free Software Foundation; either version 3, or (at your option)
      12              : any later version.
      13              : 
      14              : GNU Modula-2 is distributed in the hope that it will be useful, but
      15              : WITHOUT ANY WARRANTY; without even the implied warranty of
      16              : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      17              : General Public License for more details.
      18              : 
      19              : You should have received a copy of the GNU General Public License
      20              : along with GNU Modula-2; see the file COPYING3.  If not see
      21              : <http://www.gnu.org/licenses/>.  */
      22              : 
      23              : #include "config.h"
      24              : #include "system.h"
      25              : #include "gcc-consolidation.h"
      26              : 
      27              : #include <stdbool.h>
      28              : #   if !defined (PROC_D)
      29              : #      define PROC_D
      30              :        typedef void (*PROC_t) (void);
      31              :        typedef struct { PROC_t proc; } PROC;
      32              : #   endif
      33              : 
      34              : #   if !defined (TRUE)
      35              : #      define TRUE (1==1)
      36              : #   endif
      37              : 
      38              : #   if !defined (FALSE)
      39              : #      define FALSE (1==0)
      40              : #   endif
      41              : 
      42              : #   include "Gmcrts.h"
      43              : #if defined(__cplusplus)
      44              : #   undef NULL
      45              : #   define NULL 0
      46              : #endif
      47              : #define _M2DebugStack_C
      48              : 
      49              : #include "GM2DebugStack.h"
      50              : #   include "GDynamicStrings.h"
      51              : #   include "GSymbolTable.h"
      52              : #   include "GStringConvert.h"
      53              : #   include "GNameKey.h"
      54              : #   include "GFIO.h"
      55              : #   include "GSFIO.h"
      56              : #   include "GM2Error.h"
      57              : #   include "GM2Printf.h"
      58              : 
      59              : typedef struct M2DebugStack_ProcedureWord_p M2DebugStack_ProcedureWord;
      60              : 
      61              : typedef struct M2DebugStack_ProcedureString_p M2DebugStack_ProcedureString;
      62              : 
      63              : #   define Debugging false
      64              : static M2DebugStack_ProcedureWord OperandTok;
      65              : static M2DebugStack_ProcedureWord OperandT;
      66              : static M2DebugStack_ProcedureWord OperandF;
      67              : static M2DebugStack_ProcedureWord OperandA;
      68              : static M2DebugStack_ProcedureWord OperandD;
      69              : static M2DebugStack_ProcedureWord OperandRW;
      70              : static M2DebugStack_ProcedureString OperandAnno;
      71              : 
      72              : /*
      73              :    DebugStack - displays the stack.
      74              : */
      75              : 
      76              : extern "C" void M2DebugStack_DebugStack (unsigned int amount, M2DebugStack_ProcedureWord opt, M2DebugStack_ProcedureWord opf, M2DebugStack_ProcedureWord opa, M2DebugStack_ProcedureWord opd, M2DebugStack_ProcedureWord oprw, M2DebugStack_ProcedureWord optk, M2DebugStack_ProcedureString opanno);
      77              : 
      78              : /*
      79              :    x - checks to see that a=b.
      80              : */
      81              : 
      82              : static DynamicStrings_String x (DynamicStrings_String a, DynamicStrings_String b);
      83              : 
      84              : /*
      85              :    IsWhite - returns TRUE if, ch, is a space.
      86              : */
      87              : 
      88              : static bool IsWhite (char ch);
      89              : 
      90              : /*
      91              :    ConCatWord - joins sentances, a, b, together.
      92              : */
      93              : 
      94              : static DynamicStrings_String ConCatWord (DynamicStrings_String a, DynamicStrings_String b);
      95              : 
      96              : /*
      97              :    symDesc -
      98              : */
      99              : 
     100              : static DynamicStrings_String symDesc (unsigned int sym, DynamicStrings_String o);
     101              : 
     102              : /*
     103              :    Output - output string, s, to Stdout.  It also disposes of the string, s.
     104              : */
     105              : 
     106              : static void Output (DynamicStrings_String s);
     107              : 
     108              : /*
     109              :    GetComment -
     110              : */
     111              : 
     112              : static int GetComment (DynamicStrings_String s);
     113              : 
     114              : /*
     115              :    doName - concatenate namekey, o, to, p.
     116              : */
     117              : 
     118              : static DynamicStrings_String doName (DynamicStrings_String p, unsigned int o);
     119              : 
     120              : /*
     121              :    doSymName - concatenate symbol, o, name to, p.
     122              : */
     123              : 
     124              : static DynamicStrings_String doSymName (DynamicStrings_String p, unsigned int o);
     125              : 
     126              : /*
     127              :    doNumber - convert, o, to a cardinal and increment the length, l,
     128              :               by the number of characters required to represent, o.
     129              : */
     130              : 
     131              : static DynamicStrings_String doNumber (DynamicStrings_String p, unsigned int o);
     132              : 
     133              : /*
     134              :    doSymbol - handles a symbol indicated by, o.
     135              : */
     136              : 
     137              : static DynamicStrings_String doSymbol (DynamicStrings_String p, unsigned int o);
     138              : 
     139              : /*
     140              :    doOperand -
     141              : */
     142              : 
     143              : static DynamicStrings_String doOperand (DynamicStrings_String p, DynamicStrings_String s, int *i, int e, unsigned int o);
     144              : 
     145              : /*
     146              :    doPercent -
     147              : */
     148              : 
     149              : static DynamicStrings_String doPercent (DynamicStrings_String o, DynamicStrings_String s, int *i, int e, unsigned int n);
     150              : 
     151              : /*
     152              :    doNameLength - increment, l, by the ascii length of string determined by, o.
     153              : */
     154              : 
     155              : static void doNameLength (unsigned int *l, unsigned int o);
     156              : 
     157              : /*
     158              :    doSymNameLength - increment, l, by the ascii length of symbol, o.
     159              : */
     160              : 
     161              : static void doSymNameLength (unsigned int *l, unsigned int o);
     162              : 
     163              : /*
     164              :    doNumberLength - convert, o, to a cardinal and increment the length, l,
     165              :                     by the number of characters required to represent, o.
     166              : */
     167              : 
     168              : static void doNumberLength (unsigned int *l, unsigned int o);
     169              : 
     170              : /*
     171              :    doSymbolLength - handles a symbol indicated by, o.
     172              : */
     173              : 
     174              : static void doSymbolLength (unsigned int *l, unsigned int o);
     175              : 
     176              : /*
     177              :    doOperandLength -
     178              : */
     179              : 
     180              : static void doOperandLength (DynamicStrings_String s, int *i, int e, unsigned int *l, unsigned int o);
     181              : 
     182              : /*
     183              :    doPercentLength -
     184              : */
     185              : 
     186              : static void doPercentLength (DynamicStrings_String s, int *i, int e, unsigned int *l, unsigned int n);
     187              : 
     188              : /*
     189              :    doFieldLength - compute the string length given in annotation
     190              :                    at position, n, on the stack between characters
     191              :                    b and e.
     192              : 
     193              :                    The string description between: b..e can contain any
     194              :                    of these patterns:
     195              : 
     196              :                    %a           ascii name key.
     197              :                    %s           symbol number.
     198              :                    %d           decimal cardinal number.
     199              :                    |            indicates the next field.
     200              : */
     201              : 
     202              : static unsigned int doFieldLength (int b, int e, unsigned int n);
     203              : 
     204              : /*
     205              :    stop -
     206              : */
     207              : 
     208              : static void stop (void);
     209              : 
     210              : /*
     211              :    doMaxCard - returns the maximum of two CARDINALs.
     212              : */
     213              : 
     214              : static unsigned int doMaxCard (unsigned int a, unsigned int b);
     215              : 
     216              : /*
     217              :    GetAnnotationFieldLength -
     218              : */
     219              : 
     220              : static unsigned int GetAnnotationFieldLength (unsigned int n, unsigned int f);
     221              : 
     222              : /*
     223              :    GetAnnotationLength -
     224              : */
     225              : 
     226              : static unsigned int GetAnnotationLength (unsigned int n, unsigned int f);
     227              : 
     228              : /*
     229              :    GetFieldLength - returns the number of characters used in field, f,
     230              :                     at position, n, on the stack.
     231              : */
     232              : 
     233              : static unsigned int GetFieldLength (unsigned int n, unsigned int f);
     234              : 
     235              : /*
     236              :    GetMaxFieldAnno - returns the maximum number of characters required
     237              :                      by either the annotation or field, f, at position, n,
     238              :                      on the stack.
     239              : */
     240              : 
     241              : static unsigned int GetMaxFieldAnno (unsigned int n, unsigned int f);
     242              : 
     243              : /*
     244              :    GetStackFieldLengths - assigns, tn, and, fn, with the
     245              :                           maximum field width values.
     246              : */
     247              : 
     248              : static void GetStackFieldLengths (unsigned int *tn, unsigned int *fn, unsigned int *tk, unsigned int amount);
     249              : 
     250              : /*
     251              :    DisplayRow -
     252              : */
     253              : 
     254              : static void DisplayRow (unsigned int tn, unsigned int fn, unsigned int tk, bool initOrFinal);
     255              : 
     256              : /*
     257              :    SkipToField -
     258              : */
     259              : 
     260              : static int SkipToField (DynamicStrings_String s, unsigned int n);
     261              : 
     262              : /*
     263              :    Pad - padds out string, s, to paddedLength characters.
     264              : */
     265              : 
     266              : static DynamicStrings_String Pad (DynamicStrings_String o, unsigned int paddedLength);
     267              : 
     268              : /*
     269              :    doField - compute the string length given in annotation
     270              :              at position, n, on the stack between characters
     271              :              b and e.
     272              : 
     273              :              The string description between: b..e can contain any
     274              :              of these patterns:
     275              : 
     276              :              %a           ascii name key.
     277              :              %s           symbol number.
     278              :              %d           decimal cardinal number.
     279              :              |            indicates the next field.
     280              : */
     281              : 
     282              : static DynamicStrings_String doField (DynamicStrings_String s, unsigned int n, unsigned int f, unsigned int l);
     283              : 
     284              : /*
     285              :    doAnnotation -
     286              : */
     287              : 
     288              : static DynamicStrings_String doAnnotation (DynamicStrings_String s, unsigned int n, unsigned int field, unsigned int width);
     289              : 
     290              : /*
     291              :    DisplayFields -
     292              : */
     293              : 
     294              : static void DisplayFields (unsigned int n, unsigned int tn, unsigned int fn, unsigned int tk);
     295              : 
     296              : 
     297              : /*
     298              :    x - checks to see that a=b.
     299              : */
     300              : 
     301            0 : static DynamicStrings_String x (DynamicStrings_String a, DynamicStrings_String b)
     302              : {
     303            0 :   if (a != b)
     304              :     {
     305            0 :       M2Error_InternalError ((const char *) "different string returned", 25);
     306              :     }
     307            0 :   return a;
     308              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     309              :   __builtin_unreachable ();
     310              : }
     311              : 
     312              : 
     313              : /*
     314              :    IsWhite - returns TRUE if, ch, is a space.
     315              : */
     316              : 
     317            0 : static bool IsWhite (char ch)
     318              : {
     319            0 :   return ch == ' ';
     320              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     321              :   __builtin_unreachable ();
     322              : }
     323              : 
     324              : 
     325              : /*
     326              :    ConCatWord - joins sentances, a, b, together.
     327              : */
     328              : 
     329            0 : static DynamicStrings_String ConCatWord (DynamicStrings_String a, DynamicStrings_String b)
     330              : {
     331            0 :   if (((DynamicStrings_Length (a)) == 1) && ((DynamicStrings_char (a, 0)) == 'a'))
     332              :     {
     333            0 :       a = x (a, DynamicStrings_ConCatChar (a, 'n'));
     334              :     }
     335            0 :   else if ((((DynamicStrings_Length (a)) > 1) && ((DynamicStrings_char (a, -1)) == 'a')) && (IsWhite (DynamicStrings_char (a, -2))))
     336              :     {
     337              :       /* avoid dangling else.  */
     338            0 :       a = x (a, DynamicStrings_ConCatChar (a, 'n'));
     339              :     }
     340            0 :   if (((DynamicStrings_Length (a)) > 0) && (! (IsWhite (DynamicStrings_char (a, -1)))))
     341              :     {
     342            0 :       a = x (a, DynamicStrings_ConCatChar (a, ' '));
     343              :     }
     344            0 :   return x (a, DynamicStrings_ConCat (a, b));
     345              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     346              :   __builtin_unreachable ();
     347              : }
     348              : 
     349              : 
     350              : /*
     351              :    symDesc -
     352              : */
     353              : 
     354            0 : static DynamicStrings_String symDesc (unsigned int sym, DynamicStrings_String o)
     355              : {
     356            0 :   if (sym == SymbolTable_NulSym)
     357              :     {
     358            0 :       return ConCatWord (o, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "NulSym", 6)));
     359              :     }
     360            0 :   else if (SymbolTable_IsConstLit (sym))
     361              :     {
     362              :       /* avoid dangling else.  */
     363            0 :       return ConCatWord (o, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "constant literal", 16)));
     364              :     }
     365            0 :   else if (SymbolTable_IsConstSet (sym))
     366              :     {
     367              :       /* avoid dangling else.  */
     368            0 :       return ConCatWord (o, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "constant set", 12)));
     369              :     }
     370            0 :   else if (SymbolTable_IsConstructor (sym))
     371              :     {
     372              :       /* avoid dangling else.  */
     373            0 :       return ConCatWord (o, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "constructor", 11)));
     374              :     }
     375            0 :   else if (SymbolTable_IsConst (sym))
     376              :     {
     377              :       /* avoid dangling else.  */
     378            0 :       return ConCatWord (o, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "constant", 8)));
     379              :     }
     380            0 :   else if (SymbolTable_IsArray (sym))
     381              :     {
     382              :       /* avoid dangling else.  */
     383            0 :       return ConCatWord (o, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "array", 5)));
     384              :     }
     385            0 :   else if (SymbolTable_IsVar (sym))
     386              :     {
     387              :       /* avoid dangling else.  */
     388            0 :       return ConCatWord (o, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "variable", 8)));
     389              :     }
     390            0 :   else if (SymbolTable_IsEnumeration (sym))
     391              :     {
     392              :       /* avoid dangling else.  */
     393            0 :       return ConCatWord (o, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "enumeration type", 16)));
     394              :     }
     395            0 :   else if (SymbolTable_IsFieldEnumeration (sym))
     396              :     {
     397              :       /* avoid dangling else.  */
     398            0 :       return ConCatWord (o, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "enumeration field", 17)));
     399              :     }
     400            0 :   else if (SymbolTable_IsUnbounded (sym))
     401              :     {
     402              :       /* avoid dangling else.  */
     403            0 :       return ConCatWord (o, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "unbounded parameter", 19)));
     404              :     }
     405            0 :   else if (SymbolTable_IsProcType (sym))
     406              :     {
     407              :       /* avoid dangling else.  */
     408            0 :       return ConCatWord (o, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "procedure type", 14)));
     409              :     }
     410            0 :   else if (SymbolTable_IsProcedure (sym))
     411              :     {
     412              :       /* avoid dangling else.  */
     413            0 :       return ConCatWord (o, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "procedure", 9)));
     414              :     }
     415            0 :   else if (SymbolTable_IsPointer (sym))
     416              :     {
     417              :       /* avoid dangling else.  */
     418            0 :       return ConCatWord (o, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "pointer", 7)));
     419              :     }
     420            0 :   else if (SymbolTable_IsParameter (sym))
     421              :     {
     422              :       /* avoid dangling else.  */
     423            0 :       if (SymbolTable_IsParameterVar (sym))
     424              :         {
     425            0 :           return ConCatWord (o, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "var parameter", 13)));
     426              :         }
     427              :       else
     428              :         {
     429            0 :           return ConCatWord (o, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "parameter", 9)));
     430              :         }
     431              :     }
     432            0 :   else if (SymbolTable_IsType (sym))
     433              :     {
     434              :       /* avoid dangling else.  */
     435            0 :       return ConCatWord (o, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "type", 4)));
     436              :     }
     437            0 :   else if (SymbolTable_IsRecord (sym))
     438              :     {
     439              :       /* avoid dangling else.  */
     440            0 :       return ConCatWord (o, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "record", 6)));
     441              :     }
     442            0 :   else if (SymbolTable_IsRecordField (sym))
     443              :     {
     444              :       /* avoid dangling else.  */
     445            0 :       return ConCatWord (o, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "record field", 12)));
     446              :     }
     447            0 :   else if (SymbolTable_IsVarient (sym))
     448              :     {
     449              :       /* avoid dangling else.  */
     450            0 :       return ConCatWord (o, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "varient record", 14)));
     451              :     }
     452            0 :   else if (SymbolTable_IsModule (sym))
     453              :     {
     454              :       /* avoid dangling else.  */
     455            0 :       return ConCatWord (o, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "module", 6)));
     456              :     }
     457            0 :   else if (SymbolTable_IsDefImp (sym))
     458              :     {
     459              :       /* avoid dangling else.  */
     460            0 :       return ConCatWord (o, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "definition or implementation module", 35)));
     461              :     }
     462            0 :   else if (SymbolTable_IsSet (sym))
     463              :     {
     464              :       /* avoid dangling else.  */
     465            0 :       return ConCatWord (o, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "set", 3)));
     466              :     }
     467            0 :   else if (SymbolTable_IsSubrange (sym))
     468              :     {
     469              :       /* avoid dangling else.  */
     470            0 :       return ConCatWord (o, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "subrange", 8)));
     471              :     }
     472              :   else
     473              :     {
     474              :       /* avoid dangling else.  */
     475              :       return o;
     476              :     }
     477              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     478              :   __builtin_unreachable ();
     479              : }
     480              : 
     481              : 
     482              : /*
     483              :    Output - output string, s, to Stdout.  It also disposes of the string, s.
     484              : */
     485              : 
     486            0 : static void Output (DynamicStrings_String s)
     487              : {
     488            0 :   s = SFIO_WriteS (FIO_StdOut, s);
     489            0 :   s = DynamicStrings_KillString (s);
     490            0 : }
     491              : 
     492              : 
     493              : /*
     494              :    GetComment -
     495              : */
     496              : 
     497            0 : static int GetComment (DynamicStrings_String s)
     498              : {
     499            0 :   int c;
     500              : 
     501            0 :   c = DynamicStrings_Index (s, '|', 0);
     502            0 :   while (c >= 0)
     503              :     {
     504            0 :       c += 1;
     505            0 :       if (c >= ((int ) (DynamicStrings_Length (s))))
     506              :         {
     507              :           return -1;
     508              :         }
     509            0 :       else if ((DynamicStrings_char (s, c)) == '|')
     510              :         {
     511              :           /* avoid dangling else.  */
     512            0 :           return c+1;
     513              :         }
     514            0 :       c = DynamicStrings_Index (s, '|', static_cast<unsigned int> (c));
     515              :     }
     516              :   return -1;
     517              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     518              :   __builtin_unreachable ();
     519              : }
     520              : 
     521              : 
     522              : /*
     523              :    doName - concatenate namekey, o, to, p.
     524              : */
     525              : 
     526            0 : static DynamicStrings_String doName (DynamicStrings_String p, unsigned int o)
     527              : {
     528            0 :   return DynamicStrings_ConCat (p, DynamicStrings_InitStringCharStar (NameKey_KeyToCharStar (o)));
     529              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     530              :   __builtin_unreachable ();
     531              : }
     532              : 
     533              : 
     534              : /*
     535              :    doSymName - concatenate symbol, o, name to, p.
     536              : */
     537              : 
     538            0 : static DynamicStrings_String doSymName (DynamicStrings_String p, unsigned int o)
     539              : {
     540            0 :   return DynamicStrings_ConCat (p, DynamicStrings_InitStringCharStar (NameKey_KeyToCharStar (SymbolTable_GetSymName (o))));
     541              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     542              :   __builtin_unreachable ();
     543              : }
     544              : 
     545              : 
     546              : /*
     547              :    doNumber - convert, o, to a cardinal and increment the length, l,
     548              :               by the number of characters required to represent, o.
     549              : */
     550              : 
     551            0 : static DynamicStrings_String doNumber (DynamicStrings_String p, unsigned int o)
     552              : {
     553            0 :   return DynamicStrings_ConCat (p, StringConvert_CardinalToString ((unsigned int ) (o), 0, ' ', 10, true));
     554              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     555              :   __builtin_unreachable ();
     556              : }
     557              : 
     558              : 
     559              : /*
     560              :    doSymbol - handles a symbol indicated by, o.
     561              : */
     562              : 
     563            0 : static DynamicStrings_String doSymbol (DynamicStrings_String p, unsigned int o)
     564              : {
     565            0 :   return symDesc (o, p);
     566              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     567              :   __builtin_unreachable ();
     568              : }
     569              : 
     570              : 
     571              : /*
     572              :    doOperand -
     573              : */
     574              : 
     575            0 : static DynamicStrings_String doOperand (DynamicStrings_String p, DynamicStrings_String s, int *i, int e, unsigned int o)
     576              : {
     577            0 :   (*i) += 1;
     578            0 :   if ((*i) < e)
     579              :     {
     580            0 :       switch (DynamicStrings_char (s, (*i)))
     581              :         {
     582            0 :           case 's':
     583            0 :             (*i) += 1;  /* symbol number  */
     584            0 :             return doSymbol (p, o);
     585            0 :             break;
     586              : 
     587            0 :           case 'd':
     588            0 :             (*i) += 1;  /* decimal number  */
     589            0 :             return doNumber (p, o);
     590            0 :             break;
     591              : 
     592            0 :           case 'a':
     593            0 :             (*i) += 1;  /* symbol name key  */
     594            0 :             return doSymName (p, o);
     595            0 :             break;
     596              : 
     597            0 :           case 'n':
     598            0 :             (*i) += 1;  /* ascii name key  */
     599            0 :             return doName (p, o);
     600            0 :             break;
     601              : 
     602              : 
     603            0 :           default:
     604            0 :             M2Error_InternalError ((const char *) "incorrect format specifier expecting one of 's', 'd' or 'a'", 59);
     605              :             break;
     606              :         }
     607              :     }
     608              :   return p;
     609              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     610              :   __builtin_unreachable ();
     611              : }
     612              : 
     613              : 
     614              : /*
     615              :    doPercent -
     616              : */
     617              : 
     618            0 : static DynamicStrings_String doPercent (DynamicStrings_String o, DynamicStrings_String s, int *i, int e, unsigned int n)
     619              : {
     620            0 :   (*i) += 1;
     621            0 :   if ((*i) < e)
     622              :     {
     623            0 :       switch (DynamicStrings_char (s, (*i)))
     624              :         {
     625            0 :           case '1':
     626            0 :             return doOperand (o, s, i, e, (unsigned int ) ((*OperandT.proc) (n)));
     627            0 :             break;
     628              : 
     629            0 :           case '2':
     630            0 :             return doOperand (o, s, i, e, (unsigned int ) ((*OperandF.proc) (n)));
     631            0 :             break;
     632              : 
     633            0 :           case '3':
     634            0 :             return doOperand (o, s, i, e, (unsigned int ) ((*OperandTok.proc) (n)));
     635            0 :             break;
     636              : 
     637              : 
     638            0 :           default:
     639            0 :             M2Error_InternalError ((const char *) "unrecognised format specifier - expecting 1, 2 or 3 after the %", 63);
     640            0 :             break;
     641              :         }
     642              :     }
     643            0 :   M2Error_InternalError ((const char *) "end of field found before format specifier - expecting 1, 2 or 3 after the %", 76);
     644              :   ReturnException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/M2DebugStack.def", 20, 1);
     645              :   __builtin_unreachable ();
     646              : }
     647              : 
     648              : 
     649              : /*
     650              :    doNameLength - increment, l, by the ascii length of string determined by, o.
     651              : */
     652              : 
     653            0 : static void doNameLength (unsigned int *l, unsigned int o)
     654              : {
     655            0 :   DynamicStrings_String s;
     656              : 
     657            0 :   s = DynamicStrings_InitStringCharStar (NameKey_KeyToCharStar (o));
     658            0 :   (*l) += DynamicStrings_Length (s);
     659            0 :   s = DynamicStrings_KillString (s);
     660            0 : }
     661              : 
     662              : 
     663              : /*
     664              :    doSymNameLength - increment, l, by the ascii length of symbol, o.
     665              : */
     666              : 
     667            0 : static void doSymNameLength (unsigned int *l, unsigned int o)
     668              : {
     669            0 :   DynamicStrings_String s;
     670              : 
     671            0 :   s = DynamicStrings_InitStringCharStar (NameKey_KeyToCharStar (SymbolTable_GetSymName (o)));
     672            0 :   (*l) += DynamicStrings_Length (s);
     673            0 :   s = DynamicStrings_KillString (s);
     674            0 : }
     675              : 
     676              : 
     677              : /*
     678              :    doNumberLength - convert, o, to a cardinal and increment the length, l,
     679              :                     by the number of characters required to represent, o.
     680              : */
     681              : 
     682            0 : static void doNumberLength (unsigned int *l, unsigned int o)
     683              : {
     684            0 :   DynamicStrings_String s;
     685              : 
     686            0 :   s = StringConvert_CardinalToString ((unsigned int ) (o), 0, ' ', 10, true);
     687            0 :   (*l) += DynamicStrings_Length (s);
     688            0 :   s = DynamicStrings_KillString (s);
     689            0 : }
     690              : 
     691              : 
     692              : /*
     693              :    doSymbolLength - handles a symbol indicated by, o.
     694              : */
     695              : 
     696            0 : static void doSymbolLength (unsigned int *l, unsigned int o)
     697              : {
     698            0 :   DynamicStrings_String s;
     699              : 
     700            0 :   s = symDesc (o, DynamicStrings_InitString ((const char *) "", 0));
     701            0 :   (*l) += DynamicStrings_Length (s);
     702            0 :   s = DynamicStrings_KillString (s);
     703            0 : }
     704              : 
     705              : 
     706              : /*
     707              :    doOperandLength -
     708              : */
     709              : 
     710            0 : static void doOperandLength (DynamicStrings_String s, int *i, int e, unsigned int *l, unsigned int o)
     711              : {
     712            0 :   (*i) += 1;
     713            0 :   if ((*i) < e)
     714              :     {
     715            0 :       switch (DynamicStrings_char (s, (*i)))
     716              :         {
     717            0 :           case 's':
     718            0 :             (*i) += 1;  /* symbol number  */
     719            0 :             doSymbolLength (l, o);
     720            0 :             break;
     721              : 
     722            0 :           case 'd':
     723            0 :             (*i) += 1;  /* decimal number  */
     724            0 :             doNumberLength (l, o);
     725            0 :             break;
     726              : 
     727            0 :           case 'a':
     728            0 :             (*i) += 1;  /* ascii name key  */
     729            0 :             doSymNameLength (l, o);
     730            0 :             break;
     731              : 
     732            0 :           case 'n':
     733            0 :             (*i) += 1;  /* ascii name key  */
     734            0 :             doNameLength (l, o);
     735            0 :             break;
     736              : 
     737              : 
     738            0 :           default:
     739            0 :             M2Error_InternalError ((const char *) "incorrect format specifier expecting one of 's', 'd' or 'a'", 59);
     740              :             break;
     741              :         }
     742              :     }
     743            0 : }
     744              : 
     745              : 
     746              : /*
     747              :    doPercentLength -
     748              : */
     749              : 
     750            0 : static void doPercentLength (DynamicStrings_String s, int *i, int e, unsigned int *l, unsigned int n)
     751              : {
     752            0 :   (*i) += 1;
     753            0 :   if ((*i) < e)
     754              :     {
     755            0 :       switch (DynamicStrings_char (s, (*i)))
     756              :         {
     757            0 :           case '1':
     758            0 :             doOperandLength (s, i, e, l, (unsigned int ) ((*OperandT.proc) (n)));
     759            0 :             break;
     760              : 
     761            0 :           case '2':
     762            0 :             doOperandLength (s, i, e, l, (unsigned int ) ((*OperandF.proc) (n)));
     763            0 :             break;
     764              : 
     765            0 :           case '3':
     766            0 :             doOperandLength (s, i, e, l, (unsigned int ) ((*OperandTok.proc) (n)));
     767            0 :             break;
     768              : 
     769              : 
     770            0 :           default:
     771            0 :             M2Error_InternalError ((const char *) "unrecognised format specifier - expecting 1, 2 or 3 after the %", 63);
     772              :             break;
     773              :         }
     774              :     }
     775            0 : }
     776              : 
     777              : 
     778              : /*
     779              :    doFieldLength - compute the string length given in annotation
     780              :                    at position, n, on the stack between characters
     781              :                    b and e.
     782              : 
     783              :                    The string description between: b..e can contain any
     784              :                    of these patterns:
     785              : 
     786              :                    %a           ascii name key.
     787              :                    %s           symbol number.
     788              :                    %d           decimal cardinal number.
     789              :                    |            indicates the next field.
     790              : */
     791              : 
     792            0 : static unsigned int doFieldLength (int b, int e, unsigned int n)
     793              : {
     794            0 :   unsigned int l;
     795            0 :   int i;
     796            0 :   DynamicStrings_String s;
     797              : 
     798            0 :   if (b == -1)
     799              :     {
     800              :       return 0;
     801              :     }
     802            0 :   s = static_cast<DynamicStrings_String> ((*OperandAnno.proc) (n));
     803            0 :   if (e == -1)
     804              :     {
     805            0 :       e = DynamicStrings_Length (s);
     806              :     }
     807            0 :   l = 0;
     808            0 :   i = b;
     809            0 :   while (i < e)
     810              :     {
     811            0 :       switch (DynamicStrings_char (s, i))
     812              :         {
     813            0 :           case '|':
     814            0 :             return l;
     815            0 :             break;
     816              : 
     817            0 :           case '%':
     818            0 :             doPercentLength (s, &i, e, &l, n);
     819            0 :             break;
     820              : 
     821              : 
     822            0 :           default:
     823            0 :             l += 1;
     824            0 :             break;
     825              :         }
     826            0 :       i += 1;
     827              :     }
     828            0 :   return l;
     829              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     830              :   __builtin_unreachable ();
     831              : }
     832              : 
     833              : 
     834              : /*
     835              :    stop -
     836              : */
     837              : 
     838            0 : static void stop (void)
     839              : {
     840            0 : }
     841              : 
     842              : 
     843              : /*
     844              :    doMaxCard - returns the maximum of two CARDINALs.
     845              : */
     846              : 
     847            0 : static unsigned int doMaxCard (unsigned int a, unsigned int b)
     848              : {
     849            0 :   if ((a > 100) || (b > 100))
     850              :     {
     851            0 :       stop ();
     852              :     }
     853            0 :   if (a > b)
     854              :     {
     855              :       return a;
     856              :     }
     857              :   else
     858              :     {
     859              :       return b;
     860              :     }
     861              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     862              :   __builtin_unreachable ();
     863              : }
     864              : 
     865              : 
     866              : /*
     867              :    GetAnnotationFieldLength -
     868              : */
     869              : 
     870            0 : static unsigned int GetAnnotationFieldLength (unsigned int n, unsigned int f)
     871              : {
     872            0 :   int c;
     873            0 :   int e;
     874              : 
     875            0 :   c = GetComment ((DynamicStrings_String) ((*OperandAnno.proc) (n)));
     876            0 :   if (c > 0)
     877              :     {
     878            0 :       if (Debugging)
     879              :         {
     880              :           M2Printf_printf0 ((const char *) "full anno is: ", 14);
     881              :           Output (DynamicStrings_Dup ((DynamicStrings_String) ((*OperandAnno.proc) (n))));
     882              :           M2Printf_printf0 ((const char *) "\\n", 2);
     883              :           M2Printf_printf0 ((const char *) "comment field is: ", 18);
     884              :           Output (DynamicStrings_Slice ((DynamicStrings_String) ((*OperandAnno.proc) (n)), c, 0));
     885              :           M2Printf_printf0 ((const char *) "\\n", 2);
     886              :         }
     887            0 :       e = DynamicStrings_Index ((DynamicStrings_String) ((*OperandAnno.proc) (n)), '|', static_cast<unsigned int> (c));
     888            0 :       if (f == 0)
     889              :         {
     890            0 :           return doFieldLength (c, e, n);
     891              :         }
     892              :       else
     893              :         {
     894            0 :           if (e >= 0)
     895              :             {
     896            0 :               e += 1;
     897              :             }
     898            0 :           return doFieldLength (e, -1, n);
     899              :         }
     900              :     }
     901              :   else
     902              :     {
     903              :       return 0;
     904              :     }
     905              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     906              :   __builtin_unreachable ();
     907              : }
     908              : 
     909              : 
     910              : /*
     911              :    GetAnnotationLength -
     912              : */
     913              : 
     914            0 : static unsigned int GetAnnotationLength (unsigned int n, unsigned int f)
     915              : {
     916            0 :   unsigned int l;
     917              : 
     918            0 :   if (((*OperandAnno.proc) (n)) == NULL)
     919              :     {
     920            0 :       l = 0;
     921            0 :       if (f == 0)
     922              :         {
     923            0 :           doNumberLength (&l, (unsigned int ) ((*OperandT.proc) (n)));
     924              :         }
     925              :       else
     926              :         {
     927            0 :           doNumberLength (&l, (unsigned int ) ((*OperandF.proc) (n)));
     928              :         }
     929            0 :       return l;
     930              :     }
     931              :   else
     932              :     {
     933            0 :       return GetAnnotationFieldLength (n, f);
     934              :     }
     935              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     936              :   __builtin_unreachable ();
     937              : }
     938              : 
     939              : 
     940              : /*
     941              :    GetFieldLength - returns the number of characters used in field, f,
     942              :                     at position, n, on the stack.
     943              : */
     944              : 
     945            0 : static unsigned int GetFieldLength (unsigned int n, unsigned int f)
     946              : {
     947            0 :   int c;
     948            0 :   int b;
     949            0 :   int e;
     950              : 
     951            0 :   c = GetComment ((DynamicStrings_String) ((*OperandAnno.proc) (n)));
     952            0 :   if (c > 1)
     953              :     {
     954            0 :       e = c-2;
     955              :     }
     956              :   else
     957              :     {
     958            0 :       e = DynamicStrings_Length ((DynamicStrings_String) ((*OperandAnno.proc) (n)));
     959              :     }
     960            0 :   if (f == 0)
     961              :     {
     962              :       b = 0;
     963              :     }
     964              :   else
     965              :     {
     966            0 :       b = DynamicStrings_Index ((DynamicStrings_String) ((*OperandAnno.proc) (n)), '|', 0);
     967            0 :       if (b == -1)
     968              :         {
     969              :           return 0;
     970              :         }
     971              :       else
     972              :         {
     973            0 :           b += 1;
     974              :         }
     975              :     }
     976            0 :   return doFieldLength (b, e, n);
     977              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     978              :   __builtin_unreachable ();
     979              : }
     980              : 
     981              : 
     982              : /*
     983              :    GetMaxFieldAnno - returns the maximum number of characters required
     984              :                      by either the annotation or field, f, at position, n,
     985              :                      on the stack.
     986              : */
     987              : 
     988            0 : static unsigned int GetMaxFieldAnno (unsigned int n, unsigned int f)
     989              : {
     990            0 :   return doMaxCard (GetAnnotationLength (n, f), GetFieldLength (n, f));
     991              :   /* static analysis guarentees a RETURN statement will be used before here.  */
     992              :   __builtin_unreachable ();
     993              : }
     994              : 
     995              : 
     996              : /*
     997              :    GetStackFieldLengths - assigns, tn, and, fn, with the
     998              :                           maximum field width values.
     999              : */
    1000              : 
    1001            0 : static void GetStackFieldLengths (unsigned int *tn, unsigned int *fn, unsigned int *tk, unsigned int amount)
    1002              : {
    1003            0 :   unsigned int i;
    1004              : 
    1005            0 :   i = 1;
    1006            0 :   (*tn) = 0;
    1007            0 :   (*fn) = 0;
    1008            0 :   (*tk) = 0;
    1009            0 :   while (i <= amount)
    1010              :     {
    1011            0 :       (*tn) = doMaxCard ((*tn), GetMaxFieldAnno (i, 0));
    1012            0 :       (*fn) = doMaxCard ((*fn), GetMaxFieldAnno (i, 1));
    1013            0 :       (*tk) = doMaxCard ((*tk), GetMaxFieldAnno (i, 2));
    1014            0 :       i += 1;
    1015              :     }
    1016            0 : }
    1017              : 
    1018              : 
    1019              : /*
    1020              :    DisplayRow -
    1021              : */
    1022              : 
    1023            0 : static void DisplayRow (unsigned int tn, unsigned int fn, unsigned int tk, bool initOrFinal)
    1024              : {
    1025            0 :   unsigned int i;
    1026              : 
    1027            0 :   M2Printf_printf0 ((const char *) "+-", 2);
    1028            0 :   for (i=1; i<=tn; i++)
    1029              :     {
    1030            0 :       M2Printf_printf0 ((const char *) "-", 1);
    1031              :     }
    1032            0 :   if ((fn == 0) && (tk == 0))
    1033              :     {
    1034            0 :       if (initOrFinal)
    1035              :         {
    1036            0 :           M2Printf_printf0 ((const char *) "-+-", 3);
    1037              :         }
    1038              :       else
    1039              :         {
    1040            0 :           M2Printf_printf0 ((const char *) "-|-", 3);
    1041              :         }
    1042              :     }
    1043              :   else
    1044              :     {
    1045            0 :       if (initOrFinal)
    1046              :         {
    1047            0 :           M2Printf_printf0 ((const char *) "-+-", 3);
    1048              :         }
    1049              :       else
    1050              :         {
    1051            0 :           M2Printf_printf0 ((const char *) "-|-", 3);
    1052              :         }
    1053            0 :       if (fn != 0)
    1054              :         {
    1055            0 :           for (i=1; i<=fn; i++)
    1056              :             {
    1057            0 :               M2Printf_printf0 ((const char *) "-", 1);
    1058              :             }
    1059              :         }
    1060            0 :       if (initOrFinal)
    1061              :         {
    1062            0 :           M2Printf_printf0 ((const char *) "-+-", 3);
    1063              :         }
    1064              :       else
    1065              :         {
    1066            0 :           M2Printf_printf0 ((const char *) "-|-", 3);
    1067              :         }
    1068            0 :       if (tk != 0)
    1069              :         {
    1070            0 :           for (i=1; i<=tk; i++)
    1071              :             {
    1072            0 :               M2Printf_printf0 ((const char *) "-", 1);
    1073              :             }
    1074            0 :           M2Printf_printf0 ((const char *) "-+\\n", 4);
    1075              :         }
    1076              :     }
    1077            0 : }
    1078              : 
    1079              : 
    1080              : /*
    1081              :    SkipToField -
    1082              : */
    1083              : 
    1084            0 : static int SkipToField (DynamicStrings_String s, unsigned int n)
    1085              : {
    1086            0 :   int i;
    1087            0 :   int h;
    1088              : 
    1089            0 :   i = 0;
    1090            0 :   h = DynamicStrings_Length (s);
    1091            0 :   while ((n > 0) && (i < h))
    1092              :     {
    1093            0 :       if ((DynamicStrings_Index (s, '|', static_cast<unsigned int> (i))) > 0)
    1094              :         {
    1095            0 :           n -= 1;
    1096            0 :           if ((i < h) && ((DynamicStrings_char (s, i+1)) == '|'))
    1097              :             {
    1098              :               /* comment seen, no field available  */
    1099              :               return -1;
    1100              :             }
    1101            0 :           i = DynamicStrings_Index (s, '|', static_cast<unsigned int> (i));
    1102              :         }
    1103              :       else
    1104              :         {
    1105              :           return -1;
    1106              :         }
    1107            0 :       i += 1;
    1108              :     }
    1109            0 :   if (i == h)
    1110              :     {
    1111            0 :       i = -1;
    1112              :     }
    1113              :   return i;
    1114              :   /* static analysis guarentees a RETURN statement will be used before here.  */
    1115              :   __builtin_unreachable ();
    1116              : }
    1117              : 
    1118              : 
    1119              : /*
    1120              :    Pad - padds out string, s, to paddedLength characters.
    1121              : */
    1122              : 
    1123            0 : static DynamicStrings_String Pad (DynamicStrings_String o, unsigned int paddedLength)
    1124              : {
    1125            0 :   unsigned int i;
    1126              : 
    1127            0 :   i = DynamicStrings_Length (o);
    1128            0 :   if (i < paddedLength)
    1129              :     {
    1130            0 :       do {
    1131            0 :         o = DynamicStrings_ConCatChar (o, ' ');
    1132            0 :         i += 1;
    1133            0 :       } while (! (i == paddedLength));
    1134              :     }
    1135            0 :   return o;
    1136              :   /* static analysis guarentees a RETURN statement will be used before here.  */
    1137              :   __builtin_unreachable ();
    1138              : }
    1139              : 
    1140              : 
    1141              : /*
    1142              :    doField - compute the string length given in annotation
    1143              :              at position, n, on the stack between characters
    1144              :              b and e.
    1145              : 
    1146              :              The string description between: b..e can contain any
    1147              :              of these patterns:
    1148              : 
    1149              :              %a           ascii name key.
    1150              :              %s           symbol number.
    1151              :              %d           decimal cardinal number.
    1152              :              |            indicates the next field.
    1153              : */
    1154              : 
    1155            0 : static DynamicStrings_String doField (DynamicStrings_String s, unsigned int n, unsigned int f, unsigned int l)
    1156              : {
    1157            0 :   int h;
    1158            0 :   int i;
    1159            0 :   int j;
    1160            0 :   DynamicStrings_String o;
    1161              : 
    1162            0 :   h = DynamicStrings_Length (s);
    1163            0 :   i = SkipToField (s, f);
    1164            0 :   o = DynamicStrings_InitString ((const char *) "", 0);
    1165            0 :   if (i >= 0)
    1166              :     {
    1167            0 :       j = SkipToField (s, f+1);
    1168            0 :       if (j == -1)
    1169              :         {
    1170            0 :           j = h;
    1171              :         }
    1172            0 :       while (i < h)
    1173              :         {
    1174            0 :           switch (DynamicStrings_char (s, i))
    1175              :             {
    1176            0 :               case '|':
    1177            0 :                 i = h;
    1178            0 :                 break;
    1179              : 
    1180            0 :               case '%':
    1181            0 :                 o = doPercent (o, s, &i, h, n);
    1182            0 :                 break;
    1183              : 
    1184              : 
    1185            0 :               default:
    1186            0 :                 o = DynamicStrings_ConCatChar (o, DynamicStrings_char (s, i));
    1187            0 :                 i += 1;
    1188            0 :                 break;
    1189              :             }
    1190              :         }
    1191              :     }
    1192            0 :   o = Pad (o, l);
    1193            0 :   return o;
    1194              :   /* static analysis guarentees a RETURN statement will be used before here.  */
    1195              :   __builtin_unreachable ();
    1196              : }
    1197              : 
    1198              : 
    1199              : /*
    1200              :    doAnnotation -
    1201              : */
    1202              : 
    1203            0 : static DynamicStrings_String doAnnotation (DynamicStrings_String s, unsigned int n, unsigned int field, unsigned int width)
    1204              : {
    1205            0 :   int c;
    1206            0 :   DynamicStrings_String cf;
    1207            0 :   DynamicStrings_String o;
    1208              : 
    1209            0 :   c = GetComment (s);
    1210            0 :   if (c >= 0)
    1211              :     {
    1212            0 :       cf = DynamicStrings_Slice (s, c, 0);
    1213            0 :       o = doField (cf, n, field, width);
    1214            0 :       cf = DynamicStrings_KillString (cf);
    1215            0 :       return o;
    1216              :     }
    1217              :   else
    1218              :     {
    1219            0 :       return DynamicStrings_InitString ((const char *) "", 0);
    1220              :     }
    1221              :   /* static analysis guarentees a RETURN statement will be used before here.  */
    1222              :   __builtin_unreachable ();
    1223              : }
    1224              : 
    1225              : 
    1226              : /*
    1227              :    DisplayFields -
    1228              : */
    1229              : 
    1230            0 : static void DisplayFields (unsigned int n, unsigned int tn, unsigned int fn, unsigned int tk)
    1231              : {
    1232            0 :   DynamicStrings_String s;
    1233            0 :   unsigned int t;
    1234            0 :   unsigned int f;
    1235            0 :   unsigned int k;
    1236              : 
    1237            0 :   s = static_cast<DynamicStrings_String> ((*OperandAnno.proc) (n));
    1238            0 :   if (s == NULL)
    1239              :     {
    1240            0 :       t = static_cast<unsigned int> ((*OperandT.proc) (n));
    1241            0 :       f = static_cast<unsigned int> ((*OperandF.proc) (n));
    1242            0 :       k = static_cast<unsigned int> ((*OperandTok.proc) (n));
    1243            0 :       M2Printf_printf0 ((const char *) "| ", 2);
    1244            0 :       Output (Pad (StringConvert_CardinalToString ((unsigned int ) (t), 0, ' ', 10, true), tn));
    1245            0 :       M2Printf_printf0 ((const char *) " | ", 3);
    1246            0 :       Output (Pad (StringConvert_CardinalToString ((unsigned int ) (f), 0, ' ', 10, true), fn));
    1247            0 :       M2Printf_printf0 ((const char *) " | ", 3);
    1248            0 :       Output (Pad (StringConvert_CardinalToString ((unsigned int ) (k), 0, ' ', 10, true), tk));
    1249            0 :       M2Printf_printf0 ((const char *) " |\\n", 4);
    1250              :     }
    1251              :   else
    1252              :     {
    1253            0 :       if (tn > 0)
    1254              :         {
    1255            0 :           M2Printf_printf0 ((const char *) "| ", 2);
    1256            0 :           Output (doField (s, n, 0, tn));
    1257              :         }
    1258            0 :       if (fn > 0)
    1259              :         {
    1260            0 :           M2Printf_printf0 ((const char *) " | ", 3);
    1261            0 :           Output (doField (s, n, 1, fn));
    1262              :         }
    1263            0 :       if (tk > 0)
    1264              :         {
    1265            0 :           M2Printf_printf0 ((const char *) " | ", 3);
    1266            0 :           Output (doField (s, n, 2, tk));
    1267              :         }
    1268            0 :       M2Printf_printf0 ((const char *) " |\\n", 4);
    1269            0 :       if (tn > 0)
    1270              :         {
    1271            0 :           M2Printf_printf0 ((const char *) "| ", 2);
    1272            0 :           Output (doAnnotation (s, n, 0, tn));
    1273              :         }
    1274            0 :       if (fn > 0)
    1275              :         {
    1276            0 :           M2Printf_printf0 ((const char *) " | ", 3);
    1277            0 :           Output (doAnnotation (s, n, 1, fn));
    1278              :         }
    1279            0 :       if (tk > 0)
    1280              :         {
    1281            0 :           M2Printf_printf0 ((const char *) " | ", 3);
    1282            0 :           Output (doAnnotation (s, n, 2, tk));
    1283              :         }
    1284            0 :       M2Printf_printf0 ((const char *) " |\\n", 4);
    1285              :     }
    1286            0 : }
    1287              : 
    1288              : 
    1289              : /*
    1290              :    DebugStack - displays the stack.
    1291              : */
    1292              : 
    1293            0 : extern "C" void M2DebugStack_DebugStack (unsigned int amount, M2DebugStack_ProcedureWord opt, M2DebugStack_ProcedureWord opf, M2DebugStack_ProcedureWord opa, M2DebugStack_ProcedureWord opd, M2DebugStack_ProcedureWord oprw, M2DebugStack_ProcedureWord optk, M2DebugStack_ProcedureString opanno)
    1294              : {
    1295            0 :   unsigned int i;
    1296            0 :   unsigned int tn;
    1297            0 :   unsigned int fn;
    1298            0 :   unsigned int tk;
    1299              : 
    1300            0 :   OperandT = opt;
    1301            0 :   OperandF = opf;
    1302            0 :   OperandA = opa;
    1303            0 :   OperandD = opd;
    1304            0 :   OperandRW = oprw;
    1305            0 :   OperandAnno = opanno;
    1306            0 :   OperandTok = optk;
    1307            0 :   GetStackFieldLengths (&tn, &fn, &tk, amount);
    1308            0 :   i = 1;
    1309            0 :   while (i <= amount)
    1310              :     {
    1311            0 :       if (i == 1)
    1312              :         {
    1313            0 :           DisplayRow (tn, fn, tk, true);
    1314              :         }
    1315            0 :       DisplayFields (i, tn, fn, tk);
    1316            0 :       DisplayRow (tn, fn, tk, i == amount);
    1317            0 :       i += 1;
    1318              :     }
    1319            0 : }
    1320              : 
    1321            0 : extern "C" void _M2_M2DebugStack_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
    1322              : {
    1323            0 : }
    1324              : 
    1325            0 : extern "C" void _M2_M2DebugStack_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
    1326              : {
    1327            0 : }
        

Generated by: LCOV version 2.4-beta

LCOV profile is generated on x86_64 machine using following configure options: configure --disable-bootstrap --enable-coverage=opt --enable-languages=c,c++,fortran,go,jit,lto,rust,m2 --enable-host-shared. GCC test suite is run with the built compiler.