Exemplo n.º 1
0
CJS_Runtime::CJS_Runtime(CPDFSDK_FormFillEnvironment* pFormFillEnv)
    : m_pFormFillEnv(pFormFillEnv),
      m_bBlocking(false),
      m_isolateManaged(false) {
  v8::Isolate* pIsolate = nullptr;

  IPDF_JSPLATFORM* pPlatform = m_pFormFillEnv->GetFormFillInfo()->m_pJsPlatform;
  if (pPlatform->version <= 2) {
    unsigned int embedderDataSlot = 0;
    v8::Isolate* pExternalIsolate = nullptr;
    if (pPlatform->version == 2) {
      pExternalIsolate = reinterpret_cast<v8::Isolate*>(pPlatform->m_isolate);
      embedderDataSlot = pPlatform->m_v8EmbedderSlot;
    }
    FXJS_Initialize(embedderDataSlot, pExternalIsolate);
  }
  m_isolateManaged = FXJS_GetIsolate(&pIsolate);
  SetIsolate(pIsolate);

#ifdef PDF_ENABLE_XFA
  v8::Isolate::Scope isolate_scope(pIsolate);
  v8::HandleScope handle_scope(pIsolate);
#endif

  if (m_isolateManaged || FXJS_GlobalIsolateRefCount() == 0)
    DefineJSObjects();

  IJS_EventContext* pContext = NewEventContext();
  InitializeEngine();
  ReleaseEventContext(pContext);
  SetFormFillEnvToDocument();
}
Exemplo n.º 2
0
globle void InitializeDefrules()
  {
   InitializeEngine();
   InitializeAgenda();

   InitializeDefruleModules();

   AddReservedPatternSymbol("and",NULL);
   AddReservedPatternSymbol("not",NULL);
   AddReservedPatternSymbol("or",NULL);
   AddReservedPatternSymbol("test",NULL);
   AddReservedPatternSymbol("logical",NULL);
   AddReservedPatternSymbol("exists",NULL);
   AddReservedPatternSymbol("forall",NULL);

   DefruleBasicCommands();

   DefruleCommands();

   DefruleConstruct =
      AddConstruct("defrule","defrules",
                   ParseDefrule,FindDefrule,
                   GetConstructNamePointer,GetConstructPPForm,
                   GetConstructModuleItem,GetNextDefrule,SetNextConstruct,
                   IsDefruleDeletable,Undefrule,ReturnDefrule);
  }
Exemplo n.º 3
0
globle void InitializeDefrules(
  void *theEnv)
  {   
   AllocateEnvironmentData(theEnv,DEFRULE_DATA,sizeof(struct defruleData),DeallocateDefruleData);

   InitializeEngine(theEnv);
   InitializeAgenda(theEnv);
   InitializePatterns(theEnv);
   InitializeDefruleModules(theEnv);

   AddReservedPatternSymbol(theEnv,"and",NULL);
   AddReservedPatternSymbol(theEnv,"not",NULL);
   AddReservedPatternSymbol(theEnv,"or",NULL);
   AddReservedPatternSymbol(theEnv,"test",NULL);
   AddReservedPatternSymbol(theEnv,"logical",NULL);
   AddReservedPatternSymbol(theEnv,"exists",NULL);
   AddReservedPatternSymbol(theEnv,"forall",NULL);

   DefruleBasicCommands(theEnv);

   DefruleCommands(theEnv);

   DefruleData(theEnv)->DefruleConstruct =
      AddConstruct(theEnv,"defrule","defrules",
                   ParseDefrule,EnvFindDefrule,
                   GetConstructNamePointer,GetConstructPPForm,
                   GetConstructModuleItem,EnvGetNextDefrule,SetNextConstruct,
                   EnvIsDefruleDeletable,EnvUndefrule,ReturnDefrule);
  }
