The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Name

SPVM::Resource::Utf8proc - Bundle of the utf8proc library

Description

The Resource::Utf8proc resource in SPVM is a resouce that bundles the utf8proc library.

Usage

MyClass.config:

  my $config = SPVM::Builder::Config->new_gnu99(file => __FILE__);
  
  $config->use_resource('Resource::Utf8proc');
  
  $config->add_ccflag('-DUTF8PROC_STATIC');
  
  $config;

MyClass.c:

  #include "spvm_native.h"
  
  #include "utf8proc.h"
  
  int32_t SPVM__MyClass__test(SPVM_ENV* env, SPVM_VALUE* stack) {
    
    const char* string = "あいう";
    
    char* string_ret_tmp = NULL;
    
    int32_t string_ret_length = utf8proc_map(string, 0, &string_ret_tmp, UTF8PROC_NULLTERM | UTF8PROC_STABLE |
    UTF8PROC_COMPOSE);
    
    return 0;
  }
  

Original Product

The utf8proc library.

Original Product Version

v2.9.0

Language

The C language

Language Specification

GNU C99

Required Compiler Flags

  • -DUTF8PROC_STATIC

Header Files

  • utf8proc.h

  • utf8proc_data.c (This is an included C source file)

Source Files

  • utf8proc.c

Compiler Flags

  • -DUTF8PROC_STATIC

How to Create Resource

Download

  mkdir -p original.tmp
  git clone https://github.com/JuliaStrings/utf8proc.git original.tmp/utf8proc
  git -C original.tmp/utf8proc checkout tags/v2.9.0 -b branch_v2.9.0
  
  # Check the current branch
  git -C original.tmp/utf8proc branch

Extracting Header Files

The header files of utf8proc is copied into the include directory by the following command.

  rsync -av --include='*.h' --exclude='*' original.tmp/utf8proc/ lib/SPVM/Resource/Utf8proc.native/include/
  cp original.tmp/utf8proc/utf8proc_data.c lib/SPVM/Resource/Utf8proc.native/include/utf8proc_data.c

Extracting Source Files

The source files of utf8proc are copied into the src directory by the following command.

  cp original.tmp/utf8proc/utf8proc.c lib/SPVM/Resource/Utf8proc.native/src/utf8proc.c

Repository

SPVM::Resource::Utf8proc - Github

Author

Yuki Kimoto kimoto.yuki@gmail.com

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License

1 POD Error

The following errors were encountered while parsing the POD:

Around line 35:

Non-ASCII character seen before =encoding in '"あいう";'. Assuming UTF-8