c4gl and gcc4 comments
Posted in 2006
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL
since 4gl.4ge cannot be executed if compiled with gcc version 4 I tried the following modification of the generated 4gl.c output and it seems to work. any comments and more test ? python 4gl.py > test.c ( just create a static char array for all these const chars and replace them with the address of the string ) 4gl.py ( dirty ) : import sys f=open(sys.argv[1]).readlines() out = [] char = "" count = 0 for i in f : work = i.split('{"') if len(work) > 1 : work1 = work[1].split('"') i=work[0] + "{__ignoramus__+ " + str(count) + work1[1] for k in work1[0] : if count <> 0 : char = char + "," char = char + "'" + k + "'" count = count + 1 char = char + ",0\\n" count = count + 1 work = i.split('_EFfldname = "') if len(work) > 1 : work = i.split('"') i=work[0] + "__ignoramus__+ " + str(count) + work[2] for k in work[1] : if count <> 0 : char = char + "," char = char + "'" + k + "'" count = count + 1 char = char + ",0\\n" count = count + 1 out.append(i) print "static char __ignoramus__[" + str(count + 1) + "]={" + char + \\ "};\\n" for i in out : print i[:-1] apo