Ejemplo n.º 1
0
RPSTR_FUNC(Bool32) RPSTR_SetImportData(uint32_t dwType, void * pData)
{

  wLowRC = RPSTR_ERR_NO;
#define CASE_DATA(a,b,c)	case a: c = *(b *)pData; break
#define CASE_PDATA(a,b,c)	case a: c = (b)pData; break
	switch(dwType)
	{
	CASE_DATA(RPSTR_Bool32_Fax100,Bool32,gbFax100);
    case    RPSTR_FNIMP_ALLOC:
        my_alloc=pData;
        break;
    case    RPSTR_FNIMP_REALLOC:
        my_realloc=pData;
        break;
    case    RPSTR_FNIMP_FREE:
        my_free=pData;
        break;

	// 12.06.2002 E.P.
    case    RPSTR_FNIMP_LANGUAGE:
        language=*(uchar*)pData;
        set_lang4page(language);
        break;

#undef CASE_DATA
#undef CASE_PDATA

	default:
    wLowRC = RPSTR_ERR_NOTIMPLEMENT;
		return FALSE;
	}
return TRUE;
}
Ejemplo n.º 2
0
PUMA_FUNC(Bool) PUMA_SetImportData(uint32_t dwType, void * pData)
{
	Bool rc = TRUE;

	gwRC = 0;

#define CASE_DATA(a,b,c)		case a: c = *(b *)pData; break
#define CASE_DATAUP(a,b,c,d)	case a: if(c != *(b *)pData){c = *(b *)pData; SetUpdate(d,FLG_UPDATE_NO);}; break
#define CASE_PDATA(a,b,c)		case a: c = (b)pData; break

	switch(dwType)
	{
	CASE_DATAUP(PUMA_Word32_Language,uint32_t,gnLanguage,FLG_UPDATE_CCOM);
	CASE_DATA(PUMA_Bool32_Speller,Bool32,gbSpeller);
	CASE_DATAUP(PUMA_Bool32_OneColumn,Bool32,gbOneColumn,FLG_UPDATE_CPAGE);
	CASE_DATAUP(PUMA_Bool32_Fax100,Bool32,gbFax100,FLG_UPDATE_CCOM);
	CASE_DATAUP(PUMA_Bool32_DotMatrix,Bool32,gbDotMatrix,FLG_UPDATE_CCOM);
	CASE_DATA(PUMA_Bool32_Bold,Bool32,gbBold);
	CASE_DATA(PUMA_Bool32_Italic,Bool32,gbItalic);
	CASE_DATA(PUMA_Bool32_Size,Bool32,gbSize);
	CASE_DATA(PUMA_Bool32_Format,Bool32,gbFormat);
	CASE_PDATA(PUMA_pchar_UserDictName,char *,gpUserDictName);
	CASE_PDATA(PUMA_pchar_SerifName,char *,gpSerifName);
	CASE_PDATA(PUMA_pchar_SansSerifName,char *,gpSansSerifName);
	CASE_PDATA(PUMA_pchar_CourierName,char *,gpCourierName);
	CASE_DATAUP(PUMA_Word32_Pictures,uint32_t,gnPictures,FLG_UPDATE_CPAGE);
	CASE_DATAUP(PUMA_Word32_Tables,uint32_t,gnTables,FLG_UPDATE_CPAGE);
	CASE_DATA(PUMA_Word32_Format,Bool32,gnFormat);
	CASE_DATA(PUMA_Word8_Format,uchar,gnUnrecogChar);
	CASE_PDATA(PUMA_FNPUMA_ProgressStart, FNPUMA_ProgressStart ,fnProgressStart);
	CASE_PDATA(PUMA_FNPUMA_ProgressFinish,FNPUMA_ProgressFinish,fnProgressFinish);
	CASE_PDATA(PUMA_FNPUMA_ProgressStep,  FNPUMA_ProgressStep  ,fnProgressStep);
	CASE_DATAUP(PUMA_Bool32_AutoRotate,Bool32,gbAutoRotate,FLG_UPDATE);
	CASE_DATA(PUMA_Handle_CurrentEdPage,Handle,ghEdPage);
	 default:
		SetReturnCode_puma(IDS_ERR_NOTIMPLEMENT);
		rc = FALSE;
	}
	// Связь с предыдущими версиями
	switch(dwType)
	{
	case PUMA_Bool32_Format:
		gnFormat = gbFormat    ? gnFormat : 64;
		break;
	case PUMA_Word32_Format:
		gbFormat = gnFormat==64 ? 0 : 1;
		break;
	}

#undef CASE_DATA
#undef CASE_PDATA

return rc;
}
Ejemplo n.º 3
0
uint32
garmin_pack ( garmin_data * data, uint8 ** buf )
{
    uint8 * start;
    uint8 * finish;
    uint8 * marker;
    uint32  bytes = 0;

    if ( garmin_data_size(data) == 0 ) return 0;

    /* OK, we must know how to serialize this data.  Let's go for it. */

#define CASE_DATA(x)                        \
  case data_D##x:                           \
    {                                       \
      put_uint32(*buf,data->type);          \
      *buf += 4;                            \
      marker = *buf;                        \
      *buf += 4;                            \
      start = *buf;                         \
      garmin_pack_d##x(data->data,buf);     \
      finish = *buf;                        \
      bytes = finish-start;                 \
      put_uint32(marker,bytes);             \
      bytes += 8;                           \
    }                                       \
    break

    switch ( data->type ) {
        CASE_DATA(list);
        CASE_DATA(100);
        CASE_DATA(101);
        CASE_DATA(102);
        CASE_DATA(103);
        CASE_DATA(104);
        CASE_DATA(105);
        CASE_DATA(106);
        CASE_DATA(107);
        CASE_DATA(108);
        CASE_DATA(109);
        CASE_DATA(110);
        CASE_DATA(120);
        CASE_DATA(150);
        CASE_DATA(151);
        CASE_DATA(152);
        CASE_DATA(154);
        CASE_DATA(155);
        CASE_DATA(200);
        CASE_DATA(201);
        CASE_DATA(202);
        CASE_DATA(210);
        CASE_DATA(300);
        CASE_DATA(301);
        CASE_DATA(302);
        CASE_DATA(303);
        CASE_DATA(304);
        CASE_DATA(310);
        CASE_DATA(311);
        CASE_DATA(312);
        CASE_DATA(400);
        CASE_DATA(403);
        CASE_DATA(450);
        CASE_DATA(500);
        CASE_DATA(501);
        CASE_DATA(550);
        CASE_DATA(551);
        CASE_DATA(600);
        CASE_DATA(650);
        CASE_DATA(700);
        CASE_DATA(800);
        CASE_DATA(906);
        CASE_DATA(1000);
        CASE_DATA(1001);
        CASE_DATA(1002);
        CASE_DATA(1003);
        CASE_DATA(1004);
        CASE_DATA(1005);
        CASE_DATA(1006);
        CASE_DATA(1007);
        CASE_DATA(1008);
        CASE_DATA(1009);
        CASE_DATA(1010);
        CASE_DATA(1011);
        CASE_DATA(1012);
        CASE_DATA(1013);
        CASE_DATA(1015);
    default:
        printf("garmin_pack: data type %d not supported\n",data->type);
        break;
    }
#undef CASE_DATA

    return bytes;
}
Ejemplo n.º 4
0
PUMA_FUNC(Bool) PUMA_GetExportData(uint32_t dwType, void * pData)
{
	Bool rc = TRUE;

	gwRC = 0;

#define CASE_FUNCTION(a)	case PUMA_FN##a:	*(FN##a *)pData = a; break
#define CASE_DATA(a,b,c)	case a: *(b *)pData = c; break

	switch(dwType)
	{
	CASE_FUNCTION(PUMA_XOpen);
	CASE_FUNCTION(PUMA_XClose);
	CASE_FUNCTION(PUMA_XPageAnalysis);
	CASE_FUNCTION(PUMA_XFinalRecognition);
	CASE_FUNCTION(PUMA_XSave);
	CASE_FUNCTION(PUMA_EnumLanguages);
	CASE_FUNCTION(PUMA_EnumFormats);
	CASE_FUNCTION(PUMA_EnumCodes);
	CASE_DATA(PUMA_Word32_Language,uint32_t,gnLanguage);
	CASE_DATA(PUMA_Bool32_Speller,Bool32,gbSpeller);
	CASE_DATA(PUMA_Bool32_OneColumn,Bool32,gbOneColumn);
	CASE_DATA(PUMA_Bool32_Fax100,Bool32,gbFax100);
	CASE_DATA(PUMA_Bool32_DotMatrix,Bool32,gbDotMatrix);
	CASE_DATA(PUMA_Bool32_Bold,Bool32,gbBold);
	CASE_DATA(PUMA_Bool32_Italic,Bool32,gbItalic);
	CASE_DATA(PUMA_Bool32_Size,Bool32,gbSize);
	CASE_DATA(PUMA_Bool32_Format,Bool32,gbFormat);
	CASE_DATA(PUMA_pchar_UserDictName,const char *,gpUserDictName);
	CASE_DATA(PUMA_pchar_SerifName,const char *,gpSerifName);
	CASE_DATA(PUMA_pchar_SansSerifName,const char *,gpSansSerifName);
	CASE_DATA(PUMA_pchar_CourierName,const char *,gpCourierName);
	CASE_DATA(PUMA_Word32_Pictures,uint32_t,gnPictures);
	CASE_DATA(PUMA_Word32_Tables,uint32_t,gnTables);
	CASE_DATA(PUMA_pchar_Version,char *,s_szVersion);
	CASE_DATA(PUMA_Word32_Format,Bool32,gnFormat);
	CASE_FUNCTION(PUMA_EnumFormatMode);
	CASE_FUNCTION(PUMA_EnumTable);
	CASE_FUNCTION(PUMA_EnumPicture);
	CASE_DATA(PUMA_Word8_Format,uchar,gnUnrecogChar);
	CASE_FUNCTION(PUMA_XGetRotateDIB);
	CASE_DATA(PUMA_Bool32_AutoRotate,Bool32,gbAutoRotate);
	CASE_FUNCTION(PUMA_RenameImageName);
	CASE_FUNCTION(PUMA_XSetTemplate);
	CASE_FUNCTION(PUMA_XGetTemplate);
	CASE_DATA(PUMA_Handle_CurrentEdPage,Handle,ghEdPage);
	CASE_FUNCTION(PUMA_Save);
	CASE_DATA(PUMA_Bool32_PreserveLineBreaks,Bool32,gnPreserveLineBreaks);
	CASE_FUNCTION(PUMA_XOpenClbk);
    CASE_FUNCTION(PUMA_GetSpecialBuffer);
	CASE_FUNCTION(PUMA_SetSpecialProject);
	case PUMA_LPPUMAENTRY_CED:
		{
			LPPUMAENTRY lp = (LPPUMAENTRY)pData;
			lp->fnInit = CED_Init;
			lp->fnDone = CED_Done;
			lp->fnGetReturnCode = CED_GetReturnCode;
			lp->fnGetReturnString = CED_GetReturnString;
			lp->fnGetExportData = CED_GetExportData;
			lp->fnSetImportData = CED_SetImportData;
		}
		break;
	case PUMA_LPPUMAENTRY_ROUT:
		{
			LPPUMAENTRY lp = (LPPUMAENTRY)pData;
			lp->fnInit = ROUT_Init;
			lp->fnDone = ROUT_Done;
			lp->fnGetReturnCode = ROUT_GetReturnCode;
			lp->fnGetReturnString = (FNGetReturnString)ROUT_GetReturnString;
			lp->fnGetExportData = ROUT_GetExportData;
			lp->fnSetImportData = ROUT_SetImportData;
		}
		break;
	CASE_FUNCTION(PUMA_SaveToMemory);
	 default:
		*(Handle *)pData = NULL;
		SetReturnCode_puma(IDS_ERR_NOTIMPLEMENT);
		rc = FALSE;
	}
#undef CASE_FUNCTION
#undef CASE_DATA

return rc;
}