mirror of
https://github.com/janet-lang/janet
synced 2025-08-29 17:08:03 +00:00
Merge branch 'master' of https://github.com/janet-lang/janet
This commit is contained in:
@@ -1,217 +0,0 @@
|
|||||||
# This file is invoked by build_win.bat
|
|
||||||
# Relevant configuration variables are set there.
|
|
||||||
|
|
||||||
SetCompressor /FINAL /SOLID lzma
|
|
||||||
Unicode True
|
|
||||||
|
|
||||||
!echo "Program Files: ${PROGRAMFILES}"
|
|
||||||
!addplugindir "tools\"
|
|
||||||
|
|
||||||
# Version
|
|
||||||
!define PRODUCT_VERSION "${VERSION}.0"
|
|
||||||
VIProductVersion "${PRODUCT_VERSION}"
|
|
||||||
VIFileVersion "${PRODUCT_VERSION}"
|
|
||||||
|
|
||||||
# Use the modern UI
|
|
||||||
!define MULTIUSER_EXECUTIONLEVEL Highest
|
|
||||||
!define MULTIUSER_MUI
|
|
||||||
!define MULTIUSER_INSTALLMODE_COMMANDLINE
|
|
||||||
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY "Software\Janet\${VERSION}"
|
|
||||||
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME ""
|
|
||||||
!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY "Software\Janet\${VERSION}"
|
|
||||||
!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME ""
|
|
||||||
!define MULTIUSER_INSTALLMODE_INSTDIR "Janet-${VERSION}"
|
|
||||||
|
|
||||||
!if ${SIXTYFOUR} == "true"
|
|
||||||
!define MULTIUSER_USE_PROGRAMFILES64
|
|
||||||
!define PLATNAME "x64"
|
|
||||||
!else
|
|
||||||
!define PLATNAME "x86"
|
|
||||||
!endif
|
|
||||||
|
|
||||||
# Includes
|
|
||||||
!include "MultiUser.nsh"
|
|
||||||
!include "MUI2.nsh"
|
|
||||||
!include "LogicLib.nsh"
|
|
||||||
|
|
||||||
# Basics
|
|
||||||
Name "Janet"
|
|
||||||
|
|
||||||
# Do some NSIS-fu to figure out at compile time if we are in appveyor
|
|
||||||
!define OUTNAME $%APPVEYOR_REPO_TAG_NAME%
|
|
||||||
!define "CHECK_${OUTNAME}"
|
|
||||||
!define DOLLAR "$"
|
|
||||||
!ifdef CHECK_${DOLLAR}%APPVEYOR_REPO_TAG_NAME%
|
|
||||||
# We are not in the appveyor environment, use version name
|
|
||||||
!define OUTNAME_PART ${VERSION}
|
|
||||||
!else
|
|
||||||
# We are in appveyor, use git tag name for installer
|
|
||||||
!define OUTNAME_PART ${OUTNAME}
|
|
||||||
!endif
|
|
||||||
OutFile "janet-${OUTNAME_PART}-windows-${PLATNAME}-installer.exe"
|
|
||||||
|
|
||||||
# Some Configuration
|
|
||||||
!define APPNAME "Janet"
|
|
||||||
!define DESCRIPTION "The Janet Programming Language"
|
|
||||||
!define HELPURL "http://janet-lang.org"
|
|
||||||
BrandingText "The Janet Programming Language"
|
|
||||||
|
|
||||||
# Macros for setting registry values
|
|
||||||
!define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\Janet-${VERSION}"
|
|
||||||
!macro WriteEnv key value
|
|
||||||
${If} $MultiUser.InstallMode == "AllUsers"
|
|
||||||
WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "${key}" "${value}"
|
|
||||||
${Else}
|
|
||||||
WriteRegExpandStr HKCU "Environment" "${key}" "${value}"
|
|
||||||
${EndIf}
|
|
||||||
!macroend
|
|
||||||
!macro DelEnv key
|
|
||||||
${If} $MultiUser.InstallMode == "AllUsers"
|
|
||||||
DeleteRegValue HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "${key}"
|
|
||||||
${Else}
|
|
||||||
DeleteRegValue HKCU "Environment" "${key}"
|
|
||||||
${EndIf}
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
# MUI Configuration
|
|
||||||
!define MUI_ICON "assets\icon.ico"
|
|
||||||
!define MUI_UNICON "assets\icon.ico"
|
|
||||||
!define MUI_HEADERIMAGE
|
|
||||||
!define MUI_HEADERIMAGE_BITMAP "assets\janet-w200.png"
|
|
||||||
!define MUI_HEADERIMAGE_RIGHT
|
|
||||||
!define MUI_ABORTWARNING
|
|
||||||
|
|
||||||
# Show a welcome page first
|
|
||||||
!insertmacro MUI_PAGE_WELCOME
|
|
||||||
!insertmacro MUI_PAGE_LICENSE "LICENSE"
|
|
||||||
|
|
||||||
# Pick Install Directory
|
|
||||||
!insertmacro MULTIUSER_PAGE_INSTALLMODE
|
|
||||||
!insertmacro MUI_PAGE_DIRECTORY
|
|
||||||
!insertmacro MUI_PAGE_INSTFILES
|
|
||||||
|
|
||||||
# Done
|
|
||||||
!insertmacro MUI_PAGE_FINISH
|
|
||||||
|
|
||||||
# Need to set a language.
|
|
||||||
!insertmacro MUI_LANGUAGE "English"
|
|
||||||
|
|
||||||
function .onInit
|
|
||||||
!insertmacro MULTIUSER_INIT
|
|
||||||
functionEnd
|
|
||||||
|
|
||||||
section "Janet" BfWSection
|
|
||||||
|
|
||||||
createDirectory "$INSTDIR\Library"
|
|
||||||
createDirectory "$INSTDIR\C"
|
|
||||||
createDirectory "$INSTDIR\bin"
|
|
||||||
createDirectory "$INSTDIR\docs"
|
|
||||||
setOutPath "$INSTDIR"
|
|
||||||
|
|
||||||
# Bin files
|
|
||||||
file /oname=bin\janet.exe dist\janet.exe
|
|
||||||
file /oname=logo.ico assets\icon.ico
|
|
||||||
file /oname=bin\jpm.janet .\jpm
|
|
||||||
file /oname=bin\jpm.bat tools\jpm.bat
|
|
||||||
|
|
||||||
# C headers and library files
|
|
||||||
file /oname=C\janet.h dist\janet.h
|
|
||||||
file /oname=C\janetconf.h dist\janetconf.h
|
|
||||||
file /oname=C\janet.lib dist\janet.lib
|
|
||||||
file /oname=C\janet.exp dist\janet.exp
|
|
||||||
file /oname=C\janet.c dist\janet.c
|
|
||||||
file /oname=C\libjanet.lib dist\libjanet.lib
|
|
||||||
|
|
||||||
# Documentation
|
|
||||||
file /oname=docs\docs.html dist\doc.html
|
|
||||||
|
|
||||||
# Other
|
|
||||||
file README.md
|
|
||||||
file LICENSE
|
|
||||||
|
|
||||||
# Uninstaller - See function un.onInit and section "uninstall" for configuration
|
|
||||||
writeUninstaller "$INSTDIR\uninstall.exe"
|
|
||||||
|
|
||||||
# Start Menu
|
|
||||||
createShortCut "$SMPROGRAMS\Janet.lnk" "$INSTDIR\bin\janet.exe" "" "$INSTDIR\logo.ico"
|
|
||||||
|
|
||||||
# Update path
|
|
||||||
${If} $MultiUser.InstallMode == "AllUsers"
|
|
||||||
EnVar::SetHKLM
|
|
||||||
${Else}
|
|
||||||
EnVar::SetHKCU
|
|
||||||
${EndIf}
|
|
||||||
EnVar::AddValue "PATH" "$INSTDIR\bin"
|
|
||||||
Pop $0
|
|
||||||
|
|
||||||
# Set up Environment variables
|
|
||||||
!insertmacro WriteEnv JANET_PATH "$INSTDIR\Library"
|
|
||||||
!insertmacro WriteEnv JANET_HEADERPATH "$INSTDIR\C"
|
|
||||||
!insertmacro WriteEnv JANET_LIBPATH "$INSTDIR\C"
|
|
||||||
!insertmacro WriteEnv JANET_BINPATH "$INSTDIR\bin"
|
|
||||||
|
|
||||||
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
|
|
||||||
|
|
||||||
# Registry information for add/remove programs
|
|
||||||
WriteRegStr SHCTX "${UNINST_KEY}" "DisplayName" "Janet"
|
|
||||||
WriteRegStr SHCTX "${UNINST_KEY}" "InstallLocation" "$INSTDIR"
|
|
||||||
WriteRegStr SHCTX "${UNINST_KEY}" "DisplayIcon" "$INSTDIR\logo.ico"
|
|
||||||
WriteRegStr SHCTX "${UNINST_KEY}" "Publisher" "Janet-Lang.org"
|
|
||||||
WriteRegStr SHCTX "${UNINST_KEY}" "HelpLink" "${HELPURL}"
|
|
||||||
WriteRegStr SHCTX "${UNINST_KEY}" "URLUpdateInfo" "${HELPURL}"
|
|
||||||
WriteRegStr SHCTX "${UNINST_KEY}" "URLInfoAbout" "${HELPURL}"
|
|
||||||
WriteRegStr SHCTX "${UNINST_KEY}" "DisplayVersion" "${VERSION}"
|
|
||||||
WriteRegDWORD SHCTX "${UNINST_KEY}" "NoModify" 1
|
|
||||||
WriteRegDWORD SHCTX "${UNINST_KEY}" "NoRepair" 1
|
|
||||||
WriteRegDWORD SHCTX "${UNINST_KEY}" "EstimatedSize" 1000
|
|
||||||
# Add uninstall
|
|
||||||
WriteRegStr SHCTX "${UNINST_KEY}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\" /$MultiUser.InstallMode"
|
|
||||||
WriteRegStr SHCTX "${UNINST_KEY}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /$MultiUser.InstallMode /S"
|
|
||||||
|
|
||||||
sectionEnd
|
|
||||||
|
|
||||||
# Uninstaller
|
|
||||||
|
|
||||||
function un.onInit
|
|
||||||
!insertmacro MULTIUSER_UNINIT
|
|
||||||
functionEnd
|
|
||||||
|
|
||||||
section "uninstall"
|
|
||||||
|
|
||||||
# Remove Start Menu launcher
|
|
||||||
delete "$SMPROGRAMS\Janet.lnk"
|
|
||||||
|
|
||||||
# Remove files
|
|
||||||
delete "$INSTDIR\logo.ico"
|
|
||||||
delete "$INSTDIR\README.md"
|
|
||||||
delete "$INSTDIR\LICENSE"
|
|
||||||
rmdir /r "$INSTDIR\Library"
|
|
||||||
rmdir /r "$INSTDIR\bin"
|
|
||||||
rmdir /r "$INSTDIR\C"
|
|
||||||
rmdir /r "$INSTDIR\docs"
|
|
||||||
|
|
||||||
# Remove env vars
|
|
||||||
!insertmacro DelEnv JANET_PATH
|
|
||||||
!insertmacro DelEnv JANET_HEADERPATH
|
|
||||||
!insertmacro DelEnv JANET_LIBPATH
|
|
||||||
!insertmacro DelEnv JANET_BINPATH
|
|
||||||
|
|
||||||
# Unset PATH
|
|
||||||
${If} $MultiUser.InstallMode == "AllUsers"
|
|
||||||
EnVar::SetHKLM
|
|
||||||
${Else}
|
|
||||||
EnVar::SetHKCU
|
|
||||||
${EndIf}
|
|
||||||
EnVar::DeleteValue "PATH" "$INSTDIR\bin"
|
|
||||||
Pop $0
|
|
||||||
|
|
||||||
# make sure windows knows about the change
|
|
||||||
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
|
|
||||||
|
|
||||||
# Always delete uninstaller as the last action
|
|
||||||
delete "$INSTDIR\uninstall.exe"
|
|
||||||
|
|
||||||
# Remove uninstaller information from the registry
|
|
||||||
DeleteRegKey SHCTX "${UNINST_KEY}"
|
|
||||||
|
|
||||||
sectionEnd
|
|
@@ -275,6 +275,24 @@ static void ta_setter(void *p, Janet key, Janet value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Janet ta_view_next(void *p, Janet key) {
|
||||||
|
JanetTArrayView *view = p;
|
||||||
|
if (janet_checktype(key, JANET_NIL)) {
|
||||||
|
if (view->size > 0) {
|
||||||
|
return janet_wrap_number(0);
|
||||||
|
} else {
|
||||||
|
return janet_wrap_nil();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!janet_checksize(key)) janet_panic("expected size as key");
|
||||||
|
size_t index = janet_unwrap_number(key);
|
||||||
|
index++;
|
||||||
|
if (index < view->size) {
|
||||||
|
return janet_wrap_number((double) index);
|
||||||
|
}
|
||||||
|
return janet_wrap_nil();
|
||||||
|
}
|
||||||
|
|
||||||
const JanetAbstractType janet_ta_view_type = {
|
const JanetAbstractType janet_ta_view_type = {
|
||||||
"ta/view",
|
"ta/view",
|
||||||
NULL,
|
NULL,
|
||||||
@@ -283,7 +301,11 @@ const JanetAbstractType janet_ta_view_type = {
|
|||||||
ta_setter,
|
ta_setter,
|
||||||
ta_view_marshal,
|
ta_view_marshal,
|
||||||
ta_view_unmarshal,
|
ta_view_unmarshal,
|
||||||
JANET_ATEND_UNMARSHAL
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
ta_view_next,
|
||||||
|
JANET_ATEND_NEXT
|
||||||
};
|
};
|
||||||
|
|
||||||
JanetTArrayBuffer *janet_tarray_buffer(size_t size) {
|
JanetTArrayBuffer *janet_tarray_buffer(size_t size) {
|
||||||
@@ -364,8 +386,11 @@ static Janet cfun_typed_array_new(int32_t argc, Janet *argv) {
|
|||||||
offset = (view->buffer->data - view->as.u8) + offset * ta_type_sizes[view->type];
|
offset = (view->buffer->data - view->as.u8) + offset * ta_type_sizes[view->type];
|
||||||
stride *= view->stride;
|
stride *= view->stride;
|
||||||
buffer = view->buffer;
|
buffer = view->buffer;
|
||||||
} else {
|
} else if (janet_abstract_type(p) == &janet_ta_buffer_type) {
|
||||||
buffer = p;
|
buffer = p;
|
||||||
|
} else {
|
||||||
|
janet_panicf("bad slot #%d, expected ta/view|ta/buffer, got %v",
|
||||||
|
4, argv[4]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
JanetTArrayView *view = janet_tarray_view(type, size, stride, offset, buffer);
|
JanetTArrayView *view = janet_tarray_view(type, size, stride, offset, buffer);
|
||||||
|
@@ -1,3 +0,0 @@
|
|||||||
(defn hungry
|
|
||||||
[x]
|
|
||||||
(print x " is hungry"))
|
|
@@ -58,6 +58,17 @@
|
|||||||
|
|
||||||
(assert (= ((unmarshal (marshal b)) 3) (b 3)) "marshal")
|
(assert (= ((unmarshal (marshal b)) 3) (b 3)) "marshal")
|
||||||
|
|
||||||
|
# Issue 408
|
||||||
|
(assert-error :invalid-type (tarray/new :int32 10 1 0 (int/u64 7)) "tarray/new should only allow tarray or buffer for last argument")
|
||||||
|
(def ta (tarray/new :int32 10))
|
||||||
|
(assert (= (next a nil) 0) "tarray next 1")
|
||||||
|
(assert (= (next a 0) 1) "tarray next 2")
|
||||||
|
(assert (= (next a 8) 9) "tarray next 3")
|
||||||
|
(assert (nil? (next a 9)) "tarray next 4")
|
||||||
|
(put ta 3 7)
|
||||||
|
(put ta 9 7)
|
||||||
|
(assert (= 2 (count |(= $ 7) ta)) "tarray count")
|
||||||
|
|
||||||
# Array remove
|
# Array remove
|
||||||
|
|
||||||
(assert (deep= (array/remove @[1 2 3 4 5] 2) @[1 2 4 5]) "array/remove 1")
|
(assert (deep= (array/remove @[1 2 3 4 5] 2) @[1 2 4 5]) "array/remove 1")
|
||||||
|
BIN
tools/EnVar.dll
BIN
tools/EnVar.dll
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user