Skip to content

Commit 4553bde

Browse files
committed
re indent -kr
1 parent 063a30b commit 4553bde

4 files changed

Lines changed: 54 additions & 54 deletions

File tree

clp.c

Lines changed: 35 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ int b_constraint_var(int arglist, int rest, int th)
6262
fd_max[fd_var_max] = max;
6363
fd_len[fd_var_max] = max - min;
6464
fd_var_max++;
65-
if(fd_var_max > 32)
66-
exception(SYSTEM_ERR,ind,arglist,th);
65+
if (fd_var_max > 32)
66+
exception(SYSTEM_ERR, ind, arglist, th);
6767
return (prove_all(rest, sp[th], th));
6868
}
6969
exception(ARITY_ERR, ind, arglist, th);
@@ -92,8 +92,8 @@ int b_constraint_vars(int arglist, int rest, int th)
9292
fd_max[fd_var_max] = max;
9393
fd_len[fd_var_max] = max - min;
9494
fd_var_max++;
95-
if(fd_var_max > 32)
96-
exception(SYSTEM_ERR,ind,arglist,th);
95+
if (fd_var_max > 32)
96+
exception(SYSTEM_ERR, ind, arglist, th);
9797
arg1 = cdr(arg1);
9898
}
9999
return (prove_all(rest, sp[th], th));
@@ -558,43 +558,40 @@ int in_interval(int value, int range)
558558

559559
int in_greater(int value, int range)
560560
{
561-
if (car(range) <= car(value)+1
562-
&& (cadr(range) >= car(value)+1))
561+
if (car(range) <= car(value) + 1 && (cadr(range) >= car(value) + 1))
563562
return (1);
564563
else
565564
return (0);
566565
}
567566

568567
int in_eqgreater(int value, int range)
569568
{
570-
if (car(range) <= car(value)+1
571-
&& (cadr(range) >= car(value)+1)){
572-
return (1);}
573-
else if (car(range) <= car(value)
574-
&& (cadr(range) >= car(value))){
575-
return (1);}
576-
else
569+
if (car(range) <= car(value) + 1 && (cadr(range) >= car(value) + 1)) {
570+
return (1);
571+
} else if (car(range) <= car(value)
572+
&& (cadr(range) >= car(value))) {
573+
return (1);
574+
} else
577575
return (0);
578576
}
579577

580578
int in_smaller(int value, int range)
581579
{
582-
if (car(range) <= car(value)-1
583-
&& (cadr(range) >= car(value)-1))
580+
if (car(range) <= car(value) - 1 && (cadr(range) >= car(value) - 1))
584581
return (1);
585582
else
586583
return (0);
587584
}
588585

589586
int in_eqsmaller(int value, int range)
590587
{
591-
if (car(range) <= car(value)-1
592-
&& (cadr(range) >= car(value)-1)){
593-
return (1);}
594-
if (car(range) <= car(value)
595-
&& (cadr(range) >= car(value))){
596-
return (1);}
597-
else
588+
if (car(range) <= car(value) - 1 && (cadr(range) >= car(value) - 1)) {
589+
return (1);
590+
}
591+
if (car(range) <= car(value)
592+
&& (cadr(range) >= car(value))) {
593+
return (1);
594+
} else
598595
return (0);
599596
}
600597

@@ -825,8 +822,9 @@ void fd_enqueue(int x)
825822
fd_queue[fd_enque_idx] = x;
826823
fd_enque_idx++;
827824

828-
if(fd_enque_idx > 2048)
829-
exception(SYSTEM_ERR,makestr("fd_enque"),makeint(fd_enque_idx),0);
825+
if (fd_enque_idx > 2048)
826+
exception(SYSTEM_ERR, makestr("fd_enque"), makeint(fd_enque_idx),
827+
0);
830828
}
831829

832830
int fd_dequeue()
@@ -1018,7 +1016,7 @@ void fd_consistent1(int expr, int idx1, int idx2, int flag)
10181016
return;
10191017
}
10201018
} else if (length(left) == 2 && length(right) == 1) {
1021-
if (in_smaller(right,left)) {
1019+
if (in_smaller(right, left)) {
10221020
if (flag == 1) {
10231021
fd_add_removed(idx1, fd_domain[idx1]);
10241022
}
@@ -1058,7 +1056,7 @@ void fd_consistent1(int expr, int idx1, int idx2, int flag)
10581056
return;
10591057
}
10601058
} else if (length(left) == 2 && length(right) == 1) {
1061-
if (in_eqsmaller(right,left)) {
1059+
if (in_eqsmaller(right, left)) {
10621060
if (flag == 1) {
10631061
fd_add_removed(idx1, fd_domain[idx1]);
10641062
}
@@ -1098,7 +1096,7 @@ void fd_consistent1(int expr, int idx1, int idx2, int flag)
10981096
return;
10991097
}
11001098
} else if (length(left) == 2 && length(right) == 1) {
1101-
if (in_greater(right,left)) {
1099+
if (in_greater(right, left)) {
11021100
if (flag == 1) {
11031101
fd_add_removed(idx1, fd_domain[idx1]);
11041102
}
@@ -1138,7 +1136,7 @@ void fd_consistent1(int expr, int idx1, int idx2, int flag)
11381136
return;
11391137
}
11401138
} else if (length(left) == 2 && length(right) == 1) {
1141-
if (in_eqgreater(right,left)) {
1139+
if (in_eqgreater(right, left)) {
11421140
if (flag == 1) {
11431141
fd_add_removed(idx1, fd_domain[idx1]);
11441142
}
@@ -1187,20 +1185,20 @@ void fd_consistent(int c)
11871185
idx1 = GET_ARITY(var1);
11881186
idx2 = GET_ARITY(var2);
11891187
len = fd_len[idx1];
1190-
fd_rem_sw = 0;
1188+
fd_rem_sw = 0;
11911189
for (i = 0; i <= len; i++) {
11921190
fd_domain[idx1] = i;
11931191
fd_consistent1(expr, idx1, idx2, 0);
11941192
}
11951193
fd_domain[idx1] = UNBOUND;
1196-
// for retest consistency for removed variable, enqueue arcs
1197-
if(fd_rem_sw == 1)
1198-
fd_enqueue_affected_arcs(idx1);
1199-
1200-
/* in future implement
1201-
if(fd_rem_sw == 0)
1202-
fd_heuristic(expr,idx1,idx2);
1203-
*/
1194+
// for retest consistency for removed variable, enqueue arcs
1195+
if (fd_rem_sw == 1)
1196+
fd_enqueue_affected_arcs(idx1);
1197+
1198+
/* in future implement
1199+
if(fd_rem_sw == 0)
1200+
fd_heuristic(expr,idx1,idx2);
1201+
*/
12041202
}
12051203

12061204
int fd_empty()

extension.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -990,8 +990,9 @@ int exec_all(int goals, int bindings, int th)
990990
else
991991
return (NO);
992992
}
993-
/* ((D1,D2),Xs) */
994-
else if (structurep(goals) && car(goals) == AND && car(cadr(goals)) == AND) {
993+
/* ((D1,D2),Xs) */
994+
else if (structurep(goals) && car(goals) == AND
995+
&& car(cadr(goals)) == AND) {
995996
if (exec_all(cadr(goals), bindings, th) == YES)
996997
return (exec_all(caddr(goals), bindings, th));
997998
else

link.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
#include "npl.h"
55

66

7-
typedef void (*tpred)(char *, int(*pred)(int, int));
8-
typedef void (*tuser)(char *, int(*user)(int, int), int weight, int spec);
7+
typedef void (*tpred)(char *, int (*pred)(int, int));
8+
typedef void (*tuser)(char *, int (*user)(int, int), int weight, int spec);
99

1010

1111
char *get_name(int x)

main.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -671,12 +671,14 @@ int prove(int goal, int bindings, int rest, int th)
671671
prove_trace(DBCALL, goal, bindings, rest, th);
672672

673673
if (atomp(goal)) {
674-
clauses = GET_CAR(goal);
674+
clauses = GET_CAR(goal);
675675
if (clauses != NIL && !memberp(makeint(0), GET_ARITY(goal)))
676676
exception(ARITY_ERR, makestr("prove"), goal, th);
677677
} else {
678-
clauses = GET_CAR(car(goal));
679-
if (clauses != NIL && !memberp(makeint(length(cdr(goal))), GET_ARITY(car(goal))))
678+
clauses = GET_CAR(car(goal));
679+
if (clauses != NIL
680+
&& !memberp(makeint(length(cdr(goal))),
681+
GET_ARITY(car(goal))))
680682
exception(ARITY_ERR, makestr("prove"), goal, th);
681683
}
682684

@@ -1294,7 +1296,7 @@ void print(int addr)
12941296
}
12951297
return;
12961298
}
1297-
switch (GET_TAG(addr)) {
1299+
switch (GET_TAG(addr)) {
12981300
case INTN:
12991301
if (!bridge_flag)
13001302
fprintf(GET_PORT(output_stream), "%d", GET_INT(addr));
@@ -1644,14 +1646,13 @@ void printinfix(int addr)
16441646
printc('(');
16451647
print(cadr(addr));
16461648
printc(')');
1647-
} else{
1648-
if(structurep(cadr(addr)) && car(cadr(addr)) == AND){
1649-
printc('(');
1650-
print(cadr(addr));
1651-
printc(')');
1652-
}
1653-
else
1654-
print(cadr(addr));
1649+
} else {
1650+
if (structurep(cadr(addr)) && car(cadr(addr)) == AND) {
1651+
printc('(');
1652+
print(cadr(addr));
1653+
printc(')');
1654+
} else
1655+
print(cadr(addr));
16551656
}
16561657

16571658
print(car(addr));
@@ -1677,8 +1678,8 @@ void printinfix(int addr)
16771678
print(caddr(addr));
16781679
} else {
16791680
print(caddr(addr));
1680-
}
16811681
}
1682+
}
16821683
}
16831684

16841685

0 commit comments

Comments
 (0)