Beispiel #1
0
//カテゴリの消去、バリュも全て消去
//input は"category"の形式で受け取る
void category_del(attribute_list* att_list, char* input) {
    Attribute *att_ptr;
    Attribute *temp;
    char *category;
    char *tp;
    
    tp = strtok(input, " \"");
    category = malloc(sizeof(tp));
    strcpy(category, tp);
    
    att_ptr = att_list->attribute;
    temp = NULL;
    while (att_ptr != NULL) {
        if (strcmp(att_ptr->data, category)) {
            temp = att_ptr;
            att_ptr = att_ptr->next;
            continue;
        }
        if (temp == NULL) att_list->attribute = att_ptr->next;
        else temp->next = att_ptr->next;
        att_ptr->next = NULL;
        clear_attribute(att_ptr, 1);
        att_list->cnum--;
        free(category);
        return;
    }
    
    printf("input category not exit error\n");
    free(category);
    return;
}
Beispiel #2
0
void clear_attribute(Attribute* attribute, int all) {
	if (all == 1) {
		if (attribute->next != NULL) clear_attribute(attribute->next, 1);
	}
	if (attribute->value != NULL) clear_value(attribute->value, 1);
	memset(attribute, 0, sizeof(Attribute));
	free(attribute);
	return;
}
Beispiel #3
0
void
destroy_OGL() {
	destroy_shader(fragShader);
	destroy_shader(vertexShader);
	destroy_program(program);
	clear_attribute(vertPosAttrib);
	clear_attribute(texCoordAttrib);
	clear_uniform(colorUni);
	clear_uniform(diffuseSamplerUni);
	
	destroy_texture(whiteTexture);

	free(whiteTexture);

	free(program);

	free(fragShader);
	free(vertexShader);

	free(vertPosAttrib);
	free(texCoordAttrib);
	free(colorUni);
	free(diffuseSamplerUni);
}
Beispiel #4
0
void clear_att_list(attribute_list* att_list) {
	if(att_list->attribute != NULL) clear_attribute(att_list->attribute, 1);
	free(att_list);
	return;
}
Beispiel #5
0
void set_attribute(void* message, int value, int bitmask, int shift_count) {
    unsigned int new_message;
    clear_attribute(message, bitmask);
    new_message = (unsigned int) *((int*) message) | (value << shift_count);
    memcpy(message, (void*) &new_message, MESSAGE_SIZE);
}
Beispiel #6
0
void clear_result(void* message) {
    clear_attribute(message, UNMASK__RESULT);
}
Beispiel #7
0
void clear_ack(void* message) {
    clear_attribute(message, UNMASK__ACK);
}
Beispiel #8
0
void clear_number(void* message) {
    clear_attribute(message, UNMASK__NUMBER);
}
Beispiel #9
0
void clear_argument(void* message) {
    clear_attribute(message, UNMASK__ARGUMENT);
}
Beispiel #10
0
void clear_opcode(void* message) {
    clear_attribute(message, UNMASK__OPCODE);
}