Repository navigation
application.library: the AmigaOS 4 application API - #1967
Open
terminills wants to merge 1 commit into
Open
terminills wants to merge 1 commit into
terminills wants to merge 1 commit into
Conversation
AROS had no application.library. This implements the AmigaOS 4 API by
name, so programs written for it build unchanged, with the REGAPP_,
APPATTR_, FINDAPP_, APPNOTIFY_ and APPLIBMT_ definitions in
<libraries/application.h>. The tag and message type values are AROS's
own; the varargs forms come from genmodule.
- RegisterApplication, UnregisterApplication, Set/GetApplicationAttrs,
FindApplication, SendApplicationMsg, GetApplicationList and
FreeApplicationList. Each application gets an identifier "name.url"
("www." dropped, "_1", "_2"... for further instances) and a message
port created in its own task. A unique application refuses a second
instance and sends the running one APPLIBMT_Unique. Messages are sent
as copies carrying their strings, so senders can reuse their buffers;
receivers reply them to a port that never signals and the library
frees them on its next call. Game mode changes are broadcast, opened
documents are kept as a most-recent-first list.
- PrefsObjects: reference counted strings, numbers, dates, binary data,
arrays and dictionaries, with the Prefs<Type>A() method calls, the
DictGet...ForKey() helpers, ReadPrefsA() and WritePrefsA() (ENV:, then
ENVARC:, a full path, or a caller's stream) and
BeginDeserialization(). Files are the PrefsObjects XML in UTF-8;
strings stay 8-bit and any byte string reads back as written.
- Application preferences (REGAPP_LoadPrefs/SavePrefs/ENVDir/
CustomPrefsFileName/CustomPrefsBaseName, APPATTR_MainPrefsDict,
APPATTR_FlushPrefs): ENV(ARC):[ENVDir/]name.url.xml, shared by all
instances.
- GetAppLibAttrsA()/SetAppLibAttrsA(): last used applications and
documents, their maximum sizes, blanker and game mode state, kept in
ENV(ARC):Sys/application.xml.
- LockApplicationIcon()/UnlockApplicationIcon(), APPATTR_IconType and
UNREGAPP_WaitForUnlock; AppNotifications and BlankerNotifications.
- Notify() hands the pop-up to the notification server
(SYS:System/Notifications, started when it is not running) and
returns the APPNOTIFY_ result codes. AROS additions: APPNOTIFY_Withdraw
takes back one pop-up by its back message, APPLIBMT_ConfirmClose
carries that message, APPNOTIFY_Gauges puts up to eight bars under
the text.
The test developer/debug/test/application/apptest covers registration
and identifiers, unique applications, FindApplication, copied messages,
broadcasts, game mode, the last used lists, every PrefsObjects type,
serialising and reading back, application prefs, icon locks, the
notification messages and result codes, and the server's ARexx port.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title: application.library: the AmigaOS 4 application API
AROS had no application.library. This is the AmigaOS 4 API by name, so programs written for it build unchanged: RegisterApplication and friends, messaging between applications, Notify(), PrefsObjects (dictionaries, arrays, the XML files), application preferences, the library attributes (last used applications and documents, blanker and game mode), icon locks, and the App/Blanker notifications. Tag and message type values are AROS's own. Notify() hands pop-ups to SYS:System/Notifications (the next PR), started on demand; without it the library returns the result codes and logs.
Test: developer/debug/test/application/apptest, one PASS/FAIL line per check (62 checks; the pop-up, ARexx and settings checks are skipped when the server is not installed; the ENVARC: write check is skipped when ENVARC: is read-only, as on the live CD). pc-x86_64 in QEMU on master 9802c8c: with only the library installed
APPTEST OK 50 passed, 0 failed; with the server from the next PRAPPTEST OK 61 passed, 0 failed.