[fpc-pascal] I'm working on automated Help Output for console apps
james.richters at productionautomation.net
Mon Nov 23 14:26:40 CET 2020
I was working on one of my projects and doing some tedious output to the console and now that I have this idea in my head that this could be more automated, I thought that this task should be automated as well.. not sure if it's something that belongs in Graeme's Help Output package, but it's on a similar idea.
It seems that I always want to do a writeln of a variable to see that it's doing what I expect..
So sometimes I just stink in a writeln like this:
If I want more than one thing, I can just do:
But of course you can't always tell where ThingA stops and ThingB Starts, so I have to at least put in a space:
But then I sometimes have such a long list of these, I need to say what they are:
Writeln('ThingA: ',ThingA,' ThingB: ',ThingB);
And if the variables are some kind of floating point, I need to do something so I don't have to look at un-readable expanded notation... Which I absolutely ALWAYS forget until I run it once.. so I have to go back and put in my standard floating point formatting:
Writeln('ThingA: ',ThingA:0:20,' ThingB: ',ThingB:0:20);
And sometimes I want to make it a different color so I can spot it in a huge list of output so I will do something like:
Then when I'm doing I comment it all out so if I want it again someday, I don't have to type it all:
So What I would like is a procedure that simplifies all this... but I don't know how to implement it. There are several things I don't have a clue how to do, or if they are even possible.
First of all, can I make a procedure with maybe something like a dynamic array of variables of any random types?? So it works like Writeln... With Writeln I can mix variable types and have as many as I want.
Next.. can I have it output the name of the variable and it's contents somehow?
I would like to end up with a procedure that does all the formatting, so if I give it:
I get something like
If Control Then
I would need to somehow figure out the variable type to see if it's floating point.
Any Ideas on how this, or some of it could be accomplished? Or is it all completely impossible?
More information about the fpc-pascal