Liberty BASIC Community Forum
« calltkn files? »

Welcome Guest. Please Login or Register.
Feb 22nd, 2018, 12:32pm


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: calltkn files?  (Read 700 times)
richard peeters
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 43
xx calltkn files?
« Thread started on: Dec 28th, 2002, 06:38am »

Should it be possible to call functions in a tkn file, just a we can call functions in a dll file?
Writing dll files in LB is not possible, I suppose because we cannot make binary files, but it would surely help if we could call functions in a TKN file, made by ourselves or made by someone else.

syntax example:

to call a fileindex function called 'ind' in a TKN file called index.tkn with as stringargument the name of the file to be indexed. This could return the result (1 if ok / 0 not ok) in a variable called ind. (same idea as in functions)

Open "index.tkn" for tkn as #1

CallTkn #1, ind,"filename$"



Richard
User IP Logged

TknSoft
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 138
xx Re: calltkn files?
« Reply #1 on: Jan 5th, 2003, 1:03pm »

You can call functions in .tkn files IF....
1: The tkn was coded to use the CommandLine$
2: The called tkn either puts the results in the Windows Clipboard or sends it to a file saved to disk.
3: You know the correct parameters to send to the called tkn

If you need code examples, let me know & I'll work
something up for you !

Dave Thomas
User IP Logged

I tried to back up my hard drive, but I couldn't find 'Reverse' !
Alyce Watson
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Female
Posts: 14923
xx Re: calltkn files?
« Reply #2 on: Jan 5th, 2003, 1:53pm »

You can do as Dave suggests and use the CommandLine$ I did a newsletter article on this. That particular newsletter was lost for a while, but it is online at LB news in a zip containing 80-87. The article is in #87. Get yours here http://groups.yahoo.com/group/lbnews/files/Newsletters/

It isn't in the form of "calltkn". Instead, you "run" the tkn and include command line arguments that you must then parse in your tkn. You can use the word$ command for parsing, and there are other ways. Newsletter #87 has several example programs.

I'd like to see Dave's ideas as well. Maybe if there is more discussion of this we can start a new thread on the LB3 board?

Regards,
Alyce
User IP Logged

Alyce
Liberty BASIC Workshop - a complete IDE for Liberty BASIC


Alyce's Restaurant
for Liberty BASIC code, tools and references
TknSoft
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 138
xx Re: calltkn files?
« Reply #3 on: Jan 9th, 2003, 8:02pm »

One way to implement multiple functions in a separate
TKN file would be to make the first parameter of the command line to equal a label within the TKN.

For example, if you have [FN1],[FN2],[FN3] etc sections
of the called TKN, its source code would look something like this

RUN the external TKN with

RUN "ext.tkn [FN1] "laugh1$;" 'laugh2$;" "laugh3$

Cmd$=CommandLine$
IF WORD$(Cmd$,1)="" THEN [Exit]
IF WORD$(Cmd$,1)="[FN1] THEN [FN1]
IF WORD$(Cmd$,1)="[FN2] THEN [FN2]
IF WORD$(Cmd$,1)="[FN3] THEN [FN3]

Then, in each section parse the remainder of the commandline as is appropriate for the function.

[FN1]
Cmd$=RIGHT$(Cmd$,LEN(Cmd$)-6) ' size of '[FN1] '
L=VAL(P1$)
W=VAL(P2$)
H=VAL(P3$)
Volume=L*W*H
' Code to put result in file or clipboard here
GOTO [Exit]

[FN2]
Cmd$=RIGHT$(Cmd$,LEN(Cmd$)-6) ' size of '[FN2] '
L=VAL(P1$)
W=VAL(P2$)
' Only two Paramaters needed for this function
Area=L*W
' Code to put result in file or clipboard here
GOTO [Exit]

[FN3]
' Code for some other function here

[Exit]
NOMAINWIN
END



Does all of this make sense to everyone ?
I've used this technique a good bit & it works
great for me.

Dave Thomas
User IP Logged

I tried to back up my hard drive, but I couldn't find 'Reverse' !
TknSoft
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 138
xx Re: calltkn files?
« Reply #4 on: Jan 11th, 2003, 07:30am »

Here's a complete (including source code) working demo
of how to use this technique.

http://groups.yahoo.com/group/lbfiles/files/Call_Tkn.zip
« Last Edit: Jan 11th, 2003, 07:31am by TknSoft » User IP Logged

I tried to back up my hard drive, but I couldn't find 'Reverse' !
Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls