Commit Graph

13 Commits

Author SHA1 Message Date
Zoltan Somogyi
9b6390b17e Bring the programming style of extras up to date.
extras/curs/curs.m:
extras/curs/curs.panel.m:
    Make panel a separate submodule of curs, not a nested submodule.

extras/base64/base64.m:
extras/curses/mcurses.basics.m:
extras/curses/mcurses.m:
extras/curses/mcurses.misc.m:
extras/curses/mcurses.user.m:
extras/gator/evolve.m:
extras/gator/genotype.m:
extras/gator/phenotype.m:
extras/gator/tausworthe3.m:
extras/monte/dots.m:
extras/monte/geom.m:
extras/monte/hg.m:
extras/monte/monte.m:
extras/monte/rnd.m:
extras/moose/grammar.m:
extras/moose/moose.m:
extras/mopenssl/mopenssl.m:
extras/net/echo.m:
extras/net/errno.m:
extras/net/getaddrinfo.m:
extras/net/net.m:
extras/net/netdb.m:
extras/net/sockets.m:
extras/net/streams.m:
extras/net/tcp.m:
extras/net/test_lookups.m:
extras/net/types.m:
extras/odbc/odbc.m:
extras/odbc/odbc_test.m:
extras/references/README:
extras/references/reference.m:
extras/references/scoped_update.m:
extras/solver_types/library/any.m:
extras/solver_types/library/any_array.m:
extras/solver_types/library/any_assoc_list.m:
extras/solver_types/library/any_list.m:
extras/solver_types/library/any_map.m:
extras/solver_types/library/any_tree234.m:
extras/solver_types/library/any_util.m:
extras/trail/trail.m:
extras/trailed_update/samples/interpreter.m:
extras/trailed_update/samples/vqueens.m:
extras/trailed_update/tests/var_test.m:
extras/trailed_update/tr_array.m:
extras/trailed_update/tr_store.m:
extras/trailed_update/trailed_update.m:
extras/trailed_update/unsafe.m:
extras/trailed_update/var.m:
    Bring programming style up to date.
2023-03-30 21:48:10 +11:00
Julien Fischer
84e2536618 Fix minor compilation problems in extras and benchmarks.
These are due to:

- differences between module and file names.
- redundant imports
- the recent change from math.domain_error -> exception.domain_error.

benchmarks/*/*.m:
extras/*/*.m:
    As above.
2020-05-15 16:00:41 +10:00
Mark Brown
d465fa53cb Update the COPYING.LIB file and references to it.
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.
2018-06-09 17:43:12 +10:00
Julien Fischer
a14de83344 Minor cleanups for the networking library.
extras/net/*.m:
    As above.
2016-09-28 11:06:06 +10:00
Julien Fischer
578d172995 Fix documentation in extras/net.
extras/net/types.m:
    Fix spelling errors.
2015-08-19 21:22:00 +10:00
Paul Bone
42b610f825 [net] Add support for IPv6
extras/net/types.m:
    Add IPv6 support

extras/net/test_lookups.m:
    Conform to above change.
2015-04-13 11:23:15 +10:00
Julien Fischer
8c7559ebd3 Fix spelling in networking library.
extras/net/getaddrinfo.m:
extras/net/netdb.m:
extras/net/sockets.m:
extras/net/types.m:
	As above.
2015-04-08 12:03:42 +10:00
Paul Bone
3c9ebf0969 [net] Impement a Mercury interface to getaddrinfo
Add a Mercury interface to the C function getaddrinfo.  getaddrinfo
superceeds gethostbyname and getservbyname.  It is reenterant and also makes
it easier to support IPv6 amoung other things.  Other predicates in netdb.m
should be written in terms of getaddrinfo.

extras/net/getaddrinfo.m:
    As above.

extras/net/netdb.m:
    Add predicates that use getaddrinfo to perform lookups.

extras/net/types.m:
    Add predicates to convert to and from the raw values for family and
    socktype.

extras/net/test_lookups.m:
extras/net/Makefile:
    Add a test program.

.gitignore:
    This .gitignore file was causing git to ignore the Mercury.options file
    in net/extras.  A leading slash in .gitignore patterns matches the start
    of a path, this allows us to ignore these patterns when they're only in
    the root directory.

extras/net/Mercury.options:
    Work around a Mercury bug.

    Add this missing file.
2015-04-07 16:38:10 +10:00
Paul Bone
cbf0975e9e [net] Refactoring
Move type definitions from netdb.m and sockets.m to types.m.  This makes the
coupling between these modules looser.

netdb.m:
    Move port type to types.m

sockets.m:
    Move family and socktype types into types.m

types.m:
    Add the above types.
2015-04-07 16:38:10 +10:00
Paul Bone
8f4051d7a2 [net] Improve compatibility with Windows
types.m:
    MSVC doesn't know that abort() cannot return, so add a return statement.

    Use inet_pton rather than inet_aton.

sockets.m:
    Sockets are not file descriptors on windows, so we cannot use read and
    write system calls.  Instead use recv and send.

netdb.m:
    Windows doesn't provide getprotobyname_r() so use getprotobyname() on
    Windows.
2015-03-02 21:34:10 +11:00
Paul Bone
621337fb5f [net] Include mercury_windows.h before winsock2.h
To make winsock2.h useable we have to include mercury_windows first,
which includes windows.h in such a way as not to include the conflicting
winsock.h.

Julien caught this bug in my previous commit.  Thanks.

extras/net/netdb.m:
extras/net/sockets.m:
extras/net/tcp.m:
extras/net/types.m:
    As above.
2015-01-13 12:13:37 +11:00
Paul Bone
657511f87f [net] Make the C code compatible with Windows
extras/net/netdb.m:
extras/net/sockets.m:
extras/net/tcp.m:
extras/net/types.m:
    Include the correct header files.

    Fix the order of statements in a code block.

    Workarround the missing SHUT_RDWR macro on windows.

    Avoid use of socklen_t.
2015-01-10 15:18:52 +11:00
Paul Bone
89b66d0228 extras/ Update the net library
This library had been neglected for a while and came to my attention when it
used deprecated (or at least old) C interfaces rather than newer reentrant
ones.  I've started to improve this library by giving a more typesafe and
Mercury-esque API, using only reentrant C functions, and eventually adding
support for more protocols, (eg: IPv6 and UDP) better integration with
Mercury's io module and generally making it easier to use.

What's working now:

    + creating sockets,
    + binding and listening,
    + connecting (untested),
    + accepting,
    + closing.
    + The interface is generally more type-safe, using new types suck as
      "socket" and "address" rather than "int" and "c_pointer".

What's not working/incomplete:

    + I havn't yet touched the tcp.m module, but I intend to remove it and
      create a new high-level interface for various protocols.
    + Any kind of reading / writing over sockets at all.
    + Name lookups.
    + A lot of the interface is incomplete / missing useful functions and
      predicates.

This is a work in progress.

Makefile:
    New Makefile.

README.md:
    New Readme file.

net.m:
    net is now a module containing the other modules as submodules.

sockets.m:
    Many changes as described above.

netdb.m:
    This new module contains host and other name lookups.  Only service
    lookups are currently implemented.

types.m:
    Types shared by sockets.m and netdb.m.

echo.m:
    An example echo server.

errno.m:
    strerror functionality.

tcp.m:
    Conform to changes in net.m.
2014-09-29 09:47:49 +10:00