cstruct 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/documents.html +572 -0
- data/doc/examples/anonymous_struct.rb.html +94 -0
- data/doc/examples/anonymous_union.rb.html +93 -0
- data/doc/examples/array_member.rb.html +79 -0
- data/doc/examples/file_io.rb.html +87 -0
- data/doc/examples/first_example.rb.html +104 -0
- data/doc/examples/get_system_info.rb.html +114 -0
- data/doc/examples/get_versionex.rb.html +97 -0
- data/doc/examples/global_memory.rb.html +102 -0
- data/doc/examples/inner_struct.rb.html +79 -0
- data/doc/examples/inner_union.rb.html +77 -0
- data/doc/examples/namespace.rb.html +80 -0
- data/doc/examples/show_processes.rb.html +95 -0
- data/doc/examples/struct_member.rb.html +128 -0
- data/doc/examples.html +42 -0
- data/doc/images/Thumbs.db +0 -0
- data/doc/images/examples.png +0 -0
- data/doc/images/excample1.png +0 -0
- data/doc/images/excample2.png +0 -0
- data/doc/images/green-point.png +0 -0
- data/doc/images/learnmore.png +0 -0
- data/doc/images/logo.png +0 -0
- data/doc/images/news.png +0 -0
- data/doc/images/point.png +0 -0
- data/doc/images/start.png +0 -0
- data/doc/images/synopsish.png +0 -0
- data/doc/index.html +149 -0
- data/doc/stylesheets/coderay.css +34 -0
- data/doc/stylesheets/ie.css +9 -0
- data/doc/stylesheets/style.css +216 -0
- data/examples/anonymous_struct.rb +43 -0
- data/examples/anonymous_union.rb +42 -0
- data/examples/array_member.rb +29 -0
- data/examples/file_io.rb +49 -0
- data/examples/first_example.rb +53 -0
- data/examples/inner_struct.rb +28 -0
- data/examples/inner_union.rb +26 -0
- data/examples/namespace.rb +29 -0
- data/examples/struct_member.rb +77 -0
- data/examples/win32/get_system_info.rb +64 -0
- data/examples/win32/get_versionex.rb +47 -0
- data/examples/win32/global_memory.rb +51 -0
- data/examples/win32/show_processes.rb +45 -0
- data/lib/cstruct.rb +523 -0
- data/lib/win32struct.rb +90 -0
- data/lib/win64struct.rb +13 -0
- metadata +109 -0
@@ -0,0 +1,128 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
3
|
+
<head profile="http://gmpg.org/xfn/11" >
|
4
|
+
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
5
|
+
<title>CStruct:Examples:Struct member</title>
|
6
|
+
<style type="text/css">
|
7
|
+
|
8
|
+
.CodeRay {
|
9
|
+
background-color: #232323;
|
10
|
+
border: 1px solid black;
|
11
|
+
font-family: 'Courier New', 'Terminal', monospace;
|
12
|
+
color: #E6E0DB;
|
13
|
+
padding: 3px 5px;
|
14
|
+
overflow: auto;
|
15
|
+
font-size: 12px;
|
16
|
+
margin: 12px 0;
|
17
|
+
}
|
18
|
+
.CodeRay pre {
|
19
|
+
margin: 0px;
|
20
|
+
padding: 0px;
|
21
|
+
}
|
22
|
+
|
23
|
+
.CodeRay .an { color:#E7BE69 }
|
24
|
+
.CodeRay .c { color:#BC9358; font-style: italic; }
|
25
|
+
.CodeRay .ch { color:#509E4F }
|
26
|
+
.CodeRay .cl { color:#FFF }
|
27
|
+
.CodeRay .co { color:#FFF }
|
28
|
+
.CodeRay .fl { color:#A4C260 }
|
29
|
+
.CodeRay .fu { color:#FFC56D }
|
30
|
+
.CodeRay .gv { color:#D0CFFE }
|
31
|
+
.CodeRay .i { color:#A4C260 }
|
32
|
+
.CodeRay .il { background:#151515 }
|
33
|
+
.CodeRay .iv { color:#D0CFFE }
|
34
|
+
.CodeRay .pp { color:#E7BE69 }
|
35
|
+
.CodeRay .r { color:#CB7832 }
|
36
|
+
.CodeRay .rx { color:#A4C260 }
|
37
|
+
.CodeRay .s { color:#A4C260 }
|
38
|
+
.CodeRay .sy { color:#6C9CBD }
|
39
|
+
.CodeRay .ta { color:#E7BE69 }
|
40
|
+
.CodeRay .pc { color:#6C9CBD }
|
41
|
+
|
42
|
+
</style>
|
43
|
+
</head>
|
44
|
+
<body>
|
45
|
+
<div style="margin-left:auto;margin-right:auto;width:800px;">
|
46
|
+
<div class="CodeRay">
|
47
|
+
<div class="code"><pre><span class="c"># CStruct Examples</span>
|
48
|
+
require <span class="s"><span class="dl">'</span><span class="k">cstruct</span><span class="dl">'</span></span>
|
49
|
+
|
50
|
+
<span class="c"># example:</span>
|
51
|
+
<span class="c"># struct Point in C\C++ (32-bit platform): </span>
|
52
|
+
<span class="c">#</span>
|
53
|
+
<span class="c"># struct Point</span>
|
54
|
+
<span class="c"># {</span>
|
55
|
+
<span class="c"># int x;</span>
|
56
|
+
<span class="c"># int y;</span>
|
57
|
+
<span class="c"># }; </span>
|
58
|
+
<span class="c">#</span>
|
59
|
+
<span class="c"># struct Line in C\C++ (32-bit platform): </span>
|
60
|
+
<span class="c">#</span>
|
61
|
+
<span class="c"># struct Line</span>
|
62
|
+
<span class="c"># {</span>
|
63
|
+
<span class="c"># Point begin_point;</span>
|
64
|
+
<span class="c"># Point end_point;</span>
|
65
|
+
<span class="c"># }; </span>
|
66
|
+
|
67
|
+
<span class="c"># struct TwoLine in C\C++ (32-bit platform): </span>
|
68
|
+
<span class="c">#</span>
|
69
|
+
<span class="c"># struct TwoLine</span>
|
70
|
+
<span class="c"># {</span>
|
71
|
+
<span class="c"># Line lines[2];</span>
|
72
|
+
<span class="c"># }; </span>
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
<span class="c"># struct Point , Line and TwoLine in Ruby: </span>
|
77
|
+
<span class="r">class</span> <span class="cl">Point</span> < <span class="co">CStruct</span>
|
78
|
+
int32<span class="sy">:x</span>
|
79
|
+
int32<span class="sy">:y</span>
|
80
|
+
<span class="r">end</span>
|
81
|
+
|
82
|
+
<span class="r">class</span> <span class="cl">Line</span> < <span class="co">CStruct</span>
|
83
|
+
<span class="co">Point</span><span class="sy">:begin_point</span>
|
84
|
+
<span class="co">Point</span><span class="sy">:end_point</span>
|
85
|
+
<span class="r">end</span>
|
86
|
+
|
87
|
+
<span class="r">class</span> <span class="cl">TwoLine</span> < <span class="co">CStruct</span>
|
88
|
+
<span class="co">Line</span><span class="sy">:lines</span>,[<span class="i">2</span>]
|
89
|
+
<span class="r">end</span>
|
90
|
+
|
91
|
+
|
92
|
+
line = <span class="co">Line</span>.new
|
93
|
+
|
94
|
+
<span class="c"># assign like as C language</span>
|
95
|
+
line.begin_point.x = <span class="i">0</span>
|
96
|
+
line.begin_point.y = <span class="i">0</span>
|
97
|
+
line.end_point.x = <span class="i">20</span>
|
98
|
+
line.end_point.y = <span class="i">30</span>
|
99
|
+
|
100
|
+
|
101
|
+
puts <span class="s"><span class="dl">"</span><span class="k">sizeof(Line) = </span><span class="il"><span class="idl">#{</span><span class="co">Line</span>.__size__<span class="idl">}</span></span><span class="dl">"</span></span> <span class="c"># "__size__" is alias of "size"</span>
|
102
|
+
puts <span class="s"><span class="dl">"</span><span class="k">line.begin_point.x = </span><span class="il"><span class="idl">#{</span>line.begin_point.x<span class="idl">}</span></span><span class="dl">"</span></span>
|
103
|
+
puts <span class="s"><span class="dl">"</span><span class="k">line.begin_point.y = </span><span class="il"><span class="idl">#{</span>line.begin_point.y<span class="idl">}</span></span><span class="dl">"</span></span>
|
104
|
+
puts <span class="s"><span class="dl">"</span><span class="k">line.end_point.x = </span><span class="il"><span class="idl">#{</span>line.end_point.x<span class="idl">}</span></span><span class="dl">"</span></span>
|
105
|
+
puts <span class="s"><span class="dl">"</span><span class="k">line.end_point.y = </span><span class="il"><span class="idl">#{</span>line.end_point.y<span class="idl">}</span></span><span class="dl">"</span></span>
|
106
|
+
|
107
|
+
two_line = <span class="co">TwoLine</span>.new
|
108
|
+
|
109
|
+
<span class="c"># assign like as C language</span>
|
110
|
+
two_line.lines[<span class="i">0</span>].begin_point.x = <span class="i">6</span>
|
111
|
+
two_line.lines[<span class="i">0</span>].begin_point.y = <span class="i">16</span>
|
112
|
+
two_line.lines[<span class="i">0</span>].end_point.x = <span class="i">26</span>
|
113
|
+
two_line.lines[<span class="i">0</span>].end_point.y = <span class="i">36</span>
|
114
|
+
|
115
|
+
two_line.lines[<span class="i">1</span>].begin_point.x = <span class="i">6</span>
|
116
|
+
two_line.lines[<span class="i">1</span>].begin_point.y = <span class="i">16</span>
|
117
|
+
two_line.lines[<span class="i">1</span>].end_point.x = <span class="i">26</span>
|
118
|
+
two_line.lines[<span class="i">1</span>].end_point.y = <span class="i">36</span>
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
</pre></div>
|
125
|
+
</div>
|
126
|
+
|
127
|
+
</div>
|
128
|
+
</body>
|
data/doc/examples.html
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
3
|
+
<head profile="http://gmpg.org/xfn/11">
|
4
|
+
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
5
|
+
<title>CStruct:Examples</title>
|
6
|
+
<link rel="stylesheet" href="stylesheets/style.css" type="text/css" media="screen" />
|
7
|
+
<link rel="stylesheet" href="stylesheets/coderay.css" type="text/css" media="screen" />
|
8
|
+
</head>
|
9
|
+
<body id="examples" onload="">
|
10
|
+
<div id ="container">
|
11
|
+
<br /> <!-- ----------new line-------------- -->
|
12
|
+
<h1>CStruct Examples</h1>
|
13
|
+
<div style="border:1px solid black;"></div>
|
14
|
+
<br /> <!-- ----------new line-------------- -->
|
15
|
+
<div id='example_menu'>
|
16
|
+
<ul class="level1">
|
17
|
+
<li><a href ="examples/first_example.rb.html" target="_blank">First sample</a></li>
|
18
|
+
<li><a href ="examples/array_member.rb.html" target="_blank">Array member</a></li>
|
19
|
+
<li><a href ="examples/struct_member.rb.html" target="_blank">Struct member</a></li>
|
20
|
+
<li><a href ="examples/inner_struct.rb.html" target="_blank">Inner struct</a></li>
|
21
|
+
<li><a href ="examples/inner_union.rb.html" target="_blank">Inner union</a></li>
|
22
|
+
<li><a href ="examples/anonymous_struct.rb.html" target="_blank">Anonymous struct</a></li>
|
23
|
+
<li><a href ="examples/anonymous_union.rb.html" target="_blank">Anonymous union</a></li>
|
24
|
+
<li><a href ="examples/file_io.rb.html" target="_blank">File IO</a></li>
|
25
|
+
<li><a href ="examples/namespace.rb.html" target="_blank">Namespace</a></li>
|
26
|
+
<li>Win32Struct</li>
|
27
|
+
</ul>
|
28
|
+
<div id='example_menu2' >
|
29
|
+
<ul class="level1" style="margin-left:30px;" target="_blank">
|
30
|
+
<li><a href ="examples/get_versionex.rb.html" target="_blank">GetVersionExA</a></li>
|
31
|
+
<li><a href ="examples/get_system_info.rb.html" target="_blank">GetSystemInfo</a></li>
|
32
|
+
<li><a href ="examples/global_memory.rb.html" target="_blank">GlobalMemoryStatus</a></li>
|
33
|
+
<li><a href ="examples/show_processes.rb.html" target="_blank">Show All Processes</a></li>
|
34
|
+
</ul>
|
35
|
+
</div>
|
36
|
+
</ul>
|
37
|
+
</div>
|
38
|
+
<br /> <!-- ----------new line-------------- -->
|
39
|
+
<div style="border:1px solid black;"></div>
|
40
|
+
Back to <a href ="index.html"><b>Home</b></a>
|
41
|
+
</div>
|
42
|
+
</body>
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/doc/images/logo.png
ADDED
Binary file
|
data/doc/images/news.png
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/doc/index.html
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
3
|
+
<head profile="http://gmpg.org/xfn/11">
|
4
|
+
<meta http-equiv="Content-Type" content="text/html" charset=UTF-8 />
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
6
|
+
<title>CStruct:Home</title>
|
7
|
+
<link rel="stylesheet" href="stylesheets/style.css" type="text/css" media="screen" />
|
8
|
+
<link rel="stylesheet" href="stylesheets/coderay.css" type="text/css" media="screen" />
|
9
|
+
<!--[if IE]>
|
10
|
+
<link rel="stylesheet" href="/stylesheets/ie.css" type="text/css" media="screen" />
|
11
|
+
<![endif]-->
|
12
|
+
</head>
|
13
|
+
|
14
|
+
<body >
|
15
|
+
<div>
|
16
|
+
<div id ="container">
|
17
|
+
<div id="logo"> </div>
|
18
|
+
|
19
|
+
<div id="menu">
|
20
|
+
<ul class="navi">
|
21
|
+
<li><a href ="index.html">Home</a></li>
|
22
|
+
<li><a href ="documents.html">Documents</a></li>
|
23
|
+
<li><a href ="examples.html">Examples</a></li>
|
24
|
+
<li><a href ="http://rubyforge.org/projects/cstruct/" target="_blank">Download</a></li>
|
25
|
+
</ul>
|
26
|
+
</div>
|
27
|
+
<div id="connent">
|
28
|
+
<p class ="blank_line"> </p>
|
29
|
+
<div>
|
30
|
+
<h2 class="bk_h2 bk_h2_news">News</h2>
|
31
|
+
<p>CStruct 1.0.0 has released!</p>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<div class ="blank_line"></div>
|
35
|
+
<div>
|
36
|
+
<h2 class ="bk_h2 bk_h2_synopsish">Synopsis</h2>
|
37
|
+
<p>
|
38
|
+
CStruct is a simulation of the C language's struct.Its main purpose is to manipulate binary-data conveniently. It can be used in:<br />
|
39
|
+
1. Binary file IO like C.<br />
|
40
|
+
2. The parameter of the OS's API.(e.g. Win32)<br />
|
41
|
+
3. Other... <br />
|
42
|
+
</p>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div class ="blank_line"></div>
|
46
|
+
<div>
|
47
|
+
<h2 class ="bk_h2 bk_h2_start">Getting Started</h2>
|
48
|
+
<div>
|
49
|
+
<h3>Install CStruct</h3>
|
50
|
+
<p>
|
51
|
+
Install CStruct is easy.
|
52
|
+
<div class="CodeRay">
|
53
|
+
<div class="code">gem install cstruct<br/></div>
|
54
|
+
</div>
|
55
|
+
</p>
|
56
|
+
</div>
|
57
|
+
|
58
|
+
<div>
|
59
|
+
<h3>Using CStruct</h3>
|
60
|
+
<p>
|
61
|
+
Let's see an example,struct <b>Point</b> in C language(32-bit platform) like this:
|
62
|
+
<div class="CodeRay">
|
63
|
+
<div class="code"><span class="r">struct</span> Point<br/>
|
64
|
+
{<br/>
|
65
|
+
<span class="pt"> int</span> x;<br/>
|
66
|
+
<span class="pt"> int</span> y;<br/>
|
67
|
+
};
|
68
|
+
</div>
|
69
|
+
</div>
|
70
|
+
How to represent struct <b>Point</b> in Ruby? You can use CStruct to do it.
|
71
|
+
<div class="CodeRay">
|
72
|
+
<div class="code"><span class="r">class</span> <span class="cl">Point</span> < <span class="co">CStruct</span><br/>
|
73
|
+
int32<span class="sy">:x</span><br/>
|
74
|
+
int32<span class="sy">:y</span><br/>
|
75
|
+
<span class="r">end</span>
|
76
|
+
</div>
|
77
|
+
</div>
|
78
|
+
Example:
|
79
|
+
<div class="CodeRay">
|
80
|
+
<div class="code">require <span class="s"><span class="dl">'</span><span class="k">cstruct</span><span class="dl">'</span></span><br/>
|
81
|
+
|
82
|
+
<span class="c"># struct Point in Ruby: </span><br/>
|
83
|
+
<span class="r">class</span> <span class="cl">Point</span> < <span class="co">CStruct</span><br/>
|
84
|
+
int32<span class="sy">:x</span><br/>
|
85
|
+
int32<span class="sy">:y</span> <br/>
|
86
|
+
<span class="r">end</span><br/>
|
87
|
+
<br/>
|
88
|
+
<span class="c"># create a Point's instance</span><br/>
|
89
|
+
point = <span class="co">Point</span>.new<br/>
|
90
|
+
<br/>
|
91
|
+
<span class="c"># assign like as C language</span><br/>
|
92
|
+
point.x = <span class="i">10</span><br/>
|
93
|
+
point.y = <span class="i">20</span><br/>
|
94
|
+
puts <span class="s">"point.x = #{point.x},point.y = #{point.y}"</span><br/>
|
95
|
+
<br/>
|
96
|
+
</div>
|
97
|
+
</div>
|
98
|
+
</p>
|
99
|
+
</div>
|
100
|
+
|
101
|
+
<div>
|
102
|
+
<h3>Using Win32Struct</h3>
|
103
|
+
<p>
|
104
|
+
like this:
|
105
|
+
<div class="CodeRay">
|
106
|
+
<div class="code"><span class="r">typedef</span> <span class="r">struct</span> _OSVERSIONINFOEXA { <br/>
|
107
|
+
DWORD dwOSVersionInfoSize;<br/>
|
108
|
+
DWORD dwMajorVersion;<br/>
|
109
|
+
DWORD dwMinorVersion;<br/>
|
110
|
+
DWORD dwBuildNumber;<br/>
|
111
|
+
DWORD dwPlatformId;<br/>
|
112
|
+
CHAR szCSDVersion[ <span class="i">128</span> ];<br/>
|
113
|
+
WORD wServicePackMajor;<br/>
|
114
|
+
WORD wReserved[<span class="i">2</span>];<br/>
|
115
|
+
} OSVERSIONINFOEXA;<br/>
|
116
|
+
</div>
|
117
|
+
</div>
|
118
|
+
in ruby:
|
119
|
+
<div class="CodeRay">
|
120
|
+
<div class="code"><span class="r">class</span> <span class="cl">OSVERSIONINFOEXA</span> < <span class="co">Win32Struct</span><br/>
|
121
|
+
<span class="co">DWORD</span> <span class="sy">:dwOSVersionInfoSize</span><br/>
|
122
|
+
<span class="co">DWORD</span> <span class="sy">:dwMajorVersion</span><br/>
|
123
|
+
<span class="co">DWORD</span> <span class="sy">:dwMinorVersion</span><br/>
|
124
|
+
<span class="co">DWORD</span> <span class="sy">:dwBuildNumber</span><br/>
|
125
|
+
<span class="co">DWORD</span> <span class="sy">:dwPlatformId</span><br/>
|
126
|
+
<span class="co">CHAR</span> <span class="sy">:szCSDVersion</span>,[ <span class="i">128</span> ]<br/>
|
127
|
+
<span class="co">WORD</span> <span class="sy">:wServicePackMajor</span><br/>
|
128
|
+
<span class="co">WORD</span> <span class="sy">:wServicePackMinor</span><br/>
|
129
|
+
<span class="co">WORD</span> <span class="sy">:wReserved</span>,[<span class="i">2</span>]<br/>
|
130
|
+
<span class="r">end</span><br/>
|
131
|
+
</div>
|
132
|
+
</div>
|
133
|
+
</p>
|
134
|
+
</div>
|
135
|
+
</div>
|
136
|
+
|
137
|
+
<div class ="blank_line"></div>
|
138
|
+
<div>
|
139
|
+
<h2 class ="bk_h2 bk_h2_learnmore">Lean More</h2>
|
140
|
+
Please see also <a href="documents.html">Documents</a> and <a href="examples.html">Examples</a>.
|
141
|
+
</div>
|
142
|
+
</div>
|
143
|
+
|
144
|
+
<div id="footer" style="height:30px">
|
145
|
+
|
146
|
+
</div>
|
147
|
+
</div>
|
148
|
+
</div>
|
149
|
+
</body>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
.CodeRay {
|
2
|
+
background-color: #232323;
|
3
|
+
border: 1px solid black;
|
4
|
+
font-family: 'Courier New', 'Terminal', monospace;
|
5
|
+
color: #E6E0DB;
|
6
|
+
padding: 3px 5px;
|
7
|
+
overflow: auto;
|
8
|
+
font-size: 12px;
|
9
|
+
margin: 2px 0;
|
10
|
+
margin-bottom:5px;
|
11
|
+
}
|
12
|
+
.CodeRay pre {
|
13
|
+
margin: 0px;
|
14
|
+
padding: 0px;
|
15
|
+
}
|
16
|
+
|
17
|
+
.CodeRay .an { color:#E7BE69 } /* html attribute */
|
18
|
+
.CodeRay .c { color:#BC9358; font-style: italic; } /* comment */
|
19
|
+
.CodeRay .ch { color:#509E4F } /* escaped character */
|
20
|
+
.CodeRay .cl { color:#FFF } /* class */
|
21
|
+
.CodeRay .co { color:#FFF } /* constant */
|
22
|
+
.CodeRay .fl { color:#A4C260 } /* float */
|
23
|
+
.CodeRay .fu { color:#FFC56D } /* function */
|
24
|
+
.CodeRay .gv { color:#D0CFFE } /* global variable */
|
25
|
+
.CodeRay .i { color:#A4C260 } /* integer */
|
26
|
+
.CodeRay .il { background:#151515 } /* inline code */
|
27
|
+
.CodeRay .iv { color:#D0CFFE } /* instance variable */
|
28
|
+
.CodeRay .pp { color:#E7BE69 } /* doctype */
|
29
|
+
.CodeRay .r { color:#CB7832 } /* keyword */
|
30
|
+
.CodeRay .rx { color:#A4C260 } /* regex */
|
31
|
+
.CodeRay .s { color:#A4C260 } /* string */
|
32
|
+
.CodeRay .sy { color:#6C9CBD } /* symbol */
|
33
|
+
.CodeRay .ta { color:#E7BE69 } /* html tag */
|
34
|
+
.CodeRay .pc { color:#6C9CBD } /* boolean */
|
@@ -0,0 +1,216 @@
|
|
1
|
+
|
2
|
+
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,blockquote,p,fieldset {
|
3
|
+
margin:0;
|
4
|
+
padding:0;
|
5
|
+
}
|
6
|
+
|
7
|
+
body {
|
8
|
+
/*background:#BEC3C6 url(../images/bg.jpg) repeat-x;*/
|
9
|
+
/*color:#000;*/
|
10
|
+
/*font-family:Verdana,"BitStream vera Sans",Tahoma,Helvetica,Sans-serif;*/
|
11
|
+
font-family:"Helvetica Neue",Helvetica,Tahoma,sans-serif;
|
12
|
+
/* font-size:12px; */
|
13
|
+
/* color:#002B59;*/
|
14
|
+
background-color:#EFEFEF;
|
15
|
+
}
|
16
|
+
table {
|
17
|
+
margin-top: 5px;
|
18
|
+
border:2px solid #002B59;
|
19
|
+
border-collapse:collapse;
|
20
|
+
}
|
21
|
+
|
22
|
+
tr.def {
|
23
|
+
padding-top: 2px;
|
24
|
+
padding-bottom: 2px;
|
25
|
+
}
|
26
|
+
tr.def td{
|
27
|
+
color:#000;
|
28
|
+
border: solid #A9B3CD;
|
29
|
+
border-width: 1px 1px 1px 1px;
|
30
|
+
width:200px;
|
31
|
+
}
|
32
|
+
tr.def th{
|
33
|
+
color:#ffffff;
|
34
|
+
background-color: #002B59;
|
35
|
+
border: solid #A9B3CD;
|
36
|
+
border-width: 1px 1px 1px 1px;
|
37
|
+
width:200px;
|
38
|
+
}
|
39
|
+
|
40
|
+
tr.code {
|
41
|
+
margin:0;
|
42
|
+
padding:0;
|
43
|
+
}
|
44
|
+
tr.code td{
|
45
|
+
color:#000;
|
46
|
+
background-color: #232323;
|
47
|
+
border: solid #A9B3CD;
|
48
|
+
border-width: 1px 1px 1px 1px;
|
49
|
+
width:200px;
|
50
|
+
}
|
51
|
+
tr.code th{
|
52
|
+
color:#ffffff;
|
53
|
+
background-color: #002B59;
|
54
|
+
border: solid #A9B3CD;
|
55
|
+
border-width: 1px 1px 1px 1px;
|
56
|
+
width:200px;
|
57
|
+
}
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
h1, h2, h3, h4, h5, h6 {
|
63
|
+
font-weight:bold;
|
64
|
+
letter-spacing:-0.05em;
|
65
|
+
/* font-family:Arial;*/
|
66
|
+
}
|
67
|
+
|
68
|
+
h1 {font-size:150%;}
|
69
|
+
h2 {font-size:130%;}
|
70
|
+
h3 {font-size:110%;}
|
71
|
+
h4 {font-size:100%;}
|
72
|
+
|
73
|
+
|
74
|
+
h3{
|
75
|
+
padding-left: 12px;
|
76
|
+
background-image: url(../images/point.png);
|
77
|
+
background-repeat: no-repeat;
|
78
|
+
background-position: left center;
|
79
|
+
}
|
80
|
+
|
81
|
+
.blank_line{
|
82
|
+
height:5px;
|
83
|
+
}
|
84
|
+
.blank_line_5px{ height:5px;}
|
85
|
+
.blank_line_4px{ height:4px;}
|
86
|
+
.blank_line_3px{ height:3px;}
|
87
|
+
.blank_line_2px{ height:2px;}
|
88
|
+
.blank_line_1px{ height:1px;}
|
89
|
+
#wrap {
|
90
|
+
background:url(../images/light.gif) center top no-repeat;
|
91
|
+
padding:20px 0;
|
92
|
+
}
|
93
|
+
#container {
|
94
|
+
margin-left: auto;
|
95
|
+
margin-right: auto;
|
96
|
+
width:800px;
|
97
|
+
}
|
98
|
+
|
99
|
+
|
100
|
+
#logo {
|
101
|
+
background:url(../images/logo.png) center no-repeat;
|
102
|
+
height:150px;
|
103
|
+
overflow:hidden;
|
104
|
+
}
|
105
|
+
|
106
|
+
#menu
|
107
|
+
{
|
108
|
+
overflow:hidden;
|
109
|
+
width:800px;
|
110
|
+
border:1px solid #486B02;
|
111
|
+
background-color: #8BD400;
|
112
|
+
}
|
113
|
+
|
114
|
+
#menu ul.navi {
|
115
|
+
margin:0;
|
116
|
+
padding:0;
|
117
|
+
list-style: none;
|
118
|
+
|
119
|
+
}
|
120
|
+
|
121
|
+
#menu ul.navi li{
|
122
|
+
display:block;
|
123
|
+
float:left ;
|
124
|
+
width:8em;
|
125
|
+
background-color: #8BD400;
|
126
|
+
}
|
127
|
+
|
128
|
+
#menu ul.navi li a{
|
129
|
+
display:block;
|
130
|
+
padding:0;
|
131
|
+
line-height:1.8em;
|
132
|
+
text-decoration: none;
|
133
|
+
color:#002B59;
|
134
|
+
font-family: 'Courier New', 'Terminal', monospace;
|
135
|
+
font-size: 20px;
|
136
|
+
font-weight:bold;
|
137
|
+
text-align: center;
|
138
|
+
}
|
139
|
+
#news h2{
|
140
|
+
padding-left: 16px;
|
141
|
+
background-image: url(../images/news.png);
|
142
|
+
background-repeat: no-repeat;
|
143
|
+
background-position: left center;
|
144
|
+
}
|
145
|
+
|
146
|
+
.bk_h2{
|
147
|
+
padding-left: 20px;
|
148
|
+
background-repeat: no-repeat;
|
149
|
+
background-position: left center;
|
150
|
+
}
|
151
|
+
|
152
|
+
.bk_h2_news{ background-image: url(../images/news.png); }
|
153
|
+
.bk_h2_synopsish{ background-image: url(../images/synopsish.png); }
|
154
|
+
.bk_h2_start{ background-image: url(../images/start.png); }
|
155
|
+
.bk_h2_learnmore{ background-image: url(../images/learnmore.png); }
|
156
|
+
.bk_h2_examples{ background-image: url(../images/examples.png); }
|
157
|
+
|
158
|
+
#example_menu
|
159
|
+
{
|
160
|
+
overflow:hidden;
|
161
|
+
width:800px;
|
162
|
+
border:1px solid #486B02;
|
163
|
+
background-color:#DBDBDB;
|
164
|
+
}
|
165
|
+
#example_menu ul.level1{
|
166
|
+
margin:0;
|
167
|
+
padding:0;
|
168
|
+
list-style: none;
|
169
|
+
}
|
170
|
+
#example_menu ul.level1 li{
|
171
|
+
margin-left:30px;
|
172
|
+
display:block;
|
173
|
+
padding-left: 12px;
|
174
|
+
background-image: url(../images/excample1.png);
|
175
|
+
background-repeat: no-repeat;
|
176
|
+
background-position: left center;
|
177
|
+
}
|
178
|
+
#example_menu ul.level1 a{
|
179
|
+
padding:0;
|
180
|
+
line-height:1.5em;
|
181
|
+
text-decoration: none;
|
182
|
+
color:#002B59;
|
183
|
+
font-family: Verdana,"BitStream vera Sans",Tahoma,Helvetica,Sans-serif;
|
184
|
+
font-size: 16px;
|
185
|
+
text-align: left;
|
186
|
+
}
|
187
|
+
|
188
|
+
#example_menu2
|
189
|
+
{
|
190
|
+
overflow:hidden;
|
191
|
+
width:800px;
|
192
|
+
}
|
193
|
+
#example_menu2 ul.level1{
|
194
|
+
margin:0;
|
195
|
+
padding:0;
|
196
|
+
list-style: none;
|
197
|
+
}
|
198
|
+
#example_menu2 ul.level1 li{
|
199
|
+
margin-left:30px;
|
200
|
+
display:block;
|
201
|
+
padding-left: 12px;
|
202
|
+
background-image: url(../images/excample2.png);
|
203
|
+
background-repeat: no-repeat;
|
204
|
+
background-position: left center;
|
205
|
+
}
|
206
|
+
|
207
|
+
#example_menu2 ul.level1 a{
|
208
|
+
padding:0;
|
209
|
+
line-height:1.5em;
|
210
|
+
text-decoration: none;
|
211
|
+
color:#002B59;
|
212
|
+
font-family: Verdana,"BitStream vera Sans",Tahoma,Helvetica,Sans-serif;
|
213
|
+
font-size: 16px;
|
214
|
+
text-align: left;
|
215
|
+
}
|
216
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# CStruct Examples
|
2
|
+
require 'cstruct'
|
3
|
+
|
4
|
+
# example:
|
5
|
+
# struct Window in C\C++ (32-bit platform):
|
6
|
+
#
|
7
|
+
# struct Window
|
8
|
+
# {
|
9
|
+
# int style;
|
10
|
+
# struct{
|
11
|
+
# int x;
|
12
|
+
# int y;
|
13
|
+
# }position; /* position is anonymous struct's instance */
|
14
|
+
# };
|
15
|
+
|
16
|
+
|
17
|
+
# struct Window in Ruby:
|
18
|
+
class Window < CStruct
|
19
|
+
int32:style
|
20
|
+
struct :position do
|
21
|
+
int32:x
|
22
|
+
int32:y
|
23
|
+
end
|
24
|
+
end
|
25
|
+
# or like this (use brace):
|
26
|
+
# class Window < CStruct
|
27
|
+
# int32:style
|
28
|
+
# struct (:position) {
|
29
|
+
# int32:x
|
30
|
+
# int32:y
|
31
|
+
# }
|
32
|
+
# end
|
33
|
+
|
34
|
+
# create a Window's instance
|
35
|
+
window = Window.new
|
36
|
+
|
37
|
+
# assign like as C language
|
38
|
+
window.style = 1
|
39
|
+
window.position.x = 10
|
40
|
+
window.position.y = 10
|
41
|
+
|
42
|
+
puts "sizeof(Window) = #{Window.__size__}" # "__size__" is alias of "size"
|
43
|
+
puts "window.style = #{window.style},window.position.x = #{window.position.x},window.position.y = #{window.position.y}"
|