Hello, I have to convert an "ini"-file to pdf. On the one hand, it's easy for me to do most things in C, on the other hand, I would like to enlarge my experience with lua and ConTeXt. So here my question to the experts: what languages would you use for the different tasks? In fact, I believe lua could do a good job for some tasks, but I'm not really sure. Here the details: Example "ini"-file with 2 entries (the real file has about 200 entries): [temp_room] comment = the room temperature in °C description = This value must be sent at least once per 15 minutes, \ but only if a local sensor is connected to the device. size = 16 channel = master fb = RTS dpt = 2.009 dir = o [power] comment = the actual power available in % description = This value is only used to calculate the energy \ consumption. size = 8 channel = slave fb = HVA dpt = 4.307 dir = i The tasks: - put theses entries into a structured table (easy to do in C and the iniparser library http://ndevilla.free.fr/iniparser/ but it could be nice to do it in lua) - sorting (several PDF-documents with different sorting: by name, size, channel or other values) - filtering, for example _ must be converted to \_ and % to \% (same question: C, lua or ConTeXt) - formatting with nice layout (certainly with ConTeXt) For example, the first entry could become: 1.) temp_room, the room temperature in °C ----------------------------------------- ______________________________________________________________________ | Master | RTS | Output with datapoint type 2.009 (16 bits) | |___________|_________|______________________________________________| This value must be sent at least once per 15 minutes, but only if a local sensor is connected to the device. (Until now, I've coded just one line of lua-code in my life...) Perhaps, with your help, the subject line could become: ini -> MKIV -> pdf Thanks in advance for any hints and encouragements! Cheers, Peter -- http://pmrb.free.fr/contact/
Peter Münster wrote:
- put theses entries into a structured table (easy to do in C and the iniparser library http://ndevilla.free.fr/iniparser/ but it could be nice to do it in lua)
this kind of parsing is rather trival in lua
- sorting (several PDF-documents with different sorting: by name, size, channel or other values)
sorting is also easy
- filtering, for example _ must be converted to \_ and % to \% (same question: C, lua or ConTeXt)
depends, if the font has _ no conversion is needed (otf fonts have this)
- formatting with nice layout (certainly with ConTeXt)
ini parsing ... look into string.find; loop over the lines and triugger on [...] and ...=... Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Fri, Feb 22 2008, Hans Hagen wrote:
- filtering, for example _ must be converted to \_ and % to \% (same question: C, lua or ConTeXt)
depends, if the font has _ no conversion is needed (otf fonts have this)
Since I'm using MKIV, I think the default font should be the lm otf version, isn't it? What setup is needed, to make "_" behave like a real underscore?
ini parsing ... look into string.find; loop over the lines and triugger on [...] and ...=...
Thanks, I've spent some minutes today looking into the string, io and table libraries, and indeed lua looks very powerful. Perhaps, this will result in a module. Cheers, Peter -- http://pmrb.free.fr/contact/
Quoting Peter Münster
On Fri, Feb 22 2008, Hans Hagen wrote:
- filtering, for example _ must be converted to \_ and % to \% (same question: C, lua or ConTeXt)
depends, if the font has _ no conversion is needed (otf fonts have this)
Since I'm using MKIV, I think the default font should be the lm otf version, isn't it? What setup is needed, to make "_" behave like a real underscore?
\nonknuthmode (and there is \donknuthmode to get the default behaviour) Aditya
Peter Münster wrote:
On Fri, Feb 22 2008, Hans Hagen wrote:
- filtering, for example _ must be converted to \_ and % to \% (same question: C, lua or ConTeXt) depends, if the font has _ no conversion is needed (otf fonts have this)
Since I'm using MKIV, I think the default font should be the lm otf version, isn't it? What setup is needed, to make "_" behave like a real underscore?
\nonknuthmode ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (3)
-
Aditya Mahajan
-
Hans Hagen
-
Peter Münster