diff --git a/c/qrcodegen-demo.c b/c/qrcodegen-demo.c index 05a17c8..c06e2f7 100644 --- a/c/qrcodegen-demo.c +++ b/c/qrcodegen-demo.c @@ -40,7 +40,6 @@ static void doMaskDemo(void); static void printQr(const uint8_t qrcode[]); - // The main application program. int main(void) { doBasicDemo(); @@ -51,6 +50,9 @@ int main(void) { } + +/*---- Demo suite ----*/ + // Creates a single QR Code, then prints it to the console. static void doBasicDemo(void) { const char *text = "Hello, world!"; // User-supplied text @@ -115,6 +117,7 @@ static void doVarietyDemo(void) { } +// Creates QR Codes with manually specified segments for better compactness. static void doSegmentDemo(void) { { // Illustration "silver" const char *silver0 = "THE SQUARE ROOT OF 2 IS 1."; @@ -290,6 +293,9 @@ static void doMaskDemo(void) { } + +/*---- Utilities ----*/ + // Prints the given QR Code to the console. static void printQr(const uint8_t qrcode[]) { int size = qrcodegen_getSize(qrcode); diff --git a/cpp/QrCodeGeneratorDemo.cpp b/cpp/QrCodeGeneratorDemo.cpp index 09aba07..1107c4d 100644 --- a/cpp/QrCodeGeneratorDemo.cpp +++ b/cpp/QrCodeGeneratorDemo.cpp @@ -46,7 +46,6 @@ static void doMaskDemo(); static void printQr(const QrCode &qr); - // The main application program. int main() { doBasicDemo(); @@ -57,6 +56,9 @@ int main() { } + +/*---- Demo suite ----*/ + // Creates a single QR Code, then prints it to the console. static void doBasicDemo() { const char *text = "Hello, world!"; // User-supplied text @@ -181,6 +183,9 @@ static void doMaskDemo() { } + +/*---- Utilities ----*/ + // Prints the given QR Code to the console. static void printQr(const QrCode &qr) { int border = 4; diff --git a/java/io/nayuki/qrcodegen/QrCodeGeneratorDemo.java b/java/io/nayuki/qrcodegen/QrCodeGeneratorDemo.java index ba54148..8e144a1 100644 --- a/java/io/nayuki/qrcodegen/QrCodeGeneratorDemo.java +++ b/java/io/nayuki/qrcodegen/QrCodeGeneratorDemo.java @@ -49,6 +49,9 @@ public final class QrCodeGeneratorDemo { } + + /*---- Demo suite ----*/ + // Creates a single QR Code, then writes it to a PNG file and an SVG file. private static void doBasicDemo() throws IOException { String text = "Hello, world!"; // User-supplied Unicode text @@ -176,6 +179,9 @@ public final class QrCodeGeneratorDemo { } + + /*---- Utilities ----*/ + // Helper function to reduce code duplication. private static void writePng(BufferedImage img, String filepath) throws IOException { ImageIO.write(img, "png", new File(filepath)); diff --git a/python/qrcodegen-demo.py b/python/qrcodegen-demo.py index 9db5c1f..876e94e 100644 --- a/python/qrcodegen-demo.py +++ b/python/qrcodegen-demo.py @@ -28,8 +28,6 @@ from __future__ import print_function import qrcodegen -# ---- Main program ---- - def main(): """The main application program.""" do_basic_demo() @@ -38,6 +36,9 @@ def main(): do_mask_demo() + +# ---- Demo suite ---- + def do_basic_demo(): """Creates a single QR Code, then prints it to the console.""" text = u"Hello, world!" # User-supplied Unicode text diff --git a/rust/examples/qrcodegen-demo.rs b/rust/examples/qrcodegen-demo.rs index ec1f535..fafae13 100644 --- a/rust/examples/qrcodegen-demo.rs +++ b/rust/examples/qrcodegen-demo.rs @@ -39,6 +39,9 @@ fn main() { } + +/*---- Demo suite ----*/ + // Creates a single QR Code, then prints it to the console. fn do_basic_demo() { let text: &'static str = "Hello, world!"; // User-supplied Unicode text @@ -155,6 +158,7 @@ fn do_mask_demo() { } + /*---- Utilities ----*/ // Prints the given QrCode object to the console.