feat: add buildmanual target, faker demo, subprocess examples, and contributing sidebar to manual

Add Makefile buildmanual target for manual generation and include faker_demo.wren, subprocess_async_demo.wren, subprocess_concurrent_demo.wren, and subprocess_fiber_demo.wren example scripts. Update manual sidebar across api pages to link new web-server tutorial and contributing section with module architecture, pure-wren/c-backed modules, foreign classes, async patterns, testing, and documentation pages.
This commit is contained in:
2026-01-25 18:02:02 +00:00
parent 819bbd5091
commit 5c2269f6a7
92 changed files with 10955 additions and 621 deletions
+117
View File
@@ -0,0 +1,117 @@
// retoor <retoor@molodetz.nl>
import "faker" for Faker
System.print("=== Faker Module Demo ===\n")
System.print("--- Person Information ---")
System.print("Name: %(Faker.name())")
System.print("First Name (Male): %(Faker.firstNameMale())")
System.print("First Name (Female): %(Faker.firstNameFemale())")
System.print("Username: %(Faker.username())")
System.print("Email: %(Faker.email())")
System.print("Phone: %(Faker.phoneNumber())")
System.print("Gender: %(Faker.gender())")
System.print("\n--- Address Information ---")
System.print("Street Address: %(Faker.streetAddress())")
System.print("City: %(Faker.city())")
System.print("State: %(Faker.state()) (%(Faker.stateAbbr()))")
System.print("ZIP Code: %(Faker.zipCode())")
System.print("Country: %(Faker.country()) (%(Faker.countryCode()))")
System.print("Full Address: %(Faker.address())")
System.print("Latitude: %(Faker.latitude())")
System.print("Longitude: %(Faker.longitude())")
System.print("\n--- Internet Data ---")
System.print("IPv4: %(Faker.ipv4())")
System.print("IPv6: %(Faker.ipv6())")
System.print("MAC Address: %(Faker.macAddress())")
System.print("Domain: %(Faker.domainName())")
System.print("URL: %(Faker.url())")
System.print("Password: %(Faker.password())")
System.print("UUID: %(Faker.uuid())")
System.print("User Agent: %(Faker.userAgent())")
System.print("\n--- Company and Job ---")
System.print("Company: %(Faker.company())")
System.print("Job Title: %(Faker.jobTitle())")
System.print("Job Descriptor: %(Faker.jobDescriptor())")
System.print("\n--- Product and Commerce ---")
System.print("Product: %(Faker.product())")
System.print("Category: %(Faker.productCategory())")
System.print("Price: $%(Faker.price())")
System.print("Currency: %(Faker.currency()) (%(Faker.currencySymbol()))")
System.print("Credit Card: %(Faker.creditCardType()) %(Faker.creditCardNumber())")
System.print("CVV: %(Faker.creditCardCVV())")
System.print("Expiry: %(Faker.creditCardExpiryDate())")
System.print("\n--- Date and Time ---")
System.print("Date: %(Faker.date())")
System.print("Past Date: %(Faker.pastDate())")
System.print("Future Date: %(Faker.futureDate())")
System.print("Date of Birth: %(Faker.dateOfBirth())")
System.print("Month: %(Faker.monthName())")
System.print("Day of Week: %(Faker.dayOfWeek())")
System.print("Time: %(Faker.time())")
System.print("\n--- Text Generation ---")
System.print("Word: %(Faker.word())")
System.print("Words: %(Faker.words(5).join(" "))")
System.print("Sentence: %(Faker.sentence())")
System.print("Paragraph: %(Faker.paragraph())")
System.print("Slug: %(Faker.slug())")
System.print("\n--- Colors ---")
System.print("Color Name: %(Faker.colorName())")
System.print("Hex Color: %(Faker.hexColor())")
System.print("RGB Color: %(Faker.rgbColor())")
System.print("\n--- File and Tech ---")
System.print("Filename: %(Faker.fileName())")
System.print("Extension: %(Faker.fileExtension())")
System.print("MIME Type: %(Faker.mimeType())")
System.print("Semver: %(Faker.semver())")
System.print("\n--- Banking ---")
System.print("IBAN: %(Faker.iban())")
System.print("Account Number: %(Faker.accountNumber())")
System.print("Routing Number: %(Faker.routingNumber())")
System.print("\n--- Cryptographic ---")
System.print("MD5: %(Faker.md5())")
System.print("SHA1: %(Faker.sha1())")
System.print("SHA256: %(Faker.sha256())")
System.print("\n--- Format Helpers ---")
System.print("Numerify ###-###-####: %(Faker.numerify("###-###-####"))")
System.print("Letterify ???-???: %(Faker.letterify("???-???"))")
System.print("Bothify ??-###: %(Faker.bothify("??-###"))")
System.print("\n--- Seeding for Reproducibility ---")
Faker.seed(42)
System.print("Seeded name 1: %(Faker.name())")
Faker.seed(42)
System.print("Seeded name 2: %(Faker.name())")
Faker.reset()
System.print("\n--- Profile Generation ---")
var profile = Faker.profile()
System.print("Profile:")
System.print(" Username: %(profile["username"])")
System.print(" Name: %(profile["name"])")
System.print(" Email: %(profile["email"])")
System.print(" Address: %(profile["address"])")
System.print(" Phone: %(profile["phone"])")
System.print(" Job: %(profile["job"])")
System.print(" Company: %(profile["company"])")
System.print(" Birthdate: %(profile["birthdate"])")
System.print("\n--- Bulk Generation Example ---")
System.print("Generating 5 users:")
for (i in 1..5) {
System.print(" %(i). %(Faker.name()) <%(Faker.email())>")
}
System.print("\n=== Demo Complete ===")
+58
View File
@@ -0,0 +1,58 @@
// retoor <retoor@molodetz.nl>
import "subprocess" for Popen
System.print("=== Concurrent Ping Demo (Parallel Streaming) ===\n")
class PingTask {
construct new(host, label) {
_host = host
_label = label
_done = false
_proc = Popen.new(["ping", "-c", "3", host])
}
tick() {
if (_done) return
var chunk = _proc.stdout.read()
if (chunk == "") {
_done = true
} else {
for (line in chunk.split("\n")) {
if (line.trim() != "") {
System.print("[%(_label)] %(line)")
}
}
}
}
isDone { _done }
label { _label }
host { _host }
}
var tasks = [
PingTask.new("127.0.0.1", "LOCAL"),
PingTask.new("8.8.8.8", "GOOGLE"),
PingTask.new("1.1.1.1", "CLOUDFLARE"),
PingTask.new("9.9.9.9", "QUAD9"),
PingTask.new("208.67.222.222", "OPENDNS")
]
System.print("Starting 5 concurrent pings...")
for (t in tasks) System.print(" %(t.label) -> %(t.host)")
System.print("")
while (true) {
var allDone = true
for (task in tasks) {
if (!task.isDone) {
allDone = false
task.tick()
}
}
if (allDone) break
}
System.print("")
System.print("All 5 pings completed concurrently.")
+86
View File
@@ -0,0 +1,86 @@
// retoor <retoor@molodetz.nl>
import "subprocess" for Popen
System.print("=== Concurrent Ping Demo - 5 Processes ===")
System.print("")
var p1 = Popen.new(["ping", "-c", "3", "127.0.0.1"])
var p2 = Popen.new(["ping", "-c", "3", "8.8.8.8"])
var p3 = Popen.new(["ping", "-c", "3", "1.1.1.1"])
var p4 = Popen.new(["ping", "-c", "3", "9.9.9.9"])
var p5 = Popen.new(["ping", "-c", "3", "208.67.222.222"])
System.print("Started 5 ping processes simultaneously:")
System.print(" PID %(p1.pid) -> 127.0.0.1 (localhost)")
System.print(" PID %(p2.pid) -> 8.8.8.8 (Google DNS)")
System.print(" PID %(p3.pid) -> 1.1.1.1 (Cloudflare)")
System.print(" PID %(p4.pid) -> 9.9.9.9 (Quad9)")
System.print(" PID %(p5.pid) -> 208.67.222.222 (OpenDNS)")
System.print("")
var done1 = false
var done2 = false
var done3 = false
var done4 = false
var done5 = false
while (!done1 || !done2 || !done3 || !done4 || !done5) {
if (!done1) {
var chunk = p1.stdout.read()
if (chunk == "") {
done1 = true
} else {
for (line in chunk.split("\n")) {
if (line.trim() != "") System.print("[LOCAL ] %(line)")
}
}
}
if (!done2) {
var chunk = p2.stdout.read()
if (chunk == "") {
done2 = true
} else {
for (line in chunk.split("\n")) {
if (line.trim() != "") System.print("[GOOGLE ] %(line)")
}
}
}
if (!done3) {
var chunk = p3.stdout.read()
if (chunk == "") {
done3 = true
} else {
for (line in chunk.split("\n")) {
if (line.trim() != "") System.print("[CLOUDFLR] %(line)")
}
}
}
if (!done4) {
var chunk = p4.stdout.read()
if (chunk == "") {
done4 = true
} else {
for (line in chunk.split("\n")) {
if (line.trim() != "") System.print("[QUAD9 ] %(line)")
}
}
}
if (!done5) {
var chunk = p5.stdout.read()
if (chunk == "") {
done5 = true
} else {
for (line in chunk.split("\n")) {
if (line.trim() != "") System.print("[OPENDNS ] %(line)")
}
}
}
}
System.print("")
System.print("All 5 ping processes completed concurrently!")
+74
View File
@@ -0,0 +1,74 @@
// retoor <retoor@molodetz.nl>
import "subprocess" for Popen
import "scheduler" for Scheduler
class AsyncPing {
construct new(host, label) {
_host = host
_label = label
_output = []
_done = false
}
start() {
_proc = Popen.new(["ping", "-c", "3", _host])
_fiber = Fiber.new {
while (true) {
var chunk = _proc.stdout.read()
if (chunk == "") {
_done = true
Fiber.yield()
return
}
for (line in chunk.split("\n")) {
if (line.trim() != "") _output.add(line)
}
Fiber.yield()
}
}
return this
}
tick() {
if (!_done && !_fiber.isDone) _fiber.call()
}
isDone { _done || _fiber.isDone }
label { _label }
output { _output }
host { _host }
}
System.print("=== Async Fiber Demo - 5 Concurrent Pings ===")
System.print("")
var tasks = [
AsyncPing.new("127.0.0.1", "LOCAL ").start(),
AsyncPing.new("8.8.8.8", "GOOGLE ").start(),
AsyncPing.new("1.1.1.1", "CLOUDFLR").start(),
AsyncPing.new("9.9.9.9", "QUAD9 ").start(),
AsyncPing.new("208.67.222.222", "OPENDNS ").start()
]
System.print("Started 5 async ping tasks:")
for (t in tasks) System.print(" [%(t.label)] -> %(t.host)")
System.print("")
while (true) {
var allDone = true
for (task in tasks) {
if (!task.isDone) {
allDone = false
var before = task.output.count
task.tick()
for (i in before...task.output.count) {
System.print("[%(task.label)] %(task.output[i])")
}
}
}
if (allDone) break
}
System.print("")
System.print("All 5 async tasks completed!")