Code Monkey home page Code Monkey logo

teco-64's People

Contributors

fpjohnston avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

teco-64's Issues

Non-stop search can cause crash

If the search buffer is empty (that is, there has been no previous search yet), and a user executes an N command without a text argument, TECO will crash, as shown in the following example on Linux:

teco -n -C foo.baz
*N``
Segmentation fault (core dumped)

This does not occur when using an equivalent S command. In that case, a search failure (SRH) error is issued, which is what should happen with the N command.

Arithmetic expression bug

*iZZZZZ`j``
*0A=``
90
*(0A*2)=``
180
*(0A+(0A))=``
180
*(0A==(0A))=``
0
*(0A==90)=``
0
*((0A)==(1A))=``
0

The last three expressions should give -1 (true)

this problem is specifically with variable in the formnA as other variables such as (Z==Z) does give expected results.

Using video let the 'screen' black initially

When using this sequence of commands:

From the Linux command shell (testfile.txt is an existing, non empty text file).
#> teco testfile.txt  
*
* 5,7:w`-w``

will split the screen in two halves as expected, but no text is visible.

One needs to press <CTRK/K> to switch the background of the video mode screen white
and the text black, which is confusing and not expected.

Segmentation fault while using 'EB' and 'P'

There is a file on my harddisk:

-rw-r--r--   1 tuxic users     67105 2023-11-05 17:50  Tecotest.txt

When I start teco like this
teco
which is an alias to teco-64 (system is a up-to-date Gentoo Linux, rolling release).
and give this command:

EBTecotest.txt``

everything seems to be fine (no error message or any message at all).
When giving

P``

teco crashes with:

[1]    27531 segmentation fault  teco-64

Some Make trouble

