home *** CD-ROM | disk | FTP | other *** search
/ Boston 2 / boston-2.iso / DOS / PROGRAM / CLIPPER / NFTROFF / 13.TR < prev    next >
Text File  |  1993-12-01  |  26KB  |  1,511 lines

  1. .de }n
  2. .bp
  3. .sp .5i
  4. ..
  5. .wh -.8i }n
  6. .sp .5i
  7. .po -.4i
  8. .ll 7.5i
  9. .ps 9
  10. .vs 9
  11. .in 0i
  12. .ta 1.63265i
  13. .sp 2
  14. .ne 20
  15. .ps +3
  16. .vs +3
  17. FT_AT2()    Find position of the nth occurrence of a substring
  18. .br
  19. .ta
  20. .in 0.08i
  21. .ps -3
  22. .vs -3
  23. .sp 2
  24. \fBFT_AT2()
  25. Find position of the nth occurrence of a substring
  26. .in 0i
  27. .br
  28. \l'6.24i'
  29. .br
  30. .sp
  31. .in 0.08i
  32. \fBSyntax
  33. .sp
  34. .in 0.4i
  35. \fBFT_AT2( <cSearch>, <cTarget> [, <nOccurs> [, <lCaseSens> ] ] ) -> nPos
  36. .sp
  37. .in 0.08i
  38. \fBArguments
  39. .sp
  40. .in 0.4i
  41. \fB<cSearch>\fR is the character substring to search for\.
  42. .sp
  43. \fB<cTarget>\fR is the character string to search\.
  44. .sp
  45. \fB<nOccurs>\fR is the occurrence of cSearch to look for,
  46. .in 1.28i
  47. defaults to 1\.
  48. .sp
  49. .in 0.4i
  50. \fB<lCaseSens>\fR is a logical value denoting case sensitivity\.
  51. .in 1.28i
  52. If \.F\., then search is NOT sensitive to case,
  53. defaults to \.T\.
  54. .sp
  55. .in 0.08i
  56. \fBReturns
  57. .sp
  58. .in 0.4i
  59. The position of the nth occurrence of a substring
  60. .sp
  61. .in 0.08i
  62. \fBDescription
  63. .sp
  64. .in 0.4i
  65. This function will find the nth occurrence of a substring
  66. within a string\.
  67. .sp
  68. .in 0.08i
  69. \fBExamples
  70. .sp
  71. .in 0.4i
  72. .br
  73. cSearch := "t"
  74. .br
  75. cTarget := "This is the day that the Lord has made\."
  76. .sp
  77. .ta 3.04i
  78. .br
  79. FT_AT2( cSearch, cTarget )    // Returns ( 9 )
  80. .br
  81. .ta
  82. .sp
  83. .ta 3.04i
  84. .br
  85. FT_AT2( cSearch, cTarget, 2 )    // Returns ( 17 )
  86. .br
  87. .ta
  88. .sp
  89. .ta 3.04i
  90. .br
  91. FT_AT2( cSearch, cTarget, 2, \.F\. )    // Returns ( 9 )
  92. .br
  93. .ta
  94. .sp
  95. .in 0.08i
  96. \fBSource:\fR AT2\.PRG
  97. .sp
  98. .ta 1.84i
  99. \fBAuthor:\fR Ralph Oliver,    TRANSCOM SYSTEMS
  100. .br
  101. .ta
  102. .in 0i
  103. .sp
  104. .in 1.5i
  105. .ti -1.5i
  106. .ta 1.5i
  107. .ft B
  108. See Also:    
  109. .ft R
  110. FT_FINDITH()
  111. .ta 1.63265i
  112. .in 0i
  113. .sp 2
  114. .ne 20
  115. .ps +3
  116. .vs +3
  117. FT_BITCLR()    Clear (reset) selected bit in a byte
  118. .br
  119. .ta
  120. .in 0.08i
  121. .ps -3
  122. .vs -3
  123. .sp 2
  124. \fBFT_BITCLR()
  125. Clear (reset) selected bit in a byte
  126. .in 0i
  127. .br
  128. \l'6.24i'
  129. .br
  130. .sp
  131. .in 0.08i
  132. \fBSyntax
  133. .sp
  134. .in 0.4i
  135. \fBFT_BITCLR( <cByte>, <nBitPos> ) -> cByte
  136. .sp
  137. .in 0.08i
  138. \fBArguments
  139. .sp
  140. .in 0.4i
  141. \fB<cByte>\fR is a character from CHR(0) to CHR(255)\.
  142. .sp
  143. \fB<nBitPos>\fR is a number from 0 to 7 conforming to standard
  144. right-to-left bit numbering convention and representing the
  145. position of the bit within the byte\.
  146. .sp
  147. .in 0.08i
  148. \fBReturns
  149. .sp
  150. .in 0.4i
  151. Returns new byte, with designated bit cleared (reset)\.
  152. If parameters are faulty, returns NIL\.
  153. .sp
  154. .in 0.08i
  155. \fBDescription
  156. .sp
  157. .in 0.4i
  158. In effect, ANDs argument byte with a byte that has all bits set except
  159. the target bit\.  If bit is already clear (0), it remains clear\.
  160. Note: Calls FT_ISBIT() which is also in this Library\.
  161. .sp
  162. This function is presented to illustrate that bit-wise operations
  163. are possible with Clipper code\.  For greater speed, write \.C or
  164. \.ASM versions and use the Clipper Extend system\.
  165. .sp
  166. .in 0.08i
  167. \fBExamples
  168. .sp
  169. .in 0.4i
  170. This code would clear bit 4 in a byte represented by CHR(115):
  171. .sp
  172. .in 0.56i
  173. .br
  174. cNewByte := FT_BITCLR( CHR(115), 4 )
  175. .ta 2.08i
  176. .br
  177. ? ASC( cNewbyte )    // result: 99
  178. .br
  179. .ta
  180. .ta 2.08i
  181. .br
  182. ? cNewByte    // result: \'c\'
  183. .br
  184. .ta
  185. .sp
  186. .in 0.4i
  187. This code would clear bit 5 in the byte represented by letter \'A\':
  188. .sp
  189. .in 0.56i
  190. .ta 2.08i
  191. FT_BITCLR( \'A\', 5 )    // result: \'A\', since
  192. .br
  193. .ta
  194. .in 2.64i
  195. // bit 5 already clear
  196. .sp
  197. .in 0.4i
  198. For a demonstration of Clipper bit manipulations, compile and
  199. link the program BITTEST\.PRG in the Nanforum Toolkit source code\.
  200. .sp
  201. .in 0.08i
  202. \fBSource:\fR BITCLR\.PRG
  203. .sp
  204. \fBAuthor:\fR Forest Belt, Computer Diagnostic Services, Inc\.
  205. .in 0i
  206. .sp
  207. .in 1.5i
  208. .ti -1.5i
  209. .ta 1.5i
  210. .ft B
  211. See Also:    
  212. .ft R
  213. FT_BITSET()
  214. , FT_ISBIT()
  215. .ta 1.63265i
  216. .in 0i
  217. .sp 2
  218. .ne 20
  219. .ps +3
  220. .vs +3
  221. FT_BITSET()    Set selected bit in a byte
  222. .br
  223. .ta
  224. .in 0.08i
  225. .ps -3
  226. .vs -3
  227. .sp 2
  228. \fBFT_BITSET()
  229. Set selected bit in a byte
  230. .in 0i
  231. .br
  232. \l'6.24i'
  233. .br
  234. .sp
  235. .in 0.08i
  236. \fBSyntax
  237. .sp
  238. .in 0.4i
  239. \fBFT_BITSET( <cByte>, <nBitPos> ) -> cByte
  240. .sp
  241. .in 0.08i
  242. \fBArguments
  243. .sp
  244. .in 0.4i
  245. \fB<cByte>\fR is a character from CHR(0) to CHR(255)\.
  246. .sp
  247. \fB<nBitPos>\fR is a number from 0 to 7 conforming to standard right-to-left
  248. bit numbering convention and representing the position of the bit
  249. within the byte\.
  250. .sp
  251. .in 0.08i
  252. \fBReturns
  253. .sp
  254. .in 0.4i
  255. Returns new byte, with designated bit set\.  If parameters are faulty,
  256. returns NIL\.
  257. .sp
  258. .in 0.08i
  259. \fBDescription
  260. .sp
  261. .in 0.4i
  262. In effect, ORs argument byte with a byte that has only the target bit
  263. set\.  If bit is already set, it remains set\.
  264. Note: Calls FT_ISBIT() which is also in this Library\.
  265. .sp
  266. This function is presented to illustrate that bit-wise operations
  267. are possible with Clipper code\.  For greater speed, write \.C or
  268. \.ASM versions and use the Clipper Extend system\.
  269. .sp
  270. .in 0.08i
  271. \fBExamples
  272. .sp
  273. .in 0.4i
  274. This code would set bit 4 in a byte represented by CHR(107):
  275. .sp
  276. .in 0.8i
  277. .br
  278. cNewbyte := FT_BITSET( CHR(107), 4 )
  279. .ta 2.4i
  280. .br
  281. ? ASC( cNewbyte )    // result: 123
  282. .br
  283. .ta
  284. .ta 2.4i
  285. .br
  286. ? cNewbyte    // result: \'{\'
  287. .br
  288. .ta
  289. .sp
  290. .sp
  291. .in 0.4i
  292. This code would set bit 5 in the byte represented by the letter \'A\'\.
  293. .sp
  294. .in 0.8i
  295. .ta 2.4i
  296. ? FT_BITSET( \'A\', 5 )    // result: \'a\'
  297. .br
  298. .ta
  299. .in 3.2i
  300. // bit 5 set
  301. .sp
  302. .in 0.4i
  303. For a demonstration of Clipper bit manipulations, compile and
  304. link the program BITTEST\.PRG in the Nanforum Toolkit source code\.
  305. .sp
  306. .in 0.08i
  307. \fBSource:\fR BITSET\.PRG
  308. .sp
  309. \fBAuthor:\fR Forest Belt, Computer Diagnostic Services, Inc\.
  310. .in 0i
  311. .sp
  312. .in 1.5i
  313. .ti -1.5i
  314. .ta 1.5i
  315. .ft B
  316. See Also:    
  317. .ft R
  318. FT_BITCLR()
  319. , FT_ISBIT()
  320. .ta 1.63265i
  321. .in 0i
  322. .sp 2
  323. .ne 20
  324. .ps +3
  325. .vs +3
  326. FT_BYTEAND()    Perform bit-wise AND on two ASCII characters (bytes)
  327. .br
  328. .ta
  329. .in 0.08i
  330. .ps -3
  331. .vs -3
  332. .sp 2
  333. \fBFT_BYTEAND()
  334. Perform bit-wise AND on two ASCII characters (bytes)
  335. .in 0i
  336. .br
  337. \l'6.24i'
  338. .br
  339. .sp
  340. .in 0.08i
  341. \fBSyntax
  342. .sp
  343. .in 0.4i
  344. \fBFT_BYTEAND( <cByte1>, <cByte2> ) -> cByte
  345. .sp
  346. .in 0.08i
  347. \fBArguments
  348. .sp
  349. .in 0.4i
  350. \fB<cByte1>\fR and \fB<cByte2>\fR are characters from CHR(0) TO CHR(255)\.
  351. May be passed in CHR() form, as character literals, or as expressions
  352. evaluating to CHR() values\.
  353. .sp
  354. .in 0.08i
  355. \fBReturns
  356. .sp
  357. .in 0.4i
  358. Returns resulting byte, in CHR() form\.  If parameters are faulty,
  359. returns NIL\.
  360. .sp
  361. .in 0.08i
  362. \fBDescription
  363. .sp
  364. .in 0.4i
  365. Can be used for any bit-wise masking operation\.  In effect, this is a
  366. bit-by-bit AND operation\.  Equivalent to AND assembler instruction\.
  367. .sp
  368. This function is presented to illustrate that bit-wise operations
  369. are possible with Clipper code\.  For greater speed, write \.C or
  370. \.ASM versions and use the Clipper Extend system\.
  371. .sp
  372. .in 0.08i
  373. \fBExamples
  374. .sp
  375. .in 0.4i
  376. This code would mask out the high nibble (four most significant bits)
  377. of the byte represented by chr(123) and leave the low nibble bits as in
  378. the parameter byte\.
  379. .sp
  380. .in 0.8i
  381. .br
  382. cNewbyte := FT_BYTEAND( CHR(123), CHR(15) )
  383. .ta 1.36i
  384. .br
  385. ? asc(cNewByte)    // result: 11
  386. .br
  387. .ta
  388. .ta 1.36i
  389. .br
  390. ? cNewByte    // result: non-printable character
  391. .br
  392. .ta
  393. .sp
  394. .in 0.4i
  395. For a demonstration of Clipper bit manipulations, compile and
  396. link the program BITTEST\.PRG in the Nanforum Toolkit source code\.
  397. .sp
  398. .in 0.08i
  399. \fBSource:\fR BYTEAND\.PRG
  400. .sp
  401. \fBAuthor:\fR Forest Belt, Computer Diagnostic Services, Inc\.
  402. .in 0i
  403. .sp
  404. .in 1.5i
  405. .ti -1.5i
  406. .ta 1.5i
  407. .ft B
  408. See Also:    
  409. .ft R
  410. FT_BYTEOR()
  411. , FT_BYTEXOR()
  412. , FT_BYTENOT()
  413. , FT_BYTENEG()
  414. .ta 1.63265i
  415. .in 0i
  416. .sp 2
  417. .ne 20
  418. .ps +3
  419. .vs +3
  420. FT_BYTENEG()    Perform bit-wise negation on an ASCII character
  421. .br
  422. .ta
  423. .in 0.08i
  424. .ps -3
  425. .vs -3
  426. .sp 2
  427. \fBFT_BYTENEG()
  428. Perform bit-wise negation on an ASCII character
  429. .in 0i
  430. .br
  431. \l'6.24i'
  432. .br
  433. .sp
  434. .in 0.08i
  435. \fBSyntax
  436. .sp
  437. .in 0.4i
  438. \fBFT_BYTENEG( <cByte> ) -> cNewByte
  439. .sp
  440. .in 0.08i
  441. \fBArguments
  442. .sp
  443. .in 0.4i
  444. \fB<cByte>\fR is a character from CHR(0) to CHR(255)\.
  445. May be passed in CHR() form, as character literal, or
  446. as expression evaluating to CHR() value\.
  447. .sp
  448. .in 0.08i
  449. \fBReturns
  450. .sp
  451. .in 0.4i
  452. Returns resulting byte, in CHR() form\.  If parameters are faulty,
  453. returns NIL\.
  454. .sp
  455. .in 0.08i
  456. \fBDescription
  457. .sp
  458. .in 0.4i
  459. Can be used for bit-wise byte manipulation\.  In effect, this is a
  460. bit-by-bit NEG (two\'s complement) operation\.  Equivalent to NEG
  461. assembler instruction\.
  462. .sp
  463. This function is presented to illustrate that bit-wise operations
  464. are possible with Clipper code\.  For greater speed, write \.C or
  465. \.ASM versions and use the Clipper Extend system\.
  466. .sp
  467. .in 0.08i
  468. \fBExamples
  469. .sp
  470. .in 0.4i
  471. This code performs a bit-wise NEG on byte represented by CHR(32):
  472. .sp
  473. .in 0.8i
  474. .br
  475. cNewByte := FT_BYTENOT(CHR(32))
  476. .ta 2.64i
  477. .br
  478. ? asc(cNewByte)    // result: 224
  479. .br
  480. .ta
  481. .sp
  482. .in 0.4i
  483. For a demonstration of Clipper bit manipulations, compile and
  484. link the program BITTEST\.PRG in the Nanforum Toolkit source code\.
  485. .sp
  486. .in 0.08i
  487. \fBSource:\fR BYTENEG\.PRG
  488. .sp
  489. \fBAuthor:\fR Forest Belt, Computer Diagnostic Services, Inc\.
  490. .in 0i
  491. .sp
  492. .in 1.5i
  493. .ti -1.5i
  494. .ta 1.5i
  495. .ft B
  496. See Also:    
  497. .ft R
  498. FT_BYTEOR()
  499. , FT_BYTEXOR()
  500. , FT_BYTENOT()
  501. , FT_BYTEAND()
  502. .ta 1.63265i
  503. .in 0i
  504. .sp 2
  505. .ne 20
  506. .ps +3
  507. .vs +3
  508. FT_BYTENOT()    Perform bit-wise NOT on an ASCII character (byte)
  509. .br
  510. .ta
  511. .in 0.08i
  512. .ps -3
  513. .vs -3
  514. .sp 2
  515. \fBFT_BYTENOT()
  516. Perform bit-wise NOT on an ASCII character (byte)
  517. .in 0i
  518. .br
  519. \l'6.24i'
  520. .br
  521. .sp
  522. .in 0.08i
  523. \fBSyntax
  524. .sp
  525. .in 0.4i
  526. \fBFT_BYTENOT( <cByte> ) -> cNewByte
  527. .sp
  528. .in 0.08i
  529. \fBArguments
  530. .sp
  531. .in 0.4i
  532. \fB<cByte>\fR is a character from CHR(0) to CHR(255)\.
  533. May be passed in CHR() form, as character literal, or
  534. as expression evaluating to CHR() value\.
  535. .sp
  536. .in 0.08i
  537. \fBReturns
  538. .sp
  539. .in 0.4i
  540. Returns resulting byte, in CHR() form\.  If parameters are faulty,
  541. returns NIL\.
  542. .sp
  543. .in 0.08i
  544. \fBDescription
  545. .sp
  546. .in 0.4i
  547. Can be used for bitwise byte manipulation\.  In effect, this is a
  548. bit-by-bit NOT (one\'s complement) operation\.  Equivalent to the
  549. NOT assembler instruction\.
  550. .sp
  551. This function is presented to illustrate that bit-wise operations
  552. are possible with Clipper code\.  For greater speed, write \.C or
  553. \.ASM versions and use the Clipper Extend system\.
  554. .sp
  555. .in 0.08i
  556. \fBExamples
  557. .sp
  558. .in 0.4i
  559. This code performs a bitwise NOT on byte represented by CHR(32):
  560. .sp
  561. .in 0.8i
  562. .br
  563. cNewByte := FT_BYTENOT( CHR(32) )
  564. .ta 1.76i
  565. .br
  566. ? ASC( cNewByte )    // result: 223
  567. .br
  568. .ta
  569. .sp
  570. .in 0.4i
  571. For a demonstration of Clipper bit manipulations, compile and
  572. link the program BITTEST\.PRG in the Nanforum Toolkit source code\.
  573. .sp
  574. .in 0.08i
  575. \fBSource:\fR BYTENOT\.PRG
  576. .sp
  577. \fBAuthor:\fR Forest Belt, Computer Diagnostic Services, Inc\.
  578. .in 0i
  579. .sp
  580. .in 1.5i
  581. .ti -1.5i
  582. .ta 1.5i
  583. .ft B
  584. See Also:    
  585. .ft R
  586. FT_BYTEOR()
  587. , FT_BYTEXOR()
  588. , FT_BYTENEG()
  589. , FT_BYTEAND()
  590. .ta 1.63265i
  591. .in 0i
  592. .sp 2
  593. .ne 20
  594. .ps +3
  595. .vs +3
  596. FT_BYTEOR()    Perform bit-wise OR on two ASCII characters (bytes)
  597. .br
  598. .ta
  599. .in 0.08i
  600. .ps -3
  601. .vs -3
  602. .sp 2
  603. \fBFT_BYTEOR()
  604. Perform bit-wise OR on two ASCII characters (bytes)
  605. .in 0i
  606. .br
  607. \l'6.24i'
  608. .br
  609. .sp
  610. .in 0.08i
  611. \fBSyntax
  612. .sp
  613. .in 0.4i
  614. \fBFT_BYTEOR( <cByte1>, <cByte2> ) -> cNewByte
  615. .sp
  616. .in 0.08i
  617. \fBArguments
  618. .sp
  619. .in 0.4i
  620. \fB<cByte1>\fR and \fB<cByte2>\fR are characters from CHR(0) TO CHR(255)\.
  621. May be passed in CHR() form, as character literals, or as
  622. expressions evaluating to CHR() values\.
  623. .sp
  624. .in 0.08i
  625. \fBReturns
  626. .sp
  627. .in 0.4i
  628. Returns resulting byte, in CHR() form\.  If parameters are faulty,
  629. returns NIL\.
  630. .sp
  631. .in 0.08i
  632. \fBDescription
  633. .sp
  634. .in 0.4i
  635. Can be used for bit-wise byte manipulation\.  In effect, this is a
  636. bit-by-bit OR operation\.  Equivalent to OR assembler instruction\.
  637. .sp
  638. This function is presented to illustrate that bit-wise operations
  639. are possible with Clipper code\.  For greater speed, write \.C or
  640. \.ASM versions and use the Clipper Extend system\.
  641. .sp
  642. .in 0.08i
  643. \fBExamples
  644. .sp
  645. .in 0.8i
  646. This code performs a bit-wise OR on two bytes represented
  647. by CHR(20) and CHR(10):
  648. .sp
  649. .br
  650. cNewByte := FT_BYTEOR( CHR(20), CHR(10) )
  651. .ta 1.52i
  652. .br
  653. ? ASC( cNewByte )    // result: 30
  654. .br
  655. .ta
  656. .ta 1.52i
  657. .br
  658. ? cNewByte    // result: non-printable character
  659. .br
  660. .ta
  661. .sp
  662. .in 0.4i
  663. For a demonstration of Clipper bit manipulations, compile and
  664. link the program BITTEST\.PRG in the Nanforum Toolkit source code\.
  665. .sp
  666. .in 0.08i
  667. \fBSource:\fR BYTEOR\.PRG
  668. .sp
  669. \fBAuthor:\fR Forest Belt, Computer Diagnostic Services, Inc\.
  670. .in 0i
  671. .sp
  672. .in 1.5i
  673. .ti -1.5i
  674. .ta 1.5i
  675. .ft B
  676. See Also:    
  677. .ft R
  678. FT_BYTEXOR()
  679. , FT_BYTENOT()
  680. , FT_BYTENEG()
  681. , FT_BYTEAND()
  682. .ta 1.63265i
  683. .in 0i
  684. .sp 2
  685. .ne 20
  686. .ps +3
  687. .vs +3
  688. FT_BYTEXOR()    Perform bit-wise XOR on two ASCII characters (bytes)
  689. .br
  690. .ta
  691. .in 0.08i
  692. .ps -3
  693. .vs -3
  694. .sp 2
  695. \fBFT_BYTEXOR()
  696. Perform bit-wise XOR on two ASCII characters (bytes)
  697. .in 0i
  698. .br
  699. \l'6.24i'
  700. .br
  701. .sp
  702. .in 0.08i
  703. \fBSyntax
  704. .sp
  705. .in 0.4i
  706. \fBFT_BYTEXOR( <cByte1>, <cByte2> ) -> cNewByte
  707. .sp
  708. .in 0.08i
  709. \fBArguments
  710. .sp
  711. .in 0.4i
  712. \fB<cByte1>\fR and \fB<cByte2>\fR are characters from CHR(0) to CHR(255)\.
  713. May be passed in CHR() form, as character literals, or
  714. as expressions evaluating to CHR() values\.
  715. .sp
  716. .in 0.08i
  717. \fBReturns
  718. .sp
  719. .in 0.4i
  720. Returns resulting byte, in CHR() form\.  If parameters are faulty,
  721. returns NIL\.
  722. .sp
  723. .in 0.08i
  724. \fBDescription
  725. .sp
  726. .in 0.4i
  727. Can be used for bit-wise byte manipulation\.  In effect, this is a
  728. bit-by-bit XOR operation\.  Equivalent to XOR assembler instruction\.
  729. .sp
  730. This function is presented to illustrate that bit-wise operations
  731. are possible with Clipper code\.  For greater speed, write \.C or
  732. \.ASM versions and use the Clipper Extend system\.
  733. .sp
  734. .in 0.08i
  735. \fBExamples
  736. .sp
  737. .in 0.4i
  738. This code performs a bit-wise XOR on two bytes represented
  739. by CHR(32) and CHR(55):
  740. .sp
  741. .in 0.8i
  742. .br
  743. cNewByte := FT_BYTEXOR( CHR(32), CHR(55) )
  744. .ta 1.76i
  745. .br
  746. ? ASC( cNewByte )    // result: 23
  747. .br
  748. .ta
  749. .ta 1.76i
  750. .br
  751. ? cNewByte    // result: non-printable character
  752. .br
  753. .ta
  754. .sp
  755. .in 0.4i
  756. For a demonstration of Clipper bit manipulations, compile and
  757. link the program BITTEST\.PRG in the Nanforum Toolkit source code\.
  758. .sp
  759. .in 0.08i
  760. \fBSource:\fR BYTEXOR\.PRG
  761. .sp
  762. \fBAuthor:\fR Forest Belt, Computer Diagnostic Services, Inc\.
  763. .in 0i
  764. .sp
  765. .in 1.5i
  766. .ti -1.5i
  767. .ta 1.5i
  768. .ft B
  769. See Also:    
  770. .ft R
  771. FT_BYTEOR()
  772. , FT_BYTENOT()
  773. , FT_BYTENEG()
  774. , FT_BYTEAND()
  775. .ta 1.63265i
  776. .in 0i
  777. .sp 2
  778. .ne 20
  779. .ps +3
  780. .vs +3
  781. FT_FINDITH()    Find the "ith" occurrence of a substring within a string
  782. .br
  783. .ta
  784. .in 0.08i
  785. .ps -3
  786. .vs -3
  787. .sp 2
  788. \fBFT_FINDITH()
  789. Find the "ith" occurrence of a substring within a string
  790. .in 0i
  791. .br
  792. \l'6.24i'
  793. .br
  794. .sp
  795. .in 0.08i
  796. \fBSyntax
  797. .sp
  798. .in 0.4i
  799. \fBFT_FINDITH( <cCheckFor>, <cCheckIn>, <nWhichOccurrence> ;
  800. .in 1.36i
  801. \fB[, <lIgnoreCase> ] ) -> <nStringPosition>
  802. .sp
  803. .in 0.08i
  804. \fBArguments
  805. .sp
  806. .in 0.4i
  807. \fB<cCheckFor>\fR is the string to search for\.
  808. .sp
  809. \fB<cCheckIn>\fR is the string to search\.
  810. .sp
  811. \fB<nWhichOccurrence>\fR is the number of the occurrence to find\.
  812. .sp
  813. \fB<lIgnoreCase>\fR is a logical indicating if the search is to be case
  814. .in 0.64i
  815. sensitive\.  The default is no case sensitivity (\.F\.)\.
  816. .sp
  817. .in 0.08i
  818. \fBReturns
  819. .sp
  820. .in 0.4i
  821. The position in the string cCheckIn of the ith occurrence of cCheckFor\.
  822. .sp
  823. .in 0.08i
  824. \fBDescription
  825. .sp
  826. .in 0.4i
  827. This function finds the position in a string of the "ith" time another
  828. string appears in it\.
  829. .sp
  830. .in 0.08i
  831. \fBExamples
  832. .sp
  833. .in 0.4i
  834. .br
  835. // Find the Position in cMemoString of
  836. .br
  837. // the 10th Occurrence of "the", case
  838. .br
  839. // insensitive
  840. .sp
  841. .br
  842. nNextPosition := FT_FINDITH("the", cMemoString, 10)
  843. .sp
  844. .in 0.08i
  845. \fBSource:\fR FINDITH\.PRG
  846. .sp
  847. \fBAuthor:\fR David Husnian
  848. .in 0i
  849. .sp
  850. .in 1.5i
  851. .ti -1.5i
  852. .ta 1.5i
  853. .ft B
  854. See Also:    
  855. .ft R
  856. FT_AT2()
  857. .ta 1.63265i
  858. .in 0i
  859. .sp 2
  860. .ne 20
  861. .ps +3
  862. .vs +3
  863. FT_ISBIT()    Test the status of an individual bit
  864. .br
  865. .ta
  866. .in 0.08i
  867. .ps -3
  868. .vs -3
  869. .sp 2
  870. \fBFT_ISBIT()
  871. Test the status of an individual bit
  872. .in 0i
  873. .br
  874. \l'6.24i'
  875. .br
  876. .sp
  877. .in 0.08i
  878. \fBSyntax
  879. .sp
  880. .in 0.4i
  881. \fBFT_ISBIT( <cByte>, <nBitPos> ) -> lResult
  882. .sp
  883. .in 0.08i
  884. \fBArguments
  885. .sp
  886. .in 0.4i
  887. \fB<cByte>\fR is a character from CHR(0) to CHR(255)
  888. .sp
  889. \fB<nBitPos>\fR is a number from 0 to 7 conforming to standard right-to-left
  890. .in 1.2i
  891. bit-numbering convention and representing the position of the
  892. bit within the byte\.
  893. .sp
  894. .in 0.08i
  895. \fBReturns
  896. .sp
  897. .in 0.4i
  898. \.T\. if designated bit is set (1), \.F\. if not set (0), NIL if
  899. .in 0.48i
  900. invalid parameters\.
  901. .sp
  902. .in 0.08i
  903. \fBDescription
  904. .sp
  905. .in 0.4i
  906. Tests for status of any selected bit in the byte passed as a parameter\.
  907. Byte must be presented in CHR() form, as a literal constant, or as the
  908. one-byte character result of an expression\.
  909. .sp
  910. This function is presented to illustrate that bit-wise operations
  911. are possible with Clipper code\.  For greater speed, write \.C or
  912. \.ASM versions and use the Clipper Extend system\.
  913. .sp
  914. .in 0.08i
  915. \fBExamples
  916. .sp
  917. .in 0.4i
  918. This code tests whether bit 3 is set in the byte represented by
  919. CHR(107):
  920. .sp
  921. .in 0.48i
  922. .br
  923. lBitflag := FT_ISBIT(CHR(107), 3)
  924. .ta 2.24i
  925. .br
  926. ? lBitflag    // result: \.T\.
  927. .br
  928. .ta
  929. .sp
  930. This code tests whether bit 5 is set in the byte represented by ASCII
  931. 65 (letter \'A\')
  932. .sp
  933. .ta 2.24i
  934. .br
  935. ? FT_ISBIT(\'A\', 5)    // result: \.F\.
  936. .br
  937. .ta
  938. .sp
  939. .in 0.4i
  940. For a demonstration of Clipper bit manipulations, compile and
  941. link the program BITTEST\.PRG in the Nanforum Toolkit source code\.
  942. .sp
  943. .in 0.08i
  944. \fBSource:\fR ISBIT\.PRG
  945. .sp
  946. \fBAuthor:\fR Forest Belt, Computer Diagnostic Services, Inc\.
  947. .in 0i
  948. .sp
  949. .in 1.5i
  950. .ti -1.5i
  951. .ta 1.5i
  952. .ft B
  953. See Also:    
  954. .ft R
  955. FT_BITSET()
  956. , FT_BITCLR()
  957. .ta 1.63265i
  958. .in 0i
  959. .sp 2
  960. .ne 20
  961. .ps +3
  962. .vs +3
  963. FT_ISBITON()    Determine the state of individual bits in a number
  964. .br
  965. .ta
  966. .in 0.08i
  967. .ps -3
  968. .vs -3
  969. .sp 2
  970. \fBFT_ISBITON()
  971. Determine the state of individual bits in a number
  972. .in 0i
  973. .br
  974. \l'6.24i'
  975. .br
  976. .sp
  977. .in 0.08i
  978. \fBSyntax
  979. .sp
  980. .in 0.4i
  981. \fBFT_ISBITON( <nNumber>, <nBit> ) -> lResult
  982. .sp
  983. .in 0.08i
  984. \fBArguments
  985. .sp
  986. .in 0.4i
  987. \fB<nNumber>\fR is an integer for which a bit state needs to be checked\.
  988. .sp
  989. \fB<nBit>\fR is a number from 0 to 15 that indicates which bit to test\.
  990. .sp
  991. .in 0.08i
  992. \fBReturns
  993. .sp
  994. .in 0.4i
  995. \.T\. if the specified bit was on\., \.F\. if off\.
  996. .sp
  997. .in 0.08i
  998. \fBDescription
  999. .sp
  1000. .in 0.4i
  1001. This function is useful when dealing with binary integers\.  It will
  1002. come in very handy if you use the FT_INT86() function, because the
  1003. CPU flags are returned as a series of bits\.  Using this function, you
  1004. can determine the state of each CPU flag\.
  1005. .sp
  1006. .in 0.08i
  1007. \fBExamples
  1008. .sp
  1009. .in 0.4i
  1010. .br
  1011. if FT_ISBITON( nCPUFlags, 0 )
  1012. .in 0.64i
  1013. .br
  1014. Qout( "The carry flag was set\." )
  1015. .in 0.4i
  1016. .br
  1017. endif
  1018. .sp
  1019. .br
  1020. if FT_ISBITON( nCPUFlags, 7 )
  1021. .in 0.64i
  1022. .br
  1023. Qout( "The sign flag was set\." )
  1024. .in 0.4i
  1025. .br
  1026. endif
  1027. .sp
  1028. .in 0.08i
  1029. \fBSource:\fR ISBITON\.PRG
  1030. .sp
  1031. \fBAuthor:\fR Ted Means
  1032. .in 0i
  1033. .ta 1.63265i
  1034. .sp 2
  1035. .ne 20
  1036. .ps +3
  1037. .vs +3
  1038. FT_METAPH()    Convert a character string to MetaPhone format
  1039. .br
  1040. .ta
  1041. .in 0.08i
  1042. .ps -3
  1043. .vs -3
  1044. .sp 2
  1045. \fBFT_METAPH()
  1046. Convert a character string to MetaPhone format
  1047. .in 0i
  1048. .br
  1049. \l'6.24i'
  1050. .br
  1051. .sp
  1052. .in 0.08i
  1053. \fBSyntax
  1054. .sp
  1055. .in 0.4i
  1056. \fBFT_METAPH( <cName> [, <nSize> ] ) -> cMetaPhone
  1057. .sp
  1058. .in 0.08i
  1059. \fBArguments
  1060. .sp
  1061. .in 0.4i
  1062. \fB<cName>\fR is the character string to convert
  1063. .sp
  1064. \fB<nSize>\fR is the length of the character string to be returned\.
  1065. .in 1.04i
  1066. If not specified the default length is 4 bytes\.
  1067. .sp
  1068. .in 0.08i
  1069. \fBReturns
  1070. .sp
  1071. .in 0.4i
  1072. A phonetically spelled character string
  1073. .sp
  1074. .in 0.08i
  1075. \fBDescription
  1076. .sp
  1077. .in 0.4i
  1078. This function is a character function use to index and search for
  1079. sound-alike or phonetic matches\.  It is an alternative to
  1080. the SOUNDEX() function, and addresses some basic pronunciation
  1081. rules, by looking at surrounding letters to determine how parts of
  1082. the string are pronounced\.  FT_METAPH() will group sound-alikes
  1083. together, and forgive shortcomings in spelling ability\.
  1084. .sp
  1085. .in 0.08i
  1086. \fBExamples
  1087. .sp
  1088. .in 0.4i
  1089. .br
  1090. USE Persons
  1091. .br
  1092. INDEX ON FT_METAPH( LastName ) TO LastName
  1093. .br
  1094. SEEK FT_METAPH( "Philmore" )
  1095. .ta 2.56i
  1096. .br
  1097. ? FOUND(), LastName    // Result: \.T\. Philmore
  1098. .br
  1099. .ta
  1100. .br
  1101. SEEK FT_METAPH( "Fillmore" )
  1102. .ta 2.56i
  1103. .br
  1104. ? FOUND(), LastName    // Result: \.T\. Philmore
  1105. .br
  1106. .ta
  1107. .sp
  1108. .in 0.08i
  1109. \fBSource:\fR METAPH\.PRG
  1110. .sp
  1111. \fBAuthor:\fR Dave Adams
  1112. .in 0i
  1113. .ta 1.63265i
  1114. .sp 2
  1115. .ne 20
  1116. .ps +3
  1117. .vs +3
  1118. FT_NOOCCUR()    Find the number of times one string occurs in another
  1119. .br
  1120. .ta
  1121. .in 0.08i
  1122. .ps -3
  1123. .vs -3
  1124. .sp 2
  1125. \fBFT_NOOCCUR()
  1126. Find the number of times one string occurs in another
  1127. .in 0i
  1128. .br
  1129. \l'6.24i'
  1130. .br
  1131. .sp
  1132. .in 0.08i
  1133. \fBSyntax
  1134. .sp
  1135. .in 0.4i
  1136. \fBFT_NOOCCUR( <cCheckFor>, <cCheckIn> ;
  1137. .in 1.36i
  1138. .ta 2.08i
  1139. \fB[, <lIgnoreCase> ] )    -> <nOccurrences>
  1140. .br
  1141. .ta
  1142. .sp
  1143. .in 0.08i
  1144. \fBArguments
  1145. .sp
  1146. .in 0.4i
  1147. \fB<cCheckFor>\fR is the string to search for
  1148. .sp
  1149. \fB<cCheckIn>\fR is the string to search
  1150. .sp
  1151. \fB<lIgnoreCase>\fR is a boolean variable to force case sensitivity
  1152. (optional, defaults to \.F\.)\.
  1153. .sp
  1154. .in 0.08i
  1155. \fBReturns
  1156. .sp
  1157. .in 0.4i
  1158. The number of times <cCheckFor> appears in <cCheckIn>
  1159. .sp
  1160. .in 0.08i
  1161. \fBDescription
  1162. .sp
  1163. .in 0.4i
  1164. This function finds the number of times a string occurs in a
  1165. .in 0.64i
  1166. second string\.
  1167. .sp
  1168. .in 0.08i
  1169. \fBExamples
  1170. .sp
  1171. .in 0.4i
  1172. .br
  1173. // Find the number of times "the" appears in cMemoString, case
  1174. .br
  1175. // insensitive
  1176. .sp
  1177. .br
  1178. nNoOfOccurrences := FT_NOOCCUR( "the", cMemoString )
  1179. .sp
  1180. .br
  1181. // Find the number of times "the" appears in cMemoString, case
  1182. .br
  1183. // sensitive
  1184. .sp
  1185. .br
  1186. nNoOfOccurrences := FT_NOOCCUR( "the", cMemoString, TRUE )
  1187. .sp
  1188. .in 0.08i
  1189. \fBSource:\fR NOOCCUR\.PRG
  1190. .sp
  1191. \fBAuthor:\fR David Husnian
  1192. .in 0i
  1193. .ta 1.63265i
  1194. .sp 2
  1195. .ne 20
  1196. .ps +3
  1197. .vs +3
  1198. FT_PCHR()    Convert printer control codes
  1199. .br
  1200. .ta
  1201. .in 0.08i
  1202. .ps -3
  1203. .vs -3
  1204. .sp 2
  1205. \fBFT_PCHR()
  1206. Convert printer control codes
  1207. .in 0i
  1208. .br
  1209. \l'6.24i'
  1210. .br
  1211. .sp
  1212. .in 0.08i
  1213. \fBSyntax
  1214. .sp
  1215. .in 0.48i
  1216. .ta 1.76i 2.08i
  1217. \fBFT_PCHR( <cString> )    ->    <cPrinterFormat>
  1218. .br
  1219. .ta
  1220. .sp
  1221. .in 0.08i
  1222. \fBArguments
  1223. .sp
  1224. .in 0.56i
  1225. \fB<cString>\fR is the representation of the printer control codes in
  1226. text, numeric, hexadecimal, Epson command format, or any combination
  1227. separated by commas\.
  1228. .sp
  1229. .in 0.08i
  1230. \fBReturns
  1231. .sp
  1232. .in 0.56i
  1233. A character string of printer control codes\.
  1234. .sp
  1235. .in 0.08i
  1236. \fBDescription
  1237. .sp
  1238. .in 0.56i
  1239. This function is useful for allowing the user to enter printer
  1240. control codes in text (enclosed in double quotes), numeric,
  1241. hexadecimal, or Epson commands preceded by a slash and returns
  1242. the printer control code equivalent\.
  1243. .sp
  1244. NOTES"
  1245. .sp
  1246. .in 0.72i
  1247. .br
  1248. - Combinations of text, numbers, hex, and commands must be
  1249. .in 0.96i
  1250. .br
  1251. separated by commas ("A",27,&1B,/RESET)\.
  1252. .in 0.72i
  1253. .br
  1254. - Text must be enclosed in double quotes ("x")\.
  1255. .br
  1256. - Hexadecimal must be preceded by an ampersand (&1B)\.
  1257. .br
  1258. - Epson commands, listed below, must be preceded by a forward
  1259. .in 0.96i
  1260. .br
  1261. slash (/RESET)\.
  1262. .sp
  1263. .in 0.72i
  1264. Epson commands: (slash commands are specific to the Epson)
  1265. .sp
  1266. .in 0.88i
  1267. Job Control:
  1268. .sp
  1269. .ta 1.44i
  1270. /RESET or /INIT    Reset or initialize the printer
  1271. .br
  1272. .ta
  1273. .ta 0.56i 1.44i
  1274. /BELL    or /BEEP    Cause the printer\'s speaker to beep (not HS)
  1275. .br
  1276. .ta
  1277. .ta 1.44i
  1278. /CAN    Clear print buffers (not MX)
  1279. .br
  1280. .ta
  1281. .ta 1.44i
  1282. /SLOW    Set low speed mode (not CR, HS, MX)
  1283. .br
  1284. .ta
  1285. .ta 1.44i
  1286. /FAST    Cancel low speed mode (not CR, HS, MX)
  1287. .br
  1288. .ta
  1289. .ta 1.44i
  1290. /ONE    Select Unidirectional mode
  1291. .br
  1292. .ta
  1293. .ta 1.44i
  1294. /TWO    Select Directional mode
  1295. .br
  1296. .ta
  1297. .ta 1.44i
  1298. /ON    Activate printer
  1299. .br
  1300. .ta
  1301. .ta 1.44i
  1302. /OFF    Turn off printer
  1303. .br
  1304. .ta
  1305. .sp
  1306. .ta 1.44i
  1307. /FF or /EJECT    Form Feed
  1308. .br
  1309. .ta
  1310. .sp
  1311. Page Control:
  1312. .sp
  1313. .ta 1.44i
  1314. /1/6    Set 6 lines per inch
  1315. .br
  1316. .ta
  1317. .ta 1.44i
  1318. /1/8    Set 8 lines per inch
  1319. .br
  1320. .ta
  1321. .ta 1.44i
  1322. /SKIP    Set Skip perforation ON
  1323. .br
  1324. .ta
  1325. .ta 1.44i
  1326. /SKIPOFF    Set Skip perforation OFF
  1327. .br
  1328. .ta
  1329. .sp
  1330. Font Selection and Manipulation:
  1331. .sp
  1332. .ta 1.44i 3.44i
  1333. /ITALIC    Select italic char\. set    (only FX86, EX, LX,
  1334. .br
  1335. .ta
  1336. .in 4.72i
  1337. no LQ-1500, SX)
  1338. .in 0.88i
  1339. .ta 1.44i
  1340. /GRAPHIC    Select graphic char\. set (only FX86, EX, LX,
  1341. .br
  1342. .ta
  1343. .in 4.72i
  1344. no LQ-1500, SX)
  1345. .in 0.88i
  1346. .ta 1.44i
  1347. /ROMAN    Choose Roman font
  1348. .br
  1349. .ta
  1350. .ta 1.44i
  1351. /SANS    Choose Sans Serif font
  1352. .br
  1353. .ta
  1354. .ta 1.44i
  1355. /DRAFT    Choose draft
  1356. .br
  1357. .ta
  1358. .ta 1.44i
  1359. /NLQ    Choose near letter quality
  1360. .br
  1361. .ta
  1362. .ta 1.44i
  1363. /PICA    Choose 10 chars per inch
  1364. .br
  1365. .ta
  1366. .ta 1.44i
  1367. /ELITE    Choose 12 chars per inch
  1368. .br
  1369. .ta
  1370. .ta 1.44i
  1371. /COND or /SI    Choose 15 chars per inch
  1372. .br
  1373. .ta
  1374. .ta 1.44i
  1375. /EMPH    Turn emphasize on
  1376. .br
  1377. .ta
  1378. .ta 1.44i
  1379. /EMPHOFF    Turn emphasize off
  1380. .br
  1381. .ta
  1382. .ta 1.44i
  1383. /SPANISH    Select spanish international char set
  1384. .br
  1385. .ta
  1386. .ta 1.44i
  1387. /USA    Select USA international char set
  1388. .br
  1389. .ta
  1390. .sp
  1391. .sp
  1392. .in 0.08i
  1393. \fBExamples
  1394. .sp
  1395. .in 0.56i
  1396. .br
  1397. cSetUp := \'27,116,1\'
  1398. .br
  1399. Set Print ON
  1400. .ta 2i 2.32i
  1401. .br
  1402. ? FT_PCHR( cSetUp )    ->    (CHR(27)+CHR(116)+CHR(1))
  1403. .br
  1404. .ta
  1405. .in 3.52i
  1406. .br
  1407. <select Epson char\. graphics>
  1408. .sp
  1409. .in 0.56i
  1410. .ta 2i 2.32i
  1411. .br
  1412. ? FT_PCHR( \'27,"x",0\' )    ->    (CHR(27)+CHR(120)+CHR(0))
  1413. .br
  1414. .ta
  1415. .in 3.28i
  1416. .br
  1417. <Epson draft mode>
  1418. .sp
  1419. .in 0.56i
  1420. .ta 1.76i 2i 2.32i 3.92i
  1421. .br
  1422. ? FT_PCHR( \'&1B,"E"\'    )    ->    (CHR(27)+CHR(69))    <HP reset>
  1423. .br
  1424. .ta
  1425. .sp
  1426. .br
  1427. ? FT_PCHR( \'/ELITE,/NLQ\' ) ->(CHR(27)+CHR(77)+CHR(27)+CHR(120)+CHR(1))
  1428. .in 2.56i
  1429. .br
  1430. <Epson elite & near letter quality>
  1431. .sp
  1432. .in 0.08i
  1433. \fBSource:\fR PCHR\.PRG
  1434. .sp
  1435. \fBAuthor:\fR Jim Gale
  1436. .in 0i
  1437. .ta 1.63265i
  1438. .sp 2
  1439. .ne 20
  1440. .ps +3
  1441. .vs +3
  1442. FT_PROPER()    Convert a string to proper-name case
  1443. .br
  1444. .ta
  1445. .in 0.08i
  1446. .ps -3
  1447. .vs -3
  1448. .sp 2
  1449. \fBFT_PROPER()
  1450. Convert a string to proper-name case
  1451. .in 0i
  1452. .br
  1453. \l'6.24i'
  1454. .br
  1455. .sp
  1456. .in 0.08i
  1457. \fBSyntax
  1458. .sp
  1459. .in 0.4i
  1460. \fBFT_PROPER( <cString> ) -> cProperName
  1461. .sp
  1462. .in 0.08i
  1463. \fBArguments
  1464. .sp
  1465. .in 0.4i
  1466. \fB<cString>\fR is the string to be converted\.
  1467. .sp
  1468. .in 0.08i
  1469. \fBReturns
  1470. .sp
  1471. .in 0.4i
  1472. A string of the same length as <cString>, only converted to
  1473. proper name case (upper/lower case)\.
  1474. .sp
  1475. .in 0.08i
  1476. \fBDescription
  1477. .sp
  1478. .in 0.4i
  1479. FT_PROPER() uses a brute-force algorithm to convert a string
  1480. to propername case\.  First, it capitalizes the first letter of
  1481. all words starting after a blank, dash, or apostrophe\.  This
  1482. catches most names, including special cases such as names
  1483. beginning with O\' (O\'Malley, O\'Reilly) and hyphenated names
  1484. (such as Susan Chia-Mei Lo)\.
  1485. .sp
  1486. Next, it does a specific adjustment for words beginning in "Mc"
  1487. It finds the first \'Mc\' and capitalizes the next character after
  1488. it\.  It does this for all occurrences of Mc\.
  1489. .sp
  1490. The original FT_PROPER() was written in Clipper by Glenn Scott
  1491. and Mark Zechiel; it was re-written in C (and thus, optimized
  1492. and enhanced) by Robert DiFalco\.
  1493. .sp
  1494. .in 0.08i
  1495. \fBExamples
  1496. .sp
  1497. .in 0.56i
  1498. .br
  1499. FUNCTION main( cStr )
  1500. .in 0.72i
  1501. .br
  1502. OutStd( FT_PROPER( cStr ) + chr(13) + chr(10) )
  1503. .in 0.56i
  1504. .br
  1505. RETURN ( nil )
  1506. .sp
  1507. .in 0.08i
  1508. \fBSource:\fR PROPER\.C
  1509. .sp
  1510. \fBAuthor:\fR Robert DiFalco and Glenn Scott
  1511.