2 * ============================================================================
11 * This is the yacc file for the concurrency service script language.
14 * Torben Worm <tworm@cs.wustl.edu>
16 * ============================================================================
19 #include "CC_command.h"
21 #include "orbsvcs/CosConcurrencyControlC.h"
23 void yyerror (const char* s
);
27 extern
char line_buf
[500];
29 extern CC_CommandList
*cmdlist
;
34 CosConcurrencyControl
::lock_mode lock_mode
;
39 %token T_START_CMD T_CREATE_CMD T_LOCK_CMD T_UNLOCK_CMD T_TRYLOCK_CMD
40 %token T_CHANGEMODE_CMD T_SLEEP_CMD T_WAIT_CMD T_REPEAT_CMD T_EXCEP_CMD
41 %token T_PRINT_CMD T_LOOKUP_CMD T_TERM
42 %token T_READ T_IREAD T_UPGRADE T_WRITE T_IWRITE
43 %token
<id
> T_IDENT Q_STRING
47 %type
<id
> config_file_name lock_set_name exception_name
48 %type
<lock_mode
> lock_mode
52 | cmd_list
{ cmdlist
->add
(new CC_Sleep_Cmd
(0));
53 /* dummy to check exeption in the last command */
54 if
(cmdlist
->execute
()!=0) //CC_FAIL
55 { printf
(" ** Test succeded!!\n"); }
57 { printf
(" ** Test FAILED!!\n"); } }
60 cmd_list: cmd_list cmd
{ cmdlist
->add
($2); }
61 | cmd
{ cmdlist
->add
($1); }
64 cmd: T_START_CMD config_file_name T_TERM
65 { $$
= new CC_Start_Cmd
($2); }
66 | T_CREATE_CMD lock_set_name T_TERM
67 { $$
= new CC_CreateLockSet_Cmd
($2); }
69 { $$
= new CC_CreateLockSet_Cmd
(""); }
70 | T_LOCK_CMD lock_set_name lock_mode T_TERM
71 { $$
= new CC_Lock_Cmd
($2, $3); }
72 | T_LOCK_CMD lock_mode T_TERM
73 { $$
= new CC_Lock_Cmd
("", $2); }
74 | T_UNLOCK_CMD lock_set_name lock_mode T_TERM
75 { $$
= new CC_UnLock_Cmd
($2, $3); }
76 | T_UNLOCK_CMD lock_mode T_TERM
77 { $$
= new CC_UnLock_Cmd
("", $2); }
78 | T_TRYLOCK_CMD lock_set_name lock_mode T_TERM
79 { $$
= new CC_TryLock_Cmd
($2, $3); }
80 | T_TRYLOCK_CMD lock_mode T_TERM
81 { $$
= new CC_TryLock_Cmd
("", $2); }
82 | T_CHANGEMODE_CMD lock_set_name lock_mode lock_mode T_TERM
83 { $$
= new CC_ChangeMode_Cmd
($2, $3, $4); }
84 | T_CHANGEMODE_CMD lock_mode lock_mode T_TERM
85 { $$
= new CC_ChangeMode_Cmd
("", $2, $3); }
86 | T_SLEEP_CMD T_NUM T_TERM
87 { $$
= new CC_Sleep_Cmd
($2); }
89 { $$
= new CC_Wait_Cmd
(""); }
90 | T_WAIT_CMD Q_STRING T_TERM
91 { $$
= new CC_Wait_Cmd
($2); }
92 | T_PRINT_CMD Q_STRING T_TERM
93 { $$
= new CC_Print_Cmd
($2); }
94 | T_LOOKUP_CMD lock_set_name T_TERM
95 { $$
= new CC_Lookup_Cmd
($2); }
96 | T_REPEAT_CMD T_NUM T_TERM
97 { cmdlist
->setrepeat
($2);
98 $$
= new CC_Dummy_Cmd
();}
99 | T_EXCEP_CMD exception_name T_TERM
100 { $$
= new CC_Excep_Cmd
($2); }
103 config_file_name: T_IDENT
{$$
= $1; }
105 lock_set_name: T_IDENT
{$$
= $1; }
107 exception_name: T_IDENT
{$$
= $1; }
109 lock_mode: T_READ
{ $$
= CosConcurrencyControl
::read
; }
110 | T_IREAD
{ $$
= CosConcurrencyControl
::intention_read
; }
111 | T_UPGRADE
{ $$
= CosConcurrencyControl
::upgrade
; }
112 | T_WRITE
{ $$
= CosConcurrencyControl
::write
; }
113 | T_IWRITE
{ $$
= CosConcurrencyControl
::intention_write
; }
118 yyerror (const char *s
)
120 ACE_OS
::printf
("%d: %s at %s in:\n%s\n",