diff options
author | Sverker Eriksson <[email protected]> | 2011-03-16 16:13:20 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2011-03-16 19:25:26 +0100 |
commit | 261a3e9b465a1d9cbd0361c5d3801bf63950e623 (patch) | |
tree | 87eb67de5098ca617f2960c9c0b416b4e1b7ad63 /erts/lib_src/common | |
parent | 5fe2a6bd99fcc84cf7eb7260e1ccda29ff8e9255 (diff) | |
download | otp-261a3e9b465a1d9cbd0361c5d3801bf63950e623.tar.gz otp-261a3e9b465a1d9cbd0361c5d3801bf63950e623.tar.bz2 otp-261a3e9b465a1d9cbd0361c5d3801bf63950e623.zip |
erts_printf %be to print integers of size Eterm
Existing %bp to print pointer size integers does not work in halfword
emulator to print Eterm size integers.
Diffstat (limited to 'erts/lib_src/common')
-rw-r--r-- | erts/lib_src/common/erl_printf_format.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/erts/lib_src/common/erl_printf_format.c b/erts/lib_src/common/erl_printf_format.c index bd3d38e649..968d563325 100644 --- a/erts/lib_src/common/erl_printf_format.c +++ b/erts/lib_src/common/erl_printf_format.c @@ -1,7 +1,7 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 2005-2009. All Rights Reserved. + * Copyright Ericsson AB 2005-2011. All Rights Reserved. * * The contents of this file are subject to the Erlang Public License, * Version 1.1, (the "License"); you may not use this file except in @@ -27,7 +27,7 @@ * length: hh | h | l | ll | L | j | t | b<sz> * conversion: d,i | o,u,x,X | e,E | f,F | g,G | a,A | c | s | T | * p | n | % - * sz: 8 | 16 | 32 | 64 | p + * sz: 8 | 16 | 32 | 64 | p | e */ /* Without this, variable argument lists break on VxWorks */ @@ -76,6 +76,18 @@ #endif #endif +#ifndef ERTS_SIZEOF_ETERM +# ifdef HALFWORD_HEAP_EMULATOR +# if SIZEOF_VOID_P == 8 +# define ERTS_SIZEOF_ETERM 4 +# else +# error "HALFWORD_HEAP_EMULATOR only allowed on 64-bit architecture" +# endif +# else +# define ERTS_SIZEOF_ETERM SIZEOF_VOID_P +# endif +#endif + #if defined(__GNUC__) # undef inline # define inline __inline__ @@ -520,6 +532,17 @@ int erts_printf_format(fmtfn_t fn, void* arg, char* fmt, va_list ap) #error No integer datatype with the same size as 'void *' found #endif } + else if (*ptr == 'e') { + ptr++; +#if SIZEOF_INT == ERTS_SIZEOF_ETERM +#elif SIZEOF_LONG == ERTS_SIZEOF_ETERM + fmt |= FMTL_l; +#elif SIZEOF_LONG_LONG == ERTS_SIZEOF_ETERM + fmt |= FMTL_ll; +#else +#error No integer datatype with the same size as Eterm found +#endif + } else { int bits = 0; while(isdigit((int) *ptr)) |