home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a012 / 1.ddi / README.EXE / Q&A.TXT < prev    next >
Encoding:
Text File  |  1991-05-01  |  5.2 KB  |  164 lines

  1.                                 ASK THE GRUMPS
  2.                              Compiled by Greg Lief
  3.  
  4.  
  5. Do you have a burning Clipper question?  Send it our way via the
  6. Aquarium Message Center and get the pleasure of not only an expert
  7. solution to your question, but seeing your name in print!!
  8.  
  9. ---------------------------------------------------------------------
  10.  
  11. Dear Grumps:
  12.  
  13. Several questions for you:
  14.  
  15. 1.  What's the best and most efficient method to open a DBF file using
  16.     a variable name?  i.e.,
  17.    
  18.     dbf := cOne + cTwo + ".DBF"
  19.     ntx := (dbf) + ".NTX"
  20.     IF ! Net_use((dbf),.F.,(ntx))
  21.         CLEAR
  22.         RETURN
  23.     ENDIF
  24.    
  25.     I definitely want to stay away from macro substitution (for
  26.     example, Net_use("&dbf",.F.,"&ntx")).
  27.  
  28. 2.  What is the best and fastest code to fill an array with JUST
  29.     filenames?  I want to use DIRECTORY(), but it saves multiple arrays
  30.     containing various file information.
  31.    
  32. Thanks!
  33.  
  34. Matt Amis
  35. Port Orchard, WA
  36. *
  37. (Mr. Grump and Mr. Neff respond:)
  38.  
  39. 1.  Try this:
  40.  
  41.     mvar := 'whatever'
  42.     use (mvar + '.dbf') index (mvar + 'ntx')
  43.  
  44.     or if you want to continue using a function such as Net_Use():
  45.  
  46.     if ! net_use(mdbf, .f., mntx)
  47.        return
  48.     endif
  49.  
  50.     As you can see, with Net_Use() there is no need to enclose the dbf
  51.     and ntx names within parentheses.  And macro substitution is also
  52.     entirely unnecessary.
  53.  
  54. 2.  You have two choices... you can use ADIR() or DIRECTORY().
  55.     Although DIRECTORY() gives you all the file info (as opposed to
  56.     ADIR(), which will give you only what you specify), I would still
  57.     recommend that you use DIRECTORY().  ADIR() is one of the Clipper
  58.     functions that is in the process of being phased out, and with
  59.     good reason: it is clunky compared to DIRECTORY().  If you only
  60.     need filenames, here's two lines of code to do it for you:
  61.  
  62.     local a := directory(), b := {}
  63.     aeval(a, { | element | aadd(b, element[1] } )
  64.  
  65.     Array B will then contain only the filenames.
  66.  
  67. ---------------------------------------------------------------------
  68.  
  69. Dear Grumps:
  70.  
  71. In Summer '87, I am able to paint the entire screen with for example,
  72. chr(176), simply by issuing the command:
  73.  
  74. ? REPLICATE(chr(176), 2000)
  75.  
  76. assuming of course that the display is 80 x 25.  However, when I issue
  77. this command in 5.0, only Row 0 gets painted.  Can you explain why?
  78. Is there any other way to get around this besides going through a
  79. FOR..NEXT loop?
  80.    
  81. Thanks,
  82.  
  83. Jeff Intravaia
  84. New York, NY
  85. *
  86. (Mr. Grump responds:)
  87.  
  88. The reason that only row 0 gets painted in Clipper 5.0 is in
  89. anticipation of different display modes.  5.0 apparently does not make
  90. the assumption that your row is 80 characters wide, and thus paints a
  91. 2000 character row.  Naturally, you don't see the remaining 1920
  92. characters!
  93.  
  94. For what you are trying to do, there is no need to resort to a
  95. FOR..NEXT loop.  Try this:
  96.  
  97. @ 0, 0, maxrow(), maxcol() box replicate(chr(176), 9)
  98.  
  99. Not only will this be quite fast, but it will always cover the entire
  100. screen, no matter what display mode you happen to be using.  MAXROW()
  101. and MAXCOL() are Clipper functions that return the maximum row and
  102. column based on the current video display mode.
  103.  
  104. ---------------------------------------------------------------------
  105.  
  106. Dear Grumps:
  107.  
  108. Although RTLINK is a big improvement over PLINK86, I still have enough
  109. time to sweep the kitchen floor during the average link cycles!  Any
  110. suggestions?  Should I give in and use Blinker or WarpLink?  I've
  111. heard about pre-linked libraries -- would they help?
  112.  
  113. Kathy Uchman
  114. Concord, CA
  115. *
  116. (Mr. Grump responds:)
  117.  
  118. Dear Kathy
  119.  
  120. If you are not already using pre-linked libraries, you are wasting
  121. valuable link time.  For less than a minute's investment (40 seconds
  122. on my 386/20), you can create a .PLL that will slash your link time.
  123. Look for the file BASE50.LNK somewhere on your hard disk.  Found it?
  124. Great!  Now run the following command:
  125.  
  126.    RTLINK @base50
  127.  
  128. After a few seconds of churning, this will create the files BASE50.PLL
  129. and BASE50.PLT.  Put them in your \CLIPPER5\PLL directory.  Make sure
  130. that you have the following line in your AUTOEXEC.BAT file:
  131.  
  132.    SET PLL=C:\CLIPPER5\PLL  (or whatever directory they are in)
  133.  
  134. This environmental variable instructs the linker and run-time system
  135. where to find the .PLL.  (For more details on Clipper environmental
  136. variables, please see my article on "Compiler Switches and the
  137. Environment" elsewhere in this issue.)
  138.  
  139. Now when you link an application, instead of using this command:
  140.  
  141.    RTLINK FI whatever
  142.  
  143. use this one:
  144.  
  145.    RTLINK FI whatever /PLL:base50
  146.  
  147. You will notice a dramatic improvement in link time.  Here is a sample
  148. program that I linked "the old way", and with a .PLL:
  149.  
  150.    function main
  151.    local x := 0
  152.    return nil
  153.  
  154. The old way (using the LIBs) took 14 seconds.  With a .PLL, the link
  155. took just 5 seconds!
  156.  
  157. If this is not fast enough for you, please investigate Roger Donnay's
  158. article "Linking Tips with PLLs" in the December 1990 Aquarium. It
  159. provides a FULLBASE.LNK file that creates a pre-linked library
  160. containing every single module in all of the libraries
  161. provided with Clipper 5.0.
  162.  
  163. ---------------------------------------------------------------------
  164.