コード例 #1
0
ファイル: 07a.c プロジェクト: abecderic/Advent-of-Code-2015
int simpleGetValueOf(char *wire)
{
	/* if this isn't a wire but a value */
    if (isdigit(wire[0]))
		return atoi(wire);

	/* wire only 1 character long -> add space infront */
    if (strlen(wire) == 1)
    {
        char newWire[3] = {0};
        newWire[0] = ' ';
        newWire[1] = wire[0];
        newWire[2] = '\0';
        wire = newWire;
    }

    int i = getFromTable(&table, wire);
    if (i != -1)
		return i;
	else
    {
    	int j = getValueOf(wire);
        putInTable(&table, wire, j);
        return j;
    }
}
コード例 #2
0
ファイル: ghjson.c プロジェクト: iannsp/githubit
void ghstringparse(ghout *out)
{
    json_t *root, *message;
    json_error_t error;
    root = json_loads(out->content, 0, &error);
    out->json = malloc(sizeof(root));
    if (!out->json) {
        printf("ERROR in json Data:%s.\n",error.text);
        exit(EXIT_FAILURE);
    }
    message = getValueOf(root, "message");
    if (json_is_object(message)){
        printf("message: %s\n", json_string_value(message));
    }
    out->json = root;
}
コード例 #3
0
int CustomIngredientImplementation::getValueOf(int stat) {

	String attribute = "";

	switch(stat) {
	case CraftingManager::CR:
		attribute = "res_cold_resist";
		break;
	case CraftingManager::CD:
		attribute = "res_conductivity";
		break;
	case CraftingManager::DR:
		attribute = "res_decay_resist";
		break;
	case CraftingManager::HR:
		attribute = "res_heat_resist";
		break;
	case CraftingManager::FL:
		attribute = "res_flavor";
		break;
	case CraftingManager::MA:
		attribute = "res_malleability";
		break;
	case CraftingManager::PE:
		attribute = "res_potential_energy";
		break;
	case CraftingManager::OQ:
		attribute = "res_quality";
		break;
	case CraftingManager::SR:
		attribute = "res_shock_resistance";
		break;
	case CraftingManager::UT:
		attribute = "res_toughness";
		break;
	default:
		return 0;
		break;
	}

	return getValueOf(attribute);
}
コード例 #4
0
int IrReader::getCentimetersOf(int addr, int size){
	int value = (int)getValueOf(addr, size);
	int cm = getCentimeterI2CMap(value);
	return cm;
}
コード例 #5
0
/*INSTANCE METHODS===============================*/
uint IrReader::getValue(){
	return getValueOf(i2c_addr, i2c_size);
}