Skip to content

Instantly share code, notes, and snippets.

View slembcke's full-sized avatar
👣
Gruntled

Scott Lembcke slembcke

👣
Gruntled
View GitHub Profile
KillableInterface : abstract class {
dyingNoise : abstract func -> String {}
}
KillableReference : cover {
obj : Pointer
impl : KillableInterfaceClass
}
KillableDog : abstract class extends KillableInterface {
struct timeval start_time, end_time;
gettimeofday(&start_time, NULL);
for(int i=0; i<count; i++)
currDemo->updateFunc(i);
gettimeofday(&end_time, NULL);
long millisecs = (end_time.tv_sec - start_time.tv_sec)*1000;
millisecs += (end_time.tv_usec - start_time.tv_usec)/1000;
#include <stdio.h>
void func2(int a, int b, int c, int d, int e){
printf("%d %d %d %d %d\n", a, b, c, d, e);
}
void func1(int d){
func2(1,2,3,4,d);
}
#include <stdio.h>
void func2(int a, int b, int c){
printf("%d %d %d\n", a, b, c);
}
void func1(int c){
func2(1,2,c);
}
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <stdarg.h>
// NOTE: double precision floats count as two arguments
// givenArgc - count of arguments generated function should accept
// largeStruct - true if the function returns a struct larger than 4bytes
// func - function to wrap
// partialArgc - count of arguments passed by the trampoline to func
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <stdarg.h>
// NOTE: double precision floats count as two arguments
// givenArgc - count of arguments generated function should accept
// largeStruct - true if the function returns a struct larger than 4bytes
// func - function to wrap
// partialArgc - count of arguments passed by the trampoline to func
// iterating a singly linked list ring
// operations might include splicing or deleting elements
node *elt = first, *next;
do {
next = elt->next;
// do stuff here including modify elt->next
} while((elt = next) != first);
// is there a less verbose way?
// ************** oggsteamer.h
#define NUM_BUFFERS 4
#define BUFFER_SIZE 65536
#define BUFFER_MSECS 10
typedef struct {
char *data;
int data_length;
int seek_offset;
@interface ChipmunkSprite : CCSprite {
ChipmunkBody *body;
cpBody *cp_body;
}
@property(retain) ChipmunkBody *body;
@end
#if COCOS2D_VERSION < 0x00009904 || 0x00009904 < COCOS2D_VERSION
#warning ChipmunkSprite has not been tested against this version of Cocos2D.
// ChipmunkSprite overrides a private method (getTransformValues) of CCSprite.
// This could break ChipmunkSprite if Cocos2D changes the method changes in a different version.
// ChipmunkSprite also overrides other CCNode and CCSprite methods to make sure the position and rotation is synchronized.
#endif
@implementation ChipmunkSprite
- (ChipmunkBody *)body {return body;}