ugBASIC 1.18
An isomorphic BASIC language compiler for retrocomputers
Loading...
Searching...
No Matches
select_case.c File Reference
#include "../../ugbc.h"

Go to the source code of this file.

Functions

void select_case (Environment *_environment, char *_expression)
 Emit ASM code for SELECT CASE ... {PASSING}.

Function Documentation

◆ select_case()

void select_case ( Environment * _environment,
char * _expression )

Emit ASM code for SELECT CASE ... {PASSING}.

This function outputs the code to implement a structured conditional jump. This implementation assumes that an expression passed as a parameter can be compared to various expressions that will given after. If the expression is equal to the this, it execute the instructions that follows, until a "CASE" or an "ENDSELECT" is reached. Otherwise, it jumps directly to the next CASE statement (or CASE ELSE, if present).

Since the compiler acts with a single pass, it is necessary to keep the information on the last used label. For this purpose, the label where it will jump will be inserted in the stack, so that it is defined at the moment when the ENDSELECT instruction will be examined.

Parameters
_environmentCurrent calling environment
_expressionExpression with the true / false condition

Definition at line 145 of file select_case.c.