Skip to content

Commit 9989c69

Browse files
committed
Improve gdb by making rwm a variable in scanners
1 parent 8812aee commit 9989c69

File tree

5 files changed

+23
-15
lines changed

5 files changed

+23
-15
lines changed

src/rwlarglex.l

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
*
1313
* History
1414
*
15+
* bengsig 12-jun-2023 - Make rwm a variable in scanners
1516
* bengsig 10-aug-2022 - Output userhelp in order from rwl source file
1617
* bengsig 10-aug-2022 - Don't reorder useroption/userswitch
1718
* bengsig 04-jul-2022 - Restructure scan string, scan SQL code
@@ -39,10 +40,9 @@
3940
#include "rwldiprs.tab.h"
4041
#define YYSTYPE RWLZSTYPE
4142
#define YY_DECL sb4 rwlalex(void *yylval_param, void * yyscanner)
43+
#define YY_USER_ACTION { rwm = (yyget_extra(yyscanner)); }
4244

4345

44-
/* The rwm define is used to make code below legible */
45-
#define rwm (yyget_extra(yyscanner))
4646
// to avoid flex generating some code:
4747
// #define YY_NO_INPUT
4848

@@ -59,6 +59,11 @@
5959

6060
%%
6161

62+
%{
63+
rwl_main *rwm = 0; // will be set using YY_USER_ACTION
64+
%}
65+
66+
6267
(?i:administer[ \r\n]+key[ \r\n]+management) |
6368
(?i:associate[ \r\n]+statistics) |
6469
(?i:disassociate[ \r\n]+statistics) |

src/rwldilex.l

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
*
1515
* History
1616
*
17+
* bengsig 12-jun-2023 - Make rwm a variable in scanners
1718
* bengsig 25-may-2023 - Use rwlscanstring.c
1819
* bengsig 15-may-2023 - statisticsonly
1920
* bengsig 8-mar-2023 - Normal Distributed random
@@ -43,13 +44,12 @@
4344
#include "rwl.h"
4445
#include "rwldiprs.tab.h"
4546

46-
/* The rwm define is used to make code below legible */
47-
#define rwm (yyget_extra(yyscanner))
4847
// to avoid flex generating some code:
4948
#define YY_NO_INPUT
5049

5150
#define YYSTYPE RWLZSTYPE
5251
#define YY_DECL sb4 rwlzlex(void *yylval_param, void *yyscanner)
52+
#define YY_USER_ACTION { rwm = (yyget_extra(yyscanner)); }
5353
#define RWL_IN_DILEX // make rwlscanstring.c do the right thing
5454

5555
%}
@@ -60,6 +60,10 @@
6060

6161
%%
6262

63+
%{
64+
rwl_main *rwm = 0; // will be set using YY_USER_ACTION
65+
%}
66+
6367
\'(\\.|[^\\'])*\' { // copy from rwllexer.l
6468
rwlerror(rwm, RWL_ERROR_USE_QUOTE_FOR_STRING);
6569
rwm->badchar++;
@@ -399,8 +403,6 @@
399403

400404
%%
401405

402-
#undef rwm /* now outside flex code */
403-
404406
sb4 rwlzwrap(yyscan_t ys)
405407
{
406408
return 1;

src/rwllexer.l

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*
1212
* History
1313
*
14+
* bengsig 12-jun-2023 - Make rwm a variable in scanners
1415
* bengsig 15-may-2023 - statisticsonly, incorrect RWL-293
1516
* bengsig 2-may-2023 - $hostname: directive
1617
* bengsig 17-apr-2023 - Engineering notation output
@@ -91,11 +92,9 @@
9192
#include "rwl.h"
9293
#include "rwlparser.tab.h"
9394

94-
#define rwm (yyget_extra(yyscanner))
95-
9695
#define YYSTYPE RWLYSTYPE
9796
#define YY_DECL sb4 rwlylex(void *yylval_param, void *yyscanner)
98-
#define YY_USER_ACTION { rwm->loc.inpos += yyleng; }
97+
#define YY_USER_ACTION { rwm = (yyget_extra(yyscanner)); rwm->loc.inpos += yyleng; }
9998

10099
%}
101100

@@ -105,6 +104,10 @@
105104

106105
%%
107106

107+
%{
108+
rwl_main *rwm = 0; // will be set using YY_USER_ACTION
109+
%}
110+
108111
/* **************************************************************** */
109112
/* NOTE THAT ANY CHANGES HERE MUST BE KEPT IN SYNC WITH rwlarglex.l */
110113
/* **************************************************************** */
@@ -1529,8 +1532,6 @@
15291532

15301533
%%
15311534

1532-
#undef rwm /* now outside flex code */
1533-
15341535
/* this rouine must be here as it depends on #define
15351536
* and typedefs created by flex
15361537
*/

src/rwlscansql.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*
1414
* History
1515
*
16+
* bengsig 12-jun-2023 - Make rwm a variable in scanners
1617
* bengsig 04-jul-2022 - Scan sql and pl/sql in lexer
1718
*/
1819

@@ -33,8 +34,7 @@
3334
ub4 rwlscansql(void)
3435
#endif
3536
{
36-
rwl_main *rwmhere = rwm; // just for the debugger
37-
rwmhere->sqlbuffer[0] = 0;
37+
rwm->sqlbuffer[0] = 0;
3838
ub8 l, len;
3939
text *p;
4040
sb4 curr, next;

src/rwlscanstring.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*
1414
* History
1515
*
16+
* bengsig 12-jun-2023 - Make rwm a variable in scanners
1617
* bengsig 25-may-2023 - Also use in rwldilex.l
1718
* bengsig 04-jul-2022 - Creation
1819
*/
@@ -25,9 +26,8 @@
2526
ub4 rwlscanstring(void)
2627
#endif
2728
{
28-
rwl_main *rwmhere = rwm; // just a debugger aid
2929
text *in, *ut;
30-
rwmhere->loc.inpos -= yyleng-1; // make error below correct
30+
rwm->loc.inpos -= yyleng-1; // make error below correct
3131
/* copy string and remove " at ends */
3232
rwm->sval = rwlstrdup(rwm, (text *)yytext+1);
3333
if ('"' == yytext[yyleng-1])

0 commit comments

Comments
 (0)