POV-Ray : Newsgroups : povray.programming : QUESTION: MegaPOV Code Questions/Problems (LONG) Server Time
25 Dec 2024 11:00:49 EST (-0500)
  QUESTION: MegaPOV Code Questions/Problems (LONG) (Message 1 to 5 of 5)  
From: Robert Alan Byer
Subject: QUESTION: MegaPOV Code Questions/Problems (LONG)
Date: 5 Mar 2000 03:15:02
Message: <38C1D12C.5C545ED@mail.ourservers.net>
Sorry for this being so long in advance...

I'm working on porting over MegaPOV to OpenVMS to go along with my
POVRay v3.1g for OpenVMS and have run into a few things that I wanted to
get some input on (not knowing all the POV code and not all that great
of a programmer myself)

I'll start with the SMALL question/problem for now.  Most of the
problems aren't really problems, just compiler warnings that I would
like to make go away if possible.

(I'm using the POVRay v3.1g Unix souce code with the MegaPov 0.4 patch
file.)

In "TOKENIZE.C" there is the following section of code...

/*****************************************************************************
* Not-quite-so-Static functions
******************************************************************************/
/** poviso: July 15 '96  R.S.    removed 'static' for f_expr.c **/
#ifdef POVISO

#ifdef FastMacroPatch
void Echo_ungetc (int c);
#else
int Echo_ungetc (int c);
#endif
int Echo_getc (void);
int Skip_Spaces (void);
int Parse_C_Comments (void);
void Begin_String (void);
void Stuff_Character (int c);
void End_String (void);
int Read_Float (void);
void Parse_String_Literal (void);
void Read_Symbol (void);
SYM_ENTRY *Find_Symbol (int Index, char *s);
void Skip_Tokens (COND_TYPE cond);

int get_hash_value (char *s);
void init_reserved_words_hash_table (void);
void Write_Token (TOKEN Token_Id);
void Destroy_Table (int index);
void init_sym_tables (void);
void Add_Sym_Table (char *s);
void Remove_Symbol (int Index, char *Name);
POV_MACRO *Parse_Macro(void);
void Invoke_Macro(void);
void Return_From_Macro(void);
void Add_Entry (int Index,SYM_ENTRY *Table_Entry);
void Parse_Initalizer (int Sub, int Base, POV_ARRAY *a);

