(part1b) Han from China teaches you C



HeY KiDz!

Another week, another part of Han's award-winning C/C++ tutorial. After
last week's slightly unix centered material, this time we'll develop a
truly multi-platform "Hello World" type program.


PART1b: Hello, World, 1b
========================

During the course of this lesson you'll learn a bunch of stuff.


1b.1 Preparations
-----------------

In order too compile this weeks code, you'll need the GLUT library. On
most modern operating systems, this library is already part of your OS
installation medium, so just install it now (be sure to install
development packages as well). We'll be using only basic features,
so freeglut will do too.
Windows users can get GLUT at <http://www.xmission.com/~nate/glut/>.
Gentoo users can bite my shiny metal ass.


1b.1.1 Special note for lcc-win32 users
---------------------------------------

Unfortunately, the GLUT32.LIB import library shipped with lcc-win32 is
very old and more than one decade out of date. To remedy the situation,
first make backup copies of GLUT32.LIB and GLUT32.EXP. Next, at the end
of GLUT32.EXP, add these three lines:

___glutInitWithExit@12
___glutCreateWindowWithExit@8
___glutCreateMenuWithExit@8

Use the BUILDLIB.EXE utility and regenerate GLUT32.LIB. Done.


1b.2 Excercises
---------------

None this week, just be sure to familarize yourselves with the the code
and understand it completly before continuing with the next lesson
(we'll be using most of the code again in the lesson about stacks).
As always, you can ask any questions where the C experts hang out,
in comp.lang.c.


1b.3 The Program
----------------

/* hello1b.c */
/* link with -lglut -lGLU -lGL */

#ifndef __APPLE__
#include <GL/glut.h>
#else
#include <GLUT/glut.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <math.h>

#ifdef __GNUC__
#define UU __attribute__((__unused__))
#else
#define UU
#endif

static struct {
int width, height;
int flist, mlist, slist;
int num;
float board_size;
float base_len, base_wid, base_hgt;
float pole_rad, pole_hgt, pole_ofs;
float disk_hgt;
unsigned int tn[4];
int state;
} g;

#undef M_PI
#undef M_PI_2
#define M_PI (3.14159265358979323846f)
#define M_PI_2 (1.57079632679489661923f)
#define BASE_LENGTH 30.0f
#define BOARD_SQUARES 8
#define NUM 9

static float col_black[] = { 0.0, 0.0, 0.0, 1.0 };
static float col_white[] = { 1.0, 1.0, 1.0, 1.0 };
static float col_yellow[]= { 1.0, 1.0, 0.0, 1.0 };
static float col_base[] = { 0.34, 0.34, 0.48, 1.0 };
static float col_pole[] = { 0.545, 0.137, 0.137, 1.0 };

static float l0_pos[] = { 50.0, 50.0, 50.0, 0.0 };
static float l0_amb[] = { 0.0, 0.0, 0.0, 1.0 };
static float l0_dif[] = { 1.0, 1.0, 1.0, 1.0 };
static float l0_spc[] = { 0.0, 1.0, 1.0, 1.0 };
static float l1_pos[] = { -50.0, 50.0, -50.0, 0.0 };
static float l1_amb[] = { 0.0, 0.0, 0.0, 1.0 };
static float l1_dif[] = { 1.0, 1.0, 1.0, 1.0 };
static float l1_spc[] = { 1.0, 1.0, 1.0, 1.0 };

extern unsigned char t0_bits[], t1_bits[], t2_bits[], t3_bits[];

static void draw_tube(float bottom_radius, float top_radius,
float bottom_thickness, float top_thickness,
float height, unsigned int n_slices,
unsigned int n_loops)
{
float y;
float *cos_cache = (float *)malloc(n_slices * sizeof (float));
float *sin_cache = (float *)malloc(n_slices * sizeof (float));
int slice, last_slice = n_slices - 1;
unsigned int loop;
float radius, inner_radius, max_radius;

if(bottom_thickness > bottom_radius)
bottom_thickness = bottom_radius;
if(top_thickness > top_radius)
top_thickness = top_radius;
if(bottom_thickness < 0)
bottom_thickness = 0;
if(top_thickness < 0)
top_thickness = 0;
if(top_radius >= bottom_radius)
max_radius = top_radius;
else
max_radius = bottom_radius;

y = 0;
radius = bottom_radius;
inner_radius = bottom_radius - bottom_thickness;
glBegin(GL_QUAD_STRIP);
glNormal3f(0.0, -1.0, 0.0);
glVertex3f(0.0, y, inner_radius);
glVertex3f(0.0, y, radius);
for(slice = last_slice; slice >= 0; slice--) {
float theta = 2.0f * M_PI * (float)slice / n_slices;
cos_cache[slice] = cos(theta);
sin_cache[slice] = sin(theta);
glVertex3f(inner_radius * sin_cache[slice],
y,
inner_radius * cos_cache[slice]);
glVertex3f(radius * sin_cache[slice],
y,
radius * cos_cache[slice]);
}
glEnd();

for(loop = 0; loop < n_loops; loop++) {
float lower_radius = bottom_radius + (top_radius - bottom_radius)
* (float)loop / n_loops;
float upper_radius = bottom_radius + (top_radius - bottom_radius)
* (float)(loop+1) / n_loops;
float lower_y = height * (float)loop / n_loops;
float upper_y = height * (float)(loop+1) / n_loops;
float factor = (top_radius - top_thickness)
- (bottom_radius - bottom_thickness);
glBegin(GL_QUAD_STRIP);
for(slice = 0; slice < (int)n_slices; slice++) {
glNormal3f(sin_cache[slice], 0.0, cos_cache[slice]);
glVertex3f(upper_radius * sin_cache[slice],
upper_y,
upper_radius * cos_cache[slice]);
glVertex3f(lower_radius * sin_cache[slice],
lower_y,
lower_radius * cos_cache[slice]);
}
glNormal3f(0.0, 0.0, 1.0);
glVertex3f(0.0, upper_y, upper_radius);
glVertex3f(0.0, lower_y, lower_radius);
glEnd();

lower_radius = bottom_radius - bottom_thickness
+ factor * (float)loop / n_loops;
upper_radius = bottom_radius - bottom_thickness
+ factor * (float)(loop+1) / n_loops;
glBegin(GL_QUAD_STRIP);
glNormal3f(0.0, 0.0, -1.0);
glVertex3f(0.0, upper_y, upper_radius);
glVertex3f(0.0, lower_y, lower_radius);
for(slice = last_slice; slice >= 0; slice--) {
glNormal3f(-sin_cache[slice], 0.0, -cos_cache[slice]);
glVertex3f(upper_radius * sin_cache[slice],
upper_y,
upper_radius * cos_cache[slice]);
glVertex3f(lower_radius * sin_cache[slice],
lower_y,
lower_radius * cos_cache[slice]);
}
glEnd();
}
y = height;
radius = top_radius;
inner_radius = top_radius - top_thickness;
glBegin(GL_QUAD_STRIP);
glNormal3f(0.0, 1.0, 0.0);
for(slice = 0; slice < (int)n_slices; slice++) {
glVertex3f(inner_radius * sin_cache[slice],
y,
inner_radius * cos_cache[slice]);
glVertex3f(radius * sin_cache[slice],
y,
radius * cos_cache[slice]);
}
glVertex3f(0.0, y, inner_radius);
glVertex3f(0.0, y, radius);
glEnd();
free(sin_cache);
free(cos_cache);
}

static void draw_pole(float r, float h)
{
draw_tube(r, r, r, r, h, 32, 1);
}

static void draw_disk(float ri, float ro, float h)
{
draw_tube(ro, ro, ro - ri, ro - ri, h, 32, 1);
}

static void draw_cuboid(float l, float w, float h)
{
float xmax = l / 2.0f, xmin = -xmax;
float zmax = w / 2.0f, zmin = -zmax;
float ymax = h, ymin = 0;
glBegin(GL_QUADS);
glNormal3f(0.0, 0.0, 1.0);
glVertex3f(xmin, ymin, zmax); glVertex3f(xmax, ymin, zmax);
glVertex3f(xmax, ymax, zmax); glVertex3f(xmin, ymax, zmax);
glNormal3f(-1.0, 0.0, 0.0);
glVertex3f(xmax, ymin, zmax); glVertex3f(xmax, ymin, zmin);
glVertex3f(xmax, ymax, zmin); glVertex3f(xmax, ymax, zmax);
glNormal3f(0.0, 0.0, -1.0);
glVertex3f(xmax, ymin, zmin); glVertex3f(xmin, ymin, zmin);
glVertex3f(xmin, ymax, zmin); glVertex3f(xmax, ymax, zmin);
glNormal3f(1.0, 0.0, 0.1);
glVertex3f(xmin, ymin, zmin); glVertex3f(xmin, ymin, zmax);
glVertex3f(xmin, ymax, zmax); glVertex3f(xmin, ymax, zmin);
glNormal3f(0.0, 1.0, 0.0);
glVertex3f(xmin, ymax, zmax); glVertex3f(xmax, ymax, zmax);
glVertex3f(xmax, ymax, zmin); glVertex3f(xmin, ymax, zmin);
glNormal3f(0.0, -1.0, 0.0);
glVertex3f(xmin, ymin, zmin); glVertex3f(xmax, ymin, zmin);
glVertex3f(xmax, ymin, zmax); glVertex3f(xmin, ymin, zmax);
glEnd();
}

static void draw_sphere(int stacks, int slices)
{
int i, j;
float theta1, theta2, theta3;
float e[3], p[3], c[3] = { 0 };
float r = 1.0;
int stacks2 = stacks + stacks;
glPushAttrib(GL_POLYGON_BIT);
glFrontFace(GL_CW);
for(j = 0; j < stacks; j++) {
theta1 = j * (M_PI + M_PI) / stacks2 - M_PI_2;
theta2 = (j + 1) * (M_PI + M_PI) / stacks2 - M_PI_2;
glBegin(GL_TRIANGLE_STRIP);
for(i = 0; i <= slices; i++) {
theta3 = i * (M_PI + M_PI) / slices;
e[0] = cos(theta2) * cos(theta3);
e[1] = sin(theta2);
e[2] = cos(theta2) * sin(theta3);
p[0] = c[0] + r * e[0];
p[1] = c[1] + r * e[1];
p[2] = c[2] + r * e[2];
glTexCoord2f(1.0f - ((float)i / slices), 1.0f - ((float)(j+1) / stacks));
glNormal3fv(e);
glVertex3fv(p);
e[0] = cos(theta1) * cos(theta3);
e[1] = sin(theta1);
e[2] = cos(theta1) * sin(theta3);
p[0] = c[0] + r * e[0];
p[1] = c[1] + r * e[1];
p[2] = c[2] + r * e[2];
glTexCoord2f(1.0f - ((float)i / slices), 1.0f - ((float)j / stacks));
glNormal3fv(e);
glVertex3fv(p);
}
glEnd();
}
glPopAttrib();
}

static void hsv_to_rgbf(float h, float s, float v, float *r, float *g, float *b)
{
if(s == 0.0f) {
*r = *g = *b = v;
}
else {
float i, f, p, q, t;
if(h >= 360.0f)
h = 0.0f;
h /= 60.0f;
i = floor(h);
f = h - i;
p = v * (1.0f - s);
q = v * (1.0f - (s * f));
t = v * (1.0f - (s * (1.0f - f)));
switch((int)i) {
case 0:
*r = v; *g = t; *b = p; break;
case 1:
*r = q; *g = v; *b = p; break;
case 2:
*r = p; *g = v; *b = t; break;
case 3:
*r = p; *g = q; *b = v; break;
case 4:
*r = t; *g = p; *b = v; break;
case 5:
*r = v; *g = p; *b = q; break;
}}
}

static void hsv_to_rgbfv(float *hsv, float *rgb)
{
hsv_to_rgbf(hsv[0], hsv[1], hsv[2], &rgb[0], &rgb[1], &rgb[2]);
}

static float cfunc(float x)
{
float r;
if(x < 2.0f / 7.0f)
r = (1.0f / 12.0f) / (1.0f / 7.0f) * x;
else if(x < 3.0f / 7.0f)
r = (1.0f + 1.0f / 6.0f) * x - 1.0f / 6.0f;
else if(x < 4.0f / 7.0f)
r = (2.0f + 1.0f / 3.0f) * x - 2.0f / 3.0f;
else if(x < 5.0f / 7.0f)
r = (1.0f / 12.0f) / (1.0f / 7.0f) * x + 1.0f / 3.0f;
else
r = (1.0f / 12.0f) / (1.0f / 7.0f) * x + 1.0f / 3.0f;
return r;
}

static void mktx(unsigned char *b, int w, int h, unsigned int tx)
{
int i, j, k;
unsigned char c, *pix = (unsigned char *)malloc(w * h * 4), *p = pix;

for(i = 0; i < h; i++) {
for(j = 0; j < w/8; j++) {
c = *b++;
for(k = 0; k < 8; k++) {
if(c & 1) {
*p++ = 0x00; *p++ = 0x00; *p++ = 0x00; *p++ = 0xFF;
}
else {
*p++ = 0xFF; *p++ = 0xFF; *p++ = 0xFF; *p++ = 0xFF;
}
c >>= 1;
}}}

glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glBindTexture(GL_TEXTURE_2D, tx);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA,
GL_UNSIGNED_BYTE, pix);
glBindTexture(GL_TEXTURE_2D, 0);
free(pix);
}

