[m-users.] Signal 253 error on MinGW32 during compilation of module with a large table

Tomas By tomas at basun.net
Thu Feb 19 10:10:34 AEDT 2015


Hello,

On Wed, February 18, 2015 22:49, Dirk Ziegemeyer wrote:
> Here is a short description of the conceptual background and my current
> implementation [...]


It is very easy to just read this in from a file, and then create your own
indexes for quick access.

First, you define a type with the data, eg:

:- type mymem ---> mm(domainMember,memberID,domainCode,string,memberLabel).

And use something like this

  [...]
  io.open_input(File,Res,!IO),
  ( Res = io.ok(S),
    read_data(S,[],ListOfMyMembers,!IO),
    io.close_input(S,!IO)
  ; Res = io.error(Error), [...] ).

:- pred read_data(io.input_stream,list(mymem),list(mymem),io,io).
:- mode read_data(in,in,out,di,uo) is det.

read_data(S,!Data,!IO) :-
  io.read(S,Res,!IO),
  ( Res = io.ok(C),
    !:Data = [C|!.Data], % STORAGE COMMAND
    read_data(F,S,!Data,!IO)
  ; Res = io.eof
  ; Res = io.error(Msg,N), [...] ).

To read the file.

Then you change the collection type from `list(mymem)' to a couple of
maps, depending on how you need to access the data, and change the
`STORAGE COMMAND' to a call to a procedure that updates the maps.

I can come up with a more complete example, if you need it.

/Tomas





More information about the users mailing list