|
| void | _addnotify (void) |
| void | _remnotify (void) |
| void | _checknotify (void) |
| void | _waitnotify (void) |
| void | _lockdoslist (void) |
| void | ridoslib_nextlistitem (void) |
| void | _unlockdoslist (void) |
| void | _notifyport (void) |
| void | _getfilename (void) |
| void | _getpathname (void) |
| void | _dosentrytype (void) |
| void | ridoslib_libinit (void) |
| void | ridoslib_libfinit (void) |
| void | notifyidchk (void) |
| static ULONG | getfilename_c (const UBYTE *s, const ULONG *lens) |
| | GetFileName(filepath$): the part behind the last / or :.
|
| static ULONG | getpathname_c (const UBYTE *s, const ULONG *lens) |
| | GetPathName(filepath$): the part up to and including the last / or :.
|
| static ULONG | notifyport_c (void) |
| | NotifyPort: the message port of the notifications.
|
| static ULONG | dochecknotify (void) |
| static ULONG | checknotify_c (void) |
| | CheckNotify: the id of the next notification message.
|
| static ULONG | waitnotify_c (void) |
| | WaitNotify: waits for a notification message and returns its id.
|
| static ULONG | remnotify_c (LONG id) |
| | RemNotify notify#: ends a notification and frees its request and the name copy.
|
| static BB_BOOL | addnotify_c (ULONG id, STRPTR file, const ULONG *lens) |
| | AddNotify(idno,filespec$): starts a notification for a file.
|
| static ULONG | libinit_c (void) |
| | init: opens dos.library V36 (_dosbase) and creates the message port of all notifications.
|
| static void | libfinit_c (void) |
| | finit: ends the notifications still active, closes dos.library and deletes the port.
|
| static BB_BOOL | lockdoslist_c (UWORD flags, struct DosLibrary *dos) |
| | GetDeviceList(flags): locks the DOS device list (LockDosList(flags | LDF_READ)).
|
| static ULONG | nextlistitem_c (struct DosLibrary *dos) |
| | NextDevice: the name of the next entry of the locked list (NextDosEntry), "" at the end.
|
| static ULONG | dosentrytype_c (void) |
| | DeviceEntryType: dol_Type of the current entry (dev 0, dir 1, vol 2, late 3, nonbind 4).
|
| static ULONG | unlockdoslist_c (ULONG incoming, struct DosLibrary *dos) |
| | FreeDeviceList: unlocks the DOS device list (UnLockDosList).
|
| static void | notifyidchk_c (ULONG id) |
| | The error check of AddNotify and RemNotify (debugger only).
|
| BB_BOOL addnotify_c |
( |
ULONG | id, |
|
|
STRPTR | file, |
|
|
const ULONG * | lens ) |
|
static |
AddNotify(idno,filespec$): starts a notification for a file.
A NotifyRequest (48 bytes, MEMF_CLEAR) with a copy of the name, UserData = id, NRF_SEND_MESSAGE to the port; kept in notifys[id]. Without memory for the name copy or the request it returns 0 and leaves the table alone (fixed, #619: the original used AllocMem's results unchecked). An id outside 0..63 writes outside the tables (64 entries, the offset id*4 as a word): an invalid argument, refused by notifyidchk with runtime error checking (#626). A request already in the entry of the id is ended and freed first, as RemNotify does (fixed, #620: the original overwrote the entry, the old request stayed active and could no longer be ended). A request whose StartNotify fails is taken out of the table and freed with its name copy (fixed, #621: the original left it there, uncounted).
- Parameters
-
| id | d0: the id |
| file | d1: the file name |
| lens | a2: the argument stack, the name's length at -4(a2) |
- Returns
- d0: BB_TRUE if StartNotify worked, BB_FALSE otherwise, without memory or without dos.library or port
| ULONG dosentrytype_c |
( |
void | | ) |
|
|
static |
DeviceEntryType: dol_Type of the current entry (dev 0, dir 1, vol 2, late 3, nonbind 4).
The type noted by GetDeviceList and NextDevice while the list was locked; no entry is read, so the result stays the same after FreeDeviceList (fixed, #622: the original read dol_Type of the current entry also after the unlock, when it may have been freed).
- Returns
- d0: the type, -1 if there is no entry
| ULONG getfilename_c |
( |
const UBYTE * | s, |
|
|
const ULONG * | lens ) |
|
static |
GetFileName(filepath$): the part behind the last / or :.
The argument's string space is given back (a3 - length - 1) and the result copied to its start, from the character behind the last separator on (the result is never longer than the argument and lies behind its start: a forward copy); no 0 written, a3 on the end of the characters (the compiler adds it). Fixed (#627): the original built the result in a 256 byte buffer first, without a limit. Fixed (#628): the original took the length as a word.
- Parameters
-
| s | d0: the path |
| lens | a2: the argument stack, the length (a long) at -4(a2) |
- Returns
- d0: the length of the result
| ULONG getpathname_c |
( |
const UBYTE * | s, |
|
|
const ULONG * | lens ) |
|
static |
GetPathName(filepath$): the part up to and including the last / or :.
Searched from the end; the argument's string space is given back and the result copied to its start with its 0 (a forward copy: the result is the argument's beginning); a3 ends on the 0 (fixed, #618: the original left it behind the 0). Fixed (#627): the original built the result in a 256 byte buffer first, without a limit. Fixed (#624): the original never looked at the first character ("/abc" and ":x" gave "", like a name without separator). Fixed (#628): the original took the length as a word.
- Parameters
-
| s | d0: the path |
| lens | a2: the argument stack, the length (a long) at -4(a2) |
- Returns
- d0: the length of the result, 0 without separator
finit: ends the notifications still active, closes dos.library and deletes the port.
All 64 entries are looked at, from id 63 down (fixed, #621: the original stopped when the counter was 0). The port is deleted only if dos.library was open (always, where CreateMsgPort exists: no defect). A DOS list GetDeviceList still holds is unlocked before dos.library is closed (fixed, #1081: the original had the call commented out, the list stayed locked after the program).
| BB_BOOL lockdoslist_c |
( |
UWORD | flags, |
|
|
struct DosLibrary * | dos ) |
|
static |
GetDeviceList(flags): locks the DOS device list (LockDosList(flags | LDF_READ)).
The current entry is the list itself until NextDevice; its dol_Type is noted for DeviceEntryType (#622). A list still locked by an earlier GetDeviceList is unlocked first (fixed, #1081: the original locked it a second time, and one FreeDeviceList released only one of the locks). Without _dosbase (below Kickstart 2.0) 0, no list (fixed, #1142: the original called LockDosList, dos V36, a crash on Kickstart 1.x).
- Parameters
-
| flags | d0.w: the LDF_ flags |
| dos | a6: the program's dos base (!libs doslib,la6) |
- Returns
- d0: BB_TRUE, BB_FALSE if LockDosList fails or there is no _dosbase
| ULONG nextlistitem_c |
( |
struct DosLibrary * | dos | ) |
|
|
static |
NextDevice: the name of the next entry of the locked list (NextDosEntry), "" at the end.
The name is copied to a3 up to its 0 (DOS BSTRs have one); a3 ends on the 0 (fixed, #618: the original left it behind the 0). Without a locked list the result is "" (fixed, #625: the original returned with d0 unchanged, the string's length whatever d0 was).
- Parameters
-
| dos | a6: the program's dos base |
- Returns
- d0: the length byte of the name, 0 at the end or without a list
| void notifyidchk_c |
( |
ULONG | id | ) |
|
|
static |
The error check of AddNotify and RemNotify (debugger only).
Fixed (#626), not in the original (ridoslib had no error check area): the id indexes the two tables of 64 entries without a check, so an id outside 0..63 made AddNotify write and RemNotify read, EndNotify and free the library's data around the tables. The release code is unchanged (an invalid argument).
Errors: "Notify number must be 0 to 63".
- Parameters
-