\section{dkc\-OSIndependent.c File Reference}
\label{dkcOSIndependent_8c}\index{dkcOSIndependent.c@{dkcOSIndependent.c}}
{\tt \#include \char`\"{}dkc\-OSIndependent.h\char`\"{}}\par
{\tt \#include \char`\"{}dkc\-Defined.h\char`\"{}}\par
{\tt \#include $<$assert.h$>$}\par
{\tt \#include $<$math.h$>$}\par


Include dependency graph for dkc\-OSIndependent.c:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=168pt]{dkcOSIndependent_8c__incl}
\end{center}
\end{figure}
\subsection*{Functions}
\begin{CompactItemize}
\item 
int WINAPI {\bf dkc\-Is\-Native\-Path\-String} (const char $\ast$s, size\_\-t size)
\begin{CompactList}\small\item\em FALSEならNativeなファイルパスではない。. \item\end{CompactList}\item 
int WINAPI {\bf dkc\-Error\-Message} (const char $\ast$expression, const char $\ast$filename, size\_\-t line, const char $\ast$message,...)
\item 
void $\ast$ {\bf dkc\-Allocate} (size\_\-t size)
\item 
int {\bf dkc\-Free} (void $\ast$$\ast$p)
\item 
{\bf BOOL} {\bf dkc\-Is\_\-foepn\_\-mode} (const char $\ast$s)
\begin{CompactList}\small\item\em fopenの時の第二引数が有効な値かどうか調べる。 \item\end{CompactList}\item 
size\_\-t {\bf dkc\-Reallocate\-Size\-Function} (size\_\-t Old\-Size, size\_\-t Expand\-Size)
\item 
int WINAPI {\bf dkc\-Reallocate} (void $\ast$$\ast$New\-Ptr, size\_\-t New\-Size, void $\ast$$\ast$Old\-Ptr)
\item 
int WINAPI {\bf dkc\-Reallocate\-Ex} ({\bf DKC\_\-REALLOC\_\-F\_\-TYPE} your\_\-realloc, void $\ast$$\ast$New\-Ptr, size\_\-t New\-Size, void $\ast$$\ast$Old\-Ptr)
\begin{CompactList}\small\item\em edk\_\-SUCCEEDEDだったら成功 \item\end{CompactList}\item 
int WINAPI {\bf dkc\-Reallocate\-Auto\-Expand} ({\bf DKC\_\-REALLOC\_\-F\_\-TYPE} your\_\-realloc, void $\ast$$\ast$New\-Ptr, void $\ast$$\ast$Old\-Ptr, size\_\-t Old\-Size, size\_\-t $\ast$reallocated\_\-size)
\item 
DKC\_\-EXTERN FILE $\ast$WINAPI {\bf dkc\-FOpen} (const char $\ast$filename, const char $\ast$mode)
\begin{CompactList}\small\item\em fopenのラッパー \item\end{CompactList}\item 
DKC\_\-EXTERN int WINAPI {\bf dkc\-FClose} (FILE $\ast$$\ast$ptr)
\begin{CompactList}\small\item\em fcloseのラッパー \item\end{CompactList}\item 
int WINAPI {\bf dkc\-Save\-Binary} (const void $\ast$data, size\_\-t size, const char $\ast$fname)
\begin{CompactList}\small\item\em fopenのファイル関数を使ってバイナリセーブを行う。 \item\end{CompactList}\item 
{\bf BOOL} WINAPI {\bf dkc\-Create\-Empty\-File} (const char $\ast$filename)
\begin{CompactList}\small\item\em 空ファイルを作る。 \item\end{CompactList}\item 
int WINAPI {\bf dkc\-Load\-Binary} (void $\ast$data, size\_\-t size, const char $\ast$fname, size\_\-t $\ast$readsize)
\begin{CompactList}\small\item\em バイナリデータをメモリに読み込む。dkc\-Save\-Binary()と対 \item\end{CompactList}\item 
int WINAPI {\bf dkc\-Save\-Text} (const char $\ast$text, size\_\-t length, const char $\ast$fname)
\begin{CompactList}\small\item\em fopenでテキストセーブを行う \item\end{CompactList}\item 
int WINAPI {\bf dkc\-Load\-Text} (char $\ast$text, size\_\-t length, const char $\ast$fname, size\_\-t $\ast$readsize)
\begin{CompactList}\small\item\em テキストデータをメモリに読み込む。dkc\-Save\-Text()と対 \item\end{CompactList}\item 
void WINAPI {\bf dkc\-Swap\-Fast} (void $\ast$p1, void $\ast$p2, size\_\-t size)
\item 
void WINAPI {\bf dkc\-Swap64} (ULONGLONG $\ast$p1, ULONGLONG $\ast$p2, size\_\-t size)
\item 
void WINAPI {\bf dkc\-Swap} (void $\ast$p1, void $\ast$p2, size\_\-t size)
\item 
const char $\ast$ {\bf dkc\-Get\-Path\-Sep} ()
\begin{CompactList}\small\item\em path separatorの入った文字列(1byte毎にpath separatorの文字定数が入っている)をゲット \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
d金魚 @

\subsection{Function Documentation}
\index{dkcOSIndependent.c@{dkc\-OSIndependent.c}!dkcAllocate@{dkcAllocate}}
\index{dkcAllocate@{dkcAllocate}!dkcOSIndependent.c@{dkc\-OSIndependent.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ dkc\-Allocate (size\_\-t {\em size})}\label{dkcOSIndependent_8c_a2}


\index{dkcOSIndependent.c@{dkc\-OSIndependent.c}!dkcCreateEmptyFile@{dkcCreateEmptyFile}}
\index{dkcCreateEmptyFile@{dkcCreateEmptyFile}!dkcOSIndependent.c@{dkc\-OSIndependent.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf BOOL} WINAPI dkc\-Create\-Empty\-File (const char $\ast$ {\em filename})}\label{dkcOSIndependent_8c_a14}


空ファイルを作る。 

\index{dkcOSIndependent.c@{dkc\-OSIndependent.c}!dkcErrorMessage@{dkcErrorMessage}}
\index{dkcErrorMessage@{dkcErrorMessage}!dkcOSIndependent.c@{dkc\-OSIndependent.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int WINAPI dkc\-Error\-Message (const char $\ast$ {\em expression}, const char $\ast$ {\em filename}, size\_\-t {\em line}, const char $\ast$ {\em message}, ...)}\label{dkcOSIndependent_8c_a1}


\begin{Desc}
\item[Returns:]almost {\bf TRUE(1)}{\rm (p.\,\pageref{dkcOSIndependent_8h_a5})} \end{Desc}
\index{dkcOSIndependent.c@{dkc\-OSIndependent.c}!dkcFClose@{dkcFClose}}
\index{dkcFClose@{dkcFClose}!dkcOSIndependent.c@{dkc\-OSIndependent.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}DKC\_\-EXTERN int WINAPI dkc\-FClose (FILE $\ast$$\ast$ {\em ptr})}\label{dkcOSIndependent_8c_a12}


fcloseのラッパー 

\index{dkcOSIndependent.c@{dkc\-OSIndependent.c}!dkcFOpen@{dkcFOpen}}
\index{dkcFOpen@{dkcFOpen}!dkcOSIndependent.c@{dkc\-OSIndependent.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}DKC\_\-EXTERN FILE$\ast$ WINAPI dkc\-FOpen (const char $\ast$ {\em filename}, const char $\ast$ {\em mode})}\label{dkcOSIndependent_8c_a11}


fopenのラッパー 

\index{dkcOSIndependent.c@{dkc\-OSIndependent.c}!dkcFree@{dkcFree}}
\index{dkcFree@{dkcFree}!dkcOSIndependent.c@{dkc\-OSIndependent.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int dkc\-Free (void $\ast$$\ast$ {\em p})}\label{dkcOSIndependent_8c_a3}


\index{dkcOSIndependent.c@{dkc\-OSIndependent.c}!dkcGetPathSep@{dkcGetPathSep}}
\index{dkcGetPathSep@{dkcGetPathSep}!dkcOSIndependent.c@{dkc\-OSIndependent.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ dkc\-Get\-Path\-Sep ()}\label{dkcOSIndependent_8c_a21}


path separatorの入った文字列(1byte毎にpath separatorの文字定数が入っている)をゲット 

\index{dkcOSIndependent.c@{dkc\-OSIndependent.c}!dkcIs_foepn_mode@{dkcIs\_\-foepn\_\-mode}}
\index{dkcIs_foepn_mode@{dkcIs\_\-foepn\_\-mode}!dkcOSIndependent.c@{dkc\-OSIndependent.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf BOOL} dkc\-Is\_\-foepn\_\-mode (const char $\ast$ {\em s})}\label{dkcOSIndependent_8c_a4}


fopenの時の第二引数が有効な値かどうか調べる。 

\index{dkcOSIndependent.c@{dkc\-OSIndependent.c}!dkcIsNativePathString@{dkcIsNativePathString}}
\index{dkcIsNativePathString@{dkcIsNativePathString}!dkcOSIndependent.c@{dkc\-OSIndependent.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int WINAPI dkc\-Is\-Native\-Path\-String (const char $\ast$ {\em s}, size\_\-t {\em size})}\label{dkcOSIndependent_8c_a0}


FALSEならNativeなファイルパスではない。. 

\index{dkcOSIndependent.c@{dkc\-OSIndependent.c}!dkcLoadBinary@{dkcLoadBinary}}
\index{dkcLoadBinary@{dkcLoadBinary}!dkcOSIndependent.c@{dkc\-OSIndependent.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int WINAPI dkc\-Load\-Binary (void $\ast$ {\em data}, size\_\-t {\em size}, const char $\ast$ {\em fname}, size\_\-t $\ast$ {\em readsize})}\label{dkcOSIndependent_8c_a15}


バイナリデータをメモリに読み込む。dkc\-Save\-Binary()と対 

\index{dkcOSIndependent.c@{dkc\-OSIndependent.c}!dkcLoadText@{dkcLoadText}}
\index{dkcLoadText@{dkcLoadText}!dkcOSIndependent.c@{dkc\-OSIndependent.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int WINAPI dkc\-Load\-Text (char $\ast$ {\em text}, size\_\-t {\em length}, const char $\ast$ {\em fname}, size\_\-t $\ast$ {\em readsize})}\label{dkcOSIndependent_8c_a17}


テキストデータをメモリに読み込む。dkc\-Save\-Text()と対 

\index{dkcOSIndependent.c@{dkc\-OSIndependent.c}!dkcReallocate@{dkcReallocate}}
\index{dkcReallocate@{dkcReallocate}!dkcOSIndependent.c@{dkc\-OSIndependent.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int WINAPI dkc\-Reallocate (void $\ast$$\ast$ {\em New\-Ptr}, size\_\-t {\em New\-Size}, void $\ast$$\ast$ {\em Old\-Ptr})}\label{dkcOSIndependent_8c_a6}


\index{dkcOSIndependent.c@{dkc\-OSIndependent.c}!dkcReallocateAutoExpand@{dkcReallocateAutoExpand}}
\index{dkcReallocateAutoExpand@{dkcReallocateAutoExpand}!dkcOSIndependent.c@{dkc\-OSIndependent.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int WINAPI dkc\-Reallocate\-Auto\-Expand ({\bf DKC\_\-REALLOC\_\-F\_\-TYPE} {\em your\_\-realloc}, void $\ast$$\ast$ {\em New\-Ptr}, void $\ast$$\ast$ {\em Old\-Ptr}, size\_\-t {\em Old\-Size}, size\_\-t $\ast$ {\em reallocated\_\-size})}\label{dkcOSIndependent_8c_a8}


\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em your\_\-realloc\mbox{[}in\mbox{]}}]reallocする関数 \item[{\em New\-Ptr\mbox{[}out\mbox{]}}]新しいメモリ空間アドレス \item[{\em Old\-Ptr\mbox{[}in\mbox{]}\mbox{[}out\mbox{]}}]古いメモリ空間アドレス。関数が成功すると、Old\-Ptrは無効になる \item[{\em Old\-Size\mbox{[}in\mbox{]}}]Old\-Ptrのサイズ \item[{\em reallocated\_\-size\mbox{[}out\mbox{]}}]確保したサイズ \end{description}
\end{Desc}
\begin{Desc}
\item[Note:]メモリサイズ拡張専用 \end{Desc}
\index{dkcOSIndependent.c@{dkc\-OSIndependent.c}!dkcReallocateEx@{dkcReallocateEx}}
\index{dkcReallocateEx@{dkcReallocateEx}!dkcOSIndependent.c@{dkc\-OSIndependent.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int WINAPI dkc\-Reallocate\-Ex ({\bf DKC\_\-REALLOC\_\-F\_\-TYPE} {\em your\_\-realloc}, void $\ast$$\ast$ {\em New\-Ptr}, size\_\-t {\em New\-Size}, void $\ast$$\ast$ {\em Old\-Ptr})}\label{dkcOSIndependent_8c_a7}


edk\_\-SUCCEEDEDだったら成功 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em your\_\-realloc\mbox{[}in\mbox{]}}]reallocする関数 \item[{\em New\-Ptr\mbox{[}out\mbox{]}}]新しいメモリ空間アドレス \item[{\em New\-Size\mbox{[}in\mbox{]}}]新しいメモリ空間アドレスのサイズ。 \item[{\em Old\-Ptr\mbox{[}in\mbox{]}\mbox{[}out\mbox{]}}]古いメモリ空間アドレス。関数が成功すると、Old\-Ptrは無効になる \item[{\em Old\-Size\mbox{[}in\mbox{]}}]Old\-Ptrのサイズ \end{description}
\end{Desc}
\index{dkcOSIndependent.c@{dkc\-OSIndependent.c}!dkcReallocateSizeFunction@{dkcReallocateSizeFunction}}
\index{dkcReallocateSizeFunction@{dkcReallocateSizeFunction}!dkcOSIndependent.c@{dkc\-OSIndependent.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}size\_\-t dkc\-Reallocate\-Size\-Function (size\_\-t {\em Old\-Size}, size\_\-t {\em Expand\-Size})}\label{dkcOSIndependent_8c_a5}


\index{dkcOSIndependent.c@{dkc\-OSIndependent.c}!dkcSaveBinary@{dkcSaveBinary}}
\index{dkcSaveBinary@{dkcSaveBinary}!dkcOSIndependent.c@{dkc\-OSIndependent.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int WINAPI dkc\-Save\-Binary (const void $\ast$ {\em data}, size\_\-t {\em size}, const char $\ast$ {\em fname})}\label{dkcOSIndependent_8c_a13}


fopenのファイル関数を使ってバイナリセーブを行う。 

\index{dkcOSIndependent.c@{dkc\-OSIndependent.c}!dkcSaveText@{dkcSaveText}}
\index{dkcSaveText@{dkcSaveText}!dkcOSIndependent.c@{dkc\-OSIndependent.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int WINAPI dkc\-Save\-Text (const char $\ast$ {\em text}, size\_\-t {\em length}, const char $\ast$ {\em fname})}\label{dkcOSIndependent_8c_a16}


fopenでテキストセーブを行う 

\index{dkcOSIndependent.c@{dkc\-OSIndependent.c}!dkcSwap@{dkcSwap}}
\index{dkcSwap@{dkcSwap}!dkcOSIndependent.c@{dkc\-OSIndependent.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void WINAPI dkc\-Swap (void $\ast$ {\em p1}, void $\ast$ {\em p2}, size\_\-t {\em size})}\label{dkcOSIndependent_8c_a20}


演算でSwapさせる。SWAP\_\-NUM()ソ}クロを参照。 \index{dkcOSIndependent.c@{dkc\-OSIndependent.c}!dkcSwap64@{dkcSwap64}}
\index{dkcSwap64@{dkcSwap64}!dkcOSIndependent.c@{dkc\-OSIndependent.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void WINAPI dkc\-Swap64 (ULONGLONG $\ast$ {\em p1}, ULONGLONG $\ast$ {\em p2}, size\_\-t {\em size})}\label{dkcOSIndependent_8c_a19}


\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em p1\mbox{[}in\mbox{]}}]ULONGLONG $\ast$のバッファへのポインタ \item[{\em p2\mbox{[}in\mbox{]}}]ULONGLONG $\ast$のバッファへのポインタ \item[{\em size\mbox{[}in\mbox{]}}]p1,p2バッファのサイズ \end{description}
\end{Desc}
\begin{Desc}
\item[Note:]p1,p2共にULONGLONG $\ast$に強制型キャストしてください。 \end{Desc}
\index{dkcOSIndependent.c@{dkc\-OSIndependent.c}!dkcSwapFast@{dkcSwapFast}}
\index{dkcSwapFast@{dkcSwapFast}!dkcOSIndependent.c@{dkc\-OSIndependent.c}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void WINAPI dkc\-Swap\-Fast (void $\ast$ {\em p1}, void $\ast$ {\em p2}, size\_\-t {\em size})}\label{dkcOSIndependent_8c_a18}


どんな方法でもいいからともかく速くSwapさせる。 \begin{Desc}
\item[Note:]size分のメモリを動的確保してスワップします。 \end{Desc}
