Main Page   File List   File Members  

exec.c File Reference

#include <math.h>
#include <time.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include "exec.h"
#include "turtle.h"
#include "mc.h"
#include "class.h"
#include "type.h"
#include "list.h"
#include "proc.h"
#include "instr.h"

Typedefs

typedef s_instr *(* exec_clb_t )(struct s_instr *)

Functions

void exec_execute_all ()
void exec_execute_proc (struct s_proc *proc)
s_instr * exec_noop (struct s_instr *instr)
s_instr * exec_proccall (struct s_instr *instr)
s_instr * exec_return (struct s_instr *instr)
s_instr * exec_moveforward (struct s_instr *instr)
s_instr * exec_moveback (struct s_instr *instr)
s_instr * exec_turnright (struct s_instr *instr)
s_instr * exec_turnleft (struct s_instr *instr)
s_instr * exec_setpos (struct s_instr *instr)
s_instr * exec_setheading (struct s_instr *instr)
s_instr * exec_clearscreen (struct s_instr *instr)
s_instr * exec_hideturtle (struct s_instr *instr)
s_instr * exec_showturtle (struct s_instr *instr)
s_instr * exec_hidepen (struct s_instr *instr)
s_instr * exec_showpen (struct s_instr *instr)
s_instr * exec_setpredefcolor (struct s_instr *instr)
s_instr * exec_setuserdefcolor (struct s_instr *instr)
s_instr * exec_notrace (struct s_instr *instr)
s_instr * exec_trace (struct s_instr *instr)
s_instr * exec_write (struct s_instr *instr)
s_instr * exec_stop (struct s_instr *instr)
s_instr * exec_affect (struct s_instr *instr)
s_instr * exec_locaffect (struct s_instr *instr)
s_instr * exec_danse (struct s_instr *instr)
s_instr * exec_sleep (struct s_instr *instr)
s_instr * exec_getheading (struct s_instr *instr)
s_instr * exec_hazard (struct s_instr *instr)
s_instr * exec_repeat (struct s_instr *instr)
s_instr * exec_loopcnt (struct s_instr *instr)
s_instr * exec_if (struct s_instr *instr)
s_instr * exec_else (struct s_instr *instr)
s_instr * exec_while (struct s_instr *instr)
s_instr * exec_jump (struct s_instr *instr)
s_instr * exec_and (struct s_instr *instr)
s_instr * exec_or (struct s_instr *instr)
s_instr * exec_eq (struct s_instr *instr)
s_instr * exec_lt (struct s_instr *instr)
s_instr * exec_gt (struct s_instr *instr)
s_instr * exec_leq (struct s_instr *instr)
s_instr * exec_geq (struct s_instr *instr)
s_instr * exec_add (struct s_instr *instr)
s_instr * exec_sub (struct s_instr *instr)
s_instr * exec_mul (struct s_instr *instr)
s_instr * exec_div (struct s_instr *instr)
s_instr * exec_uneg (struct s_instr *instr)

Variables

s_turtle my_turtle
exec_clb_t exec_clb [44]
gushort predefined_colors [16][3]
valuetype_t comparison_allowed_types [6][6]
valuetype_t arithmetic_allowed_types [6][6]

Detailed Description

Author:
Guillaume Bour. 2002
Version:
0.1
Date:
2002/03/20
2002/08/05 - warnings corrections
compiled logo programs execution.


Function Documentation

struct s_instr* exec_add struct s_instr *    instr
 

'ADD':: add arithmetic operator.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_affect struct s_instr *    instr
 

'AFFECT':: affect a value to a variable.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_and struct s_instr *    instr
 

'AND':: and boolean operator.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_clearscreen struct s_instr *    instr
 

'CLEARSCREEN':: clear the screen.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_danse struct s_instr *    instr
 

'DANSE':: make the turtle dancing :)).

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_div struct s_instr *    instr
 

'DIV':: div arithmetic operator.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_else struct s_instr *    instr
 

'ELSE':: else instruction.
IS IT USEFUL ???

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_eq struct s_instr *    instr
 

'EQ':: eq comparison operator.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

void exec_execute_all  
 

main execution function.

visibility :: public

Returns:
<none>

void exec_execute_proc struct s_proc *    proc
 

execute a procedure.

visibility :: public

Returns:
<none>

struct s_instr* exec_geq struct s_instr *    instr
 

'GEQ':: greater-or-equal comparison operator.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_getheading struct s_instr *    instr
 

'GET HEADING':: get the current heading.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_gt struct s_instr *    instr
 

'GT':: greater-than comparison operator.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_hazard struct s_instr *    instr
 

'HAZARD':: choose a hazardous number.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_hidepen struct s_instr *    instr
 

'HIDE PEN':: hide the pen (difference with NOTRACE ???).

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_hideturtle struct s_instr *    instr
 

'HIDE TURTLE':: hide the turtle.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_if struct s_instr *    instr
 

'IF':: if instruction.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_jump struct s_instr *    instr
 

'JUMP':: unconditional jump.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_leq struct s_instr *    instr
 

'LEQ':: lower-or-equal comparison operator.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_locaffect struct s_instr *    instr
 

'LOCAFFECT':: affect a value to a local variable.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_loopcnt struct s_instr *    instr
 

