Page 2 of 2 <12
Topic Options
#134599 - 2005-03-10 02:12 PM Re: How the new INCLUDE statement works...
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
A while back, I did a make-like thing for a very large script, based on Glenn's idea (at the time), just used a simple bat file like:

Code:

@ECHO OFF

del kp.kix

type KpMain.kix >>kp.kix
type FindDialog.kix >>kp.kix
type GotoDialog.kix >>kp.kix
type IconsDialog.kix >>kp.kix
type MessageBoxWizard.kix >>kp.kix
type AboutDialog.kix >>kp.kix
type KpUtils.kix >>kp.kix
type OptionsDialog.kix >>kp.kix

kix32 /t kp.kix



It works great and it allows one to develop (and test) these sub-scripts in isolation ... then as a whole.

-Shawn

Top
#134600 - 2005-03-10 02:57 PM Re: How the new INCLUDE statement works...
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Just found the example Makefile laying around.

Code:
# Makefile demo.
#
# This Makefile demonstrates how to use Gnu MAKE for creating a monolithic
# pre-tokenised script from multiple source files.

# The resultant file will be called "myscript.kx", and an intermediate file
# called "myscript.kix" will be created which comprises all the source files
# catenated together.
#
# There are two source files, "demo.kix" which is in the current directory,
# and "demo.udf" which is a file containing UDFs and is stored in a UDF library
# directory.

# VPATH defines the directories to look for dependencies (source files) if *not*
# present in the current directory. We will include my UDF library directory
# for this example.
VPATH=c:\temp\KiXlib

# Copy and delete commands
COPY=COPY
DEL=DEL

# The KiXtart executable - no need to fully qualify if it is in your path.
KIX=C:\TEMP\KIX4.50\kix32.exe
# KiXtart options
KOPTS=
# Pre-tokenise flag(s)
KPRETOK=/t

# Target is the name that will be used to create the intermediate file and the
# pre-tokenised file.
TARGET=myscript

# Source file names - demo.kix is the main script, demo.udf is a UDF file in the
# UDF library
SOURCE=demo.kix demo.udf

# Default target. This is the file that we want to make.
$(TARGET).kx:

# Catenated script. This is the intermediate script, where all of the dependant files have
# been catenated into a single file in preperation for pre-tokenising.
# The foreach is a little messy, as the expansion uses *nix path semantics.
$(TARGET).kix: $(SOURCE)
$(foreach SF,$^,$(eval ALLFILES+=+ "$(subst /,\,$(SF))"))
$(COPY) nul: $(ALLFILES) "$@"

# Cleanup - remove target and intermediate
clean:
$(DEL) $(TARGET).kx $(TARGET).kix 2>NUL:

# Implicit rule for creating pre-tokenised script from .kix suffixed source
%.kx: %.kix
"$(KIX)" $(KOPTS) $(KPRETOK) "$<"

# Implicit rule for creating pre-tokenised script from .udf suffixed source
%.kx: %.udf
"$(KIX)" $(KOPTS) $(KPRETOK) "$<"


Top
#134601 - 2005-06-28 10:24 PM INCLUDE still doesn't INCLULDE UDFs
peaps Offline
Fresh Scripter

Registered: 2005-04-12
Posts: 25
Quote:

On the last post: this is by design. I mentioned in the email that INCLUDE is processed before run-time, so you can only use 'flat' strings to refer to included files, no vars, no macro's, no UDF's, etc).

Apart from this: INCLUDE is indeed broken (at least for Include-files containing UDF's). I'm working on a fix for the next build.

Ruud




I am currently using v4.50 RC1 and the INCLUDE statement still seems to have an issue with included files that contain UDFs. I have got a script that INCLUDEs a second script with an empty UDF. What happens is that the primary script exits as soon as it hits the INCLUDE statement. This happens even if there is no EXIT statement in the INCLUDEd kix script.

Is there any update on this?

Top
#134602 - 2005-06-28 10:30 PM Re: INCLUDE still doesn't INCLULDE UDFs
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
how you know it exits when it hits the include line?
include lines shouldn't be there for one to debug as they are gone before interpreter starts it's work.
_________________________
!

download KiXnet

Top
#134603 - 2005-06-28 10:34 PM Re: INCLUDE still doesn't INCLULDE UDFs
peaps Offline
Fresh Scripter

Registered: 2005-04-12
Posts: 25
Because include is the first line in my main kix file. e.g:
MAIN.KIX
Code:
 
INCLUDE sub.kix
? "something"




SUB.KIX
Code:
 
function test()
endfunction




When I run MAIN.KIX, "something" never gets printed to the screen.

Top
#134604 - 2005-06-28 10:41 PM Re: INCLUDE still doesn't INCLULDE UDFs
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
your include line just is wrong.
change it to:
INCLUDE "sub.kix"

and try again.

oh, and this syntax error of yours will error out in the final if not in the RC-1.


Edited by Lonkero (2005-06-28 10:42 PM)
_________________________
!

download KiXnet

Top
#134605 - 2005-06-28 10:42 PM Re: INCLUDE still doesn't INCLULDE UDFs
peaps Offline
Fresh Scripter

Registered: 2005-04-12
Posts: 25
sorry, I omitted the dual quotes in my code above, but I have indeed been using the correct syntax of:
INCLUDE "sub.kix"

Top
#134606 - 2005-06-28 10:43 PM Re: INCLUDE still doesn't INCLULDE UDFs
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
damn, k, let me try with rc-1 then.
_________________________
!

download KiXnet

Top
#134607 - 2005-06-28 10:46 PM Re: INCLUDE still doesn't INCLULDE UDFs
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
tested.
works with RC-1 just fine.
tested with wkix32 and kix32

my test system is: w2k sp4 ie6 dotnet
_________________________
!

download KiXnet

Top
#134608 - 2005-06-28 11:02 PM Re: INCLUDE still doesn't INCLULDE UDFs
peaps Offline
Fresh Scripter

Registered: 2005-04-12
Posts: 25
My sincere apologies.. I have just realised what was happening. I had an old version of 4.50 beta 1 in my PATH which is what was being called when I was typing KIX32 main.kix..

I can confirm that yes this is now fixed in RC1. Sorry for the confusion.

Top
Page 2 of 2 <12


Moderator:  ShaneEP, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 369 anonymous users online.
Newest Members
rrosell, PatrickPinto, Raoul, Timothy, Jojo67
17877 Registered Users

Generated in 0.096 seconds in which 0.039 seconds were spent on a total of 12 queries. Zlib compression enabled.