Level 3: programmer manual

General
The objects
The objects of anyflo
Properties
The linked lists
The blocks
The datas
Constants
Internal calls
Debug
Messages
Protocols
The compiler
The files
Debug
algorithms
Real time
Transfer



General

     Introduction

     Interpreter

     Anyflo

     Applications

     Languages

     Link

     Expression

     Evaluation

Introduction

Anyflo is a pseudo-compiled interpreter taking its input from:
a) The keyboard (default functioning).
     A ? indicates that the interpreter waits for a command line of the form:
          E1;E2;...En;ENTER
               Ei are evaluable expressions of two forms:
                    word1(par1) word2(par2) ... wordn(parn);
                         wordi are words of the language.
                         pari are evaluable expressions.
                    word1(par1) word2(par2) ... wordn(parn)=expr;
                         expr is an evaluable expression.
          An evaluable expression returns z value.
               A value can be written:
                    A number (integer or float), example -123.07.
                    A numbers list, ex mple 1,2,-3,125.76.
                    A string, example "string".
                    A concatnation of previous values, a1,2,3,"string,"-1.23,5.
                    Or NIL (empty).
b) A function call function returns a value.
c) In interaction mode, the dialogue is done via the mouse, the keyboard or any device.

Interpreter

The structures of the interpreter and the #define of the language words are in file:
     defa.h.
The sources are in files *a.c et *a.cpp
The language words are defined in file:
     koma.h.
Messages are definde in file:
     mesa.h.
The langage is described in:
     manuel langage.

Anyflo

The anyflo structures are defined in file:
     defb.h
The sources are in files *b.c and *b.cpp
The anyflo words are defined n file:
     komb.h.
Messages are defined in file:
     mesb.h.
English messages are in file:
     Voc_eng
Messages in the language xxx are in file:
     Voc_xxx
The translation is performed by function long GENERATE_CHAR(long *p1, long *fin) of file mesa.c.
For real time in file:
     def_interacb.h.
For devices in:
     device.h.

Applications

The structures of an application are defined in file:
     defc.h.
The words of this application are defined in file:
     komc.h.
Messages are defined in file:
     mesc.h.
The sources of an application can be added in file:
     utilb.c.
This file serves as an interface to link objects C or C + + anyflo. It will be necessary to build a new executable with Visual C + + environment which is in the folder anyflo
Pratically:
     1) launch Microsoft Visual C++, file->Open Workspace->anyflo->anyflo.dsw.
     2) Chang file utilb.c, possibly add others files .c or .cpp (in which case by adding by Project->Add To Project->files or new).
     3) Compile and link by Build->build anyflo.exe
     4) A new exeacutable anyflo.exe is buildes in folder anyflo/Debug.
     5) To debug it: Build->Start Debug->Go, etc..
Others applications are in *d.h, *d.c et *d.cpp, etc..

Languages

Files komx.h and mesx.h allow translating the system in another language. It is possible to define several languages simultaneously by adding alias in file komx.h.
For example, in file komb.h:
|1: screen ecr
gives 2 names screen and ecr for the command to clear the screen.

Link

Folder anyflo contains:
Folder Debug containing objects *.o and executable anyflo.exe.
The include files *.h
Sources files *.c supplied with the distribution.
The files needed to rebuild anyflo.exe in the VisualC++ environment.
For that:
1) Launch VisualC++
2) File->Open Workspace...
anyflo/anyflo.dsw
3) Change files sources.
4) Build->Build anyflo.exe launches the compiler and the link.
5) For debug: Build->Start Debug->Go
File anyflo_video.js allows launching the new executable anyflo.exe in video mode.
Note: This file contains a specific path of access to the executable file is different from the distribution/anyflo_video.js.
See DEBUG ANYFLO.

Expression

The datas come formatted as follows in the function EVALUER_1() (anyflo commands): pd0 -> (dim,MULT,n,0)(COM1)(COM2)... (COMn)
     dim = size 32 bits) of buffer
         n = commands number
         COMi = (dim,env,num)(datas)
             env = number of the environment
                 0: Interpreter (commands of koma.h)
                 1: Anyflo (commands of komb.h)
                 2: User (commands of komc.h)
             num = number of the command
             if dim > 3 datas = datas

Evaluation

long EVALUER_0(long *pd0, long *pd_eg, long *suite, long *end, long sem): interprter (file esa.c).
long EVALUER_1(long *pd0, long *pd_eg, long *suite, long *end, long sem): anyflo (file exeb.c).
long EVALUER_2(long *pd0, long *pd_eg, long *suite, long *end, long sem): applicatioin (file utilb.c).
pd0 -> expression
pd_eg -> datas
suite -> continuation of the buffer
end -> end of buffer
The evaluation is retuened in pd0.
The function returns 0 if successful, ERR0 if error and DEB_EV if overflow.

The objects

     Structure

     Visibility of an object

     General objects

     Simple objects

     Programmation of an object

Structure of an object
Structure of a linked list

Structure of an object

Objects are linked structures: struct Objet
{
/* Identifier */
long num;
char *name;
/* Type */
long type_0, type_1, type_2, type_3, type_type;
long lead; /* 0: absolute leader, else leader */
/* Properties block */
long *bloc;
long *param;
/* Geometry */
long nx, ny, nz, close, inc, cpt, valider;
/* Linked list of local objects of other object which is not a function object */
struct Objet *local;
/* Linked list of local variables of a function */
struct Objet *var;
/* datas for a function (such as displ win func) */
long *tr;
/* Chaining */
struct Objet *son;
struct Objet *father;
};
Notes: 1) If the object is a function:
              local = list of local functions numbered from 1 to n.
              var = list of formal variables, static, autos and local, if dupplication function (for a local function), they are duplicated and compiled, and copies thereof are attached to duplicated functions.
              nt = '?' for a menu ?name.
2) Otherwise: local = linked list of the local functions attached to this object.

Structureof a linked list

Some information may be stacked in linked lists of structures:
struct Linked_List
{
char *name;
long num;
long *datas;
struct Linked_List *father;
struct Linked_List *son;
};

This is the case of some commands (such as geod).

Visibility of an object

An object can be reached by its identifier id is either the name (character string) or by number (integer no zero), this object is stored in a linked list Pile_xxx.
It may be valid (validate = 1) or no (validate = 0).
The bloc is of thr form: bloc=header, addresses
       header dimension DIM_TETE=4: bloc[0,3] = (dim=DIM_TETE+n,AD,n,1)
     addresses dimension n: bloc[DIM_TETE,DIM_TETE+n-1] = (p1,p2,...,pn): list of pointers to properties blocks.
param matrix.
env,type main type env = number of the environement (0: interprete;ter, 1: anyflo, >1: applications) type = caracteristic number.
env2,type2 = secondary type
nx,ny,nz = size of 3D grid
close = 0 (open), 1 (closed)
local -> local object.
father -> father object (nul for the root).
som -> son object (nul for the last).

General objects

To every type (eee, ttt) is associated a stack Pile_Ttt of linked simple objects of the same type (eee, ttt), the root p0 of this stack is an indestructible empty object:
       p0->son = p1 (1st), p0->father = 0.
       p1->son = p2 (2nd), p1->father = p0.
       ...
       pn->son = 0 (last). A general object is any object whose type is not specified, to handle it the name of its stack must be known:
struct Objet *get_pile(long env, long type)
     Returns the concerned stack.
struct Objet *set_object_general(long env, long type, long *p_id, long ind)
     Creates and returns the object whose identifier is p_id{ind}.
struct Objet *get_object_general(long env, long type, long *p_id, long ind)
     Returns the object of type (env, type) and identifier p_id{ind}.
void rem_object_general(long env, long type, long *p)
     Deletes objects of type (env, type) and identifier p_id, all if p_id = 0.
void init_object(struct Objet *p_obj);
     Initialize to zero object p_obj.

Simple objects

Definition
A stack of objects chained consists of simple linked objects of the same type differing only by their identifiers, the root p0 of the stack is an empty indestructible object.
To create a stack Pile_Ttt:
In glbb.h: struct Objet Pile_Ttt[1];
In extbb.h: struct Objet Pile_Ttt[];
In initb.c: init_object(Pile_Ttt);
If env=2, in function get_pile_c(long env, long type) add:
case TTT: return(Pile_Ttt);
Access to simple objects
struct Objet *set_object_simple(struct Objet *pile, long env, long type, long *p_id, long ind)
     Creates and returns the simple object of type (env, type) and identifier p_id{ind} in the stack.
struct Objet *set_object_simple_num_name(struct Objet *pile,
long env, long type, long env2, long type2, long *bloc, char *name, long num)

     Creates and return the simple object of type (env, type, env2, typ2) and identifier(nom,num) in the stack, and creates block bloc.
struct Objet *get_object_simple(struct Objet *pile, long *p_id, long ind)
     Returns the simple object of pile and identifier p_num{ind}.
struct Objet *get_object_simple_type(struct Objet *pile, long typ, long *p_id, long ind)
     Returns the simple lobject of pile, identifier p_num[ind] and type typ.
struct Objet *get_object_simple_num_name(struct Objet *pile_object, long num, char *name)
     Returns the simple object of pile and identifier (num,name)
void rem_object_simple(struct Objet *pile, long *p): deletes simple objects identifiers in p, all if p = 0.
void renumeroter_object_simple(struct Objet *p)
     Renumbers the simple objects of the stack p.

Anyflo objects

anchorages
brush
device        standard devices
field        func        font
genetic
history
image        interaction
local        light
memory        menu        message
network
object
palette        pointer
scale        see        stock
texture        trajectory
variable        vol        view

Anchorages

bloc(lead) -> (dim,type,1,1)(lead)
bloc(follow) -> (dim,type,nb_follower,1)(suiv1,suiv2,...)
bloc(follow) -> (dim,type,nb_follower,1)(suiv1,suiv2,...)
bloc(follow) -> (dim,A_LONG,nb_follower,1)(num1,num2,...)
bloc(vertex lead) -> (dim,A_LONG,nb_follower,1)(num)
bloc(vertex follow) -> (dim,A_LONG,nb_follower,1)(num)

Forces field

In Pile_Champ. type_0 = FIELD
type_1 = FUNC; functional field.
       func("f"): bloc(func) -> function name "f")
       func(num): fermer = num field_utilisateur(num,...)
       p_obj->var: anyflo function
type_1 = B_IMAGE; image field.
type_2 = 0,AXIS,DILAXYZ,ROTXY; image field axis dila rot.
type_3 = B_IMAGE,SPEED; image field ... (image,speed).
       bloc(B_IMAGE) -> (dim,UNSIGNED_CHAR,nx,ny)(rgba,...)
       bloc(COE) -> (dim,A_FLOAT,1,1)(coe)
       bloc(LIMIT) -> (dim,A_FLOAT,4,1)(x1,y1,x2,y2)
       bloc(A_LIST) -> (object_image)
       bloc(NUMBER) -> (id_image)
type_1 = ROTA, ROTX, ROTY, ROTZ, FUNC
       rotational field.
type_1 = VOL: volumetric field.
       vol(id): bloc(vol) -> identifier.
       p_obj->var: object volume (dont make sup_obj(field))
type_2 = VERTEX
       vertices of volume id are central fields.

Echelles

In Pile_Echelle.
1)linar scale:
scale(id): creates the object type scale and identifier id.

2)scale ext:
scale ext("eee")directory("ddd");
       Creates an object of type scale having properties:
       EXT: ".eee"
       DIRECTORY: "ddd\"
              NAME:
              name1.eee
              name2.eee
              ...
       nx = window width in pixels
       ny = names number
              nz = clicked number.
              num = current number.
              close= line.
       validate 0 (passive) 1 (active).
The others options(opt) (colors, ...).
When invoked by:
scale ext("eee")directory("ddd")poi(x,y)
       The list is displayed at (x,y).

input scale:
scale("sss")input
       Creates the scale name sss
inc, cpt: period
scale("sss")input poi(x1,y1,x2,y2)
Displays the scale:
bloc B_TEXT -> typed text
bloc COL -> text color
bloc FRAME -> frame color
bloc RECTANGLE -> rectanglee color

move scale:
scale("t1 t2 ...")move(id)poi(x1,y1,x2)dim(t)coe(C1,C2,...)
       Creates the scale object id initially placed at (x1, y1) of n linear scales whose the n options are stacked in block = (dim0,. N,.) (DIM1, opt1) (DIM2, opt2) .. . (dim N, OPTN), 0
scale move (id) poi (x1, y1, x2) coe (C1, C2, ...)
       Display the scales (movable with the mouse).

Option mouse(1) P_Id_Scale -> (num,name,lock), when left click: lock=-lock and the function et_Id_Scale() return 1;

Functions

In Pile_Fonc.
       name = function name.
       type_0 = INTERP (runs a command line).
       type_0 = FUNC (executes a function).
       type_1 = FUNC: variable of type function In local.
       nx = number of formal parameters.
       nt = type call for an anyflo menu (?).
       bloc -> (dim,A_CHAR,.,.)("text of the function").
       param -> (dim,COMP,0,0)(compiled code).
       var -> linked list of variables returnable function:
              FORMEL: formal variables
              -A_STATIC: static variables
       Others variables, lost at the end of the function, are stacked. -AUTO: automatic variables
              -GLOBALE: global variables of local functions
       Satck Pile_Pile containing:
              object of type type_0 = PILE
              object of type function.
              linked variables.
              son = 0: end of stck
              On output of the function, the stack is released until the father's head.
              A function call is stacked in the following.

Fonts

In Pile_Fonte.
num: OpenGL number
name: anyflo name
nx = Fonte_x, ny = Fonte_y: current dimensions nz = Fonte_e, close = Fonte_d
dim font returns Fonte_x,Fonte_y,Fonte_e,Fonte_d
dim scale returns D_Fonte_y = Fonte_y + 2 * Fonte_e, Dy2 = D_Fonte_y + Fonte_d.
nz, close: default dimensions
bloc -> (dim,A_CHAR,nx,ny)(char[nx,ny]0, ...,char[nx,ny]255) for a user font using pixels defined. Fonte0 = number of the origin font ("9_BY_15" default), Fonte = number of the current font.
D_Fonte_y = Fonte_y + 6: height of rectangles and frames containing a text text or a scale.

Genetic

In Pile_Genetique.

History

In Pile_History.
       Pile_History->bloc = (dim,AD,n,0)(C1)(C2)..(Cn)
              Ci = (dim,A_CHAR,.,.)("command lines")

Images

These are simple objects stacked in Pile_Image:
       Pile_Image -> working image.
       Pile_Image->son -> 1st user image.
              nx,ny,nz = dimension, np = nx * ny * nz, close = texture.
       bloc(B_IMAGE) -> (unsigned char,np,4) rvba (t)
       bloc(-B_IMAGE) -> (unsigned char,np,4) rvba (t-1)
       bloc(0) -> (float) rvba (t)
       bloc(1) -> (float) rvba (t-1)
       speed -> (float,np,4)
       acc -> (float,np,4)
       pixel -> (float,np,2)
identificateur id.
Dimensions: nx, ny, nz.
nz (nx*ny) plans pixels RGBA stored in the following (p_obj->bloc)[DIM_TETE].
The third dimension nz can be used for 3D textures or to analyze the dynamic behavior of an image in time (close varying between 0 and nz-1): speed, accleration, study variation curves of a pixel (for example in an image speed", these curves can be very disturbed and need to be filtered.
close = 0 (default), no associated texture to the image.
if close > 0 is the number of the associated texture brought by glGenTextures((GLsizei) 1, &close);
and used by glBindTexture(GL_TEXTURE_2D, ind);.
close image(id)=0 deactivates the associated texture making glDeleteTextures((GLsizei) 1, &close); and p_obj->close = 0;
Informations are stored in the form of buffers (nx*ny*nz*4 bytes) in:
     bloc(1,IMAGE) = current image unsigned char rgba (t).
Si dyna=p_obj->type_3: dynamic image:
     bloc(1,-IMAGE) = image unsigned char rgba (t-1).
     bloc(1,NORMALE) = 1 (normal for displ image poi normal) */
     bloc(0,0) = im(t) = float rgba image (t).
     bloc(0,1) = im(t-1) = float rgba image (t-1).
     bloc(1,SPEED) = float rgba(t)-rgba(t-1) speed.
     bloc(MASS)
     bloc(SPRING)
     bloc(DUP) for traj dim image
     bloc(AUDIO) -> a1,a2,...: audio buffer numbers.
     bloc(PERIOD): period of audio (25 default).

     bloc(MOYENNE) = n,cpt,nx,ny,P1,P2,...,Pn pi -> nx*ny unsigned char (r,g,b,a,...) image(id)average(n), cpt varies from 0 to n-1, cpt image is replaced by the image each time it is changed, it takes the average value of n images.

Animation:

     bloc(TRAJ) = traj1,traj2,...

     bloc(PROPR) = tran(x,y) dila(cr,cv,cb) dim(nx,ny) luminance(light) move(x,y) rotx(rx) roty(ry) rotz(rz) transp(t)

interaction

interaction ascii
interaction stock
interaction write

interaction ascii

In Pile_Interaction.
     inreraction ascii("c")func("f")
          type_0 = INTERACTION, type_1 = ASCII, type_2 = 0, type_3 = FUNC
          name -> "c"
          bloc NOM -> "f"
          local -> p_func

     inreraction ascii("c")write name("nnn.bmp")image(id)vol win(x1,y1,x2,y2)dim(dx,dy) number("4D",num,inc)format("BGR")
          type_0 = INTERACTION, type_1 = ASCII, type_2 = GARE, type_3 = B_IMAGE, VOL, ...
          name -> "c"
          num = num, inc = inc, close = 0 (pas de codage), 4 (codage "4D"), nz = 1 (normal)
          bloc DIM -> dx,dy
          bloc NOM -> "nnn.bmp"
          bloc FEN -> x1,y2,x2,y2
          bloc FORMAT -> "BGR"
          bloc TYPE -> id

interaction stock

In Pile_Interaction.

     interaction stock win(x1,y1,x2,y2)dim(dx,dy)number("4D",num,ni,inc)format("BGR")
          type_0 = INTERACTION, type_1 = 0, type_2 =STOCK, type_3 = B_IMAGE, VOL
          nx = ni, ny = cpt++
          bloc DIM -> (dimx, dimy), nz = normal (for image)
          bloc NUMBER -> num,ni,[inc]

interaction write

In Pile_Interaction.

     interaction write("nnn.eee")win(x1,y1,x2,y2)dim(dx,dy)number("4D",num,ni,inc)format("BGR")
          type_0 = INTERACTION, type_1 = 0, type_2 = STOCK, type_3 = B_IMAGE, VOL
          nx = ni, ny = cpt++
          bloc DIM -> (dimx, dimy), nz = normal (for image)
          bloc NAME -> (nnn.eee), nz = normal (for image)
          bloc NUMBER -> ["4D"],num,ni,[inc]

Local functions

In p_obj->local.
local(0)vol(id)="f"; adds a compiled copy of function f to p_obj->local numbered form 1 to n and of type LOCALE.
The first local function is executed just before displaying the volume id and acts as the main function of the C language, it has the father (indestructible) to retrieve the object in the global obj-> var.
local(0)vol(id)=num; gives to the 1st local function of object id, the case num: of function EXEC_OBJ(p_obj, num) of file utilb.c
p_obj->local->type_0=LOCALE, p_obj->local->type_1=num.

Lights

In Pile_Lum.
p_obj->num, p_obj->name: identificateur.
p_obj->nx = number of the light (OpenGL style).
p_obj->bloc -> (dim,AD,n,1)(p1,p2,...,pn).
       p1 -> block COU: color
       p2 -> block AMBIANCE: ambiance
       p3 -> block POI: position
       p3 -> block COE: attenuation as a function of the distance
For a spot:
       p4 -> bloc AIM: aim point
       p5 -> bloc FOC: opening
       p6 -> bloc ROUL(c): the light intensity is multiplied by (cos(a))^c, with a=angle(dor,LP), dir=aim light, L=eye light P=illumated point.
       p7 -> bloc TRAJ: linked list of properties trajectories.

2D textures

These are images in Pile_Image:
              nx,ny = dimensions, close = texture.
              close = ind de glBindTexture(GL_TEXTURE_2D, ind)
texture vol: bloc(TEXTURE)
texture fac vol: bloc(TEXTURE,FAC)-> AD,p1,p2,... pi->datas(texture fac(i)vol(id))

Memories

In Pile_Memoire.
p_obj->bloc -> (dim,AD,n,1)(p1,p2,...,pn).
       p -> bloc (POI RECTANGLE).

Object memories

memory(id1)object(id2) is an object (1,MEMORY) stored in p_obj->local.

Memory of an object

bloc memory.

Menus

In Pile_Menu.
generate menu("f0;sm;f1;f2;f3;f4")text("f0;>sm;f1;.f2;!f3;!f4")text("h0;hsm;h1;h2;h3;h4) poi(x,y)col(r,v,b)[rectangle(rr,vr,br)][frame(rc,vc,bc)]
       name = 1st function name "f0"
       nx = number of functions, ny = lock, close = mouse (1 default)
       validate = 0 (off), 1 (on)
       bloc -> (DIM_TETE+2,A_D,n,1)(pi)
              bloc NOM = ("f0;>sm;f1;.f2;!f3;!f4;=f5;") names of the functions.
              bloc TEXTE = ("f0;sm;f1;f2;f3;f4;f5;") names of the boxes.
              bloc TYPE = (0,->,0,-.,-!,-!,-=) types
              bloc MENU = (pf0,pf1,pf2,pf3,pf4,pf5) indestructible objects (type = LONG et no AD) (sub menu if type==>, otherwise function).
              bloc HELP = ("h0;h1;h2;h3;h4;h5") help
              bloc DESSOUS = (x1i,y1i,x2i,y2i) frames of hi
              bloc POI = (x1i,y1i,x2i,y2i) frames of boxes
              bloc DESSOUS = (x1i,y1i,x2i,y2i) frames of helps
              bloc FRAME = (ri,vi,bi) colors of the frames menus.
              bloc RECTANGLE = (ri,vi,bi) colors of the rectangles menus.
              bloc SOURIS = (s) mouse
              bloc COU = (ri,vi,bi) texts colors
              bloc EXEC = (ci,cpti,ti) cpti counter of box ci >0 timed ti.
              bloc PERIOD = (pi,cpti,ti): period pi = of box i > 0, cpti = counter, ti = duration.

Messages

These are simple objects stored in Pile_Message and defined by:
       identifier id (num or name)
       validate = 1 (active), 0 (passive).
       nx=period, ny=duration, nz=cpt
       nx = period, ny = duration, nz = cpt, close=mouse.
       validate = 0 (hidden), 1 (displayble)
       close = mouse: 0 (permanent, 1 (inhibited on click) br>        bloc -> (DIM_TETE+2,A_D,3,1)(p1,p2,p3)
              pi -> bloc(A_TIME, -A_TIME, FRAME, COU, FONTE, FORMAT, POI, RECTANGLE, TEXTE, ...)

Object

In Pile_Objet. p_obj->type_type is the internal number (< 0) of the in Type_Dynamique -> (dim,num,"t")(...) 0 of object p_obj created by object(id)type("t").
Objets of given type:
object(id)type("t");
       type_type = num internal number (< 0) of type "t" in Type_Dynamique -> (dim,num,"t",0)
object(id1)image(id2);
       type_1 = B_IMAGE
       bloc B_IMAGE -> id2

Palette

In Pile_Palette.
bloc: properties:
       TEXTE("HELP;SAUV;REST;REST0;PINCEAU;COU;INTERP;FIN"): menu
       POI(1)=(x1,y1), POI(2)=(x2,y2): window of the menu
       COU(rt,vt,bt): color of the menu text.
       RECTANGLE COU(rr1,vr1,br1,rr2,vr2,br2): colors of filled boxes.
       FRAME COU(rc1,vc1,bc1,rc2,vc2,bc2): colors of wired boxes.

Standard devices

Audio Handled by the maximum size (MAX_AUDIO=16384 default in defb.h) buffers in DirectX.
Audio_DIM capture audio samples (initialized by dim (n) audio) is in Buf_audio..
His analysis is in Buf_audio2.
Maximums are stored in Audio_Max with Audio_NP (>(initialized by audio NP(n)) images.
Minimums are stored in Audio_Min with Audio_NP images.
Modules are stored in Audio_Module with Audio_NP (>(initialized by audio NP(n)) images.
The precision envelope is computed in Buf_Enveloppe_Audio.
The fft of the signal is calculated in Buf_Reelle (real part) and Buf_Imaginaire (imaginary part).
The envelope of the real part is calculated in Buf_Enveloppe_Reelle.
The envelope of the imaginary part is calculated in Buf_Enveloppe_Imaginaire.

stock audio Cpt_Stocker_Audio in [0,Fin_Stocker_Audio[
Informations are stored in Buf_Stocker_Audio and written in file Nom_Stocker_Audio.DAT.

Devices (sensors)

In Pile_Periph.
       num, name: identifier.
       type_0 = TYP:
              P_AUDIO, P_COM, P_DAT, P_IMA, P_ITR, P_LIR, P_MEM, P_MID, P_SOC_TCP, P_SOC_UDP, P_SOURIS, P_TRIER.
       nz = 0: server, 1: client.
       inc = tempo.
       validate
       bloc -> properties block (dim,AD,np,1)(pi):
              bloc[DIM_TETE+i] -> propri

P_DAT
       device(id)type("DAT")name("nnn")
       block(NOM) -> ("name") of file DAT.
       VAR property = float contents of the file
       nx = lines number ( = vectors number), ny = floats number per line ( = vectors dimension).

P_IMA
       nx,ny = dim image, close = number of the image, poi(x,y)=left low corner.
       bloc(VAR) = header,datas:
              en_tete = (dim,UNSIGNED_CHAR,np,4) vec np = nx *ny.
              datas = (r,v,b,a,..) nx*ny pixels GL_RGBA.

P_MEM
       si (type_1 = SIMPLE): direct characters exchange in Buf_Map .
       bloc(NOM) -> ("name") of the shared memory.
       nx = dim (memory size).
       p_var = bloc(VAR), pd = p_var[DIM_TETE] -> memory.
              *pd = flag (driver -> anyflo): 0 if driver is writing, 1: available.
              pd[1] = flag (ayflo -> driver): 0 if anyflo is writing, 1: free.
              pd[2,dim-1] = datas.

P_UDP
       type_1 -> (struct sockaddr_in *) client, type_2 -> (struct sockaddr_in *) server.

P_LIR
       device(id)type("LIR")name("nnn")dim(n)
       bloc(NOM) -> ("name") of file LIR.
       property VAR = ASCII content of the file
       nx = n.

P_SOC_UDP
       device(id)type("UDP")
       nx=id socket, ny=tempo, nz=leader: 0 client (default), 1 server.
       close=blocking
      
env2 -> (SOCKADDR_IN *)server, type2 -> (SOCKADDR_IN *)client).

Pinceau

In Pile_Pinceau.
Sons are brushes user defined:
       num,name: identifier.
       type_0=PINCEAU, type_1=DISQUE,RECTANGLE,B_IMAGE
       si type_1==B_IMAGE type_2=DISQUE,RECTANGLE
       nx=dimx, ny=dimy, nz=precision
       close=0 (<- mouse), 1(<- anyflo command).
       inc=dminimum istance betwing 2 outputs.
       validate (0,1).
bloc: properties:
              COU(r1,v1,b1,...): colors.
              COL(illum,t1,t2,a,0): illum (0: wired, 1: filled), t1,t2: transparency., a: random.
              B_IMAGE: (dim,AD,1,1)((unsigned char) pu), pu = (r1,v1,b1,a1,...)
                     type_1=IMAGE (inside of a line in an image), DISQUE ou RECTANGLE.
                     type_3=dynamic.
       bloc(MAPPE) = number of the associated image (for image ou smooth.
       RESEAU(id), read image -> motif -> validate network -> law -> displayed image

pointers

@obj
       type_0 = AD_AD
       local -> obj

Neural networks

In Pile_Reseau.
       name, num: identifier
       bloc -> addresses block:
              pn -> neurons
              pf -> FAC (layers) (dim+6,MULT,6,1,1,FAC), (dim,HYBRIDE,nf,0), p1, p2, ..., pnf
                     pi = (np+DIM_TETE,A_LONG,np,1), (n1,n2, ...,nnp)
              pm -> matrix, pmm -> -matrix.
              pm -> (bloc MOTIF)(dim, FLOAT,nx,ny)dim=DT+np*nx*ny -> np = (dim-DT)/(nx*ny)
                     motifi=(ny vectors of dimension nx) (ny columnss and nx lines image).
              pm -> (bloc -MOTIF): (dim, FLOAT,nm,dimm)(m1_1,m1_2,...,m1_dimm,...) = motif(t-1)
              pl -> (bloc LAW)(dim, FLOAT,nl,0)law1, law2, ...lawnl
                     lawi=(dim,A_FLOAT,ny,nx)(ny vectors of dimension nx) (image of ny columns and nx lines).
              pl -> (bloc LAW)(dim, FLOAT,nl,0)law1, law2, ...lawnl
                     lawi -> (dim, FLOAT,np,dimp) array of np vectors of dimensions dimp.
              pm -> meta network, adaptative training:
                     float c1_1, c1_2, c1, c1_0, dc1_1, dc1_2, dc1, dc1_0; /* coe1 */
                     float c2_1, c2_2, c2, c2_0, dc2_1, dc2_2, dc2, dc2_0; /* coe2 */
                     float moy0, moy; /* average(error) */
                     Si moy<.5 c1-=dc1 et c2-=dc2 every d
                     long a1, a2, a, a0, cpta; /* If moy>.5 do alea(matrix) every a */
                     long d1, d2, d, d0, cptd;
                     float noise;
                     long val_cpt; float val_err; long val_stat; long val_nb;
validate network(id) retourne: val_cpt,val_err,val_stat,val_nb

Network brush

network brush(id)=idr
       p_obj(idr) -> luminance network. network brush(id)=idr,idv,idb
       p_obj(idr) -> network R, p_obj(idv) -> network V, p_obj(idb) -> network B.

Objets stock

In Pile_Stocker.
type_0 = STOCKER
       type_1 = AUDIO,
       DEVICE
       MOUSE: nz = mouse(0,1,2), close = displ, inc = dist * dist.
nx = NP (vectors number), ny = input counter = [0,np-1], -1 (end).
bloc poi -> np verctors of dimension dimp.

Trajectories

       In Pile_Traj.
Object trajectories: see description in trajectories block.
traj(ni)P1(p1)P2(p2)obj(id)
traj(id)animate(ni)P1(p1)P2(p2)
nx=ni (number of images, 0: end), ny=cpt(ni): current image, nz=period, nt=delay, cpt=cpt(delay)
fermer=order, inc=inc cpt(ni), lead=ini
Objet trajectory: if their block contains trajectories, traj of traj.
Si t_id is a trajectory of the volume id (traj vol(id)=t_id; et si Interaction_Animer != 0, then traj of traj (animation of higher order), when one of them is finished (they must all have the same ni) then Interaction_Animer = 2, and these trajectories are incremented.
type_0 = TRAJ, rtpe_1 = P1, type_2 = P2, type3 = ANIMATE (traj de traj)
bloc(P1) -> bloc(VAR,P1)
bloc(P1,P2) -> bloc(VAR,P1,P2)
typ1 = NAME: traj(ni)name("nnn.eee")number(n1,n2)image(id):
       bloc(FORMAT) -> "4D"
       bloc(NAME) -> "nnn.eee"
       bloc(NUMBER) -> n1,n2
       bloc(VAR) -> n1,n1+1,...,n2

traj name number image transp(t1,t2)transp(t3,t4)col(r1,g1,b1)col(r2,g2,b2):
transf: bloc TRANSP(t1,t2), -TRANSP(t3,t4), COL(r1,g1,b1),-COL(r2,g2,b2)
ext: bloc (VAR,TRANSP), (VAR,-TRANSP), (VAR,COL), (VAR,-COL)
idem for TRANSP LUMINANCE.

number: bloc NUMBER, A_LONG
read images [FLAG_I-1,FLAG_I-ni]: bloc MEMORY, A_LONG

traj(ni)interpol(id1,id2,...idn)image(id)
       bloc(INTERPOL) -> id1,id2,...,idn
       bloc(INTERPOL,INTERPOL) -> (ni,cpt,dcpt)
       (id1,id2,1, id1,id2,.5, id1,id2,0)
       (id2,id3,.5, id2,id3,0)
       (idn-1,idn,.75, idn-1,idn,.5, idn-1,idn,.25, idn-1,idn,0)

traj(ni)transp(t1,t2,...)col(c1,c2,...)image(id)
       ti=ti1,ti2, ci=r1,g1,b1, r2,g2,b2.
       bloc(VAR TRANSP) -> ext(ti1,ti2,0)
       bloc(VAR COL 0) -> ext(ri1,gi1,bi1)
       bloc(VAR COL 1) -> ext(ri2,gi2,bi2)

traj(ni)transp(t1,t2,...)luminance(l1,l2,...)image(id)
       ti=ti1,ti2, li=l1,l2.
       bloc(VAR TRANSP) -> ext(ti1,ti2,0)
       bloc(VAR LUMINANCE) -> ext(li1,li2,0)

The variables

External variables
       in Pile_Extern.
Variables automatiques
       Any undeclared variable in a function and this p_obj, they are stored in p_obj-> var.
Formal vatiables
       Any variable appearing in the declaration of the function f (f1, f2, ...) is a formal variable stored in p_obj-> var.
Global variable of an object local function
       Any variable declared globale in a function p_obj, is stored in Pile_Globale with num=number of the object, (env2,type2)=object type.
Static variables
       Any variable declared static in a function p_obj, they are stored in p_obj->var.

Dialog windows anyflo

In Pile_Voir.
Pile_Voir->validate = 1: small square in the upper right of the screen to click to validate.
Pile_Voir -> son is see object:
       validate = 0 (off), 1 (on), -1 (bar)
      
bloc ->addresses block:
              block poi(x1,y1,x2,y2).
              block -poi(x1,y1,x2,y2): poi memory.
              block text color (rt,vt,bt).
              block rectangle color (rr,vr,br).
              block frame color (rc,vc,bc).
              block text("...").
              font("fff")

Volumes

In Pile_Vol.
       name, num: identificateur
       nx,ny,nz,close (grid)
       validate = 0 (off), 1 (on)
      
bloc -> addresses block pi:
              poi(x1,y1,z1, x2,y2,z2, ...)
              fac(fac1,fac2, ...)
              others properties.
      
param -> matrix block = (58,A_FLOAT,58,1)mat

particle
       type_0=VOL, type_1=VPARTICULE, type_2=0 ALEA RAND
       nz=3 (3D default), 2 (2D), 1(1D)
       bloc(center)(xp,yp,zp)
       bloc(mate ang)(an)
       bloc(mate axis)(ax,ay,az)
       bloc(mate force)(f1,f2,v1,v2)
       bloc(mate normal)(nor1,nor2)
       bloc(mate particle)(np)
       bloc(mate radius)(ray)

Parameters:
              AD_X=0, mat[AD_X,AD_Y,AD_Z]=x,y,z: displacement
              AD_DIL_X=3, mat[AD_DIL_X,AD_DIL_Y,AD_DIL_Z]=cx,cy,cz: dilatation
              AD_ROT_A=6, mat[AD_ROT_A]=a: rotation angle
              AD_AXE_X=7, mat[AD_AXE_X,AD_AXE_Y,AD_AXE_Z]=xa,ya,za: rotation axis
              AD_ROT_X=10, mat[AD_ROT_X,AD_ROT_Y,AD_ROT_Z]=rx,ry,rz: x y z rotations angles
Matrices:
              AD_MAT=13, mat[AD_MAT]=transformation matrix 4*4
              AD_X0=AD_MAT+16=29, mat[AD_X0,AD_Y0,AD_Z0]=x,y,z: cumulated displacement
              AD_DIL_X0=32, mat[AD_DIL_X0,AD_DIL_Y0,AD_DIL_Z0]=cx,cy,cz: cumulated dilatation
              AD_ROT_A0=35, mat[AD_ROT_A0]=a: rotation angle
              AD_AXE_X0=36, mat[AD_AXE_X0,AD_AXE_Y0,AD_AXE_Z0]=xa,ya,za: cumulated rotation axis
              AD_ROT_X0=39, mat[AD_ROT_X0,AD_ROT_Y0,AD_ROT_Z0]=rx,ry,rz: x y z cumulated rotations angles
              AD_MAT2=42, mat[AD_MAT2]=current matrix 4*4 (calculated when displaying)
Dimension totale=DIM_MAT=AD_MAT2+16=58

Memorised parameters: mat[AD_X0,AD_Y0,AD_Z0]=x,y,z: displacement
              mat[AD_DIL_X0,AD_DIL_Y0,AD_DIL_Z0]=cx,cy,cz: dilatation
              mat[AD_ROT_A0]=a: rotation angle
              mat[AD_ROT_X0,AD_ROT_Y0,AD_ROT_Z0]=xa,ya,za: rotation axis
      

Viewes

In Pile_Vue.
       type_0=VIEW, type_1=AIM,AXIS, type_3=A_WRITE
       name, num: identifier
       bloc -> addresses block:
              poi(x,y): position
              aim(xa,ya,zq): aim point
              axis(dx,dy,dz): direction
              foc(f): focal
              roll(r): roll
              others properties.

Object programamtion

General syntaxe, given obj an object type:
obj(id); creates object identifier id.
obj(id)propr(p)...; creates object id with propr(p) ... properties
obj ... propr obj2(id2); returns obj ... propr property of obj2(id2).
obj ... propr obj2(id2)=p; assigns this property.

See an example In utilb.c.

Properties

General form

The object properties are blocks whose parameters are addresses in the object block.
object->bloc -> (dim,AD,n,A)(p1,...,pn)
pi -> (dim,MULT,dim1,n,(e1,c1,...,en,cn)
pi + dim1 -> (B1)...(Bn)
Bi -> (dim,ei,ci)(datas)

Linked lists

These are objects reduced to a properties list.
struct Liste_Chainee
{
     char *name;
     long num;
     long *bloc;
     struct Liste_Chainee *father;
     struct Liste_Chainee *son;
};

datas -> (DIM_TETE+n,AD,n,1)(p1,p2,...,pn) pi->(dim,ei,ci)(datas);

The blocks

A block is a dynamic structure not fixed at compilation time.

simple blocks
multiple blocks
attach blocks
memory blocks
trajectories blocks
vertices trajectories blocks
Matrix
Access to the blocks

Simple blocks


A simple bloc is a series of longs of the form:
bloc=entete,datas
     header=dim,type,np,dimp.
          dim=DIM_TETE+n, with DIM_TETE=4 (header of fixed size), n=datas size.
          type=datas type
          np,dimp: datas size
          type=A_FLOAT
                datas=np float vectos dimension dimp.
                Exemple np=2, dimp=3, datas=x1,y1,z1, x2,y2,z2
          type=A_CHAR
               datas=np characters string .
          type=HYBRIDE, dimp=0
               datas=np simple blocks

Multiple blocks

A Multiple block is a series of longs of the form:
bloc=header, bloc1,bloc2, ...,blocn
     entete=dim0,MULT,dime,n,e1,c1,e2,c2,...,en,cn
          dim0 = total size of the block = 4 + 2 * n + sizes blocki sum
          dime=headre size = 4 + 2 * n
          n = multiplicity of the block
          ei,ci = environment number, command number
     bloci = simple block

Attach blocks

attach com1(p1) com2(p2) ... comn(pn) obj(id);
       (dim,MULT,n+2,1)(3,1,ATTACHE) Bloc1 Bloc2 ... Blocn (dim,1,OBJ)(datas id)
This bloc is a particular property of the object id, directly interpretable by evaluer_0().
If obj=vol: just after displaying the object taking into account its processing by the matrix.
Otherwise by EXEC_ATTACHE_OBJ(OBJ, 0) from interaction_Idle_Func() just before displaying.
OBJ is: BROU, CHAMP, GENETIQUE, B_IMAGE, LUM, OBJET, RESEAU or VUE.
This block is directly passed to evaluer_0() for execution, infinite recursion is avoidedmaking Sem_ATTACHE = 1 before calling EVALUER_0() in function AFF_VOL_1() of file affb.c (for attach ... vol(id) which are executed at displaying).

Examples:
Attach transformations
attach Ta(a1,a2)vol(ida)Tb(b1,b2)vol(idb);

Attach vertices
attach vertex(a1,a2,...)vol(ida)vertex(b1,b2,...)vol(idb);

Attach an interactive view
attach vertex(a1,a2,...)vol(ida)vertex(b1,b2,...)vol(idb);

dynamic adaptative view
attach aim vol(1)spring(.1,-.1)dist(200)view(1);

Memory blocks

memory(id1)obj(id2)
obj->bloc -> (dim,AD,n,1)(p1,p2,...,pm,...)
       pm -> (dim,MULT,6,1,1,MEMORY)(pm1,pm2,...)
              pmi -> (dim,num,dim0,"name"),datas
              pmi+2+dim0 -> datas

Trajectories blocks

traj(ni)transf(p)obj(id)...
Datas:
En_Tete,Bloc_Traj,Bloc_Transf,[Bloc_Coe,Bloc_Som],Bloc_Obj
       En_Tete=dim,MULT,n,0
       Bloc_Traj=(dim,1,TRAJ)(datas=ni)
       Bloc_Transf=(dim,1,TRANSF)(datas=p)
Eventuellement:
       Bloc_Coe=(dim,1,COE)(datas=p)
       Bloc_Som=(dim,1,SOM)(datas=p)
       Bloc_Obj=(dim,1,OBJ)(datas=id)
       Others blocks: period, acc, dec, pend, law(x,y,0, ...) used for building the trajectory and not coded.
Coding in block TRAJ:
(dim,OBJ,1,1)(p)
       p->object_traj vide
       p->son->object_traj (name=id,env=1,type=transf,nx=ni,ny=cpt,nz=period,num=inc)
       (p->son)->son->object_traj (env=1,type=transf,nx=ni,ny=cpt,nz=period,num=inc) ...
       p->nx = ni; p->ny = cpt; p->nz = period; p->close = multiplicity.
              object_traj->bloc=(dim,AD,n,1)(p1,p2,...,pn).
                     p1->Bloc_Transf=(dim,FLOAT,np,dimp)(valeurs)
                     Si dimp = 1: values=v1,v2,...,vnp
              Si dimp = 3: valeurs=x1,y1,z1, x2,y2,z2, ..., xnp,ynp,znp
                     p2->Bloc_VAR=(dim,FLOAT,ni,3)(datas)
                     datas=(dim,A_FLOAT,ni,3)(values): coding of Bloc_Transf extension.
                     Si dimp = 1: values=0,v_1,0, 1,v_2,0, ..., ni-1, v_ni,0
                     Si dimp = 3: values=x_1,y_1,z_1, x_2,y_2,z_2, ..., x_ni,y_ni,z_ni

Eventuellement:
              p3->Bloc_Coe=(dimC,1,COE)(datas).
Codage particulier interpol(id1,id2,...)vol(id0):
              object_traj->bloc=(dim,AD,n,1)(p1,p2,...,pn).
                     p1->Bloc_Transf=(dim,FLOAT,np,dimp)(values).
                     p2->Bloc(POI)=(dim,A_LONG,np,1)(pf1,pf2,...) pfi -> volume idi points.
                     p3->Bloc(-POI)=(dim,A_FLOAT,ni,3)(x1,y1,z1,...): trajectory buffer of extension of a vertex.
                     No block VAR.

During animation:
       If period=0 variation: 1,2,...,ni
       If period=1 cpt varies cyclically: 1, 2, ..., ni, 1, 2, ..., ni, ...
       If period=-1 cpt varies cyclically: 1, 2, ..., ni, ni-1, ni-2, ..., 1, 2, ...
The coefficients of the matrix of the object and animated parameters are modified accordingly.

Vertices trajectories blocks

traj(ni)transf(p)vertex(s)obj(id)...
Datas:
En_Tete,Bloc_Traj_Som,Bloc_Transf,[Bloc_Coe,Bloc_Som],Bloc_Som[vertex]Bloc_Obj
       En_Tete=dim,MULT,n,0
       Bloc_Traj_Som=(dim,np,OBJET,1)(datas=p_obj1,p_obj2,...,p_objn) for n vertices
              p_obj->objecti = empty object
              p_objj = p_obji->son = object traj transf vertex(i).

Matrix

(DIM_TETE+AD_MAT,A_FLOAT,AD_MAT,1)(datas):
       AD_X=0,AD_Y=1,AD_Z=2: x,y,z: displacement
       AD_DIL_X=3,AD_DIL_Y=4,AD_DIL_Z=5: cy,cz: dilatation
       AD_ROT_A=6,AD_AXIS_X=7,AD_AXIS_Y=8,AD_AXIS_Z=9: rota,axis_x,axis_y,axis_z
       AD_ROT_X=10,AD_ROT_Y=11,AD_ROT_Z=12: rotx,roty,rotz
matrix 4*4 computed ad AD_MAT=13, from (x,y,z, cx,cy,cz, a, ax,ay,az) by glGetFloatv() when virtualy displaying (function CAL_MATRIX() of file affb.c:
       m00 m01 m02 m03
       m10 m11 m12 m13
       m20 m21 m22 m23
       m30 m31 m32 m33
current matrix mat2 4*4 at:
       AD_X0=29,AD_Y0=30,AD_Z0=31: x0,y0,z0
       AD_DIL_X0=32,AD_DIL_Y0=33,AD_DIL_Z0=34: cx0,cy0,cz0
       AD_ROT_A0=35,AD_AXIS_X0=36,AD_AXIS_Y0=37,AD_AXIs_z0=38: rota0,axis_x0,axis_y0,axis_z0
       AD_ROT_X0=39,AD_ROT_Y0=40,AD_ROT_Z0=41: ax0,ay0,az0
DIM_MAT=58 = size of bloc matrix.

Access to a block

long *det_bloc_1(long *bloc, long e1, long c1)
     Returns a pointer to block (e1=environment,type=c1) et 0 if error.
Example
det_bloc_1(o_obj->bloc,1,COL)
     returns a pointer to illum property of object pointed by par p_obj.
For a multiple property:
long *det_bloc_2(bloc, e1, c1, e2, c2)
long *det_bloc_3(bloc, e1, c1, e2, c2, e3, c3)
long *det_bloc_4(bloc, e1, c1, e2, c2, e3, c3, e4, c4)
long *det_bloc_5(bloc, e1, c1, e2, c2, e3, c3, e4, c4, e5, c5)
long *det_bloc_6(bloc, e1, c1, e2, c2, e3, c3, e4, c4, e5, c5, e6, c6)

long *etendre_bloc(long *p1, long dim)
     Creates the block p2 of dimension dim, initializes it to p1, frees p1 and returns p2 and 0 if error.
long *etendre_bloc_0(long *p1, long dim1, long dim2)
     p1 -> block of dimension dim1
     Creates the block p2 of dimension dim2, initializes it to p1, frees p1, returns p2 and 0 if error allocation.

long add_ad(struct Objet *p_obj, long *p)
     Adds pointer p in the block of de p_obj, returns thep address and < 0 if error.

long *cre_ad_bloc(struct Objet *p_obj, long n)
     Returns a pointer to the bloc created of n null addresses, and 0 if error.
Example
cre_ad_bloc(p_obj, 0)
     Returns a pointer to block=(DIM_TETE=4,AD,0,1) of the object pointed by par p_obj.

long *add_bloc(struct Objet *p_obj, long dim)
     Adds a block of dim longs at the object pointed by p_obj, returns this block, and 0 if error.

void set_bloc_type_1(long *p_bloc, long e1, long c1)
     Initializes the block p_bloc at simple type (e1,c1)
For a multiple property:
void set_bloc_type_2(p_bloc, e1, c1, e2, c2)
void set_bloc_type_3(p_bloc, e1, c1, e2, c2, e3, c3)
void set_bloc_type_4(p_bloc, e1, c1, e2, c2, e3, c3, e4, c4)
void set_bloc_type_5(p_bloc, e1, c1, e2, c2, e3, c3, e4, c4, e5, c5)
void set_bloc_type_6(p_bloc, e1, c1, e3, c3, e4, c4, e5, c5, e6, c6) void set_bloc_type_ad(long *p_bloc, long nb_type, long *pd0)
     pd0 -> (dim,e1,c1,...), initializes the block p_bloc at multiple type (ei,ci)

long *cre_bloc(long dim)
     Creates a block of dim longs, does Nb_bloc++, returns a pointer to this block and 0 if error.
     The counter Nb_bloc, initialized to 0 when lauching the program, is incremented each creaation and decremented each relaese which allows control.

void free_a(long *p) */
     Ifi *p > 0: releases the block p and does Nb_bloc--
     void free_1(char *pc) */
     Releases the block pc and does Nb_bloc--

long *etendre_bloc_0(long *p1, long dim1, long dim2)
     p1 -> block of dimension dim1
     Creates the block p2 of dimension dim2, initializes it to p1
     Relaeses p1, returns p2 and 0 if error allocation

The datas

     Datas structure

     Special datas

     Example

     Access to datas

Datas structure

bloc_datas -> (dimt,type,np,dimp,mat)(datas)
       dimt = size of the buffer
       type = type of the values
        A_SHORT: short
        A_LONG: long
        A_FLOAT: float
        A_CHAR: char
        AD: points to a block (cre_bloc, rem_bloc)
        AD0: pointer to datas (malloc, free)
         HYBRIDE: there are np sub blocks.
       OBJ: pointers to objects
       np = number of vectors
       dimp = vectors size
       dimp > 0 datas = v_1,...,v_np
              v_i = x_1,...,x_dimp
       dimp = 0 datas = (datas_1)...(datas_np)
              datas_i = datas
Note:
mat=1: default
mat > 1: there are mat datas, dimt = DIM_TETE + mat * (dimt - DIM_TETE)

Special datas

acc vertex vol
     (dim,A_FLOAT,np,3)(x1,y1,z1,...)
col vertex vol
     (dim,A_FLOAT,np,3)(r1,v1,b1,...)
force vertex vol
     (dim,A_FLOAT,np,4)(x1,y1,z1,v1,...)
          xi,yi,zi = force, vi = viscosity.
speed vertex vol
     (dim,A_FLOAT,np,3)(x1,y1,z1,...)
near vertex vol
     (dim,A_FLOAT,np,3)(x1,y1,z1,...)

Example

col vol(1)=1,.75,.25:
pd0 -> header:
     15 : dimension
     -1039 : MULT (multiple command)
     2 : 2 commands
     0 : sub blocks of variable dimensions
pd0 + 4 -> col
     3 : dimension
     1 : anyflo environment
     17 : COL
pd0 + 7 -> vol
     8 : dimension
     1 : anyflo environment
     4 : VOL
pd0 + 10 -> (1)
     5 : dimension
     -1002 : A_FLOAT
     1 : 1 float value
     1 : of dimension 1
     1.0 float doded
pd_eg -> 1,.75,.25
     7 : dimension
     -1002 : A_FLOAT
     3 : 3 floats
     1 : of dimension 1
     1,.75,.25 float coded
the function EVALUER_1() returns 1 and the evaluation in pd0, here the assigned value: pd0 ->
     7 : dimension
     -1002 : A_FLOAT
     1 : 1 vector
     3 : of dimension 3
     1,.75,.25 float coded

Access to datas

long *det_datas_1(long *bloc, long e1, long c1)      Returns a pointer to the datas (environment=e1,type=c1) and 0 if error.
Example
det_datas_1(o_obj->bloc,1,EXT)
     returna a pointer to ext property of the object pointed by par p_obj.
For a multiple property:
long *det_datas_2(bloc, e1, c1, e2, c2)
long *det_datas_3(bloc, e1, c1, e2, c2, e3, c3)
long *det_datas_4(bloc, e1, c1, e2, c2, e3, c3, e4, c4)
long *det_datas_5(bloc, e1, c1, e2, c2, e3, c3, e4, c4, e5, c5)
long *det_datas_6(bloc, e1, c1, e2, c2, e3, c3, e4, c4, e5, c5, e6, c6)

long set_float_1(long *pd0, long *end, float f1)
     Initializes the block [pd0,end] to the float f1. Returns ERR0 if overflow. If end=0: no overflow test.
For several floats:
long set_float_2(long *pd0, long *end, float f1, float f2)
long set_float_3(long *pd0, long *end, float f1, float f2, float f3)
long set_float_4(long *pd0, long *end, float f1, float f2, float f3, float f4)
long set_float_5(long *pd0, long *end, float f1, float f2, float f3, float f4, float f5)
long set_float_6(long *pd0, long *end, float f1, float f2, float f3, float f4, float f5, float f6)

Constantes

Voir defa.h et defb.h.
/* PI */
#define PI 3.14159265358979323846
#define PIS2 1.57079632679489661923
#define DEUXPI 6.28318530717958647692
/* Conversion radians <-> degres */
#define Rad_Deg 57.295776
#define Deg_Rad 0.017453

Internal calls

     To simulate in C language a call in anyflo language of the form:
com1(par1)com2(par2)...
1) Build an header in a buffer [pd0,end[:
ini_pile(pd0, end);
2)Stack the successive commands (envi,comi,bufi):
add_pile_buf(pd0, end, envi, comi, buf);
3) Call the anyflo corresponding function:
f(pd0, end);
Others functions are available:
long add_pile_commande(long *pd0, long *end, long n, long env1, long com1, long env2, long com2)
     To stack n<=2 commands without parameters.
long add_pile_float(long *pd0, long *end, long env, long com, long n, float f1, float f2, float f3, float f4)

     To stack a command followed by n<=4 float.
long add_pile_char(long *pd0, long *end, long env, long com, char *name)
     To stack a command followed by a string.
long add_pile_com(long *pd0, long *end, long *p_com)
     To add p_com=(dim,env,com(datas) in pd0.

Debug

The parameters of the function interaction debug are accessible in C:
MAX_DEBUG = maximum number of scales (fixed to 24).
N_Debug = scales number (between 0 and 24).
X1_Debug,Y1_Debug,X2_Debug,Y2_Debug,X3_Debug,X4_Debug = window displaying the scales.
Val_Debug = debuging values = (c1_1,c1_2,c1, c2_1,c2_2,c2, ...).
Coe_Debug = values boundaries = (b1_1,b1_2,b1, b2_1,b2_2,b2, ...).

Messages

message(env, num): edits the message number num of the environment env.
EDITER_IDENTIFICATEUR(p_obj): edits the types, the number and the name of object p_obj.

Protocoles

External functions are referenced in:
defa.h.
defb.h.
defc.h.

The compiler

Principle        Commands        Messages        Compilation        Functions        Stack        call        execution        return        Variables        Instructions        loop_for        loop_while        switch        Link        Execution

Principe

       An text obeying to the language syntax anyflo is compiled into a pseudo assembler then linked, is directly interpreted in C, which makes it independent of the environment (system and machine).

The commands

       Command descriptions environment n (n = a: shell, b: anyflo, c: 1st application, ..) are in file komn.h in the form:
|num: com aaa
       num is the number of the command
       com is its name
       aaa is an alias (optional)
emp,sem,dim,type
       sem = [yes no] com
       type is the compilation type:
              type=0: com com -> com(com)
              type=1: com com -> com com
              type<0: cancels the evaluation
       v1,v2,...,: default values, others forms:
              [n]=v: n values initialized to v
              [n]: n values initialized to 0
              .: no values

The numbers of the commands are stored in Nb_Commande[env] with env = number of the environment (0: interpreter, 1: anyflo, >1: applications).
The commands number for an application is fixed to 200 by the directive:
#define INC_COM 200 of file defa.h, so:
The internal numbers of the interpreter commands belong to the interval [0,199].
The internal numbers of the anyflo commands belong to the interval [200,399].
The internal numbers of the 1st application commands belong to the interval [400,599].
etc...
The commands names are stored in Nom_Commande[Ad_Nom_Commande[com]], where Ad_Nom_Commande stores the commands com addresses.
The emp flags are stored in Emp_Commande[com].
The yes/no flags are stored in Sem_Commande[com].
The values numbers are stored in Dim_Commande[com].
The type flags are stored in Type_Commande[com].

The default values are stored in Def_Commande[Ad_Def_Commande[com]].
The defaul values numbers are stored in Dim_Commande[com].
Current values are stored in Val_Commande[Ad_Val_Commande[com]].

Stacking commands

Some commands (such as geod) can be stacked before being popped (as end geod). They are stacked in the linked list Liste_Commande. A WARNING is issued for more than 3 commands stacked.

The messages

       The environment n messges (a: interpreter, b: anyflo, c: application, ...) are in file komn.h in the form :
|num: text
num = relative number of the message for the current environment
text = message text possibly containing:
       \n: new line
       \7: ring
       \e: space
       \t: tabulation

The messages numbers are stored in Nb_Message[env] witv env = number of the environment (0: interprter, 1: anyflo, >1: applications).
The messages texts are stored in Nom_Message.
The addresses of the addresses of messages are stored in Ad_Env_Mesage.
The addresses of messages are stored in ad=Ad_Env_Mesage[env]. The message (env,mes) is in Nom_Message[ad[mes]].

Compilation

Function to compile p_obj is passed to the function compile(struct Objet *p_obj) of file compa.c.
A first pass compile_passe_1(p_obj, p_comp00, end_comp,&overflow) solves the directives, removes comments, spaces and \ n.
The text is compiled instructions in p_obj->param.
The formal, static, autos and local variables, are created (and possibly initialized) in p_obj->var.
A second pass put parentheses according to operator precedence.
A 3rd step possibly adds some parentheses at the expressions badly parenthesized but without ambiguous.
p_obj->nx,ny,nz,close = nombre de variables formelles, statics, autos et locales.
The formal parameters declared of type func are coded:
       (dim,-NOM_FUNC,"name").

Functions

A function is defined by an object p_func of Pile_Fonc:
       p_func->name = function name.
       p_func->bloc -> function text.
       p_func->param -> compiled code.
       p_func->father -> previous function (0 of the first).
       p_func->son -> following function (0 if the last).
       p_func->var -> empty head of the linked list of formal, statics, auto, func variables.
              p_var->son contains the following variable.
Remarque:
       p_obj->local -> linked list of local functions if p_obj is not a function.

Stack

The stack Pile_Pile is an indestructible object head of a linked list of objects containing:
start indicator stack: (name, type=FUNC, nx=formal parameters number stacked) of the called function.
nx copies of formal parameters dof p_func->var of the calling function.
indicator
etc..
Pile_NP is the last.
At the return of the function these elements are restored in p_var and destroyed.

Call to a function

Call to a function f(p1,p2,...);
In function evaluer_fonction(long *p0, long sem_ret) of file maca.c:
p0 -> (dim,code,p_func,np)(datas). np = numbert of parameters called,in datas.
code = FUNC_DISK (indeterminate -> search on the Disk), CODE_FUNC p_func = p0[2].
P_mac = p_func.
p_var=p_func->var is the linked list of parameters:
       formal (possibly completed by some NILs).
       statics which retain their values.
       autos which are the internal variables to the function.
       locaux for a local function.

La pile Pile_Pile is used for store Mac0->var (parameters of the calling function, nothing if the interpreter is calling).
The following items are stacked in Pile_NP = ++pointer_Pile:
1) A indestructible copy of the called function (p_func-> name and numbers
of formal parameters (p_func->nx),
of static parameters (p_func->ny),
of auto parameters (p_func->nz),
of local parameters (p_func->close).
2) pointer_Pile -> empty object of stack end.

At the return of the function, these elements are popped. pointer_Pile = Pile_NP->father.

Execution

The code is executed by the function interp(buf, p_ev) of file esa.c:
buf = (tete) I1, I2, ... end
Ii is an instruction.
Call parameters have been copied into the stacked formal parameters that are coded in the instructions by (type = FORMEL, nx = number in the stack), the others parameters can be modified.
The names "string" are compared to variable names p_var of type TYPE_FUNC.
The result is evaluated in [p_ev, Fin_ev[.
Returns 2 if RETURN, < 0 if error, 0 otherwise.

Return

The return is stacked in [p0, Fin_ev[.
Returns 2 if RETURN, < 0 if error, 0 otherwise.
The elements of the stack contents between two indicators (func = 0 and type) are copied in p_func-> p_var and destroyed.

Variables

External variables: stored in Pile_Extern.
       name = "name"
       type_0 = EXTERN
       bloc -> datas

Formal, automatic, static variables of a function p_func: they stored in p_func->var.
       name = "name"
       type_0 = FORMEL, -A_STATIC, -AUTO, -GLOBALE
       bloc -> datas

Formal variables of type function
       they stored in p_func->var.
       name = "name"
       type_0 = COMMANDE (when executing).
       type_1 = number of the command.

Global variables of a local functions
       they stored in Pile_Globale avec num=number of the object, (env2,type2)=type of the object.
       name = "name"
       type_0 = LOCALE
       bloc -> datas

Instructions

Format of an instruction: I = (dim,p)
       1) If dim < 0, p coded on one word.
              dim = A_FLOAT: p = float.
              dim = -A_EXTERN: p -> object of Pile_Extern.
              dim = -A_STATIC, FORMEL: p -> object of p_obj->var.
              dim = GOTO_L<0: p = ralative increment jump.
              dim = COMMANDE<0: p =number of this commande.
              p = INDEFINI < 0: (dim,INDEFINI,num,0)("name") solved at link in:
                     (CODE_FUNC < 0, p_func) p_func -> function object.
              dim = -FUNC: p -> function object of Pile_Fonc.
              dim = TYPE_FUNC: p -> variable function object.
                     link transforms in T=(COMMANDE,com) or (T=-FUNC,object)
       2) If dim > 0: I = dim,type,np,dimp)(datas).
A function is coded as (CODE_FUNC,p_func) p_func is a pointer to an object of Pile_Fonc avec:
       p_func->bloc = function text.
       p_func->param = compiled code.
       p_func->local = linked list of formal, static, local variables.
The call to a function f is coded as (dim,INDEFINI,"f") resolver at link.
A formal parameter of a function is coded as (FORMEL,p_var) p_var is a pointer to an object of the local stack of this function..
A local variable of a function is coded as (VAR_LOC,p_var) p_var is a pointer to an object of the local stack of this function.
A static variable of a function is coded as (-A_STATIC,p_var) p_var is a pointer to an object of the local stack of this function.
A constant is coded as datas.
An external variable is coded as (VAR_GLB,p_var) p_var is a pointer to an object of Pile_Extern.
       3) If dim = 0: compilation end.

The loops for

First form:
for(init;cond;inc){...}
compile (FOR1,.)(init;cond;inc){...}
link (FOR0,a1)a0(6,FOR_L1,a2,a3,a4,a5)a1(ini;)a2(cond;)a3(inc){a4...}(goto a0)a5...
exec(FOR0) -> exec(a1): initialization.
exec(FOR_L1) -> if(exec(a2){exec(a3);goto a4;}else goto a5;
If condition -> increment and execute {...}, otherwise continue.
Second form:
for(i=a,b,c){...} generates the code:
compile (FOR2,.)(i=a,b,c){...}
link (FOR0,a0),(7,FOR_L2,a,b,a4,a5,c)({...}
exec(FOR0) a=a0: initialization.
exec(FOR_L2) a+=c, if b has not reached goto a4, otherwise goto a5.

Loop while

while(cond){...} generates:
a0(4,WHILE,a1,a2,a3)a1(cond;)a1(ini;)a2{...}(goto a0)a3...
exec(WHILE) -> if(exec(a1))goto a2; else goto a3: ttq cond true do a2 else continue.

switch

switch(ins){case c1:ins1;break;case c2:ins2;...default;insd;} generates:
a0(dim,SWITCH,ai,a1,a2,...,ad,suite)ai(ins;)a1(ins1;goto suite;)a2(ins2;goto suite;) ad(insd);
Note:
This coding allows any cases (float, strings, hybride, executable instructions).

The if

if(cond){ins1;}else {ins2} generates:
(dim,IF,a1,a2,a3)a1(cond;)a2({ins1;}goto a4;)a3(ins2;)a4...
exec(IF) -> if(exec(a1))goto a2;else goto a3;

Link

The undefined references are resolved:
Calling a function "f" gives rise to a search for this function in Pile_Fonc, in case of failure, the file "f.func" is searched in the launching folder, then in the user folder and finally in the environment folder, if there is failure output error ("no function f defined"), otherwise the file is loaded and compiled. If such undefined were currently detected the link is restarted (usually successfully).

Executcution

The compiled code is interpreted very quickly in C language.

The files

Fonctions        Images        Matrices        Objects        Stock        Variables

Fonctions

The function files *.func in anyflo langage are in ascii form.

Images

Coded according to their extension (bmp flo jpg tga):
bpm: bitmap
jpg: jpeg
tga: tga
flo:
       xxxxxx yyyyyy c\n: xxxxxx yyyyyy /n xy size, c: code (0: uncompressed, 1: compressed). (on 16 octets)
       rfga rgba ... list of pixels.

Matrices

For read nb matrices of nx columns and ny lines:
Lire_Matrice_Nb = nb, Lire_Matrice_Nx = nx, Lire_Matrice_Ny = ny

Objects

Files *.ext have the following structure:
nimber.
name: (dim,"nom") if dim == 1 no name.
type: type_0, type_1, type_2, type_3, type_type.
leader
geometry: nx, ny, nz, close, inc, validate.
Properties:
       (dim,MULT,dim0,n,e1,c1,e2,c2,...,en,cn)(datas) datas=(dim,type,np,dimp)(valeurs)
Parametres block:
       (42+DIM_TTE, A_FLOAT, 42, 1)(x,y,z,cx,cy,cz,a,xa,ya,za, mat, mat2)

Stock

Command stock obj stackes in Pile_Stocker objects of type_0 obj and block one datas (dim,MULT,n,0)(p1,p2,...):
       name("N.ext")
       ext("nD") the file name is then Nnum.ext (n digits, 4 default).
       number(num) incrmented each step
       period(p) for an animatio of higher order.
For an image:
       dim(dimx,dimy)
       win(x1,y1,x2,y2)
       format("RGB")

Variables

Command write var("v")name("name") writes in file v.var the variable values extern v in the form:
dim_name: name dimension + 1 (longs).
writes the object block.
if dim_name!=1, writes the name on dim_name longs.

Debuger

Debug a command line

If the command to debug begins with an interpreter command, set a break on the line code COM: of function EVALUER_0 file esa.c where COM is the command name.
If the command to debug begins with an anyflo command, set a break on the line code COM: of function EVALUER_1 of file exeb.c where COM is the command name.

Draw an error

Messages (env,mes) are issued by the message message(env,mes) of mesa.c file, place a break in this function to draw an error.

Real time

The problem
Les structures

The problem

Anyflo structures are dynamic and are not limited in number of effects, but this is at the expense of real-time requiring rigid structures quickly accessible. A compiler datas taking, as inputs the very general anyflo structures, and giving, as output compact structures and fixed function compatible with OpenGL and DirectX, allows transparent real-time to the user.

The structures

def_interacb.h.

Transfer

Files structure

Level 0

cours

Level 1

bret

anyflo.15.2

Level 2

env

Level 3

env_eng
env_fra

read write add

allows concatenate files in only one file and deconcatenate them.
anyflo/env/src_add.func:
       must exist folder src_add
              src/*.[c cpp h] are concatened in src_add/[c cpp h].add
anyflo/env/add_src.func: add_src/[c cpp h].add are deconcatened as add_src/*.[c cpp h]
Folders names can be changed in the functions.

read write inclu

allows code and decode files.
anyflo/env/src_ext.func:
       src/*.[c cpp h] are coded as src_ext/[c cpp h].ext
Note:
only the extension and the text are coded, then it is necessary building a special folder for each extension (in this case: c, cpp and h).
anyflo/env/ext_src.func:
       src_ext/[c cpp h].ext are decoded as ext_src/*.[c cpp h]
Folders names can be changed in the functions.