From fb1b0fab0a422e9ff8807bed12ae09abb4f0d975 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Mon, 15 Feb 2010 16:43:51 +0000 Subject: Added new type 'Binary Data' to Fluid. Use this to include an arbitrary file as a byte array into your source code. Changes to load jpegs etc. from program memory will follow. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7084 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- fluid/code.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'fluid/code.cxx') diff --git a/fluid/code.cxx b/fluid/code.cxx index 5354fe5cf..a96bbd720 100644 --- a/fluid/code.cxx +++ b/fluid/code.cxx @@ -235,6 +235,17 @@ void write_cdata(const char *s, int length) { varused = 1; return; } + if (write_sourceview) { + if (length>=0) + fprintf(code_file, "{ /* ... %d bytes of binary data... */ }", length); + else + fprintf(code_file, "{ /* ... binary data... */ }"); + return; + } + if (length==-1) { + fprintf(code_file, "{ /* ... undefined size binary data... */ }"); + return; + } const unsigned char *w = (const unsigned char *)s; const unsigned char *e = w+length; int linelength = 1; -- cgit v1.2.3