POV-Ray : Newsgroups : povray.general : long syntax Server Time
6 Aug 2024 02:19:26 EDT (-0400)
  long syntax (Message 15 to 24 of 24)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Christopher James Huff
Subject: Re: long syntax
Date: 24 Jul 2002 12:19:51
Message: <chrishuff-E1D2DA.11124324072002@netplex.aussie.org>
In article <Xns### [at] 204213191226>,
 "Rafal 'Raf256' Maj" <raf### [at] raf256com> wrote:

> > Go ahead type that way, then search and replace before you render.
> > No need to change POV at all!
> 
> add-on is a good idea imho. I'll see if it will be usefull

The Windows editor doesn't already have search and replace? I'm pretty 
sure it does...

-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/


Post a reply to this message

From: TinCanMan
Subject: Re: long syntax
Date: 24 Jul 2002 12:41:00
Message: <3d3ed89c@news.povray.org>
> > #macro Fin(Dif, Amb, Spec, Rough, Refl)
> >     finish {
> >         diffuse Dif
> >         ambient Amb
> >         specular Spec
> >         roughness Rough
> >         reflection Refl
> >     }
> > #end
>

No need for all that.  Just create an include with macros along the lines
of:


#macro fin() finish #end

and use it like:
fin() { ambient 0 diffuse .3 reflection { .2 .4 } metallic .7 brilliance
1.2 }

no need to pass arguments at all and would use only one extra character
beyond the "@fin" you suggested.

I personally have no use for it as I'm perfectly comfortable with the
current syntax.  And that whole "@@" thing just weirds me out.

-tgq


Post a reply to this message

From: Rafal 'Raf256' Maj
Subject: Re: long syntax
Date: 24 Jul 2002 13:09:52
Message: <Xns9255C25DABD31raf256com@204.213.191.226>
Christopher James Huff <chr### [at] maccom> wrote in
news:chr### [at] netplexaussieorg 

> referrs to, they see "@@fi" followed by a bunch of similar garbage and
> what do you expect them to think?

"wow, it looks like bash" ;)

in Pascal/Delphi You have
  procedure fun(i : integer):integer; begin end;
  for i:=1 to 10 do begin end;

in C
  fun(int t) {} 
  for (i=1;i<=10;i++){}

I like C synax mose, and You ?

-- 
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message

From: Antti Arola
Subject: Re: long syntax
Date: 24 Jul 2002 14:08:35
Message: <slrnajtr7h.91u.aea@skavara.ese>
On 24 Jul 2002, Rafal 'Raf256' Maj <raf### [at] raf256com> wrote:
> I like C synax mose, and You ?

Perl is nicer:
@baz = $bar =~ /<img[^>]*src="([^">]*?$pattern[^">]*?)"/gi

But seriously, if POV's clear and descriptive SDL was a real
problem, it would've already been addressed. You know, one
of POV's oft-mentioned strong points is that one does not
need to be a programmer to use it.

That said, if the SDL bothers you, CHANGE IT. Write an
interface module that converts your SDL to POV and runs it
through the renderer. It's not even hard with today's
tools, such as Lex and Yacc, especially since you're only
replicating a well-known and -documented, structurally
simple grammar. If you want the very easy way out, you
could even skip the POV syntax checking and just implement
your shorthand grammar, since POV can report any SDL
errors.

-- 
Antti Arola, edistyksenvastainen retropaskiainen

This message written by a complete asshole.


Post a reply to this message

From: Christopher James Huff
Subject: Re: long syntax
Date: 24 Jul 2002 14:13:33
Message: <chrishuff-363063.13062024072002@netplex.aussie.org>
In article <Xns### [at] 204213191226>,
 "Rafal 'Raf256' Maj" <raf### [at] raf256com> wrote:

> > referrs to, they see "@@fi" followed by a bunch of similar garbage and
> > what do you expect them to think?
> 
> "wow, it looks like bash" ;)

How many people who don't like the scripting aspect of POV will be that 
familiar with bash?
Besides, shell scripting languages aren't exactly the ideal of 
programming languages... ;-)


> in Pascal/Delphi You have
>   procedure fun(i : integer):integer; begin end;
>   for i:=1 to 10 do begin end;
> 
> in C
>   fun(int t) {} 
>   for (i=1;i<=10;i++){}

You forgot a return type for the C function...and the Pascal also looks 
a little funny, though it's been too long since I used it. Comparing a 
function and procedure seems odd. Might be differences between what I 
learned and Delphi.


