<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -8,21 +8,21 @@
 
 (case platform
       
-      (&quot;iPhoneOS&quot;
-                 (set PLATFORM &quot;-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS#{sdk_version}.sdk&quot;)
-                 (set @arch '(&quot;armv6&quot;))
-                 (set @cc &quot;/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.0&quot;)
-                 (set @library_extras &quot;platforms/iPhoneOS/libffi/*.o platforms/iPhoneOS/pcre/*.o&quot;))
+      ( &quot;iPhoneOS&quot;
+        (set PLATFORM &quot;-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS#{sdk_version}.sdk&quot;)
+        (set @arch '(&quot;armv6&quot;))
+        (set @cc &quot;/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.0&quot;)
+        (set @library_extras &quot;platforms/iPhoneOS/libffi/*.o platforms/iPhoneOS/pcre/*.o&quot;))
       
-      (&quot;iPhoneSimulator&quot;
-           (set PLATFORM &quot;-isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator#{sdk_version}.sdk&quot;)
-           (set @arch '(&quot;i386&quot;))
-           (set @cc &quot;/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.0&quot;)
-           (set @library_extras &quot;platforms/iPhoneSimulator/lib/libpcre.a&quot;))
+      ( &quot;iPhoneSimulator&quot;
+        (set PLATFORM &quot;-isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator#{sdk_version}.sdk&quot;)
+        (set @arch '(&quot;i386&quot;))
+        (set @cc &quot;/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.0&quot;)
+        (set @library_extras &quot;platforms/iPhoneSimulator/lib/libpcre.a&quot;))
       
       (else nil))
 
-(set @cflags &quot;-g -Iinclude -I../include -DDARWIN -DIPHONE -DMACOSX -std=gnu99 #{PLATFORM}  -mmacosx-version-min=10.5&quot;)
+(set @cflags &quot;-g -Iinclude -I../include -DMININUSH -DDARWIN -DIPHONE -DMACOSX -std=gnu99 #{PLATFORM}  &quot;)
 
 ;; library description
 (set @library &quot;libNu&quot;)
@@ -30,7 +30,13 @@
 (compilation-tasks)
 (library-tasks)
 
-(task &quot;default&quot; =&gt; &quot;library&quot;)
+(file &quot;build/armv6/nush&quot; =&gt; &quot;library&quot; &quot;build/armv6/main.o&quot; is
+      (SH &quot;#{@cc} #{@cflags} #{@mflags} #{PLATFORM} -ObjC libNu.a ../main/main.m -framework Foundation -arch armv6 -o #{(target name)} -ledit&quot;)
+      (SH &quot;CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate codesign -fs 'iPhone Developer' #{(target name)}&quot;))
+
+(task &quot;nush&quot; =&gt; &quot;build/armv6/nush&quot;)
+
+(task &quot;default&quot; =&gt; &quot;nush&quot;)
 
 (task &quot;clobber&quot; =&gt; &quot;clean&quot; is
-      (SH &quot;rm -rf libNu.a&quot;))
+      (SH &quot;rm -rf libNu.a build/armv6/nush&quot;))</diff>
      <filename>iphone/Nukefile</filename>
    </modified>
    <modified>
      <diff>@@ -1,13 +1,23 @@
 
-This directory contains a Nukefile for building the iPhone version of Nu.
+This directory contains a Nukefile for building the iPhone version of Nu .
 
 The Nukefile builds Nu as a static library (libNu.a) that can be linked
 into an iPhone application.  When linking this library into your application,
 be sure that the -ObjC link flag is specified; otherwise, most of the classes 
 in libNu.a will not be linked into your application.
 
+Also, this Nukefile builds a &quot;nush&quot; (or strictly, a mininush) that you can
+install and run on a jailbroken iPhone. Find it at build/armv6/nush.
+
 Your application should #include &quot;Nu/Nu.h&quot;, which is copied into the include
-directory as part of the build process.
+directory as part of the build process.  You may also need to link your 
+application with libedit (-ledit).
 
 Note that libffi is included in the iPhoneSimulator sdk.
 
+
+
+
+
+
+</diff>
      <filename>iphone/README</filename>
    </modified>
    <modified>
      <diff>@@ -14,7 +14,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
-#if defined(DARWIN) &amp;&amp; !defined(IPHONE)
+#if defined(DARWIN) 
 int NuMain(int argc, const char *argv[]);
 
 int main(int argc, const char *argv[])</diff>
      <filename>main/main.m</filename>
    </modified>
    <modified>
      <diff>@@ -89,6 +89,9 @@ int NuMain(int argc, const char *argv[])
 int NuMain(int argc, const char *argv[], const char *envp[])
 #endif
 {
+	#ifdef IPHONE
+	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+	#endif
 
     #ifdef LINUX
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@@ -208,6 +211,10 @@ int NuMain(int argc, const char *argv[], const char *envp[])
         #ifdef LINUX
         [pool release];
     #endif
+
+	#ifdef IPHONE
+    [pool release];
+	#endif
     return 0;
 }
 </diff>
      <filename>objc/nu.m</filename>
    </modified>
    <modified>
      <diff>@@ -968,16 +968,21 @@ static int nu_parse_escape_sequences(NSString *string, int i, int imax, NSMutabl
     return result;
 }
 
-#ifndef IPHONE
 - (int) interact
 {
     printf(&quot;Nu Shell.\n&quot;);
     do {
         NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
         char *prompt = ([self incomplete] ? &quot;- &quot; : &quot;% &quot;);
+		#ifdef IPHONENOREADLINE
+		puts(prompt);
+		char line[1024]; // careful
+		int count = gets(line);
+		#else
         char *line = readline(prompt);
         if (line &amp;&amp; *line)
             add_history (line);
+		#endif
         if(!line || !strcmp(line, &quot;quit&quot;)) {
             break;
         }
@@ -1068,5 +1073,5 @@ static int nu_parse_escape_sequences(NSString *string, int i, int imax, NSMutabl
     [pool release];
     return result;
 }
-#endif
+
 @end</diff>
      <filename>objc/parser.m</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>38b32bc3f40d04a96e7101d09de0af590af54ab5</id>
    </parent>
  </parents>
  <author>
    <name>Tim Burks</name>
    <login>timburks</login>
    <email>tim@neontology.com</email>
  </author>
  <url>http://github.com/timburks/nu/commit/02fad24704b6afb3a3442fcf655f6378b10c28aa</url>
  <id>02fad24704b6afb3a3442fcf655f6378b10c28aa</id>
  <committed-date>2009-01-02T12:49:05-08:00</committed-date>
  <authored-date>2009-01-02T12:49:05-08:00</authored-date>
  <message>nush (standalone Nu shell) for the iPhone

nush now runs on the iPhone, allowing Nu scripts
and Nu console sessions on iPhones. Unfortunately,
sandbox limitations prevent standalone executables
from being run on &quot;stock&quot; iPhones, but this nush
will work on jailbroken iPhones and presumably on
development devices in use within Apple.

Strictly speaking, this nush is a &quot;mininush&quot;
because it does not include any parts of Nu
that are written in Nu, only what is built with
Objective-C.

Sample usage follows:

iPhone:~ root# nush
Nu Shell.
Cannot read termcap database;
using dumb terminal settings.
% (+ 2 2)
4
% (&quot;Hello, World&quot; length)
12
% (&quot;Hello, World&quot; stringByReplacingOccurrencesOfString:&quot;World&quot; withString:&quot;Phil&quot;)
&quot;Hello, Phil&quot;
% quit

iPhone:~ root# cat expose.nu

(load &quot;UIKit&quot;) ;; preload

(set before (NuClass all))
(puts (+ &quot;class count before loading: &quot; (before count)))

(set b (NSBundle bundleWithPath:&quot;/System/Library/Frameworks/CoreLocation.framework&quot;))
(puts (+ &quot;loading CoreLocation.framework: &quot; (b load)))

(set after (NuClass all))
(puts (+ &quot;class count after loading: &quot; (after count)))

(puts &quot;\n---- Methods defined in CoreLocation.framework ----&quot;)
(set new (after select:(do (x) (not (before containsObject:x)))))
;; not the fastest way to sort... but easy to code
(set new (new sortedArrayUsingBlock:(do (x y) ((x name) compare:(y name)))))
(new each:(do (c) (puts (c name))))

(puts &quot;\n---- CLLocationManager Class Methods ----&quot;)
(puts ((CLLocationManager classMethodNames) description))

(puts &quot;\n---- CLLocationManager Instance Methods ----&quot;)
(puts ((CLLocationManager instanceMethodNames) description))

iPhone:~ root# ./expose.nu
class count before loading: 1075
loading CoreLocation.framework: 1
class count after loading: 1079

---- Methods defined in CoreLocation.framework ----
CLLocation
CLLocationInternal
CLLocationManager
CLLocationManagerInternal

---- CLLocationManager Class Methods ----
(
)

---- CLLocationManager Instance Methods ----
(
    bestAccuracy,
    dealloc,
    delegate,
    desiredAccuracy,
    distanceFilter,
    init,
    internalClient,
    location,
    locationServicesApproved,
    locationServicesEnabled,
    &quot;onClientEvent:supportInfo:&quot;,
    &quot;onClientEventLocation:&quot;,
    &quot;onClientEventRegistered:&quot;,
    &quot;setDelegate:&quot;,
    &quot;setDesiredAccuracy:&quot;,
    &quot;setDistanceFilter:&quot;,
    &quot;setSupportInfo:&quot;,
    startUpdatingLocation,
    stopUpdatingLocation,
    supportInfo
)
iPhone:~ root#</message>
  <tree>b180e419e5fb7be7ccfeba67863aa81bb70fa2cb</tree>
  <committer>
    <name>Tim Burks</name>
    <login>timburks</login>
    <email>tim@neontology.com</email>
  </committer>
</commit>
