/src/FreeImage/Source/LibMNG/libmng_hlapi.c
https://bitbucket.org/cabalistic/ogredeps/ · C · 1620 lines · 1212 code · 145 blank · 263 comment · 38 complexity · aa7cea956d6561f46aaae96c747b1d41 MD5 · raw file
Large files are truncated click here to view the full file
- /* ************************************************************************** */
- /* * For conditions of distribution and use, * */
- /* * see copyright notice in libmng.h * */
- /* ************************************************************************** */
- /* * * */
- /* * project : libmng * */
- /* * file : libmng_hlapi.c copyright (c) 2000-2007 G.Juyn * */
- /* * version : 1.0.10 * */
- /* * * */
- /* * purpose : high-level application API (implementation) * */
- /* * * */
- /* * author : G.Juyn * */
- /* * * */
- /* * comment : implementation of the high-level function interface * */
- /* * for applications. * */
- /* * * */
- /* * changes : 0.5.1 - 05/06/2000 - G.Juyn * */
- /* * - added init of iPLTEcount * */
- /* * 0.5.1 - 05/08/2000 - G.Juyn * */
- /* * - changed calling-convention definition * */
- /* * - changed status-handling of display-routines * */
- /* * - added versioning-control routines * */
- /* * - filled the write routine * */
- /* * - changed strict-ANSI stuff * */
- /* * 0.5.1 - 05/11/2000 - G.Juyn * */
- /* * - added callback error-reporting support * */
- /* * 0.5.1 - 05/12/2000 - G.Juyn * */
- /* * - changed trace to macro for callback error-reporting * */
- /* * 0.5.1 - 05/13/2000 - G.Juyn * */
- /* * - added eMNGma hack (will be removed in 1.0.0 !!!) * */
- /* * - added TERM animation object pointer (easier reference) * */
- /* * 0.5.1 - 05/14/2000 - G.Juyn * */
- /* * - added cleanup of saved-data (SAVE/SEEK processing) * */
- /* * 0.5.1 - 05/16/2000 - G.Juyn * */
- /* * - moved the actual write_graphic functionality from here * */
- /* * to its appropriate function in the mng_write module * */
- /* * * */
- /* * 0.5.2 - 05/19/2000 - G.Juyn * */
- /* * - cleaned up some code regarding mixed support * */
- /* * - added JNG support * */
- /* * 0.5.2 - 05/24/2000 - G.Juyn * */
- /* * - moved init of default zlib parms here from "mng_zlib.c" * */
- /* * - added init of default IJG parms * */
- /* * 0.5.2 - 05/29/2000 - G.Juyn * */
- /* * - fixed inconsistancy with freeing global iCCP profile * */
- /* * 0.5.2 - 05/30/2000 - G.Juyn * */
- /* * - added delta-image field initialization * */
- /* * 0.5.2 - 06/06/2000 - G.Juyn * */
- /* * - added initialization of the buffer-suspend parameter * */
- /* * * */
- /* * 0.5.3 - 06/16/2000 - G.Juyn * */
- /* * - added initialization of update-region for refresh * */
- /* * - added initialization of Needrefresh parameter * */
- /* * 0.5.3 - 06/17/2000 - G.Juyn * */
- /* * - added initialization of Deltaimmediate * */
- /* * 0.5.3 - 06/21/2000 - G.Juyn * */
- /* * - added initialization of Speed * */
- /* * - added initialization of Imagelevel * */
- /* * 0.5.3 - 06/26/2000 - G.Juyn * */
- /* * - changed userdata variable to mng_ptr * */
- /* * 0.5.3 - 06/29/2000 - G.Juyn * */
- /* * - fixed initialization routine for new mng_handle type * */
- /* * * */
- /* * 0.9.1 - 07/06/2000 - G.Juyn * */
- /* * - changed mng_display_resume to allow to be called after * */
- /* * a suspension return with MNG_NEEDMOREDATA * */
- /* * - added returncode MNG_NEEDTIMERWAIT for timer breaks * */
- /* * 0.9.1 - 07/07/2000 - G.Juyn * */
- /* * - implemented support for freeze/reset/resume & go_xxxx * */
- /* * 0.9.1 - 07/08/2000 - G.Juyn * */
- /* * - added support for improved timing * */
- /* * - added support for improved I/O-suspension * */
- /* * 0.9.1 - 07/14/2000 - G.Juyn * */
- /* * - changed EOF processing behavior * */
- /* * 0.9.1 - 07/15/2000 - G.Juyn * */
- /* * - added callbacks for SAVE/SEEK processing * */
- /* * - added variable for NEEDSECTIONWAIT breaks * */
- /* * - added variable for freeze & reset processing * */
- /* * 0.9.1 - 07/17/2000 - G.Juyn * */
- /* * - added error cleanup processing * */
- /* * - fixed support for mng_display_reset() * */
- /* * - fixed suspension-buffering for 32K+ chunks * */
- /* * * */
- /* * 0.9.2 - 07/29/2000 - G.Juyn * */
- /* * - fixed small bugs in display processing * */
- /* * 0.9.2 - 07/31/2000 - G.Juyn * */
- /* * - fixed wrapping of suspension parameters * */
- /* * 0.9.2 - 08/04/2000 - G.Juyn * */
- /* * - B111096 - fixed large-buffer read-suspension * */
- /* * 0.9.2 - 08/05/2000 - G.Juyn * */
- /* * - changed file-prefixes * */
- /* * * */
- /* * 0.9.3 - 09/07/2000 - G.Juyn * */
- /* * - added support for new filter_types * */
- /* * 0.9.3 - 09/10/2000 - G.Juyn * */
- /* * - fixed DEFI behavior * */
- /* * 0.9.3 - 10/11/2000 - G.Juyn * */
- /* * - added support for nEED * */
- /* * 0.9.3 - 10/16/2000 - G.Juyn * */
- /* * - added optional support for bKGD for PNG images * */
- /* * - raised initial maximum canvas size * */
- /* * - added support for JDAA * */
- /* * 0.9.3 - 10/17/2000 - G.Juyn * */
- /* * - added callback to process non-critical unknown chunks * */
- /* * - fixed support for delta-images during read() / display() * */
- /* * 0.9.3 - 10/18/2000 - G.Juyn * */
- /* * - added closestream() processing for mng_cleanup() * */
- /* * 0.9.3 - 10/27/2000 - G.Juyn * */
- /* * - fixed separate read() & display() processing * */
- /* * * */
- /* * 0.9.4 - 11/20/2000 - G.Juyn * */
- /* * - fixed unwanted repetition in mng_readdisplay() * */
- /* * 0.9.4 - 11/24/2000 - G.Juyn * */
- /* * - moved restore of object 0 to libmng_display * */
- /* * * */
- /* * 1.0.1 - 02/08/2001 - G.Juyn * */
- /* * - added MEND processing callback * */
- /* * 1.0.1 - 02/13/2001 - G.Juyn * */
- /* * - fixed first FRAM_MODE=4 timing problem * */
- /* * 1.0.1 - 04/21/2001 - G.Juyn * */
- /* * - fixed bug with display_reset/display_resume (Thanks G!) * */
- /* * 1.0.1 - 04/22/2001 - G.Juyn * */
- /* * - fixed memory-leak (Thanks Gregg!) * */
- /* * 1.0.1 - 04/23/2001 - G.Juyn * */
- /* * - fixed reset_rundata to drop all objects * */
- /* * 1.0.1 - 04/25/2001 - G.Juyn * */
- /* * - moved mng_clear_cms to libmng_cms * */
- /* * * */
- /* * 1.0.2 - 06/23/2001 - G.Juyn * */
- /* * - added optimization option for MNG-video playback * */
- /* * - added processterm callback * */
- /* * 1.0.2 - 06/25/2001 - G.Juyn * */
- /* * - added option to turn off progressive refresh * */
- /* * * */
- /* * 1.0.5 - 07/08/2002 - G.Juyn * */
- /* * - B578572 - removed eMNGma hack (thanks Dimitri!) * */
- /* * 1.0.5 - 07/16/2002 - G.Juyn * */
- /* * - B581625 - large chunks fail with suspension reads * */
- /* * 1.0.5 - 08/19/2002 - G.Juyn * */
- /* * - B597134 - libmng pollutes the linker namespace * */
- /* * 1.0.5 - 09/15/2002 - G.Juyn * */
- /* * - fixed LOOP iteration=0 special case * */
- /* * 1.0.5 - 10/07/2002 - G.Juyn * */
- /* * - added another fix for misplaced TERM chunk * */
- /* * - completed support for condition=2 in TERM chunk * */
- /* * - added beta version function & constant * */
- /* * 1.0.5 - 10/11/2002 - G.Juyn * */
- /* * - added mng_status_dynamic to supports function * */
- /* * 1.0.5 - 11/04/2002 - G.Juyn * */
- /* * - changed FRAMECOUNT/LAYERCOUNT/PLAYTIME error to warning * */
- /* * 1.0.5 - 11/07/2002 - G.Juyn * */
- /* * - added support to get totals after mng_read() * */
- /* * 1.0.5 - 11/29/2002 - G.Juyn * */
- /* * - fixed goxxxxx() support for zero values * */
- /* * * */
- /* * 1.0.6 - 05/25/2003 - G.R-P * */
- /* * - added MNG_SKIPCHUNK_cHNK footprint optimizations * */
- /* * 1.0.6 - 07/11/2003 - G.R-P * */
- /* * - added conditionals zlib and jpeg property accessors * */
- /* * 1.0.6 - 07/14/2003 - G.R-P * */
- /* * - added conditionals around "mng_display_go*" and other * */
- /* * unused functions * */
- /* * 1.0.6 - 07/29/2003 - G.R-P * */
- /* * - added conditionals around PAST chunk support * */
- /* * * */
- /* * 1.0.7 - 03/07/2004 - G. Randers-Pehrson * */
- /* * - put gamma, cms-related declarations inside #ifdef * */
- /* * 1.0.7 - 03/10/2004 - G.R-P * */
- /* * - added conditionals around openstream/closestream * */
- /* * 1.0.7 - 03/24/2004 - G.R-P * */
- /* * - fixed zTXT -> zTXt typo * */
- /* * * */
- /* * 1.0.8 - 04/02/2004 - G.Juyn * */
- /* * - added CRC existence & checking flags * */
- /* * 1.0.8 - 04/10/2004 - G.Juyn * */
- /* * - added data-push mechanisms for specialized decoders * */
- /* * 1.0.8 - 07/06/2004 - G.R-P * */
- /* * - defend against using undefined openstream function * */
- /* * 1.0.8 - 08/02/2004 - G.Juyn * */
- /* * - added conditional to allow easier writing of large MNG's * */
- /* * * */
- /* * 1.0.9 - 08/17/2004 - G.R-P * */
- /* * - added more SKIPCHUNK conditionals * */
- /* * 1.0.9 - 09/25/2004 - G.Juyn * */
- /* * - replaced MNG_TWEAK_LARGE_FILES with permanent solution * */
- /* * 1.0.9 - 10/03/2004 - G.Juyn * */
- /* * - added function to retrieve current FRAM delay * */
- /* * 1.0.9 - 12/20/2004 - G.Juyn * */
- /* * - cleaned up macro-invocations (thanks to D. Airlie) * */
- /* * * */
- /* * 1.0.10 - 07/06/2005 - G.R-P * */
- /* * - added more SKIPCHUNK conditionals * */
- /* * 1.0.10 - 04/08/2007 - G.Juyn * */
- /* * - added support for mPNG proposal * */
- /* * 1.0.10 - 04/12/2007 - G.Juyn * */
- /* * - added support for ANG proposal * */
- /* * 1.0.10 - 07/06/2007 - G.R-P bugfix by Lucas Quintana * */
- /* * * */
- /* ************************************************************************** */
- #include "libmng.h"
- #include "libmng_data.h"
- #include "libmng_error.h"
- #include "libmng_trace.h"
- #ifdef __BORLANDC__
- #pragma hdrstop
- #endif
- #include "libmng_objects.h"
- #include "libmng_object_prc.h"
- #include "libmng_chunks.h"
- #include "libmng_memory.h"
- #include "libmng_read.h"
- #include "libmng_write.h"
- #include "libmng_display.h"
- #include "libmng_zlib.h"
- #include "libmng_jpeg.h"
- #include "libmng_cms.h"
- #include "libmng_pixels.h"
- #if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
- #pragma option -A /* force ANSI-C */
- #endif
- /* ************************************************************************** */
- /* * * */
- /* * local routines * */
- /* * * */
- /* ************************************************************************** */
- #ifdef MNG_SUPPORT_DISPLAY
- MNG_LOCAL mng_retcode mng_drop_objects (mng_datap pData,
- mng_bool bDropaniobj)
- {
- mng_objectp pObject;
- mng_objectp pNext;
- mng_cleanupobject fCleanup;
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_DROP_OBJECTS, MNG_LC_START);
- #endif
- pObject = pData->pFirstimgobj; /* get first stored image-object (if any) */
- while (pObject) /* more objects to discard ? */
- {
- pNext = ((mng_object_headerp)pObject)->pNext;
- /* call appropriate cleanup */
- fCleanup = ((mng_object_headerp)pObject)->fCleanup;
- fCleanup (pData, pObject);
- pObject = pNext; /* neeeext */
- }
- pData->pFirstimgobj = MNG_NULL; /* clean this up!!! */
- pData->pLastimgobj = MNG_NULL;
- if (bDropaniobj) /* drop animation objects ? */
- {
- pObject = pData->pFirstaniobj; /* get first stored animation-object (if any) */
- while (pObject) /* more objects to discard ? */
- {
- pNext = ((mng_object_headerp)pObject)->pNext;
- /* call appropriate cleanup */
- fCleanup = ((mng_object_headerp)pObject)->fCleanup;
- fCleanup (pData, pObject);
- pObject = pNext; /* neeeext */
- }
- pData->pFirstaniobj = MNG_NULL; /* clean this up!!! */
- pData->pLastaniobj = MNG_NULL;
- #ifdef MNG_SUPPORT_DYNAMICMNG
- pObject = pData->pFirstevent; /* get first event-object (if any) */
- while (pObject) /* more objects to discard ? */
- {
- pNext = ((mng_object_headerp)pObject)->pNext;
- /* call appropriate cleanup */
- fCleanup = ((mng_object_headerp)pObject)->fCleanup;
- fCleanup (pData, pObject);
- pObject = pNext; /* neeeext */
- }
- pData->pFirstevent = MNG_NULL; /* clean this up!!! */
- pData->pLastevent = MNG_NULL;
- #endif
- }
- #ifdef MNG_INCLUDE_MPNG_PROPOSAL
- if (pData->pMPNG) /* drop MPNG data (if any) */
- {
- fCleanup = ((mng_object_headerp)pData->pMPNG)->fCleanup;
- fCleanup (pData, pData->pMPNG);
- pData->pMPNG = MNG_NULL;
- }
- #endif
- #ifdef MNG_INCLUDE_ANG_PROPOSAL
- if (pData->pANG) /* drop ANG data (if any) */
- {
- fCleanup = ((mng_object_headerp)pData->pANG)->fCleanup;
- fCleanup (pData, pData->pANG);
- pData->pANG = MNG_NULL;
- }
- #endif
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_DROP_OBJECTS, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif /* MNG_SUPPORT_DISPLAY */
- /* ************************************************************************** */
- #ifdef MNG_SUPPORT_DISPLAY
- #ifndef MNG_SKIPCHUNK_SAVE
- MNG_LOCAL mng_retcode mng_drop_savedata (mng_datap pData)
- {
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_DROP_SAVEDATA, MNG_LC_START);
- #endif
- if (pData->pSavedata) /* sanity check */
- { /* address it more directly */
- mng_savedatap pSave = pData->pSavedata;
- if (pSave->iGlobalProfilesize) /* cleanup the profile ? */
- MNG_FREEX (pData, pSave->pGlobalProfile, pSave->iGlobalProfilesize);
- /* cleanup the save structure */
- MNG_FREE (pData, pData->pSavedata, sizeof (mng_savedata));
- }
- #ifdef MNG_SUPPORT_TRACE
- MNG_TRACE (pData, MNG_FN_DROP_SAVEDATA, MNG_LC_END);
- #endif
- return MNG_NOERROR;
- }
- #endif
- #endif /* MNG_SUPPORT_DISPLAY */
- /* ************************************************************************** */
- #ifdef MNG_SUPPORT_DISPLAY
- MNG_LOCAL mng_retcode mng_reset_rundata (mng_datap pData)
- {
- mng_drop_invalid_objects (pData); /* drop invalidly stored objects */
- #ifndef MNG_SKIPCHUNK_SAVE
- mng_drop_savedata (pData); /* drop stored savedata */
- #endif
- mng_reset_objzero (pData); /* reset object 0 */
- /* drop stored objects (if any) */
- mng_drop_objects (pData, MNG_FALSE);
- pData->bFramedone = MNG_FALSE;
- pData->iFrameseq = 0; /* reset counters & stuff */
- pData->iLayerseq = 0;
- pData->iFrametime = 0;
- pData->bSkipping = MNG_FALSE;
- #ifdef MNG_SUPPORT_DYNAMICMNG
- pData->bRunningevent = MNG_FALSE;
- pData->bStopafterseek = MNG_FALSE;
- pData->iEventx = 0;
- pData->iEventy = 0;
- pData->pLastmousemove = MNG_NULL;
- #endif
- pData->iRequestframe = 0;
- pData->iRequestlayer = 0;
- pData->iRequesttime = 0;
- pData->bSearching = MNG_FALSE;
- pData->iRuntime = 0;
- pData->iSynctime = 0;
- pData->iStarttime = 0;
- pData->iEndtime = 0;
- pData->bRunning = MNG_FALSE;
- pData->bTimerset = MNG_FALSE;
- pData->iBreakpoint = 0;
- pData->bSectionwait = MNG_FALSE;
- pData->bFreezing = MNG_FALSE;
- pData->bResetting = MNG_FALSE;
- pData->bNeedrefresh = MNG_FALSE;
- pData->bOnlyfirstframe = MNG_FALSE;
- pData->iFramesafterTERM = 0;
- pData->iIterations = 0;
- /* start of animation objects! */
- pData->pCurraniobj = MNG_NULL;
- pData->iUpdateleft = 0; /* reset region */
- pData->iUpdateright = 0;
- pData->iUpdatetop = 0;
- pData->iUpdatebottom = 0;
- pData->iPLTEcount = 0; /* reset PLTE data */
- #ifndef MNG_SKIPCHUNK_DEFI
- pData->iDEFIobjectid = 0; /* reset DEFI data */
- pData->bDEFIhasdonotshow = MNG_FALSE;
- pData->iDEFIdonotshow = 0;
- pData->bDEFIhasconcrete = MNG_FALSE;
- pData->iDEFIconcrete = 0;
- pData->bDEFIhasloca = MNG_FALSE;
- pData->iDEFIlocax = 0;
- pData->iDEFIlocay = 0;
- pData->bDEFIhasclip = MNG_FALSE;
- pData->iDEFIclipl = 0;
- pData->iDEFIclipr = 0;
- pData->iDEFIclipt = 0;
- pData->iDEFIclipb = 0;
- #endif
- #ifndef MNG_SKIPCHUNK_BACK
- pData->iBACKred = 0; /* reset BACK data */
- pData->iBACKgreen = 0;
- pData->iBACKblue = 0;
- pData->iBACKmandatory = 0;
- pData->iBACKimageid = 0;
- pData->iBACKtile = 0;
- #endif
- #ifndef MNG_SKIPCHUNK_FRAM
- pData->iFRAMmode = 1; /* default global FRAM variables */
- pData->iFRAMdelay = 1;
- pData->iFRAMtimeout = 0x7fffffffl;
- pData->bFRAMclipping = MNG_FALSE;
- pData->iFRAMclipl = 0;
- pData->iFRAMclipr = 0;
- pData->iFRAMclipt = 0;
- pData->iFRAMclipb = 0;
- pData->iFramemode = 1; /* again for the current frame */
- pData->iFramedelay = 1;
- pData->iFrametimeout = 0x7fffffffl;
- pData->bFrameclipping = MNG_FALSE;
- pData->iFrameclipl = 0;
- pData->iFrameclipr = 0;
- pData->iFrameclipt = 0;
- pData->iFrameclipb = 0;
- pData->iNextdelay = 1;
- #endif
- #ifndef MNG_SKIPCHUNK_SHOW
- pData->iSHOWmode = 0; /* reset SHOW data */
- pData->iSHOWfromid = 0;
- pData->iSHOWtoid = 0;
- pData->iSHOWnextid = 0;
- pData->iSHOWskip = 0;
- #endif
- pData->iGlobalPLTEcount = 0; /* reset global PLTE data */
- pData->iGlobalTRNSrawlen = 0; /* reset global tRNS data */
- pData->iGlobalGamma = 0; /* reset global gAMA data */
- #ifndef MNG_SKIPCHUNK_cHRM
- pData->iGlobalWhitepointx = 0; /* reset global cHRM data */
- pData->iGlobalWhitepointy = 0;
- pData->iGlobalPrimaryredx = 0;
- pData->iGlobalPrimaryredy = 0;
- pData->iGlobalPrimarygreenx = 0;
- pData->iGlobalPrimarygreeny = 0;
- pData->iGlobalPrimarybluex = 0;
- pData->iGlobalPrimarybluey = 0;
- #endif
- #ifndef MNG_SKIPCHUNK_sRGB
- pData->iGlobalRendintent = 0; /* reset global sRGB data */
- #endif
- #ifndef MNG_SKIPCHUNK_iCCP
- if (pData->iGlobalProfilesize) /* drop global profile (if any) */
- MNG_FREE (pData, pData->pGlobalProfile, pData->iGlobalProfilesize);
- pData->iGlobalProfilesize = 0;
- #endif
- #ifndef MNG_SKIPCHUNK_bKGD
- pData->iGlobalBKGDred = 0; /* reset global bKGD data */
- pData->iGlobalBKGDgreen = 0;
- pData->iGlobalBKGDblue = 0;
- #endif
- #ifndef MNG_NO_DELTA_PNG
- /* reset delta-image */
- pData->pDeltaImage = MNG_NULL;
- pData->iDeltaImagetype = 0;
- pData->iDeltatype = 0;
- pData->iDeltaBlockwidth = 0;
- pData->iDeltaBlockheight = 0;
- pData->iDeltaBlockx = 0;
- pData->iDeltaBlocky = 0;
- pData->bDeltaimmediate = MNG_FALSE;
- pData->fDeltagetrow = MNG_NULL;
- pData->fDeltaaddrow = MNG_NULL;
- pData->fDeltareplacerow = MNG_NULL;
- pData->fDeltaputrow = MNG_NULL;
- pData->fPromoterow = MNG_NULL;
- pData->fPromBitdepth = MNG_NULL;
- pData->pPromBuf = MNG_NULL;
- pData->iPromColortype = 0;
- pData->iPromBitdepth = 0;
- pData->iPromFilltype = 0;
- pData->iPromWidth = 0;
- pData->pPromSrc = MNG_NULL;
- pData->pPromDst = MNG_NULL;
- #endif
- #ifndef MNG_SKIPCHUNK_MAGN
- pData->iMAGNfromid = 0;
- pData->iMAGNtoid = 0;
- #endif
- #ifndef MNG_SKIPCHUNK_PAST
- pData->iPastx = 0;
- pData->iPasty = 0;
- #endif
- pData->pLastseek = MNG_NULL;
- return MNG_NOERROR;
- }
- #endif /* MNG_SUPPORT_DISPLAY */
- /* ************************************************************************** */
- MNG_LOCAL void cleanup_errors (mng_datap pData)
- {
- pData->iErrorcode = MNG_NOERROR;
- pData->iSeverity = 0;
- pData->iErrorx1 = 0;
- pData->iErrorx2 = 0;
- pData->zErrortext = MNG_NULL;
- return;
- }
- /* ************************************************************************** */
- #ifdef MNG_SUPPORT_READ
- MNG_LOCAL mng_retcode make_pushbuffer (mng_datap pData,
- mng_ptr pPushdata,
- mng_size_t iLength,
- mng_bool bTakeownership,
- mng_pushdatap * pPush)
- {
- mng_pushdatap pTemp;
- MNG_ALLOC (pData, pTemp, sizeof(mng_pushdata));
- pTemp->pNext = MNG_NULL;
- if (bTakeownership) /* are we going to own the buffer? */
- { /* then just copy the pointer */
- pTemp->pData = (mng_uint8p)pPushdata;
- }
- else
- { /* otherwise create new buffer */
- MNG_ALLOCX (pData, pTemp->pData, iLength);
- if (!pTemp->pData) /* succeeded? */
- {
- MNG_FREEX (pData, pTemp, sizeof(mng_pushdata));
- MNG_ERROR (pData, MNG_OUTOFMEMORY);
- }
- /* and copy the bytes across */
- MNG_COPY (pTemp->pData, pPushdata, iLength);
- }
- pTemp->iLength = iLength;
- pTemp->bOwned = bTakeownership;
- pTemp->pDatanext = pTemp->pData;
- pTemp->iRemaining = iLength;
- *pPush = pTemp; /* return it */
- return MNG_NOERROR; /* and all's well */
- }
- #endif
- #ifdef MNG_VERSION_QUERY_SUPPORT
- /* ************************************************************************** */
- /* * * */
- /* * Versioning control * */
- /* * * */
- /* ************************************************************************** */
- mng_pchar MNG_DECL mng_version_text (void)
- {
- return MNG_VERSION_TEXT;
- }
- /* ************************************************************************** */
- mng_uint8 MNG_DECL mng_version_so (void)
- {
- return MNG_VERSION_SO;
- }
- /* ************************************************************************** */
- mng_uint8 MNG_DECL mng_version_dll (void)
- {
- return MNG_VERSION_DLL;
- }
- /* ************************************************************************** */
- mng_uint8 MNG_DECL mng_version_major (void)
- {
- return MNG_VERSION_MAJOR;
- }
- /* ************************************************************************** */
- mng_uint8 MNG_DECL mng_version_minor (void)
- {
- return MNG_VERSION_MINOR;
- }
- /* ************************************************************************** */
- mng_uint8 MNG_DECL mng_version_release (void)
- {
- return MNG_VERSION_RELEASE;
- }
- /* ************************************************************************** */
- mng_bool MNG_DECL mng_version_beta (void)
- {
- return MNG_VERSION_BETA;
- }
- #endif
- /* ************************************************************************** */
- /* * * */
- /* * 'supports' function * */
- /* * * */
- /* ************************************************************************** */
- #ifdef MNG_SUPPORT_FUNCQUERY
- typedef struct {
- mng_pchar zFunction;
- mng_uint8 iMajor; /* Major == 0 means not implemented ! */
- mng_uint8 iMinor;
- mng_uint8 iRelease;
- } mng_func_entry;
- typedef mng_func_entry const * mng_func_entryp;
- MNG_LOCAL mng_func_entry const func_table [] =
- { /* keep it alphabetically sorted !!!!! */
- {"mng_cleanup", 1, 0, 0},
- {"mng_copy_chunk", 1, 0, 5},
- {"mng_create", 1, 0, 0},
- {"mng_display", 1, 0, 0},
- {"mng_display_freeze", 1, 0, 0},
- #ifndef MNG_NO_DISPLAY_GO_SUPPORTED
- {"mng_display_goframe", 1, 0, 0},
- {"mng_display_golayer", 1, 0, 0},
- {"mng_display_gotime", 1, 0, 0},
- #endif
- {"mng_display_reset", 1, 0, 0},
- {"mng_display_resume", 1, 0, 0},
- {"mng_get_alphabitdepth", 1, 0, 0},
- {"mng_get_alphacompression", 1, 0, 0},
- {"mng_get_alphadepth", 1, 0, 0},
- {"mng_get_alphafilter", 1, 0, 0},
- {"mng_get_alphainterlace", 1, 0, 0},
- {"mng_get_bgcolor", 1, 0, 0},
- {"mng_get_bitdepth", 1, 0, 0},
- {"mng_get_bkgdstyle", 1, 0, 0},
- {"mng_get_cacheplayback", 1, 0, 2},
- {"mng_get_canvasstyle", 1, 0, 0},
- {"mng_get_colortype", 1, 0, 0},
- {"mng_get_compression", 1, 0, 0},
- #ifndef MNG_NO_CURRENT_INFO
- {"mng_get_currentframe", 1, 0, 0},
- {"mng_get_currentlayer", 1, 0, 0},
- {"mng_get_currentplaytime", 1, 0, 0},
- #endif
- {"mng_get_currframdelay", 1, 0, 9},
- #ifndef MNG_NO_DFLT_INFO
- {"mng_get_dfltimggamma", 1, 0, 0},
- {"mng_get_dfltimggammaint", 1, 0, 0},
- #endif
- {"mng_get_displaygamma", 1, 0, 0},
- {"mng_get_displaygammaint", 1, 0, 0},
- {"mng_get_doprogressive", 1, 0, 2},
- {"mng_get_filter", 1, 0, 0},
- {"mng_get_framecount", 1, 0, 0},
- {"mng_get_imageheight", 1, 0, 0},
- {"mng_get_imagelevel", 1, 0, 0},
- {"mng_get_imagetype", 1, 0, 0},
- {"mng_get_imagewidth", 1, 0, 0},
- {"mng_get_interlace", 1, 0, 0},
- #ifdef MNG_ACCESS_JPEG
- {"mng_get_jpeg_dctmethod", 1, 0, 0},
- {"mng_get_jpeg_maxjdat", 1, 0, 0},
- {"mng_get_jpeg_optimized", 1, 0, 0},
- {"mng_get_jpeg_progressive", 1, 0, 0},
- {"mng_get_jpeg_quality", 1, 0, 0},
- {"mng_get_jpeg_smoothing", 1, 0, 0},
- #endif
- {"mng_get_lastbackchunk", 1, 0, 3},
- {"mng_get_lastseekname", 1, 0, 5},
- {"mng_get_layercount", 1, 0, 0},
- #ifndef MNG_SKIP_MAXCANVAS
- {"mng_get_maxcanvasheight", 1, 0, 0},
- {"mng_get_maxcanvaswidth", 1, 0, 0},
- #endif
- {"mng_get_playtime", 1, 0, 0},
- {"mng_get_refreshpass", 1, 0, 0},
- {"mng_get_runtime", 1, 0, 0},
- {"mng_get_sectionbreaks", 1, 0, 0},
- {"mng_get_sigtype", 1, 0, 0},
- {"mng_get_simplicity", 1, 0, 0},
- {"mng_get_speed", 1, 0, 0},
- {"mng_get_srgb", 1, 0, 0},
- {"mng_get_starttime", 1, 0, 0},
- {"mng_get_storechunks", 1, 0, 0},
- {"mng_get_suspensionmode", 1, 0, 0},
- {"mng_get_ticks", 1, 0, 0},
- #ifndef MNG_NO_CURRENT_INFO
- {"mng_get_totalframes", 1, 0, 5},
- {"mng_get_totallayers", 1, 0, 5},
- {"mng_get_totalplaytime", 1, 0, 5},
- #endif
- {"mng_get_usebkgd", 1, 0, 0},
- {"mng_get_userdata", 1, 0, 0},
- #if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS)
- {"mng_get_viewgamma", 1, 0, 0},
- {"mng_get_viewgammaint", 1, 0, 0},
- #endif
- #ifdef MNG_ACCESS_ZLIB
- {"mng_get_zlib_level", 1, 0, 0},
- {"mng_get_zlib_maxidat", 1, 0, 0},
- {"mng_get_zlib_memlevel", 1, 0, 0},
- {"mng_get_zlib_method", 1, 0, 0},
- {"mng_get_zlib_strategy", 1, 0, 0},
- {"mng_get_zlib_windowbits", 1, 0, 0},
- #endif
- #ifndef MNG_NO_OPEN_CLOSE_STREAM
- {"mng_getcb_closestream", 1, 0, 0},
- #endif
- {"mng_getcb_errorproc", 1, 0, 0},
- {"mng_getcb_getalphaline", 1, 0, 0},
- {"mng_getcb_getbkgdline", 1, 0, 0},
- {"mng_getcb_getcanvasline", 1, 0, 0},
- {"mng_getcb_gettickcount", 1, 0, 0},
- {"mng_getcb_memalloc", 1, 0, 0},
- {"mng_getcb_memfree", 1, 0, 0},
- #ifndef MNG_NO_OPEN_CLOSE_STREAM
- {"mng_getcb_openstream", 1, 0, 0},
- #endif
- {"mng_getcb_processarow", 1, 0, 0},
- {"mng_getcb_processchroma", 1, 0, 0},
- {"mng_getcb_processgamma", 1, 0, 0},
- {"mng_getcb_processheader", 1, 0, 0},
- {"mng_getcb_processiccp", 1, 0, 0},
- {"mng_getcb_processmend", 1, 0, 1},
- {"mng_getcb_processneed", 1, 0, 0},
- {"mng_getcb_processsave", 1, 0, 0},
- {"mng_getcb_processseek", 1, 0, 0},
- {"mng_getcb_processsrgb", 1, 0, 0},
- {"mng_getcb_processterm", 1, 0, 2},
- {"mng_getcb_processtext", 1, 0, 0},
- {"mng_getcb_processunknown", 1, 0, 0},
- {"mng_getcb_readdata", 1, 0, 0},
- {"mng_getcb_refresh", 1, 0, 0},
- {"mng_getcb_releasedata", 1, 0, 8},
- {"mng_getcb_settimer", 1, 0, 0},
- {"mng_getcb_traceproc", 1, 0, 0},
- {"mng_getcb_writedata", 1, 0, 0},
- {"mng_getchunk_back", 1, 0, 0},
- {"mng_getchunk_basi", 1, 0, 0},
- #ifndef MNG_SKIPCHUNK_bKGD
- {"mng_getchunk_bkgd", 1, 0, 0},
- #endif
- #ifndef MNG_SKIPCHUNK_cHRM
- {"mng_getchunk_chrm", 1, 0, 0},
- #endif
- {"mng_getchunk_clip", 1, 0, 0},
- {"mng_getchunk_clon", 1, 0, 0},
- #ifndef MNG_NO_DELTA_PNG
- #ifndef MNG_SKIPCHUNK_dBYK
- {"mng_getchunk_dbyk", 1, 0, 0},
- #endif
- #endif
- {"mng_getchunk_defi", 1, 0, 0},
- #ifndef MNG_NO_DELTA_PNG
- {"mng_getchunk_dhdr", 1, 0, 0},
- #endif
- {"mng_getchunk_disc", 1, 0, 0},
- #ifndef MNG_NO_DELTA_PNG
- {"mng_getchunk_drop", 1, 0, 0},
- #endif
- {"mng_getchunk_endl", 1, 0, 0},
- #ifdef MNG_INCLUDE_MPNG_PROPOSAL
- {"mng_getchunk_mpng", 1, 0, 10},
- {"mng_getchunk_mpng_frame", 1, 0, 10},
- #endif
- #ifndef MNG_SKIPCHUNK_evNT
- {"mng_getchunk_evnt", 1, 0, 5},
- {"mng_getchunk_evnt_entry", 1, 0, 5},
- #endif
- #ifndef MNG_SKIPCHUNK_eXPI
- {"mng_getchunk_expi", 1, 0, 0},
- #endif
- #ifndef MNG_SKIPCHUNK_fPRI
- {"mng_getchunk_fpri", 1, 0, 0},
- #endif
- {"mng_getchunk_fram", 1, 0, 0},
- {"mng_getchunk_gama", 1, 0, 0},
- #ifndef MNG_SKIPCHUNK_hIST
- {"mng_getchunk_hist", 1, 0, 0},
- #endif
- #ifndef MNG_SKIPCHUNK_iCCP
- {"mng_getchunk_iccp", 1, 0, 0},
- #endif
- {"mng_getchunk_idat", 1, 0, 0},
- {"mng_getchunk_iend", 1, 0, 0},
- {"mng_getchunk_ihdr", 1, 0, 0},
- #ifndef MNG_NO_DELTA_PNG
- #ifdef MNG_INCLUDE_JNG
- {"mng_getchunk_ijng", 1, 0, 0},
- #endif
- {"mng_getchunk_ipng", 1, 0, 0},
- #endif
- #ifndef MNG_SKIPCHUNK_iTXt
- {"mng_getchunk_itxt", 1, 0, 0},
- #endif
- #ifdef MNG_INCLUDE_JNG
- {"mng_getchunk_jdaa", 1, 0, 0},
- {"mng_getchunk_jdat", 1, 0, 0},
- {"mng_getchunk_jhdr", 1, 0, 0},
- {"mng_getchunk_jsep", 1, 0, 0},
- #endif
- {"mng_getchunk_loop", 1, 0, 0},
- #ifndef MNG_SKIPCHUNK_MAGN
- {"mng_getchunk_magn", 1, 0, 0},
- #endif
- {"mng_getchunk_mend", 1, 0, 0},
- {"mng_getchunk_mhdr", 1, 0, 0},
- {"mng_getchunk_move", 1, 0, 0},
- #ifndef MNG_SKIPCHUNK_nEED
- {"mng_getchunk_need", 1, 0, 0},
- #endif
- #ifndef MNG_SKIPCHUNK_ORDR
- #ifndef MNG_NO_DELTA_PNG
- {"mng_getchunk_ordr", 1, 0, 0},
- {"mng_getchunk_ordr_entry", 1, 0, 0},
- #endif
- #endif
- #ifndef MNG_SKIPCHUNK_PAST
- {"mng_getchunk_past", 1, 0, 0},
- {"mng_getchunk_past_src", 1, 0, 0},
- #endif
- #ifndef MNG_SKIPCHUNK_pHYg
- {"mng_getchunk_phyg", 1, 0, 0},
- #endif
- #ifndef MNG_SKIPCHUNK_pHYs
- {"mng_getchunk_phys", 1, 0, 0},
- #endif
- #ifndef MNG_NO_DELTA_PNG
- {"mng_getchunk_plte", 1, 0, 0},
- {"mng_getchunk_pplt", 1, 0, 0},
- {"mng_getchunk_pplt_entry", 1, 0, 0},
- {"mng_getchunk_prom", 1, 0, 0},
- #endif
- #ifndef MNG_SKIPCHUNK_SAVE
- {"mng_getchunk_save", 1, 0, 0},
- {"mng_getchunk_save_entry", 1, 0, 0},
- #endif
- #ifndef MNG_SKIPCHUNK_sBIT
- {"mng_getchunk_sbit", 1, 0, 0},
- #endif
- #ifndef MNG_SKIPCHUNK_SEEK
- {"mng_getchunk_seek", 1, 0, 0},
- #endif
- {"mng_getchunk_show", 1, 0, 0},
- #ifndef MNG_SKIPCHUNK_sPLT
- {"mng_getchunk_splt", 1, 0, 0},
- #endif
- #ifndef MNG_SKIPCHUNK_sRGB
- {"mng_getchunk_srgb", 1, 0, 0},
- #endif
- {"mng_getchunk_term", 1, 0, 0},
- #ifndef MNG_SKIPCHUNK_tEXt
- {"mng_getchunk_text", 1, 0, 0},
- #endif
- #ifndef MNG_SKIPCHUNK_tIME
- {"mng_getchunk_time", 1, 0, 0},
- #endif
- {"mng_getchunk_trns", 1, 0, 0},
- {"mng_getchunk_unkown", 1, 0, 0},
- #ifndef MNG_SKIPCHUNK_zTXt
- {"mng_getchunk_ztxt", 1, 0, 0},
- #endif
- {"mng_getimgdata_chunk", 0, 0, 0},
- {"mng_getimgdata_chunkseq", 0, 0, 0},
- {"mng_getimgdata_seq", 0, 0, 0},
- {"mng_getlasterror", 1, 0, 0},
- {"mng_initialize", 1, 0, 0},
- {"mng_iterate_chunks", 1, 0, 0},
- {"mng_putchunk_back", 1, 0, 0},
- #ifndef MNG_SKIPCHUNK_BASI
- {"mng_putchunk_basi", 1, 0, 0},
- #endif
- #ifndef MNG_SKIPCHUNK_bKGD
- {"mng_putchunk_bkgd", 1, 0, 0},
- #endif
- #ifndef MNG_SKIPCHUNK_cHRM
- {"mng_putchunk_chrm", 1, 0, 0},
- #endif
- {"mng_putchunk_clip", 1, 0, 0},
- {"mng_putchunk_clon", 1, 0, 0},
- #ifndef MNG_NO_DELTA_PNG
- #ifndef MNG_SKIPCHUNK_DBYK
- {"mng_putchunk_dbyk", 1, 0, 0},
- #endif
- #endif
- {"mng_putchunk_defi", 1, 0, 0},
- #ifndef MNG_NO_DELTA_PNG
- {"mng_putchunk_dhdr", 1, 0, 0},
- #endif
- {"mng_putchunk_disc", 1, 0, 0},
- #ifndef MNG_NO_DELTA_PNG
- {"mng_putchunk_drop", 1, 0, 0},
- #endif
- {"mng_putchunk_endl", 1, 0, 0},
- #ifdef MNG_INCLUDE_MPNG_PROPOSAL
- {"mng_putchunk_mpng", 1, 0, 10},
- {"mng_putchunk_mpng_frame", 1, 0, 10},
- #endif
- #ifndef MNG_SKIPCHUNK_evNT
- {"mng_putchunk_evnt", 1, 0, 5},
- {"mng_putchunk_evnt_entry", 1, 0, 5},
- #endif
- #ifndef MNG_SKIPCHUNK_eXPI
- {"mng_putchunk_expi", 1, 0, 0},
- #endif
- #ifndef MNG_SKIPCHUNK_fPRI
- {"mng_putchunk_fpri", 1, 0, 0},
- #endif
- #ifndef MNG_SKIPCHUNK_FRAM
- {"mng_putchunk_fram", 1, 0, 0},
- #endif
- {"mng_putchunk_gama", 1, 0, 0},
- #ifndef MNG_SKIPCHUNK_hIST
- {"mng_putchunk_hist", 1, 0, 0},
- #endif
- #ifndef MNG_SKIPCHUNK_iCCP
- {"mng_putchunk_iccp", 1, 0, 0},
- #endif
- {"mng_putchunk_idat", 1, 0, 0},
- {"mng_putchunk_iend", 1, 0, 0},
- {"mng_putchunk_ihdr", 1, 0, 0},
- #ifndef MNG_NO_DELTA_PNG
- #ifdef MNG_INCLUDE_JNG
- {"mng_putchunk_ijng", 1, 0, 0},
- #endif
- {"mng_putchunk_ipng", 1, 0, 0},
- #endif
- #ifndef MNG_SKIPCHUNK_iTXt
- {"mng_putchunk_itxt", 1, 0, 0},
- #endif
- #ifdef MNG_INCLUDE_JNG
- {"mng_putchunk_jdaa", 1, 0, 0},
- {"mng_putchunk_jdat", 1, 0, 0},
- {"mng_putchunk_jhdr", 1, 0, 0},
- {"mng_putchunk_jsep", 1, 0, 0},
- #endif
- {"mng_putchunk_loop", 1, 0, 0},
- #ifndef MNG_SKIPCHUNK_MAGN
- {"mng_putchunk_magn", 1, 0, 0},
- #endif
- {"mng_putchunk_mend", 1, 0, 0},
- {"mng_putchunk_mhdr", 1, 0, 0},
- {"mng_putchunk_move", 1, 0, 0},
- #ifndef MNG_SKIPCHUNK_nEED
- {"mng_putchunk_need", 1, 0, 0},
- #endif
- #ifndef MNG_NO_DELTA_PNG
- #ifndef MNG_SKIPCHUNK_ORDR
- {"mng_putchunk_ordr", 1, 0, 0},
- {"mng_putchunk_ordr_entry", 1, 0, 0},
- #endif
- #endif
- #ifndef MNG_SKIPCHUNK_PAST
- {"mng_putchunk_past", 1, 0, 0},
- {"mng_putchunk_past_src", 1, 0, 0},
- #endif
- #ifndef MNG_SKIPCHUNK_pHYg
- {"mng_putchunk_phyg", 1, 0, 0},
- #endif
- #ifndef MNG_SKIPCHUNK_pHYs
- {"mng_putchunk_phys", 1, 0, 0},
- #endif
- #ifndef MNG_NO_DELTA_PNG
- {"mng_putchunk_plte", 1, 0, 0},
- {"mng_putchunk_pplt", 1, 0, 0},
- {"mng_putchunk_pplt_entry", 1, 0, 0},
- {"mng_putchunk_prom", 1, 0, 0},
- #endif
- #ifndef MNG_SKIPCHUNK_SAVE
- {"mng_putchunk_save", 1, 0, 0},
- {"mng_putchunk_save_entry", 1, 0, 0},
- #endif
- #ifndef MNG_SKIPCHUNK_sBIT
- {"mng_putchunk_sbit", 1, 0, 0},
- #endif
- #ifndef MNG_SKIPCHUNK_SEEK
- {"mng_putchunk_seek", 1, 0, 0},
- #endif
- {"mng_putchunk_show", 1, 0, 0},
- #ifndef MNG_SKIPCHUNK_sPLT
- {"mng_putchunk_splt", 1, 0, 0},
- #endif
- #ifndef MNG_SKIPCHUNK_sRGB
- {"mng_putchunk_srgb", 1, 0, 0},
- #endif
- {"mng_putchunk_term", 1, 0, 0},
- #ifndef MNG_SKIPCHUNK_tEXt
- {"mng_putchunk_text", 1, 0, 0},
- #endif
- #ifndef MNG_SKIPCHUNK_tIME
- {"mng_putchunk_time", 1, 0, 0},
- #endif
- {"mng_putchunk_trns", 1, 0, 0},
- {"mng_putchunk_unkown", 1, 0, 0},
- #ifndef MNG_SKIPCHUNK_zTXt
- {"mng_putchunk_ztxt", 1, 0, 0},
- #endif
- {"mng_putimgdata_ihdr", 0, 0, 0},
- {"mng_putimgdata_jhdr", 0, 0, 0},
- {"mng_reset", 1, 0, 0},
- {"mng_read", 1, 0, 0},
- {"mng_read_pushchunk", 1, 0, 8},
- {"mng_read_pushdata", 1, 0, 8},
- {"mng_read_pushsig", 1, 0, 8},
- {"mng_read_resume", 1, 0, 0},
- {"mng_readdisplay", 1, 0, 0},
- {"mng_set_bgcolor", 1, 0, 0},
- {"mng_set_bkgdstyle", 1, 0, 0},
- {"mng_set_cacheplayback", 1, 0, 2},
- {"mng_set_canvasstyle", 1, 0, 0},
- {"mng_set_dfltimggamma", 1, 0, 0},
- #ifndef MNG_NO_DFLT_INFO
- {"mng_set_dfltimggammaint", 1, 0, 0},
- #endif
- {"mng_set_displaygamma", 1, 0, 0},
- {"mng_set_displaygammaint", 1, 0, 0},
- {"mng_set_doprogressive", 1, 0, 2},
- #ifdef MNG_ACCESS_JPEG
- {"mng_set_jpeg_dctmethod", 1, 0, 0},
- {"mng_set_jpeg_maxjdat", 1, 0, 0},
- {"mng_set_jpeg_optimized", 1, 0, 0},
- {"mng_set_jpeg_progressive", 1, 0, 0},
- {"mng_set_jpeg_quality", 1, 0, 0},
- {"mng_set_jpeg_smoothing", 1, 0, 0},
- #endif
- #ifndef MNG_SKIP_MAXCANVAS
- {"mng_set_maxcanvasheight", 1, 0, 0},
- {"mng_set_maxcanvassize", 1, 0, 0},
- {"mng_set_maxcanvaswidth", 1, 0, 0},
- #endif
- {"mng_set_outputprofile", 1, 0, 0},
- {"mng_set_outputprofile2", 1, 0, 0},
- {"mng_set_outputsrgb", 1, 0, 1},
- {"mng_set_sectionbreaks", 1, 0, 0},
- {"mng_set_speed", 1, 0, 0},
- {"mng_set_srgb", 1, 0, 0},
- {"mng_set_srgbimplicit", 1, 0, 1},
- {"mng_set_srgbprofile", 1, 0, 0},
- {"mng_set_srgbprofile2", 1, 0, 0},
- {"mng_set_storechunks", 1, 0, 0},
- {"mng_set_suspensionmode", 1, 0, 0},
- {"mng_set_usebkgd", 1, 0, 0},
- {"mng_set_userdata", 1, 0, 0},
- #if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS)
- {"mng_set_viewgamma", 1, 0, 0},
- {"mng_set_viewgammaint", 1, 0, 0},
- #endif
- #ifdef MNG_ACCESS_ZLIB
- {"mng_set_zlib_level", 1, 0, 0},
- {"mng_set_zlib_maxidat", 1, 0, 0},
- {"mng_set_zlib_memlevel", 1, 0, 0},
- {"mng_set_zlib_method", 1, 0, 0},
- {"mng_set_zlib_strategy", 1, 0, 0},
- {"mng_set_zlib_windowbits", 1, 0, 0},
- #endif
- #ifndef MNG_NO_OPEN_CLOSE_STREAM
- {"mng_setcb_closestream", 1, 0, 0},
- #endif
- {"mng_setcb_errorproc", 1, 0, 0},
- {"mng_setcb_getalphaline", 1, 0, 0},
- {"mng_setcb_getbkgdline", 1, 0, 0},
- {"mng_setcb_getcanvasline", 1, 0, 0},
- {"mng_setcb_gettickcount", 1, 0, 0},
- {"mng_setcb_memalloc", 1, 0, 0},
- {"mng_setcb_memfree", 1, 0, 0},
- #ifndef MNG_NO_OPEN_CLOSE_STREAM
- {"mng_setcb_openstream", 1, 0, 0},
- #endif
- {"mng_setcb_processarow", 1, 0, 0},
- {"mng_setcb_processchroma", 1, 0, 0},
- {"mng_setcb_processgamma", 1, 0, 0},
- {"mng_setcb_processheader", 1, 0, 0},
- {"mng_setcb_processiccp", 1, 0, 0},
- {"mng_setcb_processmend", 1, 0, 1},
- {"mng_setcb_processneed", 1, 0, 0},
- {"mng_setcb_processsave", 1, 0, 0},
- {"mng_setcb_processseek", 1, 0, 0},
- {"mng_setcb_processsrgb", 1, 0, 0},
- {"mng_setcb_processterm", 1, 0, 2},
- {"mng_setcb_processtext", 1, 0, 0},
- {"mng_setcb_processunknown", 1, 0, 0},
- {"mng_setcb_readdata", 1, 0, 0},
- {"mng_setcb_refresh", 1, 0, 0},
- {"mng_setcb_releasedata", 1, 0, 8},
- {"mng_setcb_settimer", 1, 0, 0},
- {"mng_setcb_traceproc", 1, 0, 0},
- {"mng_setcb_writedata", 1, 0, 0},
- {"mng_status_creating", 1, 0, 0},
- {"mng_status_displaying", 1, 0, 0},
- {"mng_status_dynamic", 1, 0, 5},
- {"mng_status_error", 1, 0, 0},
- {"mng_status_reading", 1, 0, 0},
- {"mng_status_running", 1, 0, 0},
- {"mng_status_runningevent", 1, 0, 5},
- {"mng_status_suspendbreak", 1, 0, 0},
- {"mng_status_timerbreak", 1, 0, 0},
- {"mng_status_writing", 1, 0, 0},
- {"mng_supports_func", 1, 0, 5},
- {"mng_trapevent", 1, 0, 5},
- {"mng_updatemngheader", 1, 0, 0},
- {"mng_updatemngsimplicity", 1, 0, 0},
- {"mng_version_beta", 1, 0, 5},
- {"mng_version_dll", 1, 0, 0},
- {"mng_version_major", 1, 0, 0},
- {"mng_version_minor", 1, 0, 0},
- {"mng_version_release", 1, 0, 0},
- {"mng_version_so", 1, 0, 0},
- {"mng_version_text", 1, 0, 0},
- {"mng_write", 1, 0, 0},
- };
- mng_bool MNG_DECL mng_supports_func (mng_pchar zFunction,
- mng_uint8* iMajor,
- mng_uint8* iMinor,
- mng_uint8* iRelease)
- {
- mng_int32 iTop, iLower, iUpper, iMiddle;
- mng_func_entryp pEntry; /* pointer to found entry */
- /* determine max index of table */
- iTop = (sizeof (func_table) / sizeof (func_table [0])) - 1;
- iLower = 0; /* initialize binary search */
- iMiddle = iTop >> 1; /* start in the middle */
- iUpper = iTop;
- pEntry = 0; /* no goods yet! */
- do /* the binary search itself */
- {
- mng_int32 iRslt = strcmp(func_table [iMiddle].zFunction, zFunction);
- if (iRslt < 0)
- iLower = iMiddle + 1;
- else if (iRslt > 0)
- iUpper = iMiddle - 1;
- else
- {
- pEntry = &func_table [iMiddle];
- break;
- };
- iMiddle = (iLower + iUpper) >> 1;
- }
- while (iLower <= iUpper);
- if (pEntry) /* found it ? */
- {
- *iMajor = pEntry->iMajor;
- *iMinor = pEntry->iMinor;
- *iRelease = pEntry->iRelease;
- return MNG_TRUE;
- }
- else
- {
- *iMajor = 0;
- *iMinor = 0;
- *iRelease = 0;
- return MNG_FALSE;
- }
- }
- #endif
- /* *****************************************************************…