> I like C synax mose, and You ?

C. "==" for equality always seemed more obvious than ":=" for 
assignment, and the "{}" braces seem like a nice way to enclose blocks, 
visually obvious and short to type.
Your point? I don't see any indecipherable abbreviations or weird 
symbols in either of those. The "++" operator and for() statement come 
close, but are pretty obvious once explained. Pointers definitely would 
qualify, for both languages, but I don't think they are relevant...I 
definitely wouldn't say people should use either language for POV, since 
they are designed for programmers, though parts of the POV language 
could be improved by copying them.

-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/


Post a reply to this message

From: Ron Parker
Subject: Re: long syntax
Date: 24 Jul 2002 14:48:06
Message: <slrnajttj8.db0.ron.parker@fwi.com>
On 24 Jul 2002 14:08:35 -0400, Antti Arola wrote:
> On 24 Jul 2002, Rafal 'Raf256' Maj <raf### [at] raf256com> wrote:
>> I like C synax mose, and You ?
> 
> Perl is nicer:
> @baz = $bar =~ /<img[^>]*src="([^">]*?$pattern[^">]*?)"/gi

Why do you think you need minimal matching here?

-- 
#macro R(L P)sphere{L F}cylinder{L P F}#end#macro P(V)merge{R(z+a z)R(-z a-z)R(a
-z-z-z a+z)torus{1F clipped_by{plane{a 0}}}translate V}#end#macro Z(a F T)merge{
P(z+a)P(z-a)R(-z-z-x a)pigment{rgbt 1}hollow interior{media{emission T}}finish{
reflection.1}}#end Z(-x-x.2y)Z(-x-x.4x)camera{location z*-10rotate x*90}


Post a reply to this message

From: Rafal 'Raf256' Maj
Subject: Re: long syntax
Date: 24 Jul 2002 15:16:33
Message: <Xns9255D7D8E352raf256com@204.213.191.226>
Antti Arola <aea### [at] ioboxfi> wrote in news:slr### [at] skavaraese

> That said, if the SDL bothers you, CHANGE IT. Write an
> interface module that converts your SDL to POV and runs it

yes I will try

-- 
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message

From: Antti Arola
Subject: Re: long syntax
Date: 24 Jul 2002 15:37:54
Message: <slrnaju0f1.9pr.aea@skavara.ese>
On 24 Jul 2002 14:48:06 -0400, Ron Parker <ron### [at] povrayorg> wrote:
> On 24 Jul 2002 14:08:35 -0400, Antti Arola wrote:
>> Perl is nicer:
>> @baz = $bar =~ /<img[^>]*src="([^">]*?$pattern[^">]*?)"/gi
> 
> Why do you think you need minimal matching here?

I have no idea; I merely wrote that, surely you cannot
ask me to *understand* it as well?-)

(To be honest, it does what it's supposed to do, with
enough reliability for its purpose, and that's enough
incentive for me to stop trying to fix it. <g>)

[no POV here, f'ups set.]

-- 
Antti Arola, edistyksenvastainen retropaskiainen

This message written by a complete asshole.


Post a reply to this message

From: Fidel viegas
Subject: Re: long syntax
Date: 25 Jul 2002 11:56:18
Message: <B965DDA8.1580%fidel.viegas@artrecognition.co.uk>
Hello guys,

I don't think it is a good idea to add that ugly syntax to povray.
The best solution is write a preprocessor to do the translation just like
Antti said.
Povray looks great as it is. We don't mind typing extra because it looks
nice.

Anyway, All the best.

Fidel.

in article Xns### [at] 204213191226, Rafal 'Raf256' Maj at
raf### [at] raf256com wrote on 24/7/02 1:45 am:

> Hi,
> I have a little suggeston / future-request.
> Myself I like usign Pov without any editor (to type code "by hands" :)
> but there are one thing that IMHO makes it unnesesarly uncomfortalbe -
> [too] long names.
> 
> Compare i.e.:
> 
> difference {
> sphere { ... }
> torus { ... }
> finish { roughness 1 brillaince 2 relfection { .2 .5 } metallic 9 diffuse
> 0.7 }
> } superellipsoid { ... }
> 
> with :
> 
> @@diff {
> s { } tr { }
> fi { rou 1 bril 2 ref { .2 .5 } met 9 diff 0.7 }
> } @sup { ... }
> 
> 
> So the idea is to use aliases for important names, and to mark them with
> '@'.
> 
> Implementation imho would be quite easy - ther is probalby one function
> that reads next element, and tells is it an object, float, string,
> undeclared identyfier, etc...
> 
> So only we have to do something like
> void interprate(char *s) {
> if (s[0]=='@') {
> char *x = // match alias name, "s","tr","fi" etc
> interprate(x);
> } 
> }
> 
> 
> 
> 
> The more advanced idea is :
> 
> if alias is marked by "@@" like @@diff { ... } then assume that every name
> in it can be an alias, even it it is not marked with "@" (or "@@")
> 
> example :
> @sp { @fi { @ref } }   // ok. sp=sphere fi=finish ref=reflection
> @sp {  fi {  ref { } } // errors, fi and ref must be marked by "@"
> @@sp {  fi {  ref { } } // ok fi and ref are inside "@@" block
> @sp {@@fi {  ref { } } // ok ref is inside "@@" block
> 
> maybe alsow it will be a good idea to implement @! operator, that removes
> aliases from following block (i.e when we need names like "fi" in it)
> 
> #declare fi = 5.0;
> @@sp {
> fi { }
> @!pig {
> fi // fi is here an 5.0 float
> }
> }
> 
> this new syntax might look strange now, but it will shorten code about x3
> times ! x3 shorter code = x3 more writing, x3 more comfortable
> x3 more code on ona page (or screen)
> 
> 
> 
> 
> My suggestions :
> 
> @tex  texture
> @mat  material
> @fin  finish
> @nor  normal
> @int  interior
> 
> @cmap color_map
> @nmap normal_map
> @mmap material_map
> 
> @sp   sphere
> @bo   box
> @pl   plane
> @to   torus
> 
> @sup  superellipsoid (that's a good example ;)
> @blo  blob
> 
> @br   brilliance (only in finish block)
> @di   diffuse    (only in finish block)
> 
> 
> I want to *help* to implement aliases, but I can not do it my self (I do
> not understand Pov's souces enought)
> 
> 
> what do You thing about it ? If You agree that this is usefull, and
> somebody also want's to implement it - I will help :)


Post a reply to this message

From: Charles Fusner
Subject: Re: long syntax
Date: 26 Jul 2002 19:04:35
Message: <3D41D583.7040404@enter.net>
Rafal 'Raf256' Maj wrote:
> So the idea is to use aliases for important names, and to mark them with 
> '@'.
> 
> Implementation imho would be quite easy - ther is probalby one function 
> that reads next element, and tells is it an object, float, string, 
> undeclared identyfier, etc...
> 


If you use a Win32 environment, you might want to consider something
like NoteTab for your editor (http://www.notetab.com/). Here's some
of the options it could invoke to help you with what you are
describing...

1. Notetab supports user defined "auto-replace" libraries, which will
scan for certain keywords you define and replace them on the fly as you
type. You could define "@am" as a keyword and have Notetab automatically
change it to "ambient" as soon as you hit the spacebar, and the editor
is sure you are done with that word. This is nearly what you are asking
to do, except that no changes to POV are required. Same saved typing,
though.

2. The built in "clipbook" scripting can do things as simple as letting
you click on a named link and have it auto-insert the text, to as
complicated as popping up a dialog box for the parameters and typing the 
whole block of code for you. So, assuming you set up the custom clipbook
items you find most helpful, you can do something as easy as click on
the word "ambient" and have Notetab insert the text "ambient" at the
current cursor position, or as complex as click on "sphere" and Notetab
prompts you for a radius and center then generates a skeletal code for
a sphere based on your input. You write the clipbooks yourself, so you
get to decide what commonly needed features need to be automated and
even change your mind as your coding needs change over time. These
clipbooks can also execute command lines so you can launch the file
in POV-Ray with just another click.

3. My favorite feature: Notetab has support to shell out to any perl
or gawk interpreter you may have installed allow you to process the
current active file thru a script automagically. It works like this:
If there's a user selection in the text, that selection is fed to your
script via STDIN and any output the script returns via STDOUT is dumped
in as a replacement for the selection. If no user selection exists,
Notetab by default does a select all on the complete file, so the entire
active file gets processed. This allows maniuplations of darn near
any complexity in a relatively painless, automated fashion. You could
write a script that preprocesses your code by scanning for any custom
abbrievations or syntax extensions you've defined and output regular,
POV standard code as the final result. This is the most complicated
option and the one requiring the most programming knowledge, but it
allows for the greatest possible flexibility in manipulating your code.
Heck, you could write a whole second language and have your script
pre-process it into POV SDL output if you were that ambitious. :)


Charles


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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