Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] pre-release questions

Date2006-10-17 15:00
FromMichael Gogins
SubjectRe: [Cs-dev] pre-release questions
I think it is not OK to call exit in any code that ends up in the Csound API, which is a library. Exit will indeed exit the host application. This decision should be up to the host application itself. Csound should return an error or perform a jump.

Regards,
Mike

-----Original Message-----
>From: Anthony Kozar 
>Sent: Oct 17, 2006 12:45 AM
>To: New Csound Developer list 
>Subject: [Cs-dev] pre-release questions
>
>I've compiled the current contents of CVS on MacOS 9 but not without a few
>difficulties.  In addition, I have noticed a few other things that I am not
>sure are right.
>
>I've already mentioned in a previous email about the new function pointers
>in CSOUND and that they may need to be moved to the empty slots in the
>public section.
>
>Furthermore, I am guessing that the API minor version number now needs to be
>incremented (to 1.03?).
>
>And I have noticed a number of uses of the exit() function within the Csound
>library and the stdutil plugin.  Is it OK to call exit() from within Csound?
>Does this exit the host application or does it get "caught" somewhere before
>that?
>
>(exit() can be found in several of the import/export utilities and within
>the new remote event code in musmon.c).
>
>Finally, regarding the remote event code -- this assumes a Unix-like socket
>interface that does not exist on MacOS 9.  I could see no way to turn off
>this code so I had to conditionalize all of it with the preprocessor,
>sometimes on a line-by-line basis.  The result is kind of ugly so I have not
>committed the changes yet (the diffs are below).  I am open to better
>suggestions on how to turn this code off.
>
>Anthony Kozar
>anthonykozar AT sbcglobal DOT net
>
>
>--- csound5/H/sysdep.h    25 Jan 2006 22:10:26 -0000    1.39
>+++ csound5/H/sysdep.h    17 Oct 2006 04:39:46 -0000
>@@ -117,6 +117,7 @@
> #  endif
> #  define  O_NDELAY (0)
> #  define  DIRSEP ':'
>+#  define  NO_REMOTE
> #elif defined(SYMANTEC)
> #  include      /* for open() etc protos on mac */
> #  define  DIRSEP ':'
>
>
>--- csound5/H/csoundCore.h    14 Oct 2006 18:45:05 -0000    1.201
>+++ csound5/H/csoundCore.h    17 Oct 2006 04:39:45 -0000
>@@ -642,7 +642,10 @@
> #include "prototyp.h"
> #include "cwindow.h"
> #include "envvar.h"
>-#include "remote.h"
>+
>+#ifndef NO_REMOTE
>+#  include "remote.h"
>+#endif
> 
> #define CS_STATE_PRE    (1)
> #define CS_STATE_COMP   (2)
>@@ -1190,8 +1193,10 @@
>     int           (*doCsoundCallback)(CSOUND *, void *, unsigned int);
>     const unsigned char *strhash_tabl_8;
>     unsigned int  (*strHash32)(const char *s);
>+#ifndef NO_REMOTE
>     REMOT_BUF     SVrecvbuf;  /* RM: rt_evt input Communications buffer */
>     void          *remoteGlobals;
>+#endif
>     /* VL: pvs bus */
>     int            nchanif, nchanof;
>     char          *chanif, *chanof;
>
>
>--- csound5/Top/csound.c    14 Oct 2006 18:45:05 -0000    1.175
>+++ csound5/Top/csound.c    17 Oct 2006 04:39:43 -0000
>@@ -583,8 +583,10 @@
>         csoundDoCallback_,  /*  doCsoundCallback    */
>         &(strhash_tabl_8[0]),   /*  strhash_tabl_8  */
>         csound_str_hash_32, /*  strHash32           */
>+#ifndef NO_REMOTE
>         {0, 0, ""},     /* REMOT_BUF */
>         NULL,            /*  remoteGlobals       */
>+#endif
>         0, 0,           /* nchanof, nchanif */
>         NULL, NULL,     /*  chanif, chanof */
>         csoundPvsinSet,
>
>
>--- csound5/Engine/entry1.c    13 Oct 2006 11:08:16 -0000    1.89
>+++ csound5/Engine/entry1.c    17 Oct 2006 04:39:46 -0000
>@@ -89,10 +89,12 @@
> { "ctrlinit",S(CTLINIT),1,      "",     "im",   ctrlinit                },
> { "massign",S(MASSIGN), 1,      "",     "iTp",  massign                 },
> { "turnon", S(TURNON),  1,      "",     "To",   turnon                  },
>+#ifndef NO_REMOTE
> { "insremot",S(INSREMOT),1,     "",     "SSm",  insremot                },
> { "midremot",S(MIDREMOT),1,     "",     "SSm",  midremot                },
> { "insglobal",S(INSGLOBAL),1,   "",     "Sm",   insglobal               },
> { "midglobal",S(MIDGLOBAL),1,   "",     "Sm",   midglobal               },
>+#endif
> { "=",      0,          0,      "",     ""                              },
> { "init",   0xffff      /* base names for later prefixes,suffixes */    },
> { "betarand", 0xffff                                                    },
>
>
>--- csound5/H/entry1.h    12 Oct 2006 14:08:08 -0000    1.13
>+++ csound5/H/entry1.h    17 Oct 2006 04:39:45 -0000
>@@ -54,7 +54,9 @@
> #include "str_ops.h"
> #include "bus.h"
> #include "pstream.h"
>-#include "remote.h"
>+#ifndef NO_REMOTE
>+#  include "remote.h"
>+#endif
> 
> #define S(x)    sizeof(x)
> 
>
>--- csound5/Engine/musmon.c    14 Oct 2006 16:40:40 -0000    1.114
>+++ csound5/Engine/musmon.c    17 Oct 2006 04:39:47 -0000
>@@ -28,7 +28,9 @@
> #include "soundio.h"
> #include "namedins.h"
> #include "oload.h"
>-#include "remote.h"
>+#ifndef NO_REMOTE
>+#  include "remote.h"
>+#endif
> #include 
> 
> #define SEGAMPS 01
>@@ -416,7 +418,9 @@
>         csound->Message(csound, Str("no sound written to disk\n"));
>     }
>     /* close any remote.c sockets */
>+#ifndef NO_REMOTE
>     if (csound->remoteGlobals) remote_Cleanup(csound);
>+#endif
>     if (csound->oparms->ringbell)
>       cs_beep(csound);
>     return dispexit(csound);    /* hold or terminate the display output
>*/
>@@ -627,6 +631,7 @@
>                                     evt->strarg);
>           break;
>         }
>+#ifndef NO_REMOTE
>         if (csound->remoteGlobals && SR(insrfd) && (rfd =
>SR(insrfd)[insno])) {
>           /* RM: if this note labeled as remote */
>           if (rfd == GLOBAL_REMOT)
>@@ -636,6 +641,7 @@
>             break;                       /* RM: and quit */
>           }
>         }
>+#endif
>         evt->p[1] = (MYFLT) insno;
>         if (csound->oparms->Beatmode && !rtEvt && evt->p3orig > FL(0.0))
>           evt->p[3] = evt->p3orig * (MYFLT) csound->beatTime;
>@@ -654,6 +660,7 @@
>                           insno, csound->maxinsno);
>           break;
>         }
>+#ifndef NO_REMOTE
>         if (csound->remoteGlobals && SR(insrfd) && (rfd =
>SR(insrfd)[insno])) {
>           /* RM: if this note labeled as remote  */
>           if (rfd == GLOBAL_REMOT)
>@@ -663,6 +670,7 @@
>              break;                        /* RM: and quit              */
>           }
>         }
>+#endif
>         if (evt->p[1] < FL(0.0))           /* if p1 neg,             */
>           infoff(csound, -evt->p[1]);      /*  turnoff any infin cpy */
>         else {
>@@ -680,8 +688,10 @@
>       {
>         FUNC  *dummyftp;
>         csound->hfgens(csound, &dummyftp, evt, 0); /* construct locally */
>+#ifndef NO_REMOTE
>         if (csound->remoteGlobals && SR(insrfd_count))
>           insGlobevt(csound, evt); /* RM: & optionally send to all remotes
>*/
>+#endif
>       }
>       break;
>     case 'a':
>@@ -742,6 +752,7 @@
>       /* RM: Events are sorted on insertion, so just check the first */
>       evt = &(e->evt);
>       insno = (int)(evt->p[1]);
>+#ifndef NO_REMOTE
>       if (csound->remoteGlobals && SR(insrfd) && (rfd = SR(insrfd)[insno]))
>{
>         if (rfd == GLOBAL_REMOT)
>           insGlobevt(csound, evt);       /* RM: do a global send and allow
>local */
>@@ -749,6 +760,7 @@
>           insSendevt(csound, evt, rfd);  /* RM: or send to single remote
>Csound */
>         return 0;
>       }
>+#endif
>       /* pop from the list */
>       csound->OrcTrigEvts = e->nxt;
>       retval = process_score_event(csound, evt, 1);
>@@ -766,6 +778,7 @@
>       /* realtime or Midifile  */
>       mep = csound->midiGlobals->Midevtblk;
>       chn = csound->m_chnbp[mep->chan];
>+#ifndef NO_REMOTE
>       if (SR(chnrfd) && (rfd = SR(chnrfd)[mep->chan+1])) { /* RM: USE CHAN
>+ 1 */
>         if (rfd == GLOBAL_REMOT)
>           MIDIGlobevt(csound, mep);
>@@ -773,6 +786,7 @@
>         return 0;
>       }
>       else  /* RM: this part is broken out  -- bv  */
>+#endif
>         process_midi_event(csound, mep, chn);
>     }
>     return retval;
>@@ -893,7 +907,11 @@
>     /*   events is not sorted by instrument number */
>     /*   (although it never was sorted anyway...)  */
> 
>-    if (O->RTevents || (csound->remoteGlobals && SR(socksin))) {
>+    if (O->RTevents
>+#ifndef NO_REMOTE
>+                    || (csound->remoteGlobals && SR(socksin))
>+#endif
>+       ) {
>       int nrecvd;
>       /* run all registered callback functions */
>       if (csound->evtFuncChain != NULL && !csound->advanceCnt) {
>@@ -910,6 +928,7 @@
>           goto scode;
>       }
>       /* RM */
>+#ifndef NO_REMOTE
>       if (csound->remoteGlobals && (sinp = SR(socksin))){
>         while ((conn = *sinp++)) {
>           while ((nrecvd = SVrecv(csound, conn,
>(void*)&(csound->SVrecvbuf), sizeof(REMOT_BUF) )) > 0) {
>@@ -946,6 +965,7 @@
>           }
>         }
>       }
>+#endif
>       /* MIDI note messages */
>       if (O->Midiin || O->FMidiin)
>         while ((sensType = sensMidi(csound)) != 0)
>@@ -958,8 +978,10 @@
>  scode:
>     /* end of section (retval == 1), score (retval == 2), */
>     /* or lplay list (retval == 3) */
>+#ifndef NO_REMOTE
>     if (csound->remoteGlobals && SR(insrfd_count))
>       insGlobevt(csound, e);/* RM: send s,e, or l to any remotes */
>+#endif
>     e->opcod = '\0';
>     if (retval == 3) {
>       section_amps(csound, 2);
>
>
>
>
>-------------------------------------------------------------------------
>Using Tomcat but need to do more? Need to support web services, security?
>Get stuff done quickly with pre-integrated technology to make your job easier
>Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>_______________________________________________
>Csound-devel mailing list
>Csound-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/csound-devel




-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net