September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
|
|
@ -0,0 +1,25 @@
|
|||
; This is not strictly LLVM, as it uses the C library function "printf".
|
||||
; LLVM does not provide a way to print values, so the alternative would be
|
||||
; to just load the string into memory, and that would be boring.
|
||||
|
||||
; Additional comments have been inserted, as well as changes made from the output produced by clang such as putting more meaningful labels for the jumps
|
||||
|
||||
%struct._iobuf = type { i8* }
|
||||
|
||||
$"message" = comdat any
|
||||
@"message" = linkonce_odr unnamed_addr constant [17 x i8] c"Goodbye, world!\0A\00", comdat, align 1
|
||||
|
||||
;-- For discovering stderr (io pipe 2)
|
||||
declare %struct._iobuf* @__acrt_iob_func(i32)
|
||||
|
||||
;--- The declaration for the external C fprintf function.
|
||||
declare i32 @fprintf(%struct._iobuf*, i8*, ...)
|
||||
|
||||
define i32 @main() {
|
||||
;-- load stderr
|
||||
%1 = call %struct._iobuf* @__acrt_iob_func(i32 2)
|
||||
;-- print the message to stderr with fprintf
|
||||
%2 = call i32 (%struct._iobuf*, i8*, ...) @fprintf(%struct._iobuf* %1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @"message", i32 0, i32 0))
|
||||
;-- exit
|
||||
ret i32 0
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
/**
|
||||
Hello world, to standard error, in Neko
|
||||
Tectonics:
|
||||
nekoc hello-stderr.neko
|
||||
neko hello-stderr
|
||||
*/
|
||||
|
||||
/* Assume stderr is already open, just need write */
|
||||
var file_write = $loader.loadprim("std@file_write", 4);
|
||||
|
||||
/* Load (and execute) the file_stderr primitive */
|
||||
var stderr = $loader.loadprim("std@file_stderr", 0)();
|
||||
|
||||
file_write(stderr, "Goodbye, World!\n", 0, 16);
|
||||
|
|
@ -0,0 +1 @@
|
|||
(print-to stderr "Goodbye, World!")
|
||||
|
|
@ -1,2 +1 @@
|
|||
with files'
|
||||
"Goodbye, World!" tempString dup getLength "/dev/stderr" spew
|
||||
'Goodbye,_World! '/dev/stderr file:spew
|
||||
|
|
|
|||
|
|
@ -1,8 +1,3 @@
|
|||
fn main() {
|
||||
use ::std::io::Write;
|
||||
let (stderr, errmsg) = (&mut ::std::io::stderr(), "Error writing to stderr");
|
||||
writeln!(stderr, "Bye, world!").expect(errmsg);
|
||||
|
||||
let (goodbye, world) = ("Goodbye", "world");
|
||||
writeln!(stderr, "{}, {}!", goodbye, world).expect(errmsg);
|
||||
eprintln!("Hello, {}!", "world");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
use std::io::{self, Write};
|
||||
fn main() {
|
||||
io::stderr().write(b"Goodbye, world!").expect("Could not write to stderr");
|
||||
// With some finagling, you can do a formatted string here as well
|
||||
let goodbye = "Goodbye";
|
||||
let world = "world";
|
||||
io::stderr().write(&*format!("{}, {}!", goodbye, world).as_bytes()).expect("Could not write to stderr");
|
||||
// Clearly, if you want formatted strings there's no reason not to just use writeln!
|
||||
use ::std::io::Write;
|
||||
let (stderr, errmsg) = (&mut ::std::io::stderr(), "Error writing to stderr");
|
||||
writeln!(stderr, "Bye, world!").expect(errmsg);
|
||||
|
||||
let (goodbye, world) = ("Goodbye", "world");
|
||||
writeln!(stderr, "{}, {}!", goodbye, world).expect(errmsg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
fn main() {
|
||||
use std::io::{self, Write};
|
||||
|
||||
io::stderr().write(b"Goodbye, world!").expect("Could not write to stderr");
|
||||
// With some finagling, you can do a formatted string here as well
|
||||
let goodbye = "Goodbye";
|
||||
let world = "world";
|
||||
io::stderr().write(&*format!("{}, {}!", goodbye, world).as_bytes()).expect("Could not write to stderr");
|
||||
// Clearly, if you want formatted strings there's no reason not to just use writeln!
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
Sub StandardError()
|
||||
Debug.Print "Goodbye World!"
|
||||
End Sub
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
Module Module1
|
||||
|
||||
Sub Main()
|
||||
Console.Error.WriteLine("Goodbye, World!")
|
||||
End Sub
|
||||
|
||||
End Module
|
||||
Loading…
Add table
Add a link
Reference in a new issue