Win32 API 日本語リファレンス
ホームGlobalization › utext_moveIndex32

utext_moveIndex32

関数
現在位置をコードポイント単位で前後に移動する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

// icuuc.dll
#include <windows.h>

CHAR utext_moveIndex32(
    UText* ut,
    INT delta
);

パラメーター

名前方向説明
utUText*inout対象のUTextオブジェクトへのポインタ。
deltaINTin現在位置から移動するコードポイント数。正で前進、負で後退する。

戻り値の型: CHAR

各言語での呼び出し定義

// icuuc.dll
#include <windows.h>

CHAR utext_moveIndex32(
    UText* ut,
    INT delta
);
[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern sbyte utext_moveIndex32(
    IntPtr ut,   // UText* in/out
    int delta   // INT
);
<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function utext_moveIndex32(
    ut As IntPtr,   ' UText* in/out
    delta As Integer   ' INT
) As SByte
End Function
' ut : UText* in/out
' delta : INT
Declare PtrSafe Function utext_moveIndex32 Lib "icuuc" ( _
    ByVal ut As LongPtr, _
    ByVal delta As Long) As Byte
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

utext_moveIndex32 = ctypes.cdll.icuuc.utext_moveIndex32
utext_moveIndex32.restype = ctypes.c_byte
utext_moveIndex32.argtypes = [
    ctypes.c_void_p,  # ut : UText* in/out
    ctypes.c_int,  # delta : INT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
utext_moveIndex32 = Fiddle::Function.new(
  lib['utext_moveIndex32'],
  [
    Fiddle::TYPE_VOIDP,  # ut : UText* in/out
    Fiddle::TYPE_INT,  # delta : INT
  ],
  Fiddle::TYPE_CHAR, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn utext_moveIndex32(
        ut: *mut UText,  // UText* in/out
        delta: i32  // INT
    ) -> i8;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern sbyte utext_moveIndex32(IntPtr ut, int delta);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_utext_moveIndex32' -Namespace Win32 -PassThru
# $api::utext_moveIndex32(ut, delta)
#uselib "icuuc.dll"
#func global utext_moveIndex32 "utext_moveIndex32" sptr, sptr
; utext_moveIndex32 varptr(ut), delta   ; 戻り値は stat
; ut : UText* in/out -> "sptr"
; delta : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icuuc.dll"
#cfunc global utext_moveIndex32 "utext_moveIndex32" var, int
; res = utext_moveIndex32(ut, delta)
; ut : UText* in/out -> "var"
; delta : INT -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; CHAR utext_moveIndex32(UText* ut, INT delta)
#uselib "icuuc.dll"
#cfunc global utext_moveIndex32 "utext_moveIndex32" var, int
; res = utext_moveIndex32(ut, delta)
; ut : UText* in/out -> "var"
; delta : INT -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procutext_moveIndex32 = icuuc.NewProc("utext_moveIndex32")
)

// ut (UText* in/out), delta (INT)
r1, _, err := procutext_moveIndex32.Call(
	uintptr(ut),
	uintptr(delta),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // CHAR
function utext_moveIndex32(
  ut: Pointer;   // UText* in/out
  delta: Integer   // INT
): Shortint; cdecl;
  external 'icuuc.dll' name 'utext_moveIndex32';
result := DllCall("icuuc\utext_moveIndex32"
    , "Ptr", ut   ; UText* in/out
    , "Int", delta   ; INT
    , "Cdecl Char")   ; return: CHAR
●utext_moveIndex32(ut, delta) = DLL("icuuc.dll", "char utext_moveIndex32(void*, int)")
# 呼び出し: utext_moveIndex32(ut, delta)
# ut : UText* in/out -> "void*"
# delta : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。
const std = @import("std");

extern "icuuc" fn utext_moveIndex32(
    ut: [*c]UText, // UText* in/out
    delta: i32 // INT
) callconv(.c) i8;
proc utext_moveIndex32(
    ut: ptr UText,  # UText* in/out
    delta: int32  # INT
): int8 {.importc: "utext_moveIndex32", cdecl, dynlib: "icuuc.dll".}
pragma(lib, "icuuc");
extern(C)
byte utext_moveIndex32(
    UText* ut,   // UText* in/out
    int delta   // INT
);
ccall((:utext_moveIndex32, "icuuc.dll"), Int8,
      (Ptr{UText}, Int32),
      ut, delta)
# ut : UText* in/out -> Ptr{UText}
# delta : INT -> Int32
local ffi = require("ffi")
ffi.cdef[[
int8_t utext_moveIndex32(
    void* ut,
    int32_t delta);
]]
local icuuc = ffi.load("icuuc")
-- icuuc.utext_moveIndex32(ut, delta)
-- ut : UText* in/out
-- delta : INT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('icuuc.dll');
const utext_moveIndex32 = lib.func('__cdecl', 'utext_moveIndex32', 'int8_t', ['void *', 'int32_t']);
// utext_moveIndex32(ut, delta)
// ut : UText* in/out -> 'void *'
// delta : INT -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("icuuc.dll", {
  utext_moveIndex32: { parameters: ["pointer", "i32"], result: "i8" },
});
// lib.symbols.utext_moveIndex32(ut, delta)
// ut : UText* in/out -> "pointer"
// delta : INT -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int8_t utext_moveIndex32(
    void* ut,
    int32_t delta);
C, "icuuc.dll");
// $ffi->utext_moveIndex32(ut, delta);
// ut : UText* in/out
// delta : INT
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Icuuc extends Library {
    Icuuc INSTANCE = Native.load("icuuc", Icuuc.class);
    byte utext_moveIndex32(
        Pointer ut,   // UText* in/out
        int delta   // INT
    );
}
@[Link("icuuc")]
lib Libicuuc
  fun utext_moveIndex32 = utext_moveIndex32(
    ut : UText*,   # UText* in/out
    delta : Int32   # INT
  ) : Int8
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef utext_moveIndex32Native = Int8 Function(Pointer<Void>, Int32);
typedef utext_moveIndex32Dart = int Function(Pointer<Void>, int);
final utext_moveIndex32 = DynamicLibrary.open('icuuc.dll')
    .lookupFunction<utext_moveIndex32Native, utext_moveIndex32Dart>('utext_moveIndex32');
// ut : UText* in/out -> Pointer<Void>
// delta : INT -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function utext_moveIndex32(
  ut: Pointer;   // UText* in/out
  delta: Integer   // INT
): Shortint; cdecl;
  external 'icuuc.dll' name 'utext_moveIndex32';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "utext_moveIndex32"
  c_utext_moveIndex32 :: Ptr () -> Int32 -> IO Int8
-- ut : UText* in/out -> Ptr ()
-- delta : INT -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let utext_moveindex32 =
  foreign "utext_moveIndex32"
    ((ptr void) @-> int32_t @-> returning int8_t)
(* ut : UText* in/out -> (ptr void) *)
(* delta : INT -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library icuuc (t "icuuc.dll"))
(cffi:use-foreign-library icuuc)

(cffi:defcfun ("utext_moveIndex32" utext-move-index32 :convention :cdecl) :int8
  (ut :pointer)   ; UText* in/out
  (delta :int32))   ; INT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $utext_moveIndex32 = Win32::API::More->new('icuuc',
    'char utext_moveIndex32(LPVOID ut, int delta)');
# my $ret = $utext_moveIndex32->Call($ut, $delta);
# ut : UText* in/out -> LPVOID
# delta : INT -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型