compiling more pro files to 1 app

compiling more pro files to 1 app

Postby plantenkennis » Fri Nov 27, 2015 6:56 pm

Hello,

I have just started on programming for Mac, coming from Windows.
My code is in more files, but when I compile it the program hangs. When I put ti in one file it works OK. What am I missing? Below my code:
When I open the database in plantenkennis.prg the program runs, but exits on mouse-scroll
When I open the database using function in functions.prg, the app hangs

Rene Koot


file: plantenkennis.prg;

#include "FiveMac.ch"
#include "Functies.prg"

function Main()

local oWnd, oBrw
local cpath:=Path()
PUBLIC leigen := .T.
PUBLIC lPro := .T.
PUBLIC lEtiket := .F.
PUBLIC cDataBasePad := cPath + "/databases/"
PUBLIC aDatabases[0][8]
PUBLIC aIndexFiles[0][2]


RK_FillArrays()
RK_BestandsControle()
RK_OpenTables()

*USE (cDatabasePad + 'latnaam') INDEX (cDatabasePad + 'Latnum'), (cDatabasePad + 'Latnaam'), (cDatabasePad + 'Latkode') ALIAS Latnaam NEW

DEFINE WINDOW oWnd TITLE "Plantenkennis" ;
FROM 30, 70 TO 650, 820

@ 48, 20 BROWSE oBrw ;
FIELDS Plantkode, Naam ;
HEADERS "Latnaam->Kode", "Latnaam->Naam" ;
OF oWnd SIZE 672, 563 ALIAS Alias()

oBrw:SetColWidth( 1, 300 )
oBrw:SetColWidth( 2, 500 )
ACTIVATE WINDOW oWnd

return nil

File functies.prg:

#include "FiveMac.ch"
#define CR_LF Chr(13) + Chr(10)

FUNCTION RK_FillArrays()

*hier worden alle benodigde arrays gevuld
*date: 24-11-2015

*alle databases, volgorde: filenaam, alias, aantal indexes, indexnamen
AADD(aDataBases, {'latnaam.dbf', 'Latnaam', 3, 'Latnum', 'Latnaam', 'Latkode', '', ''})
AADD(aDataBases, {'planten.dbf', 'Planten', 1, 'Planten', '', '', '', ''})
AADD(aDataBases, {'nednaam.dbf', 'Nednaam', 2, 'Nednum', 'Nednaam', '', '', ''})
*AADD(aDataBases, {'gegeven.dbf', 'Gegeven', 1, 'Gegeven', '', '', '', ''})
*AADD(aDataBases, {'criteria.dbf', 'Criteria', 1, 'Criteria', '', '', '', ''})
*AADD(aDataBases, {'geslacht.dbf', 'Geslacht', 1, 'GeslachtNaam', '', '', '', ''})
*AADD(aDataBases, {'groep.dbf', 'Groep', 1, 'Groep', '', '', '', ''})
*AADD(aDataBases, {'familie.dbf', 'Familie', 1, 'FamilieNaam', '', '', '', ''})
*AADD(aDataBases, {'fotograaf.dbf', 'FotoGraaf', 0, '', '', '', '', ''})
*AADD(aDataBases, {'beheerlijst.dbf' 'BeheerLijst', 0, '', '', '', '', ''})
*AADD(aDataBases, {'lijst.dbf', 'Lijst', 5, 'Lijstloc', 'Lijstkode', 'LijstLat', 'LijstNed', 'LijstNed'})
*AADD(aDataBases, {'plantlib.dbf', 'PlantLib', 2, 'LibNaam', 'Libkode', '', '', ''})
*AADD(aDataBases, {'selectie.dbf', 'Selectie', 3, 'SelecKode', 'Selectie', 'SelecNed', '', ''})
*AADD(aDataBases, {'sneltext.dbf', 'Sneltext', 1, 'SnelText', '', '', '', ''})
*AADD(aDataBases, {'snoei.dbf', 'Snoei', 1, 'Snoei', '', '', '', ''})
*AADD(aDataBases, {'snoeiwijze.dbf', 'Snoeiwijze', 1, 'SnoeiWijze', '', '', '', ''})
*AADD(aDataBases, {'afstanden.dbf', 'Familie', 1, 'afstanden', '', '', '', ''})
IF lPro
* AADD(aDataBases, {'lijsten\klanten.dbf', 'Klanten', 1, 'KlantNaam', '', '', '', ''})
* AADD(aDataBases, {'lijsten\maten.dbf', 'Maten', 1, 'MaatPlant', '', '', '', ''})
* AADD(aDataBases, {'lijsten\beheer.dbf', 'Beheer', 2, 'BeheerKlant', 'BeheerLijst', '', '', ''})
* AADD(aDataBases, {'lijsten\plantlijst.dbf', 'PlantLijst', 5, 'Lijstnr', 'Naam', 'Type', 'Vak', 'Locatie'})
ENDIF
* AADD(aDataBases, {'etiketten\lblsize.dbf', 'LabelSize', 0, '', '', '', '', ''})
* AADD(aDataBases, {'etiketten\papersiz.dbf', 'PaperSize', 0, '', '', '', '', ''})
* AADD(aDataBases, {'etiketten\lblayout.dbf', 'LabelLay', 0, '', '', '', '', ''})
* AADD(aDataBases, {'etiketten\lbmanage.dbf', 'LabelManage', 0, '', '', '', '', ''})
* AADD(aDataBases, {'etiketten\listlay.dbf', 'ListLay', 0, '', '', '', '', ''})
* AADD(aDataBases, {'etiketten\listman.dbf', 'ListManage', 0, '', '', '', '', ''})
* AADD(aDataBases, {'etiketten\exportexcel.dbf', 'ExportExcel', 0, '', '', '', '', ''})
IF lEtiket
ENDIF
IF lEigen
* AADD(aDataBases, {'algemeen.dbf', 'Algemeen', 1, '', '', '', '', ''})
* AADD(aDataBases, {'duitsnaam.dbf', 'DuitsNaam', 1, '', '', '', '', ''})
* AADD(aDataBases, {'engelsnaam.dbf', 'EngelsNaam', 1, '', '', '', '', ''})
* AADD(aDataBases, {'fransnaam.dbf', 'FransNaam', 1, '', '', '', '', ''})
ENDIF

