|
|
|
m2f-3.8/ 40755 144 144 0 6743317762 10476 5 ustar gaius users m2f-3.8/make.rules 100644 144 144 12467 6743317762 12616 0 ustar gaius users SHELL = /bin/bash
#
# set variables if this is the first time make is called.
#
ifeq (0,${MAKELEVEL})
ARCH := $(strip $(shell arch))
MACHINE := $(strip $(shell hostname --short))
CURDIR := $(strip $(shell pwd))
ifeq (i686,${ARCH})
ARCH = i386
endif
ifeq (i586,${ARCH})
ARCH = i386
endif
ifeq (i486,${ARCH})
ARCH = i386
endif
ifeq (i386,${ARCH})
DD = edd
TAPE = tape
FD = fd0
else
DD = dd
TAPE = rst8
FD = rfd0c
endif
ifeq (merlin,${MACHINE})
FD = hdc
endif
ifeq (floppsie,${MACHINE})
FD = hdc
endif
DISKSPACE = large # large >= 50 Mb spare ; tight >= 10 Mb
SOURCEDIR := $(HOME)/RELEASE
BINDIR := $(CURDIR)/$(LOCALROOT)/bin
BINDIR1 := $(CURDIR)/$(LOCALROOT)/bin1
BINDIR2 := $(CURDIR)/$(LOCALROOT)/bin2
BINDIR3 := $(CURDIR)/$(LOCALROOT)/bin3
BINDIR4 := $(CURDIR)/$(LOCALROOT)/bin4
INCFILE := $(CURDIR)/$(LOCALROOT)tools/incfile
MAKEVERSION := $(CURDIR)/$(LOCALROOT)tools/makeversion
MAKECONFIGURE := $(CURDIR)/$(LOCALROOT)tools/makeconfigure
STAGEFILE := $(CURDIR)/$(LOCALROOT).stage
MAJORFILE := $(CURDIR)/$(LOCALROOT).major
MINORFILE := $(CURDIR)/$(LOCALROOT).minor
ARCHIVEFILE := $(CURDIR)/$(LOCALROOT).archive
RELEASEROOT = /usr/m2
PUBLICBIN = /usr/bin
LN = ln -s
COPY = cp
RM = /bin/rm -f
MV = mv
CC = gcc
P2C := $(BINDIR)/p2c
P2CDIR := $(CURDIR)/$(LOCALROOT)/p2c/home
PRE := $(BINDIR)/mkfor
M2LINK := $(BINDIR)/mklink
GM2_1 := $(BINDIR1)/m2f
M2M_1 := $(BINDIR1)/m2m
GM2_2 := $(BINDIR2)/m2f
M2M_2 := $(BINDIR2)/m2m
GM2_3 := $(BINDIR3)/m2f
M2M_3 := $(BINDIR3)/m2m
GM2_4 := $(BINDIR4)/m2f
M2M_4 := $(BINDIR4)/m2m
TARGETCODEGEN = 386gas
PUSH = LEFTTORIGHT # RIGHTTOLEFT # or LEFTTORIGHT
C_VERSION =
DEBUG = -g
CFLAGS = $(DEBUG) -DITERATIVE $(C_VERSION) -O
CFLAGS4 = $(DEBUG) -DITERATIVE $(C_VERSION) -O -O2
LDFLAGS = $(DEBUG) $(C_VERSION)
TIMINGS = 586
PROFILE1 =
PROFILE2 =
M2FLAGS = $(DEBUG) -verbose -M \"../libs ../gm2s\" -quiet $(PROFILE2)
M2FLAGS2 += $(M2FLAGS) -O # -O # -Odynamic
M2FLAGS3 += $(M2FLAGS) -O # -Odynamic # -bounds -return
M2FLAGS4 += $(M2FLAGS) -O -Odynamic # -Oi586 -O2 # -bounds
M2VERIFYFLAGS = $(M2FLAGS)
M2DYNAMICFLAGS = -O #-Odynamic -Oi586
MAKE := ${MAKE} "ARCH=${ARCH}" \
"CURDIR=${CURDIR}" \
"PUSH=${PUSH}" \
"PROFILE1=${PROFILE1}" \
"PROFILE2=${PROFILE2}" \
"DD=${DD}" \
"TAPE=${TAPE}" \
"FD=${FD}" \
"DEBUG=${DEBUG}" \
"DISKSPACE=${DISKSPACE}" \
"SOURCEDIR=${SOURCEDIR}" \
"BINDIR=${BINDIR}" \
"BINDIR1=${BINDIR1}" \
"BINDIR2=${BINDIR2}" \
"BINDIR3=${BINDIR3}" \
"BINDIR4=${BINDIR4}" \
"INCFILE=${INCFILE}" \
"MAKEVERSION=${MAKEVERSION}" \
"MAKECONFIGURE=${MAKECONFIGURE}" \
"STAGEFILE=${STAGEFILE}" \
"MAJORFILE=${MAJORFILE}" \
"MINORFILE=${MINORFILE}" \
"ARCHIVEFILE=${ARCHIVEFILE}" \
"RELEASEROOT=${RELEASEROOT}" \
"PUBLICBIN=${PUBLICBIN}" \
"LN=${LN}" \
"COPY=${COPY}" \
"RM=${RM}" \
"MV=${MV}" \
"CC=${CC}" \
"P2C=${P2C}" \
"P2CDIR=${P2CDIR}" \
"PRE=${PRE}" \
"M2LINK=${M2LINK}" \
"GM2_1=${GM2_1}" \
"M2M_1=${M2M_1}" \
"GM2_2=${GM2_2}" \
"M2M_2=${M2M_2}" \
"GM2_3=${GM2_3}" \
"M2M_3=${M2M_3}" \
"GM2_4=${GM2_4}" \
"M2M_4=${M2M_4}" \
"TARGETCODEGEN=${TARGETCODEGEN}" \
"M2FLAGS=${M2FLAGS}" \
"M2FLAGS2=${M2FLAGS2}" \
"M2FLAGS3=${M2FLAGS3}" \
"M2FLAGS4=${M2FLAGS4}" \
"M2VERIFYFLAGS=${M2VERIFYFLAGS}" \
"M2DYNAMICFLAGS=${M2DYNAMICFLAGS}" \
"CFLAGS=${CFLAGS}" \
"CFLAGS4=${CFLAGS4}" \
"LDFLAGS=${LDFLAGS}" \
"TIMINGS=${TIMINGS}"
endif
m2f-3.8/makefile 100644 144 144 33525 6743317762 12323 0 ustar gaius users LOCALROOT = comp/
include make.rules
DIRS = comp make.rules makefile TAG
help: force
@echo "---------------------------------------"
@echo " $@"
@echo "---------------------------------------"
@echo " "
@echo "top level compiler makefile knows about:"
@echo " "
@echo " tape = make a tape archive"
@echo " archive = make an archive locally"
@echo " extract = extract an archive from tape"
@echo " floppyarchive = make an archive on floppy disk"
@echo " floppyextract = extract an archive from floppy disk"
@echo " clean = prune all executables and objects"
@echo " increment = increment the major version no."
@echo " all = build the compiler (all 3 stages)"
@echo " and build all other subdirectories"
@echo " ismene = build the ismene simulator"
@echo " release = release all executables into the RELEASEROOT"
@echo " install = is exactly the same as release"
@echo " regression = run the regression tests"
@echo " binary.release= create a binary release of the compiler"
all: force
@if [ -d comp ] ; then \
( cd comp ; $(MAKE) all ) ; \
fi ; \
export PATH=`pwd`/comp/bin3:$(PATH) ; \
if [ -d comp/autotest ] ; then \
( cd comp/autotest ; make all ) ; \
fi
ismene: force
@if [ -d ismene ] ; then \
( unset MAKELEVEL ; cd ismene ; make all ) ; \
fi
everything: force
@echo "------------------------------------------------------------------------"
@echo "make $@ (only makes sense when using compiler with other packages)"
@echo "------------------------------------------------------------------------"
@( $(MAKE) all )
@if [ -d os ] ; then \
( cd os ; $(MAKE) all ) ; \
fi ; \
if [ -d ismene ] ; then \
( cd ismene ; $(MAKE) all ) ; \
fi ; \
if [ -d games/MorlocTower ] ; then \
( cd games/MorlocTower ; make all ) ; \
fi ; \
regression: force
@if [ ! -x comp/bin3/gm2-i386-gas ] ; then \
echo "$(LOGNAME) you must build the compiler first before testing it" ; \
( cd comp ; $(MAKE) all ) ; \
fi ; \
if [ -x comp/bin3/gm2-i386-gas ] ; then \
echo "--------------------------------------------" ; \
echo " $@" ; \
echo "--------------------------------------------" ; \
export PATH=`pwd`/comp/bin3:$(PATH) ; \
if [ -d comp/autotest ] ; then \
( cd comp/autotest ; $(MAKE) all ) ; \
fi ; \
fi
binary.release: force
@( cd comp ; $(MAKE) binary.release )
install: force
@if [ -d comp ] ; then \
( cd comp ; $(MAKE) install ) ; \
fi
release: force
@if [ -d comp ] ; then \
( cd comp ; $(MAKE) release ) ; \
fi
install.everything: force
@( $(MAKE) install )
@if [ -d os ] ; then \
( cd os ; $(MAKE) install ) ; \
fi
@if [ -d ismene ] ; then \
( cd ismene ; $(MAKE) install ) ; \
fi
release.everything: force
@( $(MAKE) release )
@if [ -d os ] ; then \
( cd os ; $(MAKE) release ) ; \
fi
@if [ -d ismene ] ; then \
( cd ismene ; $(MAKE) release ) ; \
fi
tape: clean archive
@echo "---------------------------------------"
@echo " $@"
@echo "---------------------------------------"
@if [ "$(ARCH)" = "i386" ] ; then \
echo "this should be run as root" ; \
fi
@echo "placing $(DIRS) onto tape"
@if [ "$(TAPE)" = "" ] ; then \
echo "You need to set TAPE in make.rules" ; \
else \
if [ "`ls /dev/$(TAPE)`" != "" ] ; then \
tar cf - m2.tar.gz | $(DD) of=/dev/$(TAPE) bs=16k ; \
$(RM) m2.tar.gz ; \
mt -f /dev/$(TAPE) rewind ; \
echo "Checking to see the archive is intact" ; \
$(DD) if=/dev/$(TAPE) bs=16k | tar xvf - ; \
gzip -t m2.tar.gz ; \
else \
echo "/dev/$(TAPE) does not exist" ; \
echo "edit make.rules" ; \
fi ; \
fi
archive: force
@echo "---------------------------------------"
@echo " $@"
@echo "---------------------------------------"
@if [ -f m2.tar.gz ] ; then \
$(RM) m2.tar.gz- ; \
$(MV) m2.tar.gz m2.tar.gz- ; \
fi ; \
tar cf - $(DIRS) | gzip -9 > m2.tar.gz ; \
gzip -t m2.tar.gz ; \
ls -l m2.tar.gz
floppyarchive: force
@echo "---------------------------------------"
@echo " $@"
@echo "---------------------------------------"
@ans="n" ; \
echo -n "Do you want to make a floppy disk [y/n]? " ; \
read ans ; \
if [ "$$ans" = "y" ] ; then \
cp m2.tar.gz /ls120 ; \
sync ; \
echo "floppy disk made" ; \
else \
echo "archive NOT copied to floppy disk" ; \
fi
floppyextract: force
@echo "---------------------------------------"
@echo " $@"
@echo "---------------------------------------"
@if [ "$(FD)" = "" ] ; then \
echo "You need to set FD in make.rules" ; \
else \
if [ "`ls /dev/$(FD)`" != "" ] ; then \
if [ -f m2.tar.gz ] ; then \
$(MV) m2.tar.gz m2.tar.gz- ; \
fi ; \
if [ -f $(ARCHIVEFILE) ] ; then \
number=`cat $(ARCHIVEFILE)` ; \
else \
number="0" ; \
fi ; \
echo "Harddisk compiler archive: $$number" ; \
$(RM) -r extract ; mkdir extract ; \
cd extract ; \
cp /ls120/m2.tar.gz m2.tar.gz ; \
if gzip -t m2.tar.gz ; then \
gzip -d -c m2.tar.gz | tar xf - comp/.archive ; \
new=`cat comp/.archive` ; \
echo "Floppydisk compiler archive: $$new" ; \
if [ $$number -lt $$new ] ; then \
$(MV) m2.tar.gz .. ; \
cd .. ; \
if [ -d comp- ] ; then \
$(RM) -rf comp- ; \
fi ; \
if [ -d comp ] ; then \
$(MV) comp comp- ; \
fi ; \
gzip -d -c m2.tar.gz | tar xf - ; \
$(INCFILE) $(ARCHIVEFILE) ; \
else \
echo "archive on floppy disk is older than the one on your harddisk!" ; \
cd .. ; \
fi ; \
else \
echo "gzip consistancy check FAILED" ; \
cd .. ; \
fi ; \
else \
echo "/dev/$(FD) does not exist" ; \
echo "edit make.rules" ; \
fi ; \
fi
tapeextract: force
@echo "---------------------------------------"
@echo " $@"
@echo "---------------------------------------"
@if [ "$(ARCH)" = "i386" ] ; then \
echo "this should be run as root" ; \
fi
@if [ "$(TAPE)" = "" ] ; then \
echo "You need to set TAPE in make.rules" ; \
else \
if [ "`ls /dev/$(TAPE)`" != "" ] ; then \
$(RM) m2.tar.gz ; \
$(DD) if=/dev/$(TAPE) bs=16k | tar xvf - ; \
gzip -t m2.tar.gz ; \
gzip -d -c m2.tar.gz | tar tf - ; \
else \
echo "/dev/$(TAPE) does not exist" ; \
echo "edit make.rules" ; \
fi ; \
fi
increment: force
$(INCFILE) $(ARCHIVEFILE)
clean: force
@echo "---------------------------------------"
@echo " $@"
@echo "---------------------------------------"
echo "BINDIR = $(BINDIR)"
@if [ -d comp ] ; then \
( cd comp ; $(MAKE) clean ) ; \
fi
@if [ -d os ] ; then \
( cd os ; make clean ) ; \
fi
@if [ -d ismene ] ; then \
( cd ismene ; make clean ) ; \
fi
@if [ -d games/MorlocTower ] ; then \
( cd games/MorlocTower ; make clean ) ; \
fi
@if [ -d comp/autotest ] ; then \
( cd comp/autotest ; make clean ) ; \
fi
force:
#
# $Log: makefile,v $
# Revision 1.16 1999/01/05 16:08:48 gaius
# minor changes
#
# Revision 1.15 1999/01/05 11:14:30 gaius
# added ismene target
#
# Revision 1.14 1997/05/27 13:28:33 gaius
# make the file TAG part of an archive
#
# Revision 1.13 1997/05/27 12:57:57 gaius
# fixed install and regression tests for release 3.1
#
# Revision 1.12 1997/05/21 10:43:49 gaius
# fixed bug in makefile target everything
#
# Revision 1.11 1997/05/21 10:18:12 gaius
# fixed to make the release target only release the compiler.
#
# Revision 1.10 1997/05/21 08:17:06 gaius
# fixed install scripts inside makefiles. Removed confusion between
# release and install. Both are now treated the same. Made compiler
# handle -h option correctly.
#
# Revision 1.9 1996/10/14 12:50:09 gaius
# minor modifications
#
# Revision 1.8 1996/09/30 13:52:18 gaius
# changes to reflect simulator name change
#
# Revision 1.7 1996/07/26 11:50:03 gaius
# minor modifications
#
# Revision 1.6 1996/06/12 12:27:53 gaius
# modified to operate with the RELEASEROOT environment variable
#
# Revision 1.5 1996/06/12 09:06:30 gaius
# modified the clean to operate with CVS without causing so many anoying errors
#
# Revision 1.4 1996/06/04 10:51:06 gaius
# Added Log command
#
#
m2f-3.8/README 100644 144 144 1305 6743317762 11452 0 ustar gaius users
Read the m2f.lsm and ChangeLog for a summary of this
release.
To rebuild the compiler from sources type:
make all
su
make install
this will put the compiler and libraries in
$(RELEASEROOT)/bin and $(RELEASEROOT)/libs respectively.
You may want to alter the definition of RELEASEROOT
which is currently defined in ../make.rules
Note that when before running the compiler it is advisable to
set up two environment variables: M2PATH and M2OPTIONS.
Example:
export M2PATH="/usr/m2/libs ."
export M2OPTIONS=-g
(Actually the compiler path defaults to "/usr/m2/libs ."
so it will work without this.)
For further examples consult the manual page (man m2f).
Any problems, please email me: gaius@glam.ac.uk
m2f-3.8/COPYING 100644 144 144 44060 6743317762 11652 0 ustar gaius users The directory libs and contents is exempt from this license,
all other directories and files are under this license. The
libs directory is public domain and free.
I dont really even want to copyright this software but in order
to keep it free and the source always available I must claim copyright,
(there we are I've now done it!), and now pass over to the GPL below
which takes care of the legal issues.
Gaius Mulley
-----------------------------------------------------------------------
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
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 2 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 this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
m2f-3.8/comp/ 40755 144 144 0 6743317726 11434 5 ustar gaius users m2f-3.8/comp/BUGS 100644 144 144 24767 6647623242 12250 0 ustar gaius users
Known Outstanding bugs
======================
(1) (5) (12) (13) (18)
Bugs which have been fixed
==========================
(2) (3) (4) (6) (7) (8) (9) (10) (11) (14) (15) (16)
(17)
Description
===========
(1) When linking the program gm2l should examine both DEF and MOD
files - currently it uses the first it finds?? Is this true -
certainly it fails to link the rtp/ass3 assingment correctly
(missing modules out (BufferDevice.mod)) if the paths searches
DEFs first.
This needs closer examination and fixing!
(2) testcse27 fails. When -Ocse is supplied. ReturnValue is
not placed directly after the call to a function. The
Fault lies inside M2SubExp.mod (somewhere).
(3) Math sin/cos/tan etc. Most work but there is a bug which
is seen if you run testbox in the m2/games/animate directory.
When the demo is run it works fine until near the end where
some of the rotations are not happening.
KV has some code that might also be exhibiting the same bug?
Comments Keith?
(4) Function parameters are not checked
(5) A procedure that is defined in the DEFINITION module but not EXPORTed
can be seen by another module as an UNQUALIFIED identifier. This is
wrong and causes a linkage error. The error should be caught at
compile time.
(6) Possible to return a function name from a function with a return type INTEGER
(sflewis 1st years)
(7) procedure reference inside floating point code not detected.
(sflewis 1st years)
(8) too many errors report, END - expected, and do not specify IF WHILE etc
(sflewis 1st years)
(9) error messages sometimes point to wrong token (+-n)
(10) when missing an operator the compiler sometimes gives wierd error messages:
eg: foo := bar (12 DIV 3)
^
+ missing
used to give INTEGER undefined in SYSTEM.MOD. Wrong!
now fixed and generates two snapshots of the source code, this statement and
the declaration for bar and the message:
prog23.mod:141:symbol is not recognised as a procedure, check declaration
(11) M2OPTIONS was ignored. Now m2f properly passes each option
through to the compiler
(12) type checking needs fixing.
(Place is ARRAY[0..9] OF CHAR;)
WHILE (Place[1] <> 'qqqqqqqqq') AND (Place[2] <> 'qqqqqqqqqq') DO
Score := 4;
should fail.
(13) TYPE RaceRecord = RECORD
Name : ARRAY [0..9] OF CHAR;
Score : INTEGER;
END; (* Of RECORD *)
DataArray = ARRAY [1..15] OF RaceRecord;
InputArray = ARRAY [0..9] OF CHAR;
VAR
RecordArray : DataArray;
NumberOfCompetitors : INTEGER;
Town : InputArray;
Empty : InputArray;
Competitor : InputArray;
Index : INTEGER;
Max : CARDINAL;
TempScore : INTEGER;
Flag : BOOLEAN;
PROCEDURE Initialise;
BEGIN
FOR Index := 1 TO 15 DO
RecordArray[Index].Name := '';
RecordArray[Index].Score := '0';
gives 48 to Score !!!!!!!!!!!!!!
(14) unterminated comment which starts at top of a module causes the
compiler to exit without an error message.
(15) profiling (-p) option causes link failure.
Hi,
Your list of bug reports have been applied to the compiler.
Keep them rolling in...
Specifically:
(1) unterminated comment at start of module now generates an error message.
Compiling testcomment4.mod
Pass 1
Module SYSTEM : /user/gaius/m2/comp/libs/SYSTEM.def
Module M2RTS : /user/gaius/m2/comp/libs/M2RTS.def
Module MATH : /user/gaius/m2/comp/libs/MATH.def
testcomment4.mod:1:end of file reached in a comment
(2) PROCEDURE IsListSizeAvailable (l: LIST) : BOOLEAN ;
BEGIN
RETURN( IsAvailable(SIZE(l^))
END IsListSizeAvailable ;
and compiler says unsed variable, l, warning.
This is a very interesting situation, the compiler is half right I suspect!
in that "l" isn't *really* used (read or written to - SIZE is a pseudo function) -
- thus the compiler is prompting, requesting for better code... how about:
PROCEDURE IsListSizeAvailable () : BOOLEAN ;
BEGIN
RETURN( IsAvailable(TSIZE(LIST))
END IsListSizeAvailable ;
One candidate for discussion in a paper perhaps?
(3) parameter types which are not types... (fixed)
Compiling testtype.mod
Pass 1
Module SYSTEM : /user/gaius/m2/comp/libs/SYSTEM.def
Module M2RTS : /user/gaius/m2/comp/libs/M2RTS.def
Module MATH : /user/gaius/m2/comp/libs/MATH.def
Module testtype : testtype.mod
Pass 2
Pass 3
testtype.mod:11:the parameter type specified (v) in procedure (foo) was not itself declared as a type
testtype.mod:8:testtype.mod:
testtype.mod:MODULE testtype ;
testtype.mod:
testtype.mod:
testtype.mod:TYPE
testtype.mod: T = CARDINAL ;
testtype.mod:
testtype.mod:VAR
testtype.mod: v: T ;
^
testtype.mod:------------------------------------------
testtype.mod:
testtype.mod:MODULE testtype ;
testtype.mod:
testtype.mod:
testtype.mod:TYPE
testtype.mod: T = CARDINAL ;
testtype.mod:
testtype.mod:VAR
testtype.mod: v: T ;
testtype.mod:
testtype.mod:
testtype.mod:PROCEDURE foo (a: v) ;
^^^
(4) forgetting to EXPORT QUALIFIED symbols now gets caught as an error, rather than a linkage failure!
Compiling testimport.mod
Pass 1
Module SYSTEM : /user/gaius/m2/comp/libs/SYSTEM.def
Module M2RTS : /user/gaius/m2/comp/libs/M2RTS.def
Module MATH : /user/gaius/m2/comp/libs/MATH.def
Module testimport : testimport.mod
Module testimport2 : testimport2.def
Pass 2
Pass 3
testimport2.def:3:Unresolved symbol in module, first used at this line
the following symbols are unknown at the end of module: testimport
unknown symbol found requested by another modules import (symbols have not been EXPORTed by the appropriate definition module)
bar
foo
testimport2.def:
testimport2.def:DEFINITION MODULE testimport2 ;
testimport2.def:
testimport2.def:PROCEDURE foo ;
^^^
(5) profiling is now fixed, try the -p option to find out where the time is spent when executing
your different sort routines.
ok here are 3 modules
Invent.def - defines a pointer to a record type
impor.def - imports that and just sets it equla to a different name
impor2.mod - imports from the other two (above) but in one case (a) it is
still a pointer
however (b) is not ? so what type is variable b ?
[sflewis@moppsy opaque]$ cat Invent.def
DEFINITION MODULE Invent;
EXPORT QUALIFIED Sstring,Date,InventRec;
TYPE
InventRec = POINTER TO InventObject;
Date = [800101..991231] ; (*Year Month Day.*)
InventObject = RECORD
Description : Sstring ;
Price : REAL ;
Code : INTEGER ;
Created : Date ;
END ;
Sstring = ARRAY [0..9] OF CHAR;
END Invent.
[sflewis@moppsy opaque]$ cat Invent.mod
IMPLEMENTATION MODULE Invent;
END Invent.
[sflewis@moppsy opaque]$ cat impor.def
DEFINITION MODULE impor;
FROM Invent IMPORT InventRec, Sstring, Date;
EXPORT QUALIFIED list_data_type2;
TYPE
(* the same as InventRec;*)
list_data_type2 = InventRec;
END impor.
[sflewis@moppsy opaque]$ cat impor.mod
IMPLEMENTATION MODULE impor;
END impor.
[sflewis@moppsy opaque]$ cat impor2.mod
MODULE impor2;
FROM Storage IMPORT ALLOCATE,DEALLOCATE,Available;
FROM Invent IMPORT InventRec;
FROM impor IMPORT list_data_type2;
VAR
a : InventRec;
b : list_data_type2;
BEGIN
NEW(a);
a^.Code := 12;
(* b^.Code := 12; *)
END impor2.
[sflewis@moppsy opaque]$ m2f !$
m2f impor2.mod
Compiling impor2.mod
Pass 1
Module SYSTEM : /usr/local/m2/libs/SYSTEM.def
Module M2RTS : /usr/local/m2/libs/M2RTS.def
Module MATH : /usr/local/m2/libs/MATH.def
Module impor2 : impor2.mod
Module Storage : /usr/local/m2/libs/Storage.def
Module Invent : Invent.def
Module impor : impor.def
Pass 2
Pass 3
impor2.mod:11:warning unused variable (b) in (impor2)
Pass 4
[sflewis@moppsy opaque]$ m2f -l impor2
[sflewis@moppsy opaque]$ a.out
[sflewis@moppsy opaque]$ cat impor2.mod
MODULE impor2;
FROM Storage IMPORT ALLOCATE,DEALLOCATE,Available;
FROM Invent IMPORT InventRec;
FROM impor IMPORT list_data_type2;
VAR
a : InventRec;
b : list_data_type2;
BEGIN
NEW(a);
NEW(b);
a^.Code := 12;
(* b^.Code := 12; *)
END impor2.
[sflewis@moppsy opaque]$ m2f !$
m2f impor2.mod
Compiling impor2.mod
Pass 1
Module SYSTEM : /usr/local/m2/libs/SYSTEM.def
Module M2RTS : /usr/local/m2/libs/M2RTS.def
Module MATH : /usr/local/m2/libs/MATH.def
Module impor2 : impor2.mod
Module Storage : /usr/local/m2/libs/Storage.def
Module Invent : Invent.def
Module impor : impor.def
Pass 2
Pass 3
/usr/local/m2/libs/Storage.def:23:parameter mismatch
impor2.mod:15:Error found while compiling the program module
problem in parameter 1 : PROCEDURE ALLOCATE (VAR a: ADDRESS; ...) ;
item being passed is : b: list_data_type2
identifier with an incompatible type is being passed to this procedure
/usr/local/m2/libs/Storage.def:
/usr/local/m2/libs/Storage.def: Title : Storage
(16) PROCEDURE myproc (VAR i: CARDINAL) ;
BEGIN
FOR i := 0 TO 10 DO
END
END myproc ;
the for loop index would be garbage because of the VAR
parameter.
This is now fixed.
(17) using SIZE(variable) in an expression resulted in temp temporary
variables having a wrong type. This sometimes resulted in type
incompatability during optimization.
This is now fixed.
(18) m2/os/rtp/ass4 fails if the microkernel is built with -Oi586
(it works fine if -Odynamic is used without -Oi586 though).
This is a high priority bug..
m2f-3.8/comp/COPYING 100644 144 144 44060 6615314670 12601 0 ustar gaius users The directory libs and contents is exempt from this license,
all other directories and files are under this license. The
libs directory is public domain and free.
I dont really even want to copyright this software but in order
to keep it free and the source always available I must claim copyright,
(there we are I've now done it!), and now pass over to the GPL below
which takes care of the legal issues.
Gaius Mulley
-----------------------------------------------------------------------
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
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 2 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 this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
m2f-3.8/comp/CVS/ 40755 144 144 0 6740064605 12057 5 ustar gaius users m2f-3.8/comp/CVS/Root 100644 144 144 15 6402517643 12756 0 ustar gaius users /usr/src/cvs
m2f-3.8/comp/CVS/Repository 100644 144 144 25 6402517643 14213 0 ustar gaius users /usr/src/cvs/m2/comp
m2f-3.8/comp/CVS/Entries 100644 144 144 1437 6740064605 13515 0 ustar gaius users /compiletimes/1.1.1.1/Tue May 28 10:13:00 1996//
/doboth/1.1/Tue May 27 13:01:36 1997//
/oldsize/1.1.1.1/Tue May 28 10:13:00 1996//
D/autotest////
D/bin1////
D/bin2////
D/bin3////
D/bin4////
D/bnf////
D/el////
D/gm2s////
D/libs////
D/man////
D/p2c////
D/test////
D/tools////
/.emacs/1.1.1.1/Mon Sep 21 12:42:01 1998//
/.major/1.4/Fri Sep 11 10:08:15 1998//
/doopt/1.5/Sat Jul 25 15:31:54 1998//
/COPYING/1.3/Tue Oct 27 10:00:24 1998//
/BUGS/1.16/Fri Jan 15 11:29:38 1999//
/.archive/1.64/Fri Jun 25 16:47:08 1999//
/THOUGHTS/1.8/Fri Jun 11 15:18:46 1999//
/check34/1.1/Thu Jun 24 07:08:03 1999//
/.minor/1.84/Fri Jul 2 14:51:29 1999//
/ChangeLog/1.6/Fri Jul 2 14:48:48 1999//
/makefile/1.24/Sun Jul 4 13:16:07 1999//
/README/1.5/Mon Jul 5 08:14:02 1999//
/m2f.lsm/1.6/Mon Jul 5 08:10:03 1999//
m2f-3.8/comp/README 100644 144 144 1305 6740064512 12375 0 ustar gaius users
Read the m2f.lsm and ChangeLog for a summary of this
release.
To rebuild the compiler from sources type:
make all
su
make install
this will put the compiler and libraries in
$(RELEASEROOT)/bin and $(RELEASEROOT)/libs respectively.
You may want to alter the definition of RELEASEROOT
which is currently defined in ../make.rules
Note that when before running the compiler it is advisable to
set up two environment variables: M2PATH and M2OPTIONS.
Example:
export M2PATH="/usr/m2/libs ."
export M2OPTIONS=-g
(Actually the compiler path defaults to "/usr/m2/libs ."
so it will work without this.)
For further examples consult the manual page (man m2f).
Any problems, please email me: gaius@glam.ac.uk
m2f-3.8/comp/THOUGHTS 100644 144 144 7141 6730224326 12711 0 ustar gaius users Fri Jun 11 16:13:09 BST 1999
Working on nested procedures, two approaches, either:
we work with nested NewLocalVar quadruples or we unravel
the nested NewLocalVars. Unraveling procedures seems attactive
as a mechanism to move quadruples could be later extened to
inline procedures. Working with nested NewLocalVars is a
possibility but may cause several optimization implementations
to break in the process!
----------------------------------------------------------------
Tue Feb 3 15:00:25 GMT 1998
Nearly finished the pipeline code optimization (-Oi586) together
with pentium timings for the apu code generator. Pentium pipeline
optimization improves some loops by up to 33%.
----------------------------------------------------------------
Mon Jul 7 08:40:51 BST 1997
Dynamic code generator now used during stage3 compiler
construction. It also can be used to build the realtime
systems and simulator tools.
A few fixes to the compiler code generator have taken place
since the last log. Better error messages have also been added.
----------------------------------------------------------------
Wed Mar 12 15:53:52 GMT 1997
Compiler now compiles itself, minor inefficienies exist.
Would be good to remove them so thay do not bite later.
----------------------------------------------------------------
Fri Mar 7 10:08:40 GMT 1997
M2GenDyn486 completed and very nearly debugged, one module
M2GenDyn486 remains to execute successfully. Recursive debugging code...
Dynamic code generator, compares favourably with gcc for some modules,
(NameKey gm2 produces better code) for others gcc wins hands down.
Still dynamic code generator produces half the code of the static version.
----------------------------------------------------------------
Tue Nov 19 14:33:03 GMT 1996
Finally completed IndrX and XIndr operators after many alterations
to M2Quads and M2Gen487. In a much better position to attack the gencode
algorithm outlined in the Dragon Book.
----------------------------------------------------------------
Fri Nov 1 08:57:32 GMT 1996
Going to change ModeOfAddr to Values = LValue, RValue
Going to change quadruple meaning as above, only indirection via
Xindir and indirX (where X = *)
LeftValue == ValueAddr
RightValue == OffsetAddr
ParamOp now is mode less.
AddrOp is only used in two places in M2Quads
need to alter CopyOp -> indirX and Xindir
achieve this via implementing a procedure called MakeIndirectX
and MakeXIndirect
then remove CopyOp and alter BecomesOp to be mode less.
----------------------------------------------------------------
considering altering the set of quadruples. In particular I would
like to remove the CopyOp and replace it with two quadruples:
*indir a b meaning *a = b
indir* a b meaning a = *b
and I'd like to remove OffsetAddr & ValueAddr (ModeOfAddr)
This would make the CSE more efficient and also enable a much
better code generation mechanism (aka GenCode in Dragon Book).
All other quadruples would NOT depend upon the mode of a variable.
Although the WITH, array access, VAR parameters, pointers
need to be throught out very carefully before embarking on
a major alteration. I'm not sure whether I can remove OffsetAddr
and ValueAddr yet, it maybe that these are necessary (LValue and RValue).
BaseOp now computes the constant offset from the ADR(array), this
is much better than computing the ADR(array)+-offset as the constant
calculation can be done independantly of the runtime ADR(array).
Thus CSE can manipulate the constant offset and integrate it with
other constants in the DAG.
Done
----------------------------------------------------------------
m2f-3.8/comp/autotest/ 40755 144 144 0 6740730755 13302 5 ustar gaius users m2f-3.8/comp/autotest/CVS/ 40755 144 144 0 6601444354 13726 5 ustar gaius users m2f-3.8/comp/autotest/CVS/Root 100644 144 144 15 6402517643 14626 0 ustar gaius users /usr/src/cvs
m2f-3.8/comp/autotest/CVS/Repository 100644 144 144 36 6402517643 16065 0 ustar gaius users /usr/src/cvs/m2/comp/autotest
m2f-3.8/comp/autotest/CVS/Entries 100644 144 144 345 6601444354 15341 0 ustar gaius users /auto.sh/1.10/Tue Jun 3 09:01:15 1997//
/extra.sh/1.1/Fri Jul 26 11:07:44 1996//
/makefile/1.8/Tue May 27 12:58:03 1997//
D/case////
D/cse////
D/dynamic////
D/errors////
D/fpu////
D/run////
D/types////
D/warnings////
D/libs////
m2f-3.8/comp/autotest/case/ 40755 144 144 0 6743314171 14206 5 ustar gaius users m2f-3.8/comp/autotest/case/CVS/ 40755 144 144 0 6601444354 14641 5 ustar gaius users m2f-3.8/comp/autotest/case/CVS/Root 100644 144 144 15 6402517643 15541 0 ustar gaius users /usr/src/cvs
m2f-3.8/comp/autotest/case/CVS/Repository 100644 144 144 43 6402517643 16776 0 ustar gaius users /usr/src/cvs/m2/comp/autotest/case
m2f-3.8/comp/autotest/case/CVS/Entries 100644 144 144 272 6601444354 16253 0 ustar gaius users /testcase1.mod/1.1/Fri Jul 26 11:11:11 1996//
/testcase2.mod/1.1/Fri Jul 26 11:11:11 1996//
/testcase3.mod/1.1/Fri Jul 26 11:11:12 1996//
/testcase4.mod/1.1/Fri Jul 26 11:11:12 1996//
D
m2f-3.8/comp/autotest/case/testcase1.mod 100644 144 144 273 6176123717 16666 0 ustar gaius users MODULE testcase1 ;
PROCEDURE do ;
BEGIN
END do ;
VAR
ch: CHAR ;
BEGIN
CASE ch OF
'0' : do |
'1' : do |
'2'..'9': do
ELSE
do
END
END testcase1.
m2f-3.8/comp/autotest/case/testcase2.mod 100644 144 144 276 6176123717 16672 0 ustar gaius users MODULE testcase2 ;
(*
do -
*)
PROCEDURE do ;
BEGIN
END do ;
VAR
c: CARDINAL ;
BEGIN
CASE c OF
0 : do |
1 : do |
2..9: do
ELSE
do
END
END testcase2.
m2f-3.8/comp/autotest/case/testcase3.mod 100644 144 144 224 6176123720 16656 0 ustar gaius users MODULE testcase3 ;
PROCEDURE do ;
BEGIN
END do ;
VAR
a, b, c: CARDINAL ;
BEGIN
IF (a>=b) AND (a<=c)
THEN
do
END
END testcase3.
m2f-3.8/comp/autotest/case/testcase4.mod 100644 144 144 256 6176123720 16664 0 ustar gaius users MODULE testcase4 ;
PROCEDURE do ;
BEGIN
END do ;
VAR
c: CARDINAL ;
BEGIN
CASE c OF
2..9: do |
0 : do |
1 : do
ELSE
do
END
END testcase4.
m2f-3.8/comp/autotest/auto.sh 100755 144 144 11330 6344756533 14726 0 ustar gaius users #!/bin/sh
#
# parseArg - see if arg 1 exists if so then this is the directory where the auto.sh
# script lives.
#
function parseArg () {
if [ -f options ] ; then
export M2OPTIONS="`cat options`"
else
export M2OPTIONS="-O -g -bounds"
fi
# echo set options to $M2OPTIONS
if [ "$1" = "" ] ; then
echo "testing gm2-i386-gas from " `type gm2-i386-gas`
AUTODIR="."
else
AUTODIR="$1"
fi
}
#
# checkRun - check whether we should link module $1 and test it's execution.
#
function checkRun () {
if [ -f mustrunandfail ] ; then
m2f -M ". $AUTODIR/../../comp/libs" $M2OPTIONS $1 > /dev/null
m2f -M ". $AUTODIR/../../comp/libs" -l $M2OPTIONS $1
if ./a.out >& /dev/null ; then
echo "failed run"
exit 1
else
echo -n "[r]"
fi
fi
if [ -f mustrunandpass ] ; then
m2f -M ". $AUTODIR/../../comp/libs" $M2OPTIONS $1 > /dev/null
m2f -M ". $AUTODIR/../../comp/libs" -l $M2OPTIONS $1
if ./a.out >& /dev/null ; then
echo -n "[r]"
else
echo "failed run"
exit 1
fi
fi
}
#
# compilePass - runs the compiler on all modules and expects it to succeed on all.
#
function compilePass () {
j=0
for i in *.mod ; do
if [ -f $i ] ; then
echo -n "$i"
if gm2-i386-gas $M2OPTIONS -quiet -M ". $AUTODIR/../../comp/libs" -O `basename $i .mod` ; then
checkRun $i
echo -n " "
j=`expr $j + 1`
if [ "`expr $j % 4`" = "0" ] ; then
echo ""
fi
else
echo " x"
echo "failed to compile $i" ;
exit 1
fi
fi
done
}
#
# compileWarning - runs the compiler on all modules and expects it to generate warnings on all.
#
function compileWarning () {
j=0
echo "------------------------------------------------------------"
echo " compiling warning code tests "
echo "------------------------------------------------------------"
for i in *.mod ; do
if [ -f $i ] ; then
echo -n "$i"
gm2-i386-gas $M2OPTIONS -quiet -M ". $AUTODIR/../../comp/libs" -O `basename $i .mod` > messages
if grep warn messages > /dev/null ; then
echo -n " "
j=`expr $j + 1`
if [ "`expr $j % 4`" = "0" ] ; then
echo ""
fi
else
echo " x"
echo "failed to detect warning in $i" ;
exit 1
fi
fi
done
rm -f messages
echo " "
echo "------------------------------------------------------------"
}
#
# compileFail - runs the compiler on all modules and expects it to fail on all.
#
function compileFail () {
j=0
echo "------------------------------------------------------------"
echo " compiling errant code tests "
echo "------------------------------------------------------------"
for i in *.mod ; do
if [ -f $i ] ; then
echo -n "$i"
if gm2-i386-gas $M2OPTIONS -quiet -M ". $AUTODIR/../../comp/libs" -O `basename $i .mod` > /dev/null ; then
echo " x"
echo "failed to detect error in $i" ;
exit 1
else
echo -n " "
j=`expr $j + 1`
if [ "`expr $j % 4`" = "0" ] ; then
echo ""
fi
fi
fi
done
echo "------------------------------------------------------------"
}
#
# testModules - test all the modules
#
function testModules () {
unset DEBUGCSE
if [ -f warning ] ; then
compileWarning
elif [ -f mustfail ] ; then
compileFail
else
compilePass
fi
}
#
# runDirs - traverse subdirectories and execute the test programs.
#
function runDirs () {
for i in * ; do
if [ -d $i ] ; then
if [ "$i" != "CVS" ] ; then
echo " "
echo "-------------------------------------------------"
echo "Regression tests running in: `pwd`/$i"
echo "-------------------------------------------------"
cd $i ; ../$AUTODIR/auto.sh "../$AUTODIR" ; result=$? ; cd ..
echo " "
if [ "$result" = "0" ] ; then
echo "================================================="
echo "Directory `pwd`/$i has PASSED"
echo "================================================="
else
echo "Directory `pwd`/$i has FAILED"
fi
fi
fi
done
}
#
# main
#
parseArg $1
testModules
runDirs
echo ""
m2f-3.8/comp/autotest/extra.sh 100755 144 144 1456 6176123400 15051 0 ustar gaius users #!/bin/sh
echo "testing gm2-i386-gas from " `type gm2-i386-gas`
unset DEBUGCSE
unset CSEDEBUG
j=0
for i in testcse*mod ; do
echo -n "$i "
if gm2-i386-gas -quiet -M "../../os/m2mus/def ../../os/m2mus/mod ../libs ." -O -Ocse `basename $i .mod` ; then
j=`expr $j + 1`
if [ "`expr $j % 4`" = "0" ] ; then
echo ""
fi
else
echo "x"
echo "failed to compile $i" ;
cat $i
export DEBUGCSE=yes
export CSEDEBUG=yes
gm2-i386-gas -q -M "../../os/m2mus/def ../../os/m2mus/mod ../libs ." -O -Ocse `basename $i .mod`
exit 1
fi
done
if gm2-i386-gas -M "../../os/rtp/ass3 ../../os/m2mus/def ../../os/m2mus/mod ../libs ." -O -Ocse Executive ; then
echo Executive
else
echo Executive x
fi
echo ""
echo "all cse tests passed"
m2f-3.8/comp/autotest/makefile 100644 144 144 1223 6342555133 15066 0 ustar gaius users SHELL=/bin/sh
all: force
@export M2PATH=". `pwd`/../libs" ; \
./auto.sh | tee autolog
@echo "Regression test synopsis"
@echo "========================"
@echo " "
@if ! grep PASSED autolog ; then \
echo "NO TESTS PASSED" ; \
fi ; \
echo " " ; \
if ! grep FAILED autolog ; then \
echo "NO TESTS FAILED" ; \
fi ; \
echo " " ; \
rm -f autolog
clean: force
( cd cse ; make clean )
( cd fpu ; make clean )
( cd errors ; make clean )
( cd run ; make clean )
( cd types ; make clean )
( cd dynamic ; make clean )
$(RM) *.s *~ */*.s */*~ */a.out */*.o */mod_init.c
force:
m2f-3.8/comp/autotest/cse/ 40755 144 144 0 6743314171 14045 5 ustar gaius users m2f-3.8/comp/autotest/cse/CVS/ 40755 144 144 0 6601444354 14500 5 ustar gaius users m2f-3.8/comp/autotest/cse/CVS/Root 100644 144 144 15 6402517643 15400 0 ustar gaius users /usr/src/cvs
m2f-3.8/comp/autotest/cse/CVS/Repository 100644 144 144 42 6402517643 16634 0 ustar gaius users /usr/src/cvs/m2/comp/autotest/cse
m2f-3.8/comp/autotest/cse/CVS/Entries 100644 144 144 4143 6601444354 16133 0 ustar gaius users /makefile/1.1/Fri Jul 26 11:11:19 1996//
/testcse.def/1.1/Fri Jul 26 11:13:57 1996//
/testcse.mod/1.1/Fri Jul 26 11:11:19 1996//
/testcse10.mod/1.1/Fri Jul 26 11:11:19 1996//
/testcse11.mod/1.1/Fri Jul 26 11:11:19 1996//
/testcse12.mod/1.1/Fri Jul 26 11:11:19 1996//
/testcse13.mod/1.1/Fri Jul 26 11:11:19 1996//
/testcse14.mod/1.1/Fri Jul 26 11:11:19 1996//
/testcse15.mod/1.1/Fri Jul 26 11:11:19 1996//
/testcse16.mod/1.2/Wed Mar 12 15:38:30 1997//
/testcse17.mod/1.1/Fri Jul 26 11:11:19 1996//
/testcse18.mod/1.1/Fri Jul 26 11:11:19 1996//
/testcse19.mod/1.1/Fri Jul 26 11:11:20 1996//
/testcse2.mod/1.1/Fri Jul 26 11:11:20 1996//
/testcse20.mod/1.1/Fri Jul 26 11:11:20 1996//
/testcse21.mod/1.1/Fri Jul 26 11:11:20 1996//
/testcse22.mod/1.1/Fri Jul 26 11:11:20 1996//
/testcse23.mod/1.1/Fri Jul 26 11:11:20 1996//
/testcse24.mod/1.1/Fri Jul 26 11:11:20 1996//
/testcse25.mod/1.1/Fri Jul 26 11:11:20 1996//
/testcse26.mod/1.1/Fri Jul 26 11:11:20 1996//
/testcse27.mod/1.1/Fri Jul 26 11:11:20 1996//
/testcse28.mod/1.1/Fri Jul 26 11:11:20 1996//
/testcse29.mod/1.1/Fri Jul 26 11:11:20 1996//
/testcse3.mod/1.1/Fri Jul 26 11:11:20 1996//
/testcse31.mod/1.2/Thu May 15 08:08:31 1997//
/testcse32.mod/1.1/Fri Jul 26 11:11:21 1996//
/testcse33.mod/1.1/Fri Jul 26 11:11:21 1996//
/testcse34.mod/1.1/Fri Jul 26 11:11:21 1996//
/testcse35.mod/1.1/Fri Jul 26 11:11:21 1996//
/testcse36.mod/1.1/Fri Jul 26 11:11:21 1996//
/testcse37.mod/1.1/Fri Jul 26 11:11:21 1996//
/testcse38.mod/1.1/Fri Jul 26 11:11:21 1996//
/testcse39.mod/1.1/Fri Jul 26 11:11:21 1996//
/testcse4.mod/1.1/Fri Jul 26 11:11:21 1996//
/testcse40.mod/1.1/Fri Jul 26 11:11:21 1996//
/testcse41.mod/1.1/Wed Oct 16 11:54:22 1996//
/testcse42.mod/1.1/Wed Oct 30 12:40:31 1996//
/testcse43.mod/1.1/Wed Oct 30 12:40:31 1996//
/testcse44.mod/1.1/Wed Oct 30 12:40:31 1996//
/testcse45.mod/1.1/Thu Nov 14 10:57:11 1996//
/testcse46.mod/1.1/Tue Jun 10 13:37:22 1997//
/testcse5.mod/1.1/Fri Jul 26 11:11:22 1996//
/testcse6.mod/1.1/Fri Jul 26 11:11:22 1996//
/testcse7.mod/1.1/Fri Jul 26 11:11:22 1996//
/testcse8.mod/1.1/Fri Jul 26 11:11:22 1996//
/testsize.mod/1.1/Mon Jul 7 09:04:18 1997//
D
m2f-3.8/comp/autotest/cse/makefile 100644 144 144 61 6176123727 15604 0 ustar gaius users
all: force
clean: force
$(RM) *.s *~
force:
m2f-3.8/comp/autotest/cse/testcse.def 100644 144 144 425 6176124165 16257 0 ustar gaius users DEFINITION MODULE testcse ;
(*
Title : testcse
Author : Gaius Mulley
System : UNIX (gm2)
Date : Tue Mar 26 23:52:58 1996
Last edit : Tue Mar 26 23:52:58 1996
Description:
*)
EXPORT QUALIFIED stop ;
PROCEDURE stop ;
END testcse.
m2f-3.8/comp/autotest/cse/testcse.mod 100644 144 144 260 6176123727 16300 0 ustar gaius users IMPLEMENTATION MODULE testcse ;
PROCEDURE stop ;
BEGIN
a := 4
END stop ;
VAR
a, b, c, d: CARDINAL ;
BEGIN
a := b + 1 + b + 1 ; (* works *)
LOOP END
END testcse.
m2f-3.8/comp/autotest/cse/testcse10.mod 100644 144 144 207 6176123727 16442 0 ustar gaius users MODULE testcse10 ;
VAR
i: CARDINAL ;
j: CARDINAL ;
a: POINTER TO CARDINAL ;
BEGIN
i := a^ ;
i := i + 1
END testcse10.
m2f-3.8/comp/autotest/cse/testcse11.mod 100644 144 144 321 6176123727 16440 0 ustar gaius users MODULE testcse11 ;
TYPE
String = POINTER TO ARRAY [0..20] OF CHAR ;
(*
foo -
*)
PROCEDURE foo (VAR a: String) ;
BEGIN
a^ := 'hello'
END foo ;
VAR
a: String ;
BEGIN
foo(a)
END testcse11.
m2f-3.8/comp/autotest/cse/testcse12.mod 100644 144 144 1244 6176123727 16466 0 ustar gaius users MODULE testcse12 ;
CONST
Maxfiles = 20 ;
MaxNameSize = 80 ;
TYPE
File = INTEGER ;
(* File is the index into files array *)
FileType = ( none, reading, writing, random );
FCB = RECORD
type : FileType;
name : ARRAY [0..MaxNameSize] OF CHAR;
filedes : INTEGER; (* file descriptor *)
END ;
FileArray = ARRAY [-1..Maxfiles] OF FCB;
PROCEDURE GetUnixFileDescriptor (f: File) : INTEGER ;
BEGIN
RETURN( files[f].filedes )
END GetUnixFileDescriptor ;
VAR
f : File ;
files: FileArray;
BEGIN
IF GetUnixFileDescriptor(f)=1
THEN
END
END testcse12.
m2f-3.8/comp/autotest/cse/testcse13.mod 100644 144 144 507 6176123727 16450 0 ustar gaius users MODULE testcse13 ;
FROM SYSTEM IMPORT ADR ;
VAR
p, q: POINTER TO CHAR ;
PROCEDURE foo ;
VAR
a, b, c: CHAR ;
BEGIN
IF a=0C
THEN
END ;
q^ := 1C ;
p := ADR(a) ;
(* a := b ; *)
p^ := c ;
(*
p^ := b ;
q := ADR(a) ;
p^ := c ;
*)
LOOP END
END foo ;
BEGIN
foo ;
p^ := 3C
END testcse13.
m2f-3.8/comp/autotest/cse/testcse14.mod 100644 144 144 416 6176123727 16450 0 ustar gaius users MODULE testcse14 ;
PROCEDURE Power10 (r: REAL; power: CARDINAL) : REAL;
VAR
i: CARDINAL;
BEGIN
i := 0 ;
WHILE i<power DO
r := r * 10.0 ;
INC(i)
END ;
RETURN( r )
END Power10 ;
BEGIN
IF Power10(1.0, 1)=2.0
THEN
END
END testcse14.
m2f-3.8/comp/autotest/cse/testcse15.mod 100644 144 144 734 6176123727 16454 0 ustar gaius users MODULE testcse15 ;
TYPE
Response = (done, notdone) ;
IO = (read, write) ;
File = RECORD
res : Response ;
Opened: BOOLEAN ;
io : IO ;
END ;
PROCEDURE Close (VAR f: File) ;
BEGIN
WITH f DO
IF io=read
THEN
IF Opened
THEN
res := done
ELSE
res := notdone
END
END
END
END Close ;
VAR
f: File ;
BEGIN
Close(f)
END testcse15.
m2f-3.8/comp/autotest/cse/testcse16.mod 100644 144 144 2634 6311546766 16501 0 ustar gaius users MODULE testcse16 ;
CONST
MaxScopes = 20 ; (* Maximum number of scopes at any one time. *)
NulSym = 0 ;
TYPE
CallFrame = RECORD
Main : CARDINAL ; (* Main scope for insertions *)
Search: CARDINAL ; (* Search scope for symbol searches *)
Start : CARDINAL ; (* ScopePtr value before StartScope *)
(* was called. *)
END ;
VAR
ScopeCallFrame: ARRAY [1..MaxScopes] OF CallFrame ;
ScopePtr : CARDINAL ;
PROCEDURE foo (Sym: CARDINAL) ;
BEGIN
INC(ScopePtr) ;
WITH ScopeCallFrame[ScopePtr] DO
Main := ScopeCallFrame[ScopePtr-1].Main ;
(*
Start := ScopeCallFrame[ScopePtr-1].Start ;
Search := Sym
*)
END
END foo ;
PROCEDURE IsAlreadyDeclaredSym (Name: CARDINAL) : BOOLEAN ;
BEGIN
WITH ScopeCallFrame[ScopePtr] DO
RETURN( GetLocalSym(ScopeCallFrame[ScopePtr].Main, Name)#NulSym )
END
END IsAlreadyDeclaredSym ;
PROCEDURE GetLocalSym (Sym: CARDINAL; Name: CARDINAL) : CARDINAL ;
BEGIN
RETURN( 0 )
END GetLocalSym ;
BEGIN
ScopePtr := 1 ;
WITH ScopeCallFrame[ScopePtr] DO
Main := 1 ;
Start := 1 ;
Search := 1
END ;
foo(1000) ;
IF ScopeCallFrame[ScopePtr].Main#ScopeCallFrame[ScopePtr-1].Main
THEN
HALT
END ;
(*
IF IsAlreadyDeclaredSym(1234)
THEN
END
*)
END testcse16.
m2f-3.8/comp/autotest/cse/testcse17.mod 100644 144 144 1151 6176123727 16470 0 ustar gaius users MODULE testcse17 ;
TYPE
r = RECORD
a, b, c: CARDINAL ;
array : ARRAY [0..10] OF CARDINAL ;
END ;
PROCEDURE testcase (i: CARDINAL) : CARDINAL ;
BEGIN
WITH t[i] DO
CASE i OF
1: a := i ; b := i ; c := i |
2: a := i ; b := i ; c := i |
3: a := i ; b := i ; c := i |
4: a := i ; b := i ; c := i |
5: a := i ; b := i ; c := i
END ;
RETURN( t[i].a )
END
END testcase ;
VAR
t: ARRAY [1..10] OF r ;
i: CARDINAL ;
BEGIN
FOR i := 1 TO 5 DO
IF testcase(i)#i
THEN
HALT
END
END
END testcse17.
m2f-3.8/comp/autotest/cse/testcse18.mod 100644 144 144 1411 6176123727 16470 0 ustar gaius users MODULE testcse18 ;
CONST
NulSym = 0 ;
PROCEDURE GetScopeSym (n: CARDINAL) : CARDINAL ;
BEGIN
RETURN( 1 )
END GetScopeSym ;
PROCEDURE GetSym (Name: CARDINAL) : CARDINAL ;
VAR
Sym : CARDINAL ;
OldScopePtr: CARDINAL ;
BEGIN
Sym := GetScopeSym(Name) ;
IF Sym=NulSym
THEN
(* Check default base types for symbol *)
OldScopePtr := ScopePtr ; (* Save ScopePtr *)
ScopePtr := BaseScopePtr ; (* Alter ScopePtr to point to top of BaseModule *)
Sym := GetScopeSym(Name) ; (* Search BaseModule for Name *)
ScopePtr := OldScopePtr (* Restored ScopePtr *)
END ;
RETURN( Sym )
END GetSym ;
VAR
sym,
BaseScopePtr,
OldScopePtr,
ScopePtr,
Sym : CARDINAL ;
BEGIN
sym := GetSym(123)
END testcse18.
m2f-3.8/comp/autotest/cse/testcse19.mod 100644 144 144 224 6176123730 16444 0 ustar gaius users MODULE testcse19 ;
PROCEDURE foo ; BEGIN END foo ;
VAR
a, b, c: CARDINAL ;
BEGIN
a := b ;
b := c ;
foo ;
c := a + b
END testcse19.
m2f-3.8/comp/autotest/cse/testcse2.mod 100644 144 144 223 6176123730 16353 0 ustar gaius users MODULE testcse2 ;
VAR
i, j: CARDINAL ;
a: ARRAY [5..10] OF CARDINAL ;
BEGIN
a[i] := 100 ; (* a[j] * a[j] ; *)
LOOP END
END testcse2.
m2f-3.8/comp/autotest/cse/testcse20.mod 100644 144 144 336 6176123730 16440 0 ustar gaius users MODULE testcse20 ;
(*
Swap -
*)
PROCEDURE Swap ;
VAR
t: CARDINAL ;
BEGIN
t := a ;
a := b ;
b := t
END Swap ;
VAR
a, b, t: CARDINAL ;
BEGIN
a := 0 ;
b := 1 ;
t := 2 ;
Swap
END testcse20.
m2f-3.8/comp/autotest/cse/testcse21.mod 100644 144 144 323 6176123730 16435 0 ustar gaius users MODULE testcse21 ;
(*
Swap -
*)
PROCEDURE Swap ;
VAR
t: CARDINAL ;
BEGIN
t := a ;
a := b*a ;
b := t*a
END Swap ;
VAR
a, b: CARDINAL ;
BEGIN
a := 1 ;
b := 2 ;
Swap
END testcse21.
m2f-3.8/comp/autotest/cse/testcse22.mod 100644 144 144 302 6176123730 16433 0 ustar gaius users MODULE testcse22 ;
PROCEDURE func () : CARDINAL ;
BEGIN
RETURN( global )
END func ;
VAR
global: CARDINAL ;
BEGIN
global := func() ;
global := 1 ;
global := 2 ;
END testcse22.
m2f-3.8/comp/autotest/cse/testcse23.mod 100644 144 144 160 6176123730 16436 0 ustar gaius users MODULE testcse23 ;
VAR
a, i: CARDINAL ;
BEGIN
FOR i := 1 TO 5 DO
a := a * i
END
END testcse23.
m2f-3.8/comp/autotest/cse/testcse24.mod 100644 144 144 572 6176123730 16446 0 ustar gaius users MODULE testcse24 ;
TYPE
foo = RECORD
this: bar ;
END ;
bar = RECORD
that: REAL
END ;
VAR
r,
clock : REAL ;
i : CARDINAL ;
a : ARRAY [1..5] OF foo ;
t : POINTER TO foo ;
BEGIN
clock := a[i].this.that ;
r := t^.this.that * clock ;
IF clock=1.0
THEN
clock := 2.0
END
END testcse24.
m2f-3.8/comp/autotest/cse/testcse25.mod 100644 144 144 350 6176123730 16441 0 ustar gaius users MODULE testcse25 ;
VAR
a, b, c, d, e: CARDINAL ;
BEGIN
a := b + c ;
b := a - d ;
c := b + c ;
d := a - b ;
IF a=e
THEN
a := 100 ;
b := 100 ;
c := 100 ;
d := 100
END
END testcse25.
m2f-3.8/comp/autotest/cse/testcse26.mod 100644 144 144 1356 6176123730 16471 0 ustar gaius users MODULE testcse26 ;
FROM NumberIO IMPORT StrToBin, BinToStr ;
CONST
MaxBitsetSize = 32 ;
nul = 0C ;
PROCEDURE PopInt () : INTEGER ;
BEGIN
RETURN( 1 )
END PopInt ;
PROCEDURE PushInt (i: INTEGER) ;
BEGIN
END PushInt ;
PROCEDURE PushCard (i: CARDINAL) ;
BEGIN
END PushCard ;
PROCEDURE PopCard () : CARDINAL ;
BEGIN
RETURN( i )
END PopCard ;
PROCEDURE WriteError (a: ARRAY OF CHAR) ;
BEGIN
END WriteError ;
VAR
i: CARDINAL ;
PROCEDURE Bit ;
VAR
c : CARDINAL ;
Op1, Op2: CARDINAL ;
BEGIN
(* in correct bitset range *)
c := 0 ;
FOR i := Op1 TO Op2 DO
PushCard(i) ;
Bit ;
INC(c, PopCard())
END ;
INC(c) ;
Op1 := c ;
i := i + c ;
END Bit ;
BEGIN
Bit
END testcse26.
m2f-3.8/comp/autotest/cse/testcse27.mod 100644 144 144 777 6176123730 16460 0 ustar gaius users MODULE testcse27 ;
PROCEDURE FindNextLineInBuffer (VAR OffsetIntoBuffer: CARDINAL;
VAR OffsetIntoSource: CARDINAL) ;
BEGIN
END FindNextLineInBuffer ;
PROCEDURE StartOfIndexInBuffer () : CARDINAL ;
BEGIN
RETURN( 1 )
END StartOfIndexInBuffer ;
PROCEDURE WriteBuffer ;
VAR
a, b: CARDINAL ;
BEGIN
a := StartOfIndexInBuffer() ;
b := BufferOffset ;
FindNextLineInBuffer(a, b)
END WriteBuffer ;
VAR
BufferOffset: CARDINAL ;
BEGIN
WriteBuffer
END testcse27.
m2f-3.8/comp/autotest/cse/testcse28.mod 100644 144 144 377 6176123730 16455 0 ustar gaius users MODULE testcse28 ;
FROM StrLib IMPORT StrLen ;
(*
foo -
*)
PROCEDURE foo () : CARDINAL ;
VAR
n, r: CARDINAL ;
BEGIN
n := 0 ;
r := StrLen('abcd') ;
INC(n) ;
RETURN( n )
END foo ;
BEGIN
IF foo()=1
THEN
END
END testcse28.
m2f-3.8/comp/autotest/cse/testcse29.mod 100644 144 144 1241 6176123730 16465 0 ustar gaius users MODULE testcse29 ;
CONST
MaxNoOfRooms = 10 ;
VAR
NoOfBoxes,
NoOfCorridors: CARDINAL ;
NoOfRooms, i : CARDINAL ;
Rooms : ARRAY [0..10] OF RECORD
RoomNo: CARDINAL ;
END ;
PROCEDURE foo ;
BEGIN
NoOfRooms := NoOfBoxes ;
NoOfCorridors := NoOfCorridorBoxes ;
(* Now set all other rooms to void *)
i := NoOfRooms+1 ;
WHILE i<=MaxNoOfRooms DO
Rooms[i].RoomNo := 0 ;
INC(i)
END
END foo ;
VAR
NoOfCorridorBoxes: CARDINAL ;
BEGIN
NoOfCorridorBoxes := 10 ;
foo ;
NoOfRooms := NoOfBoxes ;
NoOfCorridors := NoOfCorridorBoxes ;
END testcse29.
m2f-3.8/comp/autotest/cse/testcse3.mod 100644 144 144 277 6176123730 16365 0 ustar gaius users MODULE testcse3 ;
PROCEDURE foo (VAR a: ARRAY OF CHAR) ;
VAR
i: CARDINAL ;
BEGIN
i := i + 1 ;
a[i] := 0C
END foo ;
VAR
b: ARRAY [0..4] OF CHAR ;
BEGIN
foo(b)
END testcse3.
m2f-3.8/comp/autotest/cse/testcse31.mod 100644 144 144 1361 6336542177 16471 0 ustar gaius users MODULE testcse31 ;
FROM SYSTEM IMPORT ADDRESS ;
TYPE
DESCRIPTOR= POINTER TO Descriptor ; (* handle onto a process *)
Descriptor= RECORD
Volatiles : ADDRESS ; (* process volatile environment *)
END ;
PROCEDURE TRANSFER (p1, p2: ADDRESS) ;
BEGIN
END TRANSFER ;
PROCEDURE Reschedule ; (* (VAR From, Highest: DESCRIPTOR) ; *)
VAR From, Highest: DESCRIPTOR ;
BEGIN
Highest := NIL ;
IF From#CurrentProcess
THEN
From := CurrentProcess ;
CurrentProcess := Highest ;
TRANSFER(From^.Volatiles, Highest^.Volatiles)
END
END Reschedule ;
VAR
CurrentProcess: DESCRIPTOR ;
BEGIN
Reschedule ; (* (CurrentProcess, CurrentProcess) ; *)
CurrentProcess := NIL
END testcse31.
m2f-3.8/comp/autotest/cse/testcse32.mod 100644 144 144 257 6176123731 16446 0 ustar gaius users MODULE testcse32 ;
FROM MATH IMPORT pi, sin, cos, tan ;
VAR
t, u, v, p: REAL ;
BEGIN
t := sin(pi/2.0) / cos(pi/2.0) ;
u := tan(pi/2.0) / cos(pi/2.0)
END testcse32.
m2f-3.8/comp/autotest/cse/testcse33.mod 100644 144 144 1052 6176123731 16461 0 ustar gaius users MODULE testcse33 ;
CONST
MaxBoxes = 500 ;
MaxX = 120 ; (* 38 ; *)
MaxY = 80 ; (* 24 ; *)
TYPE
Box = RECORD
x1, y1,
x2, y2 : CARDINAL ;
RoomOfBox: CARDINAL ;
END ;
VAR
Boxes : ARRAY [0..MaxBoxes] OF Box ;
NoOfBoxes: CARDINAL ;
PROCEDURE Init ;
BEGIN
NoOfBoxes := 0 ;
(* Initialize box 0 the edge of the map *)
WITH Boxes[0] DO
x1 := 1 ;
x2 := MaxX ;
y1 := 1 ;
y2 := MaxY
END
END Init ;
BEGIN
Init
END testcse33.
m2f-3.8/comp/autotest/cse/testcse34.mod 100644 144 144 251 6176123731 16442 0 ustar gaius users MODULE testcse34 ;
FROM MATH IMPORT pi, sin, cos, tan ;
VAR
t, u, v, p: REAL ;
BEGIN
t := sin(2.0) / cos(2.0) * 2.0 ;
u := tan(2.0) / cos(2.0)
END testcse34.
m2f-3.8/comp/autotest/cse/testcse35.mod 100644 144 144 217 6176123731 16445 0 ustar gaius users MODULE testcse35 ;
FROM SYSTEM IMPORT BYTE ;
VAR
c : CARDINAL ;
b, d: BYTE ;
BEGIN
b := 0 ;
c := 0 ;
d := 0
END testcse35.
m2f-3.8/comp/autotest/cse/testcse36.mod 100644 144 144 134 6176123731 16444 0 ustar gaius users MODULE testcse36 ;
VAR
c, b: CARDINAL ;
BEGIN
c := (1 + b) + (b + 1)
END testcse36.
m2f-3.8/comp/autotest/cse/testcse37.mod 100644 144 144 256 6176123731 16452 0 ustar gaius users MODULE testcse37 ;
PROCEDURE Read (VAR x: REAL) ;
VAR
t: REAL ;
BEGIN
t := 1.0 ;
x := t ;
x := 2.0
END Read ;
VAR
y: REAL ;
BEGIN
Read(y)
END testcse37.
m2f-3.8/comp/autotest/cse/testcse38.mod 100644 144 144 267 6176123731 16455 0 ustar gaius users MODULE testcse38 ;
VAR
a, b: ARRAY [0..10] OF CHAR ;
i : CARDINAL ;
BEGIN
FOR i := 0 TO 10 DO
a[i] := 1 ;
a[i] := a[i] + VAL(CHAR, 1) ;
END
END testcse38.
m2f-3.8/comp/autotest/cse/testcse39.mod 100644 144 144 511 6176123731 16446 0 ustar gaius users MODULE testcse39 ;
TYPE
Ptr = POINTER TO String ;
String = ARRAY [0..10] OF CHAR ;
PROCEDURE Read (VAR a, b: Ptr) ;
BEGIN
a^[0] := b^[0]
END Read ;
VAR
p, q: POINTER TO CHAR ;
c, d: CHAR ;
a, b: Ptr ;
i : CARDINAL ;
BEGIN
a := b ;
b^[i] := b^[3] ;
c := d ;
Read(a, b) ;
END testcse39.
m2f-3.8/comp/autotest/cse/testcse4.mod 100644 144 144 627 6176123731 16366 0 ustar gaius users MODULE testcse4 ;
FROM StrIO IMPORT WriteString, WriteLn ;
CONST
nul = 0C ;
PROCEDURE StrLen (a: ARRAY OF CHAR) : CARDINAL ;
VAR
High,
Len : CARDINAL ;
BEGIN
Len := 0 ;
High := HIGH( a ) ;
WHILE (Len<=High) AND (a[Len]#nul) DO
INC( Len ) ;
END ;
RETURN( Len )
END StrLen ;
BEGIN
IF StrLen('hello')=5
THEN
WriteString('works')
END ;
WriteLn
END testcse4.
m2f-3.8/comp/autotest/cse/testcse40.mod 100644 144 144 173 6176123731 16442 0 ustar gaius users MODULE testcse40 ;
FROM StrIO IMPORT WriteString, WriteLn ;
BEGIN
WriteString('hello world') ; WriteLn
END testcse40.
m2f-3.8/comp/autotest/cse/testcse41.mod 100644 144 144 544 6231146356 16445 0 ustar gaius users MODULE testcse41 ;
FROM SYSTEM IMPORT ADDRESS ;
(*
tests function value.
*)
PROCEDURE myfunc () : ADDRESS ;
BEGIN
RETURN( NIL )
END myfunc ;
VAR
v: POINTER TO RECORD
a, b: CARDINAL ;
END ;
z, x: ADDRESS ;
BEGIN
v := myfunc() ;
x := v ;
WITH v^ DO
a := 2
END ;
z := v
END testcse41.
m2f-3.8/comp/autotest/cse/testcse42.mod 100644 144 144 171 6235646277 16455 0 ustar gaius users MODULE testcse42 ;
VAR
a: ARRAY [2..8] OF CARDINAL ;
c: CARDINAL ;
BEGIN
c := 8 ;
a[4] := c
END testcse42.
m2f-3.8/comp/autotest/cse/testcse43.mod 100644 144 144 3672 6235646277 16507 0 ustar gaius users MODULE testcse43 ;
CONST
MaxSyms = 100 ;
MaxAlias = 100 ;
TYPE
AliasList = POINTER TO AList ;
(*
AList has two main components: List and Syms.
List is contains the alias through its pairing of indices in
the To and From fields.
Syms contains the actual symbols that the List indices reference
together with their mode.
*)
SymIndex = [0..MaxSyms] ;
Alias = RECORD
From, To: SymIndex ; (* index into syms, showing the alias *)
END ;
Symbol = RECORD
addr : CARDINAL ;
Id : CARDINAL ; (* symbol value from SymbolTable.mod *)
Dirty : BOOLEAN ; (* have we written to this symbol yet? *)
Count : CARDINAL ; (* number of times used (read and write) *)
END ;
AList = RECORD
List : ARRAY [1..MaxAlias] OF Alias ;
AliasPtr: CARDINAL ; (* points to the top of the List array *)
Syms : ARRAY [1..MaxSyms] OF Symbol ;
SymPtr : SymIndex ; (* points to the top of the Syms array *)
Next : AliasList ; (* used to store old lists on the free queue *)
END ;
PROCEDURE New () : AliasList ;
BEGIN
RETURN( NIL )
END New ;
PROCEDURE DuplicateAlias (a: AliasList) : AliasList ;
VAR
b: AliasList ;
i: CARDINAL ;
j: CARDINAL ;
BEGIN
b := New() ;
(* it may well be faster simply to perform b^ := a^ ?? *)
i := a^.AliasPtr ;
b^.AliasPtr := i ;
WHILE i>0 DO
b^.List[i] := a^.List[i] ;
DEC(i)
END ;
j := a^.SymPtr ;
b^.SymPtr := j ;
WHILE j>0 DO
b^.Syms[j] := a^.Syms[j] ;
DEC(j)
END ;
RETURN( b )
END DuplicateAlias ;
VAR
a, b: AliasList ;
j, i: CARDINAL ;
BEGIN
b := DuplicateAlias(a)
END testcse43.
m2f-3.8/comp/autotest/cse/testcse44.mod 100644 144 144 342 6235646277 16457 0 ustar gaius users MODULE testcse44 ;
PROCEDURE foo () : BOOLEAN ;
BEGIN
RETURN( TRUE )
END foo ;
VAR
a, b, c, d: CARDINAL ;
BEGIN
a := 1 + b + 1 ;
c := a + b ;
d := a ;
WHILE foo() DO
INC(a, b)
END
END testcse44.
m2f-3.8/comp/autotest/cse/testcse45.mod 100644 144 144 1541 6242575407 16474 0 ustar gaius users MODULE testcse45 ;
TYPE
Where = RECORD
Declared,
FirstUsed: CARDINAL ;
END ;
SymUndefined = RECORD
Name : CARDINAL ; (* Index into name array, name *)
(* of record. *)
At : Where ; (* Where was sym declared/used *)
END ;
VAR
myvar: SymUndefined ;
PROCEDURE InitWhereDeclared (VAR at: Where) ;
BEGIN
WITH at DO
Declared := 1 ;
FirstUsed := 2
END
END InitWhereDeclared ;
(*
MakeUnbounded - makes an unbounded array Symbol.
No name is required.
*)
PROCEDURE MakeUnbounded ;
BEGIN
WITH myvar DO
InitWhereDeclared(At) (* Declared here *)
END
END MakeUnbounded ;
BEGIN
MakeUnbounded
END testcse45.
m2f-3.8/comp/autotest/cse/testcse46.mod 100644 144 144 150 6347254222 16443 0 ustar gaius users MODULE testcse46 ;
VAR
i, j: CARDINAL ;
BEGIN
j := 10 ;
i := j+i ;
i := 10
END testcse46.
m2f-3.8/comp/autotest/cse/testcse5.mod 100644 144 144 2324 6176123732 16404 0 ustar gaius users MODULE testcse5 ;
FROM StrIO IMPORT WriteString, WriteLn ;
FROM StrLib IMPORT StrLen, StrCopy ;
CONST
nul = 0C ;
PROCEDURE StrEqual (a, b: ARRAY OF CHAR) : BOOLEAN ;
VAR
i,
Higha,
Highb: CARDINAL ;
Equal: BOOLEAN ;
BEGIN
Higha := StrLen( a ) ;
Highb := StrLen( b ) ;
IF Higha=Highb
THEN
Equal := TRUE ;
i := 0 ;
WHILE Equal AND (i<Higha) DO
Equal := (a[i]=b[i]) ;
INC( i )
END
ELSE
Equal := FALSE
END ;
RETURN( Equal )
END StrEqual ;
(*
PROCEDURE StrLen (a: ARRAY OF CHAR) : CARDINAL ;
VAR
High,
Len : CARDINAL ;
BEGIN
Len := 0 ;
High := HIGH( a ) ;
WHILE (Len<=High) AND (a[Len]#nul) DO
INC( Len ) ;
END ;
RETURN( Len )
END StrLen ;
PROCEDURE StrCopy (a: ARRAY OF CHAR ; VAR b: ARRAY OF CHAR) ;
VAR
Higha,
Highb,
n : CARDINAL ;
BEGIN
n := 0 ;
Higha := StrLen( a ) ;
Highb := HIGH( b ) ;
WHILE (n<Higha) AND (n<=Highb) DO
b[n] := a[n] ;
INC( n )
END ;
IF n<=Highb
THEN
b[n] := nul
END
END StrCopy ;
*)
VAR
a: ARRAY [0..10] OF CHAR ;
BEGIN
StrCopy('hello', a) ;
IF StrEqual(a, 'hello')
THEN
WriteString('works')
END ;
WriteLn
END testcse5.
m2f-3.8/comp/autotest/cse/testcse6.mod 100644 144 144 451 6176123732 16364 0 ustar gaius users MODULE testcse6 ;
(*
PROCEDURE foo ;
BEGIN
a := b + c + d + e + f + g + h
END foo ;
*)
VAR
a, b, c, d, e, f, g, h: CARDINAL ;
BEGIN
d := c ;
b := c ;
e := c ;
f := c ;
g := c ;
h := c ;
a := b + c ;
IF a=0
THEN
c := 5
END ;
a := a + 1
END testcse6.
m2f-3.8/comp/autotest/cse/testcse7.mod 100644 144 144 1021 6176123732 16377 0 ustar gaius users MODULE testcse7 ;
TYPE
Where = RECORD
Declared : CARDINAL ;
FirstUsed: CARDINAL ;
END ;
(*
foo -
*)
PROCEDURE foo () : CARDINAL ;
BEGIN
RETURN( 1 )
END foo ;
PROCEDURE InitWhereDeclared (VAR at: Where) : CARDINAL ;
BEGIN
WITH at DO
Declared := foo() ;
FirstUsed := Declared (* we assign this field to something legal *)
END ;
RETURN( foo() )
END InitWhereDeclared ;
VAR
a: Where ;
BEGIN
IF InitWhereDeclared(a)=1
THEN
END
END testcse7.
m2f-3.8/comp/autotest/cse/testcse8.mod 100644 144 144 1332 6176123732 16405 0 ustar gaius users MODULE testcse8 ;
PROCEDURE StrLen (a: ARRAY OF CHAR) : CARDINAL ;
BEGIN
RETURN( 1 )
END StrLen ;
PROCEDURE Space (ch: CHAR) : BOOLEAN ;
BEGIN
RETURN( TRUE )
END Space ;
PROCEDURE GetNextArg (CmdLine: ARRAY OF CHAR; VAR CmdIndex: CARDINAL;
VAR Arg: ARRAY OF CHAR) : BOOLEAN ;
VAR
ArgIndex: CARDINAL ; (* Index into Arg *)
HighA,
HighC: CARDINAL ;
BEGIN
HighA := HIGH(Arg) ;
HighC := StrLen(CmdLine) ;
ArgIndex := 0 ;
(* Skip spaces *)
WHILE (CmdIndex<HighC) AND Space(CmdLine[CmdIndex]) DO
INC(CmdIndex)
END ;
RETURN( TRUE )
END GetNextArg ;
VAR
a : ARRAY [0..20] OF CHAR ;
i, j: CARDINAL ;
BEGIN
IF GetNextArg(a, i, a)
THEN
END
END testcse8.
m2f-3.8/comp/autotest/cse/testsize.mod 100644 144 144 220 6360130422 16455 0 ustar gaius users MODULE testsize ;
FROM SYSTEM IMPORT SIZE, BYTE ;
VAR
a: ARRAY [0..1] OF BYTE ;
i: CARDINAL ;
BEGIN
i := SIZE(a) DIV 2
END testsize.
m2f-3.8/comp/autotest/dynamic/ 40755 144 144 0 6743317473 14727 5 ustar gaius users m2f-3.8/comp/autotest/dynamic/CVS/ 40755 144 144 0 6636505127 15356 5 ustar gaius users m2f-3.8/comp/autotest/dynamic/CVS/Root 100644 144 144 15 6402517644 16253 0 ustar gaius users /usr/src/cvs
m2f-3.8/comp/autotest/dynamic/CVS/Repository 100644 144 144 46 6402517644 17513 0 ustar gaius users /usr/src/cvs/m2/comp/autotest/dynamic
m2f-3.8/comp/autotest/dynamic/CVS/Entries 100644 144 144 10177 6636505127 17035 0 ustar gaius users /makefile/1.1/Wed Jan 15 15:06:16 1997//
/options/1.1/Wed Jan 15 15:06:17 1997//
/prog21.mod/1.1/Wed Mar 12 15:56:51 1997//
/testarray.mod/1.1/Mon Feb 24 18:00:41 1997//
/testarray2.mod/1.1/Mon Feb 24 18:00:42 1997//
/testarray3.mod/1.1/Mon Feb 24 18:00:42 1997//
/testarray4.mod/1.1/Mon Feb 24 18:00:42 1997//
/testarray5.mod/1.1/Wed Mar 26 14:26:35 1997//
/testbec.mod/1.1/Wed Jan 15 15:06:17 1997//
/testbec10.mod/1.1/Wed Jan 15 15:06:17 1997//
/testbec11.mod/1.1/Wed Jan 15 15:06:17 1997//
/testbec12.mod/1.1/Wed Jan 15 15:06:17 1997//
/testbec13.mod/1.1/Wed Jan 15 15:06:17 1997//
/testbec14.mod/1.1/Wed Jan 15 15:06:17 1997//
/testbec15.mod/1.1/Wed Jan 15 15:06:17 1997//
/testbec16.mod/1.1/Wed Jan 15 15:06:17 1997//
/testbec17.mod/1.1/Wed Jan 15 15:06:17 1997//
/testbec18.mod/1.1/Wed Jan 15 15:06:18 1997//
/testbec19.mod/1.1/Wed Jan 15 15:06:18 1997//
/testbec2.mod/1.1/Wed Jan 15 15:06:18 1997//
/testbec20.mod/1.1/Wed Jan 15 15:06:18 1997//
/testbec21.mod/1.1/Wed Jan 15 15:06:18 1997//
/testbec22.mod/1.1/Wed Jan 15 15:06:18 1997//
/testbec23.mod/1.1/Wed Jan 15 15:06:18 1997//
/testbec24.mod/1.1/Wed Jan 15 15:06:18 1997//
/testbec25.mod/1.1/Wed Jan 15 15:06:18 1997//
/testbec26.mod/1.1/Wed Jan 15 15:06:18 1997//
/testbec27.mod/1.1/Wed Jan 15 15:06:19 1997//
/testbec28.mod/1.1/Wed Jan 15 15:06:19 1997//
/testbec29.mod/1.1/Wed Jan 15 15:06:19 1997//
/testbec3.mod/1.1/Wed Jan 15 15:06:19 1997//
/testbec30.mod/1.1/Wed Jan 15 15:06:19 1997//
/testbec31.mod/1.1/Wed Mar 12 15:38:30 1997//
/testbec32.mod/1.1/Wed Mar 12 15:38:31 1997//
/testbec33.mod/1.1/Wed Mar 12 15:38:32 1997//
/testbec34.mod/1.1/Wed Mar 12 15:38:32 1997//
/testbec35.mod/1.1/Wed Mar 12 15:38:32 1997//
/testbec36.mod/1.1/Wed Mar 12 15:38:32 1997//
/testbec37.mod/1.1/Wed Mar 12 15:38:32 1997//
/testbec38.mod/1.1/Tue Jun 10 13:37:22 1997//
/testbec4.mod/1.1/Wed Jan 15 15:06:19 1997//
/testbec5.mod/1.1/Wed Jan 15 15:06:19 1997//
/testbec6.mod/1.1/Wed Jan 15 15:06:19 1997//
/testbec7.mod/1.1/Wed Jan 15 15:06:19 1997//
/testbec8.mod/1.1/Wed Jan 15 15:06:19 1997//
/testbec9.mod/1.1/Wed Jan 15 15:06:19 1997//
/testdavid.mod/1.1/Tue Jun 10 13:37:23 1997//
/testdiv.mod/1.1/Tue Jun 10 13:37:24 1997//
/testfor.mod/1.1/Mon Feb 24 18:00:42 1997//
/testfunc.mod/1.1/Wed Mar 12 15:56:51 1997//
/testit.mod/1.1/Wed Mar 12 15:56:51 1997//
/testloop.mod/1.1/Mon Feb 24 18:00:42 1997//
/testloop2.mod/1.1/Mon Feb 24 18:00:42 1997//
/testloop3.mod/1.1/Mon Feb 24 18:00:42 1997//
/testloop4.mod/1.1/Mon Feb 24 18:00:42 1997//
/testloop5.mod/1.1/Mon Feb 24 18:00:42 1997//
/testmin.mod/1.1/Mon Feb 24 18:00:42 1997//
/testnum4.mod/1.1/Wed Mar 12 16:04:25 1997//
/testord.mod/1.1/Mon Feb 24 18:00:43 1997//
/testproc.mod/1.1/Thu Jan 23 14:09:35 1997//
/testset.mod/1.1/Wed Mar 12 15:38:32 1997//
/testset2.mod/1.1/Wed Mar 12 15:38:32 1997//
/testset3.mod/1.1/Tue Jun 10 13:37:24 1997//
/teststr.mod/1.1/Thu Jan 23 14:09:35 1997//
/teststr2.mod/1.1/Thu Jan 23 14:09:35 1997//
/teststring.mod/1.1/Thu Jan 23 14:09:35 1997//
/testunbounded.mod/1.1/Tue Jun 10 13:37:24 1997//
/testzero.mod/1.1/Wed Mar 12 15:56:51 1997//
/wc.mod/1.1/Wed Mar 12 15:50:41 1997//
/testbec39.mod/1.1/Fri Oct 31 17:33:05 1997//
/testparam.mod/1.1/Fri Oct 31 20:46:31 1997//
/testbec40.mod/1.1/Thu Nov 6 11:46:14 1997//
/testbec41.mod/1.1/Thu Nov 20 16:39:03 1997//
/testbec42.mod/1.1/Fri Nov 28 11:16:34 1997//
/testbec43.mod/1.1/Fri Nov 21 22:35:04 1997//
/testhidden.mod/1.1/Thu Nov 6 09:53:17 1997//
/testbec45.mod/1.1/Thu Jan 8 12:40:58 1998//
/testwith.mod/1.1/Tue Dec 16 16:59:57 1997//
/testbec44.mod/1.4/Sat Jan 24 10:39:22 1998//
/testarray6.mod/1.1/Tue Feb 3 10:02:45 1998//
/testbec44.586/1.1/Mon Jan 26 10:09:46 1998//
/testbec44.apu/1.1/Sat Jan 24 10:39:59 1998//
/testfor2.mod/1.1/Tue May 26 10:40:00 1998//
/testfunc2.mod/1.1/Sat May 16 13:32:26 1998//
/testfunc3.mod/1.1/Sat May 16 18:04:42 1998//
/testfunc4.mod/1.1/Thu May 21 16:48:10 1998//
/testfunc5.mod/1.1/Fri May 22 12:36:39 1998//
/testfunc6.mod/1.1/Mon Jun 22 19:34:20 1998//
/testparam2.mod/1.1/Thu Jun 25 09:57:16 1998//
/add.mod/1.1/Tue Jul 21 14:25:38 1998//
/testscn.mod/1.1/Wed Sep 2 15:41:45 1998//
/testexp.mod/1.1/Tue Nov 24 08:15:39 1998//
/testif.mod/1.1/Tue Nov 24 12:55:15 1998//
D
m2f-3.8/comp/autotest/dynamic/makefile 100644 144 144 61 6267171150 16450 0 ustar gaius users
all: force
clean: force
$(RM) *.s *~
force:
m2f-3.8/comp/autotest/dynamic/options 100644 144 144 20 6267171151 16362 0 ustar gaius users -O -g -Odynamic
m2f-3.8/comp/autotest/dynamic/prog21.mod 100644 144 144 10154 6311551103 16635 0 ustar gaius users MODULE prog21;
(* Referral exercise from 1995 *)
(* Author - Stuart F Lewis March 1997 *)
(* Reads student sports race data from a file *)
(* stores in an array*)
(* displays the results *)
(* MODEL SOLUTION FOR prog21 for course.swd *)
FROM StrIO IMPORT WriteLn,WriteString,ReadString;
FROM StrLib IMPORT StrEqual, StrLess, StrConCat;
FROM StdIO IMPORT Read, Write;
FROM NumberIO IMPORT WriteInt, ReadCard,WriteCard;
FROM ASCII IMPORT eof;
CONST
MaxPeople = 20;
EndOfRaceMark = 'qqqqqqqqqq';
TYPE
Rec = RECORD
strdata : ARRAY[0..9] OF CHAR;
END;
name_type = ARRAY[0..9] OF CHAR;
OnePerson = RECORD
name : name_type;
score : CARDINAL;
END;
All = ARRAY[1..MaxPeople] OF OnePerson;
VAR
draw,position,Npeople,count : CARDINAL;
Results : All;
PROCEDURE continue;
VAR
ch : CHAR;
BEGIN
WriteLn;
WriteString("press ENTER to continue > ");
Read(ch);
END continue;
(* main program procedures start here *)
PROCEDURE Initialise;
BEGIN
Npeople := 0;
FOR count :=1 TO MaxPeople DO
WITH Results[count] DO
name := ' ';
score := 0;
END;(*with*)
END;(*for*)
END Initialise;
PROCEDURE SearchFor(temp : name_type;in : All ;
VAR Index : CARDINAL) : BOOLEAN ;
BEGIN
FOR count :=1 TO Npeople DO
WITH in[count] DO
IF StrEqual(name,temp)
THEN
Index := count;
RETURN TRUE;
END;(*if*)
END;(*with*)
END;(*for*)
RETURN FALSE;
END SearchFor;
PROCEDURE Add(temp : name_type;VAR in : All ; VAR Index : CARDINAL) ;
BEGIN
Npeople := Npeople +1;
WITH in[Npeople] DO
name := temp;
END;(*with*)
Index := Npeople;
END Add;
PROCEDURE ReadStr10(VAR temp : name_type) ;
BEGIN
temp := ' ';
ReadString(temp);
StrConCat(temp,' ',temp);
WriteString(temp);
WriteString('****');
WriteLn;
END ReadStr10;
PROCEDURE InputData;
VAR
race,temp : name_type;
Index,points : CARDINAL;
BEGIN
ReadStr10(race);
WHILE NOT StrEqual(race,EndOfRaceMark) DO
ReadStr10(temp); (*blank line*)
ReadStr10(temp); (*first person in a race*)
points := 3; (*first place*)
WHILE StrEqual(temp,EndOfRaceMark) DO
IF NOT SearchFor(temp,Results,Index) THEN
Add(temp,Results,Index);
END;(*if*)
IF points > 0 THEN
Results[Index].score := Results[Index].score + points;
points := points - 1;
END;(*if*)
ReadStr10(temp);
END;(*while same race*)
(* ReadStr10(temp); blank line*)
ReadStr10(race);
END;(*while races*)
WriteString(race);
END InputData;
PROCEDURE OutputResults;
BEGIN
position := 1;
draw := 0;
FOR count :=1 TO Npeople DO
WITH Results[count] DO
WriteString(name);
WriteCard(score,6);
WriteCard(position,4);
IF score > Results[count + 1].score
THEN
position := position + 1 + draw;
IF draw > 0
THEN
draw := 0;
WriteString("=");
END;(*if*)
END;(*if*)
IF (score = Results[count + 1].score)
THEN
draw := draw + 1;
WriteString("=");
END;(*if*)
WriteLn;
END;(*with*)
END;(*for*)
END OutputResults;
PROCEDURE Less(first,second : CARDINAL) : BOOLEAN;
BEGIN
(*compares score first then name to maintain order *)
(* comparison is back to front because we want descending order*)
IF Results[first].score > Results[second].score
THEN RETURN TRUE
ELSE
IF (Results[first].score = Results[second].score)
AND (StrLess(Results[first].name,Results[second].name))
THEN RETURN TRUE
ELSE RETURN FALSE
END;(*IF*)
END;(*IF*)
END Less;
PROCEDURE Swap(first,second : CARDINAL);
VAR
temp : OnePerson;
BEGIN
temp := Results[first];
Results[first] := Results[second];
Results[second] := temp;
END Swap;
BEGIN (*main program*)
Initialise;
InputData;
WriteLn;
(*HSort(Npeople,Less,Swap);*)
OutputResults;
END prog21.
m2f-3.8/comp/autotest/dynamic/testarray.mod 100644 144 144 1002 6304353511 17516 0 ustar gaius users MODULE testarray ;
PROCEDURE bufreadchar (Id: CARDINAL) : INTEGER ;
VAR
object: CHAR;
BEGIN
WITH files[ Id ] DO
object := buf[bufindex];
INC(bufindex);
RETURN( ORD(object) ) ;
END
END bufreadchar ;
VAR
files: ARRAY [0..10] OF RECORD
count,
bufindex: CARDINAL ;
buf : ARRAY [0..5] OF CHAR ;
END ;
i: INTEGER ;
BEGIN
i := bufreadchar(1)
END testarray.
m2f-3.8/comp/autotest/dynamic/testarray2.mod 100644 144 144 225 6304353512 17567 0 ustar gaius users MODULE testarray2 ;
VAR
a : ARRAY [0..10] OF CARDINAL ;
z, i: CARDINAL ;
BEGIN
z := a[i] ;
INC(i) ;
z := z + a[i]
END testarray2.
m2f-3.8/comp/autotest/dynamic/testarray3.mod 100644 144 144 171 6304353512 17570 0 ustar gaius users MODULE testarray3 ;
VAR
a, b, i: CARDINAL ;
BEGIN
a := i ;
INC(i) ;
b := i ;
b := b + a
END testarray3.
m2f-3.8/comp/autotest/dynamic/testarray4.mod 100644 144 144 353 6304353512 17573 0 ustar gaius users MODULE testarray4 ;
PROCEDURE foo () : CARDINAL ;
VAR
t,
i: INTEGER ;
BEGIN
t := a[i] ;
INC(i, i*3) ;
RETURN( t )
END foo ;
VAR
a: ARRAY [-10..10] OF INTEGER ;
i: CARDINAL ;
BEGIN
i := foo()
END testarray4.
m2f-3.8/comp/autotest/dynamic/testarray5.mod 100644 144 144 434 6316231033 17570 0 ustar gaius users MODULE testarray5 ;
FROM StrIO IMPORT WriteString, WriteLn ;
TYPE
foo = RECORD
a, b, c: CARDINAL ;
END ;
VAR
a : ARRAY [0..10] OF foo ;
i, j: CARDINAL ;
BEGIN
IF a[i]=a[j]
THEN
WriteString('hello world') ; WriteLn
END
END testarray5.
m2f-3.8/comp/autotest/dynamic/testbec.mod 100644 144 144 532 6267171151 17126 0 ustar gaius users MODULE testbec ;
FROM SYSTEM IMPORT ADR ;
(*
PROCEDURE foo ;
BEGIN
a := 1 ;
p^ := 1 ;
b := 1 ;
c := 1
END foo ;
*)
VAR
p : POINTER TO CARDINAL ;
a, b, c, d, e: CARDINAL ;
r : ARRAY [0..10] OF CARDINAL ;
BEGIN
(* foo ; *)
a := b + c - (d + e) - (a + b) ; (* works *)
LOOP END
END testbec.
m2f-3.8/comp/autotest/dynamic/testbec10.mod 100644 144 144 575 6267171151 17276 0 ustar gaius users MODULE testbec10 ;
FROM SYSTEM IMPORT ADR, ADDRESS ;
TYPE
foo = RECORD
a, b: CARDINAL ;
z, f: CARDINAL ;
x, y: CARDINAL ;
ch : CHAR ;
END ;
VAR
q: POINTER TO foo ;
p: POINTER TO CARDINAL ;
c: CARDINAL ;
r: foo ;
a: ADDRESS ;
BEGIN
c := p^ + 4 + c ;
q := ADR(p) + a ;
r := q^ ;
END testbec10.
m2f-3.8/comp/autotest/dynamic/testbec11.mod 100644 144 144 615 6267171151 17272 0 ustar gaius users MODULE testbec11 ;
FROM SYSTEM IMPORT ADR ;
TYPE
foo = RECORD
a, b: CARDINAL ;
z, f: CARDINAL ;
x, y: CARDINAL ;
ch : CHAR ;
END ;
PROCEDURE bar ;
VAR
a: CARDINAL ;
BEGIN
p := ADR(a)
END bar ;
VAR
q: POINTER TO foo ;
p: POINTER TO CARDINAL ;
c: CARDINAL ;
r: foo ;
BEGIN
bar ;
p := ADR(c) ;
END testbec11.
m2f-3.8/comp/autotest/dynamic/testbec12.mod 100644 144 144 125 6267171151 17267 0 ustar gaius users MODULE testbec12 ;
VAR
a, b, c: CARDINAL ;
BEGIN
a := b DIV c
END testbec12.
m2f-3.8/comp/autotest/dynamic/testbec13.mod 100644 144 144 160 6267171151 17267 0 ustar gaius users MODULE testbec13 ;
VAR
a, b, c, d, e, f: CARDINAL ;
BEGIN
a := b DIV ((c + d + e) DIV f)
END testbec13.
m2f-3.8/comp/autotest/dynamic/testbec14.mod 100644 144 144 160 6267171151 17270 0 ustar gaius users MODULE testbec14 ;
VAR
a, b, c, d, e, f: CARDINAL ;
BEGIN
a := b DIV ((c + d + e) MOD f)
END testbec14.
m2f-3.8/comp/autotest/dynamic/testbec15.mod 100644 144 144 206 6267171151 17272 0 ustar gaius users MODULE testbec15 ;
VAR
a, b, c, d, e, f, g, h: CARDINAL ;
BEGIN
a := (b DIV ((c + d + e) MOD f)) DIV (g MOD h)
END testbec15.
m2f-3.8/comp/autotest/dynamic/testbec16.mod 100644 144 144 237 6267171151 17277 0 ustar gaius users MODULE testbec16 ;
VAR
a, b, c, d, e, f, g, h, i, j, k: CARDINAL ;
BEGIN
a := (b DIV ((c + d + e) MOD f)) DIV ((i + j + k) MOD (g + h))
END testbec16.
m2f-3.8/comp/autotest/dynamic/testbec17.mod 100644 144 144 235 6267171151 17276 0 ustar gaius users MODULE testbec17 ;
VAR
a, b, c, d, e, f, g, h, i, j, k: CARDINAL ;
BEGIN
a := (b DIV ((c + d + e) MOD f)) * ((i + j + k) MOD (g + h))
END testbec17.
m2f-3.8/comp/autotest/dynamic/testbec18.mod 100644 144 144 163 6267171152 17300 0 ustar gaius users MODULE testbec18 ;
VAR
a, b, c, d, e, f, g, h, i, j, k: CARDINAL ;
BEGIN
a := b * (c + d) ;
END testbec18.
m2f-3.8/comp/autotest/dynamic/testbec19.mod 100644 144 144 252 6267171152 17300 0 ustar gaius users MODULE testbec19 ;
VAR
a, b, c, d, e, f, g, h, i, j, k, l: CARDINAL ;
BEGIN
a := (b DIV ((c + d + e) MOD f)) * ((i + j + k) MOD (g + h)) * (l * 2)
END testbec19.
m2f-3.8/comp/autotest/dynamic/testbec2.mod 100644 144 144 137 6267171152 17212 0 ustar gaius users MODULE testbec2 ;
VAR
a, b, c, d: CARDINAL ;
BEGIN
INC(a) ;
LOOP END
END testbec2.
m2f-3.8/comp/autotest/dynamic/testbec20.mod 100644 144 144 123 6267171152 17265 0 ustar gaius users MODULE testbec20 ;
VAR
a, b, c: CARDINAL ;
BEGIN
a := b * 2
END testbec20.
m2f-3.8/comp/autotest/dynamic/testbec21.mod 100644 144 144 120 6267171152 17263 0 ustar gaius users MODULE testbec21 ;
VAR
a, b: CARDINAL ;
BEGIN
a := b * 2
END testbec21.
m2f-3.8/comp/autotest/dynamic/testbec22.mod 100644 144 144 250 6267171152 17270 0 ustar gaius users MODULE testbec22 ;
VAR
i, j : INTEGER ;
a, b, c, d: CARDINAL ;
BEGIN
a := b * 8 ;
c := d DIV 8 ;
d := a MOD 256 ;
i := j MOD 4
END testbec22.
m2f-3.8/comp/autotest/dynamic/testbec23.mod 100644 144 144 244 6267171152 17274 0 ustar gaius users MODULE testbec23 ;
TYPE
foo = RECORD
a, b: CARDINAL ;
END ;
VAR
p : POINTER TO foo ;
x, y: foo ;
BEGIN
x := p^
END testbec23.
m2f-3.8/comp/autotest/dynamic/testbec24.mod 100644 144 144 244 6267171152 17275 0 ustar gaius users MODULE testbec24 ;
TYPE
foo = RECORD
a, b: CARDINAL ;
END ;
VAR
p : POINTER TO foo ;
x, y: foo ;
BEGIN
p^ := x
END testbec24.
m2f-3.8/comp/autotest/dynamic/testbec25.mod 100644 144 144 173 6267171152 17277 0 ustar gaius users MODULE testbec25 ;
VAR
p, q: POINTER TO CARDINAL ;
x, y: CARDINAL ;
BEGIN
p^ := x ;
y := q^
END testbec25.
m2f-3.8/comp/autotest/dynamic/testbec26.mod 100644 144 144 163 6267171152 17277 0 ustar gaius users MODULE testbec26 ;
VAR
p, q: POINTER TO CARDINAL ;
y : CARDINAL ;
BEGIN
y := q^ + p^
END testbec26.
m2f-3.8/comp/autotest/dynamic/testbec27.mod 100644 144 144 464 6267171153 17305 0 ustar gaius users MODULE testbec27 ;
VAR
a, b, c, d, e, f, g, h, i, j, k, l, m, n, o: CARDINAL ;
BEGIN
(*
a := ((b DIV c) DIV ((d DIV e) DIV f)) DIV ((g DIV h) DIV ((i DIV j) DIV k)) ;
*)
a := b MOD c MOD d MOD e MOD f MOD g MOD h MOD i MOD j MOD k MOD l MOD m ;
(*
a := (b MOD c) DIV (e MOD f)
*)
END testbec27.
m2f-3.8/comp/autotest/dynamic/testbec28.mod 100644 144 144 136 6267171153 17302 0 ustar gaius users MODULE testbec28 ;
VAR
a, b: ARRAY [0..100] OF CARDINAL ;
BEGIN
a := b
END testbec28.
m2f-3.8/comp/autotest/dynamic/testbec29.mod 100644 144 144 241 6267171153 17300 0 ustar gaius users MODULE testbec29 ;
TYPE
t = ARRAY [0..100] OF CARDINAL ;
VAR
p : POINTER TO t ;
a : t ;
BEGIN
p^ := a ;
p^ := 'abcdefghijkl'
END testbec29.
m2f-3.8/comp/autotest/dynamic/testbec3.mod 100644 144 144 151 6267171153 17210 0 ustar gaius users MODULE testbec3 ;
VAR
a, b, c, d: CARDINAL ;
BEGIN
a := a + b + 1 -c ;
LOOP END
END testbec3.
m2f-3.8/comp/autotest/dynamic/testbec30.mod 100644 144 144 152 6267171153 17271 0 ustar gaius users MODULE testbec30 ;
VAR
a, b: ARRAY [0..100] OF CARDINAL ;
BEGIN
a := 'hello world'
END testbec30.
m2f-3.8/comp/autotest/dynamic/testbec31.mod 100644 144 144 217 6311546766 17302 0 ustar gaius users MODULE testbec31 ;
TYPE
foo = RECORD
a, b, c: CARDINAL ;
END ;
VAR
x, y, z: foo ;
BEGIN
x := y
END testbec31.
m2f-3.8/comp/autotest/dynamic/testbec32.mod 100644 144 144 270 6311546767 17303 0 ustar gaius users MODULE testbec32 ;
TYPE
foo = RECORD
a, b, c: CARDINAL ;
END ;
PROCEDURE bar ;
VAR
x, y, z: foo ;
BEGIN
x := y
END bar ;
BEGIN
bar
END testbec32.
m2f-3.8/comp/autotest/dynamic/testbec33.mod 100644 144 144 327 6311546770 17301 0 ustar gaius users MODULE testbec33 ;
(* works *)
TYPE
foo = RECORD
a, b, c: CARDINAL ;
END ;
PROCEDURE bar ;
VAR
x: foo ;
y: POINTER TO foo ;
BEGIN
x := y^
END bar ;
BEGIN
bar
END testbec33.
m2f-3.8/comp/autotest/dynamic/testbec34.mod 100644 144 144 256 6311546770 17303 0 ustar gaius users MODULE testbec34 ;
(* works *)
TYPE
foo = RECORD
a, b, c: CARDINAL ;
END ;
VAR
x: foo ;
y: POINTER TO foo ;
BEGIN
x := y^
END testbec34.
m2f-3.8/comp/autotest/dynamic/testbec35.mod 100644 144 144 255 6311546770 17303 0 ustar gaius users MODULE testbec35 ;
(* works *)
TYPE
foo = RECORD
a, b, c: CARDINAL ;
END ;
VAR
x: POINTER TO foo ;
y: foo ;
BEGIN
x^ := y
END testbec35.
m2f-3.8/comp/autotest/dynamic/testbec36.mod 100644 144 144 327 6311546770 17304 0 ustar gaius users MODULE testbec36 ;
(* works *)
TYPE
foo = RECORD
a, b, c: CARDINAL ;
END ;
PROCEDURE bar ;
VAR
x: POINTER TO foo ;
y: foo ;
BEGIN
x^ := y
END bar ;
BEGIN
bar
END testbec36.
m2f-3.8/comp/autotest/dynamic/testbec37.mod 100644 144 144 451 6311546770 17303 0 ustar gaius users MODULE testbec37 ;
TYPE
foo = RECORD
a, b: CARDINAL ;
END ;
PROCEDURE bar ;
VAR
i, j: CARDINAL ;
t : foo ;
BEGIN
t := Sources[i] ;
Sources[i] := Sources[j] ;
Sources[j] := t
END bar ;
VAR
Sources: ARRAY [0..10] OF foo ;
BEGIN
bar
END testbec37.
m2f-3.8/comp/autotest/dynamic/testbec38.mod 100644 144 144 277 6347254222 17307 0 ustar gaius users MODULE testbec38 ;
PROCEDURE kill (VAR i: CARDINAL) ;
BEGIN
END kill ;
PROCEDURE test ;
VAR
i, j: CARDINAL ;
BEGIN
i := j ;
kill(i)
END test ;
BEGIN
test
END testbec38.
m2f-3.8/comp/autotest/dynamic/testbec4.mod 100644 144 144 234 6267171153 17213 0 ustar gaius users MODULE testbec4 ;
PROCEDURE foo ;
VAR
ch: CHAR ;
BEGIN
ch := 'a' ;
WHILE ch='a' DO
ch := 'b'
END
END foo ;
BEGIN
foo
END testbec4.
m2f-3.8/comp/autotest/dynamic/testbec5.mod 100644 144 144 410 6267171153 17210 0 ustar gaius users MODULE testbec5 ;
FROM SYSTEM IMPORT ADR, ADDRESS ;
PROCEDURE foo ;
VAR
ch: CHAR ;
a : ADDRESS ;
BEGIN
a := ADR(ch) ;
ch := 'a' ;
WHILE ch='a' DO
a := ADR(ch) ;
ch := 'b'
END ;
a := ADR(ch)
END foo ;
BEGIN
foo
END testbec5.
m2f-3.8/comp/autotest/dynamic/testbec6.mod 100644 144 144 327 6267171153 17220 0 ustar gaius users MODULE testbec6 ;
PROCEDURE foo (a, b, c: CARDINAL) : CARDINAL ;
BEGIN
g := foo(a, b, c) ;
RETURN( a+b+c )
END foo ;
VAR
a, b, c, d: CARDINAL ;
g: CARDINAL ;
BEGIN
g := foo(a, b, c)
END testbec6.
m2f-3.8/comp/autotest/dynamic/testbec7.mod 100644 144 144 463 6267171153 17222 0 ustar gaius users MODULE testbec7 ;
PROCEDURE foo (i: CARDINAL) : CARDINAL ;
BEGIN
RETURN( i )
END foo ;
PROCEDURE bar ;
VAR
a: ARRAY [0..10] OF CARDINAL ;
i: CARDINAL ;
BEGIN
IF foo(1)=foo(2)
THEN
bar
END ;
FOR i := 0 TO 10 DO
a[i] := foo(i)
END
END bar ;
BEGIN
bar
END testbec7.
m2f-3.8/comp/autotest/dynamic/testbec8.mod 100644 144 144 220 6267171153 17212 0 ustar gaius users MODULE testbec8 ;
PROCEDURE bar ;
VAR
i, j, k: CARDINAL ;
BEGIN
i := j DIV 10 ;
k := j MOD 10
END bar ;
BEGIN
bar
END testbec8.
m2f-3.8/comp/autotest/dynamic/testbec9.mod 100644 144 144 145 6267171153 17221 0 ustar gaius users MODULE testbec9 ;
VAR
a, b, t: CARDINAL ;
BEGIN
t := a ;
a := b ;
b := t
END testbec9.
m2f-3.8/comp/autotest/dynamic/testdavid.mod 100644 144 144 412 6347254223 17462 0 ustar gaius users MODULE testdavid ;
VAR
i, j, k, l, m: CARDINAL ;
BEGIN
j := 5 ;
k := 6 ;
i := j+(k*j)+k-j ; (* 5+(6*5)+6-5 = 36 *)
l := j*i-k+(j*i) ; (* 5*36-6+(5*36) = 354 *)
m := j+k+i*l-m ; (* 5+6+36*354 = 12755 *)
i := l+m
END testdavid.
m2f-3.8/comp/autotest/dynamic/testdiv.mod 100644 144 144 5247 6347254224 17211 0 ustar gaius users MODULE testdiv ;
FROM SYSTEM IMPORT ADDRESS ;
FROM NumberIO IMPORT WriteCard ;
FROM StrIO IMPORT WriteString, WriteLn ;
FROM StrLib IMPORT StrLen ;
CONST
ClockFreq = 20 ;
TYPE
ProcType = (User, System) ;
ProcStatus = (Runnable, WaitOnSem, WaitOnIO, Suspended, Killed, Sleeping) ;
PtrToProcDes = POINTER TO ProcessDescriptor ;
ProcessDescriptor = RECORD
RightPtr : PtrToProcDes ;
LeftPtr : PtrToProcDes ;
RightRunPtr : PtrToProcDes ;
LeftRunPtr : PtrToProcDes ;
RightOwner : PtrToProcDes ;
LeftOwner : PtrToProcDes ;
Father : PtrToProcDes ;
Sons : PtrToProcDes ;
PPriority : CARDINAL ; (* 0..MaxPriority *)
PQuanta : CARDINAL ;
PMemorySize : CARDINAL ;
PMemoryStart : ADDRESS ;
PHeapSize : CARDINAL ;
PHeapStart : ADDRESS ;
PFreeMem : ADDRESS ;
TimeSecs : CARDINAL ;
PName : ARRAY [0..15] OF CHAR ;
Process : ADDRESS ;
PType : ProcType ;
PCurrentStatus: ProcStatus ;
PNextStatus : ProcStatus ;
END ;
PROCEDURE WriteProcess (p: PtrToProcDes) ;
VAR
i : CARDINAL ;
BEGIN
(*
WriteString( p^.PName ) ;
i := HIGH( p^.PName )-StrLen( p^.PName ) ;
WHILE i>0 DO
WriteString(' ') ;
DEC( i )
END ;
*)
WITH p^ DO
(*
WriteCard( PMemorySize DIV 1024, 6 ) ;
WriteString('k (') ;
IF PMemorySize#0
THEN
WriteCard( (PMemorySize -
(CARDINAL(Process) - CARDINAL(PMemoryStart))) * 100
DIV PMemorySize, 3)
ELSE
WriteString(' 0')
END ;
WriteString('%) Pri') ;
WriteCard( PPriority, 2 ) ;
WriteCard( PQuanta, 3 ) ;
WriteString(' ') ;
WriteString(' ') ;
WriteString(' ') ;
*)
WriteCard( (TimeSecs DIV ClockFreq) DIV (60*60), 2 ) ; (* Hours *)
WriteString(':') ;
WriteCard( ((TimeSecs DIV ClockFreq) DIV 60) MOD 60, 2) ; (* Minutes *)
WriteString(':') ;
WriteCard( (TimeSecs DIV ClockFreq) MOD 60, 2) (* Seconds *)
END
END WriteProcess ;
VAR
TimeSecs: CARDINAL ;
p : PtrToProcDes ;
BEGIN
WriteProcess(p)
END testdiv.
m2f-3.8/comp/autotest/dynamic/testfor.mod 100644 144 144 620 6304353512 17154 0 ustar gaius users MODULE testfor ;
FROM StrIO IMPORT WriteString, WriteLn ;
CONST
Max = 100 ;
(*
Try -
*)
PROCEDURE Try ;
VAR
y,
x,
d,
i: CARDINAL ;
a: ARRAY [0..Max] OF CARDINAL ;
BEGIN
FOR i := 0 TO Max DO
d := d + a[i] ;
y := 0 ;
WriteString('it works') ;
WHILE y<i DO
INC(y)
END ;
x := d + i
END
END Try ;
BEGIN
Try
END testfor.
m2f-3.8/comp/autotest/dynamic/testfunc.mod 100644 144 144 250 6311551103 17312 0 ustar gaius users MODULE testfunc ;
PROCEDURE foo () : CARDINAL ;
BEGIN
RETURN( 10 )
END foo ;
VAR
a, b: CARDINAL ;
BEGIN
IF a*foo()>CARDINAL(b)
THEN
END
END testfunc.
m2f-3.8/comp/autotest/dynamic/testit.mod 100644 144 144 46 6311551103 16756 0 ustar gaius users MODULE testit ;
BEGIN
END testit.
m2f-3.8/comp/autotest/dynamic/testloop.mod 100644 144 144 67 6304353512 17324 0 ustar gaius users MODULE testloop ;
BEGIN
LOOP
END
END testloop.
m2f-3.8/comp/autotest/dynamic/testloop2.mod 100644 144 144 711 6304353512 17422 0 ustar gaius users MODULE testloop2 ;
FROM SYSTEM IMPORT ADR ;
PROCEDURE foo ;
VAR
p: POINTER TO CARDINAL ;
BEGIN
i := 1 ;
p := ADR(i) ;
WHILE i#0 DO
IF TRUE
THEN
dec(i)
END ;
IF i>0
THEN
ELSE
END ;
WHILE i=0 DO
END ;
REPEAT
UNTIL i=0
END
END foo ;
PROCEDURE dec (VAR i: CARDINAL) ;
BEGIN
END dec ;
PROCEDURE bar ;
BEGIN
END bar ;
VAR
i: CARDINAL ;
BEGIN
foo
END testloop2.
m2f-3.8/comp/autotest/dynamic/testloop3.mod 100644 144 144 1252 6304353512 17444 0 ustar gaius users MODULE testloop3 ;
FROM StrIO IMPORT WriteString, WriteLn ;
TYPE
PtrToNode = POINTER TO RECORD
Next: PtrToNode ;
Sym : CARDINAL ;
END ;
VAR
RemoveList: PtrToNode ;
(*
FindNextUsedQuad - returns TRUE if node, q, is on a list defined by, p.
*)
PROCEDURE IsItemOnList (p, q: PtrToNode) : BOOLEAN ;
BEGIN
WHILE p#NIL DO
IF p=q
THEN
WriteString('found item') ; WriteLn
ELSE
p := p^.Next
END
END ;
RETURN( FALSE )
END IsItemOnList ;
BEGIN
RemoveList := NIL ;
IF IsItemOnList(RemoveList, RemoveList)
THEN
END
END testloop3.
m2f-3.8/comp/autotest/dynamic/testloop4.mod 100644 144 144 420 6304353512 17421 0 ustar gaius users MODULE testloop4 ;
PROCEDURE IsUsed (i: CARDINAL) : BOOLEAN ;
BEGIN
WHILE ListUsed[i] DO
INC(i)
END ;
RETURN( FALSE )
END IsUsed ;
VAR
ListUsed: ARRAY [0..20] OF BOOLEAN ;
BEGIN
ListUsed[0] := TRUE ;
IF IsUsed(10)
THEN
END
END testloop4.
m2f-3.8/comp/autotest/dynamic/testloop5.mod 100644 144 144 661 6304353512 17431 0 ustar gaius users MODULE testloop5 ;
FROM StrIO IMPORT WriteString, WriteLn ;
TYPE
PtrToNode = POINTER TO CARDINAL ;
VAR
RemoveList: PtrToNode ;
(*
FindNextUsedQuad - returns TRUE if node, q, is on a list defined by, p.
*)
PROCEDURE IsItemOnList (p: PtrToNode) : BOOLEAN ;
BEGIN
WHILE p^#0 DO
END ;
RETURN( FALSE )
END IsItemOnList ;
BEGIN
RemoveList := NIL ;
IF IsItemOnList(RemoveList)
THEN
END
END testloop5.
m2f-3.8/comp/autotest/dynamic/testmin.mod 100644 144 144 1562 6304353512 17177 0 ustar gaius users MODULE testmin ;
FROM SYSTEM IMPORT TSIZE, BITSET ;
FROM StrIO IMPORT WriteString, WriteLn ;
FROM NumberIO IMPORT WriteCard, WriteInt ;
TYPE
barfoo = CARDINAL ;
foobar = barfoo ;
ColourCodes = (black, brown, red, orange) ;
VAR
i: INTEGER ;
b: BOOLEAN ;
c: CARDINAL ;
s: BITSET ;
t: ColourCodes ;
BEGIN
WriteString('INTEGER ') ; WriteCard(TSIZE(INTEGER), 8) ; WriteLn ;
WriteString('INTEGER ') ; WriteInt(MAX(INTEGER), 12) ; WriteInt(MIN(INTEGER), 12) ; WriteLn ;
WriteString('CARDINAL ') ; WriteCard(MAX(CARDINAL), 12) ; WriteCard(MIN(CARDINAL), 12) ; WriteLn ;
WriteString('BOOLEAN ') ; WriteCard(MAX(BOOLEAN), 12) ; WriteCard(MIN(BOOLEAN), 12) ; WriteLn ;
WriteString('BITSET ') ; WriteCard(MAX(BITSET), 12) ; WriteCard(MIN(BITSET), 12) ; WriteLn ;
FOR t := MIN(ColourCodes) TO MAX(ColourCodes) DO
END
END testmin.
m2f-3.8/comp/autotest/dynamic/testnum4.mod 100644 144 144 205 6311552011 17241 0 ustar gaius users MODULE testnum4 ;
FROM NumberIO IMPORT WriteHex ;
FROM StrIO IMPORT WriteLn ;
BEGIN
WriteHex(1234H, 8) ; WriteLn
END testnum4.
m2f-3.8/comp/autotest/dynamic/testord.mod 100644 144 144 243 6304353513 17154 0 ustar gaius users MODULE testord ;
FROM StdIO IMPORT Write ;
PROCEDURE foo ;
BEGIN
i := 2
END foo ;
VAR
i: CARDINAL ;
BEGIN
foo ;
Write(CHR(i+ORD('0')))
END testord.
m2f-3.8/comp/autotest/dynamic/testproc.mod 100644 144 144 76 6271670437 17331 0 ustar gaius users MODULE testproc ;
VAR
p: PROC ;
BEGIN
p
END testproc.
m2f-3.8/comp/autotest/dynamic/testset.mod 100644 144 144 421 6311546770 17170 0 ustar gaius users MODULE testset ;
FROM SYSTEM IMPORT BITSET ;
FROM NumberIO IMPORT WriteHex ;
FROM StrIO IMPORT WriteLn ;
VAR
b: BITSET ;
j, i: CARDINAL ;
BEGIN
FOR i := 0 TO 16 DO
b := {} ;
INCL(b, i) ;
WriteHex(CARDINAL(b), 4) ; WriteLn
END
END testset.
m2f-3.8/comp/autotest/dynamic/testset2.mod 100644 144 144 400 6311546770 17247 0 ustar gaius users MODULE testset2 ;
FROM SYSTEM IMPORT BITSET ;
FROM NumberIO IMPORT WriteHex ;
FROM StrIO IMPORT WriteLn ;
VAR
b,
j, i: CARDINAL ;
BEGIN
FOR i := 0 TO 16 DO
j := (i+j) + 4*i ;
WriteHex(CARDINAL(j), 4) ; WriteLn
END
END testset2.
m2f-3.8/comp/autotest/dynamic/testset3.mod 100644 144 144 150 6347254224 17251 0 ustar gaius users MODULE testset3 ;
FROM SYSTEM IMPORT BITSET ;
VAR
i, j: BITSET ;
BEGIN
EXCL(i, 4)
END testset3.
m2f-3.8/comp/autotest/dynamic/teststr.mod 100644 144 144 1566 6271670437 17243 0 ustar gaius users MODULE teststr ;
FROM StrIO IMPORT WriteString, WriteLn ;
FROM StrLib IMPORT StrCopy, StrConCat, StrLen, StrEqual ;
FROM NumberIO IMPORT WriteCard ;
PROCEDURE foo (b: ARRAY OF CHAR) ;
BEGIN
StrCopy(b, a)
END foo ;
VAR
a: ARRAY [0..50] OF CHAR ;
BEGIN
foo('hello') ;
WriteString('hello world') ; WriteLn ;
StrCopy('hello gaius', a) ; WriteString(a) ; WriteLn ;
StrCopy('2', a) ; WriteString(a) ; WriteLn ;
StrConCat('1', a, a) ; WriteString(a) ; WriteLn ;
StrConCat(a, a, a) ; WriteString(a) ; WriteLn ;
(* WriteString('length of a = ') ; WriteCard(StrLen(a), 10) ; WriteLn ; *)
IF StrEqual(a, '1212')
THEN
WriteString('yes')
ELSE
WriteString('no')
END ;
StrConCat(a, a, a) ; WriteString(a) ; WriteLn ;
IF StrEqual(a, '1212')
THEN
WriteString('yes')
ELSE
WriteString('no')
END ;
WriteLn ;
END teststr.
m2f-3.8/comp/autotest/dynamic/teststr2.mod 100644 144 144 627 6271670437 17302 0 ustar gaius users MODULE teststr2 ;
FROM StrIO IMPORT WriteString, WriteLn ;
FROM StrLib IMPORT StrCopy, StrConCat ;
CONST
MaxIterations = 100000 ;
VAR
i: CARDINAL ;
a: ARRAY [0..1000] OF CHAR ;
BEGIN
WriteString('timing strcopy...') ; WriteLn ;
FOR i := 1 TO MaxIterations DO
StrCopy('abcdefghijklmnopqrstuwvxyz', a) ;
StrConCat(a, a, a)
END ;
WriteString('done') ; WriteLn
END teststr2.
m2f-3.8/comp/autotest/dynamic/teststring.mod 100644 144 144 612 6271670437 17710 0 ustar gaius users MODULE teststring ;
FROM StrIO IMPORT ReadString, WriteString, WriteLn ;
TYPE
MINE = ARRAY [0..40] OF CHAR ;
PROCEDURE foo (VAR a: MINE) ;
BEGIN
a := "hello world" ;
LOOP
WriteString('> ') ;
ReadString(a) ; WriteLn ;
WriteString('String was: ') ; WriteString(a) ; WriteLn
END
END foo ;
VAR
b: MINE ;
BEGIN
foo(b) ;
b := "and again"
END teststring.
m2f-3.8/comp/autotest/dynamic/testunbounded.mod 100644 144 144 770 6347254224 20366 0 ustar gaius users MODULE testunbounded ;
FROM StrIO IMPORT WriteString ;
TYPE
DESCRIPTOR = POINTER TO RECORD
a, b, c, d, e: CARDINAL ;
RunName: ARRAY [0..15] OF CHAR ;
END ;
PROCEDURE DisplayProcess (p: DESCRIPTOR) ;
VAR
a: ARRAY [0..4] OF CHAR ;
db: ARRAY [0..50] OF CHAR ;
BEGIN
WITH p^ DO
WriteString(RunName)
END
END DisplayProcess ;
VAR
p: DESCRIPTOR ;
BEGIN
DisplayProcess(p)
END testunbounded.
m2f-3.8/comp/autotest/dynamic/testzero.mod 100644 144 144 146 6311551103 17342 0 ustar gaius users MODULE testzero ;
VAR
a, b, c: CARDINAL ;
BEGIN
a := 0 ;
b := 0 ;
c := 0
END testzero.
m2f-3.8/comp/autotest/dynamic/wc.mod 100644 144 144 1227 6311550321 16116 0 ustar gaius users MODULE wc ;
FROM StdIO IMPORT Read ;
FROM NumberIO IMPORT WriteCard ;
FROM StrIO IMPORT WriteLn ;
FROM ASCII IMPORT cr ;
CONST
Max = 1000 ;
VAR
a : ARRAY [0..Max] OF CHAR ;
words,
word : CARDINAL ;
chars: CARDINAL ;
ch : CHAR ;
BEGIN
word := 0 ;
words := 0 ;
chars := 0 ;
Read(ch) ;
WHILE ch#cr DO
INC(chars) ;
a[chars] := ch ;
IF ch#' '
THEN
IF word=0
THEN
word := 1 ;
INC(words)
END
ELSE
word := 0
END ;
Read(ch)
END ;
WriteLn ;
WriteCard(words, 4) ;
WriteLn ;
WriteCard(chars, 4) ;
WriteLn
END wc.
m2f-3.8/comp/autotest/dynamic/testparam.mod 100644 144 144 165 6426441647 17506 0 ustar gaius users MODULE testparam ;
PROCEDURE p (a, b, c, d: CARDINAL) ;
BEGIN
END p ;
BEGIN
p(1, 2, 3, 2)
END testparam.
m2f-3.8/comp/autotest/dynamic/testbec39.mod 100644 144 144 171 6426413121 17272 0 ustar gaius users MODULE testbec39 ;
VAR
a, b, c, d: CARDINAL ;
BEGIN
a := 1 ;
b := 2 ;
c := 3 ;
d := a + 4
END testbec39.
m2f-3.8/comp/autotest/dynamic/testhidden.mod 100644 144 144 144 6743317473 17637 0 ustar gaius users MODULE testhidden ;
FROM Queue IMPORT QUEUE ;
VAR
q: QUEUE ;
BEGIN
q := NIL
END testhidden.
m2f-3.8/comp/autotest/dynamic/testbec41.mod 100644 144 144 143 6435063647 17300 0 ustar gaius users MODULE testbec41 ;
VAR
a, b, c: CARDINAL ;
BEGIN
a := b + 5 ;
c := a + 3
END testbec41.
m2f-3.8/comp/autotest/dynamic/testbec42.mod 100644 144 144 223 6437524022 17267 0 ustar gaius users MODULE testbec42 ;
VAR
e, f, g, h, i,
a, b, c, d : CARDINAL ;
BEGIN
a := b + c + d ;
e := f + g + h ;
i := a + e
END testbec42.
m2f-3.8/comp/autotest/dynamic/testbec43.mod 100644 144 144 167 6435406230 17275 0 ustar gaius users MODULE testbec43 ;
VAR
a, b, c, d, e, f, g: CARDINAL ;
BEGIN
g := ((a + b) + (c + d)) + (e + g)
END testbec43.
m2f-3.8/comp/autotest/dynamic/testbec40.mod 100644 144 144 230 6430327006 17257 0 ustar gaius users MODULE testbec40 ;
VAR
a, b, c, d, e, f, g, h, i: CARDINAL ;
BEGIN
a := b + c ;
d := e + f ;
(* g := h + i *)
g := a + d
END testbec40.
m2f-3.8/comp/autotest/dynamic/testwith.mod 100644 144 144 371 6445531615 17354 0 ustar gaius users MODULE testwith ;
TYPE
List = POINTER TO RECORD
bar: CARDINAL ;
END ;
PROCEDURE foo (l: List) ;
BEGIN
WITH l^ DO
INC(bar)
END
END foo ;
VAR
l: List ;
BEGIN
foo(l)
END testwith.
m2f-3.8/comp/autotest/dynamic/testbec45.mod 100644 144 144 177 6455144532 17306 0 ustar gaius users MODULE testbec45 ;
FROM StrIO IMPORT WriteString, WriteLn ;
BEGIN
WriteString('hello world') ;
WriteLn
END testbec45.
m2f-3.8/comp/autotest/dynamic/testbec44.apu 100644 144 144 3706 6462342377 17341 0 ustar gaius users
# M-2 -> assemply language
#
.file "testbec44.mod"
# warning optimization is off
# warning optimization is off
.lcomm _e ,4 # offset 0
# warning optimization is off
.lcomm _f ,4 # offset 4
# warning optimization is off
.lcomm _g ,4 # offset 8
# warning optimization is off
.lcomm _h ,4 # offset 12
# warning optimization is off
.lcomm _i ,4 # offset 16
# warning optimization is off
.lcomm _j ,4 # offset 20
# warning optimization is off
.lcomm _a ,4 # offset 24
# warning optimization is off
.lcomm _b ,4 # offset 28
# warning optimization is off
.lcomm _c ,4 # offset 32
# warning optimization is off
.lcomm _d ,4 # offset 36
# warning optimization is off
.lcomm __T11 ,4 # offset 40
# warning optimization is off
.lcomm __T12 ,4 # offset 44
# warning optimization is off
.lcomm __T13 ,4 # offset 48
# warning optimization is off
.lcomm __T14 ,4 # offset 52
# warning optimization is off
.lcomm __T15 ,4 # offset 56
.global __M2_testbec44_init
.extern _M2RTS_HALT
.extern _M2RTS_Terminate
.global __M2_testbec44_init
__M2_testbec44_init
load.d.d %ra
load.d.d %sp
store.d.d %ra
load.d.d %rb
load.d.d %rc
load.d.d $6
pr
load.d.d $0
store.d.d _j
L16:
load.d.d $3
pr
load.d.d _j
load.d.d $100000000
gre
load.d.d $L30
bift
load.d.d $10
pr
load.d.d _c
load.d.d _b
add
store.d.d __T11
load.d.d _d
load.d.d __T11
add
store.d.d _a
load.d.d _g
load.d.d _f
add
store.d.d __T13
load.d.d _h
load.d.d __T13
add
store.d.d _e
load.d.d _e
load.d.d _a
add
store.d.d _i
load.d.d $1
load.d.d _j
add
store.d.d _j
load.d.d $L16
store.d.d %pc
L30:
load.d.d $3
pr
# clean up using Modula-2 M2RTS termination
load.d.d $_M2RTS_Terminate
call
store.d.d %rc
store.d.d %rb
store.d.d %ra
store.d.d %pc
nop
.end
m2f-3.8/comp/autotest/dynamic/testbec44.mod 100644 144 144 354 6462342332 17276 0 ustar gaius users MODULE testbec44 ;
CONST
MaxCount = 100 * 1000 * 1000 ;
VAR
e, f, g, h, i, j,
a, b, c, d : CARDINAL ;
BEGIN
FOR j := 0 TO MaxCount DO
a := b + c + d ;
e := f + g + h ;
i := a + e
END
END testbec44.
m2f-3.8/comp/autotest/dynamic/testarray6.mod 100644 144 144 230 6465565505 17606 0 ustar gaius users MODULE testarray6 ;
VAR
x: CARDINAL ;
a: ARRAY [0..10] OF CARDINAL ;
i: CARDINAL ;
BEGIN
x := 10*x + (ORD(a[i])-ORD('0'))
END testarray6.
m2f-3.8/comp/autotest/dynamic/testbec44.586 100644 144 144 4016 6463060352 17060 0 ustar gaius users
# M-2 -> assemply language
#
.file "testbec44.mod"
gcc2_compiled.:
.text
.align 32
.lcomm e ,4 # offset 0
.lcomm f ,4 # offset 4
.lcomm g ,4 # offset 8
.lcomm h ,4 # offset 12
.lcomm i ,4 # offset 16
.lcomm j ,4 # offset 20
.lcomm a ,4 # offset 24
.lcomm b ,4 # offset 28
.lcomm c ,4 # offset 32
.lcomm d ,4 # offset 36
.lcomm _T11 ,4 # offset 40
.lcomm _T12 ,4 # offset 44
.lcomm _T13 ,4 # offset 48
.lcomm _T14 ,4 # offset 52
.lcomm _T15 ,4 # offset 56
# procedures
# main
.align 16
_M2_testbec44_init:
.globl _M2_testbec44_init
pushl %ebp
movl %esp, %ebp
pushl %ebx
pushl %edi
pushl %esi
# unknown last instruction pipe
# this pipeline will take 2 cycles to execute
# U Pipe ; V Pipe
xorl %eax, %eax # 1 cycle
movl %eax, j ; # 1 cycle
.L16:
# last instruction was in V pipe
# this pipeline will take 2 cycles to execute
# U Pipe ; V Pipe
nop ; movl j, %eax # 1 cycle
cmpl $100000000, %eax ; # 1 cycle
jg .L30
# last instruction was in U pipe
# this pipeline will take 3 cycles to execute
# U Pipe ; V Pipe
movl b, %eax # 1 cycle
addl c, %eax # 1 cycle
addl d, %eax ; movl f, %edx # 1 cycle
movl %eax, a ; addl g, %edx # 1 cycle
# last instruction was in V pipe
# this pipeline will take 3 cycles to execute
# U Pipe ; V Pipe
movl j, %edi ; addl h, %edx # 1 cycle
movl %edx, e ; addl %edx, %eax # 1 cycle
inc %edi ; movl %eax, i # 1 cycle
# pipeline stall, (2 successive v pipe instructions
# last instruction was in V pipe
# this pipeline will take 1 cycles to execute
# U Pipe ; V Pipe
movl %edi, j ; # 1 cycle
jmp .L16
.L30:
# clean up using Modula-2 M2RTS termination
call M2RTS_Terminate
popl %esi
popl %edi
popl %ebx
leave
ret
.lcomm CQfpu1,4
.lcomm CQfpu2,4
.lcomm CQfpu3,4
.lcomm CQfpu4,4
m2f-3.8/comp/autotest/dynamic/testfunc3.mod 100644 144 144 2324 6527352472 17442 0 ustar gaius users MODULE testfunc3 ;
PROCEDURE WriteLn ;
BEGIN
END WriteLn ;
PROCEDURE StartOfIndexInBuffer () : CARDINAL ;
BEGIN
RETURN( 0 )
END StartOfIndexInBuffer ;
PROCEDURE FindNextLineInBuffer (a, b: CARDINAL) ;
BEGIN
END FindNextLineInBuffer ;
PROCEDURE DisplayUpToToken (a, b: CARDINAL) : CARDINAL ;
BEGIN
RETURN( a )
END DisplayUpToToken ;
PROCEDURE WriteNChars (ch: CHAR; a: CARDINAL) ;
BEGIN
END WriteNChars ;
PROCEDURE DisplayRestOfBuffer (a, b: CARDINAL) ;
BEGIN
END DisplayRestOfBuffer ;
VAR
BufferOffset,
TokenLength,
Indent : CARDINAL ;
(*
WriteBuffer - writes the buffer with the CurrentSymbol underlined.
*)
PROCEDURE WriteBuffer ;
VAR
OffsetIntoSource,
OffsetIntoBuffer,
Indent : CARDINAL ;
BEGIN
OffsetIntoBuffer := StartOfIndexInBuffer() ;
OffsetIntoSource := BufferOffset ;
FindNextLineInBuffer(OffsetIntoBuffer, OffsetIntoSource) ;
(* Found end of first line, now display BufferSource *)
Indent := DisplayUpToToken(OffsetIntoBuffer, OffsetIntoSource) ;
WriteNChars(' ', Indent) ;
WriteNChars('^', TokenLength) ;
WriteLn ;
DisplayRestOfBuffer(OffsetIntoBuffer, OffsetIntoSource) ;
WriteLn
END WriteBuffer ;
BEGIN
WriteBuffer
END testfunc3.
m2f-3.8/comp/autotest/dynamic/testfunc4.mod 100644 144 144 301 6531055312 17400 0 ustar gaius users MODULE testfunc4 ;
PROCEDURE test (a, b, c: CARDINAL) : CARDINAL ;
BEGIN
RETURN( a+b+c )
END test ;
VAR
answer, i: CARDINAL ;
BEGIN
answer := test(10+i, 20+i, 30+i)
END testfunc4.
m2f-3.8/comp/autotest/dynamic/testfunc5.mod 100644 144 144 1016 6531270527 17434 0 ustar gaius users MODULE testfunc5 ;
TYPE
Instruction = (mov) ;
Register = (RegECX) ;
VAR
WordSize: CARDINAL ;
PROCEDURE MaxDatum () : CARDINAL ;
BEGIN
RETURN( WordSize )
END MaxDatum ;
PROCEDURE InstRegInt (inst: Instruction; s: CARDINAL; reg: Register;
int: INTEGER) ;
BEGIN
END InstRegInt ;
PROCEDURE BlockMove (Size: CARDINAL) ;
BEGIN
IF Size>WordSize
THEN
InstRegInt(mov, MaxDatum(), RegECX, INTEGER(Size DIV WordSize))
END
END BlockMove ;
BEGIN
BlockMove(4)
END testfunc5. m2f-3.8/comp/autotest/dynamic/testfor2.mod 100644 144 144 270 6532516000 17233 0 ustar gaius users MODULE testfor2 ;
VAR
i, a, b, c: CARDINAL ;
BEGIN
FOR i := 1 TO 20 DO c := a + i ; b := a + i
END ;
i := b + c
END testfor2.
m2f-3.8/comp/autotest/dynamic/testfunc2.mod 100644 144 144 400 6527312552 17405 0 ustar gaius users MODULE testfunc2 ;
PROCEDURE Alpha (a: CARDINAL) : CARDINAL ;
BEGIN
RETURN( a+1 )
END Alpha ;
PROCEDURE Beta (a: CARDINAL) : CARDINAL ;
BEGIN
RETURN( a+2 )
END Beta ;
VAR
c: CARDINAL ;
BEGIN
c := 1 ;
c := Beta(Alpha(c))
END testfunc2.
m2f-3.8/comp/autotest/dynamic/testparam2.mod 100644 144 144 1650 6544417374 17611 0 ustar gaius users MODULE testparam2 ;
TYPE
RegisterList = RECORD
state : (free, used, etc) ;
Reg : CARDINAL ;
CleanAlias: CARDINAL ;
DirtyAlias: CARDINAL ;
END ;
PROCEDURE DuplicateList (i: CARDINAL) : CARDINAL ;
BEGIN
RETURN( i )
END DuplicateList ;
PROCEDURE GetRegisterAssociate (reg: CARDINAL; VAR clean, dirty: CARDINAL) ;
VAR
i: CARDINAL ;
BEGIN
i := InitRegisterPtr ;
WHILE i>0 DO
IF ListOfRegisters[i-1].Reg=reg
THEN
clean := DuplicateList(ListOfRegisters[i-1].CleanAlias) ;
dirty := DuplicateList(ListOfRegisters[i-1].DirtyAlias) ;
RETURN
ELSE
DEC(i)
END
END
END GetRegisterAssociate ;
VAR
c, d: CARDINAL ;
ListOfRegisters: ARRAY [0..10] OF RegisterList ;
InitRegisterPtr: CARDINAL ;
BEGIN
GetRegisterAssociate(1, c, d)
END testparam2.
m2f-3.8/comp/autotest/dynamic/testfunc6.mod 100644 144 144 301 6543530674 17416 0 ustar gaius users MODULE testfunc6 ;
PROCEDURE pop () : CARDINAL ;
BEGIN
RETURN( 0 )
END pop ;
PROCEDURE memcopy ;
VAR
a: CARDINAL ;
BEGIN
a := pop()
END memcopy ;
BEGIN
memcopy
END testfunc6.
m2f-3.8/comp/autotest/dynamic/add.mod 100644 144 144 73 6555122342 16203 0 ustar gaius users MODULE add ;
VAR
c: CARDINAL ;
BEGIN
c := 2
END add. m2f-3.8/comp/autotest/dynamic/testscn.mod 100644 144 144 760 6573263471 17172 0 ustar gaius users MODULE testscn ;
CONST
Width = 80 ;
Height = 25 ;
TYPE
DisplayUnit = RECORD
char : CHAR ;
attrib: CHAR ;
END ;
Line = ARRAY [0..Width-1] OF DisplayUnit ;
Screen = ARRAY [0..Height-1] OF Line ;
VAR
screen : POINTER TO Screen ;
PROCEDURE ScrollUp ;
VAR
j: CARDINAL ;
BEGIN
FOR j := 0 TO Height-2 DO
screen^[j] := screen^[j+1]
END
END ScrollUp ;
BEGIN
ScrollUp
END testscn.
m2f-3.8/comp/autotest/dynamic/testexp.mod 100644 144 144 251 6626465453 17201 0 ustar gaius users MODULE testexp ;
PROCEDURE Halt (a: ARRAY OF CHAR; file: ARRAY OF CHAR; line: CARDINAL) ;
BEGIN
END Halt ;
BEGIN
Halt('my test', __FILE__, __LINE__)
END testexp.
m2f-3.8/comp/autotest/dynamic/testif.mod 100644 144 144 1610 6626526263 17020 0 ustar gaius users MODULE testif ;
PROCEDURE ReadToken (VAR CurrentToken, TokenType, TokenIndex, CurSymLine: CARDINAL) ;
BEGIN
END ReadToken ;
PROCEDURE ProcessDate ; BEGIN END ProcessDate ;
CONST
ReservedToken = 0 ;
VAR
FoundEofToken: BOOLEAN ;
TokenNumber,
DateTok,
FileTok,
LineTok,
CurrentToken,
TokenType,
TokenIndex,
CurSymLine : CARDINAL ;
BEGIN
IF NOT FoundEofToken
THEN
ReadToken(CurrentToken, TokenType, TokenIndex, CurSymLine) ;
INC(TokenNumber) ;
(* ; WriteString('TokenIndex => ') ; Write(BufferSource[TokenIndex MOD MaxBuffer]) ; WriteLn ; *)
IF TokenType=ReservedToken
THEN
IF CurrentToken=DateTok
THEN
ProcessDate
ELSIF CurrentToken=FileTok
THEN
ProcessDate
ELSIF CurrentToken=LineTok
THEN
ProcessDate
END
END
END
END testif.
m2f-3.8/comp/autotest/errors/ 40755 144 144 0 6743314171 14607 5 ustar gaius users m2f-3.8/comp/autotest/errors/CVS/ 40755 144 144 0 6740070360 15236 5 ustar gaius users m2f-3.8/comp/autotest/errors/CVS/Root 100644 144 144 15 6402517645 16144 0 ustar gaius users /usr/src/cvs
m2f-3.8/comp/autotest/errors/CVS/Repository 100644 144 144 45 6402517645 17403 0 ustar gaius users /usr/src/cvs/m2/comp/autotest/errors
m2f-3.8/comp/autotest/errors/CVS/Entries 100644 144 144 4307 6740070360 16673 0 ustar gaius users /makefile/1.1/Mon Sep 16 07:17:08 1996//
/mustfail/1.1/Mon Sep 16 07:17:08 1996//
/options/1.1/Mon Feb 24 17:09:32 1997//
/sbowen11.mod/1.1/Thu May 15 08:08:37 1997//
/testarray.mod/1.1/Mon Apr 28 12:35:27 1997//
/testbegin.mod/1.1/Wed Mar 26 14:26:36 1997//
/testbit.mod/1.1/Mon Feb 24 17:09:33 1997//
/testbit2.mod/1.1/Mon Feb 24 17:09:33 1997//
/testcase.mod/1.1/Mon Feb 24 17:09:33 1997//
/testcomment.mod/1.1/Mon Apr 28 12:35:27 1997//
/testcomment2.mod/1.1/Mon Apr 28 12:35:28 1997//
/testcomment3.mod/1.1/Mon Apr 28 12:35:29 1997//
/testcomment4.mod/1.1/Mon Apr 28 12:35:29 1997//
/testconst.mod/1.1/Mon Apr 28 12:35:29 1997//
/testconst2.mod/1.1/Mon May 12 11:13:12 1997//
/testfio.mod/1.2/Wed Mar 12 15:38:33 1997//
/testimport.mod/1.1/Mon Apr 28 12:35:29 1997//
/testimport2.def/1.1/Mon Apr 28 12:35:30 1997//
/testimport2.mod/1.2/Thu May 15 08:08:37 1997//
/testinit.mod/1.1/Mon Feb 24 17:09:33 1997//
/testparam.mod/1.1/Wed Mar 12 15:50:46 1997//
/testproc2.mod/1.1/Thu May 15 08:08:38 1997//
/testsub2.mod/1.1/Mon Sep 16 07:17:09 1996//
/testsub3.mod/1.1/Mon Sep 16 07:17:09 1996//
/testsub4.mod/1.1/Mon Sep 16 07:17:09 1996//
/testtype.mod/1.1/Mon Apr 28 12:35:30 1997//
/testvar.mod/1.1/Mon Apr 28 12:35:30 1997//
/prog110.mod/1.1/Wed Oct 22 07:09:36 1997//
/prog111.mod/1.1/Wed Oct 22 07:12:11 1997//
/testdiv.mod/1.1/Tue Oct 28 10:22:10 1997//
/testexp.mod/1.1/Tue Oct 28 11:06:14 1997//
/prog112.mod/1.1/Wed Oct 29 14:50:20 1997//
/prog31.mod/1.1/Wed Nov 12 13:25:38 1997//
/prog51.mod/1.1/Wed Nov 19 13:05:34 1997//
/teststring.mod/1.1/Wed Feb 11 12:31:28 1998//
/testwrite.mod/1.1/Wed Feb 11 12:54:22 1998//
/prog113.mod/1.1/Fri Apr 17 19:51:44 1998//
/prog114.mod/1.1/Fri Apr 17 18:45:48 1998//
/prog21.mod/1.1/Wed Feb 25 15:59:20 1998//
/testdyn.mod/1.1/Thu Apr 23 14:24:54 1998//
/testdyn2.mod/1.1/Thu Apr 23 14:25:59 1998//
/testdyn3.mod/1.1/Thu Apr 23 14:26:27 1998//
/testwith.mod/1.1/Thu Feb 19 10:11:25 1998//
/type.mod/1.1/Thu Feb 26 18:58:51 1998//
/prog32.mod/1.1/Sun Apr 26 11:54:29 1998//
/prog33.mod/1.1/Sun Apr 26 11:54:16 1998//
/prog34.mod/1.1/Sun Apr 26 11:54:53 1998//
/testchar.mod-/1.1/Tue Mar 10 11:38:30 1998//
/array1.mod/1.1/Fri Jan 29 10:54:48 1999//
/nestedproc4.mod/1.1/Tue Jun 29 20:51:35 1999//
D
m2f-3.8/comp/autotest/errors/makefile 100644 144 144 65 6217177364 16354 0 ustar gaius users
all: force
clean: force
$(RM) *.s *~ *.o
force:
m2f-3.8/comp/autotest/errors/mustfail 100644 144 144 1 6217177364 16371 0 ustar gaius users
m2f-3.8/comp/autotest/errors/options 100644 144 144 27 6304345514 16257 0 ustar gaius users -pedantic -O -students
m2f-3.8/comp/autotest/errors/sbowen11.mod 100644 144 144 7407 6336542205 17053 0 ustar gaius users MODULE sbowen11;
FROM StrIO IMPORT WriteLn,WriteString,ReadString;
FROM NumberIO IMPORT WriteInt,ReadInt;
FROM StdIO IMPORT Read, Write;
(*FROM ASCII IMPORT eof; *)
(*FROM StrCase IMPORT Cap;*)
TYPE
FreqRecord = RECORD
Total_Freq : INTEGER ;
Capital_Freq : INTEGER ;
END ; (*End of RECORD*)
Alphabet = ['A'..'Z'] ;
DataArray = ARRAY['A'..'Z'] OF FreqRecord ;
VAR
InputData : DataArray ;
(*--------------------------------------------------------------------------
*)
(*This procedure initialise the frequency to all zeroes*)
(*--------------------------------------------------------------------------
*)
PROCEDURE Initialise(VAR InitData: DataArray) ;
VAR
Index : Alphabet ;
BEGIN
FOR Index := 'A' TO 'Z' DO
InitData[Index].Total_Freq := 0;
InitData[Index].Capital_Freq := 0;
END ;
END Initialise ; (*procedure Initialise*)
(*--------------------------------------------------------------------------
*)
(* This procedure reads in and sets up the counts of the array *)
(*--------------------------------------------------------------------------
*)
PROCEDURE ReadData(VAR DataGet: DataArray) ;
VAR
This_one : CHAR ;
BEGIN
WriteString('Please enter your sentence :');
WriteLn;
Read(This_one);
(* WHILE (This_one <> eof) DO*)
IF (This_one>='A') AND (This_one<='Z') THEN
INC(DataGet[This_one].Total_Freq);
INC(DataGet[This_one].Capital_Freq);
(* ELSE
This_one := Cap(This_one); *)
END;
(* IF (This_one>='A') AND (This_one<='Z') THEN
INC(DataGet[This_one].Total_Freq);
WriteLn;
*)
(* END; IF*)
(* Read(This_one);
*)(* END;IF*)
(* END;WHILE*)
END ReadData;(*END ReadData PROCEDURE*)
(*--------------------------------------------------------------------------
*)
(* This procedure prints out the data array as a histogram.*)
(*--------------------------------------------------------------------------
*)
PROCEDURE Histogram(HistogramData: DataArray) ;
VAR
Index : CHAR ;
i,Freq,Count : INTEGER ;
BEGIN
WriteLn;
FOR Index:='A' TO 'Z' DO
Freq:= HistogramData[Index].Total_Freq;
Count:= HistogramData[Index].Capital_Freq;
Write(CHR(ORD(Index)));
WriteString(':');
IF (Freq <10) THEN
WriteInt(0,0);
END;(*IF*)
WriteInt(Freq,1);
FOR i := 1 TO Count DO
Write(CHR(ORD(Index)));
END;(*FOR*)
FOR i := 1 TO FreqRecord DO
Write(CHR(ORD(Index)+(ORD('a')-ORD('A'))));
END;(*FOR*)
WriteLn;
END;(*FOR*)
END Histogram ;(*END Histogram PROCEDURE*)
(*--------------------------------------------------------------------------
*)
(*This procedure writes out the used cahracters in descending frequency
order.*)
(*--------------------------------------------------------------------------
*)
PROCEDURE FrequencyList(FrequencyData: DataArray) ;
VAR
Max : INTEGER;
This_one : CHAR;
Best : CHAR;
BEGIN
Best:= 'A';
Max:=1;
WHILE (Max <> 0) DO
Max:=0;
FOR This_one:= 'A' TO 'Z' DO
IF Max < FrequencyData[This_one].Total_Freq THEN
Max:=FrequencyData[This_one].Total_Freq;
Best:=This_one;
END;(*IF*)
END;(*FOR*)
FrequencyData[Best].Total_Freq:=0;
IF (Max <> 0) THEN
Write(Best);
END;(*IF*)
END;(*WHILE*)
WriteLn;
END FrequencyList ; (*Procedure FrequencyList.*)
(*--------------------------------------------------------------------------
*)
BEGIN
(* Initialise the data array by passing it as a VAR argument*)
Initialise(InputData) ;
(*Read in data AND set up counts*)
ReadData(InputData) ;
(*Print out histogram*)
Histogram(InputData) ;
(*Print out frequency list*)
FrequencyList(InputData) ;
END sbowen11.
m2f-3.8/comp/autotest/errors/testarray.mod 100644 144 144 123 6331114617 17373 0 ustar gaius users MODULE testarray ;
VAR
a: (* ARRAY *) [0..10] OF CHAR ;
BEGIN
END testarray.
m2f-3.8/comp/autotest/errors/testbegin.mod 100644 144 144 205 6316231034 17336 0 ustar gaius users MODULE testbegin ;
(*
foo -
*)
PROCEDURE foo (a, b: CARDINAL) ;
a := a + b
END foo ;
BEGIN
foo(1, 2)
END testbegin.
m2f-3.8/comp/autotest/errors/testbit.mod 100644 144 144 324 6304345515 17041 0 ustar gaius users MODULE testbit ;
FROM SYSTEM IMPORT BITSET ;
FROM StrIO IMPORT WriteString, WriteLn ;
VAR
c : CARDINAL ;
a, b: BITSET ;
BEGIN
IF c IN c
THEN
WriteString('hmm') ; WriteLn
END
END testbit.
m2f-3.8/comp/autotest/errors/testbit2.mod 100644 144 144 326 6304345515 17125 0 ustar gaius users MODULE testbit2 ;
FROM SYSTEM IMPORT BITSET ;
FROM StrIO IMPORT WriteString, WriteLn ;
VAR
c : CARDINAL ;
a, b: BITSET ;
BEGIN
IF b IN b
THEN
WriteString('hmm') ; WriteLn
END
END testbit2.
m2f-3.8/comp/autotest/errors/testcase.mod 100644 144 144 141 6304345515 17173 0 ustar gaius users MODULE testcase ;
TYPE
bar = CARDINAL ;
var
a: CARDINAL ;
BEGIN
a := 1
END testcase.
m2f-3.8/comp/autotest/errors/testcomment.mod 100644 144 144 125 6331114617 17721 0 ustar gaius users MODULE testcomment ;
(*
FROM NumberIO IMPORT WriteCard ;
BEGIN
END testcomment.
m2f-3.8/comp/autotest/errors/testcomment2.mod 100644 144 144 127 6331114620 17777 0 ustar gaius users MODULE testcomment2 ;
FROM NumberIO (* IMPORT WriteCard ;
BEGIN
END testcomment2.
m2f-3.8/comp/autotest/errors/testcomment3.mod 100644 144 144 73 6331114621 17761 0 ustar gaius users MODULE testcomment3 ;
(*--*)*)
BEGIN
END testcomment3.
m2f-3.8/comp/autotest/errors/testcomment4.mod 100644 144 144 5300 6331114621 20020 0 ustar gaius users (* *)
(* Program written by lprice *)
(* Created on Thu Apr 10 10:02:44 BST 1997 *)
(* SE108 Coursework 2
(* *)
MODULE testcomment ;
FROM StrIO IMPORT WriteLn,WriteString,ReadString;
FROM StdIO IMPORT Read,Write;
FROM NumberIO IMPORT WriteInt,WriteCard, ReadInt;
FROM StrLib IMPORT StrEqual;
TYPE
stringten = ARRAY [0..9] OF CHAR;
FreqName = RECORD
Name : stringten;
Score : INTEGER;
END ;
DataArray = ARRAY [1..20] OF FreqName;
VAR (*global*)
arraypersons : DataArray;
MAX : CARDINAL;
(*----------------------------------------------*)
(* *)
(* Put your program description here *)
(* *)
(*----------------------------------------------*)
(*----------------------------------------------*)
(* *)
(* Put your procedures here *)
(* *)
(*----------------------------------------------*)
PROCEDURE Initialise(VAR InitData: DataArray) ;
VAR
Index : INTEGER;
BEGIN
FOR Index := 1 TO 20 DO
InitData[Index].Name := 'EMPTY';
InitData[Index].Score := 0;
END;
END Initialise ;
PROCEDURE ReadData(VAR Presname: DataArray);
VAR
Person, Location, Blank : stringten;
I, Points : CARDINAL;
FOUND : BOOLEAN;
BEGIN
WriteString('Please enter the location ');
ReadString(Location);
WriteLn;
WHILE NOT StrEqual(Location,'qqqqqqqqqq') DO
ReadString(Blank);
Points := 3;
WriteString('Please enter the Name ');
WriteLn;
ReadString(Person);
WriteLn;
WHILE NOT StrEqual(Person, 'qqqqqqqqqq') DO
I := 1;
FOUND := FALSE;
WHILE (NOT FOUND) AND (NOT StrEqual(Presname[I].Name,'EMPTY')) DO
WriteCard(I,2);
WriteLn;
IF StrEqual (Presname[I].Name,Person)
THEN FOUND := TRUE;
END;(*if*)
I := I + 1;
END;(*while*)
IF NOT FOUND THEN
MAX := MAX + 1;
Presname [MAX].Name := Person;
Presname [MAX].Score:=Points;
ELSE
Presname[I-1].Score:=Points;
END;(*if*)
IF Points > 0 THEN
Points := Points - 1;
END;(*if*)
ReadString(Person);
END;
ReadString(Blank);
ReadString(Location);
END;(*while*)
END ReadData;
BEGIN
MAX:=0;
WriteString('Sports Day Results');
WriteLn;
Initialise(arraypersons) ;
ReadData(arraypersons) ;
(*Inform the user about the program*)
(*----------------------------------------------*)
(* *)
(* Put your program instructions here *)
(* *)
(*----------------------------------------------*)
(*Now thank the user*)
END testcomment.
m2f-3.8/comp/autotest/errors/testconst.mod 100644 144 144 67 6331114621 17365 0 ustar gaius users MODULE testconst ;
BEGIN
MAX:=10;
END testconst.
m2f-3.8/comp/autotest/errors/testconst2.mod 100644 144 144 373 6335575510 17503 0 ustar gaius users MODULE testconst2 ;
FROM NumberIO IMPORT WriteCard;
FROM StrIO IMPORT WriteLn;
CONST
a = 15;
VAR
i: INTEGER;
BEGIN
WriteCard(MAX(CARDINAL),20);
WriteLn;
a := 10;
FOR i := 1 TO 10 DO
i := i+1;
END;(*for*)
END testconst2.
m2f-3.8/comp/autotest/errors/testfio.mod 100644 144 144 1324 6311546771 17066 0 ustar gaius users MODULE testfio ;
FROM Args IMPORT GetArg ;
FROM StdIO IMPORT Write ;
FROM StrIO IMPORT WriteString, WriteLn ;
FROM FIO IMPORT Exists, OpenToRead, Close, File, IsNoError, EOF, ReadChar ;
VAR
i: INTEGER ;
f: File ;
c: CARDINAL ;
a: ARRAY [0..20] OF CHAR ;
BEGIN
WriteString('testfio starting') ; WriteLn ;
c := 1 ;
WHILE GetArg(a, c) DO
WriteString('File: ') ; WriteString(a) ;
IF Exists(a)
THEN
WriteString(' exists') ; WriteLn ;
f := OpenToRead(a) ;
WHILE NOT EOF(i) DO
Write(ReadChar(f))
END ;
Close(f)
ELSE
WriteString(' not found: ') ; WriteString(a) ; WriteLn
END ;
INC(c)
END
END testfio.
m2f-3.8/comp/autotest/errors/testimport.mod 100644 144 144 137 6331114621 17567 0 ustar gaius users MODULE testimport ;
FROM testimport2 IMPORT foo, bar ;
BEGIN
foo ;
bar
END testimport.
m2f-3.8/comp/autotest/errors/testimport2.def 100644 144 144 123 6331114622 17624 0 ustar gaius users DEFINITION MODULE testimport2 ;
PROCEDURE foo ;
PROCEDURE bar ;
END testimport2.
m2f-3.8/comp/autotest/errors/testimport2.mod 100644 144 144 221 6336542205 17653 0 ustar gaius users IMPLEMENTATION MODULE testimport2 ;
PROCEDURE foo ;
BEGIN
END foo ;
PROCEDURE bar ;
BEGIN
END bar ;
VAR
bar: CARDINAL ;
END testimport2.
m2f-3.8/comp/autotest/errors/testinit.mod 100644 144 144 524 6304345515 17230 0 ustar gaius users MODULE testinit ;
PROCEDURE ToThePower (i, n: CARDINAL) : CARDINAL ;
BEGIN
IF n=0
THEN
RETURN( 1 )
ELSE
WHILE n>1 DO
i := i * i ;
DEC(n)
END ;
RETURN( i )
END
END ToThePower ;
PROCEDURE foo ;
VAR
n: CARDINAL ;
BEGIN
n := ToThePower(n, 2)
END foo ;
BEGIN
foo
END testinit.
m2f-3.8/comp/autotest/errors/nestedproc4.mod 100644 144 144 1104 6736230727 17641 0 ustar gaius users MODULE nestedproc4 ;
FROM StdIO IMPORT Write ;
FROM StrIO IMPORT WriteLn ;
VAR
s: ARRAY [0..10] OF CHAR ;
PROCEDURE a ;
PROCEDURE b ;
VAR
p: PROC ;
PROCEDURE c ;
VAR
s: ARRAY [0..10] OF CHAR ;
PROCEDURE d ;
PROCEDURE e ;
BEGIN
s[4] := 'a' ;
b2
END e ;
BEGIN
e
END d ;
BEGIN
d
END c ;
BEGIN
foo(b) ;
p := b ;
c
END b ;
PROCEDURE b2 ;
BEGIN
s[4] := 'g' ;
END b2 ;
BEGIN
s := 'abcdgfghi' ;
b ;
Write(s[4]) ; WriteLn
(* output should be 'g' *)
END a ;
PROCEDURE foo (p: PROC) ;
BEGIN
END foo ;
BEGIN
a
END nestedproc4.
m2f-3.8/comp/autotest/errors/testparam.mod 100644 144 144 203 6311550326 17353 0 ustar gaius users MODULE testparam ;
FROM FIO IMPORT IsNoError, Close, EOF ;
VAR
i: INTEGER ;
BEGIN
IF EOF(i)
THEN
END
END testparam.
m2f-3.8/comp/autotest/errors/testproc2.mod 100644 144 144 620 6336542206 17310 0 ustar gaius users MODULE testproc2 ;
FROM NumberIO IMPORT WriteCard ;
FROM StrIO IMPORT WriteLn ;
PROCEDURE ToThePower (i, n: CARDINAL) : CARDINAL ;
BEGIN
IF n=0
THEN
RETURN( 1 )
ELSE
WHILE n>1 DO
i := i*i ;
DEC(n)
END ;
RETURN( n )
END
END ToThePower ;
VAR
a, b: CARDINAL ;
BEGIN
a := ToThePower(b, a) ;
WriteCard('a', 12) ; WriteLn
END testproc2.
m2f-3.8/comp/autotest/errors/testsub2.mod 100644 144 144 137 6217177365 17151 0 ustar gaius users MODULE testsub2 ;
TYPE
Index = CARDINAL ;
VAR
i: Index ;
BEGIN
DEC(i)
END testsub2.
m2f-3.8/comp/autotest/errors/testsub3.mod 100644 144 144 222 6217177365 17145 0 ustar gaius users MODULE testsub3 ;
TYPE
LIndex = CARDINAL ;
RIndex = CARDINAL ;
VAR
i: LIndex ;
j: RIndex ;
BEGIN
i := i + j + TRUE
END testsub3.
m2f-3.8/comp/autotest/errors/testsub4.mod 100644 144 144 133 6217177365 17147 0 ustar gaius users MODULE testsub4 ;
VAR
j: CARDINAL ;
i: BOOLEAN ;
BEGIN
i := i + j
END testsub4.
m2f-3.8/comp/autotest/errors/testtype.mod 100644 144 144 210 6331114622 17227 0 ustar gaius users MODULE testtype ;
TYPE
T = CARDINAL ;
VAR
v: T ;
PROCEDURE foo (a: v) ;
BEGIN
END foo ;
VAR
b: v ;
BEGIN
END testtype.
m2f-3.8/comp/autotest/errors/testvar.mod 100644 144 144 123 6331114622 17041 0 ustar gaius users MODULE testvar ;
PROCEDURE foo ;
i := 6
END foo ;
BEGIN
foo
END testvar.
m2f-3.8/comp/autotest/errors/prog111.mod 100644 144 144 107 6423323513 16550 0 ustar gaius users MODULE prog111 ;
VAR
n: INTEGER ;
BEGIN
n := n(1)
END prog111.
m2f-3.8/comp/autotest/errors/prog110.mod 100644 144 144 1217 6423323260 16571 0 ustar gaius users MODULE prog110;
FROM StrIO IMPORT WriteString, WriteLn;
FROM NumberIO IMPORT ReadInt, WriteInt;
VAR
n : INTEGER ; (* Number to divide *)
d : INTEGER ; (* Divisor *)
result : INTEGER; (* Result from divide *)
r : INTEGER ; (* Remainder *)
c : CHAR ; (* Answer from user to continue y/n *)
BEGIN
c := "Y"; (* set this to Y so it does the loop the first
time *)
WHILE c = "y" OR c = "Y" DO
WriteString "Input Number to divide (n)";
ReadInt (n);
WriteString "Input Number to divide by n";
ReadInt (d);
R := 0;
result := N DIV D;
END
END prog110.
m2f-3.8/comp/autotest/errors/testexp.mod 100644 144 144 144 6425343446 17064 0 ustar gaius users MODULE testexp ;
VAR
a, b, c, d: BOOLEAN ;
BEGIN
IF a=b AND c=d
THEN
END
END testexp.
m2f-3.8/comp/autotest/errors/testdiv.mod 100644 144 144 165 6425336322 17050 0 ustar gaius users MODULE testdiv ;
VAR
a: CHAR ;
BEGIN
a := 'Y' ;
a := 'Y' + 'Y/n' ;
WHILE a='Y/n' DO
END
END testdiv.
m2f-3.8/comp/autotest/errors/prog112.mod 100644 144 144 2413 6425646454 16611 0 ustar gaius users (*
* Program written by sabroadh
* Created on Thu Oct 16 13:44:36 BST 1997
* SDP coursework
*)
MODULE prog112;
FROM StrIO IMPORT WriteString,WriteLn,ReadString;
FROM NumberIO IMPORT ReadInt,WriteInt;
FROM IO IMPORT Read,Write;
VAR
N :INTEGER;
D :INTEGER;
R :INTEGER;
max_iteration :INTEGER;
max_counter :INTEGER;
answer :ARRAY [0..1] OF CHAR;
BEGIN
N := 0;
D := 0;
R := 0;
answer := ('y');
WriteString('INPUT MAXIMIN NUMBERS TO BE DISPLAYED : ');
ReadInt(max_iteration);
WHILE (answer[0] = 'y') OR (answer[0] = 'Y') DO
WriteString('INPUT DEVISER : ');
ReadInt(D);
WriteLn;
WriteString('INPUT NUMBER : ');
ReadInt(N);
WriteLn;
WriteInt (N,1);
WriteString (', ');
max_counter :=0;
WHILE (N >= D) AND (max_counter < max_iteration) DO
max_counter := max_counter+1;
R := N MOD D;
IF R = 0 THEN
N := N DIV D
ELSE
IF (R > 0) AND (R <= D-2) THEN
N := N * (D +1) - R
ELSE
N:=N*(D+1) +1
END; (*IF*)
WriteInt (N,1);
END; (* End first While*)
WriteLn;
WriteString ('Do you wish to do another numbers test [Y/N]:');
ReadString (answer);
END
END; prog112. m2f-3.8/comp/autotest/errors/prog31.mod 100644 144 144 1441 6432327122 16513 0 ustar gaius users (*
* Program written by iptatton
* Created on Tue Nov 11 09:06:16 GMT 1997
* sdp course
*)
(* to Convert Celsius to Fahrenheit *)
MODULE prog31;
FROM StrIO IMPORT WriteLn,WriteString;
FROM FpuIO IMPORT ReadReal, WriteReal;
FROM NumberIO IMPORT WriteInt;
celsius : REAL;
end_of_range : INTEGER;
BEGIN
celsius := -10.0;
fahrenheit := 000000.00;
end_of_range := 100;
(*WriteString('Enter the celsius value :');*)
(*ReadReal(celsius);*)
(*WriteLn;*)
WHILE (celsius < 100.0) DO
fahrenheit := ( (9.00 * celsius ) / 5.00 ) + 32.00;
WriteReal(celsius,6,2);
WriteString(" degrees Celsius goes to ") ;
WriteReal(fahrenheit,6,2);
WriteString(" degrees Fahrenheit");
WriteLn;
celsius := (celsius + 5.0);
END;
END prog31.
m2f-3.8/comp/autotest/errors/prog51.mod 100644 144 144 5110 6434562036 16521 0 ustar gaius users (*
* Program written by sabroadh
* Created on Thu Nov 13 13:16:24 GMT 1997
* sdp coursework
*)
MODULE prog51;
FROM StrIO IMPORT WriteString,WriteLn,ReadString;
FROM NumberIO IMPORT ReadInt,WriteInt;
FROM IO IMPORT Read,Write;
VAR
dname :ARRAY [0..30] OF CHAR;
d_age :INTEGER;
l_accident :INTEGER;
car_code :CHAR;
v_car :INTEGER;
premium :REAL;
excess :REAL;
type :ARRAY [0..20] OF CHAR;
rubbish :CHAR;
PROCEDURE dinput;
VAR
dname :ARRAY [0..30] OF CHAR;
d_age :INTEGER;
l_accident :INTEGER;
v_car :INTEGER; (*value of the car*)
BEGIN
WriteString ('Enter name (Z to end) ');
ReadString (dname);
WriteLn;
WHILE NOT (dname [0]= 'z') OR (dname [0] = 'Z') DO
WriteString ('Enter age ');
ReadInt (d_age);
WriteLn;
WriteString ('Enter number of years since last accident ');
ReadInt (l_accident);
WriteLn;
WriteString ('Enter car code (U = U.K., F = foreign) ');
Read (car_code);
Read (rubbish);
WriteString ('Please enter in the value of there car : ');
ReadInt (v_car);
END; (*while*)
END dinput;
PROCEDURE mainif;
VAR
d_age :INTEGER;
l_accident :INTEGER;
car_code :CHAR;
BEGIN
IF d_age > 25 THEN (*1*)
IF l_accident >3 THEN (*2*)
IF (car_code ='u') OR (car_code = 'U')THEN (*3*)
premium := 6;
excess := 0;
type := "Compiehensie";
ELSE
premium := 6;
excess := 100;
type := "Compiehensie";
END; (*3*)
ELSE
IF (car_code ='u')OR (car_code = 'U')THEN (*4*)
premium := 7;
excess := 100;
type := "Compiehensie";
ELSE
premium := 7;
excess := 100;
type := "Third party";
END; (*4*)
END; (*2*)
ELSE
IF l_accident >3 THEN (*5*)
IF (car_code ='u') OR (car_code = 'U')THEN (*6*)
premium := 8;
excess := 200;
type := "Compiehensie";
ELSE
premium := 9;
excess := 250;
type := "Compiehensie";
END; (*6*)
ELSE
IF (car_code ='u')OR (car_code = 'U')THEN (*7*)
premium := 0;
excess := 0;
type := "risk is declined";
ELSE
premium := 0;
excess := 0;
type := "risk is declined";
END; (*7*)
END; (*5*)
END; (*1*)
END mainif;
PROCEDURE premiumV;
BEGIN
premium := (v_car/100*premium);
END premiumV;
PROCEDURE Fioutput;
VAR
dname :ARRAY [0..30] OF CHAR;
premium :REAL;
excess :REAL;
type :ARRAY [0..20] OF CHAR;
BEGIN
WriteString ('UCIC qiote');
WriteLn;
WriteString (dname);
WriteLn;
WriteString (type);
WriteLn;
WriteString ('Excess ');
WirteString (excess);
WriteLn;
WriteString ('Premium ');
WriteString (premium);
WriteLn;
END Fioutput;
END prog51.
m2f-3.8/comp/autotest/errors/teststring.mod 100644 144 144 213 6470315040 17560 0 ustar gaius users MODULE teststring ;
VAR
str: ARRAY [0..40] OF CHAR ;
BEGIN
str := "Delete record containing a particular surname";
END teststring.
m2f-3.8/comp/autotest/errors/testwrite.mod 100644 144 144 451 6470317576 17430 0 ustar gaius users MODULE testwrite ;
IMPORT StrIO ;
IMPORT FIO ;
VAR
which: RECORD
filehandle: FILE ;
Surname : ARRAY [0..20] OF CHAR ;
END ;
PROCEDURE do ;
BEGIN
WITH which DO
StrIO.WriteString(filehandle,Surname)
END
END do ;
BEGIN
do
END testwrite.
m2f-3.8/comp/autotest/errors/testwith.mod 100644 144 144 212 6473002515 17227 0 ustar gaius users MODULE testwith ;
VAR
w: RECORD
a,
b: CARDINAL ;
END ;
BEGIN
WITH x DO
a := 0
END
END testwith.
m2f-3.8/comp/autotest/errors/type.mod 100644 144 144 234 6475335553 16356 0 ustar gaius users MODULE type ;
FROM FIO IMPORT EOF, OpenToRead ;
IMPORT FIO ;
VAR
f: File ;
BEGIN
f := OpenToRead('nothing') ;
IF EOF(f)
THEN
END
END type.
m2f-3.8/comp/autotest/errors/prog21.mod 100644 144 144 7577 6475037730 16544 0 ustar gaius users (*
Program written by sabroadh
Created on Tue Feb 24 15:02:59 GMT 1998
swd coursework 1 - file handling
*)
MODULE prog21;
(* your solution to employee problem - swd 1st c/w 1997/8 *)
IMPORT FIO;
FROM NumberIO IMPORT WriteInt,ReadInt,StrToInt,IntToStr;
FROM FpuIO IMPORT ReadReal,WriteReal,StrToReal,RealToStr;
FROM StdIO IMPORT Write;
IMPORT StrIO; (* WriteString,WriteLn,ReadString; *)
FROM StrCase IMPORT Cap;
FROM menu IMPORT popup,MenuType;
FROM Cursor IMPORT Clear;
CONST
EXITOPT = 8;
TYPE
string4 = ARRAY[0..3] OF CHAR;
string10 = ARRAY[0..9] OF CHAR;
string20 = ARRAY[0..19] OF CHAR;
string40 = ARRAY[0..39] OF CHAR;
employeeRecordType = RECORD
Forename : string20;
Surname : string40;
EmpNumber: string10;
Address1 : string20;
Address2 : string20;
Address3 : string20;
Address4 : string20;
END;(*record*)
VAR
menu : MenuType;
selection : CARDINAL;
filehandle : File;
crlf : ARRAY[0..1] OF CHAR;
PROCEDURE continue;
VAR
s : string4;
BEGIN
StrIO.WriteLn;
StrIO.WriteString("press ENTER to continue > ");
StrIO.ReadString(s);
END continue;
PROCEDURE blankRec(VAR blank : employeeRecordType) ;
BEGIN
WITH blank DO
Forename := ' ';
Surname := ' ';
EmpNumber:=' ';
Address1 :=' ';
Address2 :=' ';
Address3 :=' ';
Address4 :=' ';
END; (*with*)
END blankRec;
(*This procedure is passed the data for an employee . *)
(* It prints out a formatted copy of the data in this record.*)
PROCEDURE printEntry(which : employeeRecordType) ;
BEGIN
END printEntry; (*printEntry*)
(*this gets a new entry from the user *)
PROCEDURE getEntry(VAR newrec : employeeRecordType) ;
(*Data to be filled in by user responses.*)
BEGIN
END getEntry ;
PROCEDURE getRecord(VAR employeeRec: employeeRecordType);
BEGIN
END getRecord;
(*This procedure reads in the data from the input file It simply calls
getRecord over AND again. If it ever fails for any reason it aborts.*)
PROCEDURE getFile() ;
VAR
inRec : employeeRecordType;
BEGIN
(*Reset the file to read it all in.*) filehandle
:=FIO.OpenToRead ('employee.txt');
(*Process all the lines in the file.*)
WHILE NOT EOF(filehandle ) DO
getRecord(inRec);
printEntry(inRec);
END ; (* WHILE NOT EOF() *)
END getFile ;
PROCEDURE CreateNewFile;
BEGIN
END CreateNewFile;
PROCEDURE RenameExistingFile;
BEGIN
END RenameExistingFile;
PROCEDURE addRecord;
BEGIN
END addRecord;
PROCEDURE DeleteRecord;
BEGIN
END DeleteRecord;
PROCEDURE ListRecords;
BEGIN
Clear;
getFile;
FIO.WriteString ('Forename');
continue;
END ListRecords;
PROCEDURE runSubMenu;
BEGIN
END runSubMenu;
PROCEDURE provideHelp;
BEGIN
END provideHelp;
(* START OF MAIN MODULE.*)
BEGIN (*body of MODULE*)
WITH menu DO
NumberOfOptions := EXITOPT;
Option[1] := "=A9reate a new file";
OptionLetter[1] := "C";
Option[2] := "=AEename existing file";
OptionLetter[2] := "R";
Option[3] := "(A)dd a new record";
OptionLetter[3] := "A";
Option[4] := "(D)elete record by surname";
OptionLetter[4] := "D";
Option[5] := "(L)ist the whole file";
OptionLetter[5] := "L";
Option[6] := "(S)ub menu for enhancements";
OptionLetter[6] := "S";
Option[7] := "(?) for help";
OptionLetter[7] := "?";
Option[8] := "(E)xit program";
OptionLetter[8] := "E";
END; (*with*)
(*menu we get a valid input by calling popup with the
parameter menu*) Clear; selection := popup(menu,10,10);
(*Do until finished.*)
WHILE selection <> EXITOPT DO
(*Perform the appropriate action - only valid input gets here.*)
CASE selection OF
1 : CreateNewFile;
| 2 : RenameExistingFile;
| 3 : addRecord;
| 4 : DeleteRecord;
| 5 : ListRecords;
| 6 : runSubMenu;
| 7 : provideHelp;
END ; (* CASE selection *)
(*menu we get a valid input by calling popup with the parameter
menu*) selection := popup(menu,10,10);
(*if the user types ? then they will get more detailed help.*)
END ; (* WHILE selection <> EXITOPT *)
(*EXIT the MODULE.*)
StrIO.WriteString('Exiting - Thankyou for your help.');
StrIO.WriteLn;
END prog21. (* MODULE *)
m2f-3.8/comp/autotest/errors/testdyn.mod 100644 144 144 355 6517647466 17101 0 ustar gaius users MODULE testdyn ;
FROM StrLib IMPORT StrEqual ;
TYPE
Results = ARRAY [0..9] OF CHAR ;
Double = ARRAY [0..4] OF Results ;
VAR
Value : ARRAY [0..9] OF CHAR ;
BEGIN
IF StrEqual(Double[1], Value)
THEN
END
END testdyn.
m2f-3.8/comp/autotest/errors/prog114.mod 100644 144 144 137 6515721534 16565 0 ustar gaius users MODULE prog114 ;
PROCEDURE test (a: ARRAY OF CHAR;) ;
BEGIN
END test ;
BEGIN
END prog114.
m2f-3.8/comp/autotest/errors/testdyn2.mod 100644 144 144 266 6517647567 17166 0 ustar gaius users MODULE testdyn2 ;
TYPE
Results = ARRAY [0..9] OF CHAR ;
Double = ARRAY [0..4] OF Results ;
VAR
Value : ARRAY [0..9] OF CHAR ;
BEGIN
Double[1] := Value
END testdyn2.
m2f-3.8/comp/autotest/errors/testdyn3.mod 100644 144 144 266 6517647623 17160 0 ustar gaius users MODULE testdyn3 ;
TYPE
Results = ARRAY [0..9] OF CHAR ;
Double = ARRAY [0..4] OF Results ;
VAR
Value : ARRAY [0..9] OF CHAR ;
BEGIN
Value := Double[1]
END testdyn3.
m2f-3.8/comp/autotest/errors/prog113.mod 100644 144 144 221 6515731320 16550 0 ustar gaius users MODULE prog113 ;
FROM FIO IMPORT ReadString, File ;
VAR
f: File ;
a: ARRAY [0..100] OF CHAR ;
BEGIN
FIO.ReadString(f, a)
END prog113.
m2f-3.8/comp/autotest/errors/prog33.mod 100644 144 144 2317 6520620150 16513 0 ustar gaius users (* Program written by lcmorley *)
(* Created on Mon Apr 20 15:10:28 BST 1998*)
(* SE108 Coursework 2*)
MODULE prog33;
FROM StrIO IMPORT WriteString, ReadString,WriteLn;
FROM StrLib IMPORT StrEqual;
FROM IO IMPORT Read;
FROM NumberIO IMPORT WriteCard;
FROM Sort IMPORT BubbleSort;
TYPE
FieldName = ARRAY [0..9] OF CHAR;
Races = RECORD
Name : FieldName;
Score : CARDINAL;
END;
VAR
Ending : FieldName;
Count, Count2 : CARDINAL;
Venue : FieldName;
Exists, Exited, Finish : BOOLEAN;
Results : Races;
Position : CARDINAL;
Entered_Name : FieldName;
Dump : CHAR;
Less_Than : BOOLEAN;
Races_Array : ARRAY [0..50] OF Races;
PROCEDURE Sorting_Time;
BEGIN
BubbleSort(Count - 1,Less, Swap);
END Sorting_Time;
PROCEDURE Swap(Val_1: CARDINAL; Val_2 : CHAR; doo: CARDINAL);
VAR
Temporary : ARRAY [0..1] OF Races;
BEGIN
Temporary[0] := Races_Array[Val_1];
Races_Array[Val_1] := Races_Array[Val_2];
Races_Array[Val_2] := Temporary[0];
END Swap;
PROCEDURE Less(Value_1, Value_2 : CARDINAL) : BOOLEAN;
BEGIN
Less_Than := Races_Array[Value_1].Score <
Races_Array[Value_2].Score;
RETURN Less_Than;
END Less;
BEGIN
Ending := 'qqqqqqqqqq';
Sorting_Time
END prog33. m2f-3.8/comp/autotest/errors/prog34.mod 100644 144 144 2303 6520620215 16511 0 ustar gaius users (* Program written by lcmorley *)
(* Created on Mon Apr 20 15:10:28 BST 1998*)
(* SE108 Coursework 2*)
MODULE prog34;
FROM StrIO IMPORT WriteString, ReadString,WriteLn;
FROM StrLib IMPORT StrEqual;
FROM IO IMPORT Read;
FROM NumberIO IMPORT WriteCard;
FROM Sort IMPORT BubbleSort;
TYPE
FieldName = ARRAY [0..9] OF CHAR;
Races = RECORD
Name : FieldName;
Score : CARDINAL;
END;
VAR
Ending : FieldName;
Count, Count2 : CARDINAL;
Venue : FieldName;
Exists, Exited, Finish : BOOLEAN;
Results : Races;
Position : CARDINAL;
Entered_Name : FieldName;
Dump : CHAR;
Less_Than : BOOLEAN;
Races_Array : ARRAY [0..50] OF Races;
PROCEDURE Sorting_Time;
BEGIN
BubbleSort(Count - 1,Less, Swap);
END Sorting_Time;
PROCEDURE Swap(Val_1: CARDINAL; Val_2 : INTEGER);
VAR
Temporary : ARRAY [0..1] OF Races;
BEGIN
Temporary[0] := Races_Array[Val_1];
Races_Array[Val_1] := Races_Array[Val_2];
Races_Array[Val_2] := Temporary[0];
END Swap;
PROCEDURE Less(Value_1, Value_2 : CARDINAL) : BOOLEAN;
BEGIN
Less_Than := Races_Array[Value_1].Score <
Races_Array[Value_2].Score;
RETURN Less_Than;
END Less;
BEGIN
Ending := 'qqqqqqqqqq';
Sorting_Time
END prog34. m2f-3.8/comp/autotest/errors/prog32.mod 100644 144 144 2310 6520620165 16511 0 ustar gaius users (* Program written by lcmorley *)
(* Created on Mon Apr 20 15:10:28 BST 1998*)
(* SE108 Coursework 2*)
MODULE prog32;
FROM StrIO IMPORT WriteString, ReadString,WriteLn;
FROM StrLib IMPORT StrEqual;
FROM IO IMPORT Read;
FROM NumberIO IMPORT WriteCard;
FROM Sort IMPORT BubbleSort;
TYPE
FieldName = ARRAY [0..9] OF CHAR;
Races = RECORD
Name : FieldName;
Score : CARDINAL;
END;
VAR
Ending : FieldName;
Count, Count2 : CARDINAL;
Venue : FieldName;
Exists, Exited, Finish : BOOLEAN;
Results : Races;
Position : CARDINAL;
Entered_Name : FieldName;
Dump : CHAR;
Less_Than : BOOLEAN;
Races_Array : ARRAY [0..50] OF Races;
PROCEDURE Sorting_Time;
BEGIN
BubbleSort(Count - 1,Less, Swap);
END Sorting_Time;
PROCEDURE Swap(Val_1: CARDINAL; VAR Val_2 : CARDINAL);
VAR
Temporary : ARRAY [0..1] OF Races;
BEGIN
Temporary[0] := Races_Array[Val_1];
Races_Array[Val_1] := Races_Array[Val_2];
Races_Array[Val_2] := Temporary[0];
END Swap;
PROCEDURE Less(Value_1, Value_2 : CARDINAL) : BOOLEAN;
BEGIN
Less_Than := Races_Array[Value_1].Score <
Races_Array[Value_2].Score;
RETURN Less_Than;
END Less;
BEGIN
Ending := 'qqqqqqqqqq';
Sorting_Time
END prog32. m2f-3.8/comp/autotest/errors/testchar.mod- 100644 144 144 111 6501223066 17242 0 ustar gaius users MODULE testchar ;
VAR
i: CARDINAL ;
BEGIN
i := '0'
END testchar.
m2f-3.8/comp/autotest/errors/array1.mod 100644 144 144 163 6654311570 16565 0 ustar gaius users MODULE array1 ;
VAR
a: ARRAY [FALSE..TRUE] OF CARDINAL ;
i, j: CARDINAL ;
BEGIN
a[i=j] := j
END array1.
m2f-3.8/comp/autotest/fpu/ 40755 144 144 0 6743314171 14065 5 ustar gaius users m2f-3.8/comp/autotest/fpu/CVS/ 40755 144 144 0 6737147131 14523 5 ustar gaius users m2f-3.8/comp/autotest/fpu/CVS/Root 100644 144 144 15 6402517645 15422 0 ustar gaius users /usr/src/cvs
m2f-3.8/comp/autotest/fpu/CVS/Repository 100644 144 144 42 6402517645 16656 0 ustar gaius users /usr/src/cvs/m2/comp/autotest/fpu
m2f-3.8/comp/autotest/fpu/CVS/Entries 100644 144 144 463 6737147131 16137 0 ustar gaius users /makefile/1.1/Mon Sep 30 13:57:48 1996//
/testfpu1.mod/1.1/Mon Sep 30 13:57:48 1996//
/testfpu2.mod/1.1/Thu Nov 28 15:32:47 1996//
/testfpu3.mod/1.1/Wed Mar 12 15:38:34 1997//
/r1.mod/1.1/Fri Jun 12 12:58:21 1998//
/realconst.mod/1.2/Fri Jun 11 08:49:00 1999//
/testsin.mod/1.1/Fri Jun 11 08:58:26 1999//
D
m2f-3.8/comp/autotest/fpu/makefile 100644 144 144 106 6223750734 15641 0 ustar gaius users
all: force
clean: force
$(RM) mod_init.* *.o a.out *.s *~
force:
m2f-3.8/comp/autotest/fpu/realconst.mod 100644 144 144 1313 6730146574 16661 0 ustar gaius users MODULE realconst;
(*A program to convert an angle in degrees to an angle in radians*)
FROM StrIO IMPORT WriteString, WriteLn;
FROM MATH IMPORT pi;
FROM FpuIO IMPORT WriteReal, ReadReal;
VAR
Degrees, Radians: REAL;
PROCEDURE ConvertAngle (Angle:REAL): REAL;
(*Convert an angle from degrees to radians*)
VAR
ConversionFactor : REAL;
BEGIN
ConversionFactor:= pi / 180.0;
WriteReal(ConversionFactor, 20, 15 );
RETURN ConversionFactor * Angle
END ConvertAngle;
BEGIN (*convert*)
WriteString("Enter an angle in degrees: ");
ReadReal(Degrees); WriteLn;
Radians := ConvertAngle (Degrees);
WriteString("The angle in radians is: ");
WriteReal(Radians, 20, 5 ); WriteLn;
END realconst.
m2f-3.8/comp/autotest/fpu/testfpu1.mod 100644 144 144 473 6223750734 16424 0 ustar gaius users MODULE testfpu1 ;
FROM MATH IMPORT pi ;
FROM FpuIO IMPORT WriteReal, WriteLongReal ;
FROM StrIO IMPORT WriteString, WriteLn ;
BEGIN
WriteString('the LONGREAL value of pi = ') ; WriteLongReal(pi, 70, 68) ; WriteLn ;
WriteString('the REAL value of pi = ') ; WriteReal(pi, 70, 68) ; WriteLn
END testfpu1.
m2f-3.8/comp/autotest/fpu/testfpu2.mod 100644 144 144 105 6247330237 16413 0 ustar gaius users MODULE testfpu2 ;
VAR
r: REAL ;
BEGIN
r := 2.3
END testfpu2.
m2f-3.8/comp/autotest/fpu/testfpu3.mod 100644 144 144 632 6311546772 16426 0 ustar gaius users MODULE testfpu3 ;
TYPE
Stack = RECORD
Left, Right: REAL ;
END ;
VAR
Stacked: ARRAY [0..10] OF Stack ;
i : CARDINAL ;
BEGIN
FOR i := 0 TO 10 DO
WITH Stacked[i] DO
Left := FLOAT(i) ;
Right := 10.0
END
END ;
FOR i := 0 TO 10 DO
WITH Stacked[i] DO
Left := Right * Left
END
END ;
LOOP
END
END testfpu3.
m2f-3.8/comp/autotest/fpu/r1.mod 100644 144 144 200 6540222755 15156 0 ustar gaius users MODULE r1 ;
VAR
l: LONGINT ;
r: LONGREAL ;
BEGIN
l := 1000000000 ;
r := VAL(LONGREAL, l) ;
LOOP
END
END r1.
m2f-3.8/comp/autotest/fpu/testsin.mod 100644 144 144 510 6730147662 16335 0 ustar gaius users MODULE testsin ;
FROM MATH IMPORT pi, sin, cos ;
FROM FpuIO IMPORT WriteReal, WriteLongReal ;
FROM StrIO IMPORT WriteString, WriteLn ;
VAR
c,
b,
a: LONGREAL ;
BEGIN
c := pi ;
a := sin(pi/3.0) ;
b := cos(pi/3.0) ;
WriteLongReal(a, 70, 68) ; WriteLn ;
WriteLongReal(b, 70, 68) ; WriteLn ;
END testsin.
m2f-3.8/comp/autotest/run/ 40755 144 144 0 6402517646 14103 5 ustar gaius users m2f-3.8/comp/autotest/run/CVS/ 40755 144 144 0 6601444354 14532 5 ustar gaius users m2f-3.8/comp/autotest/run/CVS/Root 100644 144 144 15 6402517646 15435 0 ustar gaius users /usr/src/cvs
m2f-3.8/comp/autotest/run/CVS/Repository 100644 144 144 42 6402517646 16671 0 ustar gaius users /usr/src/cvs/m2/comp/autotest/run
m2f-3.8/comp/autotest/run/CVS/Entries 100644 144 144 77 6601444354 16127 0 ustar gaius users /makefile/1.1/Thu Sep 19 06:57:53 1996//
D/fail////
D/pass////
m2f-3.8/comp/autotest/run/fail/ 40755 144 144 0 6743314171 15012 5 ustar gaius users m2f-3.8/comp/autotest/run/fail/CVS/ 40755 144 144 0 6601445214 15441 5 ustar gaius users m2f-3.8/comp/autotest/run/fail/CVS/Root 100644 144 144 15 6402517646 16350 0 ustar gaius users /usr/src/cvs
m2f-3.8/comp/autotest/run/fail/CVS/Repository 100644 144 144 47 6402517646 17611 0 ustar gaius users /usr/src/cvs/m2/comp/autotest/run/fail
m2f-3.8/comp/autotest/run/fail/CVS/Entries 100644 144 144 404 6601445214 17050 0 ustar gaius users /makefile/1.1/Thu Sep 19 06:57:56 1996//
/mustrunandfail/1.1/Thu Sep 19 06:57:56 1996//
/testdec.mod/1.1/Thu Sep 19 06:57:56 1996//
/list.mod/1.1/Wed Feb 25 15:42:10 1998//
/testfunc.mod/1.1/Fri Jul 10 15:01:47 1998//
/options/1.2/Fri Sep 11 15:54:42 1998//
D
m2f-3.8/comp/autotest/run/fail/makefile 100644 144 144 70 6220167364 16544 0 ustar gaius users
clean: force
$(RM) *.o a.out mod_init.* *.s
force:
m2f-3.8/comp/autotest/run/fail/mustrunandfail 100644 144 144 0 6220167364 17774 0 ustar gaius users m2f-3.8/comp/autotest/run/fail/testdec.mod 100644 144 144 144 6220167364 17222 0 ustar gaius users MODULE testdec ;
VAR
c: CARDINAL ;
BEGIN
c := 0 ; (* test bounds *)
DEC(c)
END testdec.
m2f-3.8/comp/autotest/run/fail/list.mod 100644 144 144 4424 6475035722 16573 0 ustar gaius users MODULE list ;
FROM FIO IMPORT OpenToRead, OpenToWrite, Close, EOF, WriteLine,
ReadString, WriteString, File, WriteChar;
FROM NumberIO IMPORT WriteInt,ReadInt,StrToInt,IntToStr;
FROM FpuIO IMPORT ReadReal,WriteReal,StrToReal,RealToStr;
FROM StdIO IMPORT Write;
IMPORT StrIO; (* WriteString,WriteLn,ReadString; *)
FROM StrLib IMPORT StrLen,StrLess,StrEqual;
TYPE
string4 = ARRAY[0..3] OF CHAR;
string8 = ARRAY[0..7] OF CHAR;
string10 = ARRAY[0..9] OF CHAR;
string20 = ARRAY[0..19] OF CHAR;
string40 = ARRAY[0..39] OF CHAR;
employeeRecordType = RECORD
Forename : string20;
Surname : string40;
EmpNumber: string10;
Address1 : string20;
Address2 : string20;
Address3 : string20;
Address4 : string20;
END;(*record*)
VAR
filehandle: File ;
crlf : ARRAY[0..1] OF CHAR;
PROCEDURE getRecord(VAR employeeRec: employeeRecordType);
BEGIN
WITH employeeRec DO
(*Read in each field in turn.*)
ReadString(filehandle,Surname);
ReadString(filehandle,Forename);
ReadString(filehandle,EmpNumber);
ReadString(filehandle,Address1);
ReadString(filehandle,Address2);
ReadString(filehandle,Address3);
ReadString(filehandle,Address4);
ReadString(filehandle,crlf);
END
END getRecord;
PROCEDURE getFile (nameOfFile : ARRAY OF CHAR) ;
VAR
inRec : employeeRecordType;
BEGIN
(*Reset the file to read it all in.*)
filehandle := OpenToRead(nameOfFile) ;
(*Process all the lines in the file.*)
WHILE NOT EOF(filehandle ) DO
getRecord(inRec);
printEntry(inRec);
END ; (* WHILE NOT EOF() *)
Close(filehandle);
END getFile ;
PROCEDURE printEntry(which : employeeRecordType) ;
BEGIN
WITH which DO
(*print each field in turn.*)
StrIO.WriteString(Forename);
StrIO.WriteString(" ");
StrIO.WriteString(Surname);
StrIO.WriteString(" ");
StrIO.WriteString(EmpNumber);
StrIO.WriteLn;
StrIO.WriteString(Address1);
StrIO.WriteLn;
StrIO.WriteString(Address2);
StrIO.WriteLn;
StrIO.WriteString(Address3);
StrIO.WriteLn;
StrIO.WriteString(Address4);
END ; (*with*)
StrIO.WriteLn;
END printEntry; (*printEntry*)
BEGIN
getFile('employee.txt')
END list.
m2f-3.8/comp/autotest/run/fail/testfunc.mod 100644 144 144 310 6551426333 17416 0 ustar gaius users MODULE testfunc ;
(*
func -
*)
PROCEDURE func (a: CARDINAL) : CARDINAL ;
BEGIN
IF a>10
THEN
RETURN( a )
END
END func ;
VAR
e: CARDINAL ;
BEGIN
e := func(9)
END testfunc.
m2f-3.8/comp/autotest/run/fail/options 100644 144 144 20 6576243702 16462 0 ustar gaius users -return -bounds
m2f-3.8/comp/autotest/run/makefile 100644 144 144 112 6220167361 15643 0 ustar gaius users
clean: force
( cd pass ; make clean )
( cd fail ; make clean )
force:
m2f-3.8/comp/autotest/run/pass/ 40755 144 144 0 6743314171 15045 5 ustar gaius users m2f-3.8/comp/autotest/run/pass/CVS/ 40755 144 144 0 6740730566 15507 5 ustar gaius users m2f-3.8/comp/autotest/run/pass/CVS/Root 100644 144 144 15 6402517646 16403 0 ustar gaius users /usr/src/cvs
m2f-3.8/comp/autotest/run/pass/CVS/Repository 100644 144 144 47 6402517646 17644 0 ustar gaius users /usr/src/cvs/m2/comp/autotest/run/pass
m2f-3.8/comp/autotest/run/pass/CVS/Entries 100644 144 144 1746 6740730566 17150 0 ustar gaius users /makefile/1.4/Mon Jul 7 08:59:58 1997//
/mustrunandpass/1.1/Thu Sep 19 06:58:01 1996//
/options/1.1/Mon Apr 28 12:35:30 1997//
/rts.mod/1.1/Mon May 12 11:13:14 1997//
/testavail.mod/1.1/Mon Apr 28 12:35:30 1997//
/testfpufunc.mod/1.2/Wed Mar 12 15:38:35 1997//
/testfpufunc2.mod/1.1/Thu Nov 28 15:32:50 1996//
/testsize.mod/1.1/Mon May 12 11:13:14 1997//
/testsize2.mod/1.1/Mon May 12 11:13:15 1997//
/testsize3.mod/1.1/Mon Jul 7 09:04:21 1997//
/wr.mod/1.1/Tue Jun 10 13:37:26 1997//
/prog31ex.mod/1.1/Wed Nov 12 13:41:55 1997//
/testpound.mod/1.1/Wed Nov 19 17:58:12 1997//
/nothing.mod/1.1/Fri May 1 11:39:12 1998//
/stripped.mod/1.1/Fri May 1 11:56:27 1998//
/cycles.mod/1.1/Fri Oct 2 10:51:24 1998//
/testparam.mod/1.1/Mon Dec 14 14:36:26 1998//
/nestedproc.mod/1.1/Fri Jul 2 11:01:23 1999//
/nestedproc2.mod/1.1/Thu Jun 24 13:51:07 1999//
/nestedproc3.mod/1.1/Fri Jun 25 13:09:06 1999//
/testnextproc.mod/1.1/Mon Jul 5 08:57:28 1999//
/nestedproc5.mod/1.1/Wed Jul 7 19:53:36 1999//
D
m2f-3.8/comp/autotest/run/pass/makefile 100644 144 144 107 6360130016 16605 0 ustar gaius users
clean: force
$(RM) a.out *.s *.o mod_init.c results.dat *~
force:
m2f-3.8/comp/autotest/run/pass/mustrunandpass 100644 144 144 0 6220167371 20060 0 ustar gaius users m2f-3.8/comp/autotest/run/pass/options 100644 144 144 3 6331114622 16461 0 ustar gaius users -g
m2f-3.8/comp/autotest/run/pass/rts.mod 100644 144 144 731 6335575512 16441 0 ustar gaius users MODULE rts;
FROM FpuIO IMPORT ReadReal,WriteReal,StrToReal,RealToStr, ReadLongReal;
IMPORT StrIO; (* WriteString,WriteLn,ReadString; *)
VAR
s : ARRAY[0..9] OF CHAR;
r : REAL;
l : LONGREAL ;
t,f: CARDINAL;
a,b: CARDINAL ;
BEGIN
a := 123 ;
b := 45 ;
r := FLOAT(a) + (FLOAT(b) / 100.0) ;
(*
l := FLOAT(a) + (FLOAT(b) / 100.0) ;
ReadReal(r);
*)
t := 7;
f := 2;
RealToStr(r,t,f,s);
StrIO.WriteString(s);
StrIO.WriteLn;
END rts.
m2f-3.8/comp/autotest/run/pass/testavail.mod 100644 144 144 354 6331114622 17611 0 ustar gaius users MODULE testavail ;
FROM Storage IMPORT Available ;
FROM libc IMPORT exit ;
FROM StrIO IMPORT WriteString, WriteLn ;
BEGIN
IF Available(100)
THEN
WriteString('works') ; WriteLn
ELSE
exit(1)
END
END testavail.
m2f-3.8/comp/autotest/run/pass/testfpufunc.mod 100644 144 144 364 6311546773 20202 0 ustar gaius users MODULE testfpufunc ;
PROCEDURE func () : REAL ;
VAR
a: REAL ;
BEGIN
a := 4.5 ;
RETURN( a )
END func ;
VAR
t: REAL ;
n: CARDINAL ;
BEGIN
n := 0 ;
WHILE n<10000 DO
t := func() ;
INC(n)
END
END testfpufunc.
m2f-3.8/comp/autotest/run/pass/testfpufunc2.mod 100644 144 144 456 6247330242 20254 0 ustar gaius users MODULE testfpufunc2 ;
PROCEDURE func () : REAL ;
VAR
t: RECORD
a: REAL ;
END ;
BEGIN
t.a := 4.5 ;
WITH t DO
RETURN( a )
END
END func ;
VAR
t: REAL ;
n: CARDINAL ;
BEGIN
n := 0 ;
WHILE n<10000 DO
t := func() ;
INC(n)
END
END testfpufunc2.
m2f-3.8/comp/autotest/run/pass/testsize.mod 100644 144 144 252 6335575512 17501 0 ustar gaius users MODULE testsize ;
FROM SYSTEM IMPORT SIZE ;
VAR
p: POINTER TO CHAR ;
c: CARDINAL ;
BEGIN
p := NIL ;
c := SIZE(p^) (* should not sigsegv! *)
END testsize.
m2f-3.8/comp/autotest/run/pass/testsize2.mod 100644 144 144 540 6335575513 17564 0 ustar gaius users MODULE testsize2 ;
FROM SYSTEM IMPORT SIZE ;
TYPE
FRAGMENT = POINTER TO RECORD
Left, Right: FRAGMENT ;
Size : CARDINAL ;
END ;
VAR
n: CARDINAL ;
f: FRAGMENT ;
BEGIN
n := 0 ;
INC(n, SIZE(f^)) ;
f := NIL ;
IF f=f
THEN
END
END testsize2.
m2f-3.8/comp/autotest/run/pass/testsize3.mod 100644 144 144 261 6360130425 17550 0 ustar gaius users MODULE testsize3 ;
FROM SYSTEM IMPORT BYTE, SIZE ;
VAR
i: INTEGER ;
p: CHAR ;
c: CARDINAL ;
b: BYTE ;
BEGIN
c := (SIZE(i) + SIZE(p)) DIV SIZE(b)
END testsize3.
m2f-3.8/comp/autotest/run/pass/wr.mod 100644 144 144 1070 6347254226 16275 0 ustar gaius users MODULE wr;
(* Author - Stuart F Lewis 1997 *)
IMPORT FIO;
FROM StrIO IMPORT WriteString, WriteLn, ReadString;
FROM StrLib IMPORT StrEqual;
FROM NumberIO IMPORT WriteInt,WriteCard;
PROCEDURE Overall;
VAR
in,out : CARDINAL;
fnum1 : FIO.File;
BEGIN
fnum1 := FIO.OpenToWrite('results.dat');
FOR out :=1 TO 9 DO
FIO.WriteCardinal(fnum1,out);
WriteCard(FIO.IOStatus(fnum1),2);
(* FIO.ReportError(fnum1); *)
FIO.WriteLine(fnum1);
END ; (* outer for *)
FIO.Close(fnum1)
END Overall;
BEGIN (*main program*)
Overall
END wr.
m2f-3.8/comp/autotest/run/pass/testpound.mod 100644 144 144 177 6434624264 17661 0 ustar gaius users MODULE testpound ;
FROM StrIO IMPORT WriteString, WriteLn ;
BEGIN
WriteString('pound sign is £') ; WriteLn
END testpound.
m2f-3.8/comp/autotest/run/pass/prog31ex.mod 100644 144 144 772 6432331043 17271 0 ustar gaius users MODULE prog31ex;
FROM StrIO IMPORT WriteLn,WriteString;
FROM FpuIO IMPORT ReadReal, WriteReal;
VAR
fahrenheit : REAL;
celsius : REAL;
BEGIN
celsius := -10.0;
fahrenheit := 0.0;
WHILE celsius <= 100.0 DO
WriteReal(celsius,6,2);
fahrenheit := ((celsius * 9.0) / 5.0) + 32.0;
WriteString(" degrees Celsius goes to ") ;
WriteReal(fahrenheit,6,2);
WriteString(" degrees Fahrenheit");
WriteLn;
celsius := celsius + 5.0;
END
END prog31ex.
m2f-3.8/comp/autotest/run/pass/stripped.mod 100644 144 144 166 6522334153 17455 0 ustar gaius users MODULE stripped ;
FROM StrIO IMPORT WriteLn,WriteString;
FROM FpuIO IMPORT ReadReal, WriteReal;
BEGIN
END stripped .
m2f-3.8/comp/autotest/run/pass/nothing.mod 100644 144 144 202 6522332140 17252 0 ustar gaius users MODULE nothing ;
IMPORT ASCII ;
IMPORT StdIO ;
IMPORT StrIO ;
IMPORT SYSTEM ;
IMPORT NumberIO ;
IMPORT FIO ;
BEGIN
END nothing.
m2f-3.8/comp/autotest/run/pass/cycles.mod 100644 144 144 1040 6605130054 17111 0 ustar gaius users MODULE cycles ;
FROM FpuIO IMPORT StrToLongReal, WriteLongReal ;
FROM StrIO IMPORT WriteString, WriteLn ;
FROM libc IMPORT exit ;
CONST
DefaultClockFreq = 133.0 * 1000000.0 ;
MaxString = 100 ;
VAR
ClockFreq,
Period : LONGREAL ;
BEGIN
StrToLongReal('350', ClockFreq) ;
Period := 1.0/(ClockFreq * 1000000.0) ;
IF Period>1.0
THEN
WriteString('floating point code generator failed') ; WriteLn ;
exit(1)
ELSE
WriteString('si
| Results 1 - 1 |