mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-23 13:23:47 +00:00
Separate out the details of how to link against ncurses and the panel library
into a separate file. Include this new file in both the top-level and samples
Mmakefiles and use the variables it defines to link against ncurses.
Document how to to use the ncursesN-config and pkg-config tools to find
the correct set of flags to link against ncurses. Using ncursesN-config
was suggested by Fabrice Nicol in a change he recently posted.
General cleanups.
extras/curs/Ncurses.options:
New file defining variables that control how to link against ncurses
and the panel library.
Document some ways of finding the correct set of flags.
Document how to override the contents of this file on the command line.
extras/curs/Mmakefile:
Include the Ncurses.options file.
Refer users to that file for controlling how to link against
ncurses.
extras/curs/samples/Mmakefile:
Import Ncurses.options instead of hardcoding the library flags here.
extras/curs/curs.m:
Shift vim modeline into our usual place.
Update copyright notice.
Point users to Ncurses.options.
extras/curs/samples/*.m:
Replace tabs with spaces.
Delete trailing whitespace.
Minor cleanups.
40 lines
1.1 KiB
Mathematica
40 lines
1.1 KiB
Mathematica
%-----------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et tw=0 wm=0 ff=unix ft=mercury
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
:- module sleep.
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
% usleep(MSec, !IO)
|
|
%
|
|
% Sleep for MSec microseconds.
|
|
% Only implemented for Unix-like systems so far.
|
|
%
|
|
:- pred usleep(int::in, io::di, io::uo) is det.
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
:- implementation.
|
|
|
|
:- pragma foreign_decl("C",
|
|
"
|
|
#include <sys/time.h>
|
|
#include <sys/types.h>
|
|
#include <unistd.h>
|
|
").
|
|
|
|
:- pragma foreign_proc("C",
|
|
usleep(N::in, _IO0::di, _IO::uo),
|
|
[will_not_call_mercury, promise_pure, tabled_for_io],
|
|
"
|
|
struct timeval tv = {0, N};
|
|
select(0, NULL, NULL, NULL, &tv);
|
|
").
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
:- end_module sleep.
|
|
%-----------------------------------------------------------------------------%
|