create_splaytree(compare_string, copy_string, free_string)) == NULL) {
free_custom_shape(custom_shape);
return NULL;
}
create_splaytree(compare_string, copy_string, free_string)) == NULL) {
free_custom_shape(custom_shape);
return NULL;
}
create_splaytree(compare_int, copy_int, free_int)) == NULL) {
free_custom_shape(custom_shape);
return NULL;
}
create_splaytree(compare_int, copy_int, free_int)) == NULL) {
free_custom_shape(custom_shape);
return NULL;
}
create_splaytree(compare_string, copy_string, free_string)) == NULL) {
free_custom_shape(custom_shape);
return NULL;
}
create_splaytree(compare_string, copy_string, free_string)) == NULL) {
free_custom_shape(custom_shape);
return NULL;
}
create_splaytree(compare_string, copy_string, free_string)) == NULL) {
free_custom_shape(custom_shape);
return NULL;
create_splaytree(compare_string, copy_string, free_string)) == NULL) {
free_custom_shape(custom_shape);
return NULL;
if ((param = new_param_double("b", P_FLAG_NONE, &custom_shape->b, NULL, 1.0, 0.0, .5)) == NULL){
free_custom_shape(custom_shape);
if ((param = new_param_double("b", P_FLAG_NONE, &custom_shape->b, NULL, 1.0, 0.0, .5)) == NULL){
free_custom_shape(custom_shape);
if ((param = new_param_double("border_b", P_FLAG_NONE, &custom_shape->border_b, NULL, 1.0, 0.0, .5)) == NULL){
free_custom_shape(custom_shape);
if ((param = new_param_double("border_b", P_FLAG_NONE, &custom_shape->border_b, NULL, 1.0, 0.0, .5)) == NULL){
free_custom_shape(custom_shape);
if ((param = new_param_double("b2", P_FLAG_NONE, &custom_shape->b2, NULL, 1.0, 0.0, .5)) == NULL){
free_custom_shape(custom_shape);
if ((param = new_param_double("b2", P_FLAG_NONE, &custom_shape->b2, NULL, 1.0, 0.0, .5)) == NULL){
free_custom_shape(custom_shape);
if (insert_param(param, custom_shape->param_tree) < 0) {
free_custom_shape(custom_shape);
return NULL;
if (insert_param(param, custom_shape->param_tree) < 0) {
free_custom_shape(custom_shape);
return NULL;
if ((param = new_param_double("tex_ang", P_FLAG_NONE, &custom_shape->tex_ang, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0)) == NULL) {
free_custom_shape(custom_shape);
return NULL;
if ((param = new_param_double("tex_ang", P_FLAG_NONE, &custom_shape->tex_ang, NULL, MAX_DOUBLE_SIZE, -MAX_DOUBLE_SIZE, 0.0)) == NULL) {
free_custom_shape(custom_shape);
return NULL;
destroy_init_cond_tree_shape(custom_shape->init_cond_tree);
destroy_param_db_tree_shape(custom_shape->param_tree);
destroy_per_frame_init_eqn_tree_shape(custom_shape->per_frame_init_eqn_tree);
destroy_init_cond_tree_shape(custom_shape->init_cond_tree);
destroy_param_db_tree_shape(custom_shape->param_tree);
destroy_per_frame_init_eqn_tree_shape(custom_shape->per_frame_init_eqn_tree);
if (create_flag == FALSE) {
if (CUSTOM_SHAPE_DEBUG) printf("you specified not to (create flag = false), returning null\n");
return NULL;
}
if (create_flag == FALSE) {
if (CUSTOM_SHAPE_DEBUG) printf("you specified not to (create flag = false), returning null\n");
return NULL;
}
if ((custom_shape = new_custom_shape(id)) == NULL) {
if (CUSTOM_SHAPE_DEBUG) printf("failed...out of memory?\n");
return NULL;
}
if ((custom_shape = new_custom_shape(id)) == NULL) {
if (CUSTOM_SHAPE_DEBUG) printf("failed...out of memory?\n");
return NULL;
}
if (splay_insert(custom_shape, &custom_shape->id, preset->custom_shape_tree) < 0) {
if (CUSTOM_SHAPE_DEBUG) printf("failed, probably a duplicated!!\n");
free_custom_shape(custom_shape);
return NULL;
}
if (splay_insert(custom_shape, &custom_shape->id, preset->custom_shape_tree) < 0) {
if (CUSTOM_SHAPE_DEBUG) printf("failed, probably a duplicated!!\n");
free_custom_shape(custom_shape);
return NULL;
}
/* If initial condition was not defined by the preset file, force a default one
with the following code */
if ((init_cond = splay_find(param->name, interface_shape->init_cond_tree)) == NULL) {
/* If initial condition was not defined by the preset file, force a default one
with the following code */
if ((init_cond = splay_find(param->name, interface_shape->init_cond_tree)) == NULL) {
/* Make sure initial condition does not exist in the set of per frame initial equations */
if ((init_cond = splay_find(param->name, interface_shape->per_frame_init_eqn_tree)) != NULL)
return;
/* Make sure initial condition does not exist in the set of per frame initial equations */
if ((init_cond = splay_find(param->name, interface_shape->per_frame_init_eqn_tree)) != NULL)
return;
/* Create new initial condition */
if ((init_cond = new_init_cond(param, init_val)) == NULL)
return;
/* Create new initial condition */
if ((init_cond = new_init_cond(param, init_val)) == NULL)
return;
/* Insert the initial condition into this presets tree */
if (splay_insert(init_cond, init_cond->param->name, interface_shape->init_cond_tree) < 0) {
free_init_cond(init_cond);
return;
}
/* Insert the initial condition into this presets tree */
if (splay_insert(init_cond, init_cond->param->name, interface_shape->init_cond_tree) < 0) {
free_init_cond(init_cond);
return;
}