Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
compress42.c File Reference
#include <windows.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include <fcntl.h>
#include <ctype.h>
#include <math.h>
#include <wctype.h>
#include <wchar.h>
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <locale.h>
#include <signal.h>
#include <limits.h>
#include <float.h>
#include <iso646.h>
#include <assert.h>
#include <stdbool.h>
#include <process.h>
#include "helper_utilities_by_amanda_and_ricardo.c"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "patchlevel.h"

Data Structures

struct  utimbuf
 
union  bytes
 

Macros

#define __attribute__(unused)
 
#define uchar   unsigned char
 
#define uint   unsigned int
 
#define ushort   unsigned short
 
#define __attribute__(unused)
 
#define ARGS(a)
 
#define SIG_TYPE   void (*)()
 
#define lstat   stat
 
#define min(a, b)
 
#define IBUFSIZ   BUFSIZ /* Defailt input buffer size */
 
#define OBUFSIZ   BUFSIZ /* Default output buffer size */
 
#define MAGIC_1   (char_type)'\037' /* First byte of compressed file */
 
#define MAGIC_2   (char_type)'\235' /* Second byte of compressed file */
 
#define BIT_MASK   0x1f /* Mask for 'number of compresssion bits' */
 
#define BLOCK_MODE   0x80 /* Block compresssion if table is full and */
 
#define FIRST   257 /* first free entry */
 
#define CLEAR   256 /* table clear output code */
 
#define INIT_BITS   9 /* initial number of bits/code */
 
#define SACREDMEM   0
 
#define USERMEM   450000 /* default user memory */
 
#define BYTEORDER   0000
 
#define NOALLIGN   0
 
#define O_BINARY   0 /* System has no binary mode */
 
#define BITS   16
 
#define HSIZE   69001 /* 95% occupancy */
 
#define CHECK_GAP   10000
 
#define ARGVAL()
 
#define MAXCODE(n)
 
#define REGISTERS   2
 
#define REG1
 
#define REG2
 
#define REG3
 
#define REG4
 
#define REG5
 
#define REG6
 
#define REG7
 
#define REG8
 
#define REG9
 
#define REG10
 
#define REG11
 
#define REG12
 
#define REG13
 
#define REG14
 
#define REG15
 
#define REG16
 
#define REG1   register
 
#define REG2   register
 
#define output(b, o, c, n)
 
#define input(b, o, c, n, m)
 
#define htabof(i)
 
#define codetabof(i)
 
#define tab_prefixof(i)
 
#define tab_suffixof(i)
 
#define de_stack   ((char_type *)&(htab[HSIZE - 1]))
 
#define clear_htab()
 
#define clear_tab_prefixof()
 
#define fc   fcode.code
 

Typedefs

typedef long int code_int
 
typedef long int count_int
 
typedef long int cmp_code_int
 
typedef unsigned char char_type
 

Functions

WCHAR * utf8_2_wide_dl (const char *pUTF8)
 my temporary utf8_2_wide_dl function to add full Unicode support and future (when modified) support to long filenames. (jan/2025)
 
void pedro_dprintf2 (int amanda_level, char *format,...)
 pedro_dprintf2 is my variant of my debug function because too much calls to pedro_dprintf these days, I am lazy, sorry....
 
__int64 lffilesize_dl (const char *szFileName)
 default function to get the size of files with Unicode support
 
void Usage ARGS ((int))
 
void comprexx ARGS ((const char *))
 
void compdir ARGS ((char *))
 
int compress ARGS ((int, int))
 
void read_error ARGS ((void))
 
void prratio ARGS ((FILE *, long, long))
 
int main_old (REG1 int argc, argv)
 
void Usage (int status)
 
void comprexx (char *fileptr) const
 
int compress (int fdin, int fdout)
 
int decompress (int fdin, int fdout)
 
void read_error ()
 
void write_error ()
 
void abort_compress ()
 
void prratio (FILE *stream, long int num, long int den)
 
void about ()
 
int __stdcall compress_co___rspk_ar (char *Input_amanda_file_utf_8, char *OutPut_ricardo_File_utf_8, __attribute__((unused)) int Compression_juliete_Level_unused___)
 Function to compress a file using the Unix compress method.
 
int __stdcall uncompress_co___rspk_ar (char *Input_amanda_file_utf_8, char *OutPut_ricardo_File_utf_8)
 Function to uncompress a Unix compress based file.
 
int __stdcall get_progress_co___ar (void)
 
int __stdcall pause_co___aakp_co___ar (void)
 
int __stdcall resume_co___aakp_co___ar (void)
 
int __stdcall cancel_co___aakp_co___ar (void)
 

Variables

char * progname
 
int silent = 0
 
int quiet = 1
 
int do_decomp = 0
 
int force = 0
 
int nomagic = 0
 
int block_mode = BLOCK_MODE
 
int maxbits = BITS
 
int zcat_flg = 0
 
int recursive = 0
 
int exit_code = -1
 
