Jonathan Badger
9 years ago
8 changed files with 186 additions and 0 deletions
@ -0,0 +1,20 @@ |
|||||
|
--- ../kona-Win.3.36-64/src/0.c 2015-07-30 11:18:02.000000000 -0400
|
||||
|
+++ ./src/0.c 2015-12-06 03:24:04.000000000 -0500
|
||||
|
@@ -84,7 +84,7 @@
|
||||
|
GC; } |
||||
|
else if( (3==ABS(t) && (!strcmp(m,"/dev/fd/0") || !strcmp(m,"/dev/stdin"))) //read stdin |
||||
|
|| 4==t && (!strcmp(*kS(a),"/dev/fd/0") || !strcmp(*kS(a),"/dev/stdin")) ){ |
||||
|
- b=getdelim_(&v,(size_t * __restrict__)&s,EOF,stdin);
|
||||
|
+ b=new_getdelim_(&v,(size_t * __restrict__)&s,EOF,stdin);
|
||||
|
P(freopen_stdin() == NULL, FE) |
||||
|
if(b==-1){z=newK(0,0); GC;} } |
||||
|
else { //read mapped file |
||||
|
@@ -868,7 +868,7 @@
|
||||
|
FILE *f; K z,l; S s=0; I n=0; |
||||
|
f=popen(cmd,"r"); P(!f,_n()) |
||||
|
z=newK(0,0); //oom |
||||
|
- while (getline_(&s, (size_t * __restrict__)&n, f) >= 0) {
|
||||
|
+ while (new_getline_(&s, (size_t * __restrict__)&n, f) >= 0) {
|
||||
|
l=newK(-3,n-1); strncpy(kC(l),s,n-1); kap(&z,&l); } |
||||
|
free(s); pclose(f); |
||||
|
R z; } |
@ -0,0 +1,34 @@ |
|||||
|
--- ../kona-Win.3.36-64/Makefile 2015-07-30 11:18:02.000000000 -0400
|
||||
|
+++ ./Makefile 2015-12-06 04:14:40.000000000 -0500
|
||||
|
@@ -1,10 +1,10 @@
|
||||
|
-PREFIX = /usr/local
|
||||
|
-CFLAGS=-g
|
||||
|
+PREFIX = @TERMUX_PREFIX@
|
||||
|
+CFLAGS=-O3
|
||||
|
PRODFLAGS = -O3 #-pg -g3 |
||||
|
LIB=libkona.a |
||||
|
DEVFLAGS = -O0 -g3 -DDEBUG -Wunused -Wreturn-type -Wimplicit-int #-Wall |
||||
|
|
||||
|
-OS := $(shell uname -s | tr "[:upper:]" "[:lower:]")
|
||||
|
+OS = android
|
||||
|
|
||||
|
# Win-64 |
||||
|
ifeq (mingw32_nt-6.2,$(OS)) |
||||
|
@@ -34,7 +34,7 @@
|
||||
|
src/ks.o src/v.o src/va.o src/vc.o src/vd.o src/vf.o src/vg.o src/vq.o |
||||
|
LDFLAGS = -Wl,--gc-sections -Wl,-z,nocopyreloc -lgcc -no-canonical-prefixes \ |
||||
|
-Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -mthumb \ |
||||
|
- -lc -lm -ldl
|
||||
|
+ -fPIE -pie -lc -lm -ldl
|
||||
|
CFLAGS += -fPIE -fpic -ffunction-sections -funwind-tables -fstack-protector \ |
||||
|
-no-canonical-prefixes -mtune=xscale -msoft-float -mthumb \ |
||||
|
-fomit-frame-pointer -fno-strict-aliasing |
||||
|
@@ -109,7 +109,7 @@
|
||||
|
test: k_test |
||||
|
|
||||
|
install: |
||||
|
- install k $(PREFIX)/bin/k
|
||||
|
+ install k ${PREFIX}/bin/k
|
||||
|
|
||||
|
clean: |
||||
|
$(RM) -r k k_test *.exe k.dSYM k_test.dSYM src/*.o src/win/*.o |
@ -0,0 +1,12 @@ |
|||||
|
TERMUX_PKG_VERSION=3.36 |
||||
|
TERMUX_PKG_FOLDERNAME=kona-Win.$TERMUX_PKG_VERSION-64 |
||||
|
TERMUX_PKG_HOMEPAGE=https://github.com/kevinlawler/kona |
||||
|
TERMUX_PKG_DESCRIPTION="Open-source implementation of the APL-like K programming language" |
||||
|
TERMUX_PKG_SRCURL="https://github.com/kevinlawler/kona/archive/Win.$TERMUX_PKG_VERSION-64.zip" |
||||
|
TERMUX_PKG_DEPENDS="" |
||||
|
TERMUX_PKG_BUILD_IN_SRC=yes |
||||
|
TERMUX_PKG_MAINTAINER="Jonathan Badger <jhbadger@gmail.com>" |
||||
|
|
||||
|
termux_step_make_install () { |
||||
|
make install |
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
--- ../kona-Win.3.36-64/src/c.c 2015-07-30 11:18:02.000000000 -0400
|
||||
|
+++ ./src/c.c 2015-12-06 03:19:35.000000000 -0500
|
||||
|
@@ -463,7 +463,7 @@
|
||||
|
w=t; while(isspace(*w++))l++; |
||||
|
if(l==n||!n){if(y)cd(y); y=0; continue;} |
||||
|
O("%s ",t); |
||||
|
- if(-1==getline_(&u,&m,stdin))GC;
|
||||
|
+ if(-1==new_getline_(&u,&m,stdin))GC;
|
||||
|
d=stepopt(u,m); |
||||
|
if(d==1){if(y)cd(y); y=0; continue;}else if(d==2)GC; |
||||
|
show(k=ex(wd(t,n))); |
@ -0,0 +1,40 @@ |
|||||
|
--- ../kona-Win.3.36-64/src/getline.c 2015-07-30 11:18:02.000000000 -0400
|
||||
|
+++ ./src/getline.c 2015-12-06 03:21:45.000000000 -0500
|
||||
|
@@ -29,12 +29,12 @@
|
||||
|
R 0; |
||||
|
} |
||||
|
|
||||
|
-I getline_(S *s,size_t * __restrict__ n,FILE *f){R getdelim_(s,n,'\n',f);}
|
||||
|
+I new_getline_(S *s,size_t * __restrict__ n,FILE *f){R new_getdelim_(s,n,'\n',f);}
|
||||
|
|
||||
|
-I getdelim_(S *s,size_t * __restrict__ n,I d,FILE *f)
|
||||
|
+I new_getdelim_(S *s,size_t * __restrict__ n,I d,FILE *f)
|
||||
|
{ |
||||
|
I m; S z; |
||||
|
- if(getdelim(s,n,d,f)==-1){*n=0; R -1;}
|
||||
|
+ if(new_getdelim(s,n,d,f)==-1){*n=0; R -1;}
|
||||
|
m=strlenn(*s,*n); |
||||
|
z=strdupn(*s,m); |
||||
|
free(*s); |
||||
|
@@ -44,8 +44,8 @@
|
||||
|
|
||||
|
#if defined(__OpenBSD__) || defined(__NetBSD__) || \ |
||||
|
(defined(__MACH__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070) |
||||
|
-I getline(S *s,I*n, FILE *f){ R getdelim(s,n,'\n',f);}
|
||||
|
-I getdelim(S *s,I*n, I d, FILE *f)//target, current capacity, delimiter, file
|
||||
|
+I getline(S *s,I*n, FILE *f){ R new_getdelim(s,n,'\n',f);}
|
||||
|
+I new_getdelim(S *s,I*n, I d, FILE *f)//target, current capacity, delimiter, file
|
||||
|
{ |
||||
|
unsigned char *q; |
||||
|
I w=0; |
||||
|
@@ -92,8 +92,8 @@
|
||||
|
#endif |
||||
|
|
||||
|
#ifdef WIN32 |
||||
|
-I getline(S *s,I*n, FILE *f){ R getdelim(s,n,'\n',f);}
|
||||
|
-I getdelim(S *s,I*n, I d, FILE *f) { //target, current capacity, delimiter, file
|
||||
|
+I getline(S *s,I*n, FILE *f){ R new_getdelim(s,n,'\n',f);}
|
||||
|
+I new_getdelim(S *s,I*n, I d, FILE *f) { //target, current capacity, delimiter, file
|
||||
|
char *q; I w=0; |
||||
|
if (!s) {errno = EINVAL; goto error;} |
||||
|
if (f->_cnt <= 0) { |
@ -0,0 +1,23 @@ |
|||||
|
--- ../kona-Win.3.36-64/src/getline.h 2015-07-30 11:18:02.000000000 -0400
|
||||
|
+++ ./src/getline.h 2015-12-06 03:21:00.000000000 -0500
|
||||
|
@@ -1,16 +1,16 @@
|
||||
|
K _p(); |
||||
|
S strdupn(S s,I k); |
||||
|
I strlenn(S s,I k); |
||||
|
-I getdelim_(S *s,size_t * __restrict__ n,I d,FILE *f);
|
||||
|
-I getline_(S *s,size_t * __restrict__ n,FILE *f);
|
||||
|
+I new_getdelim_(S *s,size_t * __restrict__ n,I d,FILE *f);
|
||||
|
+I new_getline_(S *s,size_t * __restrict__ n,FILE *f);
|
||||
|
I appender(S *s,I *n,S t,I k); |
||||
|
I expander(S *s,I n); |
||||
|
|
||||
|
#if defined(__OpenBSD__) || defined(__NetBSD__) || \ |
||||
|
(defined(__MACH__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070) || \ |
||||
|
defined(__ANDROID__) |
||||
|
-I getline(S *s,size_t * __restrict__ n,FILE *f);
|
||||
|
-I getdelim(S *s,size_t * __restrict__ n,I d,FILE *f);
|
||||
|
+I new_getline(S *s,size_t * __restrict__ n,FILE *f);
|
||||
|
+I new_getdelim(S *s,size_t * __restrict__ n,I d,FILE *f);
|
||||
|
#endif |
||||
|
|
||||
|
#if WIN32 |
@ -0,0 +1,20 @@ |
|||||
|
--- ../kona-Win.3.36-64/src/getline_android.c 2015-07-30 11:18:02.000000000 -0400
|
||||
|
+++ ./src/getline_android.c 2015-12-06 03:22:55.000000000 -0500
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
#include <errno.h> |
||||
|
#include <stdlib.h> |
||||
|
|
||||
|
-I getline(S *s,size_t*n, FILE *f){ R getdelim(s,n,'\n',f);}
|
||||
|
+I new_getline(S *s,size_t*n, FILE *f){ R getdelim(s,n,'\n',f);}
|
||||
|
|
||||
|
/* getdelim.c --- Implementation of replacement getdelim function. |
||||
|
Copyright (C) 1994, 1996-1998, 2001, 2003, 2005-2012 Free Software |
||||
|
@@ -44,7 +44,7 @@
|
||||
|
necessary. Returns the number of characters read (not including |
||||
|
the null terminator), or -1 on error or EOF. */ |
||||
|
|
||||
|
-I getdelim (S *lineptr, size_t * __restrict__ n, I delimiter, FILE *fp)
|
||||
|
+I new_getdelim (S *lineptr, size_t * __restrict__ n, I delimiter, FILE *fp)
|
||||
|
{ |
||||
|
ssize_t result; |
||||
|
size_t cur_len = 0; |
@ -0,0 +1,26 @@ |
|||||
|
--- ../kona-Win.3.36-64/src/kc.c 2015-07-30 11:18:02.000000000 -0400
|
||||
|
+++ ./src/kc.c 2015-12-06 03:18:50.000000000 -0500
|
||||
|
@@ -34,12 +34,12 @@
|
||||
|
I wds_(K*a,FILE*f,I l) { |
||||
|
S s=0,t=0; I b=0,c=0,m=0,n=0,v=0; K z=0; PDA p=0; |
||||
|
I o=isatty(STDIN)&&f==stdin; |
||||
|
- if(-1==(c=getline_(&s,(size_t * __restrict__)&n,f)))GC;
|
||||
|
+ if(-1==(c=new_getline_(&s,(size_t * __restrict__)&n,f)))GC;
|
||||
|
appender(&t,&m,s,n); |
||||
|
while(1==(v=complete(t,m,&p,0))) { |
||||
|
b=parsedepth(p); |
||||
|
if(o)prompt(b+l); |
||||
|
- if(-1==(c=getline_(&s,(size_t * __restrict__)&n,f)))GC;
|
||||
|
+ if(-1==(c=new_getline_(&s,(size_t * __restrict__)&n,f)))GC;
|
||||
|
appender(&t,&m,s,n); } |
||||
|
SW(v){CS(2,show(kerr("unmatched"));GC) CS(3,show(kerr("nest")); GC)} |
||||
|
z=newK(-3,m-1); |
||||
|
@@ -200,7 +200,7 @@
|
||||
|
//I o = isatty(STDIN) && f==stdin; //display results to stdout? |
||||
|
I o = isatty(STDIN); //display results to stdout? |
||||
|
|
||||
|
- if(-1==(c=getline(&s,(size_t * __restrict__)&m,f))) GC;
|
||||
|
+ if(-1==(c=new_getline(&s,(size_t * __restrict__)&m,f))) GC;
|
||||
|
if(s[0]=='\\' && s[1]=='\n') { |
||||
|
if(fCheck) { fCheck=0; R 0; } //escape suspended execution with single backslash |
||||
|
if(*a) GC; } //escape continue with single backslash |
Loading…
Reference in new issue