POV-Ray : Newsgroups : povray.off-topic : How to read source code? : Re: How to read source code? Server Time
29 Jul 2024 02:22:49 EDT (-0400)
  Re: How to read source code?  
From: scott
Date: 7 Feb 2013 03:30:47
Message: <51136637$1@news.povray.org>
> Hey, this is really fantastic! So I downloaded POV-Ray's 3.62 source code, and
> it shows up in Windows Notepad, EditPadLite--even in POV-Ray itself! (I think
> the latter is my favorite 'reading platform' so far.)
>
> Thanks to everyone who posted about this. I didn't know it was so easy.
>
> Hey, there are LOTS of separate source code files for POV-Ray! Where to begin...
>   I naively thought that *whatever makes POV run* would be just one big file. Am
> I correct in thinking that the program's source code is actually split up into
> lots of little (therefore manageable) chunks?

Watch out - soon you will want to just change something and then 
recompile to get your own custom povray.exe :-)

> One other thing: Does POV-Ray (or any of the other text reader apps I mentioned)
> need ...uh... built-in 'code libraries' or something, to show *correct*
> C/C++/whatever syntax?

They need a list of words that are specific to that language, and some 
"rules" about the syntax of the language. If you open the file in 
notepad you'll see it's just plain text, something like povray or 
notepad++ interprets this plain text and makes it more human readable.

Some of the more advanced editors (eg the one in MS VisualStudio) help 
you even further when editing by figuring out what valid text you could 
possibly type next and give you that list to choose from, underlining 
errors in real-time and giving pop-ups with required parameters for 
functions etc.

> Off-off-topic: While I was doing my research into this stuff, I read about 'hex
> editors.' Apparently they can open an executable (.exe) file for editing?? (Not
> in a higher-level language, of course.)

Of course (*any* file is just an array of bytes), but what do those 
bytes mean? In the case of a .exe file there will likely be data 
portions in a non-human-readable format and code which will be in the 
form of byte-code for the CPU - it's not recommended to edit or even 
view this byte-by-byte.

The best you can really do is to use a "disassembler" that will take the 
code in the .exe and convert it to human-readable instructions for the 
CPU (eg things like "load variable X from address Y", or "add X to Y"). 
This is still very low level (no useful variable names or function 
names) and will take an order of magnitude more time to figure out 
what's going on compared to the source code.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.