| 1 |
/* do not edit automatically generated by mc from top. */ |
| 2 |
/* top.mod main top level program module for mc. |
| 3 |
|
| 4 |
Copyright (C) 2015-2025 Free Software Foundation, Inc. |
| 5 |
Contributed by Gaius Mulley <[email protected]>. |
| 6 |
|
| 7 |
This file is part of GNU Modula-2. |
| 8 |
|
| 9 |
GNU Modula-2 is free software; you can redistribute it and/or modify |
| 10 |
it under the terms of the GNU General Public License as published by |
| 11 |
the Free Software Foundation; either version 3, or (at your option) |
| 12 |
any later version. |
| 13 |
|
| 14 |
GNU Modula-2 is distributed in the hope that it will be useful, but |
| 15 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 |
General Public License for more details. |
| 18 |
|
| 19 |
You should have received a copy of the GNU General Public License |
| 20 |
along with GNU Modula-2; see the file COPYING3. If not see |
| 21 |
<http://www.gnu.org/licenses/>. */ |
| 22 |
|
| 23 |
#include "config.h" |
| 24 |
#include "system.h" |
| 25 |
#include <stdbool.h> |
| 26 |
# if !defined (PROC_D) |
| 27 |
# define PROC_D |
| 28 |
typedef void (*PROC_t) (void); |
| 29 |
typedef struct { PROC_t proc; } PROC; |
| 30 |
# endif |
| 31 |
|
| 32 |
# include "GmcOptions.h" |
| 33 |
# include "GmcComp.h" |
| 34 |
# include "GM2RTS.h" |
| 35 |
# include "GmcStream.h" |
| 36 |
# include "Glibc.h" |
| 37 |
|
| 38 |
|
| 39 |
/* |
| 40 |
wrapRemoveFiles - call removeFiles and return 0. |
| 41 |
*/ |
| 42 |
|
| 43 |
static int wrapRemoveFiles (void); |
| 44 |
|
| 45 |
/* |
| 46 |
init - translate the source file after handling all the |
| 47 |
program arguments. |
| 48 |
*/ |
| 49 |
|
| 50 |
static void init (void); |
| 51 |
|
| 52 |
/* |
| 53 |
wrapRemoveFiles - call removeFiles and return 0. |
| 54 |
*/ |
| 55 |
|
| 56 |
static int wrapRemoveFiles (void); |
| 57 |
|
| 58 |
/* |
| 59 |
init - translate the source file after handling all the |
| 60 |
program arguments. |
| 61 |
*/ |
| 62 |
|
| 63 |
static void init (void); |
| 64 |
|
| 65 |
|
| 66 |
/* |
| 67 |
wrapRemoveFiles - call removeFiles and return 0. |
| 68 |
*/ |
| 69 |
|
| 70 |
static int wrapRemoveFiles (void) |
| 71 |
{ |
| 72 |
mcStream_removeFiles (); |
| 73 |
return 0; |
| 74 |
/* static analysis guarentees a RETURN statement will be used before here. */ |
| 75 |
__builtin_unreachable (); |
| 76 |
} |
| 77 |
|
| 78 |
|
| 79 |
/* |
| 80 |
init - translate the source file after handling all the |
| 81 |
program arguments. |
| 82 |
*/ |
| 83 |
|
| 84 |
static void init (void) |
| 85 |
{ |
| 86 |
if ((libc_atexit ((libc_exitP_C) wrapRemoveFiles)) != 0) |
| 87 |
{ |
| 88 |
libc_perror ((const char *) "atexit failed", 13); |
| 89 |
} |
| 90 |
M2RTS_ExitOnHalt (1); |
| 91 |
mcComp_compile (mcOptions_handleOptions ()); |
| 92 |
} |
| 93 |
|
| 94 |
extern "C" void _M2_top_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[]) |
| 95 |
{ |
| 96 |
init (); |
| 97 |
} |
| 98 |
|
| 99 |
extern "C" void _M2_top_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[]) |
| 100 |
{ |
| 101 |
} |