Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components.js

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,18 @@
"title": "CIL",
"owner": "sbrl"
},
"cilkc": {
"title": "Cilk/C",
"require": "c",
"alias": "cilk-c",
"owner": "OpenCilk"
},
"cilkcpp": {
"title": "Cilk/C++",
"require": "cpp",
"alias": ["cilk-cpp", "cilk"],
"owner": "OpenCilk"
},
"clojure": {
"title": "Clojure",
"owner": "troglotit"
Expand Down
8 changes: 8 additions & 0 deletions components/prism-cilkc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Prism.languages.cilkc = Prism.languages.insertBefore('c', 'function', {
'parallel-keyword': {
pattern: /\bcilk_(?:for|reducer|s(?:cope|pawn|ync))\b/,
alias: 'keyword'
}
});

Prism.languages['cilk-c'] = Prism.languages['cilkc'];
1 change: 1 addition & 0 deletions components/prism-cilkc.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions components/prism-cilkcpp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Prism.languages.cilkcpp = Prism.languages.insertBefore('cpp', 'function', {
'parallel-keyword': {
pattern: /\bcilk_(?:for|reducer|s(?:cope|pawn|ync))\b/,
alias: 'keyword'
}
});

Prism.languages['cilk-cpp'] = Prism.languages['cilkcpp'];
Prism.languages['cilk'] = Prism.languages['cilkcpp'];
1 change: 1 addition & 0 deletions components/prism-cilkcpp.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions examples/prism-cilkc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<h2>Cilk keywords</h2>
<pre><code>cilk_scope {}
cilk_spawn f();
cilk_spawn {}
cilk_sync;
cilk_for () {}
int cilk_reducer() x;</code></pre>

<h2>Full example</h2>
<pre><code>#include &lt;cilk/cilk.h>

int fib_cilk_scope(int n) {
if (n &lt; 2)
return;
int x, y;
cilk_scope {
x = cilk_spawn fib(n-1);
y = fib(n-2);
}
return x + y;

int fib_cilk_sync(int n) {
if (n &lt; 2)
return;
int x = cilk_spawn fib(n-1);
int y = fib(n-2);
cilk_sync;
return x + y;
}

void zero(void *v) {
*(int *)v = 0;
}
void plus(void *l, void *r) {
*(int *)l += *(int *)r;
}
int array_sum_cilk_for_reducer(int *A, int n) {
int cilk_reducer(zero, plus) sum = 0;
cilk_for (int i = 0; i &lt; n; ++i)
sum += A[i];
return sum;
}</code></pre>
43 changes: 43 additions & 0 deletions examples/prism-cilkcpp.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<h2>Cilk keywords</h2>
<pre><code>cilk_scope {}
cilk_spawn f();
cilk_spawn {}
cilk_sync;
cilk_for () {}
int cilk_reducer() x;</code></pre>

<h2>Full example</h2>
<pre><code>#include &lt;cilk/cilk.h>
#include &lt;vector>

int fib_cilk_scope(int n) {
if (n &lt; 2)
return;
int x, y;
cilk_scope {
x = cilk_spawn fib(n-1);
y = fib(n-2);
}
return x + y;

int fib_cilk_sync(int n) {
if (n &lt; 2)
return;
int x = cilk_spawn fib(n-1);
int y = fib(n-2);
cilk_sync;
return x + y;
}

void zero(void *v) {
*(int *)v = 0;
}
void plus(void *l, void *r) {
*(int *)l += *(int *)r;
}
int array_sum_cilk_for_reducer(std::vector&lt;int> A) {
int cilk_reducer(zero, plus) sum = 0;
cilk_for (auto itr = A.cbegin(); itr != A.cend(); ++itr)
sum += *itr;
return sum;
}</code></pre>
5 changes: 5 additions & 0 deletions plugins/autoloader/prism-autoloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
"clike",
"cpp"
],
"cilkc": "c",
"cilkcpp": "cpp",
"coffeescript": "javascript",
"crystal": "ruby",
"css-extras": "css",
Expand Down Expand Up @@ -195,6 +197,9 @@
"cs": "csharp",
"dotnet": "csharp",
"cfc": "cfscript",
"cilk-c": "cilkc",
"cilk-cpp": "cilkcpp",
"cilk": "cilkcpp",
"coffee": "coffeescript",
"conc": "concurnas",
"jinja2": "django",
Expand Down
2 changes: 1 addition & 1 deletion plugins/autoloader/prism-autoloader.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions plugins/show-language/prism-show-language.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@
"cfscript": "CFScript",
"cfc": "CFScript",
"cil": "CIL",
"cilkc": "Cilk/C",
"cilk-c": "Cilk/C",
"cilkcpp": "Cilk/C++",
"cilk-cpp": "Cilk/C++",
"cilk": "Cilk/C++",
"cmake": "CMake",
"cobol": "COBOL",
"coffee": "CoffeeScript",
Expand Down
Loading