Pulling teeth

Post Reply
guestroom
Posts: 21
Joined: Fri Jun 16, 2000 12:58 am

Pulling teeth

Post by guestroom »

QUESTION: What is the proper syntax and method to call a funtion found in another file ?

Part2: How do I pass AND RECIEVE the arguement between the two files?

I have two vortex files - ptest2 and pcall.
???? What is the right syntax for pcall so that it correctly calls the KW function in the file ptest2 ???

???? What is the right syntax so I can reference the argument from the calling module correctly ????

************** THIS IS ptest2 where the function is defined ********************
<script LANGUAGE="vortex">
<a name=main>
<!-- How do I specify on the next line an ARGUMENT for $kword to follow kw ?? -->
<kw >
</a>
<A NAME=kw kword >
<$lkw = <lower $kword>

<SWITCH $lkw >
<CASE "asia">
<!-- how do I get a MATCHES or LIKE in a case statement -->
<lower $kword> matches asia, asian or asians !
<CASE "latin">
<lower $kword> matches latina latino latin!
<CASE "new">
<lower $kword> matches new !
<CASE "old">
<lower $kword> matches old !
<DEFAULT>
no matches for <lower $kword> !
</SWITCH>
</A>
</script>

********************* This is pcall *************************
<script LANGUAGE="vortex">
<a name=main>
<ptest2 "asia">
</a>
</SCRIPT>

???? What is the right syntax for pcall so that it correctly calls the KW function in the file ptest2 ???
User avatar
John
Site Admin
Posts: 2622
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Pulling teeth

Post by John »

To pass an argument to a function you would pass it as:

<kw kword=$kword>

so you name the argument and specify the value.

Often you can just put all the functions in a single file, and then you can just call the function. You can have multiple entry points into the same application.

You can also use modules to have a library of common code used by several applications. In that case you would have something like:

<script language=vortex>
<uses ptest2>
<a name=main>
<kw kword=asia>
</a>
</script>

In which case kw would need to be defined export,

<A NAME=kw EXPORT kword>


and the ptest2 module checked into the library with

texis -ci -module ptest2 ptest2
John Turnbull
Thunderstone Software
guestroom
Posts: 21
Joined: Fri Jun 16, 2000 12:58 am

Pulling teeth

Post by guestroom »

Ok, not a bad start......
I made those changes and here's the command line response (on my win98se machine)

E:\epornDirect\webinator>..\cgi-bin\texis -ci -module ptest2 ptest2
Texis Web Script (Vortex) Copyright (c) 1996-2000 Thunderstone - EPI, Inc.
Free Webinator Version 3.01.973012591 of Oct 31, 2000 (i686-intel-winnt)

002 ptest2: can't open c:\morph3\texis\testdb: No such file or directory in the
function ddopen
000 ptest2: Could not connect to c:\morph3\texis\testdb in the function openntexis

So what the heck is this c:\morph3\etc etc its referring to??
guestroom
Posts: 21
Joined: Fri Jun 16, 2000 12:58 am

Pulling teeth

Post by guestroom »

FYI - this is the same exact message that occurs when I try to compile these files on my win NT 4.0 server's command prompt too.
User avatar
Kai
Site Admin
Posts: 1272
Joined: Tue Apr 25, 2000 1:27 pm

Pulling teeth

Post by Kai »

It's the default Texis database, which needs to exist for modules to work. A Texis (not Webinator) installation creates it. You can create it with texis -d c:\morph3\texis\testdb -m.

Also, see http://www.thunderstone.com/site/vortexman/node21.html for more on passing parameters in Vortex.
guestroom
Posts: 21
Joined: Fri Jun 16, 2000 12:58 am

Pulling teeth

Post by guestroom »

Alright, I got that testdb created. Created correctly I am not sure.

So I went back to John's original commandline syntax for compiling the ptest2 module
here's the response after there's a testdb created. I typed in the words after the ">>"

Enter log message, terminated with single '.':
>> again - what the heck is this?
>> .
015 ptest2: Can't check in module ptest2: No lock set by localhost

OK Kai, John, what's this latest error mean (No lock set by localhost) ??
User avatar
Kai
Site Admin
Posts: 1272
Joined: Tue Apr 25, 2000 1:27 pm

Pulling teeth

Post by Kai »

Apparently the module already exists in the library; in this case it needs to be locked first to let other users know it's being edited. Either lock it first with texis -lock -module ptest2, or force the checkin with texis -ci -force -module ptest2 ptest2.

See http://www.thunderstone.com/site/vortexman/node177.html and adjacent pages for more details on checking in modules.
guestroom
Posts: 21
Joined: Fri Jun 16, 2000 12:58 am

Pulling teeth

Post by guestroom »

OK, well now we're compiling. thanks
But of course now its time to debug cuz my code
is not working right - but that's another thread.

thanks again
Post Reply