bool JSCLanguageBase::isIgnore(const JSCPropertyPointer& property) const { bool ignore = isIgnore(property->path(), property->pathName()); if (nullptr != property.get()) { ignore |= JSCProperty_Ref == property->type() && isIgnore(std::static_pointer_cast<JSCRef>(property)->refProperty()); ignore |= JSCProperty_Array == property->type() && isIgnore(std::static_pointer_cast<JSCArray>(property)->propertyType()); ignore |= JSCProperty_Object == property->type() && isIgnoreObj(std::static_pointer_cast<JSCObject>(property)); ignore |= JSCProperty_Enum == property->type() && isIgnoreEnum(std::static_pointer_cast<JSCEnum>(property)); } return ignore; }
static int directiveDefine (const int c, bool undef) { int r = CORK_NIL; if (cppIsident1 (c)) { bool parameterized; int nc; readIdentifier (c, Cpp.directive.name); nc = getcAndCollect (); parameterized = (nc == '('); if (parameterized) { cppStartCollectingSignature (); while (nc != EOF) { int lastC = nc; nc = getcAndCollect (); if (nc == '\n' && lastC != '\\') break; } cppStopCollectingSignature (); } ungetcAndCollect (nc); if (! isIgnore ()) makeDefineTag (vStringValue (Cpp.directive.name), parameterized, undef); } Cpp.directive.state = DRCTV_NONE; return r; }
/* Pops one nesting level for an #endif directive. */ static bool popConditional (void) { if (Cpp.directive.nestLevel > 0) --Cpp.directive.nestLevel; return isIgnore (); }
/* Pushes one nesting level for an #if directive, indicating whether or not * the branch should be ignored and whether a branch has already been chosen. */ static bool pushConditional (const bool firstBranchChosen) { const bool ignoreAllBranches = isIgnore (); /* current ignore */ bool ignoreBranch = false; if (Cpp.directive.nestLevel < (unsigned int) MaxCppNestingLevel - 1) { conditionalInfo *ifdef; ++Cpp.directive.nestLevel; ifdef = currentConditional (); /* We take a snapshot of whether there is an incomplete statement in * progress upon encountering the preprocessor conditional. If so, * then we will flag that only a single branch of the conditional * should be followed. */ ifdef->ignoreAllBranches = ignoreAllBranches; ifdef->singleBranch = Cpp.resolveRequired; ifdef->branchChosen = firstBranchChosen; ifdef->ignoring = (bool) (ignoreAllBranches || ( ! firstBranchChosen && ! BraceFormat && (ifdef->singleBranch || !Option.if0))); ignoreBranch = ifdef->ignoring; } return ignoreBranch; }
std::vector<JSCPropertyPointer> JSCLanguageBase::propertiesForObj(const JSCObjectPointer& object) const { SIAAssert(nullptr != object.get()); std::vector<JSCPropertyPointer> result; result.reserve(object->properties().size()); std::vector<JSCObjectPointer> additionalClasses = findAdditionalClasses(object); bool isLeaf = checkIsLeaf(object); for (const auto& property : object->properties()) { if (isLeaf && checkIsLeaf(property)) { for (const auto& childProperty : propertiesForProperty(property)) { result.push_back(childProperty); } } else if (!isIgnore(property) && !containsPropertyInClasses(property, additionalClasses)) { result.push_back(property); } } for (const auto& additionalClassData : additionalClasses) { JSCObjectPointer additionalClass(new JSCObject(*additionalClassData.get())); auto path = object->path(); path.push_back(additionalClassData->pathName()); additionalClass->setPath(path); result.push_back(additionalClass); } return result; }
bool JSCLanguageBase::isIgnore(const JSCProperty::Path& path, const std::string& lastName) const { for (const std::string& ignore : m_ignoreList) { if (isSubpath(path, lastName, ignore)) { return true; } } return isIgnore(lastName); }
void JSCLanguageBase::add(const JSCObjectPointer& object) { if (isIgnore(object)) { SIADebug("Ignore class with name: %s", object->rootName().c_str()); return; } for (const auto& out : generateOutput(object)) { m_outputs.push_back(out); } }
void JSCLanguageBase::add(const JSCEnumPointer& enumObj) { if (isIgnore(enumObj)) { SIADebug("Ignore enum with name: %s", enumObj->enumName().c_str()); return; } for (const auto& out : generateOutput(enumObj)) { m_outputs.push_back(out); } }
static bool directiveHash (const int c) { bool ignore = false; char directive [MaxDirectiveName]; DebugStatement ( const bool ignore0 = isIgnore (); )
int main( int argc, const char* argv[] ) { int result; int i = 1; // pq el parametro 0 es el ejecutable char* listBytes; char* listFields; // //esto no va, es para probar // parseList( argv[i], TYPE_BYTES); // itero el vector de parametros while( i<argc ){ if( isVersion( argv[i] ) == 1 ){ _isVersion = 1; } else if( isHelp(argv[i]) == 1 ){ _isHelp = 1; } else if( isBytes(argv[i]) == 1 ){ _isBytes = 1; // Parsear el argv[i+1] y determinar los elementos o rangos i++; listBytes = parseList( argv[i], TYPE_BYTES); } else if( isFields(argv[i]) == 1){ _isFields = 1; // Parsear el argv[i+1] y determinar los elementos o rangos i++; listFields = parseList( argv[i], TYPE_FIELDS); } else if( isDelimiter(argv[i]) == 1 ){ _isDelimiter = 1; // Parsear el argv[i+1] y determinar el delimitador i++; _delimiter = argv[i][0]; // el delimitador es de solo un caracter. Si tiene mas de uno se toma el primero } else if( isIgnore(argv[i]) == 1 ){ _isIgnore = 1; } else{ // argumento invalido!!! _hasInvalidParameters = 1; _invalidParameter = argv[i]; } i++; } // puts(listBytes); // puts(listFields); if (_isFields==1){ //Imprimir lo que corresponda imprimir(listFields, TYPE_FIELDS); } if (_isBytes==1){ //Imprimir lo que corresponda imprimir(listBytes, TYPE_BYTES); } // Sino tiene parametros invalidos, sigo if( _hasInvalidParameters == 0 ){ // ahora me fijo q operacion hay q hacer if( _isVersion == 1 ){ // imprimo version y salgo puts("Imprimo Version!!"); } else if(_isHelp==1){ // imprimo help y salgo puts("Imprimo help!!"); } else if(_isBytes==1){ // hago la operacion del CUT segun el conjunto de bytes previamente parseado // y salgo } else if(_isFields==1){ // hago la operacion del CUT (usando el delimitador seteado o default y el parametro ignore) // con el conjunto de fields previamente parseado y devuelvo el resultado por stdout // y salgo } result = EXIT_SUCCESS; puts("saliendo bien"); } else { // si tiene parametros invalidos salgo result = EXIT_FAILURE; puts( "saliendo mal" ); } puts("saliendo "); /* prints TP 0 */ // puts(result); return result; }
bool JSCLanguageBase::isIgnoreObj(const JSCObjectPointer& object) const { return isIgnore(object->path(), object->rootName()); }
bool JSCLanguageBase::isIgnoreEnum(const JSCEnumPointer& enumObj) const { return isIgnore(enumObj->path(), enumObj->enumName()); }