mirror of
https://github.com/ksherlock/rlint.git
synced 2025-01-02 11:31:27 +00:00
updates
This commit is contained in:
parent
06fa20d449
commit
fc67e2e791
34
GNUmakefile
34
GNUmakefile
@ -1,18 +1,18 @@
|
||||
|
||||
OBJ = o/rlint.a o/menu.a o/control.a
|
||||
|
||||
|
||||
rlint : $(OBJ)
|
||||
$(RM) o/menu.root o/control.root
|
||||
iix link o/rlint o/menu o/control keep=$@
|
||||
|
||||
|
||||
o/rlint.a : rlint.c rlint.h
|
||||
o/menu.a : menu.c rlint.h
|
||||
o/control.a : control.c rlint.h
|
||||
|
||||
o :
|
||||
mkdir $@
|
||||
|
||||
o/%.a : %.c | o
|
||||
|
||||
OBJ = o/rlint.a o/menu.a o/control.a
|
||||
|
||||
|
||||
rlint : $(OBJ)
|
||||
$(RM) o/menu.root o/control.root
|
||||
iix link o/rlint o/menu o/control keep=$@
|
||||
|
||||
|
||||
o/rlint.a : rlint.c rlint.h
|
||||
o/menu.a : menu.c rlint.h
|
||||
o/control.a : control.c rlint.h
|
||||
|
||||
o :
|
||||
mkdir $@
|
||||
|
||||
o/%.a : %.c | o
|
||||
iix compile $< keep=o/$*
|
98
control.c
98
control.c
@ -11,7 +11,7 @@ void check_rControlList(Handle h) {
|
||||
for(i = 0; ; ++i) {
|
||||
Ref ref = list[i];
|
||||
if (!ref) break;
|
||||
check(rControl, ref, check_rControl);
|
||||
check(rControlTemplate, ref);
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,48 +22,48 @@ void check_rControlTemplate(Handle h) {
|
||||
unsigned moreFlags = ptr->moreFlags;
|
||||
|
||||
if (ptr->procRef == simpleButtonControl) {
|
||||
ref = (SimpleButtonTemplate *)ptr->titleRef;
|
||||
ref = ((SimpleButtonTemplate *)ptr)->titleRef;
|
||||
if ((moreFlags & 0x03) == titleIsResource)
|
||||
check(rPString, ref, check_rPString);
|
||||
check(rPString, ref);
|
||||
|
||||
ref = (SimpleButtonTemplate *)ptr->colorTableRef;
|
||||
ref = ((SimpleButtonTemplate *)ptr)->colorTableRef;
|
||||
if ((moreFlags & 0x0c) == colorTableIsResource)
|
||||
check(rCtlColorTbl, ref, check_rCtlColorTbl);
|
||||
check(rCtlColorTbl, ref);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (ptr->procRef == checkControl) {
|
||||
|
||||
ref = (CheckBoxTemplate *)ptr->titleRef;
|
||||
ref = ((CheckBoxTemplate *)ptr)->titleRef;
|
||||
if ((moreFlags & 0x03) == titleIsResource)
|
||||
check(rPString, ref, check_rPString);
|
||||
check(rPString, ref);
|
||||
|
||||
ref = (CheckBoxTemplate *)ptr->colorTableRef;
|
||||
ref = ((CheckBoxTemplate *)ptr)->colorTableRef;
|
||||
if ((moreFlags & 0x0c) == colorTableIsResource)
|
||||
check(rCtlColorTbl, ref, check_rCtlColorTbl);
|
||||
check(rCtlColorTbl, ref);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (ptr->procRef == radioControl) {
|
||||
|
||||
ref = (RadioButtonTemplate *)ptr->titleRef;
|
||||
ref = ((RadioButtonTemplate *)ptr)->titleRef;
|
||||
if ((moreFlags & 0x03) == titleIsResource)
|
||||
check(rPString, ref, check_rPString);
|
||||
check(rPString, ref);
|
||||
|
||||
ref = (RadioButtonTemplate *)ptr->colorTableRef;
|
||||
ref = ((RadioButtonTemplate *)ptr)->colorTableRef;
|
||||
if ((moreFlags & 0x0c) == colorTableIsResource)
|
||||
check(rCtlColorTbl, ref, check_rCtlColorTbl);
|
||||
check(rCtlColorTbl, ref);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (ptr->procRef == scrollBarControl) {
|
||||
|
||||
ref = (ScrollBarTemplate *)ptr->colorTableRef;
|
||||
ref = ((ScrollBarTemplate *)ptr)->colorTableRef;
|
||||
if ((moreFlags & 0x0c) == colorTableIsResource)
|
||||
check(rCtlColorTbl, ref, check_rCtlColorTbl);
|
||||
check(rCtlColorTbl, ref);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -71,61 +71,61 @@ void check_rControlTemplate(Handle h) {
|
||||
|
||||
if (ptr->procRef == iconButtonControl) {
|
||||
|
||||
ref = (IconButtonTemplate *)ptr->titleRef;
|
||||
ref = ((IconButtonTemplate *)ptr)->titleRef;
|
||||
if ((moreFlags & 0x03) == titleIsResource)
|
||||
check(rPString, ref, check_rPString);
|
||||
check(rPString, ref);
|
||||
|
||||
ref = (IconButtonTemplate *)ptr->colorTableRef;
|
||||
ref = ((IconButtonTemplate *)ptr)->colorTableRef;
|
||||
if ((moreFlags & 0x0c) == colorTableIsResource)
|
||||
check(rCtlColorTbl, ref, check_rCtlColorTbl);
|
||||
check(rCtlColorTbl, ref);
|
||||
|
||||
ref = (IconButtonTemplate *)ptr->iconRef;
|
||||
ref = ((IconButtonTemplate *)ptr)->iconRef;
|
||||
if ((moreFlags & 0x30) == 0x20)
|
||||
check(rIcon, ref, check_rIcon);
|
||||
check(rIcon, ref);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (ptr->procRef == scrollBarControl) {
|
||||
|
||||
ref = (LineEditTemplate *)ptr->defaultRef;
|
||||
ref = ((LineEditTemplate *)ptr)->defaultRef;
|
||||
if ((moreFlags & 0x03) == titleIsResource)
|
||||
check(rPString, ref, check_rPString);
|
||||
check(rPString, ref);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (ptr->procRef == listControl) {
|
||||
|
||||
ref = (ListTemplate *)ptr->listRef;
|
||||
ref = ((ListTemplate *)ptr)->listRef;
|
||||
if ((moreFlags & 0x03) == titleIsResource)
|
||||
check(rListRef, ref, check_rListRef);
|
||||
check(rListRef, ref);
|
||||
|
||||
ref = (ListTemplate *)ptr->colorTableRef;
|
||||
ref = ((ListTemplate *)ptr)->colorTableRef;
|
||||
if ((moreFlags & 0x0c) == colorTableIsResource)
|
||||
check(rCtlColorTbl, ref, check_rCtlColorTbl);
|
||||
check(rCtlColorTbl, ref);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (ptr->procRef == pictureControl) {
|
||||
|
||||
ref = (PictureTemplate *)ptr->pictureRef;
|
||||
ref = ((PictureTemplate *)ptr)->pictureRef;
|
||||
if ((moreFlags & 0x03) == titleIsResource)
|
||||
check(rPicture, ref, check_rPicture);
|
||||
check(rPicture, ref);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (ptr->procRef == popUpControl) {
|
||||
|
||||
ref = (PopupTemplate *)ptr->menuRef;
|
||||
ref = ((PopupTemplate *)ptr)->menuRef;
|
||||
if ((moreFlags & 0x07) == titleIsResource)
|
||||
check(rMenu, ref, check_rMenu);
|
||||
check(rMenu, ref);
|
||||
|
||||
ref = (PopupTemplate *)ptr->colorTableRef;
|
||||
ref = ((PopupTemplate *)ptr)->colorTableRef;
|
||||
if ((moreFlags & 0x18) == 0x10)
|
||||
check(rCtlColorTbl, ref, check_rCtlColorTbl);
|
||||
check(rCtlColorTbl, ref);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -133,9 +133,9 @@ void check_rControlTemplate(Handle h) {
|
||||
|
||||
if (ptr->procRef == growControl) {
|
||||
|
||||
ref = (SizeBoxTemplate *)ptr->colorTableRef;
|
||||
ref = ((SizeBoxTemplate *)ptr)->colorTableRef;
|
||||
if ((moreFlags & 0x0c) == colorTableIsResource)
|
||||
check(rCtlColorTbl, ref, check_rCtlColorTbl);
|
||||
check(rCtlColorTbl, ref);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -143,9 +143,9 @@ void check_rControlTemplate(Handle h) {
|
||||
|
||||
if (ptr->procRef == statTextControl) {
|
||||
|
||||
ref = (StaticTextTemplate *)ptr->textRef;
|
||||
ref = ((StaticTextTemplate *)ptr)->textRef;
|
||||
if ((moreFlags & 0x03) == titleIsResource)
|
||||
check(rTextForLETextBox2, ref, check_rTextForLETextBox2);
|
||||
check(rTextForLETextBox2, ref);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -153,13 +153,13 @@ void check_rControlTemplate(Handle h) {
|
||||
|
||||
if (ptr->procRef == editTextControl) {
|
||||
|
||||
ref = (TextEditTemplate *)ptr->styleRef;
|
||||
ref = ((TextEditTemplate *)ptr)->styleRef;
|
||||
if ((moreFlags & 0x03) == titleIsResource)
|
||||
check(rStyleBlock, ref, check_rStyleBlock);
|
||||
check(rStyleBlock, ref);
|
||||
|
||||
ref = (TextEditTemplate *)ptr->colorRef;
|
||||
ref = ((TextEditTemplate *)ptr)->colorRef;
|
||||
if ((moreFlags & 0x0c) == colorTableIsResource)
|
||||
check(rCtlColorTbl, ref, check_rCtlColorTbl);
|
||||
check(rCtlColorTbl, ref);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -172,17 +172,17 @@ void check_rWindParam1(Handle h) {
|
||||
Ref ref;
|
||||
unsigned desc = ptr->p1InDesc;
|
||||
|
||||
ref = ptr->p1Title;
|
||||
if (desc & 0x0200) check(rPString, ref, check_rPString);
|
||||
ref = (Ref)ptr->p1Title;
|
||||
if (desc & 0x0200) check(rPString, ref);
|
||||
|
||||
ref = ptr->p1ColorTable;
|
||||
if (desc & 0x0800) check(rWindColor, ref, check_rWindColor);
|
||||
ref = (Ref)ptr->p1ColorTable;
|
||||
if (desc & 0x0800) check(rWindColor, ref);
|
||||
|
||||
ref = ptr->p1ControlList;
|
||||
ref = (Ref)ptr->p1ControlList;
|
||||
switch(desc & 0xff) {
|
||||
case singleResource: check(rControlTemplate, ref, check_rControlTemplate); break;
|
||||
case resourceToResource: check(rControlList, ref, check_rControlList); break;
|
||||
default: /* warn about invalid value ? */
|
||||
case singleResource: check(rControlTemplate, ref); break;
|
||||
case resourceToResource: check(rControlList, ref); break;
|
||||
default: break; /* warn about invalid value ? */
|
||||
}
|
||||
|
||||
}
|
||||
|
16
menu.c
16
menu.c
@ -16,11 +16,11 @@ void check_rMenuItem(Handle h) {
|
||||
|
||||
if (mi->itemFlag & 0x0400) {
|
||||
if (mi->itemFlag & 0x200) {
|
||||
if (ref) check(rItemStruct, ref, check_rItemStruct);
|
||||
if (ref) check(rItemStruct, ref);
|
||||
}
|
||||
}
|
||||
else if (mi->itemFlag & mRefResource) {
|
||||
if (ref) check(rPString, ref, check_rPString);
|
||||
if (ref) check(rPString, ref);
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,13 +33,13 @@ void check_rMenu(Handle h) {
|
||||
m = *(MenuTemplate **)h;
|
||||
if (m->menuFlag & mRefResource) {
|
||||
ref = m->menuTitleRef;
|
||||
if (ref) check(rPString, ref, check_rPString);
|
||||
if (ref) check(rPString, ref);
|
||||
}
|
||||
if (m->menuFlag & 0x2000) {
|
||||
for (i = 0; ; ++i) {
|
||||
ref = m->itemRefArray[i];
|
||||
if (!ref) break;
|
||||
check(rMenuItem, ref, check_rMenuItem);
|
||||
check(rMenuItem, ref);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -55,7 +55,7 @@ void check_rMenuBar(Handle h) {
|
||||
for (i = 0; ; ++i) {
|
||||
Ref ref = mb->menuRefArray[i];
|
||||
if (!ref) break;
|
||||
check(rMenu, ref, check_rMenu);
|
||||
check(rMenu, ref);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -69,12 +69,10 @@ void check_rItemStruct(Handle h) {
|
||||
ptr = *(itemStruct **)h;
|
||||
if (ptr->itemFlag2 & mRefResource) {
|
||||
ref = ptr->itemTitleRef;
|
||||
if (ref) check(rPString, ref, check_rPString);
|
||||
if (ref) check(rPString, ref);
|
||||
ref = ptr->itemIconRef;
|
||||
if (ref) check(rIcon, ref, check_rIcon);
|
||||
if (ref) check(rIcon, ref);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
44
rlint.c
44
rlint.c
@ -6,7 +6,7 @@
|
||||
|
||||
#include <gsos.h>
|
||||
#include <resources.h>
|
||||
|
||||
#include <memory.h>
|
||||
|
||||
#include "rlint.h"
|
||||
|
||||
@ -108,17 +108,30 @@ void check_rStringList(Handle h){
|
||||
unsigned i;
|
||||
for (i = 0; i < ptr->count; ++i) {
|
||||
Ref ref = ptr->strings[i];
|
||||
if (ref) check(rPString, ref, check_rPString);
|
||||
if (ref) check(rPString, ref);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void check(ResType type, ResID id, void (*callback)(Handle)) {
|
||||
void check(ResType type, ResID id) {
|
||||
|
||||
Handle h;
|
||||
void (*callback)(Handle);
|
||||
|
||||
|
||||
switch(type) {
|
||||
case rMenu: callback = check_rMenu; break;
|
||||
case rMenuItem: callback = check_rMenuItem; break;
|
||||
case rMenuBar: callback = check_rMenuBar; break;
|
||||
case rItemStruct: callback = check_rItemStruct; break;
|
||||
case rControlList: callback = check_rControlList; break;
|
||||
case rControlTemplate: callback = check_rControlTemplate; break;
|
||||
case rWindParam1: callback = check_rWindParam1; break;
|
||||
case rStringList: callback = check_rStringList; break;
|
||||
default: callback = 0;
|
||||
}
|
||||
|
||||
history[level].type = type;
|
||||
history[level].id = id;
|
||||
++level;
|
||||
@ -177,7 +190,7 @@ void one_file(const char *name) {
|
||||
rfd = OpenResourceFile(0x8000 | readEnable, NULL, (Pointer)gname);
|
||||
if (_toolErr) {
|
||||
++error_count;
|
||||
fprintf(stderr, "%s: OpenResourceFile: $%04x\n", name);
|
||||
fprintf(stderr, "%s: OpenResourceFile: $%04x\n", name, _toolErr);
|
||||
free(gname);
|
||||
return;
|
||||
}
|
||||
@ -186,7 +199,6 @@ void one_file(const char *name) {
|
||||
|
||||
/* now iterate through all resource types... */
|
||||
for (ti = 1; ; ++ti) {
|
||||
void (*callback)(Handle) = 0;
|
||||
ResType type = GetIndType(ti);
|
||||
if (_toolErr == resIndexRange) break;
|
||||
if (_toolErr) {
|
||||
@ -195,15 +207,17 @@ void one_file(const char *name) {
|
||||
}
|
||||
|
||||
switch(type) {
|
||||
case rMenu: callback = check_rMenu; break;
|
||||
case rMenuItem: callback = check_rMenuItem; break;
|
||||
case rMenuBar: callback = check_rMenuBar; break;
|
||||
case rItemStruct: callback = check_rItemStruct; break;
|
||||
case rControlList: callback = check_rControlList; break;
|
||||
case rControlTemplate: callback = check_rControlTemplate; break;
|
||||
case rWindParam1: callback = check_rWindParam1; break;
|
||||
case rStringList: callback = check_rStringList; break;
|
||||
default: callback = 0;
|
||||
case rMenu:
|
||||
case rMenuItem:
|
||||
case rMenuBar:
|
||||
case rItemStruct:
|
||||
case rControlList:
|
||||
case rControlTemplate:
|
||||
case rWindParam1:
|
||||
case rStringList:
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
for (ri = 1; ; ++ri) {
|
||||
@ -213,7 +227,7 @@ void one_file(const char *name) {
|
||||
fprintf(stderr, "%s: GetIndResource: $%04x\n", name, _toolErr);
|
||||
continue;
|
||||
}
|
||||
check(type, id, callback);
|
||||
check(type, id);
|
||||
}
|
||||
}
|
||||
|
||||
|
36
rlint.h
36
rlint.h
@ -1,19 +1,17 @@
|
||||
#include <types.h>
|
||||
#include <resources.h>
|
||||
|
||||
void check_rMenu(Handle h);
|
||||
void check_rMenuItem(Handle h);
|
||||
void check_rMenuBar(Handle h);
|
||||
void check_rItemStruct(Handle h);
|
||||
void check_rControlList(Handle h);
|
||||
void check_rControlTemplate(Handle h);
|
||||
void check_rWindParam1(Handle h);
|
||||
void check_rStringList(Handle h);
|
||||
|
||||
#define check_rPString 0
|
||||
#define check_rIcon 0
|
||||
#define check_rWindColor 0
|
||||
#define check_rCtlColorTbl 0
|
||||
|
||||
void error(const char *msg);
|
||||
void check(ResType type, ResID id, void (*callback)(Handle));
|
||||
#include <types.h>
|
||||
#include <resources.h>
|
||||
|
||||
void check_rMenu(Handle h);
|
||||
void check_rMenuItem(Handle h);
|
||||
void check_rMenuBar(Handle h);
|
||||
void check_rItemStruct(Handle h);
|
||||
void check_rControlList(Handle h);
|
||||
void check_rControlTemplate(Handle h);
|
||||
void check_rWindParam1(Handle h);
|
||||
void check_rStringList(Handle h);
|
||||
|
||||
void error(const char *msg);
|
||||
void check(ResType type, ResID id);
|
||||
|
||||
#pragma lint -1
|
||||
#pragma optimize -1
|
||||
|
Loading…
Reference in New Issue
Block a user