52
52
/* 9. 6.2001 moved initialization of DoPadding before CPU-specific*/
53
53
/* initialization, to allow CPU-specific override */
54
54
/* 2001-07-07 added intiialization of C54x generator */
55
+ /* 2001-10-20 GNU error style possible */
55
56
/* */
56
57
/*****************************************************************************/
57
58
@@ -1457,33 +1458,34 @@ BEGIN
1457
1458
String Tmp ;
1458
1459
UNUSED (PInp );
1459
1460
1460
- sprintf (Tmp ,LongIntFormat ,CurrLine );
1461
- sprintf (dest ,"%s (%s ) ",NamePart (CurrFileName ), Tmp );
1462
- return True ;
1461
+ sprintf (Tmp , LongIntFormat , PInp -> LineZ );
1462
+ sprintf (dest , GNUErrors ? "%s :% s " : "%s (%s) " , NamePart (PInp -> SpecName ), Tmp );
1463
+ return ! GNUErrors ;
1463
1464
END
1464
1465
1465
1466
Boolean INCLUDE_Processor (PInputTag PInp , char * Erg )
1466
1467
BEGIN
1467
1468
Boolean Result ;
1468
1469
1469
- Result = True ;
1470
+ Result = True ;
1470
1471
1471
- if (feof (PInp -> Datei )) * Erg = '\0' ;
1472
+ if (feof (PInp -> Datei ))
1473
+ * Erg = '\0' ;
1472
1474
else
1473
1475
BEGIN
1474
- ReadLn (PInp -> Datei ,Erg );
1476
+ ReadLn (PInp -> Datei , Erg );
1475
1477
/**ChkIO(10003);**/
1476
1478
END
1477
- CurrLine = (++ MomLineCounter );
1478
- if (feof (PInp -> Datei )) Result = False ;
1479
+ PInp -> LineZ = CurrLine = (++ MomLineCounter );
1480
+ if (feof (PInp -> Datei )) Result = False ;
1479
1481
1480
1482
return Result ;
1481
1483
END
1482
1484
1483
1485
static void INCLUDE_Restorer (PInputTag PInp )
1484
1486
BEGIN
1485
1487
MomLineCounter = PInp -> StartLine ;
1486
- strmaxcpy (CurrFileName ,PInp -> SpecName ,255 );
1488
+ strmaxcpy (CurrFileName ,PInp -> SaveAttr ,255 );
1487
1489
IncDepth -- ;
1488
1490
END
1489
1491
@@ -1520,7 +1522,8 @@ BEGIN
1520
1522
/* Sicherung alter Daten */
1521
1523
1522
1524
Tag -> StartLine = MomLineCounter ;
1523
- strmaxcpy (Tag -> SpecName ,CurrFileName ,255 );
1525
+ strmaxcpy (Tag -> SpecName , ArgPart , 255 );
1526
+ strmaxcpy (Tag -> SaveAttr , CurrFileName , 255 );
1524
1527
1525
1528
/* Datei oeffnen */
1526
1529
@@ -1530,7 +1533,7 @@ BEGIN
1530
1533
1531
1534
/* neu besetzen */
1532
1535
1533
- strmaxcpy (CurrFileName ,ArgPart ,255 ); MomLineCounter = 0 ;
1536
+ strmaxcpy (CurrFileName ,ArgPart ,255 ); Tag -> LineZ = MomLineCounter = 0 ;
1534
1537
NextIncDepth ++ ; AddFile (ArgPart );
1535
1538
PushInclude (ArgPart );
1536
1539
@@ -1570,23 +1573,81 @@ BEGIN
1570
1573
END
1571
1574
1572
1575
char * GetErrorPos (void )
1573
- BEGIN
1576
+ {
1574
1577
String ActPos ;
1575
1578
PInputTag RunTag ;
1576
1579
char * ErgPos = strdup ("" ),* tmppos ;
1577
1580
Boolean Last ;
1578
1581
1579
- for (RunTag = FirstInputTag ; RunTag != Nil ; RunTag = RunTag -> Next )
1580
- BEGIN
1581
- Last = RunTag -> GetPos (RunTag ,ActPos );
1582
- tmppos = (char * ) malloc (strlen (ErgPos )+ strlen (ActPos )+ 1 );
1583
- strcpy (tmppos ,ActPos ); strcat (tmppos ,ErgPos );
1584
- free (ErgPos ); ErgPos = tmppos ;
1585
- if (Last ) break ;
1586
- END
1582
+ /* for GNU error message style: */
1583
+
1584
+ if (GNUErrors )
1585
+ {
1586
+ PInputTag InnerTag = NULL ;
1587
+ Boolean First = TRUE;
1588
+ char * Msg ;
1589
+
1590
+ /* we only honor the include positions. First, print the upper include layers... */
1591
+
1592
+ for (RunTag = FirstInputTag ; RunTag ; RunTag = RunTag -> Next )
1593
+ if (RunTag -> GetPos == INCLUDE_GetPos )
1594
+ {
1595
+ if (!InnerTag )
1596
+ InnerTag = RunTag ;
1597
+ else
1598
+ {
1599
+ Last = RunTag -> GetPos (RunTag , ActPos );
1600
+ if (First )
1601
+ {
1602
+ Msg = getmessage (Num_GNUErrorMsg1 );
1603
+ tmppos = (char * ) malloc (strlen (Msg ) + 1 + strlen (ActPos ) + 1 );
1604
+ sprintf (tmppos , "%s %s" , Msg , ActPos );
1605
+ }
1606
+ else
1607
+ {
1608
+ Msg = getmessage (Num_GNUErrorMsgN );
1609
+ tmppos = (char * ) malloc (strlen (ErgPos ) + 2 + strlen (Msg ) + 1 + strlen (ActPos ) + 1 );
1610
+ sprintf (tmppos , "%s,\n%s %s" , ErgPos , Msg , ActPos );
1611
+ }
1612
+ First = False ;
1613
+ free (ErgPos ); ErgPos = tmppos ;
1614
+ }
1615
+ }
1616
+
1617
+ /* ...append something... */
1618
+
1619
+ if (* ErgPos )
1620
+ {
1621
+ tmppos = (char * ) malloc (strlen (ErgPos ) + 2 );
1622
+ sprintf (tmppos , "%s:\n" , ErgPos );
1623
+ free (ErgPos ); ErgPos = tmppos ;
1624
+ }
1625
+
1626
+ /* ...then the innermost one */
1627
+
1628
+ if (InnerTag )
1629
+ {
1630
+ InnerTag -> GetPos (InnerTag , ActPos );
1631
+ tmppos = (char * ) malloc (strlen (ErgPos ) + strlen (ActPos ) + 1 );
1632
+ sprintf (tmppos , "%s%s" , ErgPos , ActPos );
1633
+ free (ErgPos ); ErgPos = tmppos ;
1634
+ }
1635
+ }
1636
+
1637
+ /* otherwise the standard AS position generator: */
1638
+
1639
+ else
1640
+ for (RunTag = FirstInputTag ; RunTag != Nil ; RunTag = RunTag -> Next )
1641
+ {
1642
+ Last = RunTag -> GetPos (RunTag , ActPos );
1643
+ tmppos = (char * ) malloc (strlen (ErgPos ) + strlen (ActPos ) + 1 );
1644
+ strcpy (tmppos , ActPos ); strcat (tmppos , ErgPos );
1645
+ free (ErgPos ); ErgPos = tmppos ;
1646
+ if (Last ) break ;
1647
+ }
1587
1648
1588
1649
return ErgPos ;
1589
- END
1650
+ }
1590
1651
1591
1652
static Boolean InputEnd (void )
1592
1653
BEGIN
@@ -2774,6 +2835,14 @@ BEGIN
2774
2835
return CMDOK ;
2775
2836
END
2776
2837
2838
+ static CMDResult CMD_GNUErrors (Boolean Negate , char * Arg )
2839
+ BEGIN
2840
+ UNUSED (Arg );
2841
+
2842
+ GNUErrors = NOT Negate ;
2843
+ return CMDOK ;
2844
+ END
2845
+
2777
2846
static CMDResult CMD_IncludeList (Boolean Negate , char * Arg )
2778
2847
BEGIN
2779
2848
char * p ;
@@ -3022,43 +3091,44 @@ BEGIN
3022
3091
exit (4 );
3023
3092
END
3024
3093
3025
- #define ASParamCnt 35
3094
+ #define ASParamCnt 36
3026
3095
static CMDRec ASParams [ASParamCnt ]=
3027
- {{"A" , CMD_BalanceTree },
3028
- {"ALIAS" , CMD_CPUAlias },
3029
- {"a" , CMD_ShareAssembler },
3030
- {"C" , CMD_CrossList },
3031
- {"c" , CMD_ShareC },
3032
- {"CPU" , CMD_SetCPU },
3033
- {"D" , CMD_DefSymbol },
3034
- {"E" , CMD_ErrorPath },
3035
- {"g" , CMD_DebugMode },
3036
- {"G" , CMD_CodeOutput },
3037
- {"h" , CMD_HexLowerCase },
3038
- {"i" , CMD_IncludeList },
3039
- {"I" , CMD_MakeIncludeList },
3040
- {"L" , CMD_ListFile },
3041
- {"l" , CMD_ListConsole },
3042
- {"M" , CMD_MacroOutput },
3043
- {"n" , CMD_NumericErrors },
3044
- {"NOICEMASK" , CMD_NoICEMask },
3045
- {"o" , CMD_OutFile },
3046
- {"P" , CMD_MacProOutput },
3047
- {"p" , CMD_SharePascal },
3048
- {"q" , CMD_QuietMode },
3049
- {"QUIET" , CMD_QuietMode },
3050
- {"r" , CMD_MsgIfRepass },
3051
- {"s" , CMD_SectionList },
3052
- {"SHAREOUT" , CMD_ShareOutFile },
3053
- {"OLIST" , CMD_ListOutFile },
3054
- {"t" , CMD_ListMask },
3055
- {"u" , CMD_UseList },
3056
- {"U" , CMD_CaseSensitive },
3057
- {"w" , CMD_SuppWarns },
3058
- {"WARNRANGES" , CMD_HardRanges },
3059
- {"x" , CMD_ExtendErrors },
3060
- {"X" , CMD_MakeDebug },
3061
- {"Y" , CMD_ThrowErrors }};
3096
+ {{"A" , CMD_BalanceTree },
3097
+ {"ALIAS" , CMD_CPUAlias },
3098
+ {"a" , CMD_ShareAssembler },
3099
+ {"C" , CMD_CrossList },
3100
+ {"c" , CMD_ShareC },
3101
+ {"CPU" , CMD_SetCPU },
3102
+ {"D" , CMD_DefSymbol },
3103
+ {"E" , CMD_ErrorPath },
3104
+ {"g" , CMD_DebugMode },
3105
+ {"G" , CMD_CodeOutput },
3106
+ {"GNUERRORS" , CMD_GNUErrors },
3107
+ {"h" , CMD_HexLowerCase },
3108
+ {"i" , CMD_IncludeList },
3109
+ {"I" , CMD_MakeIncludeList },
3110
+ {"L" , CMD_ListFile },
3111
+ {"l" , CMD_ListConsole },
3112
+ {"M" , CMD_MacroOutput },
3113
+ {"n" , CMD_NumericErrors },
3114
+ {"NOICEMASK" , CMD_NoICEMask },
3115
+ {"o" , CMD_OutFile },
3116
+ {"P" , CMD_MacProOutput },
3117
+ {"p" , CMD_SharePascal },
3118
+ {"q" , CMD_QuietMode },
3119
+ {"QUIET" , CMD_QuietMode },
3120
+ {"r" , CMD_MsgIfRepass },
3121
+ {"s" , CMD_SectionList },
3122
+ {"SHAREOUT" , CMD_ShareOutFile },
3123
+ {"OLIST" , CMD_ListOutFile },
3124
+ {"t" , CMD_ListMask },
3125
+ {"u" , CMD_UseList },
3126
+ {"U" , CMD_CaseSensitive },
3127
+ {"w" , CMD_SuppWarns },
3128
+ {"WARNRANGES" , CMD_HardRanges },
3129
+ {"x" , CMD_ExtendErrors },
3130
+ {"X" , CMD_MakeDebug },
3131
+ {"Y" , CMD_ThrowErrors }};
3062
3132
3063
3133
/*--------------------------------------------------------------------------*/
3064
3134
@@ -3204,6 +3274,7 @@ BEGIN
3204
3274
NumericErrors = False ; DebugMode = DebugNone ; CaseSensitive = False ;
3205
3275
ThrowErrors = False ; HardRanges = True ;
3206
3276
NoICEMask = 1 << SegCode ;
3277
+ GNUErrors = False ;
3207
3278
3208
3279
LineZ = 0 ;
3209
3280
0 commit comments