diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000000..1ab63c1159 --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,113 @@ +# .github/workflows/build-and-test.yml -- GitHub CI build and test configuration for the MPS +# +# Copyright (c) 2019-2022 `GitHub contributors`_ (MIT License). +# Copyright (c) 2023 Ravenbrook Limited. See end of file for license. +# +# See design.mps.test.ci. +# +# TODO: Exclude certain branches. +# +# TODO: Regular builds of version branches. See +# . + +name: build and test + +on: + - push + - pull_request + # Also run when triggered manually, e.g. by tool/github-ci-kick + # + - workflow_dispatch + +jobs: + + posix: + + # The build matrix for GitHub CI on Posix platforms + # + # See design.mps.tests.ci.github.platforms. + # + # FreeBSD and ARM64 targets are in Travis CI, configured by + # .travis.yml. + # + # See . + + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + compiler: [clang, gcc] + exclude: + - os: macos-latest + compiler: gcc + + runs-on: ${{ matrix.os }} + + # See design.mps.tests.ci.run.posix. + steps: + - uses: actions/checkout@v3 + - run: CC=${{ matrix.compiler }} ./configure + - run: make + - run: make test + + windows: + + runs-on: windows-latest + + # See design.mps.tests.ci.run.windows. + # + # The path to Visual Studio is documented at + # . + + steps: + - uses: actions/checkout@v3 + - run: | + call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 + cd code + nmake /f w3i6mv.nmk all testci testansi testpollnone + shell: cmd + + +# A. REFERENCES +# +# [GitHub CI] "About continuous integration"; . +# +# +# B. DOCUMENT HISTORY +# +# 2023-01-11 RB Adapted from . +# 2023-01-15 RB Added licence and document history. +# +# +# C. COPYRIGHT AND LICENSE +# +# NOTE: This is the `MIT Licence `_ +# inherited from +# and not the usual licence for the MPS. +# +# Copyright (c) 2019-2022 `GitHub contributors`_. +# Copyright (c) 2023 Ravenbrook Limited . +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation files +# (the "Software"), to deal in the Software without restriction, +# including without limitation the rights to use, copy, modify, merge, +# publish, distribute, sublicense, and/or sell copies of the Software, +# and to permit persons to whom the Software is furnished to do so, +# subject to the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# +# .. _GitHub contributors: https://github.com/actions/starter-workflows/commits/1d9d6d7fb0a8a27ef98efbbfa9689cd14c906383/ci/c-cpp.yml +# +# +# $Id$ diff --git a/.gitignore b/.gitignore deleted file mode 120000 index c5c99a6a89..0000000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.p4ignore \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..89c70e46dc --- /dev/null +++ b/.gitignore @@ -0,0 +1,32 @@ +# .p4ignore -- Perforce files to ignore from MPS Project +# $Id$ +# Don't forget to consider files in more specific directories. +# Personal Perforce configurations +.p4config +# Mac OS X Finder turds +.DS_Store +# Patch results +*.orig +*.rej +# Autoconf and Automake output +Makefile +autom4te.cache +config.log +config.status +.deps +.dirstamp +bin +lib +# Misc +TAGS +*.dSYM +*.pyc +test/obj +test/test/log +test/test/obj +....gcda +....gcno +\#*# +*~ +.#.* +core diff --git a/.p4ignore b/.p4ignore deleted file mode 100644 index 89c70e46dc..0000000000 --- a/.p4ignore +++ /dev/null @@ -1,32 +0,0 @@ -# .p4ignore -- Perforce files to ignore from MPS Project -# $Id$ -# Don't forget to consider files in more specific directories. -# Personal Perforce configurations -.p4config -# Mac OS X Finder turds -.DS_Store -# Patch results -*.orig -*.rej -# Autoconf and Automake output -Makefile -autom4te.cache -config.log -config.status -.deps -.dirstamp -bin -lib -# Misc -TAGS -*.dSYM -*.pyc -test/obj -test/test/log -test/test/obj -....gcda -....gcno -\#*# -*~ -.#.* -core diff --git a/.p4ignore b/.p4ignore new file mode 120000 index 0000000000..3e4e48b0b5 --- /dev/null +++ b/.p4ignore @@ -0,0 +1 @@ +.gitignore \ No newline at end of file diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000000..0a269c4fb0 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,69 @@ +# .readthedocs.yaml -- Build configuration for MPS manual on Read The Docs +# +# Copyright (c) 2023 Ravenbrook Limited. See end of file for license. +# +# This file controls how Read the Docs builds and publishes the MPS +# manual at . +# +# See for +# the file format. +# +# Project configuration is at +# . The GitHub +# Ravenbot user is an administrator +# . + +version: 2 + +build: + os: ubuntu-22.04 + tools: + python: '3' + +python: + install: + - requirements: manual/requirements.pip + +sphinx: + configuration: manual/source/conf.py + +# A. REFERENCES +# +# [Readthedocs] "Read the Docs: Documentation Simplified"; +# . +# +# +# B. DOCUMENT HISTORY +# +# 2023-02-02 RB Created as part of MPS GitHub migration. +# +# +# C. COPYRIGHT AND LICENSE +# +# Copyright © 2023 Ravenbrook Limited . +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# +# $Id$ diff --git a/.travis.yml b/.travis.yml index 2b0f36f531..6c083e8a25 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,24 +1,53 @@ # .travis.yml -- Travis CI configuration for the MPS -# $Id$ -# See . -language: c +# +# Copyright (c) 2013-2023 Ravenbrook Limited. See end of file for license. +# +# See design.mps.test.ci. + +# Some branches don't need builds. Add them here to avoid using build +# resources and unnecessary build messages. See +# . +if: NOT branch IN (branch/2023-01-11/github-ci) + +language: c # see . + +# The build matrix for Travis CI +# +# See design.mps.tests.ci.travis.platforms. +# +# Most x86_64/amd64 builds are in GitHub CI, configured by +# .github/workflows/build-and-test.yml. + os: - freebsd - linux - - osx - # See "include" section for Windows arch: - - amd64 - arm64 compiler: - clang - gcc + +script: # see design.mps.test.ci.run.posix +- ./configure --prefix=$PWD/prefix && make install && make test + matrix: + + # Extra build jobs to add to the matrix include: - - os: windows + + # GitHub CI does not provide FreeBSD + # + # on any architecture, so we add it here for amd64. See also + # design.mps.tests.ci.travis.platforms. + + - os: freebsd + arch: amd64 + compiler: clang + - os: freebsd arch: amd64 - compiler: clang # This is a lie since we invoke MV (Microsoft C) - script: MSYS2_ARG_CONV_EXCL='*' cmd /c 'code\w3i6mv.bat' + compiler: gcc + + # Specific combinations to exclude from the matrix exclude: - os: osx compiler: gcc @@ -35,5 +64,44 @@ notifications: #before_install: # - if test "$TRAVIS_OS_NAME" = "linux"; then sudo apt-get -qq update; fi # - if test "$TRAVIS_OS_NAME" = "linux"; then sudo apt-get install -y gcc-4.7; fi -script: -- ./configure --prefix=$PWD/prefix && make install && make test + + +# A. REFERENCES +# +# +# B. DOCUMENT HISTORY +# +# 2013-05-19 RB Created. +# 2023-01-15 RB Added licence and (note) document history. +# +# +# C. COPYRIGHT AND LICENSE +# +# Copyright (C) 2013-2023 Ravenbrook Limited . +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the +# distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# +# $Id$ diff --git a/code/.gitignore b/code/.gitignore deleted file mode 120000 index c5c99a6a89..0000000000 --- a/code/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.p4ignore \ No newline at end of file diff --git a/code/.gitignore b/code/.gitignore new file mode 100644 index 0000000000..ff483930b8 --- /dev/null +++ b/code/.gitignore @@ -0,0 +1,63 @@ +# code/.p4ignore -- Perforce files to ignore list +# $Id$ +# Make output +anangc +ananll +ananmv +fri3gc +fri3ll +fri6gc +fri6ll +lia6gc +lia6ll +lii3gc +lii6gc +lii6ll +w3i3mv +w3i6mv +xca6ll +xci3gc +xci3ll +xci6gc +xci6ll +# Visual Studio junk +Debug +Release +*.filters +*.user +*.suo +# Telemetry event logs +mpsio*.log +mpsio*.sql +mpsio*.txt +# Build products +*.o +*.obj +*.a +*.so +*.lib +*.exe +a.out +core +# Xcode junk +xc +mps.xcodeproj/xcuserdata +mps.xcodeproj/project.xcworkspace +tags +# Temporary files +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +# Mac OS X Finder turds +.DS_Store +# Emacs backups +*~ +# GNU make dependencies +*/*/*.d diff --git a/code/.p4ignore b/code/.p4ignore deleted file mode 100644 index 70e6900935..0000000000 --- a/code/.p4ignore +++ /dev/null @@ -1,60 +0,0 @@ -# code/.p4ignore -- Perforce files to ignore list -# $Id$ -# Make output -anangc -ananll -ananmv -fri3gc -fri3ll -fri6gc -fri6ll -lii3gc -lii6gc -lii6ll -w3i3mv -w3i6mv -xci3gc -xci3ll -xci6gc -xci6ll -# Visual Studio junk -Debug -Release -*.filters -*.user -*.suo -# Telemetry event logs -mpsio*.log -mpsio*.sql -mpsio*.txt -# Build products -*.o -*.obj -*.a -*.so -*.lib -*.exe -a.out -core -# Xcode junk -xc -mps.xcodeproj/xcuserdata -mps.xcodeproj/project.xcworkspace -tags -# Temporary files -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -# Mac OS X Finder turds -.DS_Store -# Emacs backups -*~ -# GNU make dependencies -*/*/*.d diff --git a/code/.p4ignore b/code/.p4ignore new file mode 120000 index 0000000000..3e4e48b0b5 --- /dev/null +++ b/code/.p4ignore @@ -0,0 +1 @@ +.gitignore \ No newline at end of file diff --git a/code/arena.c b/code/arena.c index 20cd2457b8..081b260011 100644 --- a/code/arena.c +++ b/code/arena.c @@ -1347,7 +1347,7 @@ void ArenaAccumulateTime(Arena arena, Clock start, Clock end) { AVERT(Arena, arena); AVER(start <= end); - arena->tracedTime += (end - start) / (double) ClocksPerSec(); + arena->tracedTime += (double)(end - start) / (double)ClocksPerSec(); } diff --git a/code/buffer.c b/code/buffer.c index 1fe68becfa..61de9f84e2 100644 --- a/code/buffer.c +++ b/code/buffer.c @@ -292,13 +292,13 @@ void BufferDetach(Buffer buffer, Pool pool) init = BufferGetInit(buffer); limit = BufferLimit(buffer); spare = AddrOffset(init, limit); - buffer->emptySize += spare; + buffer->emptySize += (double)spare; if (buffer->isMutator) { - ArenaGlobals(buffer->arena)->emptyMutatorSize += spare; - ArenaGlobals(buffer->arena)->allocMutatorSize += - AddrOffset(buffer->base, init); + ArenaGlobals(buffer->arena)->emptyMutatorSize += (double)spare; + ArenaGlobals(buffer->arena)->allocMutatorSize + += (double)AddrOffset(buffer->base, init); } else { - ArenaGlobals(buffer->arena)->emptyInternalSize += spare; + ArenaGlobals(buffer->arena)->emptyInternalSize += (double)spare; } /* Reset the buffer. */ @@ -537,15 +537,15 @@ void BufferAttach(Buffer buffer, Addr base, Addr limit, buffer->poolLimit = limit; filled = AddrOffset(init, limit); - buffer->fillSize += filled; + buffer->fillSize += (double)filled; if (buffer->isMutator) { if (base != init) { /* see */ Size prealloc = AddrOffset(base, init); - ArenaGlobals(buffer->arena)->allocMutatorSize -= prealloc; + ArenaGlobals(buffer->arena)->allocMutatorSize -= (double)prealloc; } - ArenaGlobals(buffer->arena)->fillMutatorSize += filled; + ArenaGlobals(buffer->arena)->fillMutatorSize += (double)filled; } else { - ArenaGlobals(buffer->arena)->fillInternalSize += filled; + ArenaGlobals(buffer->arena)->fillInternalSize += (double)filled; } /* run any class-specific attachment method */ diff --git a/code/global.c b/code/global.c index 3417d0c75e..2500c9ff96 100644 --- a/code/global.c +++ b/code/global.c @@ -783,9 +783,9 @@ Bool ArenaStep(Globals globals, double interval, double multiplier) clocks_per_sec = ClocksPerSec(); start = now = ClockNow(); - intervalEnd = start + (Clock)(interval * clocks_per_sec); + intervalEnd = start + (Clock)(interval * (double)clocks_per_sec); AVER(intervalEnd >= start); - availableEnd = start + (Clock)(interval * multiplier * clocks_per_sec); + availableEnd = start + (Clock)(interval * multiplier * (double)clocks_per_sec); AVER(availableEnd >= start); /* loop while there is work to do and time on the clock. */ diff --git a/code/ll.gmk b/code/ll.gmk index db30cde45f..3835c9d99a 100644 --- a/code/ll.gmk +++ b/code/ll.gmk @@ -3,7 +3,7 @@ # ll.gmk: GNUMAKEFILE FRAGMENT FOR CLANG/LLVM # # $Id$ -# Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. +# Copyright (c) 2001-2019 Ravenbrook Limited. See end of file for license. # # This file is included by platform makefiles that use the Clang/LLVM # compiler. It defines the compiler-specific variables that the @@ -24,7 +24,6 @@ CFLAGSCOMPILER := \ -Wmissing-prototypes \ -Wmissing-variable-declarations \ -Wnested-externs \ - -Wno-extended-offsetof \ -Wpointer-arith \ -Wshadow \ -Wstrict-aliasing=2 \ @@ -53,7 +52,7 @@ endef # C. COPYRIGHT AND LICENSE # -# Copyright (C) 2001-2014 Ravenbrook Limited . +# Copyright (C) 2001-2019 Ravenbrook Limited . # All rights reserved. This is an open source license. Contact # Ravenbrook for commercial licensing options. # diff --git a/code/locus.c b/code/locus.c index b683aa0f3e..f86470a8a5 100644 --- a/code/locus.c +++ b/code/locus.c @@ -225,7 +225,7 @@ void GenDescEndTrace(GenDesc gen, Trace trace) AVER(survived <= genTrace->condemned); if (genTrace->condemned > 0) { - double mortality = 1.0 - survived / (double)genTrace->condemned; + double mortality = 1.0 - (double)survived / (double)genTrace->condemned; double alpha = LocusMortalityALPHA; gen->mortality = gen->mortality * (1 - alpha) + mortality * alpha; EVENT6(TraceEndGen, trace, gen, genTrace->condemned, genTrace->forwarded, diff --git a/code/meter.c b/code/meter.c index c2c8bccbe8..1f33b7a431 100644 --- a/code/meter.c +++ b/code/meter.c @@ -51,10 +51,10 @@ void MeterAccumulate(Meter meter, Size amount) .stddev: stddev = sqrt(meanSquared - mean^2). */ meter->count = count; - meter->total = total + amount; + meter->total = total + (double)amount; meter->meanSquared = meanSquared / dcount * (dcount - 1.0) - + amount / dcount * amount; + + (double)amount / dcount * (double)amount; if (amount > meter->max) meter->max = amount; if (amount < meter->min) diff --git a/code/mps.xcodeproj/project.pbxproj b/code/mps.xcodeproj/project.pbxproj index a2611176ff..67b551307b 100644 --- a/code/mps.xcodeproj/project.pbxproj +++ b/code/mps.xcodeproj/project.pbxproj @@ -1559,49 +1559,6 @@ 3104B02F156D39F2000A585A /* amssshe.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = amssshe.c; sourceTree = ""; }; 3104B03D156D3AD7000A585A /* segsmss */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = segsmss; sourceTree = BUILT_PRODUCTS_DIR; }; 3107DC4E173B03D100F705C8 /* arg.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = arg.h; sourceTree = ""; }; - 310EA5E21C889F4C004FE6B7 /* abq.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = abq.txt; path = ../design/abq.txt; sourceTree = ""; }; - 310EA5E41C889F4C004FE6B7 /* an.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = an.txt; path = ../design/an.txt; sourceTree = ""; }; - 310EA5E51C889F4C004FE6B7 /* arena.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = arena.txt; path = ../design/arena.txt; sourceTree = ""; }; - 310EA5E71C889F4C004FE6B7 /* bootstrap.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = bootstrap.txt; path = ../design/bootstrap.txt; sourceTree = ""; }; - 310EA5E81C889F4C004FE6B7 /* bt.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = bt.txt; path = ../design/bt.txt; sourceTree = ""; }; - 310EA5EA1C889F4C004FE6B7 /* cbs.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = cbs.txt; path = ../design/cbs.txt; sourceTree = ""; }; - 310EA5EC1C889F4C004FE6B7 /* class-interface.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = "class-interface.txt"; path = "../design/class-interface.txt"; sourceTree = ""; }; - 310EA5EE1C889F4C004FE6B7 /* config.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = config.txt; path = ../design/config.txt; sourceTree = ""; }; - 310EA5F01C889F4C004FE6B7 /* diag.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = diag.txt; path = ../design/diag.txt; sourceTree = ""; }; - 310EA5F11C889F4C004FE6B7 /* exec-env.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = "exec-env.txt"; path = "../design/exec-env.txt"; sourceTree = ""; }; - 310EA5F31C889F4C004FE6B7 /* finalize.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = finalize.txt; path = ../design/finalize.txt; sourceTree = ""; }; - 310EA5F51C889F4C004FE6B7 /* freelist.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = freelist.txt; path = ../design/freelist.txt; sourceTree = ""; }; - 310EA5F71C889F4C004FE6B7 /* guide.impl.c.format.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = guide.impl.c.format.txt; path = ../design/guide.impl.c.format.txt; sourceTree = ""; }; - 310EA5F81C889F4C004FE6B7 /* guide.impl.c.naming.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = guide.impl.c.naming.txt; path = ../design/guide.impl.c.naming.txt; sourceTree = ""; }; - 310EA5F91C889F4C004FE6B7 /* guide.review.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = guide.review.txt; path = ../design/guide.review.txt; sourceTree = ""; }; - 310EA5FB1C889F4C004FE6B7 /* interface-c.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = "interface-c.txt"; path = "../design/interface-c.txt"; sourceTree = ""; }; - 310EA5FD1C889F4C004FE6B7 /* keyword-arguments.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = "keyword-arguments.txt"; path = "../design/keyword-arguments.txt"; sourceTree = ""; }; - 310EA5FF1C889F4C004FE6B7 /* lib.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = lib.txt; path = ../design/lib.txt; sourceTree = ""; }; - 310EA6011C889F4C004FE6B7 /* locus.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = locus.txt; path = ../design/locus.txt; sourceTree = ""; }; - 310EA6031C889F4C004FE6B7 /* message.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = message.txt; path = ../design/message.txt; sourceTree = ""; }; - 310EA6071C889F4C004FE6B7 /* nailboard.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = nailboard.txt; path = ../design/nailboard.txt; sourceTree = ""; }; - 310EA6091C889F4C004FE6B7 /* pool.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = pool.txt; path = ../design/pool.txt; sourceTree = ""; }; - 310EA60B1C889F4C004FE6B7 /* poolams.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = poolams.txt; path = ../design/poolams.txt; sourceTree = ""; }; - 310EA60D1C889F4C004FE6B7 /* poollo.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = poollo.txt; path = ../design/poollo.txt; sourceTree = ""; }; - 310EA60F1C889F4C004FE6B7 /* poolmrg.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = poolmrg.txt; path = ../design/poolmrg.txt; sourceTree = ""; }; - 310EA6111C889F4C004FE6B7 /* poolmvff.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = poolmvff.txt; path = ../design/poolmvff.txt; sourceTree = ""; }; - 310EA6131C889F4C004FE6B7 /* prmc.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = prmc.txt; path = ../design/prmc.txt; sourceTree = ""; }; - 310EA6141C889F4C004FE6B7 /* prot.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = prot.txt; path = ../design/prot.txt; sourceTree = ""; }; - 310EA6161C889F4C004FE6B7 /* protocol.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = protocol.txt; path = ../design/protocol.txt; sourceTree = ""; }; - 310EA6181C889F4C004FE6B7 /* pthreadext.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = pthreadext.txt; path = ../design/pthreadext.txt; sourceTree = ""; }; - 310EA61A1C889F4C004FE6B7 /* reservoir.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = reservoir.txt; path = ../design/reservoir.txt; sourceTree = ""; }; - 310EA61C1C889F4C004FE6B7 /* root.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = root.txt; path = ../design/root.txt; sourceTree = ""; }; - 310EA61E1C889F4C004FE6B7 /* seg.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = seg.txt; path = ../design/seg.txt; sourceTree = ""; }; - 310EA6201C889F4C004FE6B7 /* sig.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = sig.txt; path = ../design/sig.txt; sourceTree = ""; }; - 310EA6211C889F4C004FE6B7 /* sp.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = sp.txt; path = ../design/sp.txt; sourceTree = ""; }; - 310EA6231C889F4C004FE6B7 /* stack-scan.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = "stack-scan.txt"; path = "../design/stack-scan.txt"; sourceTree = ""; }; - 310EA6261C889F4C004FE6B7 /* telemetry.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = telemetry.txt; path = ../design/telemetry.txt; sourceTree = ""; }; - 310EA6281C889F4C004FE6B7 /* testthr.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = testthr.txt; path = ../design/testthr.txt; sourceTree = ""; }; - 310EA6291C889F4C004FE6B7 /* thread-manager.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = "thread-manager.txt"; path = "../design/thread-manager.txt"; sourceTree = ""; }; - 310EA62B1C889F4C004FE6B7 /* trace.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = trace.txt; path = ../design/trace.txt; sourceTree = ""; }; - 310EA62D1C889F4C004FE6B7 /* version-library.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = "version-library.txt"; path = "../design/version-library.txt"; sourceTree = ""; }; - 310EA62F1C889F4C004FE6B7 /* vm.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = vm.txt; path = ../design/vm.txt; sourceTree = ""; }; - 310EA6311C889F4C004FE6B7 /* vmso.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = vmso.txt; path = ../design/vmso.txt; sourceTree = ""; }; 310F5D7118B6675F007EFCBC /* tree.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = tree.c; sourceTree = ""; }; 310F5D7218B6675F007EFCBC /* tree.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = tree.h; sourceTree = ""; }; 31108A391C6B90D600E728EA /* tagtest.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = tagtest.c; sourceTree = ""; }; @@ -1770,7 +1727,7 @@ 31942A8F1C8EC446001AAF32 /* nailboard.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = nailboard.txt; path = ../design/nailboard.txt; sourceTree = ""; }; 31942A9B1C8EC446001AAF32 /* prmc.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = prmc.txt; path = ../design/prmc.txt; sourceTree = ""; }; 31942AA91C8EC446001AAF32 /* sp.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = sp.txt; path = ../design/sp.txt; sourceTree = ""; }; - 31942AAB1C8EC446001AAF32 /* stack-scan.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = stack-scan.txt; path = ../design/stack-scan.txt; sourceTree = ""; }; + 31942AAB1C8EC446001AAF32 /* stack-scan.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = "stack-scan.txt"; path = "../design/stack-scan.txt"; sourceTree = ""; }; 31942AB01C8EC446001AAF32 /* testthr.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = testthr.txt; path = ../design/testthr.txt; sourceTree = ""; }; 31A47BA3156C1E130039B1C2 /* mps.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mps.c; sourceTree = ""; }; 31C83ADD1786281C0031A0DB /* protxc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = protxc.h; sourceTree = ""; }; @@ -2351,7 +2308,6 @@ 31942AA91C8EC446001AAF32 /* sp.txt */, 31160DC61899540D0071EB17 /* splay.txt */, 31942AAB1C8EC446001AAF32 /* stack-scan.txt */, - 31160DC71899540D0071EB17 /* sso1al.txt */, 31160DC81899540D0071EB17 /* strategy.txt */, 31160DC91899540D0071EB17 /* telemetry.txt */, 31160DCA1899540D0071EB17 /* tests.txt */, @@ -2667,7 +2623,6 @@ 31CD33BD173A9F1500524741 /* poolams.h */, 3124CACE156BE4CF00753214 /* poolawl.c */, 3124CACA156BE4A300753214 /* poollo.c */, - 31EEAC2F156AB2F200714D05 /* poolmv.c */, 31D4D5FD1745058100BE84B5 /* poolmv2.c */, 2291A5A8175CAA51001D4920 /* poolmv2.h */, 31EEAC5D156AB43F00714D05 /* poolsnc.c */, @@ -3605,7 +3560,7 @@ 31EEABDA156AAE9E00714D05 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0510; + LastUpgradeCheck = 1000; }; buildConfigurationList = 31EEABDD156AAE9E00714D05 /* Build configuration list for PBXProject "mps" */; compatibilityVersion = "Xcode 3.2"; @@ -5509,13 +5464,24 @@ 318DA8D41892C0D00089718C /* RASH */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = c89; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = s; GCC_PREPROCESSOR_DEFINITIONS = CONFIG_VAR_RASH; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; @@ -5553,7 +5519,6 @@ "-Wmissing-prototypes", "-Wmissing-variable-declarations", "-Wnested-externs", - "-Wno-extended-offsetof", "-Wpointer-arith", "-Wshadow", "-Wstrict-aliasing=2", @@ -5574,7 +5539,6 @@ 318DA8D61892C0D00089718C /* RASH */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; EXECUTABLE_PREFIX = lib; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -5948,13 +5912,25 @@ 31EEABDF156AAE9E00714D05 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = c89; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = CONFIG_VAR_COOL; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; @@ -5977,8 +5953,7 @@ GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_PARAMETER = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.4; - ONLY_ACTIVE_ARCH = YES; + MACOSX_DEPLOYMENT_TARGET = 10.6; SDKROOT = macosx; SYMROOT = xc; WARNING_CFLAGS = ( @@ -5993,7 +5968,6 @@ "-Wmissing-prototypes", "-Wmissing-variable-declarations", "-Wnested-externs", - "-Wno-extended-offsetof", "-Wpointer-arith", "-Wshadow", "-Wstrict-aliasing=2", @@ -6007,13 +5981,24 @@ 31EEABE0156AAE9E00714D05 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = c89; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = s; GCC_PREPROCESSOR_DEFINITIONS = CONFIG_VAR_HOT; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; @@ -6051,7 +6036,6 @@ "-Wmissing-prototypes", "-Wmissing-variable-declarations", "-Wnested-externs", - "-Wno-extended-offsetof", "-Wpointer-arith", "-Wshadow", "-Wstrict-aliasing=2", @@ -6065,7 +6049,6 @@ 31EEABFD156AAF9D00714D05 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; EXECUTABLE_PREFIX = lib; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -6074,7 +6057,6 @@ 31EEABFE156AAF9D00714D05 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; EXECUTABLE_PREFIX = lib; PRODUCT_NAME = "$(TARGET_NAME)"; }; diff --git a/code/policy.c b/code/policy.c index e44f67ad9f..f26000b0a6 100644 --- a/code/policy.c +++ b/code/policy.c @@ -148,7 +148,7 @@ static double policyCollectionTime(Arena arena) collectionRate = arena->tracedWork / arena->tracedTime; else collectionRate = ARENA_DEFAULT_COLLECTION_RATE; - collectionTime = collectableSize / collectionRate; + collectionTime = (double)collectableSize / collectionRate; collectionTime += ARENA_DEFAULT_COLLECTION_OVERHEAD; return collectionTime; @@ -189,8 +189,8 @@ Bool PolicyShouldCollectWorld(Arena arena, double availableTime, collectionTime = policyCollectionTime(arena); /* How long since we last collected the world? */ - sinceLastWorldCollect = ((now - arena->lastWorldCollect) / - (double) clocks_per_sec); + sinceLastWorldCollect = (double)(now - arena->lastWorldCollect) / + (double)clocks_per_sec; /* Offered enough time, and long enough since we last did it? */ return availableTime > collectionTime @@ -283,11 +283,13 @@ Bool PolicyStartTrace(Trace *traceReturn, Bool *collectWorldReturn, sFoundation = (Size)0; /* condemning everything, only roots @@@@ */ /* @@@@ sCondemned should be scannable only */ sCondemned = ArenaCommitted(arena) - ArenaSpareCommitted(arena); - sSurvivors = (Size)(sCondemned * (1 - TraceWorldMortality)); - tTracePerScan = sFoundation + (sSurvivors * (1 + TraceCopyScanRATIO)); + sSurvivors = (Size)((double)sCondemned * (1 - TraceWorldMortality)); + tTracePerScan = (double)sFoundation + + ((double)sSurvivors * (1 + TraceCopyScanRATIO)); AVER(TraceWorkFactor >= 0); - AVER(sSurvivors + tTracePerScan * TraceWorkFactor <= (double)SizeMAX); - sConsTrace = (Size)(sSurvivors + tTracePerScan * TraceWorkFactor); + AVER((double)sSurvivors + tTracePerScan * TraceWorkFactor + <= (double)SizeMAX); + sConsTrace = (Size)((double)sSurvivors + tTracePerScan * TraceWorkFactor); dynamicDeferral = (double)ArenaAvail(arena) - (double)sConsTrace; if (dynamicDeferral < 0.0) { @@ -328,7 +330,8 @@ Bool PolicyStartTrace(Trace *traceReturn, Bool *collectWorldReturn, goto failCondemn; if (TraceIsEmpty(trace)) goto nothingCondemned; - res = TraceStart(trace, mortality, trace->condemned * TraceWorkFactor); + res = TraceStart(trace, mortality, + (double)trace->condemned * TraceWorkFactor); /* We don't expect normal GC traces to fail to start. */ AVER(res == ResOK); *traceReturn = trace; @@ -382,7 +385,8 @@ Bool PolicyPollAgain(Arena arena, Clock start, Bool moreWork, Work tracedWork) return TRUE; /* Is there more work to do and more time to do it in? */ - moreTime = (ClockNow() - start) < ArenaPauseTime(arena) * ClocksPerSec(); + moreTime = (double)(ClockNow() - start) + < ArenaPauseTime(arena) * (double)ClocksPerSec(); if (moreWork && moreTime) return TRUE; diff --git a/code/pool.c b/code/pool.c index eae3346ad6..3aa2b0e60d 100644 --- a/code/pool.c +++ b/code/pool.c @@ -231,7 +231,7 @@ Res PoolAlloc(Addr *pReturn, Pool pool, Size size) /* All PoolAllocs should advance the allocation clock, so we count */ /* it all in the fillMutatorSize field. */ - ArenaGlobals(PoolArena(pool))->fillMutatorSize += size; + ArenaGlobals(PoolArena(pool))->fillMutatorSize += (double)size; EVENT3(PoolAlloc, pool, *pReturn, size); diff --git a/code/poolams.c b/code/poolams.c index 9700e285a0..4d01642914 100644 --- a/code/poolams.c +++ b/code/poolams.c @@ -747,7 +747,7 @@ static void AMSSegsDestroy(AMS ams) /* AMSVarargs -- decode obsolete varargs */ -static void AMSVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs) +static void AMSVarargs(ArgStruct args[MPS_ARGS_MAX - 1], va_list varargs) { args[0].key = MPS_KEY_FORMAT; args[0].val.format = va_arg(varargs, Format); @@ -756,6 +756,7 @@ static void AMSVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs) args[2].key = MPS_KEY_AMS_SUPPORT_AMBIGUOUS; args[2].val.b = va_arg(varargs, Bool); args[3].key = MPS_KEY_ARGS_END; + AVER(MPS_ARGS_MAX - 1 > 3); AVERT(ArgList, args); } diff --git a/code/poolmvff.c b/code/poolmvff.c index b31c0f5d92..b13102b09f 100644 --- a/code/poolmvff.c +++ b/code/poolmvff.c @@ -84,7 +84,7 @@ static void MVFFReduce(MVFF mvff) threshold fraction of the total memory. */ totalLand = MVFFTotalLand(mvff); - freeLimit = (Size)(LandSize(totalLand) * mvff->spare); + freeLimit = (Size)((double)LandSize(totalLand) * mvff->spare); freeLand = MVFFFreeLand(mvff); freeSize = LandSize(freeLand); if (freeSize < freeLimit) @@ -365,7 +365,7 @@ static Res MVFFBufferFill(Addr *baseReturn, Addr *limitReturn, /* MVFFVarargs -- decode obsolete varargs */ -static void MVFFVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs) +static void MVFFVarargs(ArgStruct args[MPS_ARGS_MAX - 1], va_list varargs) { args[0].key = MPS_KEY_EXTEND_BY; args[0].val.size = va_arg(varargs, Size); @@ -380,6 +380,7 @@ static void MVFFVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs) args[5].key = MPS_KEY_MVFF_FIRST_FIT; args[5].val.b = va_arg(varargs, Bool); args[6].key = MPS_KEY_ARGS_END; + AVER(MPS_ARGS_MAX - 1 > 6); AVERT(ArgList, args); } @@ -784,7 +785,7 @@ static Res mvInit(Pool pool, Arena arena, PoolClass klass, ArgList args) return NextMethod(Pool, MVPool, init)(pool, arena, klass, args); } -static void mvVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs) +static void mvVarargs(ArgStruct args[MPS_ARGS_MAX - 1], va_list varargs) { args[0].key = MPS_KEY_EXTEND_BY; args[0].val.size = va_arg(varargs, Size); @@ -793,6 +794,7 @@ static void mvVarargs(ArgStruct args[MPS_ARGS_MAX], va_list varargs) args[2].key = MPS_KEY_MAX_SIZE; args[2].val.size = va_arg(varargs, Size); args[3].key = MPS_KEY_ARGS_END; + AVER(MPS_ARGS_MAX - 1 > 3); AVERT(ArgList, args); } diff --git a/code/steptest.c b/code/steptest.c index f857a85d7f..ac09727d99 100644 --- a/code/steptest.c +++ b/code/steptest.c @@ -120,10 +120,8 @@ static double my_clock(void) struct rusage ru; getrusage(RUSAGE_SELF, &ru); ++ clock_reads; - return ((ru.ru_utime.tv_sec + - ru.ru_stime.tv_sec) * 1000000.0 + - (ru.ru_utime.tv_usec + - ru.ru_stime.tv_usec)); + return (double)(ru.ru_utime.tv_sec + ru.ru_stime.tv_sec) * 1000000.0 + + (double)(ru.ru_utime.tv_usec + ru.ru_stime.tv_usec); } #endif @@ -143,7 +141,7 @@ static double clock_time; /* current estimate of time to read the clock */ static void set_clock_timing(void) { - long i; + double i; double t1, t2, t3; t2 = 0.0; @@ -402,9 +400,9 @@ static void test(mps_arena_t arena, unsigned long step_period) printf(" %"PRIuLONGEST" bytes survived.\n", (ulongest_t)live); if (condemned) { printf(" Mortality %5.2f%%.\n", - (1.0 - ((double)live)/condemned) * 100.0); + (1.0 - (double)live/(double)condemned) * 100.0); printf(" Condemned fraction %5.2f%%.\n", - ((double)condemned/(condemned + not_condemned)) * 100.0); + ((double)condemned/(double)(condemned + not_condemned)) * 100.0); } if (collections) { printf(" Condemned per collection %"PRIuLONGEST" bytes.\n", @@ -420,18 +418,18 @@ static void test(mps_arena_t arena, unsigned long step_period) printf("Timings:\n"); print_time(" Allocation took ", alloc_time, ""); - print_time(", mean ", alloc_time / objs, ""); + print_time(", mean ", alloc_time / (double)objs, ""); print_time(", max ", max_alloc_time, ".\n"); if (steps) { printf(" %ld steps took ", steps); print_time("", step_time, ""); - print_time(", mean ", step_time/steps, ""); + print_time(", mean ", step_time / (double)steps, ""); print_time(", max ", max_step_time, ".\n"); } if (no_steps) { printf(" %ld non-steps took ", no_steps); print_time("", no_step_time, ""); - print_time(", mean ", no_step_time / no_steps, ""); + print_time(", mean ", no_step_time / (double)no_steps, ""); print_time(", max ", max_no_step_time, ".\n"); } if (alloc_time > 0.0) @@ -441,20 +439,20 @@ static void test(mps_arena_t arena, unsigned long step_period) printf(" Reclaimed %.2f bytes per us of step.\n", (double)(condemned - live)/step_time); if (collections > 0) { - printf(" Took %.2f steps ", (double)steps/collections); - print_time("(", step_time / collections, ") per collection.\n"); + printf(" Took %.2f steps ", (double)steps / (double)collections); + print_time("(", step_time / (double)collections, ") per collection.\n"); } } print_time(" Total time ", total_time, ".\n"); print_time(" Total MPS time ", total_mps_time, ""); printf(" (%5.2f%%, ", total_mps_time * 100.0 / total_time); - print_time("", total_mps_time/alloc_bytes, " per byte, "); - print_time("", total_mps_time/objs, " per object)\n"); + print_time("", total_mps_time / (double)alloc_bytes, " per byte, "); + print_time("", total_mps_time / (double)objs, " per object)\n"); print_time(" (adjusted for clock timing: ", total_clock_time, " spent reading the clock;\n"); printf(" %"PRIuLONGEST" clock reads; ", (ulongest_t)clock_reads); - print_time("", total_clock_time / clock_reads, " per read;"); + print_time("", total_clock_time / (double)clock_reads, " per read;"); print_time(" recently measured as ", clock_time, ").\n"); mps_arena_park(arena); diff --git a/code/table.c b/code/table.c index a26ed499d1..3f716ab85f 100644 --- a/code/table.c +++ b/code/table.c @@ -160,7 +160,7 @@ Res TableGrow(Table table, Count extraCapacity) /* Calculate the minimum table length that would allow for the required capacity without growing again. */ - minimum = (Count)(required / SPACEFRACTION); + minimum = (Count)((double)required / SPACEFRACTION); if (minimum < required) /* overflow? */ return ResLIMIT; @@ -295,7 +295,7 @@ Res TableDefine(Table table, TableKey key, TableValue value) AVER(key != table->unusedKey); AVER(key != table->deletedKey); - if (table->count >= table->length * SPACEFRACTION) { + if ((double)table->count >= (double)table->length * SPACEFRACTION) { Res res = TableGrow(table, 1); if (res != ResOK) return res; diff --git a/code/testlib.c b/code/testlib.c index cd8f340ba3..c91449fd8a 100644 --- a/code/testlib.c +++ b/code/testlib.c @@ -217,7 +217,7 @@ mps_addr_t rnd_addr(void) double rnd_double(void) { - return rnd() / R_m_float; + return (double)rnd() / R_m_float; } static unsigned sizelog2(size_t size) diff --git a/code/trace.c b/code/trace.c index da390812bb..5c93ef5c91 100644 --- a/code/trace.c +++ b/code/trace.c @@ -441,14 +441,14 @@ Res TraceCondemnEnd(double *mortalityReturn, Trace trace) } AVER(trace->condemned >= condemnedBefore); condemnedGen = trace->condemned - condemnedBefore; - casualtySize += (Size)(condemnedGen * gen->mortality); + casualtySize += (Size)((double)condemnedGen * gen->mortality); } ShieldRelease(trace->arena); if (TraceIsEmpty(trace)) return ResFAIL; - *mortalityReturn = (double)casualtySize / trace->condemned; + *mortalityReturn = (double)casualtySize / (double)trace->condemned; return ResOK; failBegin: @@ -1606,7 +1606,7 @@ Res TraceStart(Trace trace, double mortality, double finishingTime) /* Calculate the rate of scanning. */ { - Size sSurvivors = (Size)(trace->condemned * (1.0 - mortality)); + Size sSurvivors = (Size)((double)trace->condemned * (1.0 - mortality)); double nPolls = finishingTime / ArenaPollALLOCTIME; /* There must be at least one poll. */ @@ -1686,7 +1686,7 @@ void TraceAdvance(Trace trace) newWork = traceWork(trace); AVER(newWork >= oldWork); - arena->tracedWork += newWork - oldWork; + arena->tracedWork += (double)(newWork - oldWork); } @@ -1727,7 +1727,8 @@ Res TraceStartCollectAll(Trace *traceReturn, Arena arena, int why) res = TraceCondemnEnd(&mortality, trace); if(res != ResOK) /* should try some other trace, really @@@@ */ goto failCondemn; - finishingTime = ArenaAvail(arena) - trace->condemned * (1.0 - mortality); + finishingTime = (double)ArenaAvail(arena) + - (double)trace->condemned * (1.0 - mortality); if(finishingTime < 0) { /* Run out of time, should really try a smaller collection. @@@@ */ finishingTime = 0.0; diff --git a/code/w3mv/.gitignore b/code/w3mv/.gitignore deleted file mode 120000 index c5c99a6a89..0000000000 --- a/code/w3mv/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.p4ignore \ No newline at end of file diff --git a/code/w3mv/.gitignore b/code/w3mv/.gitignore new file mode 100755 index 0000000000..81b5d6c862 --- /dev/null +++ b/code/w3mv/.gitignore @@ -0,0 +1,10 @@ +# code/w3mv/.p4ignore -- Perforce files to ignore from Visual Studio +# $Id$ +# Subproject build results +*/Debug +*/Release +# Temporary user preferences +*.vcxproj.user +# Mystery rubbish +*.sdf +*.opensdf diff --git a/code/w3mv/.p4ignore b/code/w3mv/.p4ignore deleted file mode 100755 index 81b5d6c862..0000000000 --- a/code/w3mv/.p4ignore +++ /dev/null @@ -1,10 +0,0 @@ -# code/w3mv/.p4ignore -- Perforce files to ignore from Visual Studio -# $Id$ -# Subproject build results -*/Debug -*/Release -# Temporary user preferences -*.vcxproj.user -# Mystery rubbish -*.sdf -*.opensdf diff --git a/code/w3mv/.p4ignore b/code/w3mv/.p4ignore new file mode 120000 index 0000000000..3e4e48b0b5 --- /dev/null +++ b/code/w3mv/.p4ignore @@ -0,0 +1 @@ +.gitignore \ No newline at end of file diff --git a/code/zmess.c b/code/zmess.c index afa6c0b128..f98dc15aca 100644 --- a/code/zmess.c +++ b/code/zmess.c @@ -148,7 +148,6 @@ static int state[myrootCOUNT]; */ static void report(mps_arena_t arena, const char *pm, Bool discard) { - int found = 0; char mFound = '\0'; mps_message_type_t type; @@ -160,8 +159,7 @@ static void report(mps_arena_t arena, const char *pm, Bool discard) cdie(mps_message_get(&message, arena, type), "get"); - found += 1; - + switch(type) { case mps_message_type_gc_start(): { printf(" Begin Collection\n"); diff --git a/configure b/configure index 8d938b2d09..d4a70f1328 100755 --- a/configure +++ b/configure @@ -3374,7 +3374,7 @@ CFLAGS_GC="-ansi -pedantic -Wall -Werror -Wpointer-arith \ -Wstrict-prototypes -Wmissing-prototypes \ -Winline -Waggregate-return -Wnested-externs \ -Wcast-qual -Wstrict-aliasing=2 -O -g3 -pthread" -CFLAGS_LL="$CFLAGS_GC -Wno-extended-offsetof" +CFLAGS_LL="$CFLAGS_GC" # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || diff --git a/configure.ac b/configure.ac index 436aad238c..d0d0fd818c 100644 --- a/configure.ac +++ b/configure.ac @@ -36,7 +36,7 @@ CFLAGS_GC="-ansi -pedantic -Wall -Werror -Wpointer-arith \ -Wstrict-prototypes -Wmissing-prototypes \ -Winline -Waggregate-return -Wnested-externs \ -Wcast-qual -Wstrict-aliasing=2 -O -g3 -pthread" -CFLAGS_LL="$CFLAGS_GC -Wno-extended-offsetof" +CFLAGS_LL="$CFLAGS_GC" AC_CANONICAL_HOST AC_MSG_CHECKING([target platform]) diff --git a/design/tests.txt b/design/tests.txt index 4727021786..4ca8bf8ae9 100644 --- a/design/tests.txt +++ b/design/tests.txt @@ -56,6 +56,53 @@ _`.test.zcoll`: Collection scheduling, and collection feedback. _`.test.zmess`: Message lifecycle and finalization messages. +Test database +------------- + +_`.db`: The automated tests are described in the test database +(tool/testcases.txt). + +_`.db.format`: This is a self-documenting plain-text database which +gives for each test case its name and an optional set of features. For +example the feature ``=P`` means that the test case requires polling +to succeed, and therefore is expected to fail in build configurations +without polling (see design.mps.config.opt.poll_). + +_`.db.format.simple`: The format must be very simple because the test +runner on Windows is written as a batch file (.bat), in order to avoid +having to depend on any tools that are did not come as standard with +Windows XP, and batch files are inflexible. (But note that we no +longer support Windows XP, so it would now be possible to rewrite the +test runner in PowerShell if we thought that made sense.) + +_`.db.testrun`: The test runner (tool/testrun.sh on Unix or +tool/testrun.bat on Windows) parses the test database to work out +which tests to run according to the target. For example the +``testpollnone`` target must skip all test cases with the ``P`` +feature. + + +Test runner +----------- + +_`.runner.req.automated`: The test runner must execute without user +interaction, so that it can be used for continuous integration. + +_`.runner.req.output.pass`: Test cases are expected to pass nearly all the +time, and in these cases we almost never want to see the output, so +the test runner must suppress the output for passing tests. + +_`.runner.req.output.fail`: However, if a test case fails then the +test runner must preserve the output from the failing test, including +the random seed (see `.randomize.seed`_), so that this can be analyzed +and the test repeated. Moreover, it must print the output from the +failing test, so that if the test is being run on a `continuous +integration`_ system (see `.ci`_), then the output of the failing +tests is included in the failure report. (See job003489_.) + +.. _job003489: https://www.ravenbrook.com/project/mps/issue/job003489/ + + Performance test ---------------- @@ -141,6 +188,158 @@ _`.new.manual`: Edit manual/source/code-index.rst and add the new test case to the "Automated test cases" section. +Continuous integration +---------------------- + +[This section might need to become a document in its own right. CI +has grown in importance and complexity. RB 2023-01-15] + +_`.ci`: Ravenbrook uses both `GitHub CI`_ and `Travis CI`_ for +continuous integration of the MPS via GitHub. + +.. _Travis CI: https://travis-ci.com/ + +.. _GitHub CI: https://docs.github.com/en/actions/automating-builds-and-tests/about-continuous-integration + +[This section needs: definition of CI goals and requirements, what we +need CI to do and why, how the testci target meets those +requirements. 'taint really a design without this. Mention how CI +supports the pull request merge procedure (except that exists on a +separate branch at the moment). RB 2023-01-15] + +[Need to discuss compilers and toolchains. RB 2023-01-15] + +_`.ci.run.posix`: On Posix systems where we have autoconf, the CI +services run commands equivalent to:: + + ./configure + make install + make test + +which execises the testci target, as defined by `Makefile.in +<../Makefile.in>`_ in the root of the MPS tree. + +_`.ci.run.windows`: On Windows the CI services run commands that do at +least:: + + make /f w3i6mv.nmk all testci + +as defined by the `.ci.github.config`_. + +_`.ci.run.other.targets`: On some platforms we arrange to run the testansi, +testpollnone, testratio, and testscheme targets. [Need to explain +why, where, etc. RB 2023-01-15] + +_`.ci.run.other.checks`: We could also run various non-build checks +using CI to check: + +- document formatting +- shell script syntax + +[In the branch of writing, these do not yet exist. They are the +subject of `GitHub pull request #113 +`_ of +branch/2023-01-13/rst-check. When merged, they can be linked. RB +2023-01-15] + +_`.ci.when:`: CI is triggered on the `mps GitHub repo`_ by: + +- commits (pushes) +- new pull requests +- manually, using tools (see `.ci.tools`_) + +.. _mps GitHub repo: https://github.com/ravenbrook/mps + +_`.ci.results`: CI results are visible via the GitHub web interface: + +- in pull requests, under "Checks", + +- on the `branches page `_ + as green ticks or red crosses that link to details. + +as well as in logs specific to the type of CI. + +_`.ci.results.travis`: Results from Travis CI can be found at the +`Travis CI build history for the MPS GitHub repo +`_. + +_`.ci.results.github`: Results from GitHub CI can be found at `build +and test actions on the Actions tab at the Ravenbrook GitHub repo +`_. + +_`.ci.github`: [Insert overview of GitHub CI here. RB 2023-01-15] + +_`.ci.github.platforms`: GitHub provides runners_ for Linux, Windows, +and macOS, but only on x86_64. See `.ci.travis.platforms`_ for ARM64 +and FreeBSD. + +.. _runners: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources + +_`.ci.github.config`: GitHub CI is configured using the +`build-and-test.yml <../.github/workflows/build-and-test.yml>`_ file +in the .github/workflows directory of the MPS tree. + +_`.ci.travis`: [Insert overview of Travis CI here. RB 2023-01-15] + +_`.ci.travis.platforms`: Where possible, we use `GitHub CI`_ for +platforms, because `Travis CI is slow and expensive`_. However +`GitHub CI`_ does not provide ARM64 or FreeBSD, so we use `Travis CI`_ +for those. + +.. _Travis CI is slow and expensive: https://github.com/Ravenbrook/mps/issues/109 + +_`.ci.travis.config`: Travis is configured using the `.travis.yml +<../.travis.yml>`_ file at top level of the MPS tree. + +_`.ci.tools`: The MPS tree contains some simple tools for managing CI +without the need to install whole packages such as the GitHub CLI or +Travis CI's Ruby gem. + +_`.ci.tools.kick`: `tool/github-ci-kick <../tool/github-ci-kick>`_ and +`tool/travis-ci-kick <../tool/travis-ci-kick>`_ both trigger CI builds +without the need to push a change or make a pull request in the `mps +GitHub repo`_. In particular, they are useful for applying CI to work +that was pushed while CI was disabled, for whatever reason. + + +MMQA tests +---------- + +_`.mmqa`: The Memory Management Quality Assurance test suite is +another suite of test cases. + +_`.mmqa.why`: The existence of two test suites originates in the +departmental structure at Harlequin Ltd where the MPS was originally +developed. Tests written by members of the Memory Management Group +went into the code directory along with the MPS itself, while tests +written by members of the Quality Assurance Group went into the test +directory. (Conway's Law states that "organizations which design +systems … are constrained to produce designs which are copies of the +communication structures of these organizations" [Conway_1968]_.) + +_`.mmqa.run`: See test/README for how to run the MMQA tests. + + +Other tests +----------- + +_`.coverage`: The program tool/testcoverage compiles the MPS with +coverage enabled, runs the smoke tests (`.target.testrun`_) and +outputs a coverage report. + +_`.opendylan`: The program tool/testopendylan pulls Open Dylan from +GitHub and builds it against the MPS. + + +References +---------- + +.. [Conway_1968] + "How do Committees Invent?"; + Melvin E. Conway; *Datamation* 14:5, pp. 28–31; April 1968; + + + Document History ---------------- @@ -156,8 +355,11 @@ Document History - 2018-06-15 GDR_ Procedure for adding a new smoke test. -.. _RB: http://www.ravenbrook.com/consultants/rb/ -.. _GDR: http://www.ravenbrook.com/consultants/gdr/ +- 2023-01-15 RB_ Bringing CI section up to date with Travis + configuration. Removing obsolete Jenkins info. Adding GitHub CI. + +.. _RB: https://www.ravenbrook.com/consultants/rb/ +.. _GDR: https://www.ravenbrook.com/consultants/gdr/ Copyright and License @@ -178,26 +380,16 @@ met: notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -#. Redistributions in any form must be accompanied by information on how - to obtain complete source code for this software and any - accompanying software that uses this software. The source code must - either be included in the distribution or be available for no more than - the cost of distribution plus a nominal fee, and must be freely - redistributable under reasonable conditions. For an executable file, - complete source code means the source code for all modules it contains. - It does not include source code for modules or files that typically - accompany the major components of the operating system on which the - executable file runs. - -**This software is provided by the copyright holders and contributors -"as is" and any express or implied warranties, including, but not -limited to, the implied warranties of merchantability, fitness for a -particular purpose, or non-infringement, are disclaimed. In no event -shall the copyright holders and contributors be liable for any direct, -indirect, incidental, special, exemplary, or consequential damages -(including, but not limited to, procurement of substitute goods or -services; loss of use, data, or profits; or business interruption) -however caused and on any theory of liability, whether in contract, -strict liability, or tort (including negligence or otherwise) arising in -any way out of the use of this software, even if advised of the -possibility of such damage.** +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +.. end diff --git a/example/scheme/.gitignore b/example/scheme/.gitignore deleted file mode 120000 index c5c99a6a89..0000000000 --- a/example/scheme/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.p4ignore \ No newline at end of file diff --git a/example/scheme/.gitignore b/example/scheme/.gitignore new file mode 100644 index 0000000000..e368d2c988 --- /dev/null +++ b/example/scheme/.gitignore @@ -0,0 +1,12 @@ +Makefile +scheme +scheme.dSYM +scheme-advanced +scheme-advanced.dSYM +scheme-boehm +scheme-boehm.dSYM +scheme-malloc +scheme-malloc.dSYM +a.out +*.o +core diff --git a/example/scheme/.p4ignore b/example/scheme/.p4ignore deleted file mode 100644 index e368d2c988..0000000000 --- a/example/scheme/.p4ignore +++ /dev/null @@ -1,12 +0,0 @@ -Makefile -scheme -scheme.dSYM -scheme-advanced -scheme-advanced.dSYM -scheme-boehm -scheme-boehm.dSYM -scheme-malloc -scheme-malloc.dSYM -a.out -*.o -core diff --git a/example/scheme/.p4ignore b/example/scheme/.p4ignore new file mode 120000 index 0000000000..3e4e48b0b5 --- /dev/null +++ b/example/scheme/.p4ignore @@ -0,0 +1 @@ +.gitignore \ No newline at end of file diff --git a/example/scheme/scheme-advanced.c b/example/scheme/scheme-advanced.c index 49672f6a0a..0c1b2ded06 100644 --- a/example/scheme/scheme-advanced.c +++ b/example/scheme/scheme-advanced.c @@ -1,6 +1,6 @@ /* scheme.c -- SCHEME INTERPRETER EXAMPLE FOR THE MEMORY POOL SYSTEM * - * Copyright (c) 2001-2016 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2018 Ravenbrook Limited. See end of file for license. * * This is a toy interpreter for a subset of the Scheme programming * language . @@ -1230,20 +1230,20 @@ static obj_t read_string(FILE *stream, int c) } -static obj_t read(FILE *stream); +static obj_t read_(FILE *stream); static obj_t read_quote(FILE *stream, int c) { UNUSED(c); - return make_pair(obj_quote, make_pair(read(stream), obj_empty)); + return make_pair(obj_quote, make_pair(read_(stream), obj_empty)); } static obj_t read_quasiquote(FILE *stream, int c) { UNUSED(c); - return make_pair(obj_quasiquote, make_pair(read(stream), obj_empty)); + return make_pair(obj_quasiquote, make_pair(read_(stream), obj_empty)); } @@ -1251,9 +1251,9 @@ static obj_t read_unquote(FILE *stream, int c) { c = getc(stream); if(c == '@') - return make_pair(obj_unquote_splic, make_pair(read(stream), obj_empty)); + return make_pair(obj_unquote_splic, make_pair(read_(stream), obj_empty)); ungetc(c, stream); - return make_pair(obj_unquote, make_pair(read(stream), obj_empty)); + return make_pair(obj_unquote, make_pair(read_(stream), obj_empty)); } @@ -1268,7 +1268,7 @@ static obj_t read_list(FILE *stream, int c) c = getnbc(stream); if(c == ')' || c == '.' || c == EOF) break; ungetc(c, stream); - new = make_pair(read(stream), obj_empty); + new = make_pair(read_(stream), obj_empty); if(list == obj_empty) { list = new; end = new; @@ -1281,7 +1281,7 @@ static obj_t read_list(FILE *stream, int c) if(c == '.') { if(list == obj_empty) error("read: unexpected dot"); - CDR(end) = read(stream); + CDR(end) = read_(stream); c = getnbc(stream); } @@ -1341,7 +1341,7 @@ static obj_t read_special(FILE *stream, int c) } -static obj_t read(FILE *stream) +static obj_t read_(FILE *stream) { int c; @@ -1504,7 +1504,7 @@ static obj_t load(obj_t env, obj_t op_env, obj_t filename) { for(;;) { obj_t obj; mps_chat(); - obj = read(stream); + obj = read_(stream); if(obj == obj_eof) break; result = eval(env, op_env, obj); } @@ -4403,7 +4403,7 @@ static int start(int argc, char *argv[]) printf("%lu, %lu> ", (unsigned long)total, (unsigned long)mps_collections(arena)); fflush(stdout); - obj = read(input); + obj = read_(input); if(obj == obj_eof) break; obj = eval(env, op_env, obj); if(obj != obj_undefined) { @@ -4619,7 +4619,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2016 Ravenbrook Limited . + * Copyright (C) 2001-2018 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/example/scheme/scheme-malloc.c b/example/scheme/scheme-malloc.c index b09bd253fc..5c0489311b 100644 --- a/example/scheme/scheme-malloc.c +++ b/example/scheme/scheme-malloc.c @@ -1,6 +1,6 @@ /* scheme.c -- SCHEME INTERPRETER EXAMPLE FOR THE MEMORY POOL SYSTEM * - * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2018 Ravenbrook Limited. See end of file for license. * * TO DO * - unbounded integers, other number types. @@ -962,18 +962,18 @@ static obj_t read_string(FILE *stream, int c) } -static obj_t read(FILE *stream); +static obj_t read_(FILE *stream); static obj_t read_quote(FILE *stream, int c) { - return make_pair(obj_quote, make_pair(read(stream), obj_empty)); + return make_pair(obj_quote, make_pair(read_(stream), obj_empty)); } static obj_t read_quasiquote(FILE *stream, int c) { - return make_pair(obj_quasiquote, make_pair(read(stream), obj_empty)); + return make_pair(obj_quasiquote, make_pair(read_(stream), obj_empty)); } @@ -981,9 +981,9 @@ static obj_t read_unquote(FILE *stream, int c) { c = getc(stream); if(c == '@') - return make_pair(obj_unquote_splic, make_pair(read(stream), obj_empty)); + return make_pair(obj_unquote_splic, make_pair(read_(stream), obj_empty)); ungetc(c, stream); - return make_pair(obj_unquote, make_pair(read(stream), obj_empty)); + return make_pair(obj_unquote, make_pair(read_(stream), obj_empty)); } @@ -998,7 +998,7 @@ static obj_t read_list(FILE *stream, int c) c = getnbc(stream); if(c == ')' || c == '.' || c == EOF) break; ungetc(c, stream); - new = make_pair(read(stream), obj_empty); + new = make_pair(read_(stream), obj_empty); if(list == obj_empty) { list = new; end = new; @@ -1011,7 +1011,7 @@ static obj_t read_list(FILE *stream, int c) if(c == '.') { if(list == obj_empty) error("read: unexpected dot"); - CDR(end) = read(stream); + CDR(end) = read_(stream); c = getnbc(stream); } @@ -1071,7 +1071,7 @@ static obj_t read_special(FILE *stream, int c) } -static obj_t read(FILE *stream) +static obj_t read_(FILE *stream) { int c; @@ -1229,7 +1229,7 @@ static obj_t load(obj_t env, obj_t op_env, const char *filename) { if(stream == NULL) error("load: cannot open %s: %s", filename, strerror(errno)); for(;;) { - obj_t obj = read(stream); + obj_t obj = read_(stream); if(obj == obj_eof) break; result = eval(env, op_env, obj); } @@ -3625,7 +3625,7 @@ int main(int argc, char *argv[]) } printf("%lu> ", (unsigned long)total); fflush(stdout); - obj = read(input); + obj = read_(input); if(obj == obj_eof) break; obj = eval(env, op_env, obj); if(obj != obj_undefined) { @@ -3641,7 +3641,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2014 Ravenbrook Limited . + * Copyright (C) 2001-2018 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/example/scheme/scheme.c b/example/scheme/scheme.c index 1ba280c7d5..a6acfcf9e1 100644 --- a/example/scheme/scheme.c +++ b/example/scheme/scheme.c @@ -1,6 +1,6 @@ /* scheme.c -- SCHEME INTERPRETER EXAMPLE FOR THE MEMORY POOL SYSTEM * - * Copyright (c) 2001-2016 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2018 Ravenbrook Limited. See end of file for license. * * This is a toy interpreter for a subset of the Scheme programming * language . @@ -1260,20 +1260,20 @@ static obj_t read_string(FILE *stream, int c) } -static obj_t read(FILE *stream); +static obj_t read_(FILE *stream); static obj_t read_quote(FILE *stream, int c) { UNUSED(c); - return make_pair(obj_quote, make_pair(read(stream), obj_empty)); + return make_pair(obj_quote, make_pair(read_(stream), obj_empty)); } static obj_t read_quasiquote(FILE *stream, int c) { UNUSED(c); - return make_pair(obj_quasiquote, make_pair(read(stream), obj_empty)); + return make_pair(obj_quasiquote, make_pair(read_(stream), obj_empty)); } @@ -1281,9 +1281,9 @@ static obj_t read_unquote(FILE *stream, int c) { c = getc(stream); if(c == '@') - return make_pair(obj_unquote_splic, make_pair(read(stream), obj_empty)); + return make_pair(obj_unquote_splic, make_pair(read_(stream), obj_empty)); ungetc(c, stream); - return make_pair(obj_unquote, make_pair(read(stream), obj_empty)); + return make_pair(obj_unquote, make_pair(read_(stream), obj_empty)); } @@ -1298,7 +1298,7 @@ static obj_t read_list(FILE *stream, int c) c = getnbc(stream); if(c == ')' || c == '.' || c == EOF) break; ungetc(c, stream); - new = make_pair(read(stream), obj_empty); + new = make_pair(read_(stream), obj_empty); if(list == obj_empty) { list = new; end = new; @@ -1311,7 +1311,7 @@ static obj_t read_list(FILE *stream, int c) if(c == '.') { if(list == obj_empty) error("read: unexpected dot"); - CDR(end) = read(stream); + CDR(end) = read_(stream); c = getnbc(stream); } @@ -1371,7 +1371,7 @@ static obj_t read_special(FILE *stream, int c) } -static obj_t read(FILE *stream) +static obj_t read_(FILE *stream) { int c; @@ -1534,7 +1534,7 @@ static obj_t load(obj_t env, obj_t op_env, obj_t filename) { for(;;) { obj_t obj; mps_chat(); - obj = read(stream); + obj = read_(stream); if(obj == obj_eof) break; result = eval(env, op_env, obj); } @@ -4336,7 +4336,7 @@ static int start(int argc, char *argv[]) printf("%lu, %lu> ", (unsigned long)total, (unsigned long)mps_collections(arena)); fflush(stdout); - obj = read(input); + obj = read_(input); if(obj == obj_eof) break; obj = eval(env, op_env, obj); if(obj != obj_undefined) { @@ -4507,7 +4507,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2016 Ravenbrook Limited . + * Copyright (C) 2001-2018 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/manual/.gitignore b/manual/.gitignore deleted file mode 120000 index c5c99a6a89..0000000000 --- a/manual/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.p4ignore \ No newline at end of file diff --git a/manual/.gitignore b/manual/.gitignore new file mode 100644 index 0000000000..f2a531e43c --- /dev/null +++ b/manual/.gitignore @@ -0,0 +1,8 @@ +doctrees +converted +epub +html +mmref +source/design/*.rst +source/design/*.svg +tool diff --git a/manual/.p4ignore b/manual/.p4ignore deleted file mode 100644 index f2a531e43c..0000000000 --- a/manual/.p4ignore +++ /dev/null @@ -1,8 +0,0 @@ -doctrees -converted -epub -html -mmref -source/design/*.rst -source/design/*.svg -tool diff --git a/manual/.p4ignore b/manual/.p4ignore new file mode 120000 index 0000000000..3e4e48b0b5 --- /dev/null +++ b/manual/.p4ignore @@ -0,0 +1 @@ +.gitignore \ No newline at end of file diff --git a/manual/Makefile b/manual/Makefile index 7afddf4994..b2993ac20b 100644 --- a/manual/Makefile +++ b/manual/Makefile @@ -1,16 +1,20 @@ # Makefile for Sphinx documentation +# # $Id$ +# +# Keep consistent with build.txt section on building the MPS manual. # You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = sphinx-build +PYTHON = python3 +SPHINXOPTS = -T +SPHINXBUILD = tool/bin/sphinx-build PAPER = BUILDDIR = . # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source +ALLSPHINXOPTS = -T -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source @@ -40,41 +44,41 @@ help: @echo " tools to install a local copy of the Python tools using virtualenv" clean: - -rm -rf $(BUILDDIR)/{changes,devhelp,dirhtml,doctest,doctrees,epub,html,htmlhelp,json,latex,linkcheck,locale,man,pickle,qthelp,singlehtml,texinfo,text} + -for dir in changes devhelp dirhtml doctest doctrees epub html htmlhelp json latex linkcheck locale man pickle qthelp singlehtml texinfo text; do rm -rf $(BUILDDIR)/$$dir; done -find $(BUILDDIR)/source/design -name '*.rst' ! -name 'index.rst' ! -name 'old.rst' -exec rm -f '{}' ';' -html: +html: $(SPHINXBUILD) $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." -dirhtml: +dirhtml: $(SPHINXBUILD) $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." -singlehtml: +singlehtml: $(SPHINXBUILD) $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." -pickle: +pickle: $(SPHINXBUILD) $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." -json: +json: $(SPHINXBUILD) $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." -htmlhelp: +htmlhelp: $(SPHINXBUILD) $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." -qthelp: +qthelp: $(SPHINXBUILD) $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ @@ -83,7 +87,7 @@ qthelp: @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/MemoryPoolSystem.qhc" -devhelp: +devhelp: $(SPHINXBUILD) $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @@ -92,74 +96,70 @@ devhelp: @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/MemoryPoolSystem" @echo "# devhelp" -epub: +epub: $(SPHINXBUILD) $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." -latex: +latex: $(SPHINXBUILD) $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." -latexpdf: +latexpdf: $(SPHINXBUILD) $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." $(MAKE) -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." -text: +text: $(SPHINXBUILD) $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." -man: +man: $(SPHINXBUILD) $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." -texinfo: +texinfo: $(SPHINXBUILD) $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." @echo "Run \`make' in that directory to run these through makeinfo" \ "(use \`make info' here to do that automatically)." -info: +info: $(SPHINXBUILD) $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo "Running Texinfo files through makeinfo..." make -C $(BUILDDIR)/texinfo info @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." -gettext: +gettext: $(SPHINXBUILD) $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale @echo @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." -changes: +changes: $(SPHINXBUILD) $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." -linkcheck: +linkcheck: $(SPHINXBUILD) $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." -doctest: +doctest: $(SPHINXBUILD) $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." -tools: tool/bin/sphinx-build - -tool/bin/sphinx-build: tool/bin/pip - tool/bin/pip install sphinx - @echo "You can now use \`make SPHINXBUILD=tool/bin/sphinx-build html' etc." - @echo "Or add tool/bin to your path." +tool/bin/sphinx-build: tool/bin/pip requirements.pip + tool/bin/pip install -r requirements.pip tool/bin/pip: - virtualenv tool + $(PYTHON) -mvenv tool diff --git a/manual/build.txt b/manual/build.txt index 357fb14a49..c5815e1d49 100644 --- a/manual/build.txt +++ b/manual/build.txt @@ -6,7 +6,7 @@ Introduction ------------ This document describes the various ways in which you can build the MPS, -its libraries, and the tests and tools that come with it. +its manual, its libraries, and the tests and tools that come with it. You may be building the MPS for a number of different purposes. @@ -91,6 +91,32 @@ If you want to do anything beyond these simple cases, use the MPS build as described in the section "Building the MPS for development" below. +Building the MPS manual +----------------------- + +Builds of the MPS manual from the main MPS repo should be available at +``_. + +If that's not available, or if you have a variant of the MPS Kit, or +are making modifications to the MPS itself, then you should build the +manual for yourself. This uses Sphinx +``_. + +On Unix-like platforms (including macOS), the Makefile in the manual +directory can fetch and install a local copy of Sphinx and build the +manual, like this:: + + cd manual + make html + +then open manual/html/index.html. + +On Windows platforms, follow the `Sphinx installation instructions +`_ for +Windows, then invoke Sphinx as shown in the Makefile in the manual +directory. + + Building the MPS for development -------------------------------- @@ -195,7 +221,7 @@ To build just one target, run one of these commands:: nmake /f w3i3mv.nmk (32-bit) nmake /f w3i6mv.nmk (64-bit) -On macOS, you can build from the command line with:: +On macOS (64-bit only), you can build from the command line with:: xcodebuild diff --git a/manual/requirements.pip b/manual/requirements.pip new file mode 100644 index 0000000000..924753d605 --- /dev/null +++ b/manual/requirements.pip @@ -0,0 +1,29 @@ +# manual/requirements.pip -- MPS manual build requirements for pip + +# version/1.117 manual breaks in Sphinx >= 2. See +# . +# +# This list was extracted from a working configuration by:: +# +# ssh berunda lxc exec www -- sudo -u www -i www.ravenbrook.com/project/mps/custom/cet/main/manual/tool/bin/pip freeze >> requirements.pip + +alabaster==0.7.13 +Babel==2.11.0 +certifi==2022.12.7 +charset-normalizer==2.0.12 +docutils==0.17.1 +idna==3.4 +imagesize==1.4.1 +Jinja2==3.0.3 +MarkupSafe==2.0.1 +packaging==21.3 +Pygments==2.14.0 +pyparsing==3.0.9 +pytz==2022.7.1 +requests==2.27.1 +six==1.16.0 +snowballstemmer==2.2.0 +Sphinx==1.8.6 +sphinxcontrib-serializinghtml==1.1.5 +sphinxcontrib-websupport==1.2.4 +urllib3==1.26.15 diff --git a/manual/source/design/.gitignore b/manual/source/design/.gitignore deleted file mode 120000 index c5c99a6a89..0000000000 --- a/manual/source/design/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.p4ignore \ No newline at end of file diff --git a/manual/source/design/.gitignore b/manual/source/design/.gitignore new file mode 100644 index 0000000000..b46be6a82b --- /dev/null +++ b/manual/source/design/.gitignore @@ -0,0 +1,7 @@ +# The files in this directory are generated by the "mps" extension to Sphinx, +# except the index and the "old designs" index. +*.png +*.rst +*.svg +!index.rst +!old.rst diff --git a/manual/source/design/.p4ignore b/manual/source/design/.p4ignore deleted file mode 100644 index 2457ad1919..0000000000 --- a/manual/source/design/.p4ignore +++ /dev/null @@ -1,6 +0,0 @@ -# The files in this directory are generated by the "mps" extension to Sphinx, -# except the index and the "old designs" index. -*.rst -*.svg -!index.rst -!old.rst diff --git a/manual/source/design/.p4ignore b/manual/source/design/.p4ignore new file mode 120000 index 0000000000..3e4e48b0b5 --- /dev/null +++ b/manual/source/design/.p4ignore @@ -0,0 +1 @@ +.gitignore \ No newline at end of file diff --git a/manual/source/guide/overview.rst b/manual/source/guide/overview.rst index c813aaf34c..ac6c49fa11 100644 --- a/manual/source/guide/overview.rst +++ b/manual/source/guide/overview.rst @@ -8,6 +8,9 @@ Overview of the Memory Pool System ================================== +.. IMPORTANT: If you change the paragraph below, also change + readme.txt + The Memory Pool System is a very general, adaptable, flexible, reliable, and efficient memory management system. It permits the flexible combination of memory management techniques, supporting diff --git a/readme.txt b/readme.txt index 115ec3d01d..03657b5898 100644 --- a/readme.txt +++ b/readme.txt @@ -15,6 +15,9 @@ very brief overview and tell you where to find more information. Overview of the MPS ------------------- +.. IMPORTANT: If you change the paragraph below, also change + manual/source/guide/overview.rst + The Memory Pool System (MPS) is a very general, adaptable, flexible, reliable, and efficient memory management system. It permits the flexible combination of memory management techniques, supporting manual @@ -45,8 +48,11 @@ Getting started The MPS Kit is a complete set of sources and documentation to enable you to use, modify, and adapt the MPS: source code, manuals, -procedures, design documentation, and so on. See -``_ for an index. +procedures, design documentation, and so on. See the manual_ for an +index. (If for some reason the manual_ isn't available, you can build +it. See below.) + +.. _manual: https://memory-pool-system.readthedocs.io/ The MPS Kit is distributed in source form. You need to build it before using it. The basic case is straightforward on supported platforms @@ -57,14 +63,15 @@ using it. The basic case is straightforward on supported platforms cl /O2 /c mps.c Windows (with Microsoft SDK or Visual Studio 2010) This will produce an object file you can link with your project. For -details of how to configure the MPS, build libraries and tests, use -IDEs, autoconf, etc. see `Building the MPS `__. +details of how to configure the MPS, build the manual, libraries and +tests, use IDEs, autoconf, etc. see `Building the MPS +`__. For an example of using the MPS, see the `Scheme interpreter example `_. Then, to program and integrate the MPS you'll definitely need to read -the `manual `_. +the manual_. Supported target platforms @@ -134,6 +141,8 @@ Document History 2014-01-13 GDR_ Updated supported platforms. 2014-07-04 GDR_ Link to hotfix for WOW64 bug. 2016-03-24 RB_ Adding support for FreeBSD with Clang/LLVM. +2020-05-22 PNJ_ Changed to BSD 2-clause licence. +2023-02-02 RB_ Migrating from Ravenbrook Perforce to GitHub. ========== ===== ====================================================== .. _GDR: mailto:gdr@ravenbrook.com diff --git a/tool/.gitignore b/tool/.gitignore deleted file mode 120000 index c5c99a6a89..0000000000 --- a/tool/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.p4ignore \ No newline at end of file diff --git a/tool/.gitignore b/tool/.gitignore new file mode 100644 index 0000000000..835fd9ec66 --- /dev/null +++ b/tool/.gitignore @@ -0,0 +1 @@ +.test \ No newline at end of file diff --git a/tool/.p4ignore b/tool/.p4ignore deleted file mode 100644 index 835fd9ec66..0000000000 --- a/tool/.p4ignore +++ /dev/null @@ -1 +0,0 @@ -.test \ No newline at end of file diff --git a/tool/.p4ignore b/tool/.p4ignore new file mode 120000 index 0000000000..3e4e48b0b5 --- /dev/null +++ b/tool/.p4ignore @@ -0,0 +1 @@ +.gitignore \ No newline at end of file diff --git a/tool/github-ci-kick b/tool/github-ci-kick new file mode 100755 index 0000000000..dc4b090fdf --- /dev/null +++ b/tool/github-ci-kick @@ -0,0 +1,120 @@ +#!/bin/sh +# tool/github-ci-kick -- kick off a build at GitHub CI +# Richard Brooksby, Ravenbrook Limited, 2023-01-15 +# +# Copyright (c) 2023 Ravenbrook Limited. See end of file for license. +# +# This shell script uses the GitHub REST API to kick off a build on +# the GitHub CI servers [GITHUB]. The build will be run using the +# GitHub CI configuration at the commit (in +# .github/workflows/build-and-test.yml). +# +# TODO: What about other workflows such as rst-check.yml? Perhaps +# this script should kick them all. +# +# See also tool/travis-ci-kick. +# +# You can achieve the same thing using the GitHub CLI, if you have +# that installed +# . +# This script is intended to help with automation and so avoids +# depending on that. [There's a hidden policy implied here. RB +# 2023-01-15] +# +# To get a token for this script for the Ravenbrook MPS repo at +# GitHub, first see +# +# but overlay these details: +# +# 1. In "Resource owner" choose "Ravenbrook". You must be a member of +# the GitHub Ravenbrook organisation. +# +# 2. In "Repository access" choose "Only select repositories" and the +# "Ravenbrook/mps" repository. +# +# 3. In "Permissions" expand "Repository permissions" and under +# "Actions" choose "Read and write". +# +# NOTE: This script could use the GitHub CLI, but that would require +# it to be installed by the user. +# +# TODO: Convert to Python for use from Windows? +# +# TODO: Make -t optional by getting AUTH-TOKEN from somewhere (secure). + +set -e # exit on error + +# defaults +branch="master" +org="Ravenbrook" +repo="mps" + +usage() { + echo 1>&2 "Usage: ${0} [-o ORG] [-r REPO] [-b BRANCH] -t AUTH-TOKEN" + exit 1 +} + +while getopts c:b:r:t: flag; do + case "${flag}" in + b) branch="${OPTARG}";; + o) org="${OPTARG}";; + r) repo="${OPTARG}";; + t) auth="${OPTARG}";; + *) usage;; + esac +done + +test -z "${auth}" && usage + +curl --silent --show-error \ + --request POST --data @- \ + --header "Accept: application/vnd.github+json" \ + --header "Authorization: Bearer ${auth}"\ + --header "X-GitHub-Api-Version: 2022-11-28" \ + "https://api.github.com/repos/${org}/${repo}/actions/workflows/build-and-test.yml/dispatches" \ + <<-EOF +{ + "ref": "${branch}" +} +EOF + + +# A. REFERENCES +# +# [GitHub] "Create a workflow dispatch event"; . +# +# +# B. DOCUMENT HISTORY +# +# 2023-01-15 RB Created. +# +# C. COPYRIGHT AND LICENSE +# +# Copyright (C) 2023 Ravenbrook Limited . +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the +# distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# +# $Id$ diff --git a/tool/travis-ci-kick b/tool/travis-ci-kick new file mode 100755 index 0000000000..64d5b5c7d1 --- /dev/null +++ b/tool/travis-ci-kick @@ -0,0 +1,117 @@ +#!/bin/sh +# tool/travis-ci-kick -- kick off a build at Travis CI +# Richard Brooksby, Ravenbrook Limited, 2023-01-15 +# +# Copyright (c) 2023 Ravenbrook Limited. See end of file for license. +# +# This shell script uses the Travis CI REST API V3 to kick off a build +# on the Travis CI servers. The build will be run using the Travis CI +# configuration at the commit (in .travis.yml). +# +# See also tool/github-ci-kick. +# +# To get a token for this script, visit +# and copy your token +# from "API authentication". +# +# TODO: Extend this script to take MPS platform codes and kick off the +# appropriate build, overriding the (possibly nonexistent) Travis Ci +# config. See [TRAVIS]. +# +# TODO: Convert to Python for use from Windows? +# +# TODO: Make -t optional by getting AUTH-TOKEN from somewhere (secure). + +set -e # exit on error + +# defaults +branch="master" +org="Ravenbrook" +repo="mps" + +usage() { + echo 1>&2 "Usage: ${0} [-o ORG] [-r REPO] [-b BRANCH] [-c COMMIT-SHA] -t AUTH-TOKEN" + exit 1 +} + +while getopts c:b:r:t: flag; do + case "${flag}" in + c) commit="${OPTARG}";; + b) branch="${OPTARG}";; + o) org="${OPTARG}";; + r) repo="${OPTARG}";; + t) auth="${OPTARG}";; + *) usage;; + esac +done + +test -z "${auth}" && usage + +# If the field "sha" is omitted, Travis CI builds the tip of the +# branch [TRAVIS]. +if test -z "${commit}"; then + cat <<-EOF +{ + "request": { + "branch":"${branch}" + } +} +EOF +else + cat <. +# +# +# B. DOCUMENT HISTORY +# +# 2023-01-15 RB Created. +# +# C. COPYRIGHT AND LICENSE +# +# Copyright (C) 2023 Ravenbrook Limited . +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the +# distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# +# $Id$