static void set_material(float *col, float *spc, int shn)
{
glColor3fv(col);
glMaterialfv(GL_FRONT, GL_SPECULAR, spc);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, col);
glMateriali(GL_FRONT, GL_SHININESS, shn);
}

static float get_disk_radius(int i)
{
return (3.0f + i) * g.pole_rad;
}

static void get_disk_color(int i, float *color)
{
color[0] = cfunc((float)i / g.num) * 360.0f;
color[1] = 1.0f;
color[2] = 1.0f;
hsv_to_rgbfv(color, color);
}

static void draw_disk_n(int n)
{
float col[3];
get_disk_color(n, col);
set_material(col, col_white, 100);
draw_disk(g.pole_rad, get_disk_radius(n), g.disk_hgt);
}

static void init_func(void)
{
int i, j;
float tile_size, x0, x1, y0, y1, z0, z1;

g.num = NUM;
g.base_len = BASE_LENGTH;
g.pole_rad = g.base_len / (2.0f * (7.0f + 3.0f * g.num));
g.base_wid = get_disk_radius(g.num) * 2.0f;
g.pole_ofs = get_disk_radius(g.num-1) * 2.0f;
g.disk_hgt = g.pole_rad * 2;
g.base_hgt = g.pole_rad * 2;
g.pole_hgt = g.num * g.disk_hgt + g.pole_rad;
g.board_size = g.base_len * 0.5f * (1.0f + sqrt(5.0f));
g.state = 350;
tile_size = g.board_size / BOARD_SQUARES;
srand(time(NULL));

glGenTextures(4, g.tn);
mktx(t0_bits, 64, 64, g.tn[0]);
mktx(t1_bits, 64, 64, g.tn[1]);
mktx(t2_bits, 64, 64, g.tn[2]);
mktx(t3_bits, 64, 64, g.tn[3]);

g.flist = glGenLists(1);
glNewList(g.flist, GL_COMPILE);
x0 = -g.board_size / 2;
glNormal3f(0.0, 1.0, 0.0);
for(i = 0; i < BOARD_SQUARES; i++, x0 += tile_size) {
x1 = x0 + tile_size;
z0 = -g.board_size / 2;
for(j = 0; j < BOARD_SQUARES; j++, z0 += tile_size) {
int magic = i == 5 && j == 6;
set_material((i + j) & 1 ? col_white : col_black, col_white, 100);
z1 = z0 + tile_size;
if(magic)
glBindTexture(GL_TEXTURE_2D, g.tn[3]);
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0); glVertex3f(x0, 0.0, z0);
glTexCoord2f(0.0, 1.0); glVertex3f(x0, 0.0, z1);
glTexCoord2f(1.0, 1.0); glVertex3f(x1, 0.0, z1);
glTexCoord2f(1.0, 0.0); glVertex3f(x1, 0.0, z0);
glEnd();
if(magic)
glBindTexture(GL_TEXTURE_2D, 0);
}}
set_material(col_base, col_white, 50);
draw_cuboid(g.base_len, g.base_wid, g.base_hgt);
set_material(col_pole, col_white, 50);
glPushMatrix();
glTranslatef(0.0, g.base_hgt, 0.0);
draw_pole(g.pole_rad, g.pole_hgt);
glPopMatrix();
glPushMatrix();
glTranslatef(-g.pole_ofs, g.base_hgt+g.pole_rad, 0.0);
glRotatef(90, 1, 0, 1);
draw_pole(g.pole_rad, g.pole_hgt);
glPopMatrix();
glPushMatrix();
glTranslatef(g.pole_ofs, g.base_hgt, 0.0);
glRotatef(15, 0, 0, 1);
draw_pole(g.pole_rad, g.pole_hgt);
glPopMatrix();
glPushMatrix();
glTranslatef(0.0, g.base_hgt+g.pole_hgt-g.pole_rad, g.pole_rad);
glRotatef(60.0, 1,0,0);
draw_pole(g.pole_rad / 5, g.pole_rad*2);
glPopMatrix();
glPushMatrix();
glTranslatef(0, g.base_hgt, 0);
draw_disk_n(3);
glPopMatrix();
glPushMatrix();
glTranslatef(g.pole_ofs/2*1.4f, 0, g.base_wid*1.2f);
draw_disk_n(1);
glPopMatrix();
glEndList();

