2010-07-14 14:41 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* include/hbextern.ch
  * src/rtl/hbdoc.prg
    + Added __HBDOC_FROMSOURCE( <cStream> ) -> <aEntry>

  + tests/stripdoc.hbs
    + Strips NFDOC/HBDOC from .c/.prg sources.

  + tests/hbdocext.prg
    + Extracts NFDOC/HBDOC from source code.

  * contrib/hbct/bitnum.c
  * contrib/hbct/strdiff.c
  * contrib/hbct/token2.c
  * contrib/hbct/charlist.c
  * contrib/hbct/ctnet.c
  * contrib/hbct/charonly.c
  * contrib/hbct/atadjust.c
  * contrib/hbct/ctmath.c
  * contrib/hbct/ctset.c
  * contrib/hbct/ctwin.c
  + contrib/hbct/doc
  + contrib/hbct/doc/en
  + contrib/hbct/doc/en/strdiff.txt
  + contrib/hbct/doc/en/token1.txt
  + contrib/hbct/doc/en/token2.txt
  + contrib/hbct/doc/en/keyset.txt
  + contrib/hbct/doc/en/ct.txt
  + contrib/hbct/doc/en/charmirr.txt
  + contrib/hbct/doc/en/ctc.txt
  + contrib/hbct/doc/en/charlist.txt
  + contrib/hbct/doc/en/charlihb.txt
  + contrib/hbct/doc/en/relation.txt
  + contrib/hbct/doc/en/atadjust.txt
  + contrib/hbct/doc/en/charonly.txt
  + contrib/hbct/doc/en/ctmath.txt
  + contrib/hbct/doc/en/atnum.txt
  + contrib/hbct/doc/en/numconv.txt
  + contrib/hbct/doc/en/charsort.txt
  + contrib/hbct/doc/en/count.txt
  + contrib/hbct/doc/en/posdiff.txt
  + contrib/hbct/doc/en/ftoc.txt
  + contrib/hbct/doc/en/charmix.txt
  + contrib/hbct/doc/en/charevod.txt
  + contrib/hbct/doc/en/finan.txt
  + contrib/hbct/doc/en/range.txt
  + contrib/hbct/doc/en/wordrepl.txt
  + contrib/hbct/doc/en/charrepl.txt
  + contrib/hbct/doc/en/exponent.txt
  + contrib/hbct/doc/en/addascii.txt
  + contrib/hbct/doc/en/ctmath2.txt
  + contrib/hbct/doc/en/strswap.txt
  + contrib/hbct/doc/en/trig.txt
  + contrib/hbct/doc/en/tab.txt
  + contrib/hbct/doc/en/video.txt
  + contrib/hbct/doc/en/charswap.txt
  + contrib/hbct/doc/en/dattime2.txt
  + contrib/hbct/doc/en/dattime3.txt
  + contrib/hbct/doc/en/replace.txt
  + contrib/hbct/doc/en/charop.txt
  + contrib/hbct/doc/en/misc1.txt
  + contrib/hbct/doc/en/asciisum.txt
  + contrib/hbct/doc/en/color.txt
  + contrib/hbct/doc/en/charone.txt
  + contrib/hbct/doc/en/num1.txt
  + contrib/hbct/doc/en/pos1.txt
  + contrib/hbct/doc/en/pos2.txt
  + contrib/hbct/doc/en/numat.txt
  + contrib/hbct/doc/en/charophb.txt
  + contrib/hbct/doc/en/atrepl.txt
  + contrib/hbct/doc/en/ascpos.txt
  + contrib/hbct/doc/en/wordtoch.txt
  + contrib/hbct/doc/en/ctpad.txt
  + contrib/hbct/doc/en/datetime.txt
  + contrib/hbct/doc/en/print.txt
  + contrib/hbct/doc/en/justify.txt
  + contrib/hbct/doc/en/remove.txt
  + contrib/hbct/doc/en/ctstr.txt
  + contrib/hbct/doc/en/screen1.txt
    + Moved embedded docs to separate files.

  * contrib/hbct/charsort.c
  * contrib/hbct/ftoc.c
  * contrib/hbct/charmix.c
  * contrib/hbct/charevod.c
  * contrib/hbct/wordrepl.c
  * contrib/hbct/exponent.c
  * contrib/hbct/charrepl.c
  * contrib/hbct/files.c
  * contrib/hbct/strswap.c
  * contrib/hbct/trig.c
  * contrib/hbct/video.c
  * contrib/hbct/charswap.c
  * contrib/hbct/dattime3.c
  * contrib/hbct/charop.c
  * contrib/hbct/ct.prg
  * contrib/hbct/cursor.c
  * contrib/hbct/misc2.c
  * contrib/hbct/color.c
  * contrib/hbct/charone.c
  * contrib/hbct/num1.c
  * contrib/hbct/pos1.c
  * contrib/hbct/ctcom1.c
  * contrib/hbct/charophb.c
  * contrib/hbct/ascpos.c
  * contrib/hbct/numconv.prg
  * contrib/hbct/ctstr.c
  * contrib/hbct/screen1.c
  * contrib/hbct/token1.c
  * contrib/hbct/keyset.c
  * contrib/hbct/charmirr.c
  * contrib/hbct/ctc.c
  * contrib/hbct/ctwfunc.c
  * contrib/hbct/charlihb.c
  * contrib/hbct/relation.c
  * contrib/hbct/setlast.c
  * contrib/hbct/atnum.c
  * contrib/hbct/count.c
  * contrib/hbct/disk.c
  * contrib/hbct/posdiff.c
  * contrib/hbct/finan.c
  * contrib/hbct/range.c
  * contrib/hbct/addascii.c
  * contrib/hbct/ctmath2.c
  * contrib/hbct/tab.c
  * contrib/hbct/dattime2.c
  * contrib/hbct/replace.c
  * contrib/hbct/misc1.c
  * contrib/hbct/asciisum.c
  * contrib/hbct/pos2.c
  * contrib/hbct/numat.c
  * contrib/hbct/fcopy.prg
  * contrib/hbct/atrepl.c
  * contrib/hbct/ctcom2.c
  * contrib/hbct/wordtoch.c
  * contrib/hbct/ctpad.c
  * contrib/hbct/datetime.c
  * contrib/hbct/print.c
  * contrib/hbct/justify.c
  * contrib/hbct/remove.c
    - Stripped NFDOC/HBDOC from source code.

  + contrib/hbnf/doc
  + contrib/hbnf/doc/en
  + contrib/hbnf/doc/en/acctmnth.txt
  + contrib/hbnf/doc/en/savearr.txt
  + contrib/hbnf/doc/en/rand1.txt
  + contrib/hbnf/doc/en/madd.txt
  + contrib/hbnf/doc/en/dispmsg.txt
  + contrib/hbnf/doc/en/numlock.txt
  + contrib/hbnf/doc/en/mouse1.txt
  + contrib/hbnf/doc/en/settime.txt
  + contrib/hbnf/doc/en/restsets.txt
  + contrib/hbnf/doc/en/page.txt
  + contrib/hbnf/doc/en/prtscr.txt
  + contrib/hbnf/doc/en/color2n.txt
  + contrib/hbnf/doc/en/byt2bit.txt
  + contrib/hbnf/doc/en/month.txt
  + contrib/hbnf/doc/en/byt2hex.txt
  + contrib/hbnf/doc/en/findith.txt
  + contrib/hbnf/doc/en/at2.txt
  + contrib/hbnf/doc/en/acctweek.txt
  + contrib/hbnf/doc/en/gcd.txt
  + contrib/hbnf/doc/en/poke.txt
  + contrib/hbnf/doc/en/pegs.txt
  + contrib/hbnf/doc/en/min2dhm.txt
  + contrib/hbnf/doc/en/acctqtr.txt
  + contrib/hbnf/doc/en/dosver.txt
  + contrib/hbnf/doc/en/mkdir.txt
  + contrib/hbnf/doc/en/nooccur.txt
  + contrib/hbnf/doc/en/dayofyr.txt
  + contrib/hbnf/doc/en/metaph.txt
  + contrib/hbnf/doc/en/menu1.txt
  + contrib/hbnf/doc/en/byteand.txt
  + contrib/hbnf/doc/en/setlastk.txt
  + contrib/hbnf/doc/en/sqzn.txt
  + contrib/hbnf/doc/en/bytexor.txt
  + contrib/hbnf/doc/en/workdays.txt
  + contrib/hbnf/doc/en/byteor.txt
  + contrib/hbnf/doc/en/asum.txt
  + contrib/hbnf/doc/en/sleep.txt
  + contrib/hbnf/doc/en/wda.txt
  + contrib/hbnf/doc/en/aavg.txt
  + contrib/hbnf/doc/en/woy.txt
  + contrib/hbnf/doc/en/alt.txt
  + contrib/hbnf/doc/en/any2any.txt
  + contrib/hbnf/doc/en/adessort.txt
  + contrib/hbnf/doc/en/setdate.txt
  + contrib/hbnf/doc/en/netpv.txt
  + contrib/hbnf/doc/en/amedian.txt
  + contrib/hbnf/doc/en/blink.txt
  + contrib/hbnf/doc/en/ctrl.txt
  + contrib/hbnf/doc/en/vertmenu.txt
  + contrib/hbnf/doc/en/qtr.txt
  + contrib/hbnf/doc/en/linked.txt
  + contrib/hbnf/doc/en/aredit.txt
  + contrib/hbnf/doc/en/shift.txt
  + contrib/hbnf/doc/en/fttext.txt
  + contrib/hbnf/doc/en/xbox.txt
  + contrib/hbnf/doc/en/ftround.txt
  + contrib/hbnf/doc/en/hex2dec.txt
  + contrib/hbnf/doc/en/nwuid.txt
  + contrib/hbnf/doc/en/dectobin.txt
  + contrib/hbnf/doc/en/chdir.txt
  + contrib/hbnf/doc/en/bitset.txt
  + contrib/hbnf/doc/en/aemaxlen.txt
  + contrib/hbnf/doc/en/nwlstat.txt
  + contrib/hbnf/doc/en/invclr.txt
  + contrib/hbnf/doc/en/popadder.txt
  + contrib/hbnf/doc/en/lastday.txt
  + contrib/hbnf/doc/en/dispc.txt
  + contrib/hbnf/doc/en/ftattr.txt
  + contrib/hbnf/doc/en/tempfile.txt
  + contrib/hbnf/doc/en/diskfunc.txt
  + contrib/hbnf/doc/en/stod.txt
  + contrib/hbnf/doc/en/scregion.txt
  + contrib/hbnf/doc/en/mouse2.txt
  + contrib/hbnf/doc/en/d2e.txt
  + contrib/hbnf/doc/en/kspeed.txt
  + contrib/hbnf/doc/en/descendn.txt
  + contrib/hbnf/doc/en/pickday.txt
  + contrib/hbnf/doc/en/firstday.txt
  + contrib/hbnf/doc/en/daytobow.txt
  + contrib/hbnf/doc/en/getenvrn.txt
  + contrib/hbnf/doc/en/anomatch.txt
  + contrib/hbnf/doc/en/menutonf.txt
  + contrib/hbnf/doc/en/pvid.txt
  + contrib/hbnf/doc/en/proper.txt
  + contrib/hbnf/doc/en/isbiton.txt
  + contrib/hbnf/doc/en/isbit.txt
  + contrib/hbnf/doc/en/cntryset.txt
  + contrib/hbnf/doc/en/datecnfg.txt
  + contrib/hbnf/doc/en/caplock.txt
  + contrib/hbnf/doc/en/easter.txt
  + contrib/hbnf/doc/en/bytenot.txt
  + contrib/hbnf/doc/en/ftisprn.txt
  + contrib/hbnf/doc/en/setkeys.txt
  + contrib/hbnf/doc/en/ntow.txt
  + contrib/hbnf/doc/en/aeminlen.txt
  + contrib/hbnf/doc/en/floptst.txt
  + contrib/hbnf/doc/en/pchr.txt
  + contrib/hbnf/doc/en/savesets.txt
  + contrib/hbnf/doc/en/tbwhile.txt
  + contrib/hbnf/doc/en/year.txt
  + contrib/hbnf/doc/en/calendar.txt
  + contrib/hbnf/doc/en/e2d.txt
  + contrib/hbnf/doc/en/sysmem.txt
  + contrib/hbnf/doc/en/elapsed.txt
  + contrib/hbnf/doc/en/n2color.txt
  + contrib/hbnf/doc/en/bitclr.txt
  + contrib/hbnf/doc/en/eltime.txt
  + contrib/hbnf/doc/en/putkey.txt
  + contrib/hbnf/doc/en/aading.txt
  + contrib/hbnf/doc/en/dfile.txt
  + contrib/hbnf/doc/en/elapmil.txt
  + contrib/hbnf/doc/en/pending.txt
  + contrib/hbnf/doc/en/peek.txt
  + contrib/hbnf/doc/en/clrsel.txt
  + contrib/hbnf/doc/en/ontick.txt
  + contrib/hbnf/doc/en/acctyear.txt
  + contrib/hbnf/doc/en/byteneg.txt
  + contrib/hbnf/doc/en/isshare.txt
  + contrib/hbnf/doc/en/sinkey.txt
  + contrib/hbnf/doc/en/iamidle.txt
  + contrib/hbnf/doc/en/ftidle.txt
  + contrib/hbnf/doc/en/rmdir.txt
  + contrib/hbnf/doc/en/scancode.txt
  + contrib/hbnf/doc/en/vidmode.txt
  + contrib/hbnf/doc/en/origin.txt
  + contrib/hbnf/doc/en/nwsem.txt
  + contrib/hbnf/doc/en/acctadj.txt
  + contrib/hbnf/doc/en/week.txt
  + contrib/hbnf/doc/en/vidcur.txt
  + contrib/hbnf/doc/en/readme.txt
  + contrib/hbnf/doc/en/prtesc.txt
  + contrib/hbnf/doc/en/miltime.txt
    + Moved embedded docs to separate files.

  * contrib/hbnf/kspeed.c
  * contrib/hbnf/iamidle.c
  * contrib/hbnf/miltime.prg
  * contrib/hbnf/mouse1.prg
  * contrib/hbnf/setkeys.c
  * contrib/hbnf/origin.c
  * contrib/hbnf/chdir.c
  * contrib/hbnf/hex2dec.prg
  * contrib/hbnf/mouse2.prg
  * contrib/hbnf/ftisprn.c
  * contrib/hbnf/putkey.c
  * contrib/hbnf/floptst.prg
  * contrib/hbnf/mkdir.c
  * contrib/hbnf/rmdir.c
  * contrib/hbnf/setlastk.c
    ! Fixed NFDOC formatting.
    ; TODO: Strip docs.
This commit is contained in:
Viktor Szakats
2010-07-14 12:48:39 +00:00
parent 3238aea36d
commit 9e9e5129f8
277 changed files with 18435 additions and 8727 deletions

View File

@@ -16,6 +16,302 @@
The license applies to all entries newer than 2009-04-28.
*/
2010-07-14 14:41 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* include/hbextern.ch
* src/rtl/hbdoc.prg
+ Added __HBDOC_FROMSOURCE( <cStream> ) -> <aEntry>
+ tests/stripdoc.hbs
+ Strips NFDOC/HBDOC from .c/.prg sources.
+ tests/hbdocext.prg
+ Extracts NFDOC/HBDOC from source code.
* contrib/hbct/bitnum.c
* contrib/hbct/strdiff.c
* contrib/hbct/token2.c
* contrib/hbct/charlist.c
* contrib/hbct/ctnet.c
* contrib/hbct/charonly.c
* contrib/hbct/atadjust.c
* contrib/hbct/ctmath.c
* contrib/hbct/ctset.c
* contrib/hbct/ctwin.c
+ contrib/hbct/doc
+ contrib/hbct/doc/en
+ contrib/hbct/doc/en/strdiff.txt
+ contrib/hbct/doc/en/token1.txt
+ contrib/hbct/doc/en/token2.txt
+ contrib/hbct/doc/en/keyset.txt
+ contrib/hbct/doc/en/ct.txt
+ contrib/hbct/doc/en/charmirr.txt
+ contrib/hbct/doc/en/ctc.txt
+ contrib/hbct/doc/en/charlist.txt
+ contrib/hbct/doc/en/charlihb.txt
+ contrib/hbct/doc/en/relation.txt
+ contrib/hbct/doc/en/atadjust.txt
+ contrib/hbct/doc/en/charonly.txt
+ contrib/hbct/doc/en/ctmath.txt
+ contrib/hbct/doc/en/atnum.txt
+ contrib/hbct/doc/en/numconv.txt
+ contrib/hbct/doc/en/charsort.txt
+ contrib/hbct/doc/en/count.txt
+ contrib/hbct/doc/en/posdiff.txt
+ contrib/hbct/doc/en/ftoc.txt
+ contrib/hbct/doc/en/charmix.txt
+ contrib/hbct/doc/en/charevod.txt
+ contrib/hbct/doc/en/finan.txt
+ contrib/hbct/doc/en/range.txt
+ contrib/hbct/doc/en/wordrepl.txt
+ contrib/hbct/doc/en/charrepl.txt
+ contrib/hbct/doc/en/exponent.txt
+ contrib/hbct/doc/en/addascii.txt
+ contrib/hbct/doc/en/ctmath2.txt
+ contrib/hbct/doc/en/strswap.txt
+ contrib/hbct/doc/en/trig.txt
+ contrib/hbct/doc/en/tab.txt
+ contrib/hbct/doc/en/video.txt
+ contrib/hbct/doc/en/charswap.txt
+ contrib/hbct/doc/en/dattime2.txt
+ contrib/hbct/doc/en/dattime3.txt
+ contrib/hbct/doc/en/replace.txt
+ contrib/hbct/doc/en/charop.txt
+ contrib/hbct/doc/en/misc1.txt
+ contrib/hbct/doc/en/asciisum.txt
+ contrib/hbct/doc/en/color.txt
+ contrib/hbct/doc/en/charone.txt
+ contrib/hbct/doc/en/num1.txt
+ contrib/hbct/doc/en/pos1.txt
+ contrib/hbct/doc/en/pos2.txt
+ contrib/hbct/doc/en/numat.txt
+ contrib/hbct/doc/en/charophb.txt
+ contrib/hbct/doc/en/atrepl.txt
+ contrib/hbct/doc/en/ascpos.txt
+ contrib/hbct/doc/en/wordtoch.txt
+ contrib/hbct/doc/en/ctpad.txt
+ contrib/hbct/doc/en/datetime.txt
+ contrib/hbct/doc/en/print.txt
+ contrib/hbct/doc/en/justify.txt
+ contrib/hbct/doc/en/remove.txt
+ contrib/hbct/doc/en/ctstr.txt
+ contrib/hbct/doc/en/screen1.txt
+ Moved embedded docs to separate files.
* contrib/hbct/charsort.c
* contrib/hbct/ftoc.c
* contrib/hbct/charmix.c
* contrib/hbct/charevod.c
* contrib/hbct/wordrepl.c
* contrib/hbct/exponent.c
* contrib/hbct/charrepl.c
* contrib/hbct/files.c
* contrib/hbct/strswap.c
* contrib/hbct/trig.c
* contrib/hbct/video.c
* contrib/hbct/charswap.c
* contrib/hbct/dattime3.c
* contrib/hbct/charop.c
* contrib/hbct/ct.prg
* contrib/hbct/cursor.c
* contrib/hbct/misc2.c
* contrib/hbct/color.c
* contrib/hbct/charone.c
* contrib/hbct/num1.c
* contrib/hbct/pos1.c
* contrib/hbct/ctcom1.c
* contrib/hbct/charophb.c
* contrib/hbct/ascpos.c
* contrib/hbct/numconv.prg
* contrib/hbct/ctstr.c
* contrib/hbct/screen1.c
* contrib/hbct/token1.c
* contrib/hbct/keyset.c
* contrib/hbct/charmirr.c
* contrib/hbct/ctc.c
* contrib/hbct/ctwfunc.c
* contrib/hbct/charlihb.c
* contrib/hbct/relation.c
* contrib/hbct/setlast.c
* contrib/hbct/atnum.c
* contrib/hbct/count.c
* contrib/hbct/disk.c
* contrib/hbct/posdiff.c
* contrib/hbct/finan.c
* contrib/hbct/range.c
* contrib/hbct/addascii.c
* contrib/hbct/ctmath2.c
* contrib/hbct/tab.c
* contrib/hbct/dattime2.c
* contrib/hbct/replace.c
* contrib/hbct/misc1.c
* contrib/hbct/asciisum.c
* contrib/hbct/pos2.c
* contrib/hbct/numat.c
* contrib/hbct/fcopy.prg
* contrib/hbct/atrepl.c
* contrib/hbct/ctcom2.c
* contrib/hbct/wordtoch.c
* contrib/hbct/ctpad.c
* contrib/hbct/datetime.c
* contrib/hbct/print.c
* contrib/hbct/justify.c
* contrib/hbct/remove.c
- Stripped NFDOC/HBDOC from source code.
+ contrib/hbnf/doc
+ contrib/hbnf/doc/en
+ contrib/hbnf/doc/en/acctmnth.txt
+ contrib/hbnf/doc/en/savearr.txt
+ contrib/hbnf/doc/en/rand1.txt
+ contrib/hbnf/doc/en/madd.txt
+ contrib/hbnf/doc/en/dispmsg.txt
+ contrib/hbnf/doc/en/numlock.txt
+ contrib/hbnf/doc/en/mouse1.txt
+ contrib/hbnf/doc/en/settime.txt
+ contrib/hbnf/doc/en/restsets.txt
+ contrib/hbnf/doc/en/page.txt
+ contrib/hbnf/doc/en/prtscr.txt
+ contrib/hbnf/doc/en/color2n.txt
+ contrib/hbnf/doc/en/byt2bit.txt
+ contrib/hbnf/doc/en/month.txt
+ contrib/hbnf/doc/en/byt2hex.txt
+ contrib/hbnf/doc/en/findith.txt
+ contrib/hbnf/doc/en/at2.txt
+ contrib/hbnf/doc/en/acctweek.txt
+ contrib/hbnf/doc/en/gcd.txt
+ contrib/hbnf/doc/en/poke.txt
+ contrib/hbnf/doc/en/pegs.txt
+ contrib/hbnf/doc/en/min2dhm.txt
+ contrib/hbnf/doc/en/acctqtr.txt
+ contrib/hbnf/doc/en/dosver.txt
+ contrib/hbnf/doc/en/mkdir.txt
+ contrib/hbnf/doc/en/nooccur.txt
+ contrib/hbnf/doc/en/dayofyr.txt
+ contrib/hbnf/doc/en/metaph.txt
+ contrib/hbnf/doc/en/menu1.txt
+ contrib/hbnf/doc/en/byteand.txt
+ contrib/hbnf/doc/en/setlastk.txt
+ contrib/hbnf/doc/en/sqzn.txt
+ contrib/hbnf/doc/en/bytexor.txt
+ contrib/hbnf/doc/en/workdays.txt
+ contrib/hbnf/doc/en/byteor.txt
+ contrib/hbnf/doc/en/asum.txt
+ contrib/hbnf/doc/en/sleep.txt
+ contrib/hbnf/doc/en/wda.txt
+ contrib/hbnf/doc/en/aavg.txt
+ contrib/hbnf/doc/en/woy.txt
+ contrib/hbnf/doc/en/alt.txt
+ contrib/hbnf/doc/en/any2any.txt
+ contrib/hbnf/doc/en/adessort.txt
+ contrib/hbnf/doc/en/setdate.txt
+ contrib/hbnf/doc/en/netpv.txt
+ contrib/hbnf/doc/en/amedian.txt
+ contrib/hbnf/doc/en/blink.txt
+ contrib/hbnf/doc/en/ctrl.txt
+ contrib/hbnf/doc/en/vertmenu.txt
+ contrib/hbnf/doc/en/qtr.txt
+ contrib/hbnf/doc/en/linked.txt
+ contrib/hbnf/doc/en/aredit.txt
+ contrib/hbnf/doc/en/shift.txt
+ contrib/hbnf/doc/en/fttext.txt
+ contrib/hbnf/doc/en/xbox.txt
+ contrib/hbnf/doc/en/ftround.txt
+ contrib/hbnf/doc/en/hex2dec.txt
+ contrib/hbnf/doc/en/nwuid.txt
+ contrib/hbnf/doc/en/dectobin.txt
+ contrib/hbnf/doc/en/chdir.txt
+ contrib/hbnf/doc/en/bitset.txt
+ contrib/hbnf/doc/en/aemaxlen.txt
+ contrib/hbnf/doc/en/nwlstat.txt
+ contrib/hbnf/doc/en/invclr.txt
+ contrib/hbnf/doc/en/popadder.txt
+ contrib/hbnf/doc/en/lastday.txt
+ contrib/hbnf/doc/en/dispc.txt
+ contrib/hbnf/doc/en/ftattr.txt
+ contrib/hbnf/doc/en/tempfile.txt
+ contrib/hbnf/doc/en/diskfunc.txt
+ contrib/hbnf/doc/en/stod.txt
+ contrib/hbnf/doc/en/scregion.txt
+ contrib/hbnf/doc/en/mouse2.txt
+ contrib/hbnf/doc/en/d2e.txt
+ contrib/hbnf/doc/en/kspeed.txt
+ contrib/hbnf/doc/en/descendn.txt
+ contrib/hbnf/doc/en/pickday.txt
+ contrib/hbnf/doc/en/firstday.txt
+ contrib/hbnf/doc/en/daytobow.txt
+ contrib/hbnf/doc/en/getenvrn.txt
+ contrib/hbnf/doc/en/anomatch.txt
+ contrib/hbnf/doc/en/menutonf.txt
+ contrib/hbnf/doc/en/pvid.txt
+ contrib/hbnf/doc/en/proper.txt
+ contrib/hbnf/doc/en/isbiton.txt
+ contrib/hbnf/doc/en/isbit.txt
+ contrib/hbnf/doc/en/cntryset.txt
+ contrib/hbnf/doc/en/datecnfg.txt
+ contrib/hbnf/doc/en/caplock.txt
+ contrib/hbnf/doc/en/easter.txt
+ contrib/hbnf/doc/en/bytenot.txt
+ contrib/hbnf/doc/en/ftisprn.txt
+ contrib/hbnf/doc/en/setkeys.txt
+ contrib/hbnf/doc/en/ntow.txt
+ contrib/hbnf/doc/en/aeminlen.txt
+ contrib/hbnf/doc/en/floptst.txt
+ contrib/hbnf/doc/en/pchr.txt
+ contrib/hbnf/doc/en/savesets.txt
+ contrib/hbnf/doc/en/tbwhile.txt
+ contrib/hbnf/doc/en/year.txt
+ contrib/hbnf/doc/en/calendar.txt
+ contrib/hbnf/doc/en/e2d.txt
+ contrib/hbnf/doc/en/sysmem.txt
+ contrib/hbnf/doc/en/elapsed.txt
+ contrib/hbnf/doc/en/n2color.txt
+ contrib/hbnf/doc/en/bitclr.txt
+ contrib/hbnf/doc/en/eltime.txt
+ contrib/hbnf/doc/en/putkey.txt
+ contrib/hbnf/doc/en/aading.txt
+ contrib/hbnf/doc/en/dfile.txt
+ contrib/hbnf/doc/en/elapmil.txt
+ contrib/hbnf/doc/en/pending.txt
+ contrib/hbnf/doc/en/peek.txt
+ contrib/hbnf/doc/en/clrsel.txt
+ contrib/hbnf/doc/en/ontick.txt
+ contrib/hbnf/doc/en/acctyear.txt
+ contrib/hbnf/doc/en/byteneg.txt
+ contrib/hbnf/doc/en/isshare.txt
+ contrib/hbnf/doc/en/sinkey.txt
+ contrib/hbnf/doc/en/iamidle.txt
+ contrib/hbnf/doc/en/ftidle.txt
+ contrib/hbnf/doc/en/rmdir.txt
+ contrib/hbnf/doc/en/scancode.txt
+ contrib/hbnf/doc/en/vidmode.txt
+ contrib/hbnf/doc/en/origin.txt
+ contrib/hbnf/doc/en/nwsem.txt
+ contrib/hbnf/doc/en/acctadj.txt
+ contrib/hbnf/doc/en/week.txt
+ contrib/hbnf/doc/en/vidcur.txt
+ contrib/hbnf/doc/en/readme.txt
+ contrib/hbnf/doc/en/prtesc.txt
+ contrib/hbnf/doc/en/miltime.txt
+ Moved embedded docs to separate files.
* contrib/hbnf/kspeed.c
* contrib/hbnf/iamidle.c
* contrib/hbnf/miltime.prg
* contrib/hbnf/mouse1.prg
* contrib/hbnf/setkeys.c
* contrib/hbnf/origin.c
* contrib/hbnf/chdir.c
* contrib/hbnf/hex2dec.prg
* contrib/hbnf/mouse2.prg
* contrib/hbnf/ftisprn.c
* contrib/hbnf/putkey.c
* contrib/hbnf/floptst.prg
* contrib/hbnf/mkdir.c
* contrib/hbnf/rmdir.c
* contrib/hbnf/setlastk.c
! Fixed NFDOC formatting.
; TODO: Strip docs.
2010-07-14 12:49 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbct/screen2.c
* contrib/hbct/token2.c

View File

@@ -52,74 +52,8 @@
*
*/
#include "ct.h"
/* $DOC$
* $FUNCNAME$
* ADDASCII()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Add an integer value to an ascii value of a string
* $SYNTAX$
* ADDASCII (<[@]cString>, <nValue>, [<nPosition>], [<lCarryOver>]) --> cString
* $ARGUMENTS$
* <[@]cString> is the string that should be edited
* <nValue> is a integer value that should be added to the
* ASCII value of the character at the <nPosition>th position
* [<nPosition>] is the position of the character that should be edited.
* If not supplied, the last character of <[@]cString> is
* edited.
* [<lCarryOver>] NEW: is set to .T. if the substring from position 1 to
* position <nPosition> should be treated as an integer
* written to the base 256. Thus, the addition of <nValue>
* can affect to whole substring (see EXAMPLES).
* Default is .F., the original behaviour of this function.
* $RETURNS$
* The edited string is returned. The return value can be suppressed by
* using the CSETREF() function. The string must then be passed by
* reference [@].
* $DESCRIPTION$
* ADDASCII() can be used to add or subtract integer values from
* ASCII values in a string. The new <lCarryOver> parameter allows
* to treat a string as an integer written to the base 256. Since
* <nValue> is limited to a signed long, only substrings 4 characters
* long can be affected by one ADDASCII() call.
* If the length of <[@]cString> is smaller than <nPosition>, the
* string remains unchanged. The same happens, if uninterpretable
* parameters are passed to this function.
* $EXAMPLES$
* // Add 32 to the ASCII value of the character at the last position
* // in the string
*
* ? addascii ("SmitH", 32) --> "Smith"
* $TESTS$
* addascii ("0000", 1, 1) == "1000"
* addascii ("0000", 1) == "0001"
* addascii ("AAAA", -255, 1) == "BAAA"
* addascii ("AAAA", -255) == "AAAB"
* addascii ("AAAA", 1, 2, .T.) == "ABAA"
* addascii ("AAAA", 257, 2, .T.) == "BBAA"
* addascii ("AAAA", 257, 2, .F.) == "ABAA"
* addascii ("AAAA", 258,, .T.) == "AABC"
* addascii ("ABBA", -257, 3, .T.) == "AAAA"
* $STATUS$
* Ready
* $COMPLIANCE$
* ADDASCII() is compatible with CT3's ADDASCII().
* A new, 4th, parameter has been added who defaults to the original
* behaviour if omitted.
* $PLATFORMS$
* All
* $FILES$
* Source is addascii.c, library is ct3.
* $SEEALSO$
* CSETREF()
* $END$
*/
HB_FUNC( ADDASCII )
{
int iNoRet;

View File

@@ -52,48 +52,8 @@
*
*/
#include "ct.h"
/* $DOC$
* $FUNCNAME$
* ASCIISUM()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* calculate the sum of the ASCII values of the characters in a string
* $SYNTAX$
* ASCIISUM (<cString>) --> nAsciiSum
* $ARGUMENTS$
* <cString> the string to be processed
* $RETURNS$
* <nAsciiSum> sum of the ASCII values in <cString>
* $DESCRIPTION$
* The ASCIISUM() function sums up the ASCII values of the characters
* in <cString>. Be aware that the function is not position sensitive,
* i.e. a change of position of a certain character in the string does
* not change the ascii sum.
* $EXAMPLES$
* ? asciisum ("ABC") --> 197
* ? asciisum ("ACB") --> 197
* $TESTS$
* asciisum (replicate ("A", 10000)) == 650000
* asciisum ("0123456789") == 525
* asciisum (nil) == 0
* $STATUS$
* Ready
* $COMPLIANCE$
* ASCIISUM() is compatible with CT3's ASCIISUM().
* $PLATFORMS$
* All
* $FILES$
* Source is asciisum.c, library is ct3.
* $SEEALSO$
* CHECKSUM()
* $END$
*/
HB_FUNC( ASCIISUM )
{
if( HB_ISCHAR( 1 ) )

View File

@@ -54,10 +54,8 @@
*
*/
#include "ct.h"
/* defines */
#define DO_ASCPOS_ASCPOS 0
#define DO_ASCPOS_VALPOS 1
@@ -120,95 +118,11 @@ static void do_ascpos( int iSwitch )
}
}
/* $DOC$
* $FUNCNAME$
* ASCPOS()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* ASCII value of a character at a certain position
* $SYNTAX$
* ASCPOS (<cString>, [<nPosition>]) --> nAsciiValue
* $ARGUMENTS$
* <cString> is the processed string
* [<nPosition>] is an optional position within <cString>
* Default: last position in <cString>
* $RETURNS$
* <nAsciiValue> the ASCII value of the character at the specified
* position
* $DESCRIPTION$
* The ASCPOS() function returns the ASCII value of the character that
* can be found at the position <nPosition> in <cString>. If <nPosition>
* is larger than the length of <cString>, 0 is returned.
* $EXAMPLES$
* ? ascpos ("0123456789") --> 57
* ? ascpos ("0123456789",1) --> 48
* $TESTS$
* ascpos ("0123456789") == 57
* ascpos ("0123456789",1) == 48
* ascpos ("0123456789",11) == 0 // <nPosition> to large !
* $STATUS$
* Ready
* $COMPLIANCE$
* ASCPOS() is compatible with CT3's ASCPOS().
* $PLATFORMS$
* All
* $FILES$
* Source is asciisum.c, library is libct.
* $SEEALSO$
* VALPOS()
* $END$
*/
HB_FUNC( ASCPOS )
{
do_ascpos( DO_ASCPOS_ASCPOS );
}
/* $DOC$
* $FUNCNAME$
* VALPOS()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Numerical value of a character at a certain position
* $SYNTAX$
* VALPOS (<cString>, [<nPosition>]) --> nDigitValue
* $ARGUMENTS$
* <cString> is the processed string
* [<nPosition>] is an optional position within <cString>
* Default: last position in <cString>
* $RETURNS$
* <nDigitValue> the numerical value of the character at the specified
* position
* $DESCRIPTION$
* The VALPOS() function returns the numerical value of the character that
* can be found at the position <nPosition> in <cString>. If no digit
* can be found at this position or if <nPosition>
* is larger than the length of <cString>, 0 is returned.
* $EXAMPLES$
* ? valpos ("1234x56789") --> 9
* ? valpos ("1234x56789",1) --> 1
* $TESTS$
* valpos ("1234x56789") == 9
* valpos ("1234x56789",1) == 1
* valpos ("1234x56789",11) == 0 // <nPosition> to large !
* valpos ("1234x56789",5) == 0 // "x" is not a digit !
* $STATUS$
* Ready
* $COMPLIANCE$
* VALPOS() is compatible with CT3's VALPOS().
* $PLATFORMS$
* All
* $FILES$
* Source is asciisum.c, library is libct.
* $SEEALSO$
* ASCPOS()
* $END$
*/
HB_FUNC( VALPOS )
{
do_ascpos( DO_ASCPOS_VALPOS );

View File

@@ -52,52 +52,8 @@
*
*/
#include "ct.h"
/* $DOC$
* $FUNCNAME$
* ATADJUST()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Adjusts a sequence within a string to a specified position
* $SYNTAX$
* ATADJUST (<cStringToMatch>, <cString>, <nAdjustPosition>,
* [<nCounter>], [<nIgnore>],
* [<nFillChar|cFillChar>]) -> cString
* $ARGUMENTS$
* <cStringToMatch> is the sequence to be adjusted within <cString>
* <cString> is the string that contains <cStringToMatch>
* <nAdjustPosition> specifies the position to that <cStringToMatch>
* will be adjusted
* [<nCounter>] specifies which occurence of <cStringToMatch>
* in <cString> is to be adjusted
* Default: last occurence
* [<nIgnore>] specifies how many characters should be omitted
* in the scan
* [<nFillChar|cFillChar>] specifies the character that is used for the
* adjustment
* $RETURNS$
* cString the changed string
* $DESCRIPTION$
* <TODO: add a description, some examples and tests here>
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Ready
* $COMPLIANCE$
* ATADJUST() works like CT3's ATADJUST()
* $PLATFORMS$
* All
* $FILES$
* Source is atadjust.c, library is ct3.
* $SEEALSO$
* SETATLIKE(),CSETATMUPA()
* $END$
*/
HB_FUNC( ATADJUST )
{
if( HB_ISCHAR( 1 ) && HB_ISCHAR( 2 ) && HB_ISNUM( 3 ) )

View File

@@ -310,186 +310,16 @@ static void do_atnum( int iSwitch )
}
}
/* $DOC$
* $FUNCNAME$
* AFTERATNUM()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Returns string portion after nth occurence of substring
* $SYNTAX$
* AFTERATNUM (<cStringToMatch>, <cString>, [<nCounter>],
* [<nIgnore>] ) --> cRestString
* $ARGUMENTS$
* <cStringToMatch> is the substring scanned for
* <cString> is the scanned string
* [<nCounter>] determines how many occurences are of
* <cStringToMatch> in <cString> are searched
* Default: search last occurence
* [<nIgnore>] determines how many character from the start
* should be ignored in the search
* Default: 0
* $RETURNS$
* <cRestString> the portion of <cString> after the <nCounter>th
* occurence of <cStringToMatch> in <cString>
* If such a rest does not exist, an empty string
* is returned.
* $DESCRIPTION$
* This function scans <cString> for <cStringToMatch>. After the
* <nCounter>th match (or the last one, depending on the value of
* <nCounter>) has been found, the portion of
* <cString> after that match will be returned. If there aren't enough
* matches or the last match is identical to the end of <cString>, an
* empty string will be returned.
* After a match has been found, the function continues to scan after
* that match if the CSETATMUPA() switch is turned off, with the
* second character of the matched substring otherwise.
* The function will also consider the settings of SETATLIKE().
* $EXAMPLES$
* ? AFTERATNUM ("!", "What is the answer ? 4 ! 5 !") -> ""
* ? AFTERATNUM ("!", "What is the answer ? 4 ! 5 ?") -> " 5 ?"
* <TODO: add some examples here with csetatmupa() and setatlike()>
* $TESTS$
* AFTERATNUM ("..", "..This..is..a..test!") == "test!"
* AFTERATNUM ("..", "..This..is..a..test!", 2) == "is..a..test!"
* AFTERATNUM ("..", "..This..is..a..test!", 2, 2) == "a..test!"
* $STATUS$
* Ready
* $COMPLIANCE$
* AFTERATNUM() is compatible with CT3's AFTERATNUM().
* $PLATFORMS$
* All
* $FILES$
* Source is atnum.c, library is libct.
* $SEEALSO$
* ATNUM(),BEFORATNUM(),CSETATMUPA(),SETATLIKE()
* $END$
*/
HB_FUNC( AFTERATNUM )
{
do_atnum( DO_ATNUM_AFTERATNUM );
}
/* $DOC$
* $FUNCNAME$
* BEFORATNUM()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Returns string portion before nth occurence of substring
* $SYNTAX$
* BEFORATNUM (<cStringToMatch>, <cString>, [<nCounter>],
* [<nIgnore>] ) --> cRestString
* $ARGUMENTS$
* <cStringToMatch> is the substring scanned for
* <cString> is the scanned string
* [<nCounter>] determines how many occurences are of
* <cStringToMatch> in <cString> are searched
* Default: search last occurence
* [<nIgnore>] determines how many character from the start
* should be ignored in the search
* Default: 0
* $RETURNS$
* <cRestString> the portion of <cString> before the <nCounter>th
* occurence of <cStringToMatch> in <cString>
* If such a string does not exist, an empty string
* is returned.
* $DESCRIPTION$
* This function scans <cString> for <cStringToMatch>. After the
* <nCounter>th match (or the last one, depending on the value of
* <nCounter>) has been found, the portion of
* <cString> before that match will be returned. If there aren't enough
* matches or the last match is identical to the start of <cString>
* (i.e. the last match is the first match), an empty string will be returned.
* After a match has been found, the function continues to scan after
* that match if the CSETATMUPA() switch is turned off, with the
* second character of the matched substring otherwise.
* The function will also consider the settings of SETATLIKE().
* $EXAMPLES$
* ? BEFORATNUM ("!", "What is the answer ? 4 ! 5 !") -> "What is the answer ? 4 ! 5 "
* ? BEFORATNUM ("!", "What is the answer ? 4 ! 5 ?") -> "What is the answer ? 4 "
* <TODO: add some examples here with csetatmupa() and setatlike()>
* $TESTS$
* BEFORATNUM ("..", "..This..is..a..test!") == "..This..is..a"
* BEFORATNUM ("..", "..This..is..a..test!", 2) == "..This"
* BEFORATNUM ("..", "..This..is..a..test!", 2, 2) == "..This..is"
* $STATUS$
* Ready
* $COMPLIANCE$
* BEFORATNUM() is compatible with CT3's BEFORATNUM().
* $PLATFORMS$
* All
* $FILES$
* Source is atnum.c, library is ct3.
* $SEEALSO$
* ATNUM() AFTERATNUM() CSETATMUPA() SETATLIKE()
* $END$
*/
HB_FUNC( BEFORATNUM )
{
do_atnum( DO_ATNUM_BEFORATNUM );
}
/* $DOC$
* $FUNCNAME$
* ATNUM()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Returns the start position of the nth occurence of a substring in a string
* $SYNTAX$
* ATNUM (<cStringToMatch>, <cString>, [<nCounter>],
* [<nIgnore>] ) --> nPosition
* $ARGUMENTS$
* <cStringToMatch> is the substring scanned for
* <cString> is the scanned string
* [<nCounter>] determines how many occurences are of
* <cStringToMatch> in <cString> are searched
* Default: search last occurence
* [<nIgnore>] determines how many character from the start
* should be ignored in the search
* Default: 0
* $RETURNS$
* <nPosition> the position of the <nCounter>th
* occurence of <cStringToMatch> in <cString>.
* If such an occurence does not exist, 0
* is returned.
* $DESCRIPTION$
* This function scans <cString> for <cStringToMatch>. After the
* <nCounter>th match (or the last one, depending on the value of
* <nCounter>) has been found, the position of
* that match will be returned. If there aren't enough
* matches or there is no last match, 0 will be returned.
* After a match has been found, the function continues to scan after
* that match if the CSETATMUPA() switch is turned off, with the
* second character of the matched substring otherwise.
* The function will also consider the settings of SETATLIKE().
* $EXAMPLES$
* ? ATNUM ("!", "What is the answer ? 4 ! 5 !") -> 28
* ? ATNUM ("!", "What is the answer ? 4 ! 5 ?") -> 24
* <TODO: add some examples here with csetatmupa() and setatlike()>
* $TESTS$
* ATNUM ("..", "..This..is..a..test!") == 14
* ATNUM ("..", "..This..is..a..test!", 2) == 7
* ATNUM ("..", "..This..is..a..test!", 2, 2) == 11
* $STATUS$
* Ready
* $COMPLIANCE$
* ATNUM() is compatible with CT3's ATNUM().
* $PLATFORMS$
* All
* $FILES$
* Source is atnum.c, library is libct.
* $SEEALSO$
* ATNUM() AFTERATNUM() CSETATMUPA() SETATLIKE()
* $END$
*/
HB_FUNC( ATNUM )
{
do_atnum( DO_ATNUM_ATNUM );

View File

@@ -52,75 +52,8 @@
*
*/
#include "ct.h"
/* $DOC$
* $FUNCNAME$
* ATREPL()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Search and replace sequences in a string
* $SYNTAX$
* ATREPL (<cStringToMatch>, <cString>, <cReplacement>, [<nCounter>],
* [<lMode>], [<nIgnore>]) --> cString
* $ARGUMENTS$
* <cStringToMatch> is the substring searched for in <cString>
* <cString> is the processed string
* <cReplacement> is the replacement for sequences found
* [<nCounter>] specifies the number of replacements
* Default: last occurence
* [<lMode>] if set to .T., only the <nCounter>th sequence
* of <cStringToMatch> will be replaced, else
* all sequences will be replaced.
* Default: .F.
* [<nIgnore>]) specifies how many characters in <cString> from
* the beginning should be ignored by the function
* Default: 0
* $RETURNS$
* <cString>
* $DESCRIPTION$
* The ATREPL() function searches and replaces sequences in a string.
* First, the function ignores the first <nIgnore> characters of <cString>.
* Then, if <lMode> is set to .T., it searches for the <nCounter>th
* occurence of <cStringToMatch> in <cString>. If successful, the
* sequence will be replaced with <cReplacement>.
* If <lMode> is set to .F., the same search is performed, but EVERY
* occurence of <cStringToMatch> till the <nCounter>th (inclusive) will
* be replaced with <cReplacement>. Note that, in this case,
* the replacements are performed even if the <nCounter>th occurence
* does not exist.
* By using the CSETATMUPA() switch you can decide whether the
* function restarts searching after a found sequence of after
* the first character of that sequence.
* The function allows the use of wildcards in <cStringToMatch>
* and looks for the settings of SETATLIKE().
* $EXAMPLES$
* ? ATREPL("ABC", "ABCDABCDABC", "xx") --> "xxDxxDxx"
* ? ATREPL("ABC", "ABCDABC", "ZYXW") --> "ZYXWDZYXW"
* ? ATREPL("ABC", "ABCDABCDABC", "xx", 2) --> "xxDxxDABC"
* ? ATREPL("ABC", "ABCDABCDABC", "xx", 2, .T.) --> "ABCDxxDABC"
* $TESTS$
* ATREPL("ABC", "ABCDABCDABC", "xx") == "xxDxxDxx"
* ATREPL("ABC", "ABCDABC", "ZYXW") == "ZYXWDZYXW"
* ATREPL("ABC", "ABCDABCDABC", "xx", 2) == "xxDxxDABC"
* ATREPL("ABC", "ABCDABCDABC", "xx", 2, .T.) == "ABCDxxDABC"
* $STATUS$
* Ready
* $COMPLIANCE$
* ATREPL() is compatible with CT3's ATREPL().
* Note the new, 6th parameter !
* $PLATFORMS$
* All
* $FILES$
* Source is atrepl.c, library is ct3.
* $SEEALSO$
* CSETATMUPA() SETATLIKE()
* $END$
*/
HB_FUNC( ATREPL )
{
if( HB_ISCHAR( 1 ) && HB_ISCHAR( 2 ) )

View File

@@ -53,7 +53,6 @@
*
*/
#include "hbapi.h"
static HB_BOOL __numParam( int iParam, HB_MAXINT * plNum )
@@ -196,7 +195,6 @@ HB_FUNC( NUMROL )
hb_retnint( lValue );
}
HB_FUNC( NUMMIRR )
{
HB_MAXINT lValue;

View File

@@ -127,84 +127,11 @@ static void do_charevod( int iSwitch )
}
}
/* $DOC$
* $FUNCNAME$
* CHAREVEN()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Returns the characters on the even positions in a string
* $SYNTAX$
* CHAREVEN (<cString>) --> cEvenString
* $ARGUMENTS$
* <cString> processed string
* $RETURNS$
* <cEvenString> a string containing all character from even positions
* in <cString>
* $DESCRIPTION$
* The CHAREVEN() function looks for the characters on the even positions
* in a given string, collects them and returns them as a string.
* $EXAMPLES$
* ? CHAREVEN (" H E L L O !") -> "HELLO!"
* $TESTS$
* CHAREVEN (" 1 2 3 4 5") == "12345"
* CHAREVEN (" 1 2 3 4 ") == "1234"
* CHAREVEN (" ") == ""
* $STATUS$
* Ready
* $COMPLIANCE$
* CHAREVEN() is compatible with CT3's CHAREVEN().
* $PLATFORMS$
* All
* $FILES$
* Source is charevod.c, library is ct3.
* $SEEALSO$
* CHARODD() CHARMIX()
* $END$
*/
HB_FUNC( CHAREVEN )
{
do_charevod( DO_CHAREVOD_CHAREVEN );
}
/* $DOC$
* $FUNCNAME$
* CHARODD()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Returns the characters on the odd positions in a string
* $SYNTAX$
* CHARODD (<cString>) --> cOddString
* $ARGUMENTS$
* <cString> processed string
* $RETURNS$
* <cOddString> a string containing all character from odd positions
* in <cString>
* $DESCRIPTION$
* The CHARODD() function looks for the characters on the odd positions
* in a given string, collects them and returns them as a string.
* $EXAMPLES$
* ? CHARODD ("H E L L O ! ") -> "HELLO!"
* $TESTS$
* CHARODD ("1A2B3C4D5E") == "12345"
* CHARODD ("1A2B3C4D5") == "12345"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARODD() is compatible with CT3's CHARODD().
* $PLATFORMS$
* All
* $FILES$
* Source is charevod.c, library is ct3.
* $SEEALSO$
* CHAREVEN() CHARMIX()
* $END$
*/
HB_FUNC( CHARODD )
{
do_charevod( DO_CHAREVOD_CHARODD );

View File

@@ -56,89 +56,11 @@
#include "ct.h"
/* $DOC$
* $FUNCNAME$
* CHARSLIST()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Generates a sorted list of all characters in a string
* $SYNTAX$
* CHARSLIST ([<cString>]) -> cSortedCharacterList
* $ARGUMENTS$
* [<cString>] is the string for whom the function generates a
* sorted list of all characters
* Default: "" (empty string)
* $RETURNS$
* <cSortedCharacterList> a sorted list of the characters in <cString>
* $DESCRIPTION$
* The CHARLIST() function generates a sorted list of those characters that
* are contained in <cString>. This list can contain each character
* only once, so that its maximum length is 256. The function
* gives the same result as CHARSORT(CHARLIST(<cString>))
* $EXAMPLES$
* ? charslist ("Hello World !") --> " !HWdelor"
* $TESTS$
* charslist ("Hello World !") == " !HWdelor"
* charslist ("Hello World !") == charsort (charlist ("Hello World !"))
* charslist (nil) == ""
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARSLIST() is only available in Harbour's CT3 library.
* $PLATFORMS$
* All
* $FILES$
* Source is charlist.c, library is libct.
* $SEEALSO$
* CHARNOLIST(),CHARLIST(),CHARHIST()
* $END$
*/
HB_FUNC( CHARSLIST )
{
ct_charlist( CT_CHARLIST_CHARSLIST );
}
/* $DOC$
* $FUNCNAME$
* CHARHIST()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Generates a character histogram of a string
* $SYNTAX$
* CHARHIST ([<cString>]) -> aCharacterCount
* $ARGUMENTS$
* [<cString>] is the string for whom the function generates a
* character histogram
* Default: "" (empty string)
* $RETURNS$
* <aCharacterCount> an array with 256 elements where the nth element
* contains the count of character #(n-1) in cString
* $DESCRIPTION$
* The CHARHIST() function generates a character histogram of those
* characters that are contained in <cString>. This histogram is stored
* in an 256-element array where the nth element contains the count
* of ASCII character #(n-1) in <cString>.
* $EXAMPLES$
* ? charhist ("Hello World !")[109] --> 3 // chr(108)=="l"
* $TESTS$
* charhist ("Hello World !")[109] == 3
* eval ({||aeval (charhist ("Hello World !"),{|x|nTotal+=x}),nTotal==len("Hello World !")}
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARHIST() is only available in Harbour's CT3 library.
* $PLATFORMS$
* All
* $FILES$
* Source is charlist.c, library is libct.
* $SEEALSO$
* CHARLIST(),CHARNOLIST(),CHARSLIST()
* $END$
*/
HB_FUNC( CHARHIST )
{
ct_charlist( CT_CHARLIST_CHARHIST );

View File

@@ -134,89 +134,11 @@ void ct_charlist( int iMode )
}
}
/* $DOC$
* $FUNCNAME$
* CHARLIST()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Generates a list of all characters in a string
* $SYNTAX$
* CHARLIST ([<cString>]) -> cCharacterList
* $ARGUMENTS$
* [<cString>] is the string for whom the function generates a list
* of all characters
* Default: "" (empty string)
* $RETURNS$
* <cCharacterList> a list of the characters in <cString>
* $DESCRIPTION$
* The CHARLIST() function generates a list of those characters that
* are contained in <cString>. This list can contain each character
* only once, so that its maximum length is 256. The list lists those
* characters first that are occuring in <cString> first.
* $EXAMPLES$
* ? charlist ("Hello World !") --> "Helo Wrd!"
* $TESTS$
* charlist ("Hello World !") == "Helo Wrd!"
* charlist (nil) == ""
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARLIST() is compatible with CT3's CHARLIST().
* $PLATFORMS$
* All
* $FILES$
* Source is charlist.c, library is libct.
* $SEEALSO$
* CHARNOLIST(),CHARSLIST(),CHARHIST()
* $END$
*/
HB_FUNC( CHARLIST )
{
ct_charlist( CT_CHARLIST_CHARLIST );
}
/* $DOC$
* $FUNCNAME$
* CHARNOLIST()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Generates a list of all characters not contained in a string
* $SYNTAX$
* CHARNOLIST ([<cString>]) -> cCharacterList
* $ARGUMENTS$
* [<cString>] is the string for whom the function generates a list
* of all characters not contained in that string
* Default: "" (empty string)
* $RETURNS$
* <cCharacterList> a list of the characters that are not contained in <cString>
* $DESCRIPTION$
* The CHARNOLIST() function generates a list of those characters that
* are not contained in <cString>. This list can contain each character
* only once, so that its maximum length is 256. The list is alphabetically
* sorted.
* $EXAMPLES$
* ? charnolist (charnolist ("Hello World !")) --> " !HWdelor"
* $TESTS$
* charnolist (charnolist ("Hello World !")) == charslist ("Hello World !")
* charnolist (charnolist (nil)) == ""
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARNOLIST() is compatible with CT3's CHARNOLIST().
* $PLATFORMS$
* All
* $FILES$
* Source is charlist.c, library is libct.
* $SEEALSO$
* CHARLIST(),CHARSLIST(),CHARHIST()
* $END$
*/
HB_FUNC( CHARNOLIST )
{
ct_charlist( CT_CHARLIST_CHARNOLIST );

View File

@@ -52,55 +52,8 @@
*
*/
#include "ct.h"
/* $DOC$
* $FUNCNAME$
* CHARMIRR()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Mirror a string
* $SYNTAX$
* CHARMIRR (<[@]cString>, [<lDontMirrorSpaces>]) -> cMirroredString
* $ARGUMENTS$
* <[@]cString> is the string that should be mirrored
* [<lDontMirrorSpaces>] if set to .T., spaces at the end of
* <cString> will not be mirrored but kept at the end
* Default: .F., mirror the whole string
* $RETURNS$
* <cMirroredString> the mirrored string
* $DESCRIPTION$
* The CHARMIRR() function mirrors a string, i.e. the first character
* will be put at the end, the second at the last but one position etc..
* One can use this function for index searches, but then, the spaces
* at the end of the string should not be mirrored.
* One can omit the return value of the function by setting the CSETREF()
* switch to .T., but <cString> must then be passed by reference to get
* a result.
* $EXAMPLES$
* ? charmirr ("racecar") // "racecar"
* ? charmirr ("racecar ", .T.) // "racecar "
* ? charmirr ("racecar ", .F.) // " racecar"
* $TESTS$
* charmirr ("racecar") == "racecar"
* charmirr ("racecar ", .T.) == "racecar "
* charmirr ("racecar ", .F.) == " racecar"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARMIRR() is compatible with CT3's CHARMIRR().
* $PLATFORMS$
* All
* $FILES$
* Source is charmirr.c, library is ct3.
* $SEEALSO$
* CSETREF()
* $END$
*/
HB_FUNC( CHARMIRR )
{
int iNoRet;

View File

@@ -56,58 +56,6 @@
#include "ct.h"
/* $DOC$
* $FUNCNAME$
* CHARMIX()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Mix two strings
* $SYNTAX$
* CHARMIX (<cString1>[, <cString2>]) --> cMixedString
* $ARGUMENTS$
* <cString1> String that will be mixed with the characters from <cString2>
* [<cString2>] String whose characters will be mixed with the one from
* <cString1>.
* Default: " " (string with one space char)
* $RETURNS$
* <cMixedString> Mixed string
* $DESCRIPTION$
* The CHARMIX() function mixes the strings <cString1> and <cString2>. To
* do this it takes one character after the other alternatively from
* <cString1> and <cString2> and puts them in the output string.
* This procedure is stopped when the end of <cString1> is reached. If
* <cString2> is shorter than <cString1>, the function will start at
* the begin of <cString2> again. If on the other hand <cString2> is
* longer than <cString1>, the surplus characters will be omitted.
* $EXAMPLES$
* ? CHARMIX("ABC", "123") // "A1B2C3"
* ? CHARMIX("ABCDE", "12") // "A1B2C1D2E1"
* ? CHARMIX("AB", "12345") // "A1B2"
* ? CHARMIX("HELLO", " ") // "H E L L O "
* ? CHARMIX("HELLO", "") // "HELLO"
* $TESTS$
* CHARMIX("ABC", "123") == "A1B2C3"
* CHARMIX("ABCDE", "12") == "A1B2C1D2E1"
* CHARMIX("AB", "12345") == "A1B2"
* CHARMIX("HELLO", " ") == "H E L L O "
* CHARMIX("HELLO", "") == "HELLO"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARMIX() is compatible with CT3's CHARMIX().
* NOTE: CA-Tools version of CHARMIX() will hang
* if the second parameter is an empty string, this version will not.
* $PLATFORMS$
* All
* $FILES$
* Source is charmix.c, library is ct3.
* $SEEALSO$
* CHAREVEN() CHARODD()
* $END$
*/
HB_FUNC( CHARMIX )
{
if( HB_ISCHAR( 1 ) )

View File

@@ -54,10 +54,8 @@
*
*/
#include "ct.h"
/* defines */
#define DO_CHARONE_CHARONE 0
#define DO_CHARONE_WORDONE 1
@@ -204,98 +202,11 @@ static void do_charone( int iSwitch )
}
}
/* $DOC$
* $FUNCNAME$
* CHARONE()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Reduce multiple occurences of a character to one
* $SYNTAX$
* CHARONE ([<cCharactersToReduce>,] <cString>) -> cReducedString
* $ARGUMENTS$
* [<cCharactersToReduce>] specifies the characters the multiple
* occurences of which should be reduced to one
* Default: All characters.
* <cString> specifies the processed string
* $RETURNS$
* <cReducedString> the string with the reduced occurences
* $DESCRIPTION$
* The CHARONE() function reduces multiple occurences of characters in
* <cString> to a single one. It is important to note that the multiple
* occurences must occur directly one behind the other. This behaviour is
* is in contrast to the CHARLIST() function.
* $EXAMPLES$
* ? CHARONE("122333a123") // "123a123"
* ? CHARONE("A B CCCD") // "A B CD"
* ? CHARONE(" ", "A B A B") // "A B A B"
* ? CHARONE("o", "122oooB12o") // "122oB12o"
* $TESTS$
* CHARONE("122333a123") == "123a123"
* CHARONE("A B CCCD") == "A B CD"
* CHARONE(" ", "A B A B") == "A B A B"
* CHARONE("o", "122oooB12o") == "122oB12o"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARONE() is compatible with CT3's CHARONE().
* $PLATFORMS$
* All
* $FILES$
* Source is charone.c, library is ct3.
* $SEEALSO$
* CHARREM() WORDONE()
* $END$
*/
HB_FUNC( CHARONE )
{
do_charone( DO_CHARONE_CHARONE );
}
/* $DOC$
* $FUNCNAME$
* WORDONE()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Reduce multiple occurences of a double character to one
* $SYNTAX$
* WORDONE ([<cDoubleCharactersToReduce>,] <cString>) -> cReducedString
* $ARGUMENTS$
* [<cDoubleCharactersToReduce>] specifies the double characters the multiple
* occurences of which should be reduced to one
* Default: All characters.
* <cString> specifies the processed string
* $RETURNS$
* <cReducedString> the string with the reduced occurences
* $DESCRIPTION$
* The WORDONE() function reduces multiple occurences of double characters in
* <cString> to a single one. It is important to note that the multiple
* occurences must occur directly one behind the other.
* $EXAMPLES$
* ? WORDONE("12ABAB12") // "12AB12"
* ? WORDONE("1AAAA2") // "1AAAA2"
* ? WORDONE("12", "1212ABAB") // "12ABAB"
* $TESTS$
* WORDONE("12ABAB12") == "12AB12"
* WORDONE("1AAAA2") == "1AAAA2"
* WORDONE("12", "1212ABAB") == "12ABAB"
* $STATUS$
* Ready
* $COMPLIANCE$
* WORDONE() is compatible with CT3's WORDONE().
* $PLATFORMS$
* All
* $FILES$
* Source is charone.c, library is ct3.
* $SEEALSO$
* CHARONE() CHARREM()
* $END$
*/
HB_FUNC( WORDONE )
{
do_charone( DO_CHARONE_WORDONE );

View File

@@ -56,10 +56,8 @@
*
*/
#include "ct.h"
/* defines */
#define DO_CHARONLY_CHARONLY 0
#define DO_CHARONLY_WORDONLY 1
@@ -175,180 +173,21 @@ static void do_charonly( int iSwitch )
}
}
/* $DOC$
* $FUNCNAME$
* CHARONLY()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Intersectional set of two strings based on characters
* $SYNTAX$
* CHARONLY (<cThisCharactersOnly>, <cString>) -> cReducedString
* $ARGUMENTS$
* <cThisCharactersOnly> specifies the characters that must not be
* deleted in <cString>.
* <cString> is the string that should be processed
* $RETURNS$
* <cReducedString> A string with all characters deleted but those
* specified in <cThisCharactersOnly>.
* $DESCRIPTION$
* The CHARONLY() function calculates the intersectional set of two
* strings. To do this, it deletes all characters from <cString> that
* do not appear in <cThisCharacterOnly>.
* $EXAMPLES$
* ? CHARONLY("0123456789", "0211 - 38 99 77") // "0211389977"
* ? CHARONLY("0123456789", "0211/ 389 977") // "0211389977"
* $TESTS$
* CHARONLY("0123456789", "0211 - 38 99 77") == "0211389977"
* CHARONLY("0123456789", "0211/ 389 977") == "0211389977"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARONLY() is compatible with CT3's CHARONLY().
* $PLATFORMS$
* All
* $FILES$
* Source is charonly.c, library is ct3.
* $SEEALSO$
* CHARREM() WORDONLY() WORDREM()
* $END$
*/
HB_FUNC( CHARONLY )
{
do_charonly( DO_CHARONLY_CHARONLY );
}
/* $DOC$
* $FUNCNAME$
* WORDONLY()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Intersectional set of two strings based on double characters
* $SYNTAX$
* WORDONLY (<cThisDoubleCharactersOnly>, <cString>) -> cReducedString
* $ARGUMENTS$
* <cThisDoubleCharactersOnly> specifies the double characters that must
* not be deleted in <cString>.
* <cString> is the string that should be processed
* $RETURNS$
* <cReducedString> A string with all double characters deleted
* but those specified in <cThisCharactersOnly>.
* $DESCRIPTION$
* The WORDONLY() function calculates the intersectional set of two
* strings based on double characters. To do this, it deletes all double
* characters from <cString> that do not appear in <cThisDoubleCharacterOnly>.
* $EXAMPLES$
* ? WORDONLY("AABBCCDD", "XXAAYYBBZZ") // "AABB"
* ? WORDONLY("AABBCCDD", "XAAYYYBBZZ") // "BB"
* $TESTS$
* WORDONLY("AABBCCDD", "XXAAYYBBZZ") == "AABB"
* WORDONLY("AABBCCDD", "XAAYYYBBZZ") == "BB"
* $STATUS$
* Ready
* $COMPLIANCE$
* WORDONLY() is compatible with CT3's WORDONLY().
* $PLATFORMS$
* All
* $FILES$
* Source is charonly.c, library is ct3.
* $SEEALSO$
* CHARONLY() CHARREM() WORDREM()
* $END$
*/
HB_FUNC( WORDONLY )
{
do_charonly( DO_CHARONLY_WORDONLY );
}
/* $DOC$
* $FUNCNAME$
* CHARREM()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Removes characters from a string
* $SYNTAX$
* CHARREM (<cDeleteThisCharacters>, <cString>) -> cReducedString
* $ARGUMENTS$
* <cDeleteThisCharacters> specifies the characters that should
* be deleted in <cString>
* <cString>) is the string that should be processed
* $RETURNS$
* <cReducedString> is a string where the characters specified
* in <cDeleteThisCharacters> are deleted
* $DESCRIPTION$
* The CHARREM() function deletes the characters specified in
* <cDeleteThisCharacters> from <cString>.
* $EXAMPLES$
* ? CHARREM(" ", " 1 2 ") // "12"
* ? CHARREM("3y", "xyz123") // "xz12"
* $TESTS$
* CHARREM(" ", " 1 2 ") == "12"
* CHARREM("3y", "xyz123") == "xz12"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARREM() is compatible with CT3's CHARREM().
* $PLATFORMS$
* All
* $FILES$
* Source is charonly.c, library is ct3.
* $SEEALSO$
* CHARONLY() WORDONLY() WORDREM()
* $END$
*/
HB_FUNC( CHARREM )
{
do_charonly( DO_CHARONLY_CHARREM );
}
/* $DOC$
* $FUNCNAME$
* WORDREM()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Removes characters from a string
* $SYNTAX$
* WORDREM (<cDeleteThisDoubleCharacters>, <cString>) -> cReducedString
* $ARGUMENTS$
* <cDeleteThisDoubleCharacters> specifies the double characters that
* should be deleted in <cString>
* <cString>) is the string that should be processed
* $RETURNS$
* <cReducedString> is a string where the double characters
* specified in <cDeleteThisDoubleCharacters>
* are deleted
* $DESCRIPTION$
* The WORDREM() function deletes the double characters specified in
* <cDeleteThisDoubleCharacters> from <cString>.
* $EXAMPLES$
* ? WORDREM("abcd", "0ab1cd") // "0ab1"
* ? WORDREM("abcd", "ab0cd1") // "0cd1"
* $TESTS$
* WORDREM("abcd", "0ab1cd") == "0ab1"
* WORDREM("abcd", "ab0cd1") == "0cd1"
* $STATUS$
* Ready
* $COMPLIANCE$
* WORDREM() is a new function available only in Harbour's CT3.
* $PLATFORMS$
* All
* $FILES$
* Source is charonly.c, library is ct3.
* $SEEALSO$
* CHARONLY CHARREM() WORDREM()
* $END$
*/
HB_FUNC( WORDREM )
{
do_charonly( DO_CHARONLY_WORDREM );

View File

@@ -369,271 +369,26 @@ void ct_charop( int iMode )
}
}
/* $DOC$
* $FUNCNAME$
* CHARADD()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Adds corresponding ASCII value of two strings
* $SYNTAX$
* CHARADD (<[@]cString1>, <cString2>) --> cAddString
* $ARGUMENTS$
* <[@]cString1> first string
* <cString2> second string
* $RETURNS$
* <cAddString> string with added ASCII values
* $DESCRIPTION$
* The CHARADD() function constructs a new string from the two strings
* passed as parameters. To do this, it adds the ASCII values of the
* corresponding characters of both strings and places a character in
* the resulting string whose ASCII value equals to that sum (modulo 256).
* If the first string is passed by reference, the resulting string is
* stored in <cString1>, too. By setting the CSETREF()-switch to .T.,
* the return value can be omitted.
* If <cString2> is shorter than <cString1> and the last character of
* <cString2> has been processed, the function restarts with the first
* character of <cString2>.
* $EXAMPLES$
* ? charadd ("012345678", chr(1)) --> "123456789"
* ? charadd ("123456789", chr(255)) --> "012345678"
* ? charadd ("0000", chr(0)+chr(1)+chr(2)+chr(3)) --> "0123"
* $TESTS$
* charadd ("012345678", chr(1)) == "123456789"
* charadd ("012345678", chr(1)+chr(2)) == "133557799"
* charadd ("123456789", chr(255)) == "012345678"
* charadd ("123456789", chr(255)+chr(254)) == "002244668"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARADD() is compatible with CT3's CHARADD().
* $PLATFORMS$
* All
* $FILES$
* Source is charop.c, library is ct3.
* $SEEALSO$
* CHARSUB() CHARAND() CHARNOT()
* CHAROR() CHARXOR() CHARSHL()
* CHARSHR() CHARRLL() CHARRLR()
* CSETREF()
* $END$
*/
HB_FUNC( CHARADD )
{
ct_charop( CT_CHAROP_CHARADD );
}
/* $DOC$
* $FUNCNAME$
* CHARAND()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Combine corresponding ASCII value of two strings with bitwise AND
* $SYNTAX$
* CHARAND (<[@]cString1>, <cString2>) --> cAndString
* $ARGUMENTS$
* <[@]cString1> first string
* <cString2> second string
* $RETURNS$
* <cAndString> string with bitwise AND combined ASCII values
* $DESCRIPTION$
* The CHARAND() function constructs a new string from the two strings
* passed as parameters. To do this, it combines the ASCII values of the
* corresponding characters of both strings with a bitwise AND-operation
* and places a character in the resulting string whose ASCII value
* equals to the result of that operation.
* If the first string is passed by reference, the resulting string is
* stored in <cString1>, too. By setting the CSETREF()-switch to .T.,
* the return value can be omitted.
* If <cString2> is shorter than <cString1> and the last character of
* <cString2> has been processed, the function restarts with the first
* character of <cString2>.
* $EXAMPLES$
* // clear the LSB
* ? charand ("012345678", chr(254)) --> "002244668"
* ? charand ("012345678", chr(254)+chr(252)) --> "002044648"
* $TESTS$
* charand ("012345678", chr(254)) == "002244668"
* charand ("012345678", chr(254)+chr(252)) == "002044648"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARAND() is compatible with CT3's CHARAND().
* $PLATFORMS$
* All
* $FILES$
* Source is charop.c, library is ct3.
* $SEEALSO$
* CHARADD() CHARSUB() CHARNOT()
* CHAROR() CHARXOR() CHARSHL()
* CHARSHR() CHARRLL() CHARRLR()
* CSETREF()
* $END$
*/
HB_FUNC( CHARAND )
{
ct_charop( CT_CHAROP_CHARAND );
}
/* $DOC$
* $FUNCNAME$
* CHARNOT()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Process each character in a string with bitwise NOT operation
* $SYNTAX$
* CHARNOT (<[@]cString>) --> cNotString
* $ARGUMENTS$
* <[@]cString> string to be processed
* $RETURNS$
* <cNotString> string with bitwise negated characters
* $DESCRIPTION$
* The CHARNOT() function constructs a new string from the string
* passed as parameter. To do this, it performs a bitwise NOT operation
* to the characters of the string and places a character in
* the resulting string whose ASCII value equals to the result of that
* operation. It can be easily seen that the resulting ASCII-value equals
* 255 minus input ASCII value.
* If the string is passed by reference, the resulting string is
* stored in <cString>, too. By setting the CSETREF()-switch to .T.,
* the return value can be omitted.
* $EXAMPLES$
* ? charnot (chr(85)+chr(128)+chr(170)+chr(1)) --> chr(170)+chr(127)+chr(85)+chr(254)
* ? charnot (charnot ("This is a test!")) --> "This is a test!"
* $TESTS$
* charnot (chr(85)+chr(128)+chr(170)+chr(1)) == chr(170)+chr(127)+chr(85)+chr(254)
* charnot (charnot ("This is a test!")) == "This is a test!"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARNOT() is compatible with CT3's CHARNOT().
* $PLATFORMS$
* All
* $FILES$
* Source is charop.c, library is ct3.
* $SEEALSO$
* CHARADD() CHARSUB() CHARAND()
* CHAROR() CHARXOR() CHARSHL()
* CHARSHR() CHARRLL() CHARRLR()
* CSETREF()
* $END$
*/
HB_FUNC( CHARNOT )
{
ct_charop( CT_CHAROP_CHARNOT );
}
/* $DOC$
* $FUNCNAME$
* CHAROR()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Combine corresponding ASCII value of two strings with bitwise OR
* $SYNTAX$
* CHAROR (<[@]cString1>, <cString2>) --> cOrString
* $ARGUMENTS$
* <[@]cString1> first string
* <cString2> second string
* $RETURNS$
* <cOrString> string with bitwise OR combined ASCII values
* $DESCRIPTION$
* The CHAROR() function constructs a new string from the two strings
* passed as parameters. To do this, it combines the ASCII values of the
* corresponding characters of both strings with a bitwise OR-operation
* and places a character in the resulting string whose ASCII value
* equals to the result of that operation.
* If the first string is passed by reference, the resulting string is
* stored in <cString1>, too. By setting the CSETREF()-switch to .T.,
* the return value can be omitted.
* If <cString2> is shorter than <cString1> and the last character of
* <cString2> has been processed, the function restarts with the first
* character of <cString2>.
* $EXAMPLES$
* // set the LSB
* ? charor ("012345678", chr(1)) --> "113355779"
* ? charor ("012345678", chr(1)+chr(3)) --> "133357779"
* $TESTS$
* charor ("012345678", chr(1)) == "113355779"
* charor ("012345678", chr(1)+chr(3)) == "133357779"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHAROR() is compatible with CT3's CHAROR().
* $PLATFORMS$
* All
* $FILES$
* Source is charop.c, library is ct3.
* $SEEALSO$
* CHARADD() CHARSUB() CHARNOT()
* CHARAND() CHARXOR() CHARSHL()
* CHARSHR() CHARRLL() CHARRLR()
* CSETREF()
* $END$
*/
HB_FUNC( CHAROR )
{
ct_charop( CT_CHAROP_CHAROR );
}
/* $DOC$
* $FUNCNAME$
* CHARXOR()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Combine corresponding ASCII value of two strings with bitwise XOR
* $SYNTAX$
* CHARXOR (<[@]cString1>, <cString2>) --> cXOrString
* $ARGUMENTS$
* <[@]cString1> first string
* <cString2> second string
* $RETURNS$
* <cXOrString> string with bitwise XOR combined ASCII values
* $DESCRIPTION$
* The CHARXOR() function constructs a new string from the two strings
* passed as parameters. To do this, it combines the ASCII values of the
* corresponding characters of both strings with a bitwise XOR-operation
* and places a character in the resulting string whose ASCII value
* equals to the result of that operation.
* If the first string is passed by reference, the resulting string is
* stored in <cString1>, too. By setting the CSETREF()-switch to .T.,
* the return value can be omitted.
* If <cString2> is shorter than <cString1> and the last character of
* <cString2> has been processed, the function restarts with the first
* character of <cString2>.
* $EXAMPLES$
* // easy encryption
* ? charxor ("This is top secret !", "My Password") --> <encrypted sentence>
* $TESTS$
* charxor (charxor ("This is top secret !", "My Password"), "My Password") == "This is top secret !"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARXOR() is compatible with CT3's CHARXOR().
* $PLATFORMS$
* All
* $FILES$
* Source is charop.c, library is ct3.
* $SEEALSO$
* CHARADD() CHARSUB() CHARNOT()
* CHARAND() CHAROR() CHARSHL()
* CHARSHR() CHARRLL() CHARRLR()
* CSETREF()
* $END$
*/
HB_FUNC( CHARXOR )
{
ct_charop( CT_CHAROP_CHARXOR );

View File

@@ -59,264 +59,26 @@
#include "ct.h"
/* $DOC$
* $FUNCNAME$
* CHARSUB()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Subtracts corresponding ASCII value of two strings
* $SYNTAX$
* CHARSUB (<[@]cString1>, <cString2>) --> cSubString
* $ARGUMENTS$
* <[@]cString1> first string
* <cString2> second string
* $RETURNS$
* <cSubString> string with subtracted ASCII values
* $DESCRIPTION$
* The CHARSUB() function constructs a new string from the two strings
* passed as parameters. To do this, it subtracts the ASCII values of the
* corresponding characters of both strings and places a character in
* the resulting string whose ASCII value equals to that difference (modulo 256).
* If the first string is passed by reference, the resulting string is
* stored in <cString1>, too. By setting the CSETREF()-switch to .T.,
* the return value can be omitted.
* If <cString2> is shorter than <cString1> and the last character of
* <cString2> has been processed, the function restarts with the first
* character of <cString2>.
* $EXAMPLES$
* ? charsub ("012345678", chr(1)) --> "/01234567"
* ? charsub ("123456789", chr(255)) --> "23456789:"
* ? charsub ("9999", chr(0)+chr(1)+chr(2)+chr(3)) --> "9876"
* $TESTS$
* charsub ("123456789", chr(1)) == "012345678"
* charsub ("123456789", chr(1)+chr(2)) == "002244668"
* charsub ("012345678", chr(255)) == "123456789"
* charsub ("012345678", chr(255)+chr(254)) == "133557799"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARSUB() is a new function that is only available in Harbour's CT3 lib.
* $PLATFORMS$
* All
* $FILES$
* Source is charop.c, library is ct3.
* $SEEALSO$
* CHARADD() CHARAND() CHARNOT()
* CHAROR() CHARXOR() CHARSHL()
* CHARSHR() CHARRLL() CHARRLR()
* CSETREF()
* $END$
*/
HB_FUNC( CHARSUB )
{
ct_charop( CT_CHAROP_CHARSUB );
}
/* $DOC$
* $FUNCNAME$
* CHARSHL()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Process each character in a string with bitwise SHIFT LEFT operation
* $SYNTAX$
* CHARSHL (<[@]cString>, <nBitsToSHL> ) --> cSHLString
* $ARGUMENTS$
* <[@]cString> string to be processed
* <nBitsToSHL> number of bit positions to be shifted to the left
* $RETURNS$
* <cSHLString> string with bitwise shifted left characters
* $DESCRIPTION$
* The CHARSHL() function constructs a new string from the string
* passed as parameter. To do this, it performs a bitwise SHIFT LEFT
* (SHL) operation to the characters of the string and places a character in
* the resulting string whose ASCII value equals to the result of that
* operation.
* Be aware that bits shifted out of the byte are lost. If you need
* a bit rotation, use the CHARRLL() function instead.
* If the string is passed by reference, the resulting string is
* stored in <cString>, too. By setting the CSETREF()-switch to .T.,
* the return value can be omitted.
* $EXAMPLES$
* ? charshl (chr(1)+chr(2)+chr(4)+chr(8)+chr(16)+chr(32)+chr(64)+chr(128), 3)
* --> chr(8)+chr(16)+chr(32)+chr(64)+chr(128)+chr(0)+chr(0)+chr(0)
* $TESTS$
* charshl (chr(1)+chr(2)+chr(4)+chr(8)+chr(16)+chr(32)+chr(64)+chr(128), 3) == chr(8)+chr(16)+chr(32)+chr(64)+chr(128)+chr(0)+chr(0)+chr(0)
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARSHL() is a new function that is only available in Harbour's CT3 lib.
* $PLATFORMS$
* All
* $FILES$
* Source is charop.c, library is ct3.
* $SEEALSO$
* CHARADD() CHARSUB() CHARAND()
* CHAROR() CHARXOR() CHARNOT()
* CHARSHR() CHARRLL() CHARRLR()
* CSETREF()
* $END$
*/
HB_FUNC( CHARSHL )
{
ct_charop( CT_CHAROP_CHARSHL );
}
/* $DOC$
* $FUNCNAME$
* CHARSHR()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Process each character in a string with bitwise SHIFT RIGHT operation
* $SYNTAX$
* CHARSHR (<[@]cString>, <nBitsToSHR> ) --> cSHRString
* $ARGUMENTS$
* <[@]cString> string to be processed
* <nBitsToSHR> number of bit positions to be shifted to the right
* $RETURNS$
* <cSHRString> string with bitwise shifted right characters
* $DESCRIPTION$
* The CHARSHR() function constructs a new string from the string
* passed as parameter. To do this, it performs a bitwise SHIFT RIGHT
* (SHR) operation to the characters of the string and places a character in
* the resulting string whose ASCII value equals to the result of that
* operation.
* Be aware that bits shifted out of the byte are lost. If you need
* a bit rotation, use the CHARRLR() function instead.
* If the string is passed by reference, the resulting string is
* stored in <cString>, too. By setting the CSETREF()-switch to .T.,
* the return value can be omitted.
* $EXAMPLES$
* ? charshr (chr(1)+chr(2)+chr(4)+chr(8)+chr(16)+chr(32)+chr(64)+chr(128), 3)
* --> chr(0)+chr(0)+chr(0)+chr(1)+chr(2)+chr(4)+chr(8)+chr(16)
* $TESTS$
* charshr (chr(1)+chr(2)+chr(4)+chr(8)+chr(16)+chr(32)+chr(64)+chr(128), 3) == chr(0)+chr(0)+chr(0)+chr(1)+chr(2)+chr(4)+chr(8)+chr(16)
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARSHR() is a new function that is only available in Harbour's CT3 lib.
* $PLATFORMS$
* All
* $FILES$
* Source is charop.c, library is ct3.
* $SEEALSO$
* CHARADD() CHARSUB() CHARAND()
* CHAROR() CHARXOR() CHARNOT()
* CHARSHL() CHARRLL() CHARRLR()
* CSETREF()
* $END$
*/
HB_FUNC( CHARSHR )
{
ct_charop( CT_CHAROP_CHARSHR );
}
/* $DOC$
* $FUNCNAME$
* CHARRLL()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Process each character in a string with bitwise ROLL LEFT operation
* $SYNTAX$
* CHARRLL (<[@]cString>, <nBitsToRLL> ) --> cRLLString
* $ARGUMENTS$
* <[@]cString> string to be processed
* <nBitsToRLL> number of bit positions to be rolled to the left
* $RETURNS$
* <cRLLString> string with bitwise rolled left characters
* $DESCRIPTION$
* The CHARRLL() function constructs a new string from the string
* passed as parameter. To do this, it performs a bitwise ROLL LEFT
* (RLL) operation to the characters of the string and places a character in
* the resulting string whose ASCII value equals to the result of that
* operation.
* Be aware that, in contrast to CHARSHL(), bits rolled out on
* the left are put in again on the right.
* If the string is passed by reference, the resulting string is
* stored in <cString>, too. By setting the CSETREF()-switch to .T.,
* the return value can be omitted.
* $EXAMPLES$
* ? charrll (chr(1)+chr(2)+chr(4)+chr(8)+chr(16)+chr(32)+chr(64)+chr(128), 3)
* --> chr(8)+chr(16)+chr(32)+chr(64)+chr(128)+chr(1)+chr(2)+chr(4)
* $TESTS$
* charrll (chr(1)+chr(2)+chr(4)+chr(8)+chr(16)+chr(32)+chr(64)+chr(128), 3) == chr(8)+chr(16)+chr(32)+chr(64)+chr(128)+chr(1)+chr(2)+chr(4)
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARRLL() is a new function that is only available in Harbour's CT3 lib.
* $PLATFORMS$
* All
* $FILES$
* Source is charop.c, library is ct3.
* $SEEALSO$
* CHARADD() CHARSUB() CHARAND()
* CHAROR() CHARXOR() CHARNOT()
* CHARSHL() CHARSHR() CHARRLR()
* CSETREF()
* $END$
*/
HB_FUNC( CHARRLL )
{
ct_charop( CT_CHAROP_CHARRLL );
}
/* $DOC$
* $FUNCNAME$
* CHARRLR()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Process each character in a string with bitwise ROLL RIGHT operation
* $SYNTAX$
* CHARRLR (<[@]cString>, <nBitsToRLR> ) --> cRLRString
* $ARGUMENTS$
* <[@]cString> string to be processed
* <nBitsToRLR> number of bit positions to be rolled to the right
* $RETURNS$
* <cRLRString> string with bitwise rolled right characters
* $DESCRIPTION$
* The CHARRLR() function constructs a new string from the string
* passed as parameter. To do this, it performs a bitwise ROLL RIGHT
* (RLR) operation to the characters of the string and places a character in
* the resulting string whose ASCII value equals to the result of that
* operation.
* Be aware that, in contrast to CHARSHR(), bits rolled out on
* the right are put in again on the left.
* If the string is passed by reference, the resulting string is
* stored in <cString>, too. By setting the CSETREF()-switch to .T.,
* the return value can be omitted.
* $EXAMPLES$
* ? charrlr (chr(1)+chr(2)+chr(4)+chr(8)+chr(16)+chr(32)+chr(64)+chr(128), 3)
* --> chr(32)+chr(64)+chr(128)+chr(1)+chr(2)+chr(4)+chr(8)+chr(16)
* $TESTS$
* charrlr (chr(1)+chr(2)+chr(4)+chr(8)+chr(16)+chr(32)+chr(64)+chr(128), 3) == chr(32)+chr(64)+chr(128)+chr(1)+chr(2)+chr(4)+chr(8)+chr(16)
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARRLR() is a new function that is only available in Harbour's CT3 lib.
* $PLATFORMS$
* All
* $FILES$
* Source is charop.c, library is ct3.
* $SEEALSO$
* CHARADD() CHARSUB() CHARAND()
* CHAROR() CHARXOR() CHARNOT()
* CHARSHL() CHARSHR() CHARRLL()
* CSETREF()
* $END$
*/
HB_FUNC( CHARRLR )
{
ct_charop( CT_CHAROP_CHARRLR );

View File

@@ -52,74 +52,8 @@
*
*/
#include "ct.h"
/* $DOC$
* $FUNCNAME$
* CHARREPL()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Replacement of characters
* $SYNTAX$
* CHARREPL (<cSearchString>, <[@]cString>,
* <cReplaceString>, [<lMode>]) -> cString
* $ARGUMENTS$
* <cSearchString> is a string of characters that should be replaced
* <[@]cString> is the processed string
* <cReplaceString> is a string of characters that replace the one
* of <cSearchString>
* [<lMode>] sets the replacement method (see description)
* Default: .F.
* $RETURNS$
* <cString> the processed string
* $DESCRIPTION$
* The CHARREPL() function replaces certain characters in <cString>
* with others depending on the setting of <lMode>.
* If <lMode> is set to .F., the function takes the characters of
* <cSearchString> one after the other, searches for them in <cString>
* and, if successful, replaces them with the corresponding character
* of <cReplaceString>. Be aware that if the same characters occur
* in both <cSearchString> and <cReplaceString>, the character on a
* certain position in <cString> can be replaced multiple times.
* if <lMode> is set to .T., the function takes the characters in <cString>
* one after the other, searches for them in <cSearchString> and, if
* successful, replaces them with the corresponding character of
* <cReplaceString>. Note that no multiple replacements are possible
* in this mode.
* If <cReplaceString> is shorter than <cSearchString>, the last
* character of <cReplaceString> is used as corresponding character
* for the the "rest" of <cSearchString>.
* One can omit the return value by setting the CSETREF() switch to .T.,
* but then one must pass <cString> by reference to get the result.
* $EXAMPLES$
* ? charrepl ("1234", "1x2y3z", "abcd") // "axbycz"
* ? charrepl ("abcdefghij", "jhfdb", "1234567890") // "08642"
* ? charrepl ("abcdefghij", "jhfdb", "12345") // "55542"
* ? charrepl ("1234", "1234", "234A") // "AAAA"
* ? charrepl ("1234", "1234", "234A", .T.) // "234A"
* $TESTS$
* charrepl ("1234", "1x2y3z", "abcd") == "axbycz"
* charrepl ("abcdefghij", "jhfdb", "1234567890") == "08642"
* charrepl ("abcdefghij", "jhfdb", "12345") == "55542"
* charrepl ("1234", "1234", "234A") == "AAAA"
* charrepl ("1234", "1234", "234A", .T.) == "234A"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARREPL() is compatible with CT3's CHARREPL().
* $PLATFORMS$
* All
* $FILES$
* Source is charrepl.c, library is ct3.
* $SEEALSO$
* WORDREPL() POSREPL() RANGEREPL()
* CSETREF()
* $END$
*/
HB_FUNC( CHARREPL )
{
int iNoRet;

View File

@@ -91,88 +91,6 @@ _hb_do_sortdescend( const void *p1, const void *p2 )
return -strncmp( pc1, pc2, s_sCompareLen );
}
/* $DOC$
* $FUNCNAME$
* CHARSORT()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Sort sequences within a string.
* $SYNTAX$
* CHARSORT (<[@]cString>, [<nElementLength>], [<nCompareLength>],
* [<nIgnoreCharacters>], [<nElemenOffset>], [<nSortLength>],
* [<lDescending>]) -> cSortedString
* $ARGUMENTS$
* <[@]cString> is the string that should be processed
* [<nElementLength>] specifies the length of the elements that
* should be sorted
* Default: 1
* [<nCompareLength>] specifies how many characters within one
* element should be used for comparison
* Default: <nElementLength>
* [<nIgnoreCharacters>] specifies the number of characters at the
* beginning of <cString> that should be ignored
* in the sort process
* Default: 0
* [<nElementOffset>] specifies the offset of the comparison string
* within a element
* Default: 0
* [<nSortLength>] specifies how many characters in <cString>,
* starting from the <nIgnoreCharacters> position,
* should be sorted
* Default: len(cString)-nIgnoreCharacters
* [<lDescending>]) specifies whether the process should
* sort descending or not
* $RETURNS$
* <cSortedString> the string resulting from the sort process
* $DESCRIPTION$
* The CHARSORT function sorts the characters within a string <cString>.
* With the parameters <nIgnoreCharacters> and <nSortLength>, you can
* determine that only the substring from position <nIgnoreCharacters>+1
* to position <nIgnoreCharacters>+<nSortLength> within <cString> should
* be sorted.
* The sorting algorithm is determined with the other parameters.
* <nElementLength> specifies the length of one element, i.e. there are
* <nSortLength>/<nElementLength> elements that are sorted. Note that
* surplus characters are not sorted but stay at their position.
* To do the sorting, the function uses the Quicksort algorithm implemented
* in the C-lib qsort() function. This algorithm needs to know how to compare
* and order two elements. This is done by comparing the ASCII values of
* a substring within each element. This substring is determined by the
* parameters <nElementOffset> and <nCompareLength> and the order
* by <lDescending>.
* By setting the CSETREF() switch to .T., one can omit the return value
* of the function, but one must then pass <cString> by reference.
* $EXAMPLES$
* ? CHARSORT("qwert") // "eqrtw"
* ? CHARSORT("qwert", 2) // "erqwt"
* ? CHARSORT("b1a4a3a2a1", 2, 1) // "a2a1a3a4b1"
* ? CHARSORT("XXXqwert", 1, 1, 3) // "XXXeqrtw"
* ? CHARSORT("b1a4a3a2a1", 2, 1, 0, 1) // "a1b1a2a3a4"
* ? CHARSORT("384172852", 1, 1, 0, 0, 4) // "134872852"
* ? CHARSORT("qwert", .T.) // "wtrqe"
* $TESTS$
* CHARSORT("qwert") == "eqrtw"
* CHARSORT("qwert", 2) == "erqwt"
* CHARSORT("b1a4a3a2a1", 2, 1) == "a2a1a3a4b1"
* CHARSORT("XXXqwert", 1, 1, 3) == "XXXeqrtw"
* CHARSORT("b1a4a3a2a1", 2, 1, 0, 1) == "a1b1a2a3a4"
* CHARSORT("384172852", 1, 1, 0, 0, 4) == "134872852"
* CHARSORT("qwert", .T.) == "wtrqe"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARSORT() is compatible with CT3's CHARSORT().
* $PLATFORMS$
* All
* $FILES$
* Source is charsort.c, library is ct3.
* $SEEALSO$
* CSETREF()
* $END$
*/
HB_FUNC( CHARSORT )
{
int iNoRet;

View File

@@ -54,10 +54,8 @@
*
*/
#include "ct.h"
/* defines */
#define DO_CHARSWAP_CHARSWAP 0
#define DO_CHARSWAP_WORDSWAP 1
@@ -185,95 +183,11 @@ static void do_charswap( int iSwitch )
}
}
/* $DOC$
* $FUNCNAME$
* CHARSWAP()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Swap neighbouring characters in a string
* $SYNTAX$
* CHARSWAP (<[@]cString>) -> cSwappedString
* $ARGUMENTS$
* <[@]cString> is the string that should be processed
* $RETURNS$
* <cSwappedString> a string where neighbour characters are swapped
* $DESCRIPTION$
* The CHARSWAP() function loops through <cString> in steps of two
* characters and exchanges the characters from the odd and the even
* positions.
* By setting the CSETREF() switch to .T., one can omit the return value
* of this functin, but one must then pass <cString> by reference.
* $EXAMPLES$
* ? CHARSWAP("0123456789") // "1032547698"
* ? CHARSWAP("ABCDEFGHIJK") // "BADCFEHGJIK"
* $TESTS$
* CHARSWAP("0123456789") == "1032547698"
* CHARSWAP("ABCDEFGHIJK") == "BADCFEHGJIK"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARSWAP() is compatible with CT3's CHARSWAP().
* $PLATFORMS$
* All
* $FILES$
* Source is charswap.c, library is libct.
* $SEEALSO$
* WORDSWAP(),CSETREF()
* $END$
*/
HB_FUNC( CHARSWAP )
{
do_charswap( DO_CHARSWAP_CHARSWAP );
}
/* $DOC$
* $FUNCNAME$
* WORDSWAP()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Swap neighbouring double characters in a string
* $SYNTAX$
* WORDSWAP (<[@]cString> [, <lSwapCharacters>]) -> cSwappedString
* $ARGUMENTS$
* <[@]cString> is the string that should be processed
* [<lSwapCharacters>] specifies whether an additional swap should be
* done within the double characters
* Default: .F., no additional swap
* $RETURNS$
* <cSwappedString> a string where neighbouring double characters are
* swapped
* $DESCRIPTION$
* The WORDSWAP() function loops through <cString> in steps of four
* characters and exchanges the double characters from the first and
* second position with the one from the third and forth position.
* Additionally the function can perform a swap of the both char of
* each double character.
* By setting the CSETREF() switch to .T., one can omit the return value
* of this functin, but one must then pass <cString> by reference.
* $EXAMPLES$
* ? WORDSWAP("1234567890") // "3412785690"
* ? WORDSWAP("1234567890", .t.) // "4321876590"
* $TESTS$
* WORDSWAP("1234567890") == "3412785690"
* WORDSWAP("1234567890", .t.) == "4321876590"
* $STATUS$
* Ready
* $COMPLIANCE$
* WORDSWAP() is compatible with CT3's WORDSWAP().
* $PLATFORMS$
* All
* $FILES$
* Source is charswap.c, library is libct.
* $SEEALSO$
* CHARSWAP(),CSETREF()
* $END$
*/
HB_FUNC( WORDSWAP )
{
do_charswap( DO_CHARSWAP_WORDSWAP );

View File

@@ -55,33 +55,6 @@
#include "hbapi.h"
#include "hbapigt.h"
/* $DOC$
* $FUNCNAME$
* INVERTATTR()
* $CATEGORY$
* CT3 video functions
* $ONELINER$
*
* $SYNTAX$
*
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* INVERTATTR() is compatible with CT3's INVERTATTR().
* $PLATFORMS$
* All
* $FILES$
* Source is color.c, library is libct.
* $SEEALSO$
* $END$
*/
HB_FUNC( INVERTATTR )
{
int iAttr;
@@ -100,45 +73,6 @@ HB_FUNC( INVERTATTR )
( ( iAttr >> 4 ) & 0x07 ) );
}
/* $DOC$
* $FUNCNAME$
* COLORTON()
* $CATEGORY$
* CT3 video functions
* $ONELINER$
* $SYNTAX$
* COLORTON ( <cAttr> ) -> <nAttr>
* $ARGUMENTS$
* <cAttr> Designates the alphanumeric color attribute that is
* converted in NN/NN or CC/CC form.
*
* $RETURNS$
* COLORTON() returns a number that corresponds to the combined numeric
* color attribute.
*
* $DESCRIPTION$
* COLOR TO (N)umeric
* The function changes an alphanumeric color attribute from NN/NN or
* CC/CC into a combined numeric attribute. These combined attribute
* values are useful with the CA-Cl*pper Tools functions STRSCREEN(),
* SCREENMIX(), SCREENATTR(), and the CA-Cl*pper commands
* SAVE/RESTORE SCREEN.
*
* TODO: add documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* $PLATFORMS$
* All
* $FILES$
* Source is color.c, library is libct.
* $SEEALSO$
* $END$
*/
HB_FUNC( COLORTON )
{
if( HB_ISCHAR( 1 ) )
@@ -150,47 +84,6 @@ HB_FUNC( COLORTON )
hb_retni( hb_parni( 1 ) );
}
/* $DOC$
* $FUNCNAME$
* NTOCOLOR()
* $CATEGORY$
* HBCT video functions
* $ONELINER$
* $SYNTAX$
* NTOCOLOR ( <nAttr>, [<lColorCode>] ) -> <cAttr>
* $ARGUMENTS$
* <nAttr> Designates the value for the combined numeric color
* attributes.
*
* <lColorCode> If designated as .F. or if the parameter is omitted,
* NTOCOLOR() returns a string with a numeric color code.
* When designated as .T., NTOCOLOR() returns a string with
* the CA-Cl*pper alpha color coding.
*
* $RETURNS$
* NTOCOLOR() returns the designated color attribute in the NN/NN
* or CC/CC form.
*
* $DESCRIPTION$
* NTOCOLOR() converts a color attribute returned from another function
* in numeric form, into the alphanumeric data format. Use this
* attribute in conjunction with the CA-Cl*pper SET COLOR TO command.
*
* TODO: add documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* $PLATFORMS$
* All
* $FILES$
* Source is color.c, library is libct.
* $SEEALSO$
* $END$
*/
HB_FUNC( NTOCOLOR )
{
char szColorString[ 10 ];
@@ -208,105 +101,18 @@ HB_FUNC( NTOCOLOR )
hb_retc_null();
}
/* $DOC$
* $FUNCNAME$
* ENHANCED()
* $CATEGORY$
* CT3 video functions
* $ONELINER$
* Select the "ENHANCED" color value for output
* $SYNTAX$
* ENHANCED () -> <cEmptyString>
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* ENHANCED() is compatible with CT3's ENHANCED()
* $PLATFORMS$
* All
* $FILES$
* Source is color.c, library is libct.
* $SEEALSO$
* STANDARD(),UNSELECTED()
* $END$
*/
HB_FUNC( ENHANCED )
{
hb_gtColorSelect( HB_CLR_ENHANCED );
hb_retc_null();
}
/* $DOC$
* $FUNCNAME$
* STANDARD()
* $CATEGORY$
* CT3 video functions
* $ONELINER$
* Select the "STANDARD" color value for output
* $SYNTAX$
* STANDARD () -> <cEmptyString>
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* STANDARD() is compatible with CT3's STANDARD()
* $PLATFORMS$
* All
* $FILES$
* Source is color.c, library is libct.
* $SEEALSO$
* ENHANCED(),UNSELECTED()
* $END$
*/
HB_FUNC( STANDARD )
{
hb_gtColorSelect( HB_CLR_STANDARD );
hb_retc_null();
}
/* $DOC$
* $FUNCNAME$
* UNSELECTED()
* $CATEGORY$
* CT3 video functions
* $ONELINER$
* Select the "UNSELECTED" color value for output
* $SYNTAX$
* UNSELECTED () -> <cEmptyString>
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* UNSELECTED() is compatible with CT3's UNSELECTED()
* $PLATFORMS$
* All
* $FILES$
* Source is color.c, library is libct.
* $SEEALSO$
* ENHANCED(),STANDARD()
* $END$
*/
HB_FUNC( UNSELECTED )
{
hb_gtColorSelect( HB_CLR_UNSELECTED );

View File

@@ -123,69 +123,11 @@ static void do_count( int iSwitch )
}
}
/* $DOC$
* $FUNCNAME$
* COUNTLEFT()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Count a certain character at the beginning of a string
* $SYNTAX$
* COUNTLEFT (<cString>, [<cSearch|nSearch>]) -> nCount
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* COUNTLEFT() is compatible with CT3's COUNTLEFT().
* $PLATFORMS$
* All
* $FILES$
* Source is count.c, library is libct.
* $SEEALSO$
* COUNTRIGHT()
* $END$
*/
HB_FUNC( COUNTLEFT )
{
do_count( DO_COUNT_COUNTLEFT );
}
/* $DOC$
* $FUNCNAME$
* COUNTRIGHT()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Count a certain character at the end of a string
* $SYNTAX$
* COUNTRIGHT (<cString>, [<cSearch|nSearch>]) -> nCount
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* COUNTRIGHT() is compatible with CT3's COUNTRIGHT().
* $PLATFORMS$
* All
* $FILES$
* Source is count.c, library is libct.
* $SEEALSO$
* COUNTLEFT()
* $END$
*/
HB_FUNC( COUNTRIGHT )
{
do_count( DO_COUNT_COUNTRIGHT );

View File

@@ -54,40 +54,6 @@
STATIC s_bInitialized := .F.
/* $DOC$
* $FUNCNAME$
* CTINIT()
* $CATEGORY$
* CT3 general functions
* $ONELINER$
* Initializes the CT3 library
* $SYNTAX$
* CTINIT () -> lInitialized
* $ARGUMENTS$
* None
* $RETURNS$
* lInitialized .T. if the function has been correctly initialized
* $DESCRIPTION$
* The CTINIT() function initializes the CT3 library.
* Identical code is declared as INIT FUNCTION, thus should be executed
* automatically at the beginning of the application, but it is a good
* idea to call it once again explicitly somewhere at the beginning of
* your program to check the initialization.
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Ready
* $COMPLIANCE$
* CTINIT() is a new function in Harbour's CT3 library.
* $PLATFORMS$
* All
* $FILES$
* Source is ct.prg, library is libct.
* $SEEALSO$
* $END$
*/
FUNCTION CTINIT()
IF ! s_bInitialized
@@ -104,40 +70,6 @@ INIT PROCEDURE _CTINIT()
RETURN
/* $DOC$
* $FUNCNAME$
* CTEXIT()
* $CATEGORY$
* CT3 general functions
* $ONELINER$
* Uninitializes the CT3 library
* $SYNTAX$
* CTEXIT () -> nil
* $ARGUMENTS$
* none
* $RETURNS$
* nil
* $DESCRIPTION$
* The CTEXIT() function uninitializes the CT3 library.
* Identical code is declared as EXIT FUNCTION, thus should be executed
* automatically at the end of the application, but it is a good idea
* to call it explicitly somewhere at the end of your program to make
* sure that the deinitialization takes place.
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Ready
* $COMPLIANCE$
* CTEXIT() is a new function in Harbour's CT3 library.
* $PLATFORMS$
* All
* $FILES$
* Source is ct.prg, library is libct.
* $SEEALSO$
* $END$
*/
FUNCTION CTEXIT()
IF s_bInitialized

View File

@@ -52,7 +52,6 @@
*
*/
#include "ct.h"
#include "ctmath.h"
#include "hbvm.h"
@@ -125,7 +124,6 @@ HB_USHORT ct_error( HB_USHORT uiSeverity, HB_ERRCODE errGenCode, HB_ERRCODE errS
return uiAction;
}
/* throwing a CT-subsystem error with value substitution
- function adapted from errorapi.c */
PHB_ITEM ct_error_subst( HB_USHORT uiSeverity, HB_ERRCODE errGenCode, HB_ERRCODE errSubCode,
@@ -191,7 +189,6 @@ PHB_ITEM ct_error_subst( HB_USHORT uiSeverity, HB_ERRCODE errGenCode, HB_ERRCODE
return pRetVal;
}
/* argument error behaviour */
static int s_iArgErrMode = CT_ARGERR_IGNORE;
@@ -207,46 +204,6 @@ int ct_getargerrormode( void )
return s_iArgErrMode;
}
/* $DOC$
* $FUNCNAME$
* CSETARGERR()
* $CATEGORY$
* CT3 general functions
* $ONELINER$
* Sets argument error behaviour
* $SYNTAX$
* CSETARGERR ([<nNewMode>]) -> <nOldMode>
* $ARGUMENTS$
* [<nNewMode>] New argument error throwing mode
* $RETURNS$
* <nOldMode> The current or old argument error throwing mode.
* $DESCRIPTION$
* All CT3 functions are very compliant in their reaction to wrong
* parameters. By using the CSETARGERR() function, you can make the
* library throw an error with the severity <nNewMode>. It is then
* up to the error handler to substitute the return value.
* <nNewMode> can be one of the severity modes defined in ct.ch:
* CT_ARGERR_WHOCARES corresponds to ES_WHOCARES
* CT_ARGERR_WARNING corresponds to ES_WARNING
* CT_ARGERR_ERROR corresponds to ES_ERROR
* CT_ARGERR_CATASTROPHIC corresponds to ES_CATASTROPHIC
* CT_ARGERR_IGNORE
* The last is the default behaviour and switches any argument error
* throwing off.
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Ready
* $COMPLIANCE$
* CSETARGERR() is a new function in Harbour's CT3 library.
* $PLATFORMS$
* All
* $FILES$
* Source is ct.c, library is libct.
* $SEEALSO$
* $END$
*/
HB_FUNC( CSETARGERR )
{
hb_retni( ct_getargerrormode() );
@@ -286,41 +243,9 @@ HB_FUNC( CSETARGERR )
}
}
/* initialization */
static int s_initialized = 0; /* TODO: make this thread safe */
/* $DOC$
* $FUNCNAME$
* CTCINIT()
* $CATEGORY$
* CT3 general functions
* $ONELINER$
* Initializes the CT3 library, C part
* $SYNTAX$
* CTCINIT () -> lInitialized
* $ARGUMENTS$
* None
* $RETURNS$
* lInitialized .T. if the function has been correctly initialized
* $DESCRIPTION$
* The CTCINIT() function initializes the C source part of the CT3
* library. Do not call this function directly.
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Ready
* $COMPLIANCE$
* CTCINIT() is a new function in Harbour's CT3 library.
* $PLATFORMS$
* All
* $FILES$
* Source is ctc.c, library is libct.
* $SEEALSO$
* CTINIT(),CTEXIT()
* $END$
*/
HB_FUNC( CTCINIT )
{
if( s_initialized == 0 )
@@ -334,38 +259,6 @@ HB_FUNC( CTCINIT )
hb_retl( s_initialized );
}
/* $DOC$
* $FUNCNAME$
* CTCEXIT()
* $CATEGORY$
* CT3 general functions
* $ONELINER$
* Uninitializes the CT3 library, C part
* $SYNTAX$
* CTCEXIT () -> nil
* $ARGUMENTS$
* none
* $RETURNS$
* nil
* $DESCRIPTION$
* The CTCEXIT() function uninitializes the C part of the CT3 library.
* Do not call this function directly.
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Ready
* $COMPLIANCE$
* CTCEXIT() is a new function in Harbour's CT3 library.
* $PLATFORMS$
* All
* $FILES$
* Source is ctc.c, library is libct.
* $SEEALSO$
* CTINIT(),CTEXIT()
* $END$
*/
HB_FUNC( CTCEXIT )
{
ct_str_exit();

View File

@@ -367,7 +367,6 @@ HB_FUNC( COM_SKEY )
hb_retl( HB_FALSE );
}
/* COM_INIT( <nComPort>, [<nBaudRate>=300], [<cParity:E,O,M,S,N>=N],
* [<nDataLength:7,8>=8], [<nStopBits:1,2>=1] ) -> <lInitialized>
*/
@@ -482,7 +481,6 @@ HB_FUNC( COM_NUM )
hb_retni( hb_comLastNum() );
}
/* COM_GETIO( <nComPort> ) -> <nIOPort> | -1
*/
HB_FUNC( COM_GETIO )

View File

@@ -56,7 +56,6 @@
#include "hbapigt.h"
#include "hbchksum.h"
/* COM_DOSCON( <cString>, [<nLine>], [<nColumn>] ) -> <cNull>
*/
HB_FUNC( COM_DOSCON )

View File

@@ -87,37 +87,6 @@ int ct_getprecision( void )
return s_ct_precision;
}
/* $DOC$
* $FUNCNAME$
* SETPREC()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Set precision of math functions
* $SYNTAX$
* SETPREC (<nPrecision>) -> cEmptyString
* $ARGUMENTS$
* <nPrecision> digit count between 1 and 16, defaults to 16
* $RETURNS$
* cEmptyString this function always returns an empty string
* $DESCRIPTION$
* Be aware that calls to this functions do _NOT_ affect the
* calculation precision of the math functions at the moment.
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Ready
* $COMPLIANCE$
* SETPREC() is compatible with CT3's SETPREC.
* $PLATFORMS$
* All
* $FILES$
* Source is ctmath.c, library is ct3.
* $SEEALSO$
* $END$
*/
HB_FUNC( SETPREC )
{
int iPrec = hb_parni( 1 );
@@ -135,36 +104,6 @@ HB_FUNC( SETPREC )
hb_retc_null();
}
/* $DOC$
* $FUNCNAME$
* GETPREC()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Get precision of math functions
* $SYNTAX$
* GETPREC () -> nDigits
* $ARGUMENTS$
* $RETURNS$
* nDigits digit count between 1 and 16
* $DESCRIPTION$
* Be aware that calls to this functions do _NOT_ affect the
* calculation precision of the math functions at the moment.
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Ready
* $COMPLIANCE$
* GETPREC() is compatible with CT3's GETPREC.
* $PLATFORMS$
* All
* $FILES$
* Source is ctmath.c, library is ct3.
* $SEEALSO$
* $END$
*/
HB_FUNC( GETPREC )
{
hb_retni( ct_getprecision() );

View File

@@ -62,47 +62,10 @@
*
*/
#include "ct.h"
#include "ctmath.h"
#include "hbmather.h"
/* $DOC$
* $FUNCNAME$
* FLOOR()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Rounds down a number to the next integer
* $SYNTAX$
* FLOOR (nNumber) -> nDownRoundedNumber
* $ARGUMENTS$
* <nNumber> number to round down
* $RETURNS$
* <nDownRoundedNumber> the rounded number
* $DESCRIPTION$
* The function FLOOR() determines the biggest integer that is smaller
* than <nNumber>.
* $EXAMPLES$
* ? floor (1.1) --> 1.0
* ? floor (-1.1) --> -2.0
* $TESTS$
* floor (1.1) == 1.0
* floor (-1.1) == -2.0
* $STATUS$
* Ready
* $COMPLIANCE$
* FLOOR() is compatible with CT3's FLOOR().
* $PLATFORMS$
* All
* $FILES$
* Source is math.c, library is libct.
* $SEEALSO$
* CEILING
* $END$
*/
HB_FUNC( FLOOR )
{
if( HB_ISNUM( 1 ) )
@@ -140,42 +103,6 @@ HB_FUNC( FLOOR )
}
}
/* $DOC$
* $FUNCNAME$
* CEILING()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Rounds up a number to the next integer
* $SYNTAX$
* CEILING (nNumber) -> nUpRoundedNumber
* $ARGUMENTS$
* <nNumber> number to round up
* $RETURNS$
* <nUpRoundedNumber> the rounded number
* $DESCRIPTION$
* The function CEILING() determines the smallest integer that is bigger
* than <nNumber>.
* $EXAMPLES$
* ? ceiling (1.1) --> 2.0
* ? ceiling (-1.1) --> -1.0
* $TESTS$
* ceiling (1.1) == 2.0
* ceiling (-1.1) == -1.0
* $STATUS$
* Ready
* $COMPLIANCE$
* CEILING() is compatible with CT3's CEILING().
* $PLATFORMS$
* All
* $FILES$
* Source is math.c, library is libct.
* $SEEALSO$
* FLOOR
* $END$
*/
HB_FUNC( CEILING )
{
if( HB_ISNUM( 1 ) )
@@ -213,45 +140,6 @@ HB_FUNC( CEILING )
}
}
/* $DOC$
* $FUNCNAME$
* SIGN()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Sign of a number
* $SYNTAX$
* SIGN (nNumber) -> nSign
* $ARGUMENTS$
* <nNumber> a number
* $RETURNS$
* <nSign> sign of <nNumber>
* $DESCRIPTION$
* The function SIGN() determines the sign of <nNumber>.
* If <nNumber> is > 0, then SIGN(<nNumber>) returns 1
* If <nNumber> is < 0, then SIGN(<nNumber>) returns -1
* If <nNumber> is == 0, then SIGN(<nNumber>) returns 0
* $EXAMPLES$
* ? sign (1.1) --> 1
* ? sign (-1.1) --> -1
* ? sign (0.0) --> 0
* $TESTS$
* sign (1.1) == 1
* sign (-1.1) == -1
* sign (0.0) == 0
* $STATUS$
* Ready
* $COMPLIANCE$
* SIGN() is compatible with CT3's SIGN().
* $PLATFORMS$
* All
* $FILES$
* Source is math.c, library is libct.
* $SEEALSO$
* $END$
*/
HB_FUNC( SIGN )
{
if( HB_ISNUM( 1 ) )
@@ -288,41 +176,6 @@ HB_FUNC( SIGN )
}
}
/* $DOC$
* $FUNCNAME$
* LOG10()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Decadic logarithm of a number
* $SYNTAX$
* LOG10 (nNumber) -> nLogarithm
* $ARGUMENTS$
* <nNumber> number to logarithm
* $RETURNS$
* <nLogarithm> decadic logarithm of <nNumber>
* $DESCRIPTION$
* The function LOG10() calculates the decadic logarithm of <nNumber>,
* i.e. 10^<nLogarithm> == <nNumber>.
* $EXAMPLES$
* ? log10 (10.0) --> 1.0
* ? log10 (sqrt(10.0)) --> 0.5
* $TESTS$
* log10 (10.0) == 1.0
* log10 (sqrt(10.0)) == 0.5
* $STATUS$
* Ready
* $COMPLIANCE$
* LOG10() is compatible with CT3's LOG10().
* $PLATFORMS$
* All
* $FILES$
* Source is math.c, library is libct.
* $SEEALSO$
* $END$
*/
HB_FUNC( LOG10 )
{
if( HB_ISNUM( 1 ) )
@@ -373,45 +226,6 @@ HB_FUNC( LOG10 )
}
}
/* $DOC$
* $FUNCNAME$
* FACT()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Calculates faculty
* $SYNTAX$
* FACT (nNumber) -> nFaculty
* $ARGUMENTS$
* <nNumber> number between 0 and 21
* $RETURNS$
* <nFaculty> the faculty of <nNumber>
* $DESCRIPTION$
* The function FACT() calculates the faculty to the integer given in
* <nNumber>. The faculty is defined as n! = 1*2*...*n and is often
* used in statistics. Note, that faculties above 21 are too big
* so that the function must return a -1.
* $EXAMPLES$
* ? fact (0) --> 1
* ? fact (1) --> 1
* ? fact (4) --> 24
* $TESTS$
* fact (0) == 1
* fact (1) == 1
* fact (4) == 24
* $STATUS$
* Ready
* $COMPLIANCE$
* FACT() is compatible with CT3's FACT().
* $PLATFORMS$
* All
* $FILES$
* Source is math.c, library is libct.
* $SEEALSO$
* $END$
*/
HB_FUNC( FACT )
{
if( HB_ISNUM( 1 ) )

View File

@@ -129,7 +129,6 @@ HB_FUNC( NETCANCEL )
#endif
}
HB_FUNC( NETPRINTER )
{
#if defined( HB_OS_WIN ) && ! defined( HB_OS_WIN_CE )
@@ -143,7 +142,6 @@ HB_FUNC( NETPRINTER )
#endif
}
HB_FUNC( NETDISK )
{
#if defined( HB_OS_WIN ) && ! defined( HB_OS_WIN_CE )
@@ -224,7 +222,6 @@ HB_FUNC( NETWORK )
#endif
}
HB_FUNC( NNETWORK )
{
#if defined( HB_OS_WIN ) && ! defined( HB_OS_WIN_CE )

View File

@@ -144,69 +144,11 @@ static void do_pad( int iSwitch )
}
}
/* $DOC$
* $FUNCNAME$
* PADLEFT()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Fills string to a certain length on the left
* $SYNTAX$
* PADLEFT (<cString>,<nLength>, [<cChar|nChar>]) -> cString
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* PADLEFT() is compatible with CT3's PADLEFT().
* $PLATFORMS$
* All
* $FILES$
* Source is pad.c, library is libct.
* $SEEALSO$
* PADRIGHT()
* $END$
*/
HB_FUNC( PADLEFT )
{
do_pad( DO_PAD_PADLEFT );
}
/* $DOC$
* $FUNCNAME$
* PADRIGHT()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Fills string to a certain length on the right
* $SYNTAX$
* PADRIGHT (<cString>,<nLength>, [<cChar|nChar>]) -> cString
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* PADRIGHT() is compatible with CT3's PADRIGHT().
* $PLATFORMS$
* All
* $FILES$
* Source is pad.c, library is libct.
* $SEEALSO$
* PADLEFT()
* $END$
*/
HB_FUNC( PADRIGHT )
{
do_pad( DO_PAD_PADRIGHT );

View File

@@ -53,5 +53,4 @@
*
*/
#include "ct.h"

View File

@@ -52,10 +52,8 @@
*
*/
#include "ct.h"
/* -------------- */
/* initialization */
/* -------------- */
@@ -71,7 +69,6 @@ int ct_str_exit( void )
return 1;
}
/* -------------------------- */
/* search for exact substring */
/* -------------------------- */
@@ -101,7 +98,6 @@ const char *ct_at_exact_forward( const char * pcString, HB_SIZE sStrLen,
}
/* ------------------------------------------------ */
/* search for exact substring in backward direction */
/* ------------------------------------------------ */
@@ -135,7 +131,6 @@ const char *ct_at_exact_backward( const char * pcString, HB_SIZE sStrLen,
return NULL;
}
/* ----------------------------------- */
/* search for substring using wildcard */
/* ----------------------------------- */
@@ -174,7 +169,6 @@ const char *ct_at_wildcard_forward( const char * pcString, HB_SIZE sStrLen,
return NULL;
}
/* --------------------------------------------------------- */
/* search for substring using wildcard in backward direction */
/* --------------------------------------------------------- */
@@ -213,7 +207,6 @@ const char *ct_at_wildcard_backward( const char * pcString, HB_SIZE sStrLen,
return NULL;
}
/* ------------------------------- */
/* search for character from a set */
/* ------------------------------- */
@@ -247,7 +240,6 @@ const char *ct_at_charset_forward( const char * pcString, HB_SIZE sStrLen,
return NULL;
}
/* ----------------------------------------------------- */
/* search for character from a set in backward direction */
/* ----------------------------------------------------- */
@@ -280,7 +272,6 @@ const char *ct_at_charset_backward( const char * pcString, HB_SIZE sStrLen,
return NULL;
}
/*
* CSETREF() stuff
*/
@@ -293,74 +284,12 @@ void ct_setref( int iNewSwitch )
siRefSwitch = iNewSwitch;
}
int ct_getref( void )
{
HB_TRACE( HB_TR_DEBUG, ( "ct_getref()" ) );
return siRefSwitch;
}
/* $DOC$
* $FUNCNAME$
* CSETREF()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Determine return value of reference sensitive CT3 string functions
* $SYNTAX$
* CSETREF ([<lNewSwitch>]) -> lOldSwitch
* $ARGUMENTS$
* [<lNewSwitch>] .T. -> suppress return value
* .F. -> do not suppress return value
* $RETURNS$
* lOldSwitch old (if lNewSwitch is a logical value) or
* current state of the switch
* $DESCRIPTION$
* Within the CT3 functions, the following functions do not
* change the length of a string passed as parameter while
* transforming this string:
*
* ADDASCII() BLANK() CHARADD()
* CHARAND() CHARMIRR() CHARNOT()
* CHAROR() CHARRELREP() CHARREPL()
* CHARSORT() CHARSWAP() CHARXOR()
* CRYPT() JUSTLEFT() JUSTRIGHT()
* POSCHAR() POSREPL() RANGEREPL()
* REPLALL() REPLLEFT() REPLRIGHT()
* TOKENLOWER() TOKENUPPER() WORDREPL()
* WORDSWAP()
*
* Thus, these functions allow to pass the string by reference [@] to
* the function so that it may not be necessary to return the transformed
* string. By calling CSETREF (.T.), the above mentioned functions return
* the value .F. instead of the transformed string if the string is
* passed by reference to the function.
* The switch is turned off (.F.) by default.
*
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Ready
* $COMPLIANCE$
* This function is fully CT3 compatible.
* $PLATFORMS$
* All
* $FILES$
* Source is ctstr.c, library is ct3.
* $SEEALSO$
* ADDASCII() BLANK() CHARADD()
* CHARAND() CHARMIRR() CHARNOT()
* CHAROR() CHARRELREP() CHARREPL()
* CHARSORT() CHARSWAP() CHARXOR()
* CRYPT() JUSTLEFT() JUSTRIGHT()
* POSCHAR() POSREPL() RANGEREPL()
* REPLALL() REPLLEFT() REPLRIGHT()
* TOKENLOWER() TOKENUPPER() WORDREPL()
* WORDSWAP()
* $END$
*/
HB_FUNC( CSETREF )
{
hb_retl( ct_getref() );
@@ -381,7 +310,6 @@ HB_FUNC( CSETREF )
}
}
/*
* CSETATMUPA() stuff
*/
@@ -394,57 +322,12 @@ void ct_setatmupa( int iNewSwitch )
siAtMupaSwitch = iNewSwitch;
}
int ct_getatmupa( void )
{
HB_TRACE( HB_TR_DEBUG, ( "ct_getatmupa()" ) );
return siAtMupaSwitch;
}
/* $DOC$
* $FUNCNAME$
* CSETATMUPA()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Determine "multi-pass" behaviour in some string functions
* $SYNTAX$
* CSETATMUPA ([<lNewSwitch>]) -> lOldSwitch
* $ARGUMENTS$
* [<lNewSwitch>] .T. -> turn "multi-pass" on
* .F. -> turn "multi-pass" off
* $RETURNS$
* lOldSwitch old (if lNewSwitch is a logical value) or
* current state of the switch
* $DESCRIPTION$
* CSETATMUPA determines how the following CT3 string functions
*
* ATNUM() AFTERATNUM() BEFORATNUM()
* ATREPL() NUMAT() ATADJUST()
* WORDTOCHAR() WORDREPL()
*
* perform their work. See the respective function documentation for a
* further description how the switch influences these functions.
*
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Ready
* $COMPLIANCE$
* This function is fully CT3 compatible.
* $PLATFORMS$
* All
* $FILES$
* Source is ctstr.c, library is ct3.
* $SEEALSO$
* ATNUM() AFTERATNUM() BEFORATNUM()
* ATREPL() NUMAT() ATADJUST()
* WORDTOCHAR() WORDREPL()
* $END$
*/
HB_FUNC( CSETATMUPA )
{
hb_retl( ct_getatmupa() );
@@ -465,7 +348,6 @@ HB_FUNC( CSETATMUPA )
}
}
/*
* SETATLIKE() stuff
*/
@@ -479,87 +361,24 @@ void ct_setatlike( int iNewMode )
siAtLikeMode = iNewMode;
}
int ct_getatlike( void )
{
HB_TRACE( HB_TR_DEBUG, ( "ct_getatlike()" ) );
return siAtLikeMode;
}
void ct_setatlikechar( char cNewChar )
{
HB_TRACE( HB_TR_DEBUG, ( "ct_setatlikechar(\'%c\')", cNewChar ) );
scAtLikeChar = cNewChar;
}
char ct_getatlikechar( void )
{
HB_TRACE( HB_TR_DEBUG, ( "ct_getatlikechar()" ) );
return scAtLikeChar;
}
/* $DOC$
* $FUNCNAME$
* SETATLIKE()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Determine scan behaviour in some string functions
* $SYNTAX$
* SETATLIKE ([<nMode>] [, <[@]cWildcard>]) --> nOldMode
* $ARGUMENTS$
* [<nMode>] CT_SETATLIKE_EXACT -> characters are compared exactly
* CT_SETATLIKE_WILDCARD -> characters are compared using
* a wildcard character
* The default value is CT_SETATLIKE_EXACT.
* [<[@]cWildcard>] determines the character that is subsequently used
* as a wildcard character for substring scanning.
* The default value is "?".
* NEW: If this parameter is passed by reference [@],
* the current wildcard character is stored in
* <cWildcard>.
* $RETURNS$
* nOldMode old (if nMode is a numeric value) or
* current state of the switch
* $DESCRIPTION$
* In the following CT3 functions, strings are compared on a character
* base:
*
* ATADJUST() ATNUM() AFTERATNUM()
* BEFOREATNUM() ATREPL() NUMAT()
* STRDIFF()
*
* With the SETATLIKE function, one can determine when characters are
* considered to match within these functions. If CT_SETATLIKE_WILDCARD
* is set (e.g. "?"), then "?" matches every other character.
*
* <nMode> can be one of the following values that are defined
* in ct.ch
*
* Definition | Value
* ----------------------|------
* CT_SETATLIKE_EXACT | 0
* CT_SETATLIKE_WILDCARD | 1
*
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Ready
* $COMPLIANCE$
* This function is fully CT3 compatible, but allows to pass the
* second parameter by reference so that the current wildcard character
* can be determined.
* $PLATFORMS$
* All
* $FILES$
* Source is ctstr.c, header is ct.ch, library is ct3.
* $SEEALSO$
* $END$
*/
HB_FUNC( SETATLIKE )
{

View File

@@ -72,7 +72,6 @@ static int hb_ctColorParam( int iParam, int iDefault )
return iColor;
}
HB_FUNC( CTWINIT )
{
hb_retl( hb_ctwInit() );

View File

@@ -1443,7 +1443,6 @@ static void hb_ctw_gt_WriteCon( PHB_GT pGT, const char * pText, HB_SIZE nLength
}
}
static int hb_ctw_gt_GetCursorStyle( PHB_GT pGT )
{
PHB_GTCTW pCTW;

View File

@@ -69,7 +69,6 @@ HB_FUNC( SAVECURSOR )
hb_retnl( ( long ) iCol | ( iRow << 8 ) | ( iCursor << 16 ) );
}
HB_FUNC( RESTCURSOR )
{
long lCursor = hb_parnl( 1 );

View File

@@ -53,7 +53,6 @@
*
*/
/*
* The following parts are Copyright of the individual authors.
* www - http://harbour-project.org
@@ -65,39 +64,10 @@
*
*/
#include "hbapi.h"
#include "hbapiitm.h"
#include "hbdate.h"
/* $DOC$
* $FUNCNAME$
* BOM()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* _B_egin _O_f _M_onth
* $SYNTAX$
* BOM ([<dDate>]) -> dDateBeginOfMonth
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* BOM() is compatible with CT3's BOM().
* $PLATFORMS$
* All
* $FILES$
* Source is datetime.prg, library is libct.
* $SEEALSO$
* EOM(),BOQ(),EOQ(),BOY(),EOY()
* $END$
*/
HB_FUNC( BOM )
{
long lDate;
@@ -124,35 +94,6 @@ HB_FUNC( BOM )
}
}
/* $DOC$
* $FUNCNAME$
* EOM()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* _E_nd _O_f _M_onth
* $SYNTAX$
* EOM ([<dDate>]) -> dDateEndOfMonth
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* EOM() is compatible with CT3's EOM().
* $PLATFORMS$
* All
* $FILES$
* Source is datetime.prg, library is libct.
* $SEEALSO$
* BOM(),BOQ(),EOQ(),BOY(),EOY()
* $END$
*/
HB_FUNC( EOM )
{
long lDate;
@@ -185,35 +126,6 @@ HB_FUNC( EOM )
}
}
/* $DOC$
* $FUNCNAME$
* BOQ()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* _B_egin _O_f _Q_uarter
* $SYNTAX$
* BOQ ([<dDate>]) -> dDateBeginOfQuarter
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* BOQ() is compatible with CT3's BOQ().
* $PLATFORMS$
* All
* $FILES$
* Source is datetime.prg, library is libct.
* $SEEALSO$
* BOM(),EOM(),EOQ(),BOY(),EOY()
* $END$
*/
HB_FUNC( BOQ )
{
long lDate;
@@ -242,35 +154,6 @@ HB_FUNC( BOQ )
}
}
/* $DOC$
* $FUNCNAME$
* EOQ()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* _E_nd _O_f _Q_uarter
* $SYNTAX$
* EOQ ([<dDate>]) -> dDateEndOfQuarter
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* EOQ() is compatible with CT3's EOQ().
* $PLATFORMS$
* All
* $FILES$
* Source is datetime.prg, library is libct.
* $SEEALSO$
* BOM(),EOM(),BOQ(),BOY(),EOY()
* $END$
*/
HB_FUNC( EOQ )
{
long lDate;
@@ -304,35 +187,6 @@ HB_FUNC( EOQ )
}
}
/* $DOC$
* $FUNCNAME$
* BOY()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* _B_egin _O_f _Y_ear
* $SYNTAX$
* BOY ([<dDate>]) -> dDateBeginOfYear
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* BOY() is compatible with CT3's BOY().
* $PLATFORMS$
* All
* $FILES$
* Source is datetime.prg, library is libct.
* $SEEALSO$
* BOM(),EOM(),BOQ(),EOQ(),EOY()
* $END$
*/
HB_FUNC( BOY )
{
long lDate;
@@ -359,35 +213,6 @@ HB_FUNC( BOY )
}
}
/* $DOC$
* $FUNCNAME$
* EOY()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* _E_nd _O_f _Y_ear
* $SYNTAX$
* EOY ([<dDate>]) -> dDateEndOfYear
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* EOY() is compatible with CT3's EOY().
* $PLATFORMS$
* All
* $FILES$
* Source is datetime.prg, library is libct.
* $SEEALSO$
* BOM(),EOM(),BOQ(),EOQ(),BOY()
* $END$
*/
HB_FUNC( EOY )
{
long lDate;
@@ -414,7 +239,6 @@ HB_FUNC( EOY )
}
}
static int hb_wom( int iYear, int iMonth, int iDay )
{
int iWom;

View File

@@ -69,7 +69,6 @@
#include "hbdate.h"
#include "hbset.h"
static HB_BOOL ct_isleap( int iYear )
{
return iYear != 0 && ( ( ( iYear & 3 ) == 0 && iYear % 100 != 0 ) ||
@@ -105,34 +104,6 @@ static int ct_doy( long lDate )
return ( int ) ( lDate - lFirst + 1 );
}
/* $DOC$
* $FUNCNAME$
* CTODOW()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* convert name of day of the week to its ordinal number
* $SYNTAX$
* CTODOW (<cName>) -> nOrdinal
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* CTODOW() is compatible with CT3's CTODOW().
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
* NTOCDOW()
* $END$
*/
HB_FUNC( CTODOW )
{
HB_SIZE nLen = hb_parclen( 1 );
@@ -153,34 +124,6 @@ HB_FUNC( CTODOW )
hb_retnl( iDow );
}
/* $DOC$
* $FUNCNAME$
* CTOMONTH()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* convert name of month to its ordinal number
* $SYNTAX$
* CTOMONTH (<cName>) -> nOrdinal
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* CTOMONTH() is compatible with CT3's CTOMONTH().
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
* NTOCMONTH()
* $END$
*/
HB_FUNC( CTOMONTH )
{
HB_SIZE nLen = hb_parclen( 1 );
@@ -200,36 +143,6 @@ HB_FUNC( CTOMONTH )
hb_retnl( iMonth );
}
/* $DOC$
* $FUNCNAME$
* DMY()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* Returns the date as a string in DD Month YY format
* $SYNTAX$
* DMY ([<dDate>][, <lMode>]) -> cDateString
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* Returns the date as a string in DD Month YY format. If lmode
* is TRUE, a "." is inserted after the DD
* TODO: add further documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* DMY() is compatible with CT3's DMY().
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
* MDY()
* $END$
*/
HB_FUNC( DMY )
{
int iYear, iMonth, iDay;
@@ -292,36 +205,6 @@ HB_FUNC( DMY )
hb_retc_null();
}
/* $DOC$
* $FUNCNAME$
* MDY()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* Returns the date as a string in Month DD, YY or Month DD, YYYY
* $SYNTAX$
* MDY ([<dDate>]) -> cDateString
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* Returns the date as a string in Month DD, YY or Month DD, YYYY
* If dDate is NULL, the system date is used
* TODO: add further documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* MDY() is compatible with CT3's MDY().
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
* DMY()
* $END$
*/
HB_FUNC( MDY )
{
int iYear, iMonth, iDay;
@@ -370,34 +253,6 @@ HB_FUNC( MDY )
hb_retc_null();
}
/* $DOC$
* $FUNCNAME$
* ADDMONTH()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* add months to a date
* $SYNTAX$
* ADDMONTH ([<dDate>,] <nMonths>) -> dShiftedDate
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* ADDMONTH() is compatible with CT3's ADDMOTH().
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
* $END$
*/
HB_FUNC( ADDMONTH )
{
long lJulian, lMillisec = 0;
@@ -449,35 +304,6 @@ HB_FUNC( ADDMONTH )
hb_retdl( lJulian );
}
/* $DOC$
* $FUNCNAME$
* DOY()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* Determines the day of the year for a specific date
* $SYNTAX$
* DMY ([<dDate>]) -> nDayOfYear
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* Determines the day of the year for a specific date
* if dDate is invalid, returns 0
* TODO: add further documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* DOY() is compatible with CT3's DOY().
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
* $END$
*/
HB_FUNC( DOY )
{
long lDate;
@@ -495,33 +321,6 @@ HB_FUNC( DOY )
hb_retni( ct_doy( lDate ) );
}
/* $DOC$
* $FUNCNAME$
* ISLEAP()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* determines of year of date is a leap year
* $SYNTAX$
* ISLEAP ([<dDate>]) -> lIsLeap
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* TODO: add further documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* ISLEAP() is compatible with CT3's ISLEAP().
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
* $END$
*/
HB_FUNC( ISLEAP )
{
int iYear, iMonth, iDay;
@@ -534,36 +333,6 @@ HB_FUNC( ISLEAP )
hb_retl( ct_isleap( iYear ) );
}
/* $DOC$
* $FUNCNAME$
* DAYSTOMONTH()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* Total number of days from first of Jan to beginning of nMonth.
* $SYNTAX$
* DAYSTOMONTH (<nMonth>, <lLeapYear>) -> nDaysToMonth
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* lLeap is FALSE for a non-leap year but TRUE if it is. If so and nMonth
* is greater than 2, ndays is incremented
* TODO: add further documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* DAYSTOMONTH() is a new function in Harbour's CT3 library.
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
* DAYSINMONTH()
* $END$
*/
HB_FUNC( DAYSTOMONTH )
{
int iMonth = hb_parni( 1 );
@@ -572,34 +341,6 @@ HB_FUNC( DAYSTOMONTH )
hb_retni( ct_daystomonth( iMonth, bLeap ) );
}
/* $DOC$
* $FUNCNAME$
* DAYSINMONTH()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* Returns the number of days in month
* $SYNTAX$
* DAYSINMONTH (<nMonth>, <lLeapYear>) -> nDaysInMonth
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* DAYSINMONTH() is a new function in Harbour's CT3 library.
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
* DAYSTOMONTH()
* $END$
*/
HB_FUNC( DAYSINMONTH )
{
int iMonth = hb_parni( 1 );
@@ -609,35 +350,6 @@ HB_FUNC( DAYSINMONTH )
}
/* $DOC$
* $FUNCNAME$
* QUARTER()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* Returns a number equal to the quarter in which a date falls
* $SYNTAX$
* QUARTER ([<dDate>]) -> nQuarter
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* Returns a number equal to the quarter in which ddate
* falls. If ddate is empty, the system date is employed.
* TODO: add further documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* QUARTER() is compatible with CT3's QUARTER().
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
* $END$
*/
HB_FUNC( QUARTER )
{
int iYear, iMonth, iDay;
@@ -650,37 +362,6 @@ HB_FUNC( QUARTER )
hb_retni( ( iMonth + 2 ) / 3 );
}
/* $DOC$
* $FUNCNAME$
* LASTDAYOM()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* Returns the the number of days in the month.
* $SYNTAX$
* LASTDAYOM ([<dDate|nMonth>]) -> nDaysInMonth
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* <dDate|nMonth> can be a date or a month number. If empty uses the
* system date. If nMonth is a 2, lastdayom() will not know if it
* is a leap year or not. If dDate is invalid, returns 0
* TODO: add further documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* LASTDAYOM() is compatible with CT3's LASTDAYOM().
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
* EOM()
* $END$
*/
HB_FUNC( LASTDAYOM )
{
HB_BOOL bLeap = HB_FALSE;
@@ -702,109 +383,16 @@ HB_FUNC( LASTDAYOM )
}
/* $DOC$
* $FUNCNAME$
* NTOCDOW()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* (num of day) -> day name
* $SYNTAX$
* NTOCDOW (<nDay>) -> cDay
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* NTOCDOW() is compatible with CT3's NTOCDOW().
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
* CTODOW()
* $END$
*/
HB_FUNC( NTOCDOW )
{
hb_retc( hb_dateCDOW( hb_parni( 1 ) ) );
}
/* $DOC$
* $FUNCNAME$
* NTOCMONTH()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* (num of month ) -> Month Name
* $SYNTAX$
* NTOCMONTH (<nMonth>) -> cMonth
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* NTOCMONTH() is compatible with CT3's NTOCMONTH().
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
* CTOMONTH()
* $END$
*/
HB_FUNC( NTOCMONTH )
{
hb_retc( hb_dateCMonth( hb_parni( 1 ) ) );
}
/* $DOC$
* $FUNCNAME$
* WEEK()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* Returns the calendar week a number
* $SYNTAX$
* WEEK ([<dDate>][, <lSWN>]) -> nWeek
* $ARGUMENTS$
* $RETURNS$
* $DESCRIPTION$
* Returns the calendar week a number. If no date is specified,
* the system date is used. An empty date viz ctod(" / / ")
* returns 0.
* If <lSWN> is .T., week() will calculate the "simple week number", defined by
* - week #1 starts on January, 1st
* - week #(n+1) starts seven days after start of week #n
* If <lSWN> is .F. (default), the ISO8601 week number, defined by
* - weeks start on mondays
* - week #1 is the one that includes January, 4
* will be calculated
* TODO: add further documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* WEEK() is compatible with CT3's WEEK().
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
* $END$
*/
HB_FUNC( WEEK )
{
int iYear, iMonth, iDay, iWeek;

View File

@@ -66,57 +66,6 @@
#include <time.h>
/* $DOC$
* $FUNCNAME$
* WAITPERIOD()
* $CATEGORY$
* HBCT date and time functions
* $ONELINER$
* Pauses a specified time in increments of 1/100 seconds
* $SYNTAX$
* WAITPERIOD([<nDelay>]) --> lNotElapsed
* $ARGUMENTS$
* <nDelay> Designates the waiting period at initialization in
* 1/100ths of seconds. Values from 1 to 8, 640, 000 (one day) are
* possible.
* $RETURNS$
* WAITPERIOD() returns .T. , if the time span designated at initialization
* has not elapsed.
* $DESCRIPTION$
* This function sets a time span for a xHarbour DO WHILE loop to run.
* The function must initialize prior to the loop, since you must specify
* the <nDelay> parameter in 1/100th seconds. Subsequently, the function
* can be implemented without a parameter for additional loop conditions.
* It returns .T., as long as the designated time span has not yet run out.
*
* Note
*
* The function notes the status of the internal timer at
* initialization. From that point on, the initialization should always
* precede the respective DO WHILE; otherwise, the time delay is
* incorrect. The passing of midnight (the time resets to the 0 value)
* is taken into account.
* $EXAMPLES$
* Run a loop for 5 seconds:
*
* WAITPERIOD(500) // Initialization, 5 seconds
* DO WHILE <cond1> .AND. <cond2> .AND. WAITPERIOD()
* *...
* ENDDO
* $TESTS$
* $STATUS$
* Ready
* $COMPLIANCE$
* WAITPERIOD() is Clipper Tools compatible.
* $PLATFORMS$
* Windows
* $FILES$
* Source is dattime3.c, library is libct.
* $SEEALSO$
* $END$
*/
/* TODO: make it MT safe */
static double s_dTimeSet = 0;
static double s_dTimeCounter = 0;
@@ -165,124 +114,11 @@ static HB_BOOL _hb_timeValid( const char * szTime, HB_SIZE nLen, int * piDecode
return fValid;
}
/* $DOC$
* $FUNCNAME$
* TIMEVALID()
* $CATEGORY$
* HBCT Date and Time Functions
* $ONELINER$
* Determines whether a specIFied time is valid
* $SYNTAX$
* TIMEVALID(<cTime>) --> lValid
* $ARGUMENTS$
* <cTime> Designates a character string that contains the time to
* test.
* $RETURNS$
* TIMEVALID() RETURNs .T. when <cTime> is a valid time; or .F. when
* <cTime> is an invalid time.
* $DESCRIPTION$
* With input that requires time manipulation, writing your own UDF to
* check time inputs was unavoidable up to now. TIMEVALID() permits
* Complete checking of a time designation. You can use this FUNCTION
* effectively with a VALID clause within a READ mask.
*
* Note
*
* Note the format for time designations. There must always be
* two digits for hours, minutes, seconds, and hundredths; otherwise,
* the time it is regarded as invalid. Valid examples are "12",
* "12:59", "12:59:59", and "12:59:59:99". By contrast, invalid
* examples are "24", "12:60", or "12:1", and/or "12:". IF you work
* with time strings that are not completely filled and that you need to
* check with TIMEVALID(), then they must be TRIMmed prior to the use of
* TIMEVALID() (see following Examples).
* $EXAMPLES$
* Using the VALID clause with TRIM, all valid times are
* accepted, even IF no seconds or minutes are specIFied:
*
* cBegin := SPACE(11)
* @ 5, 10 SAY "Please input time for beginning work:";
* GET cBegin VALID TIMEVALID(TRIM(cBegin))
* READ
*
* Using a VALID clause without TRIM, hours and minutes must be
* specified, so that TIMEVALID() can confirm a valid time:
*
* cBegin := SPACE(5)
* @ 5, 10 SAY "Please input time for beginning work:";
* GET cBegin VALID TIMEVALID(cBegin)
* READ
* $TESTS$
* $STATUS$
* Ready
* $COMPLIANCE$
* This function is CA-Cl*pper Tools compatible.
* $PLATFORMS$
* Windows
* $FILES$
* Source is dattime3.c, library is libct.
* $SEEALSO$
* SETTIME()
* $END$
*/
HB_FUNC( TIMEVALID )
{
hb_retl( _hb_timeValid( hb_parc( 1 ), hb_parclen( 1 ), NULL ) );
}
/* $DOC$
* $FUNCNAME$
* SETTIME()
* $CATEGORY$
* HBCT Date and Time Functions
* $ONELINER$
* Sets the system clock
* $SYNTAX$
* SETTIME(<cTime>, [<lMode>]) --> lSet
* $ARGUMENTS$
* <cTime> Designates a character string that contains the time that
* is to become the system time.
*
* <lMode> Designates whether the time should also be set in the
* CMOS-RAM of an AT. The default is do not write to CMOS-RAM. Note that in
* Windows plataform this adjust is automatic, therefore this parameter is
* without efect.
* $RETURNS$
* The FUNCTION RETURNs .T. when the time is set successfully.
* $DESCRIPTION$
* When you use this FUNCTION to convert the time into the system time from
* within your xHarbour application, all files acquire this time with
* each write procedure.
* $EXAMPLES$
* Set the system time in each case; but the hardware clock only
* on an AT:
*
* cNewTime := "10:20:00"
* IF ISAT()
* SETTIME(cNewTime, .T.)
* ELSE
* SETTIME(cNewTime)
* ENDIF
*
* Or, more compactly:
*
* SETTIME(cNewTime, ISAT())
* $TESTS$
* $STATUS$
* Ready
* $COMPLIANCE$
* This function is CA-Cl*pper Tools compatible.
* $PLATFORMS$
* Windows
* $FILES$
* Source is dattime3.c, library is libct.
* $SEEALSO$
* SETDATE(),TIMEVALID()
* $END$
*/
HB_FUNC( SETTIME )
{
HB_BOOL fResult = HB_FALSE;
@@ -314,57 +150,6 @@ HB_FUNC( SETTIME )
hb_retl( fResult );
}
/* $DOC$
* $FUNCNAME$
* SETDATE()
* $CATEGORY$
* HBCT Date and Time Functions
* $ONELINER$
* Sets the system date
* $SYNTAX$
* SETDATE(<dDate>, [<lMode>]) --> lSet
* $ARGUMENTS$
* <dDate> Designates which date to use to set the system date.
*
* <lMode> Designates whether the date should also be set in the CMOS-
* RAM of an AT. The default is do not write (.F.). Note that in Windows
* plataform this adjust is automatic, therefore this parameter is without
* efect.
* $RETURNS$
* SETDATE() RETURNs .T. when the date is successfully set.
* $DESCRIPTION$
* When you use this FUNCTION to set the system date from within your
* xHarbour application, all files acquire this date with each write
* procedure.
* $EXAMPLES$
* Set the system date in each case; but the hardware clock only
* on an AT:
*
* dNewDate := CTOD("07/30/91")
* IF ISAT()
* SETDATE(dNewDate, .T.)
* ELSE
* SETDATE(dNewDate)
* ENDIF
*
* Or, more compactly:
*
* SETDATE(dNewDate, ISAT())
* $TESTS$
* $STATUS$
* Ready
* $COMPLIANCE$
* This function is CA-Cl*pper Tools compatible.
* $PLATFORMS$
* Windows
* $FILES$
* Source is dattime3.c, library is libct.
* $SEEALSO$
* SETTIME()
* $END$
*/
HB_FUNC( SETDATE )
{
HB_BOOL fResult = HB_FALSE;

View File

@@ -77,7 +77,6 @@
#include <windows.h>
#endif
HB_FUNC( DIRMAKE )
{
if( hb_fsMkDir( hb_parcx( 1 ) ) )
@@ -109,7 +108,6 @@ HB_FUNC( DIRNAME )
hb_retc_buffer( pbyBuffer );
}
HB_FUNC( DRIVETYPE )
{
#if defined( HB_OS_WIN ) && ! defined( HB_OS_WIN_CE )
@@ -157,7 +155,6 @@ HB_FUNC( DRIVETYPE )
}
HB_FUNC( NUMDISKL )
{
#if defined( HB_OS_DOS )
@@ -180,7 +177,6 @@ HB_FUNC( NUMDISKL )
#endif
}
/*
* Volume() depends of the CSETSAFETY() setting and, if is true, does not
* overwrite an existing label.

View File

@@ -0,0 +1,67 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* ADDASCII()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Add an integer value to an ascii value of a string
* $SYNTAX$
* ADDASCII (<[@]cString>, <nValue>, [<nPosition>], [<lCarryOver>]) --> cString
* $ARGUMENTS$
* <[@]cString> is the string that should be edited
* <nValue> is a integer value that should be added to the
* ASCII value of the character at the <nPosition>th position
* [<nPosition>] is the position of the character that should be edited.
* If not supplied, the last character of <[@]cString> is
* edited.
* [<lCarryOver>] NEW: is set to .T. if the substring from position 1 to
* position <nPosition> should be treated as an integer
* written to the base 256. Thus, the addition of <nValue>
* can affect to whole substring (see EXAMPLES).
* Default is .F., the original behaviour of this function.
* $RETURNS$
* The edited string is returned. The return value can be suppressed by
* using the CSETREF() function. The string must then be passed by
* reference [@].
* $DESCRIPTION$
* ADDASCII() can be used to add or subtract integer values from
* ASCII values in a string. The new <lCarryOver> parameter allows
* to treat a string as an integer written to the base 256. Since
* <nValue> is limited to a signed long, only substrings 4 characters
* long can be affected by one ADDASCII() call.
* If the length of <[@]cString> is smaller than <nPosition>, the
* string remains unchanged. The same happens, if uninterpretable
* parameters are passed to this function.
* $EXAMPLES$
* // Add 32 to the ASCII value of the character at the last position
* // in the string
*
* ? addascii ("SmitH", 32) --> "Smith"
* $TESTS$
* addascii ("0000", 1, 1) == "1000"
* addascii ("0000", 1) == "0001"
* addascii ("AAAA", -255, 1) == "BAAA"
* addascii ("AAAA", -255) == "AAAB"
* addascii ("AAAA", 1, 2, .T.) == "ABAA"
* addascii ("AAAA", 257, 2, .T.) == "BBAA"
* addascii ("AAAA", 257, 2, .F.) == "ABAA"
* addascii ("AAAA", 258,, .T.) == "AABC"
* addascii ("ABBA", -257, 3, .T.) == "AAAA"
* $STATUS$
* Ready
* $COMPLIANCE$
* ADDASCII() is compatible with CT3's ADDASCII().
* A new, 4th, parameter has been added who defaults to the original
* behaviour if omitted.
* $PLATFORMS$
* All
* $FILES$
* Source is addascii.c, library is ct3.
* $SEEALSO$
* CSETREF()
* $END$
*/

View File

@@ -0,0 +1,41 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* ASCIISUM()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* calculate the sum of the ASCII values of the characters in a string
* $SYNTAX$
* ASCIISUM (<cString>) --> nAsciiSum
* $ARGUMENTS$
* <cString> the string to be processed
* $RETURNS$
* <nAsciiSum> sum of the ASCII values in <cString>
* $DESCRIPTION$
* The ASCIISUM() function sums up the ASCII values of the characters
* in <cString>. Be aware that the function is not position sensitive,
* i.e. a change of position of a certain character in the string does
* not change the ascii sum.
* $EXAMPLES$
* ? asciisum ("ABC") --> 197
* ? asciisum ("ACB") --> 197
* $TESTS$
* asciisum (replicate ("A", 10000)) == 650000
* asciisum ("0123456789") == 525
* asciisum (nil) == 0
* $STATUS$
* Ready
* $COMPLIANCE$
* ASCIISUM() is compatible with CT3's ASCIISUM().
* $PLATFORMS$
* All
* $FILES$
* Source is asciisum.c, library is ct3.
* $SEEALSO$
* CHECKSUM()
* $END$
*/

View File

@@ -0,0 +1,85 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* ASCPOS()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* ASCII value of a character at a certain position
* $SYNTAX$
* ASCPOS (<cString>, [<nPosition>]) --> nAsciiValue
* $ARGUMENTS$
* <cString> is the processed string
* [<nPosition>] is an optional position within <cString>
* Default: last position in <cString>
* $RETURNS$
* <nAsciiValue> the ASCII value of the character at the specified
* position
* $DESCRIPTION$
* The ASCPOS() function returns the ASCII value of the character that
* can be found at the position <nPosition> in <cString>. If <nPosition>
* is larger than the length of <cString>, 0 is returned.
* $EXAMPLES$
* ? ascpos ("0123456789") --> 57
* ? ascpos ("0123456789",1) --> 48
* $TESTS$
* ascpos ("0123456789") == 57
* ascpos ("0123456789",1) == 48
* ascpos ("0123456789",11) == 0 // <nPosition> to large !
* $STATUS$
* Ready
* $COMPLIANCE$
* ASCPOS() is compatible with CT3's ASCPOS().
* $PLATFORMS$
* All
* $FILES$
* Source is asciisum.c, library is libct.
* $SEEALSO$
* VALPOS()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* VALPOS()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Numerical value of a character at a certain position
* $SYNTAX$
* VALPOS (<cString>, [<nPosition>]) --> nDigitValue
* $ARGUMENTS$
* <cString> is the processed string
* [<nPosition>] is an optional position within <cString>
* Default: last position in <cString>
* $RETURNS$
* <nDigitValue> the numerical value of the character at the specified
* position
* $DESCRIPTION$
* The VALPOS() function returns the numerical value of the character that
* can be found at the position <nPosition> in <cString>. If no digit
* can be found at this position or if <nPosition>
* is larger than the length of <cString>, 0 is returned.
* $EXAMPLES$
* ? valpos ("1234x56789") --> 9
* ? valpos ("1234x56789",1) --> 1
* $TESTS$
* valpos ("1234x56789") == 9
* valpos ("1234x56789",1) == 1
* valpos ("1234x56789",11) == 0 // <nPosition> to large !
* valpos ("1234x56789",5) == 0 // "x" is not a digit !
* $STATUS$
* Ready
* $COMPLIANCE$
* VALPOS() is compatible with CT3's VALPOS().
* $PLATFORMS$
* All
* $FILES$
* Source is asciisum.c, library is libct.
* $SEEALSO$
* ASCPOS()
* $END$
*/

View File

@@ -0,0 +1,47 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* ATADJUST()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Adjusts a sequence within a string to a specified position
* $SYNTAX$
* ATADJUST (<cStringToMatch>, <cString>, <nAdjustPosition>,
* [<nCounter>], [<nIgnore>],
* [<nFillChar|cFillChar>]) -> cString
* $ARGUMENTS$
* <cStringToMatch> is the sequence to be adjusted within <cString>
* <cString> is the string that contains <cStringToMatch>
* <nAdjustPosition> specifies the position to that <cStringToMatch>
* will be adjusted
* [<nCounter>] specifies which occurence of <cStringToMatch>
* in <cString> is to be adjusted
* Default: last occurence
* [<nIgnore>] specifies how many characters should be omitted
* in the scan
* [<nFillChar|cFillChar>] specifies the character that is used for the
* adjustment
* $RETURNS$
* cString the changed string
* $DESCRIPTION$
* <TODO: add a description, some examples and tests here>
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Ready
* $COMPLIANCE$
* ATADJUST() works like CT3's ATADJUST()
* $PLATFORMS$
* All
* $FILES$
* Source is atadjust.c, library is ct3.
* $SEEALSO$
* SETATLIKE(),CSETATMUPA()
* $END$
*/

View File

@@ -0,0 +1,170 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* AFTERATNUM()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Returns string portion after nth occurence of substring
* $SYNTAX$
* AFTERATNUM (<cStringToMatch>, <cString>, [<nCounter>],
* [<nIgnore>] ) --> cRestString
* $ARGUMENTS$
* <cStringToMatch> is the substring scanned for
* <cString> is the scanned string
* [<nCounter>] determines how many occurences are of
* <cStringToMatch> in <cString> are searched
* Default: search last occurence
* [<nIgnore>] determines how many character from the start
* should be ignored in the search
* Default: 0
* $RETURNS$
* <cRestString> the portion of <cString> after the <nCounter>th
* occurence of <cStringToMatch> in <cString>
* If such a rest does not exist, an empty string
* is returned.
* $DESCRIPTION$
* This function scans <cString> for <cStringToMatch>. After the
* <nCounter>th match (or the last one, depending on the value of
* <nCounter>) has been found, the portion of
* <cString> after that match will be returned. If there aren't enough
* matches or the last match is identical to the end of <cString>, an
* empty string will be returned.
* After a match has been found, the function continues to scan after
* that match if the CSETATMUPA() switch is turned off, with the
* second character of the matched substring otherwise.
* The function will also consider the settings of SETATLIKE().
* $EXAMPLES$
* ? AFTERATNUM ("!", "What is the answer ? 4 ! 5 !") -> ""
* ? AFTERATNUM ("!", "What is the answer ? 4 ! 5 ?") -> " 5 ?"
* <TODO: add some examples here with csetatmupa() and setatlike()>
* $TESTS$
* AFTERATNUM ("..", "..This..is..a..test!") == "test!"
* AFTERATNUM ("..", "..This..is..a..test!", 2) == "is..a..test!"
* AFTERATNUM ("..", "..This..is..a..test!", 2, 2) == "a..test!"
* $STATUS$
* Ready
* $COMPLIANCE$
* AFTERATNUM() is compatible with CT3's AFTERATNUM().
* $PLATFORMS$
* All
* $FILES$
* Source is atnum.c, library is libct.
* $SEEALSO$
* ATNUM(),BEFORATNUM(),CSETATMUPA(),SETATLIKE()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* BEFORATNUM()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Returns string portion before nth occurence of substring
* $SYNTAX$
* BEFORATNUM (<cStringToMatch>, <cString>, [<nCounter>],
* [<nIgnore>] ) --> cRestString
* $ARGUMENTS$
* <cStringToMatch> is the substring scanned for
* <cString> is the scanned string
* [<nCounter>] determines how many occurences are of
* <cStringToMatch> in <cString> are searched
* Default: search last occurence
* [<nIgnore>] determines how many character from the start
* should be ignored in the search
* Default: 0
* $RETURNS$
* <cRestString> the portion of <cString> before the <nCounter>th
* occurence of <cStringToMatch> in <cString>
* If such a string does not exist, an empty string
* is returned.
* $DESCRIPTION$
* This function scans <cString> for <cStringToMatch>. After the
* <nCounter>th match (or the last one, depending on the value of
* <nCounter>) has been found, the portion of
* <cString> before that match will be returned. If there aren't enough
* matches or the last match is identical to the start of <cString>
* (i.e. the last match is the first match), an empty string will be returned.
* After a match has been found, the function continues to scan after
* that match if the CSETATMUPA() switch is turned off, with the
* second character of the matched substring otherwise.
* The function will also consider the settings of SETATLIKE().
* $EXAMPLES$
* ? BEFORATNUM ("!", "What is the answer ? 4 ! 5 !") -> "What is the answer ? 4 ! 5 "
* ? BEFORATNUM ("!", "What is the answer ? 4 ! 5 ?") -> "What is the answer ? 4 "
* <TODO: add some examples here with csetatmupa() and setatlike()>
* $TESTS$
* BEFORATNUM ("..", "..This..is..a..test!") == "..This..is..a"
* BEFORATNUM ("..", "..This..is..a..test!", 2) == "..This"
* BEFORATNUM ("..", "..This..is..a..test!", 2, 2) == "..This..is"
* $STATUS$
* Ready
* $COMPLIANCE$
* BEFORATNUM() is compatible with CT3's BEFORATNUM().
* $PLATFORMS$
* All
* $FILES$
* Source is atnum.c, library is ct3.
* $SEEALSO$
* ATNUM() AFTERATNUM() CSETATMUPA() SETATLIKE()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* ATNUM()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Returns the start position of the nth occurence of a substring in a string
* $SYNTAX$
* ATNUM (<cStringToMatch>, <cString>, [<nCounter>],
* [<nIgnore>] ) --> nPosition
* $ARGUMENTS$
* <cStringToMatch> is the substring scanned for
* <cString> is the scanned string
* [<nCounter>] determines how many occurences are of
* <cStringToMatch> in <cString> are searched
* Default: search last occurence
* [<nIgnore>] determines how many character from the start
* should be ignored in the search
* Default: 0
* $RETURNS$
* <nPosition> the position of the <nCounter>th
* occurence of <cStringToMatch> in <cString>.
* If such an occurence does not exist, 0
* is returned.
* $DESCRIPTION$
* This function scans <cString> for <cStringToMatch>. After the
* <nCounter>th match (or the last one, depending on the value of
* <nCounter>) has been found, the position of
* that match will be returned. If there aren't enough
* matches or there is no last match, 0 will be returned.
* After a match has been found, the function continues to scan after
* that match if the CSETATMUPA() switch is turned off, with the
* second character of the matched substring otherwise.
* The function will also consider the settings of SETATLIKE().
* $EXAMPLES$
* ? ATNUM ("!", "What is the answer ? 4 ! 5 !") -> 28
* ? ATNUM ("!", "What is the answer ? 4 ! 5 ?") -> 24
* <TODO: add some examples here with csetatmupa() and setatlike()>
* $TESTS$
* ATNUM ("..", "..This..is..a..test!") == 14
* ATNUM ("..", "..This..is..a..test!", 2) == 7
* ATNUM ("..", "..This..is..a..test!", 2, 2) == 11
* $STATUS$
* Ready
* $COMPLIANCE$
* ATNUM() is compatible with CT3's ATNUM().
* $PLATFORMS$
* All
* $FILES$
* Source is atnum.c, library is libct.
* $SEEALSO$
* ATNUM() AFTERATNUM() CSETATMUPA() SETATLIKE()
* $END$
*/

View File

@@ -0,0 +1,68 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* ATREPL()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Search and replace sequences in a string
* $SYNTAX$
* ATREPL (<cStringToMatch>, <cString>, <cReplacement>, [<nCounter>],
* [<lMode>], [<nIgnore>]) --> cString
* $ARGUMENTS$
* <cStringToMatch> is the substring searched for in <cString>
* <cString> is the processed string
* <cReplacement> is the replacement for sequences found
* [<nCounter>] specifies the number of replacements
* Default: last occurence
* [<lMode>] if set to .T., only the <nCounter>th sequence
* of <cStringToMatch> will be replaced, else
* all sequences will be replaced.
* Default: .F.
* [<nIgnore>]) specifies how many characters in <cString> from
* the beginning should be ignored by the function
* Default: 0
* $RETURNS$
* <cString>
* $DESCRIPTION$
* The ATREPL() function searches and replaces sequences in a string.
* First, the function ignores the first <nIgnore> characters of <cString>.
* Then, if <lMode> is set to .T., it searches for the <nCounter>th
* occurence of <cStringToMatch> in <cString>. If successful, the
* sequence will be replaced with <cReplacement>.
* If <lMode> is set to .F., the same search is performed, but EVERY
* occurence of <cStringToMatch> till the <nCounter>th (inclusive) will
* be replaced with <cReplacement>. Note that, in this case,
* the replacements are performed even if the <nCounter>th occurence
* does not exist.
* By using the CSETATMUPA() switch you can decide whether the
* function restarts searching after a found sequence of after
* the first character of that sequence.
* The function allows the use of wildcards in <cStringToMatch>
* and looks for the settings of SETATLIKE().
* $EXAMPLES$
* ? ATREPL("ABC", "ABCDABCDABC", "xx") --> "xxDxxDxx"
* ? ATREPL("ABC", "ABCDABC", "ZYXW") --> "ZYXWDZYXW"
* ? ATREPL("ABC", "ABCDABCDABC", "xx", 2) --> "xxDxxDABC"
* ? ATREPL("ABC", "ABCDABCDABC", "xx", 2, .T.) --> "ABCDxxDABC"
* $TESTS$
* ATREPL("ABC", "ABCDABCDABC", "xx") == "xxDxxDxx"
* ATREPL("ABC", "ABCDABC", "ZYXW") == "ZYXWDZYXW"
* ATREPL("ABC", "ABCDABCDABC", "xx", 2) == "xxDxxDABC"
* ATREPL("ABC", "ABCDABCDABC", "xx", 2, .T.) == "ABCDxxDABC"
* $STATUS$
* Ready
* $COMPLIANCE$
* ATREPL() is compatible with CT3's ATREPL().
* Note the new, 6th parameter !
* $PLATFORMS$
* All
* $FILES$
* Source is atrepl.c, library is ct3.
* $SEEALSO$
* CSETATMUPA() SETATLIKE()
* $END$
*/

View File

@@ -0,0 +1,74 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* CHAREVEN()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Returns the characters on the even positions in a string
* $SYNTAX$
* CHAREVEN (<cString>) --> cEvenString
* $ARGUMENTS$
* <cString> processed string
* $RETURNS$
* <cEvenString> a string containing all character from even positions
* in <cString>
* $DESCRIPTION$
* The CHAREVEN() function looks for the characters on the even positions
* in a given string, collects them and returns them as a string.
* $EXAMPLES$
* ? CHAREVEN (" H E L L O !") -> "HELLO!"
* $TESTS$
* CHAREVEN (" 1 2 3 4 5") == "12345"
* CHAREVEN (" 1 2 3 4 ") == "1234"
* CHAREVEN (" ") == ""
* $STATUS$
* Ready
* $COMPLIANCE$
* CHAREVEN() is compatible with CT3's CHAREVEN().
* $PLATFORMS$
* All
* $FILES$
* Source is charevod.c, library is ct3.
* $SEEALSO$
* CHARODD() CHARMIX()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* CHARODD()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Returns the characters on the odd positions in a string
* $SYNTAX$
* CHARODD (<cString>) --> cOddString
* $ARGUMENTS$
* <cString> processed string
* $RETURNS$
* <cOddString> a string containing all character from odd positions
* in <cString>
* $DESCRIPTION$
* The CHARODD() function looks for the characters on the odd positions
* in a given string, collects them and returns them as a string.
* $EXAMPLES$
* ? CHARODD ("H E L L O ! ") -> "HELLO!"
* $TESTS$
* CHARODD ("1A2B3C4D5E") == "12345"
* CHARODD ("1A2B3C4D5") == "12345"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARODD() is compatible with CT3's CHARODD().
* $PLATFORMS$
* All
* $FILES$
* Source is charevod.c, library is ct3.
* $SEEALSO$
* CHAREVEN() CHARMIX()
* $END$
*/

View File

@@ -0,0 +1,81 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* CHARSLIST()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Generates a sorted list of all characters in a string
* $SYNTAX$
* CHARSLIST ([<cString>]) -> cSortedCharacterList
* $ARGUMENTS$
* [<cString>] is the string for whom the function generates a
* sorted list of all characters
* Default: "" (empty string)
* $RETURNS$
* <cSortedCharacterList> a sorted list of the characters in <cString>
* $DESCRIPTION$
* The CHARLIST() function generates a sorted list of those characters that
* are contained in <cString>. This list can contain each character
* only once, so that its maximum length is 256. The function
* gives the same result as CHARSORT(CHARLIST(<cString>))
* $EXAMPLES$
* ? charslist ("Hello World !") --> " !HWdelor"
* $TESTS$
* charslist ("Hello World !") == " !HWdelor"
* charslist ("Hello World !") == charsort (charlist ("Hello World !"))
* charslist (nil) == ""
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARSLIST() is only available in Harbour's CT3 library.
* $PLATFORMS$
* All
* $FILES$
* Source is charlist.c, library is libct.
* $SEEALSO$
* CHARNOLIST(),CHARLIST(),CHARHIST()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* CHARHIST()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Generates a character histogram of a string
* $SYNTAX$
* CHARHIST ([<cString>]) -> aCharacterCount
* $ARGUMENTS$
* [<cString>] is the string for whom the function generates a
* character histogram
* Default: "" (empty string)
* $RETURNS$
* <aCharacterCount> an array with 256 elements where the nth element
* contains the count of character #(n-1) in cString
* $DESCRIPTION$
* The CHARHIST() function generates a character histogram of those
* characters that are contained in <cString>. This histogram is stored
* in an 256-element array where the nth element contains the count
* of ASCII character #(n-1) in <cString>.
* $EXAMPLES$
* ? charhist ("Hello World !")[109] --> 3 // chr(108)=="l"
* $TESTS$
* charhist ("Hello World !")[109] == 3
* eval ({||aeval (charhist ("Hello World !"),{|x|nTotal+=x}),nTotal==len("Hello World !")}
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARHIST() is only available in Harbour's CT3 library.
* $PLATFORMS$
* All
* $FILES$
* Source is charlist.c, library is libct.
* $SEEALSO$
* CHARLIST(),CHARNOLIST(),CHARSLIST()
* $END$
*/

View File

@@ -0,0 +1,79 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* CHARLIST()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Generates a list of all characters in a string
* $SYNTAX$
* CHARLIST ([<cString>]) -> cCharacterList
* $ARGUMENTS$
* [<cString>] is the string for whom the function generates a list
* of all characters
* Default: "" (empty string)
* $RETURNS$
* <cCharacterList> a list of the characters in <cString>
* $DESCRIPTION$
* The CHARLIST() function generates a list of those characters that
* are contained in <cString>. This list can contain each character
* only once, so that its maximum length is 256. The list lists those
* characters first that are occuring in <cString> first.
* $EXAMPLES$
* ? charlist ("Hello World !") --> "Helo Wrd!"
* $TESTS$
* charlist ("Hello World !") == "Helo Wrd!"
* charlist (nil) == ""
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARLIST() is compatible with CT3's CHARLIST().
* $PLATFORMS$
* All
* $FILES$
* Source is charlist.c, library is libct.
* $SEEALSO$
* CHARNOLIST(),CHARSLIST(),CHARHIST()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* CHARNOLIST()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Generates a list of all characters not contained in a string
* $SYNTAX$
* CHARNOLIST ([<cString>]) -> cCharacterList
* $ARGUMENTS$
* [<cString>] is the string for whom the function generates a list
* of all characters not contained in that string
* Default: "" (empty string)
* $RETURNS$
* <cCharacterList> a list of the characters that are not contained in <cString>
* $DESCRIPTION$
* The CHARNOLIST() function generates a list of those characters that
* are not contained in <cString>. This list can contain each character
* only once, so that its maximum length is 256. The list is alphabetically
* sorted.
* $EXAMPLES$
* ? charnolist (charnolist ("Hello World !")) --> " !HWdelor"
* $TESTS$
* charnolist (charnolist ("Hello World !")) == charslist ("Hello World !")
* charnolist (charnolist (nil)) == ""
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARNOLIST() is compatible with CT3's CHARNOLIST().
* $PLATFORMS$
* All
* $FILES$
* Source is charlist.c, library is libct.
* $SEEALSO$
* CHARLIST(),CHARSLIST(),CHARHIST()
* $END$
*/

View File

@@ -0,0 +1,48 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* CHARMIRR()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Mirror a string
* $SYNTAX$
* CHARMIRR (<[@]cString>, [<lDontMirrorSpaces>]) -> cMirroredString
* $ARGUMENTS$
* <[@]cString> is the string that should be mirrored
* [<lDontMirrorSpaces>] if set to .T., spaces at the end of
* <cString> will not be mirrored but kept at the end
* Default: .F., mirror the whole string
* $RETURNS$
* <cMirroredString> the mirrored string
* $DESCRIPTION$
* The CHARMIRR() function mirrors a string, i.e. the first character
* will be put at the end, the second at the last but one position etc..
* One can use this function for index searches, but then, the spaces
* at the end of the string should not be mirrored.
* One can omit the return value of the function by setting the CSETREF()
* switch to .T., but <cString> must then be passed by reference to get
* a result.
* $EXAMPLES$
* ? charmirr ("racecar") // "racecar"
* ? charmirr ("racecar ", .T.) // "racecar "
* ? charmirr ("racecar ", .F.) // " racecar"
* $TESTS$
* charmirr ("racecar") == "racecar"
* charmirr ("racecar ", .T.) == "racecar "
* charmirr ("racecar ", .F.) == " racecar"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARMIRR() is compatible with CT3's CHARMIRR().
* $PLATFORMS$
* All
* $FILES$
* Source is charmirr.c, library is ct3.
* $SEEALSO$
* CSETREF()
* $END$
*/

View File

@@ -0,0 +1,54 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* CHARMIX()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Mix two strings
* $SYNTAX$
* CHARMIX (<cString1>[, <cString2>]) --> cMixedString
* $ARGUMENTS$
* <cString1> String that will be mixed with the characters from <cString2>
* [<cString2>] String whose characters will be mixed with the one from
* <cString1>.
* Default: " " (string with one space char)
* $RETURNS$
* <cMixedString> Mixed string
* $DESCRIPTION$
* The CHARMIX() function mixes the strings <cString1> and <cString2>. To
* do this it takes one character after the other alternatively from
* <cString1> and <cString2> and puts them in the output string.
* This procedure is stopped when the end of <cString1> is reached. If
* <cString2> is shorter than <cString1>, the function will start at
* the begin of <cString2> again. If on the other hand <cString2> is
* longer than <cString1>, the surplus characters will be omitted.
* $EXAMPLES$
* ? CHARMIX("ABC", "123") // "A1B2C3"
* ? CHARMIX("ABCDE", "12") // "A1B2C1D2E1"
* ? CHARMIX("AB", "12345") // "A1B2"
* ? CHARMIX("HELLO", " ") // "H E L L O "
* ? CHARMIX("HELLO", "") // "HELLO"
* $TESTS$
* CHARMIX("ABC", "123") == "A1B2C3"
* CHARMIX("ABCDE", "12") == "A1B2C1D2E1"
* CHARMIX("AB", "12345") == "A1B2"
* CHARMIX("HELLO", " ") == "H E L L O "
* CHARMIX("HELLO", "") == "HELLO"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARMIX() is compatible with CT3's CHARMIX().
* NOTE: CA-Tools version of CHARMIX() will hang
* if the second parameter is an empty string, this version will not.
* $PLATFORMS$
* All
* $FILES$
* Source is charmix.c, library is ct3.
* $SEEALSO$
* CHAREVEN() CHARODD()
* $END$
*/

View File

@@ -0,0 +1,88 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* CHARONE()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Reduce multiple occurences of a character to one
* $SYNTAX$
* CHARONE ([<cCharactersToReduce>,] <cString>) -> cReducedString
* $ARGUMENTS$
* [<cCharactersToReduce>] specifies the characters the multiple
* occurences of which should be reduced to one
* Default: All characters.
* <cString> specifies the processed string
* $RETURNS$
* <cReducedString> the string with the reduced occurences
* $DESCRIPTION$
* The CHARONE() function reduces multiple occurences of characters in
* <cString> to a single one. It is important to note that the multiple
* occurences must occur directly one behind the other. This behaviour is
* is in contrast to the CHARLIST() function.
* $EXAMPLES$
* ? CHARONE("122333a123") // "123a123"
* ? CHARONE("A B CCCD") // "A B CD"
* ? CHARONE(" ", "A B A B") // "A B A B"
* ? CHARONE("o", "122oooB12o") // "122oB12o"
* $TESTS$
* CHARONE("122333a123") == "123a123"
* CHARONE("A B CCCD") == "A B CD"
* CHARONE(" ", "A B A B") == "A B A B"
* CHARONE("o", "122oooB12o") == "122oB12o"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARONE() is compatible with CT3's CHARONE().
* $PLATFORMS$
* All
* $FILES$
* Source is charone.c, library is ct3.
* $SEEALSO$
* CHARREM() WORDONE()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* WORDONE()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Reduce multiple occurences of a double character to one
* $SYNTAX$
* WORDONE ([<cDoubleCharactersToReduce>,] <cString>) -> cReducedString
* $ARGUMENTS$
* [<cDoubleCharactersToReduce>] specifies the double characters the multiple
* occurences of which should be reduced to one
* Default: All characters.
* <cString> specifies the processed string
* $RETURNS$
* <cReducedString> the string with the reduced occurences
* $DESCRIPTION$
* The WORDONE() function reduces multiple occurences of double characters in
* <cString> to a single one. It is important to note that the multiple
* occurences must occur directly one behind the other.
* $EXAMPLES$
* ? WORDONE("12ABAB12") // "12AB12"
* ? WORDONE("1AAAA2") // "1AAAA2"
* ? WORDONE("12", "1212ABAB") // "12ABAB"
* $TESTS$
* WORDONE("12ABAB12") == "12AB12"
* WORDONE("1AAAA2") == "1AAAA2"
* WORDONE("12", "1212ABAB") == "12ABAB"
* $STATUS$
* Ready
* $COMPLIANCE$
* WORDONE() is compatible with CT3's WORDONE().
* $PLATFORMS$
* All
* $FILES$
* Source is charone.c, library is ct3.
* $SEEALSO$
* CHARONE() CHARREM()
* $END$
*/

View File

@@ -0,0 +1,158 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* CHARONLY()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Intersectional set of two strings based on characters
* $SYNTAX$
* CHARONLY (<cThisCharactersOnly>, <cString>) -> cReducedString
* $ARGUMENTS$
* <cThisCharactersOnly> specifies the characters that must not be
* deleted in <cString>.
* <cString> is the string that should be processed
* $RETURNS$
* <cReducedString> A string with all characters deleted but those
* specified in <cThisCharactersOnly>.
* $DESCRIPTION$
* The CHARONLY() function calculates the intersectional set of two
* strings. To do this, it deletes all characters from <cString> that
* do not appear in <cThisCharacterOnly>.
* $EXAMPLES$
* ? CHARONLY("0123456789", "0211 - 38 99 77") // "0211389977"
* ? CHARONLY("0123456789", "0211/ 389 977") // "0211389977"
* $TESTS$
* CHARONLY("0123456789", "0211 - 38 99 77") == "0211389977"
* CHARONLY("0123456789", "0211/ 389 977") == "0211389977"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARONLY() is compatible with CT3's CHARONLY().
* $PLATFORMS$
* All
* $FILES$
* Source is charonly.c, library is ct3.
* $SEEALSO$
* CHARREM() WORDONLY() WORDREM()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* WORDONLY()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Intersectional set of two strings based on double characters
* $SYNTAX$
* WORDONLY (<cThisDoubleCharactersOnly>, <cString>) -> cReducedString
* $ARGUMENTS$
* <cThisDoubleCharactersOnly> specifies the double characters that must
* not be deleted in <cString>.
* <cString> is the string that should be processed
* $RETURNS$
* <cReducedString> A string with all double characters deleted
* but those specified in <cThisCharactersOnly>.
* $DESCRIPTION$
* The WORDONLY() function calculates the intersectional set of two
* strings based on double characters. To do this, it deletes all double
* characters from <cString> that do not appear in <cThisDoubleCharacterOnly>.
* $EXAMPLES$
* ? WORDONLY("AABBCCDD", "XXAAYYBBZZ") // "AABB"
* ? WORDONLY("AABBCCDD", "XAAYYYBBZZ") // "BB"
* $TESTS$
* WORDONLY("AABBCCDD", "XXAAYYBBZZ") == "AABB"
* WORDONLY("AABBCCDD", "XAAYYYBBZZ") == "BB"
* $STATUS$
* Ready
* $COMPLIANCE$
* WORDONLY() is compatible with CT3's WORDONLY().
* $PLATFORMS$
* All
* $FILES$
* Source is charonly.c, library is ct3.
* $SEEALSO$
* CHARONLY() CHARREM() WORDREM()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* CHARREM()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Removes characters from a string
* $SYNTAX$
* CHARREM (<cDeleteThisCharacters>, <cString>) -> cReducedString
* $ARGUMENTS$
* <cDeleteThisCharacters> specifies the characters that should
* be deleted in <cString>
* <cString>) is the string that should be processed
* $RETURNS$
* <cReducedString> is a string where the characters specified
* in <cDeleteThisCharacters> are deleted
* $DESCRIPTION$
* The CHARREM() function deletes the characters specified in
* <cDeleteThisCharacters> from <cString>.
* $EXAMPLES$
* ? CHARREM(" ", " 1 2 ") // "12"
* ? CHARREM("3y", "xyz123") // "xz12"
* $TESTS$
* CHARREM(" ", " 1 2 ") == "12"
* CHARREM("3y", "xyz123") == "xz12"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARREM() is compatible with CT3's CHARREM().
* $PLATFORMS$
* All
* $FILES$
* Source is charonly.c, library is ct3.
* $SEEALSO$
* CHARONLY() WORDONLY() WORDREM()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* WORDREM()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Removes characters from a string
* $SYNTAX$
* WORDREM (<cDeleteThisDoubleCharacters>, <cString>) -> cReducedString
* $ARGUMENTS$
* <cDeleteThisDoubleCharacters> specifies the double characters that
* should be deleted in <cString>
* <cString>) is the string that should be processed
* $RETURNS$
* <cReducedString> is a string where the double characters
* specified in <cDeleteThisDoubleCharacters>
* are deleted
* $DESCRIPTION$
* The WORDREM() function deletes the double characters specified in
* <cDeleteThisDoubleCharacters> from <cString>.
* $EXAMPLES$
* ? WORDREM("abcd", "0ab1cd") // "0ab1"
* ? WORDREM("abcd", "ab0cd1") // "0cd1"
* $TESTS$
* WORDREM("abcd", "0ab1cd") == "0ab1"
* WORDREM("abcd", "ab0cd1") == "0cd1"
* $STATUS$
* Ready
* $COMPLIANCE$
* WORDREM() is a new function available only in Harbour's CT3.
* $PLATFORMS$
* All
* $FILES$
* Source is charonly.c, library is ct3.
* $SEEALSO$
* CHARONLY CHARREM() WORDREM()
* $END$
*/

View File

@@ -0,0 +1,243 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* CHARADD()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Adds corresponding ASCII value of two strings
* $SYNTAX$
* CHARADD (<[@]cString1>, <cString2>) --> cAddString
* $ARGUMENTS$
* <[@]cString1> first string
* <cString2> second string
* $RETURNS$
* <cAddString> string with added ASCII values
* $DESCRIPTION$
* The CHARADD() function constructs a new string from the two strings
* passed as parameters. To do this, it adds the ASCII values of the
* corresponding characters of both strings and places a character in
* the resulting string whose ASCII value equals to that sum (modulo 256).
* If the first string is passed by reference, the resulting string is
* stored in <cString1>, too. By setting the CSETREF()-switch to .T.,
* the return value can be omitted.
* If <cString2> is shorter than <cString1> and the last character of
* <cString2> has been processed, the function restarts with the first
* character of <cString2>.
* $EXAMPLES$
* ? charadd ("012345678", chr(1)) --> "123456789"
* ? charadd ("123456789", chr(255)) --> "012345678"
* ? charadd ("0000", chr(0)+chr(1)+chr(2)+chr(3)) --> "0123"
* $TESTS$
* charadd ("012345678", chr(1)) == "123456789"
* charadd ("012345678", chr(1)+chr(2)) == "133557799"
* charadd ("123456789", chr(255)) == "012345678"
* charadd ("123456789", chr(255)+chr(254)) == "002244668"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARADD() is compatible with CT3's CHARADD().
* $PLATFORMS$
* All
* $FILES$
* Source is charop.c, library is ct3.
* $SEEALSO$
* CHARSUB() CHARAND() CHARNOT()
* CHAROR() CHARXOR() CHARSHL()
* CHARSHR() CHARRLL() CHARRLR()
* CSETREF()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* CHARAND()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Combine corresponding ASCII value of two strings with bitwise AND
* $SYNTAX$
* CHARAND (<[@]cString1>, <cString2>) --> cAndString
* $ARGUMENTS$
* <[@]cString1> first string
* <cString2> second string
* $RETURNS$
* <cAndString> string with bitwise AND combined ASCII values
* $DESCRIPTION$
* The CHARAND() function constructs a new string from the two strings
* passed as parameters. To do this, it combines the ASCII values of the
* corresponding characters of both strings with a bitwise AND-operation
* and places a character in the resulting string whose ASCII value
* equals to the result of that operation.
* If the first string is passed by reference, the resulting string is
* stored in <cString1>, too. By setting the CSETREF()-switch to .T.,
* the return value can be omitted.
* If <cString2> is shorter than <cString1> and the last character of
* <cString2> has been processed, the function restarts with the first
* character of <cString2>.
* $EXAMPLES$
* // clear the LSB
* ? charand ("012345678", chr(254)) --> "002244668"
* ? charand ("012345678", chr(254)+chr(252)) --> "002044648"
* $TESTS$
* charand ("012345678", chr(254)) == "002244668"
* charand ("012345678", chr(254)+chr(252)) == "002044648"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARAND() is compatible with CT3's CHARAND().
* $PLATFORMS$
* All
* $FILES$
* Source is charop.c, library is ct3.
* $SEEALSO$
* CHARADD() CHARSUB() CHARNOT()
* CHAROR() CHARXOR() CHARSHL()
* CHARSHR() CHARRLL() CHARRLR()
* CSETREF()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* CHARNOT()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Process each character in a string with bitwise NOT operation
* $SYNTAX$
* CHARNOT (<[@]cString>) --> cNotString
* $ARGUMENTS$
* <[@]cString> string to be processed
* $RETURNS$
* <cNotString> string with bitwise negated characters
* $DESCRIPTION$
* The CHARNOT() function constructs a new string from the string
* passed as parameter. To do this, it performs a bitwise NOT operation
* to the characters of the string and places a character in
* the resulting string whose ASCII value equals to the result of that
* operation. It can be easily seen that the resulting ASCII-value equals
* 255 minus input ASCII value.
* If the string is passed by reference, the resulting string is
* stored in <cString>, too. By setting the CSETREF()-switch to .T.,
* the return value can be omitted.
* $EXAMPLES$
* ? charnot (chr(85)+chr(128)+chr(170)+chr(1)) --> chr(170)+chr(127)+chr(85)+chr(254)
* ? charnot (charnot ("This is a test!")) --> "This is a test!"
* $TESTS$
* charnot (chr(85)+chr(128)+chr(170)+chr(1)) == chr(170)+chr(127)+chr(85)+chr(254)
* charnot (charnot ("This is a test!")) == "This is a test!"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARNOT() is compatible with CT3's CHARNOT().
* $PLATFORMS$
* All
* $FILES$
* Source is charop.c, library is ct3.
* $SEEALSO$
* CHARADD() CHARSUB() CHARAND()
* CHAROR() CHARXOR() CHARSHL()
* CHARSHR() CHARRLL() CHARRLR()
* CSETREF()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* CHAROR()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Combine corresponding ASCII value of two strings with bitwise OR
* $SYNTAX$
* CHAROR (<[@]cString1>, <cString2>) --> cOrString
* $ARGUMENTS$
* <[@]cString1> first string
* <cString2> second string
* $RETURNS$
* <cOrString> string with bitwise OR combined ASCII values
* $DESCRIPTION$
* The CHAROR() function constructs a new string from the two strings
* passed as parameters. To do this, it combines the ASCII values of the
* corresponding characters of both strings with a bitwise OR-operation
* and places a character in the resulting string whose ASCII value
* equals to the result of that operation.
* If the first string is passed by reference, the resulting string is
* stored in <cString1>, too. By setting the CSETREF()-switch to .T.,
* the return value can be omitted.
* If <cString2> is shorter than <cString1> and the last character of
* <cString2> has been processed, the function restarts with the first
* character of <cString2>.
* $EXAMPLES$
* // set the LSB
* ? charor ("012345678", chr(1)) --> "113355779"
* ? charor ("012345678", chr(1)+chr(3)) --> "133357779"
* $TESTS$
* charor ("012345678", chr(1)) == "113355779"
* charor ("012345678", chr(1)+chr(3)) == "133357779"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHAROR() is compatible with CT3's CHAROR().
* $PLATFORMS$
* All
* $FILES$
* Source is charop.c, library is ct3.
* $SEEALSO$
* CHARADD() CHARSUB() CHARNOT()
* CHARAND() CHARXOR() CHARSHL()
* CHARSHR() CHARRLL() CHARRLR()
* CSETREF()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* CHARXOR()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Combine corresponding ASCII value of two strings with bitwise XOR
* $SYNTAX$
* CHARXOR (<[@]cString1>, <cString2>) --> cXOrString
* $ARGUMENTS$
* <[@]cString1> first string
* <cString2> second string
* $RETURNS$
* <cXOrString> string with bitwise XOR combined ASCII values
* $DESCRIPTION$
* The CHARXOR() function constructs a new string from the two strings
* passed as parameters. To do this, it combines the ASCII values of the
* corresponding characters of both strings with a bitwise XOR-operation
* and places a character in the resulting string whose ASCII value
* equals to the result of that operation.
* If the first string is passed by reference, the resulting string is
* stored in <cString1>, too. By setting the CSETREF()-switch to .T.,
* the return value can be omitted.
* If <cString2> is shorter than <cString1> and the last character of
* <cString2> has been processed, the function restarts with the first
* character of <cString2>.
* $EXAMPLES$
* // easy encryption
* ? charxor ("This is top secret !", "My Password") --> <encrypted sentence>
* $TESTS$
* charxor (charxor ("This is top secret !", "My Password"), "My Password") == "This is top secret !"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARXOR() is compatible with CT3's CHARXOR().
* $PLATFORMS$
* All
* $FILES$
* Source is charop.c, library is ct3.
* $SEEALSO$
* CHARADD() CHARSUB() CHARNOT()
* CHARAND() CHAROR() CHARSHL()
* CHARSHR() CHARRLL() CHARRLR()
* CSETREF()
* $END$
*/

View File

@@ -0,0 +1,237 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* CHARSUB()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Subtracts corresponding ASCII value of two strings
* $SYNTAX$
* CHARSUB (<[@]cString1>, <cString2>) --> cSubString
* $ARGUMENTS$
* <[@]cString1> first string
* <cString2> second string
* $RETURNS$
* <cSubString> string with subtracted ASCII values
* $DESCRIPTION$
* The CHARSUB() function constructs a new string from the two strings
* passed as parameters. To do this, it subtracts the ASCII values of the
* corresponding characters of both strings and places a character in
* the resulting string whose ASCII value equals to that difference (modulo 256).
* If the first string is passed by reference, the resulting string is
* stored in <cString1>, too. By setting the CSETREF()-switch to .T.,
* the return value can be omitted.
* If <cString2> is shorter than <cString1> and the last character of
* <cString2> has been processed, the function restarts with the first
* character of <cString2>.
* $EXAMPLES$
* ? charsub ("012345678", chr(1)) --> "/01234567"
* ? charsub ("123456789", chr(255)) --> "23456789:"
* ? charsub ("9999", chr(0)+chr(1)+chr(2)+chr(3)) --> "9876"
* $TESTS$
* charsub ("123456789", chr(1)) == "012345678"
* charsub ("123456789", chr(1)+chr(2)) == "002244668"
* charsub ("012345678", chr(255)) == "123456789"
* charsub ("012345678", chr(255)+chr(254)) == "133557799"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARSUB() is a new function that is only available in Harbour's CT3 lib.
* $PLATFORMS$
* All
* $FILES$
* Source is charop.c, library is ct3.
* $SEEALSO$
* CHARADD() CHARAND() CHARNOT()
* CHAROR() CHARXOR() CHARSHL()
* CHARSHR() CHARRLL() CHARRLR()
* CSETREF()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* CHARSHL()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Process each character in a string with bitwise SHIFT LEFT operation
* $SYNTAX$
* CHARSHL (<[@]cString>, <nBitsToSHL> ) --> cSHLString
* $ARGUMENTS$
* <[@]cString> string to be processed
* <nBitsToSHL> number of bit positions to be shifted to the left
* $RETURNS$
* <cSHLString> string with bitwise shifted left characters
* $DESCRIPTION$
* The CHARSHL() function constructs a new string from the string
* passed as parameter. To do this, it performs a bitwise SHIFT LEFT
* (SHL) operation to the characters of the string and places a character in
* the resulting string whose ASCII value equals to the result of that
* operation.
* Be aware that bits shifted out of the byte are lost. If you need
* a bit rotation, use the CHARRLL() function instead.
* If the string is passed by reference, the resulting string is
* stored in <cString>, too. By setting the CSETREF()-switch to .T.,
* the return value can be omitted.
* $EXAMPLES$
* ? charshl (chr(1)+chr(2)+chr(4)+chr(8)+chr(16)+chr(32)+chr(64)+chr(128), 3)
* --> chr(8)+chr(16)+chr(32)+chr(64)+chr(128)+chr(0)+chr(0)+chr(0)
* $TESTS$
* charshl (chr(1)+chr(2)+chr(4)+chr(8)+chr(16)+chr(32)+chr(64)+chr(128), 3) == chr(8)+chr(16)+chr(32)+chr(64)+chr(128)+chr(0)+chr(0)+chr(0)
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARSHL() is a new function that is only available in Harbour's CT3 lib.
* $PLATFORMS$
* All
* $FILES$
* Source is charop.c, library is ct3.
* $SEEALSO$
* CHARADD() CHARSUB() CHARAND()
* CHAROR() CHARXOR() CHARNOT()
* CHARSHR() CHARRLL() CHARRLR()
* CSETREF()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* CHARSHR()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Process each character in a string with bitwise SHIFT RIGHT operation
* $SYNTAX$
* CHARSHR (<[@]cString>, <nBitsToSHR> ) --> cSHRString
* $ARGUMENTS$
* <[@]cString> string to be processed
* <nBitsToSHR> number of bit positions to be shifted to the right
* $RETURNS$
* <cSHRString> string with bitwise shifted right characters
* $DESCRIPTION$
* The CHARSHR() function constructs a new string from the string
* passed as parameter. To do this, it performs a bitwise SHIFT RIGHT
* (SHR) operation to the characters of the string and places a character in
* the resulting string whose ASCII value equals to the result of that
* operation.
* Be aware that bits shifted out of the byte are lost. If you need
* a bit rotation, use the CHARRLR() function instead.
* If the string is passed by reference, the resulting string is
* stored in <cString>, too. By setting the CSETREF()-switch to .T.,
* the return value can be omitted.
* $EXAMPLES$
* ? charshr (chr(1)+chr(2)+chr(4)+chr(8)+chr(16)+chr(32)+chr(64)+chr(128), 3)
* --> chr(0)+chr(0)+chr(0)+chr(1)+chr(2)+chr(4)+chr(8)+chr(16)
* $TESTS$
* charshr (chr(1)+chr(2)+chr(4)+chr(8)+chr(16)+chr(32)+chr(64)+chr(128), 3) == chr(0)+chr(0)+chr(0)+chr(1)+chr(2)+chr(4)+chr(8)+chr(16)
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARSHR() is a new function that is only available in Harbour's CT3 lib.
* $PLATFORMS$
* All
* $FILES$
* Source is charop.c, library is ct3.
* $SEEALSO$
* CHARADD() CHARSUB() CHARAND()
* CHAROR() CHARXOR() CHARNOT()
* CHARSHL() CHARRLL() CHARRLR()
* CSETREF()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* CHARRLL()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Process each character in a string with bitwise ROLL LEFT operation
* $SYNTAX$
* CHARRLL (<[@]cString>, <nBitsToRLL> ) --> cRLLString
* $ARGUMENTS$
* <[@]cString> string to be processed
* <nBitsToRLL> number of bit positions to be rolled to the left
* $RETURNS$
* <cRLLString> string with bitwise rolled left characters
* $DESCRIPTION$
* The CHARRLL() function constructs a new string from the string
* passed as parameter. To do this, it performs a bitwise ROLL LEFT
* (RLL) operation to the characters of the string and places a character in
* the resulting string whose ASCII value equals to the result of that
* operation.
* Be aware that, in contrast to CHARSHL(), bits rolled out on
* the left are put in again on the right.
* If the string is passed by reference, the resulting string is
* stored in <cString>, too. By setting the CSETREF()-switch to .T.,
* the return value can be omitted.
* $EXAMPLES$
* ? charrll (chr(1)+chr(2)+chr(4)+chr(8)+chr(16)+chr(32)+chr(64)+chr(128), 3)
* --> chr(8)+chr(16)+chr(32)+chr(64)+chr(128)+chr(1)+chr(2)+chr(4)
* $TESTS$
* charrll (chr(1)+chr(2)+chr(4)+chr(8)+chr(16)+chr(32)+chr(64)+chr(128), 3) == chr(8)+chr(16)+chr(32)+chr(64)+chr(128)+chr(1)+chr(2)+chr(4)
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARRLL() is a new function that is only available in Harbour's CT3 lib.
* $PLATFORMS$
* All
* $FILES$
* Source is charop.c, library is ct3.
* $SEEALSO$
* CHARADD() CHARSUB() CHARAND()
* CHAROR() CHARXOR() CHARNOT()
* CHARSHL() CHARSHR() CHARRLR()
* CSETREF()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* CHARRLR()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Process each character in a string with bitwise ROLL RIGHT operation
* $SYNTAX$
* CHARRLR (<[@]cString>, <nBitsToRLR> ) --> cRLRString
* $ARGUMENTS$
* <[@]cString> string to be processed
* <nBitsToRLR> number of bit positions to be rolled to the right
* $RETURNS$
* <cRLRString> string with bitwise rolled right characters
* $DESCRIPTION$
* The CHARRLR() function constructs a new string from the string
* passed as parameter. To do this, it performs a bitwise ROLL RIGHT
* (RLR) operation to the characters of the string and places a character in
* the resulting string whose ASCII value equals to the result of that
* operation.
* Be aware that, in contrast to CHARSHR(), bits rolled out on
* the right are put in again on the left.
* If the string is passed by reference, the resulting string is
* stored in <cString>, too. By setting the CSETREF()-switch to .T.,
* the return value can be omitted.
* $EXAMPLES$
* ? charrlr (chr(1)+chr(2)+chr(4)+chr(8)+chr(16)+chr(32)+chr(64)+chr(128), 3)
* --> chr(32)+chr(64)+chr(128)+chr(1)+chr(2)+chr(4)+chr(8)+chr(16)
* $TESTS$
* charrlr (chr(1)+chr(2)+chr(4)+chr(8)+chr(16)+chr(32)+chr(64)+chr(128), 3) == chr(32)+chr(64)+chr(128)+chr(1)+chr(2)+chr(4)+chr(8)+chr(16)
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARRLR() is a new function that is only available in Harbour's CT3 lib.
* $PLATFORMS$
* All
* $FILES$
* Source is charop.c, library is ct3.
* $SEEALSO$
* CHARADD() CHARSUB() CHARAND()
* CHAROR() CHARXOR() CHARNOT()
* CHARSHL() CHARSHR() CHARRLL()
* CSETREF()
* $END$
*/

View File

@@ -0,0 +1,67 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* CHARREPL()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Replacement of characters
* $SYNTAX$
* CHARREPL (<cSearchString>, <[@]cString>,
* <cReplaceString>, [<lMode>]) -> cString
* $ARGUMENTS$
* <cSearchString> is a string of characters that should be replaced
* <[@]cString> is the processed string
* <cReplaceString> is a string of characters that replace the one
* of <cSearchString>
* [<lMode>] sets the replacement method (see description)
* Default: .F.
* $RETURNS$
* <cString> the processed string
* $DESCRIPTION$
* The CHARREPL() function replaces certain characters in <cString>
* with others depending on the setting of <lMode>.
* If <lMode> is set to .F., the function takes the characters of
* <cSearchString> one after the other, searches for them in <cString>
* and, if successful, replaces them with the corresponding character
* of <cReplaceString>. Be aware that if the same characters occur
* in both <cSearchString> and <cReplaceString>, the character on a
* certain position in <cString> can be replaced multiple times.
* if <lMode> is set to .T., the function takes the characters in <cString>
* one after the other, searches for them in <cSearchString> and, if
* successful, replaces them with the corresponding character of
* <cReplaceString>. Note that no multiple replacements are possible
* in this mode.
* If <cReplaceString> is shorter than <cSearchString>, the last
* character of <cReplaceString> is used as corresponding character
* for the the "rest" of <cSearchString>.
* One can omit the return value by setting the CSETREF() switch to .T.,
* but then one must pass <cString> by reference to get the result.
* $EXAMPLES$
* ? charrepl ("1234", "1x2y3z", "abcd") // "axbycz"
* ? charrepl ("abcdefghij", "jhfdb", "1234567890") // "08642"
* ? charrepl ("abcdefghij", "jhfdb", "12345") // "55542"
* ? charrepl ("1234", "1234", "234A") // "AAAA"
* ? charrepl ("1234", "1234", "234A", .T.) // "234A"
* $TESTS$
* charrepl ("1234", "1x2y3z", "abcd") == "axbycz"
* charrepl ("abcdefghij", "jhfdb", "1234567890") == "08642"
* charrepl ("abcdefghij", "jhfdb", "12345") == "55542"
* charrepl ("1234", "1234", "234A") == "AAAA"
* charrepl ("1234", "1234", "234A", .T.) == "234A"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARREPL() is compatible with CT3's CHARREPL().
* $PLATFORMS$
* All
* $FILES$
* Source is charrepl.c, library is ct3.
* $SEEALSO$
* WORDREPL() POSREPL() RANGEREPL()
* CSETREF()
* $END$
*/

View File

@@ -0,0 +1,84 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* CHARSORT()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Sort sequences within a string.
* $SYNTAX$
* CHARSORT (<[@]cString>, [<nElementLength>], [<nCompareLength>],
* [<nIgnoreCharacters>], [<nElemenOffset>], [<nSortLength>],
* [<lDescending>]) -> cSortedString
* $ARGUMENTS$
* <[@]cString> is the string that should be processed
* [<nElementLength>] specifies the length of the elements that
* should be sorted
* Default: 1
* [<nCompareLength>] specifies how many characters within one
* element should be used for comparison
* Default: <nElementLength>
* [<nIgnoreCharacters>] specifies the number of characters at the
* beginning of <cString> that should be ignored
* in the sort process
* Default: 0
* [<nElementOffset>] specifies the offset of the comparison string
* within a element
* Default: 0
* [<nSortLength>] specifies how many characters in <cString>,
* starting from the <nIgnoreCharacters> position,
* should be sorted
* Default: len(cString)-nIgnoreCharacters
* [<lDescending>]) specifies whether the process should
* sort descending or not
* $RETURNS$
* <cSortedString> the string resulting from the sort process
* $DESCRIPTION$
* The CHARSORT function sorts the characters within a string <cString>.
* With the parameters <nIgnoreCharacters> and <nSortLength>, you can
* determine that only the substring from position <nIgnoreCharacters>+1
* to position <nIgnoreCharacters>+<nSortLength> within <cString> should
* be sorted.
* The sorting algorithm is determined with the other parameters.
* <nElementLength> specifies the length of one element, i.e. there are
* <nSortLength>/<nElementLength> elements that are sorted. Note that
* surplus characters are not sorted but stay at their position.
* To do the sorting, the function uses the Quicksort algorithm implemented
* in the C-lib qsort() function. This algorithm needs to know how to compare
* and order two elements. This is done by comparing the ASCII values of
* a substring within each element. This substring is determined by the
* parameters <nElementOffset> and <nCompareLength> and the order
* by <lDescending>.
* By setting the CSETREF() switch to .T., one can omit the return value
* of the function, but one must then pass <cString> by reference.
* $EXAMPLES$
* ? CHARSORT("qwert") // "eqrtw"
* ? CHARSORT("qwert", 2) // "erqwt"
* ? CHARSORT("b1a4a3a2a1", 2, 1) // "a2a1a3a4b1"
* ? CHARSORT("XXXqwert", 1, 1, 3) // "XXXeqrtw"
* ? CHARSORT("b1a4a3a2a1", 2, 1, 0, 1) // "a1b1a2a3a4"
* ? CHARSORT("384172852", 1, 1, 0, 0, 4) // "134872852"
* ? CHARSORT("qwert", .T.) // "wtrqe"
* $TESTS$
* CHARSORT("qwert") == "eqrtw"
* CHARSORT("qwert", 2) == "erqwt"
* CHARSORT("b1a4a3a2a1", 2, 1) == "a2a1a3a4b1"
* CHARSORT("XXXqwert", 1, 1, 3) == "XXXeqrtw"
* CHARSORT("b1a4a3a2a1", 2, 1, 0, 1) == "a1b1a2a3a4"
* CHARSORT("384172852", 1, 1, 0, 0, 4) == "134872852"
* CHARSORT("qwert", .T.) == "wtrqe"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARSORT() is compatible with CT3's CHARSORT().
* $PLATFORMS$
* All
* $FILES$
* Source is charsort.c, library is ct3.
* $SEEALSO$
* CSETREF()
* $END$
*/

View File

@@ -0,0 +1,85 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* CHARSWAP()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Swap neighbouring characters in a string
* $SYNTAX$
* CHARSWAP (<[@]cString>) -> cSwappedString
* $ARGUMENTS$
* <[@]cString> is the string that should be processed
* $RETURNS$
* <cSwappedString> a string where neighbour characters are swapped
* $DESCRIPTION$
* The CHARSWAP() function loops through <cString> in steps of two
* characters and exchanges the characters from the odd and the even
* positions.
* By setting the CSETREF() switch to .T., one can omit the return value
* of this functin, but one must then pass <cString> by reference.
* $EXAMPLES$
* ? CHARSWAP("0123456789") // "1032547698"
* ? CHARSWAP("ABCDEFGHIJK") // "BADCFEHGJIK"
* $TESTS$
* CHARSWAP("0123456789") == "1032547698"
* CHARSWAP("ABCDEFGHIJK") == "BADCFEHGJIK"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARSWAP() is compatible with CT3's CHARSWAP().
* $PLATFORMS$
* All
* $FILES$
* Source is charswap.c, library is libct.
* $SEEALSO$
* WORDSWAP(),CSETREF()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* WORDSWAP()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Swap neighbouring double characters in a string
* $SYNTAX$
* WORDSWAP (<[@]cString> [, <lSwapCharacters>]) -> cSwappedString
* $ARGUMENTS$
* <[@]cString> is the string that should be processed
* [<lSwapCharacters>] specifies whether an additional swap should be
* done within the double characters
* Default: .F., no additional swap
* $RETURNS$
* <cSwappedString> a string where neighbouring double characters are
* swapped
* $DESCRIPTION$
* The WORDSWAP() function loops through <cString> in steps of four
* characters and exchanges the double characters from the first and
* second position with the one from the third and forth position.
* Additionally the function can perform a swap of the both char of
* each double character.
* By setting the CSETREF() switch to .T., one can omit the return value
* of this functin, but one must then pass <cString> by reference.
* $EXAMPLES$
* ? WORDSWAP("1234567890") // "3412785690"
* ? WORDSWAP("1234567890", .t.) // "4321876590"
* $TESTS$
* WORDSWAP("1234567890") == "3412785690"
* WORDSWAP("1234567890", .t.) == "4321876590"
* $STATUS$
* Ready
* $COMPLIANCE$
* WORDSWAP() is compatible with CT3's WORDSWAP().
* $PLATFORMS$
* All
* $FILES$
* Source is charswap.c, library is libct.
* $SEEALSO$
* CHARSWAP(),CSETREF()
* $END$
*/

View File

@@ -0,0 +1,219 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* INVERTATTR()
* $CATEGORY$
* CT3 video functions
* $ONELINER$
*
* $SYNTAX$
*
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* INVERTATTR() is compatible with CT3's INVERTATTR().
* $PLATFORMS$
* All
* $FILES$
* Source is color.c, library is libct.
* $SEEALSO$
*
* $END$
*/
/* $DOC$
* $FUNCNAME$
* COLORTON()
* $CATEGORY$
* CT3 video functions
* $ONELINER$
*
* $SYNTAX$
* COLORTON ( <cAttr> ) -> <nAttr>
* $ARGUMENTS$
* <cAttr> Designates the alphanumeric color attribute that is
* converted in NN/NN or CC/CC form.
*
* $RETURNS$
* COLORTON() returns a number that corresponds to the combined numeric
* color attribute.
*
* $DESCRIPTION$
* COLOR TO (N)umeric
* The function changes an alphanumeric color attribute from NN/NN or
* CC/CC into a combined numeric attribute. These combined attribute
* values are useful with the CA-Cl*pper Tools functions STRSCREEN(),
* SCREENMIX(), SCREENATTR(), and the CA-Cl*pper commands
* SAVE/RESTORE SCREEN.
*
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
*
* $PLATFORMS$
* All
* $FILES$
* Source is color.c, library is libct.
* $SEEALSO$
*
* $END$
*/
/* $DOC$
* $FUNCNAME$
* NTOCOLOR()
* $CATEGORY$
* HBCT video functions
* $ONELINER$
*
* $SYNTAX$
* NTOCOLOR ( <nAttr>, [<lColorCode>] ) -> <cAttr>
* $ARGUMENTS$
* <nAttr> Designates the value for the combined numeric color
* attributes.
*
* <lColorCode> If designated as .F. or if the parameter is omitted,
* NTOCOLOR() returns a string with a numeric color code.
* When designated as .T., NTOCOLOR() returns a string with
* the CA-Cl*pper alpha color coding.
*
* $RETURNS$
* NTOCOLOR() returns the designated color attribute in the NN/NN
* or CC/CC form.
*
* $DESCRIPTION$
* NTOCOLOR() converts a color attribute returned from another function
* in numeric form, into the alphanumeric data format. Use this
* attribute in conjunction with the CA-Cl*pper SET COLOR TO command.
*
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
*
* $PLATFORMS$
* All
* $FILES$
* Source is color.c, library is libct.
* $SEEALSO$
*
* $END$
*/
/* $DOC$
* $FUNCNAME$
* ENHANCED()
* $CATEGORY$
* CT3 video functions
* $ONELINER$
* Select the "ENHANCED" color value for output
* $SYNTAX$
* ENHANCED () -> <cEmptyString>
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* ENHANCED() is compatible with CT3's ENHANCED()
* $PLATFORMS$
* All
* $FILES$
* Source is color.c, library is libct.
* $SEEALSO$
* STANDARD(),UNSELECTED()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* STANDARD()
* $CATEGORY$
* CT3 video functions
* $ONELINER$
* Select the "STANDARD" color value for output
* $SYNTAX$
* STANDARD () -> <cEmptyString>
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* STANDARD() is compatible with CT3's STANDARD()
* $PLATFORMS$
* All
* $FILES$
* Source is color.c, library is libct.
* $SEEALSO$
* ENHANCED(),UNSELECTED()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* UNSELECTED()
* $CATEGORY$
* CT3 video functions
* $ONELINER$
* Select the "UNSELECTED" color value for output
* $SYNTAX$
* UNSELECTED () -> <cEmptyString>
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* UNSELECTED() is compatible with CT3's UNSELECTED()
* $PLATFORMS$
* All
* $FILES$
* Source is color.c, library is libct.
* $SEEALSO$
* ENHANCED(),STANDARD()
* $END$
*/

View File

@@ -0,0 +1,67 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* COUNTLEFT()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Count a certain character at the beginning of a string
* $SYNTAX$
* COUNTLEFT (<cString>, [<cSearch|nSearch>]) -> nCount
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* COUNTLEFT() is compatible with CT3's COUNTLEFT().
* $PLATFORMS$
* All
* $FILES$
* Source is count.c, library is libct.
* $SEEALSO$
* COUNTRIGHT()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* COUNTRIGHT()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Count a certain character at the end of a string
* $SYNTAX$
* COUNTRIGHT (<cString>, [<cSearch|nSearch>]) -> nCount
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* COUNTRIGHT() is compatible with CT3's COUNTRIGHT().
* $PLATFORMS$
* All
* $FILES$
* Source is count.c, library is libct.
* $SEEALSO$
* COUNTLEFT()
* $END$
*/

View File

@@ -0,0 +1,75 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* CTINIT()
* $CATEGORY$
* CT3 general functions
* $ONELINER$
* Initializes the CT3 library
* $SYNTAX$
* CTINIT () -> lInitialized
* $ARGUMENTS$
* None
* $RETURNS$
* lInitialized .T. if the function has been correctly initialized
* $DESCRIPTION$
* The CTINIT() function initializes the CT3 library.
* Identical code is declared as INIT FUNCTION, thus should be executed
* automatically at the beginning of the application, but it is a good
* idea to call it once again explicitly somewhere at the beginning of
* your program to check the initialization.
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Ready
* $COMPLIANCE$
* CTINIT() is a new function in Harbour's CT3 library.
* $PLATFORMS$
* All
* $FILES$
* Source is ct.prg, library is libct.
* $SEEALSO$
*
* $END$
*/
/* $DOC$
* $FUNCNAME$
* CTEXIT()
* $CATEGORY$
* CT3 general functions
* $ONELINER$
* Uninitializes the CT3 library
* $SYNTAX$
* CTEXIT () -> nil
* $ARGUMENTS$
* none
* $RETURNS$
* nil
* $DESCRIPTION$
* The CTEXIT() function uninitializes the CT3 library.
* Identical code is declared as EXIT FUNCTION, thus should be executed
* automatically at the end of the application, but it is a good idea
* to call it explicitly somewhere at the end of your program to make
* sure that the deinitialization takes place.
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Ready
* $COMPLIANCE$
* CTEXIT() is a new function in Harbour's CT3 library.
* $PLATFORMS$
* All
* $FILES$
* Source is ct.prg, library is libct.
* $SEEALSO$
*
* $END$
*/

View File

@@ -0,0 +1,112 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* CSETARGERR()
* $CATEGORY$
* CT3 general functions
* $ONELINER$
* Sets argument error behaviour
* $SYNTAX$
* CSETARGERR ([<nNewMode>]) -> <nOldMode>
* $ARGUMENTS$
* [<nNewMode>] New argument error throwing mode
* $RETURNS$
* <nOldMode> The current or old argument error throwing mode.
* $DESCRIPTION$
* All CT3 functions are very compliant in their reaction to wrong
* parameters. By using the CSETARGERR() function, you can make the
* library throw an error with the severity <nNewMode>. It is then
* up to the error handler to substitute the return value.
* <nNewMode> can be one of the severity modes defined in ct.ch:
* CT_ARGERR_WHOCARES corresponds to ES_WHOCARES
* CT_ARGERR_WARNING corresponds to ES_WARNING
* CT_ARGERR_ERROR corresponds to ES_ERROR
* CT_ARGERR_CATASTROPHIC corresponds to ES_CATASTROPHIC
* CT_ARGERR_IGNORE
* The last is the default behaviour and switches any argument error
* throwing off.
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Ready
* $COMPLIANCE$
* CSETARGERR() is a new function in Harbour's CT3 library.
* $PLATFORMS$
* All
* $FILES$
* Source is ct.c, library is libct.
* $SEEALSO$
*
* $END$
*/
/* $DOC$
* $FUNCNAME$
* CTCINIT()
* $CATEGORY$
* CT3 general functions
* $ONELINER$
* Initializes the CT3 library, C part
* $SYNTAX$
* CTCINIT () -> lInitialized
* $ARGUMENTS$
* None
* $RETURNS$
* lInitialized .T. if the function has been correctly initialized
* $DESCRIPTION$
* The CTCINIT() function initializes the C source part of the CT3
* library. Do not call this function directly.
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Ready
* $COMPLIANCE$
* CTCINIT() is a new function in Harbour's CT3 library.
* $PLATFORMS$
* All
* $FILES$
* Source is ctc.c, library is libct.
* $SEEALSO$
* CTINIT(),CTEXIT()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* CTCEXIT()
* $CATEGORY$
* CT3 general functions
* $ONELINER$
* Uninitializes the CT3 library, C part
* $SYNTAX$
* CTCEXIT () -> nil
* $ARGUMENTS$
* none
* $RETURNS$
* nil
* $DESCRIPTION$
* The CTCEXIT() function uninitializes the C part of the CT3 library.
* Do not call this function directly.
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Ready
* $COMPLIANCE$
* CTCEXIT() is a new function in Harbour's CT3 library.
* $PLATFORMS$
* All
* $FILES$
* Source is ctc.c, library is libct.
* $SEEALSO$
* CTINIT(),CTEXIT()
* $END$
*/

View File

@@ -0,0 +1,69 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* SETPREC()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Set precision of math functions
* $SYNTAX$
* SETPREC (<nPrecision>) -> cEmptyString
* $ARGUMENTS$
* <nPrecision> digit count between 1 and 16, defaults to 16
* $RETURNS$
* cEmptyString this function always returns an empty string
* $DESCRIPTION$
* Be aware that calls to this functions do _NOT_ affect the
* calculation precision of the math functions at the moment.
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Ready
* $COMPLIANCE$
* SETPREC() is compatible with CT3's SETPREC.
* $PLATFORMS$
* All
* $FILES$
* Source is ctmath.c, library is ct3.
* $SEEALSO$
*
* $END$
*/
/* $DOC$
* $FUNCNAME$
* GETPREC()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Get precision of math functions
* $SYNTAX$
* GETPREC () -> nDigits
* $ARGUMENTS$
*
* $RETURNS$
* nDigits digit count between 1 and 16
* $DESCRIPTION$
* Be aware that calls to this functions do _NOT_ affect the
* calculation precision of the math functions at the moment.
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Ready
* $COMPLIANCE$
* GETPREC() is compatible with CT3's GETPREC.
* $PLATFORMS$
* All
* $FILES$
* Source is ctmath.c, library is ct3.
* $SEEALSO$
*
* $END$
*/

View File

@@ -0,0 +1,186 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* FLOOR()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Rounds down a number to the next integer
* $SYNTAX$
* FLOOR (nNumber) -> nDownRoundedNumber
* $ARGUMENTS$
* <nNumber> number to round down
* $RETURNS$
* <nDownRoundedNumber> the rounded number
* $DESCRIPTION$
* The function FLOOR() determines the biggest integer that is smaller
* than <nNumber>.
* $EXAMPLES$
* ? floor (1.1) --> 1.0
* ? floor (-1.1) --> -2.0
* $TESTS$
* floor (1.1) == 1.0
* floor (-1.1) == -2.0
* $STATUS$
* Ready
* $COMPLIANCE$
* FLOOR() is compatible with CT3's FLOOR().
* $PLATFORMS$
* All
* $FILES$
* Source is math.c, library is libct.
* $SEEALSO$
* CEILING
* $END$
*/
/* $DOC$
* $FUNCNAME$
* CEILING()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Rounds up a number to the next integer
* $SYNTAX$
* CEILING (nNumber) -> nUpRoundedNumber
* $ARGUMENTS$
* <nNumber> number to round up
* $RETURNS$
* <nUpRoundedNumber> the rounded number
* $DESCRIPTION$
* The function CEILING() determines the smallest integer that is bigger
* than <nNumber>.
* $EXAMPLES$
* ? ceiling (1.1) --> 2.0
* ? ceiling (-1.1) --> -1.0
* $TESTS$
* ceiling (1.1) == 2.0
* ceiling (-1.1) == -1.0
* $STATUS$
* Ready
* $COMPLIANCE$
* CEILING() is compatible with CT3's CEILING().
* $PLATFORMS$
* All
* $FILES$
* Source is math.c, library is libct.
* $SEEALSO$
* FLOOR
* $END$
*/
/* $DOC$
* $FUNCNAME$
* SIGN()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Sign of a number
* $SYNTAX$
* SIGN (nNumber) -> nSign
* $ARGUMENTS$
* <nNumber> a number
* $RETURNS$
* <nSign> sign of <nNumber>
* $DESCRIPTION$
* The function SIGN() determines the sign of <nNumber>.
* If <nNumber> is > 0, then SIGN(<nNumber>) returns 1
* If <nNumber> is < 0, then SIGN(<nNumber>) returns -1
* If <nNumber> is == 0, then SIGN(<nNumber>) returns 0
* $EXAMPLES$
* ? sign (1.1) --> 1
* ? sign (-1.1) --> -1
* ? sign (0.0) --> 0
* $TESTS$
* sign (1.1) == 1
* sign (-1.1) == -1
* sign (0.0) == 0
* $STATUS$
* Ready
* $COMPLIANCE$
* SIGN() is compatible with CT3's SIGN().
* $PLATFORMS$
* All
* $FILES$
* Source is math.c, library is libct.
* $SEEALSO$
*
* $END$
*/
/* $DOC$
* $FUNCNAME$
* LOG10()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Decadic logarithm of a number
* $SYNTAX$
* LOG10 (nNumber) -> nLogarithm
* $ARGUMENTS$
* <nNumber> number to logarithm
* $RETURNS$
* <nLogarithm> decadic logarithm of <nNumber>
* $DESCRIPTION$
* The function LOG10() calculates the decadic logarithm of <nNumber>,
* i.e. 10^<nLogarithm> == <nNumber>.
* $EXAMPLES$
* ? log10 (10.0) --> 1.0
* ? log10 (sqrt(10.0)) --> 0.5
* $TESTS$
* log10 (10.0) == 1.0
* log10 (sqrt(10.0)) == 0.5
* $STATUS$
* Ready
* $COMPLIANCE$
* LOG10() is compatible with CT3's LOG10().
* $PLATFORMS$
* All
* $FILES$
* Source is math.c, library is libct.
* $SEEALSO$
*
* $END$
*/
/* $DOC$
* $FUNCNAME$
* FACT()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Calculates faculty
* $SYNTAX$
* FACT (nNumber) -> nFaculty
* $ARGUMENTS$
* <nNumber> number between 0 and 21
* $RETURNS$
* <nFaculty> the faculty of <nNumber>
* $DESCRIPTION$
* The function FACT() calculates the faculty to the integer given in
* <nNumber>. The faculty is defined as n! = 1*2*...*n and is often
* used in statistics. Note, that faculties above 21 are too big
* so that the function must return a -1.
* $EXAMPLES$
* ? fact (0) --> 1
* ? fact (1) --> 1
* ? fact (4) --> 24
* $TESTS$
* fact (0) == 1
* fact (1) == 1
* fact (4) == 24
* $STATUS$
* Ready
* $COMPLIANCE$
* FACT() is compatible with CT3's FACT().
* $PLATFORMS$
* All
* $FILES$
* Source is math.c, library is libct.
* $SEEALSO$
*
* $END$
*/

View File

@@ -0,0 +1,67 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* PADLEFT()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Fills string to a certain length on the left
* $SYNTAX$
* PADLEFT (<cString>,<nLength>, [<cChar|nChar>]) -> cString
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* PADLEFT() is compatible with CT3's PADLEFT().
* $PLATFORMS$
* All
* $FILES$
* Source is pad.c, library is libct.
* $SEEALSO$
* PADRIGHT()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* PADRIGHT()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Fills string to a certain length on the right
* $SYNTAX$
* PADRIGHT (<cString>,<nLength>, [<cChar|nChar>]) -> cString
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* PADRIGHT() is compatible with CT3's PADRIGHT().
* $PLATFORMS$
* All
* $FILES$
* Source is pad.c, library is libct.
* $SEEALSO$
* PADLEFT()
* $END$
*/

View File

@@ -0,0 +1,171 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* CSETREF()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Determine return value of reference sensitive CT3 string functions
* $SYNTAX$
* CSETREF ([<lNewSwitch>]) -> lOldSwitch
* $ARGUMENTS$
* [<lNewSwitch>] .T. -> suppress return value
* .F. -> do not suppress return value
* $RETURNS$
* lOldSwitch old (if lNewSwitch is a logical value) or
* current state of the switch
* $DESCRIPTION$
* Within the CT3 functions, the following functions do not
* change the length of a string passed as parameter while
* transforming this string:
*
* ADDASCII() BLANK() CHARADD()
* CHARAND() CHARMIRR() CHARNOT()
* CHAROR() CHARRELREP() CHARREPL()
* CHARSORT() CHARSWAP() CHARXOR()
* CRYPT() JUSTLEFT() JUSTRIGHT()
* POSCHAR() POSREPL() RANGEREPL()
* REPLALL() REPLLEFT() REPLRIGHT()
* TOKENLOWER() TOKENUPPER() WORDREPL()
* WORDSWAP()
*
* Thus, these functions allow to pass the string by reference [@] to
* the function so that it may not be necessary to return the transformed
* string. By calling CSETREF (.T.), the above mentioned functions return
* the value .F. instead of the transformed string if the string is
* passed by reference to the function.
* The switch is turned off (.F.) by default.
*
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Ready
* $COMPLIANCE$
* This function is fully CT3 compatible.
* $PLATFORMS$
* All
* $FILES$
* Source is ctstr.c, library is ct3.
* $SEEALSO$
* ADDASCII() BLANK() CHARADD()
* CHARAND() CHARMIRR() CHARNOT()
* CHAROR() CHARRELREP() CHARREPL()
* CHARSORT() CHARSWAP() CHARXOR()
* CRYPT() JUSTLEFT() JUSTRIGHT()
* POSCHAR() POSREPL() RANGEREPL()
* REPLALL() REPLLEFT() REPLRIGHT()
* TOKENLOWER() TOKENUPPER() WORDREPL()
* WORDSWAP()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* CSETATMUPA()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Determine "multi-pass" behaviour in some string functions
* $SYNTAX$
* CSETATMUPA ([<lNewSwitch>]) -> lOldSwitch
* $ARGUMENTS$
* [<lNewSwitch>] .T. -> turn "multi-pass" on
* .F. -> turn "multi-pass" off
* $RETURNS$
* lOldSwitch old (if lNewSwitch is a logical value) or
* current state of the switch
* $DESCRIPTION$
* CSETATMUPA determines how the following CT3 string functions
*
* ATNUM() AFTERATNUM() BEFORATNUM()
* ATREPL() NUMAT() ATADJUST()
* WORDTOCHAR() WORDREPL()
*
* perform their work. See the respective function documentation for a
* further description how the switch influences these functions.
*
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Ready
* $COMPLIANCE$
* This function is fully CT3 compatible.
* $PLATFORMS$
* All
* $FILES$
* Source is ctstr.c, library is ct3.
* $SEEALSO$
* ATNUM() AFTERATNUM() BEFORATNUM()
* ATREPL() NUMAT() ATADJUST()
* WORDTOCHAR() WORDREPL()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* SETATLIKE()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Determine scan behaviour in some string functions
* $SYNTAX$
* SETATLIKE ([<nMode>] [, <[@]cWildcard>]) --> nOldMode
* $ARGUMENTS$
* [<nMode>] CT_SETATLIKE_EXACT -> characters are compared exactly
* CT_SETATLIKE_WILDCARD -> characters are compared using
* a wildcard character
* The default value is CT_SETATLIKE_EXACT.
* [<[@]cWildcard>] determines the character that is subsequently used
* as a wildcard character for substring scanning.
* The default value is "?".
* NEW: If this parameter is passed by reference [@],
* the current wildcard character is stored in
* <cWildcard>.
* $RETURNS$
* nOldMode old (if nMode is a numeric value) or
* current state of the switch
* $DESCRIPTION$
* In the following CT3 functions, strings are compared on a character
* base:
*
* ATADJUST() ATNUM() AFTERATNUM()
* BEFOREATNUM() ATREPL() NUMAT()
* STRDIFF()
*
* With the SETATLIKE function, one can determine when characters are
* considered to match within these functions. If CT_SETATLIKE_WILDCARD
* is set (e.g. "?"), then "?" matches every other character.
*
* <nMode> can be one of the following values that are defined
* in ct.ch
*
* Definition | Value
* ----------------------|------
* CT_SETATLIKE_EXACT | 0
* CT_SETATLIKE_WILDCARD | 1
*
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Ready
* $COMPLIANCE$
* This function is fully CT3 compatible, but allows to pass the
* second parameter by reference so that the current wildcard character
* can be determined.
* $PLATFORMS$
* All
* $FILES$
* Source is ctstr.c, header is ct.ch, library is ct3.
* $SEEALSO$
*
* $END$
*/

View File

@@ -0,0 +1,195 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* BOM()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* _B_egin _O_f _M_onth
* $SYNTAX$
* BOM ([<dDate>]) -> dDateBeginOfMonth
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* BOM() is compatible with CT3's BOM().
* $PLATFORMS$
* All
* $FILES$
* Source is datetime.prg, library is libct.
* $SEEALSO$
* EOM(),BOQ(),EOQ(),BOY(),EOY()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* EOM()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* _E_nd _O_f _M_onth
* $SYNTAX$
* EOM ([<dDate>]) -> dDateEndOfMonth
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* EOM() is compatible with CT3's EOM().
* $PLATFORMS$
* All
* $FILES$
* Source is datetime.prg, library is libct.
* $SEEALSO$
* BOM(),BOQ(),EOQ(),BOY(),EOY()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* BOQ()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* _B_egin _O_f _Q_uarter
* $SYNTAX$
* BOQ ([<dDate>]) -> dDateBeginOfQuarter
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* BOQ() is compatible with CT3's BOQ().
* $PLATFORMS$
* All
* $FILES$
* Source is datetime.prg, library is libct.
* $SEEALSO$
* BOM(),EOM(),EOQ(),BOY(),EOY()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* EOQ()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* _E_nd _O_f _Q_uarter
* $SYNTAX$
* EOQ ([<dDate>]) -> dDateEndOfQuarter
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* EOQ() is compatible with CT3's EOQ().
* $PLATFORMS$
* All
* $FILES$
* Source is datetime.prg, library is libct.
* $SEEALSO$
* BOM(),EOM(),BOQ(),BOY(),EOY()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* BOY()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* _B_egin _O_f _Y_ear
* $SYNTAX$
* BOY ([<dDate>]) -> dDateBeginOfYear
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* BOY() is compatible with CT3's BOY().
* $PLATFORMS$
* All
* $FILES$
* Source is datetime.prg, library is libct.
* $SEEALSO$
* BOM(),EOM(),BOQ(),EOQ(),EOY()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* EOY()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* _E_nd _O_f _Y_ear
* $SYNTAX$
* EOY ([<dDate>]) -> dDateEndOfYear
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* EOY() is compatible with CT3's EOY().
* $PLATFORMS$
* All
* $FILES$
* Source is datetime.prg, library is libct.
* $SEEALSO$
* BOM(),EOM(),BOQ(),EOQ(),BOY()
* $END$
*/

View File

@@ -0,0 +1,474 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* CTODOW()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* convert name of day of the week to its ordinal number
* $SYNTAX$
* CTODOW (<cName>) -> nOrdinal
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* CTODOW() is compatible with CT3's CTODOW().
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
* NTOCDOW()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* CTOMONTH()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* convert name of month to its ordinal number
* $SYNTAX$
* CTOMONTH (<cName>) -> nOrdinal
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* CTOMONTH() is compatible with CT3's CTOMONTH().
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
* NTOCMONTH()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* DMY()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* Returns the date as a string in DD Month YY format
* $SYNTAX$
* DMY ([<dDate>][, <lMode>]) -> cDateString
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* Returns the date as a string in DD Month YY format. If lmode
* is TRUE, a "." is inserted after the DD
* TODO: add further documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* DMY() is compatible with CT3's DMY().
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
* MDY()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* MDY()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* Returns the date as a string in Month DD, YY or Month DD, YYYY
* $SYNTAX$
* MDY ([<dDate>]) -> cDateString
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* Returns the date as a string in Month DD, YY or Month DD, YYYY
* If dDate is NULL, the system date is used
* TODO: add further documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* MDY() is compatible with CT3's MDY().
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
* DMY()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* ADDMONTH()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* add months to a date
* $SYNTAX$
* ADDMONTH ([<dDate>,] <nMonths>) -> dShiftedDate
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* ADDMONTH() is compatible with CT3's ADDMOTH().
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
*
* $END$
*/
/* $DOC$
* $FUNCNAME$
* DOY()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* Determines the day of the year for a specific date
* $SYNTAX$
* DMY ([<dDate>]) -> nDayOfYear
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* Determines the day of the year for a specific date
* if dDate is invalid, returns 0
* TODO: add further documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* DOY() is compatible with CT3's DOY().
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
*
* $END$
*/
/* $DOC$
* $FUNCNAME$
* ISLEAP()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* determines of year of date is a leap year
* $SYNTAX$
* ISLEAP ([<dDate>]) -> lIsLeap
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add further documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* ISLEAP() is compatible with CT3's ISLEAP().
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
*
* $END$
*/
/* $DOC$
* $FUNCNAME$
* DAYSTOMONTH()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* Total number of days from first of Jan to beginning of nMonth.
* $SYNTAX$
* DAYSTOMONTH (<nMonth>, <lLeapYear>) -> nDaysToMonth
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* lLeap is FALSE for a non-leap year but TRUE if it is. If so and nMonth
* is greater than 2, ndays is incremented
* TODO: add further documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* DAYSTOMONTH() is a new function in Harbour's CT3 library.
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
* DAYSINMONTH()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* DAYSINMONTH()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* Returns the number of days in month
* $SYNTAX$
* DAYSINMONTH (<nMonth>, <lLeapYear>) -> nDaysInMonth
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* DAYSINMONTH() is a new function in Harbour's CT3 library.
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
* DAYSTOMONTH()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* QUARTER()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* Returns a number equal to the quarter in which a date falls
* $SYNTAX$
* QUARTER ([<dDate>]) -> nQuarter
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* Returns a number equal to the quarter in which ddate
* falls. If ddate is empty, the system date is employed.
* TODO: add further documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* QUARTER() is compatible with CT3's QUARTER().
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
*
* $END$
*/
/* $DOC$
* $FUNCNAME$
* LASTDAYOM()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* Returns the the number of days in the month.
* $SYNTAX$
* LASTDAYOM ([<dDate|nMonth>]) -> nDaysInMonth
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* <dDate|nMonth> can be a date or a month number. If empty uses the
* system date. If nMonth is a 2, lastdayom() will not know if it
* is a leap year or not. If dDate is invalid, returns 0
* TODO: add further documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* LASTDAYOM() is compatible with CT3's LASTDAYOM().
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
* EOM()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* NTOCDOW()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* (num of day) -> day name
* $SYNTAX$
* NTOCDOW (<nDay>) -> cDay
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* NTOCDOW() is compatible with CT3's NTOCDOW().
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
* CTODOW()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* NTOCMONTH()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* (num of month ) -> Month Name
* $SYNTAX$
* NTOCMONTH (<nMonth>) -> cMonth
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* NTOCMONTH() is compatible with CT3's NTOCMONTH().
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
* CTOMONTH()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* WEEK()
* $CATEGORY$
* CT3 date and time functions
* $ONELINER$
* Returns the calendar week a number
* $SYNTAX$
* WEEK ([<dDate>][, <lSWN>]) -> nWeek
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* Returns the calendar week a number. If no date is specified,
* the system date is used. An empty date viz ctod(" / / ")
* returns 0.
* If <lSWN> is .T., week() will calculate the "simple week number", defined by
* - week #1 starts on January, 1st
* - week #(n+1) starts seven days after start of week #n
* If <lSWN> is .F. (default), the ISO8601 week number, defined by
* - weeks start on mondays
* - week #1 is the one that includes January, 4
* will be calculated
* TODO: add further documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* WEEK() is compatible with CT3's WEEK().
* $PLATFORMS$
* All
* $FILES$
* Source is dattime2.prg, library is libct.
* $SEEALSO$
*
* $END$
*/

View File

@@ -0,0 +1,220 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* WAITPERIOD()
* $CATEGORY$
* HBCT date and time functions
* $ONELINER$
* Pauses a specified time in increments of 1/100 seconds
* $SYNTAX$
* WAITPERIOD([<nDelay>]) --> lNotElapsed
* $ARGUMENTS$
* <nDelay> Designates the waiting period at initialization in
* 1/100ths of seconds. Values from 1 to 8, 640, 000 (one day) are
* possible.
* $RETURNS$
* WAITPERIOD() returns .T. , if the time span designated at initialization
* has not elapsed.
* $DESCRIPTION$
* This function sets a time span for a xHarbour DO WHILE loop to run.
* The function must initialize prior to the loop, since you must specify
* the <nDelay> parameter in 1/100th seconds. Subsequently, the function
* can be implemented without a parameter for additional loop conditions.
* It returns .T., as long as the designated time span has not yet run out.
*
* Note
*
* The function notes the status of the internal timer at
* initialization. From that point on, the initialization should always
* precede the respective DO WHILE; otherwise, the time delay is
* incorrect. The passing of midnight (the time resets to the 0 value)
* is taken into account.
* $EXAMPLES$
* Run a loop for 5 seconds:
*
* WAITPERIOD(500) // Initialization, 5 seconds
* DO WHILE <cond1> .AND. <cond2> .AND. WAITPERIOD()
* *...
* ENDDO
* $TESTS$
*
* $STATUS$
* Ready
* $COMPLIANCE$
* WAITPERIOD() is Clipper Tools compatible.
* $PLATFORMS$
* Windows
* $FILES$
* Source is dattime3.c, library is libct.
* $SEEALSO$
*
* $END$
*/
/* $DOC$
* $FUNCNAME$
* TIMEVALID()
* $CATEGORY$
* HBCT Date and Time Functions
* $ONELINER$
* Determines whether a specIFied time is valid
* $SYNTAX$
* TIMEVALID(<cTime>) --> lValid
* $ARGUMENTS$
* <cTime> Designates a character string that contains the time to
* test.
* $RETURNS$
* TIMEVALID() RETURNs .T. when <cTime> is a valid time; or .F. when
* <cTime> is an invalid time.
* $DESCRIPTION$
* With input that requires time manipulation, writing your own UDF to
* check time inputs was unavoidable up to now. TIMEVALID() permits
* Complete checking of a time designation. You can use this FUNCTION
* effectively with a VALID clause within a READ mask.
*
* Note
*
* Note the format for time designations. There must always be
* two digits for hours, minutes, seconds, and hundredths; otherwise,
* the time it is regarded as invalid. Valid examples are "12",
* "12:59", "12:59:59", and "12:59:59:99". By contrast, invalid
* examples are "24", "12:60", or "12:1", and/or "12:". IF you work
* with time strings that are not completely filled and that you need to
* check with TIMEVALID(), then they must be TRIMmed prior to the use of
* TIMEVALID() (see following Examples).
* $EXAMPLES$
* Using the VALID clause with TRIM, all valid times are
* accepted, even IF no seconds or minutes are specIFied:
*
* cBegin := SPACE(11)
* @ 5, 10 SAY "Please input time for beginning work:";
* GET cBegin VALID TIMEVALID(TRIM(cBegin))
* READ
*
* Using a VALID clause without TRIM, hours and minutes must be
* specified, so that TIMEVALID() can confirm a valid time:
*
* cBegin := SPACE(5)
* @ 5, 10 SAY "Please input time for beginning work:";
* GET cBegin VALID TIMEVALID(cBegin)
* READ
* $TESTS$
*
* $STATUS$
* Ready
* $COMPLIANCE$
* This function is CA-Cl*pper Tools compatible.
* $PLATFORMS$
* Windows
* $FILES$
* Source is dattime3.c, library is libct.
* $SEEALSO$
* SETTIME()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* SETTIME()
* $CATEGORY$
* HBCT Date and Time Functions
* $ONELINER$
* Sets the system clock
* $SYNTAX$
* SETTIME(<cTime>, [<lMode>]) --> lSet
* $ARGUMENTS$
* <cTime> Designates a character string that contains the time that
* is to become the system time.
*
* <lMode> Designates whether the time should also be set in the
* CMOS-RAM of an AT. The default is do not write to CMOS-RAM. Note that in
* Windows plataform this adjust is automatic, therefore this parameter is
* without efect.
* $RETURNS$
* The FUNCTION RETURNs .T. when the time is set successfully.
* $DESCRIPTION$
* When you use this FUNCTION to convert the time into the system time from
* within your xHarbour application, all files acquire this time with
* each write procedure.
* $EXAMPLES$
* Set the system time in each case; but the hardware clock only
* on an AT:
*
* cNewTime := "10:20:00"
* IF ISAT()
* SETTIME(cNewTime, .T.)
* ELSE
* SETTIME(cNewTime)
* ENDIF
*
* Or, more compactly:
*
* SETTIME(cNewTime, ISAT())
* $TESTS$
*
* $STATUS$
* Ready
* $COMPLIANCE$
* This function is CA-Cl*pper Tools compatible.
* $PLATFORMS$
* Windows
* $FILES$
* Source is dattime3.c, library is libct.
* $SEEALSO$
* SETDATE(),TIMEVALID()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* SETDATE()
* $CATEGORY$
* HBCT Date and Time Functions
* $ONELINER$
* Sets the system date
* $SYNTAX$
* SETDATE(<dDate>, [<lMode>]) --> lSet
* $ARGUMENTS$
* <dDate> Designates which date to use to set the system date.
*
* <lMode> Designates whether the date should also be set in the CMOS-
* RAM of an AT. The default is do not write (.F.). Note that in Windows
* plataform this adjust is automatic, therefore this parameter is without
* efect.
* $RETURNS$
* SETDATE() RETURNs .T. when the date is successfully set.
* $DESCRIPTION$
* When you use this FUNCTION to set the system date from within your
* xHarbour application, all files acquire this date with each write
* procedure.
* $EXAMPLES$
* Set the system date in each case; but the hardware clock only
* on an AT:
*
* dNewDate := CTOD("07/30/91")
* IF ISAT()
* SETDATE(dNewDate, .T.)
* ELSE
* SETDATE(dNewDate)
* ENDIF
*
* Or, more compactly:
*
* SETDATE(dNewDate, ISAT())
* $TESTS$
*
* $STATUS$
* Ready
* $COMPLIANCE$
* This function is CA-Cl*pper Tools compatible.
* $PLATFORMS$
* Windows
* $FILES$
* Source is dattime3.c, library is libct.
* $SEEALSO$
* SETTIME()
* $END$
*/

View File

@@ -0,0 +1,92 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* MANTISSA()
* $CATEGORY$
* CT3 number and bit manipulation functions
* $ONELINER$
* Evaluate the mantissa of a floating point number
* $SYNTAX$
* MANTISSA( <nFloatingPointNumber> ) --> nMantissa
* $ARGUMENTS$
* <nFloatingPointNumber> Designate any Harbour number.
* $RETURNS$
* MANTISSA() returns the mantissa of the <nFloatingPointNumber> number.
* $DESCRIPTION$
* This function supplements EXPONENT() to return the mantissa of the
* <nFloatingPointNumber> number.
*
* Note: The mantissa value can be 0 or in the range of 1 to 2.
*
* The following calculation reproduces the original value:
*
* MANTISSA(<nFloatingPointNumber>)* 2^EXPONENT(<nFloatingPointNumber>) =
* <nFloatingPointNumber>
*
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* MANTISSA() is compatible with CT3's MANTISSA().
* $PLATFORMS$
* All
* $FILES$
* Source is exponent.c, library is libct.
* $SEEALSO$
* EXPONENT()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* EXPONENT()
* $CATEGORY$
* CT3 number and bit manipulation functions
* $ONELINER$
* Evaluate the exponent of a floating point number
* $SYNTAX$
* EXPONENT( <nFloatingPointNumber> ) --> nExponent
* $ARGUMENTS$
* <nFloatingPointNumber> Designate any Harbour number.
* $RETURNS$
* EXPONENT() returns the exponent of the <nFloatingPointNumber> number
* in base 2.
* $DESCRIPTION$
* This function supplements MANTISSA() to return the exponent of the
* <nFloatingPointNumber> number.
*
* Values > 1 or values < -1 return a positive number 0 to 1023.
*
* Values < 1 or values > -1 return a negative number -1 to -1023.
*
* The EXPONENT( 0 ), return 0.
*
* The following calculation reproduces the original value:
*
* 2^EXPONENT(<nFloatingPointNumber>) * MANTISSA(<nFloatingPointNumber>) =
* <nFloatingPointNumber>
*
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* EXPONENT() is compatible with CT3's EXPONENT()
* $PLATFORMS$
* All
* $FILES$
* Source is exponent.c, library is libct.
* $SEEALSO$
* MANTISSA()
* $END$
*/

View File

@@ -0,0 +1,256 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* FV()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Future value of a capital
* $SYNTAX$
* FV (nDeposit, nInterest, nPeriods) --> nFutureValue
* $ARGUMENTS$
* <nDeposit> amount of money invested per period
* <nInterest> rate of interest per period, 1 == 100%
* <nPeriods> period count
* $RETURNS$
* <nFutureValue> Total value of the capital after <nPeriods> of
* paying <nDeposit> and <nInterest> interest being
* paid every period and added to the capital (resulting
* in compound interest)
* $DESCRIPTION$
* FV() calculates the value of a capital after <nPeriods> periods.
* Starting with a value of 0, every period, <nDeposit>
* (Dollars, Euros, Yens, ...) and an interest of <nInterest> for the
* current capital are added for the capital (<nInterest>=Percent/100).
* Thus, one gets the non-linear effects of compound interests:
* value in period 0 = 0
* value in period 1 = ((value in period 0)*(1+<nInterest>/100)) + <nDeposit>
* value in period 2 = ((value in period 1)*(1+<nInterest>/100)) + <nDeposit>
* etc....
* value in period <nPeriod> = ((value in period <nPeriod>-1)*(1+<nInterest>/100))< + <nDeposit>
* = <nDeposit> * sum from i=0 to <nPeriod>-1 over (1+<nInterest>/100)^i
* = <nDeposit> * ((1+<nInterest>/100)^n-1) / (<nInterest>/100)
* $EXAMPLES$
* // Payment of 1000 per year for 10 years at a interest rate
* // of 5 per cent per year
*
* ? fv (1000, 0.05, 10) --> 12577.893
* $TESTS$
* fv (1000, 0.00, 10) == 10000.0
* fv (1000, 0.05, 10) == 12577.893
* $STATUS$
* Ready
* $COMPLIANCE$
* FV() is compatible with CT3's FV().
* $PLATFORMS$
* All
* $FILES$
* Source is finan.c, library is libct.
* $SEEALSO$
* PV(),PAYMENT(),PERIODS(),RATE()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* PV()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Present value of a loan
* $SYNTAX$
* PV (nPayment, nInterest, nPeriods) --> nPresentValue
* $ARGUMENTS$
* <nPayment> amount of money paid back per period
* <nInterest> rate of interest per period, 1 == 100%
* <nPeriods> period count
* $RETURNS$
* <nPresentValue> Present value of a loan when one is paying back
* <nDeposit> per period at a rate of interest of
* <nInterest> per period
* $DESCRIPTION$
* PV() calculates the present value of a loan that is paid back
* in <nPeriods> payments of <nPayment> (Dollars, Euros, Yens,...)
* while the rate of interest is <nInterest> per period:
* debt in period 0 = <nPresentValue>
* debt in period 1 = ((debt in period 0)-<nPayment>)*(1+<nInterest>/100)
* debt in period 2 = ((debt in period 1)-<nPayment>)*(1+<nInterest>/100)
* etc...
* debt in period <nPeriod> = ((debt in period <nPeriod>-1)-<nPayment>)*(1+<nInterest>/100)
* -> has to be 0, so
* <nPresentValue> = <nPayment>*(1-(1+<nInterest>/100)^(-n))/(<nInterest>/100)
* $EXAMPLES$
* // You can afford to pay back 100 Dollars per month for 5 years
* // at a interest rate of 0.5% per month (6% per year), so instead
* // of 6000 Dollars (the amount you will pay back) the bank will pay
* // you
*
* ? pv (100, 0.005, 60) --> 5172.56
* $TESTS$
* pv (100, 0.0, 60) == 6000.0
* pv (100, 0.005, 60) == 5172.56
* $STATUS$
* Ready
* $COMPLIANCE$
* PV() is compatible with CT3's PV().
* $PLATFORMS$
* All
* $FILES$
* Source is finan.c, library is libct.
* $SEEALSO$
* FV(),PAYMENT(),PERIODS(),RATE()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* PAYMENT()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Payments for a loan
* $SYNTAX$
* PAYMENT (nLoan, nInterest, nPeriods) --> nPayment
* $ARGUMENTS$
* <nLoan> amount of money you get from the bank
* <nInterest> rate of interest per period, 1 == 100%
* <nPeriods> period count
* $RETURNS$
* <nPayment> Periodical payment one has to make to pay the
* loan <nLoan> back
* $DESCRIPTION$
* PAYMENT() calculates the payment one has to make periodically
* to pay back a loan <nLoan> within <nPeriods> periods and for a
* rate of interest <nInterest> per period.
* debt in period 0 = <nLoan>
* debt in period 1 = ((debt in period 0)-<nPayment>)*(1+<nInterest>/100)
* debt in period 2 = ((debt in period 1)-<nPayment>)*(1+<nInterest>/100)
* etc...
* debt in period <nPeriod> = ((debt in period <nPeriod>-1)-<nPayment>)*(1+<nInterest>/100)
* -> has to be 0, so
* <nPayment> = <nLoan>*(<nInterest>/100)/(1-(1+<nInterest>/100)^(-n))
* $EXAMPLES$
* // You get a loan of 5172.56 at a interest rate of 0.5% per
* // month (6% per year).
* // For 5 years, you have to pay back every month
*
* ? payment (5172.56, 0.005, 60) --> 100.00
* $TESTS$
* payment (5172.56, 0.0, 60) == 86.21
* payment (5172.56, 0.005, 60) == 100.00
* $STATUS$
* Ready
* $COMPLIANCE$
* PAYMENT() is compatible with CT3's PAYMENT().
* $PLATFORMS$
* All
* $FILES$
* Source is finan.c, library is libct.
* $SEEALSO$
* PV(),FV(),PERIODS(),RATE()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* PERIODS()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Number of periods for a loan
* $SYNTAX$
* PERIODS (nLoan, nPayment, nInterest) --> nPeriods
* $ARGUMENTS$
* <nLoan> amount of money you get from the bank
* <nPayment> amount of money you pay back per period
* <nInterest> rate of interest per period, 1 == 100%
* $RETURNS$
* <nPeriods> number of periods you need to pay the loan back
* $DESCRIPTION$
* PERIODS() calculates the number of periods one needs to pay back
* a loan of <nLoan> with periodical payments of <nPayment> and for a
* rate of interest <nInterest> per period.
* debt in period 0 = <nLoan>
* debt in period 1 = ((debt in period 0)-<nPayment>)*(1+<nInterest>/100)
* debt in period 2 = ((debt in period 1)-<nPayment>)*(1+<nInterest>/100)
* etc...
* debt in period <nPeriod> = ((debt in period <nPeriod>-1)-<nPayment>)*(1+<nInterest>/100)
* -> has to be 0, so
* <nPeriods> = -log(1-<nLoan>*(<nInterest>/100)/<nPayment>)/log(1+<nInterest>/100))
*
* Note, however that in the case of nPayment <= <nLoan>*(<nInterest>/100),
* one would need infinite time to pay the loan back. The functions does
* then return -1.
* $EXAMPLES$
* // You get a loan of 5172.56 at a interest rate of 0.5% per
* // month (6% per year).
* // You can afford to pay 100 back every month, so you need
*
* ? periods (5172.56, 100, 0.005) --> 60.0
*
* // months to cancel the loan.
* $TESTS$
* periods (5172.56, 100, 0.005) == 60.0
* periods (5172.56, 100, 0.0) == 51.7256
* $STATUS$
* Ready
* $COMPLIANCE$
* PERIODS() is compatible with CT3's PERIODS().
* $PLATFORMS$
* All
* $FILES$
* Source is finan.c, library is libct.
* $SEEALSO$
* PV(),FV(),PAYMENT(),RATE()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* RATE()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Estimate rate of interest for a loan
* $SYNTAX$
* RATE (nLoan, nPayment, nPeriods) --> nRate
* $ARGUMENTS$
* <nLoan> amount of money you get from the bank
* <nPayment> amount of money you pay back per period
* <nPeriods> number of periods you pay the loan back
* $RETURNS$
* <nInterest> estimated rate of interest per period, 1 == 100%
* $DESCRIPTION$
* RATE() calculates the rate of interest per period for the given
* loan, payment per periods and number of periods. This is done with
* the same equation used in the PAYMENT() or PERIODS() function:
*
* <nPayment> = <nLoan>*(<nInterest>/100)/(1-(1+<nInterest>/100)^(-<nPeriods>))
*
* However, this equation can not be solved for <nInterest> in a "closed"
* manner, i.e. <nInterest> = ..., so that the result can only be estimated.
* $EXAMPLES$
* // You get a loan of 5172.56, pay 100 back every month for
* // 5 years (60 months). The effective interest rate per
* // period (=month) is
*
* ? rate (5172.56, 100, 60) --> 0.005
*
* $TESTS$
* rate (5172.56, 100, 60.0) == 0.005
* rate (6000.0, 100, 60.0) == 0.0
* $STATUS$
* Ready
* $COMPLIANCE$
* RATE() is compatible with CT3's RATE().
* $PLATFORMS$
* All
* $FILES$
* Source is finan.c, library is libct.
* $SEEALSO$
* PV(),FV(),PAYMENT(),PERIODS()
* $END$
*/

View File

@@ -0,0 +1,86 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* FTOC()
* $CATEGORY$
* CT3 number and bit manipulation functions
* $ONELINER$
*
* $SYNTAX$
* FTOC( <nFloatingPointNumber> ) --> cFloatingPointNumber
*
* $ARGUMENTS$
* <nFloatingPointNumber> Designate any Harbour number.
*
* $RETURNS$
* FTOC() return a string with the size of DOUBLE.
* ATTENTION: different implementations or platforms of Harbour, they
* could produce different format in the string returned by FTOC().
*
* $DESCRIPTION$
* Harbour internal numbers in Floating Point are stored in data type
* DOUBLE. FTOC() returns these bits as an string. In this way,
* numbers con be saved more compactly.
*
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
*
* $PLATFORMS$
* All
* $FILES$
* Source is ftoc.c, library is libct.
* $SEEALSO$
* CTOF(), XTOC()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* CTOF()
* $CATEGORY$
* CT3 number and bit manipulation functions
* $ONELINER$
*
* $SYNTAX$
* CTOF( <cFloatingPointNumber> ) --> nFloatingPointNumber
*
* $ARGUMENTS$
* <cFloatingPointNumber> Designate a string that contains a Harbour
* number in flotaing point format.
* ATTENTION: different implementations or platforms of Harbour, they
* could produce different format in the string returned by FTOC().
*
* $RETURNS$
* CTOF() return the floating point number that corresponds to the
* string passed.
*
* $DESCRIPTION$
* Character strings created with FTOC() or XTOC() are convert into
* Harbour floating point number
*
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
*
* $PLATFORMS$
* All
* $FILES$
* Source is ftoc.c, library is libct.
* $SEEALSO$
* FTOC(), XTOC()
* $END$
*/

View File

@@ -0,0 +1,67 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* JUSTLEFT()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Move characters from the beginning to the end of a string
* $SYNTAX$
* JUSTLEFT (<[@]cString>, [<cChar>|<nChar>]) -> cJustifiedString
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* JUSTLEFT() is compatible with CT3's JUSTLEFT().
* $PLATFORMS$
* All
* $FILES$
* Source is justify.c, library is libct.
* $SEEALSO$
* JUSTRIGHT()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* JUSTRIGHT()
* $CATEGORY$
* Harbour Tools string functions
* $ONELINER$
* Move characters from the end to the beginning of a string
* $SYNTAX$
* JUSTRIGHT (<[@]cString>, [<cChar>|<nChar>]) -> cJustifiedString
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* JUSTRIGHT() is compatible with CT3's JUSTRIGHT().
* $PLATFORMS$
* All
* $FILES$
* Source is justify.c, library is libct.
* $SEEALSO$
* JUSTLEFT()
* $END$
*/

View File

@@ -0,0 +1,131 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* KSETINS()
* $CATEGORY$
* CT3 switch and state functions
* $ONELINER$
*
* $SYNTAX$
* KSETINS ([<lNewSwitch>]) -> lOldSwitch
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
*
* $PLATFORMS$
* DOS
* $FILES$
* Source is keyset.c, library is libct.
* $SEEALSO$
*
* $END$
*/
/* $DOC$
* $FUNCNAME$
* KSETCAPS()
* $CATEGORY$
* CT3 switch and state functions
* $ONELINER$
*
* $SYNTAX$
* KSETCAPS ([<lNewSwitch>]) -> lOldSwitch
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
*
* $PLATFORMS$
* DOS
* $FILES$
* Source is keyset.c, library is libct.
* $SEEALSO$
*
* $END$
*/
/* $DOC$
* $FUNCNAME$
* KSETNUM()
* $CATEGORY$
* CT3 switch and state functions
* $ONELINER$
*
* $SYNTAX$
* KSETNUM ([<lNewSwitch>]) -> lOldSwitch
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
*
* $PLATFORMS$
* DOS
* $FILES$
* Source is keyset.c, library is libct.
* $SEEALSO$
*
* $END$
*/
/* $DOC$
* $FUNCNAME$
* KSETSCROLL()
* $CATEGORY$
* CT3 switch and state functions
* $ONELINER$
*
* $SYNTAX$
* KSETSCROLL ([<lNewSwitch>]) -> lOldSwitch
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
*
* $PLATFORMS$
* DOS
* $FILES$
* Source is keyset.c, library is libct.
* $SEEALSO$
*
* $END$
*/

View File

@@ -0,0 +1,51 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* XTOC()
* $CATEGORY$
* CT3 miscellaneous functions
* $ONELINER$
*
* $SYNTAX$
* XTOC( <expValue> ) --> cValue
*
* $ARGUMENTS$
* <expValue> Designate an expression of some of the following data
* type: NUMBER, CHARACTER, DATE, LOGICAL.
*
* $RETURNS$
* XTOC() return a string with the representation of data type of
* expValue.
*
* $DESCRIPTION$
* Each data type always returns a string with a particular fixed length:
*
* -----------------------------------------------------------
* Data Type Result Length Similar function
* -----------------------------------------------------------
* Numeric sizeof( DOUBLE ) FTOC()
* Logical 1
* Date 8 DTOS()
* String Unchanged
* -----------------------------------------------------------
*
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
*
* $PLATFORMS$
* All
* $FILES$
* Source is misc1.c, library is libct.
* $SEEALSO$
* CTOF(), FTOC()
* $END$
*/

View File

@@ -0,0 +1,115 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* CELSIUS()
* $CATEGORY$
* CT3 numeric functions
* $ONELINER$
* Temperature conversion Fahrenheit to Celsius
* $SYNTAX$
* CELSIUS (nDegreeFahrenheit) --> nDegreeCelsius
* $ARGUMENTS$
* <nDegreeFahrenheit> temperature in degree Fahrenheit
* $RETURNS$
* <nDegreeCelsius> temperate in degree Celsius
* $DESCRIPTION$
* CELSIUS() converts temperature values measured in the Fahrenheit scale
* to the Celsius scale.
* $EXAMPLES$
* // melting point of water in standard conditions
* ? celsius (32.0) --> 0.0
* // boiling point of water in standard conditions
* ? celsius (212.0) --> 100.0
* $TESTS$
* celsius (32.0) == 0.0
* celsius (212.0) == 100.0
* $STATUS$
* Ready
* $COMPLIANCE$
* CELSIUS() is compatible with CT3's CELSIUS().
* $PLATFORMS$
* All
* $FILES$
* Source is num1.c, library is libct.
* $SEEALSO$
* FAHRENHEIT()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* FAHRENHEIT()
* $CATEGORY$
* CT3 numeric functions
* $ONELINER$
* Temperature conversion Celsius to Fahrenheit
* $SYNTAX$
* FAHRENHEIT (nDegreeCelsius) --> nDegreeFahrenheit
* $ARGUMENTS$
* <nDegreeCelsius> temperate in degree Celsius
* $RETURNS$
* <nDegreeFahrenheit> temperature in degree Fahrenheit
* $DESCRIPTION$
* FAHRENHEIT() converts temperature values measured in the Celsius scale
* to the Fahrenheit scale.
* $EXAMPLES$
* // melting point of water in standard conditions
* ? fahrenheit (0.0) --> 32.0
* // boiling point of water in standard conditions
* ? fahrenheit (100.0) --> 212.0
* $TESTS$
* fahrenheit (0.0) == 32.0
* celsius (100.0) == 212.0
* $STATUS$
* Ready
* $COMPLIANCE$
* FAHRENHEIT() is compatible with CT3's FAHRENHEIT().
* $PLATFORMS$
* All
* $FILES$
* Source is num1.c, library is libct.
* $SEEALSO$
* CELSIUS()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* INFINITY()
* $CATEGORY$
* CT3 numeric functions
* $ONELINER$
* Returns the largest floating point number available in the system
* $SYNTAX$
* INFINITY ([<lPlatformIndependant>]) --> nLargestNumber
* $ARGUMENTS$
* [<lPlatformIndependant>] .T., if the function should return
* the maximum floating point value
* available (DBL_MAX)
* .F., function should try to return
* the same value as the original CT3 lib did
* Default: .F.
* $RETURNS$
* <nLargestNumber> the largest floating point number available in the system
* $DESCRIPTION$
* INFINITY() returns the largest floating point number available
* in the system. For platform independance, this is set to DBL_MAX.
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Ready
* $COMPLIANCE$
* INFINITY() must not necessarily return the same number as CT3's INFINITY().
* $PLATFORMS$
* All
* $FILES$
* Source is num1.c, library is libct.
* $SEEALSO$
*
* $END$
*/

View File

@@ -0,0 +1,35 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* NUMAT()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Number of occurrences of a sequence in a string
* $SYNTAX$
* NUMAT (<cStringToMatch>, <cString>, [<nIgnore>]) --> nCount
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* NUMAT() is compatible with CT3's NUMAT().
* $PLATFORMS$
* All
* $FILES$
* Source is numat.c, library is libct.
* $SEEALSO$
* CSETATMUPA(),SETATLIKE()
* $END$
*/

View File

@@ -0,0 +1,131 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* NTOC()
* $CATEGORY$
* CT3 number and bit manipulation functions
* $ONELINER$
*
* $SYNTAX$
* NTOC (<xNumber>[, <nBase>][,<nLength>][,<cPadChar>]) -> <cNumber>
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
*
* $PLATFORMS$
* All
* $FILES$
* Source is numconv.prg, library is libct.
* $SEEALSO$
* CTON()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* CTON()
* $CATEGORY$
* CT3 number and bit manipulation functions
* $ONELINER$
*
* $SYNTAX$
* CTON (<xNumber>[, <nBase>][,<lMode>]) -> <nNumber>
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
*
* $PLATFORMS$
* All
* $FILES$
* Source is numconv.prg, library is libct.
* $SEEALSO$
* NTOC()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* BITTOC()
* $CATEGORY$
* CT3 number and bit manipulation functions
* $ONELINER$
*
* $SYNTAX$
* BITTOC (<nInteger>, <cBitPattern>[,<lMode>]) -> <cBitString>
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
*
* $PLATFORMS$
* All
* $FILES$
* Source is numconv.prg, library is libct.
* $SEEALSO$
* CTOBIT()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* CTOBIT()
* $CATEGORY$
* CT3 number and bit manipulation functions
* $ONELINER$
*
* $SYNTAX$
* CTOBIT (<cBitString>, <cBitPattern>) -> <nWord>
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
*
* $PLATFORMS$
* All
* $FILES$
* Source is numconv.prg, library is libct.
* $SEEALSO$
* BITTOC()
* $END$
*/

View File

@@ -0,0 +1,132 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* POSALPHA()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Left-most position of a letter in a string
* $SYNTAX$
* POSALPHA (<cString>, [<lMode>], [<nIgnore>]) -> nPosition
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* POSALPHA() is compatible with CT3's POSALPHA().
* $PLATFORMS$
* All
* $FILES$
* Source is pos1.c, library is libct.
* $SEEALSO$
* POSLOWER(),POSUPPER(),POSRANGE()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* POSLOWER()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Left-most position of a lowercase letter in a string
* $SYNTAX$
* POSLOWER (<cString>, [<lMode>], [<nIgnore>]) -> nPosition
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* POSLOWER() is compatible with CT3's POSLOWER().
* $PLATFORMS$
* All
* $FILES$
* Source is pos1.c, library is libct.
* $SEEALSO$
* POSALPHA(),POSUPPER(),POSRANGE()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* POSRANGE()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Left-most position of a character from a set in a string
* $SYNTAX$
* POSRANGE (<cChar1>, <cChar2>, <cString>, [<lMode>],
* [<nIgnore>]) -> nPosition
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* POSRANGE() is compatible with CT3's POSRANGE().
* $PLATFORMS$
* All
* $FILES$
* Source is pos1.c, library is libct.
* $SEEALSO$
* POSALPHA(),POSLOWER(),POSUPPER()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* POSUPPER()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Left-most position of an uppercase letter in a string
* $SYNTAX$
* POSUPPER (<cString>, [<lMode>], [<nIgnore>]) -> nPosition
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* POSUPPER() is compatible with CT3's POSUPPER().
* $PLATFORMS$
* All
* $FILES$
* Source is pos1.c, library is libct.
* $SEEALSO$
* POSALPHA(),POSLOWER(),POSRANGE()
* $END$
*/

View File

@@ -0,0 +1,131 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* POSCHAR()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Replace character at a certain position within a string
* $SYNTAX$
* POSCHAR (<[@]cString>, <cCharacter|nCharacter>, [<nPosition>]) -> cString
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* POSCHAR() is compatible with CT3's POSCHAR().
* $PLATFORMS$
* All
* $FILES$
* Source is pos2.c, library is libct.
* $SEEALSO$
* POSDEL(),POSINS(),POSREPL(),CSETREF()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* POSDEL()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Delete characters at a certain position within a string
* $SYNTAX$
* POSDEL (<cString>, [<nStartPosition>], <nLength>) -> cString
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* POSDEL() is compatible with CT3's POSDEL().
* $PLATFORMS$
* All
* $FILES$
* Source is pos2.c, library is libct.
* $SEEALSO$
* POSCHAR(),POSINS(),POSREPL()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* POSINS()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Insert characters at a certain position within a string
* $SYNTAX$
* POSINS (<cString>, <cInsert>, [<nPosition>]) -> cString
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* POSINS() is compatible with CT3's POSINS().
* $PLATFORMS$
* All
* $FILES$
* Source is pos2.c, library is libct.
* $SEEALSO$
* POSCHAR,POSDEL(),POSREPL()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* POSREPL()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Replace characters at a certain position within a string
* $SYNTAX$
* POSREPL (<[@]cString>, <cReplacement>, [<nStartPosition>]) -> cString
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* POSREPL() is compatible with CT3's POSREPL().
* $PLATFORMS$
* All
* $FILES$
* Source is pos2.c, library is libct.
* $SEEALSO$
* POSCHAR(),POSDEL(),POSINS(),CSETREF()
* $END$
*/

View File

@@ -0,0 +1,67 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* POSDIFF()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* The left-most position there two string differ
* $SYNTAX$
* POSDIFF (<cString1>, <cString2>, [<nIgnore>]) -> nPosition
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* POSDIFF() is compatible with CT3's POSDIFF().
* $PLATFORMS$
* All
* $FILES$
* Source is posdiff.c, library is libct.
* $SEEALSO$
* POSEQUAL()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* POSEQUAL()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* The left-most position there two string begin to be equal
* $SYNTAX$
* POSEQUAL (<cString1>, <cString2>, [<nCompare>], [<nIgnore>]) -> nPosition
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* POSEQUAL() is compatible with CT3's POSEQUAL().
* $PLATFORMS$
* All
* $FILES$
* Source is posdiff.c, library is libct.
* $SEEALSO$
* POSDIFF()
* $END$
*/

View File

@@ -0,0 +1,67 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* PRINTSTAT()
* $CATEGORY$
* CT3 printer functions
* $ONELINER$
*
* $SYNTAX$
* PRINTSTAT ([<nPrinter>]) -> nState
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
*
* $PLATFORMS$
* DOS
* $FILES$
* Source is print.c, library is libct.
* $SEEALSO$
*
* $END$
*/
/* $DOC$
* $FUNCNAME$
* PRINTREADY()
* $CATEGORY$
* CT3 printer functions
* $ONELINER$
*
* $SYNTAX$
* PRINTREADY ([<nPrinter>]) -> lPrinterReady
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
*
* $PLATFORMS$
* DOS
* $FILES$
* Library is libct.
* $SEEALSO$
*
* $END$
*/

View File

@@ -0,0 +1,78 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* RANGEREM()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Remove characters within a certain ASCII range from a string
* $SYNTAX$
* RANGEREM (<cChar1|nChar1>, <cChar2|nChar2>, <cString>) -> cString
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
* ? rangerem ("0","9","year2002.dbf") // "year.dbf", remove all digits
* ? rangerem ("9","0","year2002.dbf") // "22", testing removal from "9" to chr(255)
* // and from chr(0) to "0"
* ? rangerem ("0","9","yearcurr.dbf") // "yearcurr.dbf", test leaving string untouched
* $TESTS$
* rangerem ("0","9","year2002.dbf") == "year.dbf"
* rangerem ("9","0","year2002.dbf") == "22"
* rangerem ("0","9","yearcurr.dbf") == "yearcurr.dbf"
* $STATUS$
* Started
* $COMPLIANCE$
* RANGEREM() is compatible with CT3's RANGEREM().
* $PLATFORMS$
* All
* $FILES$
* Source is range.c, library is libct.
* $SEEALSO$
* RANGEREPL()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* RANGEREPL
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Replace characters within a certain ASCII range from a string
* $SYNTAX$
* RANGEREPL (<cChar1|nChar1>, <cChar2|nChar2>,
* <[@]cString>, <cReplacementChar|nReplacementChar>) -> cString
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
* ? rangerepl ("0","9","year2002.dbf","?") // "year????.dbf", replace all digits
* ? rangerepl ("9","0","year2002.dbf","?") // "????2??2????", testing replacement from "9" to chr(255)
* // and from chr(0) to "0"
* ? rangerepl ("0","9","yearcurr.dbf","?") // "yearcurr.dbf", test leaving string untouched
* $TESTS$
* rangerepl ("0","9","year2002.dbf","?") == "year????.dbf"
* rangerepl ("9","0","year2002.dbf","?") == "????2??2????"
* rangerepl ("0","9","yearcurr.dbf","?") == "yearcurr.dbf"
* $STATUS$
* Started
* $COMPLIANCE$
* RANGEREPL() is compatible with CT3's RANGEREPL().
* $PLATFORMS$
* All
* $FILES$
* Source is range.c, library is libct.
* $SEEALSO$
* RANGEREM()
* $END$
*/

View File

@@ -0,0 +1,70 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* CHARRELA()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Character relation of two strings
* $SYNTAX$
* CHARRELA (<cStringToMatch1>, <cString1>,
* <cStringToMatch2>, <cString2>) -> nPosition
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* CHARRELA() is compatible with CT3's CHARRELA().
* $PLATFORMS$
* All
* $FILES$
* Source is relation.c, library is libct.
* $SEEALSO$
* CHARRELREP()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* CHARRELREP()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Relation dependant character replacement
* $SYNTAX$
* CHARRELREP (<cStringToMatch1>, <cString1>,
* <cStringToMatch2>, <[@]cString2>,
* <cReplacement>) -> cString
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* CHARRELREP() is compatible with CT3's CHARRELREP().
* $PLATFORMS$
* All
* $FILES$
* Source is relation.c, library is libct.
* $SEEALSO$
* CHARRELA(),CSETREF()
* $END$
*/

View File

@@ -0,0 +1,99 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* REMALL()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Remove certain characters at the left and right of a string
* $SYNTAX$
* REMALL (<cString>, [<cSearch|nSearch>]) -> cString
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* REMALL() is compatible with CT3's REMALL().
* $PLATFORMS$
* All
* $FILES$
* Source is remove.c, library is libct.
* $SEEALSO$
* REMLEFT(),REMRIGHT()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* REMLEFT()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Remove certain characters at the left of a string
* $SYNTAX$
* REMLEFT (<cString>, [<cSearch|nSearch>]) -> cString
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* REMLEFT() is compatible with CT3's REMLEFT().
* $PLATFORMS$
* All
* $FILES$
* Source is remove.c, library is libct.
* $SEEALSO$
* REMALL(),REMRIGHT()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* REMRIGHT()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Remove certain characters at the right of a string
* $SYNTAX$
* REMRIGHT (<cString>, [<cSearch|nSearch>]) -> cString
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* REMRIGHT() is compatible with CT3's REMRIGHT().
* $PLATFORMS$
* All
* $FILES$
* Source is remove.c, library is libct.
* $SEEALSO$
* REMALL(),REMLEFT()
* $END$
*/

View File

@@ -0,0 +1,99 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* REPLALL()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Replace certain characters at the left and right of a string
* $SYNTAX$
* REPLALL (<cString>, <cReplace|nReplace>, [<cSearch|nSearch>]) -> cString
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* REPLALL() is compatible with CT3's REPLALL().
* $PLATFORMS$
* All
* $FILES$
* Source is replace.c, library is libct.
* $SEEALSO$
* REPLLEFT(),REPLRIGHT()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* REPLLEFT()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Replace certain characters at the left of a string
* $SYNTAX$
* REPLLEFT (<cString>, <cReplace|nReplace>, [<cSearch|nSearch>]) -> cString
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* REPLLEFT() is compatible with CT3's REPLLEFT().
* $PLATFORMS$
* All
* $FILES$
* Source is replace.c, library is libct.
* $SEEALSO$
* REPLALL(),REPLRIGHT()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* REPLRIGHT()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Replace certain characters at the right of a string
* $SYNTAX$
* REPLRIGHT (<cString>, <cReplace|nReplace>, [<cSearch|nSearch>]) -> cString
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* REPLRIGHT() is compatible with CT3's REPLRIGHT().
* $PLATFORMS$
* All
* $FILES$
* Source is replace.c, library is libct.
* $SEEALSO$
* REPLALL(),REPLLEFT()
* $END$
*/

View File

@@ -0,0 +1,357 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* SCREENATTR()
* $CATEGORY$
* CT3 video functions
* $ONELINER$
*
* $SYNTAX$
* SCREENATTR ( [<nRow>],[<nColumn>] ) -> <nAttr>
* $ARGUMENTS$
* <nRow> Designates the line from which to determine the attribute.
* The default is the cursor line.
*
* <nColumn> Designates the column from which to determine the
* attribute. The default is the cursor column.
*
* $RETURNS$
* SCREENATTR() returns the attribute at the designated position.
*
* $DESCRIPTION$
* SCREENATTR() returns the current screen attribute at <nRow> and
* <nColumn>. You can query targeted attributes this way and save them
* to use later, or process them later with INVERTATTR().
*
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
*
* $PLATFORMS$
* All
* $FILES$
* Source is screen1.c, library is libct.
* $SEEALSO$
*
* $END$
*/
/* $DOC$
* $FUNCNAME$
* SCREENMIX()
* $CATEGORY$
* CT3 video functions
* $ONELINER$
*
* $SYNTAX$
* SCREENMIX (<cCharString>, <cAttributeString>, [<nRow>], [<nCol>]) -> <cEmptyString>
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
*
* $PLATFORMS$
* All
* $FILES$
* Source is screen1.c, library is libct.
* $SEEALSO$
*
* $END$
*/
/* $DOC$
* $FUNCNAME$
* SAYSCREEN()
* $CATEGORY$
* CT3 video functions
* $ONELINER$
*
* $SYNTAX$
* SAYSCREEN( <cString>, [<nRow>], [<nCol>] ) -> <cEmptyString>
* $ARGUMENTS$
* <cString> - the string to output. Although undocumented, can be NIL.
* <nRow> - row number, defaults to cursor row.
* <nCol> - column number, defaults to cursor column.
* $RETURNS$
* Returns an empty string.
* $DESCRIPTION$
* Outputs a string at specified coordinates without changing character
* attributes.
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Ready
* $COMPLIANCE$
*
* $PLATFORMS$
* All
* $FILES$
* Source is screen1.c, library is libct.
* $SEEALSO$
* SCREENMIX()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* INVERTWIN()
* $CATEGORY$
* CT3 video functions
* $ONELINER$
*
* $SYNTAX$
*
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* INVERTWIN() is compatible with CT3's INVERTWIN().
* $PLATFORMS$
* All
* $FILES$
* Source is color.c, library is libct.
* $SEEALSO$
*
* $END$
*/
/* $DOC$
* $FUNCNAME$
* UNTEXTWIN()
* $CATEGORY$
* CT3 video functions
* $ONELINER$
*
* $SYNTAX$
* UNTEXTWIN(<nTopLine>, <nLeftColumn>, <nBottomLine>, <nRightColumn>,
* <cReplacementCharacter|nReplacementCharacter>,
* [<cInitialCharacter|nInitialCharacter>],
* [<cEndCharacter|nEndCharacter>]) --> cNull
* $ARGUMENTS$
* <nTopLine> Designates the line for the upper-left corner of the
* area.
* <nLeftColumn> Designates the column for the upper-left corner of
* the area.
* <nBottomLine> Designates the line for the bottom-right corner of
* the area.
* <nRightColumn> Designates the line for the bottom-right column of
* the area.
* <cReplacementCharacter|nReplacementCharacter> Replaces each
* character within the window, with the exception of those within the
* range of <cInitialCharacter|nInitialCharacter> and
* <cEndCharacter|nEndCharacter>.
* <cInitialCharacter|nInitialCharacter> Designates the beginning of
* the bracketed area. The character can be number in the range of 0 to
* 255, or the character string type. The default value is 176.
* <cEndCharacter|nEndCharacter> Designates the end of the bracketed
* area. The character can be number in the range of 0 to 255 or the
* character string type. The default value is 223.
* $RETURNS$
* Returns a null string.
* $DESCRIPTION$
* Replaces an area of characters from a region of the screen
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
*
* $PLATFORMS$
* All
* $FILES$
* Source is screen1.c, library is libct.
* $SEEALSO$
*
* $END$
*/
/* $DOC$
* $FUNCNAME$
* CHARWIN()
* $CATEGORY$
* CT3 video functions
* $ONELINER$
*
* $SYNTAX$
* CHARWIN (<nTop>, <nLeft>, <nBottom>, <nRight>, [<cNewChar|nNewChar>],
* [<cOldChar|nOldChar>]) --> <cEmptyString>
* $ARGUMENTS$
* <nTop> - top row number, default 0
* <nLeft> - left column number, default 0
* <nBottom> - top row number, default MaxRow()
* <nRight> - right column number, default MaxCol()
* <cNewChar|nNewChar> - new character for the screen area,
* as a numeric value in the range of 0 to
* 255 or as a character string, default value is the CLEARB.
* <cOldChar|nOldChar> - character to exchange. Specify the parameter
* as a numeric in the range of 0 to 255
* or as a character string. The default is to exchange all characters.
* $RETURNS$
* Returns an empty string.
* $DESCRIPTION$
* Exchanges particular characters in a screen area.
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
*
* $PLATFORMS$
* All
* $FILES$
* Source is screen1.c, library is libct.
* $SEEALSO$
*
* $END$
*/
/* $DOC$
* $FUNCNAME$
* COLORWIN()
* $CATEGORY$
* CT3 video functions
* $ONELINER$
*
* $SYNTAX$
* COLORWIN([<nTopLine>], [<nLeftCol>], [<nBottomLine>], [<nRightCol>],
* [<cNewAttr|nNewAttr>], [<cOldAttr|nOldAttr>]) --> cNull
* $ARGUMENTS$
* <nTopLine> Designates the topmost line to begin processing. The
* default is the cursor line.
* <nLeftCol> Designates the leftmost column to begin processing. The
* default is the cursor column.
* <nBottomLine> Designates the bottommost line that is processed.
* The default is the last screen line or window line.
* <nRightCol> Designates the rightmost column to clear. The default
* is the right screen border or window border.
* <cNewAttr|nNewAttr> Designates the new attribute to replace the old
* one. The default is the standard attribute CLEARA.
* <cOldAttr|nOldAttr> Designates the old character to exchange. The
* default is "exchange all attributes".
* $RETURNS$
* Returns an empty string.
* $DESCRIPTION$
* Exchanges particular attributes in a screen area
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
*
* $PLATFORMS$
* All
* $FILES$
* Source is screen1.c, library is libct.
* $SEEALSO$
*
* $END$
*/
/* $DOC$
* $FUNCNAME$
* SCREENTEXT()
* $CATEGORY$
* CT video functions (Harbour extension)
* $ONELINER$
*
* $SYNTAX$
* SCREENTEXT(<nTop>, <nLeft>, <nBottom>, <nRight>)
* $ARGUMENTS$
* <nTop> - top row number, default 0
* <nLeft> - left column number, default 0
* <nBottom> - top row number, default MaxRow()
* <nRight> - right column number, default MaxCol()
* $RETURNS$
* Returns string with characters taken from given screen region.
* $DESCRIPTION$
* Returns string with characters taken from given screen region.
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
*
* $PLATFORMS$
* All
* $FILES$
* Source is screen1.c, library is libct.
* $SEEALSO$
*
* $END$
*/
/* $DOC$
* $FUNCNAME$
* COLORREPL()
* $CATEGORY$
* CT3 video functions
* $ONELINER$
*
* $SYNTAX$
* COLORREPL([<cNewAttr|nNewAttr>], [<cOldAttr|nOldAttr>]) --> cNull
* $ARGUMENTS$
* <cNewAttr|nNewAttr> Designates the new attribute. The default is
* CLEARA.
* <cOldAttr|InOldAttr> Designates the old attribute to exchange. The
* default is all existing attributes.
* $RETURNS$
* Returns an empty string.
* $DESCRIPTION$
* Exchanges particular screen attributes
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
*
* $PLATFORMS$
* All
* $FILES$
* Source is screen1.c, library is libct.
* $SEEALSO$
*
* $END$
*/

View File

@@ -0,0 +1,71 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* STRDIFF()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Evaluate the "Edit (Levensthein) Distance" of two strings
* $SYNTAX$
* STRDIFF (<cString1>, <cString2>, [<nReplacementPenalty>], [<nDeletionPenalty>],
* [<nInsertionPenalty>]) -> <nDistance>
* $ARGUMENTS$
* <cString1> string at the "starting point" of the transformation process, default is ""
* <cString2> string at the "end point" of the transformation process, default is ""
* <nReplacementPenalty> penalty points for a replacement of one character, default is 3
* <nDeletionPenalty> penalty points for a deletion of one character, default is 6
* <nInsertionPenalty> penalty points for an insertion of one character, default is 1
* $RETURNS$
* <nDistance> penalty point sum of all operations needed to transform <cString1> to <cString2>
* $DESCRIPTION$
* The STRDIFF() functions calculates the so called "Edit" or "Levensthein" distance of two strings.
* This distance is a measure for the number of single character replace/insert/delete operations (so called
* "point mutations") required to transform <cString1> into <cString2> and its value will be the smallest sum of
* the penalty points of the required operations.
*
* Be aware that this function is both quite time - O(len(cString1)*len(cString2)) - and memory consuming -
* O((len(cString1)+1)*(len(cString2)+1)*sizeof(int)) - so keep the strings as short as possible.
* E.g., on common 32 bit systems (sizeof(int) == 4), calling strdiff() with two strings of 1024 bytes
* in length will consume 4 MB of memory. To not impose unneeded restrictions, the function will only check if
* (len(cString1)+1)*(len(cString2)+1)*sizeof(int) <= UINT_MAX, although allocing UINT_MAX bytes will not
* work on most systems. If this simple check fails, -1 is returned.
*
* Also, be aware that there can be an overflow when the penalty points are summed up: Assuming that the
* number of transformation operations is in the order of max(len(cString1),len(cString2)), the penalty point
* sum, that is internally stored in an "int" variable, is in the order of
* (max(len(cString1),len(cString2))*max(nReplacementPenalty,nDeletionPenalty,nInsertionPentaly).
* The STRDIFF() does not do an overflow check due to time performance reasons. Future versions of STRDIFF()
* could use a type different to "int" to store the penalty point sum to save memory or to avoid overflows.
*
* The function is aware of the settings done by SETATLIKE(), that means that the wildchar character
* is considered equal to ALL characters.
*
* $EXAMPLES$
* ? strdiff("ABC", "ADC") // 3, one character replaced
* ? strdiff("ABC", "AEC") // 3, dito
* ? strdiff("CBA", "ABC") // 6, two characters replaced
* ? strdiff("ABC", "AXBC") // 1, one character inserted
* ? strdiff("AXBC", "ABC") // 6, one character removed
* ? strdiff("AXBC", "ADC") // 9, one character removed and one replaced
* $TESTS$
* strdiff("ABC", "ADC") == 3
* strdiff("ABC", "AEC") == 3
* strdiff("CBA", "ABC") == 6
* strdiff("ABC", "AXBC") == 1
* strdiff("AXBC", "ABC") == 6
* strdiff("AXBC", "ADC") == 9
* $STATUS$
* Ready
* $COMPLIANCE$
* STRDIFF() is compatible with CT3's STRDIFF().
* $PLATFORMS$
* All
* $FILES$
* Source is strdiff.c, library is libct.
* $SEEALSO$
* SETATLIKE()
* $END$
*/

View File

@@ -0,0 +1,35 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* STRSWAP()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Swap the contents of two strings
* $SYNTAX$
* STRSWAP (<[@]cString1>, <[@]cString2>) -> cString
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* STRSWAP() is compatible with CT3's STRSWAP().
* $PLATFORMS$
* All
* $FILES$
* Source is strswap.c, library is libct.
* $SEEALSO$
*
* $END$
*/

View File

@@ -0,0 +1,101 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* TABEXPAND()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Replace tabulator control characters with fill characters
* $SYNTAX$
* TABEXPAND (<cString>, [<nTabWidth>], [<cFillChar|nFillChar>],
* [<cNewLineCharacters>], [<cTabChar|nTabChar>],
* [<lIgnore141>]) -> cExpandedString
* $ARGUMENTS$
* <cString>
* <nTabWidth>
* <cFillChar|nFillChar>
* <cNewLineCharacters> string indicating new line,
* default is the string returned by
* hb_osnewline()
* <cTabChar|nTabChar> character indicating a tab stop,
* default is chr(9)
* <lIgnore141> .T., if the soft-CR used by MEMOEDIT()
* should be ignored as a newline indicator,
* default is .F. (functions uses chr(141))
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
* tabexpand("-"+chr(9)+"!") == "- !"
* tabexpand("----"+chr(9) +"!") == "---- !"
* tabexpand("-"+chr(9)+"!",, "+") == "-+++++++!"
* tabexpand("-"+chr(9)+ "!", 4) == "- !"
* tabexpand("----"+chr(9)+ "!", 8) == "---- !"
* tabexpand("----"+chr(9)+ "!", 8, "+") == "----++++!"
* tabexpand("-"+chr(9)+"!"+hb_osnewline()+"----"+chr(9)+ "!",, "+") == "-+++++++!"+hb_osnewline()+"----++++!"
* $STATUS$
* Started
* $COMPLIANCE$
* TABEXPAND() is compatible with CT3's TABEXPAND(), but there are
* three new parameters for a better fine control of the function's
* behaviour.
* $PLATFORMS$
* All
* $FILES$
* Source is tab.c, library is libct.
* $SEEALSO$
* TABPACK()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* TABPACK()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Pack fill characters to appropriate tab characters
* $SYNTAX$
* TABPACK (<cString>, [<nTabWidth>], [<cFillChar|nFillChar>],
* [<cNewLineCharacters>], [<cTabChar|nTabChar>],
* [<lIgnore141>]) -> cPackedString
* $ARGUMENTS$
* <cString>
* <nTabWidth>
* <cFillChar|nFillChar>
* <cNewLineCharacters> string indicating new line,
* default is the string returned by
* hb_osnewline()
* <cTabChar|nTabChar> character indicating a tab stop,
* default is chr(9)
* <lIgnore141> .T., if the soft-CR used by MEMOEDIT()
* should be ignored as a newline indicator,
* default is .F. (functions uses chr(141))
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* TABPACK() is compatible with CT3's TABPACK(), but there are
* three new parameters for a better fine control of the function's
* behaviour.
* $PLATFORMS$
* All
* $FILES$
* Source is tab.c, library is libct.
* $SEEALSO$
* TABEXPAND()
* $END$
*/

View File

@@ -0,0 +1,330 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* ATTOKEN()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Position of a token in a string
* $SYNTAX$
* ATTOKEN (<cString>, [<cTokenizer>],
* [<nTokenCount>], [<nSkipWidth>]) -> nPosition
* $ARGUMENTS$
* <cString> is the processed string
* [<cTokenizer>] is a list of characters separating the tokens
* in <cString>
* Default: chr(0)+chr(9)+chr(10)+chr(13)+chr(26)+
* chr(32)+chr(32)+chr(138)+chr(141)+
* ",.;:!\?/\\<>()#&%+-*"
* [<nTokenCount>] specifies the count of the token whose
* position should be calculated
* Default: last token
* [<nSkipWidth>] specifies the maximum number of successive
* tokenizing characters that are combined as
* ONE token stop, e.g. specifying 1 can
* yield to empty tokens
* Default: 0, any number of successive tokenizing
* characters are combined as ONE token stop
* $RETURNS$
* <nPosition> The start position of the specified token or
* 0 if such a token does not exist in <cString>.
* $DESCRIPTION$
* The ATTOKEN() function calculates the start position of tne
* <nTokenCount>th token in <cString>. By setting the new <nSkipWidth>
* parameter to a value different than 0, you can specify how many tokenizing
* characters are combined at most to one token stop. Be aware that
* this can result to empty tokens there the start position is not
* defined clearly. Then, ATTOKEN() returns the position there the
* token WOULD start if its length is larger than 0. To check for
* empty tokens, simply look if the character at the returned position
* is within the tokenizer list.
* $EXAMPLES$
* attoken ("Hello, World!") --> 8 // empty strings after tokenizer
* // are not a token !
* $TESTS$
* attoken ("Hello, World!") == 8
* attoken ("Hello, World!",,2) == 8
* attoken ("Hello, World!",,2,1) == 7
* attoken ("Hello, World!"," ",2,1) == 8
* $STATUS$
* Ready
* $COMPLIANCE$
* ATTOKEN() is compatible with CT3's ATTOKEN, but has an additional
* 4th parameter to let you specify a skip width equal to that in the
* TOKEN() function.
* $PLATFORMS$
* All
* $FILES$
* Source is token1.c, library is libct.
* $SEEALSO$
* TOKEN(),NUMTOKEN(),TOKENLOWER(),TOKENUPPER(),TOKENSEP()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* TOKEN()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Tokens of a string
* $SYNTAX$
* TOKEN (<cString>, [<cTokenizer>],
* [<nTokenCount], [<nSkipWidth>],
* [<@cPreTokenSep>], [<@cPostTokenSep>]) -> cToken
* $ARGUMENTS$
* <cString> is the processed string
* [<cTokenizer>] is a list of characters separating the tokens
* in <cString>
* Default: chr(0)+chr(9)+chr(10)+chr(13)+chr(26)+
* chr(32)+chr(32)+chr(138)+chr(141)+
* ",.;:!\?/\\<>()#&%+-*"
* [<nTokenCount>] specifies the count of the token that
* should be extracted
* Default: last token
* [<nSkipWidth>] specifies the maximum number of successive
* tokenizing characters that are combined as
* ONE token stop, e.g. specifying 1 can
* yield to empty token
* Default: 0, any number of successive tokenizing
* characters are combined as ONE token stop
* [<@cPreTokenSep>] If given by reference, the tokenizer before
* the actual token will be stored
* [<@cPostTokenSep>] If given by reference, the tokenizer after
* the actual token will be stored
* $RETURNS$
* <cToken> the token specified by the parameters given above
* $DESCRIPTION$
* The TOKEN() function extracts the <nTokenCount>th token from the
* string <cString>. In the course of this, the tokens in the
* string are separated by the character(s) specified in <cTokenizer>.
* The function may also extract empty tokens, if you specify a skip
* width other than zero.
* Be aware of the new 5th and 6th parameter there the TOKEN() function
* stores the tokenizing character before and after the extracted token.
* Therefore, additional calls to the TOKENSEP() function are not
* necessary.
* $EXAMPLES$
* ? token ("Hello, World!") --> "World"
* ? token ("Hello, World!",,2,1) --> ""
* ? token ("Hello, World!",",",2,1) --> " World!"
* ? token ("Hello, World!"," ",2,1) --> "World!"
* $TESTS$
* token ("Hello, World!") == "World"
* token ("Hello, World!",,2,1) == ""
* token ("Hello, World!",",",2,1) == " World!"
* token ("Hello, World!"," ",2,1) == "World!"
* $STATUS$
* Ready
* $COMPLIANCE$
* TOKEN() is compatible with CT3's TOKEN, but two additional
* parameters have been added there the TOKEN() function can store
* the tokenizers before and after the current token.
* $PLATFORMS$
* All
* $FILES$
* Source is token1.c, library is libct.
* $SEEALSO$
* NUMTOKEN(),ATTOKEN(),TOKENLOWER(),TOKENUPPER(),TOKENSEP()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* NUMTOKEN()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Retrieves the number of tokens in a string
* $SYNTAX$
* NUMTOKEN (<cString>, [<cTokenizer>], [<nSkipWidth>]) -> nTokenCount
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
*
* $EXAMPLES$
*
* $TESTS$
* numtoken ("Hello, World!") == 2
* numtoken ("This is good. See you! How do you do?",".!?") == 3
* numtoken ("one,,three,four,,six",",",1) == 6
* $STATUS$
* Ready
* $COMPLIANCE$
* NUMTOKEN() is compatible with CT3's NUMTOKEN().
* $PLATFORMS$
* All
* $FILES$
* Source is token1.c, library is libct.
* $SEEALSO$
* TOKEN(),ATTOKEN(),TOKENLOWER(),TOKENUPPER(),TOKENSEP()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* TOKENLOWER()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Change the first letter of tokens to lower case
* $SYNTAX$
* TOKENLOWER (<[@]cString>, [<cTokenizer>], [<nTokenCount>],
* [<nSkipWidth>]) -> cString
* $ARGUMENTS$
* <[@]cString> is the processed string
* [<cTokenizer>] is a list of characters separating the tokens
* in <cString>
* Default: chr(0)+chr(9)+chr(10)+chr(13)+chr(26)+
* chr(32)+chr(32)+chr(138)+chr(141)+
* ",.;:!\?/\\<>()#&%+-*"
* [<nTokenCount>] specifies the number of tokens that
* should be processed
* Default: all tokens
* [<nSkipWidth>] specifies the maximum number of successive
* tokenizing characters that are combined as
* ONE token stop, e.g. specifying 1 can
* yield to empty token
* Default: 0, any number of successive tokenizing
* characters are combined as ONE token stop
* $RETURNS$
* <cString> the string with the lowercased tokens
* $DESCRIPTION$
* The TOKENLOWER() function changes the first letter of tokens in <cString>
* to lower case. To do this, it uses the same tokenizing mechanism
* as the token() function. If TOKENLOWER() extracts a token that starts
* with a letter, this letter will be changed to lower case.
* You can omit the return value of this function by setting the CSETREF()
* switch to .T., but you must then pass <cString> by reference to get
* the result.
* $EXAMPLES$
* ? tokenlower("Hello, World, here I am!") // "hello, world, here i am!"
* ? tokenlower("Hello, World, here I am!",,3) // "hello, world, here I am!"
* ? tokenlower("Hello, World, here I am!",",",3) // "hello, World, here I am!"
* ? tokenlower("Hello, World, here I am!"," W") // "hello, World, here i am!"
* $TESTS$
* tokenlower("Hello, World, here I am!") == "hello, world, here i am!"
* tokenlower("Hello, World, here I am!",,3) == "hello, world, here I am!"
* tokenlower("Hello, World, here I am!",",",3) == "hello, World, here I am!"
* tokenlower("Hello, World, here I am!"," W") == "hello, World, here i am!"
* $STATUS$
* Ready
* $COMPLIANCE$
* TOKENLOWER() is compatible with CT3's TOKENLOWER(),
* but a new 4th parameter, <nSkipWidth> has been added for
* synchronization with the the other token functions.
* $PLATFORMS$
* All
* $FILES$
* Source is token1.c, library is libct.
* $SEEALSO$
* TOKEN(),NUMTOKEN(),ATTOKEN(),TOKENUPPER(),TOKENSEP(),CSETREF()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* TOKENUPPER()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Change the first letter of tokens to upper case
* $SYNTAX$
* TOKENUPPER (<[@]cString>, [<cTokenizer>], [<nTokenCount>],
* [<nSkipWidth>]) -> cString
* $ARGUMENTS$
* <[@]cString> is the processed string
* [<cTokenizer>] is a list of characters separating the tokens
* in <cString>
* Default: chr(0)+chr(9)+chr(10)+chr(13)+chr(26)+
* chr(32)+chr(32)+chr(138)+chr(141)+
* ",.;:!\?/\\<>()#&%+-*"
* [<nTokenCount>] specifies the number of tokens that
* should be processed
* Default: all tokens
* [<nSkipWidth>] specifies the maximum number of successive
* tokenizing characters that are combined as
* ONE token stop, e.g. specifying 1 can
* yield to empty token
* Default: 0, any number of successive tokenizing
* characters are combined as ONE token stop
* $RETURNS$
* <cString> the string with the uppercased tokens
* $DESCRIPTION$
* The TOKENUPPER() function changes the first letter of tokens in <cString>
* to upper case. To do this, it uses the same tokenizing mechanism
* as the token() function. If TOKENUPPER() extracts a token that starts
* with a letter, this letter will be changed to upper case.
* You can omit the return value of this function by setting the CSETREF()
* switch to .T., but you must then pass <cString> by reference to get
* the result.
* $EXAMPLES$
* ? tokenupper("Hello, world, here I am!") // "Hello, World, Here I Am!"
* ? tokenupper("Hello, world, here I am!",,3) // "Hello, World, Here I am!"
* ? tokenupper("Hello, world, here I am!",",",3) // "Hello, world, here I am!"
* ? tokenupper("Hello, world, here I am!"," w") // "Hello, wOrld, Here I Am!"
* $TESTS$
* tokenupper("Hello, world, here I am!") == "Hello, World, Here I Am!"
* tokenupper("Hello, world, here I am!",,3) == "Hello, World, Here I am!"
* tokenupper("Hello, world, here I am!",",",3) == "Hello, world, here I am!"
* tokenupper("Hello, world, here I am!"," w") == "Hello, wOrld, Here I Am!"
* $STATUS$
* Ready
* $COMPLIANCE$
* TOKENUPPER() is compatible with CT3's TOKENUPPER(),
* but a new 4th parameter, <nSkipWidth> has been added for
* synchronization with the the other token functions.
* $PLATFORMS$
* All
* $FILES$
* Source is token1.c, library is libct.
* $SEEALSO$
* TOKEN(),NUMTOKEN(),ATTOKEN(),TOKENLOWER(),TOKENSEP(),CSETREF()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* TOKENSEP()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Retrieves the token separators of the last token() call
* $SYNTAX$
* TOKENSEP ([<lMode>]) -> cSeparator
* $ARGUMENTS$
* [<lMode>] if set to .T., the token separator BEHIND the token
* retrieved from the token() call will be returned.
* Default: .F., returns the separator BEFORE the token
* $RETURNS$
* Depending on the setting of <lMode>, the separating character of the
* the token retrieved from the last token() call will be returned.
* These separating characters can now also be retrieved with the token()
* function.
* $DESCRIPTION$
* When one does extract tokens from a string with the token() function,
* one might be interested in the separator characters that have been
* used to extract a specific token. To get this information you can
* either use the TOKENSEP() function after each token() call, or
* use the new 5th and 6th parameter of the token() function.
* $EXAMPLES$
* see TOKEN() function
* $TESTS$
*
* $STATUS$
* Ready
* $COMPLIANCE$
* TOKENSEP() is compatible with CT3's TOKENSEP().
* $PLATFORMS$
* All
* $FILES$
* Source is token1.c, library is libct.
* $SEEALSO$
* TOKEN(),NUMTOKEN(),ATTOKEN(),TOKENLOWER(),TOKENUPPER()
* $END$
*/

View File

@@ -0,0 +1,394 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* TOKENINIT()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Initializes a token environment
* $SYNTAX$
* TOKENINIT (<[@]cString>], [<cTokenizer>], [<nSkipWidth>],
* [<@cTokenEnvironment>]) -> lState
* $ARGUMENTS$
* <[@]cString> is the processed string
* <cTokenizer> is a list of characters separating the tokens
* in <cString>
* Default: chr(0)+chr(9)+chr(10)+chr(13)+chr(26)+
* chr(32)+chr(32)+chr(138)+chr(141)+
* ",.;:!\?/\\<>()#&%+-*"
* <nSkipWidth> specifies the maximum number of successive
* tokenizing characters that are combined as
* ONE token stop, e.g. specifying 1 can
* yield to empty token
* Default: 0, any number of successive tokenizing
* characters are combined as ONE token stop
* <@cTokenEnvironment> is a token environment stored in a binary
* encoded string
* $RETURNS$
* <lState> success of the initialization
* $DESCRIPTION$
* The TOKENINIT() function initializes a token environment. A token
* environment is the information about how a string is to be tokenized.
* This information is created in the process of tokenization of the
* string <cString> - equal to the one used in the TOKEN() function
* with the help of the <cTokenizer> and <nSkipWidth> parameters.
*
* This token environment can be very useful when large strings have
* to be tokenized since the tokenization has to take place only once
* whereas the TOKEN() function must always start the tokenizing process
* from scratch.
*
* Unlike CTIII, this function provides two mechanisms of storing the
* resulting token environment. If a variable is passed by reference
* as 4th parameter, the token environment is stored in this variable,
* otherwise the global token environment is used. Do not modify the
* token environment string directly !
*
* Additionally, a counter is stored in the token environment, so that
* the tokens can successivly be obtained. This counter is first set to 1.
* When the TOKENINIT() function is called without a string a tokenize,
* the counter of either the global environment or the environment given
* by reference in the 4th parameter is rewind to 1.
*
* Additionally, unlike CTIII, tokeninit() does not need the string
* <cString> to be passed by reference, since one must provide the
* string in calls to TOKENNEXT() again.
* $EXAMPLES$
* tokeninit (cString) // tokenize the string <cString> with default
* // rules and store the token environment globally
* // and eventually delete an old global TE
* tokeninit (@cString) // no difference in result, but eventually faster,
* // since the string must not be copied
* tokeninit() // rewind counter of global TE to 1
* tokeninit ("1,2,3",",",1) // tokenize constant string, store in global TE
* tokeninit (cString,,1,@cTE1) // tokenize cString and store TE in
* // cTE1 only without overriding global TE
* tokeninit (cString,,1,cTE1) // tokenize cString and store TE in
* // GLOBAL TE since 4th parameter is
* // not given by reference !!!
* tokeninit (,,,@cTE1) // set counter in TE stored in cTE1 to 1
* $TESTS$
*
* $STATUS$
* Ready
* $COMPLIANCE$
* TOKENINIT() is compatible with CTIII's TOKENINIT(),
* but there is an additional parameter featuring local token environments.
* $PLATFORMS$
* All
* $FILES$
* Source is token2.c, library is libct.
* $SEEALSO$
* TOKEN(),TOKENEXIT(),TOKENNEXT(),TOKENNUM(),TOKENAT(),SAVETOKEN(),RESTTOKEN(),TOKENEND()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* TOKENNEXT()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Successivly obtains tokens from a string
* $SYNTAX$
* TOKENNEXT (<[@]cString>, [<nToken>],
* [<@cTokenEnvironment>]) -> cToken
* $ARGUMENTS$
* <[@]cString> the processed string
* <nToken> a token number
* <@cTokenEnvironment> a token environment
* $RETURNS$
* <cToken> a token from <cString>
* $DESCRIPTION$
* With TOKENNEXT(), the tokens determined with the TOKENINIT() functions
* can be retrieved. To do this, TOKENNEXT() uses the information stored
* in either the global token environment or the local one supplied by
* <cTokenEnvironment>. Note that, is supplied, this 3rd parameter has
* always to be passed by reference.
*
* If the 2nd parameter, <nToken> is given, TOKENNEXT() simply returns
* the <nToken>th token without manipulating the TE counter. Otherwise
* the token pointed to by the TE counter is returned and the counter
* is incremented by one. Like this, a simple loop with TOKENEND() can
* be used to retrieve all tokens of a string successivly.
*
* Note that <cString> does not have to be the same used in TOKENINIT(),
* so that one can do a "correlational tokenization", i.e. tokenize a string
* as if it was another! E.G. using TOKENINIT() with the string
* "AA,BBB" but calling TOKENNEXT() with "CCCEE" would
* give first "CC" and then "EE" (because "CCCEE" is not long enough).
* $EXAMPLES$
* // default behavhiour
* tokeninit (cString) // initialize a TE
* do while (!tokenend())
* ? tokennext (cString) // get all tokens successivly
* enddo
* ? tokennext (cString, 3) // get the 3rd token, counter will remain the same
* tokenexit() // free the memory used for the global TE
* $TESTS$
*
* $STATUS$
* Ready
* $COMPLIANCE$
* TOKENNEXT() is compatible with CTIII's TOKENNEXT(),
* but there are two additional parameters featuring local token
* environments and optional access to tokens.
* $PLATFORMS$
* All
* $FILES$
* Source is token2.c, library is libct.
* $SEEALSO$
* TOKENINIT(),TOKENEXIT(),TOKENNUM(),TOKENAT(),SAVETOKEN(),RESTTOKEN(),TOKENEND()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* TOKENNUM()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Get the total number of tokens in a token environment
* $SYNTAX$
* TOKENNUM ([<@cTokenEnvironment>]) -> nNumberofTokens
* $ARGUMENTS$
* <@cTokenEnvironment> a token environment
* $RETURNS$
* <nNumberofTokens> number of tokens in the token environment
* $DESCRIPTION$
* The TOKENNUM() function can be used to retrieve the total number
* of tokens in a token environment.
* If the parameter <@cTokenEnvironment> is supplied (must be by
* reference), the information from this token environment is used,
* otherwise the global TE is used.
* $EXAMPLES$
* tokeninit ("a.b.c.d", ".", 1) // initialize global TE
* ? tokennum() // --> 4
* $TESTS$
*
* $STATUS$
* Ready
* $COMPLIANCE$
* TOKENNUM() is a new function in Harbour's CTIII library.
* $PLATFORMS$
* All
* $FILES$
* Source is token2.c, library is libct.
* $SEEALSO$
* TOKENINIT(),TOKENEXIT(),TOKENNEXT(),TOKENAT(),SAVETOKEN(),RESTTOKEN(),TOKENEND()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* TOKENEND()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Check whether additional tokens are available with TOKENNEXT()
* $SYNTAX$
* TOKENEND ([<@cTokenEnvironment>]) -> lTokenEnd
* $ARGUMENTS$
* <@cTokenEnvironment> a token environment
* $RETURNS$
* <lTokenEnd> .T., if additional tokens are available
* $DESCRIPTION$
* The TOKENEND() function can be used to check whether the next
* call to TOKENNEXT() would return a new token. This can not be
* decided with TOKENNEXT() alone, since an empty token cannot be
* distinguished from a "no more" tokens.
* If the parameter <@cTokenEnvironment> is supplied (must be by
* reference), the information from this token environment is used,
* otherwise the global TE is used.
* With a combination of TOKENEND() and TOKENNEXT(), all tokens from a
* string can be retrieved successivly (see example).
* $EXAMPLES$
* tokeninit ("a.b.c.d", ".", 1) // initialize global TE
* do while (!tokenend())
* ? tokennext ("a.b.c.d") // get all tokens successivly
* enddo
* $TESTS$
*
* $STATUS$
* Ready
* $COMPLIANCE$
* TOKENEND() is compatible with CTIII's TOKENEND(),
* but there are is an additional parameter featuring local token environments.
* $PLATFORMS$
* All
* $FILES$
* Source is token2.c, library is libct.
* $SEEALSO$
* TOKENINIT(),TOKENEXIT(),TOKENNEXT(),TOKENNUM(),TOKENAT(),SAVETOKEN(),RESTTOKEN()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* TOKENEXIT()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Release global token environment
* $SYNTAX$
* TOKENEXIT () -> lStaticEnvironmentReleased
* $ARGUMENTS$
*
* $RETURNS$
* <lStaticEnvironmentReleased> .T., if global token environment is successfully released
* $DESCRIPTION$
* The TOKENEXIT() function releases the memory associated with the
* global token environment. One should use it for every tokeninit()
* using the global TE. Additionally, TOKENEXIT() is implicitly called
* from CTEXIT() to free the memory at library shutdown.
* $EXAMPLES$
* tokeninit (cString) // initialize a TE
* do while (!tokenend())
* ? tokennext (cString) // get all tokens successivly
* enddo
* ? tokennext (cString, 3) // get the 3rd token, counter will remain the same
* tokenexit() // free the memory used for the global TE
* $TESTS$
*
* $STATUS$
* Ready
* $COMPLIANCE$
* TOKENEXIT() is a new function in Harbour's CTIII library.
* $PLATFORMS$
* All
* $FILES$
* Source is token2.c, library is libct.
* $SEEALSO$
* TOKENINIT(),TOKENNEXT(),TOKENNUM(),TOKENAT(),SAVETOKEN(),RESTTOKEN(),TOKENEND()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* TOKENAT()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Get start and end positions of tokens in a token environment
* $SYNTAX$
* TOKENAT ([<lSeparatorPositionBehindToken>], [<nToken>],
* [<@cTokenEnvironment>]) -> nPosition
* $ARGUMENTS$
* <lSeparatorPositionBehindToken> .T., if TOKENAT() should return
* the position of the separator character
* BEHIND the token.
* Default: .F., return start position of a token.
* <nToken> a token number
* <@cTokenEnvironment> a token environment
* $RETURNS$
* <nPosition>
* $DESCRIPTION$
* The TOKENAT() function is used to retrieve the start and end position
* of the tokens in a token environment. Note however that the position of
* last character of a token is given by tokenat (.T.)-1 !!
*
* If the 2nd parameter, <nToken> is given, TOKENAT() returns the
* positions of the <nToken>th token. Otherwise
* the token pointed to by the TE counter, i.e. the token that will
* be retrieved by TOKENNEXT() _NEXT_ is used.
*
* If the parameter <@cTokenEnvironment> is supplied (must be by
* reference), the information from this token environment is used,
* otherwise the global TE is used.
* $EXAMPLES$
*
* $TESTS$
* tokeninit (cString) // initialize a TE
* do while (!tokenend())
* ? "From", tokenat(), "to", tokenat(.T.)-1
* ? tokennext (cString) // get all tokens successivly
* enddo
* ? tokennext (cString, 3) // get the 3rd token, counter will remain the same
* tokenexit() // free the memory used for the global TE
* $STATUS$
* Ready
* $COMPLIANCE$
* TOKENAT() is compatible with CTIII's TOKENAT(),
* but there are two additional parameters featuring local token
* environments and optional access to tokens.
* $PLATFORMS$
* All
* $FILES$
* Source is token2.c, library is libct.
* $SEEALSO$
* TOKENINIT(),TOKENEXIT(),TOKENNEXT(),TOKENNUM(),SAVETOKEN(),RESTTOKEN(),TOKENEND()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* SAVETOKEN()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Save the global token environment
* $SYNTAX$
* SAVETOKEN () -> cStaticTokenEnvironment
* $ARGUMENTS$
*
* $RETURNS$
* <cStaticTokenEnvironment> a binary string encoding the global TE
* $DESCRIPTION$
* The SAVETOKEN() function can be used to store the global TE for future
* use or when two or more incremental tokenizers must the nested.
* Note however that the latter can now be solved with locally stored
* token environments.
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Ready
* $COMPLIANCE$
* SAVETOKEN() is compatible with CTIII's SAVETOKEN(),
* $PLATFORMS$
* All
* $FILES$
* Source is token2.c, library is libct.
* $SEEALSO$
* TOKENINIT(),TOKENEXIT(),TOKENNEXT(),TOKENNUM(),TOKENAT(),RESTTOKEN(),TOKENEND()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* RESTTOKEN()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Restore global token environment
* $SYNTAX$
* RESTTOKEN (<cStaticTokenEnvironment>) -> cOldStaticEnvironment
* $ARGUMENTS$
* <cStaticTokenEnvironment> a binary string encoding a TE
* $RETURNS$
* <cOldStaticEnvironment> a string encoding the old global TE
* $DESCRIPTION$
* The RESTTOKEN() function restores the global TE to the one encoded
* in <cStaticTokenEnvironment>. This can either be the return value
* of SAVETOKEN() or the value stored in the 4th parameter in a
* TOKENINIT() call.
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Ready
* $COMPLIANCE$
* RESTTOKEN() is compatible with CTIII's RESTTOKEN(),
* $PLATFORMS$
* All
* $FILES$
* Source is token2.c, library is libct.
* $SEEALSO$
* TOKENINIT(),TOKENEXIT(),TOKENNEXT(),TOKENNUM(),TOKENAT(),SAVETOKEN(),TOKENEND()
* $END$
*/

View File

@@ -0,0 +1,548 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* PI()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Returns Pi, the perimeter-to-diameter-ratio of a circle
* $SYNTAX$
* PI () -> nPi
* $ARGUMENTS$
*
* $RETURNS$
* <nPi> the math constant Pi with maximum precision available
* $DESCRIPTION$
* The function PI() can be used if the constant Pi is needed
* with maximum precision. One of the most known interpretations of this
* number is the constant perimeter-to-diameter-ratio of circles.
* $EXAMPLES$
* // the diameter of a circle-like swimming pool is 3.4 meters, how
* // long is the perimeter ?
*
* ? str(PI()*3.4,5,3)+" meters" --> 10.681 meters
* $TESTS$
*
* $STATUS$
* Ready
* $COMPLIANCE$
* PI() is compatible with CT3's PI().
* $PLATFORMS$
* All
* $FILES$
* Source is trig.c, library is libct.
* $SEEALSO$
* SIN(),COS(),TAN(),COT(),ASIN(),ACOS(),ATAN(),ATN2(),SINH(),COSH(),TANH(),RTOD(),DTOR()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* SIN()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Sine of the argument
* $SYNTAX$
* SIN (nRadiant) -> nSine
* $ARGUMENTS$
* <nRadiant> an angle size given in radiants
* $RETURNS$
* <nSine> the sine of <nRadiant>
* $DESCRIPTION$
* The function SIN() calculates the sine of an angle whose size is
* given in radiants (full angle equals 2*Pi - see DTOR() for angle size
* given in degress).
* A common geometric interpretation of the SIN() function is the
* counterkathede-hypotenuse-ratio of a right-angled triangle.
* $EXAMPLES$
* ? sin (0.0) --> 0.0
* ? sin (1.0) --> 0.8414...
* $TESTS$
* sin (0.0) == 0.0
* sin (PI()/4) == sqrt(1/2)
* sin (PI()/2) == 1.0
* sin (PI()) == 0.0
* $STATUS$
* Ready
* $COMPLIANCE$
* SIN() is compatible with CT3's SIN().
* $PLATFORMS$
* All
* $FILES$
* Source is trig.c, library is libct.
* $SEEALSO$
* COS(),TAN(),COT(),ASIN(),ACOS(),ATAN(),ATN2(),SINH(),COSH(),TANH(),RTOD(),DTOR(),PI()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* COS()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Cosine of the argument
* $SYNTAX$
* COS (nRadiant) -> nCosine
* $ARGUMENTS$
* <nRadiant> an angle size given in radiants
* $RETURNS$
* <nCosine> the cosine of <nRadiant>
* $DESCRIPTION$
* The function COS() calculates the cosine of an angle whose size is
* given in radiants (full angle equals 2*Pi - see DTOR() for angle size
* given in degress).
* A common geometric interpretation of the COS() function is the
* ankathede-hypotenuse-ratio of a right-angled triangle.
* $EXAMPLES$
* ? cos (0.0) --> 1.0
* ? cos (1.0) --> 0.5403...
* $TESTS$
* cos (0.0) == 1.0
* cos (PI()/4) == sqrt(1/2)
* cos (PI()/2) == 0.0
* cos (PI()) == -1.0
* $STATUS$
* Ready
* $COMPLIANCE$
* COS() is compatible with CT3's COS().
* $PLATFORMS$
* All
* $FILES$
* Source is trig.c, library is libct.
* $SEEALSO$
* SIN(),TAN(),COT(),ASIN(),ACOS(),ATAN(),ATN2(),SINH(),COSH(),TANH(),RTOD(),DTOR(),PI()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* TAN()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Tangent of the argument
* $SYNTAX$
* TAN (nRadiant) -> nTangent
* $ARGUMENTS$
* <nRadiant> an angle size given in radiants
* $RETURNS$
* <nTangent> the tangent of <nRadiant>
* $DESCRIPTION$
* The function TAN() calculates the tangent of an angle whose size is
* given in radiants (full angle equals 2*Pi - see DTOR() for angle size
* given in degress).
* A common geometric interpretation of the TAN() function is the
* counterkathede-ankathede-ratio of a right-angled triangle, or,
* tan(x) = sin(x)/cos(x).
* $EXAMPLES$
* ? tan (0.0) --> 0.0
* ? tan (1.0) --> 1.5574...
* $TESTS$
* tan (0.0) == 0.0
* tan (PI()/4) == 1
* tan (PI()) == 0.0
* $STATUS$
* Ready
* $COMPLIANCE$
* TAN() is compatible with CT3's TAN().
* $PLATFORMS$
* All
* $FILES$
* Source is trig.c, library is libct.
* $SEEALSO$
* SIN(),COS(),COT(),ASIN(),ACOS(),ATAN(),ATN2(),SINH(),COSH(),TANH(),RTOD(),DTOR(),PI()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* COT()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Cotangent of the argument
* $SYNTAX$
* COT (nRadiant) -> nCotangent
* $ARGUMENTS$
* <nRadiant> an angle size given in radiants
* $RETURNS$
* <nCotangent> the cotangent of <nRadiant>
* $DESCRIPTION$
* The function COT() calculates the cotangent of an angle whose size is
* given in radiants (full angle equals 2*Pi - see DTOR() for angle size
* given in degress).
* A common geometric interpretation of the COT() function is the
* ankathede-counterkathede-ratio of a right-angled triangle, or,
* cot(x) = cos(x)/sin(x)=1/tan(x).
* $EXAMPLES$
* ? cot (1.0) --> 0.6420...
* $TESTS$
* cot (PI()/4) == 1
* cot (PI()/2) == 0
* $STATUS$
* Ready
* $COMPLIANCE$
* COT() is compatible with CT3's COT().
* $PLATFORMS$
* All
* $FILES$
* Source is trig.c, library is libct.
* $SEEALSO$
* SIN(),COS(),TAN(),ASIN(),ACOS(),ATAN(),ATN2(),SINH(),COSH(),TANH(),RTOD(),DTOR(),PI()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* ASIN()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Arcus sine of the argument
* $SYNTAX$
* ASIN (nSine) -> nRadiant
* $ARGUMENTS$
* <nSine> the sine of an angle
* $RETURNS$
* <nRadiant> the angle whose sine is <nSine>
* $DESCRIPTION$
* The function ASIN() is the inverse function of SIN(). It takes a
* sine value and returns the smallest(!) angle whose sine equals to the argument.
* The return value is given in radiants (full angle equals 2*Pi -
* see DTOR() if you need to convert it into degress).
* Note, that <nSine> must be between -1 and 1 and that <nRadiant>
* is always between -PI()/2 and PI()/2.
* $EXAMPLES$
* ? asin (0.0) --> 0.0
* ? asin (0.5) --> 0.5235...
* $TESTS$
* asin (0.0) == 0.0
* asin (sqrt(1/2)) == PI()/4
* asin (1.0) == PI()/2
* asin (0.0) == 0.0 // and not PI(), since the smallest angle is returned !
* $STATUS$
* Ready
* $COMPLIANCE$
* ASIN() is compatible with CT3's ASIN().
* $PLATFORMS$
* All
* $FILES$
* Source is trig.c, library is libct.
* $SEEALSO$
* SIN(),COS(),TAN(),COT(),ACOS(),ATAN(),ATN2(),SINH(),COSH(),TANH(),RTOD(),DTOR(),PI()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* ACOS()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Arcus cosine of the argument
* $SYNTAX$
* ACOS (nCosine) -> nRadiant
* $ARGUMENTS$
* <nCosine> the cosine of an angle
* $RETURNS$
* <nRadiant> the angle whose cosine is <nCosine>
* $DESCRIPTION$
* The function ACOS() is the inverse function of COS(). It takes a
* cosine value and returns the smallest(!) angle whose cosine equals to the argument.
* The return value is given in radiants (full angle equals 2*Pi -
* see DTOR() if you need to convert it into degress).
* Note, that <nCosine> must be between -1 and 1 and that <nRadiant>
* is always between 0 and PI().
* $EXAMPLES$
* ? acos (0.0) --> PI()/2
* ? acos (0.5) --> 1.04719...
* $TESTS$
* acos (0.0) == PI()/2
* acos (sqrt(1/2)) == PI()/4
* acos (1.0) == 0.0
* acos (-1.0) == PI()
* acos (0.0) == PI()/2 // and not -PI()/2, although cos (-PI()/2) == 0.0 !
* $STATUS$
* Ready
* $COMPLIANCE$
* ACOS() is compatible with CT3's ACOS().
* $PLATFORMS$
* All
* $FILES$
* Source is trig.c, library is libct.
* $SEEALSO$
* SIN(),COS(),TAN(),COT(),ASIN(),ATAN(),ATN2(),SINH(),COSH(),TANH(),RTOD(),DTOR(),PI()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* ATAN()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Arcus tangent of the argument
* $SYNTAX$
* ACOS (nTangent) -> nRadiant
* $ARGUMENTS$
* <nTangent> the tangent of an angle
* $RETURNS$
* <nRadiant> the angle whose tangent is <nTangent>
* $DESCRIPTION$
* The function ATAN() is the inverse function of TAN(). It takes a
* tangent value and returns the smallest(!) angle whose tangent equals to the argument.
* The return value is given in radiants between -PI()/2 and PI()/2
* (full angle equals 2*Pi - see DTOR() if you need to convert it into degress).
* $EXAMPLES$
* ? atan (0.0) --> 0.0
* ? atan (0.5) --> 0.4636...
* $TESTS$
* atan (0.0) == 0.0
* atan (1.0) == PI()/4
* atan (0.0) == 0.0 // and not PI(), although tan (PI()) == 0.0 !
* $STATUS$
* Ready
* $COMPLIANCE$
* ATAN() is compatible with CT3's ATAN().
* $PLATFORMS$
* All
* $FILES$
* Source is trig.c, library is libct.
* $SEEALSO$
* SIN(),COS(),TAN(),COT(),ASIN(),ACOS(),ATAN(),SINH(),COSH(),TANH(),RTOD(),DTOR(),PI()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* ATN2()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Arcus tangent a sine and a cosine argument
* $SYNTAX$
* ATN2 (nSine, nCosine) -> nRadiant
* $ARGUMENTS$
* <nSine> the sine of an angle
* <nCosine> the cosine of an angle
* $RETURNS$
* <nRadiant> the angle whose tangent is <nSine>/<nCosine>
* $DESCRIPTION$
* The function ATN2() is an alternate function for calculating
* the arcus tangent, atn2(x,y) = atan(x/y).
* It takes two arguments, the sine and the cosine
* of the angle that should be calculated. Thus, in contrast to the ATAN()
* function, ATN2() can distinguish whether the sine or the cosine has
* a negative sign (or both being positive or negative), so that
* the return value can be between -PI() and PI() and covers the full
* angle.
* The return value is given in radiants (full angle equals 2*Pi -
* see DTOR() if you need to convert it into degress).
* $EXAMPLES$
* ? atn2 (0.0, 1.0) --> 0.0
* ? atn2 (sqrt(1/2), sqrt(1/2)) --> PI()/4
* $TESTS$
* atn2 (0.0, 1.0) == 0.0
* atn2 (sqrt(1/2),sqrt(1/2)) == PI()/4
* atn2 (-sqrt(1/2),-sqrt(1/2)) == -3/4*PI() // atan() would return PI()/4 !
* $STATUS$
* Ready
* $COMPLIANCE$
* ATN2() is compatible with CT3's ATN2().
* $PLATFORMS$
* All
* $FILES$
* Source is trig.c, library is libct.
* $SEEALSO$
* SIN(),COS(),TAN(),COT(),ASIN(),ACOS(),ATAN(),SINH(),COSH(),TANH(),RTOD(),DTOR(),PI()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* SINH()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Hyperbolic Sine of the argument
* $SYNTAX$
* SINH (nArea) -> nHyperbolicSine
* $ARGUMENTS$
* <nArea> the size of the area (see below)
* $RETURNS$
* <nHyperbolicSine> the hyperbolic sine of <nArea>
* $DESCRIPTION$
* The function SINH() calculates the hyperbolic sine of the argument.
* In analytical mathematics it is defined as 1/2*(exp(nArea)-exp(-nArea)).
* A common geometric interpretation of the SINH() function is the
* maximum y value of the points in the area with the given size <nArea>,
* that is bound by the x axis, a straight line through the point of
* origin (this one is fixed by the area) and the hyperbola x^2-y^2=1.
* $EXAMPLES$
* ? sinh (0.0) --> 0.0
* ? sinh (1.0) --> 1.1752...
* $TESTS$
* sinh (0.0) == 0.0
* sinh (-0.5) == -sinh(0.5)
* $STATUS$
* Ready
* $COMPLIANCE$
* SINH() is new in Harbours CT3's library.
* $PLATFORMS$
* All
* $FILES$
* Source is trig.c, library is libct.
* $SEEALSO$
* SIN(),COS(),TAN(),COT(),ASIN(),ACOS(),ATAN(),ATN2(),COSH(),TANH(),RTOD(),DTOR(),PI()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* COSH()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Hyperbolic Cosine of the argument
* $SYNTAX$
* COSH (nArea) -> nHyperbolicCosine
* $ARGUMENTS$
* <nArea> the size of the area (see below)
* $RETURNS$
* <nHyperbolicCosine> the hyperbolic cosine of <nArea>
* $DESCRIPTION$
* The function COSH() calculates the hyperbolic cosine of the argument.
* In analytical mathematics it is defined as 1/2*(exp(nArea)+exp(-nArea)).
* A common geometric interpretation of the COSH() function is the
* maximum x value of the points in the area with the given size <nArea>,
* that is bound by the x axis, a straight line through the point of
* origin (this one is fixed by the area) and the hyperbola x^2-y^2=1.
* $EXAMPLES$
* ? cosh (0.0) --> 1.0
* ? cosh (1.0) --> 1.5430...
* $TESTS$
* cosh (0.0) == 1.0
* cosh (-0.5) == cosh(0.5)
* $STATUS$
* Ready
* $COMPLIANCE$
* COSH() is new in Harbours CT3's library.
* $PLATFORMS$
* All
* $FILES$
* Source is trig.c, library is libct.
* $SEEALSO$
* SIN(),COS(),TAN(),COT(),ASIN(),ACOS(),ATAN(),ATN2(),SINH(),TANH(),RTOD(),DTOR(),PI()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* TANH()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Hyperbolic Tangent of the argument
* $SYNTAX$
* TANH (nArea) -> nHyperbolicTangent
* $ARGUMENTS$
* <nArea> the size of the area (see below)
* $RETURNS$
* <nHyperbolicTangent> the hyperbolic tangent of <nArea>
* $DESCRIPTION$
* The function TANH() calculates the hyperbolic tangent of the argument.
* In analytical mathematics it is defined as SINH(x)/COSH(x).
* $EXAMPLES$
* ? tanh (0.0) --> 0.0
* ? tanh (1.0) --> 0.7615...
* $TESTS$
* tanh (0.0) == 0.0
* tanh (-0.5) == -tanh(0.5)
* $STATUS$
* Ready
* $COMPLIANCE$
* TANH() is new in Harbours CT3's library.
* $PLATFORMS$
* All
* $FILES$
* Source is trig.c, library is libct.
* $SEEALSO$
* SIN(),COS(),TAN(),COT(),ASIN(),ACOS(),ATAN(),ATN2(),SINH(),COSH(),RTOD(),DTOR(),PI()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* RTOD()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Convert radiant to degree
* $SYNTAX$
* RTOD (nRadiant) -> nDegree
* $ARGUMENTS$
* <nRadiant> the size of an angle in radiant
* $RETURNS$
* <nDegree> the size of that angle in degree
* $DESCRIPTION$
* The function RTOD() can be used to convert sizes of angles given
* in radiant (like those returned by the asin, acos or atan function)
* to degrees that are commonly used geometry and technics.
* $EXAMPLES$
* ? rtod (PI()) --> 180
* ? tanh (PI()/3) --> 60
* $TESTS$
* rtod (0.0) == 0.0
* rtod (PI()) == 180.0
* $STATUS$
* Ready
* $COMPLIANCE$
* RTOD() is compatible with CT3's RTOD().
* $PLATFORMS$
* All
* $FILES$
* Source is trig.c, library is libct.
* $SEEALSO$
* SIN(),COS(),TAN(),COT(),ASIN(),ACOS(),ATAN(),ATN2(),SINH(),COSH(),TANH(),DTOR(),PI()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* DTOR()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Convert degree to radiant
* $SYNTAX$
* DTOR (nDegree) -> nRadiant
* $ARGUMENTS$
* <nDegree> the size of that angle in degree
* $RETURNS$
* <nRadiant> the size of an angle in radiant
* $DESCRIPTION$
* The function DTOR() can be used to convert sizes of angles given
* in degrees to radiant (as expected by sin, cos or tan functions).
* $EXAMPLES$
* ? dtor (180) --> PI()
* ? dtor (60) --> PI()/3
* $TESTS$
* dtor (0.0) == 0.0
* dtor (180.0) == PI()
* $STATUS$
* Ready
* $COMPLIANCE$
* DTOR() is compatible with CT3's DTOR().
* $PLATFORMS$
* All
* $FILES$
* Source is trig.c, library is libct.
* $SEEALSO$
* SIN(),COS(),TAN(),COT(),ASIN(),ACOS(),ATAN(),ATN2(),SINH(),COSH(),TANH(),RTOD(),PI()
* $END$
*/

View File

@@ -0,0 +1,145 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* CHARPIX()
* $CATEGORY$
* HBCT video functions
* $ONELINER$
* Gets the number of scan lines per character.
* $SYNTAX$
* CHARPIX() --> nHeight
* $ARGUMENTS$
*
* $RETURNS$
* Returns the number of scan lines per character.
* $DESCRIPTION$
* Returns the number of scan lines per character.
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* This function is xHarbour libct contrib
* $PLATFORMS$
* DJGPP
* $FILES$
* Source is video.c, library is libct.
* $SEEALSO$
*
* $END$
*/
/* $DOC$
* $FUNCNAME$
* VGAPALETTE()
* $CATEGORY$
* HBCT video functions
* $ONELINER$
* Changes VGA palette colors
* $SYNTAX$
* VGAPALETTE([<cColor|nColor>, [<nRedValue>, <nGreenValue>,
* <nBlueValue]]) --> lValid
* $ARGUMENTS$
* <cColor|nColor> - the color to change in CA-Cl*pper color notation or
* as a number from 0 to 15.
* <nRedValue>, <nGreenValue>, and <nBlueValue> specify the palette
* settings for the respective portions in the range from 0 to 63.
* If no RGB value is specified, the palette register is reset to
* its default value (currently unsupported).
* If the function is called without parameters, the palette registers for
* all colors are reset to their default values (currently unsupported).
* $RETURNS$
* Returns .T. on success.
* $DESCRIPTION$
*
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* This function is xHarbour libct contrib
* $PLATFORMS$
* DJGPP
* $FILES$
* Source is video.c, library is libct.
* $SEEALSO$
* EGAPALETTE() FONTRESET()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* VIDEOTYPE()
* $CATEGORY$
* HBCT video functions
* $ONELINER$
* Detects supported video adapter modes
* $SYNTAX$
* VIDEOTYPE() --> nMask
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: Finish documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* This function is xHarbour libct contrib
* $PLATFORMS$
* DJGPP
* $FILES$
* Source is video.c, library is libct.
* $SEEALSO$
* ISCGA(), ISEGA(), ISHERCULES(), ISMCGA(), ISMONO(), ISPGA(), ISVGA()
* $END$
*/
/* $DOC$
* $FUNCNAME$
* SETFONT()
* $CATEGORY$
* HBCT video functions
* $ONELINER$
* Loads font from a string.
* $SYNTAX$
* SETFONT(<cFontString>, [<nFontArea>], [<nOffset>], [<nCounter>]) --> nError
* or:
* SETFONT(<cFontString>, [<nFontArea>], [<lCompute>]) --> nError
* $ARGUMENTS$
* <cFontString> Binary string containing a valid font definition.
* <nFontArea> Number of a font area where the font must be loaded.
* <nOffset> First character code to be loaded.
* <nCounter> Number of characters to load.
* <lCompute> When .T., the function computes font height automatically.
* $RETURNS$
*
* $DESCRIPTION$
* TODO: Finish documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* This function is xHarbour libct contrib
* $PLATFORMS$
* DJGPP
* $FILES$
* Source is video.c, library is libct.
* $SEEALSO$
*
* $END$
*/

View File

@@ -0,0 +1,67 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* WORDREPL()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Replacement of double characters
* $SYNTAX$
* WORDREPL (<cDoubleCharacterSearchString>, <[@]cString>,
* <cDoubleCharacterReplaceString>, [<lMode>]) -> cString
* $ARGUMENTS$
* <cDoubleCharacterSearchString> is a string of double characters
* that should be replaced
* <[@]cString> is the processed string
* <cDoubleCharacterReplaceString> is a string of double characters that
* replace the one of <cSearchString>
* [<lMode>] sets the replacement method (see description)
* Default: .F.
* $RETURNS$
* cString the processed string
* $DESCRIPTION$
* The WORDREPL() takes the double characters of <cDoubleCharacterSearchString>
* one after the other and searches for them in <cString>.
* For <lMode> set to .F., this search is successful, if the double
* character sequence in <cString> starts at an odd position or at any
* position, if <lMode> is set to .T.
* If this happens, the double character sequence will be replaced with
* the corresponding double character sequence of <cDoubleCharacterReplaceString>.
* If <cDoubleCharacterReplaceString> is shorter than <cDoubleCharacterSearchString>
* the last double sequence of <cDoubleCharacterReplaceString> is used for
* the "rest" of <cDoubleCharacterSearchString>. Note that the last double
* character sequence in "AABBC" is "BB" in this context !!
* After the replacement the function restarts the search in <cString>
* BEHIND the replacement if the CSETATMUPA() switch is turned off, or
* BEHIND the first character of the replacement if the switch is turned on.
* (see examples for this !)
* One can omit the return value of this function by setting the CSETREF()
* to .T., but one must then pass <cString> by reference to get a result.
* $EXAMPLES$
* ? wordrepl("CC", "AABBCCDDEE", "XX") // "AABBXXDDEE"
* ? wordrepl("aa", "1aaaa", "ba") // "1abaa"
* ? wordrepl("aa", "1aaaa", "ba", .T.) // "1baba"
* csetatmupa(.T.)
* ? wordrepl("aa", "1aaaa", "ba") // "1abaa"
* ? wordrepl("aa", "1aaaa", "ba", .T.) // "1bbba"
* $TESTS$
* wordrepl("CC", "AABBCCDDEE", "XX") == "AABBXXDDEE"
* wordrepl("aa", "1aaaa", "ba") == "1abaa"
* wordrepl("aa", "1aaaa", "ba", .T.) == "1baba"
* eval ({||csetatmupa(.T.),wordrepl("aa", "1aaaa", "ba")}) == "1abaa"
* eval ({||csetatmupa(.T.),wordrepl("aa", "1aaaa", "ba", .T.)}) == "1bbba"
* $STATUS$
* Ready
* $COMPLIANCE$
* WORDREPL() is compatible with CT3's WORDREPL().
* $PLATFORMS$
* All
* $FILES$
* Source is wordrepl.c, library is ct3.
* $SEEALSO$
* CHARREPL(),RANGEREPL(),POSREPL(),CSETREF(),CSETATMUPA()
* $END$
*/

View File

@@ -0,0 +1,36 @@
/*
* $Id$
*/
/* $DOC$
* $FUNCNAME$
* WORDTOCHAR()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Replace double with single characters
* $SYNTAX$
* WORDTOCHAR (<cDoubleCharacterSearchString>, <cString>,
* <cSingleCharacterReplaceString>) -> cString
* $ARGUMENTS$
*
* $RETURNS$
*
* $DESCRIPTION$
* TODO: add documentation
* $EXAMPLES$
*
* $TESTS$
*
* $STATUS$
* Started
* $COMPLIANCE$
* WORDTOCHAR() is compatible with CT3's WORDTOCHAR().
* $PLATFORMS$
* All
* $FILES$
* Source is wordtoch.c, library is libct.
* $SEEALSO$
* CSETATMUPA(),CHARREPL(),WORDREPL()
* $END$
*/

View File

@@ -57,46 +57,6 @@
/* undefine the following if you want to evaluate the mantissa and exponent from the doubles' bit representation */
/* #define CT_EXPONENT_MANTISSA_BIT 1 */
/* $DOC$
* $FUNCNAME$
* MANTISSA()
* $CATEGORY$
* CT3 number and bit manipulation functions
* $ONELINER$
* Evaluate the mantissa of a floating point number
* $SYNTAX$
* MANTISSA( <nFloatingPointNumber> ) --> nMantissa
* $ARGUMENTS$
* <nFloatingPointNumber> Designate any Harbour number.
* $RETURNS$
* MANTISSA() returns the mantissa of the <nFloatingPointNumber> number.
* $DESCRIPTION$
* This function supplements EXPONENT() to return the mantissa of the
* <nFloatingPointNumber> number.
*
* Note: The mantissa value can be 0 or in the range of 1 to 2.
*
* The following calculation reproduces the original value:
*
* MANTISSA(<nFloatingPointNumber>)* 2^EXPONENT(<nFloatingPointNumber>) =
* <nFloatingPointNumber>
*
* TODO: add documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* MANTISSA() is compatible with CT3's MANTISSA().
* $PLATFORMS$
* All
* $FILES$
* Source is exponent.c, library is libct.
* $SEEALSO$
* EXPONENT()
* $END$
*/
HB_FUNC( MANTISSA )
{
@@ -147,52 +107,6 @@ HB_FUNC( MANTISSA )
}
/* $DOC$
* $FUNCNAME$
* EXPONENT()
* $CATEGORY$
* CT3 number and bit manipulation functions
* $ONELINER$
* Evaluate the exponent of a floating point number
* $SYNTAX$
* EXPONENT( <nFloatingPointNumber> ) --> nExponent
* $ARGUMENTS$
* <nFloatingPointNumber> Designate any Harbour number.
* $RETURNS$
* EXPONENT() returns the exponent of the <nFloatingPointNumber> number
* in base 2.
* $DESCRIPTION$
* This function supplements MANTISSA() to return the exponent of the
* <nFloatingPointNumber> number.
*
* Values > 1 or values < -1 return a positive number 0 to 1023.
*
* Values < 1 or values > -1 return a negative number -1 to -1023.
*
* The EXPONENT( 0 ), return 0.
*
* The following calculation reproduces the original value:
*
* 2^EXPONENT(<nFloatingPointNumber>) * MANTISSA(<nFloatingPointNumber>) =
* <nFloatingPointNumber>
*
* TODO: add documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* EXPONENT() is compatible with CT3's EXPONENT()
* $PLATFORMS$
* All
* $FILES$
* Source is exponent.c, library is libct.
* $SEEALSO$
* MANTISSA()
* $END$
*/
HB_FUNC( EXPONENT )
{

View File

@@ -66,7 +66,6 @@
*
*/
#include "common.ch"
#include "fileio.ch"

View File

@@ -84,7 +84,6 @@
# include <time.h>
#endif
typedef struct
{
PHB_FFIND ffind;
@@ -103,7 +102,6 @@ static HB_TSD_NEW( s_FFData, sizeof( HB_FFDATA ), NULL, hb_fileFindRelease );
#define HB_GET_FFDATA() ( ( PHB_FFDATA ) hb_stackGetTSD( &s_FFData ) )
static PHB_FFIND _hb_fileStart( HB_BOOL fNext, HB_FATTR ulAttr )
{
PHB_FFDATA pFFData = HB_GET_FFDATA();
@@ -191,7 +189,6 @@ HB_FUNC( FILETIME )
hb_retc( ffind ? ffind->szTime : NULL );
}
HB_FUNC( SETFATTR )
{
int iResult;
@@ -204,7 +201,6 @@ HB_FUNC( SETFATTR )
hb_retni( iResult );
}
HB_FUNC( SETFDATI )
{
const char *szFile = hb_parc( 1 );
@@ -243,7 +239,6 @@ HB_FUNC( SETFDATI )
hb_retl( fResult );
}
HB_FUNC( FILEDELETE )
{
HB_BOOL bReturn = HB_FALSE;
@@ -288,26 +283,22 @@ HB_FUNC( FILEDELETE )
hb_retl( bReturn );
}
HB_FUNC( FILEMOVE )
{
hb_retnint( hb_fsRename( hb_parcx( 1 ),
hb_parcx( 2 ) ) ? 0 : - ( HB_MAXINT ) hb_fsOsError() );
}
HB_FUNC( RENAMEFILE )
{
HB_FUNC_EXEC( FILEMOVE );
}
HB_FUNC( DELETEFILE )
{
hb_retnint( hb_fsDelete( hb_parcx( 1 ) ) ? 0 : - ( HB_MAXINT ) hb_fsOsError() );
}
HB_FUNC( FILESMAX )
{
#if defined( __DJGPP__ )

View File

@@ -61,64 +61,10 @@
*
*/
#include "ct.h"
#include "ctmath.h"
#include "hbmather.h"
/* $DOC$
* $FUNCNAME$
* FV()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Future value of a capital
* $SYNTAX$
* FV (nDeposit, nInterest, nPeriods) --> nFutureValue
* $ARGUMENTS$
* <nDeposit> amount of money invested per period
* <nInterest> rate of interest per period, 1 == 100%
* <nPeriods> period count
* $RETURNS$
* <nFutureValue> Total value of the capital after <nPeriods> of
* paying <nDeposit> and <nInterest> interest being
* paid every period and added to the capital (resulting
* in compound interest)
* $DESCRIPTION$
* FV() calculates the value of a capital after <nPeriods> periods.
* Starting with a value of 0, every period, <nDeposit>
* (Dollars, Euros, Yens, ...) and an interest of <nInterest> for the
* current capital are added for the capital (<nInterest>=Percent/100).
* Thus, one gets the non-linear effects of compound interests:
* value in period 0 = 0
* value in period 1 = ((value in period 0)*(1+<nInterest>/100)) + <nDeposit>
* value in period 2 = ((value in period 1)*(1+<nInterest>/100)) + <nDeposit>
* etc....
* value in period <nPeriod> = ((value in period <nPeriod>-1)*(1+<nInterest>/100))< + <nDeposit>
* = <nDeposit> * sum from i=0 to <nPeriod>-1 over (1+<nInterest>/100)^i
* = <nDeposit> * ((1+<nInterest>/100)^n-1) / (<nInterest>/100)
* $EXAMPLES$
* // Payment of 1000 per year for 10 years at a interest rate
* // of 5 per cent per year
*
* ? fv (1000, 0.05, 10) --> 12577.893
* $TESTS$
* fv (1000, 0.00, 10) == 10000.0
* fv (1000, 0.05, 10) == 12577.893
* $STATUS$
* Ready
* $COMPLIANCE$
* FV() is compatible with CT3's FV().
* $PLATFORMS$
* All
* $FILES$
* Source is finan.c, library is libct.
* $SEEALSO$
* PV(),PAYMENT(),PERIODS(),RATE()
* $END$
*/
HB_FUNC( FV )
{
if( HB_ISNUM( 1 ) && HB_ISNUM( 2 ) && HB_ISNUM( 3 ) )
@@ -168,58 +114,6 @@ HB_FUNC( FV )
}
}
/* $DOC$
* $FUNCNAME$
* PV()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Present value of a loan
* $SYNTAX$
* PV (nPayment, nInterest, nPeriods) --> nPresentValue
* $ARGUMENTS$
* <nPayment> amount of money paid back per period
* <nInterest> rate of interest per period, 1 == 100%
* <nPeriods> period count
* $RETURNS$
* <nPresentValue> Present value of a loan when one is paying back
* <nDeposit> per period at a rate of interest of
* <nInterest> per period
* $DESCRIPTION$
* PV() calculates the present value of a loan that is paid back
* in <nPeriods> payments of <nPayment> (Dollars, Euros, Yens,...)
* while the rate of interest is <nInterest> per period:
* debt in period 0 = <nPresentValue>
* debt in period 1 = ((debt in period 0)-<nPayment>)*(1+<nInterest>/100)
* debt in period 2 = ((debt in period 1)-<nPayment>)*(1+<nInterest>/100)
* etc...
* debt in period <nPeriod> = ((debt in period <nPeriod>-1)-<nPayment>)*(1+<nInterest>/100)
* -> has to be 0, so
* <nPresentValue> = <nPayment>*(1-(1+<nInterest>/100)^(-n))/(<nInterest>/100)
* $EXAMPLES$
* // You can afford to pay back 100 Dollars per month for 5 years
* // at a interest rate of 0.5% per month (6% per year), so instead
* // of 6000 Dollars (the amount you will pay back) the bank will pay
* // you
*
* ? pv (100, 0.005, 60) --> 5172.56
* $TESTS$
* pv (100, 0.0, 60) == 6000.0
* pv (100, 0.005, 60) == 5172.56
* $STATUS$
* Ready
* $COMPLIANCE$
* PV() is compatible with CT3's PV().
* $PLATFORMS$
* All
* $FILES$
* Source is finan.c, library is libct.
* $SEEALSO$
* FV(),PAYMENT(),PERIODS(),RATE()
* $END$
*/
HB_FUNC( PV )
{
if( HB_ISNUM( 1 ) && HB_ISNUM( 2 ) && HB_ISNUM( 3 ) )
@@ -269,56 +163,6 @@ HB_FUNC( PV )
}
}
/* $DOC$
* $FUNCNAME$
* PAYMENT()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Payments for a loan
* $SYNTAX$
* PAYMENT (nLoan, nInterest, nPeriods) --> nPayment
* $ARGUMENTS$
* <nLoan> amount of money you get from the bank
* <nInterest> rate of interest per period, 1 == 100%
* <nPeriods> period count
* $RETURNS$
* <nPayment> Periodical payment one has to make to pay the
* loan <nLoan> back
* $DESCRIPTION$
* PAYMENT() calculates the payment one has to make periodically
* to pay back a loan <nLoan> within <nPeriods> periods and for a
* rate of interest <nInterest> per period.
* debt in period 0 = <nLoan>
* debt in period 1 = ((debt in period 0)-<nPayment>)*(1+<nInterest>/100)
* debt in period 2 = ((debt in period 1)-<nPayment>)*(1+<nInterest>/100)
* etc...
* debt in period <nPeriod> = ((debt in period <nPeriod>-1)-<nPayment>)*(1+<nInterest>/100)
* -> has to be 0, so
* <nPayment> = <nLoan>*(<nInterest>/100)/(1-(1+<nInterest>/100)^(-n))
* $EXAMPLES$
* // You get a loan of 5172.56 at a interest rate of 0.5% per
* // month (6% per year).
* // For 5 years, you have to pay back every month
*
* ? payment (5172.56, 0.005, 60) --> 100.00
* $TESTS$
* payment (5172.56, 0.0, 60) == 86.21
* payment (5172.56, 0.005, 60) == 100.00
* $STATUS$
* Ready
* $COMPLIANCE$
* PAYMENT() is compatible with CT3's PAYMENT().
* $PLATFORMS$
* All
* $FILES$
* Source is finan.c, library is libct.
* $SEEALSO$
* PV(),FV(),PERIODS(),RATE()
* $END$
*/
HB_FUNC( PAYMENT )
{
if( HB_ISNUM( 1 ) && HB_ISNUM( 2 ) && HB_ISNUM( 3 ) )
@@ -368,61 +212,6 @@ HB_FUNC( PAYMENT )
}
}
/* $DOC$
* $FUNCNAME$
* PERIODS()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Number of periods for a loan
* $SYNTAX$
* PERIODS (nLoan, nPayment, nInterest) --> nPeriods
* $ARGUMENTS$
* <nLoan> amount of money you get from the bank
* <nPayment> amount of money you pay back per period
* <nInterest> rate of interest per period, 1 == 100%
* $RETURNS$
* <nPeriods> number of periods you need to pay the loan back
* $DESCRIPTION$
* PERIODS() calculates the number of periods one needs to pay back
* a loan of <nLoan> with periodical payments of <nPayment> and for a
* rate of interest <nInterest> per period.
* debt in period 0 = <nLoan>
* debt in period 1 = ((debt in period 0)-<nPayment>)*(1+<nInterest>/100)
* debt in period 2 = ((debt in period 1)-<nPayment>)*(1+<nInterest>/100)
* etc...
* debt in period <nPeriod> = ((debt in period <nPeriod>-1)-<nPayment>)*(1+<nInterest>/100)
* -> has to be 0, so
* <nPeriods> = -log(1-<nLoan>*(<nInterest>/100)/<nPayment>)/log(1+<nInterest>/100))
*
* Note, however that in the case of nPayment <= <nLoan>*(<nInterest>/100),
* one would need infinite time to pay the loan back. The functions does
* then return -1.
* $EXAMPLES$
* // You get a loan of 5172.56 at a interest rate of 0.5% per
* // month (6% per year).
* // You can afford to pay 100 back every month, so you need
*
* ? periods (5172.56, 100, 0.005) --> 60.0
*
* // months to cancel the loan.
* $TESTS$
* periods (5172.56, 100, 0.005) == 60.0
* periods (5172.56, 100, 0.0) == 51.7256
* $STATUS$
* Ready
* $COMPLIANCE$
* PERIODS() is compatible with CT3's PERIODS().
* $PLATFORMS$
* All
* $FILES$
* Source is finan.c, library is libct.
* $SEEALSO$
* PV(),FV(),PAYMENT(),RATE()
* $END$
*/
HB_FUNC( PERIODS )
{
if( HB_ISNUM( 1 ) && HB_ISNUM( 2 ) && HB_ISNUM( 3 ) )
@@ -489,54 +278,6 @@ HB_FUNC( PERIODS )
}
}
/* $DOC$
* $FUNCNAME$
* RATE()
* $CATEGORY$
* CT3 math functions
* $ONELINER$
* Estimate rate of interest for a loan
* $SYNTAX$
* RATE (nLoan, nPayment, nPeriods) --> nRate
* $ARGUMENTS$
* <nLoan> amount of money you get from the bank
* <nPayment> amount of money you pay back per period
* <nPeriods> number of periods you pay the loan back
* $RETURNS$
* <nInterest> estimated rate of interest per period, 1 == 100%
* $DESCRIPTION$
* RATE() calculates the rate of interest per period for the given
* loan, payment per periods and number of periods. This is done with
* the same equation used in the PAYMENT() or PERIODS() function:
*
* <nPayment> = <nLoan>*(<nInterest>/100)/(1-(1+<nInterest>/100)^(-<nPeriods>))
*
* However, this equation can not be solved for <nInterest> in a "closed"
* manner, i.e. <nInterest> = ..., so that the result can only be estimated.
* $EXAMPLES$
* // You get a loan of 5172.56, pay 100 back every month for
* // 5 years (60 months). The effective interest rate per
* // period (=month) is
*
* ? rate (5172.56, 100, 60) --> 0.005
*
* $TESTS$
* rate (5172.56, 100, 60.0) == 0.005
* rate (6000.0, 100, 60.0) == 0.0
* $STATUS$
* Ready
* $COMPLIANCE$
* RATE() is compatible with CT3's RATE().
* $PLATFORMS$
* All
* $FILES$
* Source is finan.c, library is libct.
* $SEEALSO$
* PV(),FV(),PAYMENT(),PERIODS()
* $END$
*/
HB_FUNC( RATE )
{
if( HB_ISNUM( 1 ) && HB_ISNUM( 2 ) && HB_ISNUM( 3 ) )

View File

@@ -53,43 +53,6 @@
#include "ct.h"
/* $DOC$
* $FUNCNAME$
* FTOC()
* $CATEGORY$
* CT3 number and bit manipulation functions
* $ONELINER$
* $SYNTAX$
* FTOC( <nFloatingPointNumber> ) --> cFloatingPointNumber
*
* $ARGUMENTS$
* <nFloatingPointNumber> Designate any Harbour number.
*
* $RETURNS$
* FTOC() return a string with the size of DOUBLE.
* ATTENTION: different implementations or platforms of Harbour, they
* could produce different format in the string returned by FTOC().
*
* $DESCRIPTION$
* Harbour internal numbers in Floating Point are stored in data type
* DOUBLE. FTOC() returns these bits as an string. In this way,
* numbers con be saved more compactly.
*
* TODO: add documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* $PLATFORMS$
* All
* $FILES$
* Source is ftoc.c, library is libct.
* $SEEALSO$
* CTOF(), XTOC()
* $END$
*/
HB_FUNC( FTOC )
{
char buf[ sizeof( double ) ];
@@ -99,45 +62,6 @@ HB_FUNC( FTOC )
hb_retclen( buf, sizeof( buf ) );
}
/* $DOC$
* $FUNCNAME$
* CTOF()
* $CATEGORY$
* CT3 number and bit manipulation functions
* $ONELINER$
* $SYNTAX$
* CTOF( <cFloatingPointNumber> ) --> nFloatingPointNumber
*
* $ARGUMENTS$
* <cFloatingPointNumber> Designate a string that contains a Harbour
* number in flotaing point format.
* ATTENTION: different implementations or platforms of Harbour, they
* could produce different format in the string returned by FTOC().
*
* $RETURNS$
* CTOF() return the floating point number that corresponds to the
* string passed.
*
* $DESCRIPTION$
* Character strings created with FTOC() or XTOC() are convert into
* Harbour floating point number
*
* TODO: add documentation
* $EXAMPLES$
* $TESTS$
* $STATUS$
* Started
* $COMPLIANCE$
* $PLATFORMS$
* All
* $FILES$
* Source is ftoc.c, library is libct.
* $SEEALSO$
* FTOC(), XTOC()
* $END$
*/
HB_FUNC( CTOF )
{
if( hb_parclen( 1 ) >= sizeof( double ) )

Some files were not shown because too many files have changed in this diff Show More