1-- Generate binding code 2-- Written by Waldemar Celes 3-- TeCGraf/PUC-Rio 4-- Jul 1998 5-- $Id: doit.lua,v 1.1 2001/10/29 17:49:53 rr9 Exp $ 6 7 8-- This code is free software; you can redistribute it and/or modify it. 9-- The software provided hereunder is on an "as is" basis, and 10-- the author has no obligation to provide maintenance, support, updates, 11-- enhancements, or modifications. 12 13 14-- open input file, if any 15if flags.f then 16 local st, msg = readfrom(flags.f) 17 if not st then 18 error('#'..msg) 19 end 20end 21 22-- define package name, if not provided 23if not flags.n then 24 if flags.f then 25 flags.n = gsub(flags.f,"%..*","") 26 else 27 error("#no package name nor input file provided") 28 end 29end 30 31local p = Package(flags.n) 32 33if flags.f then 34 readfrom() 35end 36 37if flags.p then 38 return -- only parse 39end 40 41if flags.o then 42 local st,msg = writeto(flags.o) 43 if not st then 44 error('#'..msg) 45 end 46end 47 48if flags.P then 49 p:print() 50else 51 p:decltag() 52 p:preamble() 53 p:supcode() 54 p:register() 55 p:unregister() 56end 57 58if flags.o then 59 writeto() 60end 61 62-- write header file 63if not flags.P then 64 if flags.H then 65 local st,msg = writeto(flags.H) 66 if not st then 67 error('#'..msg) 68 end 69 p:header() 70 writeto() 71 end 72end 73 74