Porting CLIPS to iOS, compiling under Objective-C.

Showing 1-33 of 33 messages
Porting CLIPS to iOS, compiling under Objective-C. JCL 1/10/12 10:50 AM
Greetings:

I'm not a CLIPS expert so this may be a dumb question. Can somebody
provide me with any suggestions on how to compile CLIPS under
Objective-C? Theoretically, Objective-C is supposed to compile C
source code in.

Desired end goal:
I'd like to use CLIPS inside my iOS apps as a rules engine because the
logic portion of the apps is becoming too complicated (too many IF /
THEN / CASE).

This is what I'm envisioning:
* Learn to compile the CLIPS source code into an iOS "framework" than
can then be loaded into an iOS project under Xcode.
* Define all my apps' rules as plain text *.clp files inside each
app's "bundle"
* From the app's code (Objective-C), make a call to the CLIPS
framework, specifying: rules file to process; and pointer to object
containing the record to compare against the rules file.
* The CLIPS framework will return the results back to the Objective-C
code for further processing by the app.

Does it make sense? Is this possible?


If I may say so, this approach could bring a lot of new developers
(and users) to CLIPS. There are tens of thousands of iOS app
developers, and the level of complexity of those apps is growing
exponentially. Particularly in the case of games.

I'd think that a powerful, small, embedded rules engine such as CLIPS
would be hugely appealing to iOS developers. Just a thought.

Thank you.

JCL
Re: Porting CLIPS to iOS, compiling under Objective-C. Lode 1/10/12 11:18 AM
Dear JCL,

It is definitely possible, I already used CLIPS both on iOS and Android devices.
I approached it by compiling CLIPS as a static library using the iOS
cross compiler via a custom Makefile.

However, if you use CLIPS as it is, you might even be able to just
import the CLIPS xcode project as a dependency in an iOS project (I
did not try this myself).
Note that for the iOS simulator you need to compile for i386 and for
the phones you need armv6 and armv7.

Feel free to post questions if you get stuck.

2012/1/10 JCL <afgha...@mypacks.net>:> --
> You received this message because you are subscribed to the Google Groups "CLIPSESG" group.
> To post to this group, send email to CLIP...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/CLIPSESG?hl=en
>
> --> IF YOU NO LONGER WANT TO RECEIVE EMAIL <--
> Visit this group at http://groups.google.com/group/CLIPSESG?hl=en
> Click on "Edit my membership" link.
> Select the "No Email" radio button.
> Click the "Save these settings" button.
>
> --> IF YOU WANT TO UNSUBSCRIBE <--
> Visit this group at http://groups.google.com/group/CLIPSESG?hl=en
> Sign in
> Click on "Edit my membership" link.
> Click the "Unsubscribe" button.
> Note: This appears to be the most reliable way to unsubscribe
>
> Alternately, send email to CLIPSESG-u...@googlegroups.com. You will receive an email which you must respond to as well to unsubscribe. Clicking the link mentioned in the unsubscribe reply does not appear to work reliably.

Re: Porting CLIPS to iOS, compiling under Objective-C. CLIPS Support 1/10/12 11:55 AM
There's an Xcode project here (http://sourceforge.net/projects/
clipsrules/files/CLIPS/6.30/CLIPS_6.30_Beta_Mac_OS_X_Installer_R1.pkg/

download) that includes CLIPS as a framework used by the other
projects. You may be able to use this as the basis for your iOS
project. To get it to compile as a Mac OS X project, I had to update
the base SDK to 10.6 and the deployment target to 10.5
Re: Porting CLIPS to iOS, compiling under Objective-C. JCL 1/11/12 9:46 PM
Thank you all for your notes. This is where I'm at at this time (this
may be useful to other folks int he future):

* Downloaded the file you mentioned
(CLIPS_6.30_Beta_Mac_OS_X_Installer_R1.pkg) from
http://sourceforge.net/projects/clipsrules/files/CLIPS/6.30/

* Then unzip "Source Code.zip" file

