; TEST
;
; Program for Proteus
;
; (C) 1998-2004 Simone Zanella Productions
;
; Several tests.
; Do not use any input; output is sent to console.
; Implicit parameters: NULL input and output
;!proteus -z
; Function to print numbers with thousand separators
!include "decnum.prt"
; Print numbers by using UDF DecNum
CONSOLELN DecNum(123456789, 0, 20, ".")
CONSOLELN DecNum(123456789, 1, 20, ".")
CONSOLELN DecNum(123456789, 2, 20, ".")
CONSOLELN DecNum(1234567890, 0, 20, ".")
CONSOLELN DecNum(1234567890, 1, 20, ".")
CONSOLELN DecNum(1234567890, 2, 20, ".")
; This can be used to avoid long integer limitation
CONSOLELN DecNum("12345678901", 0, 20, ".")
CONSOLELN DecNum("12345678901", 1, 20, ".")
CONSOLELN DecNum("12345678901", 2, 20, ".")
CONSOLELN DecNum("123456789012", 0, 20, ".")
CONSOLELN DecNum("123456789012", 1, 20, ".")
CONSOLELN DecNum("123456789012", 2, 20, ".")
CONSOLELN DecNum(1, 0, 20, ".")
CONSOLELN DecNum(12, 1, 20, ".")
CONSOLELN DecNum(123, 2, 20, ".")
CONSOLELN DecNum(123456789, 0, 0, ".")
CONSOLELN DecNum(123456789, 1, 0, ".")
CONSOLELN DecNum(123456789, 2, 0, ".")
; Functions to manipulate pathnames under Dos, Windows and Unix
!include "filefunc.prt"
FUNCTION TestUDF(file, dummy)
; This UDF, used by SCANUDF, evaluates each element in an array,
; because it always returns 1 ignoring the key (dummy).
; It verifies that pathname is valid under Dos, Unix and Windows;
; if it is, prints out its components.
tdos = ChkPathFileDos(file)
tw95 = ChkPathFileWindows(file)
tunx = ChkPathFileUnx(file)
fcomp = VECNEW(4)
IF tdos
DosSplit(file, fcomp)
CONSOLELN "Dos interpretation for " file ":"
d = VECGET(fcomp, 1)
CONSOLELN "Drive: " IIF(ISNOTEMPTY(d), d, \
"not specified")
d = VECGET(fcomp, 2)
CONSOLELN "Path: " IIF(ISNOTEMPTY(d), d, \
"not specified")
d = VECGET(fcomp, 3)
CONSOLELN "Name: " IIF(ISNOTEMPTY(d), d, \
"not specified")
d = VECGET(fcomp, 4)
CONSOLELN "Ext: " IIF(ISNOTEMPTY(d), d, \
"not specified")
ELSE
CONSOLELN "File " file " is NOT valid under Ms-Dos."
FI
CONSOLELN ""
IF tw95
DosSplit(file, fcomp)
CONSOLELN "Windows interpretation for " file ":"
d = VECGET(fcomp, 1)
CONSOLELN "Drive: " IIF(ISNOTEMPTY(d), d, \
"not specified")
d = VECGET(fcomp, 2)
CONSOLELN "Path: " IIF(ISNOTEMPTY(d), d, \
"not specified")
d = VECGET(fcomp, 3)
CONSOLELN "Name: " IIF(ISNOTEMPTY(d), d, \
"not specified")
d = VECGET(fcomp, 4)
CONSOLELN "Ext: " IIF(ISNOTEMPTY(d), d, \
"not specified")
ELSE
CONSOLELN "The file " file " is NOT valid under Windows."
FI
CONSOLELN ""
IF tunx
UnxSplit(file, fcomp)
CONSOLELN "Unix interpretation for " file ":"
d = VECGET(fcomp, 1)
CONSOLELN "Path: " IIF(ISNOTEMPTY(d), d, \
"not specified")
d = VECGET(fcomp, 2)
CONSOLELN "Name: " IIF(ISNOTEMPTY(d), d, \
"not specified")
d = VECGET(fcomp, 3)
CONSOLELN "Ext: " IIF(ISNOTEMPTY(d), d, \
"not specified")
ELSE
CONSOLELN "The file " file " is NOT valid under Unix."
FI
CONSOLELN ""
VECFREE(fcomp)
RETURN 1
; Create an array of pathnames and process each element
; by using TestUDF
VFILE = VECCREATE("C:\\DOS\\TEST.EXE", "C:\\", \
"C:\\Program Files\\Netscape\\Navigator\\bookmarks.html", \
"/local/usr/zanella/proteus/proteus.c", "test.exe")
SCANUDF(VFILE, "", TestUDF)