Hello,
I have searched the web Hi and Lo trying to find a VT terminal Menuing system, with no success. There are literally thousands of links to terminal emulation, but NOTHING about using them. They are very similar to LCD in terms of basic control ie move to position then print
The other thing I have not been able to find is a function for formatting user input. Back in the 80's the first thing I did on my Radio Shack TRS80 was (obviously in BASIC!!) was to write a basic user input formatted along the lines of a formatted string as an input, with max and min values. This was of course when you HAD to use Strings and they were good, now Im told I mustnt use them!
so as a bit of psuedo code it would look like this
String Format_a_String( Format_Template, max ,min , instring)
Format_template would have the following features
Thanks
Steve
number input
$ an alpha input
only characters in instring
. or / or , or to give fixed dp or date format .
eg
####, 1983, 200, = Up to a 4 digit positive number between 200 and 1983
+####, 1983, 200, = as above but can change to negative
##/##/#### Date Entry
##.### a float with 3 dp
The code searches through Format_Templat and only allows valid characters to be entered.
I HAVE tried writing this function, but having lots of bugs. I will post it if nobody knows of a solution either (Hopefully) as a working solution , or asking for help in the code section, if no one knows a solution
Thanks
Steve
I would love to find a terminal emulator like Termite that recognizes VT100 or VT52 escape commands, but I don't think that is what you are asking for. Or that one exists.
Back in the day when I worked with DEC PDP-11, VAX and MicroVAX, we used VT100 dumb terminals. We didn't have many occasions when multiple user inputs were needed but when we did, it was a simple affair. We just printed out a bunch of options with a number or letter against each item. The user then entered the number or letter to select the desired choice.
You mentioned moving to a position and printing. I think the VT100 was 80 columns by 24 rows. I wonder if you are talking about some sort of pop-up on screen menu with a border drawn around it using some of the vertical, horizontal and corner characters in the VT100 character set? If so, then I think a copy of all the characters on screen was held in memory. The required menu was then "drawn" on top of the existing text (effectively replacing it on screen). When the menu was closed, either the whole screen was refreshed from the copy in memory, or you could just send out the portion of text that was overwritten.
Hi Steve,
Thanks for your reply. I clearly wasn't being clear!!!
I did look at regex, but I don't think it helps unless I misunderstood how to use it.
What I want is MUCH simple ( I think).
(1)An equivalent to LCDMenu type of library that runs on a VT100 terminal/emulator such as TeraTerm
(2) A way of validating keyboard data entry more sophisticated than parseint. etc
The problem using just the teletype type terminal ( Like Arduinos) is that everything scrolls of the end of the screen, and you cant easily forget what happened 10 entries earlier. I believe that instead of being called GUI it used to be referred to as a COW (Character Orientated Window)!!! Having a static screen is so much easier than a continuously moving target
Can you imagine how difficult it would be to use an LCD screen that kept scrolling??
You can easily change colours and Fonts, other terminals also allow drawing lines and boxes. For a simple user panel a terminal has a lot of advantages, Its pretty much cross platform with existing free software available on every platform ( I believe) Or even using a small TFT terminal. The alternative is writing a program for each platform you want to deploy.
Steve
HI Mark,
Your post came in while I was replying to Steve.
Nice to know someone else remembers what I was talking about!! You were lucky. The PDP 1105 I used to work on were installed in a machine , could probably use an UNO to do same job today, but it didn't have terminal, just toggle switches and LEDS to program in Assembler!!
Tera Term you can actually program width and height, including 16x2 or 20x4 or anything you like.
Steve
stevewidg:
This was of course when you HAD to use Strings and they were good, now I'm told I mustn't use them!
I think you are conflating the "String" class in "C" with something in BASIC which I do not clearly recall (even though I completely re-wrote a BASIC implementation).
In BASIC you would have had to manage strings yourself as arrays, no dynamic allocation. The same applies here.
Input validation during input is error prone, as you may have noticed already. If you cannot make your code work, check (failing) user entries only at the end of input. E.g. you can check an input >= 200 only after at least 3 digits have been entered, so the range should be checked only after the input is complete - determine "completed" how?
If you want to learn more about lexing and parsing see e.g. the lex or other scanner source code. In above example the syntax of the number were "####" (meaning up to 4 digits?) and the semantics were 200 <= value <= 1983. The syntax is checked by the scanner or lexer, during input, and the semantics are checked by the parser when the number input is complete.
Did you see sscanf()? That’s probably the simplest “formatted input” mechanism for C.
On arduino, you’ll need to input the string separately. Unlike the minicomputers of yore, there is no OS to feed you an edited line at a time.
But see also parser/simpleParser.cpp at master · WestfW/parser · GitHub
Ps: I haven’t done vt100 in a long time, and I haven’t seen any arduino libraries for manipulating one.
Probably because the “serial monitor” doesn’t support it.
Did you try searching for “ansi terminal menus” as well?
Paul__B:
...
In BASIC you would have had to manage strings yourself as arrays, no dynamic allocation. The same applies here.
Most BASIC implementations have "string" variables, denoted by appending a '$' to a variable that would otherwise be numeric.
Any details are hidden, so no allocation, arrays or trouble like that for the programer.
Functions like LEFT$, RIGHT$ and MID$ might be provided to take apart and get at characters, which nevertheless remained "strings" of one character. I can't find if '+' was interpreted as concatenation.
Dartmouth BASIC had a CHANGE instruction, for example
100 CHANGE A$ TO A
would place the characters of A$ into the array A, with A(0) being the character count and A(1) forward being the ASCII codes.
An array without a declaration was 10 elements, or arrays could be declared to be a certain size
10 DIM A(100)
Had to delete the semicolon my fingers typed at the end of that line three times before my brain caught up.
Apple BASIC programs that used "hires" (high resolution, not Root Beer) graphics needed to watch the use of $ strings or at a certain point the unprotected graphics area of memory would fill with characters from string operations and be filled with snow.
Strings. Making problems for programmers and computers since before the beginning.