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

ucnv_fixFileSeparator

関数
EBCDIC系コンバーターでパス区切り文字を修正する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

void ucnv_fixFileSeparator(
    const UConverter* cnv,
    WORD* source,
    INT sourceLen
);

パラメーター

名前方向
cnvUConverter*in
sourceWORD*inout
sourceLenINTin

戻り値の型: void

各言語での呼び出し定義

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

void ucnv_fixFileSeparator(
    const UConverter* cnv,
    WORD* source,
    INT sourceLen
);
[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern void ucnv_fixFileSeparator(
    ref IntPtr cnv,   // UConverter*
    ref ushort source,   // WORD* in/out
    int sourceLen   // INT
);
<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Sub ucnv_fixFileSeparator(
    ByRef cnv As IntPtr,   ' UConverter*
    ByRef source As UShort,   ' WORD* in/out
    sourceLen As Integer   ' INT
)
End Sub
' cnv : UConverter*
' source : WORD* in/out
' sourceLen : INT
Declare PtrSafe Sub ucnv_fixFileSeparator Lib "icuuc" ( _
    ByRef cnv As LongPtr, _
    ByRef source As Integer, _
    ByVal sourceLen As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ucnv_fixFileSeparator = ctypes.cdll.icuuc.ucnv_fixFileSeparator
ucnv_fixFileSeparator.restype = None
ucnv_fixFileSeparator.argtypes = [
    ctypes.c_void_p,  # cnv : UConverter*
    ctypes.POINTER(ctypes.c_ushort),  # source : WORD* in/out
    ctypes.c_int,  # sourceLen : INT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
ucnv_fixFileSeparator = Fiddle::Function.new(
  lib['ucnv_fixFileSeparator'],
  [
    Fiddle::TYPE_VOIDP,  # cnv : UConverter*
    Fiddle::TYPE_VOIDP,  # source : WORD* in/out
    Fiddle::TYPE_INT,  # sourceLen : INT
  ],
  Fiddle::TYPE_VOID, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn ucnv_fixFileSeparator(
        cnv: *const isize,  // UConverter*
        source: *mut u16,  // WORD* in/out
        sourceLen: i32  // INT
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void ucnv_fixFileSeparator(ref IntPtr cnv, ref ushort source, int sourceLen);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_ucnv_fixFileSeparator' -Namespace Win32 -PassThru
# $api::ucnv_fixFileSeparator(cnv, source, sourceLen)
#uselib "icuuc.dll"
#func global ucnv_fixFileSeparator "ucnv_fixFileSeparator" sptr, sptr, sptr
; ucnv_fixFileSeparator cnv, varptr(source), sourceLen
; cnv : UConverter* -> "sptr"
; source : WORD* in/out -> "sptr"
; sourceLen : INT -> "sptr"
出力引数:
#uselib "icuuc.dll"
#func global ucnv_fixFileSeparator "ucnv_fixFileSeparator" int, var, int
; ucnv_fixFileSeparator cnv, source, sourceLen
; cnv : UConverter* -> "int"
; source : WORD* in/out -> "var"
; sourceLen : INT -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; void ucnv_fixFileSeparator(UConverter* cnv, WORD* source, INT sourceLen)
#uselib "icuuc.dll"
#func global ucnv_fixFileSeparator "ucnv_fixFileSeparator" int, var, int
; ucnv_fixFileSeparator cnv, source, sourceLen
; cnv : UConverter* -> "int"
; source : WORD* in/out -> "var"
; sourceLen : INT -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procucnv_fixFileSeparator = icuuc.NewProc("ucnv_fixFileSeparator")
)

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