[m-users.] Signal 253 error on MinGW32 during compilation of module with a large table
Dirk Ziegemeyer
dirk at ziegemeyer.de
Fri Feb 20 05:52:53 AEDT 2015
Hello Tomas,
> Am 19.02.2015 um 00:10 schrieb Tomas By <tomas at basun.net>:
>
> 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.
This looks like an elegant way to use fact tables that are not
supposed to be hard-coded. I'll keep this solution in mind.
I prefer that the compiler checks the integrity rules of the mentioned facts at compile time, e.g. "Every explicitDomainMember has exactly one
memberID".
That’s why I'll try the rotd first.
Best regards,
Dirk
More information about the users
mailing list