Main Page   Modules   Data Structures   File List   Data Fields   Globals  

translations.h

Go to the documentation of this file.
00001 /*
00002  * translations.h
00003  * Created on 13 Feb 2005
00004  * Authors:
00005  *    Wesley Leggette <wleggette@kaylix.net>
00006  * 
00007  * 
00008  * 
00009  * libdarc
00010  * 
00011  * 
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025  * 
00026  * $Id: translations_8h-source.html 708 2005-03-21 12:30:37Z leggwes $
00027  */
00028  
00035 #ifndef TRANSLATIONS_H
00036 #define TRANSLATIONS_H
00037 #include "integers.h"
00038 #include "cross_platform.h"
00039 
00040 
00041 #if LIBDARC_HAVE_STRING_H
00042 #include <string.h>
00043 #endif
00044 #if LIBDARC_HAVE_STRINGS_H
00045 #include <strings.h>
00046 #endif
00047 #if LIBDARC_HAVE_STDBOOL_H
00048 #include <stdbool.h>
00049 #endif
00050 
00051 #ifndef TRANSLATIONS_H_INTERNAL
00052 # ifdef LIBDARC_DEBUG
00053 extern char break_buffer[30];
00054 # endif
00055 #endif
00056 
00057 #ifdef LIBDARC_DEBUG
00058 #  if HAVE_STDIO_H
00059 #    include <stdio.h>
00060 #  else
00061 #    error "stdio.h is needed to print debug messages, try configuring without --enable-debug"
00062 #  endif
00063 #  define DEBUG(message...) fprintf(stderr, message)
00064 #  define BREAK(message) \
00065 fprintf(stderr, "BREAK: "); fprintf(stderr, "%s  ", message); \
00066 gets(break_buffer);
00067 #else
00068 #  define DEBUG(message...)
00069 #  define BREAK(message)
00070 #endif
00071 
00081 #define LIBDARC_EXCEPTION( container, etype, emessage ) \
00082 container->type = etype; \
00083 container->message = (char*)malloc(strlen(emessage) + 1); \
00084 if ( container->message != NULL ) { strcpy(exception->message, emessage); } \
00085 DEBUG("Throwing exception: "); DEBUG(emessage); DEBUG("\n");
00086 
00087 
00088 #ifdef __cplusplus
00089 #define NAMESPACE_LIBDAR_START namespace libdar {
00090 #define NAMESPACE_LIBDAR_END   }
00091 #else
00092 #define NAMESPACE_LIBDAR_START
00093 #define NAMESPACE_LIBDAR_END
00094 #endif
00095 
00096 NAMESPACE_LIBDAR_START
00097 
00098 #ifdef __cplusplus
00099 extern "C" {
00100 #endif
00101 /* beginning of extern section */
00102 
00103 struct _dar_infinint;
00104 typedef struct _dar_infinint dar_infinint;
00105 
00135 DLLIMPORT void dar_infinint_destroy(dar_infinint* ref);
00136 
00138 DLLIMPORT dar_infinint *dar_infinint_copy(dar_infinint* ref);
00139 
00140 
00141 
00182 DLLIMPORT void dar_infinint_add( dar_infinint** a, dar_infinint* b );
00183 DLLIMPORT void dar_infinint_sub( dar_infinint** a, dar_infinint* b );
00184 DLLIMPORT void dar_infinint_mult( dar_infinint** a, dar_infinint* b );
00185 DLLIMPORT void dar_infinint_div( dar_infinint** a, dar_infinint* b );
00186 DLLIMPORT void dar_infinint_pow( dar_infinint** a, dar_infinint* b );
00187 DLLIMPORT void dar_infinint_powi( dar_infinint** a, int exp );
00188 DLLIMPORT void dar_infinint_shiftl( dar_infinint** a, dar_infinint* b );
00189 DLLIMPORT void dar_infinint_shiftli( dar_infinint** a, int bit );
00190 DLLIMPORT void dar_infinint_shiftr( dar_infinint** a, dar_infinint* b );
00191 DLLIMPORT void dar_infinint_shiftri( dar_infinint** a, int bit );
00192 DLLIMPORT void dar_infinint_mod( dar_infinint** a, dar_infinint* b );
00193 DLLIMPORT void dar_infinint_increment( dar_infinint** a );
00194 DLLIMPORT void dar_infinint_decrement( dar_infinint** a );
00195 DLLIMPORT void dar_infinint_euclide( dar_infinint* a, dar_infinint* b,
00196                                 dar_infinint** q, dar_infinint** r );
00197 
00198 DLLIMPORT bool dar_infinint_comp_eq( dar_infinint* a, dar_infinint* b );
00199 DLLIMPORT bool dar_infinint_comp_leq( dar_infinint* a, dar_infinint* b );
00200 DLLIMPORT bool dar_infinint_comp_l( dar_infinint* a, dar_infinint* b );
00201 DLLIMPORT bool dar_infinint_comp_geq( dar_infinint* a, dar_infinint* b );
00202 DLLIMPORT bool dar_infinint_comp_g( dar_infinint* a, dar_infinint* b );
00203 DLLIMPORT bool dar_infinint_comp_neq( dar_infinint* a, dar_infinint* b );
00204 
00205 
00320     DLLIMPORT dar_infinint *dar_infpi(int num);
00321     
00322 #if LIBDARC_OS_BITS == 64
00323     DLLIMPORT dar_infinint *dar_infi(U_64 num);
00324 #else
00325 
00326     DLLIMPORT dar_infinint *dar_infi(U_32 num);
00327 #endif
00328 
00329     DLLIMPORT dar_infinint *dar_infu32(U_32 num);
00331     DLLIMPORT dar_infinint *dar_infu64(U_64 num);
00332 
00334     DLLIMPORT dar_infinint *dar_infds(char* num);
00336     DLLIMPORT dar_infinint *dar_infhs(char* num);
00343     DLLIMPORT dar_infinint *dar_infbin(U_8* num);
00344     
00370     DLLIMPORT int           dar_piinf   (bool* overflow, dar_infinint* box);
00371 #if LIBDARC_OS_BITS == 64
00372     DLLIMPORT U_64          dar_iinf    (bool* overflow, dar_infinint* box);
00373 #else
00374 
00375     DLLIMPORT U_32          dar_iinf    (bool* overflow, dar_infinint* box);
00376 #endif
00377 
00378     DLLIMPORT U_32          dar_u32inf  (bool* overflow, dar_infinint* box);
00380     DLLIMPORT U_64          dar_u64inf  (bool* overflow, dar_infinint* box);
00382     DLLIMPORT char*         dar_dsinf   (U_I* length, dar_infinint* box);
00384     DLLIMPORT char*         dar_hsinf   (U_I* length, dar_infinint* box);
00386     DLLIMPORT U_8*          dar_bininf  (U_I* length, dar_infinint* box);
00387 
00394 #ifdef __cplusplus
00395 
00396 } /* end of extern section */
00397 
00398 #endif
00399 
00400 NAMESPACE_LIBDAR_END
00401 
00402 #endif /* end of TRANSLATIONS_H */