forked from GitHub/gf-core
Merge branch 'majestic' of github.com:GrammaticalFramework/gf-core into majestic
This commit is contained in:
@@ -1559,8 +1559,8 @@ void PgfDB::commit(object o)
|
|||||||
object save_free_descriptors = ms->free_descriptors;
|
object save_free_descriptors = ms->free_descriptors;
|
||||||
object save_active_revision = ms->active_revision;
|
object save_active_revision = ms->active_revision;
|
||||||
|
|
||||||
int res;
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
int res;
|
||||||
#ifndef MREMAP_MAYMOVE
|
#ifndef MREMAP_MAYMOVE
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
ms->active_revision = o;
|
ms->active_revision = o;
|
||||||
|
|||||||
@@ -989,4 +989,4 @@ PgfExpr PgfParser::fetch(PgfDB *db, prob_t *prob)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -864,7 +864,7 @@ pgf_graphviz_word_alignment(PgfDB *db, PgfConcrRevision* revisions, size_t n_rev
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PgfText *phrase;
|
PgfText *phrase;
|
||||||
int n_fids;
|
size_t n_fids;
|
||||||
int fids[];
|
int fids[];
|
||||||
} PgfAlignmentPhrase;
|
} PgfAlignmentPhrase;
|
||||||
|
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ bool probspace_random(PgfProbspace space, PgfText *cat,
|
|||||||
|
|
||||||
bool is_res = space->value.is_result();
|
bool is_res = space->value.is_result();
|
||||||
if (is_res && !st->excluded.count(space->value.fun)) {
|
if (is_res && !st->excluded.count(space->value.fun)) {
|
||||||
st->rand -= exp(-space->value.fun->prob);
|
st->rand -= expf(-space->value.fun->prob);
|
||||||
st->result = space->value.fun;
|
st->result = space->value.fun;
|
||||||
if (st->rand <= 0)
|
if (st->rand <= 0)
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ prob_t PgfReader::read_prob(PgfText *name)
|
|||||||
if (probs_callback != NULL) {
|
if (probs_callback != NULL) {
|
||||||
d = probs_callback->fn(probs_callback, name);
|
d = probs_callback->fn(probs_callback, name);
|
||||||
}
|
}
|
||||||
return - log(d);
|
return - logf(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t PgfReader::read_uint()
|
uint64_t PgfReader::read_uint()
|
||||||
@@ -458,7 +458,7 @@ void PgfReader::read_abstract(ref<PgfAbstr> abstract)
|
|||||||
|
|
||||||
for (size_t i = 0; i < itor.cats->len; i++) {
|
for (size_t i = 0; i < itor.cats->len; i++) {
|
||||||
PgfAbsCatCounts *counts = &itor.cats->data[i];
|
PgfAbsCatCounts *counts = &itor.cats->data[i];
|
||||||
counts->prob = - log((1-counts->probs_sum) / counts->n_nan_probs);
|
counts->prob = - logf((1-counts->probs_sum) / counts->n_nan_probs);
|
||||||
}
|
}
|
||||||
|
|
||||||
itor.fn = pad_probs;
|
itor.fn = pad_probs;
|
||||||
|
|||||||
@@ -501,7 +501,7 @@ alignWords c e = unsafePerformIO $
|
|||||||
c_phrase <- (#peek PgfAlignmentPhrase, phrase) ptr
|
c_phrase <- (#peek PgfAlignmentPhrase, phrase) ptr
|
||||||
phrase <- peekText c_phrase
|
phrase <- peekText c_phrase
|
||||||
n_fids <- (#peek PgfAlignmentPhrase, n_fids) ptr
|
n_fids <- (#peek PgfAlignmentPhrase, n_fids) ptr
|
||||||
(fids :: [CInt]) <- peekArray (fromIntegral (n_fids :: CInt)) (ptr `plusPtr` (#offset PgfAlignmentPhrase, fids))
|
(fids :: [CInt]) <- peekArray (fromIntegral (n_fids :: CSize)) (ptr `plusPtr` (#offset PgfAlignmentPhrase, fids))
|
||||||
free c_phrase
|
free c_phrase
|
||||||
free ptr
|
free ptr
|
||||||
return (phrase, map fromIntegral fids)
|
return (phrase, map fromIntegral fids)
|
||||||
|
|||||||
@@ -517,7 +517,7 @@ match_lit(PgfMarshaller *this, PgfUnmarshaller *u, PgfLiteral lit)
|
|||||||
Py_DECREF(intShifter);
|
Py_DECREF(intShifter);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
for (int n = size-1; n > 0; n--) {
|
for (size_t n = size-1; n > 0; n--) {
|
||||||
PyObject *rem = PyNumber_Remainder(x, intShifter);
|
PyObject *rem = PyNumber_Remainder(x, intShifter);
|
||||||
if (!rem) {
|
if (!rem) {
|
||||||
PyMem_RawFree(i);
|
PyMem_RawFree(i);
|
||||||
|
|||||||
Reference in New Issue
Block a user