Format Part23
-
Upload
mikee-s-cunanan -
Category
Documents
-
view
214 -
download
0
Transcript of Format Part23
-
7/29/2019 Format Part23
1/35
I. INTRODUCTION
In the very early days of computing, the only language employed was
comprised of native machine instructions, which were often entered by flipping
switches and moving cables around. Programmers had to know the numeric
representation of each instruction, and they had to calculate addresses for data
and execution paths. This generation of programming languages the analytical
and difference engine invented by Charles Babbage was introduced. Ada
Augusta is the programmer that programmed the analytical engine, she used
punch card to program the engine. Punch card often prepared
using keypunch machines, as the primary medium for input of both computerprograms and data.
Neumann Architecture is the designed that the programmers got the idea
in designing their programming languages that is why in 1950s a bright idea of
writing instructions in a human readable form by using symbols for instructions
and memory addresses was developed. They called this assembly language,
because they ran this text through a utility called an assembler that would
translate the nearly-human-readable code into machine instructions. Assembly
language is often considered the second generation of computer languages.
Naturally, each type of processor has its own flavor of assembly language
corresponding to its unique instruction set and addressing capabilities.
Translating a program from one processors assembly to another can be quite a
task, especially if its over 30,000 lines of code that makes use of idiosyncrasies
of the target processor.
The ending of second generation becomes the start of a new generation
which was called the third generation programming languages or most people
called the generation of high level programming languages. In this generation
they make the programming languages in a more readable form in which the
programmers can easily understand which sought to solve the machine-specific
problems. 3GLs expresses abstractions in a purely functional form and allows
http://en.wikipedia.org/wiki/Keypunchhttp://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Data_(computing)http://www.computerhope.com/jargon/num/1gl.htmhttp://www.computerhope.com/jargon/num/1gl.htmhttp://en.wikipedia.org/wiki/Data_(computing)http://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Keypunch -
7/29/2019 Format Part23
2/35
code and data to be interchanged easily. Thus, it appeals to mathematicians and
cognitive scientists and has proven to be a source of inspiration for other
programming languages ever since.
The 4th generation programming languages rise and these languages
sought to abstract business application development to the point where only the
business rules needed to be specified. In the 80s and early 90s many attempts
were made to rewrite applications in a 4GL, most of which failed miserably
because real-world applications require exceptions to any rule, and unless you
can easily get at lower layers of abstraction you cant use a highly abstract
language for all purposes. Thus, 4GLs are really only suitable for specificproblem domains, and so have over the years morphed into DSLs or scripting
languages for specific parts of applications, like VBA for MS Office or SQL for
database access.
Because of the programmers desired to create a programming language
that can be easily digested and program another generation of programming
language had rise and this was called as the Fifth-generation languages. This
way, the programmer only needs to worry about what problems need to be
solved and what conditions need to be met, without worrying about how to
implement a routine or algorithm to solve them, this languages are mainly used in
artificial Intelligence research.
-
7/29/2019 Format Part23
3/35
History of F-script
F-Script is an object-oriented scripting programming language for Apple's MacOS X operating system developed by Philippe Mougin. F-Script is tagged as
Cocoa developer's best friend, wherein the package provides an integrated set of
tools that makes it possible to interactively explore and manipulate Cocoa objects
as well as script them using new high-level programming techniques. F-Script is
Smalltalk with support for array programming for Cocoa Objects.
F-Script is based on a pure object paradigm (every entity manipulated within the
language is an object), its base syntax and concepts being identical to those of
Smalltalk (the canonical example of the category) with specific extensions to
support array programming as in APL.
F-Script provides an interpreter, interactive environment with support for
workspaces, which provide a rich set of functionality including object persistence,
distributed objects, GUI framework, database access, among other things.
http://en.wikipedia.org/wiki/Object-oriented_programminghttp://en.wikipedia.org/wiki/Scripting_languagehttp://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Apple_Inc.http://en.wikipedia.org/wiki/Mac_OS_Xhttp://en.wikipedia.org/wiki/Mac_OS_Xhttp://en.wikipedia.org/wiki/Cocoa_%28API%29http://en.wikipedia.org/wiki/Smalltalkhttp://en.wikipedia.org/wiki/Array_programminghttp://en.wikipedia.org/wiki/APLhttp://en.wikipedia.org/wiki/Object_persistencehttp://en.wikipedia.org/wiki/Distributed_objecthttp://en.wikipedia.org/wiki/GUIhttp://en.wikipedia.org/wiki/Databasehttp://en.wikipedia.org/wiki/Databasehttp://en.wikipedia.org/wiki/GUIhttp://en.wikipedia.org/wiki/Distributed_objecthttp://en.wikipedia.org/wiki/Object_persistencehttp://en.wikipedia.org/wiki/APLhttp://en.wikipedia.org/wiki/Array_programminghttp://en.wikipedia.org/wiki/Smalltalkhttp://en.wikipedia.org/wiki/Cocoa_%28API%29http://en.wikipedia.org/wiki/Mac_OS_Xhttp://en.wikipedia.org/wiki/Mac_OS_Xhttp://en.wikipedia.org/wiki/Apple_Inc.http://en.wikipedia.org/wiki/Programming_languagehttp://en.wikipedia.org/wiki/Scripting_languagehttp://en.wikipedia.org/wiki/Object-oriented_programming -
7/29/2019 Format Part23
4/35
General Features
F-Script 2.1 Release Notes
The main new feature in this version is support for adding methods to
existing classes. This is similar to Objective-C categories, but works
dynamically at run-time. This is quite useful for prototyping stuff and
experimenting with new designs, as well as for making object-oriented
frameworks developed independently work together. Besides, it is a
natural extension of the ability to define Cocoa classes directly in F-Script
and lets you write a bigger part of your application code in F-Script, should
you want to. You can teach new tricks to any class registered in the
Objective-C runtime, regardless of its original implementation language
(Objective-C, F-Script or other). The syntax is straightforward: class name
followed by new methods inside a pair of curly braces.
It is now possible to add F-Script methods to existing classes, much like
we do with categories in Objective-C. For example here is how we add a
print method to the NSObject class:
NSObject
{
- (void)print
{
stdout print:self description
}
}
-
7/29/2019 Format Part23
5/35
F-Script 2.0.2 Release Notes
This version fixes a memory management bug in the F-Script class
creation system when running in reference counting mode. You are
advised to upgrade.
Integration with Snow Leopard has been further improved. New symbolic
constants defined in Snow Leopard are now available in F-Script and a
number of new frameworks are now automatically loaded at launch time
by F-Script.app.
The section on memory management in the F-Script guide has been
expanded to better describe the memory management model and rules, in
particular when running in reference counting mode.
This version also brings minor UI improvements.
F-Script 2.0.1 Release Notes
Added support for F-Script injection on Mac OS X 10.6, as the current
version of F-Script Anywhere does not work on Mac OS X 10.6. See
instructions in "Extras/F-Script Anywhere/For Mac OS X 10.6/Read me".
Thanks to Ken Ferry for suggesting the workaround.
F-Script 2.0 Release Notes
F-Script 2.0 makes use of several technologies introduced in Mac OS X
10.5. It does not run on earlier versions of Mac OS X. If you need to run
on 10.3 and later, you should use the latest 1.3.x F-Script version
F-Script is now 64 bit capable. By default, F-Script.app will run in 64 bit
mode on 64 bit architectures. You can still run in 32 bit mode and you can
use the F-Script framework in 64 bit and 32 bit applications.
-
7/29/2019 Format Part23
6/35
A plugin for Interface Builder 3 is provided. It lets you easily embed F-
Script components into your application. Note that the F-Script "live" mode
for Interface Builder is no longer supported.
F-Script now supports a dedicated syntax for defining classes. When such
a class definition is evaluated, F-Script dynamically construct an
Objective-C class in memory. See the documentation for a more detailled
description of this new feature.
Garbage Collection:
o F-Script can now use the Objective-C 2.0 garbage collector. You
can still use F-Script in non-GC mode and you can use the F-Scriptframework in GC or non-GC mode. You can configure the memory
management mode for F-Script.app in the application's preference
panel.
o As with Objective-C, when you run F-Script in GC mode you no
longer have to care for retain cycles and for managing the retain
count of your objects with retain/release/autorelease.
o The methods objectPointer and objectPointer: of class FSPointer
have been modified to use the NSAllocateCollectable function, with
the NSScannedOption option, instead of malloc. This ensure that,
in GC mode, the object(s) pointers stored in the memory zone
represented by an FSObjectPointer are considered by the garbage
collector as strong references, thus ensuring correct semantic for
these methods. The memory zone will be freed on deallocation of
the FSObjectPointer (as in previous versions) when running in non-
GC mode, and will be freed by the garbage collector when running
in GC mode.
o A method + (FSGenericPointer*) allocateCollectable:
(NSUInteger)size options: (NSUInteger)options is now available on
class FSPointer. This method allocates a collectable memory zone
-
7/29/2019 Format Part23
7/35
with the NSAllocateCollectable function, then creates and returns
an FSGenericPointer instance pointing to this zone, or nil if the
memory cannot be allocated. If you want to pass 0 as option (which
means that the memory zone is not scanned for pointers by the
garbage collector), you might prefer to invoke the shorter
convenience method, +(FSGenericPointer
*)allocateCollectable:(NSUInteger)size.
F-Script 1.3.5 Release Notes
F-Script can now be compiled and run on Leopard with Xcode 3 (tested
with build 9a410). Advanced Leopard support (including 64 bits support) is
being worked on.
The new clear and clear: methods, provided by the System class, let you
remove (i.e., undefine) variables from your workspace. The clear method
removes all user-defined variables. The clear: method lets you specify the
name of the variable you want to remove.
A multiple assignment syntax has been added, as an experimentalfeature.
New math methods on numbers:
arcCosh computes the principle value of the inverse hyperbolic cosine of
the receiver.
arcSinh computes the inverse hyperbolic sine of the receiver.
arcTanh computes the inverse hyperbolic tangent of the receiver.
erf computes the error function of the receiver.
erfc computes the complementary error function of the receiver.
Minor bug fixes.
-
7/29/2019 Format Part23
8/35
F-Script 1.3.4 Release Notes
A bug in the log method that could lead to incorrect evaluation oflogarithms for arrays of numbers has been fixed. You are advised to
upgrade.
Updated documentation.
Minor UI improvements.
Minor internal improvements.
F-Script 1.3.3 Release Notes
F-Script is now Universal. It runs natively on both PowerPC and Intel-
based Macintosh computers.
The object browser displays Cocoa bindings.
Rectangles are now printed using their extent (i.e. size) instead of their
corner coordinates.
Minor UI improvements have been implemented.
This distribution of F-Script includes F-Script Anywhere 1.3, an amazing
tool developed by Robert Chin and Nicholas Riley. F-Script Anywhere lets
you dynamically inject F-Script into any Cocoa application and lets you
take control of the objects inside the application and freely play with them.
This new version of F-Script Anywhere requires Mac OS X 10.4 or later.
F-Script 1.3.2 Release Notes
The performance of the object browser has been considerably improved.
The object browser now displays the class hierarchy.
The code completion system, invoked by pressing F5, now inserts
placeholders for method arguments. You can move to the next argument
placeholder by typing Controlslash.
-
7/29/2019 Format Part23
9/35
The examples in Documentation/EmbeddingFScriptExamples/ have been
updated.
This version fixes a serious bug that could lead to a crash in some
situations when running F-Script on Intel in native mode.
F-Script 1.3.1 Release Notes
F-Script has been modified to compile with GCC 4.0. The F-Script
distribution is now built using GCC 4.0 and Xcode 2.2.1.
Re-objectification: in F-Script, the value of a managed object's property
can now be set by direct message sending (without having to explicitly use
KVC) even if the managed object does not implement the corresponding
method.
It is now possible to throw and handle any Objective-C object as an
exception object (you are no more limited to NSException objects). To let
you throw an object, the throw method has been added to FSNSObject, a
category of NSObject.
The executeWithArguments: method has been added to the Block class.
This method executes a block and returns an FSInterpreterResult object
describing the outcome of the execution. This is primarily useful when you
want to use F-Script from Objective-C code. The FSinterpreterResult
object lets you access either the result of the execution or a precise
description of the error that resulted from the execution.
It is now possible to call methods that take or return CGPoint, CGSize or
CGRect structs. F-Script uses the same mapping rules as the ones used
for NSPoint, NSSize and NSRect structs.
-
7/29/2019 Format Part23
10/35
A CGPoint is automatically mapped to an NSValue containing an NSPoint.
A CGSize is automatically mapped to an NSValue containing an NSSize.
A CGRect is automatically mapped to an NSValue containing an NSRect.
Support for AppleScript has been improved. The "eval" command, which
can be used to evaluate an F-Script expression from AppleScript, now
maps NSNumbers, NSArray, NSDate, NSDictionary, NSData, NSString
and NSAttributedString objects to their AppleScript equivalents instead of
just returning a text based description of the object.
The key handling model in the F-Script command line interface has been
improved. Standard key combinations like ctrl+p or ctrl+n are nowsupported, and the system integrates better with the standard Mac OS X
key bindings system.
The display of dictionaries in the object browser has been improved.
The object browser has been extended to displays more information
about several Cocoa classes.
A descriptive error message is now displayed when an error occurs while
processing the latent block.
A number of internal improvements have been made (complete rewrite of
the exception system, code refactoring etc.). As part of these internal
changes, several deprecated classes and methods have been removed:
The enclose and enclose: methods in the FSNSObject category.
The replication: and rotation: methods in the Array class.
The transposition: and fsmap methods in the FSNSArray category.
The fsmap method in the FSNSNumber category.
The asMutableString method in the FSNSString category.
The mod: method in the Number class.
The installTutorial method in the System class.
The FSPoint, FSSize, Range and Rectangle classes.
Several minor bugs have been fixed.
-
7/29/2019 Format Part23
11/35
F-Script 1.3.1 requires Mac OS X 10.3 or later. F-Script 1.3 is still
available for Mac OS X 10.2 users.
F-Script 1.3 Release Notes
The purpose of this version is to let you make the most out of Mac OS X
10.4. F-Script has been enhanced on many levels to provide interactive
access to the new technologies in Mac OS X 10.4. For example, the
object browser can now display rich information about new components inthe Application Kit, the symbols defined in the Objective-C-based
frameworks of Mac OS X 10.4 are available from F-Script, etc. In addition,
F-Script.app is now automatically linked with a number of new frameworks
found in Mac OS X 10.4. The complete list of frameworks F-Script.app is
now automatically linked with is:
Various UI improvements have been implemented (e.g. displaying a sort
indicator image in the collection inspector, remembering window size and
position etc.)
A QTMovie inspector has been implemented.
A sign method has been added in the FSNSNumber category. This
method answer 1 if the receiver is positive, 0 if the receiver equals 0, and -
1 if it is negative.
Several bugs have been fixed. Thanks to Andy Stark, this version comes with a convenient bookmarked
guide.
Core Data Explorer 1.0.F-Script now includes Core Data Explorer 1.0, a
technology providing interactive access to the newCore Data layerin Mac
OS X 10.4.With Core Data Explorer you can:
http://developer.apple.com/macosx/coredata.htmlhttp://developer.apple.com/macosx/coredata.htmlhttp://developer.apple.com/macosx/coredata.htmlhttp://developer.apple.com/macosx/coredata.html -
7/29/2019 Format Part23
12/35
Explore whole managed objects graphs with a powerful graphical object
browser.
Delve into collections of managed objects with a graphical collection
inspector.
Enter and evaluate Core Data queries interactively.
Manipulate managed objects with OOPAL, the high level object-oriented
programming model of F-Script.
Programmatically access the Core Data API interactively from the F-Script
environment. You can use Core Data Explorer from the F-Script
application or your own applications. You can also inject it into any third-party Cocoa application by using F-Script Anywhere.The object browser
let you freely explore and manipulate the object graph and the Core
Data stack. In addition, inspecting a collection of managed objects brings
up a fully configured collection inspector with which you can further delve
into your objects. A managed object context inspector lets you
interactively query an NSObjectContext using the predicate language
introduced in Mac OS X 10.4.OOPAL, the high-level programming model
of F-Script, let you easily manipulate Core Data managed objects.
F-Script 1.2.8 Release Notes
By default, F-Script now opens an object browser at launch time, in
addition to the command line interface. This behavior can be changed
from the preference panel.
The NSSearchField-based filter in the object browser has been extended
to act on every entry in the browser, including entries in the "object info"
sections and in the workspace column.
http://homepage.mac.com/kenferry/software.html#fsahttp://homepage.mac.com/kenferry/software.html#fsahttp://www.fscript.org/download/OOPAL.pdfhttp://www.fscript.org/download/OOPAL.pdfhttp://www.fscript.org/download/OOPAL.pdfhttp://www.fscript.org/download/OOPAL.pdfhttp://www.fscript.org/download/OOPAL.pdfhttp://homepage.mac.com/kenferry/software.html#fsa -
7/29/2019 Format Part23
13/35
The object browser now displays object description, information,
properties and methods in the same column. This makes it easier to
browse object graphs.
The support for pointers has been improved. This version introduces three
new classes for pointer management. These classes are FSPointer, a
semi-abstract class, and its two concrete subclasses: FSGenericPointer
and FSObjectPointer. The old Pointer class is now deprecated.
JGType, a new module contributed by Jrg Garbers, provides the ability to
create new classes from within F-Script. The support for this feature is
experimental in F-Script and is likely to evolve in future versions.
(Documentation forthcoming)
Most of the new symbolic constant names defined in Tiger's Objective-C
based frameworks are now available in F-Script.
Various minor UI and stability improvements have been implemented.
CoreData Explorer (Tiger only) gains the following features:
In the object browser, the values of a managed object's properties are now
displayed in the same column as the managed object itself. Thus, the
entire content of a managed object can be visualized directly.
With the introduction of CoreData specific "object info" sections, the object
browser lets you easily access and explore the whole CoreData stack
(object models, object contexts, predicates etc.)
In F-Script, the value of a managed object's property can be obtained by
direct message sending (without having to explicitly use KVC) even if themanaged object does not implement the corresponding method. For
instance, if anEmployee is a managed object with a salary property, you
can write:anEmployee salaryinstead of:anEmployee valueForKey:'salary'
The System class provides an instance method, named attach:, which
takes a managed object context as argument. For each entity associated
-
7/29/2019 Format Part23
14/35
with the managed object context, this method defines, in the workspace
associated with the receiver, an NSArray which is given the same name
as the entity and which contains all the managed objects corresponding to
the entity at the time of invocation. For instance, if myObjectContext is a
managed object context associated with an Employee entity and a
Department entity, then, after executing:sys attach:myObjectContext the
F-Script workspace will contains two new arrays, named Employee and
Department. These arrays will contain the managed objects for their
corresponding entities: the Employee array will contain all the employees
and the Department array will contain all the departments.
This method is likely to bring in memory the whole persistent object graph
associated with the object context. In practice this should not be a
problem, unless you deal with very large data-sets. In such cases you
should avoid using this method.
Note that attach: is a convenience method. You still have full access to the
CoreData framework and can use its various APIs to get access to
managed objects.
F-Script 1.2.7 Release Notes
The collection inspector has been improved in the following ways:
o In order to improve readability, the collection inspector no longer
uses enclosing quotes when displaying the value of a string.
o Compact blocks attached to columns are now displayed without the
starting "#" character in column's headers.
o Blocks of the form [:object| object valueForKey:'akey'] are displayed
as aKeyin column's headers.
-
7/29/2019 Format Part23
15/35
o The collection inspector now provides an easy to use multi-step,
multi-criteria searching and sorting facility. A new button in the
toolbar, titled "Narrow", creates a new collection containing the
selected objects (or all the currently filtered objects if the selection
is empty) and opens a new inspector for this collection. It is then
possible to further refine the exploration.
The NSSearchField-based filter in the object browser will now filter class
names (when browsing classes using the "Classes" button), in addition to
methods.
The object browser is able to display more information about severalcommon Cocoa classes.
The object browser now automatically fills the argument sheet's form with
templates for some argument types (currently including NSRange,
NSSize, NSPoint, NSRect, and SEL).
A new button, titled "Browse", has been added to the object browser. It
opens a new browser for the selected object.
F-Script 1.2.7 introduces CoreData Explorer, a new technology available
when running on Mac OS X Tiger. In this version, CoreData Explorer is
available through the following features:
The object browser now displays properties of CoreData managed objects
and lets you easily interact with and explore the object graph.
When a collection contains CoreData managed objects of the same type,
the collection inspector automatically configures itself for displaying the
properties of the objects. The Pointer class has been extended and refined in several ways. In
particular, Pointer objects can now be dereferenced, using the new at: and
at:put: methods. This makes F-Script more effective for dealing with
Objective-C APIs involving custom C pointers.
-
7/29/2019 Format Part23
16/35
The method at: defined for NSArrays by the FSNSArray category can now
be invoked with an NSIndexSet as argument (in addition to the already
supported argument types).
The method at:put: defined for NSMutableArrays by the
FSNSMutableArray category now accepts whole arrays of indices,
Boolean arrays and NSIndexSets, like the at: method. This makes it easy
to replace several elements of the receiver at once.
F-Script 1.2.6 Release Notes
The object browser has been widely improved. In particular:
An NSSearchField-based method filter has been added to the toolbar (on
Mac OS X 10.3 and later only).
The object browser has more built-in knowledge of common Cocoa
classes and design patterns.
A collection inspector has been implemented. The inspector lets you
graphically inspect NSArray, NSDictionary and NSSet objects. It is basedon an evolution of the graphical array inspector introduced in version
1.2.3, and comes with new features (including, on Mac OS X 10.3 and
later, an NSSearchField-based row filter). You can open it from the object
browser by double clicking on a collection or sending the inspectIn: or
inspectIn:with: messages to a collection.
The code completion system has been improved and is now based on
Panther's NSTextView completion layer, which provides a better user
interface (on Mac OS X 10.3 and later only). Note: code completion is
invoked by pressing the F5 key.
F-Script now uses the new standard Find panel (on Mac OS X 10.3 and
later only).
-
7/29/2019 Format Part23
17/35
Undo/redo is now available in block inspectors (on Mac OS X 10.3 and
later only).
An NSAttributedString inspector has been implemented. It shows the
interpreted attributed string and also displays the description of the
attributed string as returned by the printString method.
The block inspector now has a "Run" button in its toolbar. This button
makes it possible to evaluate the block from the inspector itself. The result
of the evaluation is shown in the object browser.
FScriptMenuItem, a new public subclass of NSMenuItem, lets you easily
embed a complete F-Script environment into an application. The F-Script palette for Interface Builder now contains an
FScriptMenuItem.
An NSFont inspector has been implemented. It opens the font panel and
shows the font.
The F-Script run-time has been made thread safe. It is now possible to
use F-Script concurrently from multiple threads in the same process. Note
that classes provided by the F-Script framework (e.g. Array, Block, etc.)
are generally not thread safe when sharing instances: you should
synchronize appropriately if you share instances of these classes between
multiple threads. However, note that the following F-Script classes are
thread safe: FSBoolean, FSVoid, Number.
F-Script includes several categories adding methods to standard Cocoa
classes. Categories that apply to Cocoa classes documented as thread
safe do not break thread safety.
Note that you should not share workspaces or block environments
between multiple threads. If you need to execute multiple chunks of F-
Script code concurrently, you should use a different FSInterpreter instance
for each one.
-
7/29/2019 Format Part23
18/35
Local variables in a block are now automatically initialized to nilwhen the
block is evaluated. This is in line with the ANSI Smalltalk standard.
Methods taking arguments of type _Bool or returning a value of this type
can now be invoked from F-Script. FSBooleans objects are automatically
mapped to _Bool values by F-Script. _Bool is a new type introduced by
the ISA/IEC 9899 (aka C99) standard and now supported by GCC.
In previous versions, the F9 and F10 function keys were used for
Parenthesizing and Switching the paste parsing modes. We now use the
F8 and F7 function keys instead.
The methods enclose and enclose: defined in FSNSObject aredeprecated, use enlist and enlist: instead (same semantics).
In order to improve integration with Cocoa (in particular, in the context of
key-value coding), this version introduces a new way of dealing with the
NSRange, NSPoint, NSRect and NSSize data types.
Values of these types are now represented in F-Script using NSValue
objects. The wrapping and unwrapping of such values in/from NSValues
object is performed automatically by F-Script when needed, allowing one
to invoke, from F-Script, methods that take or return such values.
In previous versions, F-Script provided separate classes to represent
NSRange, NSPoint, NSRect and NSSize values. These classes (i.e.,
Range, FSPoint, Rectangle and FSSize) are still provided for backward
compatibility, and automatic unwrapping from instances of these classes
to corresponding C structs is still performed. The new FSNSValue
category adds to the NSValue class a set of methods similar to the
methods provided by the four old classes. This provides a good support
for backward compatibility and transparent migration. However, a few of
the methods implemented by the old classes are not provided by the
-
7/29/2019 Format Part23
19/35
FSNSValue category. Thus, you may have to modify your code if it makes
use of these methods; either by eliminating the need to call these methods
or by ensuring your code invokes them on an instance of the correct old
class instead of on an NSValue.
See the F-Script documentation for a complete description of the old
classes and the new FSNSValue category.
F-Script.app is now automatically linked with the WebKit (on Mac OS X
10.3 and later only).
The open source license applying to F-Script has been changed and is
now based on the modified BSD license.
F-Script 1.2.5 Release Notes
The main new feature in F-Script 1.2.5 is support for Mac OS X 10.3. The
previous version would launch on 10.3 but crash on some operations.
A few bugs have been fixed.
The documentation has been improved, with a widely enhanced version ofthe OOPAL paper.
WARNING -> BACKWARD INCOMPATIBLE CHANGE: In the previous
version, when a method's return type was char * (or unsigned char *), F-
Script automatically mapped the returned char pointer to an NSString
object when this method was invoked from F-Script. Also, in the previous
version, when a method's argument type was char * (or unsigned char *),
you had to provides an NSString object for this argument when invoking
this method from F-Script. Starting with F-Script 1.2.5, this mapping
between char * (and unsigned char *) and NSString no longer happens.
Now, char * (and unsigned char *) are mapped to Pointers objects.
-
7/29/2019 Format Part23
20/35
F-Script 1.2.4 Release Notes
The integration between F-Script and Cocoa has been improved. Thesechanges are backward compatible.
o F-Script now uses Cocoa's NSNumber class cluster to represent
numbers. All the methods previously defined by the Number class
have been added to NSNumber through the FSNSNumber
category. All the public APIs previously using the Number class (for
argument and/or return values) now use the NSNumber class. The
Number class is now a subclass of NSNumber.
o F-Script's array programming model can now be used on any
NSArray object. All the methods previously implemented by the
Array class have been implemented for NSArray and
NSMutableArray, through the FSNSArray and FSNSMutableArray
categories.
The documentation has been extended with a new paper OOPAL:
Integrating Array Programming in Object-Oriented Programming (note:
this is a preliminary draft. The final version of the paper will be presented
at OOPSLA this fall).
Inter-framework dependencies have been greatly reduced for
FScript.framework and FScriptPalette.palette. These modules are now
only statically linked with the Foundation, AppKit, ExceptionHandling,
JavaVM and InterfaceBuilder (FScriptPalette.palette only) frameworks. In
the previous version they were statically linked with several otherframeworks including AddressBook, DiscRecording, IOBluetooth, etc.
The repository is now created by default at "~/Library/Application
Support/F-Script".
-
7/29/2019 Format Part23
21/35
The method -(FSSize *)size has been added to class Rectangle. Returns
a Rectangle's extent as an FSSize object.
The method -(id)fsmap of category FSNSNumber is deprecated.
The method -(id)fsmap of category FSNSArray is deprecated.
The method -(BOOL)hasFrac_bool of category FSNSNumber is
deprecated.
Several bugs have been fixed.
F-Script 1.2.3 Release Notes
A graphical array inspector has been implemented. You can open it from
the object browser by double clicking on an NSArray or sending the
inspectIn: or inspectIn:with: messages to an NSArray.
Example1: P inspectIn:sys
Example 2: P inspectIn:sys with:{#name, #salary, [:pilot | pilot salary >200000]}
-
7/29/2019 Format Part23
22/35
As you see, each column (except the "index" column) is associated with a one-
argument block. Each block is evaluated for each element of the array and the
result is displayed in the inspector.
The Add button lets you add and configure a new column. The Modify button
lets you modify the block associated with the selected column. You will have the
possibility to enter the code of the block through the graphical block inspector.
The Remove button lets you remove the selected column. The Sort button lets
you sort the rows according to the values associated with the selected column.
The Inspect button opens an inspector for the array's element associated with
the selected row (you can also double click on a row). The Browse button opens
an object browser for the array's element associated with the selected row. The
Refresh button re-compute and redisplay the table.
The stunning "Associate with interface" feature of F-Script Anywhere is
now available in F-Script as well. A new button, called "Select View" has
been added to the object browser. This button lets you select an NSView
graphically by just clicking on it on-screen! The selected view is then
displayed in the object browser.
-
7/29/2019 Format Part23
23/35
Step 1: Click on the "Select View" button -> the cursor change to a cross.
Step 2: Click on a visual part of the current application -> F-Script finds
the view object that has been clicked on, and selects it in the object
browser.
Idea and part of the code borrowed from Nicholas Riley's F-Script
Anywhere.
For easier navigation, the object browser now displays additional
information (target, subviews etc.) when browsing some classes like
NSView, NSWindows, NSCell and others.
Whenever possible, the object browser now gives indications about the
kind of the arguments you have to provide to the selected method.
-
7/29/2019 Format Part23
24/35
An advanced customization feature has been added to the object browser
toolbar, implemented from an idea and first prototype by Joerg Garbers.
As an F-Script user, you can now completely customize up to ten buttons
that can be added to the object browser toolbar. This specific
customization process is initiated by the standard toolbar customization
process (e.g. selecting the "Customize toolbar" menu item).
Double-clicking an object in the object browser opens an inspector for this
object.
An NSImage inspector has been added.
Example: (NSImage alloc initWithContentsOfFile:'/Library/Desktop
Pictures/Nature/Ladybug.jpg') inspect
-
7/29/2019 Format Part23
25/35
The preference panel of the F-Script application now allows setting
whether F-Script should ask for confirmation when quitting.
F-Script is now automatically linked with a number of the new frameworks
found in Jaguar. The complete list of frameworks F-Script is now
automatically linked with is:
AddressBook
AppKit
ExceptionHandling
DiscRecording
Foundation
IOBluetooth
IOBluetoothUI
JavaVM
Message
PreferencePanes
ScreenSaver
APIs in these frameworks can be accessed from F-Script without requiringany configuration. For instance, typing ABAddressBook
sharedAddressBook people valueForProperty:kABLastNameProperty
returns the names of people registered in your address book.
-
7/29/2019 Format Part23
26/35
In previous versions, it was not possible, from F-Script, to call methods
taking pointers as arguments or returning a pointer (other than object
pointers and char *). F-Script now supports these methods, thanks to the
new user class Pointer. C pointers are now automatically mapped to
Pointer instances. See the user guide for more about the Pointer class.
The user method guardedValue: has been added to class Block. This
method executes the receiver and returns the result. If an error occurs
during execution, it displays the block call stack to the user and returns nil.
This method is useful when you want a block to be the target of an
NSControl (for instance a button). Instead of using value: as the actionmethod, you may use this method in order to have the block inspector
pops-up automatically in case of error.
The sort method of the Array class has been rewritten. The previous
version of sort was not preserving pre-existing order among equal
elements (that is, if two elements compared as equal, the order of their
indices in the sorted array was undefined). The new version is "stable": it
preserves pre-existing order among elements that are equal, which is
quite useful in typical data-analysis use-cases.
The class method +(BOOL)validateSyntaxForIdentifier:(NSString
*)identifier has been added to FSInterpreter. Returns YES if the argument
conforms to the syntax of identifiers in the F-Script language.
Support for the new keyed archiving system introduced in Jaguar has
been implemented. Archives created by the save and save: method will
use keyed archiving. The load and load: methods are able to read keyed
archives, as well as old-style archives. F-Script public classes support
both archiving styles.
A number of goodies from Joerg Garbers have been added -> see the
directory JGAdditions in the source code distribution.
The user method < has been added to class FSBoolean.
-
7/29/2019 Format Part23
27/35
The user method < has been added to class NSNumber (through the
FSNSNumber category)
The user methods browse and browse: have been added to the
FSInterpreter class. Opens an object browser.
The user methods browseKV and browseKV: have been added to the
FSInterpreter class. Opens a key value object browser.
The user method truncated has been added to class Number. Answer an
integer equal to the receiver truncated towards zero.
The user method prefix of class Array is deprecated. Use the prefixes
method instead (same semantics). The user method mod: of class Number is deprecated. Use the rem:
method instead (same semantics).
The user method replication: is deprecated. Use replicate: instead. (same
semantics).
The user method \\ of class Array and FSNSArray category is deprecated.
Use the scan: method instead (same semantics).
The user method rotation: of class Array is deprecated. Use rotatedBy:
instead (same semantics).
The user method transposition: of class Array is deprecated. Use
transposedBy: instead (same semantics).
The user method asMutableString (provided by FSNSString) is
deprecated.
Various UI improvements not described here have been implemented.
Several bugs have been fixed.
-
7/29/2019 Format Part23
28/35
History of Jass
JASS or JASS2 (sometimes said to stand for Just Another Scripting Syntax) is an
event driven scripting language used in Blizzard Entertainment'sWarcraft IIIgame and
its expansion packThe Frozen Throne. Map creators can use it in the World Editor to
create scripts for triggers and AI (artificial intelligence) in custom maps and campaigns.
The language provides an extensive API that gives programmers control over
nearly every aspect of the game world. It can, for example, execute simple GUI
functions such as giving orders to units, changing the weather and time of day,
playing sounds and displaying text to the player, and manipulating the terrain.
JASS can also create powerful functions such as trackables, which detect if a
mouse goes over or hits a position, GetLocalPlayer(), which can cause
disconnects if used improperly (such as using handles with GetLocalPlayer() ). It
has a syntax similar to Turing and Delphi, but unlike those languages, it is case
sensitive. JASS primarily uses procedural programming concepts, though
popular user-made modifications to Blizzard's World Editor program have since
added C++-like object-oriented programming features to the syntax of JASS.
Sample code
The following function creates a string containing the message "Hello, world!"
and displays it to all players:
function Trig_JASS_test_Actions takes nothing returns nothingcall DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Hello, world!")
endfunction
http://en.wikipedia.org/wiki/Event_driven_programminghttp://en.wikipedia.org/wiki/Scripting_languagehttp://en.wikipedia.org/wiki/Blizzard_Entertainmenthttp://en.wikipedia.org/wiki/Warcraft_III:_Reign_of_Chaoshttp://en.wikipedia.org/wiki/Warcraft_III:_Reign_of_Chaoshttp://en.wikipedia.org/wiki/Warcraft_III:_Reign_of_Chaoshttp://en.wikipedia.org/wiki/Expansion_packhttp://en.wikipedia.org/wiki/Warcraft_III:_The_Frozen_Thronehttp://en.wikipedia.org/wiki/Warcraft_III:_The_Frozen_Thronehttp://en.wikipedia.org/wiki/Warcraft_III:_The_Frozen_Thronehttp://en.wikipedia.org/wiki/Warcraft_III_World_Editorhttp://en.wikipedia.org/wiki/Artificial_intelligencehttp://en.wikipedia.org/wiki/Application_programming_interfacehttp://en.wikipedia.org/wiki/Syntaxhttp://en.wikipedia.org/wiki/Turing_programming_languagehttp://en.wikipedia.org/wiki/Delphi_programming_languagehttp://en.wikipedia.org/wiki/Procedural_programminghttp://en.wikipedia.org/wiki/C%2B%2Bhttp://en.wikipedia.org/wiki/Object-Oriented_Programminghttp://en.wikipedia.org/wiki/Subroutinehttp://en.wikipedia.org/wiki/String_%28computer_science%29http://en.wikipedia.org/wiki/Hello,_world%21http://en.wikipedia.org/wiki/Hello,_world%21http://en.wikipedia.org/wiki/String_%28computer_science%29http://en.wikipedia.org/wiki/Subroutinehttp://en.wikipedia.org/wiki/Object-Oriented_Programminghttp://en.wikipedia.org/wiki/C%2B%2Bhttp://en.wikipedia.org/wiki/Procedural_programminghttp://en.wikipedia.org/wiki/Delphi_programming_languagehttp://en.wikipedia.org/wiki/Turing_programming_languagehttp://en.wikipedia.org/wiki/Syntaxhttp://en.wikipedia.org/wiki/Application_programming_interfacehttp://en.wikipedia.org/wiki/Artificial_intelligencehttp://en.wikipedia.org/wiki/Warcraft_III_World_Editorhttp://en.wikipedia.org/wiki/Warcraft_III:_The_Frozen_Thronehttp://en.wikipedia.org/wiki/Expansion_packhttp://en.wikipedia.org/wiki/Warcraft_III:_Reign_of_Chaoshttp://en.wikipedia.org/wiki/Blizzard_Entertainmenthttp://en.wikipedia.org/wiki/Scripting_languagehttp://en.wikipedia.org/wiki/Event_driven_programming -
7/29/2019 Format Part23
29/35
Types
JASS is statically-typed, and its types can be separated into two classes: nativesand handles. The native types are:
integer (32-bit signed) real (32-bit floating point numbers, similar to the float type in Java) string (limit is 1023 signs, actually to provide save/load compatibility it's
required to use only 1013 signs) boolean code
All other types are considered non-native. The native types behave very similarlyto primitive types in other programming languages. Handle types, however,behave more like objects. Handle types often represent an "object" within thegame (units, players, special effects, etc.). Similarly to how Java treats Objects,all variables and parameters in JASS of handle types are treated as values, butin reality those values are nothing but references to the handle objects. Thisbecomes important when dealing with garbage collection because handles, if notproperly cleaned up, can cause significant performance issues. Additionally, localvariables do not properly dereference handles when they go out of scope. If theyare not nullified properly, handle indices will not be garbage collected and willeventually leak. Also, any references to handles themselves take up some
memory space. Users may experience reduced performance if they are notnullified, though on a much smaller scale.
http://en.wikipedia.org/wiki/Type_system#Static_typinghttp://en.wikipedia.org/wiki/Data_typehttp://en.wikipedia.org/wiki/Java_%28programming_language%29http://en.wikipedia.org/wiki/Primitive_Typehttp://en.wikipedia.org/wiki/Object_%28computer_science%29http://en.wikipedia.org/wiki/Java_%28programming_language%29http://en.wikipedia.org/wiki/Reference_%28computer_science%29http://en.wikipedia.org/wiki/Garbage_collection_%28computer_science%29http://en.wikipedia.org/wiki/Garbage_collection_%28computer_science%29http://en.wikipedia.org/wiki/Reference_%28computer_science%29http://en.wikipedia.org/wiki/Java_%28programming_language%29http://en.wikipedia.org/wiki/Object_%28computer_science%29http://en.wikipedia.org/wiki/Primitive_Typehttp://en.wikipedia.org/wiki/Java_%28programming_language%29http://en.wikipedia.org/wiki/Data_typehttp://en.wikipedia.org/wiki/Type_system#Static_typing -
7/29/2019 Format Part23
30/35
Basic syntax
Syntaxof JASS is similar toTuring. It iscontext free. Examples of basic syntaxare shown below:
function syntax_Example_Sum takes integer i, real r returns real //functiondeclaration must include: the keyword "function",
//the function name, parameters (if any)and return type (if
//it returns something)
return i + r //return statements must begin with the keyword "return"endfunction //the keyword "endfunction" signals the end of a function blockfunction syntax_Example takes nothing returns nothinglocal integer i //declaring a local variable requires the modifier "local", the
variable's data type, and the variable namelocal real r = 5.0 //local variable declarations must come before anything else in
a function and variables may be//initialized on declaration
//separated statements MUST be placed on separate linesset i = 6 //the keyword "set" is used to rebind variablescall syntax_Example_Sum( i, r ) //function calls must be preceded by the
keyword "call
set r = syntax_Example_Sum( i, r ) //the "call" keyword is omitted whenaccessing a function's return valueendfunction
http://en.wikipedia.org/wiki/Syntaxhttp://en.wikipedia.org/wiki/Syntaxhttp://en.wikipedia.org/wiki/Turing_programming_languagehttp://en.wikipedia.org/wiki/Turing_programming_languagehttp://en.wikipedia.org/wiki/Turing_programming_languagehttp://en.wikipedia.org/wiki/Context-free_grammarhttp://en.wikipedia.org/wiki/Context-free_grammarhttp://en.wikipedia.org/wiki/Context-free_grammarhttp://en.wikipedia.org/wiki/Context-free_grammarhttp://en.wikipedia.org/wiki/Turing_programming_languagehttp://en.wikipedia.org/wiki/Syntax -
7/29/2019 Format Part23
31/35
General Features
agent
Since patch 1.24b there is a new handle-based type called "agent" which hasbeen introduced to separate handle types of which objects has to be deletedmanually (Dynamic memory allocation) and handle types of which objects aredeleted automatically (Stack-based memory allocation). For example types "unit","rect" or "destructable" which refer to dynamic allocated objects do extend type"agent" now whereas types such as "race" or "alliancetype" which actually areonly some kind of wrappers for the native type "integer" and can be compared toenumerated types do still extend type "handle".
Type casting
Of the primitive types, type casting between integer, real, and string is officiallysupported by the language. JASS supports both implicit and explicit type casting.
Implicit casting only occurs from real to integer.
The JASS library provides several functions for explicit type casting:
I2R(): casts integer to real R2I(): casts real to integer
I2S(): casts integer to string R2S(): casts real to string S2I(): casts string to integer
An important property of handle types related to type casting is that since allvariables of handles are just references, they can all be treated (and are treated)as integers. Each instance of a handle is assigned a unique integer value thatessentially acts as an identifier for the handle. Therefore, type casting fromhandles to integers, although technically not supported by JASS, is possible inpractice because implicit casting from handle types to integer can and will occurif the code is written in a certain way,
Arrays
JASS supports one-dimensional arrays of any type (excluding code). The syntaxto declare arrays and access members in an array is outlined in the code below.
http://en.wikipedia.org/wiki/Dynamic_memory_allocationhttp://en.wikipedia.org/wiki/Stack-based_memory_allocationhttp://en.wikipedia.org/wiki/Enumerated_typehttp://en.wikipedia.org/wiki/Type_conversionhttp://en.wikipedia.org/wiki/Type_conversion#Implicit_type_conversionhttp://en.wikipedia.org/wiki/Type_conversion#Explicit_type_conversionhttp://en.wikipedia.org/wiki/Reference_%28computer_science%29http://en.wikipedia.org/wiki/Array_data_structurehttp://en.wikipedia.org/wiki/Array_data_structurehttp://en.wikipedia.org/wiki/Reference_%28computer_science%29http://en.wikipedia.org/wiki/Type_conversion#Explicit_type_conversionhttp://en.wikipedia.org/wiki/Type_conversion#Implicit_type_conversionhttp://en.wikipedia.org/wiki/Type_conversionhttp://en.wikipedia.org/wiki/Enumerated_typehttp://en.wikipedia.org/wiki/Stack-based_memory_allocationhttp://en.wikipedia.org/wiki/Dynamic_memory_allocation -
7/29/2019 Format Part23
32/35
II. VARIABLES, IDENTIFIERS, DATA TYPES AND SPECIAL WORDS
Syntax for declaring variables in F-Script
: = .
x := 4.
Variable names in F-Script are simple identifiers consisting of a sequence of
letters, digits and underscores (_), beginning with a letter or an underscore. All
variables are object references. The assignment expression is denoted by the
":=" construct. The expression "x := 4." binds a number object with a value of 4 to
the target variable. Note that the value of an assignment expression is the value
that is assigned to its target variable The subsequent expression "x" will evaluate
to that number. The subsequent instruction "x := x + 1." is evaluated as follows:
1) The sub-expression x (from the right part of the assignment) evaluates
and returns the number object with a value of 4 that was bound to x.
2) The sub-expression "1" evaluates: this generates and returns a number
object with a value of 1.
3) The binary method "+" is invoked on the number object returned by step
1 with the number object returned by step 2 as the argument. The class
representing numbers is an Objective-C class, so the method "+" is
implemented in Objective-C (Objective-C does not permit symbols like "+"
to be used as method names, so F-Script automatically performs mapping
and in fact invokes the method "operator_plus:" ). This method generates
and returns a number object with a value of 5.
4) The assignment is made: x is bound to the number object returned by
step 3.
5) The number object returned by step 3 is returned as the value of the
assignment expression. You can assign an object to almost any name you
like. But if you attempt to display or make use of a variable before any
-
7/29/2019 Format Part23
33/35
object has been assigned to it, the interpreter will be unable to supply an
associated object, and won't proceed with the execution of your
instruction. It reports the trouble by yielding an error with a message in the
form of error: undefined identifier xxx.To get a list of user-defined
identifiers in your workspace, send the identifiers message to the
predefined object sys.
Expression list
x := 3. y:= 5. x+y
Evaluates to 8. The . symbol is also referred as the instruction separator.
Multiple expressions can be strung together by using the dot (.) separator. This
creates an expression list. An expression list evaluates to the result of the
evaluation of the last expression int he list.
Comments
"this is a comment"
Comments are delimited by double quotes.
Cascades
Example:
> myArray := {}> myArray add:99; add:100; add:101; count3> myArray{99, 100, 101}
A cascade is a sequence of message sends that are all directed to the same
object. Only the first in such a sequence has an explicit receiver specified. The
receiver of the subsequent messages
-
7/29/2019 Format Part23
34/35
is the same object as the receiver of the initial message in the sequence.
Otherwise, each message send occurs as if it was a normal message send that
was not part of a cascade. The result object of each message in the cascade
except the right-most message is discarded. The result of a cascade is the value
of its right-most message. Messages that form the cascade are separated by ;.
//Explain the Syntax declared above
III. CONTROL STRUCTURES
//Follow the format in declaring variables
IV. FUNCTION AND ARRAYS
//Follow the format in declaring variables
V. LANGUAGE EVALUATION CRITERIA
Reliability: Is the language designed in such a way that programming errors can
be detected and eliminated as quickly as possible? Errors detected by compile-
time checks are guaranteed absent in the running program, which is ideal. Errors
detected by run-time checks are guaranteed to cause no harm other than
throwing an exception (or at worst terminating the program),which is second-
best. Errors not detected at all can cause unlimited harm (such as corrupting
-
7/29/2019 Format Part23
35/35
data) before the program crashes. While reliability is always important, it is
absolutely essential in safety-critical systems.
Portability: Does the language help or hinder writing of portable code? In other
words, can the code be moved from.
..
VI. EVALUATION OF PROGRAMMING LANGUAGES
Java
Reliability: Java requires the specification of information, the omission of which
can make a program unreliable, such as type specifications
Portability:Java was built for complete portability. Its compiler produces source
code in a platform-independent bytecode. The bytecode is then translated at
runtime into native machine code for the given platform..
VII. SUMMARY AND CONCLUSION
// Discuss the summary and conlcusion
Portability Reliability
Java
Lisp