📄 libmng_callback_xs.c
字号:
/* ************************************************************************** *//* * For conditions of distribution and use, * *//* * see copyright notice in libmng.h * *//* ************************************************************************** *//* * * *//* * project : libmng * *//* * file : libmng_callback_xs.c copyright (c) 2000 G.Juyn * *//* * version : 1.0.2 * *//* * * *//* * purpose : callback get/set interface (implementation) * *//* * * *//* * author : G.Juyn * *//* * web : http://www.3-t.com * *//* * email : mailto:info@3-t.com * *//* * * *//* * comment : implementation of the callback get/set functions * *//* * * *//* * changes : 0.5.1 - 05/08/2000 - G.Juyn * *//* * - fixed calling convention * *//* * - changed strict-ANSI stuff * *//* * 0.5.1 - 05/12/2000 - G.Juyn * *//* * - changed trace to macro for callback error-reporting * *//* * * *//* * 0.5.2 - 05/31/2000 - G.Juyn * *//* * - fixed up punctuation (contribution by Tim Rowley) * *//* * 0.5.2 - 06/02/2000 - G.Juyn * *//* * - added getalphaline callback for RGB8_A8 canvasstyle * *//* * * *//* * 0.9.1 - 07/15/2000 - G.Juyn * *//* * - added callbacks for SAVE/SEEK processing * *//* * * *//* * 0.9.2 - 08/05/2000 - G.Juyn * *//* * - changed file-prefixes * *//* * * *//* * 0.9.3 - 10/11/2000 - G.Juyn * *//* * - added support for nEED * *//* * 0.9.3 - 10/17/2000 - G.Juyn * *//* * - added callback to process non-critical unknown chunks * *//* * * *//* * 1.0.1 - 02/08/2001 - G.Juyn * *//* * - added MEND processing callback * *//* * * *//* * 1.0.2 - 06/23/2001 - G.Juyn * *//* * - added processterm callback * *//* * * *//* ************************************************************************** */#include "libmng.h"#include "libmng_data.h"#include "libmng_error.h"#include "libmng_trace.h"#ifdef __BORLANDC__#pragma hdrstop#endif#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)#pragma option -A /* force ANSI-C */#endif/* ************************************************************************** *//* * * *//* * Callback set functions * *//* * * *//* ************************************************************************** */#ifndef MNG_INTERNAL_MEMMNGMTmng_retcode MNG_DECL mng_setcb_memalloc (mng_handle hHandle, mng_memalloc fProc){#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_MEMALLOC, MNG_LC_START)#endif MNG_VALIDHANDLE (hHandle) ((mng_datap)hHandle)->fMemalloc = fProc;#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_MEMALLOC, MNG_LC_END)#endif return MNG_NOERROR;}#endif /* MNG_INTERNAL_MEMMNGMT *//* ************************************************************************** */#ifndef MNG_INTERNAL_MEMMNGMTmng_retcode MNG_DECL mng_setcb_memfree (mng_handle hHandle, mng_memfree fProc){#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_MEMFREE, MNG_LC_START)#endif MNG_VALIDHANDLE (hHandle) ((mng_datap)hHandle)->fMemfree = fProc;#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_MEMFREE, MNG_LC_END)#endif return MNG_NOERROR;}#endif /* MNG_INTERNAL_MEMMNGMT *//* ************************************************************************** */#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)mng_retcode MNG_DECL mng_setcb_openstream (mng_handle hHandle, mng_openstream fProc){#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_OPENSTREAM, MNG_LC_START)#endif MNG_VALIDHANDLE (hHandle) ((mng_datap)hHandle)->fOpenstream = fProc;#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_OPENSTREAM, MNG_LC_END)#endif return MNG_NOERROR;}#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE *//* ************************************************************************** */#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE)mng_retcode MNG_DECL mng_setcb_closestream (mng_handle hHandle, mng_closestream fProc){#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_CLOSESTREAM, MNG_LC_START)#endif MNG_VALIDHANDLE (hHandle) ((mng_datap)hHandle)->fClosestream = fProc;#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_CLOSESTREAM, MNG_LC_END)#endif return MNG_NOERROR;}#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE *//* ************************************************************************** */#ifdef MNG_SUPPORT_READmng_retcode MNG_DECL mng_setcb_readdata (mng_handle hHandle, mng_readdata fProc){#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_READDATA, MNG_LC_START)#endif MNG_VALIDHANDLE (hHandle) ((mng_datap)hHandle)->fReaddata = fProc;#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_READDATA, MNG_LC_END)#endif return MNG_NOERROR;}#endif /* MNG_SUPPORT_READ *//* ************************************************************************** */#ifdef MNG_SUPPORT_WRITEmng_retcode MNG_DECL mng_setcb_writedata (mng_handle hHandle, mng_writedata fProc){#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_WRITEDATA, MNG_LC_START)#endif MNG_VALIDHANDLE (hHandle) ((mng_datap)hHandle)->fWritedata = fProc;#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_WRITEDATA, MNG_LC_END)#endif return MNG_NOERROR;}#endif /* MNG_SUPPORT_WRITE *//* ************************************************************************** */mng_retcode MNG_DECL mng_setcb_errorproc (mng_handle hHandle, mng_errorproc fProc){#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_ERRORPROC, MNG_LC_START)#endif MNG_VALIDHANDLE (hHandle) ((mng_datap)hHandle)->fErrorproc = fProc;#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_ERRORPROC, MNG_LC_END)#endif return MNG_NOERROR;}/* ************************************************************************** */#ifdef MNG_SUPPORT_TRACEmng_retcode MNG_DECL mng_setcb_traceproc (mng_handle hHandle, mng_traceproc fProc){#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_TRACEPROC, MNG_LC_START)#endif MNG_VALIDHANDLE (hHandle) ((mng_datap)hHandle)->fTraceproc = fProc;#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_TRACEPROC, MNG_LC_END)#endif return MNG_NOERROR;}#endif /* MNG_SUPPORT_TRACE *//* ************************************************************************** */#ifdef MNG_SUPPORT_READmng_retcode MNG_DECL mng_setcb_processheader (mng_handle hHandle, mng_processheader fProc){#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSHEADER, MNG_LC_START)#endif MNG_VALIDHANDLE (hHandle) ((mng_datap)hHandle)->fProcessheader = fProc;#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSHEADER, MNG_LC_END)#endif return MNG_NOERROR;}#endif /* MNG_SUPPORT_READ *//* ************************************************************************** */#ifdef MNG_SUPPORT_READmng_retcode MNG_DECL mng_setcb_processtext (mng_handle hHandle, mng_processtext fProc){#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSTEXT, MNG_LC_START)#endif MNG_VALIDHANDLE (hHandle) ((mng_datap)hHandle)->fProcesstext = fProc;#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSTEXT, MNG_LC_END)#endif return MNG_NOERROR;}#endif /* MNG_SUPPORT_READ *//* ************************************************************************** */#ifdef MNG_SUPPORT_READmng_retcode MNG_DECL mng_setcb_processsave (mng_handle hHandle, mng_processsave fProc){#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSSAVE, MNG_LC_START)#endif MNG_VALIDHANDLE (hHandle) ((mng_datap)hHandle)->fProcesssave = fProc;#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSSAVE, MNG_LC_END)#endif return MNG_NOERROR;}#endif /* MNG_SUPPORT_READ *//* ************************************************************************** */#ifdef MNG_SUPPORT_READmng_retcode MNG_DECL mng_setcb_processseek (mng_handle hHandle, mng_processseek fProc){#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSSEEK, MNG_LC_START)#endif MNG_VALIDHANDLE (hHandle) ((mng_datap)hHandle)->fProcessseek = fProc;#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSSEEK, MNG_LC_END)#endif return MNG_NOERROR;}#endif /* MNG_SUPPORT_READ *//* ************************************************************************** */#ifdef MNG_SUPPORT_READmng_retcode MNG_DECL mng_setcb_processneed (mng_handle hHandle, mng_processneed fProc){#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSNEED, MNG_LC_START)#endif MNG_VALIDHANDLE (hHandle) ((mng_datap)hHandle)->fProcessneed = fProc;#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSNEED, MNG_LC_END)#endif return MNG_NOERROR;}#endif /* MNG_SUPPORT_READ *//* ************************************************************************** */#ifdef MNG_SUPPORT_READmng_retcode MNG_DECL mng_setcb_processmend (mng_handle hHandle, mng_processmend fProc){#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSMEND, MNG_LC_START)#endif MNG_VALIDHANDLE (hHandle) ((mng_datap)hHandle)->fProcessmend = fProc;#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSMEND, MNG_LC_END)#endif return MNG_NOERROR;}#endif /* MNG_SUPPORT_READ *//* ************************************************************************** */#ifdef MNG_SUPPORT_READmng_retcode MNG_DECL mng_setcb_processunknown (mng_handle hHandle, mng_processunknown fProc){#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSUNKNOWN, MNG_LC_START)#endif MNG_VALIDHANDLE (hHandle) ((mng_datap)hHandle)->fProcessunknown = fProc;#ifdef MNG_SUPPORT_TRACE MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSUNKNOWN, MNG_LC_END)#endif return MNG_NOERROR;}#endif /* MNG_SUPPORT_READ *//* ************************************************************************** */#ifdef MNG_SUPPORT_READmng_retcode MNG_DECL mng_setcb_processterm (mng_handle hHandle, mng_processterm fProc){#ifdef MNG_SUPPORT_TRACE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -