Exemple #1
0
static int get_choice(lua_State * L) {
    check_choice(L, 1);
    expr const & c = to_expr(L, 1);
    int i = lua_tointeger(L, 2);
    if (i < 0 || static_cast<unsigned>(i) >= get_num_choices(c))
        throw exception("arg #2 is an invalid choice index");
    return push_expr(L, get_choice(c, i));
}
Exemple #2
0
void 
start_group_tag( xml_elem_t *doc, xml_elem_t *parm, ASXMLInterpreterState *state )
{
	++(state->group_depth);	
	set_flags(state->flags, ASXMLI_FirstArg );
	if( state->doc_type == DocType_NROFF )
		fputc( ' ', state->dest_fp );
	if( check_choice( parm ) ) 
		fputc( '[', state->dest_fp );
}
Exemple #3
0
void 
end_arg_tag( xml_elem_t *doc, xml_elem_t *parm, ASXMLInterpreterState *state )
{
	--(state->group_depth);	
	if( state->doc_type == DocType_HTML	|| state->doc_type == DocType_PHP )
		fwrite( "</B>", 1, 4, state->dest_fp );
	else if( state->doc_type == DocType_NROFF )
		fprintf( state->dest_fp, "\\fP");
	if( check_choice( parm ) ) 
		fputc( ']', state->dest_fp );
	if( state->doc_type == DocType_NROFF )
		fputc( ' ', state->dest_fp );
}
Exemple #4
0
void 
start_arg_tag( xml_elem_t *doc, xml_elem_t *parm, ASXMLInterpreterState *state )
{
	if( !get_flags(state->flags, ASXMLI_FirstArg ) && state->group_depth > 0 )
		fwrite( "| ", 1, 2, state->dest_fp );
	clear_flags(state->flags, ASXMLI_FirstArg );
	if( state->doc_type == DocType_NROFF )
		fputc( ' ', state->dest_fp );
	if( check_choice( parm ) ) 
		fputc( '[', state->dest_fp );
	if( state->doc_type == DocType_HTML	|| state->doc_type == DocType_PHP	 )
		fwrite( "<B>", 1, 3, state->dest_fp );
	else if( state->doc_type == DocType_NROFF )
		fprintf( state->dest_fp, "\\fI");
}
static gboolean
check_choices (GVariant *value,
               GError **error)
{
  int i;

  if (!check_value_type ("choices", value, G_VARIANT_TYPE ("a(ssa(ss)s)"), error))
    return FALSE;

  for (i = 0; i < g_variant_n_children (value); i++)
    {
      g_autoptr(GVariant) choice = g_variant_get_child_value (value, i);

      if (!check_choice (choice, error))
        {
          g_prefix_error (error, "invalid choice: ");
          return FALSE;
        }
    }

  return TRUE;
}
Exemple #6
0
new_music_d::new_music_d(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::new_music_d)
{
    ui->setupUi(this);

    //CHECK DIR
    QDir dir = QDir::current();
    if (!dir.exists("music"))
        if(!dir.mkdir("music"))
            QMessageBox::warning(this, tr("Dance class"),
                                 tr("Cannot create directory 'music'."));

    model = new QFileSystemModel;
    model->setRootPath(dir.absoluteFilePath("music"));
    update_tree();

    connect(ui->treeView, SIGNAL(clicked(QModelIndex)),
            this, SLOT(check_choice(QModelIndex)));
    connect(ui->treeView, SIGNAL(doubleClicked(QModelIndex)),
            this, SLOT(add_choice(QModelIndex)));
    connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(create_music()));
    connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
}
Exemple #7
0
static int get_num_choices(lua_State * L) {
    check_choice(L, 1);
    return push_integer(L, get_num_choices(to_expr(L, 1)));
}