-
Notifications
You must be signed in to change notification settings - Fork 0
/
c.html
117 lines (116 loc) · 3.17 KB
/
c.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>c</title>
<style>{}</style>
</head><body>
<h1>SymbolicC Mathematica</h1>
<p>glibc & `brew install glib` & clib<br>
check file descriptors `cat /proc/sys/fs/file-nr`
<img src="./i/POSIXRequired.png">
<img src="./i/XSIoptionheaders.png">
<a href="https://softwareengineering.stackexchange.com/questions/288016/how-do-c-c-programs-get-ported-to-different-platforms">Portable c programs</a>
</p>
<pre><a href="http://mathematica.stackexchange.com/q/73093">Code Needed</a>
<code>Needs["SymbolicC`"]</code><br>~~ <> :> -> {a}.{b} $ @ {} (t)& _blank +-*% 2^100 && || | {} == = != !s
</pre>
<table width="100%" border="1">
<tbody>
<tr>
<td><b>SymbolicC Simplified</b></td>
<td><b>SimbolicC Expanded</b></td>
<td><b>c</b></td>
</tr>
<tr>
<td><pre><code></code></pre></td>
<td><pre><code>CDeclare[mbool,{x,y}];</code></pre></td>
<td><pre><code>mbool x,y;</code></pre></td>
</tr>
<tr>
<td width="33%"><pre><code>enum[data,
val1 = -1,
val2
] enum[data,{}]</code></pre></td>
<td width="33%"><pre><code>CEnum["data", {<br> CAssign["val1", -1], "val2", "val3"<br>}]</code></pre></td>
<td width="33%"><pre><code>enum data{
val1 = -1,
val2
};</code></pre></td>
</tr>
<tr>
<td><pre><code>cast[CPointerType[double], x]</code></pre></td>
<td><pre><code>CCast[CPointerType[double], x]</code></pre></td>
<td><pre><code>(double*) x;</code></pre></td>
</tr>
<tr>
<td><pre><code>struct[point,
{double, x},
{double, y}
]
Struct[point,{ {double, x} }]</code></pre></td>
<td> </td>
<td><pre><code>struct point {
double x;
double y;
}</code></pre></td>
</tr>
<tr>
<td><pre>union[data, {
{int, ival},
{double, dval}
}] </pre></td>
<td> </td>
<td><pre><code>union data{
int ival;
double dval;
}</code></pre></td>
</tr>
<tr>
<td><pre></pre></td>
<td>
<pre><code>CTypedef[{const, int}, {myint, test2}]</code></pre>
</td>
<td><pre>typedef const int myint, test2;</pre></td>
</tr>
<tr>
<td><pre>sizeof[x]</pre></td>
<td>
<pre><code>CSizeOf[t,p]</code></pre>
</td>
<td><pre><code>sizeof(test)</code></pre></td>
</tr>
<tr>
<td><pre>test->test2
Rule[t_, p_] -> CPointerMember[t,p];
</pre></td>
<td><pre><code>CPointerMember[t,p]</code></pre></td>
<td><pre>test->test2</pre></td>
</tr>
<tr>
<td><pre>(v)&</pre></td>
<td><pre><code>CAddress[v]</code></pre></td>
<td><pre><code>v&</code></pre></td>
</tr>
<tr>
<td><pre><code>$(x)</code></pre></td>
<td><pre><code>CDerefence[x]</code></pre></td>
<td><pre><code>*x</code></pre></td>
</tr>
<tr>
<td><pre>CArray</pre></td>
<td> </td>
<td><pre><code>{}</code></pre></td>
</tr>
<tr>
<td><pre>CString</pre></td>
<td> </td>
<td><pre><code>String["test"]</code></pre></td>
</tr>
</tbody>
</table>
<p>
CArary, CInclude, CConstant, CParentheses, CDefine, CError, Cline, CPragma, CUndef
</p>
</body>
</html>