diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/ChangeLog | 7 | ||||
-rw-r--r-- | include/cipher.h | 13 | ||||
-rw-r--r-- | include/i18n.h | 4 | ||||
-rw-r--r-- | include/iobuf.h | 9 | ||||
-rw-r--r-- | include/memory.h | 17 | ||||
-rw-r--r-- | include/mpi.h | 10 | ||||
-rw-r--r-- | include/types.h | 8 | ||||
-rw-r--r-- | include/util.h | 22 |
8 files changed, 80 insertions, 10 deletions
diff --git a/include/ChangeLog b/include/ChangeLog index 232d4b3e2..128176c10 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,10 @@ +2001-08-20 Werner Koch <[email protected]> + + * util.h [__riscos__]: Added prototypes and made sure that we + never use __attribute__. + * cipher.h, iobuf.h, memory.h, mpi.h [__riscos__]: extern hack. + * i18n.h [__riscos__]: Use another include file + 2001-05-30 Werner Koch <[email protected]> * ttyio.h (tty_printf): Add missing parenthesis for non gcc. diff --git a/include/cipher.h b/include/cipher.h index 8e7c26669..6863f98ec 100644 --- a/include/cipher.h +++ b/include/cipher.h @@ -91,10 +91,17 @@ struct gcry_md_context { typedef struct gcry_md_context *MD_HANDLE; +#ifndef EXTERN_UNLESS_MAIN_MODULE + #if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE) + #define EXTERN_UNLESS_MAIN_MODULE extern + #else + #define EXTERN_UNLESS_MAIN_MODULE + #endif +#endif +EXTERN_UNLESS_MAIN_MODULE int g10c_debug_mode; +EXTERN_UNLESS_MAIN_MODULE int g10_opt_verbose; +EXTERN_UNLESS_MAIN_MODULE const char *g10_opt_homedir; -int g10c_debug_mode; -int g10_opt_verbose; -const char *g10_opt_homedir; /*-- dynload.c --*/ void register_cipher_extension( const char *mainpgm, const char *fname ); diff --git a/include/i18n.h b/include/i18n.h index efae5f2d9..0b270687a 100644 --- a/include/i18n.h +++ b/include/i18n.h @@ -34,7 +34,11 @@ #endif #ifdef ENABLE_NLS +#ifndef __riscos__ #include <libintl.h> +#else + #include "libgettext.h" +#endif /* __riscos__ */ #define _(a) gettext (a) #ifdef gettext_noop #define N_(a) gettext_noop (a) diff --git a/include/iobuf.h b/include/iobuf.h index 595186f6e..f94cf4d28 100644 --- a/include/iobuf.h +++ b/include/iobuf.h @@ -71,7 +71,14 @@ struct iobuf_struct { } unget; }; -int iobuf_debug_mode; +#ifndef EXTERN_UNLESS_MAIN_MODULE + #if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE) + #define EXTERN_UNLESS_MAIN_MODULE extern + #else + #define EXTERN_UNLESS_MAIN_MODULE + #endif +#endif +EXTERN_UNLESS_MAIN_MODULE int iobuf_debug_mode; void iobuf_enable_special_filenames ( int yes ); IOBUF iobuf_alloc(int use, size_t bufsize); diff --git a/include/memory.h b/include/memory.h index 76acd8732..5a405d18b 100644 --- a/include/memory.h +++ b/include/memory.h @@ -25,7 +25,11 @@ #ifndef STR #define STR(v) #v #endif -#define M_DBGINFO(a) __FUNCTION__ "["__FILE__ ":" STR(a) "]" +#ifndef __riscos__ + #define M_DBGINFO(a) __FUNCTION__ "["__FILE__ ":" STR(a) "]" +#else /* __riscos__ */ + #define M_DBGINFO(a) "["__FILE__ ":" STR(a) "]" +#endif /* __riscos__ */ #define m_alloc(n) m_debug_alloc((n), M_DBGINFO( __LINE__ ) ) #define m_alloc_clear(n) m_debug_alloc_clear((n), M_DBGINFO(__LINE__) ) #define m_alloc_secure(n) m_debug_alloc((n), M_DBGINFO(__LINE__) ) @@ -76,9 +80,16 @@ unsigned secmem_get_flags(void); #define DBG_MEMORY memory_debug_mode #define DBG_MEMSTAT memory_stat_debug_mode -int memory_debug_mode; -int memory_stat_debug_mode; +#ifndef EXTERN_UNLESS_MAIN_MODULE + #if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE) + #define EXTERN_UNLESS_MAIN_MODULE extern + #else + #define EXTERN_UNLESS_MAIN_MODULE + #endif +#endif +EXTERN_UNLESS_MAIN_MODULE int memory_debug_mode; +EXTERN_UNLESS_MAIN_MODULE int memory_stat_debug_mode; #endif /*G10_MEMORY_H*/ diff --git a/include/mpi.h b/include/mpi.h index 27723d1b7..99bd6a883 100644 --- a/include/mpi.h +++ b/include/mpi.h @@ -53,9 +53,17 @@ #endif #define BITS_PER_MPI_LIMB (8*BYTES_PER_MPI_LIMB) +#ifndef EXTERN_UNLESS_MAIN_MODULE + #if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE) + #define EXTERN_UNLESS_MAIN_MODULE extern + #else + #define EXTERN_UNLESS_MAIN_MODULE + #endif +#endif #define DBG_MPI mpi_debug_mode -int mpi_debug_mode; +EXTERN_UNLESS_MAIN_MODULE int mpi_debug_mode; + struct gcry_mpi { int alloced; /* array size (# of allocated limbs) */ diff --git a/include/types.h b/include/types.h index dbd711c94..81696aeea 100644 --- a/include/types.h +++ b/include/types.h @@ -43,7 +43,13 @@ #ifndef HAVE_BYTE_TYPEDEF #undef byte /* maybe there is a macro with this name */ - typedef unsigned char byte; + #ifndef __riscos__ + typedef unsigned char byte; + #else + /* FIXME it seems that char is unsigned by default and we workaround + * signed/unsigned mismacthes here. */ + typedef char byte; + #endif #define HAVE_BYTE_TYPEDEF #endif diff --git a/include/util.h b/include/util.h index 527961336..aa2d90594 100644 --- a/include/util.h +++ b/include/util.h @@ -68,7 +68,8 @@ int log_get_errorcount( int clear ); void log_inc_errorcount(void); void g10_log_hexdump( const char *text, const char *buf, size_t len ); -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 ) +#if !defined (__riscos__) \ + && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 )) void g10_log_bug( const char *fmt, ... ) __attribute__ ((noreturn, format (printf,1,2))); void g10_log_bug0( const char *, int, const char * ) __attribute__ ((noreturn)); @@ -240,4 +241,23 @@ int vasprintf ( char **result, const char *format, va_list args); #define DIM(v) (sizeof(v)/sizeof((v)[0])) #define DIMof(type,member) DIM(((type *)0)->member) +/******* RISC OS stuff ***********/ +#ifdef __riscos__ +FILE *riscos_fopen(const char *filename, const char *mode); +int riscos_open(const char *filename, int oflag, ...); +int riscos_fstat(int fildes, struct stat *buf); +int fdopenfile(const char *filename, const int allow_write); +void close_fds(void); +int renamefile(const char *old, const char *new); +char *gstrans(const char *old); +void not_implemented(const char *feature); +void set_filetype(const char *filename, const int type); +#ifndef __RISCOS__C__ + #define fopen riscos_fopen + #define open riscos_open + #define fstat riscos_fstat +#endif /* !__RISCOS__C__ */ +#endif /* __riscos__ */ + #endif /*G10_UTIL_H*/ + |