GEMLIB
0.44.0
|
initialization and interprocess communication More...
Macros | |
#define | appl_bvset(a, b) mt_appl_bvset(a,b,aes_global) |
#define | appl_control(a, b, c) mt_appl_control(a,b,c,aes_global) |
#define | appl_exit() mt_appl_exit(aes_global) |
#define | appl_find(a) mt_appl_find(a,aes_global) |
#define | appl_getinfo(a, b, c, d, e) mt_appl_getinfo(a,b,c,d,e,aes_global) |
#define | appl_xgetinfo(a, b, c, d, e) mt_appl_getinfo(a,b,c,d,e,aes_global) |
#define | appl_getinfo_str(a, b, c, d, e) mt_appl_getinfo_str(a,b,c,d,e,aes_global) |
#define | appl_read(a, b, c) mt_appl_read(a,b,c,aes_global) |
#define | appl_search(a, b, c, d) mt_appl_search(a,b,c,d,aes_global) |
#define | appl_tplay(a, b, c) mt_appl_tplay(a,b,c,aes_global) |
#define | appl_trecord(a, b) mt_appl_trecord(a,b,aes_global) |
#define | appl_write(a, b, c) mt_appl_write(a,b,c,aes_global) |
#define | appl_yield() mt_appl_yield(aes_global) |
#define | appl_getcicon() mt_appl_getcicon(aes_global) |
#define | appl_get_cicon(a, b, c, d, e, f) mt_appl_get_cicon(a,b,c,d,e,f, aes_global) |
Functions | |
static short | appl_init (void) |
short | mt_appl_bvset (short bvdisk, short bvhard, short *global_aes) |
short | mt_appl_control (short ap_cid, short ap_cwhat, void *ap_cout, short *global_aes) |
short | mt_appl_exit (short *global_aes) |
short | mt_appl_find (const char *name, short *global_aes) |
short | mt_appl_getinfo (short type, short *out1, short *out2, short *out3, short *out4, short *global_aes) |
short | mt_appl_getinfo_str (short type, char *out1, char *out2, char *out3, char *out4, short *global_aes) |
short | mt_appl_init (short *global_aes) |
short | mt_appl_read (short ap_id, short length, void *ap_pbuff, short *global_aes) |
short | mt_appl_search (short mode, char *fname, short *type, short *ap_id, short *global_aes) |
short | mt_appl_tplay (void *mem, short num, short scale, short *global_aes) |
short | mt_appl_trecord (void *mem, short count, short *global_aes) |
short | mt_appl_write (short ap_id, short length, void *ap_pbuff, short *global_aes) |
short | mt_appl_yield (short *global_aes) |
short | mt_appl_get_cicon (short type, const char *name, short size, short *cicon_width, short *cicon_height, CICON **cicon_data, short *global_aes) |
initialization and interprocess communication
The Application Services Library provides general use functions used in locating and working with other resident applications in addition to providing AES initialization and termination code.
#define appl_bvset | ( | a, | |
b | |||
) | mt_appl_bvset(a,b,aes_global) |
single-thread version of mt_appl_bvset()
#define appl_control | ( | a, | |
b, | |||
c | |||
) | mt_appl_control(a,b,c,aes_global) |
single-thread version of mt_appl_control()
#define appl_exit | ( | ) | mt_appl_exit(aes_global) |
single-thread version of mt_appl_exit()
#define appl_find | ( | a | ) | mt_appl_find(a,aes_global) |
single-thread version of mt_appl_find()
#define appl_get_cicon | ( | a, | |
b, | |||
c, | |||
d, | |||
e, | |||
f | |||
) | mt_appl_get_cicon(a,b,c,d,e,f, aes_global) |
single-thread version of mt_appl_get_cicon()
#define appl_getcicon | ( | ) | mt_appl_getcicon(aes_global) |
single-thread version of mt_appl_getcicon()
#define appl_getinfo | ( | a, | |
b, | |||
c, | |||
d, | |||
e | |||
) | mt_appl_getinfo(a,b,c,d,e,aes_global) |
single-thread version of mt_appl_getinfo()
#define appl_getinfo_str | ( | a, | |
b, | |||
c, | |||
d, | |||
e | |||
) | mt_appl_getinfo_str(a,b,c,d,e,aes_global) |
single-thread version of mt_appl_getinfo_str()
#define appl_read | ( | a, | |
b, | |||
c | |||
) | mt_appl_read(a,b,c,aes_global) |
single-thread version of mt_appl_read()
#define appl_search | ( | a, | |
b, | |||
c, | |||
d | |||
) | mt_appl_search(a,b,c,d,aes_global) |
single-thread version of mt_appl_search()
#define appl_tplay | ( | a, | |
b, | |||
c | |||
) | mt_appl_tplay(a,b,c,aes_global) |
single-thread version of mt_appl_tplay()
#define appl_trecord | ( | a, | |
b | |||
) | mt_appl_trecord(a,b,aes_global) |
single-thread version of mt_appl_trecord()
#define appl_write | ( | a, | |
b, | |||
c | |||
) | mt_appl_write(a,b,c,aes_global) |
single-thread version of mt_appl_write()
#define appl_xgetinfo | ( | a, | |
b, | |||
c, | |||
d, | |||
e | |||
) | mt_appl_getinfo(a,b,c,d,e,aes_global) |
single-thread version of mt_appl_getinfo()
#define appl_yield | ( | ) | mt_appl_yield(aes_global) |
single-thread version of mt_appl_yield()
|
inlinestatic |
single-thread version of mt_appl_init()
References aes_global, gl_ap_version, gl_apid, and mt_appl_init().
short mt_appl_bvset | ( | short | bvdisk, |
short | bvhard, | ||
short * | global_aes | ||
) |
tell PC-GEM which logical drives are connected to the system (for the file selector box).
bvdisk | Bit vector with all connected disk drives. Bit 15 (the most significant bit) denotes drive A: |
bvhard | Bit vector with all connected hard drives. |
global_aes | global AES array |
short mt_appl_control | ( | short | ap_cid, |
short | ap_cwhat, | ||
void * | ap_cout, | ||
short * | global_aes | ||
) |
Can be used to control the activity of applications.
ap_cid | the AES ID (apid) of the application you want to control. |
ap_cwhat | the type of control (refer to the table below) |
ap_cout | is filled by the AES dependent on ap_cwhat. |
global_aes | global AES array |
The table hereafter summaries the action performed by mt_appl_control() depending on the value given in ap_cwhat.
Values of ap_cwhat | Description |
0..9 | Reserved for N.AES |
APC_HIDE | Hide (fade out) application. If ap_cid is -1, the active application will be hidden. |
APC_SHOW | Show (fade in) application. If ap_cid is -1, all hidden applications are shown. |
APC_TOP | Bring application to front (the application becomes the active one). |
APC_HIDENOT | Hide all applications except the one referred to by ap_cid (which becomes the active application). If ap_cid is -1, all applications except the active one will be hidden. |
APC_INFO | Get the application parameter of the application ap_cid. If ap_cid is set to -1, the parameters of the active application are returned. ap_cout must point to a short variable. This variable is a bitmap variable:
|
APC_MENU | The last used menu tree is returned. The parameter ap_cout is a pointer to an pointer of OBJECT. The AES fills in the address of the menu tree. If ap_cid is set to -1, the address of the menu tree of the active application is returned. If ap_cid is set to 0 the address of the system menu (AES internally) is returned. If the wanted application has no menu bar or if the wanted application doesn't exist, a NULL-pointer is returned in *ap_cout. The return value always equals 1. Hint: the developer must know what he does! The changing of the tree can result in undefined system states. If MiNT memory protection is active, a read of the menu bar can result in an violation and terminate the application! |
APC_WIDGETS | This mode inquires or sets the 'default' positions of the window widgets. ap_cout is a pointer to buffer of size of MINWINOB (=12) short integers (16 bits). For inquiring the OBJECT order this buffer must be filled completly with -1. The last short must equal 0! If an error is returned the buffer is not large enough for all objects and should be enlarged. In the buffer the objects are contained in the following order: first the title bar from the left to the right, the objects of the vertical slider from top to bottom, the objects of the horizontal sloder from the left to the right. The list is terminated with a 0 short . For setting the positions, the first objects must be of the type topwidgets (from the left to the right), the next objects of the type right widgets (from top to bottom) and the last objects of the type bottom widgets (from the left to the right). If objects are set doubly or wrong, an error is returned. |
APC_APP_CONFIG | With this option you are able to inform to AES how you want your application should be considered. ap_cout is a pointer to a string. At this time value supported are:
|
APC_INFORM_MESAG | Request to AES to inform the application when there is a AES message waiting with a Unix Signal. ap_cout : not used. When the application receive a message the AES send the Signal SIGUSR2 (30) to the application, to manage the message should use classical event_mesag() or event_multi() functions. Calling one time this call request to AES to send Signal, calling a second time remove this order. appl_control return 1 if take into account else 0 |
Hidden application have a '*' placed in front of their names in the applications menu, unless they did not have a window open during hiding. If the latter is the case only the active application is changed.
So the '*' in front of the name means: One ore more windows of this application are hidden.
short mt_appl_exit | ( | short * | global_aes | ) |
Unregister an application from the AES and free its AES ID.
global_aes | global AES array |
The handling of an error (return value 0) is currently undefined.
short mt_appl_find | ( | const char * | name, |
short * | global_aes | ||
) |
searches the AES's current process list for a program named Name and, if present, returns the application identifier of the process.
name | is a pointer to a null-terminated ASCII string containing a valid GEMDOS filename (not including an extension) padded with blanks to be exactly 8 characters long (not including the NULL). |
global_aes | global AES array |
AES versions from 4.0 add several extensions to this call for the benefit of MultiTOS. This functionality only exists if the AES version is 4.0 and above and mt_appl_getinfo() indicates that it is available. Here is the extension description:
Referenced by mt_appl_getinfo(), and mt_appl_getinfo_str().
short mt_appl_get_cicon | ( | short | type, |
const char * | name, | ||
short | size, | ||
short * | cicon_width, | ||
short * | cicon_height, | ||
CICON ** | cicon_data, | ||
short * | global_aes | ||
) |
returns information about the AES.
type | : kind of icon type and format output |
name | : name of the color icon |
size | : size of icon |
cicon_width | : return pixel width |
cicon_height | : return pixel height |
cicon_data | : return CICON block + mask + icon bitmap |
global_aes | global AES array |
some more explanation:
Description:
The goal of this function is to provide cicon server (24 bit true color for MyAES or 32 picture)
This function provide only CICON data with bitmap and mask and not a full object icon.
Data provide by this function should be relocated and copy, AES not keep in memory CICON block provided that should be copy.
type&0xFF:
0 : Application icon
1 : File extension icon
2 : Reserved
3 : Load PNG file as icon from specific path
4 : Other icon (any other specific icon)
if type&0x100 =0 cicon_data return a CICON block as need by AES for display color icon else cicon_data return a simple bitmap block in ARBG format with 8 bit transparency (this format is not recognize by AES)
name: name of the cicon to load, some exemple:
with type&0xFF:
0 : name = "purec"
1 : name = "html"
3 : name = "C:\myprog\mypng\pngname.png"
4 : name = "computer"
size Size of the cicon to load, there is 3 different case:
size > 0 is the size of the icon requested and should be a multiple of 16
size = 0 the default cicon size is requested and is set by aes configuration
size = -1 the return cicon can be of any size and can change from a cicon to another
cicon_data Return block of type CICON + mask + icon bitmap if type&0x100 = 0 else a bitmap 32 bit with alpha chanel in the format ARGB 8 bits per chanel.
Relocation of cicon_data, cicon_data provide CICON block + mask + bitmap
num_planes : number of planes
*col_data, *col_mask, *sel_data, *sel_mask: provide relative position from the start of cicon_data and should be relocated
As the block can be free by the AES you should copy the block for your need, the size of the block to copy is:
number_of_block = 0
if(cicon_data->col_data) number_of_block++;
if(cicon_data->col_mask) number_of_block++;
if(cicon_data->sel_data) number_of_block++;
if(cicon_data->sel_mask) number_of_block++;
size = sizeof(CICON) + (cicon_data->num_planes * cicon_width * cicon_height * number_of_block)/8 + cicon_width*cicon_height;
CICON *newcicon;
newcicon = malloc(size);
memcpy(newcicon,cicon_data);
if(cicon_data->col_data) newcicon->col_data += newcicon;
if(cicon_data->col_mask) newcicon->col_mask += newcicon;
if(cicon_data->sel_data) newcicon->sel_data += newcicon;
if(cicon_data->sel_mask) newcicon->sel_mask += newcicon;
WARNING : In the case of 32 bits bitmap requested size of the bloc = cicon_width * cicon_height * 4
short mt_appl_getinfo | ( | short | type, |
short * | out1, | ||
short * | out2, | ||
short * | out3, | ||
short * | out4, | ||
short * | global_aes | ||
) |
returns information about the AES.
type | specifies the type of information to be returned in the shorts pointed to by out1, out2, out3 and out4. |
out1 | 1st return value [option CHECK_NULLPTR] out1 may be NULL |
out2 | 2nd return value [option CHECK_NULLPTR] out2 may be NULL |
out3 | 3rd return value [option CHECK_NULLPTR] out3 may be NULL |
out4 | 4th return value [option CHECK_NULLPTR] out4 may be NULL |
global_aes | global AES array |
The table hereafter summaries the values returned in out1, out2, out3 and out4 depending on the type of information requested.
Name | Value | Returns | ||||||||||||||||||||||||||||||||||||||||||||||||||||
AES_LARGEFONT | 0 | AES Large Font Information:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
AES_SMALLFONT | 1 | AES Large Font Information: Same as above for the current small font. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
AES_SYSTEM | 2 | AES System Specifics
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
AES_LANGUAGE | 3 | AES Globalization
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
AES_PROCESS | 4 | AES Multiple Process Support
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
AES_PCGEM | 5 | AES PC-GEM Features
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
AES_INQUIRE | 6 | AES Extended Inquiry Functions
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
#(reserved) | 7 | Currently reserved. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
AES_MOUSE | 8 | AES Mouse Support
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
AES_MENU | 9 | AES Menu Support
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
AES_SHELL | 10 | AES Shell Support
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
AES_WINDOW | 11 | AES Window Features
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
AES_MESSAGE | 12 | AES Extended Messages
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
AES_OBJECT | 13 | AES Extended Objects
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
AES_FORM | 14 | AES Form Support
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
AES_EXTENDED | 64 | Extended functions
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
AES_NAES | 65 | Additional N.AES functions
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
AES_VERSION | 96 | Additional AES functions
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
AES_WOPTS | 97 | return a bitmask of available WF_OPTS settings. This bitmask is identical to that use by the actual wind_set/get(WF_OPTS). See mt_wind_set() with WF_OPTS mode for details.
|
Using an ap_gtype value of 4 and above is only supported as of AES version 4.1
Many of the ap_gtype return values identify features of TOS not supported by Atari but for the benefit of third-party vendors. You should contact the appropriate third-party for documentation on these functions.
References mt_appl_find().
short mt_appl_getinfo_str | ( | short | type, |
char * | out1, | ||
char * | out2, | ||
char * | out3, | ||
char * | out4, | ||
short * | global_aes | ||
) |
returns information about the AES.
type | specifies the type of information to be returned in the strings pointed to by out1, out2, out3 and out4. |
out1 | pointer to a string or NULL |
out2 | pointer to a string or NULL |
out3 | pointer to a string or NULL |
out4 | pointer to a string or NULL |
global_aes | global AES array |
The table hereafter summaries the values returned in out1, out2, out3 and out4 depending on the type of information requested.
Name | Value | Returns |
AES_VERSION | 96 | Additional AES functions
|
References mt_appl_find().
short mt_appl_init | ( | short * | global_aes | ) |
should be the first function called in any application that intends to use GEM calls.
global_aes | global AES array |
Name | index of global_aes[] | Meaning |
mt_AESversion() | 0 | AES version number. |
mt_AESnumapps() | 1 | Number of concurrent applications possible (normally 1). MultiTOS will return -1. |
mt_AESapid() | 2 | Application identifier (same as mt_appl_init() return value). |
mt_AESappglobal() | 3-4 | LONG global available for use by the application. |
mt_AESrscfile() | 5-6 | Pointer to the base of the resource loaded via mt_rsrc_load(). |
(reserved) | 7-9 | Reserved |
(reserved) | 10 | Number of planes of the VDI workstation opened by the AES (used by BubbleGEM) |
(reserved) | 11-12 | Reserved |
mt_AESmaxchar() | 13 | Current maximum character used by the AES to do vst_height() prior to writing to the screen. This entry is only present as of AES version 0x0400. |
mt_AESminchar() | 14 | Current minimum character used by the AES to do vst_height() prior to writing to the screen. This entry is only present as of AES version 0x0400. |
Referenced by appl_init().
short mt_appl_read | ( | short | ap_id, |
short | length, | ||
void * | ap_pbuff, | ||
short * | global_aes | ||
) |
is designed to facilitate inter-process communication between processes running under the AES. The call will halt the application until a message of sufficient length is available (see version notes below).
ap_id | is your application identifier as returned by mt_appl_init(). |
length | is the length (in bytes) of the message to read. |
ap_pbuff | is a pointer to a memory buffer where the incoming message should be copied to. |
global_aes | global AES array |
If the AES version is 4.0 or higher and mt_appl_getinfo() indicates that this feature is supported, ap_id takes on an additional meaning. If APR_NOWAIT (-1) is passed instead of ap_id, mt_appl_read() will return immediately if no message is currently waiting.
Normally this call is not used. mt_evnt_multi() or mt_evnt_mesag() is used instead for standard message reception. mt_appl_read() is required for reading messages that are long and/or of variable length. It is recommended that message lengths in multiples of 16 bytes be used.
short mt_appl_search | ( | short | mode, |
char * | fname, | ||
short * | type, | ||
short * | ap_id, | ||
short * | global_aes | ||
) |
provides a method of identifying all of the currently running processes.
mode | specifies the search mode as follows: |
fname | should point to a memory location at least 9 bytes long to hold the 8 character process filename found and the NULL byte. |
type | is a pointer to a WORD into which will be placed the process type as follows:
|
ap_id | is a pointer to a word into which will be placed the processes' application identifier. [option CHECK_NULLPTR] ap_id may be NULL |
global_aes | global AES array |
The type parameter is actually a bit mask so it is possible that a process containing more than one characteristic will appear. For example, the desktop may return a value of APP_APPLICATION | APP_SHELL (0x0A).
short mt_appl_tplay | ( | void * | mem, |
short | num, | ||
short | scale, | ||
short * | global_aes | ||
) |
plays back events originally recorded with mt_appl_trecord().
mem | is a pointer to an array of EVNTREC structures (see mt_appl_trecord()) |
num | indicates the number of EVNTREC's to play back. |
scale | indicates on a scale of 1 to 10000 how fast the AES will attempt to play back your recording. The "original" doc says that the normal speed is 100 (200 = twice speeder, 50 = twice slower... it's linear), but in most cases, 4 shall be used for normal speed (8=twice speeder, 2=twice slower..). See the important note below to know what's the right value for you. |
global_aes | global AES array |
This function does not work correctly on AES versions less than 1.40 without a patch program available from Atari Corp..
short mt_appl_trecord | ( | void * | mem, |
short | count, | ||
short * | global_aes | ||
) |
records AES events for later playback.
mem | points to an array of Count EVNTREC structures |
count | dimension of the array of EVNTREC structures into which the AES will record events |
global_aes | global AES array |
This function does not work correctly on AES versions less than 1.40 without a patch program available from Atari Corp.
ap_value
seems to have words swapped (APPEVNT_MOUSE: X pos is in the high word and Y pos is in the low word).short mt_appl_write | ( | short | ap_id, |
short | length, | ||
void * | ap_pbuff, | ||
short * | global_aes | ||
) |
can be used to send a message to a valid message pipe.
ap_id | is the application identifier of the process to which you wish to send the message. |
length | specifies the number of bytes present in the message. |
ap_pbuff | is a pointer to a memory buffer with at least length bytes available |
global_aes | global AES array |
As of AES version 1.40, desk accessories may send MN_SELECTED messages to the desktop to trigger desktop functions.
As of AES version 4.00 you can use mt_shel_write(7,...) to 'broadcast' a message to all processes running with the exception of the AES itself, the desktop, and your own application. See mt_shel_write() for details.
It is recommended that you always send messages in 16 byte blocks using a WORD array of 8 elements as the AES does.
short mt_appl_yield | ( | short * | global_aes | ) |
forces an AES process switch.
global_aes | global AES array |