Post Reply 
A quick and dirty forms generator
11-06-2020, 08:36 PM (This post was last modified: 11-07-2020 06:51 PM by emax.)
Post: #1
A quick and dirty forms generator
I was tired of searching for syntax errors in INPUT definitions and of counting braces and curly braces. So I have written a very simple, quick&dirty forms generator. It reads a very simple input and generates the INPUT code.

Note: This is only tested for my personal needs. So far, this means only basic datatypes, drop-down boxes with alpha values and checkboxes.

As I am a pure linux user, I did this in perl (feel free to rewrite it in your language of choice).

An example input file (form.hpfrm) is included. Some explanations inside.

I will fix bugs if reported here and if I have time.

Have fun.

For tar users & linuxees:
.txt  formgen_tgz.txt (Size: 1.97 KB / Downloads: 11)

UPDATE:
Zip version:
.zip  formgen.zip (Size: 2.16 KB / Downloads: 6)

PS: rename formgen_tgz.txt to formgen.tgz and then "tar xvzf formgen.tgz". You'll get two files: A sample form and the script. Depending on your umask you'll eventually have to "chmod ug+x crthppfrm.pl"
Find all posts by this user
Quote this message in a reply
11-07-2020, 08:34 AM
Post: #2
RE: A quick and dirty forms generator
I'm afraid Windows users won't have a clue what to do with a tarball and won't have the ability to extract the files in one. It's best to upload a zip file.

There are only 10 types of people in this world. Those who understand binary and those who don't.
Find all posts by this user
Quote this message in a reply
11-07-2020, 10:29 AM
Post: #3
RE: A quick and dirty forms generator
(11-07-2020 08:34 AM)grsbanks Wrote:  I'm afraid Windows users won't have a clue what to do with a tarball and won't have the ability to extract the files in one. It's best to upload a zip file.

The Windows users who have no clue what to do with a tarball would probably have even less of a clue what to do with a Perl script!

— Ian Abbott
Find all posts by this user
Quote this message in a reply
11-07-2020, 01:36 PM
Post: #4
RE: A quick and dirty forms generator
(11-07-2020 10:29 AM)ijabbott Wrote:  
(11-07-2020 08:34 AM)grsbanks Wrote:  I'm afraid Windows users won't have a clue what to do with a tarball and won't have the ability to extract the files in one. It's best to upload a zip file.

The Windows users who have no clue what to do with a tarball would probably have even less of a clue what to do with a Perl script!

I had to smile here, always a good way to start the day, thanks for that. Smile

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
11-07-2020, 06:37 PM (This post was last modified: 11-07-2020 07:23 PM by emax.)
Post: #5
RE: A quick and dirty forms generator
(11-07-2020 08:34 AM)grsbanks Wrote:  I'm afraid Windows users won't have a clue what to do with a tarball and won't have the ability to extract the files in one. It's best to upload a zip file.

I agree with ijabbott:
> The Windows users who have no clue what to do
> with a tarball would probably have even less of a clue what to do with a Perl script!

Maybe there two kinds of windows users. Those who have a perl interpreter installed: They will usually know what to do. And those who don't have a perl interpreter: They can simply not run the script. But there is free perl for download on the web.

But though I think that nowadays archivers usually know how to deal with a tgz file even under windows, I have of course made a zip file, see below.

In case that someone might not know how to use it:

  1. Enter crthppfrm.pl -h gives a short usage string via STDERR:
    Usage: crthppfrm.pl < STDIN
    .
  2. this means that one can provide the input by either typing on the keyboard OR by feeding a file to the script. In the latter case the syntax was:
    crthppfrm.pl < form.hpfrm
    .
  3. The script produces output on STDOUT, which means, that the code is "printed on the monitor". To write into a file use it like this:
    crthppfrm.pl < form.hpfrm > form.ppl

    which reads: crthppfrm.pl shall read from form.hpfrm and write to form.ppl


Hope this helps.


.zip  formgen.zip (Size: 2.16 KB / Downloads: 3)


PS: 'crthppfrm' is by the way an abbreviation for 'create HP Prime form'. A tribute to the command nomenclature of the fantastic AS400/i5 operating system.


...



A note for those who wonder "why didn't he write this in C++, C or java?".

There is a slogan which says "Only perl can parse perl". This is probably true since perl is a very (very!) powerful text processor. I could have done this in Java or C++. Or maybe not. 'not' because it is sometimes not easily possible to do certain things so fast in other programming languages than perl. The script is less than a hundred lines and even simple regex-es can sometimes be a PITA in other languages. Perl is unbeatable in this respect and unbeatable fast to implement.

It took me half an hour to have a 60% solution. It took two hours to get to 80%. It took the afternoon to fix a glitch here and there and to make it at least "postable". No way in C++. I do C++ development for a living. But without a minimum design, you will fail with C++. At least I do. But this costs (too much) time and so I wouldn't have done it at all.

In perl, which is my swiss-army-knife² for such cheapo-tools, you sit down and start to code (known as 'quick&dirty'). You add what is missing and after a while it basically does what you had in mind (and often a bit more).

And here you can read why I didn't do this in Python.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)