To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cadOpen lugnet.cad in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / 3544
3543  |  3545
Subject: 
LDS ver 0.28
Newsgroups: 
lugnet.cad, lugnet.cad.dev
Date: 
Wed, 23 Feb 2000 23:58:49 GMT
Viewed: 
640 times
  
http://home2.swipnet.se/~w-20413/lds/lds.htm
Added in 0.28:
* IF-THEN-ELSE-END IF
* GOTO
Fixed a bug in the LINE command.


/Tore


Tore Eriksson wrote:

The new version (v0.27) of LDraw Script Compiler has a couple of (IMHO) useful new features:

* 3-D Points can be added, subtracted, and multiplied with each other. (At last, Steve!)
Syntax:
P1 [=] P2 [+ | - | *] P3
Examples:
P1 = P2 + P3
is equal to:
X1=X2+X3
Y1=Y2+Y3
Z1=Z2+Z3

P33 P33 0 -4 0
subtracts 4 from Y33, leaving X33 and Z33 as they are.

P22 Z12 Y12 X12 * 1 1 -1
is equal to:
X22=Z12
Y22=Y12
Z22=X12*-1

* Indirect addresses
Example:
I=5
PRINT X(I+5)
outputs the value of X10

* Parenthesis in math. functions.
This feature came accidently, as a bonus while I made the indirect addresses!
As you may have noticed, LDS cannot handle the hierarchy of maths functions.
A=5*2+1 will be interpreted as A=5*(2+1) = 15 (See the pseudo-code below).
Now, with parentheseis, is is easier to predict the order of the calculations:
A=(5*2)+1 will set A=11

Some pseudo-code to illustrate the reason why LDS interprets without hierarchy considerations.
float interpret(char *inw)
{
float ret;
in func;
if(func) // i e if an operand is encountered
{
    (pseudo) extract inw into first_expression - func - the_rest
    // where func is a number representing an operand
    switch(func)
    {
       case PLUS:
       ret=interpret(first_expression) + interpret(the_rest);
       break;

       case MINUS:
       ret=interpret(first_expression) - interpret(the_rest);
       break;
       ... and so on
    }
else // not a function
{
    if(!strcmpi(w,"BLACK")) return(0);
    if(!strcmpi(w,"BLUE")) return(1);
   ...
  }
  return (ret);
}

* And don't forget to download Anders Isaksson's LDS Shell program.
http://user.tninet.se/~hbh828t/dat/ldsshell.zip

If you have any questions, feel free to ask me.

/Tore



Message has 1 Reply:
  Re: LDS ver 0.28
 
(...) Good!! (...) Reasoning for GOTO? GOTO is a construct which can very easily be abused. better to have "proper" strcutures likw while-DO, repeat-until etc. Alex (25 years ago, 24-Feb-00, to lugnet.cad, lugnet.cad.dev)

Message is in Reply To:
  LDS ver 0.27 - Great News!
 
(URL) new version of LDraw Script Compiler has a couple of (IMHO) useful new features: * 3-D Points can be added, subtracted, and multiplied with each other. (At last, Steve!) Syntax: P1 [=] P2 [+ | - | *] P3 Examples: P1 = P2 + P3 is equal to: (...) (25 years ago, 17-Feb-00, to lugnet.cad, lugnet.cad.dev)

9 Messages in This Thread:



Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR