Ejemplo n.º 1
0
int MenuGlobal(GLOBDATA *aGlob_buffer)
{
    extern MP_PROFIL prof;

    int status = (int)MPOK;

    switch(ACTIONTYP)
    {
    /* re/initialize all objects of the daemon */
    case GLOBINIT:
        InitGlobal(aGlob_buffer);
        break;

    case LABELINIT:
        status = InitLAB(atoi(comm.buffer));
        break;

    case MAKELABELFILE:
        status = LABmake_file();
        break;

    /* user made changes on the global mask - process it and save it */
    case GLOBSEND:
        status = GLOBsave(&prof, aGlob_buffer);
        break;
    }

    return(status);
}
Ejemplo n.º 2
0
TCGvoid TCGClient::ConnectServer()
{
#ifndef USE_FILE
    // Network initialize
    g_GetClient()->Init();
#else
    InitGlobal();
#endif
}
Ejemplo n.º 3
0
BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
{
	(void) lpReserved;

	if (DLL_PROCESS_ATTACH == dwReason && hDll)
		InitGlobal(&G, (HINSTANCE)hDll);
	else if (DLL_PROCESS_DETACH == dwReason)
		DestroyGlobal(&G);

	return TRUE;
}
Ejemplo n.º 4
0
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd )
{

	std::tr1::shared_ptr<TestApp> pApp=std::make_shared<TestApp>("DxApp",WINDOW_WIDTH,WINDOW_HIGHT,0,0);
	InitGlobal(pApp->GetWnd()->GetHwnd(),WINDOW_WIDTH,WINDOW_HIGHT);
	RenderInfo info;
	info.width=WINDOW_WIDTH;
	info.height=WINDOW_HIGHT;
	info.bwindowed=true;
	info.backFMT=D3DFMT_A8R8G8B8;
	info.zFMT=D3DFMT_D24S8;
	info.hwnd=pApp->GetWnd()->GetHwnd();
	pApp->SetRenderInfo(info);
	pApp->Init();
	pApp->StartRun();
	pApp->ShudDown();

	return 1;
}
Ejemplo n.º 5
0
static void InitCodes(void) {
  CACHE_REGS
#if THREADS
  int wid;
  for (wid = 1; wid < MAX_THREADS; wid++) {
    Yap_local[wid] = NULL;
  }
#endif
#include "ihstruct.h"
#if THREADS
  Yap_InitThread(0);
#endif /* THREADS */
  InitGlobal();
#if !THREADS
  InitWorker(0);
#endif /* THREADS */
  Yap_InitFirstWorkerThreadHandle();
  /* make sure no one else can use these two atoms */
  LOCAL_SourceModule = CurrentModule = 0;
  Yap_ReleaseAtom(AtomOfTerm(TermRefoundVar));
  /* flags require atom table done, but must be done as soon as possible,
     definitely before any predicate initialization */
  // Yap_InitFlags(); moved to HEAPFIELDS
  /* make sure we have undefp defined */
  /* predicates can only be defined after this point */
  {
    /* make sure we know about the module predicate */
    PredEntry *modp = RepPredProp(PredPropByFunc(FunctorModule, PROLOG_MODULE));
    modp->PredFlags |= MetaPredFlag;
  }
#ifdef YAPOR
  Yap_heap_regs->getwork_code->y_u.Otapl.p =
      RepPredProp(PredPropByAtom(AtomGetwork, PROLOG_MODULE));
  Yap_heap_regs->getwork_seq_code->y_u.Otapl.p =
      RepPredProp(PredPropByAtom(AtomGetworkSeq, PROLOG_MODULE));
#endif /* YAPOR */
}
Ejemplo n.º 6
0
unsigned int __stdcall InstallAction ( MSIHANDLE hModule )
{
    // store the original path
    char ORIG_PATH[MAX_PATH_SIZE] = {0};  // c:\somewhere
    GetCurrentDirectory(MAX_PATH_SIZE, ORIG_PATH);

    if (InitGlobal() == false)
    {
        return 0;
    }
    
    ExtractBinaryFile(hModule, "JarPack", g_TEMP_INSTALLER_JAR);

    do_extract(g_TEMP_INSTALLER_JAR);

	// get JnlpFileName Property from msi Property table
    char jnlpFileName[256] = {0};
    GetMsiProperty(hModule, jnlpFileName, "JnlpFileName");
    char TEMP_JNLP_FILE[MAX_PATH_SIZE] = {0};  // C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\[javaws4c1.tmp]\draw.jnlp
    sprintf(TEMP_JNLP_FILE, "%s\\%s", g_TEMP_JAVAWS_PATH, jnlpFileName);

	// get Shortcut Property from msi Property table
    char shortcut[256] = {0};
    GetMsiProperty(hModule, shortcut, "Shortcut");
    if(shortcut[0] != '0')
    {
        strncpy(g_SHORTCUT, "-shortcut", strlen("-shortcut"));
    }

	// get CacheType Property from msi Property table
    char cachetype[256] = {0};
    GetMsiProperty(hModule, cachetype, "CacheType");
    if(0 == stricmp(cachetype, "system"))
    {
        strncpy(g_CACHE_TYPE, "-system", strlen("-system"));
    }

	// get Association Property from msi Property table
    char association[256] = {0};
    GetMsiProperty(hModule, association, "Association");
    if(association[0] != '0')
    {
        strncpy(g_ASSOCIATION, "-association", strlen("-association"));
    }

    // install the jnlp software
    STARTUPINFO stinfo = {0}; //info of the window
    stinfo.cb = sizeof(STARTUPINFO);
    PROCESS_INFORMATION procinfo; //info of the process
    char CREATEPROCESS[MAX_PATH_SIZE] = {0};  // javaws -silent -import -system -codebase %s
    sprintf(CREATEPROCESS, "%s\\javaws %s -silent -import %s %s -codebase \"%s\" %s", 
        g_JAVAWS_HOME, g_CACHE_TYPE, g_SHORTCUT, g_ASSOCIATION, g_TEMP_JAVAWS_URL, TEMP_JNLP_FILE);

    if(!CreateProcess(NULL, CREATEPROCESS, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &stinfo, &procinfo))
    {
        return 0;
    }
    
    // wait for the end of the process
    WaitForSingleObject(procinfo.hProcess, INFINITE);
    CloseHandle(procinfo.hProcess);
    CloseHandle(procinfo.hThread);

    // restore to original path & Remove the generated temporary directory
    SetCurrentDirectory(ORIG_PATH);
    RemoveDir(g_TEMP_JAVAWS_PATH);

    return ERROR_SUCCESS;
}
Ejemplo n.º 7
0
int main() {

    int r;

#if GRAPHICS
    struct Button *but,*button;
    boolean quit=FALSE;
    context = (struct Context *)malloc(sizeof(struct Context));

    but= context->Buttons= CreateButton(RUN_BUTTON,"RUN/STOP",WINDOW_W-50,WINDOW_H-90);
    but= but->Next=CreateButton(DISPLAY_RATE_UP_BUTTON,"+",WINDOW_W-40,WINDOW_H-60);
    but= but->Next=CreateButton(DISPLAY_RATE_DOWN_BUTTON,"-",WINDOW_W-60,WINDOW_H-60);
    but= but->Next=CreateButton(QUIT_BUTTON,"QUIT",WINDOW_W-50,WINDOW_H-30);

    display_rate=1L;

    OpenGraphics();
#endif

    robots = (struct Robot **)malloc(NR*sizeof(struct Robot*));

    for (r=0;r<NR;r++) {
        robots[r] = (struct Robot *)malloc(sizeof(struct Robot));
    }

    InitFiles();
    InitGlobal();

    for (r=0;r<NR;r++) {
        InitRobot(r,robots[r]);
    }

#if GRAPHICS
    while(quit == FALSE) {
        button=PressButton(context);
        switch(button->Value) {
        case QUIT_BUTTON:  
            quit = TRUE;
            break;
        case DISPLAY_RATE_UP_BUTTON:
            display_rate*=10L;
            if (display_rate>100000L) display_rate=100000L;
            display_rate-=display_rate%10L;
            if (display_rate<1L) display_rate=1L;
            DrawWindow(context);
            break;
        case DISPLAY_RATE_DOWN_BUTTON:
            if (display_rate>9L) display_rate/=10L;
            display_rate-=display_rate%10L;
            if (display_rate<1L) display_rate=1L;
            DrawWindow(context);
            break;

        case RUN_BUTTON:
#endif
            do { 

                for (r=0;r<NR;r++) {
                    RunRobot(r,robots[r]);
                    EvalRobot(t,r,robots[r]);
                }
                t++;
                if (t>TM) {
#if GRAPHICS
                    CloseGraphics();
#endif
                    return(1);
                    exit(1);
                }

#if GRAPHICS
                if (t%display_rate==0L) {
                    DrawWindow(context);
#if DISTY*(DISTY-2)
                    if (t%(250L*display_rate)==0L) {
                        DrawPlate(0,0,WINDOW_W-1,WINDOW_H-1,BLACK,PLATE_UP);
                    }
#endif
                }
#endif
            }
#if GRAPHICS
            while (UnpressButton(context,button)==FALSE); 
            break;
#else
            while (TRUE); 
#endif
#if GRAPHICS
        }
        button->State = PLATE_UP;
    }

    CloseGraphics();
#endif
    return(1);
}