Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!convex!connolly From: connolly@convex.com (Dan Connolly) Newsgroups: comp.windows.x.motif Subject: Re: UIL -> C converter Message-ID: Date: 15 Jun 91 00:14:49 GMT References: <7061@bwdls58.bnr.ca> <1991Jun14.150955.25245@auto-trol.com> Sender: usenet@convex.com (news access account) Organization: CONVEX Computer Corporation, Richardson, Tx., USA Lines: 73 Nntp-Posting-Host: pixel.convex.com In <1991Jun14.150955.25245@auto-trol.com> marbru@auto-trol.com (Martin Brunecky) writes: >In article <7061@bwdls58.bnr.ca> sami@bwdlh312.bnr.ca (Sami Boulos) writes: >> >>Is there a tool that converts UIL to C code? >>The reason I ask this question is to permit me to write UIL code, >>convert it to C, and compile the C code with the rest of my >>code, instead of having to perform file I/O in reading a .uid >>file. >> > No, I doubt there is an UIL->C converter. For the obvious reason: > it is the worst thing to do. However, some of the new generation > UI munglers may be able to read UIL file and spit out either UIL > or "C". > But. Why to do it ? If you don't like the UIL overhead, just simply > use Wcl ! This one adds no runtime overhead - the widget creation > behavior/flow is identical to your "C" code (in fact, it IS the C > code creating your widgets - Widget Creation Library -). > Your UI definition still remains separate from you "C" code, so > nothing hardcoded. Yes, you get an overhead of resource file read, > but Xt does not ask you and ALWAYS tries to read those resource files, Not necessarily: I use the normal run-time reading of resource files for prototyping and development, but when I'm ready to build the production version, I translate the resource file into a C array (we love Perl :), and use it as the fallback_resources argument when I initialize Xt. Win win. We love Wcl. p.s. No guarantees, but here's the perl script: #!/usr/local/bin/perl # # convert a resource file into a C array of resource strings # print <){ next if /^#/; local ($c); next if /^\s*!/; #skip !-style comments next unless /\S/; #and blank lines chop; #continue lines ending in \ while(/\\$/){ chop; $_ .= <>; chop; } s/\\/\\\\/g; s/"/\\"/g; print "\"$_\",\n"; } print <