Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -1,3 +1,8 @@
{{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>
'''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).
'''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).

View file

@ -0,0 +1,4 @@
---
category:
- Hardware
- Printer

View file

@ -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);
}
}

View file

@ -0,0 +1,3 @@
procedure main()
write(open("/dev/lp0","w"),"Hello, world!")
end

View file

@ -1,3 +1,3 @@
hello: procedure options (main);
put ('Hello world.');
hello: procedure options(main);
put skip list('Hello world.');
end hello;

View file

@ -1,12 +1,15 @@
import java.awt.print.PrinterException
import javax.swing.JTextPane
import scala.swing.TextArea
object LinePrinter0 extends App {
val show = false
val text = """Hello, World! in printing."""
object LinePrinter extends App {
val (show, context) = (false, "Hello, World!")
try // Default Helvetica, 12p
new JTextPane() { setText(text) }.print(null, null, show, null, null, show)
new TextArea(context) {
append(" in printing.")
peer.print(null, null, show, null, null, show)
}
catch {
case ex: PrinterException => ex.getMessage()
}
println("Document printed.")
}

View file

@ -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;

View file

@ -0,0 +1,4 @@
BEGIN
OUTTEXT("Hello World!");
OUTIMAGE
END