home *** CD-ROM | disk | FTP | other *** search
/ Windows Shareware GOLD / NuclearComputingVol3No1.cdr / _bbs4 / f1498.zip / WFPLUS.PAS < prev    next >
Pascal/Delphi Source File  |  1991-08-06  |  3KB  |  130 lines

  1. {WFPLUS - Function Extensions to ObjectWindows Copyright (C) Doug Overmyer 7/1/91}
  2. unit WFPlus;
  3.  
  4.  
  5. {******************************************************************}
  6. { I N T E R F A C E                                                        }
  7. {******************************************************************}
  8. interface
  9. uses WinTypes, WinProcs, WinDos, Strings, WObjects,StdDlgs;
  10. function Max(I,J:Integer):Integer;
  11. function Min(I,J:Integer):Integer;
  12. function GetDateTime(szDateTime:PChar):Boolean;
  13. function ExpandTabs(InStr,OutStr:PChar;Tabsize:Integer):Boolean;
  14. function CheckCC(InStr,OutStr:PChar):Boolean;
  15. {********************************************************************}
  16. {I M P L E M E N T A T I O N                                                     }
  17. {********************************************************************}
  18. implementation
  19.  
  20. {***********************************************************************}
  21. function Max(I,J:Integer):Integer;
  22. begin
  23.     if I > J then
  24.        Max := I
  25.    else
  26.        Max := J;
  27. end;
  28. {***********************************************************************}
  29. function Min(I,J:Integer):Integer;
  30. begin
  31.     if I < J then
  32.        Min := I
  33.    else
  34.        Min := J;
  35. end;
  36.  
  37. function  GetDateTime(szDateTime:PChar):Boolean;
  38. var
  39.   m,d,y,dw: Word;
  40.   temp,tag: string[4];
  41.   tStr: String;
  42. Begin
  43.   tStr := '';
  44.   GetTime(y,m,d,dw);
  45.   if (y > 12) then begin
  46.     y := (y - 12);
  47.     tag := 'pm';
  48.   End else
  49.     tag := 'am';
  50.   str(y,temp);
  51.   if (y < 10) then
  52.     temp := '0' + Temp;
  53.   tStr := tStr + temp + ':';
  54.   str(m,Temp);
  55.   tStr := tStr + temp + ':';
  56.   str(d,temp);
  57.   tStr := tStr + temp + tag + '     ';
  58.   GetDate(y,m,d,dw);
  59.   str(m,Temp);
  60.   if (m < 10) then
  61.     temp := '0' + temp;
  62.   tStr := tStr + temp + '/';
  63.   str(d,Temp);
  64.   if (d < 10) then
  65.     Temp := '0' + temp;
  66.   tStr := tStr + Temp + '/';
  67.   str(y,temp);
  68.   tStr := tStr + temp;
  69.   strPcopy(szDateTime,tStr);
  70.   GetDateTime := True;
  71. End;
  72.  
  73. function ExpandTabs(InStr,OutStr:PChar;Tabsize:Integer):Boolean;
  74. var
  75.     IndxIn,IndxOut,IndxTab:Integer;
  76. begin
  77.     IndxIn := 0;IndxOut:= 0;IndxTab:= 0;
  78.   For IndxIn := 0 to (StrLen(InStr) -1) do
  79.     case InStr[IndxIn] of
  80.         #9:
  81.         for IndxTab := 0 to Tabsize do
  82.             begin
  83.           OutStr[IndxOut] := #32;
  84.           Inc(IndxOut);
  85.           end;
  86.       #0..#31:
  87.           begin
  88.         OutStr[IndxOut] := #32;
  89.         Inc(IndxOut);
  90.         end;
  91.       else
  92.           begin
  93.         OutStr[IndxOut] := InStr[IndxIn];
  94.         Inc(IndxOut);
  95.         end;
  96.     end;
  97.   OutStr[IndxOut] := #0;
  98.   ExpandTabs := TRUE;
  99. end;
  100.  
  101. function CheckCC(InStr,OutStr:PChar):Boolean;
  102. var
  103.     IndxIn,IndxOut:Integer;
  104. begin
  105.     IndxIn := 0;IndxOut:= 0;
  106.   For IndxIn := 0 to (StrLen(InStr) -1) do
  107.     case InStr[IndxIn] of
  108.         #9:                             {retain tabs}
  109.         begin
  110.         OutStr[IndxOut] := #9;
  111.         Inc(IndxOut);
  112.         end;
  113.       #0..#31:
  114.           begin
  115.         OutStr[IndxOut] := #32;
  116.         Inc(IndxOut);
  117.         end;
  118.       else
  119.           begin
  120.         OutStr[IndxOut] := InStr[IndxIn];
  121.         Inc(IndxOut);
  122.         end;
  123.     end;
  124.   OutStr[IndxOut] := #0;
  125.   CheckCC := TRUE;
  126. end;
  127.  
  128.  
  129. end.
  130.