Skip to content

Commit 075d4d0

Browse files
committed
Improve some comments
1 parent 8219da4 commit 075d4d0

File tree

2 files changed

+17
-49
lines changed

2 files changed

+17
-49
lines changed

src/rwl.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*
1212
* History
1313
*
14+
* bengsig 27-may-2024 - Improve some comments
1415
* bengsig 17-apr-2024 - nostatistics statement
1516
* bengsig 16-apr-2024 - bit operation on clflags, -=
1617
* bengsig 4-apr-2024 - $oraerror:showoci directive
@@ -356,11 +357,11 @@ extern int nanosleep(struct timespec *, int);
356357

357358
struct rwl_option
358359
{
359-
const char *longn;
360+
const char *longn; // long name e.g. --version
360361
ub4 optbits;
361362
#define RWL_OPT_NOLARG 0
362363
#define RWL_OPT_HASARG 0x00000001 // option must have agument
363-
ub4 shortn;
364+
ub4 shortn; // short name e.g. 'v'
364365
};
365366

366367

@@ -489,6 +490,7 @@ struct rwl_cinfo
489490
text serverr[RWL_DB_SERVERR_LEN]; //
490491
};
491492

493+
// How was a string allocated in rwl_value
492494
enum rwl_vsalloc
493495
{
494496
RWL_SVALLOC_NOT = 0 /* no buffer allocated this MUST have value 0 */
@@ -829,6 +831,7 @@ struct rwl_arglist
829831
};
830832
#define RWL_USER_ARG_OFFSET 500 // offset from ordinary option val in struct option
831833

834+
// RWLOADSIM_PATH
832835
struct rwl_pathlist
833836
{
834837
text *pathname; // name of entry in RWLOADISM_PATH
@@ -1296,12 +1299,14 @@ struct rwl_main
12961299
text sqlbuffer[RWL_MAXSQL+2]; /* text of last SQL */
12971300
} ;
12981301

1302+
// Linked list of contatenation, currently used by rwldoprintf
12991303
struct rwl_conlist
13001304
{
13011305
rwl_estack *estk; // expression
13021306
rwl_conlist *connxt; // linked list pointer
13031307
};
13041308

1309+
// Link list of identifiers, e.g. used for rwlreadline
13051310
struct rwl_idlist
13061311
{
13071312
sb4 idnum; // variable number
@@ -1415,6 +1420,7 @@ struct rwl_localvar
14151420
rwl_type atype; /* the type of the argument */
14161421
};
14171422

1423+
// All operators in the RPN evaluations stack
14181424
enum rwl_stack_t
14191425
{
14201426
RWL_STACK_notinuse = 0
@@ -1662,6 +1668,7 @@ enum rwl_code_t
16621668
, RWL_CODE_SQLEND // return from something with database calls - ceptr1 is variable name (of procedure), ceint2 location guess
16631669
};
16641670

