• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kviewshell

DjVuGlobal.h

Go to the documentation of this file.
00001 //C-  -*- C++ -*-
00002 //C- -------------------------------------------------------------------
00003 //C- DjVuLibre-3.5
00004 //C- Copyright (c) 2002  Leon Bottou and Yann Le Cun.
00005 //C- Copyright (c) 2001  AT&T
00006 //C-
00007 //C- This software is subject to, and may be distributed under, the
00008 //C- GNU General Public License, Version 2. The license should have
00009 //C- accompanied the software or you may obtain a copy of the license
00010 //C- from the Free Software Foundation at http://www.fsf.org .
00011 //C-
00012 //C- This program is distributed in the hope that it will be useful,
00013 //C- but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 //C- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 //C- GNU General Public License for more details.
00016 //C- 
00017 //C- DjVuLibre-3.5 is derived from the DjVu(r) Reference Library
00018 //C- distributed by Lizardtech Software.  On July 19th 2002, Lizardtech 
00019 //C- Software authorized us to replace the original DjVu(r) Reference 
00020 //C- Library notice by the following text (see doc/lizard2002.djvu):
00021 //C-
00022 //C-  ------------------------------------------------------------------
00023 //C- | DjVu (r) Reference Library (v. 3.5)
00024 //C- | Copyright (c) 1999-2001 LizardTech, Inc. All Rights Reserved.
00025 //C- | The DjVu Reference Library is protected by U.S. Pat. No.
00026 //C- | 6,058,214 and patents pending.
00027 //C- |
00028 //C- | This software is subject to, and may be distributed under, the
00029 //C- | GNU General Public License, Version 2. The license should have
00030 //C- | accompanied the software or you may obtain a copy of the license
00031 //C- | from the Free Software Foundation at http://www.fsf.org .
00032 //C- |
00033 //C- | The computer code originally released by LizardTech under this
00034 //C- | license and unmodified by other parties is deemed "the LIZARDTECH
00035 //C- | ORIGINAL CODE."  Subject to any third party intellectual property
00036 //C- | claims, LizardTech grants recipient a worldwide, royalty-free, 
00037 //C- | non-exclusive license to make, use, sell, or otherwise dispose of 
00038 //C- | the LIZARDTECH ORIGINAL CODE or of programs derived from the 
00039 //C- | LIZARDTECH ORIGINAL CODE in compliance with the terms of the GNU 
00040 //C- | General Public License.   This grant only confers the right to 
00041 //C- | infringe patent claims underlying the LIZARDTECH ORIGINAL CODE to 
00042 //C- | the extent such infringement is reasonably necessary to enable 
00043 //C- | recipient to make, have made, practice, sell, or otherwise dispose 
00044 //C- | of the LIZARDTECH ORIGINAL CODE (or portions thereof) and not to 
00045 //C- | any greater extent that may be necessary to utilize further 
00046 //C- | modifications or combinations.
00047 //C- |
00048 //C- | The LIZARDTECH ORIGINAL CODE is provided "AS IS" WITHOUT WARRANTY
00049 //C- | OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
00050 //C- | TO ANY WARRANTY OF NON-INFRINGEMENT, OR ANY IMPLIED WARRANTY OF
00051 //C- | MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
00052 //C- +------------------------------------------------------------------
00053 // 
00054 // $Id: DjVuGlobal.h,v 1.10 2004/08/04 02:36:59 leonb Exp $
00055 // $Name: release_3_5_15 $
00056 
00057 #ifndef _DJVUGLOBAL_H
00058 #define _DJVUGLOBAL_H
00059 #ifdef HAVE_CONFIG_H
00060 # include "config.h"
00061 #endif
00062 #if NEED_GNUG_PRAGMAS
00063 # pragma interface
00064 #endif
00065 
00066 #if defined(UNDER_CE)
00067 # ifndef __WCEALT_H__
00068 inline void * operator new(size_t, void * ptr) { return ptr; }
00069 # endif
00070 #elif defined(HAVE_STDINCLUDES)
00071 # include <new>
00072 #else
00073 # include <new.h>
00074 #endif
00075 
00076 #ifdef WIN32
00077 # ifdef DLL_EXPORT
00078 #  define DJVUAPI __declspec(dllexport)
00079 # else
00080 #  ifdef LIBDJVU_DLL_IMPORT 
00081 #   define DJVUAPI __declspec(dllimport)
00082 #  endif
00083 # endif
00084 #endif
00085 #ifndef DJVUAPI
00086 # define DJVUAPI
00087 #endif
00088 
00089 
00108 
00109 
00119 
00120 
00121 #ifdef NEED_DJVU_MEMORY
00122 
00123 # include "DjVu.h"
00124 
00125 // These define the two callbacks needed for C++
00126 typedef void djvu_delete_callback(void *);
00127 typedef void *djvu_new_callback(size_t);
00128 
00129 // These functions allow users to set the callbacks.
00130 int djvu_memoryObject_callback ( djvu_delete_callback*, djvu_new_callback*);
00131 int djvu_memoryArray_callback ( djvu_delete_callback*, djvu_new_callback*);
00132 
00133 // We need to use this inline function in all modules, but we never want it to
00134 // appear in the symbol table.  It seems different compilers need different
00135 // directives to do this...
00136 # ifndef STATIC_INLINE
00137 #  ifdef __GNUC__
00138 #   define STATIC_INLINE extern inline
00139 #  else /* !__GNUC__ */
00140 #   define STATIC_INLINE static inline
00141 #  endif /* __GNUC__ */
00142 # endif /* STATIC_INLINE */
00143 
00144 // This clause is used when overriding operator new
00145 // because the standard has slightly changed.
00146 # if defined( __GNUC__ ) && ( __GNUC__*1000 + __GNUC_MINOR__ >= 2091 )
00147 #  ifndef new_throw_spec
00148 #   define new_throw_spec throw(std::bad_alloc)
00149 #  endif /* new_throw_spec */
00150 #  ifndef delete_throw_spec
00151 #   define delete_throw_spec throw()
00152 #  endif /* delete_throw_spec */
00153 # endif /* __GNUC__ ... */
00154 // Old style
00155 # ifndef new_throw_spec
00156 #  define new_throw_spec
00157 # endif /* new_throw_spec */
00158 # ifndef delete_throw_spec
00159 #  define delete_throw_spec
00160 # endif  /* delete_throw_spec */
00161 
00162 # ifdef UNIX
00163 extern djvu_new_callback *_djvu_new_ptr;
00164 extern djvu_new_callback *_djvu_newArray_ptr;
00165 extern djvu_delete_callback *_djvu_delete_ptr;
00166 extern djvu_delete_callback *_djvu_deleteArray_ptr;
00167 
00168 #  ifndef NEED_DJVU_MEMORY_IMPLEMENTATION
00169 void *operator new (size_t) new_throw_spec;
00170 void *operator new[] (size_t) new_throw_spec;
00171 void operator delete (void *) delete_throw_spec;
00172 void operator delete[] (void *) delete_throw_spec;
00173 
00174 STATIC_INLINE void *
00175 operator new(size_t sz) new_throw_spec
00176 { return (*_djvu_new_ptr)(sz); }
00177 STATIC_INLINE void
00178 operator delete(void *addr) delete_throw_spec
00179 { return (*_djvu_delete_ptr)(addr); }
00180 STATIC_INLINE void *
00181 operator new [] (size_t sz) new_throw_spec
00182 { return (*_djvu_newArray_ptr)(sz); }
00183 STATIC_INLINE void
00184 operator delete [] (void *addr) delete_throw_spec
00185 { return (*_djvu_deleteArray_ptr)(addr); }
00186 #  endif /* NEED_DJVU_MEMORY_IMPLEMENTATION */
00187 
00188 # else /* UNIX */
00189 
00190 #  ifndef NEED_DJVU_MEMORY_IMPLEMENTATION
00191 STATIC_INLINE void *
00192 operator new(size_t sz) new_throw_spec
00193 { return _djvu_new(sz); }
00194 inline_as_macro void
00195 operator delete(void *addr) delete_throw_spec
00196 { return _djvu_delete(addr); }
00197 inline_as_macro void *
00198 operator new [] (size_t sz) new_throw_spec
00199 { return _djvu_new(sz); }
00200 inline_as_macro void
00201 operator delete [] (void *addr) delete_throw_spec
00202 { _djvu_deleteArray(addr); }
00203 #  endif /* !NEED_DJVU_MEMORY_IMPLEMENTATION */
00204 
00205 # endif /* UNIX */
00206 
00207 #else
00208 
00209 # define _djvu_free(ptr) free((ptr))
00210 # define _djvu_malloc(siz) malloc((siz))
00211 # define _djvu_realloc(ptr,siz) realloc((ptr),(siz))
00212 # define _djvu_calloc(siz,items) calloc((siz),(items))
00213 
00214 #endif /* NEED_DJVU_MEMORY */
00215 
00249 
00250 #ifndef HAS_DJVU_PROGRESS_CALLBACKS
00251 # define HAS_DJVU_PROGRESS_CALLBACKS
00252 
00253 # ifdef NEED_DJVU_PROGRESS
00254 #  include "DjVu.h"
00255 
00256 extern djvu_progress_callback *_djvu_progress_ptr;
00257 
00258 #  define DJVU_PROGRESS_TASK(name,task,nsteps)  DjVuProgressTask task_##name(task,nsteps)
00259 #  define DJVU_PROGRESS_RUN(name,tostep)   { task_##name.run(tostep); }
00260 
00261 class DjVuProgressTask
00262 {
00263 public:
00264   class Data;
00265   ~DjVuProgressTask();
00266   DjVuProgressTask(const char *task,int nsteps);
00267   void run(int tostep);
00268   const char *task;
00269   static djvu_progress_callback *set_callback(djvu_progress_callback *ptr=0);
00270 private:
00271   DjVuProgressTask *parent;
00272   int nsteps;
00273   int runtostep;
00274   unsigned long startdate;
00275   // Statics
00276   void *gdata;
00277   Data *data;
00278   // Helpers
00279   void signal(unsigned long curdate, unsigned long estdate);
00280 };
00281 
00282 # else  // ! NEED_DJVU_PROGRESS
00283 
00284 #  define DJVU_PROGRESS_TASK(name,task,nsteps)
00285 #  define DJVU_PROGRESS_RUN(name,step)
00286 
00287 # endif // ! NEED_DJVU_PROGRESS
00288 #endif // HAS_DJVU_PROGRESS_CALLBACKS
00289 
00290 
00291 
00298 #ifdef __cplusplus
00299 # define DJVUEXTERNCAPI(x) extern "C" DJVUAPI x;
00300 #else
00301 # define DJVUEXTERNCAPI(x) extern DJVUAPI x
00302 #endif
00303 
00305 DJVUEXTERNCAPI(void DjVuPrintErrorUTF8(const char *fmt, ...))
00306 
00307 
00308 DJVUEXTERNCAPI(void DjVuPrintErrorNative(const char *fmt, ...))
00309 
00311 DJVUEXTERNCAPI(void DjVuPrintMessageUTF8(const char *fmt, ...))
00312 
00314 DJVUEXTERNCAPI(void DjVuPrintMessageNative(const char *fmt, ...))
00315 
00318 DJVUEXTERNCAPI(void DjVuFormatErrorUTF8(const char *fmt, ...))
00319 
00322 DJVUEXTERNCAPI(void DjVuFormatErrorNative(const char *fmt, ...))
00323 
00325 DJVUEXTERNCAPI(void DjVuWriteError( const char *message ))
00326 
00328 DJVUEXTERNCAPI(void DjVuWriteMessage( const char *message ))
00329 
00336 DJVUEXTERNCAPI(void DjVuMessageLookUpUTF8(
00337   char *msg_buffer, const unsigned int buffer_size, 
00338   const char *message ))
00339 DJVUEXTERNCAPI(void DjVuMessageLookUpNative(
00340   char *msg_buffer, const unsigned int buffer_size, 
00341   const char *message ))
00342 
00346 DJVUEXTERNCAPI(const char *djvu_programname(const char *programname))
00347 
00348 
00357 
00358 
00359 #ifdef NEED_DJVU_NAMES
00360 /* The contents of this section may be generated by this shell command :
00361  * % egrep -h '^(class|struct) +[A-Z_][A-Za-z0-9_]*' *.h *.cpp |\
00362  *   sed -e 's:[a-z]*  *\([A-Za-z_][A-Za-z0-9_]*\).*:#define \1 DJVU_\1:g' |\
00363  *   sort
00364  */
00365 #endif // NEED_DJVU_NAMES
00366 
00368 
00369 #if defined(macintosh)
00370 # define EMPTY_LOOP continue
00371 #else
00372 # define EMPTY_LOOP /* nop */
00373 #endif
00374 
00375 //  The ERR_MSG(x) macro is intended to permit automated checking of the
00376 //  externalized error message names against the source code. It has no
00377 //  effect on the executed program. It should be used to surround each
00378 //  message name that will need to be looked up in the external message
00379 //  files. In particular, it should use on all strings passed to G_THROW.
00380 #ifndef HAS_CTRL_C_IN_ERR_MSG
00381 # define HAS_CTRL_C_IN_ERR_MSG 1
00382 #endif
00383 #ifndef ERR_MSG
00384 # if HAS_CTRL_C_IN_ERR_MSG
00385 // This hack allows for the coexistence of internationalized
00386 // and non-internationalized code.  All internationalized error
00387 // message names are prefixed with a ctrl-c.  Only these will
00388 // be looked for in the message files.  Messages that do no 
00389 // start with a ctrl-c will remain untranslated.
00390 #  define ERR_MSG(x) "\003" x
00391 # else
00392 #  define ERR_MSG(x) x
00393 # endif
00394 #endif
00395 
00396 #endif /* _DJVUGLOBAL_H_ */
00397 
00398 

kviewshell

Skip menu "kviewshell"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • kviewshell
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal