Base repository for the second ARP assignment. The project provides you with a base infrastructure for the implementation of the simulated vision system through shared memory, according to the requirements specified in the PDF file of the assignment.
The two processes involved in the simulation of the vision system, namely processA and processB, are implemented as simple ncurses windows. The development of the inter-process communication pipeline, that is the shared memory, is left to you.
As for the first assignment, you also find a master process already prepared for you, responsible of spawning the entire simulation.
Additionally, I have prepared a simple program called circle.c, which shows you the basic functionalities of the libbitmap library. Please, note that the circle.c process must not appear in your final project. It is simply meant to be a guide for you on how to use the bitmap library, therefore you will need to properly use portions of that code in processA and processB in order to develop your solution.
To work with the bitmap library, you need to follow these steps:
- Download the source code from this GitHub repo in your file system.
- Navigate to the root directory of the downloaded repo and run the configuration through command
./configure
. Configuration might take a while. While running, it prints some messages telling which features it is checking for. - Type
make
to compile the package. - Run
make install
to install the programs and any data files and documentation. - Upon completing the installation, check that the files have been properly installed by navigating to
/usr/local/lib
, where you should find thelibbmp.so
shared library ready for use. - In order to properly compile programs which use the libbitmap library, you first need to notify the linker about the location of the shared library. To do that, you can simply add the following line at the end of your
.bashrc
file:export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
Now that you have properly installed the library in your system, it's time to use it in your programs:
- Include the library in your programs via
#include <bmpfile.h>
. If you want to check the content ofbmpfile.h
to glimpse the functionalities of the library, navigate to/usr/local/include
, where the header file should be located. - Compile programs which use the libbitmap library by linking the shared library with the
-lbmp
command.
Example for compiling circle.c:gcc src/circle.c -lbmp -lm -o bin/circle
The two processes are implemented as UIs through ncurses library, therefore you need to compile their source files by linking the shared library via -lncurses
. As for the first assignment, exploit the resize event of the windows to get out of situations in which the graphical elements do not properly spawn.
This is a simple example of a program which uses the libbitmap library. It generates a 100x100 colored .bmp
file with user-defined name, depicting a blue circle of given radius. When you execute it, pass the two arguments (file name and radius value) along. Execution example: ./bin/circle out/test.bmp 20
.