Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: David Hall
  Where is David Hall?
 Birmingham
 United Kingdom
 David Hall
 To: Ilya Rabyy
  Where is Ilya Rabyy?
 Fountain Valley
 California - United States
 Ilya Rabyy
 Tags
Subject: RE: libraries in applications
Thread ID: 188928 Message ID: 188974 # Views: 1 # Ratings: 0
Version: Visual FoxPro 7 Category: General VFP Topics
Date: Tuesday, August 12, 2008 8:47:21 PM         
   


> If it was a good design, and if every one (or at least majority) of the subs (procs and functions) are made as much generic as humanly possible, that would/should had made all the subs in those .APP modules, as well as modules themselves, independent from one another. (In part - if there are no implicit memvars declarations, with consecutive use of those memvars in the called subs.)
>

Ilya,
as far as I can see, every local variable (memvar) is declared local, and the procs are very generalised - but that very generality is what causes the 'mainlib' containing the general procedures to be incorporated in every .app.

Perhaps it would be better to explain in more detail the procedure which needs to be changed. In the case in point, it is a proc called IncriTlast, with LPARAMETER lcField.

lcField refers to one of the fields in a table, and the various fields are used in one or another place in the whole collection of .apps. Here is some of the code

PROCEDURE IncriTlast
LPARAMETER lcField
LOCAL lnSelected,lcUniqueID,llWasShut

lnSelected = SELECT(0)
IF USED("TLAST")
	llWasShut=.F.
	SELECT TLAST
ELSE
	llWasShut=.T.
	=UseTomTable("TLAST")
ENDIF
*    get next document numbers from TLAST
DO WHILE NOT FLOCK()
    WAIT WINDOW NOWAIT "TLAST is locked by another"
ENDDO

DO CASE
CASE lcField = "LIN"
    *    order line numbers are right justified
    lcUniqueID = STR(VAL(Tl_LineID) + 1,8)
    REPLACE Tl_LineID WITH lcUniqueID
CASE lcField = "CUS"
    *    customer numbers are left justified
    lcUniqueID = TRANSFORM(VAL(Tl_Custno) + 1)
    REPLACE Tl_Custno WITH lcUniqueID
	
...etc, etc

OTHERWISE
    =MESSAGEBOX("unknown call "+lcField+" in incriTlast",64,"System Error")
ENDCASE
UNLOCK
IF llWasShut
	USE
ENDIF
SELECT (lnSelected)
RETURN lcUniqueID


Now, since this highly generalised code is in mainlib, and mainlib is included in all .apps, if I change just one of the formulations of lcUniqueID, is it the one in the top level .app that needs to be re-compiled, the .app in which that particular formulation is used, both .apps, or all .apps?

ENTIRE THREAD

libraries in applications Posted by David Hall @ 8/12/2008 4:56:11 PM
RE: libraries in applications Posted by Ilya Rabyy @ 8/12/2008 5:19:41 PM
RE: libraries in applications Posted by David Hall @ 8/12/2008 8:47:21 PM
RE: libraries in applications Posted by Ilya Rabyy @ 8/12/2008 9:49:39 PM
RE: libraries in applications Posted by David Hall @ 8/13/2008 11:44:54 AM
RE: libraries in applications Posted by Mike Yearwood @ 8/13/2008 4:03:49 PM
RE: libraries in applications Posted by Ilya Rabyy @ 8/13/2008 5:22:57 PM
RE: libraries in applications Posted by David Hall @ 8/13/2008 6:17:10 PM
RE: libraries in applications Posted by Ilya Rabyy @ 8/14/2008 4:43:49 PM
RE: libraries in applications Posted by David Hall @ 8/14/2008 6:17:06 PM
RE: libraries in applications Posted by Ilya Rabyy @ 8/14/2008 6:22:07 PM
RE: libraries in applications Posted by Mike Yearwood @ 8/13/2008 4:24:31 AM
RE: libraries in applications Posted by David Hall @ 8/13/2008 11:59:28 AM
RE: libraries in applications Posted by Mike Yearwood @ 8/13/2008 4:00:00 PM
RE: libraries in applications Posted by tushar @ 8/13/2008 5:22:28 AM
RE: libraries in applications Posted by David Hall @ 8/13/2008 11:56:10 AM
RE: libraries in applications Posted by Tom Saddul @ 8/13/2008 12:52:40 PM
RE: libraries in applications Posted by Ilya Rabyy @ 8/13/2008 4:37:57 PM
RE: libraries in applications Posted by tushar @ 8/13/2008 2:59:19 PM