/* * Parse a type specification and variable name using a * simplified subset of C type syntax. * * TypeAndName ::= Type [IDENTIFIER] * * Type ::= TypeName * | Type '*' * | Type '&' * | Type '[' ']' * TypeName ::= IDENTIFIER { IDENTIFIER } * * Examples are "expression", "const char *", and "Item[]". * Types that don't fit this pattern should use typedef'ed * names from the underlying source language. */ static void ParseTypeAndName(TreeCCInput *input, char **type, char **name) { char *tempType; char *last; /* Type names must begin with an identifier */ if(input->token != TREECC_TOKEN_IDENTIFIER) { TreeCCError(input, "type name expected"); *type = 0; *name = 0; return; } /* Collect up the identifiers within the type name. We don't add the last to "tempType" until we've seen what comes after it. This resolves the ambiguity in the grammar */ tempType = 0; last = 0; while(input->token == TREECC_TOKEN_IDENTIFIER) { if(!tempType) { /* This is the first identifier, which is always part of the type */ tempType = TreeCCValue(input); } else if(!last) { /* No last identifier yet, so just save this one */ last = TreeCCValue(input); } else { /* Append "last" to "tempType" */ tempType = AppendStrings(input, tempType, last, 1, 1); /* Save the new identifier as "last" */ last = TreeCCValue(input); } TreeCCNextToken(input); } /* If the next token is '*', '&', or '[', then "last" is part of the type name, and not the variable name */ if(last && (input->token == TREECC_TOKEN_STAR || input->token == TREECC_TOKEN_REF || input->token == TREECC_TOKEN_LSQUARE)) { tempType = AppendStrings(input, tempType, last, 1, 1); last = 0; } /* Parse the type suffixes */ while(input->token == TREECC_TOKEN_STAR || input->token == TREECC_TOKEN_REF || input->token == TREECC_TOKEN_LSQUARE) { if(input->token == TREECC_TOKEN_STAR) { tempType = AppendStrings(input, tempType, "*", 1, 0); } else if(input->token == TREECC_TOKEN_REF) { tempType = AppendStrings(input, tempType, "&", 1, 0); } else { tempType = AppendStrings(input, tempType, "[]", 0, 0); TreeCCNextToken(input); if(input->token != TREECC_TOKEN_RSQUARE) { TreeCCError(input, "`]' expected"); continue; } } TreeCCNextToken(input); } /* Parse the variable name, if necessary */ if(!last && input->token == TREECC_TOKEN_IDENTIFIER) { last = TreeCCValue(input); TreeCCNextToken(input); } /* Return the values to the caller */ *type = tempType; *name = last; }
void CSVNLogQuery::Log ( const CTSVNPathList& targets , const SVNRev& peg_revision , const SVNRev& start , const SVNRev& end , int limit , bool strictNodeHistory , ILogReceiver* receiver , bool includeChanges , bool includeMerges , bool includeStandardRevProps , bool includeUserRevProps , const TRevPropNames& userRevProps) { SVNPool localpool (pool); // construct parameters: // everything we need to relay the result to the receiver SBaton baton = { receiver , includeChanges , includeStandardRevProps , includeUserRevProps}; // list of revision ranges to fetch // (as of now, there is only one such range) svn_opt_revision_range_t revision_range = {*start, *end}; apr_array_header_t* revision_ranges = apr_array_make (localpool, 1, sizeof(apr_array_header_t*)); *(svn_opt_revision_range_t**)apr_array_push (revision_ranges) = &revision_range; // build list of revprops to fetch. Fetch all of them // if all user-revprops are requested but no std-revprops // (post-filter before them passing to the receiver) apr_array_header_t* revprops = NULL; if (includeStandardRevProps) { // fetch user rev-props? if (includeUserRevProps) { // fetch some but not all user rev-props? if (!userRevProps.empty()) { revprops = apr_array_make ( localpool , (int)GetStandardRevProps().size() + (int)userRevProps.size() , sizeof(const char *)); AppendStrings (localpool, revprops, GetStandardRevProps()); AppendStrings (localpool, revprops, userRevProps); } } else { // standard revprops only revprops = apr_array_make ( localpool , (int)GetStandardRevProps().size() , sizeof(const char *)); AppendStrings (localpool, revprops, GetStandardRevProps()); } } else { // fetch some but not all user rev-props? if (includeUserRevProps && !userRevProps.empty()) { revprops = apr_array_make ( localpool , (int)userRevProps.size() , sizeof(const char *)); AppendStrings (localpool, revprops, userRevProps); } } CHooks::Instance().PreConnect(targets); SVNTRACE ( svn_error_t *result = svn_client_log5 ( targets.MakePathArray (localpool) , peg_revision , revision_ranges , limit , includeChanges , strictNodeHistory , includeMerges , revprops , LogReceiver , (void *)&baton , context , localpool), NULL ); if (result != NULL) throw SVNError (result); }
globle void GetToken( void *theEnv, const char *logicalName, struct token *theToken) { int inchar; unsigned short type; /*=======================================*/ /* Set Unknown default values for token. */ /*=======================================*/ theToken->type = UNKNOWN_VALUE; theToken->value = NULL; theToken->printForm = "unknown"; ScannerData(theEnv)->GlobalPos = 0; ScannerData(theEnv)->GlobalMax = 0; /*==============================================*/ /* Remove all white space before processing the */ /* GetToken() request. */ /*==============================================*/ inchar = EnvGetcRouter(theEnv,logicalName); while ((inchar == ' ') || (inchar == '\n') || (inchar == '\f') || (inchar == '\r') || (inchar == ';') || (inchar == '\t')) { /*=======================*/ /* Remove comment lines. */ /*=======================*/ if (inchar == ';') { inchar = EnvGetcRouter(theEnv,logicalName); while ((inchar != '\n') && (inchar != '\r') && (inchar != EOF) ) { inchar = EnvGetcRouter(theEnv,logicalName); } } inchar = EnvGetcRouter(theEnv,logicalName); } /*==========================*/ /* Process Symbolic Tokens. */ /*==========================*/ if (isalpha(inchar) || IsUTF8MultiByteStart(inchar)) { theToken->type = SYMBOL; EnvUngetcRouter(theEnv,inchar,logicalName); theToken->value = (void *) ScanSymbol(theEnv,logicalName,0,&type); theToken->printForm = ValueToString(theToken->value); } /*===============================================*/ /* Process Number Tokens beginning with a digit. */ /*===============================================*/ else if (isdigit(inchar)) { EnvUngetcRouter(theEnv,inchar,logicalName); ScanNumber(theEnv,logicalName,theToken); } else switch (inchar) { /*========================*/ /* Process String Tokens. */ /*========================*/ case '"': theToken->value = (void *) ScanString(theEnv,logicalName); theToken->type = STRING; theToken->printForm = StringPrintForm(theEnv,ValueToString(theToken->value)); break; /*=======================================*/ /* Process Tokens that might be numbers. */ /*=======================================*/ case '-': case '.': case '+': EnvUngetcRouter(theEnv,inchar,logicalName); ScanNumber(theEnv,logicalName,theToken); break; /*===================================*/ /* Process ? and ?<variable> Tokens. */ /*===================================*/ case '?': inchar = EnvGetcRouter(theEnv,logicalName); if (isalpha(inchar) || IsUTF8MultiByteStart(inchar) #if DEFGLOBAL_CONSTRUCT || (inchar == '*')) #else ) #endif { EnvUngetcRouter(theEnv,inchar,logicalName); theToken->value = (void *) ScanSymbol(theEnv,logicalName,0,&type); theToken->type = SF_VARIABLE; #if DEFGLOBAL_CONSTRUCT if ((ValueToString(theToken->value)[0] == '*') && (((int) strlen(ValueToString(theToken->value))) > 1) && (ValueToString(theToken->value)[strlen(ValueToString(theToken->value)) - 1] == '*')) { size_t count; theToken->type = GBL_VARIABLE; theToken->printForm = AppendStrings(theEnv,"?",ValueToString(theToken->value)); count = strlen(ScannerData(theEnv)->GlobalString); ScannerData(theEnv)->GlobalString[count-1] = EOS; theToken->value = EnvAddSymbol(theEnv,ScannerData(theEnv)->GlobalString+1); ScannerData(theEnv)->GlobalString[count-1] = (char) inchar; } else #endif theToken->printForm = AppendStrings(theEnv,"?",ValueToString(theToken->value)); } else { theToken->type = SF_WILDCARD; theToken->value = (void *) EnvAddSymbol(theEnv,"?"); EnvUngetcRouter(theEnv,inchar,logicalName); theToken->printForm = "?"; } break; /*=====================================*/ /* Process $? and $?<variable> Tokens. */ /*=====================================*/ case '$': if ((inchar = EnvGetcRouter(theEnv,logicalName)) == '?') { inchar = EnvGetcRouter(theEnv,logicalName); if (isalpha(inchar) || IsUTF8MultiByteStart(inchar) #if DEFGLOBAL_CONSTRUCT || (inchar == '*')) #else ) #endif { EnvUngetcRouter(theEnv,inchar,logicalName); theToken->value = (void *) ScanSymbol(theEnv,logicalName,0,&type); theToken->type = MF_VARIABLE; #if DEFGLOBAL_CONSTRUCT if ((ValueToString(theToken->value)[0] == '*') && ((int) (strlen(ValueToString(theToken->value))) > 1) && (ValueToString(theToken->value)[strlen(ValueToString(theToken->value)) - 1] == '*')) { size_t count; theToken->type = MF_GBL_VARIABLE; theToken->printForm = AppendStrings(theEnv,"$?",ValueToString(theToken->value)); count = strlen(ScannerData(theEnv)->GlobalString); ScannerData(theEnv)->GlobalString[count-1] = EOS; theToken->value = EnvAddSymbol(theEnv,ScannerData(theEnv)->GlobalString+1); ScannerData(theEnv)->GlobalString[count-1] = (char) inchar; } else #endif theToken->printForm = AppendStrings(theEnv,"$?",ValueToString(theToken->value)); } else {