mirror of
https://github.com/ksherlock/ample.git
synced 2024-09-27 15:58:52 +00:00
MAX_SLOTS -> SLOT_COUNT
This commit is contained in:
parent
52d140d07d
commit
3a03b2180a
@ -269,7 +269,7 @@
|
|||||||
c = [[MediaCategory alloc] initWithTitle: @"Hard Drives"];
|
c = [[MediaCategory alloc] initWithTitle: @"Hard Drives"];
|
||||||
d = [[MediaCategory alloc] initWithTitle: @"CD-ROMs"];
|
d = [[MediaCategory alloc] initWithTitle: @"CD-ROMs"];
|
||||||
e = [[MediaCategory alloc] initWithTitle: @"Cassettes"];
|
e = [[MediaCategory alloc] initWithTitle: @"Cassettes"];
|
||||||
f = [[MediaCategory alloc] initWithTitle: @"Hard Disk Images"];
|
f = [[MediaCategory alloc] initWithTitle: @"Hard Disk Images"]; // Mac Nubus psuedo image device
|
||||||
|
|
||||||
_data[0] = a;
|
_data[0] = a;
|
||||||
_data[1] = b;
|
_data[1] = b;
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
#import "Menu.h"
|
#import "Menu.h"
|
||||||
|
|
||||||
/* number of slot types. bitmask used so should be < sizeof(unsigned *8) */
|
/* number of slot types. bitmask used so should be < sizeof(unsigned *8) */
|
||||||
#define MAX_SLOTS 24
|
#define SLOT_COUNT 21
|
||||||
static_assert(MAX_SLOTS <= sizeof(unsigned) * 8, "too many slot types");
|
static_assert(SLOT_COUNT <= sizeof(unsigned) * 8, "too many slot types");
|
||||||
|
|
||||||
#define SIZEOF(x) (sizeof(x) / sizeof(x[0]))
|
#define SIZEOF(x) (sizeof(x) / sizeof(x[0]))
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ static_assert(MAX_SLOTS <= sizeof(unsigned) * 8, "too many slot types");
|
|||||||
@"Slot E:",
|
@"Slot E:",
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(SIZEOF(Names) <= MAX_SLOTS, "label overflow");
|
static_assert(SIZEOF(Names) == SLOT_COUNT, "Missing slot");
|
||||||
return Names[_index];
|
return Names[_index];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ static_assert(MAX_SLOTS <= sizeof(unsigned) * 8, "too many slot types");
|
|||||||
@"-nbd",
|
@"-nbd",
|
||||||
@"-nbe",
|
@"-nbe",
|
||||||
};
|
};
|
||||||
static_assert(SIZEOF(Names) <= MAX_SLOTS, "flag overflow");
|
static_assert(SIZEOF(Names) == SLOT_COUNT, "Missing Slot");
|
||||||
return Names[_index];
|
return Names[_index];
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -184,9 +184,9 @@ static_assert(MAX_SLOTS <= sizeof(unsigned) * 8, "too many slot types");
|
|||||||
unsigned _slots_valid;
|
unsigned _slots_valid;
|
||||||
unsigned _slots_default;
|
unsigned _slots_default;
|
||||||
|
|
||||||
NSDictionary *_slot_object[MAX_SLOTS];
|
NSDictionary *_slot_object[SLOT_COUNT];
|
||||||
NSDictionary *_slot_media[MAX_SLOTS];
|
NSDictionary *_slot_media[SLOT_COUNT];
|
||||||
NSString *_slot_value[MAX_SLOTS]; // when explicitely set.
|
NSString *_slot_value[SLOT_COUNT]; // when explicitely set.
|
||||||
NSDictionary *_machine_media;
|
NSDictionary *_machine_media;
|
||||||
|
|
||||||
NSDictionary *_machine_data;
|
NSDictionary *_machine_data;
|
||||||
@ -210,7 +210,7 @@ static_assert(MAX_SLOTS <= sizeof(unsigned) * 8, "too many slot types");
|
|||||||
_machine_media = nil;
|
_machine_media = nil;
|
||||||
_machine_data = nil;
|
_machine_data = nil;
|
||||||
|
|
||||||
for (unsigned i = 0; i < MAX_SLOTS; ++i) {
|
for (unsigned i = 0; i < SLOT_COUNT; ++i) {
|
||||||
_slot_media[i] = nil;
|
_slot_media[i] = nil;
|
||||||
_slot_object[i] = nil;
|
_slot_object[i] = nil;
|
||||||
_slot_value[i] = nil;
|
_slot_value[i] = nil;
|
||||||
@ -234,7 +234,7 @@ static_assert(MAX_SLOTS <= sizeof(unsigned) * 8, "too many slot types");
|
|||||||
@"nb9", @"nba", @"nbb", @"nbc", @"nbd", @"nbe",
|
@"nb9", @"nba", @"nbb", @"nbc", @"nbd", @"nbe",
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(SIZEOF(Keys) <= MAX_SLOTS, "key overflow");
|
static_assert(SIZEOF(Keys) == SLOT_COUNT, "Missing slot");
|
||||||
static unsigned SizeofKeys = SIZEOF(Keys);
|
static unsigned SizeofKeys = SIZEOF(Keys);
|
||||||
|
|
||||||
|
|
||||||
@ -341,7 +341,7 @@ static_assert(MAX_SLOTS <= sizeof(unsigned) * 8, "too many slot types");
|
|||||||
#endif
|
#endif
|
||||||
#if 1
|
#if 1
|
||||||
unsigned mask = 1;
|
unsigned mask = 1;
|
||||||
for (unsigned i = 0; i < MAX_SLOTS; ++i, mask <<= 1) {
|
for (unsigned i = 0; i < SLOT_COUNT; ++i, mask <<= 1) {
|
||||||
|
|
||||||
if (_slots_valid & mask) {
|
if (_slots_valid & mask) {
|
||||||
NSDictionary *tmp = _slot_media[i];
|
NSDictionary *tmp = _slot_media[i];
|
||||||
@ -403,7 +403,7 @@ static NSString *SlotFlagForIndex(unsigned index){
|
|||||||
@"-nbd",
|
@"-nbd",
|
||||||
@"-nbe",
|
@"-nbe",
|
||||||
};
|
};
|
||||||
static_assert(SIZEOF(Names) <= MAX_SLOTS, "flag overflow");
|
static_assert(SIZEOF(Names) == SLOT_COUNT, "Missing slot");
|
||||||
return Names[index];
|
return Names[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -428,7 +428,7 @@ static NSString *SlotFlagForIndex(unsigned index){
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
unsigned mask = 1;
|
unsigned mask = 1;
|
||||||
for (unsigned i = 0 ; i < MAX_SLOTS; ++i, mask <<= 1) {
|
for (unsigned i = 0 ; i < SLOT_COUNT; ++i, mask <<= 1) {
|
||||||
|
|
||||||
if (!(_slots_valid & mask)) continue;
|
if (!(_slots_valid & mask)) continue;
|
||||||
NSDictionary *d = _slot_object[i];
|
NSDictionary *d = _slot_object[i];
|
||||||
@ -481,7 +481,7 @@ static NSString *SlotFlagForIndex(unsigned index){
|
|||||||
-(IBAction)resetSlots:(id)sender {
|
-(IBAction)resetSlots:(id)sender {
|
||||||
|
|
||||||
_slots_explicit = 0;
|
_slots_explicit = 0;
|
||||||
for (unsigned i = 0; i < MAX_SLOTS; ++i) {
|
for (unsigned i = 0; i < SLOT_COUNT; ++i) {
|
||||||
_slot_media[i] = nil;
|
_slot_media[i] = nil;
|
||||||
_slot_object[i] = nil;
|
_slot_object[i] = nil;
|
||||||
_slot_value[i] = nil;
|
_slot_value[i] = nil;
|
||||||
|
Loading…
Reference in New Issue
Block a user