* Open "CLIPS.xcodeproj" in Xcode

* For each of the 03 targets:
  + set architecture to "64-bit Intel"
  + set Base SDK to "Mac OS X 10.6" (or whatever the latest Mac OS X
version you have)

At this time I'm able to compile and run all 03 targets under Mac OS
X. Next is:
* trying to compile the framework for iOS
* integrating the CLIPS framework with my Obj-C app
* passing facts to the CLIPS framework, read *.clp files off the app's
bundle, and send results back to the app.

I'm keeping notes of everything I do, and will be happy to post the
final document here if anybody is interested.

Comments welcome. Regards.
Re: Porting CLIPS to iOS, compiling under Objective-C. Prana Adikhrisna 1/12/12 12:38 AM
Hi Lode,

This may be off the topic, but I'm interested in how CLIPS is used for
Android. Do you mind sharing some knowledge on how to do that? :D

Thanks

On Jan 10, 2:18 pm, Lode Hoste <zill...@gmail.com> wrote:
> Dear JCL,
>
> It is definitely possible, I already used CLIPS both on iOS and Android devices.
> I approached it by compiling CLIPS as a static library using the iOS
> cross compiler via a custom Makefile.
>
> However, if you use CLIPS as it is, you might even be able to just
> import the CLIPS xcode project as a dependency in an iOS project (I
> did not try this myself).
> Note that for the iOS simulator you need to compile for i386 and for
> the phones you need armv6 and armv7.
>
> Feel free to post questions if you get stuck.
>
> 2012/1/10 JCL <afghan26...@mypacks.net>:
> > For more options, visit this group athttp://groups.google.com/group/CLIPSESG?hl=en
>
> > --> IF YOU NO LONGER WANT TO RECEIVE EMAIL <--
> > Visit this group athttp://groups.google.com/group/CLIPSESG?hl=en
> > Click on "Edit my membership" link.
> > Select the "No Email" radio button.
> > Click the "Save these settings" button.
>
> > --> IF YOU WANT TO UNSUBSCRIBE <--
> > Visit this group athttp://groups.google.com/group/CLIPSESG?hl=en
Re: Porting CLIPS to iOS, compiling under Objective-C. Lode 1/12/12 2:38 AM
As mine was pretty customized, I prepared a new generic CLIPS Makefile
to do cross-compilation for the Android platform.
I uploaded it to: http://wise.vub.ac.be/~lhoste/public/Makefile


2012/1/12 Prana Adikhrisna <rp.adi...@gmail.com>:> For more options, visit this group at http://groups.google.com/group/CLIPSESG?hl=en


>
> --> IF YOU NO LONGER WANT TO RECEIVE EMAIL <--
> Visit this group at http://groups.google.com/group/CLIPSESG?hl=en

> Click on "Edit my membership" link.
> Select the "No Email" radio button.
> Click the "Save these settings" button.
>
> --> IF YOU WANT TO UNSUBSCRIBE <--
> Visit this group at http://groups.google.com/group/CLIPSESG?hl=en

> Sign in
> Click on "Edit my membership" link.
> Click the "Unsubscribe" button.
> Note: This appears to be the most reliable way to unsubscribe
>
> Alternately, send email to CLIPSESG-u...@googlegroups.com. You will receive an email which you must respond to as well to unsubscribe. Clicking the link mentioned in the unsubscribe reply does not appear to work reliably.

Re: Porting CLIPS to iOS, compiling under Objective-C. JCL 1/17/12 2:47 PM
Thank you all for your notes. This is where I'm at at this time (this
may be useful to other folks in the future):
* I successfully compiled CLIPS as a "framework" for iOS
* I integrated the CLIPS framework with my Obj-C project under Xcode
4.2 and iOS 5
* I am able to pass facts to the CLIPS framework, and read *.clp files
off the app's bundle.
* I can see the results of "printout" statements on the RHS when the
rules on the *.clp file fire.

- - - Here's the Objective-C code that works for me thus far - - -

