extras/posix/posix.strerror.m:
Fix use of MR_strerror (it may return a pointer to a static string
instead of modifying the provided buffer).
Allocate string such that it will be attributed to the predicate
when profiling memory retention.
The binding for readdir() was reporting the end of the directory stream as an
unknown error. This problem was reported by Volker Wysk, to whom the initial
version of the fix is also due.
extras/posix/posix.readdir.m:
Add a new result type that distinguishes between the end of the directory
stream and an error.
Add and export to C an enumeration whose values describe the result of
a call to readdir(). Use this, rather than small integers, when
communicating the result of readdir() call back to Mercury.
Always the string output argument of a foreign_proc to a valid value;
this avoids problems if the debugger attempts to print them out.
Delete the workarounds for FD_{ZERO,SET,ISSET,CLR} in the POSIX binding. The
stated reason for their existence was that the Linux headers defined them using
inline assembler that conflicted with our use of global register variables.
Since the runtime (now) defines a wrapper for FD_ZERO, use the runtime's
version instead of having the binding define its own. We've been using
FD_{SET,ISSET} in the runtime without issues for many years. (On my system,
they and FD_CLR are not defined using inline assembler anyway.)
extras/posix/posix_workarounds.{ch}:
Delete this files.
extras/posix/posix.select.m:
Use MR_fd_zero in place of ME_fd_zero.
Use FD_{SET,ISSET,CLR} directly.
extras/posix/Makefile:
extras/posix/Mercury.options:
extras/posix/Mmakefile:
Conform to the above changes.
Building the POSIX binding using mmc --make by default and just have mmake
forward its work to that. Using mmc --make means things like library grade
exclusions will work properly.
Exclude non-C grades from the grade set in which to install the POSIX binding.
Shift a POSIX binding sample into the samples subdirectory.
extras/posix/Makefile:
extras/posix/Mercury.options:
Build the POSIX binding using mmc --make.
extras/posix/Mmakefile:
Redirect mmake to use the normal Makefile.
extras/posix/hello.m:
Shift this file into the samples subdirectory.
extras/samples/Makefile:
Set up things to build the samples against a libposix in the
parent directory.
extras/samples/Mmakefile:
Delete this file.
Discussion of these changes can be found on the Mercury developers
mailing list archives from June 2018.
COPYING.LIB:
Add a special linking exception to the LGPL.
*:
Update references to COPYING.LIB.
Clean up some minor errors that have accumulated in copyright
messages.
Remove old .cvsignore files, moving their contents to .gitignore files.
There are now no .cvsignore files in the repository.
I've also sorted some .gitignore files and avoided repeating a pattern in a
subdirectory's .gitignore file when it is already mentioned in the parent
.gitignore file.
benchmarks/progs/quicksort/qs_always_par.m:
benchmarks/progs/quicksort/qs_utils.m:
extras/moose/check.m:
extras/posix/samples/mdprof_cgid.m:
extras/xml/parsing.m:
samples/muz/zparser.m:
samples/muz/ztype_op.m:
As above -- the compiler now rejects determinism declarations on
non-predmode predicate declarations.
Replace a call to bitmap.new with bitmap.init.
This file-specific setting will override a default setting of expandtabs
in $HOME/.vimrc.
*/Makefile:
*/Mmakefile:
As above.
tests/hard_coded/.gitignore:
Don't ignore the purity subdir. This ignore must have been left over
from when purity.m was a test in hard_coded, not hard_coded/purity,
and it ignored an executable, not a directory.
extras/.gitignore:
Mercury ignores the --use-{grade}-subdir dir
Mercury/** for git 1.8+ this recursively ignores all build files
ignoring *.mh and *.init files
*.err output files
lib*.{dll|so|a|dylib} ignores target compiler library output
*.jar ignores the Java grade output
*.exe for Windows executables
extras/dynamic_linking/.gitignore:
ignoring the copy of dl.m, name_mangle.m
ignoring hello lib and dl_test* executables
extras/moose/samples/.gitignore:
ignoring cgram.m small.m alpha.m expr.m which are
generated from the .moo grammar files
extras/graphics/mercury_cairo/samples/.gitignore:
ignoring *.png output and all executables
extras/**/.gitignore:
In each sample/test/example folder the linux executable/test
output is ignored
Branches: main
Deprecate string.substring, string.foldl_substring, etc. in favour of
new procedures named string.between, string.foldl_between, etc.
The "between" procedures take a pair of [Start, End) endpoints instead
of Start, Count arguments. The reasons for this change are:
- the "between" procedures are more convenient
- "between" should be unambiguous. You can guess that it takes an End
argument instead of a Count argument without looking up the manual.
- Count arguments necessarily counted code units, but when working with
non-ASCII strings, almost the only way that the values would be arrived at
is by substracting one end point from another.
- it paves the way for a potential change to replace string offsets with an
abstract type. We cannot do that if users regularly have to perform a
subtraction between two offsets.
library/string.m:
Add string.foldl_between, string.foldl2_between,
string.foldr_between, string.between.
Deprecate the old substring names.
Replace string.substring_by_codepoint by string.between_codepoints.
compiler/elds_to_erlang.m:
compiler/error_util.m:
compiler/rbmm.live_variable_analysis.m:
compiler/timestamp.m:
extras/posix/samples/mdprof_cgid.m:
library/bitmap.m:
library/integer.m:
library/lexer.m:
library/parsing_utils.m:
mdbcomp/trace_counts.m:
profiler/demangle.m:
Conform to changes.
tests/general/Mercury.options:
tests/general/string_foldl_substring.exp:
tests/general/string_foldl_substring.m:
tests/general/string_foldr_substring.exp:
tests/general/string_foldr_substring.m:
tests/hard_coded/Mercury.options:
tests/hard_coded/string_substring.m:
Test both between and substring procedures.
tests/hard_coded/string_codepoint.exp:
tests/hard_coded/string_codepoint.exp2:
tests/hard_coded/string_codepoint.m:
Update names in test outputs.
NEWS:
Announce the change.
Estimated hours taken: 1
Branches: main
Convert the POSIX binding to use the standard library's bitmap module for
storing byte-oriented data rather than defining a separate module for doing
so. (The standard library's facilities for dealing with such data are much
more extensive than what they were when the binding was originally written.)
extras/posix/posix.read.m:
extras/posix/posix.write.m:
Use bitmaps in place of the text/0 type.
extras/posix/text.m:
extras/posix/text_header.h:
Delete these modules; they are no longer needed.
extras/posix/Mmakefile:
Don't install the extra header.
extras/posix/hello.m:
extras/posix/samples/mdprof_cgid.m:
Conform to the above change.
Estimated hours taken: 1.5
Branches: main
Retry interrupted system calls which return an error code and set `errno' to
EINTR.
compiler/prog_event.m:
library/io.m:
runtime/mercury_context.c:
runtime/mercury_memory_handlers.c:
runtime/mercury_trace_base.c:
runtime/mercury_wrapper.c:
As above.
extras/posix/posix.dup.m:
extras/posix/posix.exec.m:
extras/posix/posix.lseek.m:
extras/posix/posix.open.m:
extras/posix/posix.readdir.m:
extras/posix/posix.select.m:
extras/posix/posix.socket.m:
extras/posix/posix.stat.m:
extras/posix/posix.wait.m:
extras/posix/posix.write.m:
As above.
Use `pragma foreign_enum' in some places.
extras/posix/posix.read.m:
Use `pragma foreign_proc' instead of `pragma c_code' in a spot.
Branches: main
extras/posix/samples/Mmakefile:
extras/posix/samples/mdprof_cgid.m:
extras/posix/samples/README:
Add a minimal server program that accepts and passes through requests
to mdprof. It's useful when you want to view deep profiling data
without configuring and running a proper web server.
Estimated hours taken: 0.1
Branches: main
extras/posix/posix.m:
Fix an oversight in my last change: delete the old definition
of the type posix.dir/0.
extras/posix/posix.socket.m:
Define the type sockaddr_ptr/0 as as foreign type.
Estimated hours taken: 2
Branches: main
Further cleanups and updates for the posix binding.
extras/posix/hello.m:
extras/posix/posix.exec.m:
extras/posix/posix.kill.m:
extras/posix/posix.lseek.m:
extras/posix/posix.mkdir.m:
extras/posix/posix.open.m:
extras/posix/posix.pipe.m:
extras/posix/posix.read.m:
extras/posix/posix.rmdir.m:
extras/posix/posix.select.m:
extras/posix/posix.socket.m:
extras/posix/posix.stat.m:
extras/posix/posix.wait.m:
extras/posix/posix.write.m:
Use 4-space indentation throughout.
Use the new foreign language interface throughout.
Use state variables for threading the I/O state.
Add missing `MR_' prefixes.
Use foreign_types rather than c_pointer in a number of places; the
former is more type safe. (TODO: there are quite a few remaining uses
of c_pointer in these modules that could be replaced by foreign
types.)
Put no_inline pragmas on foreign_procs containing static data so we
don't end up duplicating that data.
(TODO: the static data should be shifted into foreign_code pragmas, but
that's a separate change.)
Rename posix.socket.(type)/0 to socket_type/0. This avoids having to
parenthesise the name. Redefine the former as an equivalence type for
the latter and add a comment mentioning that it is now obsolete.
Reformat code as per our current coding standard.
Estimated hours taken: 0.5
Branches: main
Begin moving the posix binding over to the new foreign language interface
Conform to our current coding standard in (some of) the posix binding.
extras/posix/posix.closedir.m:
extras/posix/posix.dup.m:
extras/posix/posix.fork.m:
extras/posix/posix.getpid.m:
extras/posix/posix.m:
extras/posix/posix.opendir.m:
Use the new foreign language interface in these modules.
Use predmode declarations where appropriate.
Use 4-space indentation throughout.
Define the type posix.dir/0 as a foreign type.
Estimated hours taken: 0
Branches: main, release
extras/posix/posix.exec.m:
Fix compilation of the posix binding by conforming to
recent changes in the stdlib.
Estimated hours taken: 0.1
Branches main.
Fix some minor problems with some of the libraries
in the extras distribution.
graphics/mercury_glut/glut.m:
graphics/mercury_glut/glut.overlay.m:
graphics/mercury_glut/glut.window.m:
graphics/mercury_opengl/mogl.m:
Replace use of MR_bool_return_{yes,no} with the MR_YES
and MR_NO constants Ian added the other day.
Make sure that the foreign procs in these module
don't promise will_not_call_mercury when they do.
Reformat some C code so that it adheres to our
C coding standard.
posix/posix.select.m:
Use symbolic constants for the values of yes and no
instead of integers.
Estimated hours taken: 0.5
Branches: main, release
Various changes to make it easier to build the extras.
extras/dynamic_linking/Mmakefile:
Don't require the existence of "../../../mercury/browser".
extras/posix/README:
Mention that it may be necessary to set MLLIBS.
extras/references/Mmakefile:
Don't include the "asm_fast.tr" grade in LIBGRADES, since by
default the Mercury standard library doesn't get installed in
that grade.
Estimated hours taken: 0.2
Branches: main.
Fix some compilation errors that were preventing the POSIX binding from
compiling successfully.
extras/posix/posix.stat.m:
Module qualify the `file_type' type because of a type ambiguity
between posix.stat.file_type and io.file_type.
extras/posix/posix.socket.m:
Remove an unnecessary import.
Estimated hours taken: 3
Branches: main, release
Fix a problem where different packages in the `extras' distribution
were being installed in different directories when you specified
INSTALL_PREFIX in the Mmake.params file. Some honoured the INSTALL_PREFIX
setting, some appended "/extras", and some ignored it completely.
Also, add `clean' and `realclean' targets for the extras directory hierarchy,
and fix a few other minor bugs.
extras/lazy_evaluation/Mmakefile:
Include Mmake.params, which previously wasn't included at all
in this file.
extras/logged_output/Mmakefile:
extras/odbc/Mmakefile:
extras/quickcheck/Mmakefile:
Append "/extras" to INSTALL_PREFIX, which previously wasn't done
at all in these directories.
extras/cgi/Mmakefile:
extras/complex_numbers/Mmakefile:
extras/concurrency/Mmakefile:
extras/curs/Mmakefile:
extras/curses/Mmakefile:
extras/dynamic_linking/Mmakefile:
extras/moose/Mmakefile:
extras/posix/Mmakefile:
Move the line `INSTALL_PREFIX := $(INSTALL_PREFIX/extras)'
to before the include of Mmake.params, so as not to override
the user's setting (only override the default setting).
extras/Mmakefile:
extras/concurrency/Mmakefile:
Add `clean' and `realclean' targets.
extras/posix/Mmakefile:
Add MGNUCFLAGS = --no-ansi, since this is needed on some systems.
extras/quickcheck/Mmakefile:
Add "depend", "all", and "install" targets.
Ensure that the "check" target runs the test program.
extras/quickcheck/qcheck.m:
Set the exit status to non-zero if a test fails.
extras/references/Mmakefile:
Adjust the setting of LIBGRADES to account for the fact that
$(GRADE) is no longer implicitly included in $(LIBGRADES).
Estimated hours taken: 0.25
Branches: main
extras/posix/Mmakefile:
Install in the `extras' subdirectory of $(INSTALL_PREFIX),
for consistency with what the other packages in `extras' do.
Estimated hours taken: 3
Branches: main
This patch adds support for a number of POSIX system calls:
- opendir, readdir, closedir, mkdir, rmdir
- fork, exec, wait
- dup
Estimated hours taken: 0.5
extras/posix/Mmakefile:
Various improvements to make it easier to use:
- Add an `install' target which installs the Posix library.
- Add an `all' target that builds `libposix' and `hello',
and change the default target from `hello' to `all'.
Likewise change the rule for `depend' so that it builds
`posix.depend' as well as `hello.depend'.
- Change the rule for `check' so that it runs `hello'.
- Use $O and $(EXT_FOR_PIC_OBJECTS) rather than hard-coding `.o'.