Commit 98d5820f authored by Bernd Paysan's avatar Bernd Paysan

merge

parents 391ee8a8 1d81a03f
Pipeline #1124 failed with stage
in 8 minutes and 1 second
......@@ -117,11 +117,11 @@ previous
zln z2/ zexp THEN ;
: z** ( z1 z2 -- z1**z2 ) zswap zln z* zexp ;
\ Test: Fibonacci-Zahlen
1e 5e fsqrt f+ f2/ fconstant g 1e g f- fconstant -h
1e 5e fsqrt f+ f2/ fconstant phi 1e phi f- fconstant -h
: zfib ( z1 -- fib[z1] )
zdup z>r g 0e zswap z**
zdup z>r phi 0e zswap z**
zr> zswap z>r -h 0e zswap z** znegate zr> z+
[ g -h f- 1/f ] FLiteral zscale ;
[ phi -h f- 1/f ] FLiteral zscale ;
\ complexe Operationen 02mar05py
......
......@@ -12430,18 +12430,42 @@ it, too (@pxref{Emacs and Gforth}).
However, several Forth systems have a different kind of IDE: The Forth
command line is the hub of the environment; you can view the source
from there in various ways, and call an editor if needed. An
advantage of this approach is that it allows you to use your favourite
editor.
from there in various ways, and call an editor if needed.
Gforth also implements such an IDE. It mostly follows the conventions
of SwiftForth where they exist, but implements features beyond them.
An advantage of this approach is that it allows you to use your
favourite editor: set the environment variable @code{EDITOR} to your
favourite editor, and the editing commands will call that editor;
Gforth invokes some GUI editors in the background (so you do not need
to finish editing to continue with your Forth session), terminal
editors in the foreground (default for editors not known to Gforth is
foreground). If you have not set @code{EDITOR}, the default editor is
@file{vi}.
doc-locate
The @emph{current location} is set by a number of other words in
addition to @code{locate}. Also, when an error happens while loading
a file, the location of the error becomes the current location.
A number of words work with the current location:
doc-l
doc-n
doc-b
doc-l
doc-g
You can control how many lines @code{l}, @code{n} and @code{b} show by
changing the values:
doc-before-locate
doc-after-locate
Finally, you can directly go to the source code of a word in the
editor with
doc-edit
@node Locating documentation, Locating uses of a word, Locating source code definitions, Programming Tools
......@@ -12450,17 +12474,21 @@ doc-edit
doc-help
@code{Help} sets the current location, so you can use @code{n} and
@code{b} to show more of the text, or @code{g} to visit the
documentation in an editor (@pxref{Locating source code definitions}).
@node Locating uses of a word, Locating exception source, Locating documentation, Programming Tools
@subsection Locating uses of a word
@cindex Uses of a word
doc-where
doc-whereg
doc-ww
doc-nw
doc-bw
doc-gg
doc-ll
doc-whereg
@node Locating exception source, Examining compiled code, Locating uses of a word, Programming Tools
@subsection Locating exception source
......
......@@ -95,8 +95,10 @@ variable located-bottom \ last line to display with l
2variable located-slurped \ the contents of the file in located-view, or 0 0
\ lines to show before and after locate
3 value before-locate
12 value after-locate
3 value before-locate ( -- u ) \ gforth
\G number of lines shown before current location (default 3).
12 value after-locate ( -- u ) \ gforth
\G number of lines shown after current location (default 12).
: view>filename# ( view -- u )
\G filename-number of view (obtained by @code{name>view}) see @code{filename#>str}
......
......@@ -113,8 +113,7 @@ variable included-file-buffers
view>filename# loadfilename#>str ;
: l ( -- )
\g Display source code lines at compiler error location, or
\g @code{locate}, @code{help}, @code{ww}, or @code{tt} location.
\g Display source code lines at the current location.
current-location?
cr located-view @ view>filename type ': emit
located-top @ dec.
......@@ -124,25 +123,25 @@ variable included-file-buffers
dup name>view swap name>string nip set-located-view ;
: locate-name ( nt -- )
name-set-located-view l ;
name-set-located-view l ;
: locate ( "name" -- ) \ gforth
\g Show the source code of the word @i{name} and set the current
\g location there.
(') locate-name ;
' locate alias view ( "name" -- ) \ gforth
: n ( -- ) \ gforth
\g Display lines after the last source or documentation file
\g display (error, @code{locate}, @code{help}, @code{ww},
\g @code{tt}).
\g Display lines behind the current location, or behind the last
\g @code{n} or @code{b} output (whichever was later).
current-location?
located-bottom @ dup located-top ! form drop 2/ + located-bottom !
set-bn-view l1 ;
: b ( -- ) \ gforth
\g Display lines before the last source or documentation
\g file display (error, @code{locate}, @code{help}, @code{ww},
\g @code{tt}).
\g Display lines before the current location, or before the last
\g @code{n} or @code{b} output (whichever was later).
current-location?
located-top @ dup located-bottom ! form drop 2/ - 0 max located-top !
set-bn-view l1 ;
......@@ -155,9 +154,8 @@ variable included-file-buffers
throw ;
Defer g ( -- ) \ gforth
\g Enter the editor at the compiler error location, or the
\g @code{locate}, @code{n}, @code{b}, @code{help}, @code{ww}, or
\g @code{tt} location.
\g Enter the editor at the current location, or at the start of
\g the last @code{n} or @code{b} output (whichever was later).
' extern-g is g
: edit ( "name" -- ) \ gforth
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment