-void DrawResistor(Resistor *);
-void DrawDiode(Diode *);
-void DrawTransistor(Transistor *);
-void DrawLED(LED *);
-void DrawIC(IC *);
-void DrawCapacitor(Capacitor *);
-void DrawDisp(Disp *);
-void DrawFuse(Fuse *);
-void DrawRCA(RCA *);
-void DrawThreeFive(ThreeFive *);
-void DrawSwitch(Switch *);
-
-void freetexture(GLuint);
-void reorder(Component *[]);
-void circle(float, int,int);
-void bandedCylinder(float, float , GLfloat, GLfloat , GLfloat, Band **, int);
-TexNum *fonttexturealloc(const char *, float *, float *);
-void Rect(GLfloat , GLfloat , GLfloat, GLfloat , GLfloat ,GLfloat);
-void ICLeg(GLfloat, GLfloat, GLfloat, int);
-void HoledRectangle(GLfloat, GLfloat, GLfloat, GLfloat, int);
-Resistor *NewResistor(void);
-Diode *NewDiode(void);
-Transistor *NewTransistor(void);
-LED * NewLED(void);
-Capacitor *NewCapacitor(void);
-IC* NewIC(void);
-Disp* NewDisp(void);
-Fuse *NewFuse(void);
-RCA *NewRCA(void);
-ThreeFive *NewThreeFive(void);
-Switch *NewSwitch(void);
+typedef struct {
+ GLXContext *glx_context;
+ Window window;
+
+ int XMAX, YMAX;
+ int win_w, win_h;
+
+ /* one lucky led gets to be a light source , unless -no-light*/
+ int light;
+ int lighton;
+
+ /* stores refs to textures */
+ int s_refs[50];
+
+ GLfloat viewer[3];
+ GLfloat lightpos[4];
+
+ float sin_table[720];
+ float cos_table[720];
+ float tan_table[720];
+
+ Component *components[MAX_COMPONENTS];
+ int band_list[12];
+ int band_list_polys[12];
+
+ GLfloat grid_col[3], grid_col2[3];
+
+ int display_i;
+ GLfloat rotate_angle;
+
+ texture_font_data *font;
+ char *font_strings[50]; /* max of 40 textures */
+ int font_w[50], font_h[50];
+ int font_init;
+
+ GLfloat draw_sx, draw_sy; /* bright spot co-ords */
+ int draw_sdir; /* 0 = left-right, 1 = right-left, 2 = up->dn, 3 = dn->up */
+ int draw_s; /* if spot is enabled */
+ float draw_ds; /* speed of spot */
+
+} Circuit;
+
+static Circuit *circuit = NULL;
+
+
+static int DrawResistor(Circuit *, Resistor *);
+static int DrawDiode(Circuit *, Diode *);
+static int DrawTransistor(Circuit *, Transistor *);
+static int DrawLED(Circuit *, LED *);
+static int DrawIC(Circuit *, IC *);
+static int DrawCapacitor(Circuit *, Capacitor *);
+static int DrawDisp(Circuit *, Disp *);
+static int DrawFuse(Circuit *, Fuse *);
+static int DrawRCA(Circuit *, RCA *);
+static int DrawThreeFive(Circuit *, ThreeFive *);
+static int DrawSwitch(Circuit *, Switch *);
+
+static void reorder(Component *[]);
+static int circle(Circuit *, float, int,int);
+static int bandedCylinder(Circuit *,
+ float, float , GLfloat, GLfloat , GLfloat,
+ Band **, int);
+static int Rect(GLfloat , GLfloat , GLfloat, GLfloat , GLfloat ,GLfloat);
+static int ICLeg(GLfloat, GLfloat, GLfloat, int);
+static int HoledRectangle(Circuit *ci,
+ GLfloat, GLfloat, GLfloat, GLfloat, int);
+static Resistor *NewResistor(void);
+static Diode *NewDiode(void);
+static Transistor *NewTransistor(ModeInfo *);
+static LED * NewLED(Circuit *);
+static Capacitor *NewCapacitor(Circuit *);
+static IC* NewIC(ModeInfo *);
+static Disp* NewDisp(Circuit *);
+static Fuse *NewFuse(Circuit *);
+static RCA *NewRCA(Circuit *);
+static ThreeFive *NewThreeFive(Circuit *);
+static Switch *NewSwitch(Circuit *);