Ejemplo n.º 1
0
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
//		¥ Execute									/*e*/
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// Sets the PC to the first statement in our sub statements list if one exists.
void CStatementBlock::Execute(
	CProgram	&ioState)
{
	if (mSubStatements)
		ioState.SetPC(mSubStatements);
	else
		ioState.SetPC(GetNextStatement());
	
	Try_
	{
		ExecuteSelf(ioState);
	}
	catch (const CAEDescException &err)
Ejemplo n.º 2
0
unsigned long WharfSpecialFunc (ConfigDef * config)
{
	TermDef *pterm;
	register char *cur;

	LOCAL_DEBUG_CALLER_OUT ("%p", config);
	if (config == NULL)
		return SPECIAL_BREAK;

	/* checking if we have ~Folders in here */
	LOCAL_DEBUG_OUT ("checking for ~folders at :%s", "");
	print_trimmed_str ("config->tdata", config->tdata);
	print_trimmed_str ("config->tline", config->tline);
	print_trimmed_str ("config->cursor", config->cursor);
	if ((pterm = FindStatementTerm (config->tdata, &WharfSyntax)) == NULL)
		if (mystrncasecmp (config->tdata, "~Folders", 7) == 0) {
			show_error
					(" config line %d: ~Folders keyword is no longer supported. \nPlease Update your configuration to use ~Folder instead!\n Please Accept our apologies for any inconvinience.",
					 config->line_count);
			pterm = FindStatementTerm (WHARF_FOLDER_END, &WharfSyntax);
		}

	if (pterm != NULL) {
		LOCAL_DEBUG_OUT ("term %p found keyword :[%s]", pterm, pterm->keyword);
		if (pterm->id == WHARF_FolderEnd_ID) {
			config->current_term = pterm;
			/* we are 2 levels deep, and FolderEnd will get us only 1 level up
			   so we need to climb another level ourselves : */
			LOCAL_DEBUG_OUT ("folder end - Poping out%s", "");
			PopSyntax (config);
			PopStorage (config);
			return SPECIAL_SKIP;			/* don't care what will happen */
		}
	}
	/* processing wharf item name and icons : */
	ProcessStatement (config);
	/* since we have have subconfig of Functions that has \n as line terminator
	 * we are going to get entire line again at config->cursor
	 * so lets skip 3 tokens of <name> <icon>, since those are not parts
	 * of following function */
	print_trimmed_str ("skiping 2 tokens at", config->tdata);
	cur = tokenskip (config->tdata, 2);
	print_trimmed_str ("skipped to", cur);
	if (*cur != '\0') {
		char *good_cursor;
		TermDef *pterm;

		good_cursor = config->cursor;
		config->cursor = cur;
		/* we are at the beginning of the function definition right now - lets process it : */
		/* read in entire function definition */
		GetNextStatement (config);
		/* lets find us the term for this definition */
		print_trimmed_str ("config->current_data", config->current_data);
		LOCAL_DEBUG_OUT ("curr_data_len = %d", config->current_data_len);
		print_trimmed_str ("checking keyword at", config->tline);
		if ((pterm = FindStatementTerm (config->tline, config->syntax)) == NULL) {	/* courtesy check for mistyped Folder keyword : */
			if (mystrncasecmp (config->tline, "Folders", 7) == 0) {
				show_error
						(" config line %d: Folders keyword is no longer supported. \nPlease Update your configuration to use Folder instead!\n Please Accept our apologies for any inconvinience.",
						 config->line_count);
				pterm = FindStatementTerm ("Folder", config->syntax);
			}
		}

		if (pterm == NULL) {
			/* we are 2 levels deep, and FolderEnd will get us only 1 level up
			   so we need to climb another level ourselves : */
			PopSyntax (config);
			PopStorage (config);
		} else {										/* we have a valid function definition : */
			config->current_term = pterm;
			/* we do not want to continue processing the rest of the config as
			 * a functions : */
			config->current_flags |= CF_LAST_OPTION;
			/* some wierd code to handle the fact that Folder is not really a function,
			 * but instead a start for new nested set of Wharf items : */
			LOCAL_DEBUG_OUT ("processing function definition statement...%s",
											 "");
			ProcessStatement (config);
			if (config->current_term->id == F_Folder) {	/* in which case we let parser to carry on the parsing of the Folder item,
																									 * which will get us into nested WharfSyntax subsyntax */
				config->current_flags &= ~CF_LAST_OPTION;
			}
		}
		/* restarting parsing from the same location : */
		if (config->cursor < good_cursor)
			config->cursor = good_cursor;
		LOCAL_DEBUG_OUT ("done processing function definition statement...%s",
										 "");
	} else {
		show_error
				(" config line %d: Function is not defined for the button. Use Nop if no action is desired..",
				 config->line_count);
		/* function is ommited ! */
		PopSyntax (config);
		PopStorage (config);
	}
	print_trimmed_str ("config->tdata", config->tdata);
	print_trimmed_str ("config->tline", config->tline);
	print_trimmed_str ("config->cursor", config->cursor);
	/* already done processing current statement - let parser know about it : */
	return SPECIAL_SKIP;
}