g.slist = glGenLists(1);
glNewList(g.slist, GL_COMPILE);
x0 = -g.pole_hgt/2; x1 = -x0;
y0 = g.base_hgt + g.pole_hgt - g.pole_rad/2; y1 = y0 - g.pole_hgt/3;
z0 = g.pole_rad;
set_material(col_white, col_white, 128);
glBegin(GL_QUADS);
glNormal3f(0.0, 0.0, 1.0);
glTexCoord2f(0.0, 0.0); glVertex3f(x0, y0, z0);
glTexCoord2f(0.0, 1.0); glVertex3f(x0, y1, z0);
glTexCoord2f(1.0, 1.0); glVertex3f(x1, y1, z0);
glTexCoord2f(1.0, 0.0); glVertex3f(x1, y0, z0);
glEnd();
glEndList();

g.mlist = glGenLists(1);
glNewList(g.mlist, GL_COMPILE);
draw_sphere(10, 10);
glEndList();

glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
glEnable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_LIGHT1);
glEnable(GL_TEXTURE_2D);
glLightfv(GL_LIGHT0, GL_POSITION, l0_pos);
glLightfv(GL_LIGHT0, GL_AMBIENT, l0_amb);
glLightfv(GL_LIGHT0, GL_DIFFUSE, l0_dif);
glLightfv(GL_LIGHT0, GL_SPECULAR, l0_spc);
glLightfv(GL_LIGHT1, GL_POSITION, l1_pos);
glLightfv(GL_LIGHT1, GL_AMBIENT, l1_amb);
glLightfv(GL_LIGHT1, GL_DIFFUSE, l1_dif);
glLightfv(GL_LIGHT1, GL_SPECULAR, l1_spc);
}

