diff --git a/doc/binary_c-API.lyx b/doc/binary_c-API.lyx index 41d3b3ceb36f23733787162bf400d3812c2adfd8..460a6a409954894677b9b0be2a0bca266f40a009 100644 --- a/doc/binary_c-API.lyx +++ b/doc/binary_c-API.lyx @@ -1978,12 +1978,12 @@ status open \begin_layout Plain Layout int binary_c_API_function binary_c_evolve_for_dt(struct libbinary_c_stardata_t - * stardata, + * const stardata, \end_layout \begin_layout Plain Layout - double dt); + const double dt); \end_layout \end_inset @@ -2085,12 +2085,12 @@ status open \begin_layout Plain Layout void binary_c_API_function binary_c_buffer_info(struct libbinary_c_stardata_t - * RESTRICT stardata, + * RESTRICT const stardata, \end_layout \begin_layout Plain Layout - char ** buffer, + char ** const buffer, \end_layout \begin_layout Plain Layout @@ -2159,6 +2159,109 @@ char* 's internal buffer. \end_layout +\begin_layout Subsubsection +binary_c_error_buffer +\begin_inset CommandInset label +LatexCommand label +name "subsec:binary_c_error_buffer" + +\end_inset + + +\end_layout + +\begin_layout Standard +This function returns a pointer to the +\begin_inset Formula $\binaryc$ +\end_inset + + error buffer. +\end_layout + +\begin_layout Standard +\begin_inset listings +inline false +status open + +\begin_layout Plain Layout + +void binary_c_API_function binary_c_error_buffer(struct stardata_t * RESTRICT + const stardata, + char ** const error_buffer) +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Itemize +\begin_inset Flex CStruct +status open + +\begin_layout Plain Layout +stardata +\end_layout + +\end_inset + + is defined previously (Sec. +\begin_inset space ~ +\end_inset + + +\begin_inset CommandInset ref +LatexCommand ref +reference "subsec:binary_c_new_system" + +\end_inset + +) +\end_layout + +\begin_layout Itemize +\begin_inset Flex CVar +status open + +\begin_layout Plain Layout +error_buffer +\end_layout + +\end_inset + + is a pointer to a +\begin_inset Flex CVar +status open + +\begin_layout Plain Layout +char** +\end_layout + +\end_inset + + which points to a pointer to +\begin_inset Formula $\binaryc$ +\end_inset + +'s internal error buffer. + +\end_layout + +\begin_layout Itemize +Unlike the normal +\begin_inset Flex CVar +status open + +\begin_layout Plain Layout +buffer +\end_layout + +\end_inset + + defined above, this buffer is of fixed size so you don't have to worry + about its length. +\end_layout + \begin_layout Subsubsection binary_c_buffer_empty_buffer \begin_inset CommandInset label @@ -2199,7 +2302,7 @@ status open \begin_layout Plain Layout void binary_c_API_function binary_c_buffer_empty_buffer(struct stardata_t - * RESTRICT stardata); + * RESTRICT const stardata); \end_layout \end_inset @@ -2270,7 +2373,7 @@ status open \begin_layout Plain Layout void binary_c_API_function binary_c_free_store_contents(struct libbinary_c_store -_t * RESTRICT store); +_t * RESTRICT const store); \end_layout \end_inset @@ -2349,7 +2452,7 @@ preferences \end_inset - and +, \begin_inset Flex CStruct status open @@ -2359,7 +2462,17 @@ store \end_inset - structs if required. + structs and the +\begin_inset Flex CVar +status open + +\begin_layout Plain Layout +raw_buffer +\end_layout + +\end_inset + + if required. It is possible that \family typewriter preferences @@ -2384,22 +2497,27 @@ status open \begin_layout Plain Layout void binary_c_API_function binary_c_free_memory(struct stardata_t ** RESTRICT - stardata, + const stardata, \end_layout \begin_layout Plain Layout - Boolean free_preferences, + const Boolean free_preferences, \end_layout \begin_layout Plain Layout - Boolean free_stardata, + const Boolean free_stardata, \end_layout \begin_layout Plain Layout - Boolean free_store); + const Boolean free_store, +\end_layout + +\begin_layout Plain Layout + + const Boolean free_raw_buffer); \end_layout \end_inset @@ -2451,7 +2569,7 @@ free_stardata \end_inset - and +, \begin_inset Flex CVar status open @@ -2459,6 +2577,16 @@ status open free_store \end_layout +\end_inset + + and +\begin_inset Flex CVar +status open + +\begin_layout Plain Layout +free_raw_buffer +\end_layout + \end_inset should be either @@ -2533,7 +2661,7 @@ status open \begin_layout Plain Layout void binary_c_API_function binary_c_version(struct libbinary_c_stardata_t - * RESTRICT stardata); + * RESTRICT const stardata); \end_layout \end_inset @@ -2599,7 +2727,7 @@ status open \begin_layout Plain Layout void binary_c_API_function binary_c_show_instant_RLOF_period_or_separation(struc -t libbinary_c_stardata_t * stardata); +t libbinary_c_stardata_t * const stardata); \end_layout \end_inset @@ -2684,7 +2812,7 @@ status open \begin_layout Plain Layout void binary_c_API_function binary_c_initialize_parameters(struct libbinary_c_sta -rdata_t * RESTRICT stardata); +rdata_t * RESTRICT const stardata); \end_layout \end_inset @@ -3019,6 +3147,11 @@ status open char * buffer = NULL; \end_layout +\begin_layout Plain Layout + + char * error_buffer = NULL; +\end_layout + \begin_layout Plain Layout int nbytes = 0; @@ -3035,7 +3168,12 @@ status open \begin_layout Plain Layout - * Get the binary_c output in *buffer. + * Get the binary_c output in *buffer and the +\end_layout + +\begin_layout Plain Layout + + * error buffer in *error_buffer \end_layout \begin_layout Plain Layout @@ -3050,21 +3188,80 @@ status open \begin_layout Plain Layout - + binary_c_error_buffer(stardata,&error_buffer); +\end_layout + +\begin_layout Plain Layout + +\end_layout + +\begin_layout Plain Layout + + /* check the error buffer */ +\end_layout + +\begin_layout Plain Layout + + if(error_buffer != NULL) \end_layout \begin_layout Plain Layout - /* process the buffer */ + { \end_layout \begin_layout Plain Layout + fprintf(stderr, +\begin_inset Quotes erd +\end_inset + +Error in binary_c : %s +\backslash +n +\begin_inset Quotes erd +\end_inset + +,error_buffer); +\end_layout + +\begin_layout Plain Layout + + } +\end_layout + +\begin_layout Plain Layout + + else +\end_layout + +\begin_layout Plain Layout + + { +\end_layout + +\begin_layout Plain Layout + + /* process the buffer */ \end_layout \begin_layout Plain Layout - /* ...... + +\end_layout + +\begin_layout Plain Layout + + +\end_layout + +\begin_layout Plain Layout + +\end_layout + +\begin_layout Plain Layout + + /* ...... your code goes here ...... */ \end_layout @@ -3075,17 +3272,21 @@ status open \begin_layout Plain Layout - /* free the buffer */ + } \end_layout \begin_layout Plain Layout - binary_c_buffer_empty_buffer(stardata); \end_layout \begin_layout Plain Layout - buffer = NULL; + /* free used memory */ +\end_layout + +\begin_layout Plain Layout + + binary_c_free_memory(&stardata,TRUE,TRUE,TRUE,TRUE); \end_layout \end_inset @@ -3299,7 +3500,7 @@ status open \begin_layout Plain Layout - binary_c_free_memory(&stardata,TRUE,TRUE,FALSE); + binary_c_free_memory(&stardata,TRUE,TRUE,FALSE,TRUE); \end_layout \begin_layout Plain Layout @@ -3358,15 +3559,11 @@ status open \begin_layout Plain Layout - binary_c_free_memory(&stardata,TRUE,TRUE,TRUE); + binary_c_free_memory(&stardata,TRUE,TRUE,TRUE,TRUE); \end_layout \end_inset - -\end_layout - -\begin_layout Standard but beware that your local \begin_inset Flex CStruct status open @@ -3422,7 +3619,7 @@ status open \begin_layout Plain Layout - binary_c_free_memory(&stardata,TRUE,TRUE,TRUE); + binary_c_free_memory(&stardata,TRUE,TRUE,TRUE,TRUE); \end_layout \begin_layout Plain Layout diff --git a/doc/binary_c2.lyx b/doc/binary_c2.lyx index b8dd8dc163c1ca3f31af7502c6a0b50e45f864dd..503e1309e3dc51eb7771193d9c3c769f02ad4856 100644 --- a/doc/binary_c2.lyx +++ b/doc/binary_c2.lyx @@ -511,6 +511,14 @@ End \begin_layout Standard \align center +\begin_inset Float figure +placement H +wide false +sideways false +status open + +\begin_layout Plain Layout +\align center \begin_inset Graphics filename images/logo.pdf width 55page% @@ -518,6 +526,11 @@ End \end_inset +\end_layout + +\end_inset + + \end_layout \begin_layout Standard @@ -3870,7 +3883,16 @@ ninja \end_inset . - You can install these tools on your system. + You can install these tools on your system, or follow installation instructions + at +\begin_inset CommandInset href +LatexCommand href +target "https://mesonbuild.com/Getting-meson.html" +literal "false" + +\end_inset + +. You should make sure you have \begin_inset Flex Software status open @@ -3894,7 +3916,7 @@ Python3 \end_inset - installed, you can update + installed, you can get the latest version of \begin_inset Flex Software status open @@ -3906,7 +3928,7 @@ meson \end_inset - with + with, \begin_inset listings inline false status open @@ -3918,25 +3940,27 @@ pip3 install meson \end_inset -which should get you the latest version. -\begin_inset Newline newline -\end_inset +Note: +\begin_inset Flex Software +status open +\begin_layout Plain Layout +emacs +\end_layout -\begin_inset Newline newline \end_inset -Note: + users should install the \begin_inset Flex Software status open \begin_layout Plain Layout -emacs +meson-mode \end_layout \end_inset - users should install the meson-mode. +. Go to \begin_inset CommandInset href LatexCommand href @@ -4809,18 +4833,77 @@ gcc \end_layout \begin_layout Standard -You can change the -\begin_inset Flex Args +The executable is called +\begin_inset Flex File status open \begin_layout Plain Layout -buildtype +binary_c \end_layout \end_inset - to debug if you want to build for testing (this is the default if you do - not include any +. + To run a star go back to the main binary_c directory and run tbse, e.g., +\family typewriter +\series bold + +\begin_inset listings +lstparams "language=bash" +inline false +status open + +\begin_layout Plain Layout + +cd .. +\end_layout + +\begin_layout Plain Layout + +tbse +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +Note: +\begin_inset Flex File +status open + +\begin_layout Plain Layout +binary_c +\end_layout + +\end_inset + + is built as a single, possibly +\emph on +large +\emph default + (many MB) executable. + The reason for this is the ease of use when transferring the executable + from one machine to another (e.g. +\begin_inset space ~ +\end_inset + +for use with distributed computing). + It is possible to build a shared library instead (see below) and future + +\begin_inset Formula $\binaryc$ +\end_inset + + versions will probably use environment variables to point to data directories. +\end_layout + +\begin_layout Subsubsection +Meson buildtypes +\end_layout + +\begin_layout Standard +Meson takes an argument \begin_inset Flex Args status open @@ -4830,36 +4913,61 @@ buildtype \end_inset -) – see -\begin_inset Flex URL + which changes whether the build is for development (i.e. +\begin_inset space ~ +\end_inset + +a debug build), testing or for software release. + For example, to build for release – which is what you want when installing + for a +\begin_inset Formula $\binarygrid$ +\end_inset + + run because this is as optimized as possible – run: +\end_layout + +\begin_layout Standard +\begin_inset listings +lstparams "language=bash" +inline false status open \begin_layout Plain Layout -https://mesonbuild.com/Running-Meson.html +meson --buildtype release \end_layout \end_inset - for details. + \end_layout \begin_layout Standard -The executable is called -\begin_inset Flex File +You can change the +\begin_inset Flex Args status open \begin_layout Plain Layout -binary_c +buildtype \end_layout \end_inset -. - To run a star go back to the main binary_c directory and run tbse, e.g., -\family typewriter -\series bold + to debug if you want to build for testing: this is the default if you do + not include any +\begin_inset Flex Args +status open +\begin_layout Plain Layout +buildtype +\end_layout + +\end_inset + + argument. +\end_layout + +\begin_layout Standard \begin_inset listings lstparams "language=bash" inline false @@ -4867,47 +4975,87 @@ status open \begin_layout Plain Layout -cd .. +meson --buildtype release \end_layout +\end_inset + + +\end_layout + +\begin_layout Standard +The full list of +\begin_inset Flex Args +status open + \begin_layout Plain Layout +buildtype +\end_layout -tbse +\end_inset + +s is +\begin_inset Flex Args +status open + +\begin_layout Plain Layout +plain \end_layout \end_inset +, +\begin_inset Flex Args +status open +\begin_layout Plain Layout +debug \end_layout -\begin_layout Standard -Note: -\begin_inset Flex File +\end_inset + +, +\begin_inset Flex Args status open \begin_layout Plain Layout -binary_c +debugoptimized \end_layout \end_inset - is built as a single, possibly -\emph on -large -\emph default - (many MB) executable. - The reason for this is the ease of use when transferring the executable - from one machine to another (e.g. -\begin_inset space ~ +, +\begin_inset Flex Args +status open + +\begin_layout Plain Layout +release +\end_layout + \end_inset -for use with distributed computing). - It is possible to build a shared library instead (see below) and future - -\begin_inset Formula $\binaryc$ + and +\begin_inset Flex Args +status open + +\begin_layout Plain Layout +minsize +\end_layout + \end_inset - versions will probably use environment variables to point to data directories. + with details at +\begin_inset Flex URL +status open + +\begin_layout Plain Layout + +https://mesonbuild.com/Running-Meson.html +\end_layout + +\end_inset + +. \end_layout \begin_layout Subsubsection diff --git a/doc/binary_c2.pdf b/doc/binary_c2.pdf index 01cff3b564792cb67d2d2899fa4a1e96054e7143..a66708efd336d3a24d2133964d415476452e6ded 100644 Binary files a/doc/binary_c2.pdf and b/doc/binary_c2.pdf differ diff --git a/doc/css/alabaster_binary_c.css b/doc/css/alabaster_binary_c.css index fcf73115cbfec589e36490d4af0436add1d4316b..ebb86a2864e889679ae3a2749731c6c6136ca8b6 100644 --- a/doc/css/alabaster_binary_c.css +++ b/doc/css/alabaster_binary_c.css @@ -34,9 +34,8 @@ div.sphinxsidebar { float: left; font-size: 15px; line-height: 1.5; - max-width: 250px; + max-width: 200px; min-width: 20%; - } hr { @@ -92,9 +91,16 @@ div.sphinxsidebarwrapper { padding: 18px 10px; } + +#sidebarlogo { + padding: 10px; + margin: auto; + display: block; +} + div.sphinxsidebarwrapper p.logo { padding: 0; - margin: -10px 0 0 0px; + margin: 0px 0 100px 0px; text-align: center; } diff --git a/doc/css/basic.css b/doc/css/basic.css index 5387aa15ae6563c42ed329960c5a727b2ad9ff69..635ff568bb1d9fe97e32feab8efa1425682894d1 100644 --- a/doc/css/basic.css +++ b/doc/css/basic.css @@ -45,22 +45,21 @@ div.related li.right { div.sphinxsidebarwrapper { padding: 10px 5px 0 10px; - margin-top: -150px; /* shift up so logo is at the top */ - position: -webkit-sticky; - position: sticky; - top: 0; + overflow: hidden; } div.sphinxsidebar { float: left; - margin-top: -20px; - margin-left: -25%; + margin-left: -21%; font-size: 90%; word-wrap: break-word; overflow-wrap : break-word; - position: -webkit-sticky; - position: sticky; top: 0; + position: fixed; + z-index: 1; + height: 100%; + overflow-y: scroll; + overflow-x: hidden; } div.sphinxsidebar ul { @@ -683,3 +682,12 @@ div.math:hover a.headerlink { } } +::-webkit-scrollbar { + -webkit-appearance: none; + width: 7px; +} +::-webkit-scrollbar-thumb { + border-radius: 4px; + background-color: rgba(0,0,0,.5); + -webkit-box-shadow: 0 0 1px rgba(255,255,255,.5); +} \ No newline at end of file diff --git a/doc/make_html.pl b/doc/make_html.pl index 13b053c94ccf94b2c1553680af95e4b64c5ff806..fef0a832fa63c8a10e4e36afed4be19bcd5590bb 100755 --- a/doc/make_html.pl +++ b/doc/make_html.pl @@ -122,6 +122,7 @@ while(1) ############################################################ # change HTML to suit ############################################################ + # remove layout-provided styles #$html =~s !\/\* LyX Provided Styles.*(<\/style>)!$1!s; @@ -192,7 +193,8 @@ while(1) # make binary_c etc. italic $html =~s !\bbinary_c\b!<i>binary_c</i>!g; - $html =~s !<title>\\<i>binary_c<\/i><\/title>!<title>binary_c documentation<\/title>!; + $html =~s !<title>.*<\/title>!<title>binary_c documentation<\/title>!; + no warnings; $html =~s !\blibbinary_c(.so)?\b!<i>libbinary_c$1</i>!g; use warnings; @@ -233,34 +235,62 @@ while(1) # get images mkdir $imagedir; - my @images = ($html=~/src=[\'\"]([^\'\"]+?\.(?:png|jpg|jpeg|gif))[\'\"]/g); - - my $nimage = 1; - foreach my $image (@images) + $nimage = 0; + my @images; + while ($html=~s/(src=[\'\"])([^\'\"]+?)\.(pdf|png|jpg|jpeg|gif)([\'\"])/__ IMAGEPLACER $nimage __/) { - #print "PROCESS IMAGE $image\n"; - if(!-f -s $tmpdir.'/'.$image) + my $pre = $1; + my $image = $2; + my $suffix = $3; + my $post = $4; + my $file = $image.'.'.$suffix; + + print "PROCESS IMAGE $file\n"; + + my $source = + (-f -s $tmpdir.'/'.$file) ? ($tmpdir.'/'.$file) : + (-f -s $file) ? $file : + undef; + if(!defined $source) { print "Image $nimage = $tmpdir/$image not found\n"; exit; } else { - # save image - my $suffix = ($image=~/(\.(?:png|jpg|jpeg|gif))$/)[0]; - my $newfile = $nimage.$suffix; - #print "COPYIMAGE $tmpdir/$image to $imagedir/$newfile\n"; - copy($tmpdir.'/'.$image, - $imagedir.'/'.$newfile); - $html =~s !$image!images/$newfile!; + # save or convert image + my $newfile = $nimage.'.'.$suffix; + my $target = $imagedir.'/'.$newfile; + if($suffix eq 'pdf' || $suffix eq 'eps' || $suffix eq 'ps') + { + # convert pdf, eps, ps to png + $target =~s/$suffix$/png/; + $file=~s/^$tmpdir//; # strip leading tmpdir + print "COVERTIMAGE $source $target\n"; + `convert -density 300 $source $target`; + } + else + { + # all other types render in the browser + print "COPYIMAGE $source to $target\n"; + copy($source,$target); + } + $images[$nimage] = $pre."images/$newfile".$post; } $nimage++; } + for(my $i=0; $i<=$#images; $i++) + { + if(defined $images[$i]) + { + $html =~ s/__ IMAGEPLACER $i __/$images[$i]/; + } + } # add logo my $logofile = $ENV{SVN}.'/tex/www/images/binary_c/logo3a-800.png'; copy($logofile, 'images/logo.png'); - $html =~s !<div class=\"sphinxsidebarwrapper\">\K!<img width=\"200px\" src=\"images/logo.png\">!; + $html =~s !<div class=\"sphinxsidebarwrapper\">\K!<img width=\"200px\" id=\"sidebarlogo\" src=\"images/logo.png\">!; # save dumpfile($htmlfile,$html); diff --git a/meson.build b/meson.build index aec465fcc87fe52b41ddff9e24cceccb85e5282c..a02e9ff82341a074804a5f03a8a674b2ee195509 100644 --- a/meson.build +++ b/meson.build @@ -90,23 +90,12 @@ foreach cflag : _other_cflags endif endforeach - ############################################################ # C flags that are non-generic, i.e. machine-specific. # if get_option('generic') == false _non_generic_cflags = [ - 'mmx', - 'sse', - 'sse2', - 'sse3', - 'ssse3', - 'sse4.1', - 'sse4.2', - 'sse4', - 'avx', - 'avx2', - 'avx512bw' + # put list here ] foreach cflag : _non_generic_cflags __cflag = '-m' + cflag