Skip to content

Commit

Permalink
arquivo struct.h funcionando!
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaian-k committed Jun 29, 2022
1 parent ce25f66 commit ce80c69
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 91 deletions.
37 changes: 18 additions & 19 deletions .vscode/targets.log
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ make: *** No rule to make target 'all'. Stop.
# License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
# This is free software: you are free to change and redistribute it.
# There is NO WARRANTY, to the extent permitted by law.


# Make data base, printed on Tue Jun 28 21:15:55 2022
# Make data base, printed on Wed Jun 29 10:54:15 2022

# Variables

Expand All @@ -22,7 +21,7 @@ NO_AT_BRIDGE = 1
# environment
GJS_DEBUG_OUTPUT = stderr
# environment
VSCODE_IPC_HOOK_EXTHOST = /run/user/1000/vscode-ipc-bab9bd92-8306-4d22-a2cb-d1755e7d0ee2.sock
VSCODE_IPC_HOOK_EXTHOST = /run/user/1000/vscode-ipc-1da8cd07-0a52-4110-80c2-5523bca56290.sock
# environment
VSCODE_CWD = /home/lukaian
# environment
Expand Down Expand Up @@ -64,7 +63,7 @@ VSCODE_CODE_CACHE_PATH = /home/lukaian/.config/Code/CachedData/30d9c6cd9483b2cc5
# environment
LANG = C
# environment
XAUTHORITY = /run/user/1000/.mutter-Xwaylandauth.247CO1
XAUTHORITY = /run/user/1000/.mutter-Xwaylandauth.F8J5N1
# default
.LOADED :=
# default
Expand Down Expand Up @@ -102,13 +101,13 @@ MAKEFILE_LIST :=
# environment
VSCODE_VERBOSE_LOGGING = true
# environment
VSCODE_PID = 2930
VSCODE_PID = 6068
# environment
XDG_SESSION_TYPE = wayland
# automatic
?D = $(patsubst %/,%,$(dir $?))
# environment
SESSION_MANAGER = local/unix:@/tmp/.ICE-unix/1712,unix/unix:/tmp/.ICE-unix/1712
SESSION_MANAGER = local/unix:@/tmp/.ICE-unix/1693,unix/unix:/tmp/.ICE-unix/1693
# automatic
*F = $(notdir $*)
# environment
Expand Down Expand Up @@ -146,7 +145,7 @@ MAKEFILES :=
# automatic
^F = $(notdir $^)
# environment
INVOCATION_ID = 920f7e3a245f4b149af9e150ae258eb9
INVOCATION_ID = 7cd236e1d3c74aab861a85e213a3862c
# environment
VSCODE_LOG_NATIVE = false
# environment
Expand Down Expand Up @@ -176,7 +175,7 @@ GIO_LAUNCHED_DESKTOP_FILE = /usr/share/applications/code.desktop
# makefile
.DEFAULT_GOAL :=
# environment
SYSTEMD_EXEC_PID = 1747
SYSTEMD_EXEC_PID = 1751
# environment
HISTCONTROL = ignoredups
# environment
Expand All @@ -188,20 +187,19 @@ USER = lukaian
# default
MAKE_VERSION := 4.3
# environment
MANAGERPID = 1569
MANAGERPID = 1562
# environment
which_declare = declare -f
# environment

DEBUGINFOD_URLS = https://debuginfod.fedoraproject.org/
# environment
GIO_LAUNCHED_DESKTOP_FILE_PID = 2930
GIO_LAUNCHED_DESKTOP_FILE_PID = 6068
# environment
_ = /usr/bin/make
# environment
XDG_RUNTIME_DIR = /run/user/1000
# environment
JOURNAL_STREAM = 8:28577
JOURNAL_STREAM = 8:27605
# environment
XDG_SESSION_CLASS = user
# environment
Expand Down Expand Up @@ -235,9 +233,10 @@ GDMSESSION = gnome

# Directories

# . (device 35, inode 2172841): 11 files, no impossibilities.
# . (device 35, inode 2172841): 12 files, no impossibilities.

# 11 files, no impossibilities in 1 directories.

# 12 files, no impossibilities in 1 directories.

# Implicit Rules

Expand Down Expand Up @@ -287,12 +286,12 @@ GNUmakefile:

# No general ('VPATH' variable) search path.

# strcache buffers: 1 (0) / strings = 19 / storage = 200 B / avg = 10 B
# current buf: size = 8162 B / used = 200 B / count = 19 / avg = 10 B
# strcache buffers: 1 (0) / strings = 20 / storage = 210 B / avg = 10 B
# current buf: size = 8162 B / used = 210 B / count = 20 / avg = 10 B

# strcache performance: lookups = 22 / hit rate = 13%
# strcache performance: lookups = 23 / hit rate = 13%
# hash-table stats:
# Load=19/8192=0%, Rehash=0, Collisions=0/22=0%
# Finished Make data base on Tue Jun 28 21:15:55 2022
# Load=20/8192=0%, Rehash=0, Collisions=0/23=0%
# Finished Make data base on Wed Jun 29 10:54:15 2022


17 changes: 4 additions & 13 deletions abb.h
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
//imports
#include <stdio.h>
#include <stdlib.h>
//file
#include "fila_prioridade.h"


//struct
typedef struct abb_node {
//Dados iniciais da encomenda de um livro
int id; //identificador

char *nome_aluno;
int matricula;
char *descricao;

//mecanismo p/ unir nos!
struct abb_node *left; struct abb_node *right;
} Abb_node; Abb_node *root = NULL;
//create variables
Abb_node *root = NULL;


