picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/picolisp.git/
Log | Files | Refs | README | LICENSE

commit 3c364d082fdeacd0cedc29292991bc918fa4acb9
parent b6ef7cd0a15e324ec3d771e1e9f6133444e1947d
Author: Alexander Burger <abu@software-lab.de>
Date:   Tue,  2 Apr 2013 08:35:01 +0200

Removed z3d/rcsim flight simulator
Diffstat:
MCHANGES | 1+
MINSTALL | 5++---
Ddoc/model | 57---------------------------------------------------------
Mersatz/picolisp.jar | 0
Drcsim/README | 118-------------------------------------------------------------------------------
Drcsim/env.l | 103-------------------------------------------------------------------------------
Drcsim/fokker.l | 456-------------------------------------------------------------------------------
Drcsim/lib.l | 296-------------------------------------------------------------------------------
Drcsim/main.l | 124-------------------------------------------------------------------------------
Drcsim/tone | 41-----------------------------------------
Msrc/Makefile | 17++++-------------
Msrc/vers.h | 2+-
Dsrc/z3d.c | 468-------------------------------------------------------------------------------
Dsrc/z3dClient.c | 540-------------------------------------------------------------------------------
Msrc64/tags | 126+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
Msrc64/version.l | 4++--
16 files changed, 130 insertions(+), 2228 deletions(-)

