예제 #1
0
파일: main.c 프로젝트: hl1itj/Team5
int
main(void)
{
	InitDebug();
	init_virtual_io(ENABLE_LED | ENABLE_SW | ENABLE_MATRIX);	// Enable Virtual LED's on Top Screen
	//init_printf();							// Initialize Bottom Screen for printf()

	xTaskCreate(Key_Task,
					     (const signed char * const)"Key_Task",
					     2048,
					     (void *)NULL,
					     tskIDLE_PRIORITY + 10,
					     NULL);

	KeyQueue = xQueueCreate(MAX_KEY_LOG, sizeof(u8));
	// Error Processing Needed !

	xTaskCreate(Exp_5_Task,
					     (const signed char * const)"Exp_Task",
					     2048,
					     (void *)NULL,
					     tskIDLE_PRIORITY + 1,
					     NULL);


	vTaskStartScheduler();		// Never returns
	while(1)
		;
	return 0;
}
예제 #2
0
파일: main.c 프로젝트: jongwonk/fun_thing1
int main(void)
{
	/* Configure the hardware ready to run the test. */
	prvSetupHardware();
	
	/* The following function will only create more tasks and timers if
	mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY is set to 0 (at the top of this
	file).  See the comments at the top of this file for more information. */
	//prvOptionallyCreateComprehensveTestApplication();

	InitDebug();
	initNFC();

	createDebugTask();
	createLEDTask();
	createNFCTask();
	createEthernetTask();

	/* Start the scheduler. */
	vTaskStartScheduler();
	
	/* If all is well, the scheduler will now be running, and the following line
	will never be reached.  If the following line does execute, then there was
	insufficient FreeRTOS heap memory available for the idle and/or timer tasks
	to be created.  See the memory management section on the FreeRTOS web site
	for more details. */
	for( ;; );	
}
예제 #3
0
extern "C" int __declspec(dllexport) LoadFilter(MIRANDASERVICE GetYAMNFcnPtr)
{
	FilterPath=new char[MAX_PATH];
	char *delim;
	pYAMNFcn=&YAMNFcn;

	GetModuleFileName(GetModuleHandle(NULL),FilterPath,MAX_PATH);
	if(NULL!=(delim=strrchr(FilterPath,'\\')))
		*delim=0;
	lstrcat(FilterPath,"\\basefilterdeny.txt");
#ifdef DEBUG_FILTER
	InitDebug();
#endif

	if(!LoadRules())
		return 0;

	pYAMNFcn->RegisterFilterPlugin=(MIRANDASERVICE)GetYAMNFcnPtr((WPARAM)MS_YAMN_REGISTERFILTERPLUGIN,(LPARAM)0);
	pYAMNFcn->SetFilterPluginFcnImportFcn=(YAMN_SETFILTERPLUGINFCNIMPORTFCN)GetYAMNFcnPtr((WPARAM)YAMN_SETFILTERPLUGINFCNIMPORTID,(LPARAM)0);
//Register our filter plugin to YAMN
	if(NULL==(POPFilePlugin=(HYAMNFILTERPLUGIN)pYAMNFcn->RegisterFilterPlugin((WPARAM)&FilterRegistration,(LPARAM)YAMN_FILTERREGISTRATIONVERSION)))
		return 0;
//And add our imported functions for YAMN
	if(!pYAMNFcn->SetFilterPluginFcnImportFcn(POPFilePlugin,0xb0000000,&FilterFunctions,YAMN_FILTERIMPORTFCNVERSION))
		return 0;
	return 1;		//Load luccess
}
예제 #4
0
파일: gendebug.c 프로젝트: dbunker/SABR
// free and clear
void FreeL(void *mal){

	if(!globalInitDebug)
		InitDebug();

	memInfo	memS;
	memInfo	*mem = &memS;
	mem->loc = mal;
	
	memInfo	*retMem = removeSkip(globalMemHolder,mem);
	assert(retMem,"Illegal Free");

	char *retMal = retMem->loc;
	int size = retMem->size;

	assertBool((retMal==mal),"Mal Incorrect");

	// clear out memory
	int i;
	for(i=0;i<size;i++)
		retMal[i] = 0x58;

	// doesn't really free the memory to make sure that if 
	// it is called, the result will be that it was freed (0x58)

	Free(retMem);
}
예제 #5
0
void InitApp(void)
{
    // activation de la priorité des interruptions
    _NSTDIS = 0;

    //Init des E/S
    _TRISA0 = 0;
    _TRISA1 = 0;
    led = 0;
    led1 = 0;

    OpenTimer2(T2_ON & T2_GATE_OFF & T2_PS_1_256 & T2_32BIT_MODE_OFF & T2_SOURCE_INT, 50000);
    ConfigIntTimer2(T2_INT_PRIOR_2 & T2_INT_ON);

    //Init debug on UART, TX->RP8, RX->RP9
    InitDebug(8,9);

    //Init the Servo Lib
    InitLibServo();
    ajouterServo('B',2);    //Initialise RB2, pas obligatoire
    ajouterServo('B',3);    //Initialise RB3, pas obligatoire
    __delay_ms(100);
    modifierServoPeriod('B',2,0.0015);    //1.5ms, milieu
    modifierServoPeriod('B',3,0.002);     //2ms, droite
}
예제 #6
0
파일: InitEM.c 프로젝트: forbelief/KL25EM
/****************************************************************
 *功能:初始化
 *形参:
 *			无
 *返回:
 *			无
 */
void InitEM(void)
{	
	InitCollection();
	InitControl();
	InitDebug();
	InitSimulatTimer();
}
예제 #7
0
파일: gendebug.c 프로젝트: dbunker/SABR
// print out memory leaked
void MemInfo(){

	if(!globalInitDebug)
		InitDebug();
	
	printf("Leak Size: %i\n",sizeSkip(globalMemHolder));
	printSkip(globalMemHolder,printInfo);
}
예제 #8
0
CCar::CCar()
{
	m_memory		= NULL;
	m_driver_anim_type = 0;
	m_bone_steer	= BI_NONE;
	active_camera	= 0;
	camera[ectFirst]= xr_new<CCameraFirstEye>	(this, CCameraBase::flRelativeLink|CCameraBase::flPositionRigid); 
	camera[ectFirst]->tag	= ectFirst;
	camera[ectFirst]->Load("car_firsteye_cam");

	camera[ectChase]= xr_new<CCameraLook>		(this,	CCameraBase::flRelativeLink); 
	camera[ectChase]->tag	= ectChase;
	camera[ectChase]->Load("car_look_cam");

	camera[ectFree]	= xr_new<CCameraLook>		(this); 
	camera[ectFree]->tag	= ectFree;
	camera[ectFree]->Load("car_free_cam");
	OnCameraChange(ectFirst);

	m_repairing		=false;

	///////////////////////////////
	//////////////////////////////
	/////////////////////////////
	b_wheels_limited=false;
	b_engine_on=false;
	e_state_steer=idle;
	e_state_drive=neutral;
	m_current_gear_ratio=phInfinity;
	rsp=false;lsp=false;fwp=false;bkp=false;brp=false;
	///////////////////////////////
	//////////////////////////////
	/////////////////////////////
	m_exhaust_particles	="vehiclefx\\exhaust_1";
	m_car_sound			=xr_new<SCarSound>	(this);

	//у машины слотов в инвентаре нет
	inventory			= xr_new<CInventory>();
	inventory->SetSlotsUseful(false);
	m_doors_torque_factor = 2.f;
	m_power_increment_factor=0.5f;
	m_rpm_increment_factor=0.5f;
	m_power_decrement_factor=0.5f;
	m_rpm_decrement_factor=0.5f;
	b_breaks=false;
	m_break_start=0.f;
	m_break_time=1.;
	m_breaks_to_back_rate=1.f;

	b_exploded=false;
	m_car_weapon=NULL;
	m_power_neutral_factor=0.25f;
	m_steer_angle=0.f;
#ifdef DEBUG
	InitDebug();
#endif
}
예제 #9
0
int CMPlugin::Load()
{
	g_bInitialized = false;
	
	InitDebug();
	TRACE(L"Plugin loaded\n");
	// Schedule actual initialization for later
	HookEvent(ME_SYSTEM_MODULESLOADED, Init);
	return 0;
}
예제 #10
0
PUMA_FUNC(Bool) PUMA_Init(uint16_t wHeightCode, void* hStorage)
{
	gwHeightRC = wHeightCode;

	if(!InitMem())
		return FALSE;

	InitDebug();

 return ModulesInit((void*)ghStorage);
}
예제 #11
0
void be_init()
/* Main routine for Interpreter back end */
{
	char *p;

	EuConsole = (getenv("EUCONS") != NULL && atoi(getenv("EUCONS")) == 1);
	clocks_per_sec = CLOCKS_PER_SEC;
#ifdef CLK_TCK
	clk_tck = CLK_TCK;
#else
	clk_tck = sysconf(_SC_CLK_TCK);
#endif

#define TempErrName_len (30)
	TempErrName = (char *)EMalloc(TempErrName_len);
	copy_string(TempErrName, "ex.err", TempErrName_len); // can change
	
	eudir = getenv("EUDIR");
	if (eudir == NULL) {
#ifdef EUNIX
		// should check search PATH for euphoria/bin ?
		eudir = getenv("HOME");
		if (eudir == NULL) {
			eudir = "euphoria";  
		}
		else {
			int p_size = strlen(eudir) + 12;
			p = (char *)EMalloc(p_size + 1);
			snprintf(p, p_size+1, "%s/euphoria", eudir);
			p[p_size] = 0; // ensure NULL
			eudir = p;
		}
#else // EUNIX
		eudir = "\\EUPHORIA";
#endif // EUNIX
	}
	
#if defined(EUNIX) || defined(EMINGW)
	copy_string(main_path, file_name[1], PATH_MAX); // FOR NOW!
#else
	(void)_fullpath(main_path, file_name[1], PATH_MAX+1); 
#endif
	for (p = main_path+strlen(main_path)-1; 
		 *p != '\\' && *p != '/' && p >= main_path; 
		 p--)
		;
	*(p+1) = '\0'; /* keep the path, truncate off the final name */    

	InitExecute();
	InitDebug();
	InitTraceWindow();
}
예제 #12
0
// Called by Miranda to load the plugin.
// We defer initialization until Miranda's module loading process completed and return 0 to
// mark success, everything else will cause the plugin to be freed right away.
EXTERN_C int __declspec(dllexport) Load()
{
	mir_getLP(&pluginInfoEx);
	mir_getCLI();
	
	g_bInitialized = false;
	
	InitDebug();
	TRACE(_T("Plugin loaded\n"));
	// Schedule actual initialization for later
	HookEvent(ME_SYSTEM_MODULESLOADED, Init);
	return 0;
}
예제 #13
0
int main()
{
	// This is needed for FreeRTOS.
	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);

	InitDebug();

	cfg_Init( );

	PolePosition_Init();

	// This MUST be initialized before fullCAN
	MotorPosition_Init(FEEDBACK_POLE_POSITION);

	fullCAN_Init( 1000000, cfg_GetControllerID() );

	if ( cfg_GetControllerID() == 0)
	{
		fullCAN_SetTerminationState(ENABLE);
	} else {
		fullCAN_SetTerminationState(DISABLE);
	}

	d1k_STDIO_CAN_Init( CAN2,
			fullCAN_GetControllerId() + FULLCAN_IDBASE_STDIO_TX,
			fullCAN_GetControllerId() + FULLCAN_IDBASE_STDIO_RX );

	d1k_portal_Init( );

	ControlLoopInit();

	InitLEDs( );

	adc_Init( 100000 );

	motor_Init( );

	fault_Init( );

	diag_Init( );

	fan_Init( );

	fan_SetDutyCycle( 1.0f );

	printf("fullStartup! Controller: %u\r\n", (uint16)fullCAN_GetControllerId());

	vTaskStartScheduler( );
}
예제 #14
0
파일: msystem.cpp 프로젝트: liye0005/QT_POJ
bool MSystem::Init()
{
    if(!InitConfig())
    {
        return false;
    }

    InitDebug();
    InitLog();

    MISEISINFO("*********************************************");
    MISEISINFO("MSWA start");

    return true;
}
예제 #15
0
파일: primitive.cpp 프로젝트: Booley/nbis
void Primitive::run(){
	InitSampling(parameters);											//Inizializza il vettore cloudSampling e cloudNearPoints
	InitDebug();
	double val=selectionMesh->bbox.Diag();
	while(val>selectionMesh->bbox.Diag()/100000){			//100000
		RigidTranformation();												//Modifico solo la posizione e l'orientamento
		NonLinearMinimization();										//Modifico i parametri della primitiva (es. raggio altezza)
		//UpdateWeight();
		val=abs((totDistance-lastTotDistance)/cloudSampling.size());
		lastTotDistance=totDistance;
	}
	emit updateGlArea();
	emit updateDebugStapModeSize((int)DebugCloudSampling.size()-1);
	exec();
}
예제 #16
0
파일: gendebug.c 프로젝트: dbunker/SABR
// this is used for debugging, can be more fine grained than valgrind
void *MallocInfoL(size_t len,char *info){

	if(!globalInitDebug)
		InitDebug();

	char *mal = Malloc(len);
	
	memInfo	*mem = Malloc(sizeof(memInfo));
	mem->loc = mal;
	mem->size = len;
	strncpy(mem->info,info,9);
	
	// fill with nonsense
	int i;
	for(i=0;i<len;i++)
		mal[i] = 0x4D;

	insertSkip(globalMemHolder,mem);
	return mal;
}
예제 #17
0
//************************************************************************
// Initializes the OutputManager
//************************************************************************
bool CLCDOutputManager::Initialize(tstring strAppletName,bool bAutostart, bool bConfigDialog)
{
	srand ( time(NULL) );

	InitDebug();

	m_strAppletName = strAppletName;
	
	m_pGfx = new CLCDGfx();

	m_pLcdConnection = new CLCDConnectionLogitech();
	if(!m_pLcdConnection->Initialize(m_strAppletName,bAutostart,bConfigDialog))
		return false;
	
	
	m_bInitialized = true;

	m_dwLastUpdate = GetTickCount();
	return true;
}
예제 #18
0
void InitApp(void)
{
    // activation de la priorité des interruptions
    _NSTDIS = 0;

    //Init des E/S
    _TRISA0 = 0;
    led = 0;

    //Init debug on UART, TX->RP8, RX->RP9
    InitDebug(8,9);

    //Configuration du Output Compare 1 en mode PWM
    OpenOC1(OC_IDLE_CON & OC_TIMER2_SRC & OC_HIGH_LOW, 20, 20);
    _RP15R = 18;         //OC1(18) sur RP1;

    //Configuration du Timer 2, période 20ms
    OpenTimer2(T2_ON & T2_GATE_OFF & T2_PS_1_256 & T2_32BIT_MODE_OFF & T2_SOURCE_INT, 3125);
    ConfigIntTimer2(T2_INT_ON & T2_INT_PRIOR_4);
}
예제 #19
0
BOOL	CCar::net_Spawn				(CSE_Abstract* DC)
{
#ifdef DEBUG
	InitDebug();
#endif
	CSE_Abstract					*e = (CSE_Abstract*)(DC);
	CSE_ALifeCar					*co=smart_cast<CSE_ALifeCar*>(e);
	BOOL							R = inherited::net_Spawn(DC);

	PKinematics(Visual())->CalculateBones_Invalidate();
	PKinematics(Visual())->CalculateBones(TRUE);

	CPHSkeleton::Spawn(e);
	setEnabled						(TRUE);
	setVisible						(TRUE);
	PKinematics(Visual())->CalculateBones_Invalidate();
	PKinematics(Visual())->CalculateBones(TRUE);
	m_fSaveMaxRPM					= m_max_rpm;
	SetfHealth						(co->health);

	if(!g_Alive())					b_exploded=true;
	else							b_exploded=false;
									
	CDamagableItem::RestoreEffect();
	
	
	CInifile* pUserData		= PKinematics(Visual())->LL_UserData(); 
	if(pUserData->section_exist("destroyed"))
		CPHDestroyable::Load(pUserData,"destroyed");
	if(pUserData->section_exist("mounted_weapon_definition"))
		m_car_weapon = xr_new<CCarWeapon>(this);

	if(pUserData->section_exist("visual_memory_definition"))
	{
		m_memory			= xr_new<car_memory>(this);
		m_memory->reload	(pUserData->r_string("visual_memory_definition", "section"));
	}

	return							(CScriptEntity::net_Spawn(DC) && R);
	
}
예제 #20
0
파일: main.c 프로젝트: hl1itj/Team3
int
main(void)
{
	// 상단 화면 설정
	InitDebug();
	videoSetMode(MODE_5_2D);
	vramSetBankA(VRAM_A_MAIN_BG);
	bgInit(3,BgType_Bmp16, BgSize_B16_256x256, 0, 0);
	decompress(upBitmap, BG_GFX, LZ77Vram);

	// 하단 화면 설정
	videoSetModeSub(MODE_5_2D);
	vramSetBankC(VRAM_C_SUB_BG);
	bgInitSub(3,BgType_Bmp16, BgSize_B16_256x256, 0, 0);
	decompress(downBitmap, BG_GFX_SUB, LZ77Vram);

	xTaskCreate(Key_Task,
			(const signed char * const)"Key_Task",
			2048,
			(void *)NULL,
			tskIDLE_PRIORITY + 10,
			NULL);

	xTaskCreate(Main_Task,
			(const signed char * const)"Main_Task",
			2048,
			(void *)NULL,
			tskIDLE_PRIORITY + 1,
			NULL);

	KeyQueue = xQueueCreate(MAX_KEY_LOG, sizeof(u8));

	vTaskStartScheduler();		// Never returns
	while(1)
		;
	return 0;
}
예제 #21
0
int main(int argc, char *argv[])
{
    char *pEnv;

    /*--------------------------------------------------------------------------
      중복 프로세스 체크
      ---------------------------------------------------------------------------*/
    if (dupcheckbyname(argv[0]) != 0) {
        fprintf(stderr, "oops!!! duplicated process(%s). So, exit\n", argv[0]);
        exit(0);
    }

    /*--------------------------------------------------------------------------
      시그널 등록
      ---------------------------------------------------------------------------*/
    setupSignal(vmct_signal_handler);

    /*--------------------------------------------------------------------------
      Init Environment
      ---------------------------------------------------------------------------*/
    /* get environment variable */
    if ((pEnv = getenv(BPAPP_ENV_NAME)) == NULL){
        fprintf(stderr, "'%s' environment variable not found(%s)\n", BPAPP_ENV_NAME, strerror(errno));
        exit(0);
    }

    /*--------------------------------------------------------------------------
      디버그 프린트 및 로그 초기화
      ---------------------------------------------------------------------------*/
#if 0
    InitDebug(pEnv, FMS_VMC | FMS_CLB, FMS_INFO1, DBG_TERMINAL | DBG_FILE | DBG_THIS);
#else
    InitDebug(pEnv, FMS_VMC | FMS_CLB, FMS_INFO1, DBG_FILE | DBG_THIS);
#endif

    xprint(FMS_VMC | FMS_LOOKS, "\n");
    xprint(FMS_VMC | FMS_LOOKS, "*********************************************************************\n");
    xprint(FMS_VMC | FMS_LOOKS, "     BPAPP-VMCT : START \n");
    xprint(FMS_VMC | FMS_LOOKS, "*********************************************************************\n");
    xprint(FMS_VMC | FMS_LOOKS, "\n");

    /* Init Global Variable */
    if (InitVariable() < 0) {
        xprint(FMS_VMC | FMS_FATAL, "Initialize failed, So exit\n");
        terminateLog();
        close_xprint();
        exit(0);
    }

    /* Init config from cfgFile */
    if (read_config(pEnv) < 0) {
        xprint(FMS_VMC | FMS_FATAL, "Global Configuration error, So exit\n");
        close_xprint();
        exit(0);
    }

    /* Init Mutex & MsgQCmdTmr */
    InitMutexCmdTmr();

#ifdef __DEBUG__
    DebugSizeofStruct();
    DebugVmctInfo();
    DebugVmProcessInfo();
#endif

    /*--------------------------------------------------------------------------
      pthread Create
     ---------------------------------------------------------------------------*/
    /* TCP Recv Control (HOST) */
    if (ThreadFlags[PTASK0] == FALSE) {
        pthread_attr_init(&Thread_Attr[PTASK0]);
        pthread_attr_setdetachstate(&Thread_Attr[PTASK0], PTHREAD_CREATE_DETACHED);
        pthread_create(&ThreadArray[PTASK0], &Thread_Attr[PTASK0], TcpRcvTask, NULL);
        pthread_attr_destroy(&Thread_Attr[PTASK0]);
        ThreadFlags[PTASK0] = TRUE;
    }

    /* System Info HOST Send */
    if (ThreadFlags[PTASK1] == FALSE) {
        pthread_attr_init(&Thread_Attr[PTASK1]);
        pthread_attr_setdetachstate(&Thread_Attr[PTASK1], PTHREAD_CREATE_DETACHED);
        pthread_create(&ThreadArray[PTASK1], &Thread_Attr[PTASK1], TcpSessionTask, NULL);
        pthread_attr_destroy(&Thread_Attr[PTASK1]);
        ThreadFlags[PTASK1] = TRUE;
    }

    /* Timer Cmd (TCP Reconnect) */
    if (ThreadFlags[PTASK2] == FALSE) {
        pthread_attr_init(&Thread_Attr[PTASK2]);
        pthread_attr_setdetachstate(&Thread_Attr[PTASK2], PTHREAD_CREATE_DETACHED);
        pthread_create(&ThreadArray[PTASK2], &Thread_Attr[PTASK2], TmrCmdTask, NULL);
        pthread_attr_destroy(&Thread_Attr[PTASK2]);
        ThreadFlags[PTASK2] = TRUE;
    }

    RunState = 1;

    while(RunState != 0) {
        nanoSleep(1000);
    }

    pthread_join(ThreadArray[PTASK0], NULL);
    pthread_join(ThreadArray[PTASK1], NULL);
    pthread_join(ThreadArray[PTASK2], NULL);

    return(0);
}
예제 #22
0
파일: main.cpp 프로젝트: Seldom/miranda-ng
extern "C" int __declspec(dllexport) Load(void)
{
	mir_getLP(&pluginInfo);

	YAMN_STATUS = ID_STATUS_OFFLINE;

	//	we get the Miranda Root Path
	PathToAbsoluteT( _T("."), szMirandaDir);

	// retrieve the current profile name
	CallService(MS_DB_GETPROFILENAMET, (WPARAM)_countof(ProfileName), (LPARAM)ProfileName);	//not to pass entire array to fcn
	TCHAR *fc = _tcsrchr(ProfileName, '.');
	if ( fc != NULL ) *fc = 0;

	//	we get the user path where our yamn-account.book.ini is stored from mirandaboot.ini file
	GetProfileDirectory(UserDirectory, _countof(UserDirectory));

	// Enumerate all the code pages available for the System Locale
	EnumSystemCodePages(EnumSystemCodePagesProc, CP_INSTALLED);
	CodePageNamesSupp = new _tcptable[CPLENSUPP];
	for (int i = 0, k = 0; i < CPLENALL; i++) {
		if (CodePageNamesAll[i].isValid) {
			CodePageNamesSupp[k] = CodePageNamesAll[i];
			k++;
	}	}

	// Registering YAMN as protocol
	PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
	pd.szName = YAMN_DBMODULE;
	pd.type = PROTOTYPE_VIRTUAL;
	Proto_RegisterModule(&pd);

	InitializeCriticalSection(&AccountStatusCS);
	InitializeCriticalSection(&FileWritingCS);
	InitializeCriticalSection(&PluginRegCS);

	if (NULL == (NoWriterEV = CreateEvent(NULL, TRUE, TRUE, NULL)))
		return 1;
	if (NULL == (WriteToFileEV = CreateEvent(NULL, FALSE, FALSE, NULL)))
		return 1;
	if (NULL == (ExitEV = CreateEvent(NULL, TRUE, FALSE, NULL)))
		return 1;

	PosX = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBPOSX, 0);
	PosY = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBPOSY, 0);
	SizeX = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBSIZEX, 800);
	SizeY = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBSIZEY, 200);

	HeadPosX = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSX, 0);
	HeadPosY = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSY, 0);
	HeadSizeX = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGSIZEX, 690);
	HeadSizeY = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGSIZEY, 300);
	HeadSplitPos = db_get_w(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSSPLIT, 250);

	optDateTime = db_get_b(NULL, YAMN_DBMODULE, YAMN_DBTIMEOPTIONS, optDateTime);

	// Create new window queues for broadcast messages
	YAMNVar.MessageWnds = WindowList_Create();
	YAMNVar.NewMailAccountWnd = WindowList_Create();
	YAMNVar.Shutdown = FALSE;

	hCurSplitNS = LoadCursor(NULL, IDC_SIZENS);
	hCurSplitWE = LoadCursor(NULL, IDC_SIZEWE);

#ifdef _DEBUG
	InitDebug();
#endif

	CreateServiceFunctions();

	SkinAddNewSoundEx(YAMN_NEWMAILSOUND, YAMN_DBMODULE, YAMN_NEWMAILSNDDESC);
	SkinAddNewSoundEx(YAMN_CONNECTFAILSOUND, YAMN_DBMODULE, YAMN_CONNECTFAILSNDDESC);

	HookEvents();

	LoadIcons();
	LoadPlugins();

	HOTKEYDESC hkd = {0};
	hkd.cbSize = sizeof(hkd);
	hkd.pszName = "YAMN_hotkey";
	hkd.pszService = MS_YAMN_FORCECHECK;
	hkd.pszSection = YAMN_DBMODULE;
	hkd.pszDescription = LPGEN("Check mail");
	hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_F11);
	Hotkey_Register(&hkd);

	//Create thread that will be executed every second
	if (!(SecTimer = SetTimer(NULL, 0, 1000, TimerProc)))
		return 1;

	return 0;
}
예제 #23
0
파일: main.c 프로젝트: Shaijan/Meridian59
void MainServer()
{
	InitInterfaceLocks(); 
	
	InitInterface(); /* starts a thread with the window */

   WrapInit();
	
	InitMemory(); /* memory needs channels in general, but need to start before config,
	so just be careful. */
	
	InitConfig();
	LoadConfig();		/* must be nearly first since channels use it */
	
	InitDebug();
	
	InitChannelBuffer();
	
	OpenDefaultChannels();
	
	lprintf("Starting %s\n",BlakServLongVersionString());
	
	InitClass();
	InitMessage();
	InitObject();
	InitList();
	InitTimer();
	InitSession();
	InitResource();
	InitRoomData();
	InitString();
	InitUser();
	InitAccount();
	InitNameID();
	InitDLlist();   
	InitSysTimer();
	InitMotd();
	InitLoadBof();
	InitTime();
	InitGameLock();
	InitBkodInterpret();
	InitBufferPool();
	InitTable();
	AddBuiltInDLlist();
	
	LoadMotd();
	LoadBof();
	LoadRsc();
	LoadKodbase();
	
	LoadAdminConstants();
	
	PauseTimers();
	
	if (LoadAll() == True)
	{
	/* this loaded_game_msg tells it to disconnect all blakod info about sessions,
		* that were logged on when we saved */
		
		SendTopLevelBlakodMessage(GetSystemObjectID(),LOADED_GAME_MSG,0,NULL);
		DoneLoadAccounts();
	}
	
	/* these must be after LoadAll and ClearList */
	InitCommCli(); 
	InitParseClient(); 
	InitProfiling();
	InitAsyncConnections();
	
	UpdateSecurityRedbook();
	
	UnpauseTimers();

	

	ServiceTimers();
	/* returns if server termiated */
	
	MainExitServer();
   WrapShutdown();
}
예제 #24
0
int _tmain( int argc, _TCHAR* argv[] )
{
    BOOL                bRet = FALSE;
    STARTUPINFO         startupInfo = { sizeof startupInfo };
    PROCESS_INFORMATION procInfo = { 0 };
    DEBUG_EVENT         event = { 0 };
    _EventCallback   callback;
    Exec        exec;
    HRESULT     hr = S_OK;
    LaunchInfo  info = { 0 };

    InitDebug();

    //char*   s1 = new ( _NORMAL_BLOCK, __FILE__, __LINE__ ) char[100];
    //strcpy( s1, "hello, yo!" );
    //char*   s2 = (char*) malloc( 300 );
    //strcpy( s2, "say what?" );

    callback.SetExec( &exec );

    hr = exec.Init( &callback );
    if ( FAILED( hr ) )
        goto Error;
    
#if 0
    bRet = CreateProcess( L"F:\\Users\\Magus\\Documents\\Visual Studio 2008\\Projects\\test1\\Debug\\test1.exe",
    //bRet = CreateProcess( L"F:\\Users\\Magus\\Documents\\Visual Studio 2008\\Projects\\test1\\x64\\Debug\\test1.exe",
        NULL,
        NULL,
        NULL,
        FALSE,
        DEBUG_ONLY_THIS_PROCESS,
        NULL,
        NULL,
        &startupInfo,
        &procInfo );
    if ( !bRet )
        goto Error;
#else

//#define TEST_APP64

#ifndef TEST_APP64
    info.CommandLine = L"\"F:\\Users\\Magus\\Documents\\Visual Studio 2008\\Projects\\Debugger1\\Debug\\test1.exe\"";
    info.Exe = L"F:\\Users\\Magus\\Documents\\Visual Studio 2008\\Projects\\Debugger1\\Debug\\test1.exe";
#else
    info.CommandLine =L"\"F:\\Users\\Magus\\Documents\\Visual Studio 2008\\Projects\\Debugger1\\x64\\Debug\\test1.exe\"";
    info.Exe = L"\"F:\\Users\\Magus\\Documents\\Visual Studio 2008\\Projects\\Debugger1\\x64\\Debug\\test1.exe\"";
#endif

    IProcess*   proc = NULL;

    //hr = exec.Attach( 5336, proc );
    hr = exec.Launch( &info, proc );
    if ( FAILED( hr ) )
        goto Error;
#endif

#if 0
    bRet = WaitForDebugEvent( &event, INFINITE );
    if ( !bRet )
        goto Error;
#else
    int stepCount = 0;

    for ( int i = 0; /* doesn't end */ ; i++ )
    {
        hr = exec.WaitForEvent( 1000 );
        if ( FAILED( hr ) )
            goto Error;

        hr = exec.DispatchEvent();
        if ( FAILED( hr ) )
            goto Error;

#if 1
        if ( proc->IsStopped() )
        {
            if ( callback.GetHitBp() )
            {
                stepCount++;

                //11728
                IModule*    mod = NULL;
                UINT_PTR    baseAddr = 0;

                callback.GetModule( mod );
                baseAddr = (UINT_PTR) mod->GetImageBase();
                mod->Release();

                //hr = exec.StepOut( proc, (void*) (baseAddr + 0x00011728) );
                //hr = exec.StepInstruction( proc, true );

                if ( stepCount > 1 )
                    hr = exec.StepInstruction( proc, true, true );
                else
                {
                    //113A5
                    AddressRange    range = { baseAddr + 0x0001137A, baseAddr + 0x000113A5 };
                    hr = exec.StepRange( proc, false, range, true );
                }

                if ( FAILED( hr ) )
                    goto Error;
            }
            else
            {
                hr = exec.Continue( proc, true );
                if ( FAILED( hr ) )
                    goto Error;
            }
        }
#endif

#if 1
        if ( i == 0 )
        {
            IModule*    mod = NULL;
            UINT_PTR    baseAddr = 0;

            callback.GetModule( mod );
            baseAddr = (UINT_PTR) mod->GetImageBase();

            // 0x003C137A, 0x003C1395
            // 1137A, 11395

            //exec.SetBreakpoint( proc, baseAddr + 0x0001138C, 255 );
            exec.SetBreakpoint( proc, baseAddr + 0x0001137A );
            //exec.SetBreakpoint( proc, baseAddr + 0x00011395, 129 );

            mod->Release();
        }
#endif
    }
#endif

Error:
    //exec.Detach( proc );

    // when the debugger goes away, so does the debuggee automatically

    //if ( procInfo.hThread != NULL )
    //{
    //    CloseHandle( procInfo.hThread );
    //}

    //if ( procInfo.hProcess != NULL )
    //{
    //    TerminateProcess( procInfo.hProcess, MAXINT );
    //    CloseHandle( procInfo.hProcess );
    //}

    if ( proc != NULL )
        proc->Release();

    return 0;
}
예제 #25
0
파일: main.cpp 프로젝트: samboy/Oblige
int main(int argc, char **argv)
{
	try
	{
		// skip program name
		argv++, argc--;

		ArgvInit(argc, (const char **)argv);
	 
		InitDebug(ArgvFind(0, "debug") >= 0);
		InitEndian();

		if (ArgvFind('?', NULL) >= 0 || ArgvFind('h', "help") >= 0)
		{
			ShowTitle();
			ShowInfo();
			exit(1);
		}

		InitFLTK();

		SetDefaults();
		SetupRandom();

		int W = 40;
		int H = 40;

		GetMapSize(&W, &H);

		PrintDebug("Map size %dx%d\n\n", W, H);

		the_world = new world_c(W, H);

		environ_build::CreateEnv();
		area_build::CreateAreas();
		island_build::CreateIslands();
		island_build::Cleanup();

  		stage_build::CreateStages();
		path_build::CreatePaths();
		room_build::CreateRooms();

		if (ArgvFind('g', "gui") >= 0)
		{
			guix_win = new Guix_MainWin(PROG_NAME);

			// run the GUI until the user quits
			while (! guix_win->want_quit)
				Fl::wait();
		}

		CreateWAD();
	}
	catch (const char * err)
	{
		DisplayError("%s", err);
	}
#if 1
	catch (assert_fail_c err)
	{
		DisplayError("Sorry, an internal error occurred:\n%s", err.GetMessage());
	}
	catch (...)
	{
		DisplayError("An unknown problem occurred (UI code)");
	}
#endif

	delete guix_win;

	TermDebug();

	return main_result;
}
예제 #26
0
void be_init()
/* Main routine for Interpreter back end */
{
    char *p;
    int i;
    long c;
    char *temp;

    clocks_per_sec = CLOCKS_PER_SEC;
#ifdef ELCC
    clk_tck = CLOCKS_PER_SEC;
#else
#ifdef CLK_TCK
    clk_tck = CLK_TCK;
#else
    clk_tck = sysconf(_SC_CLK_TCK);
#endif
#endif

#ifdef EWINDOWS

#ifdef EBORLAND
    _control87(MCW_EM,MCW_EM);
#endif
#endif
    TempErrName = (char *)malloc(8); // uses malloc, not EMalloc
    strcpy(TempErrName, "ex.err"); // can change

    eudir = getenv("EUDIR");
    if (eudir == NULL) {
#ifdef ELINUX
	// should check search PATH for euphoria/bin ?
	eudir = getenv("HOME");
	if (eudir == NULL) {
	    eudir = "euphoria";
	}
	else {
	    p = (char *)malloc(strlen(eudir)+12);
	    strcpy(p, eudir);
	    strcat(p, "/euphoria");
	    eudir = p;
	}
#else
	eudir = "\\EUPHORIA";
#endif
    }

#if defined(ELINUX) || defined(EDJGPP)
    strcpy(main_path, file_name[1]); // FOR NOW!
#else
    (void)_fullpath(main_path, file_name[1], PATH_MAX+1);
#endif
    for (p = main_path+strlen(main_path)-1;
	 *p != '\\' && *p != '/' && p >= main_path;
	 p--)
	;
    *(p+1) = '\0'; /* keep the path, truncate off the final name */

#ifdef EBORLAND
    PatchCallc();  // ? translator init does this
#endif

    InitExecute();
    InitDebug();
    InitTraceWindow();
}
예제 #27
0
glbsp_ret_e GlbspBuildNodes(const nodebuildinfo_t *info,
    const nodebuildfuncs_t *funcs, volatile nodebuildcomms_t *comms)
{
  char *file_msg;

  glbsp_ret_e ret = GLBSP_E_OK;

  cur_info  = info;
  cur_funcs = funcs;
  cur_comms = comms;

  cur_comms->total_big_warn = 0;
  cur_comms->total_small_warn = 0;

  // clear cancelled flag
  comms->cancelled = FALSE;

  // sanity check
  if (!cur_info->input_file  || cur_info->input_file[0] == 0 ||
      !cur_info->output_file || cur_info->output_file[0] == 0)
  {
    SetErrorMsg("INTERNAL ERROR: Missing in/out filename !");
    return GLBSP_E_BadArgs;
  }

  InitDebug();
  InitEndian();
 
  if (info->missing_output)
    PrintMsg("* No output file specified. Using: %s\n\n", info->output_file);

  if (info->same_filenames)
    PrintMsg("* Output file is same as input file. Using -loadall\n\n");

  // opens and reads directory from the input wad
  ret = ReadWadFile(cur_info->input_file);

  if (ret != GLBSP_E_OK)
  {
    TermDebug();
    return ret;
  }

  if (CountLevels() <= 0)
  {
    CloseWads();
    TermDebug();

    SetErrorMsg("No levels found in wad !");
    return GLBSP_E_Unknown;
  }
   
  PrintMsg("\n");
  PrintVerbose("Creating nodes using tunable factor of %d\n", info->factor);

  DisplayOpen(DIS_BUILDPROGRESS);
  DisplaySetTitle("glBSP Build Progress");

  file_msg = UtilFormat("File: %s", cur_info->input_file);
 
  DisplaySetBarText(2, file_msg);
  DisplaySetBarLimit(2, CountLevels() * 10);
  DisplaySetBar(2, 0);

  UtilFree(file_msg);
  
  cur_comms->file_pos = 0;
  
  // loop over each level in the wad
  while (FindNextLevel())
  {
    ret = HandleLevel();

    if (ret != GLBSP_E_OK)
      break;

    cur_comms->file_pos += 10;
    DisplaySetBar(2, cur_comms->file_pos);
  }

  DisplayClose();

  // writes all the lumps to the output wad
  if (ret == GLBSP_E_OK)
  {
    ret = WriteWadFile(cur_info->output_file);

    // when modifying the original wad, any GWA companion must be deleted
    if (ret == GLBSP_E_OK && cur_info->same_filenames)
      DeleteGwaFile(cur_info->output_file);

    PrintMsg("\n");
    PrintMsg("Total serious warnings: %d\n", cur_comms->total_big_warn);
    PrintMsg("Total minor warnings: %d\n", cur_comms->total_small_warn);

    ReportFailedLevels();
  }

  // close wads and free memory
  CloseWads();

  TermDebug();

  cur_info  = NULL;
  cur_comms = NULL;
  cur_funcs = NULL;

  return ret;
}