#import <CLIPS_iOS/clips.h>

    // - - - - - CLIPS' functions. - - - - -
    //
    // Clean up the CLIPS environment.
    InitializeEnvironment();
    Clear();

    // Define the location of the rules file inside the app's "bundle"
directory:
    NSString *filePath = [[NSBundle mainBundle]
pathForResource:@"test" ofType:@"clp"];

    // Load the content of the rules file:
    NSData *myData = [NSData dataWithContentsOfFile:filePath];
    //
    // Check to see if there was data to load from the rules file:
    if (myData) {
        //
        NSLog(@"File to load %@", filePath);
        //
        // CLIPS seems to require that strings be passed as C type
"char" as opposed to iOS' NSString.
        const unsigned char *clipsFileChar = (const unsigned char *)
[filePath cStringUsingEncoding:NSASCIIStringEncoding];
        //
        /
*============================================================*/
        /* Disable garbage collection. It's only necessary to disable
*/
        /* garbage collection when calls are made into CLIPS from an
*/
        /* embedding program. It's not necessary to do this when the
*/
        /* the calls to user code are made by CLIPS (such as for        */
        /* user-defined functions) or in the case of this example,        */
        /* there are no calls to functions which can trigger garbage
*/
        /* collection (such as Send or FunctionCall.        */
        /
*============================================================*/
        IncrementGCLocks();

        // Here we load the rules file:
        Load(clipsFileChar);
        //
        // NOW we assert a fact (passed on from the iOS application)
        // HERE is where you take the record you want to run against
the rules file and pass it on to CLIPS!
        AssertString("(person (user_firstname Mike) (user_cohort 1910)
(results Here))");
        //
        // Then we "run" the rules against the fact we passed above:
        int *numberRulesFired = Run(-1);
        //
        // OPEN ITEM: How to receive the text of the rules fired BACK
into the iOS app?
        //
        // This tells us the number of rules that were activated, or
"fired"
        NSLog(@"Number of rules that fired: %d", numberRulesFired);
        //
        //
        /
*==========================================================*/
        /* Enable garbage collection. Each call to IncrementGCLocks */
        /* should have a corresponding call to DecrementGCLocks.        */
        /*==========================================================*/
        DecrementGCLocks();
        //
    }
    else {
        //
        // In case the app could not open the file containing the
rules:
        NSLog(@"Could not find file %s", filePath);
    }
    // - - - - -

- - - - - End of code - - - - -

- - - - - Here's the test.clp file - - - - -

