Skip to content

Commit 8fda65d

Browse files
Corrigido DrawCircle e Implementado ELSEIF
1 parent 16adda5 commit 8fda65d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+4898
-4168
lines changed

Analise.cs

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,11 @@ private Acao processaAtribuicao(Modulo mod, Rotina rot, ref Trechos trechos)
359359
// if a > 0 then return else let a ++
360360
private Se processaSe(Modulo mod, Rotina rot, ref Trechos trechos)
361361
{
362+
Se subSe;
362363
bool ignoraElse = false;
363364
trechos.ExigeProximo("Esperado a comparação depois do 'if'");
364365
Se ret = new Se(trechos.Anterior, processaExpressao(mod, rot, ref trechos));
366+
subSe = ret;
365367
trechos.ExigeId("then", "Esperado 'then' após a comparação");
366368
trechos.Proximo();
367369
if(trechos.FimDaLinha)
@@ -377,19 +379,52 @@ private Se processaSe(Modulo mod, Rotina rot, ref Trechos trechos)
377379
else
378380
{
379381
nivelRotina(mod, rot, ret.SeSim, true, ref trechos);
382+
if (trechos.FimDaLinha)
383+
ignoraElse = true;
380384
}
381-
if(trechos.EhIdentificador("else") & !ignoraElse)
385+
if(!ignoraElse)
382386
{
383-
if(trechos.Proximo())
387+
while(!trechos.EhIdentificador("else"))
384388
{
385-
nivelRotina(mod, rot, ret.SeNao, true, ref trechos);
389+
if(trechos.EhIdentificador("elseif"))
390+
{
391+
trechos.ExigeProximo("Esperado a comparação depois do 'elseif'");
392+
Se ant = subSe;
393+
subSe = new Se(trechos.Anterior, processaExpressao(mod, rot, ref trechos));
394+
ant.SeNao = new List<No>(new No[] {subSe});
395+
trechos.ExigeId("then", "Esperado 'then' após a comparação");
396+
if(trechos.Proximo())
397+
{
398+
nivelRotina(mod, rot, subSe.SeSim, true, ref trechos);
399+
}
400+
else
401+
{
402+
trechos.ProximaLinha();
403+
nivelRotina(mod, rot, subSe.SeSim, false, ref trechos);
404+
if(!trechos.EhIdentificador("elseif") & !trechos.EhIdentificador("else"))
405+
{
406+
trechos.ExigeId("end", "Esperado 'end' ou 'elseif' ao final do 'elseif'");
407+
trechos.Proximo();
408+
}
409+
}
410+
}
411+
else
412+
trechos.Erro("Esperado um else/elseif/end após os comandos dentro de um if/elseif");
413+
386414
}
387-
else
415+
if(trechos.EhIdentificador("else"))
388416
{
389-
trechos.ProximaLinha();
390-
nivelRotina(mod, rot, ret.SeNao, false, ref trechos);
391-
trechos.ExigeId("end", "Esperado 'end' ao final do 'else'");
392-
trechos.Proximo();
417+
if(trechos.Proximo())
418+
{
419+
nivelRotina(mod, rot, subSe.SeNao, true, ref trechos);
420+
}
421+
else
422+
{
423+
trechos.ProximaLinha();
424+
nivelRotina(mod, rot, subSe.SeNao, false, ref trechos);
425+
trechos.ExigeId("end", "Esperado 'end' ao final do 'else'");
426+
trechos.Proximo();
427+
}
393428
}
394429
}
395430
return ret;
@@ -458,7 +493,7 @@ private void nivelRotina(Modulo mod, Rotina rot, List<No> cmds, bool apenasUmCom
458493
do
459494
{
460495
reverifica:
461-
if(trechos.EhIdentificador("end") | trechos.EhIdentificador("else") | trechos.EhIdentificador("catch")) break;
496+
if(trechos.EhIdentificador("end") | trechos.EhIdentificador("else") | trechos.EhIdentificador("elseif") | trechos.EhIdentificador("catch")) break;
462497

463498

464499
if(trechos.EhIdentificador("dim"))

Distro/Atual/hcbasic.dll

512 Bytes
Binary file not shown.

Distro/Atual/hcbasic.pdb

120 Bytes
Binary file not shown.

Distro/Linux64/Plataformas/8086/CGA.hcb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@ Module CGA
1010
Video.Colors = 2
1111
Video.DrawPixel = AddressOf(DrawPixel)
1212
GenericVideo.RegisterDrawLine Video
13-
GenericVideo.RegisterDrawEllipse Video
13+
GenericVideo.RegisterDrawCircle Video
1414
Video.DrawRectangle = AddressOf(DrawRectangle)
1515
Video.ClearScreen = AddressOf(ClearScreen)
16+
Video.Refresh = AddressOf(Refresh)
1617
Graphics.ModeManual Video
1718
GenericVideo.Register2ColorsPalette
1819
End
1920

21+
Sub Refresh(mode as VideoMode)
22+
End
23+
2024
Sub DrawPixel(mode as VideoMode, x as UInt16, y as UInt16, color as UInt16)
2125
If x >= mode.Width Then Return
2226
If y >= mode.Height Then Return

Distro/Linux64/Plataformas/8086/System.Drawing.hcb

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ Structure VideoMode
66
Dim Colors as UInt16
77
Dim DrawPixel as Action(Of VideoMode, UInt16, UInt16, UInt16)
88
Dim DrawRectangle as Action(Of VideoMode, UInt16, UInt16, UInt16, UInt16, UInt16, UInt16)
9-
Dim DrawEllipse as Action(Of VideoMode, UInt16, UInt16, UInt16, UInt16, UInt16, UInt16)
9+
Dim DrawCircle as Action(Of VideoMode, UInt16, UInt16, UInt16, UInt16, UInt16)
1010
Dim DrawLine as Action(Of VideoMode, UInt16, UInt16, UInt16, UInt16, UInt16)
1111
Dim ClearScreen as Action(Of VideoMode, UInt16)
12-
Dim Refresh as Action(Of VideoMode, UInt16)
12+
Dim Refresh as Action(Of VideoMode)
1313
End
1414

1515
Structure Size
@@ -70,13 +70,11 @@ Module Graphics
7070
Video.DrawRectangle.Invoke x1, y1, x2, y2, borderColor, backgroundColor
7171
End
7272

73-
Public Sub DrawEllipse(x1 as UInt16, y1 as UInt16, x2 as UInt16, y2 as UInt16, borderColor as UInt16, backgroundColor as UInt16)
73+
Public Sub DrawCircle(xm as UInt16, ym as UInt16, r as UInt16, borderColor as UInt16, backgroundColor as UInt16)
7474
If Active == 0 Then Throw AccessDeniedError
75-
If x1 >= Video.Width Then Return
76-
If y1 >= Video.Height Then Return
77-
If x2 >= Video.Width Then x2 = Video.Width - 1
78-
If y2 >= Video.Height Then y2 = Video.Height - 1
79-
Video.DrawEllipse.Invoke x1, y1, x2, y2, borderColor, backgroundColor
75+
If (xm + r) >= Video.Width Then Return
76+
If (ym + r) >= Video.Height Then Return
77+
Video.DrawCircle.Invoke xm, ym, r, borderColor, backgroundColor
8078
End
8179

8280
Public Sub DrawText(font as Font, text as String, x1 as UInt16, y1 as UInt16, x2 as UInt16, y2 as UInt16, color as UInt16, multiline as UInt16)
@@ -188,8 +186,8 @@ Module GenericVideo
188186
mode.DrawLine = AddressOf(DrawLine)
189187
End
190188

191-
Public Sub RegisterDrawEllipse(mode as VideoMode)
192-
mode.DrawEllipse = AddressOf(DrawEllipse)
189+
Public Sub RegisterDrawCircle(mode as VideoMode)
190+
mode.DrawCircle = AddressOf(DrawCircle)
193191
End
194192

195193
Sub DrawLine(mode as VideoMode, x1 as UInt16, y1 as UInt16, x2 as UInt16, y2 as UInt16, color as UInt16)
@@ -291,13 +289,13 @@ Module GenericVideo
291289
While (x < 0)
292290
drawCircleStart:
293291
If backgroundColor <> 0xffff Then
294-
DrawLine xm-x, xm+y, xm+x, xm+y, backgroundColor
295-
DrawLine xm-x, xm-y, xm+x, xm-y, backgroundColor
292+
Graphics.DrawLine xm-x, xm+y, xm+x, xm+y, backgroundColor
293+
Graphics.DrawLine xm-x, xm-y, xm+x, xm-y, backgroundColor
296294
End
297-
DrawPixel xm-x, ym+y, borderColor
298-
DrawPixel xm-x, ym-y, borderColor
299-
DrawPixel xm+x, ym+y, borderColor
300-
DrawPixel xm+x, ym-y, borderColor
295+
Graphics.DrawPixel xm-x, ym+y, borderColor
296+
Graphics.DrawPixel xm-x, ym-y, borderColor
297+
Graphics.DrawPixel xm+x, ym+y, borderColor
298+
Graphics.DrawPixel xm+x, ym-y, borderColor
301299
r = err
302300
If r <= y Then
303301
y++

Distro/Linux64/Plataformas/8086/VGA.hcb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@ Module VGA
1010
Video.Colors = 2
1111
Video.DrawPixel = AddressOf(DrawPixel)
1212
GenericVideo.RegisterDrawLine Video
13-
GenericVideo.RegisterDrawEllipse Video
13+
GenericVideo.RegisterDrawCircle Video
1414
Video.DrawRectangle = AddressOf(DrawRectangle)
1515
Video.ClearScreen = AddressOf(ClearScreen)
16+
Video.Refresh = AddressOf(Refresh)
1617
Graphics.ModeManual Video
1718
GenericVideo.Register2ColorsPalette
1819
End
1920

21+
Sub Refresh(mode as VideoMode)
22+
End
23+
2024
Sub DrawPixel(mode as VideoMode, x as UInt16, y as UInt16, color as UInt16)
2125
If x >= mode.Width Then Return
2226
If y >= mode.Height Then Return

Distro/Linux64/Plataformas/Font.asm

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -7,82 +7,82 @@ dw autor
77
; Dados
88
dw desconhecido
99
dw espaco
10-
dw n0 ' 2
11-
dw n1 ' 3
12-
dw n2 ' 4
13-
dw n3 ' 5
14-
dw n4 ' 6
15-
dw n5 ' 7
16-
dw n6 ' 8
17-
dw n7 ' 9
18-
dw n8 ' 10
19-
dw n9 ' 11
20-
dw amai ' 12
21-
dw bmai ' 13
22-
dw cmai ' 14
23-
dw dmai ' 15
24-
dw emai ' 16
25-
dw fmai ' 17
26-
dw gmai ' 18
27-
dw hmai ' 19
28-
dw imai ' 20
29-
dw jmai ' 21
30-
dw kmai ' 22
31-
dw lmai ' 23
32-
dw mmai ' 24
33-
dw nmai ' 25
34-
dw omai ' 26
35-
dw pmai ' 27
36-
dw qmai ' 28
37-
dw rmai ' 29
38-
dw smai ' 30
39-
dw tmai ' 31
40-
dw umai ' 32
41-
dw vmai ' 33
42-
dw wmai ' 34
43-
dw xmai ' 35
44-
dw ymai ' 36
45-
dw zmai ' 37
46-
dw amai ' 38
47-
dw bmai ' 39
48-
dw cmai ' 40
49-
dw dmai ' 41
50-
dw emai ' 42
51-
dw fmai ' 43
52-
dw gmai ' 44
53-
dw hmai ' 45
54-
dw imai ' 46
55-
dw jmai ' 47
56-
dw kmai ' 48
57-
dw lmai ' 49
58-
dw mmai ' 50
59-
dw nmai ' 51
60-
dw omai ' 52
61-
dw pmai ' 53
62-
dw qmai ' 54
63-
dw rmai ' 55
64-
dw smai ' 56
65-
dw tmai ' 57
66-
dw umai ' 58
67-
dw vmai ' 59
68-
dw wmai ' 60
69-
dw xmai ' 61
70-
dw ymai ' 62
71-
dw zmai ' 63
72-
dw agudo ' 64
73-
dw grave ' 65
74-
dw agudo_duplo ' 66
75-
dw grave_duplo ' 67
76-
dw til ' 68
77-
dw circunflexo ' 69
78-
dw macron ' 70
79-
dw braquia ' 71
80-
dw braquia_invertida ' 72
81-
dw caron ' 73
82-
dw trema ' 74
83-
dw anel ' 75
84-
dw cedilha ' 76
85-
dw gancho_polaco ' 77
10+
dw n0 ; 2
11+
dw n1 ; 3
12+
dw n2 ; 4
13+
dw n3 ; 5
14+
dw n4 ; 6
15+
dw n5 ; 7
16+
dw n6 ; 8
17+
dw n7 ; 9
18+
dw n8 ; 10
19+
dw n9 ; 11
20+
dw amai ; 12
21+
dw bmai ; 13
22+
dw cmai ; 14
23+
dw dmai ; 15
24+
dw emai ; 16
25+
dw fmai ; 17
26+
dw gmai ; 18
27+
dw hmai ; 19
28+
dw imai ; 20
29+
dw jmai ; 21
30+
dw kmai ; 22
31+
dw lmai ; 23
32+
dw mmai ; 24
33+
dw nmai ; 25
34+
dw omai ; 26
35+
dw pmai ; 27
36+
dw qmai ; 28
37+
dw rmai ; 29
38+
dw smai ; 30
39+
dw tmai ; 31
40+
dw umai ; 32
41+
dw vmai ; 33
42+
dw wmai ; 34
43+
dw xmai ; 35
44+
dw ymai ; 36
45+
dw zmai ; 37
46+
dw amai ; 38
47+
dw bmai ; 39
48+
dw cmai ; 40
49+
dw dmai ; 41
50+
dw emai ; 42
51+
dw fmai ; 43
52+
dw gmai ; 44
53+
dw hmai ; 45
54+
dw imai ; 46
55+
dw jmai ; 47
56+
dw kmai ; 48
57+
dw lmai ; 49
58+
dw mmai ; 50
59+
dw nmai ; 51
60+
dw omai ; 52
61+
dw pmai ; 53
62+
dw qmai ; 54
63+
dw rmai ; 55
64+
dw smai ; 56
65+
dw tmai ; 57
66+
dw umai ; 58
67+
dw vmai ; 59
68+
dw wmai ; 60
69+
dw xmai ; 61
70+
dw ymai ; 62
71+
dw zmai ; 63
72+
dw agudo ; 64
73+
dw grave ; 65
74+
dw agudo_duplo ; 66
75+
dw grave_duplo ; 67
76+
dw til ; 68
77+
dw circunflexo ; 69
78+
dw macron ; 70
79+
dw braquia ; 71
80+
dw braquia_invertida ; 72
81+
dw caron ; 73
82+
dw trema ; 74
83+
dw anel ; 75
84+
dw cedilha ; 76
85+
dw gancho_polaco ; 77
8686

8787
nome:
8888
db .fim - $

Distro/Linux64/hcbasic.dll

512 Bytes
Binary file not shown.

Distro/Linux64/hcbasic.pdb

124 Bytes
Binary file not shown.

Distro/LinuxARM32/Plataformas/8086/CGA.hcb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@ Module CGA
1010
Video.Colors = 2
1111
Video.DrawPixel = AddressOf(DrawPixel)
1212
GenericVideo.RegisterDrawLine Video
13-
GenericVideo.RegisterDrawEllipse Video
13+
GenericVideo.RegisterDrawCircle Video
1414
Video.DrawRectangle = AddressOf(DrawRectangle)
1515
Video.ClearScreen = AddressOf(ClearScreen)
16+
Video.Refresh = AddressOf(Refresh)
1617
Graphics.ModeManual Video
1718
GenericVideo.Register2ColorsPalette
1819
End
1920

21+
Sub Refresh(mode as VideoMode)
22+
End
23+
2024
Sub DrawPixel(mode as VideoMode, x as UInt16, y as UInt16, color as UInt16)
2125
If x >= mode.Width Then Return
2226
If y >= mode.Height Then Return

0 commit comments

Comments
 (0)