` Printed Icetips Article

Icetips Article



Templates: Code template to call a procedure
1999-04-05 -- James Fortune
 
Newsgroups: topspeed.products.c5ee

Editors note:  Please note that some lines may wrap in the template code.

Hi Arnor

>> I also have a template floating around <<

Your template is very good but I found that it had slight probs.
1. You didn't allow a Return Value from a START whereas you can have
one - the thread no.
2. Some of the variations needed brackets around parameters and some
didn't.

So I 'cleaned it up' :-)  Hope you like it!

#Template(CodeTemplates,'Code templates'),FAMILY('CW20'),FAMILY('ABC')
#!-------------------------------------------------------------------
#!  Posted on Topspeed.Topic.Suggestions on March 1st, 1999
#!  By Arnor Baldvinsson, Denmark (arnorbld@post3.tele.dk)
#!  Modified by James Fortune on April 5th, 1999
#!  This template may be distributed freely
#!-------------------------------------------------------------------
#Code(CallAProcedure,'Call a procedure')
#DISPLAY('This template will call or START a procedure while')
#DISPLAY('passing it parameters and specifying a return value!')
#DISPLAY('')
#PROMPT('Procedure to call:',PROCEDURE),%ProcedureToCall
#PROMPT('Parameters: (no brackets!)',@S255),%ProcedureToCallParameters
#PROMPT('Initiate thread',CHECK),%ProcedureToCallStart
#ENABLE(%ProcedureToCallStart)
  #PROMPT('Thread Stack',@n6),%ProcedureToCallStack,DEFAULT(25000),REQ
  #DISPLAY('Any return value can only receive the thread number!')
#ENDENABLE
#PROMPT('Return value (if any):',FIELD),%ProcedureToCallReturnValue
#ENDBOXED
#ENDBOXED
#IF(%ProcedureToCallParameters)
  #IF(%ProcedureToCallReturnValue)
    #IF(%ProcedureToCallStart)
%ProcedureToCallReturnValue =
START(%ProcedureToCall,%ProcedureToCallStack,%ProcedureToCallParameters)
    #ELSE
%ProcedureToCallReturnValue =
%ProcedureToCall(%ProcedureToCallParameters)
    #END
  #ELSE
    #IF(%ProcedureToCallStart)
START(%ProcedureToCall,%ProcedureToCallStack,%ProcedureToCallParameters)
    #ELSE
%ProcedureToCall(%ProcedureToCallParameters)
    #END
  #END
#ELSE
  #IF(%ProcedureToCallReturnValue)
    #IF(%ProcedureToCallStart)
%ProcedureToCallReturnValue =
START(%ProcedureToCall,%ProcedureToCallStack)
    #ELSE
%ProcedureToCallReturnValue = %ProcedureToCall
    #END
  #ELSE
    #IF(%ProcedureToCallStart)
START(%ProcedureToCall,%ProcedureToCallStack)
    #ELSE
%ProcedureToCall
    #END
  #END
#END
Kindest regards
James

James Fortune C.C.D.
james@accountforce.demon.co.uk

Using: C5EE ABC,DEF,CPCS,RPM,AFE,Super,DAS,PD,Ragazzi,FM2,ezHelp,Gitano,
       UltraTree,QuickDDE,CM2,Xplore,ForeHelp3,BackFlash,CopyFlash,Impex,
       CWA,Query & Report Wizard,UBeaut,J&S InBack & CPD Ctrl\,TimeSavers,
       Locus,ABCFree,MultiProj,DemoShield,Wise,ClipMate



Printed November 21, 2024, 7:29 am
This article has been viewed/printed 35323 times.
Google search has resulted in 29 hits on this article since January 25, 2004.