예제 #1
0
LONG Sqlite3QueryResult::GetLongData( int row, int column ) const
{
	LPCSTR pStr = GetStrData(row, column);
	if (NULL == pStr) return 0;

	return atol(pStr);
}
예제 #2
0
/* Recursively print a parse tree as code */
void PrintParseTree(VyParseTree* tree){
	int treeType = tree->type;

	/* If it is a list, then print a parenthesized list */
	if(treeType == TREE_LIST){
		PrintListGeneric(tree, '(', ')');
	}

	/* Print a reference separated by a colon */
	else if(treeType == TREE_REF){
		PrintParseTree(GetObj(tree));
		/* Delete the previous space before adding the colon */
		printf("\b:");
		PrintParseTree(GetRef(tree));
	}

	/* If it is a number or identifier, just print the string */
	else if(treeType == TREE_IDENT)  {
		printf("%s ", GetStrData(tree));
	}
	else if(treeType == TREE_NUM){
		PrintNumber(GetNumberData(tree));

		/* Print a space so that the backspace doesn't delete part of the number */
		printf(" ");
	}
	/* Print strings enclosed in quotes */
	else if(treeType == TREE_STR){
		printf("\"");
		printf("%s", GetStrData(tree));
		printf("\"");
		printf("\"");
	}

	/* If it is an error, print the error */
	else if(treeType == TREE_ERROR){
		printf("\n---------------------------------\n");
		printf("Error: %s", tree->data->error.message);
		printf("\n---------------------------------\n");
	}

	else{
		printf("\n\n\nWarning: Incorrect parse tree node type: %d! \n\n\n", treeType);		
	}

}
예제 #3
0
UINT64 Sqlite3QueryResult::GetUint64Data( int row, int column ) const
{
	LPCSTR pStr = GetStrData(row, column);
	if (NULL == pStr) return 0;

	UINT64 ret = 0;
	sscanf_s(pStr, "%I64u", &ret);

	return ret;
}
예제 #4
0
void PrintListGeneric(VyParseTree* tree, char oDelim, char cDelim){
	printf("%c", oDelim);

	/* Print each element recursively */
	int i;
	for(i = 0; i < ListTreeSize(tree); i++){	
		VyParseTree* next = GetListData(tree,i);
		if(IsQuote(next)){
			printf("'");
			PrintParseTree(GetListData(next, 1));
		}
		else if(IsSubstitution(next)){
			if(IsSplicingSubstitution(next)){
				printf("$@");		
			}else{
				printf("$");	
			}

			PrintParseTree(GetListData(next, 1));
		}
		else if(next->type == TREE_LIST){
			VyParseTree* first = GetListData(next, 0);
			if(first->type == TREE_IDENT && StrEquals(GetStrData(first), "infix")){
				PrintListGeneric(GetListData(next, 1), '{','}');
			}
			else if(first->type == TREE_IDENT && StrEquals(GetStrData(first), "quote-substitutions")){
				PrintListGeneric(GetListData(next, 1), '[',']');
			}else{
				PrintParseTree(next);	
			}
		}
		else{
			PrintParseTree(next);
		}
	}

	/* If it wasn't an empty list, remove the extra space generated by the item inside */
	if(ListTreeSize(tree) > 0){
		printf("\b");
	}

	printf("%c ", cDelim);  
}
예제 #5
0
std::string		
NDScriptGameData::GetRoleTaskStrData(unsigned int nKey, int nId, unsigned short index)
{
	return GetStrData(eScriptDataRole, nKey, eRoleDataTask, nId, index);
}
예제 #6
0
std::string		
NDScriptGameData::GetRoleBasicStrData(unsigned int nKey, unsigned short index)
{
	return GetStrData(eScriptDataRole, nKey, eRoleDataBasic, 0, index);
}