78#define RUNSTACK_MAX_PARMS 9
84#define RUNSTACK_MAX_NEST 512
89#define RUNSTACK_MAX_LOOP 65535
99typedef enum runstack_src_t_ {
108typedef enum runstack_condtype_t_ {
116typedef enum runstack_ifstate_t_ {
125typedef enum runstack_loopstate_t_ {
133typedef enum runstack_queue_type_t_ {
143typedef struct runstack_ifcb_t_ {
153typedef struct runstack_line_t_ {
160typedef struct runstack_loopcb_t_ {
206typedef struct runstack_condcb_t_ {
226typedef struct runstack_entry_t_ {
256typedef struct runstack_context_t_ {
325 const xmlChar *source,
480 const xmlChar *line);
543 struct xpath_pcb_t_ *xpathpcb,
616 dlq_hdr_t *sessionQ);
dlq provides general double-linked list and queue support:
status_t
global error return code
Definition: status_enum.h:210
status_t runstack_handle_if(runstack_context_t *rcxt, boolean startcond)
Handle the if command for the specific runstack context.
Definition: runstack.c:1622
void runstack_cleanup(void)
Cleanup this module.
Definition: runstack.c:1013
runstack_queue_type_t
different queues of variables for que selection
Definition: runstack.h:133
status_t runstack_handle_else(runstack_context_t *rcxt)
Handle the elsecommand for the specific runstack context.
Definition: runstack.c:1753
xmlChar * runstack_get_loop_cmd(runstack_context_t *rcxt, status_t *res)
Get the next command during loop processing.
Definition: runstack.c:1282
void runstack_cancel(runstack_context_t *rcxt)
Cancel all running scripts.
Definition: runstack.c:870
runstack_src_t runstack_get_source(runstack_context_t *rcxt)
Get the current input source for the runstack context.
Definition: runstack.c:1176
xmlChar * runstack_get_cmd(runstack_context_t *rcxt, status_t *res)
Read the current runstack context and construct a command string for processing by do_run_script.
Definition: runstack.c:701
dlq_hdr_t * runstack_get_parm_que(runstack_context_t *rcxt)
Get the parameter queue for the current stack level.
Definition: runstack.c:967
runstack_ifstate_t
keep track of the if,elif,else,end sequence
Definition: runstack.h:116
runstack_context_t * runstack_new_context(void)
Malloc and init a new runstack context.
Definition: runstack.c:1121
void runstack_init(void)
Initialize this module.
Definition: runstack.c:997
void runstack_set_groupQ(runstack_context_t *rcxt, dlq_hdr_t *groupQ)
Set the current group-specific variable Q.
Definition: runstack.c:1971
dlq_hdr_t * runstack_get_que(runstack_context_t *rcxt, runstack_queue_type_t quetype)
Read the current runstack context and figure out which queue to get.
Definition: runstack.c:918
runstack_condtype_t
identify the runstack conditional control block type
Definition: runstack.h:108
boolean runstack_get_cond_state(runstack_context_t *rcxt)
Get the current conditional code state for the context.
Definition: runstack.c:1499
void runstack_free_context(runstack_context_t *rcxt)
Clean and free the runstack context.
Definition: runstack.c:1070
runstack_src_t
identify the runstack input source
Definition: runstack.h:99
status_t runstack_handle_elif(runstack_context_t *rcxt, boolean startcond)
Handle the elif command for the specific runstack context.
Definition: runstack.c:1669
void runstack_set_sessionQ(runstack_context_t *rcxt, dlq_hdr_t *sessionQ)
Set the current session-specific variable Q.
Definition: runstack.c:1947
status_t runstack_handle_while(runstack_context_t *rcxt, uint32 maxloops, struct xpath_pcb_t_ *xpathpcb, val_value_t *docroot)
Process the current command, which is a 'while' command.
runstack_loopstate_t
keep track of the while,end sequence
Definition: runstack.h:125
void runstack_pop(runstack_context_t *rcxt)
Remove a script nest level context from the stack Call just after script is completed.
Definition: runstack.c:632
status_t runstack_push(runstack_context_t *rcxt, const xmlChar *source, FILE *fp)
Add a script nest level context to the stack.
Definition: runstack.c:543
void runstack_clean_context(runstack_context_t *rcxt)
Clean the runstack context.
Definition: runstack.c:1030
uint32 runstack_level(runstack_context_t *rcxt)
Get the current stack level.
Definition: runstack.c:514
void runstack_init_context(runstack_context_t *rcxt)
Initialize a pre-malloced runstack context.
Definition: runstack.c:1092
status_t runstack_save_line(runstack_context_t *rcxt, const xmlChar *line)
Save the current line if needed if a loop is active.
Definition: runstack.c:1200
void runstack_session_cleanup(runstack_context_t *rcxt)
Cleanup after a yangcli session has ended.
Definition: runstack.c:1145
status_t runstack_handle_end(runstack_context_t *rcxt)
Handle the end command for the specific runstack context.
Definition: runstack.c:1823
void runstack_clear_cancel(runstack_context_t *rcxt)
Clear the cancel flags.
Definition: runstack.c:890
boolean runstack_get_if_used(runstack_context_t *rcxt)
Check if the run context, which should be inside an if-stmt now, has used the 'true' block already.
Definition: runstack.c:1913
@ RUNSTACK_QUE_GROUP
group variables
Definition: runstack.h:137
@ RUNSTACK_QUE_LOCAL
local variables
Definition: runstack.h:135
@ RUNSTACK_QUE_GLOBAL
global variables
Definition: runstack.h:138
@ RUNSTACK_QUE_SESSION
session variables
Definition: runstack.h:136
@ RUNSTACK_QUE_NONE
not set
Definition: runstack.h:134
@ RUNSTACK_IF_IF
if state
Definition: runstack.h:118
@ RUNSTACK_IF_NONE
not set
Definition: runstack.h:117
@ RUNSTACK_IF_ELSE
else state
Definition: runstack.h:120
@ RUNSTACK_IF_ELIF
elif state
Definition: runstack.h:119
@ RUNSTACK_COND_NONE
not set
Definition: runstack.h:109
@ RUNSTACK_COND_LOOP
while loop condition
Definition: runstack.h:111
@ RUNSTACK_COND_IF
if-stmt condition
Definition: runstack.h:110
@ RUNSTACK_SRC_NONE
not set
Definition: runstack.h:100
@ RUNSTACK_SRC_SCRIPT
source is a yangcli script
Definition: runstack.h:102
@ RUNSTACK_SRC_USER
source is interactive input
Definition: runstack.h:101
@ RUNSTACK_SRC_LOOP
source is captured from a loop
Definition: runstack.h:103
@ RUNSTACK_LOOP_NONE
not set
Definition: runstack.h:126
@ RUNSTACK_LOOP_COLLECTING
collecting loop commands
Definition: runstack.h:127
@ RUNSTACK_LOOP_LOOPING
playing loop commands
Definition: runstack.h:128
Global error messages for status code enumerations.
control the looping for 1 while - end sequence
Definition: runstack.h:206
runstack_condtype_t cond_type
condition type
Definition: runstack.h:211
dlq_hdr_t qhdr
queue header
Definition: runstack.h:208
Main runstact context control block used by yangcli to process script input loops and conditional sta...
Definition: runstack.h:256
boolean cond_state
current conditional state
Definition: runstack.h:258
runstack_src_t cur_src
current input source
Definition: runstack.h:270
dlq_hdr_t * groupQ
group variables for this runstack
Definition: runstack.h:288
dlq_hdr_t * sessionQ
session variables for this runstack
Definition: runstack.h:285
dlq_hdr_t runstackQ
each stack level has an entry
Definition: runstack.h:273
dlq_hdr_t globalQ
global variables for this runstack context
Definition: runstack.h:276
uint32 max_script_level
maximum script depth level
Definition: runstack.h:267
uint32 script_level
current script depth devel
Definition: runstack.h:264
dlq_hdr_t zeroQ
local variables for level 0 in the runstack
Definition: runstack.h:279
dlq_hdr_t zero_condcbQ
conditions for level zero in the runstack
Definition: runstack.h:282
boolean script_cancel
script cancel requested
Definition: runstack.h:261
one script run level context entry each time a 'run script' command is encountered,...
Definition: runstack.h:226
xmlChar * buff
buffer to store input
Definition: runstack.h:239
dlq_hdr_t condcbQ
Q of runstack_condcb_t.
Definition: runstack.h:248
xmlChar * source
filespec for input
Definition: runstack.h:236
dlq_hdr_t qhdr
queue header
Definition: runstack.h:227
int bufflen
length of buffer
Definition: runstack.h:242
dlq_hdr_t parmQ
Q of ncx_var_t.
Definition: runstack.h:246
FILE * fp
file open for input
Definition: runstack.h:233
dlq_hdr_t varQ
Q of ncx_var_t.
Definition: runstack.h:247
uint32 linenum
current line number
Definition: runstack.h:245
uint32 level
current runsack level
Definition: runstack.h:230
control the conditional state for 1 if...end sequence
Definition: runstack.h:143
boolean curcond
current condition
Definition: runstack.h:147
boolean parentcond
parent condition
Definition: runstack.h:145
runstack_ifstate_t ifstate
if state
Definition: runstack.h:144
boolean ifused
T already used up.
Definition: runstack.h:148
boolean startcond
start condition
Definition: runstack.h:146
save 1 line for looping purposes
Definition: runstack.h:153
xmlChar * line
malloced line of text
Definition: runstack.h:155
dlq_hdr_t qhdr
queue header
Definition: runstack.h:154
control the looping for 1 while - end sequence
Definition: runstack.h:160
runstack_line_t * cur_line
current line for loop processing
Definition: runstack.h:192
uint32 maxloops
max number of loops allowed
Definition: runstack.h:162
struct runstack_loopcb_t_ * collector
if the collector is non-NULL, then save lines in this outer while loop
Definition: runstack.h:182
val_value_t * docroot
document root for XPath expression
Definition: runstack.h:177
uint32 loop_count
current loop count
Definition: runstack.h:165
dlq_hdr_t lineQ
this Q will only be used if collector is NULL
Definition: runstack.h:201
struct xpath_pcb_t_ * xpathpcb
condition to evaluate before each loop iteration
Definition: runstack.h:174
boolean empty_block
true if empty command block
Definition: runstack.h:198
runstack_line_t * first_line
these may point to entries in this lineQ or the collector's lineQ; only the commands that are part of...
Definition: runstack.h:189
runstack_loopstate_t loop_state
current loop state
Definition: runstack.h:168
runstack_line_t * last_line
last line for loop processing
Definition: runstack.h:195
boolean startcond
start condition state
Definition: runstack.h:171
one value to match one type
Definition: val.h:912
loop or if-stmt condition used but not both
Definition: runstack.h:214
runstack_loopcb_t loopcb
loop control block
Definition: runstack.h:215
runstack_ifcb_t ifcb
if control block
Definition: runstack.h:216
Value Node Basic Support.