Skip to content

application.library: the AmigaOS 4 application API - #1967

Open
terminills wants to merge 1 commit into
aros-development-team:masterfrom
terminills:application-library
Open

terminills wants to merge 1 commit into
aros-development-team:masterfrom
terminills:application-library

Conversation

@terminills

Copy link
Copy Markdown
Contributor

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 PR APPTEST OK 61 passed, 0 failed.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant