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.

______________________

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix