Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
49 user(s) are online (35 user(s) are browsing Forums)

Members: 0
Guests: 49

more...

Support us!

Headlines

 
  Register To Post  

Arexx calling OpenLibrary/CloseLibrary for each .library call: how to change that?
Not too shy to talk
Not too shy to talk


See User information
Hello

I have created my own .library : Microbe3D.library

I have also maded an arexsupport-function inside my Microbe3D.library
Then I can call Microbe3D from a simple Arexx script
(yeees It will allow 3D without knowing C
About Microbe3D
http://www.youtube.com/user/wazp3d
)

BUUUT each call is inside an OpenLibrary/CloseLibrary

That cause problems because Microbe3D is supposed to have a single librray-base and not one that change for each function

So the question : "How to avoid that way of functionning and make arexx use the same Microbe3D library-base all the time ?"

THANKS

Alain Thellier (aka Wazp3D)


Go to top
Re: Arexx calling OpenLibrary/CloseLibrary for each .library call: how to change that?
Home away from home
Home away from home


See User information
@thellier

You extended the lib base whit dependent_base, dependent_interface and so on.

then you open the dependent libraries in initlib().

and close the dependent library in LibExpunge(), at least thats how I do it.

You already know this I suppose, but if you generated the library whit idltool, you will will have to fix the SizeOf(struct Library) so its SizeOf(struct your_libbase_struct_name), or else you can get some corruption.

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: Arexx calling OpenLibrary/CloseLibrary for each .library call: how to change that?
Just popping in
Just popping in


See User information
@thellier

I have at least two public examples without the ARexx functionality for anyone on an AmigaOS or alike system to read and re-use of that helps?

Go to top
Re: Arexx calling OpenLibrary/CloseLibrary for each .library call: how to change that?
Just popping in
Just popping in


See User information
@Belxjander
Code examples are always nice to see :)

Maybe upload them here: http://os4depot.net/index.php?functio ... e&cat=development/example

Go to top
Re: Arexx calling OpenLibrary/CloseLibrary for each .library call: how to change that?
Home away from home
Home away from home


See User information
@thellier

So you have created an ARexx interface to your library in the same way as for instance datatypes.library has?

So you access from arexx by adding the library to the library list?

if so then from the AmigaOS manual at:

http://wiki.amigaos.net/index.php/AmigaOS_Manual:_ARexx_Functions

Quote:

Function libraries are always closed after being checked so that the operating system can reclaim the memory space if required.


An alternative to consider would be to create a small host program that could be started from the ARexx script and provide an ARexx port offering the commands. That way it can keep it's own library context etc. Two way interaction is possible in the same way my own ProAction GUI system works, by have the script itself create it's own port to receive commands or mesages.







Go to top
Re: Arexx calling OpenLibrary/CloseLibrary for each .library call: how to change that?
Not too shy to talk
Not too shy to talk


See User information

@broadblues
>extended the lib base whit dependent_base, dependent_interface

Sorry I dont understand what you wrote (my poor english..) did you mean "create an other .library that will call microbe3d.library" indirectly?

@Belxjander
>I have at least two public examples without the ARexx functionality ... to read and re-use
??? Dont understand too : Do you mean that you have an example thtat disable the arexx's Openlib/closelib feature ?

@broadblues
>So you have created an ARexx interface to your library in the same way as for instance datatypes.library has?
Yes

>So you access from arexx by adding the library to the library list?
Yes

> create a small host program that could be started from the ARexx script and provide an ARexx port offering the commands.

Nice :How can I do that ? Example source ? (I am a perfect arexx noob)

THANKS TO ALL

PS: Also I had an idea : In my own Microbe3D/CloseLib function make some kind of check "if called from arexx dont let CloseLib happen"


Alain




Go to top
Re: Arexx calling OpenLibrary/CloseLibrary for each .library call: how to change that?
Home away from home
Home away from home


See User information
@thellier

Ignore the other two Whilst both well intentioned they are trying to help you build library as far as I can see, which ofcourse you know how to do. They've misunderstood your question.


Quote:

> create a small host program that could be started from the ARexx script and provide an ARexx port offering the commands.

Nice :How can I do that ? Example source ? (I am a perfect arexx noob)



The source to my ProAction GUI server is available on os4depot, under a read to learn from type of license, your welcome to cut and paste small sections of code if you find them useful.


However it uses reactions arexx.class to handle to arexx port so if your looking for a more wide rangeing solution in terms of target platforms, you might want to look for 'simplerexx' based apps AWeb is one (source on os4depot too).
http://os4depot.net/index.php?functio ... ry/reaction/proaction.lha
http://os4depot.net/index.php?functio ... =network/browser/aweb.lha

Simplerexx itself might be on aminet, it's quite well commented as far as I rememeber.






Go to top
Re: Arexx calling OpenLibrary/CloseLibrary for each .library call: how to change that?
Home away from home
Home away from home


See User information
For got to reply to your PS:

Quote:

PS: Also I had an idea : In my own Microbe3D/CloseLib function make some kind of check "if called from arexx dont let CloseLib happen"


Risky solution. ARexx will still try to open each time, so you would have to keep track of the process that opened you and pass back the previous library base / interface. That might work to a point but how do you do areal close at thend? How do you know if it's actually ARexx that opened you, and how would you deal with multiple ARexx scripts? I think searches for commands etc are interpreted by a central ARexx server (RexxMast) so all library opens come from the same process.

Gets very hacky and dangerous quite quickly.


Go to top
Re: Arexx calling OpenLibrary/CloseLibrary for each .library call: how to change that?
Just can't stay away
Just can't stay away


See User information
@thellier

Quote:

PS: Also I had an idea : In my own Microbe3D/CloseLib function make some kind of check "if called from arexx dont let CloseLib happen"


I don't know what exactly you are trying to achieve here but you can add additional fail conditions to libExpunge to the usual "lib_OpenCnt > 0" one. You could even disable expunging of your library entirely.

For example my streplay.library replacement doesn't allow expunge while a module is playing so you can do something like:
blah = OpenLibrary("streplay.library", 0);
StartModule(blahblahmodule);
CloseLibrary(blah);

and then later do:

blah = OpenLibrary("streplay.library", 0);
StopModule();
CloseLibrary(blah);

That's not the exact API (because I can't be bothered to look it up) but it should give the general idea.

Go to top
Re: Arexx calling OpenLibrary/CloseLibrary for each .library call: how to change that?
Home away from home
Home away from home


See User information
@thellier

I was thinking you wanted to open a library inside your library, whit out having to do it in function/methods of the library’s.

I don't have Arexx support in any of my programs, so I can't really help you whit that. (well I remember a long long time ago I played whit Arexx support in AMOS... but that does not count , nor do I remember the code )

Your idea to ingorge CloseLibrary sounds like danger to me, as the Lib_OpenCnt will just Increase until the number overflows, resulting in a Lib_OpenCnt = 0 and the library Expunge kicking in, at a unpleasant point in time.

You will need to create some alternative way to keep track of if library used by Arexx or not, if you want to keep supporting Expunge function of the library.

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: Arexx calling OpenLibrary/CloseLibrary for each .library call: how to change that?
Not too shy to talk
Not too shy to talk


See User information
Hello

@all
Thanks for your help and explanations
I will investigate the ARexx port solution and especially Simplerexx

For the moment I have founded a a work-around:

Usually a Microbe3D programe is maded this way

Scene =U3D_OpenScene(...);
Load some 3d objets
loop animating the 3d objets
finish the prog
U3D_Delete(Scene);

So a Scene is like a GL Context : nothing can be done without it
So I added "ScenesCount" global counter

U3D_OpenScene(...) do ScenesCount++;
U3D_EasyOpenScene(...) do ScenesCount++;
U3D_Delete(Scene) do ScenesCount--;

And I modified my Microbe3D libary header this way

ASM(SEGLISTPTR) LibClose(REG(a6, struct ExampleLibrary * libBase))
{

libBase->LibNode.lib_OpenCnt--;
if(ScenesCount!=0)
return 0;

LIB_Close(); /* close amiga libraries */
if(!(libBase->LibNode.lib_OpenCnt))
{
if(libBase->LibNode.lib_Flags & LIBF_DELEXP)
return LibExpunge(libBase);
}
return 0;
}
For the moment it works (will need deeper test anyway...) enough to allow me to test the arexx-function and the
the ability to make arex-script that use Microbe3D
So I have right now an arexx-script that load 2 differents dancing-bears anims and play them : so the arexx part seems to works
But I will test more...


BTW Does exists rexxsupport.library for PPC/OS4 ? How is it done as the 68k version was used to return error and argstring to arexx in d0 AND a0 ?
Alain Thellier




Go to top
Re: Arexx calling OpenLibrary/CloseLibrary for each .library call: how to change that?
Just popping in
Just popping in


See User information
@Thellier

Are you wanting to have the Microbe3D library include an ARexx vector or are you launching a seperate program as a process to handle ARexx events?

If you are adding an ARexx vector then you would need some way to Identify a Context for ARexx calls

(I managed to solve this based on use of the return from "FindTask()" in exec.library as an Identification key...

However this only works based on a single context per caller...
Having a seperate "MicrobeRexx" program to connect ARexx may be a workable option.

definitely take a look at AWeb and other source code available applications on aminet and os4depot

@MoonSire

http://code.google.com/p/polymorph/
http://code.google.com/p/perception-ime/

These are my most advanced public projects...
and they also have a couple of wrinkles in embedding a process within the library that lock the library open while running (with the limitation of a race condition at exit at this time from my understanding).

Go to top
Re: Arexx calling OpenLibrary/CloseLibrary for each .library call: how to change that?
Home away from home
Home away from home


See User information
Quote:

BTW Does exists rexxsupport.library for PPC/OS4 ? How is it done as the 68k version was used to return error and argstring to arexx in d0 AND a0 ?


rexxsupport.library is 68k and only access from ARexx and so doesn't need to care about 68k quirks as it is 68k too.

You may have meant rexxsys.library as this is the one that accessed from programs to setup ARexx, this too is still 68k but has a .l.main file to create the PPC interface. There will be glue code in there that deals with the two return registers thing. Just follow the OS4 autodocs and don't worry about it. There are sliight differences in arguments and the functions #?RexxVarFromMsg() which handle access to RexxVar slight differently than the older amigalib versions.


For use under os4 with ARexx your library might need 68k stubs if built natively.





Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project