'LOOPCNT':: get the current loop counter.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_lt struct s_instr *    instr
 

'LT':: lower-than comparison operator.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_moveback struct s_instr *    instr
 

'MOVE BACK':: move the turtle back.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_moveforward struct s_instr *    instr
 

'MOVE FORWARD':: move the turtle forward.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_mul struct s_instr *    instr
 

'MUL':: mul arithmetic operator.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_noop struct s_instr *    instr
 

'NOOP':: do nothing.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_notrace struct s_instr *    instr
 

'NO TRACE':: don't trace (???).

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_or struct s_instr *    instr
 

'OR':: or boolean operator.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_proccall struct s_instr *    instr
 

'PROCCAL':: procedure call.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_repeat struct s_instr *    instr
 

'REPEAT':: repeat structure.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_return struct s_instr *    instr
 

'RETURN':: ???.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_setheading struct s_instr *    instr
 

'SET HEADING':: set the turtle heading.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_setpos struct s_instr *    instr
 

'SET POS':: set the position of the turtle.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_setpredefcolor struct s_instr *    instr
 

'SET PREDEF COLOR':: set predefined color.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_setuserdefcolor struct s_instr *    instr
 

'SET USERDEF COLOR':: set userdef color.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_showpen struct s_instr *    instr
 

'SHOW PEN':: show the pen (see up).

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_showturtle struct s_instr *    instr
 

'SHOW TURTLE':: show the turtle.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_sleep struct s_instr *    instr
 

'DANSE':: make the turtle sleeping :)).

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_stop struct s_instr *    instr
 

'STOP':: stop the execution.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_sub struct s_instr *    instr
 

'SUB':: sub arithmetic operator.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_trace struct s_instr *    instr
 

'TRACE':: trace (???).

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_turnleft struct s_instr *    instr
 

'TURN LEFT':: turn the turtle left.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_turnright struct s_instr *    instr
 

'TURN RIGHT':: turn the turtle right.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_uneg struct s_instr *    instr
 

'UNEG':: uneg arithmetic operator.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_while struct s_instr *    instr
 

'WHILE':: while instruction.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>

struct s_instr* exec_write struct s_instr *    instr
 

'WRITE':: write a string.

visibility :: public

Parameters:
instr  the instruction
Returns:
<null>


Variable Documentation

valuetype_t arithmetic_allowed_types[6][6]
 

Initial value:

 {
  
   { T_ILLEGAL, T_ILLEGAL, T_ILLEGAL, T_ILLEGAL, T_ILLEGAL ,
                    T_ILLEGAL},
   { T_ILLEGAL, T_ILLEGAL, T_ILLEGAL, T_ILLEGAL, T_ILLEGAL ,
                    T_ILLEGAL},
   { T_ILLEGAL, T_ILLEGAL, T_INT    , T_FLOAT  , T_ILLEGAL ,
                    T_ILLEGAL},
   { T_ILLEGAL, T_ILLEGAL, T_FLOAT  , T_FLOAT  , T_ILLEGAL ,
                    T_ILLEGAL},
   { T_ILLEGAL, T_ILLEGAL, T_ILLEGAL, T_ILLEGAL, T_ILLEGAL ,
                    T_ILLEGAL},
   { T_ILLEGAL, T_ILLEGAL, T_ILLEGAL, T_ILLEGAL, T_ILLEGAL ,
                    T_ILLEGAL}
}

valuetype_t comparison_allowed_types[6][6]
 

Initial value:

 {
  
   { T_ILLEGAL, T_ILLEGAL, T_ILLEGAL, T_ILLEGAL, T_ILLEGAL ,
                    T_ILLEGAL},
   { T_ILLEGAL, T_ILLEGAL, T_ILLEGAL, T_ILLEGAL, T_ILLEGAL ,
                    T_ILLEGAL},
   { T_ILLEGAL, T_ILLEGAL, T_INT    , T_FLOAT  , T_ILLEGAL ,
                    T_ILLEGAL},
   { T_ILLEGAL, T_ILLEGAL, T_FLOAT  , T_FLOAT  , T_ILLEGAL ,
                    T_ILLEGAL},
   { T_ILLEGAL, T_ILLEGAL, T_ILLEGAL, T_ILLEGAL, T_BOOL    ,
                    T_ILLEGAL},
   { T_ILLEGAL, T_ILLEGAL, T_ILLEGAL, T_ILLEGAL, T_ILLEGAL ,
                    T_STRING }
}

gushort predefined_colors[16][3]
 

Initial value:

 {
  {     0,     0,     0}, 
  {     0,     0, 65535}, 
  {     0, 65535,     0}, 
  {     0, 65535, 65535}, 
  { 65535,     0,     0}, 
  { 65535,     0, 65535}, 
  { 65535, 65535,     0}, 
  { 65535, 65535, 65535}, 
  { 39835, 24672, 15163}, 
  { 50629, 34952,  4626}, 
  { 25700, 41634, 16448}, 
  { 30840, 48059, 48059}, 
  { 65535, 38293, 30583}, 
  { 37008, 29041, 53456}, 
  { 65535, 41891,     0}, 
  { 47031, 47031, 47031}  
}


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