Skip to content

Commit

Permalink
INITIAL COMMIT
Browse files Browse the repository at this point in the history
  • Loading branch information
IX-0 committed Dec 23, 2024
0 parents commit 0899f3c
Show file tree
Hide file tree
Showing 26 changed files with 4,493 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Handle line endings automatically for files detected as text
# and leave all files detected as binary untouched.
* text=auto

# Never modify line endings of our bash scripts
*.sh -crlf

#
# The above will handle all files NOT found below
#
# These files are text and should be normalized (Convert crlf => lf)
*.css text
*.html text
*.java text
*.js text
*.json text
*.properties text
*.txt text
*.xml text

# These files are binary and should be left untouched
# (binary is macro for -text -diff)
*.class binary
*.jar binary
*.gif binary
*.jpg binary
*.png binary
*.pbm binary
*.pgm binary

67 changes: 67 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Prerequisites
*.d

# Object files
*.o
*.ko
*.obj
*.elf

# Linker output
*.ilk
*.map
*.exp

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.a
*.la
*.lo

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Debug files
*.dSYM/
*.su
*.idb
*.pdb

# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf

# Project-specific files to ignore below

# Executable files
imageBWTest
imageBWTool
imageBWTestChess
imageBWTestAND

# Image files and auxiliary dirs
*.pbm
pbm/
pub/


Binary file added AED-2024-1-RELATORIO.pdf
Binary file not shown.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 DETI - UA

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
117 changes: 117 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# make # to compile files and create the executables
# make clean # to cleanup object files and executables
# make cleanobj # to cleanup object files only
# make pbm # to download example images to the pbm/ dir
# make setup # to setup the test files in pbmt/ dir
# make tests # to run basic tests

CFLAGS = -Wall -Wextra -O2 -g

PROGS = imageBWTest imageBWTool imageBWTestChess imageBWTestAND

# Default rule: make all programs
all: $(PROGS)

imageBWTestAND: imageBWTestAND.o imageBW.o instrumentation.o

imageBWTestAND.o: imageBW.h instrumentation.h

imageBWTestChess: imageBWTestChess.o imageBW.o instrumentation.o

imageBWTestChess.o: imageBW.h instrumentation.h

imageBWTest: imageBWTest.o imageBW.o instrumentation.o

imageBWTest.o: imageBW.h instrumentation.h

imageBWTool: imageBWTool.o imageBW.o instrumentation.o

imageBWTool.o: imageBW.h instrumentation.h

# Rule to make any .o file dependent upon corresponding .h file
%.o: %.h

# Make uses builtin rule to create .o from .c files.

pbm:
wget -O- https://sweet.ua.pt/jmr/aed/pbm.tgz | tar xzf -

# 2024-11-26: pbmt/* is now managed by git,
# so pbmt/ target is no longer required, but was kept anyway.
pbmt/:
wget -O- https://sweet.ua.pt/jmr/aed/pbmt.tgz | tar xzf -

.PHONY: setup
setup: $(PROGS) pbmt/

test1: setup # neg (given)
@echo "==== $@ ===="
INSTRCTU=1 ./imageBWTool pbmt/chess9821.pbm raw neg raw save chess9820.pbm
cmp chess9820.pbm pbmt/chess9820.pbm

test2: setup # chess
@echo "==== $@ ===="
INSTRCTU=1 ./imageBWTool chess 12,6,3,0 raw rle save chess12630.pbm
cmp chess12630.pbm pbmt/chess12630.pbm
INSTRCTU=1 ./imageBWTool chess 12,6,2,1 raw rle save chess12621.pbm
cmp chess12621.pbm pbmt/chess12621.pbm

test3: setup # equal
@echo "==== $@ ===="
INSTRCTU=1 ./imageBWTool pbmt/chess9830.pbm pbmt/chess9830.pbm equal \
| grep "ImageIsEqual(I0, I1) -> 1"
INSTRCTU=1 ./imageBWTool pbmt/chess9830.pbm pbmt/chess9830x.pbm equal \
| grep "ImageIsEqual(I0, I1) -> 0"

test4: setup # AND
@echo "==== $@ ===="
INSTRCTU=1 ./imageBWTool pbmt/chess12630.pbm pbmt/chess12621.pbm and \
raw save imgAND.pbm
cmp imgAND.pbm pbmt/imgAND.pbm

test5: setup # OR
@echo "==== $@ ===="
INSTRCTU=1 ./imageBWTool pbmt/chess12630.pbm pbmt/chess12621.pbm or \
raw save imgOR.pbm
cmp imgOR.pbm pbmt/imgOR.pbm

test6: setup # XOR
@echo "==== $@ ===="
INSTRCTU=1 ./imageBWTool pbmt/chess12630.pbm pbmt/chess12621.pbm xor \
raw save imgXOR.pbm
cmp imgXOR.pbm pbmt/imgXOR.pbm

test7: setup # hmirror
@echo "==== $@ ===="
INSTRCTU=1 ./imageBWTool pbmt/imgAND.pbm raw hmirror raw \
save imgHMIRROR.pbm
cmp imgHMIRROR.pbm pbmt/imgHMIRROR.pbm

test8: setup # vmirror
@echo "==== $@ ===="
INSTRCTU=1 ./imageBWTool pbmt/imgAND.pbm raw vmirror raw \
save imgVMIRROR.pbm
cmp imgVMIRROR.pbm pbmt/imgVMIRROR.pbm

test9: setup # repb
@echo "==== $@ ===="
INSTRCTU=1 ./imageBWTool pbmt/chess12630.pbm pbmt/chess12320.pbm repb \
raw save imgREPB.pbm
cmp imgREPB.pbm pbmt/imgREPB.pbm

test10: setup # repr
@echo "==== $@ ===="
INSTRCTU=1 ./imageBWTool pbmt/chess12621.pbm pbmt/chess5631.pbm repr \
raw save imgREPR.pbm
cmp imgREPR.pbm pbmt/imgREPR.pbm

TESTS = test1 test2 test3 test4 test5 test6 test7 test8 test9 test10
.PHONY: tests
tests: $(TESTS)

cleanobj:
rm -f *.o

clean: cleanobj
rm -f $(PROGS)

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Projeto 1 AED

Realizado por: Igor Baltarejo, João Barreira
Loading

0 comments on commit 0899f3c

Please sign in to comment.