Skip to content

Commit

Permalink
Adjusted things
Browse files Browse the repository at this point in the history
  • Loading branch information
atg committed Jul 3, 2010
1 parent 8457248 commit f109712
Show file tree
Hide file tree
Showing 111 changed files with 505 additions and 170 deletions.
2 changes: 1 addition & 1 deletion Anthill Cocoa/AnthillBugReporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// AnthillReporter
//
// Created by Alex Gordon on 14/02/2009.
// Copyright 2009 Fileability. All rights reserved.
// Copyright 2009 Fileability. Written in 2010 by Fileability..
//

#import <Cocoa/Cocoa.h>
Expand Down
2 changes: 1 addition & 1 deletion Anthill Cocoa/AnthillBugReporter.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// AnthillReporter
//
// Created by Alex Gordon on 14/02/2009.
// Copyright 2009 Fileability. All rights reserved.
// Copyright 2009 Fileability. Written in 2010 by Fileability..
//

#import "AnthillBugReporter.h"
Expand Down
2 changes: 1 addition & 1 deletion CHLeftSplitVIew.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Chocolat
//
// Created by Alex Gordon on 29/10/2009.
// Copyright 2009 __MyCompanyName__. All rights reserved.
// Copyright 2009 Fileability. Written in 2010 by Fileability..
//

#import <Cocoa/Cocoa.h>
Expand Down
2 changes: 1 addition & 1 deletion CHLeftSplitView.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Chocolat
//
// Created by Alex Gordon on 29/10/2009.
// Copyright 2009 __MyCompanyName__. All rights reserved.
// Copyright 2009 Fileability. Written in 2010 by Fileability..
//

#import "CHLeftSplitView.h"
Expand Down
2 changes: 1 addition & 1 deletion CHSymbolButtonImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Chocolat
//
// Created by Alex Gordon on 11/09/2009.
// Copyright 2009 Fileability. All rights reserved.
// Copyright 2009 Fileability. Written in 2010 by Fileability..
//

#import <Cocoa/Cocoa.h>
Expand Down
2 changes: 1 addition & 1 deletion CHSymbolButtonImage.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Chocolat
//
// Created by Alex Gordon on 11/09/2009.
// Copyright 2009 Fileability. All rights reserved.
// Copyright 2009 Fileability. Written in 2010 by Fileability..
//

#import "CHSymbolButtonImage.h"
Expand Down
3 changes: 3 additions & 0 deletions English.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,7 @@
<reference key="NSMenu" ref="531461334"/>
<bool key="NSIsDisabled">YES</bool>
<bool key="NSIsSeparator">YES</bool>
<bool key="NSIsHidden">YES</bool>
<string key="NSTitle"/>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
Expand All @@ -804,6 +805,7 @@
</object>
<object class="NSMenuItem" id="739539978">
<reference key="NSMenu" ref="531461334"/>
<bool key="NSIsHidden">YES</bool>
<string key="NSTitle">Previous Symbol</string>
<string key="NSKeyEquiv"></string>
<int key="NSKeyEquivModMask">1572864</int>
Expand All @@ -813,6 +815,7 @@
</object>
<object class="NSMenuItem" id="1070219007">
<reference key="NSMenu" ref="531461334"/>
<bool key="NSIsHidden">YES</bool>
<string key="NSTitle">Next Symbol</string>
<string key="NSKeyEquiv"></string>
<int key="NSKeyEquivModMask">1572864</int>
Expand Down
6 changes: 6 additions & 0 deletions HTML_Example/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ code
.category
{
margin-top: -4px;
margin-bottom: 0;
padding-bottom: 8px;
text-indent: 20px;
font-style: italic;
font-size: 13px;
Expand Down Expand Up @@ -134,6 +136,10 @@ code

border-top-style: none;
}
.methods div.description
{
margin-top: -12px;
}

