Skip to content

Commit 7c4179a

Browse files
committed
Rename clause cost tot totcost
This makes greps simpler.
1 parent 4672e07 commit 7c4179a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

link-grammar/prepare/build-disjuncts.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ typedef struct clause_struct Clause;
3333
struct clause_struct
3434
{
3535
Clause * next;
36-
float cost;
36+
float totcost;
3737
float maxcost;
3838
Tconnector * c;
3939
};
@@ -138,7 +138,7 @@ static Clause * build_clause(Exp *e, clause_context *ct, Clause **c_last)
138138
Clause *c1 = pool_alloc(ct->Clause_pool);
139139
c1->c = NULL;
140140
c1->next = NULL;
141-
c1->cost = 0.0;
141+
c1->totcost = 0.0;
142142
c1->maxcost = 0.0;
143143
for (Exp *opd = e->operand_first; opd != NULL; opd = opd->operand_next)
144144
{
@@ -154,7 +154,7 @@ static Clause * build_clause(Exp *e, clause_context *ct, Clause **c_last)
154154

155155
Clause *c5 = pool_alloc(ct->Clause_pool);
156156
if ((c_head == NULL) && (c_last != NULL)) *c_last = c5;
157-
c5->cost = c3->cost + c4->cost;
157+
c5->totcost = c3->totcost + c4->totcost;
158158
c5->maxcost = maxcost;
159159
c5->c = catenate(c4->c, c3->c, ct->Tconnector_pool);
160160
c5->next = c_head;
@@ -191,7 +191,7 @@ static Clause * build_clause(Exp *e, clause_context *ct, Clause **c_last)
191191
{
192192
c = pool_alloc(ct->Clause_pool);
193193
c->c = build_terminal(e, ct);
194-
c->cost = 0.0;
194+
c->totcost = 0.0;
195195
c->maxcost = 0.0;
196196
c->next = NULL;
197197
if (c_last != NULL) *c_last = c;
@@ -204,7 +204,7 @@ static Clause * build_clause(Exp *e, clause_context *ct, Clause **c_last)
204204
/* c now points to the list of clauses */
205205
for (Clause *c1 = c; c1 != NULL; c1 = c1->next)
206206
{
207-
c1->cost += e->cost;
207+
c1->totcost += e->cost;
208208
/* c1->maxcost = MAX(c1->maxcost,e->cost); */
209209
/* Above is how Dennis had it. Someone changed it to below.
210210
* However, this can sometimes lead to a maxcost that is less
@@ -286,7 +286,7 @@ build_disjunct(Sentence sent, Clause * cl, const char * string,
286286
if (sat_solver || (!IS_GENERATION(sent->dict) || (' ' != string[0])))
287287
{
288288
ndis->word_string = string;
289-
ndis->cost = cl->cost;
289+
ndis->cost = cl->totcost;
290290
ndis->is_category = 0;
291291
}
292292
else
@@ -300,8 +300,8 @@ build_disjunct(Sentence sent, Clause * cl, const char * string,
300300
assert(sat_solver || ((ndis->category[0].num > 0) &&
301301
(ndis->category[0].num < 64*1024)),
302302
"Insane category %u", ndis->category[0].num);
303-
ndis->category[0].cost = cl->cost;
304-
// ndis->cost = cl->cost; No! clobbers memory!
303+
ndis->category[0].cost = cl->totcost;
304+
// ndis->cost = cl->totcost; No! clobbers memory!
305305
}
306306

307307
ndis->originating_gword = (gword_set*)gs; /* XXX remove constness */
@@ -364,7 +364,7 @@ GNUC_UNUSED static void print_clause_list(Clause * c)
364364
{
365365
for (;c != NULL; c=c->next) {
366366
printf(" Clause: ");
367-
printf("(%4.2f, %4.2f) ", c->cost, c->maxcost);
367+
printf("(%4.2f, %4.2f) ", c->totcost, c->maxcost);
368368
print_Tconnector_list(c->c);
369369
printf("\n");
370370
}

0 commit comments

Comments
 (0)