Loading doc/gforth.texi.in +51 −13 Original line number Diff line number Diff line Loading @@ -12419,25 +12419,76 @@ mixture of the @file{objects.fs} and @file{oof.fs} models. @node Locating source code definitions, Locating documentation, Programming Tools, Programming Tools @subsection Locating source code definitions @cindex source code of a word @cindex @code{view} (called @code{locate} in Gforth) @cindex integrated development environment @cindex IDE (integrated development environment) Many programming systems are organized as an integrated development environment (IDE) where the editor is the hub of the system, and allows building and running programs. If you want that, Gforth has 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. Gforth also implements such an IDE. It mostly follows the conventions of SwiftForth where they exist, but implements features beyond them. doc-locate doc-n doc-b doc-l doc-g doc-edit @node Locating documentation, Locating uses of a word, Locating source code definitions, Programming Tools @subsection Locating documentation @cindex documentation for a word doc-help @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 @node Locating exception source, Examining compiled code, Locating uses of a word, Programming Tools @subsection Locating exception source @cindex exception source code @cindex source code for exception @cindex backtrace examination doc-tt doc-nt doc-bt @node Examining compiled code, Examining data, Locating exception source, Programming Tools @subsection Examining compiled code @cindex compiled code examination And finally, @code{see} and friends show compiled code. Some of the things in the native code are not present in the compiled code (e.g., formatting and comments), but this is useful to see what threaded code or native code is produced by macros and Gforth's optimization features. doc-see doc-xt-see doc-simple-see doc-simple-see-range doc-see-code doc-see-code-range @node Examining data, Forgetting words, Examining compiled code, Programming Tools @subsection Examining data and code @cindex examining data and code Loading @@ -12462,19 +12513,6 @@ The following words inspect memory. doc-? doc-dump And finally, @code{see} and friends show compiled code. Some of the things in the native code are not present in the compiled code (e.g., formatting and comments), but this is useful to see what threaded code or native code is produced by macros and Gforth's optimization features. doc-see doc-xt-see doc-simple-see doc-simple-see-range doc-see-code doc-see-code-range @node Forgetting words, Debugging, Examining data, Programming Tools @subsection Forgetting words @cindex words, forgetting Loading kernel/input.fs +3 −2 Original line number Diff line number Diff line Loading @@ -200,12 +200,13 @@ defer line-end-hook ( -- ) \ gforth ['] refill input-color ['] color-execute catch dup -56 = IF bye THEN throw ; Defer ?set-current-xpos ' noop is ?set-current-xpos Defer ?set-current-view ( -- ) ' noop is ?set-current-view : execute-parsing-named-file ( i*x wfileid filename-addr filename-u xt -- j*x ) >r push-file \ dup 2* cells included-files 2@ drop + 2@ type str>loadfilename# loadfilename# ! loadfile ! error-stack $free r> catch dup IF ?set-current-xpos THEN r> catch dup IF ?set-current-view THEN loadfile @ close-file swap 2dup or pop-file drop throw throw ; Loading locate1.fs +18 −11 Original line number Diff line number Diff line Loading @@ -113,7 +113,8 @@ variable included-file-buffers view>filename# loadfilename#>str ; : l ( -- ) \g Display line of source after compiler error or locate \g Display source code lines at compiler error location, or \g @code{locate}, @code{help}, @code{ww}, or @code{tt} location. current-location? cr located-view @ view>filename type ': emit located-top @ dec. Loading @@ -130,14 +131,18 @@ variable included-file-buffers ' locate alias view ( "name" -- ) \ gforth : n ( -- ) \g Display next lines after locate or error : n ( -- ) \ gforth \g Display lines after the last source or documentation file \g display (error, @code{locate}, @code{help}, @code{ww}, \g @code{tt}). current-location? located-bottom @ dup located-top ! form drop 2/ + located-bottom ! set-bn-view l1 ; : b ( -- ) \g Display previous lines after locate. : b ( -- ) \ gforth \g Display lines before the last source or documentation \g file display (error, @code{locate}, @code{help}, @code{ww}, \g @code{tt}). current-location? located-top @ dup located-bottom ! form drop 2/ - 0 max located-top ! set-bn-view l1 ; Loading @@ -149,12 +154,14 @@ variable included-file-buffers bn-view @ ['] editor-cmd >string-execute 2dup system drop free throw ; Defer g ' extern-g is g \g Enter the editor at the place of the latest error, @code{locate}, \g @code{n} or @code{b}. 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. ' extern-g is g : edit ( "name" -- ) \g Enter the editor at the place of "name" : edit ( "name" -- ) \ gforth \g Enter the editor at the location of "name" (') name-set-located-view g ; Loading Loading
doc/gforth.texi.in +51 −13 Original line number Diff line number Diff line Loading @@ -12419,25 +12419,76 @@ mixture of the @file{objects.fs} and @file{oof.fs} models. @node Locating source code definitions, Locating documentation, Programming Tools, Programming Tools @subsection Locating source code definitions @cindex source code of a word @cindex @code{view} (called @code{locate} in Gforth) @cindex integrated development environment @cindex IDE (integrated development environment) Many programming systems are organized as an integrated development environment (IDE) where the editor is the hub of the system, and allows building and running programs. If you want that, Gforth has 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. Gforth also implements such an IDE. It mostly follows the conventions of SwiftForth where they exist, but implements features beyond them. doc-locate doc-n doc-b doc-l doc-g doc-edit @node Locating documentation, Locating uses of a word, Locating source code definitions, Programming Tools @subsection Locating documentation @cindex documentation for a word doc-help @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 @node Locating exception source, Examining compiled code, Locating uses of a word, Programming Tools @subsection Locating exception source @cindex exception source code @cindex source code for exception @cindex backtrace examination doc-tt doc-nt doc-bt @node Examining compiled code, Examining data, Locating exception source, Programming Tools @subsection Examining compiled code @cindex compiled code examination And finally, @code{see} and friends show compiled code. Some of the things in the native code are not present in the compiled code (e.g., formatting and comments), but this is useful to see what threaded code or native code is produced by macros and Gforth's optimization features. doc-see doc-xt-see doc-simple-see doc-simple-see-range doc-see-code doc-see-code-range @node Examining data, Forgetting words, Examining compiled code, Programming Tools @subsection Examining data and code @cindex examining data and code Loading @@ -12462,19 +12513,6 @@ The following words inspect memory. doc-? doc-dump And finally, @code{see} and friends show compiled code. Some of the things in the native code are not present in the compiled code (e.g., formatting and comments), but this is useful to see what threaded code or native code is produced by macros and Gforth's optimization features. doc-see doc-xt-see doc-simple-see doc-simple-see-range doc-see-code doc-see-code-range @node Forgetting words, Debugging, Examining data, Programming Tools @subsection Forgetting words @cindex words, forgetting Loading
kernel/input.fs +3 −2 Original line number Diff line number Diff line Loading @@ -200,12 +200,13 @@ defer line-end-hook ( -- ) \ gforth ['] refill input-color ['] color-execute catch dup -56 = IF bye THEN throw ; Defer ?set-current-xpos ' noop is ?set-current-xpos Defer ?set-current-view ( -- ) ' noop is ?set-current-view : execute-parsing-named-file ( i*x wfileid filename-addr filename-u xt -- j*x ) >r push-file \ dup 2* cells included-files 2@ drop + 2@ type str>loadfilename# loadfilename# ! loadfile ! error-stack $free r> catch dup IF ?set-current-xpos THEN r> catch dup IF ?set-current-view THEN loadfile @ close-file swap 2dup or pop-file drop throw throw ; Loading
locate1.fs +18 −11 Original line number Diff line number Diff line Loading @@ -113,7 +113,8 @@ variable included-file-buffers view>filename# loadfilename#>str ; : l ( -- ) \g Display line of source after compiler error or locate \g Display source code lines at compiler error location, or \g @code{locate}, @code{help}, @code{ww}, or @code{tt} location. current-location? cr located-view @ view>filename type ': emit located-top @ dec. Loading @@ -130,14 +131,18 @@ variable included-file-buffers ' locate alias view ( "name" -- ) \ gforth : n ( -- ) \g Display next lines after locate or error : n ( -- ) \ gforth \g Display lines after the last source or documentation file \g display (error, @code{locate}, @code{help}, @code{ww}, \g @code{tt}). current-location? located-bottom @ dup located-top ! form drop 2/ + located-bottom ! set-bn-view l1 ; : b ( -- ) \g Display previous lines after locate. : b ( -- ) \ gforth \g Display lines before the last source or documentation \g file display (error, @code{locate}, @code{help}, @code{ww}, \g @code{tt}). current-location? located-top @ dup located-bottom ! form drop 2/ - 0 max located-top ! set-bn-view l1 ; Loading @@ -149,12 +154,14 @@ variable included-file-buffers bn-view @ ['] editor-cmd >string-execute 2dup system drop free throw ; Defer g ' extern-g is g \g Enter the editor at the place of the latest error, @code{locate}, \g @code{n} or @code{b}. 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. ' extern-g is g : edit ( "name" -- ) \g Enter the editor at the place of "name" : edit ( "name" -- ) \ gforth \g Enter the editor at the location of "name" (') name-set-located-view g ; Loading