Use printn rather than println. Add string methods for copying.

This commit is contained in:
Christoffer Lerno
2023-02-04 15:38:06 +01:00
committed by Christoffer Lerno
parent 6b928c7a3d
commit dce171670f
39 changed files with 1627 additions and 677 deletions

View File

@@ -127,7 +127,7 @@ fn void main()
Summary summary = readAndBuildSummary(url);
io::printf(" Summary: ");
summary.print(io::stdout());
io::println("");
io::printn("");
String title_sure = summary.title ? summary.title.str() : "";
io::printf(" Title: %s\n", title_sure);
bool! has_title = readWhetherTitleNonEmpty(url);

View File

@@ -16,7 +16,7 @@ fn void main()
hello();
`;
io::println(text);
io::printn(text);
// Binary
const DATA = x"4749463839610100010080"

View File

@@ -14,6 +14,6 @@ fn void main()
};
foreach (greeting : greetings)
{
io::println(greeting);
io::printn(greeting);
}
}

View File

@@ -3,7 +3,7 @@ import regex, stdio;
fn void main()
{
println("Enter a story template, terminated by an empty line:");
printn("Enter a story template, terminated by an empty line:");
VarString story = "";
while (1)
{
@@ -25,5 +25,5 @@ fn void main()
story = story.replace(s, word);
}
println("\nThe story becomes:\n%s\n", story);
printn("\nThe story becomes:\n%s\n", story);
}

View File

@@ -49,7 +49,7 @@ fn void main(String[] args)
case "-":
add = false;
default:
io::println("Failed to parse expression.");
io::printn("Failed to parse expression.");
return;
}
}

View File

@@ -16,7 +16,7 @@ fn int main()
{
int maxDiv;
int count;
io::println("The first 20 anti-primes are:");
io::printn("The first 20 anti-primes are:");
int n = 1;
while (count < 20)
{
@@ -29,6 +29,6 @@ fn int main()
}
n++;
}
io::println("");
io::printn("");
return 0;
}

View File

@@ -2,6 +2,6 @@ import std::io;
fn int main()
{
io::println("Hello world");
io::printn("Hello world");
return 0;
}

View File

@@ -23,7 +23,7 @@ fn void setstring(char* dst, String str)
fn void testAllocator(Allocator* a, int val)
{
io::println("Test");
io::printn("Test");
void* data = a.alloc_aligned(val, 128, 16)!!;
io::printf("Aligned with offset %p, align 16: %s offset align 128: %s\n", data, mem::ptr_is_aligned(data, 16), mem::ptr_is_aligned(data + 16, 128));
data = a.calloc_aligned(val, 128, 16)!!;
@@ -78,7 +78,7 @@ fn void main()
ArenaAllocator aa;
aa.init(&&char[1024] {});
testAllocator(&aa, 126);
io::println("Test dynamic arena");
io::printn("Test dynamic arena");
DynamicArenaAllocator dynamic_arena;
dynamic_arena.init(1024);
testAllocator(&dynamic_arena, 112);