Exemplo n.º 4
0
int main( int argc, char* args[] )
{
	if(!InitializeEngine())
	{
		printf( "Failed to initialize!\n" );
		return 1;
	}
	if(!GameInitialize())
	{
		printf( "Failed to load media!\n" );
		return 2;
	}


	//Main loop flag
	bool quit = false;

	//Event handler
	SDL_Event e;
	Uint32 nStartTime = 0;
	Uint32 nFrameTime = 0;
	//While application is running
	while( !quit )
	{
		//Handle events on queue
		while( SDL_PollEvent( &e ) != 0 )
		{
			//User requests quit
			if( e.type == SDL_QUIT )
			{
				quit = true;
			}
			else
			{
				KeyEventListenerManager::Instance().HandlerEvent(e);
			}
		}
		nStartTime = SDL_GetTicks();
		
		GameLoop(nFrameTime);

		nFrameTime = SDL_GetTicks() - nStartTime;
	}

	// Release any and all resources.
	GameShutdown();
	ShutdownEngine();

	return 0;
}
Exemplo n.º 5
0
void InitializeDefrules(
  Environment *theEnv)
  {
   unsigned long i;
   AllocateEnvironmentData(theEnv,DEFRULE_DATA,sizeof(struct defruleData),DeallocateDefruleData);

   InitializeEngine(theEnv);
   InitializeAgenda(theEnv);
   InitializePatterns(theEnv);
   InitializeDefruleModules(theEnv);

   AddReservedPatternSymbol(theEnv,"and",NULL);
   AddReservedPatternSymbol(theEnv,"not",NULL);
   AddReservedPatternSymbol(theEnv,"or",NULL);
   AddReservedPatternSymbol(theEnv,"test",NULL);
   AddReservedPatternSymbol(theEnv,"logical",NULL);
   AddReservedPatternSymbol(theEnv,"exists",NULL);
   AddReservedPatternSymbol(theEnv,"forall",NULL);

   DefruleBasicCommands(theEnv);

   DefruleCommands(theEnv);

   DefruleData(theEnv)->DefruleConstruct =
      AddConstruct(theEnv,"defrule","defrules",
                   ParseDefrule,
                   (FindConstructFunction *) FindDefrule,
                   GetConstructNamePointer,GetConstructPPForm,
                   GetConstructModuleItem,
                   (GetNextConstructFunction *) GetNextDefrule,
                   SetNextConstruct,
                   (IsConstructDeletableFunction *) DefruleIsDeletable,
                   (DeleteConstructFunction *) Undefrule,
                   (FreeConstructFunction *) ReturnDefrule);

   DefruleData(theEnv)->AlphaMemoryTable = (ALPHA_MEMORY_HASH **)
                  gm2(theEnv,sizeof (ALPHA_MEMORY_HASH *) * ALPHA_MEMORY_HASH_SIZE);

   for (i = 0; i < ALPHA_MEMORY_HASH_SIZE; i++) DefruleData(theEnv)->AlphaMemoryTable[i] = NULL;

   DefruleData(theEnv)->BetaMemoryResizingFlag = true;

   DefruleData(theEnv)->RightPrimeJoins = NULL;
   DefruleData(theEnv)->LeftPrimeJoins = NULL;
  }
Exemplo n.º 6
0
globle void InitializeDefrules(
  void *theEnv)
  {   
   unsigned long i;
   AllocateEnvironmentData(theEnv,DEFRULE_DATA,sizeof(struct defruleData),DeallocateDefruleData);

   InitializeEngine(theEnv);
   InitializeAgenda(theEnv);
   InitializePatterns(theEnv);
   InitializeDefruleModules(theEnv);

   AddReservedPatternSymbol(theEnv,(char*)"and",NULL);
   AddReservedPatternSymbol(theEnv,(char*)"not",NULL);
   AddReservedPatternSymbol(theEnv,(char*)"or",NULL);
   AddReservedPatternSymbol(theEnv,(char*)"test",NULL);
   AddReservedPatternSymbol(theEnv,(char*)"logical",NULL);
   AddReservedPatternSymbol(theEnv,(char*)"exists",NULL);
   AddReservedPatternSymbol(theEnv,(char*)"forall",NULL);

   DefruleBasicCommands(theEnv);

   DefruleCommands(theEnv);

   DefruleData(theEnv)->DefruleConstruct =
      AddConstruct(theEnv,(char*)"defrule",(char*)"defrules",
                   ParseDefrule,EnvFindDefrule,
                   GetConstructNamePointer,GetConstructPPForm,
                   GetConstructModuleItem,EnvGetNextDefrule,SetNextConstruct,
                   EnvIsDefruleDeletable,EnvUndefrule,ReturnDefrule);

   DefruleData(theEnv)->AlphaMemoryTable = (ALPHA_MEMORY_HASH **)
                  gm3(theEnv,sizeof (ALPHA_MEMORY_HASH *) * ALPHA_MEMORY_HASH_SIZE);

   for (i = 0; i < ALPHA_MEMORY_HASH_SIZE; i++) DefruleData(theEnv)->AlphaMemoryTable[i] = NULL;

   DefruleData(theEnv)->BetaMemoryResizingFlag = TRUE;
   
   DefruleData(theEnv)->RightPrimeJoins = NULL;
   DefruleData(theEnv)->LeftPrimeJoins = NULL;   
  }
Exemplo n.º 7
0
int WINAPI WinMain(          HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nCmdShow
)
{
    GameEngine engine;
    InitializeWindow(&engine);
    InitializeEngine(&engine);
    InitializeResource();

    if (engine.Initialize())
    {
        g_hWnd = engine.GethWnd();
        game->Start();
        engine.Start();
    }
    else
    {
        MessageBox(NULL, "´´½¨´°¿Úʧ°Ü", NULL, MB_OK);
    }

    return 0;
}
Exemplo n.º 8
0
int WINAPI WinMain(HINSTANCE h, HINSTANCE p, LPSTR cmd, int show)
{
   // Register the window class
   WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc,
                     0L, 0L, GetModuleHandle(NULL), NULL, NULL,
                     NULL, NULL, WINDOW_CLASS, NULL };
   RegisterClassEx(&wc);

   // Create the application's window
   if(FULLSCREEN)
      {
		 g_hwnd = CreateWindowEx(NULL, WINDOW_CLASS, WINDOW_NAME,
                        WS_POPUP | WS_SYSMENU | WS_VISIBLE, 0, 0,
                        WIN_WIDTH, WIN_HEIGHT,
                        NULL, NULL, h, NULL);
      }
   else
      {
		 const int sys_min_height = GetSystemMetrics(SM_CYMIN);  
		 const int sys_caption_height = GetSystemMetrics(SM_CYSMCAPTION);  
		 g_hwnd = CreateWindowEx(NULL, WINDOW_CLASS, WINDOW_NAME,
                              WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0,
                              0, WIN_WIDTH + (sys_min_height - sys_caption_height),
							  WIN_HEIGHT + sys_min_height,
                              NULL, NULL, h, NULL);
      }

   if(g_hwnd)
      {
         // Show the window
         ShowWindow(g_hwnd, SW_SHOWDEFAULT);
         UpdateWindow(g_hwnd);
      }

   // Initialize the Stranded Engine.
   if(InitializeEngine())
      {
         // Initialize Stranded game.
         if(GameInitialize())
            {
               // Enter the message loop
               MSG msg;
               ZeroMemory(&msg, sizeof(msg));

               SetCursorPos(0, 0);

               while(msg.message != WM_QUIT)
                  {
                     if(PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
                        {
                           TranslateMessage(&msg);
                           DispatchMessage(&msg);
                        }
                     else
                        GameLoop();
                  }
            }
      }

   // Release any and all resources.
   GameShutdown();
   ShutdownEngine();

   UnregisterClass(WINDOW_CLASS, wc.hInstance);
   return 0;
}