[Lazarus] reading FORTRAN-style input in Lazarus

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Fri Aug 5 19:36:59 CEST 2011


Marco van de Voort wrote:
> On Fri, Aug 05, 2011 at 08:55:39AM +0000, Mark Morgan Lloyd wrote:
>> A few months ago I was reading lots of SNMP MIBs (sming format), and 
>> wrote a parser using a Meta-2 derivative. However in the general case, 
>> and particularly for line-oriented input, it's probably a job for either 
>> regexes or an (as yet unwritten) equivalent to format() etc. However, 
>> error recovery (when a line departs from the accepted format part-way 
>> through) is not going to be easy.
> 
> sscanf's like constructs are also a possibility. ARRAY OF CONST is strong enough to
> implement it.

Yes, that's the sort of thing I had in mind. I do little very little C 
so haven't really memorised even the basic functions.

>> What scripting languages can be embedded in FPC/Lazarus these days? If 
>> an embedded language was called for each line would the overhead be 
>> excessive?
> 
> For this you need a simple interpreter statemachine. For fixed width values,
> even regex is overkill. 

True, I'd not really focussed on the fact that field widths were 
predefined. I do even less FORTRAN...

-- 
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 Lazarus mailing list