"use client"; import { Copy, Download, Check, Terminal } from "lucide-react"; export interface GeneratedCHeaderProps { code: string | null; loading?: boolean; error?: string; onCopy?: () => void; onDownload?: () => void; copied?: boolean; title?: string; className?: string; } export default function GeneratedCHeader({ code, loading = false, error = "", onCopy, onDownload, copied = false, title = "Generated C Header", className = "", }: GeneratedCHeaderProps) { const crc32Hex = code ? Array.from(code) .reduce((h, c) => Math.imul(31, h) + c.charCodeAt(0) | 0, 0) .toString(16) .toUpperCase() .padStart(8, "0") .slice(-8) : null; return (
{/* Header Bar */}

{title}

{code && ( {(code.length / 1024).toFixed(1)} KB · {code.split("\n").length} Lines )}
{code && (
{onCopy && ( )} {onDownload && ( )}
)}
{/* Code Viewport */}
{error ? (
TRANSPILATION ERROR {error}
) : loading ? (
Transpiling AST to C99...
Synthesizing zero-malloc ABI & memory buffers
) : code ? (
              {code}
            
) : (
STANDBY // AWAITING COMPILATION

Target configuration staged. Press [COMPILE C HEADER] to transpile AST decision logic into bare-metal C99.

STATUS: AWAITING_TRIGGER · 0 BYTES EMITTED
)} {/* Status Bar at Bottom */}
{code ? ( <> CRC32: 0x{crc32Hex} Zero Dynamic Heap Allocation ) : ( <> ABI: INT PREDICT(CONST FLOAT*) READY TO COMPILE )}
); }