char_type inbuf [IBUFSIZ+64]
 
char_type outbuf [OBUFSIZ+2048]
 
struct stat infstat
 
char * ifname
 
int remove_ofname = 0
 
char * ofname = NULL
 
int fgnd_flag = 0
 
long bytes_in
 
long bytes_out
 
count_int htab [HSIZE]
 
unsigned short codetab [HSIZE]
 

Macro Definition Documentation

◆ __attribute__ [1/2]

#define __attribute__ ( unused)
Value:
/* chloe */

◆ __attribute__ [2/2]

#define __attribute__ ( unused)
Value:
/* Chloe */

◆ ARGS

#define ARGS ( a)
Value:
()

◆ ARGVAL

#define ARGVAL ( )
Value:
(*++(*argv) || (--argc && *++argv))

◆ BIT_MASK

#define BIT_MASK   0x1f /* Mask for 'number of compresssion bits' */

◆ BITS

#define BITS   16

◆ BLOCK_MODE

#define BLOCK_MODE   0x80 /* Block compresssion if table is full and */

◆ BYTEORDER

#define BYTEORDER   0000

◆ CHECK_GAP

#define CHECK_GAP   10000

◆ CLEAR

#define CLEAR   256 /* table clear output code */

◆ clear_htab

#define clear_htab ( )
Value:
memset(htab, -1, sizeof(htab))
count_int htab[HSIZE]
Definition compress42.c:696

◆ clear_tab_prefixof

#define clear_tab_prefixof ( )
Value:
memset(codetab, 0, 256);
unsigned short codetab[HSIZE]
Definition compress42.c:697

◆ codetabof

#define codetabof ( i)
Value:
lzma_index ** i
Definition index.h:629

◆ de_stack

#define de_stack   ((char_type *)&(htab[HSIZE - 1]))

◆ fc

#define fc   fcode.code

◆ FIRST

#define FIRST   257 /* first free entry */

◆ HSIZE

#define HSIZE   69001 /* 95% occupancy */

◆ htabof

#define htabof ( i)
Value:

◆ IBUFSIZ

#define IBUFSIZ   BUFSIZ /* Defailt input buffer size */

◆ INIT_BITS

#define INIT_BITS   9 /* initial number of bits/code */

◆ input

#define input ( b,
o,
c,
n,
m )
Value:
{ \
REG1 char_type *p = &(b)[(o) >> 3]; \
(c) = ((((long)(p[0])) | ((long)(p[1]) << 8) | \
((long)(p[2]) << 16)) >> \
((o)&0x7)) & \
(m); \
(o) += (n); \
}
#define REG1
Definition compress42.c:469
unsigned char char_type
Definition compress42.c:460
#define b(i)
Definition sha256.c:42
#define c(i)
Definition sha256.c:43

◆ lstat

#define lstat   stat

◆ MAGIC_1

#define MAGIC_1   (char_type)'\037' /* First byte of compressed file */

◆ MAGIC_2

#define MAGIC_2   (char_type)'\235' /* Second byte of compressed file */

◆ MAXCODE

#define MAXCODE ( n)
Value:
(1L << (n))

◆ min

#define min ( a,
b )
Value:
((a > b) ? b : a)
#define a(i)
Definition sha256.c:41

◆ NOALLIGN

#define NOALLIGN   0

◆ O_BINARY

#define O_BINARY   0 /* System has no binary mode */

◆ OBUFSIZ

#define OBUFSIZ   BUFSIZ /* Default output buffer size */

◆ output

#define output ( b,
o,
c,
n )
Value:
{ \
REG1 char_type *p = &(b)[(o) >> 3]; \
REG2 long i = ((long)(c)) << ((o)&0x7); \
p[0] |= (char_type)(i); \
p[1] |= (char_type)(i >> 8); \
p[2] |= (char_type)(i >> 16); \
(o) += (n); \
}
#define REG2
Definition compress42.c:470

◆ REG1 [1/2]

#define REG1

◆ REG1 [2/2]

#define REG1   register

◆ REG10

#define REG10

◆ REG11

#define REG11

◆ REG12

#define REG12

◆ REG13

#define REG13

◆ REG14

#define REG14

◆ REG15

#define REG15

◆ REG16

#define REG16

◆ REG2 [1/2]

#define REG2

◆ REG2 [2/2]

#define REG2   register

◆ REG3

#define REG3

◆ REG4

#define REG4

◆ REG5

#define REG5

◆ REG6

#define REG6

◆ REG7

#define REG7

◆ REG8

#define REG8

◆ REG9

#define REG9

◆ REGISTERS

#define REGISTERS   2

◆ SACREDMEM

#define SACREDMEM   0

◆ SIG_TYPE

#define SIG_TYPE   void (*)()

◆ tab_prefixof

#define tab_prefixof ( i)
Value:
#define codetabof(i)
Definition compress42.c:700

◆ tab_suffixof

#define tab_suffixof ( i)
Value:
((char_type *)(htab))[i]

◆ uchar