;
(deftemplate person "Definition of a Person object"
    (slot user_firstname)
    (slot user_cohort)
    (multislot results) ; I'm trying to pass results back to iOS
through this slot. Dumb?
)
;
;;; ======================================================
;
;;; - - - [Cohort Module] - - -
;
(defrule cohort-module-1910 "1910 cohort"
  (person (user_cohort 1910))
  (person (user_firstname ?user_firstname))
  (person (results ?results))
  =>
  (printout t "Hello, " ?user_firstname ", how are you today?" crlf)
  (printout t "Tell us about your family's life during World War I."
crlf)
  (assert (results "Tell us about your family's life during World War
I."))
  ; Do I use these "assert" commands to pass the results of the rules'
firings BACK to iOS?
  ; How do I read these values from iOS? Using DATA_OBJECT?
)
;

- - - - - End of test.clp - - - - -


Question:

I do have a follow up question to you all: how do I capture the
_results_ of all the rules that fired and send those results back to
my iOS app?

Specifically: I have hundreds of rules, and a single "fact" can
trigger dozens of rules. How can I pass the results (meaning, the RHS
actions) of all those fired rules back to iOS?


I'll be happy to post my full notes here if anybody is interested.
Thanks.
Re: Porting CLIPS to iOS, compiling under Objective-C. Lode 1/18/12 1:32 AM
One of the better ways to do this is adding your own user functions to CLIPS.
e.g.    EnvDefineFunction2(theEnv,"+", 'n',PTIEF AdditionFunction,
"AdditionFunction", "2*n");
Whenever you use '+' in your rules, the additionfunction is called.

For information on how to use EnvDefineFunction2, see extnfunc.h,
bmathfun.c and the Advanced Programming Guide (Volume II).


2012/1/17 JCL <afgha...@mypacks.net>:

> --
> You received this message because you are subscribed to the Google Groups "CLIPSESG" group.
> To post to this group, send email to CLIP...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/CLIPSESG?hl=en
>
> --> IF YOU NO LONGER WANT TO RECEIVE EMAIL <--
> Visit this group at http://groups.google.com/group/CLIPSESG?hl=en
> Click on "Edit my membership" link.
> Select the "No Email" radio button.
> Click the "Save these settings" button.
>
> --> IF YOU WANT TO UNSUBSCRIBE <--
> Visit this group at http://groups.google.com/group/CLIPSESG?hl=en
> Sign in
> Click on "Edit my membership" link.
> Click the "Unsubscribe" button.
> Note: This appears to be the most reliable way to unsubscribe
>
> Alternately, send email to CLIPSESG-u...@googlegroups.com. You will receive an email which you must respond to as well to unsubscribe. Clicking the link mentioned in the unsubscribe reply does not appear to work reliably.

Re: Porting CLIPS to iOS, compiling under Objective-C. CLIPS Support 1/18/12 11:53 AM
Take a look at the CLIPSJNI examples, http://sourceforge.net/projects/clipsrules/files/CLIPS/6.30/.
The example applications are written in Java, but the principles are
the same for iOS or any other framework where you're wrapping a GUI
around CLIPS. Use the CLIPS eval function to evaluate a fact-set query
function (or deffunction) which returns a set of facts that your
embedded GUI uses to determine the current state.
Re: Porting CLIPS to iOS, compiling under Objective-C. Coche 5/27/12 5:59 PM
Hey JCL , 
I just get to this group looking for help on successfully using CLISP framework with an iOS App.
I read all your post of advance, and I'm wondering how far did you get, and if you could share with me some of your notes
that can help me go through this. 
I look forward to your response.
Re: Porting CLIPS to iOS, compiling under Objective-C. Ankur S. 7/25/12 1:17 AM
Thank you very much JCL for posting this...

I am having trouble with my iPhone app.. When I try to run my app it gives me "Apple Mac-O Linker (id) error"
Could you please post the full notes? Want to check that I walked through the right steps. Thanks :)
Re: Porting CLIPS to iOS, compiling under Objective-C. Stephane Yong wai man 11/25/12 4:24 AM
Hi, 

Thanks all for sharing so far.

I also need to use an rule engine for iPhone and Clips seems to be perfect. So on the CLIPS.xcodeproj, 
- I set for the 3 targets : "Base SDK" to Lastest iOS (iOS 5.1) and Architectures to $(ARCHS_STANDARD_64_BITS), 
- I added the Foundation.framework as a "Link Binary With Libraries" on target : CLIPS and CLIPS IDE

But when running I have the following error "target specifies product type 'com.apple.product-type.framework', but there's no such product type for the 'iphonesimulator' platform"

Any ideas ?

Thanks;
St.
This message has been hidden because it was flagged for abuse.
This message has been hidden because it was flagged for abuse.
Re: Porting CLIPS to iOS, compiling under Objective-C. Stephane Yong wai man 12/23/12 3:53 PM
Hi Mikael,

I am also looking for a way to use CLIPS on IOS. Were you able to make it work ? If so could you share some advice and tips ?
Thx.
St.
Re: Porting CLIPS to iOS, compiling under Objective-C. Rawan AlHathlool 2/25/13 2:02 PM
Hi 
Could anyone please describe how to use clips in more details and if possible would you mind to attach a simple example so it may help, also I'm new on iOS environment and i have to know how to use clips with my xcode project ..
thanks in advance 
Re: Porting CLIPS to iOS, compiling under Objective-C. CJK 8/15/13 8:44 AM
JCL,

Have you had any progress in this effort? I am also looking to incorporate CLIPS as a framework for native IOS apps and would be interested to see how you made out.
RE: Porting CLIPS to iOS, compiling under Objective-C. Theodore Neward 8/15/13 1:27 PM

Somebody want to start a GitHub or other open project to do this? I’d contribute. (Had the same thought for a while now.)

 

Ted Neward

Leading, Speaking, Consulting, Writing

http://www.tedneward.com

 

From: clip...@googlegroups.com [mailto:clip...@googlegroups.com] On Behalf Of Chris Koncur
Sent: Thursday, August 15, 2013 8:45 AM
To: clip...@googlegroups.com
Subject: Re: Porting CLIPS to iOS, compiling under Objective-C.

--

You received this message because you are subscribed to the Google Groups "CLIPSESG" group.
To post to this group, send email to CLIP...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/CLIPSESG?hl=en
 
--> IF YOU NO LONGER WANT TO RECEIVE EMAIL <--
Visit this group at http://groups.google.com/group/CLIPSESG?hl=en
Click on "Edit my membership" link.
Select the "No Email" radio button.
Click the "Save these settings" button.

--> IF YOU WANT TO UNSUBSCRIBE <--
Visit this group at http://groups.google.com/group/CLIPSESG?hl=en
Sign in
Click on "Edit my membership" link.
Click the "Unsubscribe" button.
Note: This appears to be the most reliable way to unsubscribe
 
Alternately, send email to CLIPSESG-u...@googlegroups.com. You will receive an email which you must respond to as well to unsubscribe. Clicking the link mentioned in the unsubscribe reply does not appear to work reliably.
---
You received this message because you are subscribed to the Google Groups "CLIPSESG" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clipsesg+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Re: Porting CLIPS to iOS, compiling under Objective-C. Joshua Scoggins 8/16/13 2:58 PM
While I don't have any modern iOS devices, I did make a framework for OSX out of the clips source code (may have been my
fork of clips). I'll dig up the code on my mac mini and post it on my github account when I get home from work tonight. While it isn't
for iOS specifically, it will work with Objective-C and it is a good place to start. You would have to redefine the io routers to
output to the screen but it could be done (I did it for quake2 so I know its easy :D)

