mirror of
https://forge.sourceware.org/marek/gcc.git
synced 2026-02-22 03:47:02 -05:00
Add the procedure `posixexit'. gcc/algol68/ChangeLog: * a68-low-posix.cc (a68_posix_setexitstatus): Delete function. (a68_posix_exit): New function. * a68-low-prelude.cc (a68_lower_setexitstatus): Delete function. (a68_lower_posixexit): New function. * a68-low-runtime.def (SET_EXIT_STATUS): Delete definition. (POSIX_EXIT): Add definition for posixexit. * a68-parser-prelude.cc (posix_prelude): Remove setexitstatus identifier from and add posixexit identifier to standenv. * a68.h (a68_posix_setexitstatus): Delete prototype. (a68_lower_setexitstatus): Likewise. (a68_posix_exit): New prototype. (a68_lower_posixexit): Likewise. * ga68.texi: libga68/ChangeLog: * ga68-posix.c (_libga68_posixexit): New function. * ga68.h (_libga68_posixexit): New prototype. (_libga68_set_exit_status): Delete prototype. * ga68.map: Remove _libga68_set_exit_status from and add _libga68_posixexit to the global map. * libga68.c: include <stdlib.h>. (_libga68_set_exit_status): Delete function. (main): Return EXIT_SUCCESS. gcc/testsuite/ChangeLog: * algol68/execute/posix-exit-1.a68: New test. Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
130 lines
4.8 KiB
C
130 lines
4.8 KiB
C
/* Definitions for libga68.
|
|
Copyright (C) 2025 Jose E. Marchesi.
|
|
|
|
GCC 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 3, or (at your option) any later version.
|
|
|
|
GCC 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.
|
|
|
|
Under Section 7 of GPL version 3, you are granted additional permissions
|
|
described in the GCC Runtime Library Exception, version 3.1, as published by
|
|
the Free Software Foundation.
|
|
|
|
You should have received a copy of the GNU General Public License and a copy
|
|
of the GCC Runtime Library Exception along with this program; see the files
|
|
COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
#ifndef GA68_H
|
|
#define GA68_H
|
|
|
|
#include "config.h"
|
|
|
|
#include <stddef.h> /* For size_t. */
|
|
#include <stdint.h>
|
|
#include <stdarg.h>
|
|
#ifdef __has_include
|
|
# if __has_include (<sys/types.h>)
|
|
# include <sys/types.h> /* For ssize_t. */
|
|
# endif
|
|
#endif
|
|
|
|
#ifdef HAVE_ATTRIBUTE_VISIBILITY
|
|
# define GA68_HIDDEN __attribute__ ((__visibility__ ("hidden")))
|
|
#else
|
|
# define GA68_HIDDEN
|
|
#endif
|
|
|
|
/* ga68-error.c */
|
|
|
|
void _libga68_abort (const char *fmt, ...)
|
|
GA68_HIDDEN
|
|
__attribute__ ((__format__ (__printf__, 1, 2), __nonnull__ (1),
|
|
__noreturn__));
|
|
|
|
void _libga68_assert (const char *filename, unsigned int lineno);
|
|
void _libga68_derefnil (const char *filename, unsigned int lineno);
|
|
void _libga68_invalidcharerror (const char *filename, unsigned int lineno,
|
|
int c);
|
|
|
|
void _libga68_bitsboundserror (const char *filename, unsigned int lineno,
|
|
ssize_t pos);
|
|
void _libga68_unreachable (const char *filename, unsigned int lineno);
|
|
void _libga68_lower_bound (const char *filename, unsigned int lineno,
|
|
ssize_t index, ssize_t lower_bound);
|
|
void _libga68_upper_bound (const char *filename, unsigned int lineno,
|
|
ssize_t index, ssize_t upper_bound);
|
|
void _libga68_bounds (const char *filename, unsigned int lineno,
|
|
ssize_t index, ssize_t lower_bound, ssize_t upper_bound);
|
|
void _libga68_dim (const char *filename, unsigned int lineno,
|
|
size_t dim, size_t index);
|
|
void _libga68_bounds_mismatch (const char *filename, unsigned int lineno,
|
|
size_t dim, ssize_t lb1, ssize_t ub1,
|
|
ssize_t lb2, ssize_t ub2);
|
|
|
|
/* ga68-alloc.c */
|
|
|
|
void _libga68_init_heap (void) GA68_HIDDEN;
|
|
void *_libga68_malloc (size_t size);
|
|
void *_libga68_malloc_internal (size_t size) GA68_HIDDEN;
|
|
void *_libga68_realloc (void *ptr, size_t size) GA68_HIDDEN;
|
|
void *_libga68_realloc_unchecked (void *ptr, size_t size) GA68_HIDDEN;
|
|
void _libga68_free_internal (void *ptr) GA68_HIDDEN;
|
|
|
|
/* ga68-standenv.c */
|
|
|
|
float _libga68_random (void);
|
|
double _libga68_longrandom (void);
|
|
long double _libga68_longlongrandom (void);
|
|
|
|
/* ga68-posix.c */
|
|
|
|
int _libga68_posixerrno (void);
|
|
void _libga68_posixexit (int) __attribute__ ((__noreturn__));
|
|
void _libga68_posixperror (uint32_t *s, size_t len, size_t stride);
|
|
uint32_t *_libga68_posixstrerror (int errnum, size_t *len);
|
|
long long int _libga68_posixfsize (int fd);
|
|
int _libga68_posixfopen (const uint32_t *pathname, size_t len, size_t stride,
|
|
unsigned int flags);
|
|
int _libga68_posixcreat (uint32_t *pathname, size_t len, size_t stride, uint32_t mode);
|
|
int _libga68_posixclose (int fd);
|
|
int _libga68_posixargc (void);
|
|
uint32_t *_libga68_posixargv (int n, size_t *len);
|
|
void _libga68_posixgetenv (uint32_t *s, size_t len, size_t stride,
|
|
uint32_t **r, size_t *rlen);
|
|
void _libga68_posixputs (uint32_t *s, size_t len, size_t stride);
|
|
uint32_t _libga68_posixputchar (uint32_t c);
|
|
uint32_t _libga68_posixfputc (int fd, uint32_t c);
|
|
int _libga68_posixfputs (int fd, uint32_t *s, size_t len, size_t stride);
|
|
|
|
uint32_t _libga68_posixgetchar (void);
|
|
uint32_t _libga68_posixfgetc (int fd);
|
|
uint32_t *_libga68_posixfgets (int fd, int nchars, size_t *len);
|
|
uint32_t *_libga68_posixgets (int nchars, size_t *len);
|
|
|
|
int _libga68_posixfconnect (uint32_t *str, size_t len, size_t stride,
|
|
int port);
|
|
long long int _libga68_posixlseek (int fd, long long int offset, int whence);
|
|
|
|
/* ga68-unistr.c */
|
|
|
|
int _libga68_u32_cmp2 (const uint32_t *s1, size_t n1, size_t stride1,
|
|
const uint32_t *s2, size_t n2, size_t stride2);
|
|
int _libga68_u8_uctomb (uint8_t *s, uint32_t uc, ptrdiff_t n) GA68_HIDDEN;
|
|
int _libga68_u8_mbtouc (uint32_t *puc, const uint8_t *s, size_t n) GA68_HIDDEN;
|
|
uint8_t *_libga68_u32_to_u8 (const uint32_t *s, size_t n, size_t stride,
|
|
uint8_t *resultbuf, size_t *lengthp) GA68_HIDDEN;
|
|
uint32_t *_libga68_u8_to_u32 (const uint8_t *s, size_t n,
|
|
uint32_t *resultbuf, size_t *lengthp);
|
|
|
|
/* libga68.c */
|
|
|
|
extern int _libga68_argc;
|
|
extern char **_libga68_argv;
|
|
|
|
#endif /* ! GA68_H */
|