For one of my projects I have to use the TCL library, however this has not been ported to OS4 yet (and the 68k one does not work either). I tried to recompile it directly but that did not work : TCL rely on some *ix functions that are not available in the currently supported C runtime (most problematic ones beeing fork() and wait()) so to have an OS4 native port of TCL this should be done "cleanly" by adding the support for the Amiga platform. Did(does) someone work on that is interested in it ? Currently I managed to remove mainly every *ix dependencies, it remains only fork(), wait() and tzset(). I think this can be done relatively easily because the fork() call is immediatly (just a few lines) followed by an execvp()... I don't think I'll have the time to finish it right now and thought maybe someone else already work on it or would be interested in doing it ?
PS: of course I'll provide my current sources if someone is interested to go on.
I think this can be done relatively easily because the fork() call is immediatly (just a few lines) followed by an execvp()...
Post the section of code here and maybe we can help you out. Depending on how the fork()/execvp() is being used I can usually replace it with a single SystemTags() call.
In fact the fork() is followed by an execvp() however it does not waitpid() immediatly (i.e. read the call is asynchronous and checked later). However as it does not rely on features of the fork() I think it can be replaced by a SystemTags() call or by a CreateNewProc() however I'm new to Amiga processes coding so don't know how I could simulate the wait() call. I don't know however if it's really needed or if it's here only for cleaning the killed process to prevent it from becoming a zombie, I should check that...
If you use CreateNewProc() to make parallel threads, the global variables will be global, so you can simply change a global variable when your done.
Just keep in mind that CreateNewProc() is designed to take function pointer as start address, not address in side a function, local variables will be local for ever proc, so you do not need worry about that.
If you need to handle global variables as local, then you most make copy, you can pass the address of the copy as agreement to the CreateNewProc().
This can be done by making a structure that contains all variables, this way you only need pass one pointer to the address, of the copys.
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
Thank you for your answers. After some little more researches I have found that the fork() call is really only used to spawn a child process that will then be used to execute (via execvp()) a specified command asynchronously (after having redirected I/O to a previoulsy opened pipe, was using pipe() call that I replaced by opening a unique file in PIPE: one with read access, one with write access). However nothing prevents from launching several childs at the same time, so I can't rely on the use of global variables.
Then as I said a wait() call is made to gather alll terminated childs process to prevent them from becoming zombies and also to eventually generate error message in case child terminated abnormaly (signaled, return code). Currently I'm much more looking at the struct DeathMessage that can be sent automatically, someone already used that ? Suggestions ? The wait() replacement is not strictly needed because under AOS we can make the spawned process terminate itself without interfering with the parent, however if we want to have the return code, we have no choice than to keep track of all spawned childs and to analyse their return code at termination time.
No this this "just" TCL, which is in fact a powerful scripting language. Tk is an independant addon to TCL which offers TCL programs a GUI system upon X11. As it was designed by amost the same people they were often associated under the name "Tcl-Tk" but they are really two different things. I have not looked at it, but I think Tk should be more difficult to port, because you'll have to write many wrappers to replace X11 calls... I don't think I'll look at it, I don't have time to do it.
Yes : this does not work and I can't find why In fact I have a compiled tclsh and tcltest but they just fail at startup with an error message I did not understood well. Also fact is I was distracted from that for a couple of days now
I don't understand very what you mean. the error message is generated by TCL itself, it's not an error by the C runtime or AOS. Problem is I never used TCL myself, I was trying to compile it in order to be able to run the self test phase of sqlite while I was porting it to AOS4.
the tcl library is not an amiga shared library (yet), it's directly linked into the tclsh and tcltest executables. Doing an AOS4 shared library was not in my goal but is easily doable using idetool.
@SpotUP
currently I'm working with Steffen on an MUIbase native AOS4 version, and I'm experiencing trouble in an MUI listview display hook which does not want to do string operation on a local static variable without any single clue why So I must admit that TCL is really behind right now. Also I must confess that the current legal mess has undermined most of my motivation/interest in developping for the platform :-/