Thread: Avisynth+
View Single Post
Old 1st November 2013, 13:50   #202  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,373
Quote:
Originally Posted by ultim View Post
Sure, there is always room for feature requests!
How about this syntax change...for better self-documenting function declarations:

(EDIT or would this be out because it breaks compatibility?)
Code:
## function declare examples, current syntax:

function SAA(clip C, int "ss", bool "cp", int "aa")

function FunkyDeblock(clip c, int "quant", int "th", 
\        int "radius", bool "deblock", bool "depump")

function Detwinkle(clip C, float "grainmask", 
\        int "grainmode", int "tstren",  
\        float "hicont", float "hisharp", 
\        float "unblur", float "mosens", 
\        int "hismooth", String "show") 

## add syntax support for DEFAULT VALUE:

## * defaults are optional of course
## * compiler assigns default values automatically if specified
## * string literals only - no variables or Eval statements!
## * strings are not quoted (certain chars can't be supported - unless escaped?)
## * empty String defaults accepted, meaning empty string, as opposed to Undefined.
## * other empty defaults are syntax errors
## * specify explicit undefined defaults with "Undefined", "Nop" or "null"

function SAA(clip C, int "ss=2", bool "cp=true", int "aa=48")

function FunkyDeblock(clip c, int "quant=4", int "th=3", 
\        int "radius=4", bool "deblock=true", bool "depump=true")

function Detwinkle(clip C, float "grainmask=1.3", 
\        int "grainmode=2", int "tstren=25",  
\        float "hicont=1.3", float "hisharp=0", 
\        float "unblur=3", float "mosens=3", 
\        int "hismooth=2", String "show=") 


## add syntax support for DEFAULT VALUE and VALID INPUTS:

## * compiler assigns default values and enforces valid inputs
## * space optional before start of "[...]" range specifier
## * ranges ".." delimited? Dunno.
## * valid alternate values "|" delimited
## * valid ranges: "[min..max]" "[min..]" "[..max]"  or "[alt1|alt2|alt3]"
## * consider enforcing range specifier if default is used

function SAA(clip C, int "ss=2 [1..8]", bool "cp=true", int "aa=48 [4..256]")

function FunkyDeblock(clip c, int "quant=4 [0..51]", int "th=3 [0..128]", 
\        int "radius=4 [1..60]", bool "deblock=true", bool "depump=true")

function Detwinkle[clip C, float "grainmask=1.3 [0.7..18]", 
\      int "grainmode=2 [0..18]", int "tstren=25 [1..255]",  
\      float "hicont=1.3 [0.1..10]", float "hisharp=0 [-1..1]", 
\      float "unblur=3 [0..99]", float "mosens=3 [0.1..5]", 
\      int "hismooth=2 [1..5]", String "show= [blur|mask|luma|cyan|]")

Last edited by raffriff42; 1st November 2013 at 13:57.
raffriff42 is offline