Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
5
Task/Hello-world-Line-printer/00-META.yaml
Normal file
5
Task/Hello-world-Line-printer/00-META.yaml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
category:
|
||||
- Hardware
|
||||
- Printer
|
||||
from: http://rosettacode.org/wiki/Hello_world/Line_printer
|
||||
12
Task/Hello-world-Line-printer/00-TASK.txt
Normal file
12
Task/Hello-world-Line-printer/00-TASK.txt
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
;Task:
|
||||
Cause a line printer attached to the computer to print a line containing the message: <big><code> Hello World! </code></big>
|
||||
|
||||
|
||||
;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>
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
V lp = File(‘/dev/lp0’, ‘w’)
|
||||
lp.write("Hello World!\n")
|
||||
lp.close()
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
BEGIN
|
||||
STRING printer name = "/dev/lp0";
|
||||
FILE line printer;
|
||||
IF open (line printer, printer name, stand out channel) = 0 THEN
|
||||
put (line printer, ("Hello world", newline));
|
||||
close (line printer)
|
||||
ELSE
|
||||
put (stand error, ("Can't contact line printer on ", printer name, newline));
|
||||
put (stand error, ("Trying to use lpr(1)", newline));
|
||||
PIPE printer pipe = execve child pipe ("lpr", "", "");
|
||||
IF pid OF printer pipe < 0 THEN
|
||||
put (stand error, ("Oh dear, that didn't seem to work either. Giving up.", newline));
|
||||
stop
|
||||
FI;
|
||||
put (write OF printer pipe, ("Hello world", newline));
|
||||
close (read OF printer pipe);
|
||||
close (write OF printer pipe)
|
||||
FI
|
||||
END
|
||||
|
|
@ -0,0 +1 @@
|
|||
BEGIN { print("Hello World!") >"/dev/lp0" }
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
Proc Main()
|
||||
Open(1,"P:",8,0)
|
||||
PrintDE(1,"HELLO WORLD!")
|
||||
Close(1)
|
||||
Return
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
|
||||
procedure Print_Line is
|
||||
Printer : File_Type;
|
||||
begin
|
||||
begin
|
||||
Open (Printer, Mode => Out_File, Name => "/dev/lp0");
|
||||
exception
|
||||
when others =>
|
||||
Put_Line ("Unable to open printer.");
|
||||
return;
|
||||
end;
|
||||
|
||||
Set_Output (Printer);
|
||||
Put_Line ("Hello World!");
|
||||
Close (Printer);
|
||||
end Print_Line;
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
PR#1
|
||||
PRINT "HELLO WORLD!"
|
||||
|
|
@ -0,0 +1 @@
|
|||
write "/dev/lp0" "Hello World\n"
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Fileappend, Hello World!, print.txt
|
||||
Run, print "print.txt"
|
||||
|
|
@ -0,0 +1 @@
|
|||
LPRINT "Hello World!"
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
printeron
|
||||
font "Arial", 20, 50
|
||||
text 10,100, "Hello World!"
|
||||
printeroff
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
prn% = OPENOUT("PRN:")
|
||||
PRINT #prn%, "Hello World!"
|
||||
CLOSE #prn%
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
' Hello, printer
|
||||
READ msg$
|
||||
DATA "Hello World!\n"
|
||||
|
||||
' Assume printer is on /dev/lp0
|
||||
OPEN "/dev/lp0" FOR DEVICE AS printer
|
||||
PUTBYTE msg$ TO printer SIZE LEN(msg$)
|
||||
CLOSE DEVICE printer
|
||||
|
|
@ -0,0 +1 @@
|
|||
ECHO Hello world!>PRN
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
int main(){
|
||||
std::ofstream lprFile;
|
||||
lprFile.open( "/dev/lp0" );
|
||||
lprFile << "Hello World!\n";
|
||||
lprFile.close();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
||||
public class DOCINFOA
|
||||
{
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string pDocName;
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string pOutputFile;
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string pDataType;
|
||||
}
|
||||
|
||||
[DllImport("winspool.Drv", EntryPoint = "OpenPrinterA", CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
public static extern bool OpenPrinter([MarshalAs(UnmanagedType.LPStr)] string szPrinter, out IntPtr hPrinter, IntPtr pd);
|
||||
|
||||
[DllImport("winspool.Drv", EntryPoint = "StartDocPrinterA", CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
public static extern bool StartDocPrinter(IntPtr hPrinter, int level, [In, MarshalAs(UnmanagedType.LPStruct)] DOCINFOA di);
|
||||
|
||||
[DllImport("winspool.Drv", EntryPoint = "StartPagePrinter", CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
public static extern bool StartPagePrinter(IntPtr hPrinter);
|
||||
|
||||
[DllImport("winspool.Drv", EntryPoint = "EndPagePrinter", CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
public static extern bool EndPagePrinter(IntPtr hPrinter);
|
||||
|
||||
[DllImport("winspool.Drv", EntryPoint = "EndDocPrinter", CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
public static extern bool EndDocPrinter(IntPtr hPrinter);
|
||||
|
||||
[DllImport("winspool.Drv", EntryPoint = "ClosePrinter", CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
public static extern bool ClosePrinter(IntPtr hPrinter);
|
||||
|
||||
[DllImport("winspool.Drv", EntryPoint = "WritePrinter", CharSet = CharSet.Ansi, ExactSpelling = true)]
|
||||
public static extern bool WritePrinter(IntPtr hPrinter, IntPtr pBytes, Int32 dwCount, out Int32 dwWritten);
|
||||
|
||||
public void HelloWorld()
|
||||
{
|
||||
IntPtr hPrinter;
|
||||
bool openSuccessful = OpenPrinter("My Printer", out hPrinter, IntPtr.Zero);
|
||||
if (openSuccessful)
|
||||
{
|
||||
DOCINFOA docInfo = new DOCINFOA();
|
||||
docInfo.pDocName = "Hello World Example";
|
||||
docInfo.pOutputFile = null;
|
||||
docInfo.pDataType = "RAW";
|
||||
|
||||
if (StartDocPrinter(hPrinter, 1, docInfo))
|
||||
{
|
||||
StartPagePrinter(hPrinter);
|
||||
|
||||
const string helloWorld = "Hello World!";
|
||||
IntPtr buf = Marshal.StringToCoTaskMemAnsi(helloWorld);
|
||||
|
||||
int bytesWritten;
|
||||
WritePrinter(hPrinter, buf, helloWorld.Length, out bytesWritten);
|
||||
|
||||
Marshal.FreeCoTaskMem(buf);
|
||||
}
|
||||
if (EndPagePrinter(hPrinter))
|
||||
if (EndDocPrinter(hPrinter))
|
||||
ClosePrinter(hPrinter);
|
||||
}
|
||||
}
|
||||
10
Task/Hello-world-Line-printer/C/hello-world-line-printer.c
Normal file
10
Task/Hello-world-Line-printer/C/hello-world-line-printer.c
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
FILE *lp;
|
||||
lp = fopen("/dev/lp0","w");
|
||||
fprintf(lp,"Hello world!\n");
|
||||
fclose(lp);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. GOODBYE-WORLD-PRINTER.
|
||||
|
||||
PROCEDURE DIVISION.
|
||||
DISPLAY 'Hello World!'
|
||||
UPON PRINTER
|
||||
END-DISPLAY.
|
||||
STOP RUN.
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
SET PRINT ON
|
||||
SET CONSOLE OFF
|
||||
? "Hello World!"
|
||||
SET PRINT OFF
|
||||
SET CONSOLE ON
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
(ns rosetta-code.line-printer
|
||||
(:import java.io.FileWriter))
|
||||
|
||||
(defn -main [& args]
|
||||
(with-open [wr (new FileWriter "/dev/lp0")]
|
||||
(.write wr "Hello, World!")))
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
10 rem rosetta code - "Hello World" on line printer
|
||||
20 open 7,4 : rem open <logical file number>, <device number>
|
||||
30 print#7,"hello world!" : rem print line as shown to logical file number
|
||||
40 close 7 : rem close the file number
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
(defun main ()
|
||||
(with-open-file (stream "/dev/lp0"
|
||||
:direction :output
|
||||
:if-exists :append)
|
||||
(format stream "Hello World~%")))
|
||||
(main)
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
import std.stdio;
|
||||
|
||||
void main()
|
||||
{
|
||||
auto lp = File("/dev/lp0", "w");
|
||||
lp.writeln("Hello World!");
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
program Project1;
|
||||
|
||||
{$APPTYPE CONSOLE}
|
||||
|
||||
uses Printers;
|
||||
|
||||
var
|
||||
lPrinterAsTextFile: TextFile;
|
||||
begin
|
||||
AssignPrn(lPrinterAsTextFile);
|
||||
Rewrite(lPrinterAsTextFile);
|
||||
Writeln(lPrinterAsTextFile, 'Hello World!');
|
||||
CloseFile(lPrinterAsTextFile);
|
||||
end.
|
||||
|
|
@ -0,0 +1 @@
|
|||
with_computer(comp1)_printer(lp1)_text(Hello World!);
|
||||
|
|
@ -0,0 +1 @@
|
|||
with_printer(lp1)_text(Hello World!);
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
select "files"
|
||||
|
||||
f2 = fopen("E:\my.txt", "w")
|
||||
f = "my data"
|
||||
writeText(f2,f)
|
||||
flush(f2)
|
||||
fclose(f2)
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
[ Hello world
|
||||
===========
|
||||
|
||||
A program for the EDSAC
|
||||
|
||||
Can be used to print any character string:
|
||||
the string (including necessary *F and #F
|
||||
characters) should be stored in sequential
|
||||
memory addresses beginning at @+17.
|
||||
|
||||
The last character of the string should be
|
||||
marked with a 1 in the least significant
|
||||
bit. This can be coded by using D in place
|
||||
of F, e.g. AD would be an 'A' as the last
|
||||
character
|
||||
|
||||
Works with Initial Orders 2 ]
|
||||
|
||||
T56K
|
||||
GK
|
||||
|
||||
[ 0 ] O17@ [ Print character ]
|
||||
|
||||
[ 1 ] H17@ [ AND character with 1: ]
|
||||
C15@ [ if the result is 1, we ]
|
||||
S15@ [ have reached the end ]
|
||||
E13@ [ of the string ]
|
||||
|
||||
T14@ [ Modify the orders in ]
|
||||
A@ [ addresses @+0 and @+1 ]
|
||||
A16@ [ to point to the next ]
|
||||
T@ [ character ]
|
||||
A1@
|
||||
A16@
|
||||
T1@
|
||||
E@
|
||||
|
||||
[ 13 ] ZF
|
||||
|
||||
[ 14 ] PF
|
||||
[ 15 ] PD
|
||||
[ 16 ] P1F [ NB Least significant bit
|
||||
is not part of address,
|
||||
so add 2 not 1 ]
|
||||
|
||||
[ 17 ] *F [ Letter shift ]
|
||||
HF
|
||||
EF
|
||||
LF
|
||||
LF
|
||||
OF
|
||||
!F [ Blank ]
|
||||
WF
|
||||
OF
|
||||
RF
|
||||
LF
|
||||
DF
|
||||
@F [ Carriage return ]
|
||||
&D [ Line feed + 1 ]
|
||||
|
||||
EZPF
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
! Hello World in ERRE language
|
||||
PROGRAM HELLO
|
||||
BEGIN
|
||||
!$REDIR
|
||||
PRINT("Hello World !")
|
||||
!$NOREDIR
|
||||
END PROGRAM
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
(printer-font "Courier") ;; change printer font
|
||||
(printer-page "ROSETTA CODE") ;; starts a new page with nice header
|
||||
(printer-writeln "Hello World!") ;; prints new line (not seen on stdout)
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
( scratchpad ) USE: io.encodings.utf8
|
||||
( scratchpad ) USE: io.launcher
|
||||
( scratchpad ) "lpr" utf8 [ "Hello World!" print ] with-process-writer
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
WRITE (6,1)
|
||||
1 FORMAT ("+HELLO WORLD!")
|
||||
END
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
' FB 1.05.0 Win64
|
||||
|
||||
Open Lpt "Lpt:" As #1 '' prints to default printer
|
||||
Print #1, "Hello World!"
|
||||
Close #1
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
// lprint [@(col,row)|%(h,v)] "Hello,World!"
|
||||
lprint "Hello,World!"
|
||||
route _toScreen
|
||||
close lprint
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Start,Programs,Accessories,Notepad,Type:Goodbye World[pling],
|
||||
Menu:File,Print,Button:OK
|
||||
|
|
@ -0,0 +1 @@
|
|||
LPRINT "Hello World!"
|
||||
18
Task/Hello-world-Line-printer/Go/hello-world-line-printer.go
Normal file
18
Task/Hello-world-Line-printer/Go/hello-world-line-printer.go
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
lp0, err := os.Create("/dev/lp0")
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
defer lp0.Close()
|
||||
|
||||
fmt.Fprintln(lp0, "Hello World!")
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
new File('/dev/lp0').write('Hello World!\n')
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
SET PRINT ON
|
||||
SET CONSOLE OFF
|
||||
? "Hello World!"
|
||||
SET PRINT OFF
|
||||
SET CONSOLE ON
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
import System.Process (ProcessHandle, runCommand)
|
||||
|
||||
main :: IO ProcessHandle
|
||||
main = runCommand "echo \"Hello World!\" | lpr"
|
||||
|
|
@ -0,0 +1 @@
|
|||
LPRINT "Hello World!"
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
procedure main()
|
||||
write(open("/dev/lp0","w"),"Hello, world!")
|
||||
end
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
require'print'
|
||||
print'Hello world!'
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
public class LinePrinter {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
FileWriter lp0 = new FileWriter("/dev/lp0");
|
||||
lp0.write("Hello World!");
|
||||
lp0.close();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// This example runs on Node.js
|
||||
var fs = require('fs');
|
||||
// Assuming lp is at /dev/lp0
|
||||
var lp = fs.openSync('/dev/lp0', 'w');
|
||||
fs.writeSync(lp, 'Hello, world!\n');
|
||||
fs.close(lp);
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
document.write("Hello World!");
|
||||
print(); //Opens a dialog.
|
||||
|
|
@ -0,0 +1 @@
|
|||
"/dev/lp" "w" fopen "Hello World!\n" fputchars fclose.
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
lineprinter = Sys.iswindows() ? "LPT3" : "/dev/lp0"
|
||||
lp = open(lineprinter, "w")
|
||||
write(lp, "Hello world")
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
import java.io.File
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val text = "Hello World!\n"
|
||||
File("/dev/lp0").writeText(text)
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
File_Write: '/dev/lp0', 'Hello world', -FileOverWrite;
|
||||
|
|
@ -0,0 +1 @@
|
|||
10 PRINT #8, "Hello World!"
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
Printer {
|
||||
\\ just change the current layer to Print Page
|
||||
\\ Using Layer { } we can change to basic console layer inside any layer
|
||||
Print "Hello World!"
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
Try ok {
|
||||
Open "Lpt1" For OutPut As N '' prints to Lpt1 if exist a printer
|
||||
Print #N, "Hello World!"
|
||||
Close #N
|
||||
}
|
||||
If Not Ok Then Print "Can't Print"
|
||||
|
|
@ -0,0 +1 @@
|
|||
Dos "Print /d:lpt1 file " +quote$(dir$+"this.txt");
|
||||
|
|
@ -0,0 +1 @@
|
|||
Dos "command" [, sleep time after call] [;]
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fid = fopen('/dev/lp0');
|
||||
fprintf(fid,'Hello World!\n');
|
||||
fclose(fid);
|
||||
|
|
@ -0,0 +1 @@
|
|||
LPRINT "Hello World!"
|
||||
|
|
@ -0,0 +1 @@
|
|||
lprint("Hello World!")
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
commandstring = "echo Hello World! | lpr -P Printer01"
|
||||
Run[commandstring]
|
||||
|
|
@ -0,0 +1 @@
|
|||
Hello World!
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
var lp = open("/dev/lp0", fmWrite)
|
||||
lp.writeLine "Hello World"
|
||||
lp.close()
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
let () =
|
||||
let oc = open_out "/dev/lp0" in
|
||||
output_string oc "Hello world!\n";
|
||||
close_out oc ;;
|
||||
|
|
@ -0,0 +1 @@
|
|||
File new("/dev/lp0") dup open(File.WRITE) "Hello world\n" << close
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
(define p (open-output-file "/dev/lp0"))
|
||||
(when p
|
||||
(print-to p "Hello world!")
|
||||
(close-port p))
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
OUTPUT TO PRINTER.
|
||||
PUT UNFORMATTED "Hello world!" SKIP.
|
||||
OUTPUT CLOSE.
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
file_put_contents('/dev/lp0', 'Hello world!');
|
||||
?>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
fclose(STDOUT);
|
||||
$STDOUT = fopen('/dev/lp0', 'a');
|
||||
echo 'Hello world!';
|
||||
?>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
hello: procedure options(main);
|
||||
put skip list('Hello world.');
|
||||
end hello;
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
program testprn;
|
||||
uses printer;
|
||||
var i: integer;
|
||||
f: text;
|
||||
begin
|
||||
writeln ( 'Test of printer unit' );
|
||||
writeln ( 'Writing to lst ...' );
|
||||
for i := 1 to 80 do
|
||||
writeln ( lst, 'This is line', i, '.' #13 );
|
||||
close ( lst );
|
||||
writeln ( 'Done.' );
|
||||
{$ifdef Unix }
|
||||
writeln ( 'Writing to pipe ...' );
|
||||
assignlst ( f, '|/usr/bin/lpr −m' );
|
||||
rewrite ( f );
|
||||
for i:= 1 to 80 do
|
||||
writeln ( f, 'This is line ', i, '.'#13 );
|
||||
close ( f );
|
||||
writeln ( 'Done.' )
|
||||
{$endif}
|
||||
end.
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
open O, ">", "/dev/lp0";
|
||||
print O "Hello World!\n";
|
||||
close O;
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
-->
|
||||
<span style="color: #004080;">integer</span> <span style="color: #000000;">fn</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">open</span><span style="color: #0000FF;">(</span><span style="color: #008080;">iff</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">platform</span><span style="color: #0000FF;">()=</span><span style="color: #000000;">WIN32</span><span style="color: #0000FF;">?</span><span style="color: #008000;">"PRN"</span><span style="color: #0000FF;">:</span><span style="color: #008000;">"/dev/lp0"</span><span style="color: #0000FF;">),</span><span style="color: #008000;">"w"</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #008080;">if</span> <span style="color: #000000;">fn</span><span style="color: #0000FF;">=-</span><span style="color: #000000;">1</span> <span style="color: #008080;">then</span>
|
||||
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"some error"</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #008080;">else</span>
|
||||
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">fn</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Hello World!"</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #7060A8;">close</span><span style="color: #0000FF;">(</span><span style="color: #000000;">fn</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"success!"</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
|
||||
<span style="color: #0000FF;">{}</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">wait_key</span><span style="color: #0000FF;">()</span>
|
||||
<!--
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
main =>
|
||||
Printer = open("/dev/lp0", write),
|
||||
println(Printer, "Hello, world!"),
|
||||
flush(Printer),
|
||||
close(Printer).
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
(out '(lpr "-P" "Printer01")
|
||||
(prinl "Hello world") )
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<</PageSize [595 842]>> setpagedevice % set page size to DIN A4
|
||||
/Courier findfont % use Courier
|
||||
12 scalefont setfont % 12 pt
|
||||
28 802 moveto % 1 cm from the top and left edges
|
||||
(Hello world) show % draw the string
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
:- initialization(main).
|
||||
|
||||
main :-
|
||||
open("/dev/lp0", write, Printer),
|
||||
writeln(Printer, "Hello, world!"),
|
||||
flush_output(Printer),
|
||||
close(Printer).
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
MyPrinter$ = LPRINT_GetDefaultPrinter()
|
||||
If LPRINT_OpenPrinter(MyPrinter$)
|
||||
If LPRINT_StartDoc("Printing a RC-Task")
|
||||
LPRINT_Print(Chr(27) + "E") ; PCL reset for HP Printers
|
||||
LPRINT_PrintN("Hello World!")
|
||||
LPRINT_NewPage()
|
||||
LPRINT_EndDoc()
|
||||
EndIf
|
||||
LPRINT_ClosePrinter()
|
||||
EndIf
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
lp = open("/dev/lp0")
|
||||
lp.write("Hello World!\n")
|
||||
lp.close()
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
lp = open("/dev/lp0","w")
|
||||
lp.write("Hello World!\n")
|
||||
lp.close()
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
/*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. */
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
Fqsysprt O F 80 printer
|
||||
C except
|
||||
C seton LR
|
||||
Oqsysprt E
|
||||
O 11 'Hello world'
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#lang racket
|
||||
(define (print text)
|
||||
;; try lpr first
|
||||
(define lpr-exe (find-executable-path "lpr"))
|
||||
;; otherwise use a special file
|
||||
(if lpr-exe
|
||||
(with-input-from-string (~a text "\n") (λ() (void (system* lpr-exe))))
|
||||
(with-output-to-file #:exists 'append
|
||||
(case (system-type) [(windows) "PRN"] [else "/dev/lp0"])
|
||||
(λ() (displayln text)))))
|
||||
(print "Hello World!")
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
my $lp = open '/dev/lp0', :w;
|
||||
$lp.say: 'Hello World!';
|
||||
$lp.close;
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
given open '/dev/lp0', :w {
|
||||
.say: 'Hello World!';
|
||||
.close;
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
lp = fopen("/dev/lp0","w") fputs(lp,"Hello world!") fclose(lp)
|
||||
|
|
@ -0,0 +1 @@
|
|||
open("| lpr", "w") { |f| f.puts "Hello World!" }
|
||||
|
|
@ -0,0 +1 @@
|
|||
shell$("echo \"Hello World!\" | lpr")
|
||||
|
|
@ -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();
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
output = "Hello, world."
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
output(.print,25,"lpt1")
|
||||
print = "Hello, world."
|
||||
|
|
@ -0,0 +1 @@
|
|||
open_output_text_file("/dev/lp0").print("Hello World!");
|
||||
|
|
@ -0,0 +1 @@
|
|||
`echo "Hello World!" | lpr`;
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
import java.awt.print.PrinterException
|
||||
import scala.swing.TextArea
|
||||
|
||||
object LinePrinter extends App {
|
||||
val (show, context) = (false, "Hello, World!")
|
||||
try // Default Helvetica, 12p
|
||||
new TextArea(context) {
|
||||
append(" in printing.")
|
||||
peer.print(null, null, show, null, null, show)
|
||||
}
|
||||
catch {
|
||||
case ex: PrinterException => ex.getMessage()
|
||||
}
|
||||
println("Document printed.")
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
object LinePrinter extends App {
|
||||
import java.io.{ FileWriter, IOException }
|
||||
{
|
||||
val lp0 = new FileWriter("/dev/lp0")
|
||||
lp0.write("Hello, world!")
|
||||
lp0.close()
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
(call-with-output-file "/dev/lp0"
|
||||
(lambda (printer)
|
||||
(write "Hello World!" printer)))
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
$ include "seed7_05.s7i";
|
||||
|
||||
const proc: main is func
|
||||
local
|
||||
var file: lp is STD_NULL;
|
||||
begin
|
||||
lp := open("/dev/lp0", "w");
|
||||
writeln(lp, "Hello world!");
|
||||
close(lp);
|
||||
end func;
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
Sys.open(\var fh, '>', '/dev/lp0') \
|
||||
&& fh.say("Hello World!") \
|
||||
&& fh.close
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
BEGIN
|
||||
OUTTEXT("Hello World!");
|
||||
OUTIMAGE
|
||||
END
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue