\doxysection{hashmap.\+c}
\hypertarget{hashmap_8c_source}{}\label{hashmap_8c_source}\index{workspace/post-\/scarcity/src/memory/hashmap.c@{workspace/post-\/scarcity/src/memory/hashmap.c}}
\mbox{\hyperlink{hashmap_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00001}00001\ \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00002}00002\ \textcolor{comment}{\ *\ hashmap.c}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00003}00003\ \textcolor{comment}{\ *}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00004}00004\ \textcolor{comment}{\ *\ Basic\ implementation\ of\ a\ hashmap.}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00005}00005\ \textcolor{comment}{\ *}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00006}00006\ \textcolor{comment}{\ *\ (c)\ 2021\ Simon\ Brooke\ <simon@journeyman.cc>}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00007}00007\ \textcolor{comment}{\ *\ Licensed\ under\ GPL\ version\ 2.0,\ or,\ at\ your\ option,\ any\ later\ version.}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00008}00008\ \textcolor{comment}{\ */}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00009}00009\ }
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00010}00010\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{integer_8h}{arith/integer.h}}"{}}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00011}00011\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{peano_8h}{arith/peano.h}}"{}}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00012}00012\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{authorise_8h}{authorise.h}}"{}}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00013}00013\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{debug_8h}{debug.h}}"{}}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00014}00014\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{intern_8h}{ops/intern.h}}"{}}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00015}00015\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{print_8h}{io/print.h}}"{}}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00016}00016\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{conspage_8h}{memory/conspage.h}}"{}}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00017}00017\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{consspaceobject_8h}{memory/consspaceobject.h}}"{}}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00018}00018\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{hashmap_8h}{memory/hashmap.h}}"{}}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00019}00019\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{vectorspace_8h}{memory/vectorspace.h}}"{}}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00020}00020\ }
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00021}00021\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00022}00022\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00023}00023\ \textcolor{comment}{\ *\ A\ lisp\ function\ signature\ conforming\ wrapper\ around\ get\_hash,\ q.v..}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00024}00024\ \textcolor{comment}{\ */}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00025}\mbox{\hyperlink{hashmap_8c_a5031fd9c2432819ee4e7d1ba5f4812ce}{00025}}\ \textcolor{keyword}{struct\ }\mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ \mbox{\hyperlink{hashmap_8c_a5031fd9c2432819ee4e7d1ba5f4812ce}{lisp\_get\_hash}}(\ struct\ \mbox{\hyperlink{consspaceobject_8h_structstack__frame}{stack\_frame}}\ *frame,}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00026}00026\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }\mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ frame\_pointer,}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00027}00027\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ struct\ \mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ env\ )\ \{}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00028}00028\ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{integer_8c_afff1d31bb49e1be78395b0803b0b2514}{make\_integer}}(\ \mbox{\hyperlink{intern_8c_a89bab54666e014aba6cbb9c4ab4c9c2a}{get\_hash}}(\ frame-\/>arg[0]\ ),\ \mbox{\hyperlink{consspaceobject_8h_a263efce0e5cda1d387a1a43f94715445}{NIL}}\ );}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00029}00029\ \}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00030}00030\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00031}00031\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00032}00032\ \textcolor{comment}{\ *\ Lisp\ funtion\ of\ up\ to\ four\ args\ (all\ optional),\ where}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00033}00033\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00034}00034\ \textcolor{comment}{\ *\ first\ is\ expected\ to\ be\ an\ integer,\ the\ number\ of\ buckets,\ or\ nil;}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00035}00035\ \textcolor{comment}{\ *\ second\ is\ expected\ to\ be\ a\ hashing\ function,\ or\ nil;}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00036}00036\ \textcolor{comment}{\ *\ third\ is\ expected\ to\ be\ an\ assocable,\ or\ nil;}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00037}00037\ \textcolor{comment}{\ *\ fourth\ is\ a\ list\ of\ user\ tokens,\ to\ be\ used\ as\ a\ write\ ACL,\ or\ nil.}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00038}00038\ \textcolor{comment}{\ */}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00039}\mbox{\hyperlink{hashmap_8c_a9a1bd4ba729b966b71e32d61ba7c116a}{00039}}\ \textcolor{keyword}{struct\ }\mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ \mbox{\hyperlink{hashmap_8c_a9a1bd4ba729b966b71e32d61ba7c116a}{lisp\_make\_hashmap}}(\ struct\ \mbox{\hyperlink{consspaceobject_8h_structstack__frame}{stack\_frame}}\ *frame,}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00040}00040\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }\mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ frame\_pointer,}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00041}00041\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ struct\ \mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ env\ )\ \{}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00042}00042\ \ \ \ \ uint32\_t\ n\ =\ \mbox{\hyperlink{hashmap_8h_abc679bf03fc1ed8dccee8cc2a08d4211}{DFLT\_HASHMAP\_BUCKETS}};}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00043}00043\ \ \ \ \ \textcolor{keyword}{struct\ }\mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ hash\_fn\ =\ \mbox{\hyperlink{consspaceobject_8h_a263efce0e5cda1d387a1a43f94715445}{NIL}};}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00044}00044\ \ \ \ \ \textcolor{keyword}{struct\ }\mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ result\ =\ \mbox{\hyperlink{consspaceobject_8h_a263efce0e5cda1d387a1a43f94715445}{NIL}};}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00045}00045\ }
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00046}00046\ \ \ \ \ \textcolor{keywordflow}{if}\ (\ frame-\/>args\ >\ 0\ )\ \{}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00047}00047\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\ \mbox{\hyperlink{consspaceobject_8h_af99c355c0b2f78228a1e9e4e68dcfe76}{integerp}}(\ frame-\/>arg[0]\ )\ )\ \{}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00048}00048\ \ \ \ \ \ \ \ \ \ \ \ \ n\ =\ \mbox{\hyperlink{peano_8c_aff092cc8ce6153b70eddb7ed82238034}{to\_long\_int}}(\ frame-\/>arg[0]\ )\ \%\ UINT32\_MAX;}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00049}00049\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (\ !\mbox{\hyperlink{consspaceobject_8h_a758a42bfac22caaf66e29c666c91702d}{nilp}}(\ frame-\/>arg[0]\ )\ )\ \{}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00050}00050\ \ \ \ \ \ \ \ \ \ \ \ \ result\ =}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00051}00051\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{consspaceobject_8h_a2a1abab0c80ab1e97f507bc4eab02523}{make\_exception}}(\ \mbox{\hyperlink{consspaceobject_8h_a9e4202c8555763ca9a119f0d63a058cd}{c\_string\_to\_lisp\_string}}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00052}00052\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (\ L\textcolor{stringliteral}{"{}First\ arg\ to\ \`{}hashmap`,\ if\ passed,\ must\ "{}}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00053}00053\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ L\textcolor{stringliteral}{"{}be\ an\ integer\ or\ \`{}nil`.`"{}}\ ),\ \mbox{\hyperlink{consspaceobject_8h_a263efce0e5cda1d387a1a43f94715445}{NIL}}\ );}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00054}00054\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00055}00055\ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00056}00056\ \ \ \ \ \textcolor{keywordflow}{if}\ (\ frame-\/>args\ >\ 1\ )\ \{}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00057}00057\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\ \mbox{\hyperlink{consspaceobject_8h_a1ee44adf504436a098ab4cdb5dad4853}{functionp}}(\ frame-\/>arg[1]\ )\ )\ \{}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00058}00058\ \ \ \ \ \ \ \ \ \ \ \ \ hash\_fn\ =\ frame-\/>arg[1];}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00059}00059\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (\ \mbox{\hyperlink{consspaceobject_8h_a758a42bfac22caaf66e29c666c91702d}{nilp}}(\ frame-\/>arg[1]\ )\ )\ \{}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00060}00060\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ that's\ allowed\ */}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00061}00061\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00062}00062\ \ \ \ \ \ \ \ \ \ \ \ \ result\ =}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00063}00063\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{consspaceobject_8h_a2a1abab0c80ab1e97f507bc4eab02523}{make\_exception}}(\ \mbox{\hyperlink{consspaceobject_8h_a9e4202c8555763ca9a119f0d63a058cd}{c\_string\_to\_lisp\_string}}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00064}00064\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (\ L\textcolor{stringliteral}{"{}Second\ arg\ to\ \`{}hashmap`,\ if\ passed,\ must\ "{}}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00065}00065\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ L\textcolor{stringliteral}{"{}be\ a\ function\ or\ \`{}nil`.`"{}}\ ),\ \mbox{\hyperlink{consspaceobject_8h_a263efce0e5cda1d387a1a43f94715445}{NIL}}\ );}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00066}00066\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00067}00067\ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00068}00068\ }
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00069}00069\ \ \ \ \ \textcolor{keywordflow}{if}\ (\ \mbox{\hyperlink{consspaceobject_8h_a758a42bfac22caaf66e29c666c91702d}{nilp}}(\ result\ )\ )\ \{}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00070}00070\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ if\ there\ are\ fewer\ than\ 4\ args,\ then\ arg[3]\ ought\ to\ be\ nil\ anyway,\ which}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00071}00071\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ *\ is\ fine\ */}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00072}00072\ \ \ \ \ \ \ \ \ result\ =\ \mbox{\hyperlink{intern_8c_a712a222e5d6695c29e78516d7c60ba2a}{make\_hashmap}}(\ n,\ hash\_fn,\ frame-\/>arg[3]\ );}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00073}00073\ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }\mbox{\hyperlink{vectorspace_8h_structvector__space__object}{vector\_space\_object}}\ *map\ =\ \mbox{\hyperlink{vectorspace_8h_a6961330e553c390cec21939135c8c124}{pointer\_to\_vso}}(\ result\ );}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00074}00074\ }
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00075}00075\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\ frame-\/>args\ >\ 2\ \&\&}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00076}00076\ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{consspaceobject_8h_a1c1832c6670baed0272a78d536a88c78}{truep}}(\ \mbox{\hyperlink{authorise_8c_ac7a62632b2812cbcf9a3571875529b9b}{authorised}}(\ result,\ map-\/>\mbox{\hyperlink{vectorspace_8h_a52100a8d038844c00250f5356f1b9a3f}{payload}}.hashmap.write\_acl\ )\ )\ )\ \{}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00077}00077\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ then\ arg[2]\ ought\ to\ be\ an\ assoc\ list\ which\ we\ should\ iterate\ down}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00078}00078\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ populating\ the\ hashmap.}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00079}00079\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\ \textcolor{keyword}{struct}\ \mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ cursor\ =\ frame-\/>arg[2];\ !\mbox{\hyperlink{consspaceobject_8h_a758a42bfac22caaf66e29c666c91702d}{nilp}}(\ cursor\ );}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00080}00080\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ cursor\ =\ \mbox{\hyperlink{consspaceobject_8h_a36feb8e8c928ce9ffb6fb80167cc1f04}{c\_cdr}}(\ cursor\ )\ )\ \{}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00081}00081\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }\mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ pair\ =\ \mbox{\hyperlink{consspaceobject_8h_ac683bad260c334cc2e5fad1f7d0c7b52}{c\_car}}(\ cursor\ );}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00082}00082\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }\mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ key\ =\ \mbox{\hyperlink{consspaceobject_8h_ac683bad260c334cc2e5fad1f7d0c7b52}{c\_car}}(\ pair\ );}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00083}00083\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }\mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ val\ =\ \mbox{\hyperlink{consspaceobject_8h_a36feb8e8c928ce9ffb6fb80167cc1f04}{c\_cdr}}(\ pair\ );}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00084}00084\ }
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00085}00085\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ uint32\_t\ bucket\_no\ =}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00086}00086\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{intern_8c_a89bab54666e014aba6cbb9c4ab4c9c2a}{get\_hash}}(\ key\ )\ \%\ (\ (\ \textcolor{keyword}{struct\ }\mbox{\hyperlink{vectorspace_8h_structhashmap__payload}{hashmap\_payload}}\ *\ )}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00087}00087\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \&(\ map-\/>\mbox{\hyperlink{vectorspace_8h_a52100a8d038844c00250f5356f1b9a3f}{payload}}\ )\ )-\/>n\_buckets;}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00088}00088\ }
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00089}00089\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ map-\/>\mbox{\hyperlink{vectorspace_8h_a52100a8d038844c00250f5356f1b9a3f}{payload}}.hashmap.buckets[bucket\_no]\ =}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00090}00090\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{consspaceobject_8h_afff9c83c8c250837b5737c11e21cc4ca}{make\_cons}}(\ \mbox{\hyperlink{consspaceobject_8h_afff9c83c8c250837b5737c11e21cc4ca}{make\_cons}}(\ key,\ val\ ),}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00091}00091\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ map-\/>\mbox{\hyperlink{vectorspace_8h_a52100a8d038844c00250f5356f1b9a3f}{payload}}.hashmap.buckets[bucket\_no]\ );}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00092}00092\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00093}00093\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00094}00094\ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00095}00095\ }
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00096}00096\ \ \ \ \ \textcolor{keywordflow}{return}\ result;}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00097}00097\ \}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00098}00098\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00099}00099\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00100}00100\ \textcolor{comment}{\ *\ Expects\ \`{}frame-\/>arg[1]`\ to\ be\ a\ hashmap\ or\ namespace;\ \`{}frame-\/>arg[2]`\ to\ be}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00101}00101\ \textcolor{comment}{\ *\ a\ string-\/like-\/thing\ (perhaps\ necessarily\ a\ keyword);\ frame-\/>arg[3]\ to\ be\ }}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00102}00102\ \textcolor{comment}{\ *\ any\ value.\ If}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00103}00103\ \textcolor{comment}{\ *\ current\ user\ is\ authorised\ to\ write\ to\ this\ hashmap,\ modifies\ the\ hashmap\ and}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00104}00104\ \textcolor{comment}{\ *\ returns\ it;\ if\ not,\ clones\ the\ hashmap,\ modifies\ the\ clone,\ and\ returns\ that.}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00105}00105\ \textcolor{comment}{\ */}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00106}\mbox{\hyperlink{hashmap_8c_a8d0c095179bda2196eae01f111f59ff0}{00106}}\ \textcolor{keyword}{struct\ }\mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ \mbox{\hyperlink{hashmap_8c_a8d0c095179bda2196eae01f111f59ff0}{lisp\_hashmap\_put}}(\ struct\ \mbox{\hyperlink{consspaceobject_8h_structstack__frame}{stack\_frame}}\ *frame,}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00107}00107\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }\mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ frame\_pointer,}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00108}00108\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ struct\ \mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ env\ )\ \{}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00109}00109\ \ \ \ \ \textcolor{comment}{//\ TODO:\ if\ current\ user\ has\ write\ access\ to\ this\ hashmap}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00110}00110\ }
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00111}00111\ \ \ \ \ \textcolor{keyword}{struct\ }\mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ mapp\ =\ frame-\/>arg[0];}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00112}00112\ \ \ \ \ \textcolor{keyword}{struct\ }\mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ key\ =\ frame-\/>arg[1];}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00113}00113\ \ \ \ \ \textcolor{keyword}{struct\ }\mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ val\ =\ frame-\/>arg[2];}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00114}00114\ }
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00115}00115\ \ \ \ \ \textcolor{keyword}{struct\ }\mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ result\ =\ \mbox{\hyperlink{intern_8c_a3593c291344b1053a5055c976c6d9917}{hashmap\_put}}(\ mapp,\ key,\ val\ );}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00116}00116\ \ \ \ \ \textcolor{keyword}{struct\ }\mbox{\hyperlink{consspaceobject_8h_structcons__space__object}{cons\_space\_object}}\ *cell\ =\ \&\mbox{\hyperlink{consspaceobject_8h_af31e1da9438d7ae4410864ecc901b131}{pointer2cell}}(\ result\ );}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00117}00117\ \ \ \ \ \textcolor{keywordflow}{return}\ result;}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00118}00118\ }
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00119}00119\ \ \ \ \ \textcolor{comment}{//\ TODO:\ else\ clone\ and\ return\ clone.}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00120}00120\ \}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00121}00121\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00122}00122\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00123}00123\ \textcolor{comment}{\ *\ Lisp\ function\ expecting\ two\ arguments,\ a\ hashmap\ and\ an\ assoc\ list.\ Copies\ all}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00124}00124\ \textcolor{comment}{\ *\ key/value\ pairs\ from\ the\ assoc\ list\ into\ the\ map.}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00125}00125\ \textcolor{comment}{\ */}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00126}\mbox{\hyperlink{hashmap_8c_a12025927fdfc09645ee5fade9eba4a5e}{00126}}\ \textcolor{keyword}{struct\ }\mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ \mbox{\hyperlink{hashmap_8c_a12025927fdfc09645ee5fade9eba4a5e}{lisp\_hashmap\_put\_all}}(\ struct\ \mbox{\hyperlink{consspaceobject_8h_structstack__frame}{stack\_frame}}\ *frame,}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00127}00127\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }\mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ frame\_pointer,}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00128}00128\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ struct\ \mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ env\ )\ \{}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00129}00129\ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{intern_8c_a6c37b87bbbfe5335b46fdf7f76ef0298}{hashmap\_put\_all}}(\ frame-\/>arg[0],\ frame-\/>arg[1]\ );}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00130}00130\ \}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00131}00131\ }
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00132}\mbox{\hyperlink{hashmap_8c_ae03dcc0b9a29db2edd47573d07387ccb}{00132}}\ \textcolor{keyword}{struct\ }\mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ \mbox{\hyperlink{hashmap_8c_ae03dcc0b9a29db2edd47573d07387ccb}{lisp\_hashmap\_keys}}(\ struct\ \mbox{\hyperlink{consspaceobject_8h_structstack__frame}{stack\_frame}}\ *frame,}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00133}00133\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }\mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ frame\_pointer,}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00134}00134\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ struct\ \mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ env\ )\ \{}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00135}00135\ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{intern_8c_a808e8e6f10a04c33a3fa937fba0e9d56}{hashmap\_keys}}(\ frame-\/>arg[0]\ );}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00136}00136\ \}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00137}00137\ }
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00138}\mbox{\hyperlink{hashmap_8c_a288bcdc76785b84f975bd61dc47d37fd}{00138}}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{hashmap_8c_a288bcdc76785b84f975bd61dc47d37fd}{dump\_map}}(\ \mbox{\hyperlink{fopen_8h_structfcurl__data}{URL\_FILE}}\ *output,\ \textcolor{keyword}{struct}\ \mbox{\hyperlink{consspaceobject_8h_structcons__pointer}{cons\_pointer}}\ pointer\ )\ \{}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00139}00139\ \ \ \ \ \textcolor{keyword}{struct\ }\mbox{\hyperlink{vectorspace_8h_structhashmap__payload}{hashmap\_payload}}\ *payload\ =}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00140}00140\ \ \ \ \ \ \ \ \ \&\mbox{\hyperlink{vectorspace_8h_a6961330e553c390cec21939135c8c124}{pointer\_to\_vso}}(\ pointer\ )-\/>payload.hashmap;}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00141}00141\ \ \ \ \ \mbox{\hyperlink{fopen_8h_ac88d8de2499a3cdc3a4c7c4f5a4424e8}{url\_fwprintf}}(\ output,\ L\textcolor{stringliteral}{"{}Hashmap\ with\ \%d\ buckets:\(\backslash\)n"{}},\ payload-\/>\mbox{\hyperlink{vectorspace_8h_a241ccfe90f415a07cad8a881fc0f83ac}{n\_buckets}}\ );}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00142}00142\ \ \ \ \ \mbox{\hyperlink{fopen_8h_ac88d8de2499a3cdc3a4c7c4f5a4424e8}{url\_fwprintf}}(\ output,\ L\textcolor{stringliteral}{"{}\(\backslash\)tHash\ function:\ "{}}\ );}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00143}00143\ \ \ \ \ \mbox{\hyperlink{print_8c_ad0e1c7bb094ddb18a30d5141e836991b}{print}}(\ output,\ payload-\/>\mbox{\hyperlink{vectorspace_8h_a1d86eb1948d0cd90cacbad7eba0bfc0f}{hash\_fn}}\ );}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00144}00144\ \ \ \ \ \mbox{\hyperlink{fopen_8h_ac88d8de2499a3cdc3a4c7c4f5a4424e8}{url\_fwprintf}}(\ output,\ L\textcolor{stringliteral}{"{}\(\backslash\)n\(\backslash\)tWrite\ ACL:\ "{}}\ );}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00145}00145\ \ \ \ \ \mbox{\hyperlink{print_8c_ad0e1c7bb094ddb18a30d5141e836991b}{print}}(\ output,\ payload-\/>\mbox{\hyperlink{vectorspace_8h_a2e3029ea295f8519d2e42e8b3c481b4b}{write\_acl}}\ );}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00146}00146\ \ \ \ \ \mbox{\hyperlink{fopen_8h_ac88d8de2499a3cdc3a4c7c4f5a4424e8}{url\_fwprintf}}(\ output,\ L\textcolor{stringliteral}{"{}\(\backslash\)n\(\backslash\)tBuckets:"{}}\ );}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00147}00147\ \ \ \ \ \textcolor{keywordflow}{for}\ (\ \textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ payload-\/>\mbox{\hyperlink{vectorspace_8h_a241ccfe90f415a07cad8a881fc0f83ac}{n\_buckets}};\ i++\ )\ \{}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00148}00148\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{fopen_8h_ac88d8de2499a3cdc3a4c7c4f5a4424e8}{url\_fwprintf}}(\ output,\ L\textcolor{stringliteral}{"{}\(\backslash\)n\(\backslash\)t\(\backslash\)t[\%d]:\ "{}},\ i\ );}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00149}00149\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{print_8c_ad0e1c7bb094ddb18a30d5141e836991b}{print}}(\ output,\ payload-\/>\mbox{\hyperlink{vectorspace_8h_ae05c576dff650fd511b86a82723a1942}{buckets}}[i]\ );}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00150}00150\ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00151}00151\ \ \ \ \ \mbox{\hyperlink{fopen_8h_ac88d8de2499a3cdc3a4c7c4f5a4424e8}{url\_fwprintf}}(\ output,\ L\textcolor{stringliteral}{"{}\(\backslash\)n"{}}\ );}
\DoxyCodeLine{\Hypertarget{hashmap_8c_source_l00152}00152\ \}}

\end{DoxyCode}
