summaryrefslogtreecommitdiff
path: root/parser.c
diff options
context:
space:
mode:
authorroot <root@fedora-arm.domain.avtechpulse.com>1999-12-31 20:28:31 -0500
committerroot <root@fedora-arm.domain.avtechpulse.com>1999-12-31 20:28:31 -0500
commit839c01f7c250431644bd827e21f7363314ef3f13 (patch)
tree6b3ad3b3a4bf811651c1055074d2f184a8c89a3e /parser.c
parentf58de74bf0fc34cc1e5547324e21772f83b09923 (diff)
prepare to arrange responses as callbacks
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/parser.c b/parser.c
index c425a98..f081842 100644
--- a/parser.c
+++ b/parser.c
@@ -528,7 +528,7 @@ static int Parser_get_unit(char *parameter,char *units)
return units_present;
}
-void Parser_main (char *in, gchar** response, int allow_unrequested_responses, int *error_num)
+void Parser_main (char *in, gchar** response, int allow_unrequested_responses)
{
int in_pos; /* this identifies the single character of in being processed */
int command_depth; /* how many command words have been parsed */
@@ -683,16 +683,16 @@ void Parser_main (char *in, gchar** response, int allow_unrequested_responses, i
++command_depth;
/* add end of tokens marker (0) */
- *error_num=OK;
+ int error_num=OK;
response[0]=0;
if (parameter_found) {
units_found = Parser_get_unit(parameter,units);
- *error_num=String_trim_excess_digits(parameter);
- *error_num=String_trim_excess_digits(units);
+ error_num=String_trim_excess_digits(parameter);
+ error_num=String_trim_excess_digits(units);
}
- if (!*error_num) {
+ if (!error_num) {
if (!units_found) {
units[0]='\0';
}
@@ -703,7 +703,7 @@ void Parser_main (char *in, gchar** response, int allow_unrequested_responses, i
routine_num = Parser_find_commands(commands,command_depth);
/* check for valid channel number, based on position in command */
- if ( (*error_num=Parser_channel(&channel,with_id_code,routine_num)) )
+ if ( (error_num=Parser_channel(&channel,with_id_code,routine_num)) )
/* not a valid command due to improper channel suffix */
{
routine_num=9999;
@@ -716,17 +716,17 @@ void Parser_main (char *in, gchar** response, int allow_unrequested_responses, i
switch (routine_num) {
case 0:
*response = g_strdup_printf("routine_num: %d, channel: %d, parameter: %s, units: %s, command type: %d\n\r",routine_num,channel,parameter,units,command_type);
- *error_num=Unrecognized;
+ error_num=Unrecognized;
break;
case 11:
- *error_num=Go_syst_err_11(response,channel,parameter,units,command_type);
+ error_num=Go_syst_err_11(response,channel,parameter,units,command_type);
break;
case 32:
case 33:
- *error_num=Go_freq_32_33(response,channel,parameter,units,command_type);
+ error_num=Go_freq_32_33(response,channel,parameter,units,command_type);
break;
case 66:
- *error_num=Go_syst_errcnt66(*response,channel,parameter,units,command_type);
+ error_num=Go_syst_errcnt66(*response,channel,parameter,units,command_type);
break;
case 9999:
@@ -741,15 +741,16 @@ void Parser_main (char *in, gchar** response, int allow_unrequested_responses, i
}
}
-// int control_mode = 0; //CUSTOM
-
-// FIXME
- if (*error_num) {
+ // FIXME
+ if (error_num) {
g_free (*response);
- queue_error_from_parser(response, *error_num);
- } // else {
-// IO_output_to_comm_bus(response,control_mode);
-// }
+ queue_error_from_parser(response, error_num);
+ if (allow_unrequested_responses) {
+ ; // SEND ERROR RESPONSE TO CLIENT NOW!
+ }
+ } else {
+ ; // SEND RESPONSE TO CLIENT NOW!
+ }
if (!is_query) {
Main_update_shift_registers(); /* update values in pulse generator circuit */