translations.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
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
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 }
00397
00398 #endif
00399
00400 NAMESPACE_LIBDAR_END
00401
00402 #endif