mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Use printn rather than println. Add string methods for copying.
This commit is contained in:
committed by
Christoffer Lerno
parent
6b928c7a3d
commit
dce171670f
@@ -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);
|
||||
|
||||
@@ -16,7 +16,7 @@ fn void main()
|
||||
|
||||
hello();
|
||||
`;
|
||||
io::println(text);
|
||||
io::printn(text);
|
||||
|
||||
// Binary
|
||||
const DATA = x"4749463839610100010080"
|
||||
|
||||
@@ -14,6 +14,6 @@ fn void main()
|
||||
};
|
||||
foreach (greeting : greetings)
|
||||
{
|
||||
io::println(greeting);
|
||||
io::printn(greeting);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -2,6 +2,6 @@ import std::io;
|
||||
|
||||
fn int main()
|
||||
{
|
||||
io::println("Hello world");
|
||||
io::printn("Hello world");
|
||||
return 0;
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user