void Parse_Fopen(void);
void Parse_Fclose(void);
void Parse_Read(void);
void Parse_Write(void);
static int Parse_Comma_RParen(void);
int Parse_Read_Value(DATA_FILE *User_File,int Previous,int
*NumberPtr,void **Da
void Check_Macro_Vers(void);
DBL Parse_Cond_Param(void);
void Parse_Cond_Param2(DBL *V1,DBL *V2);
void Inc_CS_Index(void);
#else

#ifdef FastMacroPatch
static void Echo_ungetc (int c);
#else
static int Echo_ungetc (int c);
#endif
static int Echo_getc (void);
static int Skip_Spaces (void);
static int Parse_C_Comments (void);
static void Begin_String (void);
static void Stuff_Character (int c);
static void End_String (void);
static int Read_Float (void);
static void Parse_String_Literal (void);
static void Read_Symbol (void);
static SYM_ENTRY *Find_Symbol (int Index, char *s);
static void Skip_Tokens (COND_TYPE cond);

static int get_hash_value (char *s);
static void Write_Token (TOKEN Token_Id);
static void Destroy_Table (int index);
static void init_sym_tables (void);
static void Add_Sym_Table (char *s);
static void Remove_Symbol (int Index, char *Name);
static POV_MACRO *Parse_Macro(void);
static void Invoke_Macro(void);
static void Return_From_Macro(void);
static void Add_Entry (int Index,SYM_ENTRY *Table_Entry);
static void Parse_Initalizer (int Sub, int Base, POV_ARRAY *a);

static void Parse_Fopen(void);
static void Parse_Fclose(void);
static void Parse_Read(void);
static void Parse_Write(void);
static int Parse_Comma_RParen(void);static int
Parse_Read_Value(DATA_FILE *User_File,int Previous,int *NumberPtr,vo
static void Check_Macro_Vers(void);
static DBL Parse_Cond_Param(void);
static void Parse_Cond_Param2(DBL *V1,DBL *V2);
static void Inc_CS_Index(void);

#endif

Now, if I'm reading this right, depending on if POVISO is defined the
following...

	Skip_Spaces		Parse_C_Comments
	Begin_String		Stuff_Character
	End_String		Read_Float
	Parse_String_Literal	Read_Symbol
	Echo_getc		Skip_Tokens
	get_hash_value		init_sym_tables
	Add_Sym_Table		Destroy_Table
	Add_Entry		Find_Symbol
	Remove_Symbol		Check_Macro_Vers
	Parse_Macro		Invoke Macro
	Return_From_Macro	Parse_Initalizer
	Parse_Fopen		Parse_Fclose
	Parse_Read		Parse_Read_Value
	Parse_Write		Parse_Cond_Param
	Parse_Cond_Param2	Inc_CS_Index
	
can either be "static" or not.

Now, the problem is that when it comes to the actual functions, they are
still defined as "static".

So the function prototype can be either "static" or not but the function
it's self is "static"?

(That is, if I'm reading all this correct).

Now, my compiler will still compile it, but with warnings.

So I'm wondering if the functions should also have a test for POVISO so
the function can be defined as "static" or not?

Example...

/*****************************************************************************
*
* FUNCTION
*
* INPUT
*
* OUTPUT
*
* RETURNS
*
* AUTHOR
*
* DESCRIPTION
*
*   Skip over spaces in the input file.
*
* CHANGES
*
******************************************************************************/

#if defined(POVISO)
  int Skip_Spaces ()
#else
  static int Skip_Spaces ()
#endif

And if I'm write, I know other parts of the code that could use this
cleaning up.

So I'm open to suggestions and clarifications on this matter as I would
like to finish my port (and get on to the next problem).

Thanks.
(Sorry for the long port.)

-- 

 +--------------------------+----------------------------------------+
 | Robert Alan Byer         | "I don't want to take over the world,  |
 | bye### [at] mailourserversnet |  just my own little part of it."       |
 | Phone: (317)357-2724     | http://www.ourservers.net/~byer        |
 +--------------------------+----------------------------------------+
 | Send an E-mail request to obtain my PGP key.        ICQ #65926579 |
 +-------------------------------------------------------------------+


Post a reply to this message

From: Thomas Willhalm
Subject: Re: QUESTION: MegaPOV Code Questions/Problems (LONG)
Date: 6 Mar 2000 03:24:02
Message: <qqmn1ocld5p.fsf@schlatt.fmi.uni-konstanz.de>
Robert Alan Byer <bye### [at] mailourserversnet> writes:
> 
> In "TOKENIZE.C" there is the following section of code...
> 
> /***************************************************************************
> * Not-quite-so-Static functions
> ****************************************************************************/
[...]
> Now, the problem is that when it comes to the actual functions, they are
> still defined as "static".
> 
> So the function prototype can be either "static" or not but the function
> it's self is "static"?
> 
> (That is, if I'm reading all this correct).
> 
> Now, my compiler will still compile it, but with warnings.

From my limited knowledge of the code I can say that they can be static. 
More precisely, I have compiled the megapatch for Sun Solaris and I've 
had the same warnings. So, I've changed the not-quite-so-static 
functions to static functions and it worked fine for me.
Despite this fact I would like to know too, why they are considered 
not-quite-so-static.

Thomas


-- 
http://thomas.willhalm.de/ (includes pgp key)


Post a reply to this message

From: Nathan Kopp
Subject: Re: QUESTION: MegaPOV Code Questions/Problems (LONG)
Date: 6 Mar 2000 09:07:40
Message: <38c3bbac$1@news.povray.org>
Thomas Willhalm <tho### [at] willhalmde> wrote...
>
> From my limited knowledge of the code I can say that they can be static.
> More precisely, I have compiled the megapatch for Sun Solaris and I've
> had the same warnings. So, I've changed the not-quite-so-static
> functions to static functions and it worked fine for me.
> Despite this fact I would like to know too, why they are considered
> not-quite-so-static.

When merging all these various patches from various authors together, I
(actually, we), didn't have enough time to really look things over.  Those
functions were in the 'static' section, but for some reason somebody had
taken away the 'static' keyword.  I assumed that they were used elsewhere
(in the function parsing code, most likely).  Because the comment still said
"Static functions" even though they weren't static, I changed the comment.
It was kind of a joke to myself at the time, but it reflected the fact that
maybe they were static or maybe they were not... depending on the
perprocessor defines.

-Nathan


Post a reply to this message

From: Thomas Willhalm
Subject: Re: QUESTION: MegaPOV Code Questions/Problems (LONG)
Date: 6 Mar 2000 09:55:16
Message: <qqmog8sjgh6.fsf@schlatt.fmi.uni-konstanz.de>
"Nathan Kopp" <Nat### [at] Koppcom> writes:

> Thomas Willhalm <tho### [at] willhalmde> wrote...
> >
> > From my limited knowledge of the code I can say that they can be static.
> > More precisely, I have compiled the megapatch for Sun Solaris and I've
> > had the same warnings. So, I've changed the not-quite-so-static
> > functions to static functions and it worked fine for me.
> > Despite this fact I would like to know too, why they are considered
> > not-quite-so-static.
> 
> When merging all these various patches from various authors together, I
> (actually, we), didn't have enough time to really look things over.  Those
> functions were in the 'static' section, but for some reason somebody had
> taken away the 'static' keyword.  I assumed that they were used elsewhere
> (in the function parsing code, most likely).  Because the comment still said
> "Static functions" even though they weren't static, I changed the comment.
> It was kind of a joke to myself at the time, but it reflected the fact that
> maybe they were static or maybe they were not... depending on the
> perprocessor defines.

This explains it. I'm still impressed by your work to merge all these
patches (and writing your own at the same time). So, it's fully 
understandable that some gaps exist that haven't been be explored so far.

Thomas

-- 
http://thomas.willhalm.de/ (includes pgp key)


Post a reply to this message

From: Robert Alan Byer
Subject: Re: QUESTION: MegaPOV Code Questions/Problems (LONG)
Date: 6 Mar 2000 12:24:57
Message: <38C3A38D.4D553EF2@mail.ourservers.net>
> >
> > From my limited knowledge of the code I can say that they can be static.
> > More precisely, I have compiled the megapatch for Sun Solaris and I've
> > had the same warnings. So, I've changed the not-quite-so-static
> > functions to static functions and it worked fine for me.
> > Despite this fact I would like to know too, why they are considered
> > not-quite-so-static.
> 
> When merging all these various patches from various authors together, I
> (actually, we), didn't have enough time to really look things over.  Those
> functions were in the 'static' section, but for some reason somebody had
> taken away the 'static' keyword.  I assumed that they were used elsewhere
> (in the function parsing code, most likely).  Because the comment still said
> "Static functions" even though they weren't static, I changed the comment.
> It was kind of a joke to myself at the time, but it reflected the fact that
> maybe they were static or maybe they were not... depending on the
> perprocessor defines.
> 
> -Nathan

So, then answer to the "million-dollar-question" is that all of those
functions should be static and the section of the code in "tokenize.c"
and "f_expr.c" where they are defined as not being static should be
removed so the code can be cleaned up a bit.

Correct?

-- 

 +--------------------------+----------------------------------------+
 | Robert Alan Byer         | "I don't want to take over the world,  |
 | bye### [at] mailourserversnet |  just my own little part of it."       |
 | Phone: (317)357-2724     | http://www.ourservers.net/~byer        |
 +--------------------------+----------------------------------------+
 | Send an E-mail request to obtain my PGP key.        ICQ #65926579 |
 +-------------------------------------------------------------------+


Post a reply to this message

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