//fuctions
Expand Down
18 changes: 3 additions & 15 deletions fila_pre_cadastrados.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,12 @@
#include <stdio.h>
#include <stdlib.h>


//3 secretarios (cargo: S) e 5 transportadores (cargo: T)
typedef struct admin {
char *nome;
char *senha;
int cpf;
char cargo;
} Admin;


typedef struct fifopre_node {
Admin *a;
//mecanismo p/ unir nos!
struct fifopre_node *next;
} Fifopre_node;
//create variables
Fifopre_node *fifopre_start = NULL; Fifopre_node *fifopre_last = NULL; int fifopre_tam = 0;


//fuctions

void fifopre_add(int identificador, char *nome_aluno, int prioridade){
Pedido *p = malloc(sizeof(Pedido));
p->identificador = identificador;
Expand Down
57 changes: 19 additions & 38 deletions fila_prioridade.h
Original file line number Diff line number Diff line change
@@ -1,65 +1,46 @@
//imports
#include <stdio.h>
#include <stdlib.h>
//file
#include "structs.h"


//structs
typedef struct pedido {
int identificador; //id
int prioridade; //de 0 à 100

//informações ja existentes
char *nome_aluno;
int matricula;
char *descricao;
//novas informações
char *nome_responsavel;
char *nome_campus_aluno;
char *nome_campus_livro;
} Pedido;


typedef struct fifop_node {
Pedido *p;
//mecanismo p/ unir nos!
struct fifop_node *next;
} Fifop_node;
//create variables
Fifop_node *fifop_start = NULL; Fifop_node *fifop_last = NULL; int fifop_tam = 0;


//fuctions

void add_fila(int identificador, int prioridade, char *nome_aluno, int matricula, char *descricao, char *nome_responsavel, char *nome_campus_aluno, char *nome_campus_livro){
Pedido *p = malloc(sizeof(Pedido));
p->identificador = identificador;
p->prioridade = prioridade;
p->nome_aluno = nome_aluno;
p->matricula = matricula;
p->descricao = descricao;
p->nome_responsavel = nome_responsavel;
p->nome_campus_aluno = nome_campus_aluno;
p->nome_campus_livro = nome_campus_livro;
void add_fila(int id, int prioridade, char *nome_aluno, int matricula, char *descricao, char *nome_responsavel, char *nome_campus_aluno, char *nome_campus_livro){
Pedido *pedido = malloc(sizeof(Pedido));
pedido->id = id;
pedido->prioridade = prioridade;
pedido->nome_aluno = nome_aluno;
pedido->matricula = matricula;
pedido->descricao = descricao;
pedido->nome_responsavel = nome_responsavel;
pedido->nome_campus_aluno = nome_campus_aluno;
pedido->nome_campus_livro = nome_campus_livro;

Fifop_node *novo = malloc(sizeof(Fifop_node));
novo->p = p;
novo->pedido = pedido;
novo->next = NULL;

if (fifop_start == NULL){ //fila vazia
fifop_start = novo; fifop_last = novo; fifop_tam++;}

//adiciona de acordo com a prioridade! :D
else if(fifop_start->p->prioridade < prioridade){
else if(fifop_start->pedido->prioridade < prioridade){
novo->next = fifop_start;
fifop_start = novo; fifop_tam++;}

else {
if (fifop_last->p->prioridade > prioridade){
if (fifop_last->pedido->prioridade > prioridade){
fifop_last->next = novo;
fifop_last = novo;}

else {
Fifop_node *aux = fifop_start;
while (aux->next->p->prioridade < prioridade){
while (aux->next->pedido->prioridade < prioridade){
aux = aux->next;}

novo->next = aux->next;
Expand All @@ -71,7 +52,7 @@ void add_fila(int identificador, int prioridade, char *nome_aluno, int matricula
void imprimir(){
Fifop_node *aux = fifop_start;
for (int i=0; i<fifop_tam; i++){
printf("Identificador: %d\n", aux->p->identificador);
printf("Identificador: %d\n", aux->pedido->id);
aux = aux->next;}}


Expand All @@ -81,7 +62,7 @@ Pedido remover_fila(){
if (fifop_start != NULL){ //remover do antigo inicio da lista!
Fifop_node *lixo = fifop_start;
fifop_start = fifop_start->next;
pedido.identificador = lixo->p->identificador;
pedido.id = lixo->pedido->id;
//...
free(lixo); fifop_tam--;

Expand Down
3 changes: 1 addition & 2 deletions fuctions_system.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//imports
#include <stdio.h>
#include <stdlib.h>
//files
//file
#include "abb.h"
#include "fila_prioridade.h"
//#include "fila_pre_cadastrados.h"

//create variables
Expand Down
Binary file modified principal
Binary file not shown.
15 changes: 11 additions & 4 deletions structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,30 @@ typedef struct admin { //3 secretarios (cargo: S) e 5 transportadores (cargo: T)
} Admin;


typedef struct abb_node { //no da abb - encomendas
Pedido encomenda;
typedef struct abb_node {
//Dados iniciais da encomenda de um livro
int id; //identificador

char *nome_aluno;
int matricula;
char *descricao;

//mecanismo p/ unir nos!
struct abb_node *left; struct abb_node *right;
} Abb_node;


typedef struct fifop_node { //struct para os pedidos
Pedido p;
Pedido *pedido;

//mecanismo p/ unir nos!
struct fifop_node *next;
} Fifop_node;


typedef struct fifopre_node { //struct para os usuarios pre-cadastrados
Admin a;
Admin *admin;

//mecanismo p/ unir nos!
struct fifopre_node *next;
} Fifopre_node;

0 comments on commit ce80c69

Please sign in to comment.