Merge branch 'master' of yap.dcc.fc.up.pt:yap-6

This commit is contained in:
Ricardo Rocha 2010-04-19 02:36:14 +01:00
commit 1029828775
17 changed files with 98 additions and 28 deletions

View File

@ -548,17 +548,15 @@ get_num(int *chp, int *chbuffp, int inp_stream, int (*Nxtch) (int), int (*Quoted
}
*chp = ch;
}
else if ((ch == 'o') && base == 0) {
else if ((ch == 'o' || ch == 'O') && base == 0) {
might_be_float = FALSE;
base = 8;
if (--max_size == 0) {
Yap_ErrorMessage = "Number Too Long";
return (TermNil);
}
*sp++ = ch;
*chp = Nxtch(inp_stream);
}
else {
ch = Nxtch(inp_stream);
} else if ((ch == 'b' || ch == 'B') && base == 0) {
might_be_float = FALSE;
base = 2;
ch = Nxtch(inp_stream);
} else {
val = base;
base = 10;
}
@ -666,6 +664,10 @@ get_num(int *chp, int *chbuffp, int inp_stream, int (*Nxtch) (int), int (*Quoted
*chp = ch;
if (s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
return read_int_overflow(s+2,16,val,sign);
else if (s[0] == '0' && (s[1] == 'o' || s[1] == 'O'))
return read_int_overflow(s+2,8,val,sign);
else if (s[0] == '0' && (s[1] == 'b' || s[1] == 'B'))
return read_int_overflow(s+2,2,val,sign);
if (s[1] == '\'')
return read_int_overflow(s+2,base,val,sign);
if (s[2] == '\'')

View File

@ -1,4 +1,8 @@
/* This file, dglobals.h, was generated automatically by "yap -L misc/buildheap"
please do not update, update misc/GLOBALS instead */

View File

@ -1,4 +1,8 @@
/* This file, dhstruct.h, was generated automatically by "yap -L misc/buildheap"
please do not update, update misc/HEAPFIELDS instead */

View File

@ -1,4 +1,8 @@
/* This file, hglobals.h, was generated automatically by "yap -L misc/buildheap"
please do not update, update misc/GLOBALS instead */

View File

@ -1,4 +1,8 @@
/* This file, hstruct.h, was generated automatically by "yap -L misc/buildheap"
please do not update, update misc/HEAPFIELDS instead */

View File

@ -1,3 +1,7 @@
/* This file, iatoms.h, was generated automatically by "yap -L misc/buildatoms"
please do not update, update misc/ATOMS instead */
Atom3Dots = Yap_LookupAtom("...");
AtomAbol = Yap_FullLookupAtom("$abol");
AtomAccess = Yap_LookupAtom("access");

View File

@ -1,4 +1,8 @@
/* This file, iglobals.h, was generated automatically by "yap -L misc/buildheap"
please do not update, update misc/GLOBALS instead */

View File

@ -1,4 +1,8 @@
/* This file, ihstruct.h, was generated automatically by "yap -L misc/buildheap"
please do not update, update misc/HEAPFIELDS instead */

View File

@ -1,3 +1,7 @@
/* This file, ratoms.h, was generated automatically by "yap -L misc/buildatoms"
please do not update, update misc/ATOMS instead */
Atom3Dots = AtomAdjust(Atom3Dots);
AtomAbol = AtomAdjust(AtomAbol);
AtomAccess = AtomAdjust(AtomAccess);

View File

@ -1,4 +1,8 @@
/* This file, rglobals.h, was generated automatically by "yap -L misc/buildheap"
please do not update, update misc/GLOBALS instead */

View File

@ -1,4 +1,8 @@
/* This file, rhstruct.h, was generated automatically by "yap -L misc/buildheap"
please do not update, update misc/HEAPFIELDS instead */

View File

@ -1,3 +1,7 @@
/* This file, tatoms.h, was generated automatically by "yap -L misc/buildatoms"
please do not update, update misc/ATOMS instead */
Atom Atom3Dots_;
#define Atom3Dots Yap_heap_regs->Atom3Dots_
Atom AtomAbol_;

View File

@ -9113,14 +9113,24 @@ For every line @var{LineIn} in stream @var{StreamInp}, execute
stream @var{StreamOut}.
@item file_filter(+@var{FileIn}, +@var{FileOut}, +@var{Goal})
@findex filter/3
@snindex filter/3
@cnindex filter/3
@findex file_filter/3
@snindex file_filter/3
@cnindex file_filter/3
For every line @var{LineIn} in file @var{FileIn}, execute
@code{call(Goal,LineIn,LineOut)}, and output @var{LineOut} to file
@var{FileOut}.
@item file_filter(+@var{FileIn}, +@var{FileOut}, +@var{Goal},
+@var{FormatCommand}, +@var{Arguments})
@findex file_filter_with_init/5
@snindex file_filter_with_init/5
@cnindex file_filter_with_init/5
Same as @code{file_filter/3}, but before starting the filter execute
@code{format/3} on the output stream, using @var{FormatCommand} and
@var{Arguments}.
@end table

View File

@ -11,10 +11,11 @@
copy_line/2,
filter/3,
file_filter/3,
file_filter_with_init/5,
process/2
]).
:- meta_predicate filter(+,+,:), file_filter(+,+,:), process(+,:).
:- meta_predicate filter(+,+,:), file_filter(+,+,:), file_filter_with_init(+,+,:,+,:), process(+,:).
:- use_module(library(lists),
[member/2,
@ -137,4 +138,12 @@ file_filter(Inp, Out, Command) :-
close(StreamInp),
close(StreamOut).
file_filter_with_init(Inp, Out, Command, FormatString, Parameters) :-
open(Inp, read, StreamInp),
open(Out, write, StreamOut),
format(StreamOut, FormatString, Parameters),
filter(StreamInp, StreamOut, Command),
close(StreamInp),
close(StreamOut).

View File

@ -1,6 +1,6 @@
:- use_module(library(lineutils),
[file_filter/3,
[file_filter_with_init/5,
split/3]).
:- use_module(library(lists),
@ -11,11 +11,13 @@
:- yap_flag(write_strings,on).
main :-
file_filter('misc/ATOMS','H/tatoms.h',gen_fields),
file_filter('misc/ATOMS','H/iatoms.h',gen_decl),
file_filter('misc/ATOMS','H/ratoms.h',gen_rcov).
% file_filter('misc/ATOMS','packages/PLStream/natoms.h',gen_swiatoms).
warning(Warning),
file_filter_with_init('misc/ATOMS','H/tatoms.h',gen_fields, Warning, ['tatoms.h']),
file_filter_with_init('misc/ATOMS','H/iatoms.h',gen_decl, Warning, ['iatoms.h']),
file_filter_with_init('misc/ATOMS','H/ratoms.h',gen_rcov, Warning, ['ratoms.h']).
% file_filter_with_init('misc/ATOMS','packages/PLStream/natoms.h', gen_swiatoms, Warning, ['natoms.h']).
warning('~n /* This file, ~a, was generated automatically by \"yap -L misc/buildatoms\"~n please do not update, update misc/ATOMS instead */~n~n').
gen_fields(Inp,Out) :-
split(Inp," ",["A",Atom,_,_]), !,

View File

@ -1,6 +1,6 @@
:- use_module(library(lineutils),
[file_filter/3,
[file_filter_with_init/5,
split/3,
glue/3]).
@ -17,15 +17,18 @@
:- style_check(all).
main :-
file_filter('misc/HEAPFIELDS','H/hstruct.h',gen_struct),
file_filter('misc/HEAPFIELDS','H/dhstruct.h',gen_dstruct),
file_filter('misc/HEAPFIELDS','H/rhstruct.h',gen_hstruct),
file_filter('misc/HEAPFIELDS','H/ihstruct.h',gen_init),
file_filter('misc/GLOBALS','H/hglobals.h',gen_struct),
file_filter('misc/GLOBALS','H/dglobals.h',gen_dstruct),
file_filter('misc/GLOBALS','H/rglobals.h',gen_hstruct),
file_filter('misc/GLOBALS','H/iglobals.h',gen_init).
warning(Warning),
file_filter_with_init('misc/HEAPFIELDS','H/hstruct.h',gen_struct,Warning,['hstruct.h','HEAPFIELDS']),
file_filter_with_init('misc/HEAPFIELDS','H/dhstruct.h',gen_dstruct,Warning,['dhstruct.h','HEAPFIELDS']),
file_filter_with_init('misc/HEAPFIELDS','H/rhstruct.h',gen_hstruct,Warning,['rhstruct.h','HEAPFIELDS']),
file_filter_with_init('misc/HEAPFIELDS','H/ihstruct.h',gen_init,Warning,['ihstruct.h','HEAPFIELDS']),
file_filter_with_init('misc/GLOBALS','H/hglobals.h',gen_struct,Warning,['hglobals.h','GLOBALS']),
file_filter_with_init('misc/GLOBALS','H/dglobals.h',gen_dstruct,Warning,['dglobals.h','GLOBALS']),
file_filter_with_init('misc/GLOBALS','H/rglobals.h',gen_hstruct,Warning,['rglobals.h','GLOBALS']),
file_filter_with_init('misc/GLOBALS','H/iglobals.h',gen_init,Warning,['iglobals.h','GLOBALS']).
warning('~n /* This file, ~a, was generated automatically by \"yap -L misc/buildheap\"~n please do not update, update misc/~a instead */~n~n').
/* define the field */

@ -1 +1 @@
Subproject commit 9efaf4ce7063fbdae534b4555a80fa1373bb7e9a
Subproject commit 3823a8b909e99c8f0a581d14c9505a4fbd9a2853