aboutsummaryrefslogtreecommitdiff
path: root/gcc/m2/gm2-libs-iso
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/m2/gm2-libs-iso')
-rw-r--r--gcc/m2/gm2-libs-iso/M2RTS.def9
-rw-r--r--gcc/m2/gm2-libs-iso/M2RTS.mod20
-rw-r--r--gcc/m2/gm2-libs-iso/wrapsock.c260
-rw-r--r--gcc/m2/gm2-libs-iso/wraptime.c292
4 files changed, 17 insertions, 564 deletions
diff --git a/gcc/m2/gm2-libs-iso/M2RTS.def b/gcc/m2/gm2-libs-iso/M2RTS.def
index cca4ae6..343dab7 100644
--- a/gcc/m2/gm2-libs-iso/M2RTS.def
+++ b/gcc/m2/gm2-libs-iso/M2RTS.def
@@ -33,10 +33,10 @@ TYPE
ArgCVEnvP = PROCEDURE (INTEGER, ADDRESS, ADDRESS) ;
-PROCEDURE ConstructModules (applicationmodule: ADDRESS;
+PROCEDURE ConstructModules (applicationmodule, libname: ADDRESS;
argc: INTEGER; argv, envp: ADDRESS) ;
-PROCEDURE DeconstructModules (applicationmodule: ADDRESS;
+PROCEDURE DeconstructModules (applicationmodule, libname: ADDRESS;
argc: INTEGER; argv, envp: ADDRESS) ;
@@ -46,7 +46,7 @@ PROCEDURE DeconstructModules (applicationmodule: ADDRESS;
explored to determine initialization order.
*)
-PROCEDURE RegisterModule (name: ADDRESS;
+PROCEDURE RegisterModule (name, libname: ADDRESS;
init, fini: ArgCVEnvP;
dependencies: PROC) ;
@@ -56,7 +56,8 @@ PROCEDURE RegisterModule (name: ADDRESS;
module dependantmodule.
*)
-PROCEDURE RequestDependant (modulename, dependantmodule: ADDRESS) ;
+PROCEDURE RequestDependant (modulename, libname,
+ dependantmodule, dependantlibname: ADDRESS) ;
(*
diff --git a/gcc/m2/gm2-libs-iso/M2RTS.mod b/gcc/m2/gm2-libs-iso/M2RTS.mod
index cbe70a9..a59735a 100644
--- a/gcc/m2/gm2-libs-iso/M2RTS.mod
+++ b/gcc/m2/gm2-libs-iso/M2RTS.mod
@@ -71,10 +71,11 @@ VAR
module constructor in turn.
*)
-PROCEDURE ConstructModules (applicationmodule: ADDRESS;
+PROCEDURE ConstructModules (applicationmodule, libname: ADDRESS;
argc: INTEGER; argv, envp: ADDRESS) ;
BEGIN
- M2Dependent.ConstructModules (applicationmodule, argc, argv, envp)
+ M2Dependent.ConstructModules (applicationmodule, libname,
+ argc, argv, envp)
END ConstructModules ;
@@ -83,10 +84,11 @@ END ConstructModules ;
module constructor in turn.
*)
-PROCEDURE DeconstructModules (applicationmodule: ADDRESS;
+PROCEDURE DeconstructModules (applicationmodule, libname: ADDRESS;
argc: INTEGER; argv, envp: ADDRESS) ;
BEGIN
- M2Dependent.DeconstructModules (applicationmodule, argc, argv, envp)
+ M2Dependent.DeconstructModules (applicationmodule, libname,
+ argc, argv, envp)
END DeconstructModules ;
@@ -96,11 +98,11 @@ END DeconstructModules ;
explored to determine initialization order.
*)
-PROCEDURE RegisterModule (name: ADDRESS;
+PROCEDURE RegisterModule (name, libname: ADDRESS;
init, fini: ArgCVEnvP;
dependencies: PROC) ;
BEGIN
- M2Dependent.RegisterModule (name, init, fini, dependencies)
+ M2Dependent.RegisterModule (name, libname, init, fini, dependencies)
END RegisterModule ;
@@ -109,9 +111,11 @@ END RegisterModule ;
module dependantmodule.
*)
-PROCEDURE RequestDependant (modulename, dependantmodule: ADDRESS) ;
+PROCEDURE RequestDependant (modulename, libname,
+ dependantmodule, dependantlibname: ADDRESS) ;
BEGIN
- M2Dependent.RequestDependant (modulename, dependantmodule)
+ M2Dependent.RequestDependant (modulename, libname,
+ dependantmodule, dependantlibname)
END RequestDependant ;
diff --git a/gcc/m2/gm2-libs-iso/wrapsock.c b/gcc/m2/gm2-libs-iso/wrapsock.c
deleted file mode 100644
index 6d032ee..0000000
--- a/gcc/m2/gm2-libs-iso/wrapsock.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/* wrapsock.c implements access to low level client socket primitives.
-
-Copyright (C) 2008-2023 Free Software Foundation, Inc.
-Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
-
-This file is part of GNU Modula-2.
-
-GNU Modula-2 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.
-
-GNU Modula-2 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/>. */
-
-#include <p2c/p2c.h>
-
-#if defined(HAVE_SYS_TYPES_H)
-# include <sys/types.h>
-#endif
-
-#if defined(HAVE_SYS_SOCKET_H)
-# include <sys/socket.h>
-#endif
-
-#include <netinet/in.h>
-#include <netdb.h>
-
-#if defined(HAVE_UNISTD_H)
-# include <unistd.h>
-#endif
-
-#if defined(HAVE_SIGNAL_H)
-# include <signal.h>
-#endif
-
-#if defined(HAVE_SYS_ERRNO_H)
-# include <sys/errno.h>
-#endif
-
-#if defined(HAVE_ERRNO_H)
-# include <errno.h>
-#endif
-
-#if defined(HAVE_MALLOC_H)
-# include <malloc.h>
-#endif
-
-#if defined(HAVE_SIGNAL_H)
-# include <signal.h>
-#endif
-
-#if defined(HAVE_STRING_H)
-# include <string.h>
-#endif
-
-#if defined(HAVE_STDLIB_H)
-# include <stdlib.h>
-#endif
-
-#if !defined(TRUE)
-# define TRUE (1==1)
-#endif
-#if !defined(FALSE)
-# define FALSE (1==0)
-#endif
-
-#include "ChanConsts.h"
-
-#define MAXHOSTNAME 1024
-#define MAXPBBUF 1024
-
-
-typedef struct {
- char hostname[MAXHOSTNAME];
- struct hostent *hp;
- struct sockaddr_in sa;
- int sockFd;
- int portNo;
- int hasChar;
- char pbChar[MAXPBBUF];
-} clientInfo;
-
-static openResults clientConnect (clientInfo *c);
-
-
-/*
- * clientOpen - returns an ISO Modula-2 OpenResult.
- * It attempts to connect to: hostname:portNo.
- * If successful then the data structure, c,
- * will have its fields initialized.
- */
-
-openResults wrapsock_clientOpen (clientInfo *c, char *hostname,
- unsigned int length, int portNo)
-{
- /* remove SIGPIPE which is raised on the server if the client is killed */
- signal(SIGPIPE, SIG_IGN);
-
- c->hp = gethostbyname(hostname);
- if (c->hp == NULL)
- return noSuchFile;
-
- memset((void *)&c->sa, 0, sizeof(c->sa));
- c->sa.sin_family = AF_INET;
- memcpy((void *)&c->sa.sin_addr, (void *)c->hp->h_addr, c->hp->h_length);
- c->portNo = portNo;
- c->sa.sin_port = htons(portNo);
- c->hasChar = 0;
- /*
- * Open a TCP socket (an Internet stream socket)
- */
-
- c->sockFd = socket(c->hp->h_addrtype, SOCK_STREAM, 0);
- return clientConnect(c);
-}
-
-/*
- * clientOpenIP - returns an ISO Modula-2 OpenResult.
- * It attempts to connect to: ipaddress:portNo.
- * If successful then the data structure, c,
- * will have its fields initialized.
- */
-
-openResults wrapsock_clientOpenIP (clientInfo *c, unsigned int ip, int portNo)
-{
- /* remove SIGPIPE which is raised on the server if the client is killed */
- signal(SIGPIPE, SIG_IGN);
-
- memset((void *)&c->sa, 0, sizeof(c->sa));
- c->sa.sin_family = AF_INET;
- memcpy((void *)&c->sa.sin_addr, (void *)&ip, sizeof(ip));
- c->portNo = portNo;
- c->sa.sin_port = htons(portNo);
-
- /*
- * Open a TCP socket (an Internet stream socket)
- */
-
- c->sockFd = socket(PF_INET, SOCK_STREAM, 0);
- return clientConnect(c);
-}
-
-/*
- * clientConnect - returns an ISO Modula-2 OpenResult
- * once a connect has been performed.
- * If successful the clientInfo will
- * include the file descriptor ready
- * for read/write operations.
- */
-
-static openResults clientConnect (clientInfo *c)
-{
- if (connect(c->sockFd, (struct sockaddr *)&c->sa, sizeof(c->sa)) < 0)
- return noSuchFile;
-
- return opened;
-}
-
-/*
- * getClientPortNo - returns the portNo from structure, c.
- */
-
-int wrapsock_getClientPortNo (clientInfo *c)
-{
- return c->portNo;
-}
-
-/*
- * getClientHostname - fills in the hostname of the server
- * the to which the client is connecting.
- */
-
-void wrapsock_getClientHostname (clientInfo *c,
- char *hostname, unsigned int high)
-{
- strncpy(hostname, c->hostname, high+1);
-}
-
-/*
- * getClientSocketFd - returns the sockFd from structure, c.
- */
-
-int wrapsock_getClientSocketFd (clientInfo *c)
-{
- return c->sockFd;
-}
-
-/*
- * getClientIP - returns the sockFd from structure, s.
- */
-
-unsigned int wrapsock_getClientIP (clientInfo *c)
-{
-#if 0
- printf("client ip = %s\n", inet_ntoa (c->sa.sin_addr.s_addr));
-#endif
- return c->sa.sin_addr.s_addr;
-}
-
-/*
- * getPushBackChar - returns TRUE if a pushed back character
- * is available.
- */
-
-unsigned int wrapsock_getPushBackChar (clientInfo *c, char *ch)
-{
- if (c->hasChar > 0) {
- c->hasChar--;
- *ch = c->pbChar[c->hasChar];
- return TRUE;
- }
- return FALSE;
-}
-
-/*
- * setPushBackChar - returns TRUE if it is able to push back a
- * character.
- */
-
-unsigned int wrapsock_setPushBackChar (clientInfo *c, char ch)
-{
- if (c->hasChar == MAXPBBUF)
- return FALSE;
- c->pbChar[c->hasChar] = ch;
- c->hasChar++;
- return TRUE;
-}
-
-/*
- * getSizeOfClientInfo - returns the sizeof (opaque data type).
- */
-
-unsigned int wrapsock_getSizeOfClientInfo (void)
-{
- return sizeof (clientInfo);
-}
-
-/*
- * GNU Modula-2 link fodder.
- */
-
-void _M2_wrapsock_init (void)
-{
-}
-
-void _M2_wrapsock_finish (void)
-{
-}
diff --git a/gcc/m2/gm2-libs-iso/wraptime.c b/gcc/m2/gm2-libs-iso/wraptime.c
deleted file mode 100644
index dafdb66..0000000
--- a/gcc/m2/gm2-libs-iso/wraptime.c
+++ /dev/null
@@ -1,292 +0,0 @@
-/* wraptime.c provides access to time functions.
-
-Copyright (C) 2009-2023 Free Software Foundation, Inc.
-Contributed by Gaius Mulley <gaius@glam.ac.uk>.
-
-This file is part of GNU Modula-2.
-
-GNU Modula-2 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.
-
-GNU Modula-2 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/>. */
-
-#include "gm2-libs-host.h"
-
-#if defined(HAVE_SYS_TYPES_H)
-# include <sys/types.h>
-#endif
-
-#if defined(HAVE_SYS_TIME_H)
-# include <sys/time.h>
-#endif
-
-#if defined(HAVE_TIME_H)
-# include <time.h>
-#endif
-
-#if defined(HAVE_MALLOC_H)
-# include <malloc.h>
-#endif
-
-#if !defined(TRUE)
-# define TRUE (1==1)
-#endif
-#if !defined(FALSE)
-# define FALSE (1==0)
-#endif
-
-/* InitTimeval returns a newly created opaque type. */
-
-struct timeval *
-wraptime_InitTimeval (void)
-{
-#if defined(HAVE_TIMEVAL)
- return (struct timeval *) malloc (sizeof (struct timeval));
-#else
- return NULL;
-#endif
-}
-
-/* KillTimeval deallocates the memory associated with an
- opaque type. */
-
-struct timeval *
-wraptime_KillTimeval (void *tv)
-{
- free (tv);
- return NULL;
-}
-
-/* InitTimezone returns a newly created opaque type. */
-
-struct timezone *
-wraptime_InitTimezone (void)
-{
- return (struct timezone *) malloc (sizeof (struct timezone));
-}
-
-/* KillTimezone deallocates the memory associated with an
- opaque type. */
-
-struct timezone *
-wraptime_KillTimezone (struct timezone *tv)
-{
- free (tv);
- return NULL;
-}
-
-/* InitTM returns a newly created opaque type. */
-
-struct tm *
-wraptime_InitTM (void)
-{
- return (struct tm *) malloc (sizeof (struct tm));
-}
-
-/* KillTM deallocates the memory associated with an opaque type. */
-
-struct tm *
-wraptime_KillTM (struct tm *tv)
-{
- free (tv);
- return NULL;
-}
-
-/* gettimeofday calls gettimeofday(2) with the same parameters, tv,
- and, tz. It returns 0 on success. */
-
-int
-wraptime_gettimeofday (void *tv, struct timezone *tz)
-{
- return gettimeofday (tv, tz);
-}
-
-/* settimeofday calls settimeofday(2) with the same parameters, tv,
- and, tz. It returns 0 on success. */
-
-int
-wraptime_settimeofday (void *tv, struct timezone *tz)
-{
- return settimeofday (tv, tz);
-}
-
-/* wraptime_GetFractions returns the tv_usec field inside the timeval
- structure. */
-
-#if defined(HAVE_TIMEVAL)
-unsigned int
-wraptime_GetFractions (struct timeval *tv)
-{
- return (unsigned int) tv->tv_usec;
-}
-#else
-unsigned int
-wraptime_GetFractions (void *tv)
-{
- return 0;
-}
-#endif
-
-/* localtime_r returns the tm parameter, m, after it has been assigned
- with appropriate contents determined by, tv. Notice that this
- procedure function expects, timeval, as its first parameter and not
- a time_t (as expected by the posix equivalent). */
-
-#if defined(HAVE_TIMEVAL)
-struct tm *
-wraptime_localtime_r (struct timeval *tv, struct tm *m)
-{
- return localtime_r (&tv->tv_sec, m);
-}
-#else
-struct tm *
-wraptime_localtime_r (void *tv, struct tm *m)
-{
- return m;
-}
-#endif
-
-/* wraptime_GetYear returns the year from the structure, m. */
-
-unsigned int
-wraptime_GetYear (struct tm *m)
-{
- return m->tm_year;
-}
-
-/* wraptime_GetMonth returns the month from the structure, m. */
-
-unsigned int
-wraptime_GetMonth (struct tm *m)
-{
- return m->tm_mon;
-}
-
-/* wraptime_GetDay returns the day of the month from the structure, m. */
-
-unsigned int
-wraptime_GetDay (struct tm *m)
-{
- return m->tm_mday;
-}
-
-/* wraptime_GetHour returns the hour of the day from the structure, m. */
-
-unsigned int
-wraptime_GetHour (struct tm *m)
-{
- return m->tm_hour;
-}
-
-/* wraptime_GetMinute returns the minute within the hour from the structure, m. */
-
-unsigned int
-wraptime_GetMinute (struct tm *m)
-{
- return m->tm_min;
-}
-
-/* wraptime_GetSecond returns the seconds in the minute from the
- structure, m. The return value will always be in the range 0..59.
- A leap minute of value 60 will be truncated to 59. */
-
-unsigned int
-wraptime_GetSecond (struct tm *m)
-{
- if (m->tm_sec == 60)
- return 59;
- else
- return m->tm_sec;
-}
-
-/* wraptime_GetSummerTime returns true if summer time is in effect. */
-
-unsigned int
-wraptime_GetSummerTime (struct timezone *tz)
-{
- return tz->tz_dsttime != 0;
-}
-
-/* wraptime_GetDST returns the number of minutes west of GMT. */
-
-int
-wraptime_GetDST (struct timezone *tz)
-{
- return tz->tz_minuteswest;
-}
-
-/* SetTimezone set the timezone field inside timeval, tv. */
-
-void
-wraptime_SetTimezone (struct timezone *tz,
- int zone, int minuteswest)
-{
- tz->tz_dsttime = zone;
- tz->tz_minuteswest = minuteswest;
-}
-
-/* SetTimeval sets the fields in tm, t, with:
- second, minute, hour, day, month, year, fractions. */
-
-#if defined(HAVE_TIMEVAL)
-void
-wraptime_SetTimeval (struct tm *t,
- unsigned int second,
- unsigned int minute,
- unsigned int hour,
- unsigned int day,
- unsigned int month,
- unsigned int year,
- unsigned int yday,
- unsigned int wday,
- unsigned int isdst)
-{
- t->tm_sec = second;
- t->tm_min = minute;
- t->tm_hour = hour;
- t->tm_mday = day;
- t->tm_mon = month;
- t->tm_year = year;
- t->tm_yday = yday;
- t->tm_wday = wday;
- t->tm_isdst = isdst;
-}
-#else
-wraptime_SetTimeval (void *t,
- unsigned int second,
- unsigned int minute,
- unsigned int hour,
- unsigned int day,
- unsigned int month,
- unsigned int year,
- unsigned int yday,
- unsigned int wday,
- unsigned int isdst)
-{
- return t;
-}
-#endif
-
-/* init/finish functions for the module. */
-
-void
-_M2_wraptime_init ()
-{}
-
-void
-_M2_wraptime_finish ()
-{}