INPUTS AND OUTPUTS

Keyboard
Disk
Devices

















































Keyboard

Outputs

       Command print(expr) ou $expr prints the evaluation of expr.
Examples:
$(1+2*3); prints 7.
$read("foo") prints the contents of the ASCII file name foo.

Inputs

         Command input returns the evaluation of a command typed at the keyboard.
Examples:
$input;
         =1.2 (typed).
         prints: 1.2
if(input == 1) $ "ONE" else $"OTHERWISE";
         Prints ONE if you press 1, otherwise product OTHERWISE.
x=input("input"); Prints the message "input" and expects a value typed at the keyboard to be assigned to the variable x..

Interaction with the disk

Path
Unformated
Formated by default
Formated
Objects
Coding
Images
Zbuffers
Direct access
Write protection

Path

The search for a file location, in order:
       by the path if specified path/name.ext.
       In the folder of anyflo executable ./name.ext.
       In the user folder uti/name.ext.
       In the environment folder env/name.ext.
See directory.

Unformated

Writing data is in the format of them.
Reading can be done only if one knows this format, with:
read name("nnn")format("fff");
Examples:
write("A BC DEF")name("nnn") writes A BC DEF in ascii characters in file nnn.
read name("nnn")format("char") returns A BC DEF.
read name("nnn") returns also A BC DEF (format "char" by default).

write[1,4]name("nnn") writes 1,2,3,4 in floats in file nnn.
read name("nnn")format("float") returns 1,2,3,4.

Formated by default

Any file extension ext is assumed to contain data format ext.
Examples:
nnn.char is assumed to contain ascii characters.
read(nnn.char) return the ascii content of file nnn.char.

nnn.short is assumed to contain shorts (16 bits integers).
read(nnn.short) returns the short content of file nnn.char.

nnn.long is assumed to contain longs (32 bits intergers).
read(nnn.long) returns the long content of file nnn.char.

nnn.float is assumed to contain floats (32 bits).
read(nnn.float) returns the float content of file nnn.char.

nnn.double is assumed to contain doubles (64 bits).
read(nnn.double) returns the double content of file nnn.char.

nnn.anyflo is assumed to contain datas in format anyflo.
read(nnn.anyflo) returns the content (in format anyflo) of file nnn.anyflo.

Formated

To read and write data compatible with any application, formatted exchanges can force a format, regardless of the file extens.
write(expr)name("nnn")format("fff") writes exprnnn.
read name("nnn")format("fff") returns the content of file nnn in the format fff.
Examples:
write(expr)name("nnn")format("char") expr is written in ASCII characters in the file nnn.
read name("nnn")format("char") returns the ascii content of file nnn.

write(expr)name("nnn")format("short") expr is written in shorts in file nnn.
read name("nnn")format("short") returns the shorts content of file nnn.

write(expr)name("nnn")format("long") expr is written in longs in file nnn.
read name("nnn")format("long") returns the longs content of file nnn.

write(expr)name("nnn")format("float") expr is written in floats in file nnn.
read name("nnn")format("floatcode> returns the floats content of file nnn.

write(expr)name("nnn")format("anyflo") expr is written (format anyflo) in file nnn. écrit expr en format anyflo dans le fichier nnn.
read name("nnn")format("anyflo") returns the format anyflo content of file nnn.

Write and read objects

write com name("nnn"); writes all objects of type com in binary file nnn.ext (write and read valid for any object of anyflo).
L´extension ext du fichier caractérise le type de l´object:
       .
       field:
force field.
       gen: genetic.
       .
      
.
      
menus.
       objects.
       network: neural network.
       vol: volumes.
       vues. Examples:
write alea name("nnn"); writes the randol array aléatoires in file nnn.ale.
read alea name("nnn"); loads the randol array with the content of file name.alea.

write func name("name"); writes all functions in file nnn.func.dans
read func name("name"); reads functiuons of file nnn.func.

write func("nom1")name(nom2"); writes function nom1 in filf nom2.func.
read func name("name"); reads functions of file name.func.

write history name("nnn");writes the history in file nnn.history.
read history name("nnn"); reads history as the content of file nnn.history.

write var name("name"); writes all variables in file nnn.var.
x=read name("nnn"); sets the variable x to the value contained in file nnn.var.

garre type name("nnn"); writes all types in file nnn.type.
read type "nnn"; initializes types with the content of file nnn.type.

write obj name("nnn") writes all objects
in file nnn.obj.
Examples:
write vol name("nnn") writes all volumes in file nnn.vol.
read light name("nnn") reads light from file nnn.light.

Coding

Les fichiers binaires sont ainsi structurés:
       number: 1 long.
       dim: dim long. If dim > 1 name is coded on dim-1 longs.
       env,type: 2 longs (main type).
       env2,type2: 2 longs (secondary type) .
       nx,ny,nz,close,validate: 5 longs.
       dim: dim long (dimension of the property block).
       AD,nb,A: 3 longs (nb properties).
       (dim,type,np,dimp)(parameters): properties bloc_1.
       ...
       (dim,type,np,dimp)(parameters): properties bloc_nb.

Images

The filename extension specifies the type of encoding:
write image(id)name("xxx.ext"); writes image id in the image file nnn.ext according to the format ext which can be
ima default format anyflo.
jpg format jpeg.
bmp format bit map.
tga format tga.

Zbuffers

The extension specifies the size of the words:
       zbuf1: shorts (16 bits).
       zbuf2: floats (32 bits).

Direct access

Can directly access the contents of a file with the commands:
id=fopen("nnn") returns a file identifier.
w=getword(id) returns a word.
fwrite(id,"datas") writes datas.
w=fread(id,np) returns np bytes.
fclose(id); closes a file.

Write protection

Command no write, yes write, and status write(s) allow to specify the write protection.

DEVELOPING

Garer des images antialiasées (haute definition)

         Lancer anyflo avec l´option:
         anyflo hau=2
         L´image en mémoire centrale a 4 fois la taille vidéo. Lors d´un ´write image´, cette image sera convolée à la taille video.
         Il sera nécessaire de construire les bases de données en fonction de la taille de la memory d´image. Par exemple:
         d=dim screen;D=.1*d[0]; Fournit une base D independante de l´image
         On peut préciser la taille de l´image antialiasée (dimx,dimy) et le facteur d´antialiasage k:
         anyflo x=dimx y=dimy gra=0 mem=1 hau=k
Remarque:          write com1 com2 ... "nnn": Gare les objets de type comi dans les fichiers nnn.comi
Exemple:
write vol light "toto"; Gare tous les volumes dans toto.vol, toutes les lumières dans toto.light

Devices

Principle:

Standard devices.
         Standard peripherals exist (depending on the machine and the system):
                  mouse
                  audio
                  video
                  ...
Devices using drivers
device(id)type("TYP")name("NOM")
TYP is:
         FIC: files.
         MEM: shared memory.
         COM: serial port.
         TCP: sockets format TCP/IP.
         UDP: sockets format UDP.
         MID: format MIDI.
NOM est un nom dépendant du type
Note:
         Already initialized device can not be redefined, except to device (id) end.
Example:
         webcam.js launches the driver exe/WebCam.exe using the shared memory WEBCAM. it suffices declare in anyflo a péripd type MEM:
device(id)type("MEM")name("WEBCAM");
Command device(id)var; returns an image dimensions 8 by 8.

ENTREES SORTIES EN MODE INTERACTION

Interaction ascii

see