Example TEST.PRT
; 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)
Samples index Next example Previous example Contents Index
Midnight Lake iPhone Case Black Women Shoes Black Flat Shoes Leather Flats Black Patent Ballerinas Black Ballet Shoes Casual Shoes Black Shoes Women Balle Record Player Cufflinks Best iPhone XR Clear Cases iPhone XS/XS Max Leather Cases Sale Best iPhone 8/8 Plus Silicone Cases iPhone 7/7 Plus Cases & Screen Protector New Cases For iPhone 6/6 Plus iPhone 8 Case Sale iPhone Xr Case Online iPhone 7 Case UK Online iPhone X Case UK Sale iPhone X Case Deals iPhone Xs Case New Case For iPhone Xr UK Online Case For iPhone 8 UK Outlet Fashion Silver Cufflinks For Men Best Mens Cufflinks Outlet Online The Gold Cufflinks Shop Online Cheap Shirt Cufflinks On Sale Nice Wedding Cufflinks UK Online Top Black Cufflinks UK Online Mens Cufflinks Online Silver Cufflinks For Men Men Cufflinks UK Sale Gold Cufflinks UK Online Gold Cufflinks UK Silver Cufflinks UK Shirt Cufflinks Discount Online Mens Cufflinks Deals & Sales Girls Shoes For Dance Fashion Ballet Dance Shoes Best Ballet Flats Shoes UK Online Cheap Ballet Pointe Shoes UK Online Best Ballet Shoes Outlet Best Dance Shoes Sale Cheap Ballet Flats Sale UK Best Pointe Shoes Online UK Ballet Dance Shoes UK Shoes For Dance UK Best Ballet Slippers Shop Best Yoga Shoes Hotsell