// 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: 07 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 be useable for querying the fork name (fork_str(0))and // 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 back door, hook. However, we are where we are. // For povr one can set the global variable 'Dump_povr_fork_' to anything. to // quickly test if running a povr fork of POV-Ray and the information available // for the fork_* function pairs. This include file can be run alone with // commands such as: // povr +mv3.8 +iforkversionhook.inc declare=Dump_povr_fork_=1 // // 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 define or uncomment line below to dump available "povr" fork_str // and fork_val pairs to debug output with a stop using #error before render. // #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),6,4)," and it's the povr fork version.\n") #debug concat("\nfork_str(1) = ",fork_str(1)) #debug concat("\nfork_val(1) = ",str(fork_val(1),6,4),"\n") #local ForkStr = fork_str(2); // Done like this to test assignments. #local ForkVal = fork_val(2); #debug concat("\nfork_str(2) = ",ForkStr) #debug concat("\nfork_val(2) = ",str(ForkVal,6,4),"\n") #debug "----------------------------------------------------------------------\n" #error "\n\nStop after wrting 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" //