GetPot Dollar Bracket Language.
The
dollar bracket language allows a variety of operations on variables,
numbers and strings inside a configuration file. For the programmer
that reads the configuration file, it is completely indifferent if the
file was written using dollar bracket language or not. The user on the
other hand, can decide how much of its features he wants to use. The
programmer who reads the information from the GetPot objects still
always operates with the same ease.
One goal if GetPot is also to establish a standardization of
this configuration file language. This way many applications can offer
compfortable configuration files, and users don't not have to learn for each
application another language. One means in order to achieve this is a
massive porting to different programming languages such as C++, Java, Python, and Ruby.
name = GetPot
[${name}] address = getpot.sourceforge.net
[]
info0 = ${GetPot/address}
[1.2] [Philosophy]
boss = 'Dr. Frederique Mouillard'
members = 4
professors = 3
[Mechanical-Engineering]
boss = Dr.\ Frieda\ LaBlonde
members = 24
professors = 5
[]
x1 = Mechanical-Engineering
x2 = Philosophy
[1.2]
info0 = '${${x1}/boss}: ${${x1}/professors}/${${x1}/members}'
info1 = '${${x2}/boss}: ${${x2}/professors}/${${x2}/members}'
[1.3] car = Citroen-2CV
ground-vehicle = car
vehicle = ground-vehicle
object = vehicle
variable = info0
${variable} = '${${ ${ ${object}}}}'
[Citroen-2CV]
[./wheels]
[./front]
[./right]
radius = 30
[1.3]
part = wheels
attribute = radius
position = front/right
variable = info1
${variable} = '${${${${${object}}}}/${part}/${position}/${attribute}}'
[1.4]
[Nicknames]
BMW = Beamer
Mercedez = Grandpa\'s\ Slide
Volkswagen = Beetle
Citroen-2CV = Deuche
[1.4]
info0 = '${Nicknames/${1.3/info0}}'
my-car = Mercedez
info1 = '${Nicknames/${1.4/my-car}}'
[2.1] info0 = ${:even expressions like ${my-car} are left as they are}
info1 = ${:\\-ing (backslashing) works still the same way}
info2 = ${:backslashes allow one to have spaces w/o quotes}
[2.2] info0 = ${& simple concatination without whitespaces results in a mess}
info1 = '${& ${:In France, the } ${1.3/info0}
${: is called \'La } ${Nicknames/${1.3/info0}} \'}
'
[2.3] info0 = 'We spell your name \'${<-> Phillip Ph F}\''
info1 = 'The ${<-> ${Nicknames/Volkswagen} ee ea}s'
car = Nicknames/Citroen-2CV
info2 = 'I switched from ${${car}} to ${${<-> ${car} Citroen-2CV Volkswagen}}'
[3.1] info0 = ${+ 1 1}
x = 4699 y = 14 z = 4
info1 = ${+ ${x} ${y} -2}
info2 = ${- 10 1}
info3 = ${- ${x} ${y} -2}
info4 = '${* 12 12}'
info5 = '${* 2 2 ${z}}'
info6 = '${/ 12 6}'
info7 = '${/ 144 12 3 2}'
[3.2] info0 = '${^ 2 16}'
info1 = '${^ 2 2 2 2}'
[3.3] info0 = ${== 1 2}
info1 = ${== Deuche ${${2.3/car}}}
info2 = ${== 1.0 1.000}
info3 = '${>= 3.14 12} but ${>= 3.14 0.0} and ${>= 3.14 3.140000}'
info4 = '${< 12 3.14} but ${< 3.14 3.141} and ${> Berta Vladimir}'
info5 = '${> 12 3.14} but ${> 3.14 3.141} and ${> Zeppelin Alberta}'
info6 = 'The real name for 'Deuche' is number ${== Deuche
${Nicknames/Volkswagen}
${Nicknames/Mercedez}
${Nicknames/Citroen-2CV}
${Nicknames/BMW}}'
info7 = 'The first element less than 2 is element number ${> 2 10 1001 3 6 1 9 -10}'
[3.4] guess = Citroen-2CV
info0 = 'Your guess was ${? ${== Citroen-2CV ${guess}} right wrong}'
x = 12 y = 14
info1 = 'x (=${x}) is ${?${> ${x} ${y}} greater less} than y (=${y})'
[msg]
english = 'Star Wars'
francais = 'La Guerre des Etoiles'
espagnol = 'Las Guerras De la Estrella'
italiano = 'Le Guerre Della Stella'
deutsch = 'Krieg der Beruehmten'
portugues = 'As Guerras Da Estrela'
[3.4] domain = .fr
info2 = '${?? ${== ${domain} .de .uk .fr .es .it .pt}
${msg/deutsch}
${msg/english}
${msg/francais}
${msg/espagnol}
${msg/italiano}
${msg/portugues}}'
[3.5] info0 = '${@: Wasserkraftwerkinstallationsunternehmenspruefstelle 6 10}'
info1 = '${@: Wasserkraftwerkinstallationsunternehmenspruefstelle 4}'
info2 = '${@: Wasserkraftwerkinstallationsunternehmenspruefstelle 40 -1}'
info3 = '${@: Wasserkraftwerkinstallationsunternehmenspruefstelle 0 5}'
my-vector = 'Cordoba Madrid Buenos-Aires Kairo Moskow Heidelberg
Grenoble Marseille Disneyland'
info4 = ${@ my-vector 4 -1} info5 = ${@ info4 3 4} info6 = ${@ info4 0 3} info7 = ${@ info4 4}
[3.6] x2 = ${: ${* ${x} ${x}}}
x4 = ${: ${* ${!x2} ${!x2}}}
x6 = ${: ${* ${!x4} ${!x2}}}
sin = ${: ${* ${x}
${+ 1
${/ ${!x2} -6}
${/ ${!x4} 120}
${/ ${!x6} -5040}
}
}
}
convert = ${/ 3.14 180.0}
x = ${* 30 ${convert}}
info0 = ${!sin}
x = ${* 60 ${convert}}
info1 = ${!sin}