GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
ov-ch-mat.cc File Reference
#include <cctype>
#include <ostream>
#include "dNDArray.h"
#include "fNDArray.h"
#include "int8NDArray.h"
#include "int16NDArray.h"
#include "int32NDArray.h"
#include "int64NDArray.h"
#include "uint8NDArray.h"
#include "uint16NDArray.h"
#include "uint32NDArray.h"
#include "uint64NDArray.h"
#include "lo-ieee.h"
#include "mx-base.h"
#include "unicase-wrappers.h"
#include "unictype-wrappers.h"
#include "unistr-wrappers.h"
#include "mxarray.h"
#include "ov-base.h"
#include "ov-base-mat.h"
#include "ov-base-mat.cc"
#include "ov-ch-mat.h"
#include "errwarn.h"
#include "pr-output.h"
Include dependency graph for ov-ch-mat.cc:

Go to the source code of this file.

Macros

#define STRING_MAPPER(UMAP, FCN, TYPE)
 
#define STRING_U8_FCN(UMAP, U8_FCN, STD_FCN)
 
#define STRING_U8_MAPPER(UMAP, FCN)
 

Functions

static int xisascii (int c)
 

Macro Definition Documentation

◆ STRING_MAPPER

#define STRING_MAPPER (   UMAP,
  FCN,
  TYPE 
)
Value:
case umap_ ## UMAP: \
return octave_value (m_matrix.map<TYPE, int (&) (int)> (FCN))
@ FCN
Definition: oct-parse.h:135
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))

◆ STRING_U8_FCN

#define STRING_U8_FCN (   UMAP,
  U8_FCN,
  STD_FCN 
)
Value:
case umap_ ## UMAP: \
{ \
charNDArray in_m = m_matrix; \
Array<octave_idx_type> p (dim_vector (m_matrix.ndims (), 1)); \
if (m_matrix.ndims () > 1) \
{ \
for (octave_idx_type i=0; i < m_matrix.ndims (); i++) \
p(i) = i; \
p(0) = 1; \
p(1) = 0; \
in_m = m_matrix.permute (p); \
} \
std::size_t output_length = in_m.numel (); \
charNDArray ch_array = charNDArray (in_m.dims ()); \
const uint8_t *in = reinterpret_cast<const uint8_t *> (in_m.data ()); \
uint8_t *buf = reinterpret_cast<uint8_t *> (ch_array.fortran_vec ()); \
U8_FCN (in, m_matrix.numel (), nullptr, buf, &output_length); \
if (output_length != static_cast<std::size_t> (m_matrix.numel ())) \
{ \
warning_with_id ("Octave:multi_byte_char_length", \
"UMAP: Possible multi-byte error."); \
return octave_value (m_matrix.map<char, int (&) (int)> (STD_FCN)); \
} \
return octave_value ((m_matrix.ndims () > 1) ? ch_array.permute (p, true)\
: ch_array); \
}
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:94
class OCTAVE_API charNDArray
Definition: mx-fwd.h:43

◆ STRING_U8_MAPPER

#define STRING_U8_MAPPER (   UMAP,
  FCN 
)
Value:
case umap_ ## UMAP: \
{ \
charNDArray in_m = m_matrix; \
Array<octave_idx_type> p (dim_vector (m_matrix.ndims (), 1)); \
if (m_matrix.ndims () > 1) \
{ \
for (octave_idx_type i=0; i < m_matrix.ndims (); i++) \
p(i) = i; \
p(0) = 1; \
p(1) = 0; \
in_m = m_matrix.permute (p); \
} \
boolNDArray b_array = boolNDArray (in_m.dims ()); \
const uint8_t *in = reinterpret_cast<const uint8_t *> (in_m.data ()); \
uint32_t uc; \
for (octave_idx_type i = 0; i < in_m.numel (); ) \
{ \
int mblen = octave_u8_strmbtouc_wrapper (&uc, in + i); \
if (mblen < 1) \
mblen = 1; \
bool is_upper = FCN (uc); \
for (int j = 0; j < mblen; j++) \
b_array(i+j) = is_upper; \
i += mblen; \
} \
return octave_value ((m_matrix.ndims () > 1) ? b_array.permute (p, true) \
: b_array); \
}
class OCTAVE_API boolNDArray
Definition: mx-fwd.h:42
int octave_u8_strmbtouc_wrapper(uint32_t *puc, const uint8_t *src)

Function Documentation

◆ xisascii()

static int xisascii ( int  c)
inlinestatic

Definition at line 246 of file ov-ch-mat.cc.

Referenced by Fisascii(), octave_cell::map(), and octave_char_matrix::map().