diff --git a/CHANGES b/CHANGES @@ -1,4 +1,5 @@ * DDjun13 picoLisp-3.1.3 + Removed z3d/rcsim flight simulator Bug in 'conc' (64-bit) * 30mar13 picoLisp-3.1.2 diff --git a/INSTALL b/INSTALL @@ -1,4 +1,4 @@ -27feb13abu +01apr13abu (c) Software Lab. Alexander Burger @@ -164,8 +164,7 @@ For details about the 64-bit version, refer to "doc64/README", "doc64/asm" and As always, the most accurate and complete documentation is the source code ;-) Included in the distribution are many utilities and pet projects, including -tests, demo databases and servers, games (chess, minesweeper), 3D animation -(flight simulator, 32-bit version only), and more. +tests, demo databases and servers, games (chess, minesweeper), and more. Any feedback is welcome! Hope you enjoy :-) diff --git a/doc/model b/doc/model @@ -1,57 +0,0 @@ -# 20aug04abu -# (c) Software Lab. Alexander Burger - -Sym Val -> Model list: -( - pos.x pos.y pos.z # Position - rot.a.x rot.a.y rot.a.z # Orientation - rot.b.x rot.b.y rot.b.z - rot.c.x rot.c.y rot.c.z - sym # Submodel - .. - (col1 col2 ["text"] p1.x p1.y p1.z p2.x p2.y p2.z ..) # Face - .. - sym # Submodel - .. - (col1 col2 p1.x p1.y p1.z p2.x p2.y p2.z p3.x p3.y p3.z ..) # Face - .. -) - -<col> <col> # Both sides visible -<col> NIL # Backface culling - NIL <col> # Foreside culling - NIL NIL # Transparent - NIL T # Shadow - - -Transmission format: - hor sky gnd - cnt x y z "text" x y z x y z .. col - cnt x y z NIL x y z x y z x y z .. col - .. - 0 32767 | 0 snx sny - -Transmission size: - (4 + 2 * polygons + 3 * points) * 4 bytes - - -Polygon design rules: - -- All polygons should be convex - (split concave polygons if necessary) - -- Points loop right when seen from the front side - (if the two faces should have different colors) - -- The first three points must not be on a straight line - (to allow the calculation of the normal vector) - -- The first point cannot be the local origin - (if 'aRot' is to be used) - - -z3dField .graf -((x y . "string") ..) - -Transmission format: - cnt x y "string" .. diff --git a/ersatz/picolisp.jar b/ersatz/picolisp.jar Binary files differ. diff --git a/rcsim/README b/rcsim/README @@ -1,118 +0,0 @@ -27feb13abu -(c) Software Lab. Alexander Burger - - - RC Flight Simulator - =================== - -The PicoLisp RC Flight Simulator is a very simple toy simulator, allowing you to -fly an airplane in a way similar to a radio controlled model plane. - -Currently, it is supported only in the 32-bit version of PicoLisp. - -It is all implemented within the PicoLisp system, so that no additional -libraries like OpenGL or GL4Java are needed. It may be regarded as a proof of -concept, because a flight simulator is one of the least typical things to do in -Lisp. - -The plane is similar to the German WW-I aircraft Fokker "D-VII" (and a bit to -the British Sopwith Camel ;-). Though the user's position is that of a model -plane's pilot (i.e. viewing the plane from a fixed position), all parameters -like dimensions, mass, engine power and flight data are intended to be as close -as possible to a "real" Fokker D-VII. Unfortunately, some of these parameters -are not known exactly, but it is a fun project anyway, and I hope it comes -close. - - -The simulator supports two different kinds of user interface. The version in the -standard release uses a plain Xlib frontend. To use it, you'll have to build it -once: - - $ (cd src; make x11) - -Then start the PicoLisp server with - - $ ./pil rcsim/main.l -main -go + - -and then the Z3d-Client from another X-terminal - - $ bin/z3dClient localhost 8080 - -Then make sure that your keyboard focus is on the first X-terminal (where you -started the simulator from, _not_ the Z3d-Client window). - -Hitting ENTER at the PicoLisp prompt (the colon ':') will terminate the -simulation process and close the Z3d-Client window. As always, you can stop the -PicoLisp servers with 'killall picolisp'. - - -The second version runs in an Applet in any Java-enabled browser.To run it -locally, please download and unpack the "picoJavaGUI.tgz" tarball. It contains -the Java applet GUI which is no longer part of the standard PicoLisp release. - -You can start the PicoLisp server with - - $ ./pil rcsim/applet.main.l -main -go -wait - -or (to get an interactive PicoLisp command line) with - - $ ./pil rcsim/main.l -main -go + - -and then point your browser to "http://localhost:8080". Click onto the image to -set the keyboard focus. - - -The simulator runs in the background, so if it is started interactively (see -above), the Lisp interpreter is fully available and lets you inspect or modify -the environment. For example - -: (show *Model) - -shows the current state of the model. - -In the Z3d-Version, terminal output is interlaced with the simulator's output. -If you see no ':' prompt, it is helpful to type a single dot '.' and ENTER, to -avoid terminating the interpreter: - -... -0 % 0 km/h 0 m/s 1 m -. --> NIL -: - - -The simulator is controlled by the following 10 keys: - -- The cursor (arrow) keys UP and DOWN control the elevator -- The LEFT and RIGHT cursor keys control the combined rudder/ailerons -- The HOME key sets full throttle (F8) -- PAGE UP/DOWN increase/decrease the throttle (F7/F6) -- The END key turns the engine off (F5) -- INS/DEL zoom in/out (or F4/F3) - -For a first flight, just hit the HOME key as the plane sits waiting on the -runway, and watch it accelerate. After some time, when it starts to jump a bit -nervously, give a little up-elevator (the DOWN arrow key) to gain height. Then -hit the PAGE DOWN key once or twice to decrease the throttle, and cautiously -experiment with with the arrow keys. - - -There is some rudimentary sound implemented. It is not intended to be realistic -(the graphic isn't either ;-) but to give some audible feedback to the user. It -produces a simple square wave sound, depending on the engine's thrust, the -airspeed, the distance, and the Doppler effect. - -If you are using the Java/Applet version, you might simply click on the "Sound" -checkbox. Be warned, however, that this induces additional load on the client -side, and doesn't sound very smooth. BTW, does anybody know of a better way to -produce continuous sound with variable frequency in a Java applet? - -In the Z3d-Client version, a console speaker interface is used, which gives -better results. As the speaker can be accessed in Linux only from a virtual -console (not from an X-terminal), log into a virtual console (typically tty1 .. -tty6) _before_ you start the simulator, change to the installation directory, -and run the simple tone server: - - $ rcsim/tone - -When done, you can stop it with 'killall tone'. diff --git a/rcsim/env.l b/rcsim/env.l @@ -1,103 +0,0 @@ -# 21jan07abu -# (c) Software Lab. Alexander Burger - -(model This - '(runway1 -120.0 -200.0 -0.02 - (`DarkGrey NIL - +20.0 -20.0 0 - +20.0 +20.0 0 - -20.0 +20.0 0 - -20.0 -20.0 0 ) - (`White NIL - +10.0 -1.0 0 - +10.0 +1.0 0 - -10.0 +1.0 0 - -10.0 -1.0 0 ) ) ) - -(model This - '(runway2 -80.0 -200.0 -0.02 - (`DarkGrey NIL - +20.0 -20.0 0 - +20.0 +20.0 0 - -20.0 +20.0 0 - -20.0 -20.0 0 ) - (`White NIL - +10.0 -1.0 0 - +10.0 +1.0 0 - -10.0 +1.0 0 - -10.0 -1.0 0 ) ) ) - -(model This - '(runway3 -40.0 -200.0 -0.02 - (`DarkGrey NIL - +20.0 -20.0 0 - +20.0 +20.0 0 - -20.0 +20.0 0 - -20.0 -20.0 0 ) - (`White NIL - +10.0 -1.0 0 - +10.0 +1.0 0 - -10.0 +1.0 0 - -10.0 -1.0 0 ) ) ) - -(model This - '(runway4 0.0 -200.0 -0.02 - (`DarkGrey NIL - +20.0 -20.0 0 - +20.0 +20.0 0 - -20.0 +20.0 0 - -20.0 -20.0 0 ) - (`White NIL - +10.0 -1.0 0 - +10.0 +1.0 0 - -10.0 +1.0 0 - -10.0 -1.0 0 ) ) ) - -(model This - '(runway5 +40.0 -200.0 -0.02 - (`DarkGrey NIL - +20.0 -20.0 0 - +20.0 +20.0 0 - -20.0 +20.0 0 - -20.0 -20.0 0 ) - (`White NIL - +10.0 -1.0 0 - +10.0 +1.0 0 - -10.0 +1.0 0 - -10.0 -1.0 0 ) ) ) - -(model This - '(runway6 +80.0 -200.0 -0.02 - (`DarkGrey NIL - +20.0 -20.0 0 - +20.0 +20.0 0 - -20.0 +20.0 0 - -20.0 -20.0 0 ) - (`White NIL - +10.0 -1.0 0 - +10.0 +1.0 0 - -10.0 +1.0 0 - -10.0 -1.0 0 ) ) ) - -(model This - '(runway7 +120.0 -200.0 -0.02 - (`DarkGrey NIL - +20.0 -20.0 0 - +20.0 +20.0 0 - -20.0 +20.0 0 - -20.0 -20.0 0 ) - (`White NIL - +10.0 -1.0 0 - +10.0 +1.0 0 - -10.0 +1.0 0 - -10.0 -1.0 0 ) ) ) - -(=: env - (list - (: runway1) - (: runway2) - (: runway3) - (: runway4) - (: runway5) - (: runway6) - (: runway7) ) ) diff --git a/rcsim/fokker.l b/rcsim/fokker.l @@ -1,456 +0,0 @@ -# 01feb05abu -# (c) Software Lab. Alexander Burger - -(=: mass 910.0) # kg -(=: power 3924.0) # N -(=: rc -1.4) # kg/m -(=: lc -250.0) # kg/m -(=: trim 30) # Trimmung -(=: lim1 0.8) # tan(a) -(=: lim2 0.24) -(=: tx 1.2) # Touchdown -(=: tz -1.9) -(=: pitch 0.26) -(=: torq -10000.0) # Drehmoment -(=: stab (0.01 0.01 0.02)) # Stabilitaet - -(model This - '(body 0.0 0.0 1.50 - # Flaeche oben - (`Blue `Blue - -0.15 +0.30 +1.05 - +1.20 0.00 +1.05 - +1.20 +3.90 +1.05 - +0.90 +4.20 +1.05 - -0.20 +3.90 +1.05 - -0.60 +2.20 +1.05 - -0.60 +0.60 +1.05 ) - (`Blue `Blue - -0.60 -0.60 +1.05 - -0.60 -2.20 +1.05 - -0.20 -3.90 +1.05 - +0.90 -4.20 +1.05 - +1.20 -3.90 +1.05 - +1.20 0.00 +1.05 - -0.15 -0.30 +1.05 ) - (`Blue `Blue - +1.20 0.00 +1.05 - -0.15 -0.30 +1.05 - -0.15 +0.30 +1.05 ) - - # Querruder - (rightAileron -0.60 +2.20 +1.05 - (`Red `Red - +0.40 +1.70 0.00 - +0.72 +1.78 0.00 - +0.72 +1.90 0.00 - +0.40 +2.10 0.00 - 0.00 +1.80 0.00 - 0.00 +1.70 0.00 ) - (`Red `Red - +0.40 +1.70 0.00 - 0.00 +1.70 0.00 - 0.00 0.00 0.00 ) ) - (leftAileron -0.60 -2.20 +1.05 - (`Red `Red - +0.40 -1.70 0.00 - +0.72 -1.78 0.00 - +0.72 -1.90 0.00 - +0.40 -2.10 0.00 - 0.00 -1.80 0.00 - 0.00 -1.70 0.00 ) - (`Red `Red - +0.40 -1.70 0.00 - 0.00 -1.70 0.00 - 0.00 0.00 0.00 ) ) - - # Flaeche rechts unten - (`Blue `Blue - +0.90 +0.20 -0.60 - +0.90 +3.90 -0.30 - +0.60 +4.20 -0.30 - -0.90 +3.90 -0.30 - -0.90 +0.20 -0.60 ) - - # Flaeche links unten - (`Blue `Blue - -0.90 -0.20 -0.60 - -0.90 -3.90 -0.30 - +0.60 -4.20 -0.30 - +0.90 -3.90 -0.30 - +0.90 -0.20 -0.60 ) - - # Streben links - (`Brown `Brown - -0.20 -2.55 +1.05 - -0.50 -2.55 -0.37 - -0.60 -2.55 -0.37 - -0.30 -2.55 +1.05 ) - - (`Brown `Brown - -0.50 -2.55 -0.37 - -0.50 -2.55 -0.37 - +0.80 -2.55 +0.90 - +0.80 -2.55 +1.05 ) - - (`Brown `Brown - +0.90 -2.55 +1.05 - +0.60 -2.55 -0.37 - +0.50 -2.55 -0.37 - +0.80 -2.55 +1.05 ) - - # Streben rechts - (`Brown `Brown - -0.20 +2.55 +1.05 - -0.50 +2.55 -0.37 - -0.60 +2.55 -0.37 - -0.30 +2.55 +1.05 ) - - (`Brown `Brown - -0.50 +2.55 -0.37 - -0.50 +2.55 -0.37 - +0.80 +2.55 +0.90 - +0.80 +2.55 +1.05 ) - - (`Brown `Brown - +0.90 +2.55 +1.05 - +0.60 +2.55 -0.37 - +0.50 +2.55 -0.37 - +0.80 +2.55 +1.05 ) - - # Motorlager - (`Grey NIL - +1.80 +0.30 +0.30 - +1.80 -0.30 +0.30 - +1.80 -0.30 -0.30 - +1.80 +0.30 -0.30 ) - - # Rumpfnase - (`Blue NIL - +1.20 0.00 +0.60 - +1.80 -0.30 +0.30 - +1.80 +0.30 +0.30 ) - (`Blue NIL - +1.20 0.00 +0.60 - +1.20 -0.45 +0.30 - +1.80 -0.30 +0.30 ) - (`Blue NIL - +1.80 +0.30 +0.30 - +1.20 +0.45 +0.30 - +1.20 0.00 +0.60 ) - (`Blue NIL - +1.20 -0.45 +0.30 - +1.20 -0.45 -0.30 - +1.80 -0.30 -0.30 - +1.80 -0.30 +0.30 ) - (`Blue NIL - +1.80 +0.30 +0.30 - +1.80 +0.30 -0.30 - +1.20 +0.45 -0.30 - +1.20 +0.45 +0.30 ) - (`Blue NIL - +1.20 -0.45 -0.30 - +1.20 -0.30 -0.60 - +1.80 -0.30 -0.30 ) - (`Blue NIL - +1.80 +0.30 -0.30 - +1.20 +0.30 -0.60 - +1.20 +0.45 -0.30 ) - (`Blue NIL - +1.20 -0.30 -0.60 - +1.20 +0.30 -0.60 - +1.80 +0.30 -0.30 - +1.80 -0.30 -0.30 ) - - # Rumpfseite rechts - (`Red NIL - +1.20 +0.45 +0.30 - +1.20 +0.45 -0.30 - -1.50 +0.45 -0.30 - -1.50 +0.45 +0.30 - -1.20 +0.45 +0.45 - -0.90 +0.45 +0.45 ) - (`Red NIL - -1.50 +0.45 +0.30 - -1.50 +0.45 -0.30 - -4.80 0.00 -0.30 - -4.80 0.00 0.00 ) - - # Rumpfseite links - (`Red NIL - -0.90 -0.45 +0.45 - -1.20 -0.45 +0.45 - -1.50 -0.45 +0.30 - -1.50 -0.45 -0.30 - +1.20 -0.45 -0.30 - +1.20 -0.45 +0.30 ) - (`Red NIL - -4.80 0.00 0.00 - -4.80 0.00 -0.30 - -1.50 -0.45 -0.30 - -1.50 -0.45 +0.30 ) - - # Rumpfoberteil vorne - (`Red NIL - +1.20 0.00 +0.60 - +1.20 +0.45 +0.30 - -0.90 +0.45 +0.45 - -0.60 0.00 +0.60 ) - (`Red NIL - -0.60 0.00 +0.60 - -0.90 -0.45 +0.45 - +1.20 -0.45 +0.30 - +1.20 0.00 +0.60 ) - - # Cockpit - (`Brown NIL - -0.60 0.00 +0.60 - -0.90 +0.45 +0.45 - -0.90 -0.45 +0.45 ) - (`Black NIL - -0.90 +0.45 +0.45 - -1.20 +0.45 +0.45 - -1.20 -0.45 +0.45 - -0.90 -0.45 +0.45 ) - (`Black NIL - -1.20 +0.45 +0.45 - -1.35 0.00 +0.54 - -1.20 -0.45 +0.45 ) - - # Rumpfoberteil hinten - (`Red NIL - -1.35 0.00 +0.54 - -1.20 +0.45 +0.45 - -4.80 0.00 0.00 ) - (`Red NIL - -1.20 +0.45 +0.45 - -1.50 +0.45 +0.30 - -4.80 0.00 0.00 ) - (`Red NIL - -4.80 0.00 0.00 - -1.20 -0.45 +0.45 - -1.35 0.00 +0.54 ) - (`Red NIL - -4.80 0.00 0.00 - -1.50 -0.45 +0.30 - -1.20 -0.45 +0.45 ) - - # Rumpfboden - (`Red NIL - +1.20 +0.45 -0.30 - +1.20 +0.30 -0.60 - -1.50 +0.30 -0.60 - -1.50 +0.45 -0.30 ) - (`Red NIL - +1.20 +0.30 -0.60 - +1.20 -0.30 -0.60 - -1.50 -0.30 -0.60 - -1.50 +0.30 -0.60 ) - (`Red NIL - -1.50 -0.45 -0.30 - -1.50 -0.30 -0.60 - +1.20 -0.30 -0.60 - +1.20 -0.45 -0.30 ) - (`Red NIL - -4.80 0.00 -0.30 - -1.50 -0.30 -0.60 - -1.50 -0.45 -0.30 ) - (`Red NIL - -4.80 0.00 -0.30 - -1.50 +0.30 -0.60 - -1.50 -0.30 -0.60 ) - (`Red NIL - -1.50 +0.45 -0.30 - -1.50 +0.30 -0.60 - -4.80 0.00 -0.30 ) - - # Hoehenleitwerk - (`Red `Red - -3.60 +0.15 0.00 - -4.20 +1.80 0.00 - -4.50 +1.80 0.00 - -4.50 +0.06 0.00 ) - (`Red `Red - -4.50 -0.06 0.00 - -4.50 -1.80 0.00 - -4.20 -1.80 0.00 - -3.60 -0.15 0.00 ) - - # Hoehenruder - (elevator -4.50 0.00 0.00 - (`Blue `Blue - 0.00 +1.80 0.00 - -0.60 +1.50 0.00 - -0.60 +0.60 0.00 - 0.00 +0.06 0.00 ) - (`Blue `Blue - 0.00 -0.06 0.00 - -0.60 -0.60 0.00 - -0.60 -1.50 0.00 - 0.00 -1.80 0.00 ) ) - - # Seitenleitwerk - (`Red `Red - -4.80 0.00 0.00 - -3.60 0.00 +0.15 - -4.20 0.00 +0.90 - -4.80 0.00 +1.05 ) - - # Seitenruder - (rudder -4.80 0.00 0.00 - (`Blue `Blue - 0.00 0.00 +1.05 - 0.00 0.00 -0.30 - -0.45 0.00 +0.30 - -0.45 0.00 +0.90 ) ) - - # Schatten Nase - (NIL T - +0.90 -0.30 -0.20 - +1.70 0.00 -0.20 - +0.90 +0.30 -0.20 ) - - # Schatten Flaechen - (NIL T - +0.90 -3.00 -0.20 - +0.90 +3.00 -0.20 - -0.90 +3.00 -0.20 - -0.90 -3.00 -0.20 ) - - # Schatten Rumpf - (NIL T - -0.90 -0.40 -0.20 - -0.90 +0.40 -0.20 - -4.70 0.00 -0.20 ) - - # Schatten Leitwerk - (NIL T - -3.60 0.00 -0.20 - -4.20 +1.80 -0.20 - -4.50 +1.80 -0.20 - -4.50 -1.80 -0.20 - -4.20 -1.80 -0.20 ) - - # Spinner - (`Blue NIL - +1.80 +0.15 -0.15 - +1.80 +0.15 +0.15 - +2.10 0.00 0.00 ) - (`Blue NIL - +1.80 -0.15 -0.15 - +1.80 +0.15 -0.15 - +2.10 0.00 0.00 ) - (`Blue NIL - +1.80 -0.15 +0.15 - +1.80 -0.15 -0.15 - +2.10 0.00 0.00 ) - (`Blue NIL - +1.80 +0.15 +0.15 - +1.80 -0.15 +0.15 - +2.10 0.00 0.00 ) - - # Fahrwerk - (`Grey `Grey - +1.20 +0.30 -0.60 - +1.20 +0.90 -1.47 - +1.20 +1.00 -1.47 - +1.20 +0.40 -0.60 ) - (`Grey `Grey - +1.20 -0.30 -0.60 - +1.20 -0.90 -1.47 - +1.20 -1.00 -1.47 - +1.20 -0.40 -0.60 ) - (`Grey `Grey - +1.20 -1.20 -1.47 - +1.20 -1.20 -1.53 - +1.20 +1.20 -1.53 - +1.20 +1.20 -1.47 ) - (`Grey `Grey - +1.20 +0.90 -1.53 - +1.20 +0.90 -1.47 - +0.30 +0.30 -0.60 - +0.18 +0.30 -0.60 ) - (`Grey `Grey - +1.20 -0.90 -1.53 - +1.20 -0.90 -1.47 - +0.30 -0.30 -0.60 - +0.18 -0.30 -0.60 ) - - # Rad rechts - (`Yellow `Yellow - +1.20 +1.20 -1.20 - +1.38 +1.20 -1.25 - +1.50 +1.20 -1.37 - +1.55 +1.20 -1.55 - +1.50 +1.20 -1.73 - +1.38 +1.20 -1.85 - +1.20 +1.20 -1.90 - +1.02 +1.20 -1.85 - +0.90 +1.20 -1.72 - +0.85 +1.20 -1.55 - +0.90 +1.20 -1.37 - +1.02 +1.20 -1.25 ) - - # Schatten Rad rechts - (NIL T - +1.60 +1.00 -1.55 - +1.60 +1.40 -1.55 - +0.80 +1.40 -1.55 - +0.80 +1.00 -1.55 ) - - # Rad links - (`Yellow `Yellow - +1.20 -1.20 -1.20 - +1.38 -1.20 -1.25 - +1.50 -1.20 -1.37 - +1.55 -1.20 -1.55 - +1.50 -1.20 -1.73 - +1.38 -1.20 -1.85 - +1.20 -1.20 -1.90 - +1.02 -1.20 -1.85 - +0.90 -1.20 -1.72 - +0.85 -1.20 -1.55 - +0.90 -1.20 -1.37 - +1.02 -1.20 -1.25 ) - - # Schatten Rad links - (NIL T - +1.60 -1.00 -1.55 - +1.60 -1.40 -1.55 - +0.80 -1.40 -1.55 - +0.80 -1.00 -1.55 ) - - # Latte - (propeller +1.95 0.00 0.00) ) ) - -(model This - '(blade +1.95 0.00 0.00 - (`Black `Black - -0.05 0.00 0.00 - +0.05 0.00 0.00 - +0.02 +0.40 -0.50 - +0.00 +0.90 -0.90 - -0.02 +0.50 -0.40 - -0.05 0.00 0.00 - -0.02 -0.50 +0.40 - +0.00 -0.90 +0.90 - +0.02 -0.40 +0.50 - +0.05 0.00 0.00 ) ) ) - -(model This - '(disk +1.95 0.00 0.00 - (NIL NIL - +0.00 -0.30 +1.20 - +0.00 -0.90 +0.90 - +0.00 -1.20 +0.30 - +0.00 -1.20 -0.30 - +0.00 -0.90 -0.90 - +0.00 -0.30 -1.20 - +0.00 +0.30 -1.20 - +0.00 +0.90 -0.90 - +0.00 +1.20 -0.30 - +0.00 +1.20 +0.30 - +0.00 +0.90 +0.90 - +0.00 +0.30 +1.20 ) ) ) - -(z3d:Yrot 0.26 (: body)) diff --git a/rcsim/lib.l b/rcsim/lib.l @@ -1,296 +0,0 @@ -# 29mar13abu -# (c) Software Lab. Alexander Burger - -# *Pilot *Scene *Model -# *DT *Thr *Speed *Climb *Alt - -(scl 6) # Keep in sync with `SCL' in "src/z3d.c" - -# Color Constant Definitions from "/usr/lib/X11/rgb.txt" -(de rgb (R G B . S) - (def S (+ B (* G 256) (* R 65536))) ) - -(rgb 0 0 0 . Black) -(rgb 0 0 255 . Blue) -(rgb 165 42 42 . Brown) -(rgb 0 100 0 . DarkGreen) -(rgb 169 169 169 . DarkGrey) -(rgb 190 190 190 . Grey) -(rgb 173 216 230 . LightBlue) -(rgb 255 0 0 . Red) -(rgb 255 255 0 . Yellow) - -(rgb 255 255 255 . White) - - -# Create model -(de model (Obj Lst) - (let X Obj - (while (sym? (cadr Lst)) - (setq X (get X (pop 'Lst))) ) - (unless X - (quit "Can't attach (sub)model" (car Lst)) ) - (prog1 - (put X (pop 'Lst) (box)) - (set @ - (conc - (cut 3 'Lst) - (cons - 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 - (mapcar - '((M) - (if (and (car M) (sym? @)) - (model Obj M) - M ) ) - Lst ) ) ) ) ) ) ) - -# Simulation -(de *DT . 0.020) -(de *Tower . 12.0) - -(de start () - (task -20 0 (simulate)) - (setq "Time" (time)) ) - -(de stop () - (task -20) ) - -(de draw () - (at (0 . 100) - (let N (time) - (rate> *Pilot (- N "Time")) - (setq "Time" N) ) ) - (draw> *Scene) ) - -(de simulate () - (sim> *Scene) - (sim> *Model) ) - -(de MUL Args - (let D 1.0 - (make - (link '*/ (pop 'Args) (pop 'Args)) - (while Args - (setq D (* D 1.0)) - (link (pop 'Args)) ) - (link D) ) ) ) - -(de dist (X Y) - (sqrt (+ (* X X) (* Y Y))) ) - -(de damp ("Var" Val) - (set "Var" (>> 1 (+ Val (val "Var")))) ) - -(de doppler (F X Y VX VY) - (let N (dist X Y) - (if (=0 N) - F - (- F - (*/ F - (+ `(MUL X VX) `(MUL Y VY)) - (* N 150) ) ) ) ) ) - - -(class +Model) -# mass power rc lc limit tx tz pitch torq stab -# body leftAileron rightAileron rudder elevator propeller blade disk -# ele ail rud thr thrust vx vy vz fx fy fz dx dy dz - -(dm T () - (load "rcsim/fokker.l") - (=: ele (=: ail (=: rud (=: thr (=: thrust 0))))) - (=: vx (=: vy (=: vz 0))) - (=: fx (=: fy (=: fz 0))) - (=: dx (=: dy (=: dz 0))) - (set (: body 0) - (- (: body 0 1) 100.0) ) - (set (: body 0 -1) - (- (: body 0 2) 200.0) ) - (blade> This) ) - -(dm dir> () - (let B (val (: body)) - (z3d:Spot - (+ (car B) (>> 3 (: vx)) (>> 2 (: vz))) - (+ (cadr B) (>> 3 (: vy)) (>> 2 (: vz))) - (+ (caddr B) (>> 3 (: vz)) (>> 2 (: vz))) - 0 0 *Tower ) ) ) - -(dm blade> () - (set (: propeller) (val (: blade))) ) - -(dm disk> () - (set (: propeller) (val (: disk))) ) - - -(dm down> () - (when (> (: ele) -100) - (dec (:: ele) 20) - (z3d:Arot +0.2 (: elevator)) ) ) - -(dm up> () - (when (> 100 (: ele)) - (inc (:: ele) 20) - (z3d:Arot -0.2 (: elevator)) ) ) - -(dm left> () - (when (> (: ail) -100) - (dec (:: ail) 20) - (dec (:: rud) 20) - (z3d:Arot +0.2 (: leftAileron)) - (z3d:Arot +0.2 (: rightAileron)) - (z3d:Arot +0.2 (: rudder)) ) ) - -(dm right> () - (when (> 100 (: ail)) - (inc (:: ail) 20) - (inc (:: rud) 20) - (z3d:Arot -0.2 (: leftAileron)) - (z3d:Arot -0.2 (: rightAileron)) - (z3d:Arot -0.2 (: rudder)) ) ) - -(dm throt> (X) - (=: thr - (cond - ((not X) 0) - ((=T X) 100) - ((lt0 X) (max 10 (- (: thr) 25))) - ((=0 (: thr)) 10) - ((= 10 (: thr)) 25) - (T (min 100 (+ 25 (: thr)))) ) ) ) - -(dm sim> () - (cond - ((gt0 (: ele)) - (dec (:: ele)) - (z3d:Arot +0.01 (: elevator)) ) - ((lt0 (: ele)) - (inc (:: ele)) - (z3d:Arot -0.01 (: elevator)) ) ) - (cond - ((gt0 (: ail)) - (dec (:: ail)) - (dec (:: rud)) - (z3d:Arot +0.01 (: leftAileron)) - (z3d:Arot +0.01 (: rightAileron)) - (z3d:Arot +0.01 (: rudder)) ) - ((lt0 (: ail)) - (inc (:: ail)) - (inc (:: rud)) - (z3d:Arot -0.01 (: leftAileron)) - (z3d:Arot -0.01 (: rightAileron)) - (z3d:Arot -0.01 (: rudder)) ) ) - (cond - ((> (: thr) (: thrust)) - (inc (:: thrust)) ) - ((> (: thrust) (: thr)) - (dec (:: thrust)) ) ) - (if (> 20 (: thrust)) - (blade> This) - (disk> This) ) - (unless (=0 (: thrust)) - (z3d:Xrot 0.2 (: propeller)) ) - (use (Touch VX VY VZ Body Taxi Stick A FX FY FZ DX DY DZ) - (z3d:Rotate (: tx) 0 (: tz) (: body) NIL NIL 'Touch) - (z3d:Rotate (: vx) (: vy) (: vz) (: body) 'VX 'VY 'VZ T) - (setq - Body (val (: body)) - Taxi (> 0.1 (+ (caddr Body) Touch)) - Stick (>= 1.0 (+ VX VY)) - FX (+ (*/ (: thrust) (: power) 100) `(MUL (: rc) VX (abs VX))) - FZ (+ - (cond - ((> 0.1 VX) 0) - ((> (abs (setq A (*/ 1.0 VZ VX))) (: lim2)) - 0 ) - ((>= (: lim1) A) - `(MUL VX VX (: lc) A) ) - (T `(MUL VX VX (: lc) (- (: lim2) A))) ) - `(MUL 8.0 (: rc) VZ (abs VZ)) ) ) - - (ifn Taxi - (setq FY `(MUL 4.0 (: rc) VY (abs VY))) - (let F (>> 2 (: mass)) - (cond - ((> 0.1 (abs VX)) - (and (>= F FX) (zero FX)) ) - ((gt0 VX) - (dec 'FX F) ) - (T (inc 'FX F)) ) - (setq FY (if (lt0 VY) (* 12 F) (* -12 F))) ) - (z3d:Yrot - (>> 3 (- (: pitch) (get Body 6))) # rot.a.z - (: body) ) ) - (unless Stick - (z3d:Yrot - (+ - (*/ VX (+ (: ele) (: trim)) 80000) - `(MUL VZ (: stab 2)) ) - (: body) ) - (if Taxi - (prog - (z3d:Zrot (*/ VX (: rud) 80000) (: body)) - (z3d:Xrot (get Body 9) (: body)) ) # rot.b.z - (z3d:Xrot # roll - (+ - (- (*/ VX (: ail) 80000) (/ VY 400)) - (*/ (: thrust) (: torq) (: mass)) - `(MUL (get Body 9) (: stab 1)) ) # rot.b.z - (: body) ) - (z3d:Zrot - (+ - (*/ VX (: rud) 80000) - `(MUL VY (: stab 3)) ) - (: body) ) ) ) - - # World system - (z3d:Rotate FX FY FZ (: body) 'FX 'FY 'FZ) - (dec 'FZ `(MUL (: mass) 9.81)) - - # Accelerate - (setq - A (*/ 1.0 *DT (: mass)) - DX `(MUL A (damp (:: fx) FX)) - DY `(MUL A (damp (:: fy) FY)) - DZ `(MUL A (damp (:: fz) FZ)) ) - (if (and Stick (> 0.001 (+ `(MUL DX DX) `(MUL DY DY)))) - (=: vx (=: vy (=: dx (=: dy 0)))) - (inc (:: vx) (damp (:: dx) DX)) - (inc (:: vy) (damp (:: dy) DY)) ) - (inc (:: vz) (damp (:: dz) DZ)) - (when (and Taxi (lt0 (: vz))) - (when (> -6.0 (: vz)) - (=: thr (=: thrust 0)) - (=: vx (=: vy 0)) - (blade> This) ) - (set (cddr Body) (- Touch)) - (=: vz 0) ) - - # Translate - (inc Body `(MUL (: vx) *DT)) - (inc (cdr Body) `(MUL (: vy) *DT)) - (inc (cddr Body) `(MUL (: vz) *DT)) - - # Sound/Display - (tone> *Scene - (max 0 - (- 100 - (/ (dist (car Body) (cadr Body)) 40.0) ) ) - (cond - ((=0 (: thrust)) 0) - ((> 22 (: thrust)) 11) - (T - (doppler - (>> 1 (+ (: thrust) (/ VX 0.5))) - (car Body) - (cadr Body) - (: vx) - (: vy) ) ) ) ) - (unless (= *Thr (: thr)) - (thr> *Pilot (setq *Thr (: thr))) ) - (unless (= *Speed (setq A (*/ VX 3.6 `(* 1.0 1.0)))) - (speed> *Pilot (setq *Speed A)) ) - (unless (= *Climb (setq A (/ (: vz) 1.0))) - (climb> *Pilot (setq *Climb A)) ) - (unless (= *Alt (setq A (/ (caddr Body) 1.0))) - (alt> *Pilot (setq *Alt A)) ) ) ) diff --git a/rcsim/main.l b/rcsim/main.l @@ -1,124 +0,0 @@ -# 24jul07abu -# (c) Software Lab. Alexander Burger - -# *Sock *Panel *FocLen - -(load "lib/term.l") -(load "rcsim/lib.l") - - -(de main () - (setq - *FocLen 8000.0 - *Pilot (new '(+Pilot)) - *Scene (new '(+Scene)) - *Model (new '(+Model)) - *Panel (list - 0 " % " - 0 " km/h " - 0 " m/s " - 0 " m " - NIL ) ) - (push1 '*Bye '(tone> *Scene 0 0)) ) - -(de setPanel (N X) - (set (nth *Panel N) X) - (prinl *Panel) ) - -(de go () - (out (setq *Sock (listen (port 8080) 120000)) - (pr 800 600) ) - (start) - (draw) - (task *Sock - (in *Sock - (case (rd) - (`(char "o") # ok - (draw) ) - (`(char "c") # clk - (rd) (rd) ) ) ) ) ) - -# Key Controls -(fkey *XtIns - (when (> 32000.0 *FocLen) - (setq *FocLen (>> -1 *FocLen)) ) ) - -(fkey *XtDel - (when (> *FocLen 2000.0) - (setq *FocLen (>> 1 *FocLen)) ) ) - -(fkey *XtUp - (down> *Model) ) - -(fkey *XtDown - (up> *Model) ) - -(fkey *XtLeft - (left> *Model) ) - -(fkey *XtRight - (right> *Model) ) - -(fkey *XtHome - (throt> *Model T) ) - -(fkey *XtPgDn - (throt> *Model -1) ) - -(fkey *XtPgUp - (throt> *Model +1) ) - -(fkey *XtEnd - (throt> *Model) ) - -(fkey *XtF3 ~(get (fkey) *XtDel)) -(fkey *XtF4 ~(get (fkey) *XtIns)) -(fkey *XtF5 ~(get (fkey) *XtEnd)) -(fkey *XtF6 ~(get (fkey) *XtPgDn)) -(fkey *XtF7 ~(get (fkey) *XtPgUp)) -(fkey *XtF8 ~(get (fkey) *XtHome)) - - -# Pilot -(class +Pilot) - -(dm thr> (N) - (setPanel 1 N) ) - -(dm speed> (N) - (setPanel 3 N) ) - -(dm climb> (N) - (setPanel 5 N) ) - -(dm alt> (N) - (setPanel 7 N) ) - -(dm rate> (N) - (setPanel 9 (pack (format N 2) " s")) ) - - -# Scene -(class +Scene) -# env tone - -(dm T () - (load "rcsim/env.l") - (when (call 'test "-p" "fifo/tone") - (=: tone (open "fifo/tone")) ) ) - -(dm sim> ()) - -(dm draw> () - (out *Sock - (let Dir (dir> *Model) - (z3d:Draw *FocLen (car Dir) (cdr Dir) 0 0 *Tower LightBlue DarkGreen) - (z3d:Draw (get *Model 'body)) - (mapc z3d:Draw (: env)) - (z3d:Draw) ) ) ) - -(dm tone> (A F) - (when (: tone) - (out @ (pr A (*/ F 22 10))) ) ) - -# vi:et:ts=3:sw=3 diff --git a/rcsim/tone b/rcsim/tone @@ -1,41 +0,0 @@ -#!bin/picolisp lib.l -# 13oct06abu -# (c) Software Lab. Alexander Burger - -# Must be run on a virtual console - -(load "lib/misc.l" "lib/gcc.l") - -### 'ioctl' glue function -(gcc "tst" NIL 'tone) - -#include <sys/ioctl.h> -#include <linux/kd.h> // KIOCSOUND - -// (tone 'freq) -> flg -any tone(any ex) { - long amp = evCnt(ex,cdr(ex)); - long freq = evCnt(ex,cddr(ex)); - - return ioctl(0, KIOCSOUND, amp==0 || freq==0? 0 : 1193180L/freq) < 0? Nil : T; -} - -/**/ - -### Create named pipe -(unless (call 'test "-p" "fifo/tone") - (call 'mkdir "-p" "fifo") - (call 'mkfifo "fifo/tone") ) - -(push1 '*Bye '(call 'rm "fifo/tone")) - - -### Serve calls like: -# (setq *Tone (open "fifo/tone")) -# (out *Tone (pr 100 440)) # 440 Hz -# (out *Tone (pr 0 0)) # Off -# (close *Tone) -(loop - (in "fifo/tone" - (while (rd) - (tone @ (rd)) ) ) ) diff --git a/src/Makefile b/src/Makefile @@ -1,4 +1,4 @@ -# 05nov12abu +# 01apr13abu # 27feb08rdo # (c) Software Lab. Alexander Burger @@ -65,18 +65,17 @@ endif endif -picolisp: $(bin)/picolisp $(lib)/ext$(dll) $(lib)/ht$(dll) $(lib)/z3d$(dll) +picolisp: $(bin)/picolisp $(lib)/ext$(dll) $(lib)/ht$(dll) tools: $(bin)/lat1 $(bin)/utf2 $(bin)/balance gate: $(bin)/ssl $(bin)/httpGate -x11: $(bin)/z3dClient -all: picolisp tools gate x11 +all: picolisp tools gate .c.o: gcc $(CFLAGS) -D_OS='"$(OS)"' $*.c -$(picoFiles:.c=.o) ext.o ht.o z3d.o: pico.h +$(picoFiles:.c=.o) ext.o ht.o: pico.h main.o: vers.h @@ -109,10 +108,6 @@ $(lib)/ht$(dll): ht.o gcc -o $(lib)/ht$(dll) $(DYNAMIC-LIB-FLAGS) ht.o $(DLL-DEFS) $(STRIP) $(lib)/ht$(dll) -$(lib)/z3d$(dll): z3d.o - gcc -o $(lib)/z3d$(dll) $(DYNAMIC-LIB-FLAGS) z3d.o $(DLL-DEFS) - $(STRIP) $(lib)/z3d$(dll) - $(bin)/lat1: lat1.c gcc -o $(bin)/lat1$(exe) lat1.c @@ -134,10 +129,6 @@ $(bin)/httpGate: httpGate.c gcc -o $(bin)/httpGate$(exe) httpGate.c -lssl -lcrypto $(STRIP) $(bin)/httpGate$(exe) -$(bin)/z3dClient: z3dClient.c - gcc -o $(bin)/z3dClient$(exe) z3dClient.c -L/usr/X11R6/lib -lXext -lX11 - $(STRIP) $(bin)/z3dClient$(exe) - # Clean up clean: diff --git a/src/vers.h b/src/vers.h @@ -1 +1 @@ -static byte Version[4] = {3,1,2,1}; +static byte Version[4] = {3,1,2,2}; diff --git a/src/z3d.c b/src/z3d.c @@ -1,468 +0,0 @@ -/* 22apr08abu - * (c) Software Lab. Alexander Burger - */ - -#include "pico.h" - -#define SCL 1000000.0 - -typedef struct {double x, y, z;} vector; -typedef struct {vector a, b, c;} matrix; - -static bool Snap; -static int SnapD, Snap1h, Snap1v, Snap2h, Snap2v; -static double FocLen, PosX, PosY, PosZ, Pos6, Pos9, SnapX, SnapY, SnapZ; -static double Coeff1, Coeff2, Coeff4, Coeff5, Coeff6, Coeff7, Coeff8, Coeff9; - - -static any getVector(any lst, vector *dst) { - dst->x = numToDouble(car(lst)) / SCL, lst = cdr(lst); - dst->y = numToDouble(car(lst)) / SCL, lst = cdr(lst); - dst->z = numToDouble(car(lst)) / SCL; - return cdr(lst); -} - -static any putVector(vector *src, any lst) { - car(lst) = doubleToNum(src->x * SCL), lst = cdr(lst); - car(lst) = doubleToNum(src->y * SCL), lst = cdr(lst); - car(lst) = doubleToNum(src->z * SCL); - return cdr(lst); -} - -static any getMatrix(any lst, matrix *dst) { - return getVector(getVector(getVector(lst, &dst->a), &dst->b), &dst->c); -} - -static any putMatrix(matrix *src, any lst) { - return putVector(&src->c, putVector(&src->b, putVector(&src->a, lst))); -} - -static void xrot(matrix *p, double ca, double sa) { - matrix m = *p; - - p->b.x = ca * m.b.x - sa * m.c.x; - p->b.y = ca * m.b.y - sa * m.c.y; - p->b.z = ca * m.b.z - sa * m.c.z; - p->c.x = sa * m.b.x + ca * m.c.x; - p->c.y = sa * m.b.y + ca * m.c.y; - p->c.z = sa * m.b.z + ca * m.c.z; -} - -// (z3d:Xrot 'angle 'model) -> T -any Xrot(any ex) { - any x; - double a; - matrix m; - - a = evDouble(ex, x = cdr(ex)) / SCL; - x = EVAL(cadr(x)); - Touch(ex,x); - x = cdddr(val(x)); - getMatrix(x, &m), xrot(&m, cos(a), sin(a)), putMatrix(&m, x); - return T; -} - -static void yrot(matrix *p, double ca, double sa) { - matrix m = *p; - - p->a.x = ca * m.a.x + sa * m.c.x; - p->a.y = ca * m.a.y + sa * m.c.y; - p->a.z = ca * m.a.z + sa * m.c.z; - p->c.x = ca * m.c.x - sa * m.a.x; - p->c.y = ca * m.c.y - sa * m.a.y; - p->c.z = ca * m.c.z - sa * m.a.z; -} - -// (z3d:Yrot 'angle 'model) -> T -any Yrot(any ex) { - any x; - double a; - matrix m; - - a = evDouble(ex, x = cdr(ex)) / SCL; - x = EVAL(cadr(x)); - Touch(ex,x); - x = cdddr(val(x)); - getMatrix(x, &m), yrot(&m, cos(a), sin(a)), putMatrix(&m, x); - return T; -} - -static void zrot(matrix *p, double ca, double sa) { - matrix m = *p; - - p->a.x = ca * m.a.x + sa * m.b.x; - p->a.y = ca * m.a.y + sa * m.b.y; - p->a.z = ca * m.a.z + sa * m.b.z; - p->b.x = ca * m.b.x - sa * m.a.x; - p->b.y = ca * m.b.y - sa * m.a.y; - p->b.z = ca * m.b.z - sa * m.a.z; -} - -// (z3d:Zrot 'angle 'model) -> T -any Zrot(any ex) { - any x; - double a; - matrix m; - - a = evDouble(ex, x = cdr(ex)) / SCL; - x = EVAL(cadr(x)); - Touch(ex,x); - x = cdddr(val(x)); - getMatrix(x, &m), zrot(&m, cos(a), sin(a)), putMatrix(&m, x); - return T; -} - -// (z3d:Arot 'angle 'model) -> T -any Arot(any ex) { - any x; - double a, n; - matrix m; - vector pt; - - a = evDouble(ex, x = cdr(ex)) / SCL; - x = EVAL(cadr(x)); - Touch(ex,x); - x = cdddr(val(x)); - getVector(cddar(getMatrix(x, &m)), &pt); - n = sqrt(pt.x*pt.x + pt.y*pt.y + pt.z*pt.z); - pt.x /= n, pt.y /= n, pt.z /= n; // Axis unit vector - if ((n = sqrt(pt.y*pt.y + pt.z*pt.z)) == 0.0) // Axis parallel to x-axis - a *= pt.x, xrot(&m, cos(a), sin(a)); - else { - xrot(&m, pt.z/n, -pt.y/n); - yrot(&m, n, pt.x); - zrot(&m, cos(a), sin(a)); - yrot(&m, n, -pt.x); - xrot(&m, pt.z/n, pt.y/n); - } - putMatrix(&m, x); - return T; -} - -// (z3d:Rotate 'X 'Y 'Z 'model 'varX 'varY 'varZ ['flg]) -> T -any Rotate(any ex) { - any x; - double vx, vy, vz; - matrix m; - cell c1, c2, c3; - - vx = evDouble(ex, x = cdr(ex)) / SCL; - vy = evDouble(ex, x = cdr(x)) / SCL; - vz = evDouble(ex, x = cdr(x)) / SCL; - x = cdr(x), getMatrix(cdddr(val(EVAL(car(x)))), &m); - x = cdr(x), Push(c1, EVAL(car(x))); - NeedVar(ex,data(c1)); - x = cdr(x), Push(c2, EVAL(car(x))); - NeedVar(ex,data(c2)); - x = cdr(x), Push(c3, EVAL(car(x))); - NeedVar(ex,data(c3)); - if (isNil(EVAL(cadr(x)))) { - if (!isNil(data(c1))) - val(data(c1)) = doubleToNum((vx * m.a.x + vy * m.b.x + vz * m.c.x) * SCL); - if (!isNil(data(c2))) - val(data(c2)) = doubleToNum((vx * m.a.y + vy * m.b.y + vz * m.c.y) * SCL); - if (!isNil(data(c3))) - val(data(c3)) = doubleToNum((vx * m.a.z + vy * m.b.z + vz * m.c.z) * SCL); - } - else { - if (!isNil(data(c1))) - val(data(c1)) = doubleToNum((vx * m.a.x + vy * m.a.y + vz * m.a.z) * SCL); - if (!isNil(data(c2))) - val(data(c2)) = doubleToNum((vx * m.b.x + vy * m.b.y + vz * m.b.z) * SCL); - if (!isNil(data(c3))) - val(data(c3)) = doubleToNum((vx * m.c.x + vy * m.c.y + vz * m.c.z) * SCL); - } - drop(c1); - return T; -} - -static void _approach(any ex, double d, any dst, any src) { - any l1, l2; - int i; - double n; - - Touch(ex,dst); - l1 = val(dst); - Fetch(ex,src); - l2 = val(src); - for (i = 0; i < 12; ++i) { - n = numToDouble(car(l1)) / SCL; - car(l1) = doubleToNum((n + d * (numToDouble(car(l2)) / SCL - n)) * SCL); - l1 = cdr(l1), l2 = cdr(l2); - } - do { - while (!isSym(car(l1))) - if (!isCell(l1 = cdr(l1))) - return; - while (!isSym(car(l2))) - if (!isCell(l2 = cdr(l2))) - return; - _approach(ex, d, car(l1), car(l2)); - } while (isCell(l1 = cdr(l1)) && isCell(l2 = cdr(l2))); -} - -// (z3d:Approach 'num 'model 'model) -> T -any Approach(any ex) { - any x; - long n; - cell c1, c2; - - n = evCnt(ex, x = cdr(ex)); - x = cdr(x), Push(c1, EVAL(car(x))); - x = cdr(x), Push(c2, EVAL(car(x))); - _approach(ex, 1.0 / (double)n, data(c1), data(c2)); - drop(c1); - return T; -} - -// (z3d:Spot 'dx 'dy 'dz ['x 'y 'z]) -> (yaw . pitch) -any Spot(any ex) { - any x; - double dx, dy, dz; - cell c1; - - dx = evDouble(ex, x = cdr(ex)) / SCL; - dy = evDouble(ex, x = cdr(x)) / SCL; - dz = evDouble(ex, x = cdr(x)) / SCL; - - if (isCell(x = cdr(x))) { - dx -= evDouble(ex, x) / SCL; - dy -= evDouble(ex, x = cdr(x)) / SCL; - dz -= evDouble(ex, x = cdr(x)) / SCL; - } - - Push(c1, doubleToNum(atan2(dy,dx) * SCL)); - dx = sqrt(dx*dx + dy*dy + dz*dz); - data(c1) = cons(data(c1), doubleToNum(dx==0.0? 0.0 : asin(dz/dx)*SCL)); - return Pop(c1); -} - -static void rotate(vector *src, matrix *p, vector *dst) { - dst->x = src->x * p->a.x + src->y * p->b.x + src->z * p->c.x; - dst->y = src->x * p->a.y + src->y * p->b.y + src->z * p->c.y; - dst->z = src->x * p->a.z + src->y * p->b.z + src->z * p->c.z; -} - -#if 0 -/* (lst -- x y z) */ -void Locate(void) { - any lst; - vector pos, v, w; - matrix rot, r; - - lst = Tos; - getMatrix(getVector(car(lst), &pos), &rot); - while (isCell(lst = cdr(lst))) { - getMatrix(getVector(car(lst), &v), &r); - rotate(&v, &rot, &w); - pos.x += w.x, pos.y += w.y, pos.z += w.z; - v = r.a, rotate(&v, &rot, &r.a); - v = r.b, rotate(&v, &rot, &r.b); - v = r.c, rotate(&v, &rot, &r.c); - rot = r; - } - Tos = doubleToNum(pos.x) * SCL; - push(doubleToNum(pos.y)) * SCL; - push(doubleToNum(pos.z)) * SCL; -} -#endif - -static void shadowPt(double vx, double vy) { - double z; - - z = Coeff7 * vx + Coeff8 * vy - Pos9; - prn((int)(FocLen * (Coeff1 * vx + Coeff2 * vy) / z)); - prn((int)(FocLen * (Coeff4 * vx + Coeff5 * vy - Pos6) / z)); - prn(num(1000.0 * z)); -} - -static void transPt(double vx, double vy, double vz) { - double x, y, z; - int h, v, dh, dv, d; - - x = Coeff1 * vx + Coeff2 * vy; - y = Coeff4 * vx + Coeff5 * vy + Coeff6 * vz; - z = Coeff7 * vx + Coeff8 * vy + Coeff9 * vz; - prn(h = (int)(FocLen * x/z)); - prn(v = (int)(FocLen * y/z)); - prn(num(1000.0 * z)); - if (Snap) { - if ((dh = h - Snap1h) < 0) - dh = -dh; - if ((dv = v - Snap1v) < 0) - dv = -dv; - if ((d = dh>dv? dh+dv*41/100-dh/24 : dv+dh*41/100-dv/24) < SnapD) { - SnapD = d; - Snap2h = h; Snap2v = v; - SnapX = vx; SnapY = vy; SnapZ = vz; - } - } -} - -static void doDraw(any ex, any mdl, matrix *r, double x, double y, double z) { - any face, c1, c2, txt; - long n, pix; - double dx, dy, dz; - vector pos, pt1, pt2, pt3, v, w, nv; - matrix rot; - - Fetch(ex,mdl); - mdl = getMatrix(getVector(val(mdl), &pos), &rot); - if (!r) - r = &rot; - else { - v = pos, rotate(&v, r, &pos); - pos.x += x, pos.y += y, pos.z += z; - v = rot.a, rotate(&v, r, &rot.a); - v = rot.b, rotate(&v, r, &rot.b); - v = rot.c, rotate(&v, r, &rot.c); - } - dx = pos.x - PosX; - dy = pos.y - PosY; - dz = pos.z - PosZ; - - if ((z = Coeff7*dx + Coeff8*dy + Coeff9*dz) < 0.1) - return; - if (z < fabs(Coeff1*dx + Coeff2*dy)) - return; - if (z < fabs(Coeff4*dx + Coeff5*dy + Coeff6*dz)) - return; - - while (isCell(mdl)) { - face = car(mdl), mdl = cdr(mdl); - if (isSym(face)) - doDraw(ex, face, &rot, pos.x, pos.y, pos.z); - else { - c1 = car(face), face = cdr(face); - c2 = car(face), face = cdr(face); - if (!isSym(car(face))) - txt = Nil; - else - txt = car(face), face = cdr(face); - face = getVector(getVector(face, &v), &w); - if ((v.x || v.y || v.z) && (w.x || w.y || w.z)) - r = &rot, rotate(&v, r, &pt1), rotate(&w, r, &pt2); - else - rotate(&v, r, &pt1), rotate(&w, r, &pt2), r = &rot; - face = getVector(face, &v), rotate(&v, r, &pt3); - if (c2 == T) { - n = length(face) / 3; - prn(n+2); - shadowPt(pt1.x + dx + pt1.z + pos.z, pt1.y + dy); - pr(0,txt); - shadowPt(pt2.x + dx + pt2.z + pos.z, pt2.y + dy); - shadowPt(pt3.x + dx + pt3.z + pos.z, pt3.y + dy); - while (--n >= 0) { - face = getVector(face, &v), rotate(&v, r, &pt1); - shadowPt(pt1.x + dx + pt1.z + pos.z, pt1.y + dy); - } - prn(0); - } - else { - v.x = pt1.x - pt2.x; - v.y = pt1.y - pt2.y; - v.z = pt1.z - pt2.z; - w.x = pt3.x - pt2.x; - w.y = pt3.y - pt2.y; - w.z = pt3.z - pt2.z; - nv.x = v.y * w.z - v.z * w.y; - nv.y = v.z * w.x - v.x * w.z; - nv.z = v.x * w.y - v.y * w.x; - pt1.x += dx, pt1.y += dy, pt1.z += dz; - if (isNil(c1) && isNil(c2)) - pix = -1; // Transparent - else { - if (pt1.x * nv.x + pt1.y * nv.y + pt1.z * nv.z >= 0.0) { - if (isNil(c1)) - continue; // Backface culling - pix = unDig(c1) / 2; - n = 80 - num(14.14 * (nv.z-nv.x) / sqrt(nv.x*nv.x + nv.y*nv.y + nv.z*nv.z)); - } - else { - if (isNil(c2)) - continue; // Backface culling - pix = unDig(c2) / 2; - n = 80 + num(14.14 * (nv.z-nv.x) / sqrt(nv.x*nv.x + nv.y*nv.y + nv.z*nv.z)); - } - pix = ((pix >> 16) & 255) * n / 100 << 16 | - ((pix >> 8) & 255) * n / 100 << 8 | (pix & 255) * n / 100; - } - n = length(face) / 3; - prn(n+2); - transPt(pt1.x, pt1.y, pt1.z); - pr(0,txt); - transPt(pt2.x + dx, pt2.y + dy, pt2.z + dz); - transPt(pt3.x + dx, pt3.y + dy, pt3.z + dz); - while (--n >= 0) { - face = getVector(face, &v), rotate(&v, r, &pt1); - transPt(pt1.x + dx, pt1.y + dy, pt1.z + dz); - } - prn(pix); - } - } - } -} - -// (z3d:Draw 'foc 'yaw 'pitch 'x 'y 'z 'sky 'gnd ['h 'v]) -> NIL -// (z3d:Draw 'sym) -> NIL -// (z3d:Draw 'NIL) -> lst -any Draw(any ex) { - any x, y; - double a, sinY, cosY, sinP, cosP; - - x = cdr(ex); - if (isNil(y = EVAL(car(x)))) { - cell c1; - - prn(0); - if (!Snap) { - prn(32767); - return Nil; - } - prn(Snap2h), prn(Snap2v); - Push(c1, doubleToNum(SnapZ * SCL)); - data(c1) = cons(doubleToNum(SnapY * SCL), data(c1)); - data(c1) = cons(doubleToNum(SnapX * SCL), data(c1)); - return Pop(c1); - } - if (isSym(y)) { - doDraw(ex, y, NULL, 0.0, 0.0, 0.0); - return Nil; - } - FocLen = numToDouble(y) / SCL; - a = evDouble(ex, x = cdr(x)) / SCL, sinY = sin(a), cosY = cos(a); - a = evDouble(ex, x = cdr(x)) / SCL, sinP = sin(a), cosP = cos(a); - PosX = evDouble(ex, x = cdr(x)) / SCL; - PosY = evDouble(ex, x = cdr(x)) / SCL; - PosZ = evDouble(ex, x = cdr(x)) / SCL; - - Coeff1 = -sinY; - Coeff2 = cosY; - Coeff4 = cosY * sinP; - Coeff5 = sinY * sinP; - Coeff6 = -cosP; - Coeff7 = cosY * cosP; - Coeff8 = sinY * cosP; - Coeff9 = sinP; - - Pos6 = Coeff6 * PosZ; - Pos9 = Coeff9 * PosZ; - - if (cosP == 0.0) - prn(sinP > 0.0? +16383 : -16384); - else if ((a = FocLen * sinP/cosP) > +16383.0) - prn(+16383); - else if (a < -16384.0) - prn(-16384); - else - prn(num(a)); - prn(evCnt(ex, x = cdr(x))); - prn(evCnt(ex, x = cdr(x))); - x = cdr(x); - if (Snap = !isNil(y = EVAL(car(x)))) { - SnapD = 32767; - Snap1h = (int)xCnt(ex,y); - Snap1v = (int)evCnt(ex,cdr(x)); - } - return Nil; -} diff --git a/src/z3dClient.c b/src/z3dClient.c @@ -1,540 +0,0 @@ -/* 20oct11abu - * (c) Software Lab. Alexander Burger - */ - -#include <stdio.h> -#include <stdlib.h> -#include <sys/time.h> -#include <unistd.h> -#include <string.h> -#include <errno.h> - -#include <netdb.h> -#include <arpa/inet.h> - -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <sys/shm.h> -#include <X11/extensions/XShm.h> - - -typedef unsigned char byte; -typedef struct {long h[2]; unsigned long z[2];} edge; - -/* Globals */ -static int Socket; -static Display *Disp; -static int Scrn; -static int Dpth; -static int PixSize; -static Colormap Cmap; -static GC Gc; -static Window Win; -static long long Tim; - -/* 3D-Environment */ -static int SizX, SizY, OrgX, OrgY, SnapX, SnapY; -static unsigned long *Zbuff; -static edge *Edges; -static XImage *Img; -static XShmSegmentInfo Info; - - -/* Error exit */ -static void giveup(char *msg) { - fprintf(stderr, "z3dClient: %s\r\n", msg); - exit(1); -} - -/* Memory allocation */ -void *alloc(long siz) { - void *p; - - if (!(p = malloc(siz))) - giveup("No memory"); - return p; -} - -static void paint(void) { - XEvent ev; - - while (XCheckTypedEvent(Disp, Expose, &ev)); - XShmPutImage(Disp, Win, Gc, Img, 0, 0, 0, 0, SizX, SizY, False); - if (SnapX != 32767) { - XSetFunction(Disp, Gc, GXinvert); - XFillRectangle(Disp, Win, Gc, OrgX+SnapX-3, OrgY+SnapY-3, 6, 6); - XSetFunction(Disp, Gc, GXcopy); - } - XSync(Disp,False); -} - -static void prLong(long n) { - int i; - char buf[8]; - - n = n >= 0? n * 2 : -n * 2 + 1; - if ((n & 0xFFFFFF00) == 0) - i = 2, buf[0] = 1*4, buf[1] = n; - else if ((n & 0xFFFF0000) == 0) - i = 3, buf[0] = 2*4, buf[1] = n, buf[2] = n>>8; - else if ((n & 0xFF000000) == 0) - i = 4, buf[0] = 3*4, buf[1] = n, buf[2] = n>>8, buf[3] = n>>16; - else - i = 5, buf[0] = 4*4, buf[1] = n, buf[2] = n>>8, buf[3] = n>>16, buf[4] = n>>24; - if (write(Socket, buf, i) <= 0) - giveup("Socket write error"); -} - - -static byte get1(void) { - static int n, cnt; - static byte buf[1024]; - - while (n == cnt) { - int fd; - fd_set fdSet; - - fd = ConnectionNumber(Disp); - FD_ZERO(&fdSet); - FD_SET(fd, &fdSet); - FD_SET(Socket, &fdSet); - while (select((fd > Socket? fd : Socket) + 1, &fdSet, NULL,NULL,NULL) < 0) - if (errno != EINTR) - giveup("Select error"); - if (FD_ISSET(fd, &fdSet)) { - XEvent ev; - - XNextEvent(Disp, &ev); - switch (ev.type) { - case Expose: - paint(); - break; - case KeyPress: - if (((XKeyEvent*)&ev)->state == 37) // Ctrl-Key - printf("Ok\n"); //#? - break; - case KeyRelease: - break; - case ButtonPress: - prLong('c'); // clk - prLong(((XButtonEvent*)&ev)->x - OrgX); - prLong(((XButtonEvent*)&ev)->y - OrgY); - break; - case MotionNotify: //#? - break; - } - } - if (FD_ISSET(Socket, &fdSet)) { - while ((cnt = read(Socket, buf, sizeof(buf))) < 0) - if (errno != EINTR) - giveup("Socket read error"); - if (cnt == 0) - exit(0); - n = 0; - } - } - return buf[n++]; -} - -static long getNum(void) { - int cnt = get1() / 4; - long n = get1(); - int i = 0; - - while (--cnt) - n |= get1() << (i += 8); - if (n & 1) - n = -n; - return n / 2; -} - -static void skipStr(void) { - int cnt = get1() / 4; - while (--cnt >= 0) - get1(); -} - -static long getColor(long c) { - XColor col; - - col.red = c >> 8 & 0xFF00; - col.green = c & 0xFF00; - col.blue = (c & 0xFF) << 8; - col.flags = DoRed | DoGreen | DoBlue; - if (!XAllocColor(Disp, Cmap, &col)) - giveup("Can't allocate color"); - return col.pixel; -} - -static void mkEdge(int x1, int y1, int z1, int x2, int y2, int z2) { - int a, dx, dy, dz, sx, xd, xe, sz, zd, ze; - edge *p; - - if (y2 < y1) { - a = x1, x1 = x2, x2 = a; - a = y1, y1 = y2, y2 = a; - a = z1, z1 = z2, z2 = a; - } - if (y1 > OrgY || ((y2 += OrgY) <= 0)) - return; - if ((dy = y2 - (y1 += OrgY)) == 0) - return; - dx = x2 - x1, dz = z2 - z1; - if (y1 < 0) { - x1 += -y1 * dx / dy; - z1 += -y1 * dz / dy; - y1 = 0; - if ((dy = y2) == 0) - return; - dx = x2 - x1, dz = z2 - z1; - } - if (y2 > SizY) { - x2 += (SizY - y2) * dx / dy; - z2 += (SizY - y2) * dz / dy; - y2 = SizY; - if ((dy = y2 - y1) == 0) - return; - dx = x2 - x1, dz = z2 - z1; - } - sx = 0; - if (dx > 0) - sx = 1; - else if (dx < 0) - dx = -dx, sx = -1; - xd = 0; - if (dx > dy) - xd = dx/dy, dx -= xd*dy, xd *= sx; - xe = (dx *= 2) - dy; - sz = 0; - if (dz > 0) - sz = 1; - else if (dz < 0) - dz = -dz, sz = -1; - zd = 0; - if (dz > dy) - zd = dz/dy, dz -= zd*dy, zd *= sz; - ze = (dz *= 2) - dy; - dy *= 2; - x1 += OrgX; - p = Edges + y1; - do { - if ((a = x1) < 0) - a = 0; - else if (a > SizX) - a = SizX; - if (a < p->h[1]) { - p->h[0] = a; - p->z[0] = z1; - } - else { - p->h[0] = p->h[1]; - p->z[0] = p->z[1]; - p->h[1] = a; - p->z[1] = z1; - } - ++p; - x1 += xd; - if (xe >= 0) - x1 += sx, xe -= dy; - xe += dx; - z1 += zd; - if (ze >= 0) - z1 += sz, ze -= dy; - ze += dz; - } while (++y1 < y2); -} - -static void zDots(long i, long h, long h2, unsigned long z, unsigned long z2) { - char *frame; - unsigned long *zbuff; - - i = i * SizX + h; - frame = Img->data + i * PixSize; - zbuff = Zbuff + i; - i = h2 - h; - switch (PixSize) { - case 1: - if (z < *zbuff) - *zbuff = z, *frame = 0; - if (z2 < *(zbuff += i)) - *zbuff = z2, *(frame + i) = 0; - break; - case 2: - if (z < *zbuff) - *zbuff = z, *(short*)frame = (short)0; - if (z2 < *(zbuff += i)) - *zbuff = z2, *(short*)(frame + 2 * i) = (short)0; - break; - case 3: - if (z < *zbuff) { - *zbuff = z; - frame[0] = 0; - frame[1] = 0; - frame[2] = 0; - } - if (z2 < *(zbuff += i)) { - *zbuff = z2; - frame += 3 * i; - frame[0] = 0; - frame[1] = 0; - frame[2] = 0; - } - break; - case 4: - if (z < *zbuff) - *zbuff = z, *(long*)frame = (long)0; - if (z2 < *(zbuff += i)) - *zbuff = z2, *(long*)(frame + 4 * i) = (long)0; - break; - } -} - -static void zLine(long pix, long v, long h, long h2, - unsigned long z, unsigned long z2) { - char *frame; - unsigned long *zbuff; - long d, e, dh, dz, sz; - - if (dh = h2 - h) { - v = v * SizX + h; - frame = Img->data + v * PixSize; - zbuff = Zbuff + v; - sz = 0; - if ((dz = z2 - z) > 0) - sz = 1; - else if (dz < 0) - dz = -dz, sz = -1; - d = 0; - if (dz > dh) - d = dz/dh, dz -= d*dh, d *= sz; - e = (dz *= 2) - dh; - dh *= 2; - switch (PixSize) { - case 1: - do { - if (z < *zbuff) - *zbuff = z, *frame = pix; - z += d; - if (e >= 0) - z += sz, e -= dh; - ++zbuff, ++frame; - e += dz; - } while (++h < h2); - break; - case 2: - do { - if (z < *zbuff) - *zbuff = z, *(short*)frame = (short)pix; - z += d; - if (e >= 0) - z += sz, e -= dh; - ++zbuff, frame += 2; - e += dz; - } while (++h < h2); - break; - case 3: - do { - if (z < *zbuff) { - *zbuff = z; - frame[0] = pix; - frame[1] = (pix >> 8); - frame[2] = (pix >> 16); - } - z += d; - if (e >= 0) - z += sz, e -= dh; - ++zbuff, frame += 3; - e += dz; - } while (++h < h2); - break; - case 4: - do { - if (z < *zbuff) - *zbuff = z, *(long*)frame = pix; - z += d; - if (e >= 0) - z += sz, e -= dh; - ++zbuff, frame += 4; - e += dz; - } while (++h < h2); - break; - } - } -} - -int z3dConnect(char *node, char *service) { - struct addrinfo hints, *lst, *p; - int sd; - - memset(&hints, 0, sizeof(hints)); - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - if (getaddrinfo(node, service, &hints, &lst) == 0) { - for (p = lst; p; p = p->ai_next) { - if ((sd = socket(p->ai_family, p->ai_socktype, 0)) >= 0) { - if (connect(sd, p->ai_addr, p->ai_addrlen) == 0) { - freeaddrinfo(lst); - return sd; - } - close(sd); - } - } - freeaddrinfo(lst); - } - return -1; -} - -/*** Main entry point ***/ -int main(int ac, char *av[]) { - XPixmapFormatValues *pmFormat; - long hor, sky, gnd, pix, v; - int n, i, x0, y0, z0, x1, y1, z1, x2, y2, z2; - char *frame; - edge *e; - long long t; - struct timeval tv; - - if (ac != 3) - giveup("Use: <host> <port>"); - - /* Open Connection */ - if ((Socket = z3dConnect(av[1], av[2])) < 0) - giveup("Can't connect to server"); - - /* Open Display */ - if ((Disp = XOpenDisplay(NULL)) == NULL) - giveup("Can't open Display"); - Scrn = DefaultScreen(Disp); - Cmap = DefaultColormap(Disp,Scrn); - Dpth = PixSize = 0; - pmFormat = XListPixmapFormats(Disp, &n); - for (i = 0; i < n; i++) { - if (pmFormat[i].depth == 24) { - Dpth = 24; - if (PixSize != 4) - PixSize = (pmFormat[i].bits_per_pixel + 7) / 8 & ~8; - } - else if (pmFormat[i].depth == 16 && (PixSize < 3 || PixSize > 4)) { - Dpth = 16; - PixSize = (pmFormat[i].bits_per_pixel + 7) / 8 & ~8; - } - else if (pmFormat[i].depth == 8 && (PixSize < 2 || PixSize > 4)) { - Dpth = 8; - PixSize = (pmFormat[i].bits_per_pixel + 7) / 8 & ~8; - } - } - if (!Dpth) - giveup("Bad Display Depth"); - Gc = XCreateGC(Disp,RootWindow(Disp,Scrn), 0, NULL); - - OrgX = (SizX = getNum()) / 2; - OrgY = (SizY = getNum()) / 2; - - /* Create Window */ - Win = XCreateSimpleWindow(Disp, RootWindow(Disp,Scrn), 0, 0, SizX, SizY, - 1, BlackPixel(Disp,Scrn), WhitePixel(Disp,Scrn) ); - XStoreName(Disp, Win, "PicoLisp z3d"); - XSelectInput(Disp, Win, - ExposureMask | - KeyPressMask | KeyReleaseMask | - ButtonPressMask | - PointerMotionMask ); - XMapWindow(Disp, Win); - - /* Create Image */ - SizX = SizX + 3 & ~3; - SizY = SizY + 3 & ~3; - Zbuff = alloc(SizX * SizY * sizeof(unsigned long)); - Edges = alloc(SizY * sizeof(edge)); - if (!XShmQueryExtension(Disp) || - !(Img = XShmCreateImage(Disp, DefaultVisual(Disp, Scrn), - Dpth, ZPixmap, NULL, &Info, SizX, SizY )) || - (Info.shmid = shmget(IPC_PRIVATE, - SizX * SizY * PixSize, IPC_CREAT | 0777 )) < 0 || - (Info.shmaddr = Img->data = - shmat(Info.shmid, 0, 0) ) == (char*)-1 || - !XShmAttach(Disp, &Info) ) - giveup("Can't create XImage"); - - /* Main loop */ - for (;;) { - prLong('o'); // ok - hor = getNum() + OrgY; - sky = getColor(getNum()); - gnd = getColor(getNum()); - for (v = 0; v < SizY; ++v) { - pix = v < hor? sky : gnd; - frame = Img->data + v * SizX * PixSize; - switch (PixSize) { - case 1: - memset(frame, pix, SizX); - break; - case 2: - pix |= pix<<16; - i = 0; - do - *(long*)frame = pix, frame += 4; - while ((i+=2) < SizX); - break; - case 3: - i = 0; - do { - frame[0] = pix; - frame[1] = (pix >> 8); - frame[2] = (pix >> 16); - frame += 3; - } while (++i < SizX); - break; - case 4: - i = 0; - do - *(long*)frame = pix, frame += 4; - while (++i < SizX); - break; - } - } - memset(Zbuff, 0xFF, SizX * SizY * sizeof(unsigned long)); - - while (n = getNum()) { - memset(Edges, 0, SizY * sizeof(edge)); - x0 = x1 = getNum(); - y0 = y1 = getNum(); - z0 = z1 = getNum(); - skipStr(); - for (;;) { - x2 = getNum(); - y2 = getNum(); - z2 = getNum(); - mkEdge(x1, y1, z1, x2, y2, z2); - if (--n == 0) - break; - x1 = x2, y1 = y2, z1 = z2; - } - mkEdge(x2, y2, z2, x0, y0, z0); - i = 0, e = Edges; - if ((pix = getNum()) < 0) { - do // Transparent - if (e->h[1]) - zDots(i, e->h[0], e->h[1], e->z[0], e->z[1]); - while (++e, ++i < SizY); - } - else { - pix = getColor(pix); // Face color - do - if (e->h[1]) - zLine(pix, i, e->h[0], e->h[1], e->z[0], e->z[1]); - while (++e, ++i < SizY); - } - } - if ((SnapX = getNum()) != 32767) - SnapY = getNum(); - paint(); - gettimeofday(&tv,NULL), t = tv.tv_sec * 1000LL + tv.tv_usec / 1000; - if (Tim > t) { - tv.tv_sec = 0, tv.tv_usec = (Tim - t) * 1000; - select(0, NULL, NULL, NULL, &tv); - t = Tim; - } - Tim = t + 40; - } -} diff --git a/src64/tags b/src64/tags @@ -48,6 +48,120 @@ CHAR_LETTER63,1499 CHAR_DIGIT64,1520 +sys/x86-64.linux.defs.l,1959 +ENOENT5,59 +EINTR6,108 +EBADF7,155 +EAGAIN8,194 +EACCES9,227 +EPIPE10,268 +ECONNRESET11,303 +O_RDONLY14,365 +O_WRONLY15,382 +O_RDWR16,399 +O_CREAT17,414 +O_EXCL18,431 +O_TRUNC19,448 +O_APPEND20,466 +F_GETFD21,486 +F_SETFD22,502 +FD_CLOEXEC23,518 +BUFSIZ26,546 +PIPE_BUF27,564 +MAXPATHLEN29,585 +RTLD_LAZY32,613 +RTLD_GLOBAL33,631 +FLOCK36,662 +L_TYPE37,702 +L_WHENCE38,722 +L_START39,744 +L_LEN40,760 +L_PID41,775 +SEEK_SET42,790 +SEEK_CUR43,807 +F_RDLCK44,824 +F_WRLCK45,840 +F_UNLCK46,856 +F_GETFL47,872 +F_SETFL48,888 +F_GETLK49,904 +F_SETLK50,920 +F_SETLKW51,936 +F_SETOWN52,953 +O_NONBLOCK53,970 +O_ASYNC54,992 +STAT57,1019 +ST_MODE58,1061 +ST_SIZE59,1083 +ST_MTIME60,1100 +S_IFMT61,1118 +S_IFDIR62,1144 +TMS65,1180 +TMS_UTIME66,1214 +TMS_STIME67,1232 +TERMIOS70,1261 +C_IFLAG71,1304 +C_LFLAG72,1320 +C_CC73,1337 +ISIG74,1351 +VMIN75,1364 +VTIME76,1377 +TCSADRAIN77,1391 +SIGACTION80,1419 +SIGSET_T81,1462 +SA_HANDLER82,1481 +SA_MASK83,1500 +SA_FLAGS84,1516 +SIG_DFL86,1536 +SIG_IGN87,1552 +SIG_UNBLOCK88,1568 +SIGHUP90,1589 +SIGINT91,1615 +SIGUSR192,1630 +SIGUSR293,1647 +SIGPIPE94,1664 +SIGALRM95,1681 +SIGTERM96,1698 +SIGCHLD97,1715 +SIGCONT98,1732 +SIGSTOP99,1749 +SIGTSTP100,1766 +SIGTTIN101,1783 +SIGTTOU102,1800 +SIGIO103,1817 +SIGNALS104,1832 +WNOHANG107,1894 +WUNTRACED108,1910 +FD_SET111,1938 +TM_SEC114,1975 +TM_MIN115,1990 +TM_HOUR116,2005 +TM_MDAY117,2021 +TM_MON118,2038 +TM_YEAR119,2054 +D_NAME122,2078 +SOCK_STREAM125,2105 +SOCK_DGRAM126,2125 +AF_UNSPEC127,2144 +AF_INET6128,2162 +SOL_SOCKET129,2180 +SO_REUSEADDR130,2199 +IPPROTO_IPV6131,2220 +IPV6_V6ONLY132,2242 +INET6_ADDRSTRLEN133,2263 +NI_MAXHOST135,2290 +NI_NAMEREQD136,2312 +SOCKADDR_IN6138,2333 +SIN6_FAMILY139,2355 +SIN6_PORT140,2375 +SIN6_ADDR141,2393 +ADDRINFO143,2412 +AI_FAMILY144,2430 +AI_SOCKTYPE145,2448 +AI_ADDRLEN146,2468 +AI_ADDR147,2488 +AI_NEXT148,2505 + ./glob.l,4310 Data4,51 AV7,77 @@ -1138,9 +1252,9 @@ getUdpZ_FB373,9872 putUdpBZ380,10017 -sys/emu.code.l,95 -errno_A8,134 -errnoC16,260 -wifstoppedS_F24,409 -wifsignaledS_F32,570 -wtermsigS_A40,725 +sys/x86-64.linux.code.l,94 +errno_A5,67 +errnoC10,169 +wifstoppedS_F16,287 +wifsignaledS_F21,413 +wtermsigS_A28,568 diff --git a/src64/version.l b/src64/version.l @@ -1,6 +1,6 @@ -# 30mar13abu +# 02apr13abu # (c) Software Lab. Alexander Burger -(de *Version 3 1 2 1) +(de *Version 3 1 2 2) # vi:et:ts=3:sw=3