September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -0,0 +1,18 @@
# syntax: TAWK -f PROGRAM_NAME.AWK
#
# GAWK can provide the invoking program name from ARGV[0] but is unable to
# provide the AWK script name that follows -f. Thompson Automation's TAWK
# version 5.0c, last released in 1998 and no longer commercially available, can
# provide the AWK script name that follows -f from the PROGFN built-in
# variable. It should also provide the invoking program name, E.G. TAWK, from
# ARGV[0] but due to a bug it holds the fully qualified -f name instead.
#
# This example is posted here with hopes the TAWK built-in variables PROGFN
# (PROGram File Name) and PROGLN (PROGram Line Number) be added to GAWK by its
# developers.
#
BEGIN {
printf("%s -f %s\n",ARGV[0],PROGFN)
printf("line number %d\n",PROGLN)
exit(0)
}

View file

@ -1,8 +1,6 @@
#import system.
#symbol program =
program =
[
console writeLine:system'commandLine. // the whole command line
console writeLine:('program'arguments@0). // the program name
console writeLine('program'arguments[0]). // the program name
].

View file

@ -0,0 +1,10 @@
Public Sub Main()
Dim sTemp As String
Print "Command to start the program was ";;
For Each sTemp In Args.All
Print sTemp;;
Next
End

View file

@ -0,0 +1,8 @@
// version 1.0.6
// 'progname.kt' packaged as 'progname.jar'
fun main(args: Array<String>) {
println(System.getProperty("sun.java.command")) // may not exist on all JVMs
println(System.getProperty("java.vm.name"))
}

View file

@ -0,0 +1,5 @@
#!/usr/bin/env newlisp
(let ((program (main-args 1)))
(println (format "Program: %s" program))
(exit))

View file

@ -1,19 +0,0 @@
$ scala ScriptName.scala
Program: ScriptName.scala
$ scalac ScriptName.scala
$ scala -classpath . ScriptName
Program: ScriptName.scala
$ scala
Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_26).
Type in expressions to have them evaluated.
Type :help for more information.
scala> :load ScriptName.scala
Loading ScriptName.scala...
import scala.util.matching.Regex.MatchIterator
defined module ScriptName
scala> ScriptName.main(Array[String]())
Program: <console>

View file

@ -1,18 +0,0 @@
import scala.util.matching.Regex.MatchIterator
object ScriptName {
val program = {
val filenames = new RuntimeException("").getStackTrace.map { t => t.getFileName }
val scala = filenames.indexOf("NativeMethodAccessorImpl.java")
if (scala == -1)
"<console>"
else
filenames(scala - 1)
}
def main(args: Array[String]) {
val prog = program
println("Program: " + prog)
}
}

View file

@ -1,2 +1,2 @@
#!/usr/local/bin/txr -B
@(bind my-name @*self-path*)
@(bind my-name @self-path)

View file

@ -0,0 +1,5 @@
Wscript.Echo "FullName:",Wscript.FullName
Wscript.Echo "Name:",Wscript.Name
Wscript.Echo "Path:",Wscript.Path
Wscript.Echo "ScriptFullName:",Wscript.ScriptFullName
Wscript.Echo "ScriptName:",Wscript.ScriptName

View file

@ -0,0 +1,19 @@
FORMAT=-f elf
RUN=./
BIN=scriptname
OBJ=scriptname.o
all: test
test: $(BIN)
$(RUN)$(BIN)
$(BIN): $(OBJ)
ld -o $(BIN) $(OBJ)
$(OBJ): scriptname.asm
nasm $(FORMAT) -o $(OBJ) scriptname.asm
clean:
-rm $(BIN)
-rm $(OBJ)

View file

@ -0,0 +1,72 @@
bits 32
section .data
stdout equ 1
sys_write equ 4
sys_exit equ 1
kernel equ 0x80
program db "Program: ", 0
programlen equ $-program
nl db "", 10, 0
nllen equ $-nl
section .bss
scriptname resd 1
scriptnamelen resd 1
section .text
global _start
strlen: ; eax: a string ending in 0
push eax ; cache eax
.strloop:
mov bl, byte [eax]
cmp bl, 0
je .strret ; return len if bl == 0
inc eax ; else eax++
jmp .strloop
.strret:
pop ebx ; ebx = cached eax
sub eax, ebx ; eax -= ebx
ret ; eax = len
_start:
mov eax, esp
add eax, 4
mov eax, [eax]
mov dword [scriptname], eax
mov eax, sys_write
mov ebx, stdout
mov ecx, program
mov edx, programlen
int kernel
mov dword eax, [scriptname]
call strlen
mov dword [scriptnamelen], eax
mov eax, sys_write
mov ebx, stdout
mov dword ecx, [scriptname]
mov dword edx, [scriptnamelen]
int kernel
mov eax, sys_write
mov ebx, stdout
mov ecx, nl
mov edx, nllen
int kernel
mov eax, sys_exit
mov ebx, 0
int kernel

View file

@ -0,0 +1,27 @@
# FreeBSD defaults
FORMAT=-f elf
RUN=./
BIN=scriptname
OBJ=scriptname.o
# Mac OS X
ifeq ($(shell uname -s),Darwin)
FORMAT=-f macho
MINV=-macosx_version_min 10.6
endif
all: test
test: $(BIN)
$(RUN)$(BIN)
$(BIN): $(OBJ)
ld -o $(BIN) $(MINV) $(OBJ)
$(OBJ): scriptname.asm
nasm $(FORMAT) -o $(OBJ) scriptname.asm
clean:
-rm $(BIN)
-rm $(OBJ)

View file

@ -0,0 +1,79 @@
bits 32
section .data
stdout equ 1
sys_write equ 4
sys_exit equ 1
kernel equ 0x80
program db "Program: ", 0
programlen equ $-program
nl db "", 10, 0
nllen equ $-nl
section .bss
scriptname resd 1
scriptnamelen resd 1
section .text
global start
strlen: ; eax: a string ending in 0
push eax ; cache eax
.strloop:
mov bl, byte [eax]
cmp bl, 0
je .strret ; return len if bl == 0
inc eax ; else eax++
jmp .strloop
.strret:
pop ebx ; ebx = cached eax
sub eax, ebx ; eax -= ebx
ret ; eax = len
start:
mov eax, esp
add eax, 4
mov eax, [eax]
mov dword [scriptname], eax
push programlen
push program
push stdout
mov eax, sys_write
sub esp, 4
int kernel
add esp, 4 + 4 * 3
mov dword eax, [scriptname]
call strlen
mov dword [scriptnamelen], eax
push dword [scriptnamelen]
push dword [scriptname]
push stdout
mov eax, sys_write
sub esp, 4
int kernel
add esp, 4 + 4 * 3
push nllen
push nl
push stdout
mov eax, sys_write
sub esp, 4
int kernel
add esp, 4 + 4 * 3
push 0
mov eax, sys_exit
sub esp, 4
int kernel

View file

@ -0,0 +1,19 @@
FORMAT=-f win32
BIN=scriptname.exe
OBJ=scriptname.obj
RUN=
all: test
test: $(BIN)
$(RUN)$(BIN)
$(BIN): $(OBJ)
golink /fo $(BIN) $(OBJ) /console kernel32.dll Msvcrt.dll
$(OBJ): scriptname.asm
nasm $(FORMAT) -o $(OBJ) scriptname.asm
clean:
-rm $(BIN)
-rm $(OBJ)

View file

@ -0,0 +1,94 @@
bits 32
section .data
program db "Program: ", 0
programlen equ $-program
nl db "", 13, 10, 0
nllen equ $-nl
stdouthandle equ -11
section .bss
stdout resd 1
charswritten resd 1
env resd 1
argc resd 1
argv resd 255
scriptname resd 1
scriptnamelen resd 1
section .text
global Start
extern GetStdHandle
extern __getmainargs
extern WriteConsoleA
extern ExitProcess
strlen: ; eax: a string ending in 0
push eax ; cache eax
.strloop:
mov bl, byte [eax]
cmp bl, 0
je .strret ; return len if bl == 0
inc eax ; else eax++
jmp .strloop
.strret:
pop ebx ; ebx = cached eax
sub eax, ebx ; eax -= ebx
ret ; eax = len
Start:
push 0
push env
push argv
push argc
call __getmainargs
mov eax, [argv]
mov eax, [eax]
mov [scriptname], eax
add esp, 4 * 4
push stdouthandle
call GetStdHandle
mov [stdout], eax
add esp, 4 * 1
push 0
push charswritten
push programlen
push program
push dword [stdout]
call WriteConsoleA
add esp, 4 * 5
mov eax, [scriptname]
call strlen
mov [scriptnamelen], eax
push 0
push charswritten
push dword [scriptnamelen]
push dword [scriptname]
push dword [stdout]
call WriteConsoleA
add esp, 4 * 5
push 0
push charswritten
push nllen
push nl
push dword [stdout]
call WriteConsoleA
add esp, 4 * 5
push 0
call ExitProcess

View file

@ -0,0 +1,2 @@
#!/Homer/craigd/Bin/zkl
println(System.argv);

View file

@ -0,0 +1,2 @@
./bbb.zkl
zkl bbb.zkl

View file

@ -0,0 +1,15 @@
#!/bin/sh
# A bash script to run zkl if you haven't jumped
# through all the Unix hoops to put the bits in the "right" places
# You can change zklRoot to your build directory,
# change the script name to "zkl" and put it in your bin path.
# You may need to chmod a+x <this script>
if [ -z $zklRoot ]; then
zklRoot=$HOME/ZKL
if [ ! -d $zklRoot ]; then
zklRoot=$HOME/Projects/ZKL
fi
fi
export zklRoot
#set -o noglob
LD_LIBRARY_PATH=$zklRoot/Lib $zklRoot/Bin/zkl "$@"