FROM Storage IMPORT ALLOCATE ;
FROM M2RTS IMPORT Halt ;
-FROM libc IMPORT printf, memcpy, memcpy, memset ;
+FROM libc IMPORT printf, memcpy, memset ;
CONST
VAR
initMain,
- initGTh : BOOLEAN ;
+ initGTh : BOOLEAN ;
(*
FROM ASCII IMPORT nul, lf, cr ;
-FROM ChanConsts IMPORT OpenResults, ChanFlags ;
+FROM ChanConsts IMPORT ChanFlags ;
FROM RTio IMPORT GetDeviceId ;
FROM RTgenif IMPORT GenDevIF, InitGenDevIF ;
FROM RTdata IMPORT ModuleId, MakeModuleId, InitData, GetData, KillData ;
IMPLEMENTATION MODULE IOChan ;
-IMPORT FIO, EXCEPTIONS, M2EXCEPTION, RTio, IOConsts,
+IMPORT FIO, EXCEPTIONS, M2EXCEPTION, RTio,
RTentity, errno, ErrnoCategory, IOLink, StdChans, M2RTS ;
FROM EXCEPTIONS IMPORT ExceptionSource, RAISE, AllocateSource,
IMPLEMENTATION MODULE IOLink ;
-IMPORT RTio, RTentity, EXCEPTIONS, IOChan, M2RTS, SYSTEM, ASCII ;
+IMPORT RTio, RTentity, EXCEPTIONS, M2RTS, ASCII ;
FROM Storage IMPORT ALLOCATE, DEALLOCATE ;
IMPLEMENTATION MODULE IOResult ;
-IMPORT IOChan ;
PROCEDURE ReadResult (cid: IOChan.ChanId): ReadResults;
(* Returns the result for the last read operation on the channel cid. *)
*)
FROM TextIO IMPORT WriteChar, ReadChar ;
-FROM StringChan IMPORT writeString ;
+FROM StringChan IMPORT writeString, writeFieldWidth ;
FROM IOChan IMPORT SetReadResult ;
FROM IOConsts IMPORT ReadResults ;
RealToEngString ;
FROM ConvTypes IMPORT ScanClass, ScanState ;
-FROM TextIO IMPORT WriteChar, ReadChar ;
FROM DynamicStrings IMPORT String, char, KillString, Length, InitString, ConCatChar, string ;
FROM LongConv IMPORT ScanReal ;
-FROM StringChan IMPORT writeString, writeFieldWidth ;
FROM ldtoa IMPORT strtold ;
FROM TextUtil IMPORT SkipSpaces ;
type IOConsts.ReadResults.
*)
-IMPORT IOChan;
-
(* The text form of a signed whole number is
["+" | "-"], decimal digit, {decimal digit}
(* FROM Builtins IMPORT strncmp, strcmp ; not available during bootstrap. *)
FROM NumberIO IMPORT CardToStr ;
FROM StrLib IMPORT StrCopy, StrLen, StrEqual ;
-FROM SYSTEM IMPORT ADDRESS, ADR ;
+FROM SYSTEM IMPORT ADR ;
FROM ASCII IMPORT nl, nul ;
FROM Storage IMPORT ALLOCATE ;
FROM FIO IMPORT File ;
FROM IOConsts IMPORT ReadResults ;
FROM ChanConsts IMPORT readFlag, writeFlag ;
-FROM SYSTEM IMPORT ADDRESS, ADR ;
+FROM SYSTEM IMPORT ADR ;
FROM ASCII IMPORT nl, nul ;
FROM Storage IMPORT ALLOCATE, DEALLOCATE, REALLOCATE ;
FROM libc IMPORT printf ;
IMPLEMENTATION MODULE RTdata ;
-FROM IOLink IMPORT DeviceTablePtr, RAISEdevException ;
+FROM IOLink IMPORT RAISEdevException ;
FROM RTentity IMPORT Group, InitGroup, PutKey, IsIn, DelKey ;
FROM Storage IMPORT ALLOCATE, DEALLOCATE ;
IMPLEMENTATION MODULE RTfio ;
-FROM IOLink IMPORT DeviceTablePtr ;
FROM RTio IMPORT GetFile ;
FROM errno IMPORT geterrno ;
-FROM FIO IMPORT File, ReadChar, UnReadChar, WriteChar, ReadNBytes, WriteNBytes, IsActive,
+FROM FIO IMPORT File, ReadChar, UnReadChar, WriteChar, ReadNBytes,
+ WriteNBytes, IsActive,
WriteLine, EOF, WasEOLN, IsNoError ;
(*
- dowbytes -
+ dowbytes -
*)
PROCEDURE dowbytes (g: GenDevIF; d: DeviceTablePtr;
FROM IOChan IMPORT ChanId, InvalidChan, ChanExceptions ;
-FROM IOLink IMPORT DeviceTablePtr, DeviceTablePtrValue,
+FROM IOLink IMPORT DeviceTablePtrValue,
RAISEdevException ;
IMPORT ChanConsts ;
IMPORT ErrnoCategory ;
IMPORT RTgen ;
-FROM RTgenif IMPORT GenDevIF, getDID,
+FROM RTgenif IMPORT getDID,
doReadChar, doUnReadChar, doGetErrno,
- doRBytes, doWBytes,
- doWBytes, doWrLn,
+ doRBytes, doWBytes, doWrLn,
isEOF, isError, isEOLN ;
FROM ChanConsts IMPORT FlagSet, readFlag, writeFlag, rawFlag,
*)
FROM TextIO IMPORT WriteChar, ReadChar ;
-FROM StringChan IMPORT writeString ;
+FROM StringChan IMPORT writeString, writeFieldWidth ;
FROM IOChan IMPORT SetReadResult ;
FROM IOConsts IMPORT ReadResults ;
RealToEngString ;
FROM ConvTypes IMPORT ScanClass, ScanState ;
-FROM TextIO IMPORT WriteChar, ReadChar ;
FROM DynamicStrings IMPORT String, char, KillString, Length, InitString, ConCatChar, string ;
FROM RealConv IMPORT ScanReal ;
-FROM StringChan IMPORT writeString, writeFieldWidth ;
FROM dtoa IMPORT strtod ;
FROM TextUtil IMPORT SkipSpaces ;
AllocateSource, ExceptionSource, IsCurrentSource,
IsExceptionalExecution ;
-IMPORT FIO, SYSTEM, RTio, errno, ErrnoCategory ;
+IMPORT FIO, RTio, errno, ErrnoCategory ;
VAR
IMPLEMENTATION MODULE SYSTEM ;
-FROM libc IMPORT memcpy, memcpy, memset ;
+FROM libc IMPORT memcpy, memset ;
CONST
BitsPerBitset = MAX(BITSET)+1 ;
type IOConsts.ReadResults.
*)
-IMPORT IOChan;
-
(* The text form of a signed whole number is
["+" | "-"], decimal digit, {decimal digit}
IMPLEMENTATION MODULE TextIO ;
-IMPORT IOChan, IOConsts, CharClass, ASCII ;
+IMPORT IOConsts, CharClass, ASCII ;
FROM SYSTEM IMPORT ADR ;
FROM FIO IMPORT FlushOutErr ;
FROM libc IMPORT printf ;
IMPLEMENTATION MODULE TextUtil ;
-IMPORT IOChan, CharClass, IOConsts ;
+IMPORT CharClass, IOConsts ;
(*
SkipSpaces - skips any spaces.
type IOConsts.ReadResults.
*)
-IMPORT IOChan ;
(* The text form of a signed whole number is
["+" | "-"], decimal digit, {decimal digit}
IMPLEMENTATION MODULE BitByteOps ;
-FROM SYSTEM IMPORT BYTE, ADR, SHIFT, ROTATE, TSIZE, BITSET8, CARDINAL8 ;
+FROM SYSTEM IMPORT ADR, SHIFT, ROTATE, TSIZE, BITSET8, CARDINAL8 ;
(*
FROM M2RTS IMPORT InstallTerminationProcedure ;
FROM Storage IMPORT ALLOCATE ;
-FROM SYSTEM IMPORT WORD, BYTE, ADDRESS, ADR ;
-IMPORT FIO, SFIO, libc, wrapc ;
-FROM DynamicStrings IMPORT String, InitString, ConCat, ConCatChar, KillString, string ;
+FROM SYSTEM IMPORT ADR ;
+IMPORT SFIO, libc, wrapc ;
+FROM DynamicStrings IMPORT InitString, ConCat, ConCatChar, KillString, string ;
FROM FormatStrings IMPORT Sprintf2 ;
CONST
IMPORT FIO, SFIO, Terminal ;
FROM FIO IMPORT File, StdIn, StdOut ;
-FROM DynamicStrings IMPORT String, InitString, Mark, KillString, ConCat,
+FROM DynamicStrings IMPORT InitString, Mark, KillString, ConCat,
RemoveWhitePrefix, char, ConCatChar, Length ;
FROM StringConvert IMPORT CardinalToString, stoc, stoi, ctos, itos ;
InitStringCharDB, MultDB, DupDB, SliceDB ;
FROM StringConvert IMPORT LongrealToString, StringToLongreal,
- StringToLongreal, StringToInteger, itos ;
+ StringToInteger, itos ;
FROM ASCII IMPORT nul ;
FROM Builtins IMPORT logl, log10l ;
provides a simple buffered file input/output library.
*)
-FROM SYSTEM IMPORT ADR, TSIZE, SIZE, WORD ;
+FROM SYSTEM IMPORT ADR, TSIZE, WORD ;
FROM ASCII IMPORT nl, nul, tab ;
FROM StrLib IMPORT StrLen, StrConCat, StrCopy ;
FROM Storage IMPORT ALLOCATE, DEALLOCATE ;
IMPLEMENTATION MODULE FormatStrings ;
-FROM DynamicStrings IMPORT String, InitString, InitStringChar, Mark,
+FROM DynamicStrings IMPORT InitString, InitStringChar, Mark,
ConCat, Slice, Index, char, string,
Assign, Length, Mult, Dup, ConCatChar,
PushAllocation, PopAllocationExemption,
InitStringDB, InitStringCharStarDB,
InitStringCharDB, MultDB, DupDB, SliceDB,
- KillString, ConCatChar ;
+ KillString ;
FROM StringConvert IMPORT IntegerToString, CardinalToString, hstoc ;
FROM SYSTEM IMPORT ADDRESS ;
FROM StrLib IMPORT StrCopy ;
-FROM SYSTEM IMPORT ADR, SIZE ;
+FROM SYSTEM IMPORT ADR ;
FROM libc IMPORT read, write, system, isatty ;
FROM FIO IMPORT File, StdIn, StdOut, StdErr, WriteChar, ReadChar,
FROM libc IMPORT memset, memmove ;
FROM Storage IMPORT ALLOCATE, REALLOCATE, DEALLOCATE ;
-FROM SYSTEM IMPORT TSIZE, ADDRESS, WORD, BYTE ;
+FROM SYSTEM IMPORT TSIZE, WORD, BYTE ;
CONST
MinSize = 128 ;
FROM libc IMPORT abort, exit, write, getenv, printf, snprintf, strncpy ;
FROM ASCII IMPORT nul, nl ;
-FROM SYSTEM IMPORT ADR, SIZE ;
+FROM SYSTEM IMPORT ADR ;
FROM Storage IMPORT ALLOCATE ;
FROM StrLib IMPORT StrCopy, StrLen, StrEqual ;
(* FROM Builtins IMPORT strncmp, strcmp ; not available during bootstrap. *)
FROM NumberIO IMPORT CardToStr ;
FROM StrLib IMPORT StrCopy, StrLen, StrEqual ;
-FROM SYSTEM IMPORT ADDRESS, ADR ;
+FROM SYSTEM IMPORT ADR ;
FROM ASCII IMPORT nl, nul ;
FROM Storage IMPORT ALLOCATE ;
FROM Storage IMPORT ALLOCATE, DEALLOCATE ;
FROM libc IMPORT memcpy ;
-FROM DynamicStrings IMPORT String ;
IMPORT DynamicStrings ;
IMPLEMENTATION MODULE SYSTEM ;
-FROM libc IMPORT memcpy, memcpy, memset ;
+FROM libc IMPORT memcpy, memset ;
CONST
BitsPerBitset = MAX(BITSET)+1 ;
IMPORT DynamicStrings ;
-FROM DynamicStrings IMPORT String, InitString,
+FROM DynamicStrings IMPORT InitString,
InitStringChar, InitStringCharStar,
Mark, ConCat, Dup, string,
Slice, Index, char, Assign, Length, Mult,
--- /dev/null
+MODULE hello;
+
+FROM STextIO IMPORT WriteString, WriteLn ;
+
+BEGIN
+ WriteString ("Hello world") ;
+ WriteLn
+END hello.
--- /dev/null
+# Copyright (C) 2003-2023 Free Software Foundation, Inc.
+
+# This program 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 of the License, or
+# (at your option) any later version.
+#
+# This program 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 GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# This file was written by Gaius Mulley (gaius.mulley@southwales.ac.uk)
+# for GNU Modula-2.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+# load support procs
+load_lib gm2-torture.exp
+
+set gm2src ${srcdir}/../m2
+
+gm2_init_iso "${srcdir}/gm2/switches/pedantic/pass" -Wpedantic -Werror
+
+foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] {
+ # If we're only testing specific files and this isn't one of them, skip it.
+ if ![runtest_file_p $runtests $testcase] then {
+ continue
+ }
+
+ gm2-torture-execute $testcase "" "pass"
+}
libm2iso_la_M2FLAGS = \
-fm2-pathname=m2iso -I. -Ilibm2iso -I$(GM2_SRC)/gm2-libs-iso \
-fm2-pathname=m2pim -I$(GM2_SRC)/gm2-libs \
- -fiso -fextended-opaque -fm2-g -g -Wcase-enum -Wreturn-type -fcase -fm2-prefix=m2iso \
+ -fiso -fextended-opaque -fm2-g -g -Wcase-enum \
+ -Wreturn-type -fcase -fm2-prefix=m2iso \
$(TARGET_LONGDOUBLE_ABI)
if TARGET_DARWIN
libm2iso_la_link_flags = -Wl,-undefined,dynamic_lookup
@BUILD_ISOLIB_TRUE@libm2iso_la_M2FLAGS = \
@BUILD_ISOLIB_TRUE@ -fm2-pathname=m2iso -I. -Ilibm2iso -I$(GM2_SRC)/gm2-libs-iso \
@BUILD_ISOLIB_TRUE@ -fm2-pathname=m2pim -I$(GM2_SRC)/gm2-libs \
-@BUILD_ISOLIB_TRUE@ -fiso -fextended-opaque -fm2-g -g -Wcase-enum -Wreturn-type -fcase -fm2-prefix=m2iso \
+@BUILD_ISOLIB_TRUE@ -fiso -fextended-opaque -fm2-g -g -Wcase-enum \
+@BUILD_ISOLIB_TRUE@ -Wreturn-type -fcase -fm2-prefix=m2iso \
@BUILD_ISOLIB_TRUE@ $(TARGET_LONGDOUBLE_ABI)
@BUILD_ISOLIB_TRUE@@TARGET_DARWIN_FALSE@libm2iso_la_link_flags = \
-fm2-pathname=m2log -I$(GM2_SRC)/gm2-libs-log \
-fm2-pathname=m2pim -I$(GM2_SRC)/gm2-libs \
-fm2-pathname=m2iso -I$(GM2_SRC)/gm2-libs-iso \
- -Wcase-enum -Wreturn-type -fcase -fm2-prefix=m2log \
+ -Wcase-enum -Wreturn-type \
+ -fcase -fm2-prefix=m2log \
$(TARGET_LONGDOUBLE_ABI)
if TARGET_DARWIN
libm2log_la_link_flags = -Wl,-undefined,dynamic_lookup
@BUILD_LOGLIB_TRUE@ -fm2-pathname=m2log -I$(GM2_SRC)/gm2-libs-log \
@BUILD_LOGLIB_TRUE@ -fm2-pathname=m2pim -I$(GM2_SRC)/gm2-libs \
@BUILD_LOGLIB_TRUE@ -fm2-pathname=m2iso -I$(GM2_SRC)/gm2-libs-iso \
-@BUILD_LOGLIB_TRUE@ -Wcase-enum -Wreturn-type -fcase -fm2-prefix=m2log \
+@BUILD_LOGLIB_TRUE@ -Wcase-enum -Wreturn-type \
+@BUILD_LOGLIB_TRUE@ -fcase -fm2-prefix=m2log \
@BUILD_LOGLIB_TRUE@ $(TARGET_LONGDOUBLE_ABI)
@BUILD_LOGLIB_TRUE@@TARGET_DARWIN_FALSE@libm2log_la_link_flags = \
libm2pim_la_M2FLAGS = \
-fm2-pathname=m2pim -I. -I$(GM2_SRC)/gm2-libs \
-fm2-pathname=m2iso -I$(GM2_SRC)/gm2-libs-iso \
- -fm2-g -g -Wcase-enum -Wreturn-type -fcase -fm2-prefix=m2pim \
+ -fm2-g -g -Wcase-enum -Wreturn-type \
+ -fcase -fm2-prefix=m2pim \
$(TARGET_LONGDOUBLE_ABI)
if TARGET_DARWIN
libm2pim_la_link_flags = -Wl,-undefined,dynamic_lookup
@BUILD_PIMLIB_TRUE@libm2pim_la_M2FLAGS = \
@BUILD_PIMLIB_TRUE@ -fm2-pathname=m2pim -I. -I$(GM2_SRC)/gm2-libs \
@BUILD_PIMLIB_TRUE@ -fm2-pathname=m2iso -I$(GM2_SRC)/gm2-libs-iso \
-@BUILD_PIMLIB_TRUE@ -fm2-g -g -Wcase-enum -Wreturn-type -fcase -fm2-prefix=m2pim \
+@BUILD_PIMLIB_TRUE@ -fm2-g -g -Wcase-enum -Wreturn-type \
+@BUILD_PIMLIB_TRUE@ -fcase -fm2-prefix=m2pim \
@BUILD_PIMLIB_TRUE@ $(TARGET_LONGDOUBLE_ABI)
@BUILD_PIMLIB_TRUE@@TARGET_DARWIN_FALSE@libm2pim_la_link_flags = \