PPWIZARD is a free preprocessor for HTML, REXX, Visual Basic or any text files.
;----------------------------------------------------------------------------
; MODULE NAME: REXAMPLE.XH
;
; $Author: USER "Dennis" $
; $Revision: 1.0 $
; $Date: 30 Mar 2001 18:05:34 $
; $Logfile: C:/DBAREIS/Projects.PVCS/MultiOs/PPWIZARD/rexample.xh.pvcs $
;
; DESCRIPTION: Small example header file.
;
;----------------------------------------------------------------------------
/*
* $Header: C:/DBAREIS/Projects.PVCS/MultiOs/PPWIZARD/rexample.xh.pvcs 1.0 30 Mar 2001 18:05:34 USER "Dennis" $
*/
/*--- Something in this header needs a feature introduced in "99.249" -------*/
#require 99.249
/*--- Skip past rexx routines -----------------------------------------------*/
<?RexxSkip>
#ifdef INCL_AddCommas2DecimalNumber
/*===========================================================================*/
AddCommas2DecimalNumber: /* Integers Only! */
#ifdef Procedure
<$Procedure>
#endif
/*===========================================================================*/
/*--- Get number return it it we already have commas ---------------------*/
#NextId
@@NoComma = strip( arg(1) );
if pos(',', @@NoComma) <> 0 then
return(@@NoComma);
/*--- split at possible decimal point ------------------------------------*/
@@DotPos = pos('.', @@NoComma);
if @@DotPos = 0 then
@@AfterDecimal = '';
else
do
/*--- There is a decimal component -----------------------------------*/
if @@DotPos = 1 then
return("0" || @@NoComma);
@@AfterDecimal = substr(@@NoComma, @@DotPos+1);
@@NoComma = left(@@NoComma, @@DotPos-1);
end;
/*--- Reverse the integer ------------------------------------------------*/
@@NoComma = reverse(@@NoComma);
/*--- Grab 3 digits at a time --------------------------------------------*/
@@ResultWithCommas = "";
do while length(@@NoComma) > 3
@@ResultWithCommas = @@ResultWithCommas || left(@@NoComma, 3) || ',';
@@NoComma = substr(@@NoComma, 4);
end;
@@ResultWithCommas = @@ResultWithCommas || @@NoComma;
/*--- Reverse the string and add decimal component -----------------------*/
@@ResultWithCommas = reverse(@@ResultWithCommas)
if @@AfterDecimal <> '' then
@@ResultWithCommas = @@ResultWithCommas || '.' || @@AfterDecimal;
return(@@ResultWithCommas);
#endif
#ifdef INCL_GetAmPmTime
/*===========================================================================*/
GetAmPmTime: /* Fixed length AM/PM time with seconds */
#ifdef Procedure
<$Procedure>
#endif
/*===========================================================================*/
#NextId
@@CivilTime = time('C'); if length(@@CivilTime) = 6 then @@CivilTime=' '@@CivilTime;
@@NumSeconds = ':'substr(time(), 7, 2);
return( insert(@@NumSeconds, @@CivilTime, 5) ); /* Insert # seconds */
#endif
#ifdef INCL_StringReplace
/*===========================================================================*/
StringReplace: /* Too tricky & limiting to set up as procedure */
/*===========================================================================*/
/*--- Get the passed parameters ------------------------------------------*/
#NextId
@@String = arg(1);
@@ChangeFrom = arg(2);
@@ChangeTo = arg(3);
@@ChangeCntVar = arg(4); /* Passed by reference! */
/*--- Look for the search string -----------------------------------------*/
@@ChangeFromLength = length(@@ChangeFrom);
@@ChangeToLength = length(@@ChangeTo);
@@FoundPosn = pos(@@ChangeFrom, @@String);
@@ChangesMade = 0;
do while @@FoundPosn <> 0
/*--- Perform the substitution ---------------------------------------*/
@@String = left(@@String, @@FoundPosn-1) || @@ChangeTo || substr(@@String, @@FoundPosn+@@ChangeFromLength);
/*--- Look for the more occurances of the search string --------------*/
@@FoundPosn = pos(@@ChangeFrom, @@String, @@FoundPosn+@@ChangeToLength);
@@ChangesMade = @@ChangesMade + 1;
end;
/*--- Update the change counter and return to the caller -----------------*/
if @@ChangeCntVar <> "" then
interpret @@ChangeCntVar || " = @@ChangesMade + " || @@ChangeCntVar;
return(@@String);
#endif
/*--- End of header file ----------------------------------------------------*/
<?RexxSkipTo>
PPWIZARD Manual

Thursday January 17 2002 at 6:27pm