The aim of the project is to create an advanced table processor. You should use dynamic memory allocation. Application has to process table data in the file provided via command line argument. Actions will be in command line arguments too.
Use makefile. That is the easiest way:
make
Alternatively, you can compile it on your own:
gcc -std=c99 -Wall -Wextra -Werror -pedantic -c -o sps.o sps.c
./sheet [-d DELIMITER] CMD_SEQUENCE FILE
Argument -d defines what characters could be interpreted as column delimiters.
In case delimiter is not set, the delimiter is space .
The first delimiter from delimiters will be used as a delimiter for output data.
CMD_SEQUENCE could be defined in the file via command -cCMD_SEQUENCE_FILE
The table could contain escaped strings. Escaped could be whole cell, substring of cell, or
just one char using " or \ for one character.
Command will be processed for every cell in selected range. The range is defined by selection commands. By default, first cell of the first row is selected.
[R,C]- selects rowRand columnC[R,_]- selects whole rowR[_,C]- selects columnC[R1,C1,R2,C2]- selects window of cells starting at rowR1and columnC1and ends atR2and columnC2[_,_]- selects whole table[min]- selects cell with lowest numeric value[max]- selects cell with highest numeric value[find STR]- selects cell that contains (sub)stringSTR[_]- selection from temporary value will be set as actual selection
Commands that change the table dimension.
irow- adds new row with empty cells above selected rangearow- adds new row with empty cells bellow selected rangedrow- deletes selected rowsicol- adds empty column before selected rangeacol- adds empty column behind selected rangedcol C- deletes selected columns
set STR- sets stringSTRto all cells in selected rangeclear- wipes content of all cells in selected rangeswap [R,C]- swaps selected cell with cell atRrow andCcolumnsum [R,C]- sum of numeric values of cells in selected range will be set to cell atRrow andCcolumnavg [R,C]- average of numeric values of cells in selected range will be set to cell atRrow andCcolumncount [R,C]- counts non empty cells in selected range will be set to cell atRrow andCcolumnlen [R,C]- sets lenght of selected cell to cell atRrow andCcolumn