Just remember that Apple will require you to either use binary load/save or a runtime module. I know they will not allow apps with
interpreted code on the app store. I'm not trying to deter anyone, I just want people to know what they may get themselves into.

-Joshua Scoggins
Re: Porting CLIPS to iOS, compiling under Objective-C. Joshua Scoggins 8/16/13 10:34 PM
Alright, I posted the code to github. It should work with xcode, if someone wants to write a
makefile I will be glad to merge it into the mainline. It turns out that I added NSLog IO router
support already as well as a CLIPSEnvironment class for objc (it was a while ago).

http://github.com/DrItanium/CLIPS-Cocoa

I hope this helps someone out. Happy Hacking :D

-Joshua Scoggins
RE: Porting CLIPS to iOS, compiling under Objective-C. Theodore Neward 8/17/13 1:51 AM

It would seem to me that a starting point for an iCLIPS (somebody please come up with a better name) would be to simply create an app that is all one giant text area, and run CLIPS in there essentially in the same UI style as the command-line console app version. It would be cool if the app could then (as a v1.1 feature) integrate with Dropbox or something so as to be able to run CLIPS files out of a user’s Dropbox, rather than having to type them in by hand each time.

 

Apple has allowed other interpreter applications onto the iOS platform (see Gambit Scheme, Try F#, and so on), but I don’t know if there’s some kind of magic technical trick that those apps are using to bypass Apple’s weird restrictions. (Try F#, for example, I’m pretty sure is compiling the code on a Microsoft server and just essentially piping “stdin” and “stdout” over the web to that server, since I’m 98% certain that Don Syme and associates didn’t rewrite/port the compiler to iOS.) That said, though, I’d still be happy with a version that I have to compile on my own box and side-load onto whatever device I want to use it on; somehow, I don’t see this as being a #1-bestselling iPhone app anytime soon, even if we did get Apple’s approval to put it into the AppStore. :-)

 

If somebody builds this for iOS, I’ll take it as a longer-term action item to do a similar version for Android. (Compile the core CLIPS engine to a .so using the Android NDK, then build a dirt-simple Android UI for it, just the same as the above.) I just don’t have the time to do it right this month. :-/

 

Ted Neward

Leading, Speaking, Consulting, Writing

http://www.tedneward.com

 

From: clip...@googlegroups.com [mailto:clip...@googlegroups.com] On Behalf Of Joshua Scoggins
Sent: Friday, August 16, 2013 10:35 PM

RE: Porting CLIPS to iOS, compiling under Objective-C. Artem Novikov 8/17/13 10:53 AM
Some time ago, I wrote a CLIPSShell.  It's based on Qt and can run on iOS.
http://sourceforge.net/projects/clipsshell
Re: Porting CLIPS to iOS, compiling under Objective-C. CLIPS Support 8/20/13 7:43 PM
I uploaded an Xcode 4.6 project (clips_mab_ios_0_1.zip) at https://sourceforge.net/projects/clipsrules/files/CLIPS/Misc/. It shows how to link the CLIPS code into a static library, load a CLIPS file containing rules, and redirect output to a UITextView.
Re: Porting CLIPS to iOS, compiling under Objective-C. CJK 8/22/13 10:32 AM
Having some issues baking this into a storyboard with a UITextView on the viewController. outputView doesnt seem to be available no matter what I do. Any suggestions?

BTW AMAZING WORK
Re: Porting CLIPS to iOS, compiling under Objective-C. CJK 8/22/13 10:37 AM
I have a Main_iPhone Storyboard with multiple named ViewControllers, your AppDelegate .h/.m

////  ThirdViewController.h

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController

@property (strong, nonatomic) IBOutlet UITextView *outputView;

@end


==========

////  ThirdViewController.m

#import "ThirdViewController.h"

#import <UIKit/UIKit.h>


@interface ViewController ()


@end


@implementation ViewController


- (void) viewDidLoad

  {

   [super viewDidLoad];


   // Do any additional setup after loading the view, typically from a nib.

  }


- (void) didReceiveMemoryWarning

  {

   [super didReceiveMemoryWarning];

   // Dispose of any resources that can be recreated.

  }


@end

=================

//

//  AppDelegate.h

#import <UIKit/UIKit.h>


@class ViewController;


@interface AppDelegate : UIResponder <UIApplicationDelegate>


@property (strong, nonatomic) UIWindow *window;


@property (strong, nonatomic) ViewController *viewController;


@end

==========

//AppDelegate.m


#import "AppDelegate.h"

#import "ThirdViewController.h"


#import "clips.h"



@implementation AppDelegate

@synthesize window = _window;


///ADDED

- (void)applicationWillResignActive:(UIApplication *)application

{

    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.

    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.

}


- (void)applicationDidEnterBackground:(UIApplication *)application

{

    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.

    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.

}


- (void)applicationWillEnterForeground:(UIApplication *)application

{

    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.

}


- (void)applicationDidBecomeActive:(UIApplication *)application

{

    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.

}


- (void)applicationWillTerminate:(UIApplication *)application

{

    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.

}


// END ADDED



/************************/

/* QueryInterfaceRouter */

/************************/

intBool QueryInterfaceRouter(

  void *theEnv,

  char *logicalName)

  {

   if ( (strcmp(logicalName,"stdout") == 0) ||

        (strcmp(logicalName,WPROMPT) == 0) ||

        (strcmp(logicalName,WTRACE) == 0) ||

        (strcmp(logicalName,WERROR) == 0) ||

        (strcmp(logicalName,WWARNING) == 0) ||

        (strcmp(logicalName,WDISPLAY) == 0) ||

        (strcmp(logicalName,WDIALOG) == 0) )

     { return(TRUE); }


    return(FALSE);

  }


/************************/

/* PrintInterfaceRouter */

/************************/

int PrintInterfaceRouter(

  void *theEnv,

  char *logicalName,

  char *str)

  {

   NSString *theStr = [NSString stringWithCString: str encoding: NSUTF8StringEncoding];

   

   if (str == nil)

     { return(FALSE); }

          

   AppDelegate *theAD = (__bridge AppDelegate *) GetEnvironmentRouterContext(theEnv);

   

   theAD.viewController.outputView.text = [theAD.viewController.outputView.text stringByAppendingString: theStr];


   return(TRUE);

  }


/**********************************************/

/* application:didFinishLaunchingWithOptions: */

/**********************************************/

- (BOOL) application: (UIApplication *) application didFinishLaunchingWithOptions: (NSDictionary *) launchOptions

  {

   void *theEnv;

   

   /*self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

  

      // Override point for customization after application launch.

   if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)

     { self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil]; }

   else

     { self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil]; }

   self.window.rootViewController = self.viewController;

   [self.window makeKeyAndVisible];

   */

      

   theEnv = CreateEnvironment();

   if (theEnv == NULL) return YES;


   EnvAddRouterWithContext(theEnv,"CLIPSSimpleOutput",10,QueryInterfaceRouter,PrintInterfaceRouter,

                           NULL,NULL,NULL,(__bridge void *)(self));


   NSString* filePath = [[NSBundle mainBundle] pathForResource: @"mab" ofType:@"clp"];

   char *cFilePath = (char *) [filePath UTF8String];

   EnvLoad(theEnv,cFilePath);


   EnvReset(theEnv);

   EnvRun(theEnv,-1);


   return YES;

  }


@end


Re: Porting CLIPS to iOS, compiling under Objective-C. CLIPS Support 8/22/13 1:32 PM
Did you connect the outputView outlet to the UITextView in the storyboard? Click on the storyboard, click on the viewController, select the connection inspector in the utilities pane, and then click on the outputView outlet and drag the connection to the UITextView.

On Thursday, August 22, 2013 12:32:30 PM UTC-5, CJK wrote:
Having some issues baking this into a storyboard with a UITextView on the viewController. outputView doesnt seem to be available no matter what I do. Any suggestions?

BTW AMAZING WORK

On Tuesday, August 20, 2013 10:43:54 PM UTC-4, CLIPS Support wrote:
I uploaded an Xcode 4.6 project (clips_mab_ios_0_1.zip) at https://sourceforge.net/projects/clipsrules/files/CLIPS/Misc/. It shows how to link the CLIPS code into a static library, load a CLIPS file containing rules, and redirect output to a UITextView.

On Thursday, August 15, 2013 10:44:36 AM UTC-5, CJK wrote:
JCL,

Have you had any progress in this effort? I am also looking to incorporate CLIPS as a framework for native IOS apps and would be interested to see how you made out.


On Tuesday, January 10, 2012 1:50:38 PM UTC-5, JCL wrote:
Greetings:

I'm not a CLIPS expert so this may be a dumb question. Can somebody
provide me with any suggestions on how to compile CLIPS under
Objective-C? Theoretically, Objective-C is supposed to compile C
source code in.

Desired end goal:
I'd like to use CLIPS inside my iOS apps as a rules engine because the
logic portion of the apps is becoming too complicated (too many IF /
THEN / CASE).

This is what I'm envisioning:
* Learn to compile the CLIPS source code into an iOS "framework" than
can then be loaded into an iOS project under Xcode.
* Define all my apps' rules as plain text *.clp files inside each
app's "bundle"
* From the app's code (Objective-C), make a call to the CLIPS
framework, specifying: rules file to process; and pointer to object
containing the record to compare against the rules file.
* The CLIPS framework will return the results back to the Objective-C
code for further processing by the app.

Does it make sense? Is this possible?


If I may say so, this approach could bring a lot of new developers
(and users) to CLIPS. There are tens of thousands of iOS app
developers, and the level of complexity of those apps is growing
exponentially. Particularly in the case of games.

I'd think that a powerful, small, embedded rules engine such as CLIPS
would be hugely appealing to iOS developers. Just a thought.

Thank you.

JCL
Re: Porting CLIPS to iOS, compiling under Objective-C. CJK 8/22/13 1:39 PM
Thats the thing... in storyboard I cant get the outputView to show in outputView to show as an outlet (unlike in XIB example )
Re: Porting CLIPS to iOS, compiling under Objective-C. CLIPS Support 8/22/13 2:00 PM
I created a new Single View Application with storyboards and added this single line to the viewController.h file:

   @property (strong, nonatomic) IBOutlet UITextView *outputView;

The outlet shows up when I click on the storyboard.

It's hard to say what could be wrong without any description of the attributes of the storyboard. It could be that the Custom Class for the view controller is set to the wrong class.
Re: Porting CLIPS to iOS, compiling under Objective-C. CJK 8/22/13 2:05 PM
Exactly what I did also and no dice! Would it be possible for you to post that project ? or email me so I can compare the two?
Re: Porting CLIPS to iOS, compiling under Objective-C. CJK 8/22/13 4:30 PM
Im such an as.... the class wasnt set .... now its connected and getting the static Lorem Ipsum text though??
Re: Porting CLIPS to iOS, compiling under Objective-C. CLIPS Support 8/22/13 4:52 PM
It would probably be easier if you attached your project. If it's connected and the text isn't getting changed then the view controller method probably isn't getting called or its a different view controller. If the outlet is properly connected, you should be able to determine that just by directly setting the text in the viewDidLoad code of the view controller.

- (void)viewDidLoad

{

    [super viewDidLoad];

// Do any additional setup after loading the view, typically from a nib.

    _outputView.text = @"outlet is connected";

}


On Thursday, August 22, 2013 6:30:38 PM UTC-5, CJK wrote:
Im such an as.... the class wasnt set .... now its connected and getting the static Lorem Ipsum text though??
Re: Porting CLIPS to iOS, compiling under Objective-C. CJK 8/22/13 4:59 PM
Gary,

Here is the sample project I am testing with. Thank you very much for taking the time to help.


--
You received this message because you are subscribed to the Google Groups "CLIPSESG" group.
To post to this group, send email to CLIP...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/CLIPSESG?hl=en
 
--> IF YOU NO LONGER WANT TO RECEIVE EMAIL <--
Visit this group at http://groups.google.com/group/CLIPSESG?hl=en
Click on "Edit my membership" link.
Select the "No Email" radio button.
Click the "Save these settings" button.

--> IF YOU WANT TO UNSUBSCRIBE <--
Visit this group at http://groups.google.com/group/CLIPSESG?hl=en
Sign in
Click on "Edit my membership" link.
Click the "Unsubscribe" button.
Note: This appears to be the most reliable way to unsubscribe
 
Alternately, send email to CLIPSESG-u...@googlegroups.com. You will receive an email which you must respond to as well to unsubscribe. Clicking the link mentioned in the unsubscribe reply does not appear to work reliably.
---
You received this message because you are subscribed to a topic in the Google Groups "CLIPSESG" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clipsesg/Birk6kK8opk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clipsesg+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Re: Porting CLIPS to iOS, compiling under Objective-C. CLIPS Support 8/23/13 4:08 PM
Because you're using a storyboard, the CLIPS code is being executed in the AppDelegate before the view is created. If you move the code from the AppDelegate to the view controller, you can delay CLIPS execution until the view actually appears. That's probably a more realistic scenario anyway (that CLIPS won't be executed immediately upon app startup but rather in response to the user interacting with a UI control). It also appears that the project you're using was created with Xcode 5. I'd suggest using Xcode 4.6.3 instead unless you have a compelling reason for using the prerelease software.
More topics »