[Info-vax] Any Way to Pass Arrays of Strings from C to Basic?

Dave Froble davef at tsoft-inc.com
Fri Nov 8 10:18:52 EST 2019


On 11/8/2019 8:16 AM, Simon Clubley wrote:
> On 2019-11-07, Dave Froble <davef at tsoft-inc.com> wrote:
>> On 11/7/2019 11:40 AM, seasoned_geek wrote:
>>> The only portion which
>>> needed to be in C was the piece which originally called Xerces XML
>>> parser which was, at the time heavily supported by IBM. There was a
>>> correct decision all XML parsing should be done by an industry
>>> standard library.
>>
>> A while back we looked at several XML parsers.  When done looking, we
>> looked at each other and basically said WTF?  The products would test
>> some XML for matching tag pairs, but nothing else we could see.  One
>> thing they didn't do was parse out the actual data that we needed.
>> That, we still had to custom program.  Have to wonder just what these
>> bloatware products are good for?  Nothing we could see or justify.
>>
>> Note, perhaps there may be products that actually extract your data, but
>> we never saw one.
>>
>
> Are you sure you are not confusing a XML validator with a XML parser ?

Now, that is very possible.  I'm not very familiar with such things.

> There are two basic types of XML parser I am aware of.
>
> The first one, the SAX style parser, calls back into a handler you
> declare when an event (such as tag start seen, text seen, etc) occurs
> during parsing.
>
> The second one, the DOM style parser, parses the entire XML document
> at once and places it in a DOM style tree which you can then pull
> bits out of as required.
>
> BTW, I don't know DEC Basic. Can you _directly_ call into a DEC BASIC
> function from a C language routine and if so, are there limits on
> what can be passed from the C routine into the DEC BASIC routine ?

One can do just about anything, if one understands what will be 
happening.  Some languages make things easier than others do.

My experiences are that C is less helpful than any other language I've 
had the occasion to attempt to use.

> If there are not, then I don't see why you can't just use one of
> the various C language SAX parsers and register your BASIC function
> as the callback handler if you didn't want to bother with one of
> the DOM style parsers.

If a simple routine similar to:

100     !************************************************************
         !                      Parse a String
         !************************************************************
         !
         SUB PARSE( STG$ , DELIM$ , FRONT$ , BACK$ )
         !
         !       STG$            - String to parse
         !       DELIM$          - Delimiter string
         !       FRONT$          - Segment of string preceeding delimiter
         !       BACK$           - Segment of string following delimiter
         !
         !************************************************************
         !
         OPTION SIZE=( INTEGER WORD , REAL DOUBLE )

         Z% = INSTR( 1% , STG$ , DELIM$ )                !  Search for 
delimiter
         Z% = LEN(STG$)+1% UNLESS Z%                     !  Not found, 
whole stri
ng
         FRONT$ = LEFT( STG$ , Z%-1% )                   !  Preceeding 
segment
         BACK$ = RIGHT( STG$ , Z%+LEN(DELIM$) )          !  Following 
segment
                                                         !
         SUBEND

is available, then just about anything can be extracted with two calls 
to the routine.  For example:

<customer_number>987654321</customer_number>

can easily get the data by parsing first the front tag, then the rear tag.

I just don't see why I should f*** around with anyone else's bloatware, 
which does so much more than what I need.

I'm sure there are those who consider me an idiot.


-- 
David Froble                       Tel: 724-529-0450
Dave Froble Enterprises, Inc.      E-Mail: davef at tsoft-inc.com
DFE Ultralights, Inc.
170 Grimplin Road
Vanderbilt, PA  15486



More information about the Info-vax mailing list