// This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. // To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a // letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. // Persistence of Vision Ray Tracer version 3.8 Include File. (Customized for povr fork) // File: forkversionhook.inc // Last updated: 09 February 2022 // Description: Provides a means to determine the fork string name and // fork version for unofficial POV-Ray forks/branches/patches. // It uses the f_odd() inbuilt function which has, since its addition, been a // useless duplicate of f_cushion(). Where the f_odd() function has been // modified to return 99.0 no matter the four numeric arguments, it indicates // paired parse functions named fork_str(n) and fork_val(n) are available. // At a minimum these are to be be useable for querying the fork name // (fork_str(0)) and fork version (fork_val(0)). It may be additional indexes // with more information are provided. // If there were a time machine available, we'd drop back 20 years and add the // two fork_* parse time functions to the official POV-Ray code. Then // patch/fork/branch creators would have access to such functions without // reverting to the f_odd()=99 hook. We are where we are. // For povr one can set the global variable 'Dump_povr_fork_' to a value. If // declared, code below will test if running a povr fork of POV-Ray. If so, // output the information available for the fork_* function pairs. This include // file can be run directly with commands such as: // povr +mv3.8 +iforkversionhook.inc declare=Dump_povr_fork_=1 // or // povray +iforkversionhook.inc //------------------------------------------------------------------------------ #ifndef (Forkversionhook_include_temp) #declare Forkversionhook_include_temp = version; #version 3.5; // Enable official POV-Ray back to v3.5 to run this. #ifdef (View_POV_Include_Stack) #debug "including forkversionhook.inc\n" #end #macro Have_f_odd_fork_hook() #local Func_ = function {internal(43)}; // This f_odd() index. ((99 = Func_(0.99,0.99,0.99,99)) & (99 = Func_(0,0,0,0))) #end // Elsewhere declare or uncomment line below to dump available "povr" fork_str // and fork_val pairs to debug output. Renders are stopped early using #error. // #declare Dump_povr_fork_ = true; #if ((Have_f_odd_fork_hook()) & (defined(Dump_povr_fork_))) #if (!strcmp(fork_str(0),"povr")) #debug "\n-------- Available fork_str, fork_val indexes and information --------\n" #debug concat("\nfork_str(0) = ",fork_str(0)) #debug concat("\nfork_val(0) = ",str(fork_val(0),4,0)," (release count / tarball count)\n") #debug concat("\nfork_str(1) = ",fork_str(1)," (povr forked more or less at POV-Ray v3.8)") #debug concat("\nfork_val(1) = ",str(fork_val(1),4,0)," (-1 means NA)\n") #local ForkStr = fork_str(2); // Done to test parser assignments. These strings not univerally useable. #local ForkVal = fork_val(2); #debug concat("\nfork_str(2) = ",ForkStr) #debug concat("\nfork_val(2) = ",str(ForkVal,4,0)," (-1 means NA)\n") #debug concat("\nfork_str(3) = ",fork_str(3)) // Major (not presently used, still ~v3.8 based) #debug concat("\nfork_val(3) = ",str(fork_val(3),4,0),"\n") #debug concat("\nfork_str(4) = ",fork_str(4)) // Minor (presently this release tarball count) #debug concat("\nfork_val(4) = ",str(fork_val(4),4,0),"\n") #debug concat("\nfork_str(5) = ",fork_str(5)) // Revision (not yet used by me) #debug concat("\nfork_val(5) = ",str(fork_val(5),4,0),"\n") #debug concat("\nfork_str(6) = ",fork_str(6)) // Patch (not yet used by me) #debug concat("\nfork_val(6) = ",str(fork_val(6),4,0),"\n") #debug "----------------------------------------------------------------------\n" #error "\n\nStop after writing povr's available fork_str() and fork_val() pairs.\n" #else #error "\n\nDid not find fork_str(0) to be the string 'povr'.\nNo fork_str() and fork_val() output generated.\n" #end #else #end #version Forkversionhook_include_temp; #end // Example code using only Have_f_odd_fork_hook() after including this file. // Place code below in a file name testHook.pov or similar an uncomment. // Run via testHook.pov. //--- //#version 3.7; // //global_settings {assumed_gamma 1} //box {0,1} // //#include "forkversionhook.inc" // //#if (Have_f_odd_fork_hook()) // #debug "\nFound f_odd hook indicating fork_str(), fork_var() parse functions exist.\n\n" //#else // #debug "\nNo f_odd hook indicating fork_str(), fork_var() parse functions exist.\n\n" //#end // //#error "\nStopping early.\nThis example code using forkversionhook.inc and Have_f_odd_fork_hook() macro.\n" //