📄 project.c
字号:
tmp2 = strstr(buffer,source);
while(tmp2!=0)
{
count ++;
buffer = tmp2+slen;
tmp2 = strstr(buffer,source);
}
buffer = buffer1+0;
tmp2 = 0;
if(count >0)
{
outlen = *nLen -count;
tmp1 = (char*)malloc(outlen);
tmp2 = strstr(buffer,source);
while(tmp2!=0)
{
len = tmp2-buffer;
memcpy(tmp1+pos,buffer,len);
pos+=len;
tmp1[pos]=target;
pos++;
buffer = tmp2+slen;
tmp2 = strstr(buffer,source);
if(tmp2 ==0)
{
memcpy(tmp1+pos,buffer,(*nLen-(buffer-buffer1)));
}
}
if(*pStrObj)
free(*pStrObj);
*nLen = outlen;
*pStrObj = (char*)malloc(outlen);
memcpy(*pStrObj,tmp1,outlen);
if(tmp1)
free(tmp1);
}
free (buffer1);
}int GetStringLen(const char* str)
{
int len ;
len = 0;
if(!str)
return 0;
while(str[len]!='\n')
len++;
return len;
}int PushInfo(WinInfo* info)
{
int i = 0;
WinInfoList p;
WinInfoList prv;
WinInfoList * address;
if(info==0)
return -1;
address = &gWinInfoList;
p = gWinInfoList;
prv = p;
while(p){
i++;
prv = p;
address = &p->next;
p = p->next;
}
p = (WinInfoList )malloc(sizeof (struct WININFOLIST));
if(!p)
return 0;
memset(p,0,sizeof( struct WININFOLIST));
p->info_p = info;
*address = p;
i ++;
return i;
}
WinInfo* SearchInfo(HWND id)
{
WinInfoList wl ;
if(id <=0)
return NULL;
wl = gWinInfoList;
while(wl)
{
WinInfo* info = (WinInfo*)wl->info_p;
if(!info || info->id<=0)
{
wl = wl->next;
continue;
}
if(info->id == id)
return info;
wl = wl->next;
}
return NULL;
}
void FreeInfo()
{
WinInfoList wl ,wlnext;
wl = gWinInfoList;
while(wl)
{
WinInfo* info = (WinInfo*)wl->info_p;
if(!info)
free(info);
wl = wl->next;
}
wl = gWinInfoList;
if(wl)
{
wlnext = wl->next;
while(wl)
{
free(wl);
wl = wlnext;
wlnext = wl?wl->next:NULL;
}
}
return ;
}BOOL CreatePageCreate(const char* objstring)
{
_INDEX index;
int page_no;
int nlen ;
int pos =OBJECT_LEN;
index = GetIndexInformation(objstring,&pos);
nlen = GetStringLen(objstring);
if(index._Type != 0 )
return FALSE;
while(index._Length !=0 && pos <nlen)
{
page_no = GetLongVal(objstring,&pos);
CreatePage(&g_page[page_no]);
if(pos+LENGTH_LEN >nlen)
break;
index = GetIndexInformation(objstring,&pos);
if(index._Type != 0 )
return FALSE;
}
return TRUE;
}BOOL CreatePageCommunication(const char* objstring)
{
_INDEX index;
int mode =0;
STRING ip = 0;
STRING mask = 0;
int pos =OBJECT_LEN;
int nReturn = TRUE;
index = GetIndexInformation(objstring,&pos);
if(index._Type != 0 )
{
nReturn = FALSE;
goto FAILED;
}
mode = GetLongVal(objstring,&pos);
index = GetIndexInformation(objstring,&pos);
if(index._Type!=1) {
nReturn = FALSE;
goto FAILED;
}
ip = GetStringVal(objstring,index._Length,&pos,0);
index = GetIndexInformation(objstring,&pos);
if(index._Type!=1) {
nReturn = FALSE;
goto FAILED;
}
mask = GetStringVal(objstring,index._Length,&pos,0);
Misc_Initialize(&g_miscii,mode,ip,mask);
FAILED:
if(ip)
free(ip);
if(mask)
free (mask);
return nReturn ;
}
int Misc_init(Miscii* misc)
{
MAINWINCREATE CreateInfo;
misc->alpha[0] = 255;
misc->alpha[1] = 255;
misc->bIdDisplay = 0;
misc->bOneway = 1;
misc->color_end[0] = 0x000000;
misc->color_end[1] = 0x555555;
misc->color_margin[0] = 0x000000;
misc->color_margin[1] = 0x555555;
misc->color_middle[0] = 0xAAAAAA;
misc->color_middle[1] = 0xFFFFFF;
misc->color_start[0] = 0xAAAAAA;
misc->color_start[0] = 0xFFFFFF;
misc->ip_adress = 0;
misc->m_rfid = 0x40;
misc->m_sleep = 3600;
misc->m_Styletheme[0] = 0;
misc->m_Styletheme[1] = 0;
misc->m_ForPNG[0] = 0;
misc->m_ForPNG[1] = 0;
misc->mask_address = 0;
misc->mode = 3;
misc->point_start_x[0] = 0;
misc->point_start_y[0] = 0;
misc->point_end_x[0] = 0;
misc->point_end_y[0] = 100;
misc->point_start_x[1] = 0;
misc->point_start_y[1] = 0;
misc->point_end_x[1] = 0;
misc->point_end_y[1] = 100;
misc->point_marginone_x[0] = 0;
misc->point_marginone_y[0] = 0;
misc->point_margintwo_x[0] = 0;
misc->point_margintwo_y[0] = 100;
misc->point_marginone_x[1] = 0;
misc->point_marginone_y[1] = 0;
misc->point_margintwo_x[1] = 0;
misc->point_margintwo_y[1] = 100;
misc->version = 0;
misc->color_image[0] = 0xAAAAAA;
misc->color_image[1] = 0x555555;
misc->color_image_active[0] = 0x555555;
misc->color_image_active[1] = 0xAAAAAA;
misc->m_switch_two[0] = 0;
misc->m_switch_two[1] = 0;
misc->m_switch_three[0] = 0;
misc->m_switch_three[1] = 0;
CreateInfo.dwStyle = WS_OVERLAPPED;
CreateInfo.dwExStyle = WS_EX_NONE;
CreateInfo.spCaption = "miniGUIForTouchPanel";
CreateInfo.hMenu = 0;
CreateInfo.hCursor = GetSystemCursor(0);
CreateInfo.hIcon = 0;
CreateInfo.MainWindowProc = miniGUIWinProc;
CreateInfo.lx = 0;
CreateInfo.ty = 0;
CreateInfo.rx = 640;
CreateInfo.by = 480;
CreateInfo.iBkColor = COLOR_lightwhite;
CreateInfo.dwAddData = 0;
CreateInfo.hHosting = HWND_DESKTOP;
misc->g_wndMain = CreateMainWindow (&CreateInfo);
if (misc->g_wndMain == HWND_INVALID)
return -1;
ShowWindow(misc->g_wndMain,SW_SHOW );
return 1;
}
int Misc_Initialize(Miscii* misc,int mode,STRING ip,STRING mask)
{
if(!ip || !mask)
return 0;
// misc->mode = mode;
misc->mode = 0; if(misc->ip_adress)
free(misc->ip_adress);
misc->ip_adress = (STRING) malloc(strlen(ip)+1);
if(0 == misc->ip_adress)
{
Misc_destroy();
return 0;
}
memset(misc->ip_adress,0,strlen(ip)+1);
strcpy(misc->ip_adress,ip);
if(misc->mask_address)
free(misc->mask_address);
misc->mask_address = (STRING) malloc(strlen(mask)+1);
if(0 == misc->mask_address)
{
Misc_destroy();
return 0;
}
memset(misc->mask_address,0,strlen(mask)+1);
strcpy(misc->mask_address ,mask);
return 1;
}int Misc_Initialize2(Miscii* misc,int version)
{
misc->version = version; return 0;
}
int Misc_Initialize3(Miscii* misc, int style0,int style1,\
int alpha0,int alpha1,\
unsigned long color_start0,\
unsigned long color_start1,\
unsigned long color_end0,\
unsigned long color_end1,\
int point_start_x0,\
int point_start_x1,\
int point_start_y0,\
int point_start_y1,\
int point_end_x0,\
int point_end_x1,\
int point_end_y0,\
int point_end_y1,\
unsigned long color_margin0,\
unsigned long color_margin1,\
unsigned long color_middle0,\
unsigned long color_middle1,\
int point_marginone_x0,\
int point_marginone_x1,\
int point_marginone_y0,\
int point_marginone_y1,\
int point_margintwo_x0,\
int point_margintwo_x1,\
int point_margintwo_y0,\
int point_margintwo_y1,\
STRING m_Styletheme0,\
STRING m_Styletheme1,\
int png0,\
int png1,\
unsigned long image0,\
unsigned long image1,\
unsigned long image_active0,\
unsigned long image_active1,\
int switchtwo0,\
int switchtwo1,\
int switchthree0,\
int switchthree1
)
{
misc->style[0 ] = style0;
misc->style[1 ] = style1;
misc->alpha[0 ] = alpha0;
misc->alpha[1 ] = alpha1;
misc->color_start[0 ] = color_start0;
misc->color_start[1 ] = color_start1;
misc->color_end[0 ] = color_end0;
misc->color_end[1 ] = color_end1;
misc->point_start_x[0 ] = point_start_x0;
misc->point_start_x[1 ] = point_start_x1;
misc->point_start_y[0 ] = point_start_y0;
misc->point_start_y[1 ] = point_start_y1;
misc->point_end_x[0 ] = point_end_x0;
misc->point_end_x[1 ] = point_end_x1;
misc->point_end_y[0 ] = point_end_y0;
misc->point_end_y[1 ] = point_end_y1;
misc->color_margin[0 ] = color_margin0;
misc->color_margin[1 ] = color_margin1;
misc->color_middle[0 ] = color_middle0;
misc->color_middle[1 ] = color_middle1;
misc->point_marginone_x[0 ] = point_marginone_x0;
misc->point_marginone_x[1 ] = point_marginone_x1;
misc->point_marginone_y[0 ] = point_marginone_y0;
misc->point_marginone_y[1 ] = point_marginone_y1;
misc->point_margintwo_x[0 ] = point_margintwo_x0;
misc->point_margintwo_x[1 ] = point_margintwo_x1;
misc->point_margintwo_y[0 ] = point_margintwo_y0;
misc->point_margintwo_y[1 ] = point_margintwo_y1;
if(m_Styletheme0)
{
misc->m_Styletheme[0 ] = (STRING) malloc(strlen(m_Styletheme0)+1);
memset(misc->m_Styletheme[0 ],0,strlen(m_Styletheme0)+1);
strcpy(misc->m_Styletheme[0 ],m_Styletheme0);
}
if(m_Styletheme1)
{
misc->m_Styletheme[1 ] = (STRING) malloc(strlen(m_Styletheme1)+1);
memset(misc->m_Styletheme[1 ],0,strlen(m_Styletheme1)+1);
strcpy(misc->m_Styletheme[1 ],m_Styletheme1);
}
misc->m_ForPNG[0] = png0;
misc->m_ForPNG[1] = png1;
misc->color_image[0] = image0;
misc->color_image[1] = image1;
misc->color_image_active[0] = image_active0;
misc->color_image_active[1] = image_active1;
misc->m_switch_two[0] = switchtwo0;
misc->m_switch_two[1] = switchtwo1;
misc->m_switch_three[0] = switchthree0;
misc->m_switch_three[1] = switchthree1;
return 1;
}
int Misc_destroy()
{
if(g_miscii.mask_address)
free (g_miscii.mask_address);
if(g_miscii.ip_adress )
free (g_miscii.ip_adress);
g_miscii.ip_adress = 0;
g_miscii.mask_address = 0;
g_miscii.version = 0;
g_miscii.mode = 0; return 0;
}BOOL CreatePageSub2(const char* objstring)
{
BOOL nReturn;
long Position_left,Position_top,Position_right,Position_bottom;
unsigned char bStyle;
long Grid_width,Grid_height;
unsigned long dwBackgroundColor;
unsigned char bStatus;
char* ImageItem_ImageName;
unsigned long ImageItem_dwForeColor,ImageItem_dwBackColor;
unsigned char ImageItem_bStatus;
unsigned long ImageItem_dwTransparenceColor;
char* szPageName;
unsigned int Comm_Type;
int feedback_type;
int nID,delay,fashion;
char* groupid;
_INDEX index;
int pos =OBJECT_LEN;
fashion = 0;
nReturn = TRUE;
ImageItem_ImageName=0;
szPageName=0;
groupid=0;
// position left.
index = GetIndexInformation(objstring,&pos);
if(index._Type!=0)
{
nReturn = FALSE;
goto FAILED;
}
Position_left = GetLongVal(objstring,&pos);
// position top.
index = GetIndexInformation(objstring,&pos);
if(index._Type!=0)
{
nReturn = FALSE;
goto FAILED;
}
Position_top = GetLongVal(objstring,&pos);
//// position right.
index = GetIndexInformation(objstring,&pos);
if(index._Type!=0)
{
nReturn = FALSE;
goto FAILED;
}
Position_right = GetLongVal(objstring,&pos);
//// position bottom
index = GetIndexInformation(objstring,&pos);
if(index._Type!=0)
{
nReturn = FALSE;
goto FAILED;
}
Position_bottom = GetLongVal(objstring,&pos);
// main page flag.
index = GetIndexInformation(objstring,&pos);
if(index._Type!=0)
{
nReturn = FALSE;
goto FAILED;
}
bStyle =(unsigned char) GetLongVal(objstring,&pos);
//// grid size.cx.
index = GetIndexInformation(objstring,&pos);
if(index._Type!=0)
{
nReturn = FALSE;
goto FAILED;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -