TIP: Click on subject to list as thread! ANSI
echo: semware
to: All
from: `Sammy Mitchell`
date: 2003-01-15 10:48:12
subject: [TSEPro] Using .ui file procedures in external macros

From: "Sammy Mitchell" 
@Date: Tue, 14 Jan 2003 19:18:12 -0500
@Sender: semware-owner{at}sawasdi.apana.org.au



In version 4 of TSE Pro, public procedures can be called via
external macros.  For example:

---------foo.s---------------------------------------------
public proc doit()
    MsgBox("", "Hello from foo!")
end

---------bar.s---------------------------------------------
proc main()
    ExecMacro("foo", "doit")
end

When you run bar.mac, assuming assuming foo.mac exists, the
doit procedure in foo will run.

And, you can do the same thing with your .ui file:

---------tse.ui--------------------------------------------
public proc mEmptyClipboard()
    EmptyBuffer(Query(ClipboardId))
end

---------test.s--------------------------------------------
proc main()
    ExecMacro(".ui", "mEmptyClipboard") // note ".ui"
end

What good is this?

1) You can have a macro library, that is shared by multiple
macros.  While simply #including the relevant code also
works, the macro library sometimes offers a better solution.

2) This also opens up .ui file routines to external macros.

3) Since the parameters to ExecMacro() are strings, this can
potentially be used for a sort of poor mans dynamic linking
facility within the macro language.

What is bad about this?

1) The syntax is ugly: ExecMacro(macro-filename, public-macroname)

Perhaps in a future version we could just type:
macro-filename.public-macroname()

2) Declaring the proc as "public" also makes it show up in
the publics list.  For "library" routines, it probably
should not show up there.

3) Only procs without parameters are supported in this
version.  Bummer.

--
Sammy Mitchell

--
TSEPro mailing list



---
[sawasdi.apana.org.au] (3:800/846.13)
* Origin: apana>>>>>fidonet
SEEN-BY: 633/267 270
@PATH: 800/846 1 640/954 774/605 123/500 106/1 379/1 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.