This commit is contained in:
Robert Jelic
2025-02-16 18:04:24 +01:00
parent 41e6149828
commit 31787b0e9b
2670 changed files with 1037781 additions and 0 deletions

33
node_modules/shiki/samples/objective-cpp.sample generated vendored Normal file
View File

@@ -0,0 +1,33 @@
#include <stdio.h>
#include <Block.h>
typedef int (^IntBlock)();
IntBlock MakeCounter(int start, int increment) {
__block int i = start;
return Block_copy( ^ {
int ret = i;
i += increment;
return ret;
});
}
int main(void) {
IntBlock mycounter = MakeCounter(5, 2);
printf("First call: %d\n", mycounter());
printf("Second call: %d\n", mycounter());
printf("Third call: %d\n", mycounter());
/* because it was copied, it must also be released */
Block_release(mycounter);
return 0;
}
/* Output:
First call: 5
Second call: 7
Third call: 9
*/
// From https://en.wikipedia.org/wiki/Objective-C