AADD(aIndexFiles, {'Latnum', 'PlantNum'})
AADD(aIndexFiles, {'Latnaam', 'Naam'})
AADD(aIndexFiles, {'Latkode', 'PlantKode'})
AADD(aIndexFiles, {'Planten', 'PlantNum'})
AADD(aIndexFiles, {'Nednum', 'PlantNum'})
AADD(aIndexFiles, {'Nednaam', 'UPPER(NederNaam)'})

RETURN NIL

*************************************************

FUNCTION RK_BestandsControle()

*om alle bestanden te controleren of ze aanwezig zijn
*date: 24-11-2015

LOCAL cBestand := '', cIndexFile := '', cField := '', r := 0
LOCAL cBarBestand := '', cBarIndex := ''
LOCAL n, i
FOR n = 1 TO LEN(aDataBases)
cBestand := cDataBasePad + aDataBases[n,1]
cBarBestand := aDataBases[n,1]
IF .NOT. FILE(cBestand)
MSgInfo(cBestand + ' is niet aanwezig' + CR_LF + 'Het programma wordt afgesloten')
RETURN
ELSE
IF aDataBases[n,3] > 0
FOR i = 1 TO aDataBases[n,3]
cIndexFile := cDataBasePad + aDataBases[n, i+3] + '.ntx'
cBarIndex := aDataBases[n, i+2]
IF .NOT. FILE(cIndexFile)
r := ASCAN(aIndexFiles, { |x| x[1] == aDataBases[n,i+3]})
IF r > 0
cField := aIndexFiles[r,2]
USE &cBestand
* Win_Main.StatusBar.Item(1) := 'Index maken voor: ' + cBarBestand + ' -> ' + cBarIndex
INDEX ON &cField TO &cIndexFile EVAL NtxProgress() EVERY LASTREC()/100
USE
ELSE
* MsgInfo('foutje in de indexarray')
ENDIF
ENDIF
NEXT
ENDIF
ENDIF
NEXT

RETURN NIL

*************************************************

FUNCTION NtxProgress()

LOCAL nComplete := INT((RECNO()/LASTREC()) * 100)
*Win_Main.StatusBar.Item(2) := 'Gedaan: ' + ALLTRIM(STR(nComplete)) + ' %'
*DO EVENTS

RETURN .T.

*************************************************

FUNCTION RK_OpenTables()

*hier worden alle bestanden geopend
*date: 25-11-2015 (aangepaste vesie)

