Misplaced Pages

AEOM

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

Apple events are the message-based interprocess communication mechanism in Mac OS , first making an appearance in System 7 and supported by every version of the classic Mac OS since then and by macOS . Apple events describe "high-level" events such as "open document" or "print file", whereas earlier OSs had supported much more basic events, namely "click" and "keypress". Apple events form the basis of the Mac OS scripting system, the Open Scripting Architecture (the primary language of such being AppleScript ).

#202797

58-463: AEOM may refer to: AppleEvent Object Model , a set of protocols built on top of AppleEvents by which applications running under Mac OS could control each other's functions All Eyez on Me , an album by Tupac Shakur Topics referred to by the same term [REDACTED] This disambiguation page lists articles associated with the title AEOM . If an internal link led you here, you may wish to change

116-403: A release message to self, and return nil to indicate that initialization failed. Any checking for such errors must only be performed after having called the superclass initialization to ensure that destroying the object will be done correctly. If a class has more than one initialization method, only one of them (the designated initializer ) needs to follow this pattern; others should call

174-692: A child of that parent, all collected in an AERecord . An iterator was provided by parents to enumerate their children, or children of a certain class, allowing applications to address a set of elements. The system was generally similar to the Document Object Model used in XML , although with some differences in access patterns. Each object could have elements and properties ; elements were other objects, which might be created or deleted, while properties could not be created or deleted but had values which might be interrogated or changed. For instance,

232-523: A corresponding implementation unless they are abstract . The Smalltalk-style programming as used in Objective-C allows messages to go unimplemented, with the method resolved to its implementation at runtime. For example, a message may be sent to a collection of objects, to which only some will be expected to respond, without fear of producing runtime errors. Message passing also does not require that an object be defined at compile time . An implementation

290-421: A few practical changes to existing tools. Specifically, they needed to support objects in a flexible manner, come supplied with a usable set of libraries , and allow for the code (and any resources needed by the code) to be bundled into one cross-platform format. Love and Cox eventually formed PPI to commercialize their product, which coupled an Objective-C compiler with class libraries. In 1986, Cox published

348-479: A method ; one sends a message . This is unlike the Simula -style programming model used by C++ . The difference between these two concepts is in how the code referenced by the method or message name is executed. In a Simula-style language, the method name is in most cases bound to a section of code in the target class by the compiler. In Smalltalk and Objective-C, the target of a message is resolved at runtime, with

406-412: A name labeling the argument that is part of the method name, followed by a colon followed by the expected argument type in parentheses and the argument name. The label can be omitted. A derivative of the interface definition is the category , which allows one to add methods to existing classes. The interface only declares the class interface and not the methods themselves: the actual code is written in

464-492: A platform for custom programming. To circumvent the terms of the GPL , NeXT had originally intended to ship the Objective-C frontend separately, allowing the user to link it with GCC to produce the compiler executable. Though initially accepted by Richard M. Stallman , this plan was rejected after Stallman consulted with GNU's lawyers and NeXT agreed to make Objective-C part of GCC. The work to extend GNU Compiler Collection (GCC)

522-410: A process on the local or a remote machine), and various other options for handling it. Remote machines initially had to be connected via AppleTalk , but Mac OS 9 added the option for connections via TCP/IP . After sending an Apple event to its target process, the sending process can elect to receive a reply to an Apple event. This can contain various bits of information returned from the target about

580-616: Is a high-level general-purpose , object-oriented programming language that adds Smalltalk -style message passing (messaging) to the C programming language. Originally developed by Brad Cox and Tom Love in the early 1980s, it was selected by NeXT for its NeXTSTEP operating system . Due to Apple macOS ’s direct lineage from NeXTSTEP, Objective-C was the standard language used, supported, and promoted by Apple for developing macOS and iOS applications (via their respective application programming interfaces ( APIs ), Cocoa and Cocoa Touch ) from 1997, when Apple purchased NeXT until

638-506: Is a list of methods that a class can opt to implement. It is specified in the documentation, since it has no presence in the language. Informal protocols are implemented as a category (see below) on NSObject and often include optional methods, which, if implemented, can change the behavior of a class. For example, a text field class might have a delegate that implements an informal protocol with an optional method for performing auto-completion of user-typed text. The text field discovers whether

SECTION 10

#1732797524203

696-470: Is an AERecord with fields that depended on the purpose of the event. In addition, it has attributes (which are distinct from record fields, which are now called the parameters of the event) from a set predefined by the Apple Event Manager. These specify what the event is supposed to do (through event class and event ID ), the target address to which the event is to be sent (which could be

754-535: Is based on OpenStep interface objects and is the most significant Objective-C environment being used for active development. At WWDC 2014, Apple introduced a new language, Swift , which was characterized as "Objective-C without the C". Objective-C is a thin layer atop C and is a "strict superset " of C, meaning that it is possible to compile any C program with an Objective-C compiler and to freely include C language code within an Objective-C class. Objective-C derives its object syntax from Smalltalk . All of

812-563: Is just an OSType code specifying the data type, together with a block of type-dependent data. For instance, the OSType code inte indicates that the data was a four-byte signed integer in big-endian format. Besides predefined type codes for various common simple types, there are two predefined structured descriptor types: an AERecord , which has data type reco (record), and AEList with type list (list or array). The internal structure of these contain recursively-nested AEDescs, while

870-489: Is named objc_msg_sendv , but it has been deprecated in favor of a modern lookup system under objc_msg_lookup . Both styles of programming have multiple strengths and weaknesses. Object-oriented programming in the Simula ( C++ ) style allows multiple inheritance and faster execution by using compile-time binding whenever possible, but it does not support dynamic binding by default. It also forces all methods to have

928-418: Is never an allocated object that hasn't undergone initialization (and because it is unwise to keep the intermediate result since -init can return a different object than that on which it is called). Instantiation with the default, no-parameter initializer: Instantiation with a custom initializer: In the case where no custom initialization is being performed, the "new" method can often be used in place of

986-488: Is not necessarily known at link time which method will be called because the class of the receiver (the object being sent the message) need not be known until runtime. Once an Objective-C class is written, it can be instantiated. This is done by first allocating an uninitialized instance of the class (an object) and then by initializing it. An object is not fully functional until both steps have been completed. These steps should be accomplished with one line of code so that there

1044-469: Is rare to find this kind of power in general-purpose scripting languages outside of SQL . Adding support for the AEOM in the classic Mac OS was a difficult process. Application developers had to identify their objects and hand-write code to allow them to be addressed. This typically took the form of code for returning the "next" object of a particular type, allowing AppleScript to iterate over them. But since

1102-449: Is still required for the method to be called in the derived object. (See the dynamic typing section below for more advantages of dynamic (late) binding.) Objective-C requires that the interface and implementation of a class be in separately declared code blocks. By convention, developers place the interface in a header file and the implementation in a code file. The header files, normally suffixed .h, are similar to C header files while

1160-424: Is to refer to an instance method, with the class and then method names appended and colons changed to underscores. As the order of parameters is part of the method name, it cannot be changed to suit coding style or expression as with true named parameters. However, internal names of the function are rarely used directly. Generally, messages are converted to function calls defined in the Objective-C runtime library. It

1218-633: Is uncommon to find a Cocoa application that is not scriptable to some degree. The Scripting Bridge is a macOS framework which allows applications to communicate with each other without the use of an intermediary scripting language such as AppleScript . Like AppleScript, the Scripting Bridge uses Apple events for inter-application communication . The Scripting Bridge is typically used from Objective-C , but can be used in other programming languages through an Objective-C bridge such as MacRuby and PyObjC . Objective-C Objective-C

SECTION 20

#1732797524203

1276-419: Is used to map the internal "object-like" names onto human-readable versions, and in most cases creating this is all that is needed to add fairly substantial scriptability to most programs. While Cocoa applications are not AEOM based, and often use subtly different objects than Apple's originally defined standard objects, Cocoa apps are generally much more scriptable than their "classic" counterparts—in fact, it

1334-619: The Cocoa API . Unofficial bindings also exist for other languages (with varying degrees of limitation), including Perl , UserTalk , Ruby and Python . The AppleEvent Object Model ( AEOM ) was a set of protocols built on top of AppleEvents by which applications running under classic Mac OS and macOS could control each other's functions. Applications that implemented some part of the AEOM were called scriptable because they could be controlled via AppleScript . Unfortunately, scriptability support remained patchy and inconsistent throughout

1392-542: The receiver — is not guaranteed to respond to a message, and if it does not, it raises an exception. Sending the message method to the object pointed to by the pointer obj would require the following code in C++ : In Objective-C, this is written as follows: The "method" call is translated by the compiler to the objc_msgSend(id self, SEL op, ...) family of runtime functions. Different implementations handle modern additions like super . In GNU families this function

1450-429: The AEOM considerably easier, dramatically reducing the amount of code needed in the average application. Additionally the majority of Cocoa applications are constructed primarily from Cocoa-standard objects, all of which were upgraded to offer fairly extensive scriptability. This extends not only to GUI objects as under MacApp, but also to data objects inside them, including text, tables and various list objects. A text file

1508-634: The AERecord also associates each element with a unique record field ID, which is an OSType. The Apple Event Manager provides API calls to construct these structures, as well as extract their contents and query the type of contents they hold. The Apple Event Manager also supports coercions , which converts AEDescs from one data type to another. In addition to standard coercions, for instance between integer and real types, applications can install their own coercion handler callbacks , which handle conversions to and from custom data types. An Apple event proper

1566-501: The OS did not contain an object model, this work was left entirely to the developers, many of whom did not implement it. Oddly, even Apple's own application framework , MacApp , did not offer such a model except for the GUI objects it knew about, once again making the developer do most of the work of scripting the objects representing the data itself. Largely for these reasons, AppleScript support

1624-878: The Objective-C frontend to Clang . The GNU project started work on its free software implementation of Cocoa , named GNUstep , based on the OpenStep standard. Dennis Glatting wrote the first GNU Objective-C runtime in 1992. The current GNU Objective-C runtime, in use since 1993, is the one developed by Kresten Krab Thorup while he was a university student in Denmark . Thorup also worked at NeXT from 1993 to 1996. After acquiring NeXT in 1996, Apple Computer used OpenStep in its then-new operating system, Mac OS X . This included Objective-C, NeXT's Objective-C-based developer tool, Project Builder , and its interface design tool, Interface Builder . Both were later merged into one application, Xcode . Most of Apple's current Cocoa API

1682-675: The Objective-C trademark) and extended the GCC compiler to support Objective-C. NeXT developed the Application Kit (AppKit) and Foundation Kit libraries on which the NeXTSTEP user interface and Interface Builder were based. While the NeXT workstations failed to make a great impact in the marketplace, the tools were widely lauded in the industry. NeXT dropped hardware production and focused on software tools, selling NeXTSTEP (and OPENSTEP) as

