root/doc_inner/doxygen/latex/load_8c_source.tex

/* [<][>][^][v][top][bottom][index][help] */
\doxysection{load.\+c}
\label{load_8c_source}\index{src/load.c@{src/load.c}}
\textbf{ Go to the documentation of this file.}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{preprocessor}{\#include\ <stdio.h>}}
\DoxyCodeLine{00002\ \textcolor{preprocessor}{\#include\ <string.h>}}
\DoxyCodeLine{00003\ \textcolor{preprocessor}{\#include\ <assert.h>}}
\DoxyCodeLine{00004\ \textcolor{preprocessor}{\#include\ <stdlib.h>}}
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#include\ <ctype.h>}}
\DoxyCodeLine{00006\ }
\DoxyCodeLine{00007\ \textcolor{preprocessor}{\#include\ "{}word.h"{}}}
\DoxyCodeLine{00008\ \textcolor{preprocessor}{\#include\ "{}struct.h"{}}}
\DoxyCodeLine{00009\ \textcolor{preprocessor}{\#include\ "{}cerr.h"{}}}
\DoxyCodeLine{00010\ }
\DoxyCodeLine{00014\ \textcolor{keyword}{static}\ CERR\ cerr\_load[]\ =\ \{}
\DoxyCodeLine{00015\ \ \ \ \ \{\ 210,\ \textcolor{stringliteral}{"{}load\ -\/\ memory\ overflow"{}}\ \},}
\DoxyCodeLine{00016\ \ \ \ \ \{\ 211,\ \textcolor{stringliteral}{"{}object\ file\ not\ specified"{}}\ \},}
\DoxyCodeLine{00017\ \ \ \ \ \{\ 212,\ \textcolor{stringliteral}{"{}invalid\ option"{}}\ \},}
\DoxyCodeLine{00018\ \ \ \ \ \{\ 213,\ \textcolor{stringliteral}{"{}invalid\ argument"{}}\ \},}
\DoxyCodeLine{00019\ \};}
\DoxyCodeLine{00020\ }
\DoxyCodeLine{00021\ \textcolor{comment}{/*\ load.hで定義された関数群\ */}}
\DoxyCodeLine{00022\ \textcolor{keywordtype}{void}\ addcerrlist\_load()}
\DoxyCodeLine{00023\ \{}
\DoxyCodeLine{00024\ \ \ \ \ addcerrlist(ARRAYSIZE(cerr\_load),\ cerr\_load);}
\DoxyCodeLine{00025\ \}}
\DoxyCodeLine{00026\ }
\DoxyCodeLine{00027\ WORD\ loadassemble(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *file,\ WORD\ start)}
\DoxyCodeLine{00028\ \{}
\DoxyCodeLine{00029\ \ \ \ \ FILE\ *fp\ =\ NULL;}
\DoxyCodeLine{00030\ \ \ \ \ WORD\ end\ =\ 0;}
\DoxyCodeLine{00031\ }
\DoxyCodeLine{00032\ \ \ \ \ assert(file\ !=\ NULL);}
\DoxyCodeLine{00033\ \ \ \ \ \textcolor{keywordflow}{if}((fp\ =\ fopen(file,\ \textcolor{stringliteral}{"{}rb"{}}))\ ==\ NULL)\ \{}
\DoxyCodeLine{00034\ \ \ \ \ \ \ \ \ perror(file);}
\DoxyCodeLine{00035\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{00036\ \ \ \ \ \}}
\DoxyCodeLine{00037\ \ \ \ \ end\ =\ start\ +\ fread(sys-\/>memory\ +\ start,\ \textcolor{keyword}{sizeof}(WORD),\ sys-\/>memsize\ -\/\ start,\ fp);}
\DoxyCodeLine{00038\ \ \ \ \ \textcolor{keywordflow}{if}(end\ ==\ sys-\/>memsize)\ \{}
\DoxyCodeLine{00039\ \ \ \ \ \ \ \ \ setcerr(210,\ file);\ \ \ \ \textcolor{comment}{/*\ load\ -\/\ memory\ overflow\ */}}
\DoxyCodeLine{00040\ \ \ \ \ \ \ \ \ fprintf(stderr,\ \textcolor{stringliteral}{"{}Load\ error\ -\/\ \%d:\ \%s\(\backslash\)n"{}},\ cerr-\/>num,\ cerr-\/>msg);}
\DoxyCodeLine{00041\ \ \ \ \ \}}
\DoxyCodeLine{00042\ \ \ \ \ fclose(fp);}
\DoxyCodeLine{00043\ \ \ \ \ \textcolor{keywordflow}{return}\ end;}
\DoxyCodeLine{00044\ \}}

\end{DoxyCode}

/* [<][>][^][v][top][bottom][index][help] */