Changeset b54b06a
- Timestamp:
- Sep 30, 2011, 8:14:49 AM (13 years ago)
- Children:
- cce9369
- Parents:
- c0e728a
- git-author:
- Jason Gross <jgross@mit.edu> (05/23/11 22:03:45)
- git-committer:
- Jason Gross <jgross@mit.edu> (09/30/11 08:14:49)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/lib/BarnOwl.pm
r7803326 rb54b06a 17 17 add_io_dispatch remove_io_dispatch 18 18 new_command 19 new_variable_int new_variable_bool new_variable_string 19 new_variable_int new_variable_bool new_variable_string new_variable_enum 20 20 quote redisplay); 21 21 our %EXPORT_TAGS = (all => \@EXPORT_OK); … … 389 389 =head2 new_variable_string NAME [{ARGS}] 390 390 391 Add a new owl variable, either an int, a bool, or a string, with the 392 specified name. 391 =head2 new_variable_enum NAME [{ARGS}] 392 393 Add a new owl variable, either an int, a bool, a string, or an enum, 394 with the specified name. 393 395 394 396 ARGS can optionally contain the following keys: … … 398 400 =item default 399 401 400 The default and initial value for the variable 402 The default and initial value for the variable. 403 Note that this should be a string value for an enum. 401 404 402 405 =item summary … … 407 410 408 411 A longer description of the function of the variable 412 413 =item valid_settings 414 415 A listref of valid setttings for the enum variable. 416 The settings must not contain any commas. 409 417 410 418 =back … … 425 433 unshift @_, \&BarnOwl::Internal::new_variable_string, ""; 426 434 goto \&_new_variable; 435 } 436 437 sub new_variable_enum { 438 my $name = shift; 439 my $args = shift || {}; 440 my %args = ( 441 summary => "", 442 description => "", 443 %{$args}); 444 445 my @valid_settings = @{$args{valid_settings}}; 446 if (defined $args{default}) { 447 ($args{default}) = grep { $args{default} eq $valid_settings[$_] } 0..$#valid_settings; # turn the string default into a numerical default 448 } else { 449 $args{default} = 0; 450 } 451 $args{valid_settings} = join ",", @valid_settings; 452 453 BarnOwl::Internal::new_variable_enum($name, $args{default}, $args{summary}, $args{description}, $args{valid_settings}); 427 454 } 428 455 -
perlglue.xs
re89ec48 rb54b06a 444 444 445 445 void 446 new_variable_enum(name, ival, summ, desc, validset) 447 const char * name 448 int ival 449 const char * summ 450 const char * desc 451 const char * validset 452 CODE: 453 owl_variable_dict_newvar_enum(owl_global_get_vardict(&g), 454 name, 455 summ, 456 desc, 457 ival, 458 validset); 459 460 void 446 461 start_edit(edit_type, line, callback) 447 462 const char *edit_type
Note: See TracChangeset
for help on using the changeset viewer.