| 1 | package SPVM::Resource::Utf8proc; | ||
| 2 | |||
| 3 | 1 | our $VERSION = "0.005"; | |
| 4 | |||
| 5 | 1 | 1; | |
| 6 | |||
| 7 | =head1 Name | ||
| 8 | |||
| 9 | SPVM::Resource::Utf8proc - Bundle of the utf8proc library | ||
| 10 | |||
| 11 | =head1 Description | ||
| 12 | |||
| 13 | Resource::Utf8proc class in L<SPVM> is a L<resouce|SPVM::Document::Resource> class for L<utf8proc|https://github.com/JuliaStrings/utf8proc> library. | ||
| 14 | |||
| 15 | =head1 Usage | ||
| 16 | |||
| 17 | MyClass.config: | ||
| 18 | |||
| 19 | my $config = SPVM::Builder::Config->new_c99; | ||
| 20 | |||
| 21 | $config->use_resource('Resource::Utf8proc'); | ||
| 22 | |||
| 23 | $config->add_ccflag('-DUTF8PROC_STATIC'); | ||
| 24 | |||
| 25 | $config; | ||
| 26 | |||
| 27 | MyClass.c: | ||
| 28 | |||
| 29 | #include "spvm_native.h" | ||
| 30 | |||
| 31 | #include "utf8proc.h" | ||
| 32 | |||
| 33 | int32_t SPVM__MyClass__test(SPVM_ENV* env, SPVM_VALUE* stack) { | ||
| 34 | |||
| 35 | const char* string = "あいう"; | ||
| 36 | |||
| 37 | char* string_ret_tmp = NULL; | ||
| 38 | |||
| 39 | int32_t string_ret_length = utf8proc_map(string, 0, &string_ret_tmp, UTF8PROC_NULLTERM | UTF8PROC_STABLE | | ||
| 40 | UTF8PROC_COMPOSE); | ||
| 41 | |||
| 42 | return 0; | ||
| 43 | } | ||
| 44 | |||
| 45 | =head1 Original Product | ||
| 46 | |||
| 47 | The L<utf8proc|https://github.com/JuliaStrings/utf8proc> library. | ||
| 48 | |||
| 49 | =head1 Original Product Version | ||
| 50 | |||
| 51 | v2.9.0 | ||
| 52 | |||
| 53 | =head1 Language | ||
| 54 | |||
| 55 | The C language | ||
| 56 | |||
| 57 | =head1 Language Standard | ||
| 58 | |||
| 59 | C99 | ||
| 60 | |||
| 61 | =head1 Required Compiler Flags | ||
| 62 | |||
| 63 | =over 2 | ||
| 64 | |||
| 65 | =item * -DUTF8PROC_STATIC | ||
| 66 | |||
| 67 | =back | ||
| 68 | |||
| 69 | =head1 Header Files | ||
| 70 | |||
| 71 | =over 2 | ||
| 72 | |||
| 73 | =item * utf8proc.h | ||
| 74 | |||
| 75 | =item * utf8proc_data.c (This is an included C source file) | ||
| 76 | |||
| 77 | =back | ||
| 78 | |||
| 79 | =head1 Source Files | ||
| 80 | |||
| 81 | =over 2 | ||
| 82 | |||
| 83 | =item * utf8proc.c | ||
| 84 | |||
| 85 | =back | ||
| 86 | |||
| 87 | =head1 Compiler Flags | ||
| 88 | |||
| 89 | =over 2 | ||
| 90 | |||
| 91 | =item * -DUTF8PROC_STATIC | ||
| 92 | |||
| 93 | =back | ||
| 94 | |||
| 95 | =head1 How to Create Resource | ||
| 96 | |||
| 97 | =head2 Download | ||
| 98 | |||
| 99 | mkdir -p .tmp | ||
| 100 | git clone https://github.com/JuliaStrings/utf8proc.git .tmp/utf8proc | ||
| 101 | git -C .tmp/utf8proc checkout tags/v2.9.0 -b branch_v2.9.0 | ||
| 102 | |||
| 103 | # Check the current branch | ||
| 104 | git -C .tmp/utf8proc branch | ||
| 105 | |||
| 106 | =head2 Extracting Header Files | ||
| 107 | |||
| 108 | The header files of C<utf8proc> is copied into the C<include> directory by the following command. | ||
| 109 | |||
| 110 | rsync -av --include='*.h' --exclude='*' .tmp/utf8proc/ lib/SPVM/Resource/Utf8proc.native/include/ | ||
| 111 | cp .tmp/utf8proc/utf8proc_data.c lib/SPVM/Resource/Utf8proc.native/include/utf8proc_data.c | ||
| 112 | |||
| 113 | =head2 Extracting Source Files | ||
| 114 | |||
| 115 | The source files of C<utf8proc> are copied into the C<src> directory by the following command. | ||
| 116 | |||
| 117 | cp .tmp/utf8proc/utf8proc.c lib/SPVM/Resource/Utf8proc.native/src/utf8proc.c | ||
| 118 | |||
| 119 | =head1 Repository | ||
| 120 | |||
| 121 | L<SPVM::Resource::Utf8proc - Github|https://github.com/yuki-kimoto/SPVM-Resource-Utf8proc> | ||
| 122 | |||
| 123 | =head1 Author | ||
| 124 | |||
| 125 | Yuki Kimoto C<kimoto.yuki@gmail.com> | ||
| 126 | |||
| 127 | =head1 Copyright & License | ||
| 128 | |||
| 129 | Copyright (c) 2023 Yuki Kimoto | ||
| 130 | |||
| 131 | MIT License | ||
| 132 |