static void vti_di_read(void *arg, long period) //reads digital inputs from the vti { vti_struct *vti; int i; char latchedVal; vti = arg; if (diocount == 0) return; // No DIO enabled /* Get ENCDAC onboard inputs */ latchedVal = encoder->DIO; if (vti->dir_bits[0] == 0) split_input(latchedVal, &(vti->port[0][0]), 4); if (vti->dir_bits[1] == 0) split_input(latchedVal, &(vti->port[0][4]), 4); /* Get Extended I/O inputs */ if (diocount <= 8) return; // No extended I/O enabled for (i = 1; i < (diocount / 8); i++) { latchedVal = dac->DIO[i - 1]; if (vti->dir_bits[i * 2] == 0) split_input(latchedVal, &(vti->port[i][0]), 4); if (vti->dir_bits[i * 2 + 1] == 0) split_input(latchedVal, &(vti->port[i][4]), 4); } }
void UltTTTMaster::play() { std::string input; while(std::getline(std::cin, input)) { char delim = ' '; std::vector<std::string> command_options = split_input(input, delim); if (command_options[0] == "settings") { if (command_options[1] == "timebank") { __settings.set_time_bank(std::stoi(command_options[2])); } else if (command_options[1] == "time_per_move") { __settings.set_time_per_move(std::stoi(command_options[2])); } else if (command_options[1] == "player_names") { std::vector<std::string> names(command_options.begin() + 2, command_options.end()); __settings.set_player_names(names); } else if (command_options[1] == "your_bot") { __settings.set_bot_name(command_options[2]); } else if (command_options[1] == "your_botid") { __settings.set_bot_id(std::stoi(command_options[2])); } } else if (command_options[0] == "update") { if (command_options[2] == "round") { __game.set_round(std::stoi(command_options[3])); } else if (command_options[2] == "move") { __game.set_move(std::stoi(command_options[3])); } else if (command_options[2] == "field") { std::vector<std::string> f = split_input(command_options[3], ','); std::vector<int> fint; for (const std::string& s: f) { fint.push_back(std::stoi(s)); } __game.set_field(fint); } else if (command_options[2] == "macroboard") { std::vector<std::string> f = split_input(command_options[3], ','); std::vector<int> fint; for (const std::string& s: f) { fint.push_back(std::stoi(s)); } __game.set_field(fint); } } else if (command_options[0] == "action") { // give game board and macro board to AI engine, pick moves, output as follows: // std::cout << "place_move " << x << y << std::endl; std::cout << "place_move " << 1 << 1 << std::endl; } } }
static void split_at_CW_sep_char( char * splitpos ) { /***********************************************************/ /* if 2 CW_sep_chars follow, don't split line */ /* ... this is NOWHERE documented, but wgml 4.0 tested */ /* also don't split if last char of record */ /***********************************************************/ if( buff2[1] != '\'' ) { if( splitpos == NULL ) { // splitpos not yet known splitpos = strchr( buff2 + 2, CW_sep_char ); } if( (splitpos != NULL) && (splitpos[1] != '\0') ) { if( (splitpos[-1] == '\'') && (splitpos[1] == '\'') ) { ; // hack for testing macro repchars docs\doc\hlp\fmtmacro.gml(174) // don't split &'index("&x.",';') TBD } else { if( splitpos[1] != CW_sep_char ) { split_input( buff2, splitpos + 1, false ); // split after CW_sep_char splitpos[0] = '\0'; // terminate 1. part #if 0 } else { // ignore 1 CW_sep_char memmove( splitpos, splitpos + 1, splitpos - buff2 + buff2_lg ); buff2_lg = strlen( buff2 ); #endif } } } } }
int main() { pipe_t in_pipe; if (-1 == in_pipe.init()) return 1; pipe_t out_pipe; if (-1 == out_pipe.init()) return 1; int pid = fork(); if (pid) { // parent if(-1 == close(in_pipe.fds[0])) {fprintf(stderr,"Can't close %d\n", in_pipe.fds[0]); return 1;} if(-1 == close(out_pipe.fds[1])) {fprintf(stderr,"Can't close %d\n", out_pipe.fds[1]); return 1;} printf("child pid: %d\n", pid); int child_in_fds[] = {in_pipe.fds[1]}; int child_out_fds[] = {out_pipe.fds[0]}; printf("split_input...\n"); int res = split_input(0, 1, child_in_fds, child_out_fds, 1); printf("... split_input %d\n", res); close(out_pipe.fds[0]); in_pipe.fds[0] = -1; return res==0 ? 0 : 1; } else { // child if(-1 == close(in_pipe.fds[1])) {fprintf(stderr,"Can't close %d\n", in_pipe.fds[1]); return 1;} if(-1 == close(out_pipe.fds[0])) {fprintf(stderr,"Can't close %d\n", out_pipe.fds[0]); return 1;} if(-1 == dup2(in_pipe.fds[0], 0)) {fprintf(stderr,"Can't dup 0\n"); return 1;} if(-1 == dup2(out_pipe.fds[1], 1)) {fprintf(stderr,"Can't dup 1\n"); return 1;} int return_status = system("cat"); /* fprintf(stderr, "CHILD: running child...\n"); size_t buff_len = 1024 * 32; char *buff = new char[buff_len]; while(true) { fprintf(stderr, "CHILD: reading ...\n"); ssize_t read_sz = read(0, (void*)buff, buff_len); if (read_sz == 0) { fprintf(stderr, "CHILD: 0 bytes read from %d\n", 0); break; // eof } else if (read_sz == -1) { fprintf(stderr, "CHILD: error on read\n"); return 1; // error } else { fprintf(stderr, "CHILD: %zu bytes read from %d\n", read_sz, 0); write(1, (void*)buff, read_sz); } } */ //close(in_pipe.fds[0]); //close(out_pipe.fds[1]); close(0); close(1); return return_status; } return 0; }
static void on_event(int bp, ldb_t *ldb, lua_State *state, lua_Debug *ar) { int depth; depth = get_calldepth(state); if (bp < 0 && ldb->call_depth != -1 && depth > ldb->call_depth) { /* next command, just return */ return; } ldb->call_depth = depth; if (bp >= 0) { ldb_output("Breakpoint %d hit!\n", bp); } set_prompt(); char *buff = NULL; input_t input;; int ret, i, len; while ((len = get_input(&buff)) >= 0) { if (len == 0) { free(buff); continue; } if (split_input(buff, &input) < 0) { set_prompt(); free(buff); continue; } ret = 0; for (i = 0; commands[i].handler != NULL; ++i) { if (!strcmp(input.buffer[0], commands[i].short_name) || !strcmp(input.buffer[0], commands[i].name)) { ldb->call_depth = get_calldepth(state); ret = (*commands[i].handler)(state, ldb, ar, &input); break; } } if (commands[i].name == NULL) { ldb_output("bad command: %s, ldb_output h for help\n", buff); } //free(buff); if (ret < 0) { break; } set_prompt(); } }
void scr_th( void ) { ifcb * cb = input_cbs->if_cb; char linestr[MAX_L_AS_STR]; scan_err = false; cb->if_flags[cb->if_level].ifcwte = false; if( !cb->if_flags[cb->if_level].iflast || !(cb->if_flags[cb->if_level].iftrue || cb->if_flags[cb->if_level].iffalse) || cb->if_flags[cb->if_level].ifthen || cb->if_flags[cb->if_level].ifelse || cb->if_flags[cb->if_level].ifdo ) { scan_err = true; g_err( err_if_then ); if( input_cbs->fmflags & II_macro ) { ultoa( input_cbs->s.m->lineno, linestr, 10 ); g_info( inf_mac_line, linestr, input_cbs->s.m->mac->name ); } else { ultoa( input_cbs->s.f->lineno, linestr, 10 ); g_info( inf_file_line, linestr, input_cbs->s.f->filename ); } show_ifcb( "then", cb ); show_include_stack(); err_count++; return; } cb->if_flags[cb->if_level].iflast = false; cb->if_flags[cb->if_level].ifthen = true; ProcFlags.keep_ifstate = true; if( input_cbs->fmflags & II_research && GlobalFlags.firstpass ) { show_ifcb( "then", cb ); } garginit(); // find end of control word while( *scan_start == ' ' ) { scan_start++; } if( *scan_start ) { // rest of line is not empty split split_input( buff2, scan_start, false );// and process next } scan_restart = scan_stop + 1; return; }
void scr_th( void ) { ifcb * cb = input_cbs->if_cb; scan_err = false; cb->if_flags[cb->if_level].ifcwte = false; if( !cb->if_flags[cb->if_level].iflast || !(cb->if_flags[cb->if_level].iftrue || cb->if_flags[cb->if_level].iffalse) || cb->if_flags[cb->if_level].ifthen || cb->if_flags[cb->if_level].ifelse || cb->if_flags[cb->if_level].ifdo ) { scan_err = true; g_err( err_if_then ); g_info_inp_pos(); show_ifcb( "then", cb ); show_include_stack(); err_count++; return; } cb->if_flags[cb->if_level].iflast = false; cb->if_flags[cb->if_level].ifthen = true; ProcFlags.keep_ifstate = true; if( input_cbs->fmflags & II_research && GlobalFlags.firstpass ) { show_ifcb( "then", cb ); } garginit(); // find end of control word while( *scan_start == ' ' ) { scan_start++; } if( *scan_start ) { // rest of line is not empty split split_input( buff2, scan_start, false );// and process next } scan_restart = scan_stop; return; }
void scr_ct( void ) { char * p; p = scan_start; // next char after .ct if( *p ) { // line operand specified p++; // over space if( *p ) { post_space = 0; ProcFlags.ct = true; if( (*p == SCR_char) || // script control word follows (*p == GML_char) ) { // GML tag follows split_input( scan_start, p, (*p == SCR_char) ); } else { process_text( p, g_curr_font_num ); // text follows } } } scan_restart = scan_stop + 1; return; }
static void process_input(brl_t *brl, const char *input, void *user_data) { client_t *c = (client_t *)user_data; int len = input ? strlen(input) + 1 : 0; char buf[len], *args[64]; int narg; if (len > 1) { brl_add_history(brl, input); hide_prompt(c); strcpy(buf, input); narg = split_input(buf, MRP_ARRAY_SIZE(args), args); if (narg > 0) execute_user_command(c, narg, &args[0]); else printf("failed to parse input '%s'\n", input); show_prompt(c); } }
void scr_label( void ) { condcode cc; getnum_block gn; labelcb * lb; char linestr[MAX_L_AS_STR]; scan_start += 2; // over dots while( *scan_start == ' ' ) { // may be ...LABEL or ... LABEL scan_start++; // over blanks } if( *scan_start == '\0' ) { // no label? scan_err = true; err_count++; g_err( err_missing_name, "" ); if( input_cbs->fmflags & II_tag_mac ) { utoa( input_cbs->s.m->lineno, linestr, 10 ); g_info( inf_mac_line, linestr, input_cbs->s.m->mac->name ); } else { utoa( input_cbs->s.f->lineno, linestr, 10 ); g_info( inf_file_line, linestr, input_cbs->s.f->filename ); } show_include_stack(); return; } else { gn.argstart = scan_start; gn.argstop = scan_stop; gn.ignore_blanks = 0; cc = getnum( &gn ); // try numeric expression evaluation if( cc == pos ) { // numeric linenumber scan_start = gn.argstart; // start for next token // check if lineno from label matches actual lineno if( input_cbs->fmflags & II_tag_mac ) { if( gn.result != input_cbs->s.m->lineno ) { scan_err = true; err_count++; g_err( err_label_line, gn.resultstr ); utoa( input_cbs->s.m->lineno, linestr, 10 ); g_info( inf_mac_line, linestr, input_cbs->s.m->mac->name ); show_include_stack(); return; } } else { if( gn.result != input_cbs->s.f->lineno ) { scan_err = true; err_count++; g_err( err_label_line, gn.resultstr ); utoa( input_cbs->s.f->lineno, linestr, 10 ); g_info( inf_file_line, linestr, input_cbs->s.f->filename ); show_include_stack(); return; } } if( input_cbs->fmflags & II_tag_mac ) { // numeric macro label no need to store } else { wng_count++; g_warn( wng_label_num ); utoa( input_cbs->s.f->lineno, linestr, 10 ); g_info( inf_file_line, linestr, input_cbs->s.f->filename ); show_include_stack(); } } else { // no numeric label cc = getarg(); if( cc == pos ) { // label name specefied char * p; char * pt; int len; p = tok_start; pt = token_buf; len = 0; while( len < arg_flen ) { // copy to buffer *pt++ = *p++; len++; } *pt = '\0'; if( len > MAC_NAME_LENGTH ) { err_count++; g_err( err_sym_long, token_buf ); utoa( input_cbs->s.f->lineno, linestr, 10 ); g_info( inf_file_line, linestr, input_cbs->s.f->filename ); show_include_stack(); token_buf[MAC_NAME_LENGTH] = '\0'; } if( input_cbs->fmflags & II_tag_mac ) { cc = test_duplicate( token_buf, input_cbs->s.m->lineno ); if( cc == pos ) { // ok name and lineno match // nothing to do } else { if( cc == neg ) { // name with different lineno scan_err = true; err_count++; g_err( err_label_dup, token_buf ); utoa( input_cbs->s.m->lineno, linestr, 10 ); g_info( inf_mac_line, linestr, input_cbs->s.m->mac->name ); show_include_stack(); return; } else { // new label lb = mem_alloc( sizeof( labelcb ) ); lb->prev = input_cbs->s.m->mac->label_cb; input_cbs->s.m->mac->label_cb = lb; lb->pos = 0; lb->lineno = input_cbs->s.m->lineno; strcpy_s( lb->label_name, sizeof( lb->label_name ), token_buf ); } } } else { cc = test_duplicate( token_buf, input_cbs->s.f->lineno ); if( cc == pos ) { // ok name and lineno match // nothing to do } else { if( cc == neg ) { // name with different lineno scan_err = true; err_count++; g_err( err_label_dup, token_buf ); utoa( input_cbs->s.f->lineno, linestr, 10 ); g_info( inf_file_line, linestr, input_cbs->s.f->filename ); show_include_stack(); return; } else { // new label lb = mem_alloc( sizeof( labelcb ) ); lb->prev = input_cbs->s.f->label_cb; input_cbs->s.f->label_cb = lb; lb->pos = input_cbs->s.f->pos; lb->lineno = input_cbs->s.f->lineno; strcpy_s( lb->label_name, sizeof( lb->label_name ), token_buf ); } } } } else { scan_err = true; err_count++; g_err( err_missing_name, "" ); if( input_cbs->fmflags & II_tag_mac ) { utoa( input_cbs->s.m->lineno, linestr, 10 ); g_info( inf_mac_line, linestr, input_cbs->s.m->mac->name ); } else { utoa( input_cbs->s.f->lineno, linestr, 10 ); g_info( inf_file_line, linestr, input_cbs->s.f->filename ); } show_include_stack(); return; } } if( *scan_start == ' ' ) { scan_start++; // skip one blank if( *scan_start ) { // rest of line is not empty split_input( buff2, scan_start, false );// split and process next } } scan_restart = scan_stop + 1; return; } }
static void split_at_GML_tag( void ) { char * p; char * p2; char * pchar; char c; bool layoutsw; size_t toklen; if( *buff2 == GML_char ) { if( !strnicmp( (buff2 + 1), "CMT", 3 ) && ((*(buff2 + 4) == '.') || (*(buff2 + 4) == ' ')) ) { return; // no split for :cmt. line } } /***********************************************************************/ /* Look for GML tag start char(s) until a known tag is found */ /* then split the line */ /***********************************************************************/ pchar = strchr( buff2 + 1, GML_char ); while( pchar != NULL ) { while( *(pchar + 1) == GML_char ) { pchar++; // handle repeated GML_chars } for( p2 = pchar + 1; is_id_char( *p2 ) && (p2 < (buff2 + buf_size)); p2++ ) /* empty loop */ ; if( (p2 > pchar + 1) && ((*p2 == '.') || is_space_tab_char( *p2 ) || (*p2 == '\0') || (*p2 == GML_char) ) ) { // 'good' tag end c = *p2; if( ProcFlags.layout && (c == '\t') ) { c = ' '; // replace tab with space in layout } *p2 = '\0'; // null terminate string toklen = p2 - pchar - 1; /***************************************************************/ /* Verify valid user or system tag */ /***************************************************************/ if( (find_tag( &tag_dict, pchar + 1 ) != NULL) || (find_sys_tag( pchar + 1, toklen ) != NULL) || (find_lay_tag( pchar + 1, toklen ) != NULL) ) { *p2 = c; if( input_cbs->fmflags & II_sol ) { // remove spaces before tags at sol in restricted sections // in or just before LAYOUT tag layoutsw = ProcFlags.layout; if( !layoutsw && (strncmp( "LAYOUT", pchar + 1, 6 ) == 0 ) ) { layoutsw = true; } if( (rs_loc > 0) || layoutsw ) { p = buff2; while( is_space_tab_char( *p ) ) { p++; } if( p == pchar ) { // only leading blanks memmove( buff2, pchar, buf_size - (p - buff2) ); buff2_lg = strlen( buff2 );// new length pchar = strchr( buff2 + 1, GML_char ); // try next GMLchar continue; // dummy split done try again } } } split_input( buff2, pchar, false );// split line if( ProcFlags.literal ) { // if literal active if( li_cnt < LONG_MAX ) {// we decrement, adjust for split line li_cnt++; } } break; // we did a split stop now } else { *p2 = c; } } pchar = strchr( pchar + 1, GML_char ); // try next GMLchar } }
static void scan_script( void ) { inputcb * cb; mac_entry * me; char * p; char * pt; int toklen; int k; bool cwfound; cb = input_cbs; p = scan_start + 1; scan_restart = scan_start; if( (*p == '*') || !strnicmp( p, "cm ", 3 ) ) { scan_start = scan_stop + 1; // .cm +++ ignore comment up to EOL return; // .* +++ ignore comment up to EOL } if( *p == SCR_char && *(p+1) == SCR_char ) { pt = token_buf; *pt++ = SCR_char; // special for ...label *pt++ = SCR_char; *pt = '\0'; me = NULL; scan_start = p + 2; toklen = 2; } else { if( *p == '\'' ) { // .' p++; ProcFlags.CW_sep_ignore = 1; } else { if( CW_sep_char == '\0') { ProcFlags.CW_sep_ignore = 1;// No separator char no split } else{ ProcFlags.CW_sep_ignore = 0; } if( *p == SCR_char ) { // .. p++; ProcFlags.macro_ignore = 1; me = NULL; } else { ProcFlags.macro_ignore = 0; } } if( ProcFlags.literal ) { // no macro or split line if literal ProcFlags.CW_sep_ignore = 1; ProcFlags.macro_ignore = 1; } if( !ProcFlags.CW_sep_ignore ) { // scan line for CW_sep_char char * pchar; pchar = search_separator( buff2, CW_sep_char ); if( pchar != NULL ) { if( *(pchar + 1) != '\0' ) { // only split if more follows split_input( buff2, pchar + 1, false );// ignore CW_sep_char } *pchar= '\0'; // delete CW_sep_char buff2_lg = strlen( buff2 ); // new length of first part } } scan_start = p; pt = token_buf; while( *p && is_macro_char( *p ) ) { // end of controlword *pt++ = tolower( *p++ ); // copy lowercase to TokenBuf } *pt = '\0'; toklen = pt - token_buf; if( *p && (*p != ' ') || toklen == 0 ) {// no valid script controlword / macro // if( !ProcFlags.literal ) { // TBD // cw_err(); // } scan_start = scan_restart; // treat as text return; } if( toklen >= MAC_NAME_LENGTH ) { *(token_buf + MAC_NAME_LENGTH) = '\0'; } if( !ProcFlags.macro_ignore ) { me = find_macro( macro_dict, token_buf ); } else { me = NULL; } } if( me != NULL ) { // macro found if( GlobalFlags.firstpass && cb->fmflags & II_research ) { if( cb->fmflags & II_macro ) { printf_research( "L%d %c%s macro found in macro %s(%d)\n\n", inc_level, SCR_char, token_buf, cb->s.m->mac->name, cb->s.m->lineno ); } else { printf_research( "L%d %c%s macro found in file %s(%d)\n\n", inc_level, SCR_char, token_buf, cb->s.f->filename, cb->s.f->lineno ); } add_SCR_tag_research( token_buf ); } add_macro_cb_entry( me, NULL ); inc_inc_level(); add_macro_parms( p ); scan_restart = scan_stop + 1; } else { // try script controlword cwfound = false; if( cb->fmflags & II_research && GlobalFlags.firstpass ) { if( cb->fmflags & II_macro ) { printf_research( "L%d %c%s CW found in macro %s(%d)\n\n", inc_level, SCR_char, token_buf, cb->s.m->mac->name, cb->s.m->lineno ); } else { printf_research( "L%d %c%s CW found in file %s(%d)\n\n", inc_level, SCR_char, token_buf, cb->s.f->filename, cb->s.f->lineno ); } add_SCR_tag_research( token_buf ); } if( toklen == SCR_KW_LENGTH ) { for( k = 0; k < SCR_TAGMAX; ++k ) { if( !strcmp( scr_tags[k].tagname, token_buf ) ) { #if 0 if( !ProcFlags.fb_document_done && scr_tags[k].cwflags & cw_o_t ) { /***************************************************/ /* if this is the first cw which produces output */ /* set page geometry and margins from layout */ /***************************************************/ do_layout_end_processing(); } #endif if( !ProcFlags.layout && (scr_tags[k].cwflags & cw_o_t) ) { /********************************************************/ /* this is the first control word which produces output */ /* start the document, the layout is done */ /* start_doc_sect() calls do_layout_end_processing() */ /********************************************************/ start_doc_sect(); } if( ProcFlags.literal ) { // .li active if( !strcmp( token_buf, "li" ) ) { // .li scan_start = p; // found, process scr_tags[k].tagproc(); } } else { scan_start = p; // script controlword found, process if( scr_tags[k].cwflags & cw_break ) { scr_process_break();// output incomplete line, if any } scr_tags[k].tagproc(); } cwfound = true; break; } } } if( !cwfound ) { cw_err(); // unrecognized control word } } scan_start = scan_restart; }
void scr_if( void ) { ifcb * cb; // if stack ptr condcode cct1; condcode cct2; condcode ccrelop; termcb t1; // first argument termcb t2; // second argument relop relation; // the relation between t1 and t2 logop logical; // if more than 1 condition bool ifcond; // current condition bool totalcondition; // resultant condition bool firstcondition; // first comparison .if scan_err = false; firstcondition = true; // first 2 terms to compare garginit(); // find end of control word cb = input_cbs->if_cb; // get .if control block cb->if_flags[cb->if_level].ifcwif = false; // reset cwif switch for( ;; ) { // evaluate if conditions cct1 = gargterm( &t1 ); // get term 1 ccrelop = gargrelop( &relation ); // get relation operator cct2 = gargterm( &t2 ); // get term 2 if( (cct1 == no) || (cct2 == no) ) { scan_err = true; err_count++; g_err( err_if_term ); g_info_inp_pos(); show_include_stack(); return; } if( ccrelop != pos ) { scan_err = true; err_count++; g_err( err_if_relop ); g_info_inp_pos(); show_include_stack(); return; } // terms and operator ok now compare ifcond = ifcompare( &t1, relation, &t2 ); mem_free( t1.term_string ); // don't need the strings anymore mem_free( t2.term_string ); if( firstcondition ) { firstcondition = false; if( cb->if_level < MAX_IF_LEVEL ) { cb->if_level++; memset( &cb->if_flags[cb->if_level], '\0', sizeof( cb->if_flags[cb->if_level] ) ); cb->if_flags[cb->if_level].iflast = true; cb->if_flags[cb->if_level].ifcwte = false; // no .th .el yet cb->if_flags[cb->if_level].iftrue = false; // cond not yet true cb->if_flags[cb->if_level].iffalse = false; // cond not yet false } else { scan_err = true; g_err( err_if_nesting ); g_info_inp_pos(); show_include_stack(); err_count++; return; } totalcondition = ifcond; } else { // resultant condition if( logical == AND ) { totalcondition &= ifcond; } else { totalcondition |= ifcond; } } if( totalcondition ) { // set if true / false flags cb->if_flags[cb->if_level].iftrue = true; cb->if_flags[cb->if_level].iffalse = false; } else { cb->if_flags[cb->if_level].iffalse = true; cb->if_flags[cb->if_level].iftrue = false; } while( *scan_start == ' ' ) { scan_start++; } /* * test logical condition if not line end * .if a = b or c GT d * ^^ */ if( *scan_start ) { if( *scan_start == SCR_char ) { break; // .xx can't be logical operator } if( *(scan_start + 1) == ' ' ) {// single char + blank if( *scan_start == '&' ) { logical = AND; scan_start += 2; continue; // do next conditions } else if( *scan_start == '|' ) { logical = OR; scan_start += 2; continue; // do next conditions } } else { if( !strnicmp( scan_start, "and ", 4 ) ) { logical = AND; scan_start += 4; continue; // do next conditions } else if( !strnicmp( scan_start, "or ", 3 ) ) { logical = OR; scan_start += 3; continue; // do next conditions } } } break; // no more operators / conditions } if( cb->if_level > 1 ) { // nested if if( cb->if_flags[cb->if_level - 1].ifthen ) { // object of .th if( cb->if_flags[cb->if_level - 1].iffalse ) {// last .if false cb->if_flags[cb->if_level].iftrue = true;// process nothing cb->if_flags[cb->if_level].iffalse = true; } } else { if( cb->if_flags[cb->if_level - 1].ifelse // object of .el && cb->if_flags[cb->if_level - 1].iftrue ) {// last .if true cb->if_flags[cb->if_level].iftrue = true;// process nothing cb->if_flags[cb->if_level].iffalse = true; } } } if( input_cbs->fmflags & II_research && GlobalFlags.firstpass ) { show_ifcb( "if", cb ); #if 0 out_msg( "\t.if is %s Level %d\n" "\t.ifcb iftrue %d, iffalse %d\n", totalcondition ? "true " : "false", cb->if_level, cb->if_flags[cb->if_level].iftrue, cb->if_flags[cb->if_level].iffalse ); #endif } if( *scan_start ) { // rest of line is not empty split_input( buff2, scan_start, false ); // split and process next } scan_restart = scan_stop; return; }