Example #1
0
uint32_t ConverROUTtoMemory(Handle hEd, int32_t lnFormat, int32_t lnCode, Byte * lpMem, uint32_t size)
{
uint32_t rc = 0;
	if (
		!ROUT_SetImportData(ROUT_BOOL_PreserveLineBreaks,
					  (void*)gnPreserveLineBreaks)||
		!ROUT_SetImportData(ROUT_HANDLE_PageHandle,hEd)||
		!ROUT_SetImportData(ROUT_LONG_Format,(void*)lnFormat)||
		!ROUT_SetImportData(ROUT_LONG_Code,(void*)lnCode)||
		!ROUT_SetImportData(ROUT_PCHAR_BAD_CHAR,&gnUnrecogChar))
	{
		SetReturnCode_puma(ROUT_GetReturnCode());
		return rc;
	}

		// Количество объектов
		long countObjects = ROUT_CountObjects();
		if ( countObjects == -1 )
			{
				SetReturnCode_puma(ROUT_GetReturnCode());
				return rc;
			}
// Просмотрим размер памяти
		long nSize = 0;
		for (long objIndex = 1;
			objIndex <= countObjects;
			objIndex++)
			{
				long nCurSize = ROUT_GetObjectSize(objIndex);
				nSize += nCurSize;
				if(nSize <= (long)size)
				{
					if (!ROUT_GetObject(objIndex,lpMem + (nSize - nCurSize),&nCurSize))
						{
							SetReturnCode_puma(ROUT_GetReturnCode());
							return rc;
						}
				}
			} // Цикл по объектам на странице
	rc = nSize;
	return rc;
}
Example #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;
}
Example #3
0
Bool32 ModulesInit(Handle  ghStorage)
{
	// CONTEINERS
	if(!CLINE_Init(PUMA_MODULE_CLINE,NULL))
	{
		SetReturnCode_puma(CLINE_GetReturnCode());
		goto lError;
	}
	if(!CFIO_Init(PUMA_MODULE_CFIO,NULL))
	{
		SetReturnCode_puma(CFIO_GetReturnCode());
		goto lError;
	}
	/*
	ghStorage = OpenStorage(szStorage,OS_CREATE);
	if(ghStorage==NULL)
	{
		SetReturnCode_puma(IDS_ERR_CREATESTORAGE);
		goto lError;
	}
	*/
	if(!CIMAGE_Init(PUMA_MODULE_CIMAGE,NULL))
	{
		SetReturnCode_puma(CIMAGE_GetReturnCode());
		goto lError;
	}
	if(!CCOM_Init(PUMA_MODULE_CCOM,NULL))   //  нужна инициализация контейнера CCOM перед
	{               //  вызовом поиска компонент
		SetReturnCode_puma(CCOM_GetReturnCode());
		goto lError;
	}
	if(!CPAGE_Init(PUMA_MODULE_CPAGE,ghStorage))
	{
		SetReturnCode_puma(CPAGE_GetReturnCode());
		goto lError;
	}
	if(!CSTR_Init(PUMA_MODULE_CSTR,ghStorage))
	{
		SetReturnCode_puma(CSTR_GetReturnCode());
		goto lError;
	}
	// RECOGNITIONS
	if(!REXC_Init(PUMA_MODULE_REXC,NULL)) // инициализация библиотеки поиска компонент
	{
		SetReturnCode_puma(REXC_GetReturnCode());
		goto lError;
	}
//	REXC_SetImportData(REXC_OcrPath, GetModulePath());
	if(!RLINE_Init(PUMA_MODULE_RLINE,ghStorage))
	{
		SetReturnCode_puma(RLINE_GetReturnCode());
		goto lError;
	}

    if(!RRECCOM_Init(PUMA_MODULE_RRECCOM,ghStorage))
	{
 		SetReturnCode_puma(RRECCOM_GetReturnCode());
		goto lError;
	}
	RRECCOM_SetImportData(RRECCOM_OcrPath, GetModulePath());

    if(!RSL_Init(PUMA_MODULE_RSL,ghStorage))
	{
 		SetReturnCode_puma(RSL_GetReturnCode());
		goto lError;
	}
	if(!RSTUFF_Init(PUMA_MODULE_RSTUFF,ghStorage))
	{
		SetReturnCode_puma(RSTUFF_GetReturnCode());
		goto lError;
	}
	if(!RMARKER_Init(PUMA_MODULE_RBLOCK,ghStorage))
	{
 		SetReturnCode_puma(RMARKER_GetReturnCode());
		goto lError;
	}
	if(!RBLOCK_Init(PUMA_MODULE_RBLOCK,ghStorage))
	{
		SetReturnCode_puma(RBLOCK_GetReturnCode());
		goto lError;
	}
	if(!RSELSTR_Init(PUMA_MODULE_RBLOCK,ghStorage))
	{
		SetReturnCode_puma(RSELSTR_GetReturnCode());
		goto lError;
	}
    RSTR_SetImportData(RSTR_OcrPath, GetModulePath());
	RSTR_SetImportData(RSTR_pchar_temp_dir, GetModuleTempPath());
	if(!RSTR_Init(PUMA_MODULE_RSTR,ghStorage))
	{
		SetReturnCode_puma(RSTR_GetReturnCode());
		goto lError;
	}

	if(!RFRMT_Init(PUMA_MODULE_RFRMT,ghStorage))
	{
		SetReturnCode_puma(RFRMT_GetReturnCode());
		goto lError;
	}
	if(!RIMAGE_Init(PUMA_MODULE_RIMAGE,ghStorage))
	{
		SetReturnCode_puma(RIMAGE_GetReturnCode());
		goto lError;
	}
	// Инициализируем виртуальные функции
	if(!RPSTR_Init(PUMA_MODULE_RPSTR,ghStorage))
	{
		SetReturnCode_puma(RPSTR_GetReturnCode());
		goto lError;
	}
	if(!RPIC_Init(PUMA_MODULE_RPIC,ghStorage))
	{
		SetReturnCode_puma(RPIC_GetReturnCode());
		goto lError;
	}
	if(!CED_Init(PUMA_MODULE_CED,ghStorage))
	{
		SetReturnCode_puma(CED_GetReturnCode());
		goto lError;
	}
	if(!ROUT_Init(PUMA_MODULE_ROUT,ghStorage))
	{
		SetReturnCode_puma(ROUT_GetReturnCode());
		goto lError;
	}
	else
	{
		if(!ROUT_LoadRec6List("rec6all.dat"))
		{
			SetReturnCode_puma(ROUT_GetReturnCode());
			goto lError;
		}
	}

#ifdef _USE_RVERLINE_
	if(!RVERLINE_Init(PUMA_MODULE_RVERLINE,ghStorage))
	{
		SetReturnCode_puma(RVERLINE_GetReturnCode());
		goto lError;
	}
#endif //_USE_RVERLINE_

#ifdef _USE_RMSEGMENT_
	if(!RMSEGMENT_Init(PUMA_MODULE_RMSEGMENT,ghStorage))
	{
		SetReturnCode_puma(RMSEGMENT_GetReturnCode());
		goto lError;
	}
#endif //_USE_RMSEGMENT_

	if(!RCORRKEGL_Init(PUMA_MODULE_RCORRKEGL,ghStorage))
	{
		goto lError;
	}
//#ifdef _DEBUG

	My_SJTL_Init();
	if( !LDPUMA_Skip(hDebugEnableSaveJtl) )
	{
		My_SJTL_open("one.frm", "one.jtl");
	}
/* FIXME: could not figure out what to do with this in Linux, so disabled it.
	_CrtMemCheckpoint( &g_dbgMemState );
*/
//#endif
return TRUE;
lError:
		ModulesDone(ghStorage);
return FALSE;
}
Example #4
0
Bool32 ConverROUT(char * lpOutFileName, int32_t lnFormat, int32_t lnCode,Bool32 bAppend)
{
	char szName[260];
	strcpy(szName,lpOutFileName);
	char * str = strrchr(szName,'.');
	if(str)
		*(str)='\0';

	if (/*
		!ROUT_SetImportData(ROUT_PCHAR_TableTextSeparators,
						TableTextSeparators) ||
		!ROUT_SetImportData(ROUT_ULONG_TableTextIntervalBetweenCellsYY,
						(void*)TableTextIntervalBetweenCellsYY)||
		!ROUT_SetImportData(ROUT_ULONG_TableTextIntervalBetweenCellsXX,
						(void*)TableTextIntervalBetweenCellsXX)||
		!ROUT_SetImportData(ROUT_ULONG_TableTextLeftIndent,
						(void*)TableTextLeftIndent)||
		!ROUT_SetImportData(ROUT_LONG_TableTextOptions,
						(void*)TableTextOptions)*/
		!ROUT_SetImportData(ROUT_BOOL_PreserveLineBreaks,
					  (void*)gnPreserveLineBreaks)||
		!ROUT_SetImportData(ROUT_PCHAR_PageName,szName) ||
		!ROUT_SetImportData(ROUT_HANDLE_PageHandle,ghEdPage)||
		!ROUT_SetImportData(ROUT_LONG_Format,(void*)lnFormat)||
		!ROUT_SetImportData(ROUT_LONG_Code,(void*)lnCode)||
		!ROUT_SetImportData(ROUT_PCHAR_BAD_CHAR,&gnUnrecogChar))
	{
		SetReturnCode_puma(ROUT_GetReturnCode());
		return FALSE;
	}

	/*
	if (!LoadAlphabet(Rec6DatFilename))
		{
		SetReturnCode_puma(ROUT_GetReturnCode());
		return FALSE;
		}

	if (!ROUT_SetAlphabet(sizeAlphabet,upper,lower,vowels))
		{
		SetReturnCode_puma(ROUT_GetReturnCode());
		return FALSE;
		}
	*/
		// Количество объектов
		long countObjects = ROUT_CountObjects();
		if ( countObjects == -1 )
			{
				SetReturnCode_puma(ROUT_GetReturnCode());
				return FALSE;
			}

		for (long objIndex = 1;
			objIndex <= countObjects;
			objIndex++)
			{
			char path[260] = "";

			char *p = lpOutFileName;
			if ( countObjects!=1)
			{
                p = (char*)ROUT_GetDefaultObjectName(objIndex);
                if(!p)
                {
				    SetReturnCode_puma(ROUT_GetReturnCode());
				    return FALSE;
                }
			}

			strcpy(path,p);

			if (!ROUT_SaveObject(objIndex,path,bAppend))
				{
					SetReturnCode_puma(ROUT_GetReturnCode());
					return FALSE;
				}
			} // Цикл по объектам на странице

	return TRUE;
}
Example #5
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;
}