XMV: CALLER and GET.CMD

CALLER is a TCL command which calls a subroutine. It is useful for testing.

Example: CALLER DOZ.CONVERT 144 (P)

000 CALLER
001 * From intl-spectrum.com/xmv/caller
002 call GET.CMD(CMD,OPT)
003 CSIZE = dcount(CMD,@FM)
004 dim PARAMS(100)
005 for PCNT = 1 to 100
006 PARAMS(PCNT) = CMD<PCNT>
007 next PCNT
008 begin case
009 case CSIZE = 4
010 call @CMD<2>(PARMS(4))
011 print PARAMS(4)
012 case CSIZE = 5
013 call @CMD<2>(PARMS(4),PARMS(5))
014 print PARAMS(4),PARMS(5)
...999 end case

GET.CMD is a subroutine command which gets all of the command line values used.

000 GET.CMD
001 * From intl-spectrum.com/xmv/get.cmd
002 GET.CMD(CMD,OPT)
003 CMD = SENTENCE()
004 OPT = ''
005 if (index(CMD,'(',1) then
006 OPT = oconv(CMD,'g(1');* This is not foolproof
007 CMD = oconv(CMD,'g0(1')
008 end
009 convert ' ' to @AM in CMD
010 return

This is an occasional mini-column for showing off quick bits of code which extend TCL, mvBASIC, Proc, or other MultiValue features and functions. Want to submit your own? E-mail editor@intl-spectrum.com with your XMV.

CHARLES BAROUCH

Charles Barouch is the CTO of HDWP, Inc. He is also a regular contributor to International Spectrum Magazine, a former Associate Editor for both Database Trends and for Gateways Magazine, a former distance learning Instructor for CALC. He is presently the Past President of the U2UG. Mr. Barouch has presented technology and business topics in front of hundreds of companies, in a wide range of product and service categories. He is available for on-site speaking and consulting engagements in and out of the United States.

View more articles
menu
menu