G:/ScriptBasic/source/commands/if.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include "../command.h"

Go to the source code of this file.

Functions

static int IsTrue (VARIABLE v)
 COMMAND (SLIF)
 if (!IsTrue(ItemResult))
 while (1)
END SETPROGRAMCOUNTER (PARAMETERNODE)

Variables

END NODE nItem
NODE nGoForward
NODE nCode
VARIABLE ItemResult
END END NEXTPARAMETER


Function Documentation

COMMAND SLIF   ) 
 

IF =section misc =title IF condition THEN

Conditional execution. There are two different ways to use this command: single line T<IF> and multi line T<IF>.

A single line T<IF> has the form

=verbatim IF condition THEN command =noverbatim

There is no way to specify any T<ELSE> part for the command in the single line version. If you need T<ELSE> command you have use multi line T<IF>.

The multi line T<IF> should not contain any command directly after the keyword T<THEN>. It should have the format:

=verbatim IF condition THEN commands ELSE commands END IF =noverbatim

The T<ELSE> part of the command is optional, thus the command can have the format

=verbatim IF condition THEN commands END IF =noverbatim

as well. To be very precise the full syntax of the multi-line T<IF> command is:

=verbatim IF condition THEN commands [ ELSE IF | ELSEIF | ELSIF | ELIF commands ... ] [ ELSE commands ] END IF | ENDIF =noverbatim

You can use as many T<ELSE IF> branches as you like and at most one T<ELSE> branch.

The keywords T<ELSE IF>, T<ELSEIF> and others are allowed for ease program porting from other BASIC dialect. There is no difference between the interpretation. The same is true for T<END IF> in two words and written into a single keyword T<ENDIF>.

Definition at line 112 of file if.c.

if IsTrue(ItemResult)  ) 
 

Definition at line 129 of file if.c.

References RETURN, and SETPROGRAMCOUNTER().

static int IsTrue VARIABLE  v  )  [static]
 

Definition at line 30 of file if.c.

References LONGVALUE(), memory_IsUndef(), and STRINGVALUE().

Referenced by while().

END SETPROGRAMCOUNTER PARAMETERNODE   ) 
 

while  ) 
 

Definition at line 156 of file if.c.

References ASSERTOKE, IsTrue(), NEXTPARAMETER, OPCODE, pEo, RETURN, and SETPROGRAMCOUNTER().


Variable Documentation

VARIABLE ItemResult
 

Definition at line 154 of file if.c.

NODE nCode
 

Definition at line 153 of file if.c.

END END NEXTPARAMETER
 

Definition at line 237 of file if.c.

NODE nGoForward
 

Definition at line 152 of file if.c.

END NODE nItem
 

Definition at line 151 of file if.c.


Generated on Sun Mar 12 23:56:33 2006 for ScriptBasic by  doxygen 1.4.6-NO