POV-Ray : Newsgroups : povray.programming : QUESTION: MegaPOV Code Questions/Problems (LONG) : QUESTION: MegaPOV Code Questions/Problems (LONG) Server Time
28 Jul 2024 16:19:39 EDT (-0400)
  QUESTION: MegaPOV Code Questions/Problems (LONG)  
From: Robert Alan Byer
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

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