\doxysection{conspage.\+h}
\hypertarget{conspage_8h_source}{}\label{conspage_8h_source}\index{workspace/post-\/scarcity/src/memory/conspage.h@{workspace/post-\/scarcity/src/memory/conspage.h}}
\mbox{\hyperlink{conspage_8h}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00001}00001\ \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00002}00002\ \textcolor{comment}{\ *\ conspage.h}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00003}00003\ \textcolor{comment}{\ *}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00004}00004\ \textcolor{comment}{\ *\ Setup\ and\ tear\ down\ cons\ pages,\ and\ (FOR\ NOW)\ do\ primitive}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00005}00005\ \textcolor{comment}{\ *\ allocation/deallocation\ of\ cells.}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00006}00006\ \textcolor{comment}{\ *\ NOTE\ THAT\ before\ we\ go\ multi-\/threaded,\ these\ functions\ must\ be}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00007}00007\ \textcolor{comment}{\ *\ aggressively}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00008}00008\ \textcolor{comment}{\ *\ thread\ safe.}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00009}00009\ \textcolor{comment}{\ *}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00010}00010\ \textcolor{comment}{\ *\ (c)\ 2017\ Simon\ Brooke\ <simon@journeyman.cc>}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00011}00011\ \textcolor{comment}{\ *\ Licensed\ under\ GPL\ version\ 2.0,\ or,\ at\ your\ option,\ any\ later\ version.}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00012}00012\ \textcolor{comment}{\ */}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00013}00013\ \textcolor{preprocessor}{\#ifndef\ \_\_psse\_conspage\_h}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00014}00014\ \textcolor{preprocessor}{\#define\ \_\_psse\_conspage\_h}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00015}00015\ }
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00016}00016\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{consspaceobject_8h}{memory/consspaceobject.h}}"{}}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00017}00017\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00018}00018\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00019}00019\ \textcolor{comment}{\ *\ the\ number\ of\ cons\ cells\ on\ a\ cons\ page.\ The\ maximum\ value\ this\ can}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00020}00020\ \textcolor{comment}{\ *\ be\ (and\ consequently,\ the\ size\ which,\ by\ version\ 1,\ it\ will\ default}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00021}00021\ \textcolor{comment}{\ *\ to)\ is\ the\ maximum\ value\ of\ an\ unsigned\ 32\ bit\ integer,\ which\ is\ to}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00022}00022\ \textcolor{comment}{\ *\ say\ 4294967296.\ However,\ we'll\ start\ small.}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00023}00023\ \textcolor{comment}{\ */}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00024}\mbox{\hyperlink{conspage_8h_a384a2520aa9fc6aa1dc6528b2795edab}{00024}}\ \textcolor{preprocessor}{\#define\ CONSPAGESIZE\ 1024}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00025}00025\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00026}00026\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00027}00027\ \textcolor{comment}{\ *\ the\ number\ of\ cons\ pages\ we\ will\ initially\ allow\ for.\ For}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00028}00028\ \textcolor{comment}{\ *\ convenience\ we'll\ set\ up\ an\ array\ of\ cons\ pages\ this\ big;\ however,}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00029}00029\ \textcolor{comment}{\ *\ later\ we\ will\ want\ a\ mechanism\ for\ this\ to\ be\ able\ to\ grow}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00030}00030\ \textcolor{comment}{\ *\ dynamically\ to\ the\ maximum\ we\ can\ currently\ allow,\ which\ is}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00031}00031\ \textcolor{comment}{\ *\ 4294967296.}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00032}00032\ \textcolor{comment}{\ *}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00033}00033\ \textcolor{comment}{\ *\ Note\ that\ this\ means\ the\ total\ number\ of\ addressable\ cons\ cells\ is}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00034}00034\ \textcolor{comment}{\ *\ 1.8e19,\ each\ of\ 20\ bytes;\ or\ 3e20\ bytes\ in\ total;\ and\ there\ are}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00035}00035\ \textcolor{comment}{\ *\ up\ to\ a\ maximum\ of\ 4e9\ of\ heap\ space\ objects,\ each\ of\ potentially}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00036}00036\ \textcolor{comment}{\ *\ 4e9\ bytes.\ So\ we're\ talking\ about\ a\ potential\ total\ of\ 8e100\ bytes}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00037}00037\ \textcolor{comment}{\ *\ of\ addressable\ memory,\ which\ is\ only\ slightly\ more\ than\ the}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00038}00038\ \textcolor{comment}{\ *\ number\ of\ atoms\ in\ the\ universe.}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00039}00039\ \textcolor{comment}{\ */}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00040}\mbox{\hyperlink{conspage_8h_a2656b2b52cfab9ff1a7f8cf63e5d111f}{00040}}\ \textcolor{preprocessor}{\#define\ NCONSPAGES\ 64}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00041}00041\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00042}00042\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00043}00043\ \textcolor{comment}{\ *\ a\ cons\ page\ is\ essentially\ just\ an\ array\ of\ cons\ space\ objects.\ It}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00044}00044\ \textcolor{comment}{\ *\ might\ later\ have\ a\ local\ free\ list\ (i.e.\ list\ of\ free\ cells\ on\ this}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00045}00045\ \textcolor{comment}{\ *\ page)\ and\ a\ pointer\ to\ the\ next\ cons\ page,\ but\ my\ current\ view\ is}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00046}00046\ \textcolor{comment}{\ *\ that\ that's\ probably\ unneccessary.}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00047}00047\ \textcolor{comment}{\ */}}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00048}\mbox{\hyperlink{conspage_8h}{00048}}\ \textcolor{keyword}{struct\ }\mbox{\hyperlink{conspage_8h_structcons__page}{cons\_page}}\ \{}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00049}\mbox{\hyperlink{conspage_8h_aa1b41597ee18aa5db40910014d12d762}{00049}}\ \ \ \ \ \textcolor{keyword}{struct\ }\mbox{\hyperlink{consspaceobject_8h_structcons__space__object}{cons\_space\_object}}\ \mbox{\hyperlink{conspage_8h_aa1b41597ee18aa5db40910014d12d762}{cell}}[\mbox{\hyperlink{conspage_8h_a384a2520aa9fc6aa1dc6528b2795edab}{CONSPAGESIZE}}];}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00050}00050\ \};}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00051}00051\ }
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00052}00052\ \textcolor{keyword}{extern}\ \textcolor{keyword}{struct\ }\mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ \mbox{\hyperlink{conspage_8h_ae0a20197a96d9f07dac864b925cd0f32}{freelist}};}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00053}00053\ }
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00054}00054\ \textcolor{keyword}{extern}\ \textcolor{keyword}{struct\ }\mbox{\hyperlink{conspage_8h_structcons__page}{cons\_page}}\ *\mbox{\hyperlink{conspage_8h_a7cce1a2d3dd8b5abe5e30622d94e6959}{conspages}}[\mbox{\hyperlink{conspage_8h_a2656b2b52cfab9ff1a7f8cf63e5d111f}{NCONSPAGES}}];}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00055}00055\ }
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00056}00056\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{conspage_8h_a7cf88f8487cd8fef12fdd78a2aaa6216}{free\_cell}}(\ \textcolor{keyword}{struct}\ \mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ pointer\ );}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00057}00057\ }
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00058}00058\ \textcolor{keyword}{struct\ }\mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ \mbox{\hyperlink{conspage_8h_a04ba7c874b05e9789d0aca9ee6b106a7}{allocate\_cell}}(\ uint32\_t\ tag\ );}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00059}00059\ }
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00060}00060\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{conspage_8h_aeb73441904896a283f5b57298479bc4a}{initialise\_cons\_pages}}(\ \ );}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00061}00061\ }
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00062}00062\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{conspage_8h_a8078785bb1865878f934d02b28e600d9}{dump\_pages}}(\ \mbox{\hyperlink{fopen_8h_structfcurl__data}{URL\_FILE}}\ *\ output\ );}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00063}00063\ }
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00064}00064\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{conspage_8h_ab8d9d6417f194dca8d8322301cf37c7c}{summarise\_allocation}}(\ \ );}
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00065}00065\ }
\DoxyCodeLine{\Hypertarget{conspage_8h_source_l00066}00066\ \textcolor{preprocessor}{\#endif}}

\end{DoxyCode}
