\doxysection{repl.\+c}
\hypertarget{repl_8c_source}{}\label{repl_8c_source}\index{workspace/post-\/scarcity/src/repl.c@{workspace/post-\/scarcity/src/repl.c}}
\mbox{\hyperlink{repl_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00001}00001\ \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00002}00002\ \textcolor{comment}{\ *\ repl.c}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00003}00003\ \textcolor{comment}{\ *}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00004}00004\ \textcolor{comment}{\ *\ the\ read/eval/print\ loop}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00005}00005\ \textcolor{comment}{\ *}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00006}00006\ \textcolor{comment}{\ *\ (c)\ 2017\ Simon\ Brooke\ <simon@journeyman.cc>}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00007}00007\ \textcolor{comment}{\ *\ Licensed\ under\ GPL\ version\ 2.0,\ or,\ at\ your\ option,\ any\ later\ version.}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00008}00008\ \textcolor{comment}{\ */}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00009}00009\ }
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00010}00010\ \textcolor{preprocessor}{\#include\ <stdbool.h>}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00011}00011\ \textcolor{preprocessor}{\#include\ <stdio.h>}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00012}00012\ \textcolor{preprocessor}{\#include\ <wchar.h>}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00013}00013\ \textcolor{preprocessor}{\#include\ <signal.h>}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00014}00014\ }
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00015}00015\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{consspaceobject_8h}{memory/consspaceobject.h}}"{}}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00016}00016\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{debug_8h}{debug.h}}"{}}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00017}00017\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{intern_8h}{ops/intern.h}}"{}}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00018}00018\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{lispops_8h}{ops/lispops.h}}"{}}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00019}00019\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{stack_8h}{memory/stack.h}}"{}}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00020}00020\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00021}00021\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00022}00022\ \textcolor{comment}{\ *\ @brief\ Handle\ an\ interrupt\ signal.}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00023}00023\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00024}00024\ \textcolor{comment}{\ *\ @param\ dummy\ }}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00025}00025\ \textcolor{comment}{\ */}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00026}\mbox{\hyperlink{repl_8c_a9e1874568e9a77889a1bf51abbaaa5b0}{00026}}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{repl_8c_a9e1874568e9a77889a1bf51abbaaa5b0}{int\_handler}}(\ \textcolor{keywordtype}{int}\ dummy\ )\ \{}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00027}00027\ \ \ \ \ wprintf(\ L\textcolor{stringliteral}{"{}TODO:\ handle\ ctrl-\/C\ in\ a\ more\ interesting\ way\(\backslash\)n"{}}\ );}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00028}00028\ \}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00029}00029\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00030}00030\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00031}00031\ \textcolor{comment}{\ *\ The\ read/eval/print\ loop.}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00032}00032\ \textcolor{comment}{\ */}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00033}\mbox{\hyperlink{repl_8c_a34fa27b192f788b6c3f8386f3d9383b1}{00033}}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{repl_8c_a34fa27b192f788b6c3f8386f3d9383b1}{repl}}(\ \ )\ \{}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00034}00034\ \ \ \ \ signal(\ SIGINT,\ \mbox{\hyperlink{repl_8c_a9e1874568e9a77889a1bf51abbaaa5b0}{int\_handler}}\ );}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00035}00035\ \ \ \ \ \mbox{\hyperlink{debug_8c_ad55e4f61e076944d705d98b5314c5181}{debug\_print}}(\ L\textcolor{stringliteral}{"{}Entered\ repl\(\backslash\)n"{}},\ \mbox{\hyperlink{debug_8h_a9d33eefe5658ff19d53df47d625cc01b}{DEBUG\_REPL}}\ );}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00036}00036\ }
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00037}00037\ \ \ \ \ \textcolor{keyword}{struct\ }\mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ env\ =}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00038}00038\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{consspaceobject_8h_a69012ee77381bb1d51aafa1002f64430}{consp}}(\ \mbox{\hyperlink{intern_8c_aca78d8df225fa73eef263164d8427430}{oblist}}\ )\ ?\ \mbox{\hyperlink{intern_8c_aca78d8df225fa73eef263164d8427430}{oblist}}\ :\ \mbox{\hyperlink{consspaceobject_8c_afff9c83c8c250837b5737c11e21cc4ca}{make\_cons}}(\ \mbox{\hyperlink{intern_8c_aca78d8df225fa73eef263164d8427430}{oblist}},\ \mbox{\hyperlink{consspaceobject_8h_a263efce0e5cda1d387a1a43f94715445}{NIL}}\ );}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00039}00039\ }
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00040}00040\ \ \ \ \ \textcolor{comment}{/*\ bottom\ of\ stack\ */}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00041}00041\ \ \ \ \ \textcolor{keyword}{struct\ }\mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ frame\_pointer\ =\ \mbox{\hyperlink{stack_8c_af448982b321038e7c24a5873b74533a7}{make\_stack\_frame}}(\ \mbox{\hyperlink{consspaceobject_8h_a263efce0e5cda1d387a1a43f94715445}{NIL}},\ \mbox{\hyperlink{consspaceobject_8h_a263efce0e5cda1d387a1a43f94715445}{NIL}},\ env\ );}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00042}00042\ }
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00043}00043\ \ \ \ \ \textcolor{keywordflow}{if}\ (\ !\mbox{\hyperlink{consspaceobject_8h_a758a42bfac22caaf66e29c666c91702d}{nilp}}(\ frame\_pointer\ )\ )\ \{}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00044}00044\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{lispops_8c_ab9755455107909ddd1f0f4eaacebd3e1}{lisp\_repl}}(\ \mbox{\hyperlink{stack_8c_a81653b4495f0fd4e7e49b9bd99e8e8db}{get\_stack\_frame}}(\ frame\_pointer\ ),\ frame\_pointer,\ env\ );}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00045}00045\ }
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00046}00046\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{consspaceobject_8c_aecb4a52465163e0377356bcaa85539bf}{dec\_ref}}(\ frame\_pointer\ );}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00047}00047\ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00048}00048\ }
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00049}00049\ \ \ \ \ \mbox{\hyperlink{debug_8c_ad55e4f61e076944d705d98b5314c5181}{debug\_print}}(\ L\textcolor{stringliteral}{"{}Leaving\ repl\(\backslash\)n"{}},\ \mbox{\hyperlink{debug_8h_a9d33eefe5658ff19d53df47d625cc01b}{DEBUG\_REPL}}\ );}
\DoxyCodeLine{\Hypertarget{repl_8c_source_l00050}00050\ \}}

\end{DoxyCode}
