boof / syntaxhighlighter

SVN import of official repository.

This URL has Read+Write access

syntaxhighlighter / Cpp.html
100644 216 lines (195 sloc) 7.425 kb
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Code Syntax Highlighter
Version 1.5.2
Copyright (C) 2004-2008 Alex Gorbatchev
http://www.dreamprojections.com/syntaxhighlighter/
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/Test.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>dp.SyntaxHighlighter Tests</title>
<link type="text/css" rel="stylesheet" href="Styles/SyntaxHighlighter.css">
</link>
<link href="Styles/TestPages.css" rel="stylesheet" type="text/css">
</link>
</head>
<body>
<h1>dp.SyntaxHighlighter 1.5.2 Tests and Samples</h1>
<p><a href="http://code.google.com/p/syntaxhighlighter/">http://code.google.com/p/syntaxhighlighter/</a></p>
<h2><!-- InstanceBeginEditable name="Title" -->C++<!-- InstanceEndEditable --></h2>
<div class="layout">
<div class="column1">
<h3>Languages:</h3>
<ol>
<li><a href="CSharp.html">C#</a></li>
<li><a href="CSS.html">CSS</a></li>
<li><a href="Cpp.html">C++</a></li>
<li><a href="Delphi.html">Delphi</a></li>
<li><a href="Java.html">Java</a></li>
<li><a href="JavaScript.html">JavaScript</a></li>
<li><a href="PHP.html">PHP</a></li>
<li><a href="Python.html">Python</a></li>
<li><a href="Ruby.html">Ruby</a></li>
<li><a href="SQL.html">SQL</a></li>
<li><a href="VB.html">Visual Basic</a></li>
<li><a href="XML.html">XML / HTML</a></li>
<li><a href="Scala.html">Scala</a></li>
<li><a href="Groovy.html">Groovy</a></li>
<li><a href="Bash.html">Bash</a></li>
</ol>
<h3>Features:</h3>
<ol>
<li><a href="SmartTabs.html">Smart tabs</a></li>
<li><a href="FirstLine.html">First line</a> </li>
<li><a href="CollapseCode.html">Expand code</a></li>
<li><a href="ShowColumns.html">Show columns</a></li>
<li><a href="Blogger.html">Blogger integration</a></li>
<li><a href="NoGutter.html">No gutter</a></li>
<li><a href="NoControls.html">No controls</a></li>
</ol>
<h3>Issues:</h3>
<ol>
<li><a href="Issues/Issue7.xml">#7, XSL transformation</a></li>
<li><a href="Issues/Issue15.html">#15, Incorrect single quote</a></li>
<li><a href="Issues/Issue10.html">#10, VB crash</a></li>
<li><a href="Issues/Issue19.html">#19, No matches</a></li>
</ol>
</div>
<div class="column2">
<div class="block-box">Block before.</div>
<!-- InstanceBeginEditable name="Code" -->
<pre name="code" class="c">
#include &lt;windows.h>
#include "winevent.hpp"
 
#include &lt;time.h>
#include &lt;stdio.h>
 
int nInt = 0;
int nStart = 0;
int nEnd = 0;
char buf[255];
 
//////////////////////////////////////////////////////////////
// Event handlers
 
template&lt;>
LRESULT OnMsg&lt;WM_CREATE>(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
strcpy(buf, "Press any key to start test");
return DefWindowProc(hWnd, WM_CREATE, wParam, lParam);
}
 
template&lt;>
LRESULT OnMsg&lt;WM_KEYDOWN>(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
nInt = 0;
strcpy(buf, "running test, please wait ...");
InvalidateRect(hWnd, NULL, true);
SendMessage(hWnd, WM_PAINT, 0, 0);
nStart = GetTickCount();
PostMessage(hWnd, WM_TIMER, 0, 0);
return DefWindowProc(hWnd, WM_KEYDOWN, wParam, lParam);
}
 
template&lt;>
LRESULT OnMsg&lt;WM_TIMER>(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
if (nInt++ < 100000) {
PostMessage(hWnd, WM_TIMER, 0, 0);
} else {
nEnd = GetTickCount();
sprintf(buf, "Time elapsed = %d msec",
((nEnd - nStart) * 1000) / CLOCKS_PER_SEC);
InvalidateRect(hWnd, NULL, true);
}
return 0;
}
 
template&lt;>
LRESULT OnMsg&lt;WM_DESTROY>(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
PostQuitMessage(0);
return 0;
}
 
template&lt;>
LRESULT OnMsg&lt;WM_PAINT>(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;
hdc = BeginPaint(hWnd, &ps);
TextOut(hdc, 100, 100, buf, static_cast&lt;int>(strlen(buf)));
EndPaint(hWnd, &ps);
return DefWindowProc(hWnd, WM_PAINT, wParam, lParam);
}
 
/****************************************************
// Entry point for the application.
****************************************************/
 
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance, LPSTR szCmdLine, int nCmdShow)
{
InitMsgHandlers&lt;NULL>();
 
static char szAppName[] = "demo";
HWND hwnd;
MSG msg;
WNDCLASSEX wndclass;
 
wndclass.cbSize = sizeof(wndclass);
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wndclass.lpszClassName = szAppName;
wndclass.lpszMenuName = NULL;
 
RegisterClassEx(&wndclass);
 
hwnd = CreateWindow(szAppName, "Static Dispatch Demo",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInstance, NULL);
 
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
 
while ( GetMessage(&msg, NULL, 0, 0) ) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return static_cast&lt;int>(msg.wParam);
}
</pre>
<!-- InstanceEndEditable -->
<div class="block-box">Block after.</div>
</div>
</div>
<div class="footer"> Copyright 2004-2008 Alex Gorbatchev.<br/>
</div>
<script class="javascript" src="Scripts/shCore.js"></script>
<script class="javascript" src="Scripts/shBrushCSharp.js"></script>
<script class="javascript" src="Scripts/shBrushPhp.js"></script>
<script class="javascript" src="Scripts/shBrushJScript.js"></script>
<script class="javascript" src="Scripts/shBrushJava.js"></script>
<script class="javascript" src="Scripts/shBrushVb.js"></script>
<script class="javascript" src="Scripts/shBrushSql.js"></script>
<script class="javascript" src="Scripts/shBrushXml.js"></script>
<script class="javascript" src="Scripts/shBrushDelphi.js"></script>
<script class="javascript" src="Scripts/shBrushPython.js"></script>
<script class="javascript" src="Scripts/shBrushRuby.js"></script>
<script class="javascript" src="Scripts/shBrushCss.js"></script>
<script class="javascript" src="Scripts/shBrushCpp.js"></script>
<script class="javascript" src="Scripts/shBrushScala.js"></script>
<script class="javascript" src="Scripts/shBrushGroovy.js"></script>
<script class="javascript" src="Scripts/shBrushBash.js"></script>
<script class="javascript">
      if(window.isBloggerMode == true)
      dp.SyntaxHighlighter.BloggerMode();
      
      dp.SyntaxHighlighter.ClipboardSwf = 'Scripts/clipboard.swf';
      dp.SyntaxHighlighter.HighlightAll('code');
    </script>
</body>
<!-- InstanceEnd --></html>