forked from filebench/filebench
-
Notifications
You must be signed in to change notification settings - Fork 0
/
parser_gram.y
3224 lines (2709 loc) · 71.4 KB
/
parser_gram.y
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Portions Copyright 2008 Denis Cheng
*/
%{
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <float.h>
#include <limits.h>
#include <signal.h>
#include <errno.h>
#include <sys/types.h>
#include <locale.h>
#include <sys/utsname.h>
#include <sys/statvfs.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/wait.h>
#include "parsertypes.h"
#include "filebench.h"
#include "utils.h"
#include "stats.h"
#include "vars.h"
#include "eventgen.h"
#include "aslr.h"
#include "multi_client_sync.h"
/* yacc and lex externals */
extern FILE *yyin;
extern int yydebug;
extern void yyerror(char *s);
extern int yylex(void);
/* executable name to execute worker processes later */
char *execname;
/* utilities */
static cmd_t *alloc_cmd(void);
static attr_t *alloc_attr(void);
static attr_t *alloc_lvar_attr(var_t *var);
static attr_t *get_attr(cmd_t *cmd, int64_t name);
static void get_attr_lvars(cmd_t *cmd, flowop_t *flowop);
static list_t *alloc_list();
static probtabent_t *alloc_probtabent(void);
static void add_lvar_to_list(var_t *newlvar, var_t **lvar_list);
/* Info Commands */
static void parser_fileset_list(cmd_t *);
static void parser_flowop_list(cmd_t *);
/* Define Commands */
static void parser_proc_define(cmd_t *);
static void parser_thread_define(cmd_t *, procflow_t *);
static void parser_flowop_define(cmd_t *, threadflow_t *, flowop_t **, int);
static void parser_composite_flowop_define(cmd_t *);
static void parser_file_define(cmd_t *);
static void parser_fileset_define(cmd_t *);
static void parser_var_assign_random(char *, cmd_t *);
static void parser_var_assign_custom(char *, cmd_t *);
/* Create Commands */
static void parser_fileset_create(cmd_t *);
/* Run Commands */
static void parser_run(cmd_t *cmd);
static void parser_run_variable(cmd_t *cmd);
static void parser_psrun(cmd_t *cmd);
/* Shutdown (Quit) Commands */
static void parser_filebench_shutdown(cmd_t *cmd);
/* Other Commands */
static void parser_echo(cmd_t *cmd);
static void parser_system(cmd_t *cmd);
static void parser_eventgen(cmd_t *cmd);
static void parser_enable_mc(cmd_t *cmd);
static void parser_domultisync(cmd_t *cmd);
static void parser_sleep(cmd_t *cmd);
static void parser_sleep_variable(cmd_t *cmd);
static void parser_version(cmd_t *cmd);
static void parser_enable_lathist(cmd_t *cmd);
%}
%union {
int64_t ival;
unsigned char bval;
char * sval;
avd_t avd;
cmd_t *cmd;
attr_t *attr;
list_t *list;
probtabent_t *rndtb;
}
%start commands
%token FSC_LIST FSC_DEFINE FSC_QUIT FSC_DEBUG FSC_CREATE FSC_SLEEP FSC_SET
%token FSC_SYSTEM FSC_EVENTGEN FSC_ECHO FSC_RUN FSC_PSRUN FSC_VERSION FSC_ENABLE
%token FSC_DOMULTISYNC
%token FSV_STRING FSV_VAL_POSINT FSV_VAL_NEGINT FSV_VAL_BOOLEAN FSV_VARIABLE
%token FSV_WHITESTRING FSV_RANDUNI FSV_RANDTAB FSV_URAND FSV_RAND48
%token FSE_FILE FSE_FILES FSE_FILESET FSE_PROC FSE_THREAD FSE_FLOWOP FSE_CVAR
%token FSE_RAND FSE_MODE FSE_MULTI
%token FSK_SEPLST FSK_OPENLST FSK_CLOSELST FSK_OPENPAR FSK_CLOSEPAR FSK_ASSIGN
%token FSK_IN FSK_QUOTE
%token FSA_SIZE FSA_PREALLOC FSA_PARALLOC FSA_PATH FSA_REUSE
%token FSA_MEMSIZE FSA_RATE FSA_READONLY FSA_TRUSTTREE
%token FSA_IOSIZE FSA_FILENAME FSA_WSS FSA_NAME FSA_RANDOM FSA_INSTANCES FSA_NODE
%token FSA_DSYNC FSA_TARGET FSA_ITERS FSA_NICE FSA_VALUE FSA_BLOCKING
%token FSA_HIGHWATER FSA_DIRECTIO FSA_DIRWIDTH FSA_FD FSA_SRCFD FSA_ROTATEFD
%token FSA_ENTRIES FSA_DIRDEPTHRV FSA_DIRGAMMA FSA_USEISM FSA_TYPE
%token FSA_LEAFDIRS FSA_INDEXED FSA_RANDTABLE FSA_RANDSRC FSA_ROUND
%token FSA_RANDSEED FSA_RANDGAMMA FSA_RANDMEAN FSA_MIN FSA_MAX FSA_MASTER
%token FSA_CLIENT FSS_TYPE FSS_SEED FSS_GAMMA FSS_MEAN FSS_MIN FSS_SRC FSS_ROUND
%token FSA_LVAR_ASSIGN FSA_ALLDONE FSA_FIRSTDONE FSA_TIMEOUT FSA_LATHIST
%token FSA_NOREADAHEAD FSA_IOPRIO FSA_WRITEONLY FSA_PARAMETERS FSA_NOUSESTATS
%type <ival> FSV_VAL_POSINT FSV_VAL_NEGINT
%type <bval> FSV_VAL_BOOLEAN
%type <sval> FSV_STRING FSV_WHITESTRING FSV_VARIABLE FSK_ASSIGN
%type <ival> FSC_DEFINE FSC_SET FSC_RUN FSC_ENABLE FSC_PSRUN
%type <ival> FSC_DOMULTISYNC
%type <ival> FSE_FILE FSE_FILES FSE_PROC FSE_THREAD FSC_VERSION
%type <sval> name
%type <cmd> command run_command list_command psrun_command
%type <cmd> proc_define_command files_define_command
%type <cmd> flowop_define_command debug_command create_command
%type <cmd> sleep_command set_command
%type <cmd> system_command flowop_command
%type <cmd> eventgen_command quit_command flowop_list thread_list
%type <cmd> thread echo_command
%type <cmd> version_command enable_command multisync_command
%type <cmd> set_variable set_random_variable set_custom_variable set_mode
%type <attr> fileset_attr_op fileset_attr_ops file_attr_ops file_attr_op p_attr_op t_attr_op p_attr_ops t_attr_ops
%type <attr> fo_attr_op fo_attr_ops ev_attr_op ev_attr_ops
%type <attr> randvar_attr_op randvar_attr_ops randvar_attr_typop
%type <attr> randvar_attr_srcop attr_value
%type <attr> comp_lvar_def comp_attr_op comp_attr_ops
%type <attr> enable_multi_ops enable_multi_op multisync_op
%type <attr> cvar_attr_ops cvar_attr_op
%type <list> whitevar_string whitevar_string_list
%type <ival> attrs_define_thread attrs_flowop
%type <ival> attrs_define_fileset attrs_define_file attrs_define_proc attrs_eventgen attrs_define_comp
%type <ival> randvar_attr_name FSA_TYPE randtype_name
%type <ival> randsrc_name FSA_RANDSRC em_attr_name
%type <ival> FSS_TYPE FSS_SEED FSS_GAMMA FSS_MEAN FSS_MIN FSS_SRC
%type <ival> cvar_attr_name
%type <rndtb> probtabentry_list probtabentry
%type <avd> var_int_val
%%
commands: commands command
{
if ($2->cmd)
$2->cmd($2);
free($2);
}
| commands error
{
YYABORT;
}
|;
command:
proc_define_command
| files_define_command
| flowop_define_command
| debug_command
| eventgen_command
| create_command
| echo_command
| list_command
| run_command
| psrun_command
| set_command
| quit_command
| sleep_command
| system_command
| version_command
| enable_command
| multisync_command
eventgen_command: FSC_EVENTGEN
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = &parser_eventgen;
}
| eventgen_command ev_attr_ops
{
$1->cmd_attr_list = $2;
};
system_command: FSC_SYSTEM whitevar_string_list
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd_param_list = $2;
$$->cmd = parser_system;
};
echo_command: FSC_ECHO whitevar_string_list
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd_param_list = $2;
$$->cmd = parser_echo;
};
version_command: FSC_VERSION
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = parser_version;
};
enable_command: FSC_ENABLE FSE_MULTI enable_multi_ops
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = parser_enable_mc;
$$->cmd_attr_list = $3;
}
| FSC_ENABLE FSA_LATHIST
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = parser_enable_lathist;
};
multisync_command: FSC_DOMULTISYNC multisync_op
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = parser_domultisync;
$$->cmd_attr_list = $2;
}
whitevar_string: FSK_QUOTE FSV_VARIABLE
{
if (($$ = alloc_list()) == NULL)
YYERROR;
$$->list_string = avd_str_alloc($2);
}
| FSK_QUOTE FSV_WHITESTRING
{
if (($$ = alloc_list()) == NULL)
YYERROR;
$$->list_string = avd_str_alloc($2);
};
whitevar_string_list: whitevar_string FSV_WHITESTRING
{
list_t *list = NULL;
list_t *list_end = NULL;
/* Add string */
if (($$ = alloc_list()) == NULL)
YYERROR;
$$->list_string = avd_str_alloc($2);
/* Find end of list */
for (list = $1; list != NULL;
list = list->list_next)
list_end = list;
list_end->list_next = $$;
$$ = $1;
}| whitevar_string FSV_VARIABLE
{
list_t *list = NULL;
list_t *list_end = NULL;
/* Add variable */
if (($$ = alloc_list()) == NULL)
YYERROR;
$$->list_string = avd_str_alloc($2);
/* Find end of list */
for (list = $1; list != NULL;
list = list->list_next)
list_end = list;
list_end->list_next = $$;
$$ = $1;
}| whitevar_string_list FSV_WHITESTRING
{
list_t *list = NULL;
list_t *list_end = NULL;
/* Add string */
if (($$ = alloc_list()) == NULL)
YYERROR;
$$->list_string = avd_str_alloc($2);
/* Find end of list */
for (list = $1; list != NULL;
list = list->list_next)
list_end = list;
list_end->list_next = $$;
$$ = $1;
}| whitevar_string_list FSV_VARIABLE
{
list_t *list = NULL;
list_t *list_end = NULL;
/* Add variable */
if (($$ = alloc_list()) == NULL)
YYERROR;
$$->list_string = avd_str_alloc($2);
/* Find end of list */
for (list = $1; list != NULL;
list = list->list_next)
list_end = list;
list_end->list_next = $$;
$$ = $1;
}| whitevar_string_list FSK_QUOTE
{
$$ = $1;
}| whitevar_string FSK_QUOTE
{
$$ = $1;
};
list_command: FSC_LIST FSE_FILESET
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = &parser_fileset_list;
}
| FSC_LIST FSE_FLOWOP
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = &parser_flowop_list;
};
debug_command: FSC_DEBUG FSV_VAL_POSINT
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = NULL;
filebench_shm->shm_debug_level = $2;
if (filebench_shm->shm_debug_level > 10) {
filebench_log(LOG_ERROR, "Debug level set out of range."
" Adjusting to 10.");
filebench_shm->shm_debug_level = 10;
}
if (filebench_shm->shm_debug_level > 9)
yydebug = 1;
};
set_command: set_variable | set_random_variable | set_custom_variable | set_mode;
set_variable: FSC_SET FSV_VARIABLE FSK_ASSIGN FSV_VAL_POSINT
{
$$ = alloc_cmd();
if (!$$)
YYERROR;
var_assign_integer($2, $4);
$$->cmd = NULL;
}
|
FSC_SET FSV_VARIABLE FSK_ASSIGN FSV_VAL_BOOLEAN
{
$$ = alloc_cmd();
if (!$$)
YYERROR;
var_assign_boolean($2, $4);
$$->cmd = NULL;
}
| FSC_SET FSV_VARIABLE FSK_ASSIGN FSK_QUOTE FSV_WHITESTRING FSK_QUOTE
{
$$ = alloc_cmd();
if (!$$)
YYERROR;
var_assign_string($2, $5);
$$->cmd = NULL;
}
| FSC_SET FSV_VARIABLE FSK_ASSIGN FSV_STRING
{
$$ = alloc_cmd();
if (!$$)
YYERROR;
var_assign_string($2, $4);
$$->cmd = NULL;
};
set_random_variable: FSC_SET FSV_VARIABLE FSK_ASSIGN FSE_RAND FSK_OPENPAR randvar_attr_ops FSK_CLOSEPAR
{
$$ = alloc_cmd();
if (!$$)
YYERROR;
$$->cmd_attr_list = $6;
$$->cmd = NULL;
parser_var_assign_random($2, $$);
}
set_custom_variable: FSC_SET FSV_VARIABLE FSK_ASSIGN FSE_CVAR FSK_OPENPAR cvar_attr_ops FSK_CLOSEPAR
{
$$ = alloc_cmd();
if (!$$)
YYERROR;
$$->cmd_attr_list = $6;
$$->cmd = NULL;
parser_var_assign_custom($2, $$);
};
set_mode: FSC_SET FSE_MODE FSC_QUIT FSA_TIMEOUT
{
$$ = alloc_cmd();
if (!$$)
YYERROR;
filebench_shm->shm_rmode = FILEBENCH_MODE_TIMEOUT;
$$->cmd = NULL;
}
| FSC_SET FSE_MODE FSC_QUIT FSA_ALLDONE
{
$$ = alloc_cmd();
if (!$$)
YYERROR;
filebench_shm->shm_rmode = FILEBENCH_MODE_QALLDONE;
$$->cmd = NULL;
}
| FSC_SET FSE_MODE FSC_QUIT FSA_FIRSTDONE
{
$$ = alloc_cmd();
if (!$$)
YYERROR;
filebench_shm->shm_rmode = FILEBENCH_MODE_Q1STDONE;
$$->cmd = NULL;
}
| FSC_SET FSE_MODE FSA_NOUSESTATS
{
$$ = alloc_cmd();
if (!$$)
YYERROR;
filebench_log(LOG_INFO, "Disabling CPU usage statistics");
filebench_shm->shm_mmode |= FILEBENCH_MODE_NOUSAGE;
$$->cmd = NULL;
};
quit_command: FSC_QUIT
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = parser_filebench_shutdown;
};
flowop_list: flowop_command
{
$$ = $1;
}| flowop_list flowop_command
{
cmd_t *list = NULL;
cmd_t *list_end = NULL;
/* Find end of list */
for (list = $1; list != NULL;
list = list->cmd_next)
list_end = list;
list_end->cmd_next = $2;
filebench_log(LOG_DEBUG_IMPL,
"flowop_list adding cmd %zx to list %zx", $2, $1);
$$ = $1;
};
thread: FSE_THREAD t_attr_ops FSK_OPENLST flowop_list FSK_CLOSELST
{
/*
* Allocate a cmd node per thread, with a
* list of flowops attached to the cmd_list
*/
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd_list = $4;
$$->cmd_attr_list = $2;
};
thread_list: thread
{
$$ = $1;
}| thread_list thread
{
cmd_t *list = NULL;
cmd_t *list_end = NULL;
/* Find end of list */
for (list = $1; list != NULL;
list = list->cmd_next)
list_end = list;
list_end->cmd_next = $2;
filebench_log(LOG_DEBUG_IMPL,
"thread_list adding cmd %zx to list %zx", $2, $1);
$$ = $1;
};
proc_define_command: FSC_DEFINE FSE_PROC p_attr_ops FSK_OPENLST thread_list FSK_CLOSELST
{
$$ = alloc_cmd();
if (!$$)
YYERROR;
$$->cmd = &parser_proc_define;
$$->cmd_list = $5;
$$->cmd_attr_list = $3;
}
files_define_command: FSC_DEFINE FSE_FILE file_attr_ops
{
$$ = alloc_cmd();
if (!$$)
YYERROR;
$$->cmd = &parser_file_define;
$$->cmd_attr_list = $3;
}| FSC_DEFINE FSE_FILESET fileset_attr_ops
{
$$ = alloc_cmd();
if (!$$)
YYERROR;
$$->cmd = &parser_fileset_define;
$$->cmd_attr_list = $3;
}
create_command: FSC_CREATE FSE_FILES
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = &parser_fileset_create;
};
sleep_command: FSC_SLEEP FSV_VAL_POSINT
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = parser_sleep;
$$->cmd_qty = $2;
}
| FSC_SLEEP FSV_VARIABLE
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = parser_sleep_variable;
$$->cmd_tgt1 = fb_stralloc($2);
}
run_command: FSC_RUN FSV_VAL_POSINT
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = parser_run;
$$->cmd_qty = $2;
}
| FSC_RUN FSV_VARIABLE
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = parser_run_variable;
$$->cmd_tgt1 = fb_stralloc($2);
}
| FSC_RUN
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = parser_run;
$$->cmd_qty = 0;
};
psrun_command: FSC_PSRUN
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = parser_psrun;
$$->cmd_qty1 = 0;
$$->cmd_qty = 0;
}
| FSC_PSRUN FSV_VAL_NEGINT
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = parser_psrun;
$$->cmd_qty1 = $2;
$$->cmd_qty = 0;
}
| FSC_PSRUN FSV_VAL_POSINT
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = parser_psrun;
$$->cmd_qty1 = $2;
$$->cmd_qty = 0;
}
| FSC_PSRUN FSV_VAL_NEGINT FSV_VAL_POSINT
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = parser_psrun;
$$->cmd_qty1 = $2;
$$->cmd_qty = $3;
}
| FSC_PSRUN FSV_VAL_POSINT FSV_VAL_POSINT
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd = parser_psrun;
$$->cmd_qty1 = $2;
$$->cmd_qty = $3;
};
flowop_command: FSE_FLOWOP name
{
if (($$ = alloc_cmd()) == NULL)
YYERROR;
$$->cmd_name = fb_stralloc($2);
}
| flowop_command fo_attr_ops
{
$1->cmd_attr_list = $2;
};
name: FSV_STRING;
file_attr_ops: file_attr_op
{
$$ = $1;
}
| file_attr_ops FSK_SEPLST file_attr_op
{
attr_t *attr = NULL;
attr_t *list_end = NULL;
for (attr = $1; attr; attr = attr->attr_next)
list_end = attr;
list_end->attr_next = $3;
$$ = $1;
};
fileset_attr_ops: fileset_attr_op
{
$$ = $1;
}
| fileset_attr_ops FSK_SEPLST fileset_attr_op
{
attr_t *attr = NULL;
attr_t *list_end = NULL;
for (attr = $1; attr; attr = attr->attr_next)
list_end = attr;
list_end->attr_next = $3;
$$ = $1;
};
file_attr_op: attrs_define_file FSK_ASSIGN attr_value
{
$$ = $3;
$$->attr_name = $1;
}
| attrs_define_file
{
$$ = alloc_attr();
if (!$$)
YYERROR;
$$->attr_name = $1;
$$->attr_avd = avd_bool_alloc(TRUE);
};
fileset_attr_op: attrs_define_fileset FSK_ASSIGN attr_value
{
$$ = $3;
$$->attr_name = $1;
}
| attrs_define_fileset
{
$$ = alloc_attr();
if (!$$)
YYERROR;
$$->attr_name = $1;
$$->attr_avd = avd_bool_alloc(TRUE);
};
/* attribute parsing for random variables */
randvar_attr_ops: randvar_attr_op
{
$$ = $1;
}
| randvar_attr_ops FSK_SEPLST randvar_attr_op
{
attr_t *attr = NULL;
attr_t *list_end = NULL;
for (attr = $1; attr != NULL;
attr = attr->attr_next)
list_end = attr; /* Find end of list */
list_end->attr_next = $3;
$$ = $1;
}
| randvar_attr_ops FSK_SEPLST FSA_RANDTABLE FSK_ASSIGN FSK_OPENLST probtabentry_list FSK_CLOSELST
{
attr_t *attr = NULL;
attr_t *list_end = NULL;
for (attr = $1; attr != NULL;
attr = attr->attr_next)
list_end = attr; /* Find end of list */
if ((attr = alloc_attr()) == NULL)
YYERROR;
attr->attr_name = FSA_RANDTABLE;
attr->attr_obj = (void *)$6;
list_end->attr_next = attr;
$$ = $1;
};
randvar_attr_op: randvar_attr_name FSK_ASSIGN attr_value
{
$$ = $3;
$$->attr_name = $1;
}
| randvar_attr_name
{
if (($$ = alloc_attr()) == NULL)
YYERROR;
$$->attr_name = $1;
$$->attr_avd = avd_bool_alloc(TRUE);
}
| FSA_TYPE FSK_ASSIGN randvar_attr_typop
{
$$ = $3;
$$->attr_name = FSA_TYPE;
}
| FSA_RANDSRC FSK_ASSIGN randvar_attr_srcop
{
$$ = $3;
$$->attr_name = FSA_RANDSRC;
};
probtabentry: FSK_OPENLST var_int_val FSK_SEPLST var_int_val FSK_SEPLST var_int_val FSK_CLOSELST
{
if (($$ = alloc_probtabent()) == NULL)
YYERROR;
$$->pte_percent = $2;
$$->pte_segmin = $4;
$$->pte_segmax = $6;
};
/* attribute parsing for prob density function table */
probtabentry_list: probtabentry
{
$$ = $1;
}
| probtabentry_list FSK_SEPLST probtabentry
{
probtabent_t *pte = NULL;
probtabent_t *ptelist_end = NULL;
for (pte = $1; pte != NULL;
pte = pte->pte_next)
ptelist_end = pte; /* Find end of prob table entry list */
ptelist_end->pte_next = $3;
$$ = $1;
};
p_attr_ops: p_attr_op
{
$$ = $1;
}
| p_attr_ops FSK_SEPLST p_attr_op
{
attr_t *attr = NULL;
attr_t *list_end = NULL;
for (attr = $1; attr != NULL;
attr = attr->attr_next)
list_end = attr; /* Find end of list */
list_end->attr_next = $3;
$$ = $1;
};
p_attr_op: attrs_define_proc FSK_ASSIGN attr_value
{
$$ = $3;
$$->attr_name = $1;
}
| attrs_define_proc
{
$$ = alloc_attr();
if (!$$)
YYERROR;
$$->attr_name = $1;
$$->attr_avd = avd_bool_alloc(TRUE);
};
/* attribute parsing thread options */
t_attr_ops: t_attr_op
{
$$ = $1;
}
| t_attr_ops FSK_SEPLST t_attr_op
{
attr_t *attr = NULL;
attr_t *list_end = NULL;
for (attr = $1; attr != NULL;
attr = attr->attr_next)
list_end = attr; /* Find end of list */
list_end->attr_next = $3;
$$ = $1;
};
t_attr_op: attrs_define_thread FSK_ASSIGN attr_value
{
$$ = $3;
$$->attr_name = $1;
}
| attrs_define_thread
{
if (($$ = alloc_attr()) == NULL)
YYERROR;
$$->attr_name = $1;
$$->attr_avd = avd_bool_alloc(TRUE);
};
/* attribute parsing for flowops */
fo_attr_ops: fo_attr_op
{
$$ = $1;
}
| fo_attr_ops FSK_SEPLST fo_attr_op
{
attr_t *attr = NULL;
attr_t *list_end = NULL;
for (attr = $1; attr != NULL;
attr = attr->attr_next)
list_end = attr; /* Find end of list */
list_end->attr_next = $3;
$$ = $1;
}
| fo_attr_ops FSK_SEPLST comp_lvar_def
{
attr_t *attr = NULL;
attr_t *list_end = NULL;
for (attr = $1; attr != NULL;
attr = attr->attr_next)
list_end = attr; /* Find end of list */
list_end->attr_next = $3;
$$ = $1;
};
fo_attr_op: attrs_flowop FSK_ASSIGN attr_value
{
$$ = $3;
$$->attr_name = $1;
}
| attrs_flowop
{
if (($$ = alloc_attr()) == NULL)
YYERROR;
$$->attr_name = $1;
$$->attr_avd = avd_bool_alloc(TRUE);
};
/* attribute parsing for Event Generator */
ev_attr_ops: ev_attr_op
{
$$ = $1;
}
| ev_attr_ops FSK_SEPLST ev_attr_op
{
attr_t *attr = NULL;
attr_t *list_end = NULL;
for (attr = $1; attr != NULL;
attr = attr->attr_next)
list_end = attr; /* Find end of list */
list_end->attr_next = $3;
$$ = $1;
};
ev_attr_op: attrs_eventgen FSK_ASSIGN attr_value
{
$$ = $3;
$$->attr_name = $1;
}
| attrs_eventgen
{
if (($$ = alloc_attr()) == NULL)
YYERROR;
$$->attr_name = $1;
$$->attr_avd = avd_bool_alloc(TRUE);
};
/* attribute parsing for enable multiple client command */
enable_multi_ops: enable_multi_op