#endif
#ifdef _L7200_IAL
{\, InitL7200Input, TermL7200Input}, #endif
#ifdef _ARM3000_IAL
{\, InitARM3000Input, TermARM3000Input}, #endif
#ifdef _EMBEST2410_IAL
{\, InitEMBEST2410Input, TermEMBEST2410Input}, #endif
#ifdef _EM8620_IAL
{\, InitEm8620Input, TermEm8620Input}, #endif
#ifdef _EM86_IAL
{\, InitEm86Input, TermEm86Input}, #endif
#ifdef _EM85_IAL
{\, InitEm85Input, TermEm85Input}, #endif
#ifdef _FFT7202_IAL
{\, InitFFTInput, TermFFTInput}, #endif
#ifdef _UTPMC_IAL
{\, InitUTPMCInput, TermUTPMCInput}, #endif
#ifdef _DM270_IAL
{\, InitDM270Input, TermDM270Input}, #endif
#ifdef _EVMV10_IAL
{\, InitXscaleEVMV10Input, TermXscaleEVMV10Input}, #endif
#ifdef _FXRM9200_IAL
{\, InitRm9200Input, TermRm9200Input}, #endif
#ifdef _ABSSIG_IAL
{\, InitABSSIGInput, TermABSSIGInput}, #endif
#ifdef _SKYEYE_EP7312_IAL
{\, InitSkyEyeEP7312Input, TermSkyEyeEP7312Input}, #endif
#ifdef _FIGUEROA_IAL
{\, InitFiguerOAInput, TermFiguerOAInput}, #endif
#ifdef _HI3510_IAL
{\, InitHI3510Input, TermHI3510Input}, #endif
#ifdef _HI3610_IAL
{\, InitHI3610Input, TermHI3610Input}, #endif
/* ... end of board-specific IAL engines */ };
3、函数流程
INPUT* __mg_cur_input;
#define NR_INPUTS (sizeof (inputs) / sizeof (INPUT))
int InitIAL (void) {
int i;
char engine [LEN_ENGINE_NAME + 1]; //输入引擎名称 char mdev [MAX_PATH + 1]; //路径 char mtype[LEN_MTYPE_NAME + 1]; //类型
if (NR_INPUTS == 0) //如果没有输入引擎,返回错误信息 return ERR_NO_ENGINE;
//将system的ial_engine段的值复制给engine指向的地址
if (GetMgEtcValue (\, \, engine, LEN_ENGINE_NAME) < 0) return ERR_CONFIG_FILE;
if (GetMgEtcValue (\, \, mdev, MAX_PATH) < 0) return ERR_CONFIG_FILE;
if (GetMgEtcValue (\, \, mtype, LEN_MTYPE_NAME) < 0) return ERR_CONFIG_FILE;
//找到与engine相等的字符串,由此来确定当前的输入引擎__mg_cur_input for (i = 0; i < NR_INPUTS; i++) {
if (strncmp (engine, inputs[i].id, LEN_ENGINE_NAME) == 0) { __mg_cur_input = inputs + i; break; } }
//如果当前输入引擎为空 if (__mg_cur_input == NULL) {
fprintf (stderr, \, engine); if (NR_INPUTS) { //输入引擎数组不为空
__mg_cur_input = inputs;//当前输入引擎为输入引擎数组的第一个 fprintf (stderr, \, __mg_cur_input->id); }
else
return ERR_NO_MATCH; }
//将mdev存储的路径字符串复制给__mg_cur_input->mdev strcpy (__mg_cur_input->mdev, mdev);
//根据输入引擎选择对应的输入初始化函数对输入进行初始化 if (!IAL_InitInput (__mg_cur_input, mdev, mtype)) { fprintf (stderr, \); return ERR_INPUT_ENGINE; } return 0; }
4、QVFB输入引擎初始化InitQVFBInput
BOOL InitQVFBInput (INPUT* input, const char* mdev, const char* mtype) {
char file [50]; int display;
fprintf(stderr,\); #ifdef _INCORE_RES
/* Define if build MiniGUI for no file I/O system */ /* #undef _INCORE_RES */ //#define _INCORE_RES 1 display = 0; #endif
/* open mouse pipe */
sprintf (file, QT_VFB_MOUSE_PIPE, display); if ((mouse_fd = open (file, O_RDONLY)) < 0) {
fprintf (stderr, \); return FALSE; }
/* open keyboard pipe */
sprintf (file, QT_VFB_KEYBOARD_PIPE, display); if ((kbd_fd = open (file, O_RDONLY)) < 0) {
fprintf (stderr, \); return FALSE; }
input->update_mouse = mouse_update; input->get_mouse_xy = mouse_getxy; input->set_mouse_xy = NULL;
input->get_mouse_button = mouse_getbutton; input->set_mouse_range = NULL; input->suspend_mouse= NULL; input->resume_mouse = NULL;
input->update_keyboard = keyboard_update; input->get_keyboard_state = keyboard_getstate; input->suspend_keyboard = NULL; input->resume_keyboard = NULL; input->set_leds = NULL;
input->wait_event = wait_event;
init_code_map ();
return TRUE; }
5、GetValueFromEtc
typedef struct _ETC_S {
/** Allocated number of sections */ int sect_nr_alloc; /** Number of sections */ int section_nr; /** Pointer to section arrays */ PETCSECTION sections; } ETC_S;
typedef struct _ETCSECTION {
/** Allocated number of keys */ int key_nr_alloc; /** Key number in the section */ int key_nr; /** Name of the section */ char *name; /** Array of keys */
char** keys; /** Array of values */
char** values; } ETCSECTION;
typedef ETCSECTION* PETCSECTION; typedef unsigned int GHANDLE; * Parameter:
* pEtcFile: etc file path name. * pSection: Section name. * pKey: Key name.
* pValue: The buffer will store the value of the key. * iLen: The max length of value string. * Return:
* int meaning
* ETC_FILENOTFOUND The etc file not found. * ETC_SECTIONNOTFOUND The section is not found. * ETC_EKYNOTFOUND The Key is not found. * ETC_OK OK.
在pSection指向的分区的pKey段找到iLen长度的字符串赋给pValue指向的字符串 int GUIAPI GetValueFromEtc (GHANDLE hEtc, const char* pSection, const char* pKey, char* pValue, int iLen) {
int i, empty_section = -1; ETC_S *petc = (ETC_S*) hEtc; PETCSECTION psect = NULL;
if (!petc || !pValue) return -1;
for (i=0; i
if (strcmp (psect->name, pSection) == 0) { break; } }
if (i >= petc->section_nr) { if (iLen > 0)
return ETC_SECTIONNOTFOUND; else {
if (petc->sect_nr_alloc <= 0) return ETC_READONLYOBJ;
if (empty_section >= 0)
psect = petc->sections + empty_section; else {
psect = etc_NewSection (petc); }
if (psect->name == NULL) { psect->key_nr = 0;
psect->name = FixStrDup (pSection);
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库minigui代码分析(5)在线全文阅读。
相关推荐: