void zpl_var_print(FILE* fp, const Var* var) { const char* name = xlp_getvarname(prog_get_lp(), var); VarClass class = xlp_getclass(prog_get_lp(), var); Bound* lower = xlp_getlower(prog_get_lp(), var); Bound* upper = xlp_getupper(prog_get_lp(), var); fprintf(fp, "\"%s\" ", name); switch(class) { case VAR_CON : fprintf(fp, "real ["); break; case VAR_IMP : fprintf(fp, "implicit integer ["); break; case VAR_INT : fprintf(fp, "integer ["); break; default : abort(); } bound_print(fp, lower); fprintf(fp, ","); bound_print(fp, upper); fprintf(fp, "] "); bound_free(upper); bound_free(lower); }
/* return False if we are in mode CON_FORM_NAME and * already a constraint with the prefix exists. Otherwise this * is unimportant, because all constraints will get a unique * number anyway. */ Bool conname_set(const char* prefix) { assert(prefix != NULL); assert(cname == NULL); cpfix = strdup(prefix); clen = strlen(cpfix) + 16; cname = malloc(clen); assert(cname != NULL); if (cform != CON_FORM_NAME) return TRUE; assert(cform == CON_FORM_NAME); count = 1; strcpy(cname, cpfix); strcat(cname, "_1"); if (xlp_conname_exists(prog_get_lp(), cname)) return FALSE; strcat(cname, "_a_0"); return !xlp_conname_exists(prog_get_lp(), cname); }