Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 May 2002 21:41:05 -0700
From:      Jonathan Mini <mini@freebsd.org>
To:        "E.B. Dreger" <eddy+public+spam@noc.everquick.net>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: any file --> symbol in .o file
Message-ID:  <20020519214105.K25907@stylus.haikugeek.com>
In-Reply-To: <Pine.LNX.4.20.0205200347220.8811-100000@www.everquick.net>; from eddy%2Bpublic%2Bspam@noc.everquick.net on Mon, May 20, 2002 at 04:16:02AM %2B0000
References:  <Pine.LNX.4.20.0205200347220.8811-100000@www.everquick.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Take a look at file2c. You'll need to run the source through the compiler
first, but that is easy to do with make.

E.B. Dreger [eddy+public+spam@noc.everquick.net] wrote :

> Greetings all,
> 
> 
> While writing CGIs in C, I'm getting a bit sick of escaping
> quotes and line continuations in strings.  Not a huge deal,
> perhaps, but there must be a better way.  Strings end up in .data
> or .rodata in object files to be linked...
> 
> I'm about to whip up a utility that will take any arbitrary
> file and store the contents in a .o file (complete with symbol
> names so one can actually link, of course).
> 
> Instead of compiling:
> 
> 	const char foo[] = "\"Escape\" chars make strings in 'C'
> 	code...\n\
> 	...messy.  Line breaks can be troublesome and add\
> 	    unexpected whitespace to one's code." ;
> 
> simply put the desired unescaped text in a file:
> 
> 	"Escape" chars make strings in 'C' code...
> 	...messy.  Line breaks can be troublesome and add
> 	    unexpected whitespace to one's code.
> 
> then run the utility.
> 
> Large amounts of embedded HTML/XML/XHTML are just beginning to
> bug me.
> 
> Note that it wouldn't be limited to text, either.  If one wished
> to take a raw-binary lookup table for a sine wave, that would
> make no difference.
> 
> If there's interest, I'll post it for download.  I also have a
> few other ideas, and certainly am open to suggestions.
> 
> 
> --
> Eddy
> 
> Brotsman & Dreger, Inc. - EverQuick Internet Division
> Phone: +1 (316) 794-8922 Wichita/(Inter)national
> Phone: +1 (785) 865-5885 Lawrence
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Date: Mon, 21 May 2001 11:23:58 +0000 (GMT)
> From: A Trap <blacklist@brics.com>
> To: blacklist@brics.com
> Subject: Please ignore this portion of my mail signature.
> 
> These last few lines are a trap for address-harvesting spambots.
> Do NOT send mail to <blacklist@brics.com>, or you are likely to
> be blocked.
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-hackers" in the body of the message

-- 
Jonathan Mini <mini@freebsd.org>
http://www.haikugeek.com

"He who is not aware of his ignorance will be only misled by his knowledge."
                                                        -- Richard Whatley

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020519214105.K25907>