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

ubrk_preceding

関数
指定位置の直前にある境界位置を取得する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

INT ubrk_preceding(
    UBreakIterator* bi,
    INT offset
);

パラメーター

名前方向
biUBreakIterator*inout
offsetINTin

戻り値の型: INT

各言語での呼び出し定義

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

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

ubrk_preceding = ctypes.cdll.icuuc.ubrk_preceding
ubrk_preceding.restype = ctypes.c_int
ubrk_preceding.argtypes = [
    ctypes.c_void_p,  # bi : UBreakIterator* in/out
    ctypes.c_int,  # offset : INT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
ubrk_preceding = Fiddle::Function.new(
  lib['ubrk_preceding'],
  [
    Fiddle::TYPE_VOIDP,  # bi : UBreakIterator* in/out
    Fiddle::TYPE_INT,  # offset : INT
  ],
  Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn ubrk_preceding(
        bi: *mut isize,  // UBreakIterator* in/out
        offset: i32  // INT
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int ubrk_preceding(ref IntPtr bi, int offset);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ubrk_preceding' -Namespace Win32 -PassThru
# $api::ubrk_preceding(bi, offset)
#uselib "icuuc.dll"
#func global ubrk_preceding "ubrk_preceding" sptr, sptr
; ubrk_preceding bi, offset   ; 戻り値は stat
; bi : UBreakIterator* in/out -> "sptr"
; offset : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "icuuc.dll"
#cfunc global ubrk_preceding "ubrk_preceding" int, int
; res = ubrk_preceding(bi, offset)
; bi : UBreakIterator* in/out -> "int"
; offset : INT -> "int"
; INT ubrk_preceding(UBreakIterator* bi, INT offset)
#uselib "icuuc.dll"
#cfunc global ubrk_preceding "ubrk_preceding" int, int
; res = ubrk_preceding(bi, offset)
; bi : UBreakIterator* in/out -> "int"
; offset : INT -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procubrk_preceding = icuuc.NewProc("ubrk_preceding")
)

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