static void exit_func(void)
{
/* this function intentionally left blank */
}

static float frand(float max)
{
return (float)rand() / RAND_MAX * max;
}

static void timer_func(UU int value)
{
static int ticks = 200;
int state = g.state;

if(state == 350) {
if(++ticks == 250) {
ticks = 0;
state--;
}}
else {
state--;
if(state == 350) {
float f = frand(100);
if(f > 12.5f && f < 87.5f)
state--;
}}
if(state < 0)
state = 359;
if(state != g.state) {
g.state = state;
glutPostRedisplay();
}
glutTimerFunc(1000 / 25, timer_func, 1);
}

static void display_func(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glPushMatrix();
gluLookAt(0.0, 15.0, 50.0,
0.0, 0.0, 0.0,
0.0, 1.0, 0.0);

glCallList(g.flist);

glBindTexture(GL_TEXTURE_2D, g.tn[0]);
glCallList(g.slist);
glBindTexture(GL_TEXTURE_2D, 0);

glPushMatrix();
glTranslatef(-g.pole_ofs*2, g.pole_hgt, -g.base_len*2);
glScalef(3,3,3);
glRotatef(g.state, 0, 1, 0);
set_material(col_yellow, col_white, 100);
glBindTexture(GL_TEXTURE_2D, g.state != 350 ? g.tn[1] : g.tn[2]);
glCallList(g.mlist);
glBindTexture(GL_TEXTURE_2D, 0);
glPopMatrix();

glPopMatrix();
glutSwapBuffers();
}

