upFRONT

The Embedded Linux Consortium and more.
Listing. Making Raster Bars, raster.c
// gcc -Wall -O2 raster.c -lvgagl -lvga -lm
#include <vga.h>
#include <vgagl.h>
#include <math.h> /* sines! */
#include <stdlib.h> /* malloc */
#define GMODE G320x200x256
GraphicsContext *virtualscreen;
GraphicsContext *physicalscreen;
{
  char *redbox, *orangebox, *yellowbox;
  char *greenbox, *bluebox, *purplebox;
  char c, d; /* to keep track of color */
  short int x; /* a counter for our sine */
  vga_init(); /* start svgalib */
  gl_enableclipping(); /* just in case */
  vga_setmode(GMODE); /* set mode */
  gl_setcontextvga(GMODE);
  physicalscreen = gl_allocatecontext();
  gl_getcontext(physicalscreen);
  gl_setcontextvgavirtual(GMODE);
  virtualscreen = gl_allocatecontext();
  gl_getcontext(virtualscreen);
  /* Allocate the memory for our bars! */
  redbox = malloc(WIDTH*17*BYTESPERPIXEL);
  orangebox = malloc(WIDTH*17*BYTESPERPIXEL);
  yellowbox = malloc(WIDTH*17*BYTESPERPIXEL);
  greenbox = malloc(WIDTH*17*BYTESPERPIXEL);
  bluebox = malloc(WIDTH*17*BYTESPERPIXEL);
  purplebox = malloc(WIDTH*17*BYTESPERPIXEL);
  /* set up the palette! */
  c=0; /* red */
  for (d=1; d<10; d++)
    gl_setpalettecolor(191+c*9+d,
                       7*d, 0, 0);
  c=1; /* orange */
  for (d=1; d<10; d++)
    gl_setpalettecolor(191+c*9+d,
                       7*d, 3.5*d, 0);
  c=2; /* yellow */
  for (d=1; d<10; d++)
    gl_setpalettecolor(191+c*9+d,
                       7*d, 7*d, 0);
  c=3; /* green */
  for (d=1; d<10; d++)
    gl_setpalettecolor(191+c*9+d,
                       0, 7*d, 0);
  c=4; /* blue */
  for (d=1; d<10; d++)
    gl_setpalettecolor(191+c*9+d,
                       0, 0, 7*d);
  c=5; /* purple */
  for (d=1; d<10; d++)
    gl_setpalettecolor(191+c*9+d,
                       7*d, 0, 7*d);
  /* Now is when we draw the bars! */
  for (d=0; d<9; d++) {
    gl_hline(0,d,WIDTH-1,192+d);
    gl_hline(0,16-d,WIDTH-1,192+d);
    gl_hline(0,17+d,WIDTH-1,201+d);
    gl_hline(0,33-d,WIDTH-1,201+d);
    gl_hline(0,34+d,WIDTH-1,210+d);
    gl_hline(0,50-d,WIDTH-1,210+d);
    gl_hline(0,51+d,WIDTH-1,219+d);
    gl_hline(0,67-d,WIDTH-1,219+d);
    gl_hline(0,68+d,WIDTH-1,228+d);
    gl_hline(0,84-d,WIDTH-1,228+d);
    gl_hline(0,85+d,WIDTH-1,237+d);
    gl_hline(0,101-d,WIDTH-1,237+d);
  }
  /* copy the bars to our arrays */
  gl_getbox(0,0,WIDTH,17,redbox);
  gl_getbox(0,16,WIDTH,17,orangebox);
  gl_getbox(0,34,WIDTH,17,yellowbox);
  gl_getbox(0,51,WIDTH,17,greenbox);
  gl_getbox(0,68,WIDTH,17,bluebox);
  gl_getbox(0,85,WIDTH,17,purplebox);
  /* the main loop. This severely and
   * inefficiently burns CPU but we're
   * feeling sadistic on the chip today.
   * 12 raster bars is a lot, so comment
   * out a few if your computer grinds
   * to disastrous effect.
   */
  for (x=d=0; d==0; d=vga_getkey()) {
    x++;
    gl_putbox(0,40*sin((x+0)/24.0)+40,
              WIDTH, 17, purplebox);
    gl_putbox(0,40*sin((x+10)/24.0)+40,
              WIDTH, 17, bluebox);
    gl_putbox(0,40*sin((x+20)/24.0)+40,
              WIDTH, 17, greenbox);
    gl_putbox(0,40*sin((x+30)/24.0)+40,
              WIDTH, 17, yellowbox);
    gl_putbox(0,40*sin((x+40)/24.0)+40,
              WIDTH, 17, orangebox);
    gl_putbox(0,40*sin((x+50)/24.0)+40,
              WIDTH, 17, redbox);
    gl_putbox(0,-40*sin((x+0)/24.0)+144,
              WIDTH, 17, purplebox);
    gl_putbox(0,-40*sin((x+10)/24.0)+144,
              WIDTH, 17, bluebox);
    gl_putbox(0,-40*sin((x+20)/24.0)+144,
              WIDTH, 17, greenbox);
    gl_putbox(0,-40*sin((x+30)/24.0)+144,
              WIDTH, 17, yellowbox);
    gl_putbox(0,-40*sin((x+40)/24.0)+144,
              WIDTH, 17, orangebox);
    gl_putbox(0,-40*sin((x+50)/24.0)+144,
              WIDTH, 17, redbox);
    gl_copyscreen(physicalscreen);
    gl_clearscreen(0);
    vga_waitretrace();
  }
  return 0; /* it's almost a tradition! */
}
STRICTLY ON-LINE, http://www.linuxjournal.com/

Installing Window Maker by Michael Hammel is a tutorial on the basics of getting started with the Window Maker window manager. It is an excellent companion to the third part of his “Artists' Guide to the Desktop, Part 3” in this issue.

Data and Telecommunications: Systems and Applications is a book review by Derek Vadala.

______________________

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState