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

Lukasz Sokol el.es.cr at gmail.com
Mon Aug 3 11:49:22 CEST 2015


On 03/08/15 09:36, Mark Morgan Lloyd wrote:
> 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.
> 

Hmm, yeah, guess I complicated my case 'a bit' by keeping the command/function mapping in a static array...
Back to the drawing board ;J

>>> * 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.
> 
Ah, ok. So , no, that's not needed in my case.


Thanks,
el es




More information about the fpc-pascal mailing list