home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / LIBTOOLS.ZIP / BRIAN_S.DOC next >
Encoding:
Text File  |  1988-09-18  |  22.6 KB  |  912 lines

  1.  
  2.                     LIBRARY APPLICATIONS TOOLKIT
  3.  
  4.                              Version 1.0
  5.  
  6.                               Written by:
  7.  
  8.                            Brian Vanlandingham
  9.                            in cooperation with
  10.  
  11.                       North Carolina Central University
  12.                   School of Library and Information Science
  13.  
  14.                                  c1988
  15.  
  16.                        Written in Clipper Summer '87
  17.  
  18.   The   library  applications  toolbox  contains  a   number   of
  19. predefined  functions for developing library oriented information
  20. retrieval systems.
  21.  Parameters  are  evaluated  before  being  passed  to  the   the
  22. procedures.  In  most  cases an improper parameter will return  a
  23. null  value  although attempting to pass illegal data  types  may
  24. result  in  ambiguous or bizarre results.  Variables used in  the
  25. procedures  are declared private so there should be  no  problems
  26. caused by duplicating variable names in other parts of a program.
  27.  
  28.   Each  of  the  extended search routines  provided  require  the
  29. Clipper  Extend.lib  passed  in the linkage list to  the  linkage
  30. editor.  Other  routines  are identified as to  any  restrictions
  31. imposed by their syntax.
  32.  
  33. Syntax for the linkage list is:
  34.  
  35. (Turbo C linker)
  36. TLINK <myfile>,<myfile>,,CLIPPER+EXTEND+BRIAN_S
  37.  
  38. (Microsoft Link) (May need to increase segments to 200)
  39. TLINK <myfile>,<myfile>,,CLIPPER+EXTEND+BRIAN_S
  40.  
  41. (Clipper summer 87)
  42. PLINK86 FI <my_file>, <myfile> LIB CLIPPER, EXTEND, BRIAN_S
  43.  
  44. ***************************************
  45.  
  46.  
  47. PROCEDURE BOX_WRAP
  48.  
  49. Displays a text variable with word wrap inside a box at specified
  50. coordinates.
  51.  
  52. Call as:
  53.  
  54. do box_wrap with var_name,row_number,left_column,right_column,message
  55.  
  56. usage:
  57.  
  58. save screen
  59. store "Annotation" to mess
  60. do b_wrap with annotation,10,10,40,mess
  61. wait
  62. restore screen
  63.  
  64. Will  display  the variable field inside a box beginning  at  row
  65. 10,column ten, and extending to column 40.
  66. The  message string is diplayed centered across the box  line  of
  67. the box.
  68.  
  69. The vertical height of the box is dependent on the maximum length
  70. of the  variable.  Passing untrimed character strings will result
  71. in empty spaces being left at the bottom of the box.
  72.  
  73. The message must be small enough to fit across the top of the box
  74. or it will be ignored.
  75.  
  76. Use for screen displays only since the printer does not use the
  77. @ x,y BOX FRAME frame command.
  78.  
  79. *****************************************************
  80.  
  81. FUNCTION WRAP_ME()
  82.  
  83. Performs word wrap for print functions.
  84.  
  85. Call as:
  86.  store wrap_me(var_name,startcol,endcol,indent) to line_cnt
  87.  
  88. var_name = variable passed
  89. startcol = starting at left column #
  90. endcol = endding at right column #
  91. indent = indent 2,3,4,5... lines
  92.  
  93. line_cnt = number of lines taken by wrapped character string
  94.  
  95. Example:
  96.  
  97. store "abcdefg hi j klmno pqrstuv wxyz" to string
  98. store wrap_me(string,5,20,3) to var
  99.  
  100.  
  101.  
  102. results in:
  103.  
  104.      accdefg hi j klmno
  105.         pqrstuv wxyz
  106.  
  107. Returns a result of 2 that can be use to control pagebreaks.
  108.  
  109. example:
  110.  
  111. store 1 to linecnt
  112. do while .not. eof()
  113. store field_name to string
  114. store wrap_me(string,5,20,3) + line_cnt to line_cnt
  115. if line_cnt > 55
  116. eject
  117. store 2 to linecnt
  118. endif
  119. enddo
  120.  
  121.  
  122. Optionally the return value can be discarded:
  123.  
  124. store wrap_me(string,5,20,3) to not_used_for_anything
  125.  
  126. ***********************************************************
  127.  
  128. FUNCTION Q_WRAP()
  129.  
  130. usage: store Q_WRAP(var,0) to line_cnt
  131. or:    store Q_WRAP(var,1) to line_cnt
  132.  
  133.  
  134. Provides a quick, dirty word wrap with one command verb.
  135.  
  136. defaults are: begin at column 3
  137.               end at column 70
  138.               indent 4 spaces after first line
  139.  
  140. The second parameter (1 or 0) controls whether or not to include
  141. blank spaces at the beginning of the character string as part
  142. of the variable. The default is 0, not to count blank spaces.
  143.  
  144. i.e.  Q_WRAP(var,0) and Q_WRAP(var) are the same.
  145.  Q_WRAP(var,1) will remove leading blanks before processing the
  146. string.
  147.  
  148.  
  149.  
  150. To change defaults it will be necessary to recompile the function.
  151. Returns line counter that can be used to control pagebreaks
  152.  
  153. example:
  154.  
  155. store 1 to linecnt
  156. do while .not. eof()
  157. store field_name to string
  158.  
  159. store Q_wrap(string) + line_cnt to line_cnt
  160.  
  161. if line_cnt > 50
  162. eject
  163. store 2 to line_cnt
  164. endif
  165. enddo
  166.  
  167. *****************************************************
  168.  
  169. FUNCTION CENTER()
  170.  
  171. Centers a line of text in N spaces
  172.  
  173. Usage:
  174.  
  175. @ 10,0 say center("Hello",80)
  176. @ 20,0 say center("Hello",40)
  177.  
  178. etc..
  179.  
  180. If used without the second parameter a column width
  181. of 80 if assumed.
  182.  
  183. @ 10,0 say center("Hello")
  184.  
  185. *********************************************************
  186.  
  187. FUNCTION NOPRINT()
  188.  
  189. Provides error trap to check online printer status.
  190.  
  191. usage:
  192.  
  193. if NOPRINT()
  194. return         && or loop, or whatever
  195. endif
  196.             && else go ahead and print something
  197.  
  198. If printer is not available, saves screen, displays
  199. message
  200.               PRINTER IS NOT READY
  201.         READY PRINTER, PRESS <Y> TO CONTINUE
  202.            OR PRESS <N> TO ABANDON PRINT
  203.  
  204. The  message stays on the screen as long as the user continues to
  205. press <Y> or until the printer is ready.
  206.  
  207. returns .T. if the printer is NOT READY
  208. returns .F. if the printer IS READY
  209.  
  210. Requires extend.lib in the linkage list passed to the linker.
  211.  
  212. **************************************************************
  213.  
  214. FUNCTION SAIDYES()
  215.  
  216. Forces Y or N response to user prompt.
  217.  
  218. Turns off console and cursor, and forces a wait
  219. state until 'YyNn' is entered at the keyboard
  220. returns .t. if 'Yy' is entered, else .f. if 'Nn'
  221. or the excape key is pressed.
  222.  
  223.  
  224. SAIDYES() turns cursor on after return
  225. SAIDYES(0) leaves cursor off after return
  226.  
  227. USAGE:
  228.  
  229. @ 10,3 say "Go ahead and do whatever? (Y/N) ?"
  230.  
  231. if SAIDYES()
  232.  DO whatever
  233.  else
  234. return
  235. endif
  236.  
  237. *****************************************************************
  238.  
  239. FUNCTION INWAIT()
  240.  
  241. Doesn't  do anything. Turns off console and cursor and forces  a
  242. wait state until a keypress, then turns them back on again.
  243.  
  244. USAGE:
  245.  
  246. @ 5,10 say "press any key to continue"
  247.  
  248. inwait()  && turns cursor on after returning
  249. inwait(0) && leaves cursor off after returning
  250.  
  251. do whatever
  252.  
  253. ***********************************************************
  254.  
  255. FUNCTION AUT_KEY()
  256.  
  257. Returns OCLC type author search key from character string.
  258.  
  259. usage:
  260.  
  261. store "JONES, BILL A" to name
  262. store AUT_KEY(name) to var
  263. ? var
  264.  
  265. returns "JONEBILA" as index key
  266.  
  267. Variables passed to the function must be of type string.  Shorter
  268. names passed will return strings ending in blanks.
  269.  
  270. example:
  271.  
  272. store "JONES, BILL" to name
  273. store AUT_KEY(name) to var
  274. ? var
  275. returns "JONEBIL " as index key
  276.  
  277. (i.e. all return values are 8 characters long)
  278.  
  279. **************************************************************
  280.  
  281. FUNCTION TITL_KEY()
  282.  
  283. Returns OCLC type title index key from character string.
  284.  
  285. example:
  286.  
  287. store "CAT IN THE HAT" to title
  288. store TITL_KEY(title) to var
  289. ? VAR
  290.  
  291. returns: "CATINTHH" as index key
  292.  
  293. Shorter character strings passed return strings ending in blanks.
  294.  
  295. usage:
  296.  
  297. store "CAT IN THE" to title
  298. store TITL_KEY(title) to var
  299. ? var
  300.  
  301. returns: "CATINTH " as index key
  302.  
  303. (i.e. all return values are 8 characters long)
  304.  
  305. ***************************************************************
  306.  
  307. FUNCTION U_NIQUE()
  308.  
  309. Returns unique index key for string variables.
  310.  
  311. Index based on charater data type must be in use before  function
  312. is called.
  313.  
  314. Checks to see if key is unique in index,  if not, adds "A" to end
  315. of   character   string,   and  checks  again.   If   still   not
  316. unique,removes  the "A",  adds a "B",  etc.,  until a unique  key
  317. value  is obtained.  In the event that all letters up through "Z"
  318. are  in use,  the function adds another "A" and starts  over.  As
  319. more letters are tried the time taken by the function increases.
  320.  
  321. Be  sure  data  field is long enough  to  accept  the  additional
  322. letters added by the function.
  323.  
  324. returns .t.
  325.  
  326. usage:
  327.  
  328. store U_NIQUE(index_key) to var
  329.  
  330. replace field_name with var
  331.  
  332. ********************************************************************
  333.  
  334. FUNCTION TITL_SRCH()
  335.  
  336. Use  with index key searches based on the TITL_KEY() function  to
  337. list and display multiple items sharing the same index keys.
  338.  
  339. Displays  up  to  73  characters of  character  string  per  item
  340. displayed.
  341.  
  342. TITL_SEARCH()  will  display  listing  of up  to  15  titles  per
  343. screenload retrieved by the search.
  344.  
  345. Returns logical values .t. or .f.
  346.  
  347.   Returns  .t.  and leaves file open if the user A)ccepts a title
  348. found in a list of items displayed in screenloads of items.
  349.  
  350. If  the  SEEK  command fails,  or if the user  quits  the  search
  351. without A)ccepting a record from the screen display the  function
  352. returns .f. and closes all data files.
  353.  
  354. File  must  be  indexed  on key expression  compatible  with  the
  355. TITL_KEY function.  Parameters passed are the name of the  index
  356. field and the expression to be displayed for selection.
  357.  
  358. usage:  TITL_SRCH("TKEY","TITLE")
  359.         && uses the index key TKEY and displays the
  360.         && retrieved field TITLE
  361.  
  362. Example:
  363.  
  364. use file index tkey
  365.  
  366. IF TITL_SRCH("TKEY","TITLE")
  367.  DO edit   &&(print, display, etc.)
  368.   else
  369.    return
  370. ENDIF
  371.  
  372. **********************************************************************
  373.  
  374. FUNCTION T_SEARCH()
  375.  
  376. Functions similar to the TITL_SRCH() function above, but displays
  377. individual  records  one at a time with the options  of  browsing
  378. forward  and  backward in the retrieval set  until  a  particular
  379. record  is  selected.  Returns logical .t.  if a user A)ccepts  a
  380. particular record in the retrieval set.  If no match is found  or
  381. the Q)uit search option is selected, closes files and returns .f.
  382.  
  383. File  must  be  indexed  on key expression  compatible  with  the
  384. TITL_KEY function.
  385.  
  386. CALL as T_SEARCH(<indexfieldname>,progname)
  387.  
  388. With  PROGNAME  as  the name of the  procedure  file  to  display
  389. individual records.
  390.  
  391. Note  that T_SEARCH() reserves the bottom of the screen beginning
  392. at  line  24  for the user  request  line.  PROGNAME  should  not
  393. overwrite this area.
  394.  
  395. USAGE:
  396.  
  397. use file index tkey
  398. store  "DISPLAY" to prog
  399. do while .t.
  400.  
  401. IF T_SEARCH("TKEY",prog)
  402.   do edit    && or print, delete, recall, or whatever
  403. else
  404. return
  405. endif
  406.  
  407. procedure DISPLAY
  408. clear
  409. @ 2,0 say "TITLE" + title
  410. @ 4,0 say "AUTHOR" + author
  411. @ 6,0 say "PUB" + publisher
  412. @ 8,0 say "DATE" + dtoc(date)
  413. return
  414.  
  415. **********************************************************
  416.  
  417. FUNCTION GET_TKEY()
  418.  
  419. Prompts user for OCLC type title search key.
  420.  
  421. Returns  null  if  user escapes without entering  keys  otherwise
  422. returns 8 character upper case search key.
  423.  
  424. USAGE: store GET_TKEY() to var_name
  425.  
  426. **********************************************************
  427.  
  428. FUNCTION GET_AKEY()
  429.  
  430. Prompts user for OCLC type author search key.
  431.  
  432. Returns  null  if user escapes without  entering  keys  otherwise
  433. returns 8 character upper case search key.
  434.  
  435. USAGE: store GET_AKEY() to var_name
  436.  
  437. ********************************************************************
  438.  
  439. FUNCTION GOOD_DOS()
  440.  
  441. Returns variable with illegal DOS filename characters removed and
  442. replaced with underlines.
  443.  
  444. Intended  to  prevent  errors from attempting to open  file  with
  445. illegal characters in name.
  446.  
  447. Illegal characters tested are:
  448.  "/\[]:|<>+=;,  and blank (chr(32))
  449.  
  450. Usage:   GOOD_DOS(var)
  451.  
  452. example:
  453.      store space(8) to var
  454.      @ 5,1 say "Enter name of output file" get var
  455.      read
  456.      store GOOD_DOS(var) to var
  457.      store var + ".txt" to var
  458.      set printer to &var
  459.  
  460. Converts "my file" to "my_file", etc.
  461. ***************************************************
  462.  
  463. FUNCTION BAD_DOS
  464.  
  465. Checks for illegal characters in filename but does not
  466. correct illegal characters.
  467.  
  468. Returns .t. if name contains
  469.      "/\[]:|<>+=;,  and blank (chr(32))
  470.  
  471. otherwise returns .f.
  472.  
  473.  
  474. ***************************************************
  475.  
  476. FUNCTION STOPWORD()
  477.  
  478. Designed  to  be  used  with  the  TITL_KEY  function  to  remove
  479. stopwords from the title keys generated by that function.
  480.  
  481. Requires  a  stopword data file be set up indexed  on  the  words
  482. established as stopwords.
  483.  
  484. The function automatically adjusts to the length of the character
  485. field in the stopword list.
  486.  
  487. EXAMPLE:
  488.  
  489.  Passing  "The cat in the hat" as a variable string
  490.  to the function returns "CAT IN THE HAT".
  491.  
  492.  Passing "And the west was won" returns
  493.  "WEST WAS WON"
  494.  
  495. ... depending on the terms in the stopword list.
  496.  
  497. Items  entered  into the stopword list must be of type  character
  498. and upper case.
  499.  
  500. USAGE:
  501.  
  502. select 1
  503. use title index stop_title
  504. select 2
  505. use stopword index stopword
  506. select 1
  507.  
  508. store space(100) to mtitle
  509. @ 10,1 say "Enter title" get mtitle
  510. read
  511. select 2
  512. store stopword(mtitle) to stop_title
  513. select 1
  514.  
  515. replace title with mtitle
  516. replace t_key with TITL_KEY(stop_title)
  517.  
  518.  
  519. Syntax for indexing on stopword()
  520.  
  521. select 1
  522. use filename
  523. EXTERNAL STOPPER           && required
  524. select 2
  525. use stopword index stopword
  526. select 1
  527. index on stopper(keyfield) to indexname
  528. close data
  529. return
  530.  
  531. FUNCTION STOPPER
  532. parameters instring
  533. select 2
  534. store len(instring) to inlength
  535. store stopword(instring) to instring
  536. if len(instring) < inlength
  537. store instring + space(inlength - len(instring)) to instring
  538. endif
  539. select 1
  540. return instring
  541.  
  542.  
  543. ******************************************************************
  544.  
  545. FUNCTION STOPPED()
  546.  
  547. Similar to the stopword() function above,  but rotates  stopwords
  548. to the end of the string and appends the number of the characters
  549. that have been rotated in the form "~#",  with # being the number
  550. of  characters  rotated.  Strings longer than 252 characters  are
  551. simply truncated at a 252 character limit.
  552.  
  553. EXAMPLE:
  554.     store "A new bicycle" to title
  555.     ? stopped(title)
  556.  
  557. RETURNS:   new bicycle A~2
  558.  
  559.     store "The new bicycle" to title
  560.     ? stopped(title)
  561.  
  562. RETURNS: new bicycle The ~4
  563.  
  564. USAGE:
  565.  
  566. use title
  567. index on title to titledex
  568.  
  569. select 1
  570. use title index titledex
  571. select 2
  572. use stopword index stopword
  573. select 1
  574. store space(100) to mtitle
  575. @ 10,1 say "Enter title" get mtitle
  576. read
  577.  
  578. select 2
  579. store stopped(mtitle) to stop_title
  580. select 1
  581.  
  582. replace title with stop_title
  583.  
  584.   Since  the function adds at least 2 and sometimes 3  characters
  585. to  the string,  make the field wherein the string is  stored  at
  586. least 3 characters longer than the input line as displayed to the
  587. user,  lest  the numerical counter be lost and the stopwords  are
  588. left  in the rotated position forever.  The UNSTOPPED()  function
  589. requires  the numerical information to unrotate the stopwords  to
  590. the front of the string.
  591.  
  592. ************************************************************************
  593.  
  594. FUNCTION UNSTOPPED()
  595.  
  596.  Reverses  the  action of the STOPPED()  function,  rotating  the
  597. stopwords back to the front of the character string.
  598.  
  599. Strings passed the the STOPPED() and UNSTOPPED() functions should
  600. not have a tilde "~" as part of the string,  as this will prevent
  601. the  UNSTOPPED()  function  string  from  unrotating  the  string
  602. properly.
  603.  
  604. USAGE:
  605.  
  606. ? title
  607.  
  608. RETURNS: new bicycle The ~4
  609.  
  610. ? UNSTOPPED(title)
  611.  
  612. RETURNS: The new bicycle
  613.  
  614.  
  615. ********************************************************************
  616.  
  617. FUNCTION AUT_SRCH()
  618.  
  619. Indexed author search based on AUT_KEY compatible index keys.
  620.  
  621. usage: AUT_SRCH("INDEXFIELD","SEARCHFIELD",PROG1, PROG2, PAGE_COUNT)
  622.  
  623. With  INDEXFIELD being the name of the AUT_KEY() compatible index
  624. field,  SEARCHFIELD being the field to search for unique entries,
  625. PROG1  being the procedure file use to format individual  records
  626. on the screen,  and prog2 being the procedure file used to format
  627. printed copy of search results. Page layout is the responsibility
  628. of  PROG2.  PAGE_COUNT controls the number of individual  records
  629. that  are printed by PROG2 before issuing a line feed to eject  a
  630. page from the printer.
  631.  
  632.  
  633.  
  634. Retrieves multiple records for varying forms of authors names.
  635.  
  636. Displays results in form:
  637.   Set 1)  SMITH, JOE             (8 records)
  638.   Set 2)  SMITH JOE A            (4 records)
  639.   Set 3)  SMITH JOE A, 1965-     (2 records)
  640.     etc.
  641.  
  642. Records  may then be viewed individually of sets of  records  for
  643. particular authors may be printed.
  644.  
  645. The  procedure use a temporary data file "TEMPSRCH" designated to
  646. memory work area 9,  if this file is not on the logical path  the
  647. function will create it.
  648.  
  649.  
  650. Requires Extend.lib in linkage list.
  651.  
  652. Note  that the procedure uses the lower 2 lines of the screen for
  653. user interface beginning at line 23.  PROG1 should not  overwrite
  654. these areas.
  655.  
  656. Returns logical values .t. or .f.
  657.  
  658. Returns .t. and leaves file open if the desired item is found and
  659. A)ccepted in a list of items displayed in screenloads of items.
  660.  
  661. If  the  SEEK  command fails,  or if the user does not  find  the
  662. desired  item  in the screen displays and exits the  function  it
  663. returns .f. and closes all data files.
  664.  
  665. EXAMPLE:
  666.  
  667. select 1
  668. use file index akey
  669.  
  670. store "DISPLAY" to prog1
  671. store "PRINTME" to prog2
  672.  
  673.  && to search a field called "AUTHOR" based on the index field "AKEY"
  674. store 3 to pagecount
  675. if AUT_SRCH("AKEY,"AUTHOR",prog1,prog2,pagecount)
  676. do editer  &&printer,or whatever
  677. else
  678. return
  679.  
  680. endif
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.   && to search the fields "LNAME" + "FNAME" + "MID"
  691.   && based on the index field "AKEY"
  692. store "LNAME + FNAME + MID" to showfield
  693. store 3 to pagecount
  694. if AUT_SRCH("AKEY",SHOWFIELD,prog1,prog2,pagecount)
  695. do editer  && printer, or whatever
  696. else
  697. return
  698. endif
  699.  
  700.  
  701. PROCEDURE DISPLAY
  702.  
  703. clear
  704. @ 5,0 say "AUTHOR" + author
  705. @ 6,0 say "TITLE"  + title
  706. @ 8,0 say "PUBLISHER" + publisher
  707. return
  708.  
  709. PROCEDURE PRINTME
  710.  
  711. ? "AUTHOR " + author
  712. ? "TITLE " + title
  713. ? "PUBLISHER " + pub
  714. return
  715.  
  716. **************************************************
  717.  
  718. PROCEDURE STOPMENU
  719.  
  720. A complete stopword maintenance menu with light bar interface.
  721.  
  722. Functions  supported  include  create/initialize  stopword  file,
  723. search,  add,  delete,  list or edit stopwords,  pack and reindex
  724. stopword  file,  reinitialize  title key index  fields  with  the
  725. current stopwords in the file, and information screens.
  726.  
  727. Usage:
  728.  
  729. DO stopmenu
  730.  
  731. No  parameters are passed so the procedure returns nothing to the
  732. calling program.
  733.  
  734. *************************************************************
  735.  
  736. PROCEDURE EDITHELP
  737.  
  738. Presents  a 2 screenload list of menu navigation and full  screen
  739. editing  commands.  Called  from help.prg.  clears @ 0,0 so  GETS
  740. remain  in memory after leaving the procedure.  Screen should  be
  741. SAVED before  calling the procedure and RESTORED after it finishes.
  742.  
  743.  
  744.  
  745. ******************************************************
  746.  
  747. PROCEDURE BAR_EDIT
  748.  
  749. Places  light  bar menu on row 24 of the screen display with  the
  750. options  DELETE,  UNDELETE,  EDIT,  PRINT,  QUIT  EDIT  LINE  and
  751. displays the message RECORD IS DELETED or RECORD IS NOT DELETED.
  752.  
  753. CALL as DO BAR_EDIT with PROG1,PROG2
  754.  
  755. prog1 is the name of the procedure to edit individual records.
  756. prog2 is the name of the procedure to print individual records.
  757.  
  758. PROG1 should not overwrite line 24, as BAR_EDIT clears the screen
  759. @ 24,0 for the edit line.  Any information displayed on that line
  760. will be lost.  Printer and console control while printing is  the
  761. responsibility of PROG2.
  762.  
  763. Options  to delete or undelete records are confirmed in a  series
  764. of  pop up windows.  The status of the record is then updated  on
  765. row  24.  Quitting the editline leaves the record pointer at  the
  766. same record and leaves the files open.  While on the editline the
  767. record can be repeatedly edited, deleted and recalled.
  768.  
  769. example:
  770. use whatever
  771.  
  772. store "editprog" to prog1
  773. store "printme" to prog2
  774.  
  775.    && goto individual record
  776.  
  777. do display
  778. do BAR_EDIT with prog1,prog2
  779.  
  780. close data
  781. return
  782.  
  783. ********************************************************************
  784.  
  785. PROCEDURE STR_SRCH
  786.  
  787. Performs  substring  searching of field with up to  three  search
  788. terms and the Boolean operators AND and OR.
  789.  
  790. The  procedure  calls  BAR_EDIT as editline  for  the  individual
  791. records that are retrieved.
  792.  
  793. Four parameters are passed: the name of the field to be searched,
  794. the name of the display procedure,  the edit procedure,  and  the
  795. procedure  to format records for printing.  Console control while
  796. printing is the responsibility of the print procedure.
  797.  
  798.  
  799. usage:
  800.  
  801. use file index whatever
  802.  
  803. store "DISPLAY" to prog1
  804. store "EDITME" to prog2
  805. store "PRINTME" to prog3
  806.  
  807. do STR_SRCH with "TITLE",prog1,prog2,prog3
  808. return
  809.  
  810. **************************************************************
  811.  
  812. FUNCTION NO_DUP_CHR()
  813.  
  814. Removes  duplicate  characters from a string,  beginning  at  the
  815. leftmost position.
  816.  
  817. usage: store NO_DUP_CHR(string) to var
  818.  
  819. example:
  820.       store "123451345AC1" to string
  821.       ? NO_DUP_CHR(string)
  822.  
  823.       returns: "12345AC"
  824.  
  825. *******************************************************************
  826.  
  827. PROCEDURE BOOL_SRCH
  828.  
  829. Provides  sequential substring searching with up to  nine  search
  830. terms and the Boolean operators AND, OR and NOT.
  831.  
  832. Four parameters are passed: the name of the field to be searched,
  833. the name of the display procedure,  the edit procedure,  and  the
  834. procedure  to format records for printing.  BAR_EDIT is called as
  835. status line for editing of records.  Console and printer  control
  836. while printing is the responsibility of the print procedure.
  837.  
  838. usage:
  839.  
  840. use file index whatever
  841.  
  842. store "DISPLAY" to prog1
  843. store "EDITME" to prog2
  844. store "PRINTME" to prog3
  845.  
  846. do BOOL_SRCH with "TITLE",prog1,prog2,prog3
  847. return
  848.  
  849. *******************************************
  850.  
  851. FUNCTION EXPLODE()
  852.  
  853.  Opens 'exploding window' at specified coordinates
  854.  parameters top, left, bottom, right of final position
  855.  
  856.  Useage: save screen
  857.          explode(5,10,10,50)
  858.          @ 6,11 say "whatever"
  859.          inwait()
  860.          restore screen
  861.  
  862. ******************************************************
  863.  
  864.  
  865. FUNCTION IMPLODE()
  866.  
  867.  closes 'exploding window at specified coordinates
  868.  parameters top,left,bottom,right
  869.  
  870.     Usage:   save screen
  871.              explode(5,5,20,50)
  872.              @ 6,6 say "whatever"
  873.              &&wait for input from user
  874.              implode(5,5,20,50)
  875.  
  876.  
  877. ***************************************************
  878.  
  879. FUNCTION GOODNTX
  880.  
  881. Determines in .NTX index file is approriate for
  882.  use with a particular .DBF. Useful for confirming
  883.  indexes prior to opening.
  884.  
  885. CALL AS:
  886.  
  887.    if GOODNTX(datafile,indexfile)
  888.    do whatever
  889.    else
  890.    do something_else
  891.    endif
  892.  
  893.    DATAFILE should be passed as file name without .DBF etension
  894.    INDEXFILE should be passed with .NTX extension
  895.     (i.e.  if GOODNTX(mydbf,myindex.ntx)
  896.  
  897. returns .t. if index is valid for .DBF
  898. returns .f. if error in opening file or if the
  899.   index key is inaproriate for use with this .DBF
  900.  
  901. Does not accept UDFs in index key expression
  902.  
  903.  
  904. *************************************************
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.