Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
ALGOL 68
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===transput: Input and output=== '''Transput''' is the term used to refer to ALGOL 68's input and output facilities. It includes pre-defined procedures for unformatted, formatted and binary transput. Files and other transput devices are handled in a consistent and machine-independent manner. The following example prints out some unformatted output to the '''standard output''' device: <pre> print ((newpage, "Title", newline, "Value of i is ", i, "and x[i] is ", x[i], newline)) </pre> Note the predefined procedures <code>newpage</code> and <code>newline</code> passed as arguments. ====Books, channels and files==== The '''TRANSPUT''' is considered to be of '''BOOKS''', '''CHANNELS''' and '''FILES''': * '''Books''' are made up of pages, lines and characters, and may be backed up by files. ** A specific book can be located by name with a call to <code>match</code>. * '''CHANNEL'''s correspond to physical devices. e.g. card punches and printers. ** Three standard channels are distinguished: ''stand in'' channel, ''stand out'' channel, ''stand back'' channel. * A '''FILE''' is a means of communicating between a program and a book that has been opened via some channel. ** The '''MOOD''' of a file may be read, write, char, bin, and opened. ** transput procedures include: <code>establish, create, open, associate, lock, close, scratch</code>. ** position enquires: <code>char number, line number, page number</code>. ** layout routines include: ***<code>space</code>, <code>backspace</code>, <code>newline</code>, <code>newpage</code>. ***<code>get good line, get good page, get good book</code>, and <code>'''PROC''' set=('''REF''' '''FILE''' f, '''INT''' page,line,char)'''VOID''':</code> ** A file has '''event routines'''. e.g. <code>on logical file end, on physical file end, on page end, on line end, on format end, on value error, on char error</code>. ====formatted transput==== "Formatted transput" in ALGOL 68's transput has its own syntax and patterns (functions), with '''FORMAT'''s embedded between two $ characters.<ref>{{Cite web|url=http://www.xs4all.nl/~jmvdveer/syntax.html#formats|archiveurl=https://web.archive.org/web/20080109161728/http://www.xs4all.nl/~jmvdveer/syntax.html#formats|url-status=dead|title=Format syntax in ALGOL 68G|archive-date=9 January 2008|access-date=7 April 2023}}</ref> Examples: <pre> printf (($2l"The sum is:"x, g(0)$, m + n)); Β’ prints the same as: Β’ print ((new line, new line, "The sum is:", space, whole (m + n, 0)) </pre>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)