Re: Other option rather than .rsrc in Xcode...
Re: Other option rather than .rsrc in Xcode...
- Subject: Re: Other option rather than .rsrc in Xcode...
- From: Dave Carrigan <email@hidden>
- Date: Wed, 17 Dec 2008 15:20:09 -0800
On Dec 17, 2008, at 2:40 PM, Nima wrote:
You could of course just put it in a large constant string, or take
advantage of C's automatic concatenation of consecutive string
literals:
char * myScript = "function inDate() {\n"
s=prompt(\"input date:\");\n"
Etc.
The maintenance of the newlines and escaping of the quotes is a
pain, but if this is a one-time thing you can do it with find and
replace.
Chris
Thanks Chris,
I wish there was a better approach as you mentioned the maintenance
is not an easy thing to do.
Put your javascript into a file write a script that creates a .h file
with syntactically-correct C, and #include that .h file. Add a build
rule that will run the script on your input files and create .h files.
The script is pretty simple. Off the top of my head, written in
mail.app:
#! /usr/bin/perl -n
BEGIN {
print "char const* myscript = ";
}
while (<>) {
chomp;
s/\\/\\\\/g;
s/\"/\\\"/g;
print '"', $_, '"', "\n";
}
END {
print ";\n";
}
--
Dave Carrigan
email@hidden
Seattle, WA, USA
Attachment:
PGP.sig
Description: This is a digitally signed message part
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden