This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
Misc generic code changes
- From: Jonathan Larmour <jifl at eCosCentric dot com>
- To: eCos Patches List <ecos-patches at ecos dot sourceware dot org>
- Date: Mon, 15 Mar 2004 15:18:30 +0000
- Subject: Misc generic code changes
This is a rather large patch which adds a few bits of (configurable)
functionality, some fixes, consistency/correctness changes, as well as
easing use with newer GCC and reducing warnings. Much of it doesn't really
add much more than future-proofing I'm afraid.
Jifl
--
eCosCentric http://www.eCosCentric.com/ The eCos and RedBoot experts
>>>>> Visit us in booth 2527 at the Embedded Systems Conference 2004 <<<<<
March 30 - April 1, San Francisco http://www.esconline.com/electronicaUSA/
--["No sense being pessimistic, it wouldn't work anyway"]-- Opinions==mine
Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/ChangeLog,v
retrieving revision 1.135
diff -u -5 -p -r1.135 ChangeLog
--- ChangeLog 2 Mar 2004 10:11:08 -0000 1.135
+++ ChangeLog 15 Mar 2004 15:03:48 -0000
@@ -1,5 +1,12 @@
+2004-03-12 Jonathan Larmour <jifl@eCosCentric.com>
+
+ * pkgconf/rules.mak: When linking, $LDFLAGS must be after target.ld
+ so that -nostdlib works in all cases, so place it at the end.
+ Add -finline-limit hack to preserve behaviour with newer GCC.
+ Treat -frtti like -fno-rtti.
+
2004-02-27 Iztok Zupet <iz@elsis.si>
* ecos.db: Added the LANCEPCI packages and support for the vmWare
target
Index: io/fileio/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/fileio/current/ChangeLog,v
retrieving revision 1.40
diff -u -5 -p -r1.40 ChangeLog
--- io/fileio/current/ChangeLog 16 Feb 2004 16:25:45 -0000 1.40
+++ io/fileio/current/ChangeLog 15 Mar 2004 15:04:03 -0000
@@ -1,5 +1,13 @@
+2004-03-12 Jonathan Larmour <jifl@eCosCentric.com>
+
+ * src/fio.h: If no POSIX then CYG_FILEIO_DELIVER_SIGNALS
+ and CYG_FILEIO_SIGMASK_SET call CYG_UNUSED_PARAM on their
+ arguments to silence warnings.
+ * src/file.cxx (rename): Use a throw specifier to match
+ prototype.
+
2004-02-16 Andrew Lunn <andrew.lunn@ascom.ch>
* src/io.cxx (readwritev): For EWOULDBLOCK and EAGAIN return
the number of bytes written if any have been written.
Index: io/fileio/current/src/file.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/fileio/current/src/file.cxx,v
retrieving revision 1.9
diff -u -5 -p -r1.9 file.cxx
--- io/fileio/current/src/file.cxx 23 Oct 2003 17:15:20 -0000 1.9
+++ io/fileio/current/src/file.cxx 15 Mar 2004 15:04:04 -0000
@@ -334,11 +334,11 @@ __externC int rmdir( const char *path )
}
//==========================================================================
// Rename a file
-__externC int rename( const char *path1, const char *path2 )
+__externC int rename( const char *path1, const char *path2 ) __THROW
{
FILEIO_ENTRY();
int ret = 0;
cyg_mtab_entry *mte1 = cyg_cdir_mtab_entry;
Index: io/fileio/current/src/fio.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/fileio/current/src/fio.h,v
retrieving revision 1.10
diff -u -5 -p -r1.10 fio.h
--- io/fileio/current/src/fio.h 7 Jan 2004 06:45:28 -0000 1.10
+++ io/fileio/current/src/fio.h 15 Mar 2004 15:04:04 -0000
@@ -117,15 +117,19 @@
#define CYG_FILEIO_DELIVER_SIGNALS( __mask ) \
CYG_POSIX_DELIVER_SIGNALS( __mask )
#else
-#define CYG_FILEIO_SIGMASK_SET( __set, __oset ) CYG_EMPTY_STATEMENT
+#define CYG_FILEIO_SIGMASK_SET( __set, __oset ) \
+CYG_MACRO_START \
+CYG_UNUSED_PARAM( const sigset_t*, __set ); \
+CYG_UNUSED_PARAM( const sigset_t*, __oset ); \
+CYG_MACRO_END
#define CYG_FILEIO_SIGPENDING() (0)
-#define CYG_FILEIO_DELIVER_SIGNALS( __mask ) CYG_EMPTY_STATEMENT
+#define CYG_FILEIO_DELIVER_SIGNALS( __mask ) CYG_UNUSED_PARAM( const sigset_t*, __mask )
typedef int sigset_t;
#endif
Index: isoinfra/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/isoinfra/current/ChangeLog,v
retrieving revision 1.25
diff -u -5 -p -r1.25 ChangeLog
--- isoinfra/current/ChangeLog 7 Jan 2004 06:45:13 -0000 1.25
+++ isoinfra/current/ChangeLog 15 Mar 2004 15:04:04 -0000
@@ -1,5 +1,18 @@
+2004-03-12 Jonathan Larmour <jifl@eCosCentric.com>
+
+ * cdl/isoinfra.cdl: Typo: CYGBLD_ISO_STDIO_FILEPOS ->
+ CYGBLD_ISO_STDIO_FILEPOS_HEADER.
+
+ * include/limits.h: Avoid potential illegal recursion if
+ already been included by GCC's limits.h.
+
+ * include/stdio.h: Include stdarg.h to save duplication.
+ Give fileno(),fdopen() throw specifiers.
+
+ * include/unistd.h: Prototype for rename() lives in stdio.h.
+
2004-01-07 Jonathan Larmour <jifl@eCosCentric.com>
* include/sys/select.h: Only declare pselect() when posix signals are
included.
Index: isoinfra/current/cdl/isoinfra.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/isoinfra/current/cdl/isoinfra.cdl,v
retrieving revision 1.13
diff -u -5 -p -r1.13 isoinfra.cdl
--- isoinfra/current/cdl/isoinfra.cdl 23 May 2002 23:06:40 -0000 1.13
+++ isoinfra/current/cdl/isoinfra.cdl 15 Mar 2004 15:04:04 -0000
@@ -255,11 +255,11 @@ cdl_package CYGPKG_ISOINFRA {
display "Number of implementations of stdio file positioning"
flavor booldata
requires { 1 >= CYGINT_ISO_STDIO_FILEPOS }
}
- cdl_option CYGBLD_ISO_STDIO_FILEPOS {
+ cdl_option CYGBLD_ISO_STDIO_FILEPOS_HEADER {
display "Stdio file positioning implementation header"
flavor booldata
default_value 0
}
Index: isoinfra/current/include/limits.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/isoinfra/current/include/limits.h,v
retrieving revision 1.5
diff -u -5 -p -r1.5 limits.h
--- isoinfra/current/include/limits.h 23 May 2002 23:06:41 -0000 1.5
+++ isoinfra/current/include/limits.h 15 Mar 2004 15:04:05 -0000
@@ -215,8 +215,11 @@
/* When using a crosscompiler targeting linux, the next limits.h file
in the include sequence may be the glibc header - which breaks our
world. So skip it by defining _LIBC_LIMITS_H_ */
#define _LIBC_LIMITS_H_
-#include_next <limits.h>
+/* Secondly only include if we haven't already been included by it. */
+#ifndef _GCC_LIMITS_H_
+# include_next <limits.h>
+#endif
/* EOF limits.h */
Index: isoinfra/current/include/stdio.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/isoinfra/current/include/stdio.h,v
retrieving revision 1.5
diff -u -5 -p -r1.5 stdio.h
--- isoinfra/current/include/stdio.h 23 May 2002 23:06:43 -0000 1.5
+++ isoinfra/current/include/stdio.h 15 Mar 2004 15:04:05 -0000
@@ -67,10 +67,17 @@
*/
#define __need_NULL
#define __need_size_t
#include <stddef.h>
+/* Misc functions below use varargs stuff, so pull it in from the compiler
+ * here to save duplication.
+ */
+
+#define __need___va_list
+#include <stdarg.h>
+
#ifdef CYGINT_ISO_STDIO_FILETYPES
# ifdef CYGBLD_ISO_STDIO_FILETYPES_HEADER
# include CYGBLD_ISO_STDIO_FILETYPES_HEADER
# endif
#endif
@@ -131,14 +138,14 @@
# ifdef __cplusplus
extern "C" {
# endif
extern int
-fileno( FILE *__stream );
+fileno( FILE *__stream ) __THROW;
extern FILE *
-fdopen( int __fildes, const char *__type );
+fdopen( int __fildes, const char *__type ) __THROW;
# ifdef __cplusplus
} // extern "C"
# endif
# endif
Index: isoinfra/current/include/unistd.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/isoinfra/current/include/unistd.h,v
retrieving revision 1.6
diff -u -5 -p -r1.6 unistd.h
--- isoinfra/current/include/unistd.h 23 May 2002 23:06:43 -0000 1.6
+++ isoinfra/current/include/unistd.h 15 Mar 2004 15:04:05 -0000
@@ -220,11 +220,10 @@ extern "C" {
extern int link(const char *path1, const char *path2);
extern int unlink(const char *path);
extern int rmdir(const char *path);
-extern int rename(const char *old_name, const char *new_name);
extern int access(const char *path, int amode);
extern int chown(const char *path, uid_t owner, uid_t group);
extern long pathconf(const char *path, int name);
extern long fpathconf(int fd, int name);
extern int pipe(int fildes[2]);
Index: kernel/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/kernel/current/ChangeLog,v
retrieving revision 1.115
diff -u -5 -p -r1.115 ChangeLog
--- kernel/current/ChangeLog 4 Mar 2004 02:17:54 -0000 1.115
+++ kernel/current/ChangeLog 15 Mar 2004 15:04:09 -0000
@@ -1,5 +1,15 @@
+2004-03-12 Jonathan Larmour <jifl@eCosCentric.com>
+
+ * include/kapi.h: Add throw specifications throughout.
+ * src/kapi.cxx: Ditto.
+ * include/sched.inl: Move include of thread.inl further down to
+ allow Cyg_Scheduler inlines to be defined first.
+ * include/thread.inl: Reorder destructors section and include
+ sched.inl right before it to solve mutual header dependency
+ problems.
+
2004-03-04 Jonathan Larmour <jifl@eCosCentric.com>
* doc/kernel.sgml: Document cyg_thread_delete return value.
2004-02-19 Jonathan Larmour <jifl@eCosCentric.com>
Index: kernel/current/include/kapi.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/kernel/current/include/kapi.h,v
retrieving revision 1.19
diff -u -5 -p -r1.19 kapi.h
--- kernel/current/include/kapi.h 9 Dec 2003 15:10:40 -0000 1.19
+++ kernel/current/include/kapi.h 15 Mar 2004 15:04:10 -0000
@@ -128,25 +128,25 @@ typedef struct cyg_spinlock_t cyg_spinlo
/*---------------------------------------------------------------------------*/
/* Scheduler operations */
/* Starts scheduler with created threads. Never returns. */
-void cyg_scheduler_start(void) CYGBLD_ATTRIB_NORET;
+void cyg_scheduler_start(void) __THROW CYGBLD_ATTRIB_NORET;
/* Lock and unlock the scheduler. When the scheduler is */
/* locked thread preemption is disabled. */
-void cyg_scheduler_lock(void);
+void cyg_scheduler_lock(void) __THROW;
-void cyg_scheduler_unlock(void);
+void cyg_scheduler_unlock(void) __THROW;
/* Just like 'cyg_scheduler_lock()', but never take the lock higher than 1 */
/* Thus this call is safe even if the scheduler is already locked and a */
/* subsequent call to 'cyg_scheduler_unlock()' will completely unlock. */
-void cyg_scheduler_safe_lock(void);
+void cyg_scheduler_safe_lock(void) __THROW;
/* Read the scheduler lock value. */
-cyg_ucount32 cyg_scheduler_read_lock(void);
+cyg_ucount32 cyg_scheduler_read_lock(void) __THROW;
/*---------------------------------------------------------------------------*/
/* Thread operations */
typedef void cyg_thread_entry_t(cyg_addrword_t);
@@ -158,55 +158,55 @@ void cyg_thread_create(
char *name, /* optional thread name */
void *stack_base, /* stack base, NULL = alloc */
cyg_ucount32 stack_size, /* stack size, 0 = default */
cyg_handle_t *handle, /* returned thread handle */
cyg_thread *thread /* put thread here */
-);
+) __THROW;
-void cyg_thread_exit(void);
+void cyg_thread_exit(void) __THROW;
/* It may be necessary to arrange for the victim to run for it to disappear */
-cyg_bool_t cyg_thread_delete(cyg_handle_t thread); /* false if NOT deleted */
+cyg_bool_t cyg_thread_delete(cyg_handle_t thread) __THROW; /* false if NOT deleted */
-void cyg_thread_suspend(cyg_handle_t thread);
+void cyg_thread_suspend(cyg_handle_t thread) __THROW;
-void cyg_thread_resume(cyg_handle_t thread);
+void cyg_thread_resume(cyg_handle_t thread) __THROW;
-void cyg_thread_kill(cyg_handle_t thread);
+void cyg_thread_kill(cyg_handle_t thread) __THROW;
-void cyg_thread_release(cyg_handle_t thread);
+void cyg_thread_release(cyg_handle_t thread) __THROW;
-void cyg_thread_yield(void);
+void cyg_thread_yield(void) __THROW;
-cyg_handle_t cyg_thread_self(void);
+cyg_handle_t cyg_thread_self(void) __THROW;
-cyg_handle_t cyg_thread_idle_thread(void);
+cyg_handle_t cyg_thread_idle_thread(void) __THROW;
/* Priority manipulation */
-void cyg_thread_set_priority(cyg_handle_t thread, cyg_priority_t priority );
+void cyg_thread_set_priority(cyg_handle_t thread, cyg_priority_t priority ) __THROW;
-cyg_priority_t cyg_thread_get_priority(cyg_handle_t thread);
-cyg_priority_t cyg_thread_get_current_priority(cyg_handle_t thread);
+cyg_priority_t cyg_thread_get_priority(cyg_handle_t thread) __THROW;
+cyg_priority_t cyg_thread_get_current_priority(cyg_handle_t thread) __THROW;
/* Deadline scheduling control (optional) */
void cyg_thread_deadline_wait(
cyg_tick_count_t start_time, /* abs earliest start time */
cyg_tick_count_t run_time, /* worst case execution time */
cyg_tick_count_t deadline /* absolute deadline */
-);
+) __THROW;
-void cyg_thread_delay(cyg_tick_count_t delay);
+void cyg_thread_delay(cyg_tick_count_t delay) __THROW;
/* Stack information */
-cyg_addrword_t cyg_thread_get_stack_base(cyg_handle_t thread);
+cyg_addrword_t cyg_thread_get_stack_base(cyg_handle_t thread) __THROW;
-cyg_uint32 cyg_thread_get_stack_size(cyg_handle_t thread);
+cyg_uint32 cyg_thread_get_stack_size(cyg_handle_t thread) __THROW;
#ifdef CYGFUN_KERNEL_THREADS_STACK_MEASUREMENT
-cyg_uint32 cyg_thread_measure_stack_usage(cyg_handle_t thread);
+cyg_uint32 cyg_thread_measure_stack_usage(cyg_handle_t thread) __THROW;
#endif
/*---------------------------------------------------------------------------*/
/* Thread enumeration and information */
@@ -221,34 +221,34 @@ typedef struct
cyg_addrword_t stack_base;
cyg_uint32 stack_size;
cyg_uint32 stack_used;
} cyg_thread_info;
-cyg_bool_t cyg_thread_get_next( cyg_handle_t *thread, cyg_uint16 *id );
+cyg_bool_t cyg_thread_get_next( cyg_handle_t *thread, cyg_uint16 *id ) __THROW;
cyg_bool_t cyg_thread_get_info( cyg_handle_t thread,
cyg_uint16 id,
- cyg_thread_info *info );
+ cyg_thread_info *info ) __THROW;
-cyg_uint16 cyg_thread_get_id( cyg_handle_t thread );
+cyg_uint16 cyg_thread_get_id( cyg_handle_t thread ) __THROW;
-cyg_handle_t cyg_thread_find( cyg_uint16 id );
+cyg_handle_t cyg_thread_find( cyg_uint16 id ) __THROW;
/*---------------------------------------------------------------------------*/
/* Per-thread Data */
#ifdef CYGVAR_KERNEL_THREADS_DATA
-cyg_ucount32 cyg_thread_new_data_index(void);
+cyg_ucount32 cyg_thread_new_data_index(void) __THROW;
-void cyg_thread_free_data_index(cyg_ucount32 index);
+void cyg_thread_free_data_index(cyg_ucount32 index) __THROW;
-CYG_ADDRWORD cyg_thread_get_data(cyg_ucount32 index);
+CYG_ADDRWORD cyg_thread_get_data(cyg_ucount32 index) __THROW;
-CYG_ADDRWORD *cyg_thread_get_data_ptr(cyg_ucount32 index);
+CYG_ADDRWORD *cyg_thread_get_data_ptr(cyg_ucount32 index) __THROW;
-void cyg_thread_set_data(cyg_ucount32 index, CYG_ADDRWORD data);
+void cyg_thread_set_data(cyg_ucount32 index, CYG_ADDRWORD data) __THROW;
#endif
/*---------------------------------------------------------------------------*/
/* Thread destructors */
@@ -256,13 +256,13 @@ void cyg_thread_set_data(cyg_ucount32 in
#ifdef CYGPKG_KERNEL_THREADS_DESTRUCTORS
typedef void (*cyg_thread_destructor_fn)(cyg_addrword_t);
cyg_bool_t cyg_thread_add_destructor( cyg_thread_destructor_fn fn,
- cyg_addrword_t data );
+ cyg_addrword_t data ) __THROW;
cyg_bool_t cyg_thread_rem_destructor( cyg_thread_destructor_fn fn,
- cyg_addrword_t data );
+ cyg_addrword_t data ) __THROW;
#endif
/*---------------------------------------------------------------------------*/
/* Exception handling. */
@@ -274,23 +274,23 @@ void cyg_exception_set_handler(
cyg_code_t exception_number,
cyg_exception_handler_t *new_handler,
cyg_addrword_t new_data,
cyg_exception_handler_t **old_handler,
cyg_addrword_t *old_data
-);
+) __THROW;
/* Clear exception hander to default value */
void cyg_exception_clear_handler(
cyg_code_t exception_number
-);
+) __THROW;
/* Invoke exception handler */
void cyg_exception_call_handler(
cyg_handle_t thread,
cyg_code_t exception_number,
cyg_addrword_t exception_info
-);
+) __THROW;
/*---------------------------------------------------------------------------*/
/* Interrupt handling */
typedef void cyg_VSR_t(void);
@@ -312,83 +312,83 @@ void cyg_interrupt_create(
cyg_addrword_t data, /* Data pointer */
cyg_ISR_t *isr, /* Interrupt Service Routine */
cyg_DSR_t *dsr, /* Deferred Service Routine */
cyg_handle_t *handle, /* returned handle */
cyg_interrupt *intr /* put interrupt here */
-);
+) __THROW;
-void cyg_interrupt_delete( cyg_handle_t interrupt );
+void cyg_interrupt_delete( cyg_handle_t interrupt ) __THROW;
-void cyg_interrupt_attach( cyg_handle_t interrupt );
+void cyg_interrupt_attach( cyg_handle_t interrupt ) __THROW;
-void cyg_interrupt_detach( cyg_handle_t interrupt );
+void cyg_interrupt_detach( cyg_handle_t interrupt ) __THROW;
/* VSR manipulation */
void cyg_interrupt_get_vsr(
cyg_vector_t vector, /* vector to get */
cyg_VSR_t **vsr /* vsr got */
-);
+) __THROW;
void cyg_interrupt_set_vsr(
cyg_vector_t vector, /* vector to set */
cyg_VSR_t *vsr /* vsr to set */
-);
+) __THROW;
/* CPU level interrupt mask */
-void cyg_interrupt_disable(void);
+void cyg_interrupt_disable(void) __THROW;
-void cyg_interrupt_enable(void);
+void cyg_interrupt_enable(void) __THROW;
/* Interrupt controller access */
-void cyg_interrupt_mask(cyg_vector_t vector);
-void cyg_interrupt_mask_intunsafe(cyg_vector_t vector);
+void cyg_interrupt_mask(cyg_vector_t vector) __THROW;
+void cyg_interrupt_mask_intunsafe(cyg_vector_t vector) __THROW;
-void cyg_interrupt_unmask(cyg_vector_t vector);
-void cyg_interrupt_unmask_intunsafe(cyg_vector_t vector);
+void cyg_interrupt_unmask(cyg_vector_t vector) __THROW;
+void cyg_interrupt_unmask_intunsafe(cyg_vector_t vector) __THROW;
-void cyg_interrupt_acknowledge(cyg_vector_t vector);
+void cyg_interrupt_acknowledge(cyg_vector_t vector) __THROW;
void cyg_interrupt_configure(
cyg_vector_t vector, /* vector to configure */
cyg_bool_t level, /* level or edge triggered */
cyg_bool_t up /* rising/faling edge, high/low level*/
-);
+) __THROW;
void cyg_interrupt_set_cpu(
cyg_vector_t vector, /* vector to control */
cyg_cpu_t cpu /* CPU to set */
-);
+) __THROW;
cyg_cpu_t cyg_interrupt_get_cpu(
cyg_vector_t vector /* vector to control */
-);
+) __THROW;
/*---------------------------------------------------------------------------*/
/* Counters, Clocks and Alarms */
void cyg_counter_create(
cyg_handle_t *handle, /* returned counter handle */
cyg_counter *counter /* put counter here */
-);
+) __THROW;
-void cyg_counter_delete(cyg_handle_t counter);
+void cyg_counter_delete(cyg_handle_t counter) __THROW;
/* Return current value of counter */
-cyg_tick_count_t cyg_counter_current_value(cyg_handle_t counter);
+cyg_tick_count_t cyg_counter_current_value(cyg_handle_t counter) __THROW;
/* Set new current value */
void cyg_counter_set_value(
cyg_handle_t counter,
cyg_tick_count_t new_value
-);
+) __THROW;
/* Advance counter by one tick */
-void cyg_counter_tick(cyg_handle_t counter);
+void cyg_counter_tick(cyg_handle_t counter) __THROW;
/* Advance counter by multiple ticks */
-void cyg_counter_multi_tick(cyg_handle_t counter, cyg_tick_count_t _ticks);
+void cyg_counter_multi_tick(cyg_handle_t counter, cyg_tick_count_t _ticks) __THROW;
#define CYG_RESOLUTION_T_MEMBERS \
cyg_uint32 dividend; \
cyg_uint32 divisor;
@@ -401,107 +401,107 @@ typedef struct
/* Create a clock object */
void cyg_clock_create(
cyg_resolution_t resolution, /* Initial resolution */
cyg_handle_t *handle, /* Returned clock handle */
cyg_clock *clock /* put clock here */
-);
+) __THROW;
-void cyg_clock_delete(cyg_handle_t clock);
+void cyg_clock_delete(cyg_handle_t clock) __THROW;
/* convert a clock handle to a counter handle so we can use the */
/* counter API on it. */
void cyg_clock_to_counter(
cyg_handle_t clock,
cyg_handle_t *counter
-);
+) __THROW;
void cyg_clock_set_resolution(
cyg_handle_t clock,
cyg_resolution_t resolution /* New resolution */
-);
+) __THROW;
-cyg_resolution_t cyg_clock_get_resolution(cyg_handle_t clock);
+cyg_resolution_t cyg_clock_get_resolution(cyg_handle_t clock) __THROW;
/* handle of real time clock */
-cyg_handle_t cyg_real_time_clock(void);
+cyg_handle_t cyg_real_time_clock(void) __THROW;
/* returns value of real time clock's counter.
This is the same as:
(cyg_clock_to_counter(cyg_real_time_clock(), &h),
cyg_counter_current_value(h)) */
-cyg_tick_count_t cyg_current_time(void);
+cyg_tick_count_t cyg_current_time(void) __THROW;
/* Alarm handler function */
typedef void cyg_alarm_t(cyg_handle_t alarm, cyg_addrword_t data);
void cyg_alarm_create(
cyg_handle_t counter, /* Attached to this counter */
cyg_alarm_t *alarmfn, /* Call-back function */
cyg_addrword_t data, /* Call-back data */
cyg_handle_t *handle, /* Returned alarm object */
cyg_alarm *alarm /* put alarm here */
-);
+) __THROW;
/* Disable alarm, detach from counter and invalidate handles */
-void cyg_alarm_delete( cyg_handle_t alarm);
+void cyg_alarm_delete( cyg_handle_t alarm) __THROW;
void cyg_alarm_initialize(
cyg_handle_t alarm,
cyg_tick_count_t trigger, /* Absolute trigger time */
cyg_tick_count_t interval /* Relative retrigger interval */
-);
+) __THROW;
void cyg_alarm_get_times(
cyg_handle_t alarm,
cyg_tick_count_t *trigger, /* Next trigger time */
cyg_tick_count_t *interval /* Current interval */
-);
+) __THROW;
-void cyg_alarm_enable( cyg_handle_t alarm );
+void cyg_alarm_enable( cyg_handle_t alarm ) __THROW;
-void cyg_alarm_disable( cyg_handle_t alarm );
+void cyg_alarm_disable( cyg_handle_t alarm ) __THROW;
/*---------------------------------------------------------------------------*/
/* Mail boxes */
void cyg_mbox_create(
cyg_handle_t *handle,
cyg_mbox *mbox
-);
+) __THROW;
-void cyg_mbox_delete(cyg_handle_t mbox);
+void cyg_mbox_delete(cyg_handle_t mbox) __THROW;
-void *cyg_mbox_get(cyg_handle_t mbox);
+void *cyg_mbox_get(cyg_handle_t mbox) __THROW;
#ifdef CYGFUN_KERNEL_THREADS_TIMER
void *cyg_mbox_timed_get(
cyg_handle_t mbox,
cyg_tick_count_t abstime
- );
+ ) __THROW;
#endif
-void *cyg_mbox_tryget(cyg_handle_t mbox);
+void *cyg_mbox_tryget(cyg_handle_t mbox) __THROW;
-void *cyg_mbox_peek_item(cyg_handle_t mbox);
+void *cyg_mbox_peek_item(cyg_handle_t mbox) __THROW;
#ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT
-cyg_bool_t cyg_mbox_put(cyg_handle_t mbox, void *item);
+cyg_bool_t cyg_mbox_put(cyg_handle_t mbox, void *item) __THROW;
#ifdef CYGFUN_KERNEL_THREADS_TIMER
cyg_bool_t cyg_mbox_timed_put(
cyg_handle_t mbox,
void *item,
cyg_tick_count_t abstime
- );
+ ) __THROW;
#endif
#endif
-cyg_bool_t cyg_mbox_tryput(cyg_handle_t mbox, void *item);
+cyg_bool_t cyg_mbox_tryput(cyg_handle_t mbox, void *item) __THROW;
-cyg_count32 cyg_mbox_peek(cyg_handle_t mbox);
+cyg_count32 cyg_mbox_peek(cyg_handle_t mbox) __THROW;
-cyg_bool_t cyg_mbox_waiting_to_get(cyg_handle_t mbox);
+cyg_bool_t cyg_mbox_waiting_to_get(cyg_handle_t mbox) __THROW;
-cyg_bool_t cyg_mbox_waiting_to_put(cyg_handle_t mbox);
+cyg_bool_t cyg_mbox_waiting_to_put(cyg_handle_t mbox) __THROW;
/*-----------------------------------------------------------------------*/
/* Memory pools */
@@ -516,28 +516,28 @@ cyg_bool_t cyg_mbox_waiting_to_put(cyg_h
/* Semaphores */
void cyg_semaphore_init(
cyg_sem_t *sem, /* Semaphore to init */
cyg_count32 val /* Initial semaphore value */
-);
+) __THROW;
-void cyg_semaphore_destroy( cyg_sem_t *sem );
+void cyg_semaphore_destroy( cyg_sem_t *sem ) __THROW;
-cyg_bool_t cyg_semaphore_wait( cyg_sem_t *sem );
+cyg_bool_t cyg_semaphore_wait( cyg_sem_t *sem ) __THROW;
#ifdef CYGFUN_KERNEL_THREADS_TIMER
cyg_bool_t cyg_semaphore_timed_wait(
cyg_sem_t *sem,
cyg_tick_count_t abstime
- );
+ ) __THROW;
#endif
-cyg_bool_t cyg_semaphore_trywait( cyg_sem_t *sem );
+cyg_bool_t cyg_semaphore_trywait( cyg_sem_t *sem ) __THROW;
-void cyg_semaphore_post( cyg_sem_t *sem );
+void cyg_semaphore_post( cyg_sem_t *sem ) __THROW;
-void cyg_semaphore_peek( cyg_sem_t *sem, cyg_count32 *val );
+void cyg_semaphore_peek( cyg_sem_t *sem, cyg_count32 *val ) __THROW;
/*---------------------------------------------------------------------------*/
/* Flags */
typedef cyg_uint32 cyg_flag_value_t;
@@ -546,46 +546,46 @@ typedef cyg_uint8 cyg_flag_mode_t;
#define CYG_FLAG_WAITMODE_OR ((cyg_flag_mode_t)2) /* any bit must be set */
#define CYG_FLAG_WAITMODE_CLR ((cyg_flag_mode_t)1) /* clear when satisfied */
void cyg_flag_init(
cyg_flag_t *flag /* Flag to init */
-);
+) __THROW;
-void cyg_flag_destroy( cyg_flag_t *flag );
+void cyg_flag_destroy( cyg_flag_t *flag ) __THROW;
/* bitwise-or in the bits in value; awaken any waiting tasks whose
condition is now satisfied */
-void cyg_flag_setbits( cyg_flag_t *flag, cyg_flag_value_t value);
+void cyg_flag_setbits( cyg_flag_t *flag, cyg_flag_value_t value) __THROW;
/* bitwise-and with the the bits in value; this clears the bits which
are not set in value. No waiting task can be awoken. */
-void cyg_flag_maskbits( cyg_flag_t *flag, cyg_flag_value_t value);
+void cyg_flag_maskbits( cyg_flag_t *flag, cyg_flag_value_t value) __THROW;
/* wait for the flag value to match the pattern, according to the mode.
If mode includes CLR, set the flag value to zero when
our pattern is matched. The return value is that which matched
the request, or zero for an error/timeout return.
Value must not itself be zero. */
cyg_flag_value_t cyg_flag_wait( cyg_flag_t *flag,
cyg_flag_value_t pattern,
- cyg_flag_mode_t mode );
+ cyg_flag_mode_t mode ) __THROW;
#ifdef CYGFUN_KERNEL_THREADS_TIMER
cyg_flag_value_t cyg_flag_timed_wait( cyg_flag_t *flag,
cyg_flag_value_t pattern,
cyg_flag_mode_t mode,
- cyg_tick_count_t abstime );
+ cyg_tick_count_t abstime ) __THROW;
#endif
cyg_flag_value_t cyg_flag_poll( cyg_flag_t *flag,
cyg_flag_value_t pattern,
- cyg_flag_mode_t mode );
+ cyg_flag_mode_t mode ) __THROW;
-cyg_flag_value_t cyg_flag_peek( cyg_flag_t *flag );
+cyg_flag_value_t cyg_flag_peek( cyg_flag_t *flag ) __THROW;
-cyg_bool_t cyg_flag_waiting( cyg_flag_t *flag );
+cyg_bool_t cyg_flag_waiting( cyg_flag_t *flag ) __THROW;
/*---------------------------------------------------------------------------*/
/* Mutex */
#ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DYNAMIC
@@ -597,76 +597,76 @@ enum cyg_mutex_protocol
};
#endif
void cyg_mutex_init(
cyg_mutex_t *mutex /* Mutex to init */
-);
+) __THROW;
-void cyg_mutex_destroy( cyg_mutex_t *mutex );
+void cyg_mutex_destroy( cyg_mutex_t *mutex ) __THROW;
-cyg_bool_t cyg_mutex_lock( cyg_mutex_t *mutex );
+cyg_bool_t cyg_mutex_lock( cyg_mutex_t *mutex ) __THROW;
-cyg_bool_t cyg_mutex_trylock( cyg_mutex_t *mutex );
+cyg_bool_t cyg_mutex_trylock( cyg_mutex_t *mutex ) __THROW;
-void cyg_mutex_unlock( cyg_mutex_t *mutex );
+void cyg_mutex_unlock( cyg_mutex_t *mutex ) __THROW;
-void cyg_mutex_release( cyg_mutex_t *mutex );
+void cyg_mutex_release( cyg_mutex_t *mutex ) __THROW;
#ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_CEILING
-void cyg_mutex_set_ceiling( cyg_mutex_t *mutex, cyg_priority_t priority );
+void cyg_mutex_set_ceiling( cyg_mutex_t *mutex, cyg_priority_t priority ) __THROW;
#endif
#ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DYNAMIC
-void cyg_mutex_set_protocol ( cyg_mutex_t *mutex, enum cyg_mutex_protocol protocol );
+void cyg_mutex_set_protocol ( cyg_mutex_t *mutex, enum cyg_mutex_protocol protocol ) __THROW;
#endif
/*---------------------------------------------------------------------------*/
/* Condition Variables */
void cyg_cond_init(
cyg_cond_t *cond, /* condition variable to init */
cyg_mutex_t *mutex /* associated mutex */
-);
+) __THROW;
-void cyg_cond_destroy( cyg_cond_t *cond );
+void cyg_cond_destroy( cyg_cond_t *cond ) __THROW;
-cyg_bool_t cyg_cond_wait( cyg_cond_t *cond );
+cyg_bool_t cyg_cond_wait( cyg_cond_t *cond ) __THROW;
-void cyg_cond_signal( cyg_cond_t *cond );
+void cyg_cond_signal( cyg_cond_t *cond ) __THROW;
-void cyg_cond_broadcast( cyg_cond_t *cond );
+void cyg_cond_broadcast( cyg_cond_t *cond ) __THROW;
#ifdef CYGMFN_KERNEL_SYNCH_CONDVAR_TIMED_WAIT
cyg_bool_t cyg_cond_timed_wait(
cyg_cond_t *cond,
cyg_tick_count_t abstime
- );
+ ) __THROW;
#endif
/*---------------------------------------------------------------------------*/
/* Spinlocks */
void cyg_spinlock_init(
cyg_spinlock_t *lock, /* spinlock to initialize */
cyg_bool_t locked /* init locked or unlocked */
-);
+) __THROW;
-void cyg_spinlock_destroy( cyg_spinlock_t *lock );
+void cyg_spinlock_destroy( cyg_spinlock_t *lock ) __THROW;
-void cyg_spinlock_spin( cyg_spinlock_t *lock );
+void cyg_spinlock_spin( cyg_spinlock_t *lock ) __THROW;
-void cyg_spinlock_clear( cyg_spinlock_t *lock );
+void cyg_spinlock_clear( cyg_spinlock_t *lock ) __THROW;
-cyg_bool_t cyg_spinlock_try( cyg_spinlock_t *lock );
+cyg_bool_t cyg_spinlock_try( cyg_spinlock_t *lock ) __THROW;
-cyg_bool_t cyg_spinlock_test( cyg_spinlock_t *lock );
+cyg_bool_t cyg_spinlock_test( cyg_spinlock_t *lock ) __THROW;
void cyg_spinlock_spin_intsave( cyg_spinlock_t *lock,
- cyg_addrword_t *istate );
+ cyg_addrword_t *istate ) __THROW;
void cyg_spinlock_clear_intsave( cyg_spinlock_t *lock,
- cyg_addrword_t istate );
+ cyg_addrword_t istate ) __THROW;
/*---------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
Index: kernel/current/include/sched.inl
===================================================================
RCS file: /cvs/ecos/ecos/packages/kernel/current/include/sched.inl,v
retrieving revision 1.10
diff -u -5 -p -r1.10 sched.inl
--- kernel/current/include/sched.inl 23 May 2002 23:06:50 -0000 1.10
+++ kernel/current/include/sched.inl 15 Mar 2004 15:04:10 -0000
@@ -59,12 +59,11 @@
//####DESCRIPTIONEND####
//
//==========================================================================
#include <cyg/kernel/instrmnt.h>
-
-#include <cyg/kernel/thread.inl> // we use some thread inlines here
+#include <cyg/hal/hal_arch.h>
// -------------------------------------------------------------------------
// Inlines for Cyg_Scheduler class
inline void Cyg_Scheduler::lock()
@@ -149,10 +148,12 @@ inline void Cyg_Scheduler::unlock_simple
}
// -------------------------------------------------------------------------
// Inlines for Cyg_SchedThread class
+
+#include <cyg/kernel/thread.inl> // we use some thread inlines here
inline void Cyg_SchedThread::remove()
{
if( queue != NULL )
{
Index: kernel/current/include/thread.inl
===================================================================
RCS file: /cvs/ecos/ecos/packages/kernel/current/include/thread.inl,v
retrieving revision 1.15
diff -u -5 -p -r1.15 thread.inl
--- kernel/current/include/thread.inl 10 Feb 2003 22:02:16 -0000 1.15
+++ kernel/current/include/thread.inl 15 Mar 2004 15:04:10 -0000
@@ -516,61 +516,10 @@ inline void Cyg_Thread::set_data( Cyg_Th
#endif
// -------------------------------------------------------------------------
-#ifdef CYGPKG_KERNEL_THREADS_DESTRUCTORS
-
-// Add and remove destructors. Returns true on success, false on failure.
-inline cyg_bool
-Cyg_Thread::add_destructor( destructor_fn fn, CYG_ADDRWORD data )
-{
- cyg_ucount16 i;
-#ifndef CYGSEM_KERNEL_THREADS_DESTRUCTORS_PER_THREAD
- Cyg_Scheduler::lock();
-#endif
- for (i=0; i<CYGNUM_KERNEL_THREADS_DESTRUCTORS; i++) {
- if (NULL == destructors[i].fn) {
- destructors[i].data = data;
- destructors[i].fn = fn;
-#ifndef CYGSEM_KERNEL_THREADS_DESTRUCTORS_PER_THREAD
- Cyg_Scheduler::unlock();
-#endif
- return true;
- }
- }
-#ifndef CYGSEM_KERNEL_THREADS_DESTRUCTORS_PER_THREAD
- Cyg_Scheduler::unlock();
-#endif
- return false;
-}
-
-inline cyg_bool
-Cyg_Thread::rem_destructor( destructor_fn fn, CYG_ADDRWORD data )
-{
- cyg_ucount16 i;
-#ifndef CYGSEM_KERNEL_THREADS_DESTRUCTORS_PER_THREAD
- Cyg_Scheduler::lock();
-#endif
- for (i=0; i<CYGNUM_KERNEL_THREADS_DESTRUCTORS; i++) {
- if (destructors[i].fn == fn && destructors[i].data == data) {
- destructors[i].fn = NULL;
-#ifndef CYGSEM_KERNEL_THREADS_DESTRUCTORS_PER_THREAD
- Cyg_Scheduler::unlock();
-#endif
- return true;
- }
- }
-#ifndef CYGSEM_KERNEL_THREADS_DESTRUCTORS_PER_THREAD
- Cyg_Scheduler::unlock();
-#endif
- return false;
-}
-#endif
-
-// -------------------------------------------------------------------------
-
#ifdef CYGVAR_KERNEL_THREADS_NAME
inline char *Cyg_Thread::get_name()
{
return name;
@@ -682,7 +631,63 @@ inline cyg_bool Cyg_ThreadQueue::empty()
{
return Cyg_ThreadQueue_Implementation::empty();
}
// -------------------------------------------------------------------------
+
+#ifdef CYGPKG_KERNEL_THREADS_DESTRUCTORS
+
+#ifndef CYGSEM_KERNEL_THREADS_DESTRUCTORS_PER_THREAD
+# include <cyg/kernel/sched.inl>
+#endif
+
+// Add and remove destructors. Returns true on success, false on failure.
+inline cyg_bool
+Cyg_Thread::add_destructor( destructor_fn fn, CYG_ADDRWORD data )
+{
+ cyg_ucount16 i;
+#ifndef CYGSEM_KERNEL_THREADS_DESTRUCTORS_PER_THREAD
+ Cyg_Scheduler::lock();
+#endif
+ for (i=0; i<CYGNUM_KERNEL_THREADS_DESTRUCTORS; i++) {
+ if (NULL == destructors[i].fn) {
+ destructors[i].data = data;
+ destructors[i].fn = fn;
+#ifndef CYGSEM_KERNEL_THREADS_DESTRUCTORS_PER_THREAD
+ Cyg_Scheduler::unlock();
+#endif
+ return true;
+ }
+ }
+#ifndef CYGSEM_KERNEL_THREADS_DESTRUCTORS_PER_THREAD
+ Cyg_Scheduler::unlock();
+#endif
+ return false;
+}
+
+inline cyg_bool
+Cyg_Thread::rem_destructor( destructor_fn fn, CYG_ADDRWORD data )
+{
+ cyg_ucount16 i;
+#ifndef CYGSEM_KERNEL_THREADS_DESTRUCTORS_PER_THREAD
+ Cyg_Scheduler::lock();
+#endif
+ for (i=0; i<CYGNUM_KERNEL_THREADS_DESTRUCTORS; i++) {
+ if (destructors[i].fn == fn && destructors[i].data == data) {
+ destructors[i].fn = NULL;
+#ifndef CYGSEM_KERNEL_THREADS_DESTRUCTORS_PER_THREAD
+ Cyg_Scheduler::unlock();
+#endif
+ return true;
+ }
+ }
+#ifndef CYGSEM_KERNEL_THREADS_DESTRUCTORS_PER_THREAD
+ Cyg_Scheduler::unlock();
+#endif
+ return false;
+}
+#endif
+
+// -------------------------------------------------------------------------
+
#endif // ifndef CYGONCE_KERNEL_THREAD_INL
// EOF thread.inl
Index: kernel/current/src/common/kapi.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/kernel/current/src/common/kapi.cxx,v
retrieving revision 1.23
diff -u -5 -p -r1.23 kapi.cxx
--- kernel/current/src/common/kapi.cxx 9 Dec 2003 15:10:40 -0000 1.23
+++ kernel/current/src/common/kapi.cxx 15 Mar 2004 15:04:10 -0000
@@ -107,26 +107,26 @@ CYG_MACRO_END
/*---------------------------------------------------------------------------*/
/* Scheduler operations */
/* Starts scheduler with created threads. Never returns. */
-externC void cyg_scheduler_start(void)
+externC void cyg_scheduler_start(void) __THROW
{
Cyg_Scheduler::start();
}
/* Lock the scheduler. */
-externC void cyg_scheduler_lock(void)
+externC void cyg_scheduler_lock(void) __THROW
{
Cyg_Scheduler::lock();
// get_sched_lock() is unsigned, see below "cyg_ucount32 lock"
CYG_ASSERT( (0xff000000 & (Cyg_Scheduler::get_sched_lock())) == 0,
"Scheduler overlocked" );
}
/* Lock the scheduler, but never more than level=1. */
-externC void cyg_scheduler_safe_lock(void)
+externC void cyg_scheduler_safe_lock(void) __THROW
{
Cyg_Scheduler::lock();
cyg_ucount32 slock = Cyg_Scheduler::get_sched_lock();
if (slock > 1)
Cyg_Scheduler::unlock();
@@ -134,21 +134,21 @@ externC void cyg_scheduler_safe_lock(voi
CYG_ASSERT( (0xff000000 & (Cyg_Scheduler::get_sched_lock())) == 0,
"Scheduler overlocked" );
}
/* Unlock the scheduler. */
-externC void cyg_scheduler_unlock(void)
+externC void cyg_scheduler_unlock(void) __THROW
{
cyg_ucount32 slock = Cyg_Scheduler::get_sched_lock();
CYG_ASSERT( 0 < slock, "Scheduler not locked" );
// And program defensively too:
if ( 0 < slock )
Cyg_Scheduler::unlock();
}
/* Read the scheduler lock value. */
-externC cyg_ucount32 cyg_scheduler_read_lock(void)
+externC cyg_ucount32 cyg_scheduler_read_lock(void) __THROW
{
cyg_ucount32 slock = Cyg_Scheduler::get_sched_lock();
return slock;
}
@@ -162,11 +162,11 @@ externC void cyg_thread_create(
char *name, /* optional thread name */
void *stack_base, /* stack base, NULL = alloc */
cyg_ucount32 stack_size, /* stack size, 0 = default */
cyg_handle_t *handle, /* returned thread handle */
cyg_thread *thread /* put thread here */
-)
+) __THROW
{
CYG_ASSERT_SIZES( cyg_thread, Cyg_Thread );
Cyg_Thread *t = new((void *)thread) Cyg_Thread (
(CYG_ADDRWORD) sched_info,
@@ -180,32 +180,32 @@ externC void cyg_thread_create(
CYG_CHECK_DATA_PTR( handle, "Bad handle pointer" );
*handle = (cyg_handle_t)thread;
}
-externC void cyg_thread_exit()
+externC void cyg_thread_exit() __THROW
{
Cyg_Thread::exit();
}
-externC cyg_bool_t cyg_thread_delete( cyg_handle_t thread )
+externC cyg_bool_t cyg_thread_delete( cyg_handle_t thread ) __THROW
{
Cyg_Thread *th = (Cyg_Thread *)thread;
if( th->get_state() != Cyg_Thread::EXITED )
th->kill(); // encourage it to terminate
if( th->get_state() != Cyg_Thread::EXITED )
return false; // it didn't run yet, leave it up to the app to fix
th->~Cyg_Thread();
return true;
}
-externC void cyg_thread_suspend(cyg_handle_t thread)
+externC void cyg_thread_suspend(cyg_handle_t thread) __THROW
{
((Cyg_Thread *)thread)->suspend();
}
-externC void cyg_thread_resume(cyg_handle_t thread)
+externC void cyg_thread_resume(cyg_handle_t thread) __THROW
{
Cyg_Thread *th = (Cyg_Thread *)thread;
// If we are resuming an exited thread then
// reinitialize it.
@@ -214,55 +214,55 @@ externC void cyg_thread_resume(cyg_handl
th->reinitialize();
th->resume();
}
-externC void cyg_thread_kill( cyg_handle_t thread)
+externC void cyg_thread_kill( cyg_handle_t thread) __THROW
{
((Cyg_Thread *)thread)->kill();
}
-externC void cyg_thread_release( cyg_handle_t thread)
+externC void cyg_thread_release( cyg_handle_t thread) __THROW
{
((Cyg_Thread *)thread)->release();
}
-externC void cyg_thread_yield()
+externC void cyg_thread_yield() __THROW
{
Cyg_Thread::yield();
}
-externC cyg_handle_t cyg_thread_self()
+externC cyg_handle_t cyg_thread_self() __THROW
{
return (cyg_handle_t)Cyg_Thread::self();
}
-externC cyg_uint16 cyg_thread_get_id( cyg_handle_t thread)
+externC cyg_uint16 cyg_thread_get_id( cyg_handle_t thread) __THROW
{
return ((Cyg_Thread *)thread)->get_unique_id();
}
// idle thread is not really a plain CygThread; danger.
-externC cyg_handle_t cyg_thread_idle_thread()
+externC cyg_handle_t cyg_thread_idle_thread() __THROW
{
extern Cyg_Thread idle_thread;
return (cyg_handle_t)&idle_thread;
}
/* Priority manipulation */
externC void cyg_thread_set_priority(
- cyg_handle_t thread, cyg_priority_t priority )
+ cyg_handle_t thread, cyg_priority_t priority ) __THROW
{
#ifdef CYGIMP_THREAD_PRIORITY
((Cyg_Thread *)thread)->set_priority(priority);
#endif
}
/* Get the normal priority, ie without any applied mutex inheritance or
* ceiling protocol. */
-externC cyg_priority_t cyg_thread_get_priority(cyg_handle_t thread)
+externC cyg_priority_t cyg_thread_get_priority(cyg_handle_t thread) __THROW
{
#ifdef CYGIMP_THREAD_PRIORITY
return ((Cyg_Thread *)thread)->get_priority();
#else
return 0;
@@ -270,11 +270,11 @@ externC cyg_priority_t cyg_thread_get_pr
}
/* Get the current priority, ie any applied mutex inheritance or
* ceiling protocol. */
-externC cyg_priority_t cyg_thread_get_current_priority(cyg_handle_t thread)
+externC cyg_priority_t cyg_thread_get_current_priority(cyg_handle_t thread) __THROW
{
#ifdef CYGIMP_THREAD_PRIORITY
return ((Cyg_Thread *)thread)->get_current_priority();
#else
return 0;
@@ -285,44 +285,44 @@ externC cyg_priority_t cyg_thread_get_cu
externC void cyg_thread_deadline_wait(
cyg_tick_count_t start_time, /* abs earliest start time */
cyg_tick_count_t run_time, /* worst case execution time */
cyg_tick_count_t deadline /* absolute deadline */
-)
+) __THROW
{
CYG_ASSERT(0,"Not implemented");
}
-externC void cyg_thread_delay(cyg_tick_count_t delay)
+externC void cyg_thread_delay(cyg_tick_count_t delay) __THROW
{
Cyg_Thread::self()->delay(delay);
}
/* Stack information */
-externC cyg_addrword_t cyg_thread_get_stack_base(cyg_handle_t thread)
+externC cyg_addrword_t cyg_thread_get_stack_base(cyg_handle_t thread) __THROW
{
return ((Cyg_Thread *)thread)->get_stack_base();
}
-externC cyg_uint32 cyg_thread_get_stack_size(cyg_handle_t thread)
+externC cyg_uint32 cyg_thread_get_stack_size(cyg_handle_t thread) __THROW
{
return ((Cyg_Thread *)thread)->get_stack_size();
}
#ifdef CYGFUN_KERNEL_THREADS_STACK_MEASUREMENT
-externC cyg_uint32 cyg_thread_measure_stack_usage(cyg_handle_t thread)
+externC cyg_uint32 cyg_thread_measure_stack_usage(cyg_handle_t thread) __THROW
{
return ((Cyg_Thread *)thread)->measure_stack_usage();
}
#endif
/*---------------------------------------------------------------------------*/
/* Thread enumeration and information */
#ifdef CYGVAR_KERNEL_THREADS_LIST
-cyg_bool_t cyg_thread_get_next( cyg_handle_t *current, cyg_uint16 *id )
+cyg_bool_t cyg_thread_get_next( cyg_handle_t *current, cyg_uint16 *id ) __THROW
{
cyg_bool_t result = true;
// There is a minute but finite chance that the thread could have
// exitted since the previous cyg_thread_get_next() call, and we can't
@@ -361,11 +361,11 @@ cyg_bool_t cyg_thread_get_next( cyg_hand
Cyg_Scheduler::unlock();
return result;
}
-cyg_handle_t cyg_thread_find( cyg_uint16 id )
+cyg_handle_t cyg_thread_find( cyg_uint16 id ) __THROW
{
Cyg_Scheduler::lock();
Cyg_Thread *thread = Cyg_Thread::get_list_head();
@@ -384,11 +384,11 @@ cyg_handle_t cyg_thread_find( cyg_uint16
#endif
cyg_bool_t cyg_thread_get_info( cyg_handle_t threadh,
cyg_uint16 id,
- cyg_thread_info *info )
+ cyg_thread_info *info ) __THROW
{
cyg_bool_t result = true;
Cyg_Thread *thread = (Cyg_Thread *)threadh;
CYG_CHECK_DATA_PTRC( thread );
if ( NULL != info )
@@ -428,34 +428,34 @@ cyg_bool_t cyg_thread_get_info( cyg_hand
/*---------------------------------------------------------------------------*/
/* Per-thread data */
#ifdef CYGVAR_KERNEL_THREADS_DATA
-externC cyg_ucount32 cyg_thread_new_data_index()
+externC cyg_ucount32 cyg_thread_new_data_index() __THROW
{
Cyg_Thread::cyg_data_index index = Cyg_Thread::new_data_index();
CYG_ASSERT(index >= 0, "failed to allocate data index" );
return index;
}
-externC void cyg_thread_free_data_index(cyg_ucount32 index)
+externC void cyg_thread_free_data_index(cyg_ucount32 index) __THROW
{
Cyg_Thread::free_data_index(index);
}
-externC CYG_ADDRWORD cyg_thread_get_data(cyg_ucount32 index)
+externC CYG_ADDRWORD cyg_thread_get_data(cyg_ucount32 index) __THROW
{
return Cyg_Thread::get_data(index);
}
-externC CYG_ADDRWORD *cyg_thread_get_data_ptr(cyg_ucount32 index)
+externC CYG_ADDRWORD *cyg_thread_get_data_ptr(cyg_ucount32 index) __THROW
{
return Cyg_Thread::get_data_ptr(index);
}
externC void cyg_thread_set_data(cyg_ucount32 index, CYG_ADDRWORD
-data)
+data) __THROW
{
Cyg_Thread::self()->set_data(index, data);
}
#endif
@@ -463,18 +463,18 @@ data)
/* Thread destructors */
#ifdef CYGPKG_KERNEL_THREADS_DESTRUCTORS
__externC cyg_bool_t
cyg_thread_add_destructor( cyg_thread_destructor_fn fn,
- cyg_addrword_t data )
+ cyg_addrword_t data ) __THROW
{
return Cyg_Thread::self()->add_destructor( fn, data );
}
__externC cyg_bool_t
cyg_thread_rem_destructor( cyg_thread_destructor_fn fn,
- cyg_addrword_t data )
+ cyg_addrword_t data ) __THROW
{
return Cyg_Thread::self()->rem_destructor( fn, data );
}
#endif
@@ -486,11 +486,11 @@ externC void cyg_exception_set_handler(
cyg_code_t exception_number,
cyg_exception_handler_t *new_handler,
cyg_addrword_t new_data,
cyg_exception_handler_t **old_handler,
cyg_addrword_t *old_data
-)
+) __THROW
{
Cyg_Thread::register_exception(
exception_number,
(cyg_exception_handler *)new_handler,
(CYG_ADDRWORD)new_data,
@@ -500,21 +500,21 @@ externC void cyg_exception_set_handler(
}
/* Clear exception handler to default */
externC void cyg_exception_clear_handler(
cyg_code_t exception_number
-)
+) __THROW
{
Cyg_Thread::deregister_exception( exception_number );
}
/* Invoke exception handler */
externC void cyg_exception_call_handler(
cyg_handle_t thread,
cyg_code_t exception_number,
cyg_addrword_t error_code
-)
+) __THROW
{
Cyg_Thread *t = (Cyg_Thread *)thread;
t->deliver_exception( exception_number, error_code );
}
@@ -529,11 +529,11 @@ externC void cyg_interrupt_create(
cyg_addrword_t data, /* Data pointer */
cyg_ISR_t *isr, /* Interrupt Service Routine */
cyg_DSR_t *dsr, /* Deferred Service Routine */
cyg_handle_t *handle, /* returned handle */
cyg_interrupt *intr /* put interrupt here */
-)
+) __THROW
{
CYG_ASSERT_SIZES( cyg_interrupt, Cyg_Interrupt );
Cyg_Interrupt *t = new((void *)intr) Cyg_Interrupt (
(cyg_vector)vector,
@@ -545,103 +545,103 @@ externC void cyg_interrupt_create(
CYG_CHECK_DATA_PTR( handle, "Bad handle pointer" );
*handle = (cyg_handle_t)intr;
}
-externC void cyg_interrupt_delete( cyg_handle_t interrupt)
+externC void cyg_interrupt_delete( cyg_handle_t interrupt) __THROW
{
((Cyg_Interrupt *)interrupt)->~Cyg_Interrupt();
}
-void cyg_interrupt_attach( cyg_handle_t interrupt )
+void cyg_interrupt_attach( cyg_handle_t interrupt ) __THROW
{
((Cyg_Interrupt *)interrupt)->attach();
}
-void cyg_interrupt_detach( cyg_handle_t interrupt )
+void cyg_interrupt_detach( cyg_handle_t interrupt ) __THROW
{
((Cyg_Interrupt *)interrupt)->detach();
}
/* VSR manipulation */
externC void cyg_interrupt_get_vsr(
cyg_vector_t vector, /* vector to get */
cyg_VSR_t **vsr /* vsr got */
-)
+) __THROW
{
Cyg_Interrupt::get_vsr( (cyg_vector)vector, (cyg_VSR **)vsr);
}
externC void cyg_interrupt_set_vsr(
cyg_vector_t vector, /* vector to set */
cyg_VSR_t *vsr /* vsr to set */
-)
+) __THROW
{
Cyg_Interrupt::set_vsr( (cyg_vector)vector, (cyg_VSR *)vsr);
}
/* CPU level interrupt mask */
-externC void cyg_interrupt_disable()
+externC void cyg_interrupt_disable() __THROW
{
Cyg_Interrupt::disable_interrupts();
}
-externC void cyg_interrupt_enable()
+externC void cyg_interrupt_enable() __THROW
{
Cyg_Interrupt::enable_interrupts();
}
/* Interrupt controller access */
-externC void cyg_interrupt_mask(cyg_vector_t vector)
+externC void cyg_interrupt_mask(cyg_vector_t vector) __THROW
{
Cyg_Interrupt::mask_interrupt( (cyg_vector)vector);
}
-externC void cyg_interrupt_mask_intunsafe(cyg_vector_t vector)
+externC void cyg_interrupt_mask_intunsafe(cyg_vector_t vector) __THROW
{
Cyg_Interrupt::mask_interrupt_intunsafe( (cyg_vector)vector);
}
-externC void cyg_interrupt_unmask(cyg_vector_t vector)
+externC void cyg_interrupt_unmask(cyg_vector_t vector) __THROW
{
Cyg_Interrupt::unmask_interrupt( (cyg_vector)vector);
}
-externC void cyg_interrupt_unmask_intunsafe(cyg_vector_t vector)
+externC void cyg_interrupt_unmask_intunsafe(cyg_vector_t vector) __THROW
{
Cyg_Interrupt::unmask_interrupt_intunsafe( (cyg_vector)vector);
}
-externC void cyg_interrupt_acknowledge(cyg_vector_t vector)
+externC void cyg_interrupt_acknowledge(cyg_vector_t vector) __THROW
{
Cyg_Interrupt::acknowledge_interrupt( (cyg_vector)vector);
}
externC void cyg_interrupt_configure(
cyg_vector_t vector, /* vector to configure */
cyg_bool_t level, /* level or edge triggered */
cyg_bool_t up /* rising/faling edge, high/low level*/
-)
+) __THROW
{
Cyg_Interrupt::configure_interrupt( (cyg_vector)vector, level, up );
}
externC void cyg_interrupt_set_cpu(
cyg_vector_t vector, /* vector to control */
cyg_cpu_t cpu /* CPU to set */
-)
+) __THROW
{
#ifdef CYGPKG_KERNEL_SMP_SUPPORT
Cyg_Interrupt::set_cpu( vector, cpu );
#endif
}
externC cyg_cpu_t cyg_interrupt_get_cpu(
cyg_vector_t vector /* vector to control */
-)
+) __THROW
{
#ifdef CYGPKG_KERNEL_SMP_SUPPORT
return Cyg_Interrupt::get_cpu( vector );
#else
return CYG_KERNEL_CPU_THIS();
@@ -653,59 +653,59 @@ externC cyg_cpu_t cyg_interrupt_get_cpu(
/* Counters, Clocks and Alarms */
externC void cyg_counter_create(
cyg_handle_t *handle, /* returned counter handle */
cyg_counter *counter /* put counter here */
-)
+) __THROW
{
CYG_ASSERT_SIZES( cyg_counter, Cyg_Counter );
Cyg_Counter *t = new((void *)counter) Cyg_Counter ();
t=t;
CYG_CHECK_DATA_PTR( handle, "Bad handle pointer" );
*handle = (cyg_handle_t)counter;
}
-externC void cyg_counter_delete(cyg_handle_t counter)
+externC void cyg_counter_delete(cyg_handle_t counter) __THROW
{
((Cyg_Counter *)counter)->~Cyg_Counter();
}
/* Return current value of counter */
-externC cyg_tick_count_t cyg_counter_current_value(cyg_handle_t counter)
+externC cyg_tick_count_t cyg_counter_current_value(cyg_handle_t counter) __THROW
{
return ((Cyg_Counter *)counter)->current_value();
}
/* Set new current value */
externC void cyg_counter_set_value(
cyg_handle_t counter,
cyg_tick_count_t new_value
-)
+) __THROW
{
((Cyg_Counter *)counter)->set_value( new_value );
}
/* Advance counter by one tick */
-externC void cyg_counter_tick(cyg_handle_t counter)
+externC void cyg_counter_tick(cyg_handle_t counter) __THROW
{
((Cyg_Counter *)counter)->tick();
}
/* Advance counter by multiple ticks */
-externC void cyg_counter_multi_tick(cyg_handle_t counter, cyg_tick_count_t ticks)
+externC void cyg_counter_multi_tick(cyg_handle_t counter, cyg_tick_count_t ticks) __THROW
{
((Cyg_Counter *)counter)->tick(ticks);
}
/* Create a clock object */
externC void cyg_clock_create(
cyg_resolution_t resolution, /* Initial resolution */
cyg_handle_t *handle, /* Returned clock handle */
cyg_clock *clock /* put clock here */
-)
+) __THROW
{
CYG_ASSERT_SIZES( cyg_clock, Cyg_Clock );
Cyg_Clock::cyg_resolution res;
@@ -717,40 +717,40 @@ externC void cyg_clock_create(
CYG_CHECK_DATA_PTR( handle, "Bad handle pointer" );
*handle = (cyg_handle_t)clock;
}
-externC void cyg_clock_delete(cyg_handle_t clock)
+externC void cyg_clock_delete(cyg_handle_t clock) __THROW
{
((Cyg_Clock *)clock)->~Cyg_Clock();
}
/* convert a clock handle to a counter handle so we can use the */
/* counter API on it. */
externC void cyg_clock_to_counter(
cyg_handle_t clock,
cyg_handle_t *counter
-)
+) __THROW
{
CYG_CHECK_DATA_PTR( counter, "Bad counter handle pointer" );
*counter = (cyg_handle_t)(Cyg_Counter *)clock;
}
externC void cyg_clock_set_resolution(
cyg_handle_t clock,
cyg_resolution_t resolution /* New resolution */
-)
+) __THROW
{
Cyg_Clock::cyg_resolution res;
res.dividend = resolution.dividend;
res.divisor = resolution.divisor;
((Cyg_Clock *)clock)->set_resolution( res );
}
-externC cyg_resolution_t cyg_clock_get_resolution(cyg_handle_t clock)
+externC cyg_resolution_t cyg_clock_get_resolution(cyg_handle_t clock) __THROW
{
Cyg_Clock::cyg_resolution res =
((Cyg_Clock *)clock)->get_resolution();
cyg_resolution_t resolution;
@@ -760,16 +760,16 @@ externC cyg_resolution_t cyg_clock_get_r
return resolution;
}
#ifdef CYGVAR_KERNEL_COUNTERS_CLOCK
-externC cyg_handle_t cyg_real_time_clock(void)
+externC cyg_handle_t cyg_real_time_clock(void) __THROW
{
return (cyg_handle_t)Cyg_Clock::real_time_clock;
}
-externC cyg_tick_count_t cyg_current_time(void)
+externC cyg_tick_count_t cyg_current_time(void) __THROW
{
return Cyg_Clock::real_time_clock->current_value();
}
#endif
@@ -777,11 +777,11 @@ externC void cyg_alarm_create(
cyg_handle_t counter, /* Attached to this counter */
cyg_alarm_t *alarmfn, /* Call-back function */
cyg_addrword_t data, /* Call-back data */
cyg_handle_t *handle, /* Returned alarm object */
cyg_alarm *alarm /* put alarm here */
-)
+) __THROW
{
CYG_ASSERT_SIZES( cyg_alarm, Cyg_Alarm );
Cyg_Alarm *t = new((void *)alarm) Cyg_Alarm (
(Cyg_Counter *)counter,
@@ -793,128 +793,128 @@ externC void cyg_alarm_create(
CYG_CHECK_DATA_PTR( handle, "Bad handle pointer" );
*handle = (cyg_handle_t)alarm;
}
/* Disable alarm, detach from counter and invalidate handles */
-externC void cyg_alarm_delete( cyg_handle_t alarm)
+externC void cyg_alarm_delete( cyg_handle_t alarm) __THROW
{
((Cyg_Alarm *)alarm)->~Cyg_Alarm();
}
externC void cyg_alarm_initialize(
cyg_handle_t alarm,
cyg_tick_count_t trigger, /* Absolute trigger time */
cyg_tick_count_t interval /* Relative retrigger interval */
-)
+) __THROW
{
((Cyg_Alarm *)alarm)->initialize(
(cyg_tick_count)trigger,
(cyg_tick_count)interval);
}
externC void cyg_alarm_get_times(
cyg_handle_t alarm,
cyg_tick_count_t *trigger, /* Next trigger time */
cyg_tick_count_t *interval /* Current interval */
-)
+) __THROW
{
((Cyg_Alarm *)alarm)->get_times(
(cyg_tick_count*)trigger,
(cyg_tick_count*)interval);
}
-externC void cyg_alarm_enable( cyg_handle_t alarm )
+externC void cyg_alarm_enable( cyg_handle_t alarm ) __THROW
{
((Cyg_Alarm *)alarm)->enable();
}
-externC void cyg_alarm_disable( cyg_handle_t alarm )
+externC void cyg_alarm_disable( cyg_handle_t alarm ) __THROW
{
((Cyg_Alarm *)alarm)->disable();
}
/*---------------------------------------------------------------------------*/
/* Mail boxes */
externC void cyg_mbox_create(
cyg_handle_t *handle,
cyg_mbox *mbox
-)
+) __THROW
{
CYG_ASSERT_SIZES( cyg_mbox, Cyg_Mbox );
Cyg_Mbox *t = new((void *)mbox) Cyg_Mbox();
t=t;
CYG_CHECK_DATA_PTR( handle, "Bad handle pointer" );
*handle = (cyg_handle_t)mbox;
}
-externC void cyg_mbox_delete(cyg_handle_t mbox)
+externC void cyg_mbox_delete(cyg_handle_t mbox) __THROW
{
((Cyg_Mbox *)mbox)->~Cyg_Mbox();
}
-externC void *cyg_mbox_get(cyg_handle_t mbox)
+externC void *cyg_mbox_get(cyg_handle_t mbox) __THROW
{
return ((Cyg_Mbox *)mbox)->get();
}
#ifdef CYGFUN_KERNEL_THREADS_TIMER
void *cyg_mbox_timed_get(
cyg_handle_t mbox,
cyg_tick_count_t abstime
- )
+ ) __THROW
{
return ((Cyg_Mbox *)mbox)->get(abstime);
}
#endif
-externC void *cyg_mbox_tryget(cyg_handle_t mbox)
+externC void *cyg_mbox_tryget(cyg_handle_t mbox) __THROW
{
return ((Cyg_Mbox *)mbox)->tryget();
}
-externC void *cyg_mbox_peek_item(cyg_handle_t mbox)
+externC void *cyg_mbox_peek_item(cyg_handle_t mbox) __THROW
{
return ((Cyg_Mbox *)mbox)->peek_item();
}
#ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT
-externC cyg_bool_t cyg_mbox_put(cyg_handle_t mbox, void *item)
+externC cyg_bool_t cyg_mbox_put(cyg_handle_t mbox, void *item) __THROW
{
return ((Cyg_Mbox *)mbox)->put(item);
}
#ifdef CYGFUN_KERNEL_THREADS_TIMER
externC cyg_bool_t cyg_mbox_timed_put(
cyg_handle_t mbox,
void *item,
cyg_tick_count_t abstime
- )
+ ) __THROW
{
return ((Cyg_Mbox *)mbox)->put(item, abstime);
}
#endif
#endif
-externC cyg_bool_t cyg_mbox_tryput(cyg_handle_t mbox, void *item)
+externC cyg_bool_t cyg_mbox_tryput(cyg_handle_t mbox, void *item) __THROW
{
return ((Cyg_Mbox *)mbox)->tryput(item);
}
-externC cyg_count32 cyg_mbox_peek(cyg_handle_t mbox)
+externC cyg_count32 cyg_mbox_peek(cyg_handle_t mbox) __THROW
{
return ((Cyg_Mbox *)mbox)->peek();
}
-externC cyg_bool_t cyg_mbox_waiting_to_get(cyg_handle_t mbox)
+externC cyg_bool_t cyg_mbox_waiting_to_get(cyg_handle_t mbox) __THROW
{
return ((Cyg_Mbox *)mbox)->waiting_to_get();
}
-externC cyg_bool_t cyg_mbox_waiting_to_put(cyg_handle_t mbox)
+externC cyg_bool_t cyg_mbox_waiting_to_put(cyg_handle_t mbox) __THROW
{
return ((Cyg_Mbox *)mbox)->waiting_to_put();
}
@@ -922,50 +922,50 @@ externC cyg_bool_t cyg_mbox_waiting_to_p
/* Semaphores */
externC void cyg_semaphore_init(
cyg_sem_t *sem, /* Semaphore to init */
cyg_count32 val /* Initial semaphore value */
-)
+) __THROW
{
CYG_ASSERT_SIZES( cyg_sem_t, Cyg_Counting_Semaphore );
Cyg_Counting_Semaphore *t = new((void *)sem) Cyg_Counting_Semaphore(val);
t=t;
}
-externC void cyg_semaphore_destroy( cyg_sem_t *sem )
+externC void cyg_semaphore_destroy( cyg_sem_t *sem ) __THROW
{
((Cyg_Counting_Semaphore *)sem)->~Cyg_Counting_Semaphore();
}
-externC cyg_bool_t cyg_semaphore_wait( cyg_sem_t *sem )
+externC cyg_bool_t cyg_semaphore_wait( cyg_sem_t *sem ) __THROW
{
return ((Cyg_Counting_Semaphore *)sem)->wait();
}
#ifdef CYGFUN_KERNEL_THREADS_TIMER
externC cyg_bool_t cyg_semaphore_timed_wait(
cyg_sem_t *sem,
cyg_tick_count_t abstime
- )
+ ) __THROW
{
return ((Cyg_Counting_Semaphore *)sem)->wait(abstime);
}
#endif
-externC int cyg_semaphore_trywait( cyg_sem_t *sem )
+externC int cyg_semaphore_trywait( cyg_sem_t *sem ) __THROW
{
return ((Cyg_Counting_Semaphore *)sem)->trywait();
}
-externC void cyg_semaphore_post( cyg_sem_t *sem )
+externC void cyg_semaphore_post( cyg_sem_t *sem ) __THROW
{
((Cyg_Counting_Semaphore *)sem)->post();
}
-externC void cyg_semaphore_peek( cyg_sem_t *sem, cyg_count32 *val )
+externC void cyg_semaphore_peek( cyg_sem_t *sem, cyg_count32 *val ) __THROW
{
CYG_CHECK_DATA_PTR( val, "Bad val parameter" );
*val = ((Cyg_Counting_Semaphore *)sem)->peek();
}
@@ -974,11 +974,11 @@ externC void cyg_semaphore_peek( cyg_sem
/*---------------------------------------------------------------------------*/
/* Flags */
void cyg_flag_init(
cyg_flag_t *flag /* Flag to init */
-)
+) __THROW
{
CYG_ASSERT_SIZES( cyg_flag_t, Cyg_Flag );
CYG_ASSERT(
( Cyg_Flag::AND == CYG_FLAG_WAITMODE_AND ) &&
( Cyg_Flag::OR == CYG_FLAG_WAITMODE_OR ) &&
@@ -987,28 +987,28 @@ void cyg_flag_init(
Cyg_Flag *t = new((void *)flag) Cyg_Flag();
t=t;
}
-void cyg_flag_destroy( cyg_flag_t *flag )
+void cyg_flag_destroy( cyg_flag_t *flag ) __THROW
{
((Cyg_Flag *)flag)->~Cyg_Flag();
}
-void cyg_flag_setbits( cyg_flag_t *flag, cyg_flag_value_t value)
+void cyg_flag_setbits( cyg_flag_t *flag, cyg_flag_value_t value) __THROW
{
((Cyg_Flag *)flag)->setbits( value );
}
-void cyg_flag_maskbits( cyg_flag_t *flag, cyg_flag_value_t value)
+void cyg_flag_maskbits( cyg_flag_t *flag, cyg_flag_value_t value) __THROW
{
((Cyg_Flag *)flag)->maskbits( value );
}
cyg_flag_value_t cyg_flag_wait( cyg_flag_t *flag,
cyg_flag_value_t pattern,
- cyg_flag_mode_t mode )
+ cyg_flag_mode_t mode ) __THROW
{
if ( 0 == pattern || 0 != (mode & ~3) )
return 0;
return ((Cyg_Flag *)flag)->wait( pattern, mode );
@@ -1016,91 +1016,91 @@ cyg_flag_value_t cyg_flag_wait( cyg_flag
#ifdef CYGFUN_KERNEL_THREADS_TIMER
cyg_flag_value_t cyg_flag_timed_wait( cyg_flag_t *flag,
cyg_flag_value_t pattern,
cyg_flag_mode_t mode,
- cyg_tick_count_t abstime )
+ cyg_tick_count_t abstime ) __THROW
{
if ( 0 == pattern || 0 != (mode & ~3) )
return 0;
return ((Cyg_Flag *)flag)->wait( pattern, mode, abstime );
}
#endif
cyg_flag_value_t cyg_flag_poll( cyg_flag_t *flag,
cyg_flag_value_t pattern,
- cyg_flag_mode_t mode )
+ cyg_flag_mode_t mode ) __THROW
{
if ( 0 == pattern || 0 != (mode & ~3) )
return 0;
return ((Cyg_Flag *)flag)->poll( pattern, mode );
}
-cyg_flag_value_t cyg_flag_peek( cyg_flag_t *flag )
+cyg_flag_value_t cyg_flag_peek( cyg_flag_t *flag ) __THROW
{
return ((Cyg_Flag *)flag)->peek();
}
-cyg_bool_t cyg_flag_waiting( cyg_flag_t *flag )
+cyg_bool_t cyg_flag_waiting( cyg_flag_t *flag ) __THROW
{
return ((Cyg_Flag *)flag)->waiting();
}
/*---------------------------------------------------------------------------*/
/* Mutex */
externC void cyg_mutex_init(
cyg_mutex_t *mutex /* Mutex to init */
-)
+) __THROW
{
CYG_ASSERT_SIZES( cyg_mutex_t, Cyg_Mutex );
Cyg_Mutex *m = new((void *)mutex) Cyg_Mutex;
m=m;
}
-externC void cyg_mutex_destroy( cyg_mutex_t *mutex )
+externC void cyg_mutex_destroy( cyg_mutex_t *mutex ) __THROW
{
((Cyg_Mutex *)mutex)->~Cyg_Mutex();
}
-externC cyg_bool_t cyg_mutex_lock( cyg_mutex_t *mutex )
+externC cyg_bool_t cyg_mutex_lock( cyg_mutex_t *mutex ) __THROW
{
return ((Cyg_Mutex *)mutex)->lock();
}
-externC cyg_bool_t cyg_mutex_trylock( cyg_mutex_t *mutex )
+externC cyg_bool_t cyg_mutex_trylock( cyg_mutex_t *mutex ) __THROW
{
return ((Cyg_Mutex *)mutex)->trylock();
}
-externC void cyg_mutex_unlock( cyg_mutex_t *mutex )
+externC void cyg_mutex_unlock( cyg_mutex_t *mutex ) __THROW
{
((Cyg_Mutex *)mutex)->unlock();
}
-externC void cyg_mutex_release( cyg_mutex_t *mutex )
+externC void cyg_mutex_release( cyg_mutex_t *mutex ) __THROW
{
((Cyg_Mutex *)mutex)->release();
}
#ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_CEILING
externC void cyg_mutex_set_ceiling(
cyg_mutex_t *mutex,
- cyg_priority_t priority )
+ cyg_priority_t priority ) __THROW
{
((Cyg_Mutex *)mutex)->set_ceiling(priority);
}
#endif
#ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DYNAMIC
externC void cyg_mutex_set_protocol(
cyg_mutex_t *mutex,
- enum cyg_mutex_protocol protocol )
+ enum cyg_mutex_protocol protocol ) __THROW
{
((Cyg_Mutex *)mutex)->set_protocol((Cyg_Mutex::cyg_protcol)protocol);
}
#endif
@@ -1108,44 +1108,44 @@ externC void cyg_mutex_set_protocol(
/* Condition Variables */
externC void cyg_cond_init(
cyg_cond_t *cond, /* condition variable to init */
cyg_mutex_t *mutex /* associated mutex */
-)
+) __THROW
{
CYG_ASSERT_SIZES( cyg_cond_t, Cyg_Condition_Variable );
Cyg_Condition_Variable *t = new((void *)cond) Cyg_Condition_Variable(
*(Cyg_Mutex *)mutex);
t=t;
}
-externC void cyg_cond_destroy( cyg_cond_t *cond )
+externC void cyg_cond_destroy( cyg_cond_t *cond ) __THROW
{
((Cyg_Condition_Variable *)cond)->~Cyg_Condition_Variable();
}
-externC cyg_bool_t cyg_cond_wait( cyg_cond_t *cond )
+externC cyg_bool_t cyg_cond_wait( cyg_cond_t *cond ) __THROW
{
return ((Cyg_Condition_Variable *)cond)->wait();
}
-externC void cyg_cond_signal( cyg_cond_t *cond )
+externC void cyg_cond_signal( cyg_cond_t *cond ) __THROW
{
((Cyg_Condition_Variable *)cond)->signal();
}
-externC void cyg_cond_broadcast( cyg_cond_t *cond )
+externC void cyg_cond_broadcast( cyg_cond_t *cond ) __THROW
{
((Cyg_Condition_Variable *)cond)->broadcast();
}
#ifdef CYGMFN_KERNEL_SYNCH_CONDVAR_TIMED_WAIT
externC cyg_bool_t cyg_cond_timed_wait(
cyg_cond_t *cond,
cyg_tick_count_t abstime
- )
+ ) __THROW
{
return ((Cyg_Condition_Variable *)cond)->wait(abstime);
}
#endif
@@ -1154,11 +1154,11 @@ externC cyg_bool_t cyg_cond_timed_wait(
/* Spinlocks */
externC void cyg_spinlock_init(
cyg_spinlock_t *lock, /* spinlock to initialize */
cyg_bool_t locked /* init locked or unlocked */
-)
+) __THROW
{
CYG_ASSERT_SIZES( cyg_spinlock_t, Cyg_SpinLock );
// Create the spinlock in cleared state
Cyg_SpinLock *t = new((void *)lock) Cyg_SpinLock();
@@ -1166,43 +1166,43 @@ externC void cyg_spinlock_init(
// If the lock is to start locked, then lock it now.
if( locked )
t->spin();
}
-externC void cyg_spinlock_destroy( cyg_spinlock_t *lock )
+externC void cyg_spinlock_destroy( cyg_spinlock_t *lock ) __THROW
{
((Cyg_SpinLock *)lock)->~Cyg_SpinLock();
}
-externC void cyg_spinlock_spin( cyg_spinlock_t *lock )
+externC void cyg_spinlock_spin( cyg_spinlock_t *lock ) __THROW
{
((Cyg_SpinLock *)lock)->spin();
}
-externC void cyg_spinlock_clear( cyg_spinlock_t *lock )
+externC void cyg_spinlock_clear( cyg_spinlock_t *lock ) __THROW
{
((Cyg_SpinLock *)lock)->clear();
}
-externC cyg_bool_t cyg_spinlock_try( cyg_spinlock_t *lock )
+externC cyg_bool_t cyg_spinlock_try( cyg_spinlock_t *lock ) __THROW
{
return ((Cyg_SpinLock *)lock)->trylock();
}
-externC cyg_bool_t cyg_spinlock_test( cyg_spinlock_t *lock )
+externC cyg_bool_t cyg_spinlock_test( cyg_spinlock_t *lock ) __THROW
{
return ((Cyg_SpinLock *)lock)->test();
}
externC void cyg_spinlock_spin_intsave( cyg_spinlock_t *lock,
- cyg_addrword_t *istate )
+ cyg_addrword_t *istate ) __THROW
{
((Cyg_SpinLock *)lock)->spin_intsave((CYG_INTERRUPT_STATE *)istate);
}
externC void cyg_spinlock_clear_intsave( cyg_spinlock_t *lock,
- cyg_addrword_t istate )
+ cyg_addrword_t istate ) __THROW
{
((Cyg_SpinLock *)lock)->clear_intsave((CYG_INTERRUPT_STATE)istate);
}
@@ -1216,11 +1216,11 @@ externC void cyg_spinlock_clear_intsave(
class Cyg_Check_Structure_Sizes
{
int dummy;
public:
- Cyg_Check_Structure_Sizes( int x );
+ Cyg_Check_Structure_Sizes( int x ) __THROW;
};
#define CYG_CHECK_SIZES(cstruct, cxxstruct) \
if( sizeof(cstruct) != sizeof(cxxstruct) ) \
@@ -1230,11 +1230,11 @@ if( sizeof(cstruct) != sizeof(cxxstruct)
CYG_TRACE2(1, fmt, sizeof(cstruct) , sizeof(cxxstruct) ); \
fail = true; \
fmt = fmt; \
}
-Cyg_Check_Structure_Sizes::Cyg_Check_Structure_Sizes(int x)
+Cyg_Check_Structure_Sizes::Cyg_Check_Structure_Sizes(int x) __THROW
{
cyg_bool fail = false;
dummy = x+1;
Index: language/c/libc/i18n/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/i18n/current/ChangeLog,v
retrieving revision 1.6
diff -u -5 -p -r1.6 ChangeLog
--- language/c/libc/i18n/current/ChangeLog 24 Feb 2003 14:26:42 -0000 1.6
+++ language/c/libc/i18n/current/ChangeLog 15 Mar 2004 15:04:10 -0000
@@ -1,5 +1,18 @@
+2004-02-17 Jonathan Larmour <jifl@eCosCentric.com>
+
+ * cdl/i18n.cdl: Add newlib style ctype implementation.
+ CYGSEM_LIBC_I18N_PER_THREAD_MB can be inactive when no kernel.
+ * include/newlibctype.h: New file.
+ * src/newlibctype.cxx: New file.
+ * src/ctype.cxx: Don't define functions if newlib style ctype
+ chosen instead.
+
+ * src/wctomb.cxx (wctomb): Use correct thread data type.
+ * src/mbtowc.cxx (mbtowc): Ditto.
+ * src/mblen.cxx (mblen): Ditto.
+
2003-02-24 Jonathan Larmour <jifl@eCosCentric.com>
* cdl/i18n.cdl: Fix doc link.
2001-06-28 Jesper Skov <jskov@redhat.com>
Index: language/c/libc/i18n/current/cdl/i18n.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/i18n/current/cdl/i18n.cdl,v
retrieving revision 1.5
diff -u -5 -p -r1.5 i18n.cdl
--- language/c/libc/i18n/current/cdl/i18n.cdl 24 Feb 2003 14:26:42 -0000 1.5
+++ language/c/libc/i18n/current/cdl/i18n.cdl 15 Mar 2004 15:04:10 -0000
@@ -114,14 +114,30 @@ cdl_package CYGPKG_LIBC_I18N {
}
}
# ====================================================================
+ cdl_option CYGPKG_LIBC_I18N_NEWLIB_CTYPE {
+ display "Newlib's ctype implementation"
+ default_value 0
+ requires { CYGBLD_ISO_CTYPE_HEADER == \
+ "<cyg/libc/i18n/newlibctype.h>" }
+ description "
+ This option enables the implementation of the ctype functions
+ that comes with newlib. It is table driven and therefore
+ exhibits different performance characteristics. It also offers
+ a limited amount of binary compatibility
+ with newlib so that programs linked against newlib ctype/locale
+ do not need to be recompiled when linked with eCos."
+ compile newlibctype.cxx
+ }
+
cdl_option CYGSEM_LIBC_I18N_PER_THREAD_MB {
display "Per-thread multibyte state"
+ active_if CYGPKG_KERNEL
requires CYGVAR_KERNEL_THREADS_DATA
- default_value 0
+ default_value { CYGVAR_KERNEL_THREADS_DATA != 0 }
description "
This option controls whether the multibyte character
handling functions mblen(), mbtowc(), and wctomb(),
have their state recorded on a per-thread
basis rather than global. If this option is
Index: language/c/libc/i18n/current/include/newlibctype.h
===================================================================
RCS file: language/c/libc/i18n/current/include/newlibctype.h
diff -N language/c/libc/i18n/current/include/newlibctype.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ language/c/libc/i18n/current/include/newlibctype.h 15 Mar 2004 15:04:10 -0000
@@ -0,0 +1,125 @@
+#ifndef CYGONCE_LIBC_I18N_NEWLIBCTYPE_H
+#define CYGONCE_LIBC_I18N_NEWLIBCTYPE_H
+/*===========================================================================
+//
+// newlibctype.h
+//
+// newlib's implementation of the ctype functions
+//
+//===========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2004 eCosCentric Ltd.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//===========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): jlarmour
+// Contributors:
+// Date: 2004-02-16
+// Purpose:
+// Description:
+// Usage: Do not include this file directly - use #include <ctype.h>
+//
+//####DESCRIPTIONEND####
+//
+//=========================================================================*/
+
+/* CONFIGURATION */
+
+#include <pkgconf/libc_i18n.h> /* Configuration header */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int isalnum(int __c);
+extern int isalpha(int __c);
+extern int iscntrl(int __c);
+extern int isdigit(int __c);
+extern int isgraph(int __c);
+extern int islower(int __c);
+extern int isprint(int __c);
+extern int ispunct(int __c);
+extern int isspace(int __c);
+extern int isupper(int __c);
+extern int isxdigit(int __c);
+extern int tolower(int __c);
+extern int toupper(int __c);
+
+#ifndef __STRICT_ANSI__
+int isascii(int __c);
+int toascii(int __c);
+int _tolower(int __c);
+int _toupper(int __c);
+#endif
+
+#define _U 01
+#define _L 02
+#define _N 04
+#define _S 010
+#define _P 020
+#define _C 040
+#define _X 0100
+#define _B 0200
+
+extern const char _ctype_[];
+
+#ifndef __cplusplus
+#define isalpha(c) ((_ctype_+1)[(unsigned)(c)]&(_U|_L))
+#define isupper(c) ((_ctype_+1)[(unsigned)(c)]&_U)
+#define islower(c) ((_ctype_+1)[(unsigned)(c)]&_L)
+#define isdigit(c) ((_ctype_+1)[(unsigned)(c)]&_N)
+#define isxdigit(c) ((_ctype_+1)[(unsigned)(c)]&(_X|_N))
+#define isspace(c) ((_ctype_+1)[(unsigned)(c)]&_S)
+#define ispunct(c) ((_ctype_+1)[(unsigned)(c)]&_P)
+#define isalnum(c) ((_ctype_+1)[(unsigned)(c)]&(_U|_L|_N))
+#define isprint(c) ((_ctype_+1)[(unsigned)(c)]&(_P|_U|_L|_N|_B))
+#define isgraph(c) ((_ctype_+1)[(unsigned)(c)]&(_P|_U|_L|_N))
+#define iscntrl(c) ((_ctype_+1)[(unsigned)(c)]&_C)
+/* Non-gcc versions will get the library versions, and will be
+ slightly slower */
+#ifdef __GNUC__
+# define toupper(c) \
+ __extension__ ({ int __x = (c); islower(__x) ? (__x - 'a' + 'A') : __x;})
+# define tolower(c) \
+ __extension__ ({ int __x = (c); isupper(__x) ? (__x - 'A' + 'a') : __x;})
+#endif
+#endif /* !__cplusplus */
+
+#ifndef __STRICT_ANSI__
+#define isascii(c) ((unsigned)(c)<=0177)
+#define toascii(c) ((c)&0177)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* CYGONCE_LIBC_I18N_NEWLIBCTYPE_H multiple inclusion protection */
+
+/* EOF newlibctype.h */
Index: language/c/libc/i18n/current/src/ctype.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/i18n/current/src/ctype.cxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 ctype.cxx
--- language/c/libc/i18n/current/src/ctype.cxx 23 May 2002 23:07:06 -0000 1.3
+++ language/c/libc/i18n/current/src/ctype.cxx 15 Mar 2004 15:04:10 -0000
@@ -51,14 +51,20 @@
//
//####DESCRIPTIONEND####
//
//=========================================================================*/
+/* CONFIGURATION */
+
+#include <pkgconf/libc_i18n.h> /* Configuration header */
+
/* We don't want the inline versions of the ctype functions defined here */
#define CYGPRI_LIBC_I18N_CTYPE_INLINE
/* This means that including ctype.inl will make the outline functions */
-#include <cyg/libc/i18n/ctype.inl>
+#ifndef CYGPKG_LIBC_I18N_NEWLIB_CTYPE
+# include <cyg/libc/i18n/ctype.inl>
+#endif
/* EOF ctype.cxx */
Index: language/c/libc/i18n/current/src/mblen.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/i18n/current/src/mblen.cxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 mblen.cxx
--- language/c/libc/i18n/current/src/mblen.cxx 23 May 2002 23:07:06 -0000 1.3
+++ language/c/libc/i18n/current/src/mblen.cxx 15 Mar 2004 15:04:10 -0000
@@ -130,11 +130,13 @@ static int mblen_trace = CYGNUM_LIBC_I18
// STATICS
#ifdef CYGINT_LIBC_I18N_MB_REQUIRED
# ifdef CYGSEM_LIBC_I18N_PER_THREAD_MB
-static volatile cyg_ucount32 mblen_data_index=CYGNUM_KERNEL_THREADS_DATA_MAX;
+static volatile Cyg_Thread::cyg_data_index
+mblen_data_index=CYGNUM_KERNEL_THREADS_DATA_MAX;
+
static Cyg_Mutex mblen_data_mutex CYG_INIT_PRIORITY(LIBC);
# else
static int cyg_libc_mblen_last;
# endif
#endif
@@ -165,15 +167,15 @@ mblen ( const char *s, size_t n )
// rare situation
if (CYGNUM_KERNEL_THREADS_DATA_MAX==mblen_data_index) {
mblen_data_mutex.lock();
if (CYGNUM_KERNEL_THREADS_DATA_MAX==mblen_data_index) {
- // the kernel just throws an assert if this doesn't work
// FIXME: Should use real CDL to pre-allocate a slot at compile
// time to ensure there are enough slots
mblen_data_index = self->new_data_index();
+ CYG_ASSERT(mblen_data_index >= 0, "failed to allocate data index" );
}
mblen_data_mutex.unlock();
} // if
// we have a valid index now
Index: language/c/libc/i18n/current/src/mbtowc.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/i18n/current/src/mbtowc.cxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 mbtowc.cxx
--- language/c/libc/i18n/current/src/mbtowc.cxx 23 May 2002 23:07:06 -0000 1.3
+++ language/c/libc/i18n/current/src/mbtowc.cxx 15 Mar 2004 15:04:10 -0000
@@ -139,11 +139,13 @@ static int mbtowc_trace = CYGNUM_LIBC_I1
// STATICS
#ifdef CYGINT_LIBC_I18N_MB_REQUIRED
# ifdef CYGSEM_LIBC_I18N_PER_THREAD_MB
-static volatile cyg_ucount32 mbtowc_data_index=CYGNUM_KERNEL_THREADS_DATA_MAX;
+static volatile Cyg_Thread::cyg_data_index
+mbtowc_data_index=CYGNUM_KERNEL_THREADS_DATA_MAX;
+
static Cyg_Mutex mbtowc_data_mutex CYG_INIT_PRIORITY(LIBC);
# else
static int cyg_libc_mbtowc_last;
# endif
#endif
@@ -176,15 +178,15 @@ mbtowc ( wchar_t *pwc, const char *s, si
// rare situation
if (CYGNUM_KERNEL_THREADS_DATA_MAX==mbtowc_data_index) {
mbtowc_data_mutex.lock();
if (CYGNUM_KERNEL_THREADS_DATA_MAX==mbtowc_data_index) {
- // the kernel just throws an assert if this doesn't work
// FIXME: Should use real CDL to pre-allocate a slot at compile
// time to ensure there are enough slots
mbtowc_data_index = self->new_data_index();
+ CYG_ASSERT(mbtowc_data_index >= 0, "failed to allocate data index" );
}
mbtowc_data_mutex.unlock();
} // if
// we have a valid index now
Index: language/c/libc/i18n/current/src/newlibctype.cxx
===================================================================
RCS file: language/c/libc/i18n/current/src/newlibctype.cxx
diff -N language/c/libc/i18n/current/src/newlibctype.cxx
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ language/c/libc/i18n/current/src/newlibctype.cxx 15 Mar 2004 15:04:10 -0000
@@ -0,0 +1,229 @@
+/*===========================================================================
+//
+// newlibctype.cxx
+//
+// newlib's implementation of the ctype functions
+//
+//===========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2004 eCosCentric Ltd.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//===========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): jlarmour
+// Contributors:
+// Date: 2004-02-16
+// Purpose: Provides newlib's implementation of the ctype functions.
+// Description: Also provides a degree of binary compatibility with newlib
+// ctype functions, primarily for the benefit of libstdc++.
+// Usage:
+//
+//####DESCRIPTIONEND####
+//
+//=========================================================================*/
+
+/* CONFIGURATION */
+
+#include <pkgconf/libc_i18n.h> // Configuration header
+
+#ifdef CYGPKG_LIBC_I18N_NEWLIB_CTYPE
+
+#include <cyg/infra/cyg_type.h>
+#include <cyg/libc/i18n/newlibctype.h>
+
+#define _CONST const // just for compatibility
+
+#define _CTYPE_DATA_0_127 \
+ _C, _C, _C, _C, _C, _C, _C, _C, \
+ _C, _C|_S, _C|_S, _C|_S, _C|_S, _C|_S, _C, _C, \
+ _C, _C, _C, _C, _C, _C, _C, _C, \
+ _C, _C, _C, _C, _C, _C, _C, _C, \
+ _S|_B, _P, _P, _P, _P, _P, _P, _P, \
+ _P, _P, _P, _P, _P, _P, _P, _P, \
+ _N, _N, _N, _N, _N, _N, _N, _N, \
+ _N, _N, _P, _P, _P, _P, _P, _P, \
+ _P, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U, \
+ _U, _U, _U, _U, _U, _U, _U, _U, \
+ _U, _U, _U, _U, _U, _U, _U, _U, \
+ _U, _U, _U, _P, _P, _P, _P, _P, \
+ _P, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L, \
+ _L, _L, _L, _L, _L, _L, _L, _L, \
+ _L, _L, _L, _L, _L, _L, _L, _L, \
+ _L, _L, _L, _P, _P, _P, _P, _C
+
+#define _CTYPE_DATA_128_256 \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, 0, 0, 0
+
+_CONST char _ctype_[1 + 256] = {
+ 0,
+ _CTYPE_DATA_0_127,
+ _CTYPE_DATA_128_256
+};
+_CONST char *__ctype_ptr = _ctype_ + 1;
+
+#undef _tolower
+#undef tolower
+#undef _toupper
+#undef toupper
+
+int
+_tolower(int c)
+{
+ return isupper(c) ? (c) - 'A' + 'a' : c;
+}
+
+int
+tolower(int c)
+{
+ return isupper(c) ? (c) - 'A' + 'a' : c;
+}
+
+int
+_toupper(int c)
+{
+ return islower(c) ? c - 'a' + 'A' : c;
+}
+
+int
+toupper(int c)
+{
+ return islower(c) ? c - 'a' + 'A' : c;
+}
+
+#undef isalnum
+#undef isalpha
+#undef isascii
+#undef iscntrl
+#undef isdigit
+#undef islower
+#undef isgraph
+#undef isprint
+#undef ispunct
+#undef isspace
+#undef isupper
+#undef isxdigit
+#undef toascii
+
+int
+isalnum(int c)
+{
+ return((_ctype_ + 1)[c] & (_U|_L|_N));
+}
+
+int
+isalpha(int c)
+{
+ return((_ctype_ + 1)[c] & (_U|_L));
+}
+
+int
+isascii(int c)
+{
+ return c >= 0 && c< 128;
+}
+
+int
+iscntrl(int c)
+{
+ return((_ctype_ + 1)[c] & _C);
+}
+
+int
+isdigit(int c)
+{
+ return((_ctype_ + 1)[c] & _N);
+}
+
+int
+islower(int c)
+{
+ return((_ctype_ + 1)[c] & _L);
+}
+
+int
+isgraph(int c)
+{
+ return((_ctype_ + 1)[c] & (_P|_U|_L|_N));
+}
+
+int
+isprint(int c)
+{
+ return((_ctype_ + 1)[c] & (_P|_U|_L|_N|_B));
+}
+
+int
+ispunct(int c)
+{
+ return((_ctype_ + 1)[c] & _P);
+}
+
+int
+isspace(int c)
+{
+ return((_ctype_ + 1)[c] & _S);
+}
+
+int
+isupper(int c)
+{
+ return((_ctype_ + 1)[c] & _U);
+}
+
+int
+isxdigit(int c)
+{
+ return((_ctype_ + 1)[c] & ((_X)|(_N)));
+}
+
+int
+toascii(int c)
+{
+ return (c)&0177;
+}
+
+#endif // ifdef CYGPKG_LIBC_I18N_NEWLIB_CTYPE
+
+/* EOF newlibctype.cxx */
Index: language/c/libc/i18n/current/src/wctomb.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/i18n/current/src/wctomb.cxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 wctomb.cxx
--- language/c/libc/i18n/current/src/wctomb.cxx 23 May 2002 23:07:07 -0000 1.3
+++ language/c/libc/i18n/current/src/wctomb.cxx 15 Mar 2004 15:04:10 -0000
@@ -134,11 +134,12 @@ static int wctomb_trace = CYGNUM_LIBC_I1
// STATICS
#ifdef CYGINT_LIBC_I18N_MB_REQUIRED
# ifdef CYGSEM_LIBC_I18N_PER_THREAD_MB
-static volatile cyg_ucount32 wctomb_data_index=CYGNUM_KERNEL_THREADS_DATA_MAX;
+static volatile Cyg_Thread::cyg_data_index
+wctomb_data_index=CYGNUM_KERNEL_THREADS_DATA_MAX;
static Cyg_Mutex wctomb_data_mutex CYG_INIT_PRIORITY(LIBC);
# else
static int cyg_libc_wctomb_last;
# endif
#endif
@@ -167,15 +168,15 @@ wctomb ( char *s, const wchar_t wchar )
// rare situation
if (CYGNUM_KERNEL_THREADS_DATA_MAX==wctomb_data_index) {
wctomb_data_mutex.lock();
if (CYGNUM_KERNEL_THREADS_DATA_MAX==wctomb_data_index) {
- // the kernel just throws an assert if this doesn't work
// FIXME: Should use real CDL to pre-allocate a slot at compile
// time to ensure there are enough slots
wctomb_data_index = self->new_data_index();
+ CYG_ASSERT(wctomb_data_index >= 0, "failed to allocate data index" );
}
wctomb_data_mutex.unlock();
} // if
// we have a valid index now
Index: language/c/libc/stdio/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/ChangeLog,v
retrieving revision 1.24
diff -u -5 -p -r1.24 ChangeLog
--- language/c/libc/stdio/current/ChangeLog 3 Sep 2003 15:37:55 -0000 1.24
+++ language/c/libc/stdio/current/ChangeLog 15 Mar 2004 15:04:11 -0000
@@ -1,5 +1,59 @@
+2004-03-12 Jonathan Larmour <jifl@eCosCentric.com>
+
+ * src/input/vfscanf.cxx (vfscanf): Silence warning.
+
+ * include/stdio.h:
+ Add file operation functions which weren't here before!
+ While I'm here, add __THROW everywhere and use __externC not externC.
+
+ * cdl/stdio.cdl: We implement stdio fileops in isoinfra now.
+ Also set header for that.
+ Build fileops.cxx.
+ L_tmpnam must be at least 4.
+ TMP_MAX must be at least 1, and ISO C says it should be >=25.
+ Add description for CYGPKG_LIBC_STDIO_FILEIO and move up from
+ bottom so it goes with others.
+
+ * src/common/fileops.cxx: New file. Implements rename(), remove(),
+ tmpnam() and tmpfile().
+
+ * src/common/fclose.cxx: Add throw specifiers to match stdio.h.
+ * src/common/feof.cxx: Ditto.
+ * src/common/fflush.cxx: Ditto.
+ * src/common/fopen.cxx: Ditto.
+ * src/common/freopen.cxx: Ditto.
+ * src/common/fseek.cxx: Ditto.
+ * src/common/setvbuf.cxx: Ditto.
+ * src/common/snprintf.cxx: Ditto.
+ * src/common/sprintf.cxx: Ditto.
+ * src/common/sscanf.cxx: Ditto.
+ * src/common/stdioinlines.cxx: Ditto.
+ * src/common/ungetc.cxx: Ditto.
+ * src/common/vsnprintf.cxx: Ditto.
+ * src/common/vsscanf.cxx: Ditto.
+ * src/input/fgetc.cxx: Ditto.
+ * src/input/fgets.cxx: Ditto.
+ * src/input/fread.cxx: Ditto.
+ * src/input/fscanf.cxx: Ditto.
+ * src/input/gets.cxx: Ditto.
+ * src/input/scanf.cxx: Ditto.
+ * src/input/vfscanf.cxx: Ditto.
+ * src/output/fnprintf.cxx: Ditto.
+ * src/output/fprintf.cxx: Ditto.
+ * src/output/fputc.cxx: Ditto.
+ * src/output/fputs.cxx: Ditto.
+ * src/output/fwrite.cxx: Ditto.
+ * src/output/printf.cxx: Ditto.
+ * src/output/vfnprintf.cxx: Ditto.
+
+2004-02-17 Jonathan Larmour <jifl@eCosCentric.com>
+
+ * cdl/stdio.cdl (CYGSEM_LIBC_STDIO_THREAD_SAFE_STREAMS): Can
+ be inactive when no kernel.
+ * cdl/stdio.cdl: Implements file positioning functions in isoinfra.
+
2003-09-03 Thomas Koeller <thomas.koeller@baslerweb.com>
* cdl/stdio.cdl: only require "/dev/haldiag" if actually using it.
2003-08-12 Scott Wilkinson <scott@alliantnetworks.com>
Index: language/c/libc/stdio/current/cdl/stdio.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/cdl/stdio.cdl,v
retrieving revision 1.11
diff -u -5 -p -r1.11 stdio.cdl
--- language/c/libc/stdio/current/cdl/stdio.cdl 3 Sep 2003 15:37:56 -0000 1.11
+++ language/c/libc/stdio/current/cdl/stdio.cdl 15 Mar 2004 15:04:11 -0000
@@ -59,10 +59,12 @@ cdl_package CYGPKG_LIBC_STDIO {
parent CYGPKG_LIBC
requires CYGPKG_IO
requires CYGPKG_LIBC_I18N
implements CYGINT_ISO_STDIO_FILETYPES
implements CYGINT_ISO_STDIO_FILEACCESS
+ implements CYGINT_ISO_STDIO_FILEPOS
+ implements CYGINT_ISO_STDIO_FILEOPS
implements CYGINT_ISO_STDIO_FORMATTED_IO
implements CYGINT_ISO_STDIO_CHAR_IO
implements CYGINT_ISO_STDIO_DIRECT_IO
implements CYGINT_ISO_STDIO_ERROR
implements CYGINT_ISO_STDIO_STREAMS
@@ -70,10 +72,14 @@ cdl_package CYGPKG_LIBC_STDIO {
CYGPKG_IO_SERIAL_HALDIAG : 1) }
requires { CYGBLD_ISO_STDIO_FILETYPES_HEADER == \
"<cyg/libc/stdio/stdio.h>" }
requires { CYGBLD_ISO_STDIO_FILEACCESS_HEADER == \
"<cyg/libc/stdio/stdio.h>" }
+ requires { CYGBLD_ISO_STDIO_FILEPOS_HEADER == \
+ "<cyg/libc/stdio/stdio.h>" }
+ requires { CYGBLD_ISO_STDIO_FILEOPS_HEADER == \
+ "<cyg/libc/stdio/stdio.h>" }
requires { CYGBLD_ISO_STDIO_FORMATTED_IO_HEADER == \
"<cyg/libc/stdio/stdio.h>" }
requires { CYGBLD_ISO_STDIO_CHAR_IO_HEADER == \
"<cyg/libc/stdio/stdio.h>" }
requires { CYGBLD_ISO_STDIO_DIRECT_IO_HEADER == \
@@ -100,11 +106,11 @@ cdl_package CYGPKG_LIBC_STDIO {
common/stdin.cxx common/stdiofiles.cxx \
common/fseek.cxx common/stdioinlines.cxx\
common/stdiosupp.cxx common/stdout.cxx \
common/stream.cxx common/streambuf.cxx \
common/ungetc.cxx common/vsnprintf.cxx \
- common/vsscanf.cxx \
+ common/vsscanf.cxx common/fileops.cxx \
\
input/fgetc.cxx input/fgets.cxx \
input/fread.cxx input/fscanf.cxx \
input/gets.cxx input/scanf.cxx \
input/vfscanf.cxx \
@@ -154,11 +160,11 @@ cdl_package CYGPKG_LIBC_STDIO {
}
cdl_option L_tmpnam {
display "Maximum length of filenames for temporary files"
flavor data
- legal_values 1 to 0x7fffffff
+ legal_values 4 to 0x7fffffff
default_value 16
description "
This option defines the maximum allowed size of
filenames for temporary files as generated by
tmpnam(). It is measured in characters, and the
@@ -167,17 +173,19 @@ cdl_package CYGPKG_LIBC_STDIO {
}
cdl_option TMP_MAX {
display "Unique file names generated by tmpnam()"
flavor data
- legal_values 0 to 0x7fffffff
- default_value 0
+ legal_values 1 to 0x7fffffff
+ default_value 25
description "
This option defines the minimum number of
unique file names generated by tmpnam(). The
ISO C standard requires it to be defined (para
- 7.9.1)."
+ 7.9.1) and for ISO compliance it should be at least
+ 25. Note that TMP_MAX names may not be generated
+ if L_tmpnam is too small."
}
cdl_component CYGSEM_LIBC_STDIO_WANT_BUFFERED_IO {
display "Buffered I/O"
flavor bool
@@ -342,22 +350,37 @@ cdl_package CYGPKG_LIBC_STDIO {
}
cdl_option CYGSEM_LIBC_STDIO_THREAD_SAFE_STREAMS {
display "Thread safe I/O streams"
doc ref/libc-thread-safety.html
- requires CYGPKG_KERNEL
- default_value { 0 != CYGPKG_KERNEL }
+ active_if CYGPKG_KERNEL
+ default_value 1
description "
This option controls whether standard I/O streams
are thread-safe. Having this option set allows
the streams to be locked when accessed by
multiple threads simultaneously."
}
# ====================================================================
+ cdl_option CYGPKG_LIBC_STDIO_FILEIO {
+ display "Enable use of FILEIO package for IO operations."
+ active_if CYGPKG_IO_FILEIO
+ requires CYGSEM_LIBC_STDIO_WANT_BUFFERED_IO
+ calculated 1
+ description "
+ This CDL exists to control how the standard I/O functions
+ interface to the underlying I/O system. Either using the
+ File I/O package, or the generic I/O package which is used
+ by fewer devices."
+ }
+}
+
+# ====================================================================
+
cdl_component CYGPKG_LIBC_STDIO_OPTIONS {
display "C library stdio functions build options"
flavor none
no_define
description "
@@ -399,18 +422,8 @@ cdl_package CYGPKG_LIBC_STDIO {
description "
This option specifies the set of tests for the C library
stdio functions."
}
}
-
-# ====================================================================
-
- cdl_option CYGPKG_LIBC_STDIO_FILEIO {
- display "Enable use of FILEIO package for IO operations."
- active_if CYGPKG_IO_FILEIO
- requires CYGSEM_LIBC_STDIO_WANT_BUFFERED_IO
- calculated 1
- }
-}
# ====================================================================
# EOF stdio.cdl
Index: language/c/libc/stdio/current/include/stdio.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/include/stdio.h,v
retrieving revision 1.5
diff -u -5 -p -r1.5 stdio.h
--- language/c/libc/stdio/current/include/stdio.h 29 May 2002 18:28:28 -0000 1.5
+++ language/c/libc/stdio/current/include/stdio.h 15 Mar 2004 15:04:11 -0000
@@ -117,186 +117,202 @@ __externC FILE *stdin, *stdout, *stderr;
// FUNCTION PROTOTYPES
//========================================================================
-// ISO C 7.9.5 File access functions
+// ISO C89 7.9.4 Functions for operations on files
-externC int
-fclose( FILE * /* stream */ );
+__externC int
+remove( const char * /* pathname */ ) __THROW;
-externC int
-fflush( FILE * /* stream */ );
+__externC int
+rename( const char * /* oldpath */, const char * /* newpath */ ) __THROW;
-externC FILE *
-fopen( const char * /* filename */, const char * /* mode */ );
+__externC FILE *
+tmpfile( void ) __THROW;
-externC FILE *
+__externC char *
+tmpnam(char * /* s */ ) __THROW;
+
+//========================================================================
+
+// ISO C89 7.9.5 File access functions
+
+__externC int
+fclose( FILE * /* stream */ ) __THROW;
+
+__externC int
+fflush( FILE * /* stream */ ) __THROW;
+
+__externC FILE *
+fopen( const char * /* filename */, const char * /* mode */ ) __THROW;
+
+__externC FILE *
freopen( const char * /* filename */, const char * /* mode */,
- FILE * /* stream */ );
+ FILE * /* stream */ ) __THROW;
-externC void
-setbuf( FILE * /* stream */, char * /* buffer */ );
+__externC void
+setbuf( FILE * /* stream */, char * /* buffer */ ) __THROW;
-externC int
+__externC int
setvbuf( FILE * /* stream */, char * /* buffer */, int /* mode */,
- size_t /* size */ );
+ size_t /* size */ ) __THROW;
//========================================================================
-// ISO C 7.9.6 Formatted input/output functions
+// ISO C89 7.9.6 Formatted input/output functions
-externC int
-fprintf( FILE * /* stream */, const char * /* format */, ... );
+__externC int
+fprintf( FILE * /* stream */, const char * /* format */, ... ) __THROW;
-externC int
-fscanf( FILE * /* stream */, const char * /* format */, ... );
+__externC int
+fscanf( FILE * /* stream */, const char * /* format */, ... ) __THROW;
-externC int
-printf( const char * /* format */, ... );
+__externC int
+printf( const char * /* format */, ... ) __THROW;
-externC int
-scanf( const char * /* format */, ... );
+__externC int
+scanf( const char * /* format */, ... ) __THROW;
-externC int
-sprintf( char * /* str */, const char * /* format */, ... );
+__externC int
+sprintf( char * /* str */, const char * /* format */, ... ) __THROW;
-externC int
-sscanf( const char * /* str */, const char * /* format */, ... );
+__externC int
+sscanf( const char * /* str */, const char * /* format */, ... ) __THROW;
-externC int
+__externC int
vfprintf( FILE * /* stream */, const char * /* format */,
- va_list /* args */ );
+ va_list /* args */ ) __THROW;
-externC int
-vprintf( const char * /* format */, va_list /* args */ );
+__externC int
+vprintf( const char * /* format */, va_list /* args */ ) __THROW;
-externC int
+__externC int
vsprintf( char * /* str */, const char * /* format */,
- va_list /* args */ );
+ va_list /* args */ ) __THROW;
//========================================================================
-// ISO C 7.9.7 Character input/output functions
+// ISO C89 7.9.7 Character input/output functions
-externC int
-fgetc( FILE * /* stream */ );
+__externC int
+fgetc( FILE * /* stream */ ) __THROW;
-externC char *
-fgets( char * /* str */, int /* length */, FILE * /* stream */ );
+__externC char *
+fgets( char * /* str */, int /* length */, FILE * /* stream */ ) __THROW;
-externC int
-fputc( int /* c */, FILE * /* stream */ );
+__externC int
+fputc( int /* c */, FILE * /* stream */ ) __THROW;
-externC int
-putc( int /* c */, FILE * /* stream */ );
+__externC int
+putc( int /* c */, FILE * /* stream */ ) __THROW;
-externC int
-putchar( int /* c */ );
+__externC int
+putchar( int /* c */ ) __THROW;
-externC int
-fputs( const char * /* str */, FILE * /* stream */ );
+__externC int
+fputs( const char * /* str */, FILE * /* stream */ ) __THROW;
-externC char *
-gets( char * );
+__externC char *
+gets( char * ) __THROW;
-externC int
-getc( FILE * /* stream */ );
+__externC int
+getc( FILE * /* stream */ ) __THROW;
-externC int
-getchar( void );
+__externC int
+getchar( void ) __THROW;
-externC int
-puts( const char * /* str */ );
+__externC int
+puts( const char * /* str */ ) __THROW;
-externC int
-ungetc( int /* c */, FILE * /* stream */ );
+__externC int
+ungetc( int /* c */, FILE * /* stream */ ) __THROW;
// no function equivalent is required for getchar() or putchar(), so we can
// just #define them
#define getchar() fgetc( stdin )
#define putchar(__c) fputc(__c, stdout)
//========================================================================
-// ISO C 7.9.8 Direct input/output functions
+// ISO C89 7.9.8 Direct input/output functions
-externC size_t
+__externC size_t
fread( void * /* ptr */, size_t /* object_size */,
- size_t /* num_objects */, FILE * /* stream */ );
+ size_t /* num_objects */, FILE * /* stream */ ) __THROW;
-externC size_t
+__externC size_t
fwrite( const void * /* ptr */, size_t /* object_size */,
- size_t /* num_objects */, FILE * /* stream */ );
+ size_t /* num_objects */, FILE * /* stream */ ) __THROW;
//========================================================================
-// ISO C 7.9.9 File positioning functions
+// ISO C89 7.9.9 File positioning functions
-externC int
-fgetpos( FILE * /* stream */, fpos_t * /* pos */ );
+__externC int
+fgetpos( FILE * /* stream */, fpos_t * /* pos */ ) __THROW;
-externC int
-fseek( FILE * /* stream */, long int /* offset */, int /* whence */ );
+__externC int
+fseek( FILE * /* stream */, long int /* offset */, int /* whence */ ) __THROW;
-externC int
-fsetpos( FILE * /* stream */, const fpos_t * /* pos */ );
+__externC int
+fsetpos( FILE * /* stream */, const fpos_t * /* pos */ ) __THROW;
-externC long int
-ftell( FILE * /* stream */ );
+__externC long int
+ftell( FILE * /* stream */ ) __THROW;
-externC void
-rewind( FILE * /* stream */ );
+__externC void
+rewind( FILE * /* stream */ ) __THROW;
//========================================================================
-// ISO C 7.9.10 Error-handling functions
+// ISO C89 7.9.10 Error-handling functions
-externC void
-clearerr( FILE * /* stream */ );
+__externC void
+clearerr( FILE * /* stream */ ) __THROW;
-externC int
-feof( FILE * /* stream */ );
+__externC int
+feof( FILE * /* stream */ ) __THROW;
-externC int
-ferror( FILE * /* stream */ );
+__externC int
+ferror( FILE * /* stream */ ) __THROW;
-externC void
-perror( const char * /* prefix_str */ );
+__externC void
+perror( const char * /* prefix_str */ ) __THROW;
//========================================================================
// Other non-ISO C functions
-externC int
+__externC int
fnprintf( FILE * /* stream */, size_t /* length */,
- const char * /* format */, ... ) CYGBLD_ATTRIB_PRINTF_FORMAT(3, 4);
+ const char * /* format */, ... ) __THROW CYGBLD_ATTRIB_PRINTF_FORMAT(3, 4);
-externC int
+__externC int
snprintf( char * /* str */, size_t /* length */, const char * /* format */,
- ... ) CYGBLD_ATTRIB_PRINTF_FORMAT(3, 4);
+ ... ) __THROW CYGBLD_ATTRIB_PRINTF_FORMAT(3, 4);
-externC int
+__externC int
vfnprintf( FILE * /* stream */, size_t /* length */,
- const char * /* format */, va_list /* args */ );
+ const char * /* format */, va_list /* args */ ) __THROW;
-externC int
+__externC int
vsnprintf( char * /* str */, size_t /* length */,
- const char * /* format */, va_list /* args */ );
+ const char * /* format */, va_list /* args */ ) __THROW;
-externC int
-vscanf( const char * /* format */, va_list /* args */ );
+__externC int
+vscanf( const char * /* format */, va_list /* args */ ) __THROW;
-externC int
+__externC int
vsscanf( const char * /* str */, const char * /* format */,
- va_list /* args */ );
+ va_list /* args */ ) __THROW;
-externC int
+__externC int
vfscanf( FILE * /* stream */, const char * /* format */,
- va_list /* args */ );
+ va_list /* args */ ) __THROW;
// INLINE FUNCTIONS
#ifdef CYGIMP_LIBC_STDIO_INLINES
Index: language/c/libc/stdio/current/include/stdio.inl
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/include/stdio.inl,v
retrieving revision 1.4
diff -u -5 -p -r1.4 stdio.inl
--- language/c/libc/stdio/current/include/stdio.inl 15 Feb 2003 16:57:04 -0000 1.4
+++ language/c/libc/stdio/current/include/stdio.inl 15 Mar 2004 15:04:11 -0000
@@ -72,11 +72,11 @@
//===========================================================================
// 7.9.5 File access functions
extern __inline__ void
-setbuf( FILE *stream, char *buf )
+setbuf( FILE *stream, char *buf ) __THROW
{
if (buf == NULL)
setvbuf( stream, NULL, _IONBF, 0 );
else
// NB: Should use full buffering by default ordinarily, but in
@@ -89,36 +89,36 @@ setbuf( FILE *stream, char *buf )
//===========================================================================
// 7.9.6 Formatted input/output functions
extern __inline__ int
-vfprintf( FILE *stream, const char *format, va_list arg )
+vfprintf( FILE *stream, const char *format, va_list arg ) __THROW
{
return vfnprintf(stream, INT_MAX, format, arg);
} // vfprintf()
extern __inline__ int
-vprintf( const char *format, va_list arg )
+vprintf( const char *format, va_list arg ) __THROW
{
return vfnprintf(stdout, INT_MAX, format, arg);
} // vprintf()
extern __inline__ int
-vsprintf( char *s, const char *format, va_list arg )
+vsprintf( char *s, const char *format, va_list arg ) __THROW
{
return vsnprintf(s, INT_MAX, format, arg);
} // vsprintf()
//===========================================================================
// 7.9.7 Character input/output functions
extern __inline__ int
-puts( const char *s )
+puts( const char *s ) __THROW
{
int rc;
rc = fputs( s, stdout );
@@ -132,11 +132,11 @@ puts( const char *s )
//===========================================================================
// 7.9.10 Error-handling functions
extern __inline__ void
-perror( const char *s )
+perror( const char *s ) __THROW
{
if (s && *s)
fprintf( stderr, "%s: %s\n", s, strerror(errno) );
else
fputs( strerror(errno), stderr );
@@ -146,11 +146,11 @@ perror( const char *s )
//===========================================================================
// Other non-ANSI functions
extern __inline__ int
-vscanf( const char *format, va_list arg )
+vscanf( const char *format, va_list arg ) __THROW
{
return vfscanf( stdin, format, arg );
} // vscanf()
Index: language/c/libc/stdio/current/include/stream.hxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/include/stream.hxx,v
retrieving revision 1.5
diff -u -5 -p -r1.5 stream.hxx
--- language/c/libc/stdio/current/include/stream.hxx 23 May 2002 23:07:14 -0000 1.5
+++ language/c/libc/stdio/current/include/stream.hxx 15 Mar 2004 15:04:11 -0000
@@ -77,11 +77,11 @@ class Cyg_StdioStream;
__externC Cyg_ErrNo
cyg_libc_stdio_flush_all_but( Cyg_StdioStream * );
class Cyg_StdioStream
{
- friend int setvbuf( FILE *, char *, int, size_t );
+ friend int setvbuf( FILE *, char *, int, size_t ) __THROW;
friend Cyg_ErrNo
cyg_libc_stdio_flush_all_but( Cyg_StdioStream * );
private:
Index: language/c/libc/stdio/current/src/common/fclose.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/common/fclose.cxx,v
retrieving revision 1.4
diff -u -5 -p -r1.4 fclose.cxx
--- language/c/libc/stdio/current/src/common/fclose.cxx 18 Aug 2003 19:45:33 -0000 1.4
+++ language/c/libc/stdio/current/src/common/fclose.cxx 15 Mar 2004 15:04:11 -0000
@@ -73,11 +73,11 @@
// FUNCTIONS
externC int
-fclose( FILE *stream )
+fclose( FILE *stream ) __THROW
{
Cyg_StdioStream *real_stream = (Cyg_StdioStream *)stream;
int i;
Cyg_ErrNo err;
Index: language/c/libc/stdio/current/src/common/feof.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/common/feof.cxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 feof.cxx
--- language/c/libc/stdio/current/src/common/feof.cxx 23 May 2002 23:07:16 -0000 1.3
+++ language/c/libc/stdio/current/src/common/feof.cxx 15 Mar 2004 15:04:11 -0000
@@ -61,27 +61,27 @@
#include <cyg/infra/cyg_type.h> // Common type definitions and support
#include <stdio.h> // Header for this file
#include <cyg/libc/stdio/stream.hxx> // Cyg_StdioStream class
externC int
-feof( FILE *stream )
+feof( FILE *stream ) __THROW
{
Cyg_StdioStream *real_stream = (Cyg_StdioStream *)stream;
return (real_stream->get_eof_state() != 0);
} // feof()
externC int
-ferror( FILE *stream )
+ferror( FILE *stream ) __THROW
{
Cyg_StdioStream *real_stream = (Cyg_StdioStream *)stream;
return (real_stream->get_error() != 0);
} // ferror()
externC void
-clearerr( FILE *stream )
+clearerr( FILE *stream ) __THROW
{
Cyg_StdioStream *real_stream = (Cyg_StdioStream *)stream;
real_stream->set_error(0);
real_stream->set_eof_state(false);
Index: language/c/libc/stdio/current/src/common/fflush.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/common/fflush.cxx,v
retrieving revision 1.6
diff -u -5 -p -r1.6 fflush.cxx
--- language/c/libc/stdio/current/src/common/fflush.cxx 23 May 2002 23:07:16 -0000 1.6
+++ language/c/libc/stdio/current/src/common/fflush.cxx 15 Mar 2004 15:04:11 -0000
@@ -125,11 +125,11 @@ cyg_libc_stdio_flush_all_but( Cyg_StdioS
return err;
} // cyg_libc_stdio_flush_all_but()
externC int
-fflush( FILE *stream )
+fflush( FILE *stream ) __THROW
{
Cyg_StdioStream *real_stream = (Cyg_StdioStream *)stream;
Cyg_ErrNo err;
if (stream == NULL) { // tells us to flush ALL streams
Index: language/c/libc/stdio/current/src/common/fileops.cxx
===================================================================
RCS file: language/c/libc/stdio/current/src/common/fileops.cxx
diff -N language/c/libc/stdio/current/src/common/fileops.cxx
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ language/c/libc/stdio/current/src/common/fileops.cxx 15 Mar 2004 15:04:11 -0000
@@ -0,0 +1,250 @@
+/*========================================================================
+//
+// fileops.cxx
+//
+// Implementation of ISO C rename(),remove(),tmpnam(),tmpfile() functions
+//
+//========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2004 eCosCentric Ltd.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): jlarmour
+// Contributors:
+// Date: 2004-02-30
+// Purpose: Implementation of ISO C rename(),remove(),tmpnam(),tmpfile()
+// Description:
+// Usage:
+//
+//####DESCRIPTIONEND####
+//======================================================================*/
+
+// CONFIGURATION
+
+#include <pkgconf/system.h>
+#include <pkgconf/isoinfra.h>
+#include <pkgconf/libc_stdio.h> // Configuration header
+
+// INCLUDES
+
+#include <cyg/infra/cyg_type.h> // Common type definitions and support
+#include <cyg/infra/cyg_ass.h> // Common assertion functions
+#include <cyg/infra/cyg_trac.h> // Common tracing functions
+#include <stdio.h> // Header for this file
+#include <errno.h> // errno
+#ifdef CYGPKG_LIBC_STDIO_FILEIO // unix-y functions, e.g. stat,rmdir,unlink,...
+# include <unistd.h>
+# include <fcntl.h>
+# include <sys/stat.h>
+#endif
+#include <cyg/libc/stdio/io.hxx> // I/O definitions
+#ifdef CYGPKG_POSIX
+# include <pkgconf/posix.h>
+# include <cyg/posix/export.h>
+#endif
+
+#if defined(CYGINT_ISO_EXIT) && (CYGINT_ISO_EXIT+0)
+# include <stdlib.h> // used by tmpfile() for atexit()
+#endif
+
+// DEFINES
+
+#ifdef CYGPKG_POSIX
+# define CYG_STDIO_FUNCTION_START() CYG_POSIX_FUNCTION_START()
+# define CYG_STDIO_FUNCTION_FINISH() CYG_POSIX_FUNCTION_FINISH()
+#else
+# define CYG_STDIO_FUNCTION_START() CYG_EMPTY_STATEMENT
+# define CYG_STDIO_FUNCTION_FINISH() CYG_EMPTY_STATEMENT
+#endif
+
+// Handle entry
+#define STDIO_ENTRY() \
+ CYG_REPORT_FUNCTYPE( "returning %d" ); \
+ CYG_STDIO_FUNCTION_START(); \
+
+#define STDIO_RETURN(err) \
+CYG_MACRO_START \
+ int __retval = 0; \
+ CYG_STDIO_FUNCTION_FINISH(); \
+ if( err != 0 ) __retval = -1, errno = err; \
+ CYG_REPORT_RETVAL( __retval ); \
+ return __retval; \
+CYG_MACRO_END
+
+#define STDIO_RETURN_VALUE(val) \
+CYG_MACRO_START \
+ CYG_STDIO_FUNCTION_FINISH(); \
+ CYG_REPORT_RETVAL( val ); \
+ return val; \
+CYG_MACRO_END
+
+// FUNCTIONS
+
+///////////////////////////////////////////////////////////////////////////
+// remove()
+
+__externC int remove( const char *path ) __THROW
+{
+ int ret;
+ STDIO_ENTRY();
+ CYG_CHECK_DATA_PTR( path, "path pointer invalid" );
+
+#ifdef CYGPKG_LIBC_STDIO_FILEIO
+ struct stat sbuf;
+ ret = stat( path, &sbuf );
+
+ if (0 == ret)
+ {
+ if ( S_ISDIR(sbuf.st_mode) )
+ {
+ ret = rmdir( path );
+ } else {
+ ret = unlink( path );
+ }
+ }
+#else // !defined(CYGPKG_LIBC_STDIO_FILEIO)
+ ret = ENOSYS;
+#endif
+ STDIO_RETURN(ret);
+} // remove()
+
+///////////////////////////////////////////////////////////////////////////
+// rename()
+//
+// The File I/O package supplies its own complete version of this, so we
+// only implement a dummy here.
+
+#ifndef CYGPKG_LIBC_STDIO_FILEIO
+__externC int rename( const char *oldname, const char *newname ) __THROW
+{
+ STDIO_ENTRY();
+ CYG_CHECK_DATA_PTR(oldname, "oldname pointer invalid");
+ CYG_CHECK_DATA_PTR(newname, "newname pointer invalid");
+ STDIO_RETURN(ENOSYS);
+}
+#endif // ifndef CYGPKG_LIBC_STDIO_FILEIO
+
+///////////////////////////////////////////////////////////////////////////
+// tmpnam()
+
+__externC char *tmpnam( char *s ) __THROW
+{
+ STDIO_ENTRY();
+ static char staticbuf[ L_tmpnam ];
+#if (TMP_MAX < 256)
+ typedef cyg_uint8 counttype;
+#elif (TMP_MAX < 65536)
+ typedef cyg_uint16 counttype;
+#else
+ typedef cyg_ucount32 counttype;
+#endif
+ static counttype count;
+ counttype totaliters=0;
+ int i;
+
+ if ( NULL != s )
+ CYG_CHECK_DATA_PTR( s, "supplied string pointer invalid" );
+ else
+ s = staticbuf;
+
+ // start off by making it "tmp00000" etc. so we can fill backwards
+ // from end without spaces
+ s[0] = 't'; s[1] = 'm'; s[2] = 'p';
+
+ while (totaliters < TMP_MAX)
+ {
+ for (i=3; i < (L_tmpnam-1); i++)
+ {
+ s[i] = '0';
+ }
+ s[i] = '\0';
+
+ counttype counttmp = count;
+ for (i=(L_tmpnam-1); i>2; i--)
+ {
+ const char tohex[] = "0123456789abcdef";
+ s[i] = tohex[counttmp & 0xf];
+ counttmp = counttmp >> 4;
+ }
+ count++;
+ count %= TMP_MAX; // cycle round
+ totaliters++;
+
+ // s now points to a name candidate
+#ifdef CYGPKG_LIBC_STDIO_FILEIO
+ int fd = open( s, O_RDONLY );
+ close(fd);
+ if (fd < 0 && ENOENT == errno) // we have a winner
+ break;
+#else
+ break; // no real filesystem, so just go with what we've come up with
+#endif
+ }
+
+ if ( totaliters == TMP_MAX ) // oops, looped right the way round
+ s = NULL;
+
+ STDIO_RETURN_VALUE( s );
+} // tmpnam()
+
+///////////////////////////////////////////////////////////////////////////
+// tmpfile()
+
+__externC FILE *tmpfile( void ) __THROW
+{
+ FILE *f;
+ char fname[L_tmpnam];
+ char *s;
+
+ STDIO_ENTRY();
+
+ s = tmpnam( fname );
+ if ( s == NULL)
+ f = NULL;
+ else
+ {
+ // fname is now a valid name to use
+ f = fopen( fname, "wb+" );
+#ifdef CYGPKG_LIBC_STDIO_FILEIO
+ // We can use remove which should mean the file is removed on program
+ // exit.We ignore the return code though - the standard seems to
+ // indicate that the return status from this function is solely
+ // dictated by whether the file could be created.
+ if (f)
+ remove( fname );
+#endif
+ }
+
+ STDIO_RETURN_VALUE( f );
+} // tmpfile()
+
+///////////////////////////////////////////////////////////////////////////
+// EOF fileops.cxx
Index: language/c/libc/stdio/current/src/common/fopen.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/common/fopen.cxx,v
retrieving revision 1.5
diff -u -5 -p -r1.5 fopen.cxx
--- language/c/libc/stdio/current/src/common/fopen.cxx 18 Aug 2003 19:45:33 -0000 1.5
+++ language/c/libc/stdio/current/src/common/fopen.cxx 15 Mar 2004 15:04:11 -0000
@@ -200,11 +200,11 @@ static FILE *fopen_inner( cyg_stdio_hand
return (FILE *)(curr_stream);
} // fopen_inner()
externC FILE *
-fopen( const char *filename, const char *mode )
+fopen( const char *filename, const char *mode ) __THROW
{
cyg_stdio_handle_t dev;
Cyg_ErrNo err;
Cyg_StdioStream::OpenMode open_mode;
cyg_bool binary, append;
@@ -230,18 +230,18 @@ fopen( const char *filename, const char
#endif // defined(CYGPKG_LIBC_STDIO_OPEN)
#ifdef CYGPKG_LIBC_STDIO_FILEIO
-externC int fileno( FILE *stream )
+externC int fileno( FILE *stream ) __THROW
{
Cyg_StdioStream *real_stream = (Cyg_StdioStream *)stream;
return real_stream->get_dev();
}
-externC FILE *fdopen( int fd, const char *mode )
+externC FILE *fdopen( int fd, const char *mode ) __THROW
{
Cyg_StdioStream::OpenMode open_mode;
cyg_bool binary, append;
FILE *f;
Index: language/c/libc/stdio/current/src/common/freopen.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/common/freopen.cxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 freopen.cxx
--- language/c/libc/stdio/current/src/common/freopen.cxx 23 May 2002 23:07:17 -0000 1.3
+++ language/c/libc/stdio/current/src/common/freopen.cxx 15 Mar 2004 15:04:11 -0000
@@ -67,11 +67,11 @@
// FUNCTIONS
externC FILE *
-freopen( const char *, const char *, FILE * )
+freopen( const char *, const char *, FILE * ) __THROW
{
return NULL; // Returning NULL is valid! FIXME
} // freopen()
#endif // defined(CYGPKG_LIBC_STDIO_OPEN)
Index: language/c/libc/stdio/current/src/common/fseek.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/common/fseek.cxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 fseek.cxx
--- language/c/libc/stdio/current/src/common/fseek.cxx 23 May 2002 23:07:17 -0000 1.3
+++ language/c/libc/stdio/current/src/common/fseek.cxx 15 Mar 2004 15:04:11 -0000
@@ -67,11 +67,11 @@
//========================================================================
// ISO C 7.9.9 File positioning functions
externC int
-fgetpos( FILE * stream , fpos_t *pos )
+fgetpos( FILE * stream , fpos_t *pos ) __THROW
{
Cyg_StdioStream *real_stream = (Cyg_StdioStream *)stream;
Cyg_ErrNo err;
int ret = 0;
@@ -88,11 +88,11 @@ fgetpos( FILE * stream , fpos_t *pos )
CYG_REPORT_RETVAL( ret );
return ret;
}
externC int
-fseek( FILE * stream , long int offset , int whence )
+fseek( FILE * stream , long int offset , int whence ) __THROW
{
Cyg_StdioStream *real_stream = (Cyg_StdioStream *)stream;
Cyg_ErrNo err;
int ret = 0;
@@ -109,11 +109,11 @@ fseek( FILE * stream , long int offset ,
CYG_REPORT_RETVAL( ret );
return ret;
}
externC int
-fsetpos( FILE * stream , const fpos_t * pos )
+fsetpos( FILE * stream , const fpos_t * pos ) __THROW
{
Cyg_StdioStream *real_stream = (Cyg_StdioStream *)stream;
Cyg_ErrNo err;
int ret = 0;
@@ -130,11 +130,11 @@ fsetpos( FILE * stream , const fpos_t *
CYG_REPORT_RETVAL( ret );
return ret;
}
externC long int
-ftell( FILE * stream )
+ftell( FILE * stream ) __THROW
{
Cyg_StdioStream *real_stream = (Cyg_StdioStream *)stream;
Cyg_ErrNo err;
long int ret = 0;
fpos_t pos;
@@ -153,11 +153,11 @@ ftell( FILE * stream )
CYG_REPORT_RETVAL( ret );
return ret;
}
externC void
-rewind( FILE * stream )
+rewind( FILE * stream ) __THROW
{
Cyg_StdioStream *real_stream = (Cyg_StdioStream *)stream;
(void)fseek( stream, 0L, SEEK_SET );
real_stream->set_error( ENOERR );
Index: language/c/libc/stdio/current/src/common/setvbuf.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/common/setvbuf.cxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 setvbuf.cxx
--- language/c/libc/stdio/current/src/common/setvbuf.cxx 23 May 2002 23:07:17 -0000 1.3
+++ language/c/libc/stdio/current/src/common/setvbuf.cxx 15 Mar 2004 15:04:11 -0000
@@ -66,11 +66,11 @@
// FUNCTIONS
externC int
-setvbuf( FILE *stream, char *buf, int mode, size_t size )
+setvbuf( FILE *stream, char *buf, int mode, size_t size ) __THROW
{
#ifdef CYGSEM_LIBC_STDIO_WANT_BUFFERED_IO
Cyg_StdioStream *real_stream = (Cyg_StdioStream *)stream;
Cyg_ErrNo err;
Index: language/c/libc/stdio/current/src/common/snprintf.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/common/snprintf.cxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 snprintf.cxx
--- language/c/libc/stdio/current/src/common/snprintf.cxx 23 May 2002 23:07:17 -0000 1.3
+++ language/c/libc/stdio/current/src/common/snprintf.cxx 15 Mar 2004 15:04:11 -0000
@@ -62,11 +62,11 @@
#include <stdio.h> // header for this file
// FUNCTIONS
externC int
-snprintf( char *s, size_t size, const char *format, ... )
+snprintf( char *s, size_t size, const char *format, ... ) __THROW
{
int rc; // return code
va_list ap; // for variable args
va_start(ap, format); // init specifying last non-var arg
Index: language/c/libc/stdio/current/src/common/sprintf.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/common/sprintf.cxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 sprintf.cxx
--- language/c/libc/stdio/current/src/common/sprintf.cxx 23 May 2002 23:07:17 -0000 1.3
+++ language/c/libc/stdio/current/src/common/sprintf.cxx 15 Mar 2004 15:04:11 -0000
@@ -63,11 +63,11 @@
#include <limits.h> // INT_MAX
// FUNCTIONS
externC int
-sprintf( char *s, const char *format, ... )
+sprintf( char *s, const char *format, ... ) __THROW
{
int rc; // return code
va_list ap; // for variable args
va_start(ap, format); // init specifying last non-var arg
Index: language/c/libc/stdio/current/src/common/sscanf.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/common/sscanf.cxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 sscanf.cxx
--- language/c/libc/stdio/current/src/common/sscanf.cxx 23 May 2002 23:07:17 -0000 1.3
+++ language/c/libc/stdio/current/src/common/sscanf.cxx 15 Mar 2004 15:04:11 -0000
@@ -62,11 +62,11 @@
#include <stdio.h> // header for this file
// FUNCTIONS
externC int
-sscanf( const char *s, const char *format, ... )
+sscanf( const char *s, const char *format, ... ) __THROW
{
int rc; // return code
va_list ap; // for variable args
va_start(ap, format); // init specifying last non-var arg
Index: language/c/libc/stdio/current/src/common/stdioinlines.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/common/stdioinlines.cxx,v
retrieving revision 1.4
diff -u -5 -p -r1.4 stdioinlines.cxx
--- language/c/libc/stdio/current/src/common/stdioinlines.cxx 15 Feb 2003 16:57:04 -0000 1.4
+++ language/c/libc/stdio/current/src/common/stdioinlines.cxx 15 Mar 2004 15:04:12 -0000
@@ -77,11 +77,11 @@
//===========================================================================
// 7.9.5 File access functions
externC void
-setbuf( FILE *stream, char *buf )
+setbuf( FILE *stream, char *buf ) __THROW
{
if (buf == NULL)
setvbuf( stream, NULL, _IONBF, 0 );
else
// NB: Should use full buffering by default ordinarily, but in
@@ -95,36 +95,36 @@ setbuf( FILE *stream, char *buf )
// 7.9.6 Formatted input/output functions
externC int
-vfprintf( FILE *stream, const char *format, va_list arg )
+vfprintf( FILE *stream, const char *format, va_list arg ) __THROW
{
return vfnprintf(stream, INT_MAX, format, arg);
} // vfprintf()
externC int
-vprintf( const char *format, va_list arg)
+vprintf( const char *format, va_list arg) __THROW
{
return vfnprintf( stdout, INT_MAX, format, arg );
} // vprintf()
externC int
-vsprintf( char *s, const char *format, va_list arg )
+vsprintf( char *s, const char *format, va_list arg ) __THROW
{
return vsnprintf(s, INT_MAX, format, arg);
} // vsprintf()
//===========================================================================
// 7.9.7 Character input/output functions
externC int
-puts( const char *s )
+puts( const char *s ) __THROW
{
int rc;
rc = fputs( s, stdout );
@@ -138,11 +138,11 @@ puts( const char *s )
//===========================================================================
// 7.9.10 Error-handling functions
externC void
-perror( const char *s )
+perror( const char *s ) __THROW
{
if (s && *s)
fprintf( stderr, "%s: %s\n", s, strerror(errno) );
else
fputs( strerror(errno), stderr );
@@ -153,11 +153,11 @@ perror( const char *s )
// Other non-ANSI functions
#ifdef CYGFUN_LIBC_STDIO_ungetc
externC int
-vscanf( const char *format, va_list arg )
+vscanf( const char *format, va_list arg ) __THROW
{
return vfscanf( stdin, format, arg );
} // vscanf()
#endif
Index: language/c/libc/stdio/current/src/common/ungetc.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/common/ungetc.cxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 ungetc.cxx
--- language/c/libc/stdio/current/src/common/ungetc.cxx 23 May 2002 23:07:18 -0000 1.3
+++ language/c/libc/stdio/current/src/common/ungetc.cxx 15 Mar 2004 15:04:12 -0000
@@ -65,11 +65,11 @@
// FUNCTIONS
externC int
-ungetc( int c, FILE *stream )
+ungetc( int c, FILE *stream ) __THROW
{
Cyg_StdioStream *real_stream = (Cyg_StdioStream *)stream;
Cyg_ErrNo err;
cyg_uint8 real_c;
Index: language/c/libc/stdio/current/src/common/vsnprintf.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/common/vsnprintf.cxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 vsnprintf.cxx
--- language/c/libc/stdio/current/src/common/vsnprintf.cxx 23 May 2002 23:07:18 -0000 1.3
+++ language/c/libc/stdio/current/src/common/vsnprintf.cxx 15 Mar 2004 15:04:12 -0000
@@ -100,11 +100,11 @@ static DEVIO_TABLE(devio_table,
NULL, // select
NULL, // get_config
NULL); // set_config
externC int
-vsnprintf( char *s, size_t size, const char *format, va_list arg )
+vsnprintf( char *s, size_t size, const char *format, va_list arg ) __THROW
{
int rc;
// construct a fake device with the address of the string we've
// been passed as its private data. This way we can use the data
// directly
@@ -129,11 +129,11 @@ vsnprintf( char *s, size_t size, const c
} // vsnprintf()
#else
externC int
-vsnprintf( char *s, size_t size, const char *format, va_list arg )
+vsnprintf( char *s, size_t size, const char *format, va_list arg ) __THROW
{
int rc;
Cyg_StdioStream my_stream( Cyg_StdioStream::CYG_STREAM_WRITE,
size, (cyg_uint8 *)s );
Index: language/c/libc/stdio/current/src/common/vsscanf.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/common/vsscanf.cxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 vsscanf.cxx
--- language/c/libc/stdio/current/src/common/vsscanf.cxx 23 May 2002 23:07:18 -0000 1.3
+++ language/c/libc/stdio/current/src/common/vsscanf.cxx 15 Mar 2004 15:04:12 -0000
@@ -117,11 +117,11 @@ static DEVIO_TABLE(devio_table,
NULL, // get_config
NULL); // set_config
externC int
-vsscanf( const char *s, const char *format, va_list arg )
+vsscanf( const char *s, const char *format, va_list arg ) __THROW
{
// construct a fake device with the address of the string we've
// been passed as its private data. This way we can use the data
// directly
DEVTAB_ENTRY_NO_INIT(strdev,
@@ -139,11 +139,11 @@ vsscanf( const char *s, const char *form
} // vsscanf()
#else
externC int
-vsscanf( const char *s, const char *format, va_list arg )
+vsscanf( const char *s, const char *format, va_list arg ) __THROW
{
Cyg_StdioStream my_stream( Cyg_StdioStream::CYG_STREAM_READ,
strlen(s), (cyg_uint8 *)s );
return vfscanf( (FILE *)&my_stream, format, arg );
Index: language/c/libc/stdio/current/src/input/fgetc.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/input/fgetc.cxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 fgetc.cxx
--- language/c/libc/stdio/current/src/input/fgetc.cxx 23 May 2002 23:07:18 -0000 1.3
+++ language/c/libc/stdio/current/src/input/fgetc.cxx 15 Mar 2004 15:04:12 -0000
@@ -67,11 +67,11 @@
#include <cyg/libc/stdio/stream.hxx>// Cyg_StdioStream
// FUNCTIONS
externC int
-fgetc( FILE *stream )
+fgetc( FILE *stream ) __THROW
{
Cyg_StdioStream *real_stream = (Cyg_StdioStream *)stream;
cyg_ucount32 bytes_read;
Cyg_ErrNo err;
cyg_uint8 c;
@@ -111,11 +111,11 @@ fgetc( FILE *stream )
// Also define getc() even though it can be a macro.
// Undefine it first though
#undef getchar
externC int
-getchar( void )
+getchar( void ) __THROW
{
return fgetc( stdin );
} // getchar()
@@ -124,8 +124,8 @@ getchar( void )
// Also define getc() even though it can be a macro.
// Undefine it first though
#undef getc
externC int
-getc( FILE * ) CYGBLD_ATTRIB_WEAK_ALIAS(fgetc);
+getc( FILE * ) __THROW CYGBLD_ATTRIB_WEAK_ALIAS(fgetc);
// EOF fgetc.cxx
Index: language/c/libc/stdio/current/src/input/fgets.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/input/fgets.cxx,v
retrieving revision 1.4
diff -u -5 -p -r1.4 fgets.cxx
--- language/c/libc/stdio/current/src/input/fgets.cxx 23 May 2002 23:07:18 -0000 1.4
+++ language/c/libc/stdio/current/src/input/fgets.cxx 15 Mar 2004 15:04:12 -0000
@@ -69,11 +69,11 @@
// FIXME: should be reworked to read buffer at a time, and scan that
// for newlines, rather than reading byte at a time.
externC char *
-fgets( char *s, int n, FILE *stream )
+fgets( char *s, int n, FILE *stream ) __THROW
{
Cyg_StdioStream *real_stream = (Cyg_StdioStream *)stream;
Cyg_ErrNo err=ENOERR;
cyg_uint8 c;
cyg_uint8 *str=(cyg_uint8 *)s;
Index: language/c/libc/stdio/current/src/input/fread.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/input/fread.cxx,v
retrieving revision 1.5
diff -u -5 -p -r1.5 fread.cxx
--- language/c/libc/stdio/current/src/input/fread.cxx 6 Mar 2003 20:57:26 -0000 1.5
+++ language/c/libc/stdio/current/src/input/fread.cxx 15 Mar 2004 15:04:12 -0000
@@ -66,11 +66,11 @@
#include <cyg/libc/stdio/stream.hxx>// Cyg_StdioStream
// FUNCTIONS
externC size_t
-fread( void *ptr, size_t object_size, size_t num_objects, FILE *stream )
+fread( void *ptr, size_t object_size, size_t num_objects, FILE *stream ) __THROW
{
Cyg_StdioStream *real_stream = (Cyg_StdioStream *)stream;
cyg_ucount32 bytes_read;
cyg_ucount32 bytes_to_read;
cyg_ucount32 total_read;
Index: language/c/libc/stdio/current/src/input/fscanf.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/input/fscanf.cxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 fscanf.cxx
--- language/c/libc/stdio/current/src/input/fscanf.cxx 23 May 2002 23:07:18 -0000 1.3
+++ language/c/libc/stdio/current/src/input/fscanf.cxx 15 Mar 2004 15:04:12 -0000
@@ -63,11 +63,11 @@
#include <limits.h> // INT_MAX
// FUNCTIONS
externC int
-fscanf( FILE *stream, const char *format, ... )
+fscanf( FILE *stream, const char *format, ... ) __THROW
{
int rc; // return code
va_list ap; // for variable args
va_start(ap, format); // init specifying last non-var arg
Index: language/c/libc/stdio/current/src/input/gets.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/input/gets.cxx,v
retrieving revision 1.4
diff -u -5 -p -r1.4 gets.cxx
--- language/c/libc/stdio/current/src/input/gets.cxx 23 May 2002 23:07:18 -0000 1.4
+++ language/c/libc/stdio/current/src/input/gets.cxx 15 Mar 2004 15:04:12 -0000
@@ -69,11 +69,11 @@
// FIXME: should be reworked to read buffer at a time, and scan that
// for newlines, rather than reading byte at a time.
externC char *
-gets( char *s )
+gets( char *s ) __THROW
{
Cyg_StdioStream *real_stream = (Cyg_StdioStream *)stdin;
Cyg_ErrNo err=ENOERR;
cyg_uint8 c;
cyg_uint8 *str=(cyg_uint8 *)s;
Index: language/c/libc/stdio/current/src/input/scanf.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/input/scanf.cxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 scanf.cxx
--- language/c/libc/stdio/current/src/input/scanf.cxx 23 May 2002 23:07:18 -0000 1.3
+++ language/c/libc/stdio/current/src/input/scanf.cxx 15 Mar 2004 15:04:12 -0000
@@ -63,11 +63,11 @@
// FUNCTIONS
externC int
-scanf( const char *format, ... )
+scanf( const char *format, ... ) __THROW
{
int rc; // return code
va_list ap; // for variable args
va_start(ap, format); // init specifying last non-var arg
Index: language/c/libc/stdio/current/src/input/vfscanf.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/input/vfscanf.cxx,v
retrieving revision 1.4
diff -u -5 -p -r1.4 vfscanf.cxx
--- language/c/libc/stdio/current/src/input/vfscanf.cxx 23 May 2002 23:07:18 -0000 1.4
+++ language/c/libc/stdio/current/src/input/vfscanf.cxx 15 Mar 2004 15:04:12 -0000
@@ -176,11 +176,11 @@ __sccl (char *tab, u_char *fmt);
typedef int (*mbtowc_fn_type)(wchar_t *, const char *, size_t, int *);
externC mbtowc_fn_type __get_current_locale_mbtowc_fn();
#endif
externC int
-vfscanf (FILE *fp, const char *fmt0, va_list ap)
+vfscanf (FILE *fp, const char *fmt0, va_list ap) __THROW
{
u_char *fmt = (u_char *) fmt0;
int c; /* character from format, or conversion */
wchar_t wc; /* wide character from format */
size_t width; /* field width, or 0 */
@@ -515,11 +515,11 @@ literal:
width = ~0; /* `infinity' */
/* take only those things in the class */
if (flags & SUPPRESS)
{
n = 0;
- while (ccltab[*CURR_POS])
+ while (ccltab[(int)*CURR_POS])
{
n++, INC_CURR_POS;
if (--width == 0)
break;
if (BufferEmpty)
@@ -533,11 +533,11 @@ literal:
goto match_failure;
}
else
{
p0 = p = va_arg (ap, char *);
- while (ccltab[*CURR_POS])
+ while (ccltab[(int)*CURR_POS])
{
*p++ = *CURR_POS;
INC_CURR_POS;
if (--width == 0)
break;
Index: language/c/libc/stdio/current/src/output/fnprintf.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/output/fnprintf.cxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 fnprintf.cxx
--- language/c/libc/stdio/current/src/output/fnprintf.cxx 23 May 2002 23:07:19 -0000 1.3
+++ language/c/libc/stdio/current/src/output/fnprintf.cxx 15 Mar 2004 15:04:12 -0000
@@ -62,11 +62,11 @@
#include <stdio.h> // header for this file
// FUNCTIONS
externC int
-fnprintf( FILE *stream, size_t size, const char *format, ... )
+fnprintf( FILE *stream, size_t size, const char *format, ... ) __THROW
{
int rc; // return code
va_list ap; // for variable args
va_start(ap, format); // init specifying last non-var arg
Index: language/c/libc/stdio/current/src/output/fprintf.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/output/fprintf.cxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 fprintf.cxx
--- language/c/libc/stdio/current/src/output/fprintf.cxx 23 May 2002 23:07:19 -0000 1.3
+++ language/c/libc/stdio/current/src/output/fprintf.cxx 15 Mar 2004 15:04:12 -0000
@@ -63,11 +63,11 @@
#include <limits.h> // INT_MAX
// FUNCTIONS
externC int
-fprintf( FILE *stream, const char *format, ... )
+fprintf( FILE *stream, const char *format, ... ) __THROW
{
int rc; // return code
va_list ap; // for variable args
va_start(ap, format); // init specifying last non-var arg
Index: language/c/libc/stdio/current/src/output/fputc.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/output/fputc.cxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 fputc.cxx
--- language/c/libc/stdio/current/src/output/fputc.cxx 23 May 2002 23:07:19 -0000 1.3
+++ language/c/libc/stdio/current/src/output/fputc.cxx 15 Mar 2004 15:04:12 -0000
@@ -67,11 +67,11 @@
#include <cyg/libc/stdio/stream.hxx>// Cyg_StdioStream
// FUNCTIONS
externC int
-fputc( int c, FILE *stream )
+fputc( int c, FILE *stream ) __THROW
{
Cyg_StdioStream *real_stream = (Cyg_StdioStream *)stream;
Cyg_ErrNo err;
cyg_uint8 real_c = (cyg_uint8) c;
@@ -99,18 +99,18 @@ fputc( int c, FILE *stream )
// Also define putchar() even though it can be a macro.
// Undefine the macro first though
#undef putchar
externC int
-putchar( int c )
+putchar( int c ) __THROW
{
return fputc( c, stdout );
} // putchar()
// Also define putc() even though it can be a macro.
// Undefine the macro first though
#undef putc
externC int
-putc( int, FILE * ) CYGBLD_ATTRIB_WEAK_ALIAS(fputc);
+putc( int, FILE * ) __THROW CYGBLD_ATTRIB_WEAK_ALIAS(fputc);
// EOF fputc.cxx
Index: language/c/libc/stdio/current/src/output/fputs.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/output/fputs.cxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 fputs.cxx
--- language/c/libc/stdio/current/src/output/fputs.cxx 23 May 2002 23:07:19 -0000 1.3
+++ language/c/libc/stdio/current/src/output/fputs.cxx 15 Mar 2004 15:04:12 -0000
@@ -65,11 +65,11 @@
#include <string.h> // strlen()
// FUNCTIONS
externC int
-fputs( const char *s, FILE *stream )
+fputs( const char *s, FILE *stream ) __THROW
{
Cyg_StdioStream *real_stream = (Cyg_StdioStream *)stream;
cyg_ucount32 size = strlen(s);
cyg_ucount32 written;
Cyg_ErrNo err;
Index: language/c/libc/stdio/current/src/output/fwrite.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/output/fwrite.cxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 fwrite.cxx
--- language/c/libc/stdio/current/src/output/fwrite.cxx 23 May 2002 23:07:19 -0000 1.3
+++ language/c/libc/stdio/current/src/output/fwrite.cxx 15 Mar 2004 15:04:12 -0000
@@ -67,11 +67,11 @@
// FUNCTIONS
externC size_t
fwrite( const void *ptr, size_t object_size, size_t num_objects,
- FILE *stream )
+ FILE *stream ) __THROW
{
Cyg_StdioStream *real_stream = (Cyg_StdioStream *)stream;
cyg_ucount32 written;
Cyg_ErrNo err;
Index: language/c/libc/stdio/current/src/output/printf.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/output/printf.cxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 printf.cxx
--- language/c/libc/stdio/current/src/output/printf.cxx 23 May 2002 23:07:19 -0000 1.3
+++ language/c/libc/stdio/current/src/output/printf.cxx 15 Mar 2004 15:04:12 -0000
@@ -63,11 +63,11 @@
#include <limits.h> // INT_MAX
// FUNCTIONS
externC int
-printf( const char *format, ... )
+printf( const char *format, ... ) __THROW
{
int rc; // return code
va_list ap; // for variable args
va_start(ap, format); // init specifying last non-var arg
Index: language/c/libc/stdio/current/src/output/vfnprintf.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/output/vfnprintf.cxx,v
retrieving revision 1.7
diff -u -5 -p -r1.7 vfnprintf.cxx
--- language/c/libc/stdio/current/src/output/vfnprintf.cxx 10 Jun 2003 10:27:13 -0000 1.7
+++ language/c/libc/stdio/current/src/output/vfnprintf.cxx 15 Mar 2004 15:04:13 -0000
@@ -151,11 +151,11 @@ externC mbtowc_fn_type __get_current_loc
#define ZEROPAD 0x080 /* zero (as opposed to blank) pad */
#define FPT 0x100 /* Floating point number */
#define SIZET 0x200 /* size_t */
externC int
-vfnprintf ( FILE *stream, size_t n, const char *format, va_list arg)
+vfnprintf ( FILE *stream, size_t n, const char *format, va_list arg) __THROW
{
char *fmt; /* format string */
int ch; /* character from fmt */
int x, y; /* handy integers (short term usage) */
char *cp; /* handy char pointer (short term usage) */
Index: language/c/libc/stdlib/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdlib/current/ChangeLog,v
retrieving revision 1.7
diff -u -5 -p -r1.7 ChangeLog
--- language/c/libc/stdlib/current/ChangeLog 24 Feb 2003 14:28:02 -0000 1.7
+++ language/c/libc/stdlib/current/ChangeLog 15 Mar 2004 15:04:13 -0000
@@ -1,5 +1,10 @@
+2004-02-17 Jonathan Larmour <jifl@eCosCentric.com>
+
+ * src/rand.cxx (srand): Use correct thread data type.
+ (rand): Ditto.
+
2003-02-24 Jonathan Larmour <jifl@eCosCentric.com>
* cdl/stdlib.cdl: Fix doc link.
2001-06-28 Jesper Skov <jskov@redhat.com>
Index: language/c/libc/stdlib/current/src/rand.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdlib/current/src/rand.cxx,v
retrieving revision 1.4
diff -u -5 -p -r1.4 rand.cxx
--- language/c/libc/stdlib/current/src/rand.cxx 23 May 2002 23:07:21 -0000 1.4
+++ language/c/libc/stdlib/current/src/rand.cxx 15 Mar 2004 15:04:13 -0000
@@ -84,11 +84,13 @@ static int rand_trace = CYGNUM_LIBC_RAND
// STATICS
#ifdef CYGSEM_LIBC_PER_THREAD_RAND
-static cyg_ucount32 rand_data_index=CYGNUM_KERNEL_THREADS_DATA_MAX;
+static Cyg_Thread::cyg_data_index
+rand_data_index=CYGNUM_KERNEL_THREADS_DATA_MAX;
+
static Cyg_Mutex rand_data_mutex CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_LIBC);
#else
static unsigned int cyg_libc_rand_seed = CYGNUM_LIBC_RAND_SEED;
#endif
@@ -111,14 +113,14 @@ rand( void )
// rare situation
if (CYGNUM_KERNEL_THREADS_DATA_MAX==rand_data_index) {
rand_data_mutex.lock();
if (CYGNUM_KERNEL_THREADS_DATA_MAX==rand_data_index) {
- // the kernel just throws an assert if this doesn't work
// FIXME: Should use real CDL to pre-allocate a slot at compile
// time to ensure there are enough slots
rand_data_index = self->new_data_index();
+ CYG_ASSERT(rand_data_index >= 0, "failed to allocate data index" );
// Initialize seed
self->set_data(rand_data_index, CYGNUM_LIBC_RAND_SEED);
}
rand_data_mutex.unlock();
@@ -226,15 +228,14 @@ srand( unsigned int seed )
// rare situation
if (CYGNUM_KERNEL_THREADS_DATA_MAX==rand_data_index) {
rand_data_mutex.lock();
if (CYGNUM_KERNEL_THREADS_DATA_MAX==rand_data_index) {
- // the kernel just throws an assert if this doesn't work
// FIXME: Should use real CDL to pre-allocate a slot at compile
// time to ensure there are enough slots
rand_data_index = self->new_data_index();
-
+ CYG_ASSERT(rand_data_index >= 0, "failed to allocate data index" );
}
rand_data_mutex.unlock();
} // if
// we have a valid index now
Index: language/c/libc/string/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/string/current/ChangeLog,v
retrieving revision 1.7
diff -u -5 -p -r1.7 ChangeLog
--- language/c/libc/string/current/ChangeLog 24 Feb 2003 14:28:23 -0000 1.7
+++ language/c/libc/string/current/ChangeLog 15 Mar 2004 15:04:13 -0000
@@ -1,5 +1,15 @@
+2004-02-20 Jonathan Larmour <jifl@eCosCentric.com>
+
+ * include/string.h: Prototype strdup().
+ * include/stringsupp.hxx: Prototype __strdup().
+ externC -> __externC while I'm here.
+ * src/strdup.cxx: New file implementing strdup()/__strdup().
+ * cdl/string.cdl: Build strdup.cxx if CYGINT_ISO_MALLOC.
+
+ * src/strtok.cxx (strtok): Use correct thread data type.
+
2003-02-24 Jonathan Larmour <jifl@eCosCentric.com>
* cdl/string.cdl: Fix doc link.
2001-11-27 Jonathan Larmour <jlarmour@redhat.com>
Index: language/c/libc/string/current/cdl/string.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/string/current/cdl/string.cdl,v
retrieving revision 1.6
diff -u -5 -p -r1.6 string.cdl
--- language/c/libc/string/current/cdl/string.cdl 24 Feb 2003 14:28:23 -0000 1.6
+++ language/c/libc/string/current/cdl/string.cdl 15 Mar 2004 15:04:13 -0000
@@ -156,10 +156,19 @@ cdl_package CYGPKG_LIBC_STRING {
functions strtok() and strtok_r(). Increase this
value to get additional trace output."
}
}
+ cdl_option CYGFUN_LIBC_STRING_STRDUP {
+ display "strdup"
+ active_if CYGINT_ISO_MALLOC
+ calculated 1
+ compile strdup.cxx
+ description "
+ This option indicates whether strdup() is to be supported."
+ }
+
cdl_component CYGPKG_LIBC_STRING_OPTIONS {
display "C library string functions build options"
flavor none
no_define
description "
Index: language/c/libc/string/current/include/string.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/string/current/include/string.h,v
retrieving revision 1.3
diff -u -5 -p -r1.3 string.h
--- language/c/libc/string/current/include/string.h 23 May 2002 23:07:23 -0000 1.3
+++ language/c/libc/string/current/include/string.h 15 Mar 2004 15:04:13 -0000
@@ -148,10 +148,16 @@ strtok_r( char *, const char *, char **
/* 7.11.6 Miscellaneous functions */
extern size_t
strlen( const char * );
+// NB This is a BSD function
+#ifndef __STRICT_ANSI__
+extern char *
+strdup( const char * );
+#endif
+
#ifdef __cplusplus
} /* extern "C" */
#endif
/* INLINE FUNCTIONS */
Index: language/c/libc/string/current/include/stringsupp.hxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/string/current/include/stringsupp.hxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 stringsupp.hxx
--- language/c/libc/string/current/include/stringsupp.hxx 23 May 2002 23:07:24 -0000 1.3
+++ language/c/libc/string/current/include/stringsupp.hxx 15 Mar 2004 15:04:14 -0000
@@ -66,12 +66,12 @@
// CONSTANTS
#ifndef CYGIMP_LIBC_STRING_PREFER_SMALL_TO_FAST
// Masks for CYG_LIBC_STR_DETECTNULL below
-externC const cyg_uint64 Cyg_libc_str_null_mask_1;
-externC const cyg_uint64 Cyg_libc_str_null_mask_2;
+__externC const cyg_uint64 Cyg_libc_str_null_mask_1;
+__externC const cyg_uint64 Cyg_libc_str_null_mask_2;
#endif
// MACROS
@@ -109,106 +109,110 @@ externC const cyg_uint64 Cyg_libc_str_nu
//===========================================================================
// 7.11.2 Copying functions
-externC void *
+__externC void *
__memmove( void *, const void *, size_t );
-externC char *
+__externC char *
__strcpy( char *, const char * );
-externC char *
+__externC char *
__strncpy( char *, const char *, size_t );
//===========================================================================
// 7.11.3 Concatenation functions
-externC char *
+__externC char *
__strcat( char *, const char * );
-externC char *
+__externC char *
__strncat( char *, const char *, size_t );
//===========================================================================
// 7.11.4 Comparison functions
-externC int
+__externC int
__memcmp( const void *, const void *, size_t );
-externC int
+__externC int
__strcmp( const char *, const char * );
-externC int
+__externC int
__strcoll( const char *, const char * );
-externC int
+__externC int
__strncmp( const char *, const char *, size_t );
-externC size_t
+__externC size_t
__strxfrm( char *, const char *, size_t );
//===========================================================================
// 7.11.5 Search functions
-externC void *
+__externC void *
__memchr( const void *, int , size_t );
-externC char *
+__externC char *
__strchr( const char *, int );
-externC size_t
+__externC size_t
__strcspn( const char *, const char * );
-externC char *
+__externC char *
__strpbrk( const char *, const char * );
-externC char *
+__externC char *
__strrchr( const char *, int );
-externC size_t
+__externC size_t
__strspn( const char *, const char * );
-externC char *
+__externC char *
__strstr( const char *, const char * );
-externC char *
+__externC char *
__strtok( char *, const char * );
// For POSIX 1003.1 section 8.3.3 strtok_r()
-externC char *
+__externC char *
__strtok_r( char *, const char *, char ** );
//===========================================================================
// 7.11.6 Miscellaneous functions
-externC size_t
+__externC size_t
__strlen( const char * );
+
+// NB This is a BSD function
+__externC char *
+__strdup( const char * );
#endif // CYGONCE_LIBC_STRING_STRINGSUPP_HXX multiple inclusion protection
// EOF stringsupp.hxx
Index: language/c/libc/string/current/src/strdup.cxx
===================================================================
RCS file: language/c/libc/string/current/src/strdup.cxx
diff -N language/c/libc/string/current/src/strdup.cxx
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ language/c/libc/string/current/src/strdup.cxx 15 Mar 2004 15:04:14 -0000
@@ -0,0 +1,96 @@
+//===========================================================================
+//
+// strdup.cxx
+//
+// BSD strdup() routine
+//
+//===========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2004 eCosCentric Ltd.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//===========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): jlarmour
+// Contributors:
+// Date: 2004-02-17
+// Purpose:
+// Description:
+// Usage:
+//
+//####DESCRIPTIONEND####
+//
+//===========================================================================
+
+// CONFIGURATION
+
+#include <pkgconf/libc_string.h> // Configuration header
+
+// INCLUDES
+
+#include <cyg/infra/cyg_type.h> // Common type definitions
+#include <cyg/infra/cyg_trac.h> // Tracing support
+#include <cyg/infra/cyg_ass.h> // Assertion support
+#include <string.h> // Header for this file
+#include <stddef.h> // Compiler definitions such as size_t, NULL etc.
+#include <stdlib.h> // malloc()
+#include <cyg/libc/string/stringsupp.hxx> // Useful string function support and
+ // prototypes
+
+// EXPORTED SYMBOLS
+
+__externC char *
+strdup( const char * ) CYGBLD_ATTRIB_WEAK_ALIAS(__strdup);
+
+// FUNCTIONS
+
+char *
+__strdup( const char *s1 )
+{
+ char *newstring;
+ size_t len;
+
+ CYG_REPORT_FUNCNAMETYPE( "__strdup", "returning addr %08x" );
+ CYG_REPORT_FUNCARG1( "s1=%08x", s1 );
+
+ CYG_CHECK_DATA_PTR( s1, "s1 is not a valid pointer!" );
+
+ len = strlen( s1 ) + 1;
+ newstring = (char *)malloc( len );
+ if ( newstring )
+ {
+ memcpy( newstring, s1, len );
+ } // if
+
+ CYG_REPORT_RETVAL( newstring );
+
+ return newstring;
+} // __strdup()
+
+// EOF strdup.cxx
Index: language/c/libc/string/current/src/strtok.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/string/current/src/strtok.cxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 strtok.cxx
--- language/c/libc/string/current/src/strtok.cxx 23 May 2002 23:07:28 -0000 1.3
+++ language/c/libc/string/current/src/strtok.cxx 15 Mar 2004 15:04:14 -0000
@@ -114,11 +114,13 @@ static int strtok_trace = CYGNUM_LIBC_ST
#endif
// STATICS
#ifdef CYGSEM_LIBC_STRING_PER_THREAD_STRTOK
-static cyg_ucount32 strtok_data_index=CYGNUM_KERNEL_THREADS_DATA_MAX;
+static Cyg_Thread::cyg_data_index
+strtok_data_index=CYGNUM_KERNEL_THREADS_DATA_MAX;
+
static Cyg_Mutex strtok_data_mutex CYG_INIT_PRIORITY(LIBC);
#else
static char *cyg_libc_strtok_last;
#endif
@@ -145,15 +147,15 @@ strtok( char *s1, const char *s2 )
// rare situation
if (CYGNUM_KERNEL_THREADS_DATA_MAX==strtok_data_index) {
strtok_data_mutex.lock();
if (CYGNUM_KERNEL_THREADS_DATA_MAX==strtok_data_index) {
- // the kernel just throws an assert if this doesn't work
// FIXME: Should use real CDL to pre-allocate a slot at compile
// time to ensure there are enough slots
strtok_data_index = self->new_data_index();
-
+ CYG_ASSERT(strtok_data_index >= 0,
+ "failed to allocate data index" );
}
strtok_data_mutex.unlock();
} // if
// we have a valid index now
Index: pkgconf/rules.mak
===================================================================
RCS file: /cvs/ecos/ecos/packages/pkgconf/rules.mak,v
retrieving revision 1.13
diff -u -5 -p -r1.13 rules.mak
--- pkgconf/rules.mak 24 Oct 2003 18:27:39 -0000 1.13
+++ pkgconf/rules.mak 15 Mar 2004 15:04:23 -0000
@@ -59,15 +59,26 @@ ifneq ($(wildcard *.deps),)
include $(wildcard *.deps)
endif
# GCC since 2.95 does -finit-priority by default so remove it from old HALs
CFLAGS := $(subst -finit-priority,,$(CFLAGS))
+
+# -fvtable-gc is known to be broken in all recent GCC.
CFLAGS := $(subst -fvtable-gc,,$(CFLAGS))
+# To support more recent GCC whilst preserving existing behaviour, we need
+# to increase the inlining limit globally from the default 600. Note this
+# will break GCC 2.95 based tools and earlier. You must use "make OLDGCC=1"
+# to avoid this.
+ifneq ($(OLDGCC),1)
+CFLAGS := -finline-limit=7000 $(CFLAGS)
+endif
+
# Separate C++ flags out from C flags.
ACTUAL_CFLAGS = $(CFLAGS)
ACTUAL_CFLAGS := $(subst -fno-rtti,,$(ACTUAL_CFLAGS))
+ACTUAL_CFLAGS := $(subst -frtti,,$(ACTUAL_CFLAGS))
ACTUAL_CFLAGS := $(subst -Woverloaded-virtual,,$(ACTUAL_CFLAGS))
ACTUAL_CFLAGS := $(subst -fvtable-gc,,$(ACTUAL_CFLAGS))
ACTUAL_CXXFLAGS = $(CFLAGS)
@@ -163,13 +174,13 @@ ifeq ($(HOST),CYGWIN)
@mkdir -p `cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
else
@mkdir -p $(dir $@)
endif
ifneq ($(IGNORE_LINK_ERRORS),)
- -$(CC) $(LDFLAGS) -L$(PREFIX)/lib -Ttarget.ld -o $@ $(<:.d=.o)
+ -$(CC) -L$(PREFIX)/lib -Ttarget.ld -o $@ $(<:.d=.o) $(LDFLAGS)
else
- $(CC) $(LDFLAGS) -L$(PREFIX)/lib -Ttarget.ld -o $@ $(<:.d=.o)
+ $(CC) -L$(PREFIX)/lib -Ttarget.ld -o $@ $(<:.d=.o) $(LDFLAGS)
endif
# rule to generate all tests and create a dependency file "tests.deps" by
# concatenating the individual dependency rule files (file extension = ".d")
# generated during compilation
Index: services/memalloc/common/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/services/memalloc/common/current/ChangeLog,v
retrieving revision 1.29
diff -u -5 -p -r1.29 ChangeLog
--- services/memalloc/common/current/ChangeLog 6 Oct 2003 18:25:57 -0000 1.29
+++ services/memalloc/common/current/ChangeLog 15 Mar 2004 15:04:24 -0000
@@ -1,5 +1,10 @@
+2004-02-15 Jonathan Larmour <jifl@eCosCentric.com>
+
+ * include/kapi.h: Add throw specifications throughout.
+ * src/kapi.cxx: Ditto.
+
2003-10-06 Andrew Lunn <andrew.lunn@ascom.ch>
* src/dlmalloc.cxx (Cyg_Mempool_dlmalloc_Implementation): Fixed
compiler warning added by previous patch.
Index: services/memalloc/common/current/include/kapi.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/services/memalloc/common/current/include/kapi.h,v
retrieving revision 1.3
diff -u -5 -p -r1.3 kapi.h
--- services/memalloc/common/current/include/kapi.h 23 May 2002 23:08:43 -0000 1.3
+++ services/memalloc/common/current/include/kapi.h 15 Mar 2004 15:04:24 -0000
@@ -81,46 +81,46 @@ typedef struct cyg_mempool_fix cyg_mempo
void cyg_mempool_var_create(
void *base, /* base of memory to use for pool */
cyg_int32 size, /* size of memory in bytes */
cyg_handle_t *handle, /* returned handle of memory pool */
cyg_mempool_var *var /* space to put pool structure in */
- );
+ ) __THROW;
/* Delete variable size memory pool */
-void cyg_mempool_var_delete(cyg_handle_t varpool);
+void cyg_mempool_var_delete(cyg_handle_t varpool) __THROW;
#ifdef CYGSEM_MEMALLOC_ALLOCATOR_VARIABLE_THREADAWARE
/* Allocates a block of length size. This waits if the memory is not
currently available. */
-void *cyg_mempool_var_alloc(cyg_handle_t varpool, cyg_int32 size);
+void *cyg_mempool_var_alloc(cyg_handle_t varpool, cyg_int32 size) __THROW;
# ifdef CYGFUN_KERNEL_THREADS_TIMER
/* Allocates a block of length size. This waits until abstime,
if the memory is not already available. NULL is returned if
no memory is available. */
void *cyg_mempool_var_timed_alloc(
cyg_handle_t varpool,
cyg_int32 size,
- cyg_tick_count_t abstime);
+ cyg_tick_count_t abstime) __THROW;
# endif
#endif
/* Allocates a block of length size. NULL is returned if no memory is
available. */
void *cyg_mempool_var_try_alloc(
cyg_handle_t varpool,
- cyg_int32 size);
+ cyg_int32 size) __THROW;
/* Frees memory back into variable size pool. */
-void cyg_mempool_var_free(cyg_handle_t varpool, void *p);
+void cyg_mempool_var_free(cyg_handle_t varpool, void *p) __THROW;
/* Returns true if there are any threads waiting for memory in the
given memory pool. */
-cyg_bool_t cyg_mempool_var_waiting(cyg_handle_t varpool);
+cyg_bool_t cyg_mempool_var_waiting(cyg_handle_t varpool) __THROW;
typedef struct {
cyg_int32 totalmem;
cyg_int32 freemem;
void *base;
@@ -129,54 +129,54 @@ typedef struct {
cyg_int32 maxfree; // The largest free block
} cyg_mempool_info;
/* Puts information about a variable memory pool into the structure
provided. */
-void cyg_mempool_var_get_info(cyg_handle_t varpool, cyg_mempool_info *info);
+void cyg_mempool_var_get_info(cyg_handle_t varpool, cyg_mempool_info *info) __THROW;
/* Create a fixed size memory pool */
void cyg_mempool_fix_create(
void *base, // base of memory to use for pool
cyg_int32 size, // size of memory in byte
cyg_int32 blocksize, // size of allocation in bytes
cyg_handle_t *handle, // handle of memory pool
cyg_mempool_fix *fix // space to put pool structure in
- );
+ ) __THROW;
/* Delete fixed size memory pool */
-void cyg_mempool_fix_delete(cyg_handle_t fixpool);
+void cyg_mempool_fix_delete(cyg_handle_t fixpool) __THROW;
#ifdef CYGSEM_MEMALLOC_ALLOCATOR_FIXED_THREADAWARE
/* Allocates a block. This waits if the memory is not
currently available. */
-void *cyg_mempool_fix_alloc(cyg_handle_t fixpool);
+void *cyg_mempool_fix_alloc(cyg_handle_t fixpool) __THROW;
# ifdef CYGFUN_KERNEL_THREADS_TIMER
/* Allocates a block. This waits until abstime, if the memory
is not already available. NULL is returned if no memory is
available. */
void *cyg_mempool_fix_timed_alloc(
cyg_handle_t fixpool,
- cyg_tick_count_t abstime);
+ cyg_tick_count_t abstime) __THROW;
# endif
#endif
/* Allocates a block. NULL is returned if no memory is available. */
-void *cyg_mempool_fix_try_alloc(cyg_handle_t fixpool);
+void *cyg_mempool_fix_try_alloc(cyg_handle_t fixpool) __THROW;
/* Frees memory back into fixed size pool. */
-void cyg_mempool_fix_free(cyg_handle_t fixpool, void *p);
+void cyg_mempool_fix_free(cyg_handle_t fixpool, void *p) __THROW;
/* Returns true if there are any threads waiting for memory in the
given memory pool. */
-cyg_bool_t cyg_mempool_fix_waiting(cyg_handle_t fixpool);
+cyg_bool_t cyg_mempool_fix_waiting(cyg_handle_t fixpool) __THROW;
/* Puts information about a variable memory pool into the structure
provided. */
-void cyg_mempool_fix_get_info(cyg_handle_t fixpool, cyg_mempool_info *info);
+void cyg_mempool_fix_get_info(cyg_handle_t fixpool, cyg_mempool_info *info) __THROW;
#endif /* ifndef CYGONCE_MEMALLOC_KAPI_H */
/* EOF kapi.h */
Index: services/memalloc/common/current/src/kapi.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/services/memalloc/common/current/src/kapi.cxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 kapi.cxx
--- services/memalloc/common/current/src/kapi.cxx 23 May 2002 23:08:44 -0000 1.3
+++ services/memalloc/common/current/src/kapi.cxx 15 Mar 2004 15:04:24 -0000
@@ -109,11 +109,11 @@ inline void *operator new(size_t size, v
externC void cyg_mempool_var_create(
void *base, /* base of memory to use for pool */
cyg_int32 size, /* size of memory in bytes */
cyg_handle_t *handle, /* returned handle of memory pool */
cyg_mempool_var *var /* space to put pool structure in */
- )
+ ) __THROW
{
CYG_ASSERT_SIZES( cyg_mempool_var, Cyg_Mempool_Variable );
Cyg_Mempool_Variable *t = new((void *)var) Cyg_Mempool_Variable (
(cyg_uint8 *)base,
@@ -124,19 +124,19 @@ externC void cyg_mempool_var_create(
CYG_CHECK_DATA_PTR( handle, "Bad handle pointer" );
*handle = (cyg_handle_t)var;
}
/* Delete variable size memory pool */
-externC void cyg_mempool_var_delete(cyg_handle_t varpool)
+externC void cyg_mempool_var_delete(cyg_handle_t varpool) __THROW
{
((Cyg_Mempool_Variable *)varpool)->~Cyg_Mempool_Variable();
}
/* Allocates a block of length size. This waits if the memory is not
currently available. */
#ifdef CYGSEM_MEMALLOC_ALLOCATOR_VARIABLE_THREADAWARE
-externC void *cyg_mempool_var_alloc(cyg_handle_t varpool, cyg_int32 size)
+externC void *cyg_mempool_var_alloc(cyg_handle_t varpool, cyg_int32 size) __THROW
{
return ((Cyg_Mempool_Variable *)varpool)->alloc(size);
}
# ifdef CYGFUN_KERNEL_THREADS_TIMER
@@ -145,11 +145,11 @@ externC void *cyg_mempool_var_alloc(cyg_
ticks, if the memory is not already available. NULL is returned if
no memory is available. */
externC void *cyg_mempool_var_timed_alloc(
cyg_handle_t varpool,
cyg_int32 size,
- cyg_tick_count_t abstime)
+ cyg_tick_count_t abstime) __THROW
{
return ((Cyg_Mempool_Variable *)varpool)->alloc(size, abstime);
}
# endif
@@ -157,27 +157,27 @@ externC void *cyg_mempool_var_timed_allo
/* Allocates a block of length size. NULL is returned if no memory is
available. */
externC void *cyg_mempool_var_try_alloc(
cyg_handle_t varpool,
- cyg_int32 size)
+ cyg_int32 size) __THROW
{
return ((Cyg_Mempool_Variable *)varpool)->try_alloc(size);
}
/* Frees memory back into variable size pool. */
-externC void cyg_mempool_var_free(cyg_handle_t varpool, void *p)
+externC void cyg_mempool_var_free(cyg_handle_t varpool, void *p) __THROW
{
cyg_bool b;
b = ((Cyg_Mempool_Variable *)varpool)->free((cyg_uint8 *)p, 0);
CYG_ASSERT( b, "Bad free");
}
/* Returns true if there are any threads waiting for memory in the
given memory pool. */
-externC cyg_bool_t cyg_mempool_var_waiting(cyg_handle_t varpool)
+externC cyg_bool_t cyg_mempool_var_waiting(cyg_handle_t varpool) __THROW
{
Cyg_Mempool_Variable *v = (Cyg_Mempool_Variable *)varpool;
Cyg_Mempool_Status stat;
v->get_status( CYG_MEMPOOL_STAT_WAITING, stat );
@@ -186,11 +186,11 @@ externC cyg_bool_t cyg_mempool_var_waiti
/* Puts information about a variable memory pool into the structure
provided. */
externC void cyg_mempool_var_get_info(
cyg_handle_t varpool,
- cyg_mempool_info *info)
+ cyg_mempool_info *info) __THROW
{
Cyg_Mempool_Variable *v = (Cyg_Mempool_Variable *)varpool;
Cyg_Mempool_Status stat;
v->get_status( CYG_MEMPOOL_STAT_ARENASIZE|
@@ -213,11 +213,11 @@ externC void cyg_mempool_fix_create(
void *base, // base of memory to use for pool
cyg_int32 size, // size of memory in byte
cyg_int32 blocksize, // size of allocation in bytes
cyg_handle_t *handle, // handle of memory pool
cyg_mempool_fix *fix // space to put pool structure in
- )
+ ) __THROW
{
CYG_ASSERT_SIZES( cyg_mempool_fix, Cyg_Mempool_Fixed );
Cyg_Mempool_Fixed *t = new((void *)fix) Cyg_Mempool_Fixed (
(cyg_uint8 *)base,
@@ -229,19 +229,19 @@ externC void cyg_mempool_fix_create(
CYG_CHECK_DATA_PTR( handle, "Bad handle pointer" );
*handle = (cyg_handle_t)fix;
}
/* Delete fixed size memory pool */
-externC void cyg_mempool_fix_delete(cyg_handle_t fixpool)
+externC void cyg_mempool_fix_delete(cyg_handle_t fixpool) __THROW
{
((Cyg_Mempool_Fixed *)fixpool)->~Cyg_Mempool_Fixed();
}
#ifdef CYGSEM_MEMALLOC_ALLOCATOR_FIXED_THREADAWARE
/* Allocates a block. This waits if the memory is not
currently available. */
-externC void *cyg_mempool_fix_alloc(cyg_handle_t fixpool)
+externC void *cyg_mempool_fix_alloc(cyg_handle_t fixpool) __THROW
{
return ((Cyg_Mempool_Fixed *)fixpool)->alloc();
}
# ifdef CYGFUN_KERNEL_THREADS_TIMER
@@ -249,35 +249,35 @@ externC void *cyg_mempool_fix_alloc(cyg_
/* Allocates a block. This waits for up to delay ticks, if the memory
is not already available. NULL is returned if no memory is
available. */
externC void *cyg_mempool_fix_timed_alloc(
cyg_handle_t fixpool,
- cyg_tick_count_t abstime)
+ cyg_tick_count_t abstime) __THROW
{
return ((Cyg_Mempool_Fixed *)fixpool)->alloc(abstime);
}
# endif
#endif
/* Allocates a block. NULL is returned if no memory is available. */
-externC void *cyg_mempool_fix_try_alloc(cyg_handle_t fixpool)
+externC void *cyg_mempool_fix_try_alloc(cyg_handle_t fixpool) __THROW
{
return ((Cyg_Mempool_Fixed *)fixpool)->try_alloc();
}
/* Frees memory back into fixed size pool. */
-externC void cyg_mempool_fix_free(cyg_handle_t fixpool, void *p)
+externC void cyg_mempool_fix_free(cyg_handle_t fixpool, void *p) __THROW
{
cyg_bool b;
b = ((Cyg_Mempool_Fixed *)fixpool)->free((cyg_uint8 *)p);
CYG_ASSERT( b, "Bad free");
}
/* Returns true if there are any threads waiting for memory in the
given memory pool. */
-externC cyg_bool_t cyg_mempool_fix_waiting(cyg_handle_t fixpool)
+externC cyg_bool_t cyg_mempool_fix_waiting(cyg_handle_t fixpool) __THROW
{
Cyg_Mempool_Fixed *f = (Cyg_Mempool_Fixed *)fixpool;
Cyg_Mempool_Status stat;
f->get_status( CYG_MEMPOOL_STAT_WAITING, stat );
@@ -286,11 +286,11 @@ externC cyg_bool_t cyg_mempool_fix_waiti
/* Puts information about a fixed block memory pool into the structure
provided. */
externC void cyg_mempool_fix_get_info(
cyg_handle_t fixpool,
- cyg_mempool_info *info)
+ cyg_mempool_info *info) __THROW
{
Cyg_Mempool_Fixed *f = (Cyg_Mempool_Fixed *)fixpool;
Cyg_Mempool_Status stat;
f->get_status( CYG_MEMPOOL_STAT_ARENASIZE|
@@ -318,11 +318,11 @@ externC void cyg_mempool_fix_get_info(
class Cyg_Check_Mem_Structure_Sizes
{
int dummy;
public:
- Cyg_Check_Mem_Structure_Sizes( int x );
+ Cyg_Check_Mem_Structure_Sizes( int x ) __THROW;
};
#define CYG_CHECK_SIZES(cstruct, cxxstruct) \
if( sizeof(cstruct) != sizeof(cxxstruct) ) \
@@ -332,11 +332,11 @@ if( sizeof(cstruct) != sizeof(cxxstruct)
CYG_TRACE2(1, fmt, sizeof(cstruct) , sizeof(cxxstruct) ); \
fail = true; \
fmt = fmt; \
}
-Cyg_Check_Mem_Structure_Sizes::Cyg_Check_Mem_Structure_Sizes(int x)
+Cyg_Check_Mem_Structure_Sizes::Cyg_Check_Mem_Structure_Sizes(int x) __THROW
{
cyg_bool fail = false;
dummy = x+1;