Minetest study : main.cpp

Throughout this study of source code, I risk writing things that more experienced people might find naive. I do not master all the technologies that can be used in the code studied. I also don't have a professional knowledge of all computer concepts. Finally, I don't know anything about the source code in question, and discover it step by step. So expect inaccuracies or shortcomings on my part. Be understanding.

main.cpp

The Minetest source code starts by calling a debug_set_exception_handler() function to handle exceptions in debug mode. When I look at the code for this function, I see that it is exclusively written for Microsoft Windows. The code directly uses the OS-specific library and I'm not used to reading source code that uses such a library directly. I prefer crossplatform codes, especially since I mainly use Linux and more rarely Windows. Since this is a useful feature for debugging, but not necessarily normal game usage and I would like to make studying Minetest code and forking more accessible, I make the choice for the moment to neglect all the code which relates to this functionality.

g_logger.registerThread     ("Main");
g_logger.addOutputMaxLevel  (&stderr_output, LL_ACTION);

The program then calls two functions belonging to the logger. The logger is intended to collect and transmit information such as errors, connection messages, etc. through the log. The first function is used to register the current process in the logger with the name "main". The current process being the main one since we have just started the program.

The second function links std::cerr (on pc) to different types of possible log outputs up to and including LL_ACTION level. This seems to prepare the log to receive error or event messages to display in the log during the rest of the program. At the moment I don't understand why this is initialized like this and how the log works overall. Consequently, I will rewrite this part once I have progressed far enough in the study of the code, and after some tests of the program.

This topic is being written. Thank you for your patience :)
You can follow me on Neocities to read more later :D

>> Home <<