static void reshape_func(int w, int h)
{
g.width = w;
g.height = h;
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(30.0, (double)w / (double)h, 1.0, 500.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}

static void keyboard_func(unsigned char key, UU int x, UU int y)
{
switch(key) {
case 'q':
case 'Q':
case 27:
exit(EXIT_SUCCESS);
break;
}
}

static void special_func(UU int key, UU int x, UU int y)
{
/* this function intentionally left blank */
}

int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize(640, 480);
glutCreateWindow("Hello-1B");
atexit(exit_func);
init_func();
glutDisplayFunc(display_func);
glutReshapeFunc(reshape_func);
glutKeyboardFunc(keyboard_func);
glutSpecialFunc(special_func);
glutTimerFunc(20, timer_func, 1);
glutMainLoop();
return 0;
}

/* DATA */
unsigned char t0_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3e, 0x40, 0x04, 0x00, 0x00, 0x3c, 0x00, 0x00,
0x7e, 0xc0, 0x06, 0x00, 0x00, 0x42, 0x00, 0x00, 0xe6, 0x40, 0x05, 0x00,
0x00, 0x42, 0x00, 0x00, 0xc2, 0x5f, 0x64, 0xcc, 0x01, 0x42, 0x00, 0x00,
0x80, 0x5f, 0x94, 0x52, 0x02, 0x42, 0x00, 0x00, 0x00, 0x40, 0x94, 0x52,
0x02, 0x42, 0x00, 0x00, 0x00, 0x40, 0x94, 0x52, 0x02, 0x42, 0x00, 0x00,
0x00, 0x40, 0x64, 0x4c, 0x02, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xc3, 0x07, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x42, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x42, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0x42, 0x08, 0x01,
0x00, 0x00, 0x00, 0x00, 0x10, 0x42, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00,
0x10, 0x42, 0x08, 0x01, 0x00, 0x00, 0x00, 0x80, 0x17, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x40, 0x18, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40,
0x10, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x10, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x40, 0x10, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40,
0x10, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x10, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x42, 0x80, 0x02, 0x10, 0x11, 0x00, 0x04, 0x55, 0x42, 0x80, 0x02, 0x10,
0x11, 0x00, 0x04, 0x55, 0x42, 0x80, 0x02, 0x10, 0x11, 0x00, 0x04, 0x55,
0x42, 0x80, 0x02, 0x10, 0x11, 0x00, 0x04, 0x55, 0x42, 0x9e, 0x72, 0x10,
0x91, 0xd3, 0xe4, 0x55, 0x7e, 0xa1, 0x8a, 0x10, 0x51, 0x34, 0x15, 0x55,
0x42, 0xa1, 0x8a, 0xa0, 0x4a, 0x14, 0x14, 0x55, 0x42, 0xbf, 0x8a, 0xa0,
0x4a, 0x14, 0x14, 0x55, 0x42, 0x81, 0x8a, 0xa0, 0x4a, 0x14, 0x14, 0x55,
0x42, 0x81, 0x8a, 0xa0, 0x4a, 0x14, 0x14, 0x55, 0x42, 0xa1, 0x8a, 0xa6,
0x4a, 0x14, 0x14, 0x01, 0x42, 0x9e, 0x72, 0x46, 0x84, 0x13, 0xe4, 0x55,
0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
unsigned char t1_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x05, 0x05, 0x2a, 0x80, 0x28, 0x00, 0x00, 0x00,
0x05, 0x05, 0x2a, 0x80, 0x28, 0x00, 0x00, 0x00, 0x05, 0x05, 0x2a, 0x80,
0x28, 0x00, 0x00, 0x00, 0x25, 0x25, 0x2a, 0x99, 0x2c, 0x00, 0x00, 0x00,
0x57, 0x55, 0xaa, 0xaa, 0x2a, 0x00, 0x00, 0x00, 0x55, 0x55, 0xaa, 0x8a,
0x2a, 0x00, 0x00, 0x00, 0x35, 0x55, 0x94, 0x8a, 0x2a, 0x00, 0x00, 0x00,
0x15, 0x55, 0x94, 0x8a, 0x2a, 0x00, 0x00, 0x00, 0x55, 0x55, 0x95, 0x8a,
0x0a, 0x00, 0x00, 0x00, 0x25, 0x25, 0x15, 0x89, 0x2c, 0x00, 0x00, 0x00,
0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
unsigned char t2_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x92, 0x8c, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x52, 0x4a,
0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x52, 0x4a, 0x00, 0x00, 0x00, 0x80,
0x01, 0x82, 0x52, 0x4a, 0x00, 0x00, 0x00, 0x80, 0x01, 0x82, 0x52, 0x4a,
0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x52, 0x4a, 0x00, 0x00, 0x00, 0x00,
0x00, 0x82, 0x52, 0x4a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x8c, 0x49,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
unsigned char t3_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x40, 0x08,
0xe3, 0x41, 0x30, 0x3c, 0x00, 0x00, 0x40, 0x88, 0x14, 0x42, 0x48, 0x42,
0x00, 0x00, 0x40, 0x88, 0x10, 0x20, 0x84, 0x42, 0x00, 0x00, 0x40, 0x88,
0x10, 0x00, 0x84, 0x42, 0x00, 0x00, 0xc0, 0xef, 0x13, 0x00, 0x84, 0x62,
0x00, 0x3e, 0x5f, 0x88, 0x10, 0x00, 0x84, 0x5c, 0x00, 0x00, 0x40, 0x88,
0x10, 0x00, 0x84, 0x40, 0x00, 0x00, 0x40, 0x88, 0x10, 0x00, 0x84, 0x42,
0x00, 0x00, 0x40, 0x88, 0x10, 0x02, 0x48, 0x22, 0x00, 0x00, 0x40, 0x88,
0xe0, 0x01, 0x30, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

