Skip to content

Commit

Permalink
reformat source code using astyle
Browse files Browse the repository at this point in the history
  • Loading branch information
fangq committed May 21, 2022
1 parent b7cf723 commit ef858a5
Show file tree
Hide file tree
Showing 5 changed files with 578 additions and 465 deletions.
5 changes: 3 additions & 2 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ZMAT is written by Qianqian Fang. Qianqian is currently an Assistant Professor in the
Department of Bioengineering at Northeastern University.
ZMAT is written by Qianqian Fang. Qianqian is currently an
Associate Professor in the Department of Bioengineering at
Northeastern University.

Address: Dept. of Bioengineering
Northeastern University
Expand Down
30 changes: 15 additions & 15 deletions include/zmatlib.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/***************************************************************************//**
** \mainpage ZMat - A portable C-library and MATLAB/Octave toolbox for inline data compression
** \mainpage ZMat - A portable C-library and MATLAB/Octave toolbox for inline data compression
**
** \author Qianqian Fang <q.fang at neu.edu>
** \copyright Qianqian Fang, 2019-2020
**
** ZMat provides an easy-to-use interface for stream compression and decompression.
**
** It can be compiled as a MATLAB/Octave mex function (zipmat.mex/zmat.m) and compresses
** It can be compiled as a MATLAB/Octave mex function (zipmat.mex/zmat.m) and compresses
** arrays and strings in MATLAB/Octave. It can also be compiled as a lightweight
** C-library (libzmat.a/libzmat.so) that can be called in C/C++/FORTRAN etc to
** C-library (libzmat.a/libzmat.so) that can be called in C/C++/FORTRAN etc to
** provide stream-level compression and decompression.
**
** Currently, zmat/libzmat supports 6 different compression algorthms, including
Expand All @@ -21,7 +21,7 @@
** author: (C) 1995-2017 Jean-loup Gailly and Mark Adler
**
** Depencency: LZ4 library: https://lz4.github.io/lz4/
** author: (C) 2011-2019, Yann Collet,
** author: (C) 2011-2019, Yann Collet,
**
** Depencency: Original LZMA library
** author: Igor Pavlov
Expand Down Expand Up @@ -72,12 +72,12 @@ enum TZipMethod {zmZlib, zmGzip, zmBase64, zmLzip, zmLzma, zmLz4, zmLz4hc};
* @param[in] outputsize: output stream buffer length
* @param[in] outputbuf: output stream buffer pointer
* @param[in] ret: encoder/decoder specific detailed error code (if error occurs)
* @param[in] iscompress: 0: decompression, 1: use default compression level;
* @param[in] iscompress: 0: decompression, 1: use default compression level;
* negative interger: set compression level (-1, less, to -9, more compression)
* @return return the coarse grained zmat error code; detailed error code is in ret.
*/

int zmat_run(const size_t inputsize, unsigned char *inputstr, size_t *outputsize, unsigned char **outputbuf, const int zipid, int *ret, const int iscompress);
int zmat_run(const size_t inputsize, unsigned char* inputstr, size_t* outputsize, unsigned char** outputbuf, const int zipid, int* ret, const int iscompress);

/**
* @brief Simplified interface to perform compression (use default compression level)
Expand All @@ -90,7 +90,7 @@ int zmat_run(const size_t inputsize, unsigned char *inputstr, size_t *outputsize
* @return return the coarse grained zmat error code; detailed error code is in ret.
*/

int zmat_encode(const size_t inputsize, unsigned char *inputstr, size_t *outputsize, unsigned char **outputbuf, const int zipid, int *ret);
int zmat_encode(const size_t inputsize, unsigned char* inputstr, size_t* outputsize, unsigned char** outputbuf, const int zipid, int* ret);

/**
* @brief Simplified interface to perform decompression
Expand All @@ -103,15 +103,15 @@ int zmat_encode(const size_t inputsize, unsigned char *inputstr, size_t *outputs
* @return return the coarse grained zmat error code; detailed error code is in ret.
*/

int zmat_decode(const size_t inputsize, unsigned char *inputstr, size_t *outputsize, unsigned char **outputbuf, const int zipid, int *ret);
int zmat_decode(const size_t inputsize, unsigned char* inputstr, size_t* outputsize, unsigned char** outputbuf, const int zipid, int* ret);

/**
* @brief Free the output buffer to facilitate use in fortran
*
* @param[in,out] outputbuf: the outputbuf buffer's initial address to be freed
*/

void zmat_free(unsigned char **outputbuf);
void zmat_free(unsigned char** outputbuf);

/**
* @brief Look up a string in a string list and return the index
Expand All @@ -121,15 +121,15 @@ void zmat_free(unsigned char **outputbuf);
* @return if found, return the index of the string in the dictionary, otherwise -1.
*/

int zmat_keylookup(char *origkey, const char *table[]);
int zmat_keylookup(char* origkey, const char* table[]);

/**
* @brief Convert error code to a string error message
*
* @param[in] id: zmat error code
*/

char *zmat_error(int id);
char* zmat_error(int id);

/**
* @brief base64_encode - Base64 encode
Expand All @@ -144,8 +144,8 @@ char *zmat_error(int id);
* not included in out_len.
*/

unsigned char * base64_encode(const unsigned char *src, size_t len,
size_t *out_len);
unsigned char* base64_encode(const unsigned char* src, size_t len,
size_t* out_len);

/**
* base64_decode - Base64 decode
Expand All @@ -158,8 +158,8 @@ unsigned char * base64_encode(const unsigned char *src, size_t len,
* Caller is responsible for freeing the returned buffer.
*/

unsigned char * base64_decode(const unsigned char *src, size_t len,
size_t *out_len);
unsigned char* base64_decode(const unsigned char* src, size_t len,
size_t* out_len);

#ifdef __cplusplus
}
Expand Down
22 changes: 22 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,28 @@ $(OUTPUT_DIR)/$(BINARY): $(OBJS)
clean:
-rm -f $(OBJS) $(OUTPUT_DIR)/$(BINARY)$(EXESUFFIX) zmat$(OBJSUFFIX) $(LIBDIR)/*

pretty:
astyle \
--style=attach \
--indent=spaces=4 \
--indent-modifiers \
--indent-switches \
--indent-preproc-block \
--indent-preproc-define \
--indent-col1-comments \
--pad-oper \
--pad-header \
--align-pointer=type \
--align-reference=type \
--add-brackets \
--convert-tabs \
--lineend=linux \
--preserve-date \
--suffix=none \
--formatted \
--break-blocks \
"*.c" "../include/*.h" "*.cpp"

.PHONY: all mex oct lib dll

.DEFAULT_GOAL := all
Expand Down
Loading

0 comments on commit ef858a5

Please sign in to comment.