[Info-vax] VMS Software needs to port VAX DIBOL to OpenVMS X86 platform
1tim....@gmail.com
1tim.lovern at gmail.com
Sat Dec 19 17:44:19 EST 2020
here is a more modern Dibol example - not 99 bottles of beer. it was written just to test a String parser class, written in Dibol.
import parser
import System.Collections
record
parse , at StringParser
arry , at ArrayList
proc
parse = new StringParser() ;; create instance of parser
parse.parseNameValue("abc~123;test this string", "~",";") ;; load our test string to do name / value parse
console.writeline("-[abc~123;test this string]-")
console.writeLine("NameStr = "+ parse.ThisNameStr)
console.writeLine("valueStr = "+ parse.ThisValueStr)
console.writeLine("commentStr = "+ parse.ThisCommentStr)
console.writeline(" ")
parse.parseNameValue("~abc123;test this string", "~",";") ;;load case without name part of name value pair
console.writeline("-[~abc123;test this string]-")
console.writeLine("NameStr = "+ parse.ThisNameStr)
console.writeLine("valueStr = "+ parse.ThisValueStr)
console.writeLine("commentStr = "+ parse.ThisCommentStr)
console.writeline(" ")
parse.parseNameValue(";abc123test this string", "~",";") ;; load case where entire string is comment
console.writeline("-[;abc123test this string]-")
console.writeLine("NameStr = "+ parse.ThisNameStr)
console.writeLine("valueStr = "+ parse.ThisValueStr)
console.writeLine("commentStr = "+ parse.ThisCommentStr)
console.writeline(" ")
parse.parseNameValue("abc123test this string", "~",";") ;; load case with only name part
console.writeline("-[abc123test this string]-")
console.writeLine("NameStr = "+ parse.ThisNameStr)
console.writeLine("valueStr = "+ parse.ThisValueStr)
console.writeLine("commentStr = "+ parse.ThisCommentStr)
console.writeline(" ")
parse.parseList("A~B~C~D~E~F~G~;this is a comment", "~",";") ;; parse a list into an array object
arry = parse.ThisListArr
begin ;; use begin / end for local data scope
data count ,i4
data idx ,i4
data value , at String
console.writeline("-[A~B~C~D~E~F~G~;this is a comment]-")
count = arry.count
console.writeline("ary contains: " + string(count) + " elements")
for idx from 1 thru count ;; loop thru array object
begin
value = (String) arry.indexer(idx-1)
console.writeLine(" { " + value + " }")
end
console.writeLine("commentStr = "+ parse.ThisCommentStr)
end
console.writeline(" ")
end
More information about the Info-vax
mailing list