[comp.windows.x.motif] UIL -> C converter

sami@bwdlh312.bnr.ca (Sami Boulos) (06/13/91)

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.

Thanks, in advance.


--
Sami Boulos  |  Bell-Northern Research           |  (613) 765-2108
             |  P.O. Box 3511, Stn. C            | 
sami@bnr.ca  |  Ottawa, Ontario  Canada K1Y 4H7  |  #include <disclaimer.h>

marbru@auto-trol.com (Martin Brunecky) (06/14/91)

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,
    and I have yet to see a (properly defined) X resosurce file that
    would take a measurable time to read. I clocked 1000 lines/sec on
    a 2.5 MIPS VAXstation - with no I/O caching (I can't clock on my
    16 MIPS DECstation, as I don't have resource file long enough to
    do any timing).



-- 
=*= Opinions presented here are solely of my own and not those of Auto-trol =*=
Martin Brunecky                      marbru%auto-trol@sunpeaks.central.sun.com
(303) 252-2499                       (better avoid:  marbru@auto-trol.COM )
Auto-trol Technology Corp. 12500 North Washington St., Denver, CO 80241-2404 

stanley@icad.com (Stanley Knutson) (06/14/91)

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.

Some of UI development tools use or can read UIL, and then generate C code.
I believe ICS BuilderXcessory will do this, ask them: info@ics.com or 617-547-0510.
I am using a different UI tool, but was pretty impressed with ICS.
--
----------------------------------------------------------------------
Stanley Knutson                 ICAD, 201 Broadway, Cambridge MA 02139   
Stanley@icad.com                Knowledge-Based Mechanical Engineering
(617) 868-2800                  "Object-oriented mechanical design"

connolly@convex.com (Dan Connolly) (06/15/91)

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 <<EOF;
/* automatically generated: do not edit! */
typedef char* String;

String interface_resources[] = {
EOF


while(<>){
  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 <<EOF
  0
  };
EOF

marbru@auto-trol.com (Martin Brunecky) (06/18/91)

In article <connolly.676944889@convex.convex.com> connolly@convex.com (Dan Connolly) writes:
>In <1991Jun14.150955.25245@auto-trol.com> marbru@auto-trol.com (Martin Brunecky) writes:
>
>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.
>
   Mhmm. It can get fairly lengthy. What I occasionally do, is specify
   an application defined resource in my resource file - kind of "key".
   If after XtAppInitialize (or similar) I can't retrieve this resource,
   I assume my resource file was not found - so I print out a message
   to that extent and gracefully exit.
   Not that I mind the fallback resources - but havingh too much there
   could make your life miserable if you want to make on-site changes
   to the UI, as you ed up fighting your own "fallback" resources.

   Some other people explicitly load their Xrm files. The extremists can
   read encrypted resource files, so that the user is completely out of
   any luck.

-- Martin


-- 
=*= Opinions presented here are solely of my own and not those of Auto-trol =*=
Martin Brunecky                      marbru%auto-trol@sunpeaks.central.sun.com
(303) 252-2499                       (better avoid:  marbru@auto-trol.COM )
Auto-trol Technology Corp. 12500 North Washington St., Denver, CO 80241-2404