|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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 post.)
--
+--------------------------+----------------------------------------+
| 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: david sharp
Subject: Re: QUESTION: MegaPOV Code Questions/Problems (LONG)
Date: 5 Mar 2000 14:53:41
Message: <38c2bb45@news.povray.org>
|
|
|
| |
| |
|
|
I think that everything in that #ifdef POVISO section of
declarations is pointless.
None of those functions is ever used outside of tokenize.c,
so they all should be "static".
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>
> I think that everything in that #ifdef POVISO section of
> declarations is pointless.
> None of those functions is ever used outside of tokenize.c,
> so they all should be "static".
>
I don't think this is the case as most of those functions (the ones I
listed) are used in "F_EXPR.C" (In fact, that's the only place those
functions are used.)
--
+--------------------------+----------------------------------------+
| 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: Thorsten Froehlich
Subject: Re: QUESTION: MegaPOV Code Questions/Problems (LONG)
Date: 5 Mar 2000 21:46:32
Message: <38c31c08$1@news.povray.org>
|
|
|
| |
| |
|
|
In article <38C2D309.1FA42CE2@mail.ourservers.net> , Robert Alan Byer
<bye### [at] mailourserversnet> wrote:
>>
>> I think that everything in that #ifdef POVISO section of
>> declarations is pointless.
>> None of those functions is ever used outside of tokenize.c,
>> so they all should be "static".
>>
>
> I don't think this is the case as most of those functions (the ones I
> listed) are used in "F_EXPR.C" (In fact, that's the only place those
> functions are used.)
Today static functions are no longer a major issue in modern C. The
simplest solution is to just remove all of them and move on.
Thorsten
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> >>
> >> I think that everything in that #ifdef POVISO section of
> >> declarations is pointless.
> >> None of those functions is ever used outside of tokenize.c,
> >> so they all should be "static".
> >>
> >
> > I don't think this is the case as most of those functions (the ones I
> > listed) are used in "F_EXPR.C" (In fact, that's the only place those
> > functions are used.)
>
> Today static functions are no longer a major issue in modern C. The
> simplest solution is to just remove all of them and move on.
>
> Thorsten
Thanks, what I just ended up doing for now to make it "proper"
(so-to-speak) was to put "#if defined(POVISO)" clauses for each of the
functions to match the prototypes.
(At least for now.)
It looks like the code needs to be cleaned up a bit and I think I might
just do that and submit the cleaned up code files here to help prevent
future confustion.
--
+--------------------------+----------------------------------------+
| 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: Thorsten Froehlich
Subject: Re: QUESTION: MegaPOV Code Questions/Problems (LONG)
Date: 5 Mar 2000 22:08:35
Message: <38c32133@news.povray.org>
|
|
|
| |
| |
|
|
In article <38C2D8F9.17602873@mail.ourservers.net> , Robert Alan Byer
<bye### [at] mailourserversnet> wrote:
> Thanks, what I just ended up doing for now to make it "proper"
> (so-to-speak) was to put "#if defined(POVISO)" clauses for each of the
> functions to match the prototypes.
You can just do
#if defined(POVISO)
#define STATIC static
#else
#define STATIC
#endif
and replace any static with STATIC.
> It looks like the code needs to be cleaned up a bit and I think I might
> just do that and submit the cleaned up code files here to help prevent
> future confustion.
If I were you I would really not bother, the MegaPOV isosurface code will be
obsolete later this year when POV-Ray 3.5 arrives (with isosurfaces) anyway
:-)
Thorsten
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>
> > Thanks, what I just ended up doing for now to make it "proper"
> > (so-to-speak) was to put "#if defined(POVISO)" clauses for each of the
> > functions to match the prototypes.
>
> You can just do
>
> #if defined(POVISO)
> #define STATIC static
> #else
> #define STATIC
> #endif
>
> and replace any static with STATIC.
>
Thanks, I did something similar.
>
> > It looks like the code needs to be cleaned up a bit and I think I might
> > just do that and submit the cleaned up code files here to help prevent
> > future confustion.
>
> If I were you I would really not bother, the MegaPOV isosurface code will be
> obsolete later this year when POV-Ray 3.5 arrives (with isosurfaces) anyway
> :-)
>
O.k., well, I bothered with it as I wanted to get it working and a clean
compile now.
--
+--------------------------+----------------------------------------+
| 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
|
|
| |
| |
|
|
|
|
| |