2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -1,8 +1,14 @@
{{omit from|PARI/GP}}
{{omit from|ML/I|Does not have printer-related functions}}
Cause a line printer attached to the computer to print a line containing the message <tt>Hello World!</tt>
;Task:
Cause a line printer attached to the computer to print a line containing the message: &nbsp; <big><code> Hello World! </code></big>
;Note:
A line printer is not the same as standard output.
A &nbsp; [[wp:line printer|line printer]] &nbsp; was an older-style printer which prints one line at a time to a continuous ream of paper.
'''Note:''' A line printer is not the same as standard output.
A [[wp:line printer|line printer]] was an older-style printer which prints one line at a time to a continuous ream of paper.
With some systems, a line printer can be any device attached to an appropriate port (such as a parallel port).
<br><br>

View file

@ -0,0 +1,13 @@
HELLO CSECT
PRINT NOGEN
BALR 12,0
USING *,12
OPEN LNPRNTR
LA 6,HW
PUT LNPRNTR
CLOSE LNPRNTR
EOJ
LNPRNTR DTFPR DEVADDR=SYSLST,IOAREA1=L1
L1 DS 0CL133
HW DC C'Hello World!'
END HELLO

View file

@ -0,0 +1,26 @@
\ No operating system, embedded device, printer output example
defer emit \ deferred words in Forth are a place holder for an
\ execution token (XT) that is assigned later.
\ When executed the deferred word simply runs that assigned routine
: type ( addr count -- ) \ type a string uses emit
bounds ?do i c@ emit loop ; \ type is used by all other text output words in the system
HEX
: CR ( -- ) 0A emit 0D emit ; \ send a carriage return, linefeed pair with emit
\ memory mapped I/O addresses for the printer port
B02E constant scsr \ serial control status register
B02F constant scdr \ serial control data register
: printer-emit ( char -- ) \ output 'char' to the printer serial port
begin scsr C@ 80 and until \ loop until the port shows a ready bit
scdr C! \ C! (char store) writes a byte to an address
20 ms ; \ 32 mS delay to prevent over-runs
: console-emit ( char -- ) ... \ defined in the Forth system, usually assembler
\ vector control words
: >console ['] console-emit is EMIT ; \ assign the execution token of console-emit to EMIT
: >printer ['] printer-emit is EMIT ; \ assign the execution token of printer-emit to EMIT

View file

@ -0,0 +1,3 @@
my $lp = open '/dev/lp0', :w;
$lp.say: 'Hello World!';
$lp.close;

View file

@ -0,0 +1,4 @@
given open '/dev/lp0', :w {
.say: 'Hello World!';
.close;
}

View file

@ -1,5 +0,0 @@
given open '/dev/lp0', :w { # Open the device for writing as the default
.say('Hello World!'); # Send it the string
.close;
# ^ The prefix "." says "use the default device here"
}

View file

@ -1,2 +1,3 @@
str='Hello World'
'@ECHO' str ">PRN"
/*REXX program prints a string to the (DOS) line printer via redirection to a printer.*/
$= 'Hello World!' /*define a string to be used for output*/
'@ECHO' $ ">PRN" /*stick a fork in it, we're all done. */

View file

@ -0,0 +1,7 @@
use std::fs::OpenOptions;
use std::io::Write;
fn main() {
let file = OpenOptions::new().write(true).open("/dev/lp0").unwrap();
file.write(b"Hello, World!").unwrap();
}