LOCAL cDataBase := '', aIndex[0], cAlias := ''
*LOCAL cTekst := ''
FOR n = 1 TO LEN(aDataBases)
ASIZE(aIndex, 0)
cDataBase := cDataBasePad + aDataBases[n,1]
cAlias := aDataBases[n,2]
IF aDatabases[n,3] > 0
FOR i = 1 TO aDataBases[n,3]
AADD(aIndex, cDataBasePad + aDataBases[n,i+3])
NEXT
ENDIF

IF LEN(aIndex) == 0
USE (cDataBase) NEW ALIAS &cAlias SHARED
ELSEIF LEN(aIndex) == 1
USE (cDataBase) INDEX (aIndex[1]) NEW ALIAS &cAlias SHARED
ELSEIF LEN(aIndex) == 2
USE (cDataBase) INDEX (aIndex[1]), (aIndex[2]) NEW ALIAS &cAlias SHARED
ELSEIF LEN(aIndex) == 3
USE (cDataBase) INDEX (aIndex[1]), (aIndex[2]), (aIndex[3]) NEW ALIAS &cAlias SHARED
ELSEIF LEN(aIndex) == 4
USE (cDataBase) INDEX (aIndex[1]), (aIndex[2]), (aIndex[3]), (aIndex[4]) NEW ALIAS &cAlias SHARED
ELSEIF LEN(aIndex) == 5
USE (cDataBase) INDEX (aIndex[1]), (aIndex[2]), (aIndex[3]), (aIndex[4]), (aIndex[5]) NEW ALIAS &cAlias SHARED
ELSEIF LEN(aIndex) == 6
USE (cDataBase) INDEX (aIndex[1]), (aIndex[2]), (aIndex[3]), (aIndex[4]), (aIndex[5]), (aIndex[6]) NEW ALIAS &cAlias SHARED
ENDIF
NEXT
MsgInfo('tables opened')
RETURN NIL
Kind regards,

René Koot
User avatar
plantenkennis
 
Posts: 166
Joined: Wed Nov 25, 2015 7:13 pm
Location: the Netherlands

Re: compiling more pro files to 1 app

Postby Antonio Linares » Fri Nov 27, 2015 8:20 pm

René,

How are you building your app ?

Are you using a makefile ?

If so, could you please post it here ? thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42149
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: compiling more pro files to 1 app

Postby Antonio Linares » Fri Nov 27, 2015 10:05 pm

René,

In FiveMac/make folder there is an example of a makefile for several PRGs

Simply do "make" from a terminal window and the app will be properly built.

Please use it as a skeleton to build your app.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42149
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: compiling more pro files to 1 app

Postby plantenkennis » Sat Nov 28, 2015 10:37 am

Hello Antonio,

I build my app using terminal and type "./build.ch plantenkennis" On top of the plantenkennis.prg I include the functions.prg.

Verstuurd vanaf mijn GT-N8010 met Tapatalk
Kind regards,

René Koot
User avatar
plantenkennis
 
Posts: 166
Joined: Wed Nov 25, 2015 7:13 pm
Location: the Netherlands

Re: compiling more pro files to 1 app

Postby Antonio Linares » Sat Nov 28, 2015 12:01 pm

René,

If you want to use build.sh to build it, then please move:

#include "Functies.prg"

to the bottom of plantenkennis.prg

Our advise is to use a makefile when your app uses more than one PRG file.

In FiveMac\make you have a full working example :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42149
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: compiling more pro files to 1 app

Postby plantenkennis » Wed Dec 02, 2015 5:41 am

Hello Antonio,

I was able to build my app using a makefile. But the problem was that I did not select the right database before browse. When Imput in 'select latnaam' the build went well.
I take small steps in building apps, becouse of lack of time.
Another question: where can I find ALL the commands and properties that I can use. I have looked on http://wiki.fivetechsoft.com/doku.php?i ... umentation, but this is not very complete. A lot of items are missing.
Rene

Verstuurd vanaf mijn GT-N8010 met Tapatalk
Kind regards,

René Koot
User avatar
plantenkennis
 
Posts: 166
Joined: Wed Nov 25, 2015 7:13 pm
Location: the Netherlands

Re: compiling more pro files to 1 app

Postby Antonio Linares » Wed Dec 02, 2015 8:03 am

René,

Please review FiveMac\include\fivemac.ch

all the FIveMac commands are defined inside it
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42149
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveMac / FivePhone (iPhone, iPad)

Who is online

Users browsing this forum: No registered users and 2 guests