1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-02 04:20:55 +11:00

Compare commits

..

No commits in common. "4d893d90fc13f1e096faba32120635ff8ba05f5c" and "48f371d380e07ba29b1ed7fce09ae4906eef4e78" have entirely different histories.

6 changed files with 15 additions and 24 deletions

View File

@ -1,6 +1,8 @@
: _type ( buf -- ) : _type ( buf -- )
C< DUP 0xd = IF 2DROP EXIT THEN SWAP DUP _zbuf ( c a ) C< DUP 0xd = IF 2DROP EXIT THEN OVER DUP _zbuf ( c a )
BEGIN ( c a ) C!+ C< TUCK 0x0d = UNTIL ( c a ) C! ; BEGIN ( c a )
C!+ C< SWAP
OVER 0x0d = UNTIL ( c a ) C! ;
( user-facing lines are 1-based ) ( user-facing lines are 1-based )
: T 1- DUP 64 * EDPOS ! _pln ; : T 1- DUP 64 * EDPOS ! _pln ;
: P IBUF _type IBUF EDPOS @ _cpos 64 MOVE BLK!! ; : P IBUF _type IBUF EDPOS @ _cpos 64 MOVE BLK!! ;

12
blk/107
View File

@ -1,10 +1,10 @@
: _F ( F without _type and _pln. used in VE ) : _F ( F without _pln. used in VE )
FBUF EDPOS @ _cpos ( a1 a2 ) FBUF _type FBUF EDPOS @ _cpos ( a1 a2 )
BEGIN BEGIN
C@+ ROT ( a2+1 c2 a1 ) C@+ ROT ( a2+1 a1+1 c1 c2 ) C@+ ROT ( a2+1 c2 a1 ) C@+ ROT ( a2+1 a1+1 c1 c2 )
= NOT IF DROP FBUF THEN ( a2 a1 ) = NOT IF DROP FBUF THEN
TUCK C@ 0xd = ( a1 a2 f1 ) TUCK C@ 0xd = ( a1 a2 f1 )
OVER BLK) = OR ( a1 a2 f1|f2 ) OVER BLK) = OR ( a1 a2 f1|f2 )
UNTIL ( a1 a2 ) UNTIL
DUP BLK) < IF BLK( - FBUF + -^ EDPOS ! ELSE DROP THEN ; DUP BLK) < IF BLK( - FBUF + -^ EDPOS ! THEN DROP ;
: F FBUF _type _F EDPOS @ 64 / _pln ; : F _F EDPOS @ 64 / _pln ;

View File

@ -3,8 +3,8 @@
: _rbufsz ( size of linebuf to the right of curpos ) : _rbufsz ( size of linebuf to the right of curpos )
EDPOS @ 64 MOD 63 -^ ; EDPOS @ 64 MOD 63 -^ ;
: i COMPILE I ; IMMEDIATE ( save overshadowed ) : i COMPILE I ; IMMEDIATE ( save overshadowed )
: _I ( I without _pln and _type. used in VE ) : _I ( I without _pln. used in VE )
_rbufsz IBUF _blen 2DUP > IF IBUF _type _rbufsz IBUF _blen 2DUP > IF
TUCK - ( ilen chars-to-move ) TUCK - ( ilen chars-to-move )
SWAP EDPOS @ _cpos 2DUP + ( ctm ilen a a+ilen ) SWAP EDPOS @ _cpos 2DUP + ( ctm ilen a a+ilen )
3 PICK MOVE- ( ctm ilen ) 3 PICK MOVE- ( ctm ilen )
@ -12,4 +12,4 @@
ELSE DROP ( ilen becomes rbuffsize ) ELSE DROP ( ilen becomes rbuffsize )
THEN THEN
DUP IBUF EDPOS @ _cpos ROT MOVE ( ilen ) EDPOS +! BLK!! ; DUP IBUF EDPOS @ _cpos ROT MOVE ( ilen ) EDPOS +! BLK!! ;
: I IBUF _type _I EDPOS @ 64 / _pln ; : I _I EDPOS @ 64 / _pln ;

View File

@ -3,8 +3,3 @@
: setpos ( -- ) EDPOS @ 64 /MOD : setpos ( -- ) EDPOS @ 64 /MOD
3 + ( header ) SWAP 3 + ( gutter ) SWAP AT-XY ; 3 + ( header ) SWAP 3 + ( gutter ) SWAP AT-XY ;
: cmv ( n -- , char movement ) acc@ * EDPOS @ + pos! ; : cmv ( n -- , char movement ) acc@ * EDPOS @ + pos! ;
: buftype ( buf ln -- )
3 OVER AT-XY C< DUP 0xd = IF 2DROP DROP EXIT THEN
( buf ln c ) 63 nspcs SWAP 4 SWAP AT-XY ( buf c )
SWAP DUP _zbuf BEGIN ( c a )
C!+ C< TUCK 0x0d = UNTIL ( c a ) C! ;

View File

@ -2,8 +2,8 @@
: $g ACC @ selblk 0acc ; : $g ACC @ selblk 0acc ;
: $[ BLK> @ acc@ - selblk ; : $[ BLK> @ acc@ - selblk ;
: $] BLK> @ acc@ + selblk ; : $] BLK> @ acc@ + selblk ;
: $I mode! 'I' EMIT IBUF 1 buftype _I contents mode! SPC ; : $I mode! 'I' EMIT 3 1 AT-XY _I contents mode! SPC ;
: $F mode! 'F' EMIT FBUF 2 buftype _F setpos mode! SPC ; : $F mode! 'F' EMIT 3 2 AT-XY _F setpos mode! SPC ;
: $E E contents ; : $E E contents ;
: $X acc@ X contents ; : $X acc@ X contents ;
: $h -1 cmv ; : $l 1 cmv ; : $k -64 cmv ; : $j 64 cmv ; : $h -1 cmv ; : $l 1 cmv ; : $k -64 cmv ; : $j 64 cmv ;

View File

@ -2,7 +2,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <dirent.h> #include <dirent.h>
#include <errno.h>
#include <string.h> #include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -42,10 +41,6 @@ int main(int argc, char *argv[])
strcat(fullpath, "/"); strcat(fullpath, "/");
strcat(fullpath, ep->d_name); strcat(fullpath, ep->d_name);
FILE *fp = fopen(fullpath, "r"); FILE *fp = fopen(fullpath, "r");
if (fp == NULL) {
fprintf(stderr, "Could not open %s: %s\n", ep->d_name, strerror(errno));
continue;
}
char *line = NULL; char *line = NULL;
size_t n = 0; size_t n = 0;
for (int i=0; i<16; i++) { for (int i=0; i<16; i++) {
@ -61,7 +56,6 @@ int main(int argc, char *argv[])
fprintf(stderr, "blk %s has more than 16 lines\n", ep->d_name); fprintf(stderr, "blk %s has more than 16 lines\n", ep->d_name);
} }
free(line); free(line);
fclose(fp);
} }
fwrite(buf, 1024, blkcnt, stdout); fwrite(buf, 1024, blkcnt, stdout);
free(buf); free(buf);