Re: Namespaces
- Posted by Derek Parnell <ddparnell at bigpond.com> Jun 09, 2004
- 569 views
Hi irv, using my macro utility, you could do it thus ... @insert mailinglist.e <ns=customer @insert mailinglist.e <ns=supplier customer_file = "customer.edb" supplier_file = "supplier.edb" customer_add("Coyote, W") supplier_add("Acme Anvils, Inc.") where the 'mailinglist.e' file would look something like ... sequence [[ns]]_file function valid_[[ns]](object pKey) integer lStatus lStatus = 0 @if [[ns]] eq customer . . . code to validate the customer data @endif @if [[ns]] eq supplier . . . code to validate the supplier data @endif return lStatus end function procedure [[ns]]_add(object pKey) if valid_[[ns]](pData) then open_db([[ns]]_file) rec_add(pKey) end if end procedure You could even have insert files ... @ newfld.i @inc global [[[[ns]]_fldno]] constant [[ns]]_[[fld]] = [[[[ns]]_fldno]] and @ recdef.i constant [[ns]]_Empty_Record = repeat(0,[[[[ns]]_fldno]]]) and used like this ... @insert newfld.i <ns=customer,fld=Name @insert newfld.i <ns=customer,fld=Address @insert newfld.i <ns=customer,fld=Phone @insert newfld.i <ns=customer,fld=Email @insert newfld.i <ns=supplier,fld=ID @insert newfld.i <ns=supplier,fld=Email @insert newfld.i <ns=supplier,fld=Address @insert recdef.i <ns=customer @insert recdef.i <ns=supplier to generate ... constant customer_Name = 1 constant customer_Address = 2 constant customer_Phone = 3 constant customer_Email = 4 constant supplier_ID = 1 constant supplier_Email = 2 constant supplier_Address = 3 constant customer_Empty_Record = repeat(0, 4) constant supplier_Empty_Record = repeat(0, 3) -- Derek Parnell Melbourne, Australia