EB.COMPILE question
- Gordan
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 18
- Thank you received: 0
16 years 3 months ago #2425
by Gordan
EB.COMPILE question was created by Gordan
Hi, forum members.
Can anybody help me with the following problem. By default EB.COMPILE searches for included files in the current directory + GLOBUS.BP
Suppose I want to add another directory (COMMON.BP) in the search path. I know this can be done by using the -I switch i.e.
BASIC -ICOMMON.BP TEST.BP,
and then CATALOG. But if I use -I with EB.COMPILE it just doesn't do anything. Does EB.COMPILE have a similar functionality? Also could someone point out the risk of using BASIC + CATALOG instead of EB.COMPILE?
I am using jbase5 and R8. Thanks in advance.
Can anybody help me with the following problem. By default EB.COMPILE searches for included files in the current directory + GLOBUS.BP
Suppose I want to add another directory (COMMON.BP) in the search path. I know this can be done by using the -I switch i.e.
BASIC -ICOMMON.BP TEST.BP,
and then CATALOG. But if I use -I with EB.COMPILE it just doesn't do anything. Does EB.COMPILE have a similar functionality? Also could someone point out the risk of using BASIC + CATALOG instead of EB.COMPILE?
I am using jbase5 and R8. Thanks in advance.
Please Log in or Create an account to join the conversation.
- KingArthur
- Offline
- Senior Member
-
Less
More
- Posts: 75
- Thank you received: 1
16 years 3 months ago #2427
by KingArthur
Replied by KingArthur on topic Re:EB.COMPILE question
I thing EB.COMPILE doesn't have such functionality.
But you can achieve this by the following two ways:
Way 1:
Instead of $INSERT use $INCLUDE in your local routine.
Way 2:
Write a small routine MY.COMPILE which overrides the core EB.COMPILE routine.
But you can achieve this by the following two ways:
Way 1:
Instead of $INSERT use $INCLUDE in your local routine.
Way 2:
Write a small routine MY.COMPILE which overrides the core EB.COMPILE routine.
Please Log in or Create an account to join the conversation.
- Gordan
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 18
- Thank you received: 0
16 years 3 months ago #2430
by Gordan
Replied by Gordan on topic Re:EB.COMPILE question
Thanks for the ideas KingArthur.
Unfortunately I don't quite understand the differences between $INSERT and $INCLUDE. Could you explain that shortly please?
As for the second way, how do you propose I override EB.COMPILE? I don't have the source code, and I don't know what it does other than BASIC + CATALOG.
Any help would be appreciated.
Unfortunately I don't quite understand the differences between $INSERT and $INCLUDE. Could you explain that shortly please?
As for the second way, how do you propose I override EB.COMPILE? I don't have the source code, and I don't know what it does other than BASIC + CATALOG.
Any help would be appreciated.
Please Log in or Create an account to join the conversation.
- pnieles
- Offline
- Junior Member
-
Less
More
- Posts: 25
- Thank you received: 1
16 years 3 months ago #2443
by pnieles
Replied by pnieles on topic Re:EB.COMPILE question
My understanding is that you want to load include files from the GLOBUS.BP directory, that directory needs to be in the PATH variable. The $INCLUDE command permits you to specify the directory of the file you're loading whilst $INSERT only looks in GLOBUS.BP. If you want to compile into a specific directory then your JBCDEV_BIN environment variable has to be set to that directory. Obviously you need to include that specific directory as well in your PATH otherwise the executable will not be found.
i.e.
i.e.
Please Log in or Create an account to join the conversation.
- malai
-
- Offline
- Platinum Member
-
Less
More
- Posts: 508
- Thank you received: 11
16 years 3 months ago #2448
by malai
Replied by malai on topic Re:EB.COMPILE question
Write a program CUSTOM.COMPILE which accepts 3 arguments
CUSTOM.COMPILE <source bp> <insert bp> <routine name>
Do the following
1. Get the routine name
2. Open the source bp and read the routine
3. Locate all the $INSERT and get all the list file names
4. Now try to read the list file name from the insert bp
5. If exists just copy the insert file into your source bp
6. If not exists just leave it (may be core insert)
7. Call EB.COMPILE <source bp> <routine name>
8. Delete all the insert files that you copied
Thats it... If you get success on this please upload your routine in our Downloads section.
I can assist you on developing the program.
Cheers
CUSTOM.COMPILE <source bp> <insert bp> <routine name>
Do the following
1. Get the routine name
2. Open the source bp and read the routine
3. Locate all the $INSERT and get all the list file names
4. Now try to read the list file name from the insert bp
5. If exists just copy the insert file into your source bp
6. If not exists just leave it (may be core insert)
7. Call EB.COMPILE <source bp> <routine name>
8. Delete all the insert files that you copied
Thats it... If you get success on this please upload your routine in our Downloads section.
I can assist you on developing the program.
Cheers
Please Log in or Create an account to join the conversation.
- KingArthur
- Offline
- Senior Member
-
Less
More
- Posts: 75
- Thank you received: 1
16 years 3 months ago #2449
by KingArthur
Replied by KingArthur on topic Re:EB.COMPILE question
For example:
Keep all your insert files in MYINSERT.BP
Inside your routine use $INCLUDE MYINSERT.BP I_F.filename
Keep all your insert files in MYINSERT.BP
Inside your routine use $INCLUDE MYINSERT.BP I_F.filename
Please Log in or Create an account to join the conversation.
- Gordan
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 18
- Thank you received: 0
16 years 3 months ago #2451
by Gordan
Replied by Gordan on topic Re:EB.COMPILE question
@King Arthur:
My intention was to have EB.COMPILE check into a different alternative dir in case it doesn't find the included file in the current dir, and
not to rewrite the source code.
e.g. $INCLUDE MYINCLUDE;
MYINCLUDE not found in the current dir - search in COMMON.BP instead of GLOBUS.BP
@GvA:
Thanks, I'll give it a try, and post the results.
My intention was to have EB.COMPILE check into a different alternative dir in case it doesn't find the included file in the current dir, and
not to rewrite the source code.
e.g. $INCLUDE MYINCLUDE;
MYINCLUDE not found in the current dir - search in COMMON.BP instead of GLOBUS.BP
@GvA:
Thanks, I'll give it a try, and post the results.
Please Log in or Create an account to join the conversation.
- Gordan
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 18
- Thank you received: 0
16 years 3 months ago - 16 years 2 months ago #2454
by Gordan
Replied by Gordan on topic Re:EB.COMPILE question
The uploads section seems broken. I've tried it with IE and Firefox. So here is the source code for the program proposed by GvA:
*
* Override of EB.COMPILE
* Allows to search for included files in a directory
* specified as command line argument.
* USAGE:
*
* jsh --> CUSTOM.COMPILE COMMON.BP SOURCE.BP SUBR1
*
* By Gordan Petrovski, 23.01.2009
*
PROGRAM CUSTOM.COMPILE
**** For Unix
EQU DIR.SEPARATOR TO '/'
**** For Windows
* EQU DIR.SEPARATOR TO '\'
GOSUB MAIN
GOSUB PROGRAM.END
*
MAIN:
*
DELETE.LIST = ''
ARGS.LIST = @USERSTATS<41,2>
**** Verify the arguments
IF DCOUNT(ARGS.LIST,' ') = 4 THEN
ALT.INCLUDE.DIR = FIELD(ARGS.LIST,' ',2)
SOURCE.DIR = FIELD(ARGS.LIST,' ',3)
SOURCE.FILENAME = FIELD(ARGS.LIST,' ',4)
SOURCE.FILE.PATH = @PATH:DIR.SEPARATOR:SOURCE.DIR:DIR.SEPARATOR:SOURCE.FILENAME
**** Open and read the source file
OPENSEQ SOURCE.FILE.PATH TO F.SOURCE
ELSE
PRINT 'CANNOT OPEN ':SOURCE.FILE.PATH
STOP
END
EOF = 0;
SOURCE.LINE = ''
LOOP WHILE EOF = 0
READSEQ SOURCE.LINE FROM F.SOURCE THEN
GOSUB SCAN.FOR.INCLUDES
END ELSE EOF = 1
REPEAT
**** Compile the source file and delete the copied include files
EXECUTE 'EB.COMPILE ': SOURCE.DIR : ' ' : SOURCE.FILENAME
FOR CC.DEL = 1 TO DCOUNT( DELETE.LIST, @FM)
EXECUTE 'rm ':DELETE.LIST<CC.DEL>
NEXT CC.DEL
PRINT 'VAMOS RAFA!'
END ELSE
PRINT 'INVALID ARGUMENTS COUNT'
PRINT 'EXAMPLE USAGE: CUSTOM.COMPILE COMMON.BP SOURCE.BP SUBR1'
END
RETURN
*
SCAN.FOR.INCLUDES:
*
**** Remove unecessary tabs and whitespaces
SOURCE.LINE = CHANGE(SOURCE.LINE,' ', ' ')
SOURCE.LINE = TRIM(SOURCE.LINE, ' ','R')
WORD1 = FIELD(SOURCE.LINE, ' ',1)
IF (WORD1 = '$INCLUDE') OR (WORD1 = '$INSERT') THEN
WORDS.COUNT = DCOUNT(SOURCE.LINE, ' ')
IF WORDS.COUNT < 4 THEN
**** Discover the path of the desired include file
IF WORDS.COUNT = 2 THEN
INCLUDED.FILE = FIELD(SOURCE.LINE, ' ',2)
INCLUDE.FILE.PATH = SOURCE.DIR:DIR.SEPARATOR:INCLUDED.FILE
END
IF WORDS.COUNT = 3 THEN
INCLUDED.FILE = FIELD(SOURCE.LINE, ' ',3)
INCLUDED.DIR = FIELD(SOURCE.LINE, ' ',2)
IF INCLUDED.DIR = 'GLOBUS.BP' THEN
INCLUDED.DIR = '..':DIR.SEPARATOR:'GLOBUS.BP'
END
INCLUDE.FILE.PATH = INCLUDED.DIR:DIR.SEPARATOR:INCLUDED.FILE
END
**** If the include file is not located, copy it from the new include directory
THE.OUTPUT = ''
HUSH ON
EXECUTE 'ls ':INCLUDE.FILE.PATH CAPTURING THE.OUTPUT
HUSH OFF
IF THE.OUTPUT # INCLUDE.FILE.PATH THEN
CPY.COMMAND = 'cp ': ALT.INCLUDE.DIR:DIR.SEPARATOR:INCLUDED.FILE:' ':INCLUDE.FILE.PATH
EXECUTE CPY.COMMAND
DELETE.LIST<-1> = INCLUDE.FILE.PATH
END
END
END
RETURN
*
PROGRAM.END:
*
END
*
* Override of EB.COMPILE
* Allows to search for included files in a directory
* specified as command line argument.
* USAGE:
*
* jsh --> CUSTOM.COMPILE COMMON.BP SOURCE.BP SUBR1
*
* By Gordan Petrovski, 23.01.2009
*
PROGRAM CUSTOM.COMPILE
**** For Unix
EQU DIR.SEPARATOR TO '/'
**** For Windows
* EQU DIR.SEPARATOR TO '\'
GOSUB MAIN
GOSUB PROGRAM.END
*
MAIN:
*
DELETE.LIST = ''
ARGS.LIST = @USERSTATS<41,2>
**** Verify the arguments
IF DCOUNT(ARGS.LIST,' ') = 4 THEN
ALT.INCLUDE.DIR = FIELD(ARGS.LIST,' ',2)
SOURCE.DIR = FIELD(ARGS.LIST,' ',3)
SOURCE.FILENAME = FIELD(ARGS.LIST,' ',4)
SOURCE.FILE.PATH = @PATH:DIR.SEPARATOR:SOURCE.DIR:DIR.SEPARATOR:SOURCE.FILENAME
**** Open and read the source file
OPENSEQ SOURCE.FILE.PATH TO F.SOURCE
ELSE
PRINT 'CANNOT OPEN ':SOURCE.FILE.PATH
STOP
END
EOF = 0;
SOURCE.LINE = ''
LOOP WHILE EOF = 0
READSEQ SOURCE.LINE FROM F.SOURCE THEN
GOSUB SCAN.FOR.INCLUDES
END ELSE EOF = 1
REPEAT
**** Compile the source file and delete the copied include files
EXECUTE 'EB.COMPILE ': SOURCE.DIR : ' ' : SOURCE.FILENAME
FOR CC.DEL = 1 TO DCOUNT( DELETE.LIST, @FM)
EXECUTE 'rm ':DELETE.LIST<CC.DEL>
NEXT CC.DEL
PRINT 'VAMOS RAFA!'
END ELSE
PRINT 'INVALID ARGUMENTS COUNT'
PRINT 'EXAMPLE USAGE: CUSTOM.COMPILE COMMON.BP SOURCE.BP SUBR1'
END
RETURN
*
SCAN.FOR.INCLUDES:
*
**** Remove unecessary tabs and whitespaces
SOURCE.LINE = CHANGE(SOURCE.LINE,' ', ' ')
SOURCE.LINE = TRIM(SOURCE.LINE, ' ','R')
WORD1 = FIELD(SOURCE.LINE, ' ',1)
IF (WORD1 = '$INCLUDE') OR (WORD1 = '$INSERT') THEN
WORDS.COUNT = DCOUNT(SOURCE.LINE, ' ')
IF WORDS.COUNT < 4 THEN
**** Discover the path of the desired include file
IF WORDS.COUNT = 2 THEN
INCLUDED.FILE = FIELD(SOURCE.LINE, ' ',2)
INCLUDE.FILE.PATH = SOURCE.DIR:DIR.SEPARATOR:INCLUDED.FILE
END
IF WORDS.COUNT = 3 THEN
INCLUDED.FILE = FIELD(SOURCE.LINE, ' ',3)
INCLUDED.DIR = FIELD(SOURCE.LINE, ' ',2)
IF INCLUDED.DIR = 'GLOBUS.BP' THEN
INCLUDED.DIR = '..':DIR.SEPARATOR:'GLOBUS.BP'
END
INCLUDE.FILE.PATH = INCLUDED.DIR:DIR.SEPARATOR:INCLUDED.FILE
END
**** If the include file is not located, copy it from the new include directory
THE.OUTPUT = ''
HUSH ON
EXECUTE 'ls ':INCLUDE.FILE.PATH CAPTURING THE.OUTPUT
HUSH OFF
IF THE.OUTPUT # INCLUDE.FILE.PATH THEN
CPY.COMMAND = 'cp ': ALT.INCLUDE.DIR:DIR.SEPARATOR:INCLUDED.FILE:' ':INCLUDE.FILE.PATH
EXECUTE CPY.COMMAND
DELETE.LIST<-1> = INCLUDE.FILE.PATH
END
END
END
RETURN
*
PROGRAM.END:
*
END
Last edit: 16 years 2 months ago by .
Please Log in or Create an account to join the conversation.
Time to create page: 0.045 seconds