Esempio n. 1
0
/* while文文の文ノードを作る  while(e) body */
stmt_t mk_stmt_while(char * filename, int line, expr_t e, stmt_t body)
{
  stmt_t s = alloc_stmt(filename, line, stmt_kind_while);
  s->u.w.e = e;
  s->u.w.body = body;
  return s;
}
Esempio n. 2
0
/* 複合文 の文ノードを作る. decls : 変数宣言. body 本体の文のリスト */
stmt_t mk_stmt_compound(char * filename, int line, 
			var_decl_list_t decls, stmt_list_t body)
{
  stmt_t s = alloc_stmt(filename, line, stmt_kind_compound);
  s->u.c.decls = decls;
  s->u.c.body = body;
  return s;
}
Esempio n. 3
0
/* if文の文ノードを作る (e) th else el  */
stmt_t mk_stmt_if(char * filename, int line, expr_t e, stmt_t th, stmt_t el)
{
  stmt_t s = alloc_stmt(filename, line, stmt_kind_if);
  s->u.i.e = e;
  s->u.i.th = th;
  s->u.i.el = el;
  return s;
}
Esempio n. 4
0
KL_Stmt* 
KL_create_return_stmt(KL_Expr* expr)
{
  KL_Stmt* stmt = alloc_stmt(ST_RET);
  stmt->stmt.ret_s.ret_expr = expr;

  return stmt;
}
Esempio n. 5
0
KL_Stmt* 
KL_create_expr_stmt(KL_Expr* expr)
{
  KL_Stmt* stmt = alloc_stmt(ST_EXPR);
  stmt->stmt.expr_s = expr;

  return stmt;
}
Esempio n. 6
0
KL_Stmt* 
KL_create_global_stmt(KL_IDList* id_list)
{
  KL_Stmt* stmt = alloc_stmt(ST_GLOBAL);
  stmt->stmt.global_s.id_list = id_list;

  return stmt;
}
Esempio n. 7
0
KL_Stmt* 
KL_create_while_stmt(KL_Expr* cond, KL_Block* block)
{
  KL_Stmt* stmt = alloc_stmt(ST_WHILE);
  stmt->stmt.while_s.cond = cond;
  stmt->stmt.while_s.block = block;

  return stmt;
}
Esempio n. 8
0
KL_Stmt* 
KL_create_if_stmt(KL_Expr* cond, KL_Block* then_block, KL_Block* else_block)
{
  KL_Stmt* stmt = alloc_stmt(ST_IF);
  stmt->stmt.if_s.cond = cond;
  stmt->stmt.if_s.then_block = then_block;
  stmt->stmt.if_s.else_block = else_block;

  return stmt;
}
Esempio n. 9
0
CAMLprim value caml_sqlite3_prepare(value v_db, value v_sql)
{
  CAMLparam2(v_db, v_sql);
  char *loc = "prepare";
  db_wrap *dbw = Sqlite3_val(v_db);
  value v_stmt;
  check_db(dbw, loc);
  v_stmt = alloc_stmt(dbw);
  prepare_it(dbw, v_stmt, String_val(v_sql), caml_string_length(v_sql), loc);
  CAMLreturn(v_stmt);
}
Esempio n. 10
0
CAMLprim value caml_sqlite3_prepare_tail(value v_stmt)
{
  CAMLparam1(v_stmt);
  char *loc = "prepare_tail";
  stmt_wrap *stmtw = Sqlite3_stmtw_val(v_stmt);
  if (stmtw->sql && stmtw->tail && *(stmtw->tail)) {
    db_wrap *dbw = stmtw->db_wrap;
    value v_new_stmt = alloc_stmt(dbw);
    int tail_len = stmtw->sql_len - (stmtw->tail - stmtw->sql);
    prepare_it(dbw, v_new_stmt, stmtw->tail, tail_len, loc);
    CAMLreturn(Val_Some(v_new_stmt));
  }
  else CAMLreturn(Val_None);
}
Esempio n. 11
0
bool Fl_Query::open() {
    checkDatabaseState();

    try {
        m_database->lock();
        if (!m_stmt)
            alloc_stmt();
        m_database->open_query(this);
    }
    catch (...) {
        m_database->unlock();
        throw;
    }

    m_database->unlock();

    m_active = true;
    return true;
}
Esempio n. 12
0
/* 式文 e; の文ノードを作る */
stmt_t mk_stmt_expr(char * filename, int line, expr_t e)
{
  stmt_t s = alloc_stmt(filename, line, stmt_kind_expr);
  s->u.e = e;
  return s;
}
Esempio n. 13
0
/* break文の文ノードを作る */
stmt_t mk_stmt_break(char * filename, int line)
{
  return alloc_stmt(filename, line, stmt_kind_break);
}
Esempio n. 14
0
/* continue文の文ノードを作る */
stmt_t mk_stmt_continue(char * filename, int line)
{
  return alloc_stmt(filename, line, stmt_kind_continue);
}
Esempio n. 15
0
/* 空文の文ノードを作る */
stmt_t mk_stmt_empty(char * filename, int line)
{
  return alloc_stmt(filename, line, stmt_kind_empty);
}
Esempio n. 16
0
KL_Stmt* 
KL_create_break_stmt(void)
{
  return alloc_stmt(ST_BREAK);
}