Files
kb_exfiltrator/why_conversion.zig
T
wesandClaude ff42d5c35c Add complete Kobo highlight sync system with NickelMenu integration
- Add text cleaning to remove page reference numbers (e.g., "10After" -> "After")
- Implement cleanHighlightText() function with boundary detection
- Add NickelMenu configuration for UI integration
- Create sync wrapper scripts (with and without FBInk notifications)
- Add installation guides for Kobo deployment
- Include pointer/slice explanation examples for learning

Features:
- Extracts highlights from Kobo SQLite database
- Cleans page references from academic texts
- Computes SHA-256 hashes for deduplication
- POSTs JSON to Flask API endpoint
- Supports ARM static linking for Kobo hardware
- Optional FBInk notifications for user feedback

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 21:13:16 -05:00

26 lines
814 B
Zig

const std = @import("std");
pub fn main() !void {
// Why we need the conversion:
// SQLite stores strings as C-style null-terminated strings
const c_string: [*:0]const u8 = "Hello, World!";
// But Zig functions expect slices (pointer + length)
// For example, this function wants a slice:
printText("Direct string"); // This works - string literals are slices
// Can't do this - type mismatch:
// printText(c_string); // ERROR: expected []const u8, found [*:0]const u8
// Must convert pointer to slice:
const slice = std.mem.span(c_string);
printText(slice); // Now it works!
// Our Highlight.init() is the same - it expects slices, not pointers
}
fn printText(text: []const u8) void {
std.debug.print("Text: {s} (length: {})\n", .{text, text.len});
}