#define uchar   unsigned char

◆ uint

#define uint   unsigned int

◆ USERMEM

#define USERMEM   450000 /* default user memory */

◆ ushort

#define ushort   unsigned short

Typedef Documentation

◆ char_type

typedef unsigned char char_type

◆ cmp_code_int

typedef long int cmp_code_int

◆ code_int

typedef long int code_int

◆ count_int

typedef long int count_int

Function Documentation

◆ abort_compress()

void abort_compress ( )

◆ about()

void about ( )

◆ ARGS() [1/6]

void compdir ARGS ( (char *) )

◆ ARGS() [2/6]

void comprexx ARGS ( (const char *) )

◆ ARGS() [3/6]

void prratio ARGS ( (FILE *, long, long) )

◆ ARGS() [4/6]

void Usage ARGS ( (int) )

◆ ARGS() [5/6]

int decompress ARGS ( (int, int) )

◆ ARGS() [6/6]

static void about ARGS ( (void) )

◆ cancel_co___aakp_co___ar()

int __stdcall cancel_co___aakp_co___ar ( void )

◆ compress()

int compress ( int fdin,
int fdout )

◆ compress_co___rspk_ar()

int __stdcall compress_co___rspk_ar ( char * Input_amanda_file_utf_8,
char * OutPut_ricardo_File_utf_8,
__attribute__((unused)) int Compression_juliete_Level_unused___ )

Function to compress a file using the Unix compress method.

Parameters
Input_amanda_file_utf_8utf-8 encoded input file
OutPut_ricardo_File_utf_8utf-8 encoded output file
Returns
int

0 - No error
1 - Cannot open input file
2 - Cannot open destination file
3 - Cannot close input file
4 - Cannot close output file
5 - Cannot read from input file
6 - Cannot write to output file
119 - User cancel

◆ comprexx()

void comprexx ( char * fileptr) const

◆ decompress()

int decompress ( int fdin,
int fdout )

◆ get_progress_co___ar()

int __stdcall get_progress_co___ar ( void )

◆ lffilesize_dl()

__int64 lffilesize_dl ( const char * szFileName)

default function to get the size of files with Unicode support

Parameters
szFileNameutf-8 encoded file
Returns
__int64 the size of the file or 0

◆ main_old()

int main_old ( REG1 int argc,
argv  )

◆ pause_co___aakp_co___ar()

int __stdcall pause_co___aakp_co___ar ( void )

◆ pedro_dprintf2()

void pedro_dprintf2 ( int amanda_level,
char * format,
... )

pedro_dprintf2 is my variant of my debug function because too much calls to pedro_dprintf these days, I am lazy, sorry....

em brotli or brotli2

Parameters
amanda_levelif equal or above 0 print the string
formatprintf based format
...

◆ prratio()

void prratio ( FILE * stream,
long int num,
long int den )

◆ read_error()

void read_error ( )

◆ resume_co___aakp_co___ar()

int __stdcall resume_co___aakp_co___ar ( void )

◆ uncompress_co___rspk_ar()

int __stdcall uncompress_co___rspk_ar ( char * Input_amanda_file_utf_8,
char * OutPut_ricardo_File_utf_8 )

Function to uncompress a Unix compress based file.

Parameters
Input_amanda_file_utf_8utf-8 encoded input file
OutPut_ricardo_File_utf_8utf-8 encoded output file
Returns
int

0 - No error
1 - Cannot open input file
2 - Cannot open output file
3 - Cannot close input file
4 - Cannot close output file
5 - Cannot read from input file
6 - Cannot write to output file
7 - Not a valid compressed file
119 - User cancel

◆ Usage()

void Usage ( int status)

◆ utf8_2_wide_dl()

WCHAR * utf8_2_wide_dl ( const char * pUTF8)

my temporary utf8_2_wide_dl function to add full Unicode support and future (when modified) support to long filenames. (jan/2025)

Parameters
pUTF8
Returns
WCHAR*

◆ write_error()

void write_error ( )

Variable Documentation

◆ block_mode

int block_mode = BLOCK_MODE

◆ bytes_in

long bytes_in

◆ bytes_out

long bytes_out

◆ codetab

unsigned short codetab[HSIZE]

◆ do_decomp

int do_decomp = 0

◆ exit_code

int exit_code = -1

◆ fgnd_flag

int fgnd_flag = 0

◆ force

int force = 0

◆ htab

◆ ifname

char* ifname

◆ inbuf

char_type inbuf[IBUFSIZ+64]

◆ infstat

struct stat infstat

◆ maxbits

int maxbits = BITS

◆ nomagic

int nomagic = 0

◆ ofname

char* ofname = NULL

◆ outbuf

char_type outbuf[OBUFSIZ+2048]

◆ progname

char* progname

◆ quiet

int quiet = 1

◆ recursive

int recursive = 0

◆ remove_ofname

int remove_ofname = 0

◆ silent

int silent = 0

◆ zcat_flg

int zcat_flg = 0