.methods .info h3
{
Expand Down
2 changes: 1 addition & 1 deletion IGKAnnotation.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Ingredients
//
// Created by Jean-Nicolas Jolivet on 10-04-30.
// Copyright 2010 SilverCocoa. All rights reserved.
// Written in 2010 by SilverCocoa.
//

#import <Cocoa/Cocoa.h>
Expand Down
2 changes: 1 addition & 1 deletion IGKAnnotation.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Ingredients
//
// Created by Jean-Nicolas Jolivet on 10-04-30.
// Copyright 2010 SilverCocoa. All rights reserved.
// Written in 2010 by SilverCocoa.
//

#import "IGKAnnotation.h"
Expand Down
2 changes: 1 addition & 1 deletion IGKAnnotationManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Ingredients
//
// Created by Jean-Nicolas Jolivet on 10-04-30.
// Copyright 2010 SilverCocoa. All rights reserved.
// Written in 2010 by SilverCocoa.
//

#import <Cocoa/Cocoa.h>
Expand Down
2 changes: 1 addition & 1 deletion IGKAnnotationManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Ingredients
//
// Created by Jean-Nicolas Jolivet on 10-04-30.
// Copyright 2010 SilverCocoa. All rights reserved.
// Written in 2010 by SilverCocoa.
//

#import "IGKAnnotationManager.h"
Expand Down
2 changes: 1 addition & 1 deletion IGKApplicationDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 23/01/2010.
// Copyright 2010 Fileability. All rights reserved.
// Written in 2010 by Fileability.
//

#import <Cocoa/Cocoa.h>
Expand Down
2 changes: 1 addition & 1 deletion IGKApplicationDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 23/01/2010.
// Copyright 2010 Fileability. All rights reserved.
// Written in 2010 by Fileability.
//

#import "IGKApplicationDelegate.h"
Expand Down
2 changes: 1 addition & 1 deletion IGKArrayController.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 13/02/2010.
// Copyright 2010 Fileability. All rights reserved.
// Written in 2010 by Fileability.
//

#import <Cocoa/Cocoa.h>
Expand Down
2 changes: 1 addition & 1 deletion IGKArrayController.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 13/02/2010.
// Copyright 2010 Fileability. All rights reserved.
// Written in 2010 by Fileability.
//

#import "IGKArrayController.h"
Expand Down
2 changes: 1 addition & 1 deletion IGKBackForwardManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 07/03/2010.
// Copyright 2010 Fileability. All rights reserved.
// Written in 2010 by Fileability.
//

#import <Cocoa/Cocoa.h>
Expand Down
2 changes: 1 addition & 1 deletion IGKBackForwardManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 07/03/2010.
// Copyright 2010 Fileability. All rights reserved.
// Written in 2010 by Fileability.
//

#import "IGKBackForwardManager.h"
Expand Down
2 changes: 1 addition & 1 deletion IGKBackgroundProgressBar.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 17/04/2010.
// Copyright 2010 Fileability. All rights reserved.
// Written in 2010 by Fileability.
//

#import <Cocoa/Cocoa.h>
Expand Down
2 changes: 1 addition & 1 deletion IGKBackgroundProgressBar.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 17/04/2010.
// Copyright 2010 Fileability. All rights reserved.
// Written in 2010 by Fileability.
//

#import "IGKBackgroundProgressBar.h"
Expand Down
25 changes: 16 additions & 9 deletions IGKCircularBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,44 @@ typedef struct {
// 0 <= elementCount <= actualSize <= targetSize

//The number of elements in the buffer
size_t elementCount;
CFIndex elementCount;

//The amount of elements that we have allocated enough memory to hold. Must not be 0
size_t allocatedCount;
CFIndex allocatedCount;

//The maximum number of elements that the buffer will grow to hold before it starts discarding things
size_t maximumCount;
CFIndex maximumCount;

//The size in bytes of each element in the buffer
size_t elementSize;
CFIndex elementSize;

//A pointer to all the elements
void* items;

//The offset of the element that was added the longest time ago
size_t oldestElement;
CFIndex oldestElement;

//The offset of the element that was added most recently
size_t youngestElement;
CFIndex youngestElement;

} IGKCircularBuffer;

//Create a buffer and fill it with data
IGKCircularBuffer IGKCircularBufferCreateFromData(const void *data, CFIndex dataLength, CFIndex maximumCount, CFIndex elementSize);

//Create an empty buffer with a specified size
IGKCircularBuffer IGKCircularBufferCreate(size_t maximumCount, size_t elementSize, size_t initialSize);
IGKCircularBuffer IGKCircularBufferCreate(CFIndex maximumCount, CFIndex elementSize, CFIndex initialSize);

//Add elementSize bytes of *pointerToData to the buffer.
void IGKCircularBufferAdd(IGKCircularBuffer buffer, void* pointerToData);

//Get a pointer to the raw data and the length of the data, eg to pass to NSData
IGKCircularBuffer IGKCircularBufferRawData(IGKCircularBuffer buffer);
size_t IGKCircularBufferRawDataLength(IGKCircularBuffer buffer);
void* IGKCircularBufferRawData(IGKCircularBuffer buffer);
CFIndex IGKCircularBufferRawDataLength(IGKCircularBuffer buffer);

//Get data in a format suitable for writing out to disk
NSData* IGKCircularBufferOrderedData(IGKCircularBuffer buffer);
CFIndex IGKCircularBufferOrderedDataLength(IGKCircularBuffer buffer);

//Delete the buffer
void IGKCircularBufferFree(IGKCircularBuffer buffer);
70 changes: 46 additions & 24 deletions IGKCircularBuffer.m
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
typedef struct {
// 0 <= elementCount <= actualSize <= targetSize

//The number of elements in the buffer
CFIndex elementCount;

//The amount of elements that we have allocated enough memory to hold. Must not be 0
CFIndex allocatedCount;

//The maximum number of elements that the buffer will grow to hold before it starts discarding things
CFIndex maximumCount;

//The size in bytes of each element in the buffer
CFIndex elementSize;
#import "IGKCircularBuffer.h"

IGKCircularBuffer IGKCircularBufferCreateFromData(const void *data, CFIndex dataLength, CFIndex maximumCount, CFIndex elementSize)
{
IGKCircularBuffer buffer;

//A pointer to all the elements
void* items;
buffer.elementCount = 0;
buffer.allocatedCount = dataLength / elementSize;
buffer.maximumCount = maximumCount;
buffer.elementSize = elementSize;

//The offset of the element that was added the longest time ago
int64_t oldestElement;
buffer.items = malloc(dataLength * elementSize);
memcpy(buffer.items, data, dataLength);

//The offset of the element that was added most recently
CFIndex youngestElement;
buffer.oldestElement = -1;
buffer.youngestElement = -1;

} IGKCircularBuffer;
return buffer;
}

//Create an empty buffer with a specified size
IGKCircularBuffer IGKCircularBufferCreate(CFIndex maximumCount, CFIndex elementSize, CFIndex initialSize)
Expand All @@ -47,7 +41,7 @@ IGKCircularBuffer IGKCircularBufferCreate(CFIndex maximumCount, CFIndex elementS
}

//Add elementSize bytes of *pointerToData to the buffer.
void* IGKCircularBufferAdd(IGKCircularBuffer buffer, void* pointerToData)
void IGKCircularBufferAdd(IGKCircularBuffer buffer, void* pointerToData)
{
//If the buffer needs to grow
if (buffer.elementCount + 1 > buffer.allocatedCount && buffer.allocatedCount < buffer.maximumCount)
Expand All @@ -65,7 +59,7 @@ IGKCircularBuffer IGKCircularBufferCreate(CFIndex maximumCount, CFIndex elementS
if (!newItems)
{
//Do something if reallocf fails
return NULL;
return;
}

//Set our variables
Expand Down Expand Up @@ -114,7 +108,7 @@ IGKCircularBuffer IGKCircularBufferCreate(CFIndex maximumCount, CFIndex elementS
}

//Get a pointer to the raw data and the length of the data, eg to pass to NSData
IGKCircularBuffer* IGKCircularBufferRawData(IGKCircularBuffer buffer)
void* IGKCircularBufferRawData(IGKCircularBuffer buffer)
{
return buffer.items;
}
Expand All @@ -125,6 +119,34 @@ CFIndex IGKCircularBufferRawDataLength(IGKCircularBuffer buffer)
return 0;
}

//Get data in a format suitable for writing out to disk
NSData* IGKCircularBufferOrderedData(IGKCircularBuffer buffer)
{
NSMutableData *data = [[NSMutableData alloc] initWithCapacity:IGKCircularBufferOrderedDataLength(buffer)];

if (buffer.elementCount == 0)
return data;

for (CFIndex i = buffer.oldestElement; ; i = (i + 1) % buffer.elementCount)
{
if (buffer.items + i == NULL)
continue;

[data appendBytes:buffer.items + i * buffer.elementSize length:buffer.elementSize];

if (i == buffer.youngestElement)
break;
}

return data;
}
CFIndex IGKCircularBufferOrderedDataLength(IGKCircularBuffer buffer)
{
if (buffer.items)
return buffer.elementCount * buffer.elementSize;
return 0;
}

//Delete the buffer
void IGKCircularBufferFree(IGKCircularBuffer buffer)
{
Expand Down
2 changes: 1 addition & 1 deletion IGKDocRecordManagedObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 25/01/2010.
// Copyright 2010 Fileability. All rights reserved.
// Written in 2010 by Fileability.
//

#import <Cocoa/Cocoa.h>
Expand Down
6 changes: 5 additions & 1 deletion IGKDocRecordManagedObject.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Ingredients
//
// Created by Alex Gordon on 25/01/2010.
// Copyright 2010 Fileability. All rights reserved.
// Written in 2010 by Fileability.
//

#import "IGKDocRecordManagedObject.h"
Expand Down Expand Up @@ -552,5 +552,9 @@ - (NSImage *)iconForSelectedState:(BOOL)isSelected

return [[CHSymbolButtonImage symbolImageWithMask:mask] objectAtIndex:index];
}
- (NSNumber *)lengthOfContent
{
return [self valueForKey:@"contentsLength"];
}

@end
Loading

0 comments on commit f109712

Please sign in to comment.