The XGC Libraries

C/C++ Libraries for Real-Time Applications

Edited by

Chris Nettleton

This document includes information for users of the XGC software development systems.

Acknowledgements

The text of this manual is based on the relevant ANSI C and real-time POSIX standards, and is customized to conform to the libraries as supplied.

The XGC libraries were developed under European Space Agency contract 11935/NL/JG and are maintained by XGC Software.


Table of Contents
Preface
About This Manual
Audience
Reader's Comments
Conventions
1. Introduction
1.1. Program Startup
1.2. Program Termination
1.3. Standard Headers
1.4. Errors <errno.h>
1.5. Limits <float.h> and <limits.h>
1.6. Common definitions <stddef.h>
2. Diagnostics <assert.h>
2.1. Program Diagnostics
The assert macro -- The assert macro
3. Character Handling <ctype.h>
3.1. Implementation Notes
3.2. Character Testing Functions
The isalnum function -- 
The isalpha function -- 
The iscntrl function -- 
The isdigit function -- 
The isgraph function -- 
The islower function -- 
The isprint function -- 
The ispunct function -- 
The isspace function -- 
The isupper function -- 
The isxdigit function -- 
3.3. Character Case Mapping Functions
The tolower function -- 
The toupper function -- 
4. Localization <locale.h>
5. Mathematics <math.h>
5.1. Treatment of Error Conditions
5.2. Notes
5.3. Trigonometric Functions
The acos function -- 
The asin function -- 
The atan function -- 
The atan2 function -- 
The cos function -- 
The sin function -- 
The tan function -- 
5.4. Hyperbolic Functions
The cosh function -- 
The sinh function -- 
The tanh function -- 
5.5. Exponential and Logarithmic Functions
The exp function -- 
The frexp function -- 
The ldexp function -- 
The log function -- 
The log10 function -- 
The modf function -- 
5.6. Power Functions
The pow function -- 
The sqrt function -- 
5.7. Nearest Integer, Absolute Value and Remainder Functions
The ceil function -- 
The fabs function -- 
The floor function -- 
The fmod function -- 
6. Nonlocal Jumps <setjmp.h>
6.1. Save Calling Environment
The setjmp macro -- 
6.2. Restore Calling Environment
The longjmp function -- 
7. Signal Handling <signal.h>
7.1. Specify Signal Handling
The signal function -- 
7.2. Send Signal
The raise function -- 
8. Variable Arguments <stdarg.h>
8.1. Variable Argument List Access Macros
The va_start macro -- 
The va_arg macro -- 
The va_end macro -- 
9. Input/output <stdio.h>
9.1. Formatted Input/Output Functions
The printf function -- 
The sprintf function -- 
The vprintf function -- 
The vsprintf function -- 
9.2. Character Input/Output Functions
The fgetc function -- 
The fgets function -- 
The fputc function -- 
The fputs function -- 
The getc function -- 
The getchar function -- 
The gets function -- 
The putc function -- 
The putchar function -- 
The puts function -- 
10. General Utilities <stdlib.h>
10.1. String Conversion Functions
The atof function -- 
The atoi function -- 
The atol function -- 
The strtod function -- 
The strtol function -- 
The strtoul function -- 
10.2. Pseudo-Random Sequence Generation Functions
The rand function -- 
The srand function -- 
10.3. Memory Management Functions
The calloc function -- 
The free function -- 
The malloc function -- 
The realloc function -- 
10.4. Communication with the Environment
The abort function -- 
The atexit function -- 
The exit function -- 
The system function -- 
10.5. Searching and Sorting Utilities
The bsearch function -- 
10.6. Integer Arithmetic Functions
The abs function -- 
The div function -- 
The labs function -- 
The ldiv function -- 
10.7. Multi-byte Character Functions
The mblen function -- 
The mbtowc function -- 
The wctomb function -- 
10.8. Multi-byte String Functions
The mbstowcs function -- 
The wcstombs function -- 
11. String Handling <string.h>
11.1. String Function Conventions
11.2. Copying Functions
The memcpy function -- Copy a block of memory
The memmove function -- Copy a block of memory
The strcpy function -- Copy a string
The strncpy function -- Copy a string
11.3. Concatenation Functions
The strcat function -- 
The strncat function -- Concatenate two strings
11.4. Comparison Functions
The memcmp function -- 
The strcmp function -- 
The strncmp function -- 
The strcoll function -- 
The strxfrm function -- 
11.5. Search Functions
The memchr function -- 
The strchr function -- 
The strcspn function -- 
The strpbrk function -- 
The strrchr function -- 
The strspn function -- 
The strstr function -- 
The strtok function -- 
11.6. Miscellaneous Functions
The memset function -- 
The strerror function -- 
The strlen function -- 
12. Date and Time <time.h>
12.1. Time Manipulation Functions
The clock function -- 
The difftime function -- 
The mktime function -- 
The time function -- 
12.2. Time Conversion Functions
The asctime function -- Transform binary date and time to ASCII
The ctime function -- 
The gmtime function -- 
The localtime function -- 
The strftime function -- 
13. Test Output <report.h>
13.1. Test Support Functions
The test function -- 
The comment function -- 
The failed function -- 
The result function -- 
14. POSIX Threads
14.1. Initialization Functions
The pthread_init function -- 
14.2. Create and Destroy Functions
The pthread_create function -- 
The pthread_detach function -- 
The pthread_equal function -- 
The pthread_exit function -- 
The pthread_join function -- 
14.3. Scheduling Functions
The pthread_getschedparam function -- 
The pthread_setschedparam function -- 
The sched_get_priority_max function -- 
The sched_get_priority_min function -- 
The sched_yield function -- 
14.4. Timing Functions
The sleep function -- 
The clock_gettime function -- 
The nanosleep function -- 
14.5. Pthread Attribute Functions
The pthread_attr_destroy function -- 
The pthread_attr_getdetachstate function -- 
The pthread_attr_getinheritsched function -- 
The pthread_attr_getschedparam function -- 
The pthread_attr_getschedpolicy function -- 
The pthread_attr_init function -- 
The pthread_attr_setdetachstate function -- 
The pthread_attr_setinheritsched function -- 
The pthread_attr_setschedparam function -- 
The pthread_attr_setschedpolicy function -- 
The pthread_attr_setstacksize function -- 
14.6. Pthread Cond Functions
The pthread_cond_broadcast function -- 
The pthread_cond_destroy function -- 
The pthread_cond_init function -- 
The pthread_cond_signal function -- 
The pthread_cond_timedwait function -- 
The pthread_cond_wait function -- 
14.7. Pthread Mutex Functions
The pthread_mutex_init function -- 
The pthread_mutex_destroy function -- 
The pthread_mutex_lock function -- 
The pthread_mutex_trylock function -- 
The pthread_mutex_unlock function -- 
14.8. Miscellaneous Functions
The pthread_once function -- 
The pthread_self function -- 
The pthread_key_create function -- 
The pthread_getspecific function -- 
The pthread_setspecific function -- 
The pthread_cleanup_push function -- 
The pthread_cleanup_pop function -- 
Index
List of Tables
1-1. Values in float.h
1-2. Values in limits.h
List of Examples
1-1. Function main
1-2. Function main with arguments
13-1. Test Program
13-2. Output from Test Program
13-3. Output from Failed Test Program