GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
gzip.cc File Reference

Octave interface to the compression and uncompression libraries. More...

#include <cstdio>
#include <cstring>
#include <functional>
#include <list>
#include <stdexcept>
#include <string>
#include "Array.h"
#include "dir-ops.h"
#include "file-ops.h"
#include "file-stat.h"
#include "glob-match.h"
#include "lo-sysdep.h"
#include "oct-env.h"
#include "str-vec.h"
#include "Cell.h"
#include "defun-dld.h"
#include "defun-int.h"
#include "errwarn.h"
#include "ov.h"
#include "ovl.h"

Go to the source code of this file.

Functions

octave_value_list Fbzip2 (const octave_value_list &, int)
 
octave_value_list Fgzip (const octave_value_list &, int)
 
C octave_functionGbzip2 (const octave::dynamic_library &shl, bool relative)
 
C octave_functionGgzip (const octave::dynamic_library &shl, bool relative)
 
template<typename X >
string_vector xzip (const Array< std::string > &source_patterns)
 
template<typename X >
string_vector xzip (const Array< std::string > &source_patterns, const std::function< std::string(const std::string &)> &mk_dest_path)
 
template<typename X >
string_vector xzip (const Array< std::string > &source_patterns, const std::string &out_dir)
 

Detailed Description

Octave interface to the compression and uncompression libraries.

This was originally implemented as an m file which directly called bzip2 and gzip applications. This may look simpler but causes some issues (see bug #43431) because we have no control over the output file:

  • created file is always in the same directory as the original file;
  • automatically skip files that already have gz/bz2/etc extension;
  • some older versions lack the –keep option.

In addition, because system() does not have a method that allows passing a list of arguments, there is the issue of having to escape filenames.

A solution is to pipe file contents into the applications instead of filenames. However, that solution causes:

missing file header with original file information;

implementing ourselves the recursive transversion of directories;

do the above in a m file which will be slow;

popen2 is frail on windows.

Definition in file gzip.cc.

Function Documentation

◆ Fbzip2()

octave_value_list Fbzip2 ( const octave_value_list args,
int  nargout 
)
extern

Definition at line 660 of file gzip.cc.

References err_disabled_feature().

◆ Fgzip()

octave_value_list Fgzip ( const octave_value_list args,
int  nargout 
)
extern

Definition at line 614 of file gzip.cc.

References err_disabled_feature().

◆ Gbzip2()

C octave_function * Gbzip2 ( const octave::dynamic_library &  shl,
bool  relative 
)
extern

Definition at line 660 of file gzip.cc.

◆ Ggzip()

C octave_function * Ggzip ( const octave::dynamic_library &  shl,
bool  relative 
)
extern

Definition at line 614 of file gzip.cc.

◆ xzip() [1/3]

template<typename X >
string_vector xzip ( const Array< std::string > &  source_patterns)

Definition at line 536 of file gzip.cc.

◆ xzip() [2/3]

template<typename X >
string_vector xzip ( const Array< std::string > &  source_patterns,
const std::function< std::string(const std::string &)> &  mk_dest_path 
)

Definition at line 470 of file gzip.cc.

References glob_match::glob(), Array< T, Alloc >::numel(), and string_vector::numel().

◆ xzip() [3/3]

template<typename X >
string_vector xzip ( const Array< std::string > &  source_patterns,
const std::string &  out_dir 
)

Definition at line 549 of file gzip.cc.