Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Caco Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bfsc19
Caco Project
Commits
f5c97e55
Commit
f5c97e55
authored
2 years ago
by
bfsc19
Browse files
Options
Downloads
Plain Diff
Merge branch 'revert-
b627cfe2
' into 'main'
Revert "ahh" See merge request
!14
parents
b627cfe2
20401c3f
Branches
Branches containing commit
No related tags found
1 merge request
!14
Revert "ahh"
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
headers/client.h
+15
-1
15 additions, 1 deletion
headers/client.h
headers/conexao.h
+8
-14
8 additions, 14 deletions
headers/conexao.h
match3
+0
-0
0 additions, 0 deletions
match3
match3.zip
+0
-0
0 additions, 0 deletions
match3.zip
selection_sort.asm
+0
-212
0 additions, 212 deletions
selection_sort.asm
with
23 additions
and
227 deletions
headers/client.h
+
15
−
1
View file @
f5c97e55
...
...
@@ -117,6 +117,20 @@ int client::start_transmission() {
return
1
;
}
// Encerra a transmissao com o servidor
int
client
::
end_transmission
()
{
cout
<<
"
\t
Encerrando a transmissao
\n
"
;
// ->log
frame
*
end
=
new
frame
(
FIMT
,
0
,
vector
<
char
>
(
1
,
0
));
frame
*
enviado
=
send_frame_socket
(
end
);
if
(
!
enviado
)
{
cout
<<
"
\t
Falha ao encerrar a transmissao
\n
"
;
// ->log
return
0
;
}
cout
<<
"
\t
Transmissao encerrada com sucesso
\n
"
;
// ->log
return
1
;
}
/**
* @brief Send a list of frames through the socket
*
...
...
@@ -148,7 +162,7 @@ int client::send_frames(vector<frame *> frames) {
janela
.
push
((
iniJanela
+
frameCounter
)
%
16
);
cout
<<
"
\t
Enviando frame
\n
"
;
frames
[
iniJanela
+
frameCounter
]
->
imprime
(
HEX
);
frames
[
iniJanela
+
frameCounter
]
->
imprime
(
DEC
);
if
(
socket
->
send_frame
(
frames
[
iniJanela
+
frameCounter
])
==
-
1
)
{
cout
<<
"Falha ao enviar o frame
\n
"
;
...
...
This diff is collapsed.
Click to expand it.
headers/conexao.h
+
8
−
14
View file @
f5c97e55
...
...
@@ -106,18 +106,17 @@ frame *conexao::receive_frame() {
*/
int
conexao
::
send_frame
(
frame
*
f
)
{
int
escapes
=
add_escapes
((
char
*
)
f
,
bufferSend
);
add_escapes
((
char
*
)
f
,
bufferSend
);
bool
ack
=
false
;
int
timeout
=
0
;
cout
<<
"send: "
;
for
(
int
i
=
0
;
i
<
escapes
;
i
++
)
int
byteSend
=
send
(
device
,
bufferSend
,
sizeof
(
frame
)
*
2
,
0
);
printf
(
"send %d: "
,
byteSend
);
for
(
int
i
=
0
;
i
<
byteSend
;
i
++
)
{
cout
<<
hex
<<
(
int
(
bufferSend
[
i
])
&
0xff
)
<<
" "
;
}
cout
<<
"
\n
"
;
int
byteSend
=
send
(
device
,
bufferSend
,
sizeof
(
frame
)
*
2
,
0
);
if
(
byteSend
<
0
)
{
cout
<<
"Erro no sendto"
<<
byteSend
<<
"
\n
"
;
return
-
1
;
...
...
@@ -141,23 +140,18 @@ int conexao::add_escapes(char *f, char *out) {
for
(
size_t
i
=
0
;
i
<
sizeof
(
frame
);
i
++
)
{
out
[
j
++
]
=
f
[
i
];
if
(
f
[
i
]
==
(
char
)
0x88
||
f
[
i
]
==
(
char
)
0x81
)
{
out
[
j
++
]
=
0xFF
;
}
if
(
f
[
i
]
==
0x88
||
f
[
i
]
==
0x81
)
out
[
j
++
]
=
0xFF
;
}
cout
<<
"
\n
escapes: "
;
for
(
int
i
=
0
;
i
<
j
;
i
++
)
cout
<<
hex
<<
(
int
(
out
[
i
])
&
0xff
)
<<
" "
;
cout
<<
"
\n
"
;
return
j
;
}
int
conexao
::
remove_escapes
(
char
*
f
,
char
*
out
)
{
int
j
=
0
;
for
(
size_t
i
=
0
;
i
<
sizeof
(
frame
);
i
++
)
{
for
(
size_t
i
=
0
;
j
<
sizeof
(
frame
);
i
++
)
{
out
[
j
++
]
=
f
[
i
];
if
(
f
[
i
]
==
(
char
)
0x88
||
f
[
i
]
==
(
char
)
0x81
)
i
++
;
if
(
f
[
i
]
==
0x88
||
f
[
i
]
==
0x81
)
i
++
;
}
return
j
;
...
...
This diff is collapsed.
Click to expand it.
match3
deleted
100755 → 0
+
0
−
0
View file @
b627cfe2
File deleted
This diff is collapsed.
Click to expand it.
match3.zip
deleted
100644 → 0
+
0
−
0
View file @
b627cfe2
File deleted
This diff is collapsed.
Click to expand it.
selection_sort.asm
deleted
100644 → 0
+
0
−
212
View file @
b627cfe2
#
s0
=
indice
inicial
#
s1
=
indice
final
#
s2
=
tam
.data
vetor:
.space
24
#
Esp
a
ç
o
em
bits
para
6
int
,
cada
int
tem
4
bits
espaco:
.ascii
" "
#
É
um
esp
aco
.text
main:
li
$
s2
,
6
#
Tamanho
do
vetor
li
$
s0
,
0
#
Indice
inicial
do
vetor
addi
$
s1
,
$
s2
,
-
1
#
s1
é
o
indice
final
,
s1
=
tam
-
1
move
$
a1
,
$
s2
#
passa
o
tam
como
paramentro
jal
leVetor
#
le
um
vetor
#
Chama
o
selection
Sort
move
$
a1
,
$
s0
#
ai
=
indice
inicial
move
$
a2
,
$
s1
#
a2
=
indice
final
jal
selectionSort
move
$
a1
,
$
s0
#
a1
=
indice
move
$
a2
,
$
s2
#
a2
=
tamanho
jal
imprimeVetor
#
Termina
o
programa
li
$
v0
,
10
syscall
#
Fun
çã
o
que
l
ê
um
vetor
,
n
ã
o
retorna
nada
leVetor:
#
Configura
a
pilha
addiu
$
sp
,
$
sp
,
-
12
#
Al
oca
12
byte
s
na
pilha
(
a
,
b
e
ra
)
sw
$
ra
,
0
(
$
sp
)
#
1
posicao
da
pilha
=
ra
sw
$
s0
,
4
(
$
sp
)
#
2
posicao
da
pilha
=
a
sw
$
s1
,
8
(
$
sp
)
#
3
posicao
da
pilha
=
b
li
$
t0
,
0
#
t0
é
o
í
ndice
,
inicia
em
0
li
$
t1
,
0
#
t1
é
o
contador
,
t1
=
0
move
$
t2
,
$
a1
#
t2
=
tam
#
l
ê
s2
elementos
le_loop:
beq
$
t1
,
$
t2
,
endLe
#
Se
cont
=
tam
sai
do
loop
li
$
v0
,
5
#
Instru
çã
o
5
l
ê
um
int
syscall
sw
$
v0
,
vetor
(
$
t0
)
#
vetor
[
0
]
=
$
v0
addi
$
t0
,
$
t0
,
4
#
Atualiza
o
indice
,
4
pq
um
int
tem
4
bits
addi
$
t1
,
$
t1
,
1
#
Atualiza
o
contador
j
le_loop
#
Volta
para
o
inicio
do
loop
endLe:
#
Recupera
os
valores
lw
$
ra
,
0
(
$
sp
)
#
Recupera
o
ra
lw
$
s0
,
4
(
$
sp
)
#
Recupera
o
a
lw
$
s1
,
8
(
$
sp
)
#
Recupera
o
b
addiu
$
sp
,
$
sp
,
12
#
Volta
o
sp
jr
$
ra
#
Retorna
para
onde
a
fun
çã
o
foi
ch
amada
#
Fun
çã
o
que
imprime
um
vetor
,
n
ã
o
retorna
nada
imprimeVetor:
#
Configura
a
pilha
addiu
$
sp
,
$
sp
,
-
16
#
Al
oca
16
byte
s
na
pilha
(
tam
,
a
,
b
e
ra
)
sw
$
ra
,
0
(
$
sp
)
#
1
posicao
da
pilha
=
ra
sw
$
s0
,
4
(
$
sp
)
#
2
posicao
da
pilha
=
a
sw
$
s1
,
8
(
$
sp
)
#
3
posicao
da
pilha
=
b
sw
$
s2
,
12
(
$
sp
)
#
4
posica
da
pilha
=
tam
li
$
t0
,
0
#
t0
é
o
contador
,
t1
=
0
li
$
t1
,
0
#
t1
é
o
í
ndice
,
inicia
em
0
#
imprime
t0
elementos
imprime_loop:
beq
$
t0
,
$
a2
,
endImprime
#
Se
cont
=
tam
sai
do
loop
lw
$
a0
,
vetor
(
$
t1
)
#
a0
=
vetor
[
t1
]
li
$
v0
,
1
#
instru
çã
o
1
imprime
a0
syscall
la
$
a0
,
esp
aco
#
Imprime
um
esp
a
ç
o
li
$
v0
,
4
#
instru
çã
o
1
imprime
a0
syscall
addi
$
t0
,
$
t0
,
1
#
Atualiza
o
contador
addi
$
t1
,
$
t1
,
4
#
Atualiza
o
indice
,
4
pq
um
int
tem
4
bits
j
imprime_loop
#
Volta
para
o
inicio
do
loop
endImprime:
#
Recupera
os
valores
lw
$
ra
,
0
(
$
sp
)
#
Recupera
o
ra
lw
$
s0
,
4
(
$
sp
)
#
Recupera
o
a
lw
$
s1
,
8
(
$
sp
)
#
Recupera
o
b
lw
$
s2
,
12
(
$
sp
)
#
Recupera
o
tam
addiu
$
sp
,
$
sp
,
16
#
Volta
o
sp
jr
$
ra
#
Retorna
para
onde
a
fun
çã
o
foi
ch
amada
#
Ordena
em
ordem
crescente
selectionSort:
#
Configura
a
pilha
addiu
$
sp
,
$
sp
,
-
16
#
Al
oca
12
byte
s
na
pilha
(
a
,
b
e
ra
)
sw
$
ra
,
0
(
$
sp
)
#
1
posicao
da
pilha
=
ra
sw
$
s0
,
4
(
$
sp
)
#
2
posicao
da
pilha
=
a
sw
$
s1
,
8
(
$
sp
)
#
3
posicao
da
pilha
=
b
sw
$
s2
,
12
(
$
sp
)
#
4
posica
da
pilha
=
tam
move
$
t0
,
$
a1
#
Libera
os
registradores
de
parametro
move
$
t1
,
$
a2
bge
$
t0
,
$
t1
,
fimSelection
#
se
a
>
=
b
sai
da
recurs
ã
o
jal
minimo
#
Acha
o
menor
valor
#
Faz
a
troca
move
$
a1
,
$
v0
#
a3
=
min
(
v0
)
move
$
a2
,
$
t0
#
a2
=
a
jal
troca
#
chama
a
recurs
ã
o
para
o
prox
elem
addi
$
t0
,
$
t0
,
1
#
a
++
jal
selectionSort
fimSelection:
#
Recupera
os
valores
lw
$
ra
,
0
(
$
sp
)
#
Recupera
o
ra
lw
$
s0
,
4
(
$
sp
)
#
Recupera
o
a
lw
$
s1
,
8
(
$
sp
)
#
Recupera
o
b
lw
$
s2
,
12
(
$
sp
)
#
Recupera
o
tam
addiu
$
sp
,
$
sp
,
16
#
Volta
o
sp
jr
$
ra
#
Retorna
para
onde
a
fun
çã
o
foi
ch
amada
minimo:
#
Acha
o
minimo
do
vetor
#
Configura
a
pilha
addiu
$
sp
,
$
sp
,
-
16
#
Al
oca
16
byte
s
na
pilha
(
tam
,
a
,
b
e
ra
)
sw
$
ra
,
0
(
$
sp
)
#
1
posicao
da
pilha
=
ra
sw
$
s0
,
4
(
$
sp
)
#
2
posicao
da
pilha
=
a
sw
$
s1
,
8
(
$
sp
)
#
3
posicao
da
pilha
=
b
sw
$
s2
,
12
(
$
sp
)
#
4
posicao
da
pilha
=
tam
move
$
t0
,
$
a1
#
t0
é
o
í
ndice
sll
$
t0
,
$
t0
,
2
#
t0
=
t0
*
4
lw
$
t1
,
vetor
(
$
t0
)
#
t1
=
vetor
[
t0
*
4
]
li
$
t2
,
0
#
t2
é
o
contador
,
t2
=
0
min_loop:
#
Acha
o
menor
valor
beq
$
t2
,
$
a2
,
fimMin
#
Se
cont
==
b
sai
do
loop
addi
$
t0
,
$
t0
,
4
#
Atualiza
o
indice
,
um
int
tem
4
bits
addi
$
t2
,
$
t2
,
1
#
Atualiza
o
contador
,
contador
++
lw
$
t3
,
vetor
(
$
t0
)
#
t3
=
vetor
[
t0
],
comeca
no
2
º
elem
do
vetor
li
$
t4
,
0
#
indice
do
menor
valor
,
comeca
em
0
bgt
$
t3
,
$
t1
,
fimMin_if
#
se
t3
>
t1
sai
do
if
move
$
t1
,
$
t3
#
se
t3
<
t1
t0
=
t3
(
achou
o
min
)
move
$
t4
,
$
t0
fimMin_if:
j
min_loop
#
repete
para
o
prox
elem
fimMin:
#
Recupera
os
valores
lw
$
ra
,
0
(
$
sp
)
#
Recupera
o
ra
lw
$
s0
,
4
(
$
sp
)
#
Recupera
o
a
lw
$
s1
,
8
(
$
sp
)
#
Recupera
o
b
lw
$
s2
,
12
(
$
sp
)
#
Recupera
o
tam
addiu
$
sp
,
$
sp
,
16
#
Volta
o
sp
move
$
v0
,
$
t4
#
retorna
o
indice
do
menor
valor
(
t0
),
v0
=
t0
jr
$
ra
#
Retorna
para
onde
a
fun
çã
o
foi
ch
amada
#
Troca
dois
elementos
troca:
#
Configura
a
pilha
addiu
$
sp
,
$
sp
,
-
16
#
Al
oca
16
byte
s
na
pilha
(
tam
,
a
,
b
e
ra
)
sw
$
ra
,
0
(
$
sp
)
#
1
posicao
da
pilha
=
ra
sw
$
s0
,
4
(
$
sp
)
#
2
posicao
da
pilha
=
a
sw
$
s1
,
8
(
$
sp
)
#
3
posicao
da
pilha
=
b
sw
$
s2
,
12
(
$
sp
)
#
4
posicao
da
pilha
=
tam
#
Guarda
os
valores
lw
$
t0
,
vetor
(
$
a1
)
#
t0
=
vetor
[
a1
]
lw
$
t1
,
vetor
(
$
a2
)
#
t1
=
vetor
[
a2
]
#
Troca
os
valores
sw
$
t1
,
vetor
(
$
a1
)
#
vetor
[
a3
]
=
t1
sw
$
t0
,
vetor
(
$
t2
)
#
vetor
[
a1
]
=
t0
#
Recupera
os
valores
lw
$
ra
,
0
(
$
sp
)
#
Recupera
o
ra
lw
$
s0
,
4
(
$
sp
)
#
Recupera
o
a
lw
$
s1
,
8
(
$
sp
)
#
Recupera
o
b
lw
$
s2
,
12
(
$
sp
)
#
Recupera
o
tam
addiu
$
sp
,
$
sp
,
16
#
Volta
o
sp
jr
$
ra
#
Retorna
para
onde
a
fun
çã
o
foi
ch
amada
#
fazer
para
mais
de
6
elementos
#
ler
com
esp
a
ç
o
ao
inves
de
enter
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment