[fpc-pascal] Interactive command recognition & mapping to program functions & other 'cli' features as a unit

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Mon Aug 3 10:36:51 CEST 2015


Lukasz Sokol wrote:
> On 31/07/15 16:41, Mark Morgan Lloyd wrote:
>> Lukasz Sokol wrote:
>>> On 31/07/15 14:46, Mark Morgan Lloyd wrote:
>>>> Lukasz Sokol wrote:
>>>>> Hi,
>>>>>
>>>>> I tried piecing something like in $topic together,
>>>>>
>>>>> intended as an 'interactive' command interpreter for my program. (which will in time grow an 'embedded' web server and intended to
>>>>> run as a (windows) service, but it's too early for that at the
>>>>> moment)
> 
>> Looking at your question another way, I suppose that you also have
>> the issue of parsing a command as well as handling the data entry. I
>> think that there's various possibilities here depending on what
>> you're trying to handle:
>>
>> * A simple sequence of names/numbers.
>>
> Supposedly this would do, parameters mostly are numbers (but when parsing
> through a TStringList everything is a string first anyway, so I can define
> some rules as to which parameter is what type)

Parse the first word to an enumeration, feed that to a case. Leave 
options for terminating characters, case sensitivity and so on.

>> * A unix-style command line, with leading options.
> 
> Would be nice, however I don't need 'if' or explicitly defined looping instructions...

No, I mean parsing of options starting - or -- together with their 
parameters. 'if' etc. are part of the shell, so are a distinct issue.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list