mirror of
https://github.com/ksherlock/ample.git
synced 2025-02-18 17:30:37 +00:00
commit a91a858d68c845f74db106dd21a800c4d09e6e38 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Mar 7 22:49:42 2021 -0500 listxml utility. commit e52576797da2609e700a12d1ffd7c78e8f1c2b23 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Mar 7 22:34:00 2021 -0500 update media to use a structure instead of passing around dictionaries. commit 9277a0f720091c386812ac5f84d96080fe6e14f3 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Mar 7 20:13:27 2021 -0500 media is working again. commit 7c0ac9a973df85fdcdaa978f80905cb9e8532ea5 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Mar 7 18:46:38 2021 -0500 use new slot objects [WIP] commit 005e2f14d37e7b83ac4ab3e60e7fb794ac8ed651 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Mar 7 17:33:59 2021 -0500 new slot code to make sub options easier. commit d7f3d9ef75367fad15081789a33212b7cf928fb3 Author: Kelvin Sherlock <ksherlock@gmail.com> Date: Sun Mar 7 17:33:13 2021 -0500 String Interning...
59 lines
1.0 KiB
Objective-C
59 lines
1.0 KiB
Objective-C
//
|
|
// Media.m
|
|
// Ample
|
|
//
|
|
// Created by Kelvin Sherlock on 3/7/2021.
|
|
// Copyright © 2021 Kelvin Sherlock. All rights reserved.
|
|
//
|
|
|
|
#import <Foundation/Foundation.h>
|
|
#import "Media.h"
|
|
|
|
const Media EmptyMedia = { 0 };
|
|
|
|
struct Media MediaFromDictionary(NSDictionary *dict) {
|
|
|
|
Media m = { 0 };
|
|
|
|
#define _(name) m.name = [[dict objectForKey: @ # name] unsignedIntValue]
|
|
_(cass);
|
|
_(cdrom);
|
|
_(hard);
|
|
_(floppy_3_5);
|
|
_(floppy_5_25);
|
|
_(pseudo_disk);
|
|
|
|
return m;
|
|
#undef _
|
|
}
|
|
|
|
void MediaAdd(Media *dest, const Media *src) {
|
|
|
|
if (!src || !dest) return;
|
|
|
|
#define _(name) dest->name += src->name;
|
|
_(cass);
|
|
_(cdrom);
|
|
_(hard);
|
|
_(floppy_3_5);
|
|
_(floppy_5_25);
|
|
_(pseudo_disk);
|
|
#undef _
|
|
}
|
|
|
|
BOOL MediaEqual(const Media *lhs, const Media *rhs) {
|
|
if (lhs == rhs) return YES;
|
|
if (!lhs || !rhs) return NO;
|
|
|
|
|
|
#define _(name) if (lhs->name != rhs->name) return NO;
|
|
_(cass);
|
|
_(cdrom);
|
|
_(hard);
|
|
_(floppy_3_5);
|
|
_(floppy_5_25);
|
|
_(pseudo_disk);
|
|
return YES;
|
|
#undef _
|
|
}
|