$ make -d
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
Reading makefiles...
Reading makefile `Makefile'...
Reading makefile `etc/make/sources.mk' (search path) (no ~ expansion)...
Reading makefile `etc/make/display.mk' (search path) (no ~ expansion)...
etc/make/display.mk:36: *** missing separator.  Stop.

Search and replace UTF-8

I try to replace some UTF-8 characters in a file use FS command: (save the text below to a file and call EI)

0J<@FS/ᴇ/E/;>
^[^[

This works with TECOC since I guess that is 8bit clean. However this failed to work with TECO-64.
Neither using ^Q to quote would work:

0J<@FS/^Qᴇ/E/;>
^[^[

I also tried to put ^Q before every byte of but had no luck. Input using 225i180i135i works so I'm surprised searching UTF-8 would not work.

Is this a limitation of TECO-64 or there is a way to work around this?

Goto gets NCA error when buffer is empty

I found the bug when testing part of squ.tes from TECOC lib, below has a minimal example to reproduce the error.

The conditions needed to reproduce the bug I found are:

  • The goto and label is inside a macro register
  • ^YK has been called inside the macro level
  • When the goto O is called the buffer is empty

In most of the case in squ.tes when the macro is called the buffer wouldn't be empty, but I have tested the same example in TECOC and it
has no problem even when the buffer is empty.

As a side note rewrite goto using loop '< >' can work around this issue.

This bug reproduces both on macOS (built with Clang) and Linux (built with GCC).

*eitest.tes``

Delete CR/LF (Y/N) <N>? 12^U?NCA   Negative argument to comma
^D                              ! set decimal !
0ED                             ! set edit mode zero !
0^X                             ! set search mode zero !
0,128ET                         ! set abort-on-error !

! R get Response from user !
@^UR*
^YX0
^YK                             ! kill last inserted string XXX: if move outside macro won't reproduce !
.U1                             ! num 1 <- current point !
ZJ                              ! go to end !
.U2                             ! num 2 <- save buffer end pos !

! display the prompt on a new, clean, line !

!PMPT!

13^T10^T                        ! type <CR><LF> !
        :G0                     !   type str 0 !
        Q2,ZT                    !   and input so far !


!GETCH!
^TU0                            ! read char to num 0 !
Q0-21 "E                        ! if char = ^U !
        Q2,ZK                   !  XXX: when the buffer is empty !
                                !  XXX: the goto would fail by ?NCA !
        @O!PMPT!                !   go to PROMPT !
'                               ! fi !
Q0-27 "E                        ! if char = <ESC> !
        13^T 10^T               !   type <CR> <LF> !
        @O!DONE!                !   go to DONE XXX: if input is empty this would also fail !
'                               ! fi !
Q0@I//                          ! insert input char to buffer !
@O!GETCH!                       ! go to GETCH !

!DONE!

Q1J                             ! restore to original buffer position !
*                               ! end of ^UR !

@I+Delete CR/LF (Y/N) <N>? +    ! str 0 <- display prompt !

MR
HT
^[^[

Control structure works differently from traditional TECO

This might be more of a feature request than bug report.

A interesting phrase I found in squ.tes has interleaved loop and conditional constructs

< D .-Z; 0A"D > '

and the effect is delete digits from current point until there is no more. (although the ?UTC would be thrown at run time if noun digit is encountered in TECOC)

Apparently the traditional TECO treats control flow commands as anchor points to go to, where TECO-64 works differently.

Consulting the Standard TECO user guide, I was wondering the lack of unconditional exit from loop construct, and if interleave loop with conditional is allow then I would not be surprised the "intentional" omitting of such construct.

New target

How about an "install" target for the makefile?

Index origin of computed goto

The TECO manual does say nth tag in n@O/tag1,tag2,.../, however TECO C does use 0 origin for computed goto, that is n=1 selects tag2. In my opinion TECO-64 got it right. Maybe a feature flag can be added to facilitate this.

mkstemps

This function is not POSIX and not part of my SDK.

Binary files

TECO is able to edit binary files, but doing so in display mode may not work as expected, due to the fact that the code currently expects the edit buffer to include some line delimiters. This may be addressed eventually, but for now please be aware of this limitation.

Can't compile teco-64 under Gentoo Linux. "DSO missing"

Thank you very much for rebuilding the legend! :)

I am running Gentoo Linux.
gcc
gcc (Gentoo 12.3.1_p20230825 p2) 12.3.1 20230825
glibc
2.38-r6
binutils
2.41-r2
ldd
ldd (Gentoo 2.38-r6 (patchset 6)) 2.38

To compile teco-64 I did a 'make' in the root of the clone repo and got this error message:

gcc -o bin/teco @obj/objects.lis -l ncurses -Ofast -s
/usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: obj/display.o: undefined reference to symbol 'TABSIZE'
/usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: /lib64/libtinfo.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [Makefile:68: bin/teco] Error 1
[1]    18699 exit 2     make

Beside this, the compiler suit works fine - Gentoo is a source-only distro, you need to compile everything locally.
How can I compile teco-64 successfully?

`^N` (end of file flag) cause crashes when no input file.

And a fix is provided:

diff --git a/src/flag_cmd.c b/src/flag_cmd.c
index e73646a2..9ede57df 100644
--- a/src/flag_cmd.c
+++ b/src/flag_cmd.c
@@ -514,9 +514,13 @@ bool scan_flag1(struct cmd *cmd)
             confirm(cmd, NO_N);
 
             struct ifile *ifile = &ifiles[istream];
-            int_t eof = feof(ifile->fp) ? -1 : 0;
+            if (ifile->fp == NULL)
+              store_val(0);
+            else {
+              int_t eof = feof(ifile->fp) ? -1 : 0;
 
-            store_val(eof);
+              store_val(eof);
+            }
 
             return true;
         }

Foreground/background color can only be set once

I am using GENTOO Linux, the newest version of TECO-64 sources, and sys-libs/ncurses-6.4_p20230401, sys-libs/glibc-2.38-r7.
I compiled TECO-64 myself.

When starting video mode like this:

5,7:w`-w``
<CTRL/K>

I get a white background with black characters (see previous issue).
Lets make it colorful!

@F2/blue/green/``

...nothing happens.

<CTRL/K>

The colors had changed!...but the color combo is bad for my eyes. Let's change them again:

@F2/white/blue/``

Nothing happens.

<CTRL/K>

Got stuck...nothing changed.
This is not expected/

Macros seem not to work as expected

I am sure, this is a definitely a bug, but I am completely unsure, whether it is my bug or a slight glitch in teco.

From the command line from within teco:

@^Uv/5,7:w`-w`/``

and executed via

mv``

works fine.
Putting the same into init.tec results in this error message:

?ILL   Invalid command '<^P>'
[1]    7897 exit 1     teco-64

non-standard ulong

Making errors.o
../src/errors.c: In function 'print_error':
../src/errors.c:253:21: error: 'ulong' undeclared (first use in this
function); did you mean 'u_long'?
  253 |                    (ulong)cmd_line);
      |                     ^~~~~
      |                     u_long
../src/errors.c:253:21: note: each undeclared identifier is reported
only once for each function it appears in
../src/errors.c:253:27: error: expected ')' before 'cmd_line'
  253 |                    (ulong)cmd_line);
      |                           ^~~~~~~~
      |                           )
../src/errors.c: In function 'throw':
../src/errors.c:458:1: warning: 'noreturn' function does return
  458 | }
      | ^
make: *** [Makefile:420: errors.o] Error 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.