Skip to content

Comments

feat(compressor/decompressor): Implementando o compressor/descompress…#3

Merged
DevlTz merged 5 commits intomainfrom
devltz/feat/add-compressor
Oct 13, 2025
Merged

feat(compressor/decompressor): Implementando o compressor/descompress…#3
DevlTz merged 5 commits intomainfrom
devltz/feat/add-compressor

Conversation

@DevlTz
Copy link
Owner

@DevlTz DevlTz commented Oct 12, 2025

This pull request introduces a major refactor and feature addition to the compressor tool, focusing on modularization, Huffman compression improvements, and better command-line usability. The most important changes are the creation of a dedicated compressor module, the implementation of multi-character token support for frequency tables, and enhancements to both the compression and decompression logic. Additionally, usability and code organization have been improved.

Compressor Module & Huffman Compression Improvements

  • Added a new compressor module with compress_file and decompress_file functions in include/compressor/compressor.h and implemented their logic in src/compressor/compressor.cpp. This includes support for multi-character tokens and reading frequency tables with escaped characters. [1] [2]
  • Refactored the main compressor entry point in src/compressor/main.cpp to use the new module, improved command-line argument parsing, and added error handling and usage instructions.
  • Updated the build configuration in CMakeLists.txt to include the new compressor.cpp implementation file in the compressor executable.

Frequency Table & Token Handling

  • Added escape/unescape functions for special characters in frequency tables, ensuring compatibility with multi-character tokens. This affects both frequency counting (src/freq_counter/main.cpp) and frequency table output. [1] [2]
  • Added a sample frequency table file (tabela_cpp.freq) with escaped characters and multi-character tokens for testing.

Huffman Tree Serialization

  • Changed helper functions for Huffman tree serialization and deserialization to be class member functions for better encapsulation in src/lib/huffman_tree.cpp. [1] [2]

Other changes include new example and test files, such as simple C++ code snippets and documentation updates, which help with testing and demonstration.

-> Foram HORAS PARA FAZER ISSO < ISSO TIROU MEU CEREBRO PARA PENSAR EM DOBRO. ACABA LOGO ESSE PROJETOOOOOOOOOOOOOOOOOOOOOO.

…or - alterando algumas coisas importantes para o projeto rodar.
@DevlTz DevlTz requested a review from ctrindadedev October 12, 2025 04:01
@DevlTz DevlTz self-assigned this Oct 12, 2025
@DevlTz DevlTz requested a review from Copilot October 12, 2025 04:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a comprehensive compressor/decompressor module for a Huffman compression tool with multi-character token support and improved command-line interface.

  • Created a dedicated compressor module with functions for file compression and decompression
  • Added support for multi-character tokens in frequency tables with escape/unescape functionality
  • Refactored the main compressor entry point to use the new module with improved command-line parsing

Reviewed Changes

Copilot reviewed 11 out of 14 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
include/compressor/compressor.h New header defining the compressor module API
src/compressor/compressor.cpp Core implementation of compression/decompression logic with multi-token support
src/compressor/main.cpp Refactored main entry point with improved command-line parsing
src/lib/huffman_tree.cpp Made serialization helper functions class members for better encapsulation
src/freq_counter/main.cpp Added escape_chars function for special character handling in frequency tables
tabela_cpp.freq Sample frequency table with escaped characters and multi-character tokens
CMakeLists.txt Updated build configuration to include new compressor.cpp
Various test files Added example files for testing compression functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

DevlTz and others added 2 commits October 12, 2025 10:16
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Owner Author

@DevlTz DevlTz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agora tá tudo ok

Copy link
Collaborator

@ctrindadedev ctrindadedev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ótimo trabalho nesse PR. A refatoração deixou o projeto muito mais organizado e as novas funcionalidades de tokenização estão funcionando bem. Mais detalhes sobre o que eu achei após testes:

Testes e Validação
Eu fiz um teste para validar o fluxo completo, e os testes passaram com sucesso

Verificação: Comparei codigo_restaurado.cpp com o code_test.cpp original e eles são idênticos.

Sugestões para Melhoria

Melhorar o .gitignore. Sugiro adicionar:

*.huf
*.freq
*.exe
Isso evita que arquivos comprimidos e tabelas de frequência sejam commitados no repositório

Organizar os Arquivos de Exemplo:
Sugiro criarmos uma estrutura mais clara, talvez com subpastas para diferentes tipos e tamanhos de arquivos. Por exemplo:

examples/
├── cpp/
│ ├── small.cpp
│ └── medium.cpp
├── text/
│ ├── small.txt
│ └── large_alice.txt
└── ...
Isso vai facilitar muito na hora de rodar os testes de comparação e escrever o relatório final (report.md)

Conclusão:
ótimo PR , kauã, parabéns

@DevlTz
Copy link
Owner Author

DevlTz commented Oct 13, 2025

Ótimo trabalho nesse PR. A refatoração deixou o projeto muito mais organizado e as novas funcionalidades de tokenização estão funcionando bem. Mais detalhes sobre o que eu achei após testes:

Testes e Validação Eu fiz um teste para validar o fluxo completo, e os testes passaram com sucesso

Verificação: Comparei codigo_restaurado.cpp com o code_test.cpp original e eles são idênticos.

Sugestões para Melhoria

Melhorar o .gitignore. Sugiro adicionar:

*.huf *.freq *.exe Isso evita que arquivos comprimidos e tabelas de frequência sejam commitados no repositório

Organizar os Arquivos de Exemplo: Sugiro criarmos uma estrutura mais clara, talvez com subpastas para diferentes tipos e tamanhos de arquivos. Por exemplo:

examples/ ├── cpp/ │ ├── small.cpp │ └── medium.cpp ├── text/ │ ├── small.txt │ └── large_alice.txt └── ... Isso vai facilitar muito na hora de rodar os testes de comparação e escrever o relatório final (report.md)

Conclusão: ótimo PR , kauã, parabéns

Sobre a estrutura de repositorio, vou atualizar (Já estava fazendo assim como você falou) quando eu subir o inicio do relatório.

Irei modificar o .gitignore e o cmake !!

@DevlTz DevlTz closed this Oct 13, 2025
@DevlTz DevlTz reopened this Oct 13, 2025
@DevlTz DevlTz merged commit fd7eb7e into main Oct 13, 2025
@DevlTz DevlTz deleted the devltz/feat/add-compressor branch October 13, 2025 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants