Skip to content

Commit

Permalink
Removes needless linking on hklmath
Browse files Browse the repository at this point in the history
  • Loading branch information
lavignes committed Dec 4, 2012
1 parent 3b8e72c commit 4b1e19a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ statement/hklr_statement_while.c \
linenoise/linenoise.c

math_SOURCES = module/math.c
math_SOURCES += hklr.c hkl_value.c hklr_expression.c
math_SOURCES += hkl_value.c
math_LDFLAGS = -shared -nostartfiles
math_LDADD = -lm
math_CFLAGS = $(AM_CFLAGS)
math_CFLAGS += -fPIC


math_CFLAGS += -fPIC
Binary file modified src/math
Binary file not shown.
10 changes: 9 additions & 1 deletion src/module/math.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <math.h>

#include "hkl_value.h"
#include "hklr_expression.h"

double hklapi_PI = 3.1415926;
double hklapi_TAU = 2.0*3.1415926;
Expand Down Expand Up @@ -58,6 +57,15 @@ HklValue* hklapi_log10(HklList* args) {
return hkl_value_new(HKL_TYPE_REAL, log10(d));
}

HklValue* hklapi_sqrt(HklList* args) {

HklValue* value = args->head->data;
double d = value->as.real;
hkl_value_free(value);

return hkl_value_new(HKL_TYPE_REAL, sqrt(d));
}

HklValue* hklapi_pow(HklList* args) {

HklValue* value = args->head->data;
Expand Down
1 change: 1 addition & 0 deletions src/module/math.hkl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Math = interface "src/math"
tan: cfunc
log: cfunc
log10: cfunc
sqrt: cfunc
pow: cfunc

end

0 comments on commit 4b1e19a

Please sign in to comment.