instance names (refdes) are hashed as uppercase, so collision check will be case insensitive, if enabled
This commit is contained in:
parent
0a61fb8362
commit
ef2e059c59
|
|
@ -207,7 +207,7 @@ char *uniq_inc_str(const char *includes, const char *isep, const char *osep, int
|
||||||
|
|
||||||
/* assemble the output */
|
/* assemble the output */
|
||||||
|
|
||||||
if (0>=eren)
|
if (eren <= 0)
|
||||||
uniq_inc_assemble_normal(ret, numelem, arr, osep, oseplen);
|
uniq_inc_assemble_normal(ret, numelem, arr, osep, oseplen);
|
||||||
else
|
else
|
||||||
uniq_inc_assemble_groups(ret, numelem, arr, osep, oseplen, eren, eres);
|
uniq_inc_assemble_groups(ret, numelem, arr, osep, oseplen, eren, eres);
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,9 @@ $(BIN)/gui/find_misc.o: $(SRC)/gui/find_misc.c
|
||||||
$(BIN)/gui/find_gl.o: $(SRC)/gui/find_gl.c
|
$(BIN)/gui/find_gl.o: $(SRC)/gui/find_gl.c
|
||||||
$(CC) $(CFLAGS) -c $(SRC)/gui/find_gl.c -o $(BIN)/gui/find_gl.o
|
$(CC) $(CFLAGS) -c $(SRC)/gui/find_gl.c -o $(BIN)/gui/find_gl.o
|
||||||
|
|
||||||
|
$(BIN)/gui/find_sdl2.o: $(SRC)/gui/find_sdl2.c
|
||||||
|
$(CC) $(CFLAGS) -c $(SRC)/gui/find_sdl2.c -o $(BIN)/gui/find_sdl2.o
|
||||||
|
|
||||||
$(BIN)/gui/find_cairo.o: $(SRC)/gui/find_cairo.c
|
$(BIN)/gui/find_cairo.o: $(SRC)/gui/find_cairo.c
|
||||||
$(CC) $(CFLAGS) -c $(SRC)/gui/find_cairo.c -o $(BIN)/gui/find_cairo.o
|
$(CC) $(CFLAGS) -c $(SRC)/gui/find_cairo.c -o $(BIN)/gui/find_cairo.o
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,3 +84,98 @@ int find_sdl2(const char *name, int logdepth, int fatal)
|
||||||
|
|
||||||
return try_fail(logdepth, node);
|
return try_fail(logdepth, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int find_sdl2_gfx(const char *name, int logdepth, int fatal)
|
||||||
|
{
|
||||||
|
const char *test_c =
|
||||||
|
NL "#include <SDL2_gfxPrimitives.h>"
|
||||||
|
NL "#include <stdlib.h>"
|
||||||
|
NL "int main()"
|
||||||
|
NL "{"
|
||||||
|
NL " aalineColor(NULL, 1, 2, 3, 4, 100);"
|
||||||
|
NL " return 0;"
|
||||||
|
NL "}"
|
||||||
|
NL;
|
||||||
|
char *cflags, *ldflags;
|
||||||
|
const char *ocf, *olf;
|
||||||
|
const char *node = "libs/gui/sdl2_gfx";
|
||||||
|
int succ;
|
||||||
|
|
||||||
|
if (require("cc/cc", logdepth, fatal))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
report("Checking for sdl2_gfx... ");
|
||||||
|
logprintf(logdepth, "find_sdl2_gfx:\n");
|
||||||
|
logdepth++;
|
||||||
|
|
||||||
|
if (run_pkg_config(logdepth, "SDL2_gfx", &cflags, &ldflags) == 0)
|
||||||
|
if (try_icl_norun(logdepth, node, test_c, NULL, cflags, ldflags) != 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* extend SDL2's cflags and ldflags */
|
||||||
|
if (require("libs/gui/sdl2/cflags", logdepth, fatal))
|
||||||
|
return try_fail(logdepth, node);
|
||||||
|
if (require("libs/gui/sdl2/ldflags", logdepth, fatal))
|
||||||
|
return try_fail(logdepth, node);
|
||||||
|
|
||||||
|
ocf = get("libs/gui/sdl2/cflags");
|
||||||
|
olf = get("libs/gui/sdl2/ldflags");
|
||||||
|
|
||||||
|
cflags = (char *)ocf;
|
||||||
|
ldflags = str_concat(" ", "-lSDL2_gfx", olf, NULL);
|
||||||
|
succ = try_icl_norun(logdepth, node, test_c, NULL, cflags, ldflags);
|
||||||
|
free(ldflags);
|
||||||
|
|
||||||
|
if (succ != 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return try_fail(logdepth, node);
|
||||||
|
}
|
||||||
|
|
||||||
|
int find_sdl2_ttf(const char *name, int logdepth, int fatal)
|
||||||
|
{
|
||||||
|
const char *test_c =
|
||||||
|
NL "#include <SDL_ttf.h>"
|
||||||
|
NL "#include <stdio.h>"
|
||||||
|
NL "int main()"
|
||||||
|
NL "{"
|
||||||
|
NL " if (TTF_Init() == 0)"
|
||||||
|
NL " puts(\"OK\");"
|
||||||
|
NL " return 0;"
|
||||||
|
NL "}"
|
||||||
|
NL;
|
||||||
|
char *cflags, *ldflags;
|
||||||
|
const char *ocf, *olf;
|
||||||
|
const char *node = "libs/gui/sdl2_ttf";
|
||||||
|
int succ;
|
||||||
|
|
||||||
|
if (require("cc/cc", logdepth, fatal))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
report("Checking for sdl2_ttf... ");
|
||||||
|
logprintf(logdepth, "find_sdl2_ttf:\n");
|
||||||
|
logdepth++;
|
||||||
|
|
||||||
|
if (run_pkg_config(logdepth, "SDL2_ttf", &cflags, &ldflags) == 0)
|
||||||
|
if (try_icl(logdepth, node, test_c, NULL, cflags, ldflags) != 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* extend SDL2's cflags and ldflags */
|
||||||
|
if (require("libs/gui/sdl2/cflags", logdepth, fatal))
|
||||||
|
return try_fail(logdepth, node);
|
||||||
|
if (require("libs/gui/sdl2/ldflags", logdepth, fatal))
|
||||||
|
return try_fail(logdepth, node);
|
||||||
|
|
||||||
|
ocf = get("libs/gui/sdl2/cflags");
|
||||||
|
olf = get("libs/gui/sdl2/ldflags");
|
||||||
|
|
||||||
|
cflags = (char *)ocf;
|
||||||
|
ldflags = str_concat(" ", "-lSDL2_ttf", olf, NULL);
|
||||||
|
succ = try_icl(logdepth, node, test_c, NULL, cflags, ldflags);
|
||||||
|
free(ldflags);
|
||||||
|
|
||||||
|
if (succ != 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return try_fail(logdepth, node);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,4 @@
|
||||||
int find_sdl2(const char *name, int logdepth, int fatal);
|
int find_sdl2(const char *name, int logdepth, int fatal);
|
||||||
|
int find_sdl2_gfx(const char *name, int logdepth, int fatal);
|
||||||
|
int find_sdl2_ttf(const char *name, int logdepth, int fatal);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -320,3 +320,40 @@ int find_xpm(const char *name, int logdepth, int fatal)
|
||||||
}
|
}
|
||||||
return try_fail(logdepth, node);
|
return try_fail(logdepth, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int find_keysymtoucs4(const char *name, int logdepth, int fatal)
|
||||||
|
{
|
||||||
|
const char *test_c =
|
||||||
|
NL "#include <stdio.h>"
|
||||||
|
NL "#include <X11/Xlib.h>"
|
||||||
|
NL "extern unsigned int KeySymToUcs4(KeySym keysym);"
|
||||||
|
NL "int main()"
|
||||||
|
NL "{"
|
||||||
|
NL " if (KeySymToUcs4(32) == 32)"
|
||||||
|
NL " puts(\"OK\");"
|
||||||
|
NL " return 0;"
|
||||||
|
NL "}"
|
||||||
|
NL;
|
||||||
|
const char *node = "libs/gui/keysymtoucs4";
|
||||||
|
const char *xincludes, *xcflags, *xldflags;
|
||||||
|
|
||||||
|
if (require("cc/cc", logdepth, fatal))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (require("libs/gui/xopendisplay/*", logdepth, fatal))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
xincludes = get("libs/gui/xopendisplay/includes");
|
||||||
|
xcflags = get("libs/gui/xopendisplay/cflags");
|
||||||
|
xldflags = get("libs/gui/xopendisplay/ldflags");
|
||||||
|
|
||||||
|
report("Checking for KeySymToUcs4... ");
|
||||||
|
logprintf(logdepth, "find_KeySymToUcs4:\n");
|
||||||
|
logdepth++;
|
||||||
|
|
||||||
|
/* This should be standard X11 call, but not published so better test */
|
||||||
|
if (try_icl_with_deps(logdepth, node, test_c, NULL, NULL, NULL, xincludes, xcflags, xldflags, 1) != 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return try_fail(logdepth, node);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,5 @@ int find_xcb(const char *name, int logdepth, int fatal);
|
||||||
int find_xcb_render(const char *name, int logdepth, int fatal);
|
int find_xcb_render(const char *name, int logdepth, int fatal);
|
||||||
int find_xgetxcbconnection(const char *name, int logdepth, int fatal);
|
int find_xgetxcbconnection(const char *name, int logdepth, int fatal);
|
||||||
int find_xpm(const char *name, int logdepth, int fatal);
|
int find_xpm(const char *name, int logdepth, int fatal);
|
||||||
|
int find_keysymtoucs4(const char *name, int logdepth, int fatal);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ void deps_gui_init()
|
||||||
dep_add("libs/gui/xcb_render/*", find_xcb_render);
|
dep_add("libs/gui/xcb_render/*", find_xcb_render);
|
||||||
dep_add("libs/gui/xgetxcbconnection/*", find_xgetxcbconnection);
|
dep_add("libs/gui/xgetxcbconnection/*", find_xgetxcbconnection);
|
||||||
dep_add("libs/gui/xpm/*", find_xpm);
|
dep_add("libs/gui/xpm/*", find_xpm);
|
||||||
|
dep_add("libs/gui/keysymtoucs4/*", find_keysymtoucs4);
|
||||||
dep_add("libs/gui/gtk2/*", find_gtk2);
|
dep_add("libs/gui/gtk2/*", find_gtk2);
|
||||||
dep_add("libs/gui/gtk2gl/*", find_gtk2gl);
|
dep_add("libs/gui/gtk2gl/*", find_gtk2gl);
|
||||||
dep_add("libs/gui/gtk2/key_prefix", find_gtk2_key_prefix);
|
dep_add("libs/gui/gtk2/key_prefix", find_gtk2_key_prefix);
|
||||||
|
|
@ -49,4 +50,6 @@ void deps_gui_init()
|
||||||
dep_add("libs/gui/wgl/*", find_gui_wgl);
|
dep_add("libs/gui/wgl/*", find_gui_wgl);
|
||||||
dep_add("libs/gui/glfw/*", find_glfw);
|
dep_add("libs/gui/glfw/*", find_glfw);
|
||||||
dep_add("libs/gui/sdl2/*", find_sdl2);
|
dep_add("libs/gui/sdl2/*", find_sdl2);
|
||||||
|
dep_add("libs/gui/sdl2_gfx/*", find_sdl2_gfx);
|
||||||
|
dep_add("libs/gui/sdl2_ttf/*", find_sdl2_ttf);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
38
src/token.c
38
src/token.c
|
|
@ -65,8 +65,9 @@ static Inst_hashentry *inst_hash_lookup(char *token, int value, int what, size_t
|
||||||
entry=(Inst_hashentry *) my_malloc(425, s);
|
entry=(Inst_hashentry *) my_malloc(425, s);
|
||||||
*preventry=entry;
|
*preventry=entry;
|
||||||
entry->next=NULL;
|
entry->next=NULL;
|
||||||
|
entry->token = NULL;
|
||||||
|
my_strdup(1248, &entry->token, token);
|
||||||
entry->hash=hashcode;
|
entry->hash=hashcode;
|
||||||
entry->token = xctx->inst[value].instname; /* do not strdup, store pointer */
|
|
||||||
entry->value = value;
|
entry->value = value;
|
||||||
}
|
}
|
||||||
return NULL; /* token was not in hash */
|
return NULL; /* token was not in hash */
|
||||||
|
|
@ -74,6 +75,7 @@ static Inst_hashentry *inst_hash_lookup(char *token, int value, int what, size_t
|
||||||
if( entry->hash==hashcode && !strcmp(token,entry->token) ) { /* found a matching token */
|
if( entry->hash==hashcode && !strcmp(token,entry->token) ) { /* found a matching token */
|
||||||
if(what == XDELETE) { /* remove token from the hash table ... */
|
if(what == XDELETE) { /* remove token from the hash table ... */
|
||||||
saveptr=entry->next;
|
saveptr=entry->next;
|
||||||
|
my_free(1249, &entry->token);
|
||||||
my_free(969, &entry);
|
my_free(969, &entry);
|
||||||
*preventry=saveptr;
|
*preventry=saveptr;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -112,11 +114,15 @@ static void inst_hash_free(void) /* remove the whole hash table */
|
||||||
void hash_all_names(int n)
|
void hash_all_names(int n)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
char*upinst = NULL;
|
||||||
inst_hash_free();
|
inst_hash_free();
|
||||||
for(i=0; i<xctx->instances; i++) {
|
for(i=0; i<xctx->instances; i++) {
|
||||||
|
my_strdup(1254, &upinst, xctx->inst[i].instname);
|
||||||
|
strtoupper(upinst);
|
||||||
/* if(i == n) continue; */
|
/* if(i == n) continue; */
|
||||||
inst_hash_lookup(xctx->inst[i].instname, i, XINSERT, strlen(xctx->inst[i].instname));
|
inst_hash_lookup(upinst, i, XINSERT, strlen(upinst));
|
||||||
}
|
}
|
||||||
|
my_free(1255, &upinst);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *tcl_hook2(char **res)
|
const char *tcl_hook2(char **res)
|
||||||
|
|
@ -155,6 +161,7 @@ void check_unique_names(int rename)
|
||||||
char *tmp = NULL;
|
char *tmp = NULL;
|
||||||
Inst_hashentry *entry;
|
Inst_hashentry *entry;
|
||||||
int big = xctx->wires> 2000 || xctx->instances > 2000;
|
int big = xctx->wires> 2000 || xctx->instances > 2000;
|
||||||
|
char *upinst = NULL;
|
||||||
/* int save_draw; */
|
/* int save_draw; */
|
||||||
|
|
||||||
if(xctx->hilight_nets) {
|
if(xctx->hilight_nets) {
|
||||||
|
|
@ -175,8 +182,10 @@ void check_unique_names(int rename)
|
||||||
first = 1;
|
first = 1;
|
||||||
for(i=0;i<xctx->instances;i++) {
|
for(i=0;i<xctx->instances;i++) {
|
||||||
if(xctx->inst[i].instname && xctx->inst[i].instname[0]) {
|
if(xctx->inst[i].instname && xctx->inst[i].instname[0]) {
|
||||||
if( (entry = inst_hash_lookup(xctx->inst[i].instname, i, XINSERT_NOREPLACE,
|
my_strdup(1246, &upinst, xctx->inst[i].instname);
|
||||||
strlen(xctx->inst[i].instname)) ) && entry->value != i) {
|
strtoupper(upinst);
|
||||||
|
if( (entry = inst_hash_lookup(upinst, i, XINSERT_NOREPLACE,
|
||||||
|
strlen(upinst)) ) && entry->value != i) {
|
||||||
xctx->inst[i].color = -PINLAYER;
|
xctx->inst[i].color = -PINLAYER;
|
||||||
xctx->hilight_nets=1;
|
xctx->hilight_nets=1;
|
||||||
if(rename == 1) {
|
if(rename == 1) {
|
||||||
|
|
@ -194,13 +203,16 @@ void check_unique_names(int rename)
|
||||||
if( (xctx->inst[i].color != -10000) && rename) {
|
if( (xctx->inst[i].color != -10000) && rename) {
|
||||||
my_strdup(511, &tmp, xctx->inst[i].prop_ptr);
|
my_strdup(511, &tmp, xctx->inst[i].prop_ptr);
|
||||||
new_prop_string(i, tmp, newpropcnt++, 0);
|
new_prop_string(i, tmp, newpropcnt++, 0);
|
||||||
inst_hash_lookup(xctx->inst[i].instname, i, XINSERT, strlen(xctx->inst[i].instname));
|
my_strdup(1259, &upinst, xctx->inst[i].instname);
|
||||||
|
strtoupper(upinst);
|
||||||
|
inst_hash_lookup(upinst, i, XINSERT, strlen(upinst));
|
||||||
symbol_bbox(i, &xctx->inst[i].x1, &xctx->inst[i].y1, &xctx->inst[i].x2, &xctx->inst[i].y2);
|
symbol_bbox(i, &xctx->inst[i].x1, &xctx->inst[i].y1, &xctx->inst[i].x2, &xctx->inst[i].y2);
|
||||||
bbox(ADD, xctx->inst[i].x1, xctx->inst[i].y1, xctx->inst[i].x2, xctx->inst[i].y2);
|
bbox(ADD, xctx->inst[i].x1, xctx->inst[i].y1, xctx->inst[i].x2, xctx->inst[i].y2);
|
||||||
my_free(972, &tmp);
|
my_free(972, &tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} /* for(i...) */
|
} /* for(i...) */
|
||||||
|
my_free(1247, &upinst);
|
||||||
if(rename == 1 && xctx->hilight_nets) {
|
if(rename == 1 && xctx->hilight_nets) {
|
||||||
bbox(SET,0.0,0.0,0.0,0.0);
|
bbox(SET,0.0,0.0,0.0,0.0);
|
||||||
draw();
|
draw();
|
||||||
|
|
@ -635,6 +647,8 @@ void new_prop_string(int i, const char *old_prop, int fast, int dis_uniq_names)
|
||||||
int n;
|
int n;
|
||||||
char *old_name_base = NULL;
|
char *old_name_base = NULL;
|
||||||
Inst_hashentry *entry;
|
Inst_hashentry *entry;
|
||||||
|
char *up_old_name = NULL;
|
||||||
|
char *up_new_name = NULL;
|
||||||
|
|
||||||
dbg(1, "new_prop_string(): i=%d, old_prop=%s, fast=%d\n", i, old_prop, fast);
|
dbg(1, "new_prop_string(): i=%d, old_prop=%s, fast=%d\n", i, old_prop, fast);
|
||||||
if(!fast) { /* on 1st invocation of new_prop_string */
|
if(!fast) { /* on 1st invocation of new_prop_string */
|
||||||
|
|
@ -647,6 +661,8 @@ void new_prop_string(int i, const char *old_prop, int fast, int dis_uniq_names)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
old_name_len = my_strdup(444, &old_name,get_tok_value(old_prop,"name",0) ); /* added old_name_len */
|
old_name_len = my_strdup(444, &old_name,get_tok_value(old_prop,"name",0) ); /* added old_name_len */
|
||||||
|
my_strdup(1256, &up_old_name, old_name);
|
||||||
|
strtoupper(up_old_name);
|
||||||
|
|
||||||
if(old_name==NULL)
|
if(old_name==NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -656,12 +672,12 @@ void new_prop_string(int i, const char *old_prop, int fast, int dis_uniq_names)
|
||||||
}
|
}
|
||||||
xctx->prefix=old_name[0];
|
xctx->prefix=old_name[0];
|
||||||
/* don't change old_prop if name does not conflict. */
|
/* don't change old_prop if name does not conflict. */
|
||||||
if(dis_uniq_names || (entry = inst_hash_lookup(old_name, i, XLOOKUP, old_name_len))==NULL ||
|
if(dis_uniq_names || (entry = inst_hash_lookup(up_old_name, i, XLOOKUP, old_name_len))==NULL ||
|
||||||
entry->value == i)
|
entry->value == i)
|
||||||
{
|
{
|
||||||
my_strdup(447, &xctx->inst[i].prop_ptr, old_prop);
|
my_strdup(447, &xctx->inst[i].prop_ptr, old_prop);
|
||||||
my_strdup2(90, &xctx->inst[i].instname, old_name);
|
my_strdup2(90, &xctx->inst[i].instname, old_name);
|
||||||
inst_hash_lookup(old_name, i, XINSERT, old_name_len);
|
inst_hash_lookup(up_old_name, i, XINSERT, old_name_len);
|
||||||
my_free(985, &old_name);
|
my_free(985, &old_name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -677,7 +693,9 @@ void new_prop_string(int i, const char *old_prop, int fast, int dis_uniq_names)
|
||||||
} else { /* goes here if weird name set for example to name=[3:0] or name=12 */
|
} else { /* goes here if weird name set for example to name=[3:0] or name=12 */
|
||||||
new_name_len = my_snprintf(new_name, old_name_len + 40, "%c%d%s", xctx->prefix,q, tmp);
|
new_name_len = my_snprintf(new_name, old_name_len + 40, "%c%d%s", xctx->prefix,q, tmp);
|
||||||
}
|
}
|
||||||
if((entry = inst_hash_lookup(new_name, i, XLOOKUP, new_name_len)) == NULL || entry->value == i)
|
my_strdup(1258, &up_new_name, new_name);
|
||||||
|
strtoupper(up_new_name);
|
||||||
|
if((entry = inst_hash_lookup(up_new_name, i, XLOOKUP, new_name_len)) == NULL || entry->value == i)
|
||||||
{
|
{
|
||||||
last[(int)xctx->prefix]=q+1;
|
last[(int)xctx->prefix]=q+1;
|
||||||
break;
|
break;
|
||||||
|
|
@ -688,10 +706,12 @@ void new_prop_string(int i, const char *old_prop, int fast, int dis_uniq_names)
|
||||||
if(strcmp(tmp2, old_prop) ) {
|
if(strcmp(tmp2, old_prop) ) {
|
||||||
my_strdup(449, &xctx->inst[i].prop_ptr, tmp2);
|
my_strdup(449, &xctx->inst[i].prop_ptr, tmp2);
|
||||||
my_strdup2(235, &xctx->inst[i].instname, new_name);
|
my_strdup2(235, &xctx->inst[i].instname, new_name);
|
||||||
inst_hash_lookup(new_name, i, XINSERT, new_name_len); /* reinsert in hash */
|
inst_hash_lookup(up_new_name, i, XINSERT, new_name_len); /* reinsert in hash */
|
||||||
}
|
}
|
||||||
my_free(987, &old_name);
|
my_free(987, &old_name);
|
||||||
|
my_free(1257, &up_old_name);
|
||||||
my_free(988, &new_name);
|
my_free(988, &new_name);
|
||||||
|
my_free(1260, &up_new_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue