1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-28 17:30:31 +00:00

Fix string/number issue.

This commit is contained in:
Calvin Rose 2018-12-22 16:24:08 -05:00
parent 02673dd791
commit 9723ddb96b
6 changed files with 20 additions and 17 deletions

1
.gitignore vendored
View File

@ -10,6 +10,7 @@ janet
/Emscripten
/src/include/generated/*.h
janet-*.tar.gz
dist
# Emscripten
*.bc

View File

@ -157,7 +157,7 @@ dist: build/janet-dist.tar.gz
build/janet-%.tar.gz: $(JANET_TARGET) src/include/janet/janet.h \
janet.1 LICENSE CONTRIBUTING.md $(JANET_LIBRARY) \
build/doc.html README.md $(wildcard doc/*)
build/doc.html README.md $(wildcard doc/*.md)
tar -czvf $@ $^
#########################

View File

@ -21,6 +21,8 @@ install:
- build_win
- build_win test
- build_win dist
- choco install nsis -y -pre
- call "C:\Program Files (x86)\NSIS\makensis.exe" janet-installer.nsi
build: off

View File

@ -100,7 +100,6 @@ copy README.md dist\README.md
copy janet.lib dist\janet.lib
copy janet.exp dist\janet.exp
copy src\include\janet\janet.h dist\janet.h
xcopy /s doc dist\doc
exit /b 0
:TESTFAIL

View File

@ -6,7 +6,7 @@
!include "MUI2.nsh"
Name "Janet"
OutFile "janet.exe"
OutFile "janet-install.exe"
!define MUI_ABORTWARNING

View File

@ -1158,8 +1158,8 @@ JANET_API int janet_typeabstract_err(JanetArgs args, int32_t n, const JanetAbstr
} while (0)
#define JANET_CHECKMANY(A, N, TS) do {\
if ((A).n > (N)) {\
JanetType t = janet_type((A).v[(N)]);\
if (!((1 << t) & (TS))) return janet_typemany_err(A, N, TS);\
JanetType _t_ = janet_type((A).v[(N)]);\
if (!((1 << _t_) & (TS))) return janet_typemany_err(A, N, TS);\
} else {\
if (!((TS) & JANET_NIL)) return janet_typemany_err(A, N, TS);\
}\
@ -1167,9 +1167,9 @@ JANET_API int janet_typeabstract_err(JanetArgs args, int32_t n, const JanetAbstr
#define JANET_CHECKABSTRACT(A, N, AT) do {\
if ((A).n > (N)) {\
Janet x = (A).v[(N)];\
if (!janet_checktype(x, JANET_ABSTRACT) ||\
janet_abstract_type(janet_unwrap_abstract(x)) != (AT))\
Janet _x_ = (A).v[(N)];\
if (!janet_checktype(_x_, JANET_ABSTRACT) ||\
janet_abstract_type(janet_unwrap_abstract(_x_)) != (AT))\
return janet_typeabstract_err(A, N, AT);\
} else {\
return janet_typeabstract_err(A, N, AT);\
@ -1177,15 +1177,16 @@ JANET_API int janet_typeabstract_err(JanetArgs args, int32_t n, const JanetAbstr
} while (0)
#define JANET_ARG_NUMBER(DEST, A, N) do { \
if ((A).n <= (N)) \
return janet_typemany_err(A, N, JANET_TFLAG_NUMBER);\
Janet val = (A).v[(N)];\
if (janet_checktype(val, JANET_REAL)) { \
DEST = janet_unwrap_real(val); \
} else if (janet_checktype(val, JANET_INTEGER)) {\
DEST = (double) janet_unwrap_integer(val);\
}\
else return janet_typemany_err(A, N, JANET_TFLAG_NUMBER); \
if ((A).n <= (N)) return janet_typemany_err(A, N, JANET_TFLAG_NUMBER); \
Janet _val_ = (A).v[(N)];\
JanetType _type_ = janet_type(_val_); \
if (_type_ == JANET_REAL) { \
DEST = janet_unwrap_real(_val_); \
} else if (_type_ == JANET_INTEGER) {\
DEST = (double) janet_unwrap_integer(_val_);\
} else { \
return janet_typemany_err(A, N, JANET_TFLAG_NUMBER); \
} \
} while (0)
#define JANET_ARG_BOOLEAN(DEST, A, N) do { \