1671+
// Entries in the p-code array
16651672
struct rwl_code
16661673
{
16671674
rwl_code_t ctyp; /* operator - code type */
@@ -1701,7 +1708,9 @@ struct rwl_rastvar /* random string as a variable */
17011708
/* Internal variable names
17021709
* Note that "runseconds" to the user is like
17031710
* a read-only variable, while it really is a
1704-
* function without arguments
1711+
* function without arguments. It should be given
1712+
* by the user as runseconds() as if it were a
1713+
* function
17051714
*/
17061715
#define RWL_LOOPNUMBER_VAR (text *)"loopnumber"
17071716
#define RWL_THREADNUMBER_VAR (text *)"threadnumber"
@@ -1753,7 +1762,6 @@ struct rwl_histogram
17531762
/* execution time statistics structure */
17541763
struct rwl_stats
17551764
{
1756-
//rwl_mutex *mutex_stats; // moved to rwl_identifier due to RWL-600 [rwlmutexget-notinit]
17571765
double wtime, etime, atime, dtime; // wait exec, application time
17581766
ub4 *persec; /* array of per second counters */
17591767
double *wtimsum; // array of per second wait time
@@ -1814,6 +1822,7 @@ extern void rwlexprdestroy(rwl_main *, rwl_estack *);
18141822
// rwlexprbic: vvv -= (vvv/bbb)%2 ? bbb : 0
18151823
// note that bbb must be rwl_onep, rwl_twop, rwl_fourp, etc
18161824
//
1825+
// They can be much simplified once we get bitwise operators
18171826
#define rwlexprbis(rwm, vvv, bbb) \
18181827
/* vvv */ rwlexprpush(rwm, vvv, RWL_STACK_VAR); \
18191828
/* bbb */ rwlexprpush(rwm, bbb, RWL_STACK_NUM); \

src/rwlparser.y

Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@
160160
*/
161161
#define rwlyrwmscanner rwm->rwlyscanner
162162

163+
// pretty print parser syntax errors
163164
struct rwl_yt2txt
164165
{
165166
const char *ytoken;
@@ -168,6 +169,7 @@ struct rwl_yt2txt
168169

169170
typedef struct rwl_yt2txt rwl_yt2txt;
170171

172+
// Note that this must be sorted by ytoken (first column)
171173
static const rwl_yt2txt rwlyt2[] =
172174
{
173175
{"RWL_T_ABORT", "'abort'"}
@@ -330,6 +332,7 @@ static const rwl_yt2txt rwlyt2[] =
330332
};
331333
#define RWL_TOK_COUNT (sizeof(rwlyt2)/sizeof(rwl_yt2txt))
332334

335+
// compare - used by bsearch
333336
static int rwlcmptok(const void *l1, const void *l2)
334337
{
335338
rwl_yt2txt *y1, *y2;
@@ -545,11 +548,6 @@ programelementlist:
545548
}
546549
;
547550

548-
/*
549-
-----------------------------------------------
550-
* complex declarations that can only be in main
551-
-----------------------------------------------
552-
*/
553551

554552
programelement:
555553
statement
@@ -561,7 +559,6 @@ programelement:
561559
{ rwlprintallvars(rwm); }
562560
| RWL_T_PRINTVAR printvarlist
563561
terminator
564-
565562
;
566563
/* end of programelement */
567564

@@ -856,44 +853,6 @@ dbspec:
856853
if (rwm->dbsav)
857854
bis(rwm->dbsav->flags, RWL_DB_DEFAULT);
858855
rwm->defdb = rwm->dbname;
859-
#ifdef NEVER
860-
// The default database should pick up any -X, -Y, -G, -g arguments
861-
if (rwm->argX)
862-
{
863-
rwm->dbsav->poolmax = rwm->argX;
864-
if (rwm->argY)
865-
rwm->dbsav->poolmin = rwm->argY;
866-
else
867-
rwm->dbsav->poolmin = 1;
868-
rwm->dbsav->pooltype = RWL_DBPOOL_SESSION;
869-
rwm->dbsav->pooltext = "sessionpool";
870-
if (bit(rwm->m3flags, RWL_P3_DEFRECONN|RWL_P3_DEFTHRDED))
871-
rwlerror(rwm, RWL_ERROR_DBPOOL_ALREADY);
872-
873-
}
874-
else
875-
{
876-
if (rwm->argY)
877-
rwlerror(rwm, RWL_ERROR_ONLY_POOL_MIN_SET);
878-
if (bit(rwm->m3flags, RWL_P3_DEFRECONN))
879-
{
880-
rwm->dbsav->pooltype = RWL_DBPOOL_RECONNECT;
881-
rwm->dbsav->pooltext = "reconnect";
882-
if (bit(rwm->m3flags, RWL_P3_DEFTHRDED))
883-
rwlerror(rwm, RWL_ERROR_DBPOOL_ALREADY);
884-
}
885-
else if (bit(rwm->m3flags, RWL_P3_DEFTHRDED))
886-
{
887-
rwm->dbsav->pooltype = RWL_DBPOOL_RETHRDED;
888-
rwm->dbsav->pooltext = "threads dedicated";
889-
}
890-
else
891-
{
892-
rwm->dbsav->pooltype = RWL_DBPOOL_DEDICATED;
893-
rwm->dbsav->pooltext = "dedicated";
894-
}
895-
}
896-
#endif
897856
}
898857
}
899858
| RWL_T_CONNECTIONPOOL compiletime_expression
@@ -1517,7 +1476,7 @@ Note that "concatenation" which is two expressions right after
15171476
each other (i.e. just omission of the || operator) causes a
15181477
well understood bison conflict. This is because e.g.
15191478
a - b
1520-
could be both a followed by -b (i.e. to concatenated expressions)
1479+
could be both a followed by -b (i.e. two concatenated expressions)
15211480
or it could be a-b (i.e. the subtraction). This shift/reduce conflict
15221481
in bison will solved by doing the shift so it is the subtraction.
15231482

0 commit comments

Comments
 (0)