Main Page   File List   File Members  

turtle.h

00001 /*
00002  *
00003  *
00004  */
00005 
00006 #ifndef __TURTLE_H__
00007 #define __TURTLE_H__
00008 
00009 #include <gtk/gtk.h>
00010 #include <math.h>
00011 #include "config.h"
00012 
00013 #define locale_t      guint
00014 #define LOCALE_ENGLISH     0
00015 #define LOCALE_FRENCH      1
00016 
00017 
00018 /*>> define the turtle                                                       */
00019 struct s_turtle {
00020   gdouble x,y;              /*>> turtle position (starting from top-left)    */
00021   gdouble angle;            /*>> turtle-head angle (0° eq 0h00)              */
00022   gdouble virtual_heading;  /*>> angle value in degrees                      */
00023   
00024   gboolean trace;           /*>> pen tracing during turtle moves (Y/N)       */
00025   GdkColor pencolor;        /*>> color of the turtle pen                     */
00026 
00027   int delay;                /*>> delay between 2 steps of drawings 
00028                                  (in nanoseconds)                            */
00029 
00030   GtkWidget *source_txt,
00031             *debug_txt,
00032             *drawing_field,
00033             *notebook,
00034             *wstatus,
00035     //            *filesel,
00036     //      *saveassel,
00037     *main_app_window,
00038     *progressbar;
00039 
00040   GdkPixmap *pixmap;        /*>> background pixmap. Used for drawings        */
00041   GdkPixmap *animator;      /*>> turtle animator pixmap                      */
00042   int anix, aniy;
00043 
00044   GdkGC *gc;
00045 
00046   //  GSList *instructions;     
00047   GSList *procedures;       /*>> list or procedures                          */
00048 
00049   struct s_proc *main_proc; /*>> main procedure                              */
00050   struct s_proc *cur_proc;  /*>> current procedure. used for compilation     */
00051 
00052   //  GSList *variables;        /*>> global variables list                       */
00053 
00054   GdkFont *font;
00055 
00056   //#ifdef DEBUG
00057   gboolean compile;
00058   gboolean draw;
00059   //#endif
00060 
00061   gboolean compilation_failed;
00062 
00063   GtkAdjustment *hadj, *vadj;
00064 
00065   GtkWidget *boxes[3];
00066 
00067   gint status;
00068   gchar *filename;
00069   locale_t locale;
00070 };
00071 
00072 
00073 #ifndef G_PI
00074 #  define G_PI   M_PI
00075 #endif
00076 
00077 #define BASE_CAP (-(M_PI/2))
00078 
00079 #define COLOR_BLACK        0
00080 #define COLOR_BLUE         1
00081 #define COLOR_GREEN        2
00082 #define COLOR_CYAN         3
00083 #define COLOR_RED          4
00084 #define COLOR_MAGENTA      5
00085 #define COLOR_YELLOW       6
00086 #define COLOR_WHITE        7
00087 #define COLOR_BROWN        8
00088 #define COLOR_LIGHTBROWN   9
00089 #define COLOR_MIDGREEN    10
00090 #define COLOR_BLUEGREEN   11
00091 #define COLOR_SALMON      12
00092 #define COLOR_BLUEISH     13
00093 #define COLOR_ORANGE      14
00094 #define COLOR_OR          15
00095 
00096 
00097 int frlex(void);
00098 int enlex(void);
00099 
00100 
00101 #define OPEN_PROGRAM_BOX   1
00102 #define SAVE_PROGRAM_BOX   2
00103 #define SAVE_DRAWING_BOX   3
00104 
00105 
00106 #include <libintl.h>
00107 #define _(String) gettext (String)
00108 
00109 
00110 #define STATUS_CHANGED     1
00111 #define STATUS_NAMED       2
00112 //#define STATUS_UNCHANGED   2
00113 //#define STATUS_NOTNAMED    3
00114 
00115 /* return a boolean */
00116 #define STATUS_IS_MODIFIED(a_turtle)     (a_turtle.status & STATUS_CHANGED)
00117 #define STATUS_IS_NAMED(a_turtle)        (a_turtle.status & STATUS_NAMED)
00118 
00119 #define SET_STATUS_MODIFIED(a_turtle)    (a_turtle.status | STATUS_CHANGED)
00120 #define SET_STATUS_NAMED(a_turtle)       (a_turtle.status | STATUS_NAMED)
00121 
00122 #define UNSET_STATUS_MODIFIED(a_turtle)  (a_turtle.status & ~STATUS_CHANGED)
00123 #define UNSET_STATUS_NAMED(a_turtle)     (a_turtle.status & ~STATUS_CHANGED)
00124 #endif /* __TURTLE_H__ */

Generated on Tue Aug 6 13:21:19 2002 for lafontaine by doxygen1.2.15