awk: how to achieve a 64character column file from a list of FORTH commands (and other things) ?
Hello,
I have following file which I want to be restructured as output (a Forth program working on a Debian 64bits cross-development platform) Code:
3.14159265359e FCONSTANT PINB and would like to have it reformatted with awk in following output Code:
3.14159265359E0 FCONSTANT PINB I achieved the second posted file with manual work. Thats ok: take not much time. But for the "beauty", it would be good if the output is achieved straight with awk. Target: a) rework all lines between ": " and " ;" only (for : and ; not within brackets "") b) file output with with 64 characters columns c) file recognizing 1.0e or 4.0E and changing it to e0 or E0 (= 1.0E0 or 4.0E0) with no number after "E" exponent of the number d) .... (more to come.. but of lower priority) Any advice is welcome. No hurry; manually is so far fine. Thanks to everyone. |
What is this line supposed to do?
Code:
1.0E0 FVARIABLE R Code:
FVARIABLE R ( ___ ) |
Quote:
The target was to initialize the float variable R with 1.0 but since you are asking, the correct would be "FVARIABLE R" only (no 1.0 before or after) since I initialize later to 1.0. Good remark/question. (however it worked, only it had the side effect I just understood now, a 1.0 appeared in the float stack). I am a beginner (this is the first Forth program in my life). |
Perhaps not quite what you wanted, but could be the first step
Code:
#!/usr/bin/awk -f |
The following variant looks for the ending semicolon only in the formatted block, and then prints it unconditionally.
Code:
#!/usr/bin/awk -f |
Thanks. I am using it in a terminal. Good.
awk -f filter1 PERE12.fth > temp.txt awk -f filter2 temp.txt > RESULT.SRC Is there any possibility to make only 1 command out of the 2 above? (filter2 is from the post above) |
What does filter1 do?
|
Quote:
Sorry, you have been blocked You are unable to access linuxquestions.org"). Code:
# This program helps for filtering commented files on a PC. |
Unfortunately for all of us, "FORTH" is a thoroughly obsolete technology which, much like "MUMPS," still refuses to die.
When "digital computers were still too weak to get out of their own way," these systems actually made sense. (And, yes, I definitely remember those days, entirely without(!) nostalgia.) |
Quote:
But let me cite some Web articles. Quote:
Quote:
|
Quote:
|
Quote:
Or copy/paste the relevant awk code. |
After studying the forth description in Wikipedia I have made the following:
Code:
#!/usr/bin/awk -f |
I like FORTH too, in the Pioneer days there were lots of interesting, small, efficient languages.
I have it on a Rasperry Pico at work to amuse myself while I am downloading Python frameworks for money. Of course, you should really be writing the FORTH formatter in FORTH. |
Quote:
Code:
: PERE12 ( r1=a r2=b -- r=perimeter ) So far, now I am using a script progfilter.sh Quote:
|
All times are GMT -5. The time now is 05:35 PM. |