void shopping_value( const char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr) { char argm[100], buf[MAX_STRING_LENGTH]; struct obj_data *temp1; int i; float mult = 0; if(!(is_ok(keeper,ch,shop_nr))) return; if(keeper->generic != 0) for(i = 0; i <= MAX_TRADE; i++) { if(keeper->generic == FAMINE) if(shop_index[shop_nr].type[i] == ITEM_FOOD) { mult = shop_multiplier; /* we're in a famine, we sell food, so we */ break; /* our prices to hell ;-) -DM */ } if(keeper->generic == DWARVES_STRIKE) if((shop_index[shop_nr].type[i] == ITEM_ARMOR) || (shop_index[shop_nr].type[i] == ITEM_WEAPON)) { mult = shop_multiplier; break; } } only_argument(arg, argm); if(!(*argm)) { sprintf(buf,"%s What do you want me to evaluate??", GET_NAME(ch)); do_tell(keeper,buf,19); return; } if(!( temp1 = get_obj_in_list_vis(ch,argm,ch->carrying))) { sprintf(buf,shop_index[shop_nr].no_such_item2, GET_NAME(ch)); do_tell(keeper,buf,19); return; } if(!(trade_with(temp1,shop_nr))) { sprintf(buf, shop_index[shop_nr].do_not_buy, GET_NAME(ch)); do_tell(keeper,buf,19); return; } sprintf(buf,"%s I'll give you %d gold coins for that!", GET_NAME(ch),(int) (temp1->obj_flags.cost* shop_index[shop_nr].profit_sell + ((chr_apply[ (int)GET_CHR(ch) ].reaction * temp1->obj_flags.cost)/100) + (mult * temp1->obj_flags.cost))); do_tell(keeper,buf,19); return; }
void shopping_list( char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr) { char buf[MAX_STRING_LENGTH], buf2[100],buf3[100]; struct obj_data *temp1; extern char *drinks[]; int found_obj; int i; float mult = 0; if(!(is_ok(keeper,ch,shop_nr))) return; if(keeper->generic != 0) for(i = 0; i <= MAX_TRADE; i++) { if(keeper->generic == FAMINE) if(shop_index[shop_nr].type[i] == ITEM_FOOD) { mult = shop_multiplier; /* we're in a famine, we sell food, so we */ break; /* our prices to hell ;-) -DM */ } if(keeper->generic == DWARVES_STRIKE) if((shop_index[shop_nr].type[i] == ITEM_ARMOR) || (shop_index[shop_nr].type[i] == ITEM_WEAPON)) { mult = shop_multiplier; break; } } strcpy(buf,"You can buy:\n\r"); found_obj = FALSE; if(keeper->carrying) for(temp1=keeper->carrying; temp1; temp1 = temp1->next_content) if((CAN_SEE_OBJ(ch,temp1)) && (temp1->obj_flags.cost>0)) { found_obj = TRUE; if(temp1->obj_flags.type_flag != ITEM_DRINKCON) sprintf(buf2,"%s for %d gold coins.\n\r" ,(temp1->short_description),(int)(temp1->obj_flags.cost*shop_index[shop_nr].profit_buy - ((chr_apply[GET_CHR(ch)].reaction*temp1->obj_flags.cost)/100) + (mult * temp1->obj_flags.cost))); else { if (temp1->obj_flags.value[1]) sprintf(buf3,"%s of %s",(temp1->short_description) ,drinks[temp1->obj_flags.value[2]]); else sprintf(buf3,"%s",(temp1->short_description)); sprintf(buf2,"%s for %d gold coins.\n\r",buf3, (int)(temp1->obj_flags.cost*shop_index[shop_nr].profit_buy - ((chr_apply[GET_CHR(ch)].reaction*temp1->obj_flags.cost)/100) + (mult * temp1->obj_flags.cost))); } strcat(buf,CAP(buf2)); }; if(!found_obj) strcat(buf,"Nothing!\n\r"); send_to_char(buf,ch); return; }
static int _parse (SCAN *scan, int dim, double **buf) { /* --- parse normalization statistics */ int k, n = 0; /* loop variable, counter */ double *p; /* to access the statistics elements */ assert(scan); /* check the function arguments */ if ((sc_token(scan) != T_ID) /* check whether 'scales' follows */ || (strcmp(sc_value(scan), "scales") != 0)) ERR_STR("scales"); /* if not, abort the function */ GET_TOK(); /* consume 'scales' */ GET_CHR('='); /* consume '=' */ for (k = 0; (dim <= 0) || (k < dim); k++) { if (k > 0) { GET_CHR(',');} /* if not first, consume ',' */ if (k >= n) { /* if the statistics vector is full */ if (dim > 0) n = dim; /* compute the new vector size */ else n += (n > BLKSIZE) ? n >> 1 : BLKSIZE; p = (double*)realloc(*buf, (n+n) *sizeof(double)); if (!p) ERROR(E_NOMEM); /* enlarge the buffer vector */ *buf = p; /* and set the new vector, */ } /* then note factor and offset */ p = *buf +k +k; /* get the element to set */ GET_CHR('['); /* consume '[' */ if (sc_token(scan) != T_NUM) ERROR(E_NUMEXP); p[0] = strtod(sc_value(scan), NULL); GET_TOK(); /* consume the offset */ GET_CHR(','); /* consume '[' */ if (sc_token(scan) != T_NUM) ERROR(E_NUMEXP); p[1] = strtod(sc_value(scan), NULL); GET_TOK(); /* consume the factor */ GET_CHR(']'); /* consume '[' */ if ((dim <= 0) && (sc_token(scan) != ',')) { k++; break; } /* check for more scaling params. */ } GET_CHR(';'); /* consume ';' */ return k; /* return 'ok' */ } /* _parse() */
void shopping_sell( const char *arg, struct char_data *ch, struct char_data *keeper,int shop_nr) { char argm[100], buf[MAX_STRING_LENGTH]; int cost,temp_cost, i; struct obj_data *temp1; float mult = 0; if(!(is_ok(keeper,ch,shop_nr))) return; if(keeper->generic != 0) for(i = 0; i <= MAX_TRADE; i++) { if(keeper->generic == FAMINE) if(shop_index[shop_nr].type[i] == ITEM_FOOD) { mult = shop_multiplier; /* we're in a famine, we sell food, so we */ break; /* our prices to hell ;-) -DM */ } if(keeper->generic == DWARVES_STRIKE) if((shop_index[shop_nr].type[i] == ITEM_ARMOR) || (shop_index[shop_nr].type[i] == ITEM_WEAPON)) { mult = shop_multiplier; break; } } only_argument(arg, argm); if(!(*argm)) { sprintf(buf, "%s What do you want to sell??" ,GET_NAME(ch)); do_tell(keeper,buf,19); return; } if (!( temp1 = get_obj_in_list_vis(ch,argm,ch->carrying))) { sprintf(buf, shop_index[shop_nr].no_such_item2,GET_NAME(ch)); do_tell(keeper,buf,19); return; } if( IS_OBJ_STAT( temp1, ITEM_NODROP ) && !IS_IMMORTAL( ch ) ) { send_to_char("You can't let go of it, it must be CURSED!\n\r", ch); return; } if (!(trade_with(temp1,shop_nr))||(temp1->obj_flags.cost<1)) { sprintf(buf,shop_index[shop_nr].do_not_buy, GET_NAME(ch)); do_tell(keeper,buf,19); return; } if( GET_GOLD(keeper)<(int) (temp1->obj_flags.cost* shop_index[shop_nr].profit_sell + ((chr_apply[ (int)GET_CHR(ch)].reaction*temp1->obj_flags.cost)/100) + (mult * temp1->obj_flags.cost))) { sprintf(buf,shop_index[shop_nr].missing_cash1,GET_NAME(ch)); do_tell(keeper,buf,19); return; } cost = temp1->obj_flags.cost; if ((ITEM_TYPE(temp1) == ITEM_WAND) || (ITEM_TYPE(temp1) == ITEM_STAFF)) { if (temp1->obj_flags.value[1]) { cost = (int)( cost * ( (float)temp1->obj_flags.value[2] / (float)temp1->obj_flags.value[1] ) ); } else { cost = 0; } } else if (ITEM_TYPE(temp1) == ITEM_ARMOR) { if (temp1->obj_flags.value[1]) { cost = (int)( cost * ( (float)temp1->obj_flags.value[0] / (float)temp1->obj_flags.value[1] ) ); } else { cost = 0; } } temp1->obj_flags.cost = cost; act("$n sells $p.", FALSE, ch, temp1, 0, TO_ROOM); temp_cost = (int) (temp1->obj_flags.cost*shop_index[shop_nr].profit_sell + ((chr_apply[ (int)GET_CHR(ch) ].reaction * temp1->obj_flags.cost)/100) + (mult * temp1->obj_flags.cost)); if(temp_cost < 0) temp_cost=0; sprintf(buf,shop_index[shop_nr].message_sell,GET_NAME(ch),temp_cost); /* (int) (temp1->obj_flags.cost* shop_index[shop_nr].profit_sell + ((chr_apply[GET_CHR(ch)].reaction*temp1->obj_flags.cost)/100))) ; */ do_tell(keeper,buf,19); sprintf(buf,"The shopkeeper now has %s.\n\r", temp1->short_description); send_to_char(buf,ch); if (GET_GOLD(keeper)< temp_cost) { /* (int) (temp1->obj_flags.cost* shop_index[shop_nr].profit_sell + ((chr_apply[GET_CHR(ch)].reaction*temp1->obj_flags.cost)/100))) { */ sprintf(buf,shop_index[shop_nr].missing_cash1 ,GET_NAME(ch)); do_tell(keeper,buf,19); return; } GET_GOLD(ch) += temp_cost; /* (int) (temp1->obj_flags.cost* shop_index[shop_nr].profit_sell + ((chr_apply[GET_CHR(ch)].reaction*temp1->obj_flags.cost)/100)); */ GET_GOLD(keeper) -= temp_cost; /* (int) (temp1->obj_flags.cost* shop_index[shop_nr].profit_sell + ((chr_apply[GET_CHR(ch)].reaction*temp1->obj_flags.cost)/100)); */ obj_from_char(temp1); if (temp1 == NULL) { send_to_char("As far as I am concerned, you are out..\n\r",ch); return; } if ((get_obj_in_list(argm,keeper->carrying)) || (GET_ITEM_TYPE(temp1) == ITEM_TRASH)) { extract_obj(temp1); } else { obj_to_char(temp1,keeper); } return; }
void shopping_buy( const char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr) { char argm[100], buf[MAX_STRING_LENGTH], newarg[100]; int num = 1; struct obj_data *temp1; int i; float mult = 0; if(!(is_ok(keeper,ch,shop_nr))) return; if(keeper->generic != 0) for(i = 0; i <= MAX_TRADE; i++) { if(keeper->generic == FAMINE) if(shop_index[shop_nr].type[i] == ITEM_FOOD) { mult = shop_multiplier; /* we're in a famine, we sell food, so we */ break; /* our prices to hell ;-) -DM */ } if(keeper->generic == DWARVES_STRIKE) if((shop_index[shop_nr].type[i] == ITEM_ARMOR) || (shop_index[shop_nr].type[i] == ITEM_WEAPON)) { mult = shop_multiplier; break; } } only_argument(arg, argm); if(!(*argm)) { sprintf(buf, "%s what do you want to buy??" ,GET_NAME(ch)); do_tell(keeper,buf,19); return; }; if( ( num = getabunch( argm, newarg ) ) != 0 ) { strcpy(argm,newarg); } if (num == 0) num = 1; if(!( temp1 = get_obj_in_list_vis(ch,argm,keeper->carrying))) { sprintf(buf, shop_index[shop_nr].no_such_item1 ,GET_NAME(ch)); do_tell(keeper,buf,19); return; } if(temp1->obj_flags.cost <= 0) { sprintf(buf, shop_index[shop_nr].no_such_item1 ,GET_NAME(ch)); do_tell(keeper,buf,19); extract_obj(temp1); return; } if( GET_GOLD(ch) < (int) (num*(temp1->obj_flags.cost* shop_index[shop_nr].profit_buy - ((chr_apply[ (int)GET_CHR(ch) ].reaction*temp1->obj_flags.cost)/100) + (mult * temp1->obj_flags.cost))) && GetMaxLevel(ch)<DEMIGOD) { sprintf(buf, shop_index[shop_nr].missing_cash2, GET_NAME(ch)); do_tell(keeper,buf,19); switch(shop_index[shop_nr].temper1) { case 0: do_action(keeper,GET_NAME(ch),30); return; case 1: do_emote(keeper,"grins happily",36); return; default: return; } } if ((IS_CARRYING_N(ch) + num) > (CAN_CARRY_N(ch))) { sprintf(buf,"%s : You can't carry that many items.\n\r", fname(temp1->name)); send_to_char(buf, ch); return; } if ((IS_CARRYING_W(ch) + (num * temp1->obj_flags.weight)) > CAN_CARRY_W(ch)) { sprintf(buf,"%s : You can't carry that much weight.\n\r", fname(temp1->name)); send_to_char(buf, ch); return; } act("$n buys $p.", FALSE, ch, temp1, 0, TO_ROOM); sprintf(buf, shop_index[shop_nr].message_buy, GET_NAME(ch), (int) (num * (temp1->obj_flags.cost* shop_index[shop_nr].profit_buy - ((chr_apply[ (int)GET_CHR(ch)].reaction*temp1->obj_flags.cost)/100) + (mult * temp1->obj_flags.cost)))); do_tell(keeper,buf,19); sprintf(buf,"You now have %s (*%d).\n\r", temp1->short_description,num); send_to_char(buf,ch); while (num-- > 0) { if (GetMaxLevel(ch)<DEMIGOD) GET_GOLD(ch) -= (int)(temp1->obj_flags.cost* shop_index[shop_nr].profit_buy - ((chr_apply[ (int)GET_CHR(ch) ].reaction*temp1->obj_flags.cost)/100)+ (mult * temp1->obj_flags.cost)); GET_GOLD(keeper) += (int)(temp1->obj_flags.cost* shop_index[shop_nr].profit_buy - ((chr_apply[(int)GET_CHR(ch)].reaction*temp1->obj_flags.cost)/100)+ (mult * temp1->obj_flags.cost)); /* Test if producing shop ! */ if (shop_producing(temp1,shop_nr)) temp1 = read_object(temp1->item_number, REAL); else { obj_from_char(temp1); if (temp1 == NULL) { send_to_char("Sorry, I just ran out of those.\n\r",ch); GET_GOLD(ch) += (int)(temp1->obj_flags.cost* shop_index[shop_nr].profit_buy - ((chr_apply[ (int)GET_CHR(ch) ].reaction * temp1->obj_flags.cost)/100)+ (mult * temp1->obj_flags.cost)); return; } } obj_to_char(temp1,ch); } return; }
void affect_modify(struct char_data *ch,byte loc, long mod, long bitv,bool add) { int i; char buff[200]; if (loc == APPLY_IMMUNE) { if (add) { if(bitv && !mod) SET_BIT(ch->immune, bitv); else SET_BIT(ch->immune, mod); } else { if(bitv && !mod) REMOVE_BIT(ch->immune, bitv); else REMOVE_BIT(ch->immune, mod); } } else if (loc == APPLY_SUSC) { if (add) { SET_BIT(ch->susc, mod); } else { REMOVE_BIT(ch->susc, mod); } } else if (loc == APPLY_M_IMMUNE) { if (add) { SET_BIT(ch->M_immune, mod); } else { REMOVE_BIT(ch->M_immune, mod); } } else if (loc == APPLY_SPELL) { if (add) { SET_BIT(ch->specials.affected_by, mod); } else { REMOVE_BIT(ch->specials.affected_by, mod); } } else if (loc == APPLY_WEAPON_SPELL) { return; } else if (loc == APPLY_BV2) { if (add) { SET_BIT(ch->specials.affected_by2, bitv); } else { REMOVE_BIT(ch->specials.affected_by2, bitv); } return; } else { if (add) { SET_BIT(ch->specials.affected_by, bitv); } else { REMOVE_BIT(ch->specials.affected_by, bitv); mod = -mod; } } switch(loc) { case APPLY_NONE: case APPLY_INTRINSIC: break; case APPLY_STR: ChangeStrength(ch, mod); break; case APPLY_DEX: #if 0 temp = GET_DEX(ch); temp2=GET_DEX(ch); if(temp2 < ch->abilities.dex) GET_DEX(ch)=ch->abilities.dex; if(temp > 18) temp=18; if(GET_DEX(ch) > 18) GET_DEX(ch)=18; GET_AC(ch) -= dex_app[temp].defensive; GET_AC(ch) += dex_app[GET_DEX(ch)].defensive; #endif GET_DEX(ch) += mod; break; case APPLY_INT: GET_INT(ch) += mod; break; case APPLY_WIS: GET_WIS(ch) += mod; break; case APPLY_CON: GET_CON(ch) += mod; break; case APPLY_SEX: GET_SEX(ch) = (!(ch->player.sex-1))+1; break; case APPLY_CHR: GET_CHR(ch) += mod; break; case APPLY_LEVEL: break; case APPLY_AGE: ch->player.time.birth -= SECS_PER_MUD_YEAR*mod; break; case APPLY_CHAR_WEIGHT: GET_WEIGHT(ch) += mod; break; case APPLY_CHAR_HEIGHT: GET_HEIGHT(ch) += mod; break; case APPLY_MANA: ch->points.max_mana += mod; break; case APPLY_HIT: /* ch->points.max_hit += mod; */ ch->points.max_hit += mod; break; case APPLY_MOVE: ch->points.max_move += mod; break; case APPLY_GOLD: break; case APPLY_EXP: break; case APPLY_AC: GET_AC(ch) += mod; break; case APPLY_HITROLL: GET_HITROLL(ch) += mod; break; case APPLY_DAMROLL: GET_DAMROLL(ch) += mod; break; /* negatives make saving throws better */ case APPLY_SAVING_PARA: ch->specials.apply_saving_throw[0] += mod; break; case APPLY_SAVING_ROD: ch->specials.apply_saving_throw[1] += mod; break; case APPLY_SAVING_PETRI: ch->specials.apply_saving_throw[2] += mod; break; case APPLY_SAVING_BREATH: ch->specials.apply_saving_throw[3] += mod; break; case APPLY_SAVING_SPELL: ch->specials.apply_saving_throw[4] += mod; break; case APPLY_SAVE_ALL: { for (i=0;i<=4;i++) ch->specials.apply_saving_throw[i] += mod; } break; case APPLY_IMMUNE: break; case APPLY_SUSC: break; case APPLY_M_IMMUNE: break; case APPLY_SPELL: break; case APPLY_HITNDAM: GET_HITROLL(ch) += mod; GET_DAMROLL(ch) += mod; break; case APPLY_WEAPON_SPELL: case APPLY_EAT_SPELL: break; case APPLY_BACKSTAB: if (!ch->skills) return; ch->skills[SKILL_BACKSTAB].learned += mod; break; case APPLY_KICK: if (!ch->skills) return; ch->skills[SKILL_KICK].learned += mod; break; case APPLY_SNEAK: if (!ch->skills) return; ch->skills[SKILL_SNEAK].learned += mod; break; case APPLY_HIDE: if (!ch->skills) return; ch->skills[SKILL_HIDE].learned += mod; break; case APPLY_BASH: if (!ch->skills) return; ch->skills[SKILL_BASH].learned += mod; break; case APPLY_PICK: if (!ch->skills) return; ch->skills[SKILL_PICK_LOCK].learned += mod; break; case APPLY_STEAL: if (!ch->skills) return; ch->skills[SKILL_STEAL].learned += mod; break; case APPLY_TRACK: if (!ch->skills) return; ch->skills[SKILL_HUNT].learned += mod; break; case APPLY_SPELLFAIL: ch->specials.spellfail += mod; break; case APPLY_HASTE: if (mod > 0) { if (WizLock) fprintf(stderr, "current mult = %f\n", ch->mult_att); ch->mult_att = ch->mult_att * 2.0; if (WizLock) fprintf(stderr, "new mult = %f\n", ch->mult_att); } else if (mod < 0) { ch->mult_att = ch->mult_att / 2.0; } break; case APPLY_SLOW: if (mod > 0) ch->mult_att /= 2.0; else if (mod < 0) ch->mult_att *= 2.0; break; case APPLY_ATTACKS: break; case APPLY_FIND_TRAPS: if (!ch->skills) return; ch->skills[SKILL_LOCATE_TRAP].learned += mod; break; case APPLY_RIDE: if (!ch->skills) return; ch->skills[SKILL_RIDE].learned += mod; break; case APPLY_RACE_SLAYER: case APPLY_ALIGN_SLAYER: break; case APPLY_MANA_REGEN: ch->points.mana_gain += mod; break; case APPLY_HIT_REGEN: ch->points.hit_gain += mod; break; case APPLY_MOVE_REGEN: ch->points.move_gain += mod; break; case APPLY_MOVE_BONUS: ch->specials.move_cost += mod; break; default: logE("Unknown apply adjust attempt (handler.c, affect_modify)."); logE(ch->player.name); break; } /* switch */ }
static int _domains (ATTSET *set, SCAN *scan, int tflags) { /* --- parse attribute domains */ ATT *att; /* attribute read */ int type; /* attribute type */ int t; /* temporary buffer */ double wgt; /* buffer for attribute weight */ const char *v; /* token value */ while ((sc_token(scan) == T_ID) /* parse domain definitions */ && ((strcmp(sc_value(scan), "dom") == 0) || (strcmp(sc_value(scan), "domain") == 0))) { GET_TOK(); /* consume 'dom' */ GET_CHR('('); /* consume '(' */ t = sc_token(scan); /* check next token for a valid name */ if ((t != T_ID) && (t != T_NUM)) ERROR(E_ATTEXP); att = att_create(sc_value(scan), AT_NOM); if (!att) ERROR(E_NOMEM); /* create an attribute and */ t = as_attadd(set, att); /* add it to the attribute set */ if (t) { att_delete(att); ERROR((t > 0) ? E_DUPATT : E_NOMEM); } GET_TOK(); /* consume attribute name */ GET_CHR(')'); /* consume ')' */ GET_CHR('='); /* consume '=' */ type = -1; /* init. attribute type to 'none' */ t = sc_token(scan); /* test next token */ if (t == '{') /* if a set of values follows, */ type = tflags & AT_NOM; /* attribute is nominal */ else if (t == T_ID) { /* if an identifier follows */ v = sc_value(scan); /* get it for simpler comparisons */ if ((strcmp(v, "ZZ") == 0) || (strcmp(v, "Z") == 0) || (strcmp(v, "int") == 0) || (strcmp(v, "integer") == 0)) type = tflags & AT_INT; /* attribute is integer-valued */ else if ((strcmp(v, "IR") == 0) || (strcmp(v, "R") == 0) || (strcmp(v, "real") == 0) || (strcmp(v, "float") == 0)) type = tflags & AT_REAL;/* attribute is real-valued */ } /* (get and check attribute type) */ if (type <= 0) ERROR(E_DOMAIN); att->type = type; /* set attribute type */ if (type != AT_NOM) { /* if attribute is numeric */ GET_TOK(); /* consume type indicator */ if (type == AT_INT) { /* if attribute is integer-valued */ att->min.i = INT_MAX; /* initialize minimal */ att->max.i = -INT_MAX;} /* and maximal value */ else { /* if attribute is real-valued */ att->min.f = FLT_MAX; /* initialize minimal */ att->max.f = -FLT_MAX; /* and maximal value */ } if (sc_token(scan) == '[') { /* if a range of values is given */ GET_TOK(); /* consume '[' */ if (sc_token(scan) != T_NUM) ERROR(E_NUMEXP); if (att_valadd(att, sc_value(scan), NULL) != 0) ERROR(E_NUMBER); /* get and check lower bound */ GET_TOK(); /* consume lower bound */ GET_CHR(','); /* consume ',' */ if (sc_token(scan) != T_NUM) ERROR(E_NUMEXP); if (att_valadd(att, sc_value(scan), NULL) != 0) ERROR(E_NUMBER); /* get and check upper bound */ GET_TOK(); /* consume upper bound */ GET_CHR(']'); /* consume ']' */ } } else { /* if attribute is nominal */ GET_CHR('{'); /* consume '{' */ if (sc_token(scan) != '}') { while (1) { /* read a list of values */ t = sc_token(scan); /* check for a name */ if ((t != T_ID) && (t != T_NUM)) ERROR(E_VALEXP); t = att_valadd(att, sc_value(scan), NULL); if (t) ERROR((t > 0) ? E_DUPVAL : E_NOMEM); GET_TOK(); /* get and consume attribute value */ if (sc_token(scan) != ',') break; GET_TOK(); /* if at end of list, abort loop, */ } /* otherwise consume ',' */ } GET_CHR('}'); /* consume '}' */ } if (sc_token(scan) == ':'){ /* if a direction indication follows */ GET_TOK(); /* consume ',' */ if (sc_token(scan) != T_ID) ERR_STR("in"); v = sc_value(scan); /* get the direction indicator */ if (strcmp(v, "none") == 0) att->dir = DIR_NONE; else if (strcmp(v, "in") == 0) att->dir = DIR_IN; else if (strcmp(v, "out") == 0) att->dir = DIR_OUT; else if (strcmp(v, "id") == 0) att->dir = DIR_ID; else if (strcmp(v, "wgt") == 0) att->dir = DIR_WGT; else ERR_STR("in"); /* get the direction code */ GET_TOK(); /* and consume the token */ } if (sc_token(scan) == ','){ /* if a weight indication follows */ if (sc_token(scan) != T_NUM) ERROR(E_NUMEXP); wgt = atof(sc_value(scan)); /* get the attribute weight */ if ((wgt <= NV_REAL) || (wgt > FLT_MAX)) ERROR(E_NUMBER); att->weight = (float)wgt; /* check and set attribute weight */ GET_TOK(); /* and consume the token */ } GET_CHR(';'); /* consume ';' */ } /* while ((sc_token(scan) == T_ID) .. */ return 0; /* return 'ok' */ } /* _domains() */