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
Expand Up @@ -3,7 +3,7 @@
// AnthillReporter // AnthillReporter
// //
// Created by Alex Gordon on 14/02/2009. // 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> #import <Cocoa/Cocoa.h>
Expand Down
2 changes: 1 addition & 1 deletion Anthill Cocoa/AnthillBugReporter.m
Expand Up @@ -3,7 +3,7 @@
// AnthillReporter // AnthillReporter
// //
// Created by Alex Gordon on 14/02/2009. // 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" #import "AnthillBugReporter.h"
Expand Down
2 changes: 1 addition & 1 deletion CHLeftSplitVIew.h
Expand Up @@ -3,7 +3,7 @@
// Chocolat // Chocolat
// //
// Created by Alex Gordon on 29/10/2009. // 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> #import <Cocoa/Cocoa.h>
Expand Down
2 changes: 1 addition & 1 deletion CHLeftSplitView.m
Expand Up @@ -3,7 +3,7 @@
// Chocolat // Chocolat
// //
// Created by Alex Gordon on 29/10/2009. // 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" #import "CHLeftSplitView.h"
Expand Down
2 changes: 1 addition & 1 deletion CHSymbolButtonImage.h
Expand Up @@ -3,7 +3,7 @@
// Chocolat // Chocolat
// //
// Created by Alex Gordon on 11/09/2009. // 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> #import <Cocoa/Cocoa.h>
Expand Down
2 changes: 1 addition & 1 deletion CHSymbolButtonImage.m
Expand Up @@ -3,7 +3,7 @@
// Chocolat // Chocolat
// //
// Created by Alex Gordon on 11/09/2009. // 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" #import "CHSymbolButtonImage.h"
Expand Down
3 changes: 3 additions & 0 deletions English.lproj/MainMenu.xib
Expand Up @@ -796,6 +796,7 @@
<reference key="NSMenu" ref="531461334"/> <reference key="NSMenu" ref="531461334"/>
<bool key="NSIsDisabled">YES</bool> <bool key="NSIsDisabled">YES</bool>
<bool key="NSIsSeparator">YES</bool> <bool key="NSIsSeparator">YES</bool>
<bool key="NSIsHidden">YES</bool>
<string key="NSTitle"/> <string key="NSTitle"/>
<string key="NSKeyEquiv"/> <string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int> <int key="NSMnemonicLoc">2147483647</int>
Expand All @@ -804,6 +805,7 @@
</object> </object>
<object class="NSMenuItem" id="739539978"> <object class="NSMenuItem" id="739539978">
<reference key="NSMenu" ref="531461334"/> <reference key="NSMenu" ref="531461334"/>
<bool key="NSIsHidden">YES</bool>
<string key="NSTitle">Previous Symbol</string> <string key="NSTitle">Previous Symbol</string>
<string key="NSKeyEquiv"></string> <string key="NSKeyEquiv"></string>
<int key="NSKeyEquivModMask">1572864</int> <int key="NSKeyEquivModMask">1572864</int>
Expand All @@ -813,6 +815,7 @@
</object> </object>
<object class="NSMenuItem" id="1070219007"> <object class="NSMenuItem" id="1070219007">
<reference key="NSMenu" ref="531461334"/> <reference key="NSMenu" ref="531461334"/>
<bool key="NSIsHidden">YES</bool>
<string key="NSTitle">Next Symbol</string> <string key="NSTitle">Next Symbol</string>
<string key="NSKeyEquiv"></string> <string key="NSKeyEquiv"></string>
<int key="NSKeyEquivModMask">1572864</int> <int key="NSKeyEquivModMask">1572864</int>
Expand Down
6 changes: 6 additions & 0 deletions HTML_Example/main.css
Expand Up @@ -17,6 +17,8 @@ code
.category .category
{ {
margin-top: -4px; margin-top: -4px;
margin-bottom: 0;
padding-bottom: 8px;
text-indent: 20px; text-indent: 20px;
font-style: italic; font-style: italic;
font-size: 13px; font-size: 13px;
Expand Down Expand Up @@ -134,6 +136,10 @@ code


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


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


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


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


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


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


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


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


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


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


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


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


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


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


//The number of elements in the buffer //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 //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 //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 //The size in bytes of each element in the buffer
size_t elementSize; CFIndex elementSize;


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


//The offset of the element that was added the longest time ago //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 //The offset of the element that was added most recently
size_t youngestElement; CFIndex youngestElement;


} IGKCircularBuffer; } 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 //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. //Add elementSize bytes of *pointerToData to the buffer.
void IGKCircularBufferAdd(IGKCircularBuffer buffer, void* pointerToData); void IGKCircularBufferAdd(IGKCircularBuffer buffer, void* pointerToData);


//Get a pointer to the raw data and the length of the data, eg to pass to NSData //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);
size_t IGKCircularBufferRawDataLength(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 //Delete the buffer
void IGKCircularBufferFree(IGKCircularBuffer buffer); void IGKCircularBufferFree(IGKCircularBuffer buffer);
70 changes: 46 additions & 24 deletions IGKCircularBuffer.m
@@ -1,28 +1,22 @@
typedef struct { #import "IGKCircularBuffer.h"
// 0 <= elementCount <= actualSize <= targetSize

IGKCircularBuffer IGKCircularBufferCreateFromData(const void *data, CFIndex dataLength, CFIndex maximumCount, CFIndex elementSize)
//The number of elements in the buffer {
CFIndex elementCount; IGKCircularBuffer buffer;

//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;


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


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


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


} IGKCircularBuffer; return buffer;
}


//Create an empty buffer with a specified size //Create an empty buffer with a specified size
IGKCircularBuffer IGKCircularBufferCreate(CFIndex maximumCount, CFIndex elementSize, CFIndex initialSize) 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. //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 the buffer needs to grow
if (buffer.elementCount + 1 > buffer.allocatedCount && buffer.allocatedCount < buffer.maximumCount) if (buffer.elementCount + 1 > buffer.allocatedCount && buffer.allocatedCount < buffer.maximumCount)
Expand All @@ -65,7 +59,7 @@ IGKCircularBuffer IGKCircularBufferCreate(CFIndex maximumCount, CFIndex elementS
if (!newItems) if (!newItems)
{ {
//Do something if reallocf fails //Do something if reallocf fails
return NULL; return;
} }


//Set our variables //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 //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; return buffer.items;
} }
Expand All @@ -125,6 +119,34 @@ CFIndex IGKCircularBufferRawDataLength(IGKCircularBuffer buffer)
return 0; 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 //Delete the buffer
void IGKCircularBufferFree(IGKCircularBuffer buffer) void IGKCircularBufferFree(IGKCircularBuffer buffer)
{ {
Expand Down
2 changes: 1 addition & 1 deletion IGKDocRecordManagedObject.h
Expand Up @@ -3,7 +3,7 @@
// Ingredients // Ingredients
// //
// Created by Alex Gordon on 25/01/2010. // Created by Alex Gordon on 25/01/2010.
// Copyright 2010 Fileability. All rights reserved. // Written in 2010 by Fileability.
// //


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


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


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


@end @end

0 comments on commit f109712

Please sign in to comment.