Have fun!

Yours,
Han from China

--
"Entropy isn't what it used to be."

.



Relevant Pages

  • generics problem
    ... static void Main ... return tRet; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: C S-function with pointers
    ... void SmoothIn(int, float, float, int, float, float, float, ... when I am writing C S-function it does compile but when I ... static void mdlOutputs ... void SmoothIn(int ENABLE_, float Y1_, float Y2_, int ...
    (comp.soft-sys.matlab)
  • [PATCH] epca.c: reformat comments and coding style improvements
    ... static int nbdevs, num_cards, liloconfig; ... This structure is NOT used to overlay the cards physical channel ... static void memwinoff ... static struct channel *verifyChannel ...
    (Linux-Kernel)
  • [PATCH 2/7] dlm: communication
    ... +static struct task_struct *recv_task; ... +static int nodeid_to_addr(int nodeid, struct sockaddr *retaddr) ... +static void lowcomms_data_ready ...
    (Linux-Kernel)
  • [PATCH] Fixed warnings from -Wmissing-prototypes in HOSTCFLAGS
    ... +static int get_family_id ... +static void print_cgroupstats ... -void cfag12864b_set(unsigned char x, unsigned char y) ... +static void slab_validate(struct slabinfo *s) ...
    (Linux-Kernel)

Quantcast