static environment_t* import_set(cons_t* p) { std::string s = symbol_name(car(p)); /* * Each import set can be either of: */ // (rename <import set> (<identifier1> <identifier2>) ...) if ( s == "rename" ) return rename(import_set(cadr(p)), cddr(p)); // (prefix <import set> <identifier>) else if ( s == "prefix" ) return prefix(import_set(cadr(p)), caddr(p)); // (only <import set> <identifier> ...) else if ( s == "only" ) return only(import_set(cadr(p)), cddr(p)); // (except <import set> <identifier> ...) else if ( s == "except" ) return except(import_set(cadr(p)), cddr(p)); // <library name> else if ( !s.empty() ) return import_library(sprint(p)); raise(runtime_exception("Unknown import set: " + sprint(p))); return NULL; }
/* Leave only one (current) pane. */ static void cmd_ctrl_wo(key_info_t key_info, keys_info_t *keys_info) { if(vi->view->explore_mode) { only(); } else { display_error("Can't leave preview window alone on the screen."); } }
/************************** operatorHandling *********************************** Element operatorHandling(Element *pOperand1, Element *pOperand2, Element *pOperator, Customer *pCustomer) Purpose: This function handles an operation of type AND, OR, =, NOTANY, or ONLY on two operands. Parameters: I Element *pOperand1 The first of the two operands. I Element *pOperand2 The second operand. I Element *pOperator The operator element for this operation. I Customer *pCustomer The customer for which the operations need to be true. Notes: Return value: A boolean Element containing the result of the operation. *******************************************************************************/ Element operatorHandling(Element *pOperand1, Element *pOperand2, Element *pOperator, Customer *pCustomer) { Element result; Trait currentTrait; char *szOperatorM[] = {"=", "NOTANY", "ONLY", "AND", "OR"}; int i; for (i = 0; (strcmp(pOperator->szToken, szOperatorM[i]) != 0); i++); //will stop when i = the index of our operator in szOperatorM[] switch (i) { case 0: //= strcpy(currentTrait.szTraitType, pOperand1->szToken); strcpy(currentTrait.szTraitValue, pOperand2->szToken); //store both tokens poped in a trait variable to use in atLeastOne function result.bInclude = atLeastOne(pCustomer, ¤tTrait); break; case 1: //NOTANY strcpy(currentTrait.szTraitType, pOperand1->szToken); strcpy(currentTrait.szTraitValue, pOperand2->szToken); //store both tokens poped in a trait variable to use in notAny function result.bInclude = notAny(pCustomer, ¤tTrait); break; case 2: //ONLY strcpy(currentTrait.szTraitType, pOperand1->szToken); strcpy(currentTrait.szTraitValue, pOperand2->szToken); //store both tokens poped in a trait variable to use in only function result.bInclude = only(pCustomer, ¤tTrait); break; case 3: //AND result.bInclude = and(pOperand1, pOperand2); //call function and if token is AND break; case 4: //OR result.bInclude = or(pOperand1, pOperand2); //call function or if token is OR break; } strcpy(result.szBoolean, "Boolean result of "); strcat(result.szBoolean, pOperator->szToken); //for help in debugging and identifying boolean structs return result; }