Thread: [F-Script-talk] FSInterpreterView execute
Brought to you by:
pmougin
From: Peter A P. <p.a...@su...> - 2008-06-14 11:30:01
|
Hi Philippe and Co, I'm currently integrating F-Script into my time series analysis software and I am wondering about how to use FSInterpreterView properly. What I would like to do is execute commands that I have sent to FSInterpreterView via the -putCommand method. Specifically, what I would like is a convenience method similar to the ShellView method - executeCurrentComand that is accessible from FSInterpreterView. Should I go ahead and write my own convenience methods by altering CLIview and ShellView as necessary? Or is there just a much simpler way to do this that I am missing? My intention here is to go through a number of processing steps automatically, and let the user observe what is happening. I could just use the FSInterpreter directly and return its results, but I still need a way to get the user back to the command prompt (possibly by faking a RETURN keyDown event to the view). By the way, f-script is an absolutely brilliant package - it is fantastic that this is available and completely open source. I have been using it heavily for about two weeks, and have found myself starting to rely on it for my Cocoa dev. I'm trying to put together an intuitive system for academics (mostly neuroscientists) for analyzing and simulating time series data, and I wanted to include a scripting language. The APL + Cocoa style syntax is exactly what I needed. I have been using the GNU scientific library for fast vector processing and math functions, so I'm now looking at ways of using the best features of both the GSL and f-script together. Peter Passaro Research Officer Dept of Informatics/Dept of Biology Pevensey III University of Sussex Falmer, Brighton BN1 9QH, UK Office + 44 (0)1273 877590 P.A...@su... |
From: Philippe M. <pm...@ac...> - 2008-06-14 16:34:20
|
Peter, That's wonderful feedback! I'm glad you find F-Script so useful for your developments. Back to your question, the easiest solution I can think of right now is to invoke, in your code, the executeCurrentCommand: method of the ShellView associated with your FSInterpreterView. In Objective-C, it'd look like: [interpreterView putCommand:@"4 + 3"]; [[[interpreterView cliView] shellView] executeCurrentCommand:nil]; It makes use of private methods (cliView and shellView) so it's a hack. We will have a better way of doing this in the near future. Philippe Le 14 juin 08 à 13:29, Peter A Passaro a écrit : > > Hi Philippe and Co, > > I'm currently integrating F-Script into my time series analysis > software and I am wondering about how to use FSInterpreterView > properly. What I would like to do is execute commands that I have sent > to FSInterpreterView via the -putCommand method. Specifically, what I > would like is a convenience method similar to the ShellView method - > executeCurrentComand that is accessible from FSInterpreterView. > > Should I go ahead and write my own convenience methods by altering > CLIview and ShellView as necessary? Or is there just a much simpler > way to do this that I am missing? My intention here is to go through a > number of processing steps automatically, and let the user observe > what is happening. I could just use the FSInterpreter directly and > return its results, but I still need a way to get the user back to the > command prompt (possibly by faking a RETURN keyDown event to the > view). > > By the way, f-script is an absolutely brilliant package - it is > fantastic that this is available and completely open source. I have > been using it heavily for about two weeks, and have found myself > starting to rely on it for my Cocoa dev. I'm trying to put together an > intuitive system for academics (mostly neuroscientists) for analyzing > and simulating time series data, and I wanted to include a scripting > language. The APL + Cocoa style syntax is exactly what I needed. I > have been using the GNU scientific library for fast vector processing > and math functions, so I'm now looking at ways of using the best > features of both the GSL and f-script together. > > Peter Passaro > Research Officer > Dept of Informatics/Dept of Biology > Pevensey III > University of Sussex > Falmer, Brighton BN1 9QH, UK > Office + 44 (0)1273 877590 > P.A...@su... > > > > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > F-Script-talk mailing list > F-S...@li... > https://lists.sourceforge.net/lists/listinfo/f-script-talk > |
From: Philippe M. <pm...@ac...> - 2008-06-22 08:40:45
|
Peter, This is fixed in the forthcoming alpha. You'll be able to use carriage return characters (i.e., ASCII code 13, specified using the \r escape sequence in string literals) to emulate a user pressing the Return key . Philippe Le 14 juin 08 à 13:29, Peter A Passaro a écrit : > > Hi Philippe and Co, > > I'm currently integrating F-Script into my time series analysis > software and I am wondering about how to use FSInterpreterView > properly. What I would like to do is execute commands that I have sent > to FSInterpreterView via the -putCommand method. Specifically, what I > would like is a convenience method similar to the ShellView method - > executeCurrentComand that is accessible from FSInterpreterView. > > Should I go ahead and write my own convenience methods by altering > CLIview and ShellView as necessary? Or is there just a much simpler > way to do this that I am missing? My intention here is to go through a > number of processing steps automatically, and let the user observe > what is happening. I could just use the FSInterpreter directly and > return its results, but I still need a way to get the user back to the > command prompt (possibly by faking a RETURN keyDown event to the > view). > > By the way, f-script is an absolutely brilliant package - it is > fantastic that this is available and completely open source. I have > been using it heavily for about two weeks, and have found myself > starting to rely on it for my Cocoa dev. I'm trying to put together an > intuitive system for academics (mostly neuroscientists) for analyzing > and simulating time series data, and I wanted to include a scripting > language. The APL + Cocoa style syntax is exactly what I needed. I > have been using the GNU scientific library for fast vector processing > and math functions, so I'm now looking at ways of using the best > features of both the GSL and f-script together. > > Peter Passaro > Research Officer > Dept of Informatics/Dept of Biology > Pevensey III > University of Sussex > Falmer, Brighton BN1 9QH, UK > Office + 44 (0)1273 877590 > P.A...@su... |
From: Peter A P. <p.a...@su...> - 2008-06-22 02:20:47
|
Thanks for that Phillipe. The hack worked fine, but it will be nice not to get compiler warnings :) Another possible convenience method suggestion for the FSInterpreterView - a method for creating one word commands. I've added one word commands for accessing some of the more commonly used methods in my objects by using NSInvocationOperation for a quick solution. In the example below, NEAFSCommand is a subclass of NSInvocationOperation that I override the -description method to tell it to invoke itself and return the returnString (to the FSInterpreterView). The interpreter then will invoke the method assigned to an NEAFSCommand object when its name is entered in the interpreter view. In the object that has the method I want to make a single word method, I include the lines newDoc = [[NEAFSCommand alloc] initWithTarget:self selector:@selector(newDocument:) object:nil]; [(NEAFSCommand *)newDoc setReturnString:@"new Document Created"]; [interpreter setObject:newDoc forIdentifier:@"newDoc"]; The -description method of NEAFSCommand contains: [[self invocation] invoke]; return returnString; The reason I'm doing this is because I want to have a set of simple, top-level commands for use inside the interpreter that are specific to the operation of my app. This also provides a shorthand to create a workflow of commands inside a block. Peter Passaro Research Officer Dept of Informatics/Dept of Biology Pevensey III University of Sussex Falmer, Brighton BN1 9QH, UK Office + 44 (0)1273 877590 P.A...@su... On 21 Jun 2008, at 16:56, Philippe Mougin wrote: > Peter, > > This is fixed in the forthcoming alpha. > You'll be able to use carriage return characters (i.e., ASCII code > 13, specified using the \r escape sequence in string literals) to > emulate a user pressing the Return key . > > Philippe > > Le 14 juin 08 à 13:29, Peter A Passaro a écrit : > >> >> Hi Philippe and Co, >> >> I'm currently integrating F-Script into my time series analysis >> software and I am wondering about how to use FSInterpreterView >> properly. What I would like to do is execute commands that I have >> sent >> to FSInterpreterView via the -putCommand method. Specifically, what I >> would like is a convenience method similar to the ShellView method - >> executeCurrentComand that is accessible from FSInterpreterView. >> >> Should I go ahead and write my own convenience methods by altering >> CLIview and ShellView as necessary? Or is there just a much simpler >> way to do this that I am missing? My intention here is to go >> through a >> number of processing steps automatically, and let the user observe >> what is happening. I could just use the FSInterpreter directly and >> return its results, but I still need a way to get the user back to >> the >> command prompt (possibly by faking a RETURN keyDown event to the >> view). >> >> By the way, f-script is an absolutely brilliant package - it is >> fantastic that this is available and completely open source. I have >> been using it heavily for about two weeks, and have found myself >> starting to rely on it for my Cocoa dev. I'm trying to put together >> an >> intuitive system for academics (mostly neuroscientists) for analyzing >> and simulating time series data, and I wanted to include a scripting >> language. The APL + Cocoa style syntax is exactly what I needed. I >> have been using the GNU scientific library for fast vector processing >> and math functions, so I'm now looking at ways of using the best >> features of both the GSL and f-script together. >> >> Peter Passaro >> Research Officer >> Dept of Informatics/Dept of Biology >> Pevensey III >> University of Sussex >> Falmer, Brighton BN1 9QH, UK >> Office + 44 (0)1273 877590 >> P.A...@su... > > |