1740-491: The abilities of Smalltalk . He soon had a working implementation of an object-oriented extension to the C language, which he named Object-Oriented Pre-Compiler (OOPC). Love was hired by Schlumberger Research in 1982 and had the opportunity to acquire the first commercial copy of Smalltalk-80, which further influenced the development of their brainchild. To demonstrate that real progress could be made, Cox showed that making interchangeable software components really needed only

1798-428: The alloc-init messages: Also, some classes implement class method initializers. Like +new , they combine +alloc and -init , but unlike +new , they return an autoreleased instance. Some class method initializers take parameters: The alloc message allocates enough memory to hold all the instance variables for an object, sets all the instance variables to zero values, and turns the memory into an instance of

AEOM - Misplaced Pages Continue

1856-479: The application might have one or more window elements representing windows showing the contents of currently-open documents. These windows might have properties such as their title, position and size. An application could define custom verbs for operating on its objects. The AEOM also specified various standard verbs which (it was hoped) applications would implement in a consistent fashion, such as open, close, create element, delete, set data, and get data. Each verb

1914-466: The class; at no point during the initialization is the memory an instance of the superclass. The init message performs the set-up of the instance upon creation. The init method is often written as follows: In the above example, notice the id return type. This type stands for pointer to any object in Objective-C (See the Dynamic typing section). The initializer pattern is used to assure that

