ugBASIC
1.18
An isomorphic BASIC language compiler for retrocomputers
Loading...
Searching...
No Matches
begin_do_loop.c
Go to the documentation of this file.
1
/*****************************************************************************
2
* ugBASIC - an isomorphic BASIC language compiler for retrocomputers *
3
*****************************************************************************
4
* Copyright 2021-2026 Marco Spedaletti (asimov@mclink.it)
5
*
6
* Licensed under the Apache License, Version 2.0 (the "License");
7
* you may not use this file except in compliance with the License.
8
* You may obtain a copy of the License at
9
*
10
* http://www.apache.org/licenses/LICENSE-2.0
11
*
12
* Unless required by applicable law or agreed to in writing, software
13
* distributed under the License is distributed on an "AS IS" BASIS,
14
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
* See the License for the specific language governing permissions and
16
* limitations under the License.
17
*----------------------------------------------------------------------------
18
* Concesso in licenza secondo i termini della Licenza Apache, versione 2.0
19
* (la "Licenza"); è proibito usare questo file se non in conformità alla
20
* Licenza. Una copia della Licenza è disponibile all'indirizzo:
21
*
22
* http://www.apache.org/licenses/LICENSE-2.0
23
*
24
* Se non richiesto dalla legislazione vigente o concordato per iscritto,
25
* il software distribuito nei termini della Licenza è distribuito
26
* "COSÌ COM'È", SENZA GARANZIE O CONDIZIONI DI ALCUN TIPO, esplicite o
27
* implicite. Consultare la Licenza per il testo specifico che regola le
28
* autorizzazioni e le limitazioni previste dalla medesima.
29
****************************************************************************/
30
31
/****************************************************************************
32
* INCLUDE SECTION
33
****************************************************************************/
34
35
#include "
../../ugbc.h
"
36
37
/****************************************************************************
38
* CODE SECTION
39
****************************************************************************/
40
49
/* <usermanual>
50
@keyword DO...LOOP
51
52
@english
53
54
The ''DO...LOOP'' command is used for repeatedly executing a
55
block of statements. It creates a loop, which is a sequence of
56
statements that is executed repeatedly, forever (unless exits
57
using the ''EXIT'' keyword). You can nest ''DO LOOP''s within other
58
loops, creating more complex control structures.
59
60
If you want to repeat the statements a set number of times,
61
the ''FOR...NEXT'' statement is usually a better choice,
62
while if you want to repeat for specific conditions,
63
you should use the ''WHILE...WEND'' and ''REPEAT...UNTIL''
64
statements.
65
66
If you want, you can use a variant of the ''DO...LOOP''
67
command by adding the keywords ''WHILE'' or ''UNTIL'' to the end of
68
the ''LOOP'' statement. In this case, the loop will be repeated
69
until the condition is true or false, respectively.
70
71
@italian
72
73
Il comando ''DO...LOOP'' viene utilizzato per eseguire ripetutamente
74
un blocco di istruzioni. Crea un ciclo, ovvero una sequenza di
75
istruzioni che viene eseguita ripetutamente, per sempre (a meno che
76
non esca utilizzando la parola chiave ''EXIT''). Puoi annidare
77
''DO LOOP'' all'interno di altri cicli, creando strutture di controllo
78
più complesse.
79
80
Se vuoi ripetere le istruzioni un numero di volte stabilito, l'istruzione
81
''FOR...NEXT'' è solitamente una scelta migliore, mentre se vuoi
82
ripetere per condizioni specifiche, dovresti usare le istruzioni
83
''WHILE... WEND'' e ''REPEAT...UNTIL''.
84
85
Volendo, è possibile utilizzare
86
una variante del comando ''DO...LOOP'', aggiungendo in coda all'istruzione
87
''LOOP'' le parole chiavi ''WHILE'' oppure ''UNTIL''. In tal caso, il
88
loop sarà ripetuto fino a che la condizione sarà, rispettivamente, vera oppure falsa.
89
90
@syntax DO
91
@syntax ... instructions ...
92
@syntax LOOP [WHILE expr | UNTIL expr]
93
94
@example DO
95
@example x = x + 1
96
@example LOOP
97
98
@usedInExample control_loops_01.bas
99
@usedInExample control_loops_02.bas
100
@usedInExample control_loops_03.bas
101
@usedInExample control_loops_04.bas
102
@usedInExample control_loops_05.bas
103
104
@seeAlso FOR...NEXT
105
@seeAlso WHILE...WEND
106
@seeAlso REPEAT...UNTIL
107
108
@target all
109
</usermanual> */
110
111
/* <usermanual>
112
@keyword LOOP...END LOOP
113
114
@english
115
116
@italian
117
118
@syntax LOOP
119
@syntax ... instructions ...
120
@syntax END LOOP
121
122
@example LOOP
123
@example x = x + 1
124
@example END LOOP
125
126
@alias DO...LOOP
127
128
@target all
129
</usermanual> */
130
131
void
begin_do_loop
(
Environment
* _environment ) {
132
133
begin_loop
( _environment, 1 );
134
135
}
begin_do_loop
void begin_do_loop(Environment *_environment)
Emit ASM code for DO ....
Definition
begin_do_loop.c:131
begin_loop
void begin_loop(Environment *_environment, int _do)
Emit ASM code for DO ....
Definition
begin_loop.c:49
ugbc.h
Environment
struct _Environment Environment
Structure of compilation environment.
Z:
ugbasic
ugbc
src
targets
common
begin_do_loop.c
Generated by
1.16.1