rBundle support.

This commit is contained in:
Kelvin Sherlock 2018-07-25 17:12:16 -04:00
parent 9b196eaea3
commit 5d3e1d29ee
3 changed files with 72 additions and 5 deletions

View File

@ -1,15 +1,16 @@
OBJ = o/rlint.a o/menu.a o/control.a OBJ = o/rlint.a o/menu.a o/control.a o/bundle.a
rlint : $(OBJ) rlint : $(OBJ)
$(RM) o/menu.root o/control.root $(RM) o/menu.root o/control.root o/bundle.root
iix link o/rlint o/menu o/control keep=$@ iix link o/rlint o/menu o/control o/bundle keep=$@
o/rlint.a : rlint.c rlint.h o/rlint.a : rlint.c rlint.h
o/menu.a : menu.c rlint.h o/menu.a : menu.c rlint.h
o/control.a : control.c rlint.h o/control.a : control.c rlint.h
o/bundle.a : bundle.c rlint.h
o : o :
mkdir $@ mkdir $@

View File

@ -7,6 +7,7 @@ typedef struct BundleHeader {
Ref iconID; Ref iconID;
Ref bundleID; Ref bundleID;
LongWord reserved; LongWord reserved;
Word count;
} BundleHeader; } BundleHeader;
typedef struct OneDocHeader { typedef struct OneDocHeader {
@ -31,17 +32,80 @@ typedef struct OneDocHeader {
} OneDocHeader; } OneDocHeader;
/* equates for rBundle */
#define LaunchThis 0x1
#define DontLaunch 0x0
#define reads 0x10
#define writes 0x20
#define native 0x40
#define creator 0x80
#define Filetype 0x1
#define AuxType 0x2
#define Filename 0x4
#define CreateDateTime 0x8
#define ModDateTime 0x10
#define LocalAccess 0x20
#define NetworkAccess 0x40
#define Where 0x80
#define HFSFileType 0x100
#define HFSCreator 0x200
#define OptionList 0x400
#define EOF 0x800
#define CompareAll 0x00FF // compareSpec operators
#define CompareSecond 0x0001
#define CompareMinute 0x0002
#define CompareHour 0x0004
#define CompareYear 0x0008
#define CompareDay 0x0010
#define CompareMonth 0x0020
#define CompareWeekday 0x0080
#define lessThan 0x0000
#define equal 0x0100
#define greater 0x0200
#define not 0x0400
void check_rBundle(Handle h){ void check_rBundle(Handle h){
BundleHeader *ptr; BundleHeader *ptr;
OneDocHeader *doc; OneDocHeader *doc;
Ref ref; Ref ref;
unsigned offset = 0;
unsigned i;
unsigned count;
ptr = *(BundleHeader **)h; ptr = *(BundleHeader **)h;
ref = h->iconID; ref = ptr->iconID;
if (ref) check(rIcon, ref); if (ref) check(rIcon, ref);
/* bundleID should match the current id, but that would be an uneneding loop */ /* bundleID should match the current id, but that would be a recursive loop */
count = ptr->count;
offset = sizeof(BundleHeader);
for(i = 0; i < count; ++i) {
unsigned numResults;
doc = (OneDocHeader *)((byte *)ptr + offset);
switch(doc->numResults) {
case 5:
case 4:
ref = doc->smallIconID;
if (ref) check(rIcon, ref);
case 3:
ref = doc->iconID;
if (ref) check(rIcon, ref);
case 2:
ref = doc->pathID;
if (ref) check(rFinderPath, ref);
case 1:
case 0:
break;
}
offset += doc->oneDocSize;
}
} }

View File

@ -169,6 +169,7 @@ void check(ResType type, ResID id) {
case rControlTemplate: callback = check_rControlTemplate; break; case rControlTemplate: callback = check_rControlTemplate; break;
case rWindParam1: callback = check_rWindParam1; break; case rWindParam1: callback = check_rWindParam1; break;
case rStringList: callback = check_rStringList; break; case rStringList: callback = check_rStringList; break;
case rBundle: callback = check_rBundle; break;
default: callback = 0; default: callback = 0;
} }
@ -258,6 +259,7 @@ void one_file(const char *name) {
case rControlTemplate: case rControlTemplate:
case rWindParam1: case rWindParam1:
case rStringList: case rStringList:
case rBundle:
break; break;
default: default:
continue; continue;