1972-437: The correspondence between internal AppleEvent codes and external natural-language descriptions is specified through the aete ( AppleEvent Terminology Extension ) resource — the "extension" being to the standard terminology built into AppleScript itself. An application may provide multiple 'aete' resources for multiple languages, in keeping with the original multilingual design of AppleScript itself For instance, consider

2030-639: The designated initializer instead of the superclass initializer. In other programming languages, these are called interfaces . Objective-C was extended at NeXT to introduce the concept of multiple inheritance of specification, but not implementation, through the introduction of protocols . This is a pattern achievable either as an abstract multiple inherited base class in C++ , or as an interface (as in Java and C# ). Objective-C makes use of ad hoc protocols called informal protocols and compiler-enforced protocols called formal protocols . An informal protocol

2088-509: The developer could at least reduce the workload of planning how to expose their objects. Yet because these objects were generally not part of the system itself (with the exception of the severely limited TextEdit editor), the actual implementation was left to the developer. Applications developed in Cocoa , the system formerly known as OpenStep , offer a rich object runtime that can be queried from any other application. This makes implementation of

2146-431: The following AppleScript sequence controlling a fictional drawing application: This actually involves the sending of two AppleEvents to the target application (and the receipt of their corresponding replies): first, a get-data event is sent to retrieve the background color property of the window identified by the name "Old Drawing"; then a set-data event is sent to apply the value returned as the background color property of

2204-448: The form: In the above, plus signs denote class methods , or methods that can be called on the class itself (not on an instance), and minus signs denote instance methods , which can only be called on a particular instance of the class. Class methods also have no access to instance variables . The code above is roughly equivalent to the following C++ interface: Note that instanceMethod2With2Parameters:param2_callName: demonstrates

2262-418: The history of classic Mac OS. The AEOM provided a syntactic layer under which any application could publish its internal objects, allowing those objects to be manipulated in a standardized way. Unlike other similar-sounding concepts such as ToolTalk , there was a clear, orthogonal distinction between nouns and verbs ; thus, instead of providing separate commands for "close document" and "close window", there

2320-443: The implementation (method) files, normally suffixed .m, can be very similar to C code files. This is analogous to class declarations as used in other object-oriented languages, such as C++ or Python. The interface of a class is usually defined in a header file. A common convention is to name the header file after the name of the class, e.g. Ball.h would contain the interface for the class Ball . An interface declaration takes

2378-533: The implementation file. Implementation (method) files normally have the file extension .m , which originally signified "messages". Methods are written using their interface declarations. Comparing Objective-C and C: The syntax allows pseudo- naming of arguments . Internal representations of a method vary between different implementations of Objective-C. If myColor is of the class Color , instance method -changeColorToRed:green:blue: might be internally labeled _i_Color_changeColorToRed_green_blue . The i

AEOM - Misplaced Pages Continue

2436-499: The interleaving of selector segments with argument expressions, for which there is no direct equivalent in C/C++. Return types can be any standard C type, a pointer to a generic Objective-C object, a pointer to a specific type of object such as NSArray *, NSImage *, or NSString *, or a pointer to the class to which the method belongs (instancetype). The default return type is the generic Objective-C type id . Method arguments begin with

2494-493: The introduction of the Swift language in 2014. Objective-C programs developed for non-Apple operating systems or that are not dependent on Apple's APIs may also be compiled for any platform supported by GNU GNU Compiler Collection (GCC) or LLVM / Clang . Objective-C source code 'messaging/implementation' program files usually have .m filename extensions, while Objective-C 'header/interface' files have .h extensions,

2552-466: The link to point directly to the intended article. Retrieved from " https://en.wikipedia.org/w/index.php?title=AEOM&oldid=487643284 " Category : Disambiguation pages Hidden categories: Short description is different from Wikidata All article disambiguation pages All disambiguation pages AppleEvent Object Model The starting point is a dynamically-typed, extensible descriptor format called an AEDesc , which

2610-409: The main description of Objective-C in its original form in the book Object-Oriented Programming, An Evolutionary Approach . Although he was careful to explain that there is more to the problem of reusability than just what Objective-C provides, the language was often compared feature for feature with other languages. In 1988, NeXT licensed Objective-C from StepStone (the new name of PPI, the owner of

2668-450: The object is properly initialized by its superclass before the init method performs its initialization. It performs the following actions: A non-valid object pointer has the value nil ; conditional statements like if treat nil like a null pointer, so the initialization code will not be executed if [super init] returned nil. If there is an error in initialization the init method should perform any necessary cleanup, including sending

2726-711: The processing of the original event, including an error code indicating success/failure, any information requested by the original event, and/or other appropriate information. Apple events are the foundation of the AppleEvent Object Model , which in turn is the foundation of the OSA and AppleScript . As of 2016 , the official implementation of the Apple Event Manager API is available in C and its descendants, including C++ . Official bindings are also provided for Objective-C and Swift through

2784-409: The receiving object itself interpreting the message. A method is identified by a selector or SEL — a unique identifier for each message name, often just a NUL -terminated string representing its name — and resolved to a C method pointer implementing it: an IMP . A consequence of this is that the message-passing system has no type checking. The object to which the message is directed —

2842-455: The reply event. The "set data" event took two parameters, the object descriptor for the property to set and the new value for the property; the reply event was only expected to return a success status or failure error code. The entire AppleEvent architecture identifies things using four-byte OSType codes, studiously avoiding actual words or phrases in English (or any other language). Instead,

2900-453: The same as C header files. Objective-C++ files are denoted with a .mm file extension. Objective-C was created mainly by Brad Cox and Tom Love in the early 1980s at their company Productivity Products International (PPI) . Leading up to the creation of their company, both had been introduced to Smalltalk while at ITT Corporation 's Programming Technology Center in 1981. The earliest work on Objective-C traces back to around then. Cox

2958-415: The syntax for non-object-oriented operations (including primitive variables, pre-processing, expressions, function declarations, and function calls) are identical to those of C, while the syntax for object-oriented features is an implementation of Smalltalk-style messaging. The Objective-C model of object-oriented programming is based on message passing to object instances. In Objective-C one does not call

SECTION 50

#1732797524203

3016-484: The window named "New Drawing". Since this sort of access pattern was typical, AppleScript made widespread use of the tell statement, which switched the context to the named object in a fashion similar to the with statement found in Visual Basic or Pascal . All commands after the tell to the corresponding end tell would be sent to the object named in the tell , instead of the default object, which

3074-453: Was a single "close" verb which could take references to "document" or "window" objects, or any other object that the application published. The objects that an application made available through its AEOM support were arranged in a hierarchy. At the top was the application itself, referenced via a null object descriptor. Other objects were referenced by (recursively) specifying their parent object, together with other information identifying it as

3132-399: Was defined as an AppleEvent of a specific type and class, together with particular parameters of particular types that were expected to be present. For instance, the "get data" event was the standard means for obtaining the value of a property: it took essentially one parameter, which was an object descriptor identifying the property to be queried. The value of that property would be returned in

3190-462: Was intrigued by problems of true reusability in software design and programming. He realized that a language like Smalltalk would be invaluable in building development environments for system developers at ITT. However, he and Tom Love also recognized that backward compatibility with C was critically important in ITT's telecom engineering milieu. Cox began writing a pre-processor for C to add some of

3248-420: Was led by Steve Naroff, who joined NeXT from StepStone. The compiler changes were made available as per GNU General Public License (GPL) terms, but the runtime libraries were not, rendering the open source contribution unusable to the general public. This led to other parties developing such runtime libraries under open source licenses. Later, Steve Naroff was also principal contributor to work at Apple to build

3306-422: Was not very widespread. Apple did attempt to address this problem with the introduction of various object "suites", which represented standard objects and verbs that were expected to be supported by different types of applications. For instance, all applications were expected to support the "core suite", and any application editing text was expected to support the "text suite". By selecting a suitable set of suites,

3364-551: Was the current application. Object descriptors allowed the identification of objects in various ways. The most interesting one was using a where-clause (which translated into AppleScript terminology as a filter expression ). For instance, the AppleScript 1.0 SDK shipped with the source code for an example application called the Scriptable Text Editor, which would respond to scripts such as: Even today, it

#202797