Exemple #1
0
void initPassOne()
{
	aboutToFreeRuntime();

	//dump_pool_histo(pyr_pool_runtime);
	pyr_pool_runtime->FreeAllInternal();
	//dump_pool_histo(pyr_pool_runtime);
	//gPermanentObjPool.Init(pyr_pool_runtime, PERMOBJCHUNK);
	sClassExtFiles = 0;

	void *ptr = pyr_pool_runtime->Alloc(sizeof(SymbolTable));
	gMainVMGlobals->symbolTable  = new (ptr) SymbolTable(pyr_pool_runtime, 8192);

	//gFileSymbolTable = newSymbolTable(512);

	pyrmath_init_globs();

	initSymbols(); // initialize symbol globals
	//init_graph_compile();
	initSpecialSelectors();
	initSpecialClasses();
	initClasses();
	initParserPool();
	initParseNodes();
	initPrimitives();
	//tellPlugInsAboutToCompile();
	initLexer();
	compileErrors = 0;
	numClassDeps = 0;
	compiledOK = false;
	compiledDirectories.clear();
	sc_InitCompileDirectory();
}
Exemple #2
0
JNIEXPORT void JNICALL NAME(nativeCreate)(JNIEnv *env, jobject thiz)
{
    initClasses(env, thiz);
    vlc_mutex_t *parse_lock = calloc(1, sizeof(vlc_mutex_t));
    vlc_mutex_init(parse_lock);
    setIntValue(env, thiz, "mNativeMediaParseLock", (jint) parse_lock);
    vlc_cond_t *parse_cond = calloc(1, sizeof(vlc_cond_t));
    vlc_cond_init(parse_cond);
    setIntValue(env, thiz, "mNativeMediaParseCond", (jint) parse_cond);
    setIntValue(env, thiz, "mNativeMediaBufferingCount", 0);
    const char *argv[] = {"-I", "dummy", "-vvv", "--no-plugins-cache", "--no-drop-late-frames", "--input-timeshift-path", "/data/local/tmp"};
    libvlc_instance_t *instance = libvlc_new_with_builtins(sizeof(argv) / sizeof(*argv), argv, vlc_builtins_modules);
    setIntValue(env, thiz, "mLibVlcInstance", (jint) instance);
    libvlc_media_player_t *mp = libvlc_media_player_new(instance);
    setIntValue(env, thiz, "mLibVlcMediaPlayer", (jint) mp);
    /* throw? */
    libvlc_event_manager_t *em = libvlc_media_player_event_manager(mp);
    for (int i = 0; i < sizeof(mp_listening) / sizeof(*mp_listening); i++)
    {
        libvlc_event_attach(em, mp_listening[i], vlc_event_callback, thiz);
    }
}
SOM_Scope AppointmentBook*  SOMLINK createAppointmentBook(AppointmentBookFactory *somSelf,
                                                           Environment *ev,
                                                          string name)
{

    CosNaming_NamingContext      *BookContext;
    DistributedAppointmentBook    *DistApptBook=NULL;
    LName                                  *bookContextname;
    LNameComponent                   *lnc;
    CosNaming_Name                     Name;
    AppointmentBookFactoryData *somThis = AppointmentBookFactoryGetData(somSelf);
    AppointmentBookFactoryMethodDebug("AppointmentBookFactory","createAppointmentBook");


    initClasses();             // Initialize the appointment book classes
    SOMD_Init(ev);           // Initialize DSOM
    if (!(somThis->nameContext)) {  // If the nameContext has not been set then error
       // raise the exception
       NoABContext *nocontext = (NoABContext *)SOMMalloc(sizeof(NoABContext));
       nocontext->ErrCode = NOABCONTEXT;
       strcpy(nocontext->Reason, "AppointmentBooks context not initialized");
       somSetException(ev, USER_EXCEPTION, "AppointmentBookFactory::NoABContext",
                          (void *)nocontext);
    } else {
      // Set up the context name for the book
      lnc = create_lname_component();
      lnc->set_id(ev, name);
      lnc->set_kind(ev, "");
      bookContextname = create_lname();
      bookContextname->insert_component(ev, 0, lnc);

      Name = bookContextname->to_idl_form(ev);
      // Check to see if one already registered in name server if so error
      DistApptBook = (DistributedAppointmentBook *)
                      (somThis->nameContext)->resolve(ev, &Name);
      if ( (ev->_major == NO_EXCEPTION)  || // Want name not found error
           (strcmp(somExceptionId(ev), ex_CosNaming_NamingContext_NotFound) != 0) )
      {
        // raise the exception
        BookExists *bookexists = (BookExists *)SOMMalloc(sizeof(BookExists));
        bookexists->ErrCode = BOOKEXISTS;
        strcpy(bookexists->Reason, "A book by this name already exists.");
        somSetException(ev, USER_EXCEPTION, "AppointmentBookFactory::BookExists",
                          (void *)bookexists);
        DistApptBook = (DistributedAppointmentBook *)OBJECT_NIL;
      }
      else
      {         // if the book not bound to the name service
         if (strcmp(somExceptionId(ev), ex_CosNaming_NamingContext_NotFound) == 0){
           somExceptionFree(ev);
              // This Server can Create a distributed book note: regimpl -l for BookServer classes
              // Create a distributed book
           DistApptBook = (DistributedAppointmentBook *)somSelf->getNewAppointmentBook(ev,name);
           DistApptBook->_set_bookName(ev, name);
           DistApptBook->incrementUsers(ev);    // Increment the number of book users

           // Register the Distributed Appointment Book in the Name server
           (somThis->nameContext)->bind(ev, &Name, DistApptBook);
           // The client is expected to check the environment for errors
         }
      }
    }
    return((AppointmentBook *)DistApptBook);
}
/*
 * The prototype for createConferenceCall was replaced by the following prototype:
 */
SOM_Scope ConferenceCall*  SOMLINK createConferenceCall(AppointmentBookFactory *somSelf,
                                                         Environment *ev)
{
    AppointmentBookFactoryData *somThis = AppointmentBookFactoryGetData(somSelf);
    AppointmentBookFactoryMethodDebug("AppointmentBookFactory","createConferenceCall");

    CosNaming_NamingContext      *apptContext;
    DistributedConferenceCall    *distCCall=NULL;
    LName                        *appointmentContextname;
    LNameComponent               *lnc;
    CosNaming_Name               Name;
    char                         idBuffer[33];
    char                         name[13];
    const char            *namePrefix = "C";
    int                            idTime;
    int                            idDay;
    time_t                       t;
    struct                       tm today;

    initClasses();             // Initialize the appointment book classes
    SOMD_Init(ev);           // Initialize DSOM
    time(&t);
    today = *gmtime(&t);
    idDay = today.tm_yday;
    idTime = (today.tm_hour * 3600) + (today.tm_min * 60) + today.tm_sec;
    strcpy(name,namePrefix);
    itoa(idTime,idBuffer,10);
    strcat(name, idBuffer);
    strcat(name,".");
    itoa(idDay,idBuffer,10);
    strcat(name,idBuffer);
 // If the AppointmentNameContext has not been set then error
    if (!(somThis->AppointmentNameContext)) {
       // raise the exception
       NoApptContext *nocontext = (NoApptContext *)SOMMalloc(sizeof(NoApptContext));
       nocontext->ErrCode = NOAPPTCONTEXT;
       strcpy(nocontext->Reason, "Appointments context not initialized");
       somSetException(ev, USER_EXCEPTION, "AppointmentBookFactory::NoApptContext",
                          (void *)nocontext);
    } else {
      // Set up the context name for the book
      lnc = create_lname_component();
      lnc->set_id(ev, name);
      lnc->set_kind(ev, "");
      appointmentContextname = create_lname();
      appointmentContextname->insert_component(ev, 0, lnc);

      Name = appointmentContextname->to_idl_form(ev);
      // Check to see if one already registered in name server if so error
      distCCall = (DistributedConferenceCall *)(void *)(somThis->AppointmentNameContext)->resolve(ev, &Name);
      if ( (ev->_major == NO_EXCEPTION)  || // Want name not found error
           (strcmp(somExceptionId(ev), ex_CosNaming_NamingContext_NotFound) != 0) )
      {
        // raise the exception
        AppointmentExists *apptExists = (AppointmentExists *)SOMMalloc(sizeof(AppointmentExists));
        apptExists->ErrCode = APPOINTMENTEXISTS;
        strcpy(apptExists->Reason, "A book by this name already exists.");
        somSetException(ev, USER_EXCEPTION, "AppointmentBookFactory::AppointmentExists",
                          (void *)apptExists);
        distCCall = (DistributedConferenceCall *)(void *)OBJECT_NIL;
      }
      else
      {         // if the book not bound to the name service
         if (strcmp(somExceptionId(ev), ex_CosNaming_NamingContext_NotFound) == 0){
           somExceptionFree(ev);
              // This Server can Create a distributed appointment note: regimpl -l for BookServer classes
              // Create a distributed appointment
           distCCall = (DistributedConferenceCall*)somSelf->getNewConferenceCall(ev,name);
           distCCall->_set_appointmentName(ev, name);
           distCCall->incrementUsers(ev);    // Increment the number of book users
                                               // Set the Appointment ID for the book
           distCCall->_set_apptId(ev, (idTime*1000 + idDay));
           // Register the Distributed Appointment Book in the Name server
           (somThis->AppointmentNameContext)->bind(ev, &Name,(SOMObject *)(void *) distCCall);
           // The client is expected to check the environment for errors
         }
      }
    }
    return((ConferenceCall *)distCCall);
}