1 /**************************************************************************/
2 /* Command line stuff */
3 /**************************************************************************/
5 int Illegal(); /* llegal command */
7 int Quit(); /* Quit test program */
8 int Help(); /* Help on commands */
9 int History(); /* History */
10 int Shell(); /* Shell command */
11 int Sleep(); /* Sleep seconds */
12 int Pause(); /* Pause keyboard */
13 int Atoms(); /* Atom list commands */
15 int RegisterCallback();
31 int EditSharedMemory();
34 int ShowDaemonEventLog();
35 int ShowDaemonEventHistory();
36 int ClearDaemonEventLog();
41 CmdNOCM
, /* llegal command */
43 CmdQUIT
, /* Quit test program */
44 CmdHELP
, /* Help on commands */
45 CmdHIST
, /* History */
46 CmdSHELL
, /* Shell command */
47 CmdSLEEP
, /* Sleep seconds */
48 CmdPAUSE
, /* Pause keyboard */
49 CmdATOMS
, /* Atom list commands */
51 CmdRGCB
, /* Register/Unregister callback */
53 CmdNDS
, /* Show all nodes */
66 CmdLDT
, /* Load table from disc */
67 CmdSVT
, /* Save table to dsic */
69 CmdESHM
, /* Edit table in shared memory */
75 CmdINIT
, /* Execute initialize protocol */
86 static Cmd cmds
[CmdCMDS
] = {
88 { CmdNOCM
, "???", "Illegal command" ,"" ,Illegal
},
90 { CmdQUIT
, "q" , "Quit test program" ,"" ,Quit
},
91 { CmdHELP
, "h" , "Help on commands" ,"" ,Help
},
92 { CmdHIST
, "his", "History" ,"" ,History
},
93 { CmdSHELL
, "sh", "Shell command" ,"UnixCmd" ,Shell
},
94 { CmdSLEEP
, "s" , "Sleep seconds" ,"Seconds" ,Sleep
},
95 { CmdPAUSE
, "z" , "Pause keyboard" ,"" ,Pause
},
96 { CmdATOMS
, "a" , "Atom list commands" ,"" ,Atoms
},
98 { CmdRGCB
,"rgcb","Register callback again" ,"?|<EvtMask>" ,RegisterCallback
},
99 { CmdNDS
, "nds" ,"Get all node Ids" ,"" ,GetAllNodeIds
},
100 { CmdTDS
, "tds" ,"Get table description" ,"<TbIdMsk>" ,GetTableDesc
},
101 { CmdWAIT
,"wait","Wait for callback" ,"" ,Wait
},
102 { CmdPOLL
,"poll","Poll for callback" ,"" ,Poll
},
103 { CmdSNDT
,"wsh" ,"Write shmem to xmem" ,"<TbId>" ,SendTable
},
104 { CmdRCVT
,"rsh" ,"Read shmem from xmem" ,"<TbId>" ,RecvTable
},
105 { CmdSMS
, "sms" ,"Send message" ,"?|<Type><NdIdMsk><Data>",SendMessage
},
106 { CmdCHKT
,"chkt","Check for table updates" ,"" ,CheckTables
},
107 { CmdLDT
, "ldsh","Load shmem table from disc","<TbId>" ,LoadTable
},
108 { CmdSVT
, "svsh","Save shmem table to disc" ,"<TbId>" ,SaveTable
},
109 { CmdESHM
,"esh" ,"Edit table shared memory" ,"<TbId>" ,EditSharedMemory
},
110 { CmdSDEL
,"sdel","Show daemon event log" ,"" ,ShowDaemonEventLog
},
111 { CmdSDEH
,"sdeh","Show daemon event history" ,"<NdId>" ,ShowDaemonEventHistory
},
112 { CmdCDEL
,"cdel","Clear daemon event log" ,"" ,ClearDaemonEventLog
},
113 { CmdKILD
,"kd" ,"Kill daemons" ,"<NdIdMsk>" ,KillDaemon
},
114 { CmdINIT
,"init","Start Initialize protocol" ,"" ,Init
}
121 OprNE
, OprEQ
, OprGT
, OprGE
, OprLT
, OprLE
, OprAS
,
122 OprPL
, OprMI
, OprTI
, OprDI
, OprAND
, OprOR
, OprXOR
,
123 OprNOT
, OprNEG
, OprLSH
, OprRSH
, OprINC
, OprDECR
, OprPOP
,
133 static Opr oprs
[OprOPRS
] = {
134 { OprNOOP
, "?" ,"Not an operator" },
135 { OprNE
, "#" ,"Not equal" },
136 { OprEQ
, "=" ,"Equal" },
137 { OprGT
, ">" ,"Greater than" },
138 { OprGE
, ">=" ,"Greater than or equal" },
139 { OprLT
, "<" ,"Less than" },
140 { OprLE
, "<=" ,"Less than or equal" },
141 { OprAS
, ":=" ,"Becomes equal" },
142 { OprPL
, "+" ,"Add" },
143 { OprMI
, "-" ,"Subtract" },
144 { OprTI
, "*" ,"Multiply" },
145 { OprDI
, "/" ,"Divide" },
146 { OprAND
, "&" ,"AND" },
147 { OprOR
, "!" ,"OR" },
148 { OprXOR
, "!!" ,"XOR" },
149 { OprNOT
, "##" ,"Ones Compliment" },
150 { OprNEG
, "#-" ,"Twos compliment" },
151 { OprLSH
, "<<" ,"Left shift" },
152 { OprRSH
, ">>" ,"Right shift" },
153 { OprINC
, "++" ,"Increment" },
154 { OprDECR
, "--" ,"Decrement" },
155 { OprPOP
, ";" ,"POP" },
156 { OprSTM
, "->" ,"PUSH" } };
158 static char atomhash
[256] = {
159 10,9,9,9,9,9,9,9,9,0,0,9,9,0,9 ,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
160 0 ,1,9,1,9,4,1,9,2,3,1,1,0,1,11,1,5,5,5,5,5,5,5,5,5,5,1,1,1,1,1,1,
161 10,6,6,6,6,6,6,6,6,6,6,6,6,6,6 ,6,6,6,6,6,6,6,6,6,6,6,6,7,9,8,9,6,
162 9 ,6,6,6,6,6,6,6,6,6,6,6,6,6,6 ,6,6,6,6,6,6,6,6,6,6,6,6,9,9,9,9,9,
163 9 ,9,9,9,9,9,9,9,9,9,9,9,9,9,9 ,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
164 9 ,9,9,9,9,9,9,9,9,9,9,9,9,9,9 ,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
165 9 ,9,9,9,9,9,9,9,9,9,9,9,9,9,9 ,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
166 9 ,9,9,9,9,9,9,9,9,9,9,9,9,9,9 ,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9 };
169 Seperator
=0,Operator
=1,Open
=2,Close
=3,Comment
=4,Numeric
=5,Alpha
=6,
170 Open_index
=7,Close_index
=8,Illegal_char
=9,Terminator
=10,Bit
=11,
173 #define MAX_ARG_LENGTH 32
174 #define MAX_ARG_COUNT 16
175 #define MAX_ARG_HISTORY 16
181 char Text
[MAX_ARG_LENGTH
];
187 static ArgVal val_bufs
[MAX_ARG_HISTORY
][MAX_ARG_COUNT
];
188 static ArgVal
*vals
= val_bufs
[0];