Re: How can I add a new function in options.c?
newbie nullzwei via gnumeric-list <[email protected]> Fri, 5 Aug 2022 14:50:55 +0200
| Newsgroups | gmane.comp.gnome.apps.gnumeric |
|---|---|
| Message-ID | <trinity-6ba700cc-5d40-44d0-90b5-e1b5c513c6c3-1659703855439@3c-app-gmx-bs60> |
--===============7814937242860863843== Content-Type: text/html; charset=UTF-8 <html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div> </div> <div>the <span class="title">'Defining New Functions' page in the manual appears empty in '</span>https://help.gnome.org/users/gnumeric/stable/sect-extending-functions.html.en', perhaps someone can add a chapter similar to the text below which made it for acsglster to implement his changes.</div> <div> </div> <div>For those interested in the derivatives matter he has published and commented his work in <a href="https://github.com/steve-g-lynn/gnumeric-options-plugin" target="_blank">https://github.com/steve-g-lynn/gnumeric-options-plugin</a>.</div> <div> </div> <div> <div>--------------------------------------------------------------------------------------------------</div> <div>change functions in gnumeric or - highly recommended - add variants instead:</div> <div> </div> <div>some - old - info about programming gnumeric is in 'main_dir/doc/developer'.</div> <div> </div> <div>assuming you already managed to compile gnumeric and have found that most functions reside in subdirs of 'plugins', there mostly in 'functions.c' ... poor mans simple approach:</div> <div>take a function already existing there, if given together with it's 'help section' starting with sthg. like 'static GnmFuncHelp const help_function_name', most likely a block from one '/* info what function */' comment to the next one,</div> <div>for first tests try an easy one, e.g. without subroutines like 'function_name1', and copy below itself,</div> <div>in first step only change the function_name and! the 'help_function_name',</div> <div> </div> <div>I. additional step to learn: add an appropriate entry in the 'GnmFuncDescriptor const xxxxxx_functions' section at the bottom of the file, copy from original function and adapt name and help_name,</div> <div> </div> <div>II. add. step to learn: add an appropriate entry in '<a href="http://plugin.xml.in" target="_blank">plugin.xml.in</a>' in that directory, copy from original function and change name, do not change plugin.xml, it's overwriten in compilation,</div> <div> </div> <div>re-compile, and check if it's working, if not read compiler comments, if yes adapt to your needs,<br/> be aware to use 'gnm_float' instead of 'double' or 'long double' as datatype, and - for most cases - 'gnm_code_function' instead of 'code_function' to enable datatype independent code, e.g. gnm_float x = gnm_pow( gnm_float y, gnm_float z ), instead of double x = pow( double y, double z ),</div> <div> </div> <div>'numbers.h' in 'src' directory is the main dispatcher between double vs. long double and c-code vs. 'gnumeric substitutes in goffice' functions,</div> <div> </div> <div>the rest is up to you, your knowledge in 'pure-C' programming, your luck in guessing the meaning of parameters and your patience to approach your goal in small steps,</div> <div> </div> <div>what helped me immensely - after difficulties to get it running - is 'WHENCE' together with 'GG', 'SS' and 'confect' by John Denker, see <a href="https://www.av8n.com/gnumeric/" target="_blank">https://www.av8n.com/gnumeric/</a> , it allows several almost independent gnumeric installations side by side, and thus 'trial and error' while keeping an undisturbed original as reference.</div> <div> </div> <div>hope that helps a little, hope I didn't miss steps ... <br/> --------------------------------------------------------------------------------------------------</div> </div> <div> <div> <div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"> <div name="quoted-content"> <div class="gmail_quote"> <blockquote class="gmail_quote" style="margin: 0.0px 0.0px 0.0px 0.8ex;border-left: 1.0px solid rgb(204,204,204);padding-left: 1.0ex;"> <div class="gmail_quote"> <blockquote class="gmail_quote" style="margin: 0.0px 0.0px 0.0px 0.8ex;border-left: 1.0px solid rgb(204,204,204);padding-left: 1.0ex;"> <div> <div style="font-family: Verdana;font-size: 12.0px;"> <div> <div> <div style="margin: 10.0px 5.0px 5.0px 10.0px;padding: 10.0px 0.0px 10.0px 10.0px;border-left: 2.0px solid rgb(195,217,229);"> <div> <div> <div> </div> </div> _______________________________________________ gnumeric-list mailing list <a href="mailto:[email protected]" onclick="parent.window.location.href='mailto:[email protected]'; return false;" target="_blank">[email protected]</a> <a href="https://mail.gnome.org/mailman/listinfo/gnumeric-list" target="_blank">https://mail.gnome.org/mailman/listinfo/gnumeric-list</a></div> </div> </div> </div> </div> </div> </blockquote> </div> </blockquote> </div> </div> </div> </div> </div></div></body></html> --===============7814937242860863843== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ gnumeric-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/gnumeric-list --===============7814937242860863843==--