[m-rev.] nested sub-modules break parallel builds

Keri Harris keri at gentoo.org
Mon Oct 23 18:25:38 AEST 2006


It appears that nested sub-modules can break in a parallel build. Using the 
following with a stub Mmakefile:


%--------------------------------%

:- module foo.
:- interface.

:- pred foo.
:- mode foo is det.

%--------------------------------%

    :- module bar.
    :- interface.

    :- pred bar.
    :- mode bar is det.

    :- end_module bar.

%--------------------------------%

:- implementation.

foo.

%--------------------------------%

    :- module bar.
    :- implementation.

    bar.

    :- end_module bar.

%--------------------------------%


$ mmake -j33
mmc --make-short-interface --grade asm_fast.gc          foo
mmc --make-short-interface --grade asm_fast.gc          foo.m
cp: cannot stat `foo.bar.int3.tmp': No such file or directory
Error creating `foo.bar.int3': can't open input file: No such file or 
directory
Error: problem updating interface files.
mmc --make-private-interface --grade asm_fast.gc          foo
gmake: *** [foo.bar.date3] Error 1
gmake: *** Waiting for unfinished jobs....


I'm not sure whether this is a bug in the Mercury build system or an expected 
limitation of using nested sub-modules. What led me on to this behaviour was 
attempting to compile extras/curs.m on an SMP machine, giving a similar 
error:


mmc --make-short-interface --grade asm_fast.gc          curs
mmc --make-short-interface --grade asm_fast.gc          curs.m
cp: cannot stat `curs.int3.tmp': No such file or directory
Error creating `curs.int3': can't open input file: No such file or directory
Error: problem updating interface files.
cp: cannot stat `curs.panel.int3.tmp':mmc --make-private-interface --grade 
asm_fast.gc          curs
 No such file or directory
Error creating `curs.panel.int3': can't open input file: No such file or 
directory
Error: problem updating interface files.
gmake: *** [curs.panel.date3] Error 1
gmake: *** Waiting for unfinished jobs....


If this is expected behaviour for nested sub-modules then if may be worthwhile 
using a separate sub-module for the extras/curs package; I've taken the 
liberty of attaching the following diff:


diff -urN mercury-extras-0.13.0.orig/curs/curs.m 
mercury-extras-0.13.0/curs/curs.m
--- mercury-extras-0.13.0.orig/curs/curs.m	2006-04-21 15:42:46.000000000 +1200
+++ mercury-extras-0.13.0/curs/curs.m	2006-10-23 17:00:50.000000000 +1300
@@ -31,6 +31,8 @@
 :- import_module io.
 :- import_module string.
 
+:- include_module curs__panel.
+
 %-----------------------------------------------------------------------------%
 
     % Start a curses session (colour, unbuffered input, no echoing, 
@@ -210,90 +212,6 @@
 :- func cyan = colour.
 :- func white = colour.
 
-    %-------------------------------------------------------------------------%
-    %-------------------------------------------------------------------------%
-
-        % Panels are windows over the main display; they may be
-        % stacked, moved, ordered and hidden.  Contents of panels
-        % closer to the top of the stack obscure the parts of panels
-        % they overlap that are lower in the stack.
-        %
-    :- module panel.
-    :- interface.
-    
-    :- type panel.
-
-        % new(Rows, Cols, Row, Col, Attr, Panel) creates a new panel
-        % Panel whose size is given by (Rows, Cols) and whose position
-        % on the display is given by (Row, Col).  The new panel starts
-        % visible and at the top of the stack.  The default attributes
-        % for the panel are set to Attr.
-        %
-    :- pred new(int::in, int::in, int::in, int::in, attr::in, panel::out,
-        io::di, io::uo) is det.
-
-        % Destroy a panel.
-        %
-    :- pred delete(panel::in, io::di, io::uo) is det.
-
-        % Raise/lower a panel to the top/bottom of the stack.
-        %
-    :- pred raise(panel::in, io::di, io::uo) is det.
-    :- pred lower(panel::in, io::di, io::uo) is det.
-
-        % Hide/reveal a panel (revealing places it at the top of the stack).
-        %
-    :- pred hide(panel::in, io::di, io::uo) is det.
-    :- pred reveal(panel::in, io::di, io::uo) is det.
-
-        % Move a panel to (Row, Col) on the display.
-        %
-    :- pred relocate(panel::in, int::in, int::in, io::di, io::uo) is det.
-
-        % Clear a panel.
-        %
-    :- pred clear(panel::in, io::di, io::uo) is det.
-
-        % Move the virtual cursor to given row and column; (0, 0) are the
-        % coordinates for the upper left hand corner of the panel.
-        %
-    :- pred move(panel::in, int::in, int::in, io::di, io::uo) is det.
-
-        % Add a char/string to a panel with the given attributes.
-        % Note that char codes are passed rather than plain chars.
-        %
-    :- pred addch(panel::in, attr::in, int::in, io::di, io::uo) is det.
-    :- pred addstr(panel::in, attr::in, string::in, io::di, io::uo) is det.
-
-        % Turn on/off or set attributes that will be applied by default.
-        %
-    :- pred attr_on(panel::in, attr::in, io::di, io::uo) is det.
-    :- pred attr_off(panel::in, attr::in, io::di, io::uo) is det.
-    :- pred attr_set(panel::in, attr::in, io::di, io::uo) is det.
-
-        % Update the display (also calls doupdate).
-        % NOTE: doupdate does not call update_panels.
-        %
-    :- pred update_panels(io::di, io::uo) is det.
-
-        % Draws a border around the inside edge of the display.
-        %
-    :- pred border(panel::in, io::di, io::uo) is det.
-
-        % Draws an horizontal line of length N moving to the right.
-        %
-    :- pred hline(panel::in, int::in, int::in, io::di, io::uo) is det.
-
-        % Draws a vertical line of length N moving down.
-        %
-    :- pred vline(panel::in, int::in, int::in, io::di, io::uo) is det.
-
-    :- end_module panel.
-
-    %-------------------------------------------------------------------------%
-    %-------------------------------------------------------------------------%
-
-%-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
 :- implementation.
@@ -1044,210 +962,4 @@
     IO = IO0;
 ").
 
-    %-------------------------------------------------------------------------%
-    %-------------------------------------------------------------------------%
-
-    :- module panel.
-
-    :- implementation.
-
-    %-------------------------------------------------------------------------%
-
-    :- pragma foreign_decl("C", "
-
-        #include <ncurses.h>
-        #include <panel.h>
-
-    ").
-    
-    :- pragma foreign_type("C", panel, "PANEL *").
-
-    %-------------------------------------------------------------------------%
-
-    :- pragma foreign_proc("C",
-        new(Rows::in, Cols::in, Row::in, Col::in, Attr::in, Panel::out,
-            IO0::di, IO::uo),
-        [will_not_call_mercury, promise_pure],
-    "
-            WINDOW *w = newwin(Rows, Cols, Row, Col);
-            scrollok(w, TRUE);
-            wattrset(w, Attr);
-            wcolor_set(w, Attr, NULL);
-            wclear(w);
-            Panel = new_panel(w);
-
-            IO = IO0;
-    ").
-
-    %-------------------------------------------------------------------------%
-
-    :- pragma foreign_proc("C",
-        delete(Panel::in, IO0::di, IO::uo),
-        [will_not_call_mercury, promise_pure],
-    "
-        delwin(panel_window(Panel));
-        del_panel(Panel);
-
-        IO = IO0;
-    ").
-
-    %-------------------------------------------------------------------------%
-
-    :- pragma foreign_proc("C",
-        raise(Panel::in, IO0::di, IO::uo),
-        [will_not_call_mercury, promise_pure],
-    "
-        top_panel(Panel);
-        IO = IO0;
-    ").
-
-    %-------------------------------------------------------------------------%
-
-    :- pragma foreign_proc("C",
-        lower(Panel::in, IO0::di, IO::uo),
-        [will_not_call_mercury, promise_pure],
-    "
-        bottom_panel(Panel);
-        IO = IO0;
-    ").
-
-    %-------------------------------------------------------------------------%
-
-    :- pragma foreign_proc("C",
-        hide(Panel::in, IO0::di, IO::uo),
-        [will_not_call_mercury, promise_pure],
-    "
-        hide_panel(Panel);
-        IO = IO0;
-    ").
-
-    %-------------------------------------------------------------------------%
-
-    :- pragma foreign_proc("C",
-        reveal(Panel::in, IO0::di, IO::uo),
-        [will_not_call_mercury, promise_pure],
-    "
-        show_panel(Panel);
-        IO = IO0;
-    ").
-
-    %-------------------------------------------------------------------------%
-
-    :- pragma foreign_proc("C",
-        relocate(Panel::in, Row::in, Col::in, IO0::di, IO::uo),
-        [will_not_call_mercury, promise_pure],
-    "
-        move_panel(Panel, Row, Col);
-        IO = IO0;
-    ").
-
-    %-------------------------------------------------------------------------%
-
-    :- pragma foreign_proc("C",
-        clear(Panel::in, IO0::di, IO::uo),
-        [will_not_call_mercury, promise_pure],
-    "
-        wclear(panel_window(Panel));
-        IO = IO0;
-    ").
-
-    %-------------------------------------------------------------------------%
-
-    :- pragma foreign_proc("C",
-        move(Panel::in, Row::in, Col::in, IO0::di, IO::uo),
-        [will_not_call_mercury, promise_pure],
-    "
-        wmove(panel_window(Panel), Row, Col);
-        IO = IO0;
-    ").
-
-    %-------------------------------------------------------------------------%
-
-    :- pragma foreign_proc("C",
-        addch(Panel::in, Attr::in, CharCode::in, IO0::di, IO::uo),
-        [will_not_call_mercury, promise_pure],
-    "
-        waddch(panel_window(Panel), (chtype)Attr | (chtype)CharCode);
-        IO = IO0;
-    ").
-
-    %-------------------------------------------------------------------------%
-
-    addstr(Panel, Attr, Str, !IO) :-
-        string.foldl(
-            ( pred(Char::in, !.IO::di, !:IO::uo) is det :-
-                addch(Panel, Attr, char.to_int(Char), !IO)
-            ),
-            Str, !IO
-        ).
-
-    %-------------------------------------------------------------------------%
-
-    :- pragma foreign_proc("C",
-        attr_on(Panel::in, Attr::in, IO0::di, IO::uo),
-        [will_not_call_mercury, promise_pure],
-    "
-        wattron(panel_window(Panel), Attr);
-        IO = IO0;
-    ").
-    
-    :- pragma foreign_proc("C",
-        attr_off(Panel::in, Attr::in, IO0::di, IO::uo),
-        [will_not_call_mercury, promise_pure],
-    "
-        wattroff(panel_window(Panel), Attr);
-        IO = IO0;
-    ").
-
-    :- pragma foreign_proc("C",
-        attr_set(Panel::in, Attr::in, IO0::di, IO::uo),
-        [will_not_call_mercury, promise_pure],
-    "
-        wattrset(panel_window(Panel), Attr);
-        IO = IO0;
-    ").
-
-    %-------------------------------------------------------------------------%
-
-    :- pragma foreign_proc("C",
-        update_panels(IO0::di, IO::uo),
-        [will_not_call_mercury, promise_pure],
-    "
-        update_panels();
-        doupdate();
-        IO = IO0;
-    ").
-
-    %-------------------------------------------------------------------------%
-
-    :- pragma foreign_proc("C",
-        border(Panel::in, IO0::di, IO::uo),
-        [will_not_call_mercury, promise_pure],
-    "
-        wborder(panel_window(Panel), 0, 0, 0, 0, 0, 0, 0, 0);
-        IO = IO0;
-    ").
-
-    :- pragma foreign_proc("C",
-        hline(Panel::in, C::in, N::in, IO0::di, IO::uo),
-        [will_not_call_mercury, promise_pure],
-    "
-        whline(panel_window(Panel), C, N);
-        IO = IO0;
-    ").
-
-    :- pragma foreign_proc("C",
-        vline(Panel::in, C::in, N::in, IO0::di, IO::uo),
-        [will_not_call_mercury, promise_pure],
-    "
-        wvline(panel_window(Panel), C, N);
-        IO = IO0;
-    ").
-
-    %-------------------------------------------------------------------------%
-    :- end_module panel.
-    %-------------------------------------------------------------------------%
-    %-------------------------------------------------------------------------%
-
-%-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
diff -urN mercury-extras-0.13.0.orig/curs/curs.panel.m 
mercury-extras-0.13.0/curs/curs.panel.m
--- mercury-extras-0.13.0.orig/curs/curs.panel.m	1970-01-01 12:00:00.000000000 
+1200
+++ mercury-extras-0.13.0/curs/curs.panel.m	2006-10-23 16:52:58.000000000 
+1300
@@ -0,0 +1,282 @@
+%-----------------------------------------------------------------------------%
+% curs.panel.m
+% Copyright (C) 2001 Ralph Becket <rbeck at microsoft.com>
+% Thu Jan 11 13:47:25 GMT 2001
+% vim: ts=4 sw=4 et tw=0 wm=0 ff=unix ft=mercury
+%
+%   THIS FILE IS HEREBY CONTRIBUTED TO THE MERCURY PROJECT TO
+%   BE RELEASED UNDER WHATEVER LICENCE IS DEEMED APPROPRIATE
+%   BY THE ADMINISTRATORS OF THE MERCURY PROJECT.
+%
+% Simplified Mercury interface to the ncurses panel library.
+%
+%-----------------------------------------------------------------------------%
+
+:- module curs__panel.
+:- interface.
+
+:- type panel.
+
+    % new(Rows, Cols, Row, Col, Attr, Panel) creates a new panel
+    % Panel whose size is given by (Rows, Cols) and whose position
+    % on the display is given by (Row, Col).  The new panel starts
+    % visible and at the top of the stack.  The default attributes
+    % for the panel are set to Attr.
+    %
+:- pred new(int::in, int::in, int::in, int::in, attr::in, panel::out,
+    io::di, io::uo) is det.
+
+    % Destroy a panel.
+    %
+:- pred delete(panel::in, io::di, io::uo) is det.
+
+    % Raise/lower a panel to the top/bottom of the stack.
+    %
+:- pred raise(panel::in, io::di, io::uo) is det.
+:- pred lower(panel::in, io::di, io::uo) is det.
+
+    % Hide/reveal a panel (revealing places it at the top of the stack).
+    %
+:- pred hide(panel::in, io::di, io::uo) is det.
+:- pred reveal(panel::in, io::di, io::uo) is det.
+
+    % Move a panel to (Row, Col) on the display.
+    %
+:- pred relocate(panel::in, int::in, int::in, io::di, io::uo) is det.
+
+    % Clear a panel.
+    %
+:- pred clear(panel::in, io::di, io::uo) is det.
+
+    % Move the virtual cursor to given row and column; (0, 0) are the
+    % coordinates for the upper left hand corner of the panel.
+    %
+:- pred move(panel::in, int::in, int::in, io::di, io::uo) is det.
+
+    % Add a char/string to a panel with the given attributes.
+    % Note that char codes are passed rather than plain chars.
+    %
+:- pred addch(panel::in, attr::in, int::in, io::di, io::uo) is det.
+:- pred addstr(panel::in, attr::in, string::in, io::di, io::uo) is det.
+
+    % Turn on/off or set attributes that will be applied by default.
+    %
+:- pred attr_on(panel::in, attr::in, io::di, io::uo) is det.
+:- pred attr_off(panel::in, attr::in, io::di, io::uo) is det.
+:- pred attr_set(panel::in, attr::in, io::di, io::uo) is det.
+
+    % Update the display (also calls doupdate).
+    % NOTE: doupdate does not call update_panels.
+    %
+:- pred update_panels(io::di, io::uo) is det.
+
+    % Draws a border around the inside edge of the display.
+    %
+:- pred border(panel::in, io::di, io::uo) is det.
+
+    % Draws an horizontal line of length N moving to the right.
+    %
+:- pred hline(panel::in, int::in, int::in, io::di, io::uo) is det.
+
+    % Draws a vertical line of length N moving down.
+    %
+:- pred vline(panel::in, int::in, int::in, io::di, io::uo) is det.
+
+%-----------------------------------------------------------------------------%
+
+:- implementation.
+
+%-------------------------------------------------------------------------%
+
+:- pragma foreign_decl("C", "
+
+    #include <ncurses.h>
+    #include <panel.h>
+
+").
+
+:- pragma foreign_type("C", panel, "PANEL *").
+
+%-------------------------------------------------------------------------%
+
+:- pragma foreign_proc("C",
+    new(Rows::in, Cols::in, Row::in, Col::in, Attr::in, Panel::out,
+        IO0::di, IO::uo),
+    [will_not_call_mercury, promise_pure],
+"
+        WINDOW *w = newwin(Rows, Cols, Row, Col);
+        scrollok(w, TRUE);
+        wattrset(w, Attr);
+        wcolor_set(w, Attr, NULL);
+        wclear(w);
+        Panel = new_panel(w);
+
+        IO = IO0;
+").
+
+%-------------------------------------------------------------------------%
+
+:- pragma foreign_proc("C",
+    delete(Panel::in, IO0::di, IO::uo),
+    [will_not_call_mercury, promise_pure],
+"
+    delwin(panel_window(Panel));
+    del_panel(Panel);
+
+    IO = IO0;
+").
+
+%-------------------------------------------------------------------------%
+
+:- pragma foreign_proc("C",
+    raise(Panel::in, IO0::di, IO::uo),
+    [will_not_call_mercury, promise_pure],
+"
+    top_panel(Panel);
+    IO = IO0;
+").
+
+%-------------------------------------------------------------------------%
+
+:- pragma foreign_proc("C",
+    lower(Panel::in, IO0::di, IO::uo),
+    [will_not_call_mercury, promise_pure],
+"
+    bottom_panel(Panel);
+    IO = IO0;
+").
+
+%-------------------------------------------------------------------------%
+
+:- pragma foreign_proc("C",
+    hide(Panel::in, IO0::di, IO::uo),
+    [will_not_call_mercury, promise_pure],
+"
+    hide_panel(Panel);
+    IO = IO0;
+").
+
+%-------------------------------------------------------------------------%
+
+:- pragma foreign_proc("C",
+    reveal(Panel::in, IO0::di, IO::uo),
+    [will_not_call_mercury, promise_pure],
+"
+    show_panel(Panel);
+    IO = IO0;
+").
+
+%-------------------------------------------------------------------------%
+
+:- pragma foreign_proc("C",
+    relocate(Panel::in, Row::in, Col::in, IO0::di, IO::uo),
+    [will_not_call_mercury, promise_pure],
+"
+    move_panel(Panel, Row, Col);
+    IO = IO0;
+").
+
+%-------------------------------------------------------------------------%
+
+:- pragma foreign_proc("C",
+    clear(Panel::in, IO0::di, IO::uo),
+    [will_not_call_mercury, promise_pure],
+"
+    wclear(panel_window(Panel));
+    IO = IO0;
+").
+
+%-------------------------------------------------------------------------%
+
+:- pragma foreign_proc("C",
+    move(Panel::in, Row::in, Col::in, IO0::di, IO::uo),
+    [will_not_call_mercury, promise_pure],
+"
+    wmove(panel_window(Panel), Row, Col);
+    IO = IO0;
+").
+
+%-------------------------------------------------------------------------%
+
+:- pragma foreign_proc("C",
+    addch(Panel::in, Attr::in, CharCode::in, IO0::di, IO::uo),
+    [will_not_call_mercury, promise_pure],
+"
+    waddch(panel_window(Panel), (chtype)Attr | (chtype)CharCode);
+    IO = IO0;
+").
+
+%-------------------------------------------------------------------------%
+
+addstr(Panel, Attr, Str, !IO) :-
+    string.foldl(
+        ( pred(Char::in, !.IO::di, !:IO::uo) is det :-
+            addch(Panel, Attr, char.to_int(Char), !IO)
+        ),
+        Str, !IO
+    ).
+
+%-------------------------------------------------------------------------%
+
+:- pragma foreign_proc("C",
+    attr_on(Panel::in, Attr::in, IO0::di, IO::uo),
+    [will_not_call_mercury, promise_pure],
+"
+    wattron(panel_window(Panel), Attr);
+    IO = IO0;
+").
+
+:- pragma foreign_proc("C",
+    attr_off(Panel::in, Attr::in, IO0::di, IO::uo),
+    [will_not_call_mercury, promise_pure],
+"
+    wattroff(panel_window(Panel), Attr);
+    IO = IO0;
+").
+
+:- pragma foreign_proc("C",
+    attr_set(Panel::in, Attr::in, IO0::di, IO::uo),
+    [will_not_call_mercury, promise_pure],
+"
+    wattrset(panel_window(Panel), Attr);
+    IO = IO0;
+").
+
+%-------------------------------------------------------------------------%
+
+:- pragma foreign_proc("C",
+    update_panels(IO0::di, IO::uo),
+    [will_not_call_mercury, promise_pure],
+"
+    update_panels();
+    doupdate();
+    IO = IO0;
+").
+
+%-------------------------------------------------------------------------%
+
+:- pragma foreign_proc("C",
+    border(Panel::in, IO0::di, IO::uo),
+    [will_not_call_mercury, promise_pure],
+"
+    wborder(panel_window(Panel), 0, 0, 0, 0, 0, 0, 0, 0);
+    IO = IO0;
+").
+
+:- pragma foreign_proc("C",
+    hline(Panel::in, C::in, N::in, IO0::di, IO::uo),
+    [will_not_call_mercury, promise_pure],
+"
+    whline(panel_window(Panel), C, N);
+    IO = IO0;
+").
+
+:- pragma foreign_proc("C",
+    vline(Panel::in, C::in, N::in, IO0::di, IO::uo),
+    [will_not_call_mercury, promise_pure],
+"
+    wvline(panel_window(Panel), C, N);
+    IO = IO0;
+").
+
+%-----------------------------------------------------------------------------%

Keri

-- 
Keri Harris - Gentoo Developer
Public Key:
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xA128F5ED
Key fingerprint = 1690 30DA 4950 E710 A871 07D7 AF04 BFB6 A138 F5ED
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20061023/4d5bdb0e/attachment.sig>


More information about the reviews mailing list