Skip to content

Instantly share code, notes, and snippets.

@rubys
Created May 17, 2026 23:33
Show Gist options
  • Select an option

  • Save rubys/caaab6ef1936f5670db802b8718969a7 to your computer and use it in GitHub Desktop.

Select an option

Save rubys/caaab6ef1936f5670db802b8718969a7 to your computer and use it in GitHub Desktop.
articles_controller_test.c after spinel 8ca93b4 (regression on iv___session/iv___flash)
/* Generated by Spinel AOT compiler */
#include "sp_runtime.h"
/* sp_sym intern table */
#define SP_SYM_COUNT 112
static const char *const sp_sym_names[112] = {(&("\xff" "OK")[1]),(&("\xff" "ROW")[1]),(&("\xff" "DONE")[1]),(&("\xff" "sqlite3_open")[1]),(&("\xff" "str")[1]),(&("\xff" "ptr")[1]),(&("\xff" "int")[1]),(&("\xff" "sqlite3_close")[1]),(&("\xff" "sqlite3_exec")[1]),(&("\xff" "sqlite3_prepare_v2")[1]),(&("\xff" "sqlite3_step")[1]),(&("\xff" "sqlite3_finalize")[1]),(&("\xff" "sqlite3_column_int")[1]),(&("\xff" "sqlite3_column_text")[1]),(&("\xff" "sqlite3_column_count")[1]),(&("\xff" "sqlite3_column_name")[1]),(&("\xff" "sqlite3_errmsg")[1]),(&("\xff" "sqlite3_last_insert_rowid")[1]),(&("\xff" "long")[1]),(&("\xff" "sqlite3_changes")[1]),(&("\xff" "db_out")[1]),(&("\xff" "stmt_out")[1]),(&("\xff" "read_ptr")[1]),(&("\xff" "record")[1]),(&("\xff" "adapter")[1]),(&("\xff" "id")[1]),(&("\xff" "updated_at")[1]),(&("\xff" "created_at")[1]),(&("\xff" "verb")[1]),(&("\xff" "pattern")[1]),(&("\xff" "controller")[1]),(&("\xff" "action")[1]),(&("\xff" "path_params")[1]),(&("\xff" "notice")[1]),(&("\xff" "alert")[1]),(&("\xff" "__body__")[1]),(&("\xff" "href")[1]),(&("\xff" "method")[1]),(&("\xff" "form_class")[1]),(&("\xff" "class")[1]),(&("\xff" "type")[1]),(&("\xff" "rel")[1]),(&("\xff" "name")[1]),(&("\xff" "path")[1]),(&("\xff" "model")[1]),(&("\xff" "model_name")[1]),(&("\xff" "for")[1]),(&("\xff" "value")[1]),(&("\xff" "patch")[1]),(&("\xff" "data-disable-with")[1]),(&("\xff" "post")[1]),(&("\xff" "accept-charset")[1]),(&("\xff" "ok")[1]),(&("\xff" "created")[1]),(&("\xff" "accepted")[1]),(&("\xff" "no_content")[1]),(&("\xff" "moved_permanently")[1]),(&("\xff" "found")[1]),(&("\xff" "see_other")[1]),(&("\xff" "not_modified")[1]),(&("\xff" "bad_request")[1]),(&("\xff" "unauthorized")[1]),(&("\xff" "forbidden")[1]),(&("\xff" "not_found")[1]),(&("\xff" "unprocessable_entity")[1]),(&("\xff" "unprocessable_content")[1]),(&("\xff" "internal_server_error")[1]),(&("\xff" "params")[1]),(&("\xff" "session")[1]),(&("\xff" "flash")[1]),(&("\xff" "request_method")[1]),(&("\xff" "request_path")[1]),(&("\xff" "request_format")[1]),(&("\xff" "status")[1]),(&("\xff" "body")[1]),(&("\xff" "location")[1]),(&("\xff" "content_type")[1]),(&("\xff" "html")[1]),(&("\xff" "append")[1]),(&("\xff" "stream")[1]),(&("\xff" "target")[1]),(&("\xff" "prepend")[1]),(&("\xff" "replace")[1]),(&("\xff" "remove")[1]),(&("\xff" "delete")[1]),(&("\xff" "data")[1]),(&("\xff" "turbo_confirm")[1]),(&("\xff" "comments_count")[1]),(&("\xff" "length")[1]),(&("\xff" "opts")[1]),(&("\xff" "title")[1]),(&("\xff" "rows")[1]),(&("\xff" "article_id")[1]),(&("\xff" "commenter")[1]),(&("\xff" "head")[1]),(&("\xff" "data-turbo-track")[1]),(&("\xff" "index")[1]),(&("\xff" "show")[1]),(&("\xff" "new")[1]),(&("\xff" "edit")[1]),(&("\xff" "create")[1]),(&("\xff" "update")[1]),(&("\xff" "destroy")[1]),(&("\xff" "json")[1]),(&("\xff" "articles")[1]),(&("\xff" "comments")[1]),(&("\xff" "success")[1]),(&("\xff" "redirect")[1]),(&("\xff" "missing")[1]),(&("\xff" "error")[1]),(&("\xff" "minimum")[1]),(&("\xff" "article")[1])};
static const char *sp_sym_to_s(sp_sym id) __attribute__((unused));
static const char *sp_sym_to_s(sp_sym id){if(id>=0&&id<SP_SYM_COUNT)return sp_sym_names[id];return "";}
#define SPS_OK ((sp_sym)0)
#define SPS_ROW ((sp_sym)1)
#define SPS_DONE ((sp_sym)2)
#define SPS_sqlite3_open ((sp_sym)3)
#define SPS_str ((sp_sym)4)
#define SPS_ptr ((sp_sym)5)
#define SPS_int ((sp_sym)6)
#define SPS_sqlite3_close ((sp_sym)7)
#define SPS_sqlite3_exec ((sp_sym)8)
#define SPS_sqlite3_prepare_v2 ((sp_sym)9)
#define SPS_sqlite3_step ((sp_sym)10)
#define SPS_sqlite3_finalize ((sp_sym)11)
#define SPS_sqlite3_column_int ((sp_sym)12)
#define SPS_sqlite3_column_text ((sp_sym)13)
#define SPS_sqlite3_column_count ((sp_sym)14)
#define SPS_sqlite3_column_name ((sp_sym)15)
#define SPS_sqlite3_errmsg ((sp_sym)16)
#define SPS_sqlite3_last_insert_rowid ((sp_sym)17)
#define SPS_long ((sp_sym)18)
#define SPS_sqlite3_changes ((sp_sym)19)
#define SPS_db_out ((sp_sym)20)
#define SPS_stmt_out ((sp_sym)21)
#define SPS_read_ptr ((sp_sym)22)
#define SPS_record ((sp_sym)23)
#define SPS_adapter ((sp_sym)24)
#define SPS_id ((sp_sym)25)
#define SPS_updated_at ((sp_sym)26)
#define SPS_created_at ((sp_sym)27)
#define SPS_verb ((sp_sym)28)
#define SPS_pattern ((sp_sym)29)
#define SPS_controller ((sp_sym)30)
#define SPS_action ((sp_sym)31)
#define SPS_path_params ((sp_sym)32)
#define SPS_notice ((sp_sym)33)
#define SPS_alert ((sp_sym)34)
#define SPS___body__ ((sp_sym)35)
#define SPS_href ((sp_sym)36)
#define SPS_method ((sp_sym)37)
#define SPS_form_class ((sp_sym)38)
#define SPS_class ((sp_sym)39)
#define SPS_type ((sp_sym)40)
#define SPS_rel ((sp_sym)41)
#define SPS_name ((sp_sym)42)
#define SPS_path ((sp_sym)43)
#define SPS_model ((sp_sym)44)
#define SPS_model_name ((sp_sym)45)
#define SPS_for ((sp_sym)46)
#define SPS_value ((sp_sym)47)
#define SPS_patch ((sp_sym)48)
#define SPS_post ((sp_sym)50)
#define SPS_ok ((sp_sym)52)
#define SPS_created ((sp_sym)53)
#define SPS_accepted ((sp_sym)54)
#define SPS_no_content ((sp_sym)55)
#define SPS_moved_permanently ((sp_sym)56)
#define SPS_found ((sp_sym)57)
#define SPS_see_other ((sp_sym)58)
#define SPS_not_modified ((sp_sym)59)
#define SPS_bad_request ((sp_sym)60)
#define SPS_unauthorized ((sp_sym)61)
#define SPS_forbidden ((sp_sym)62)
#define SPS_not_found ((sp_sym)63)
#define SPS_unprocessable_entity ((sp_sym)64)
#define SPS_unprocessable_content ((sp_sym)65)
#define SPS_internal_server_error ((sp_sym)66)
#define SPS_params ((sp_sym)67)
#define SPS_session ((sp_sym)68)
#define SPS_flash ((sp_sym)69)
#define SPS_request_method ((sp_sym)70)
#define SPS_request_path ((sp_sym)71)
#define SPS_request_format ((sp_sym)72)
#define SPS_status ((sp_sym)73)
#define SPS_body ((sp_sym)74)
#define SPS_location ((sp_sym)75)
#define SPS_content_type ((sp_sym)76)
#define SPS_html ((sp_sym)77)
#define SPS_append ((sp_sym)78)
#define SPS_stream ((sp_sym)79)
#define SPS_target ((sp_sym)80)
#define SPS_prepend ((sp_sym)81)
#define SPS_replace ((sp_sym)82)
#define SPS_remove ((sp_sym)83)
#define SPS_delete ((sp_sym)84)
#define SPS_data ((sp_sym)85)
#define SPS_turbo_confirm ((sp_sym)86)
#define SPS_comments_count ((sp_sym)87)
#define SPS_length ((sp_sym)88)
#define SPS_opts ((sp_sym)89)
#define SPS_title ((sp_sym)90)
#define SPS_rows ((sp_sym)91)
#define SPS_article_id ((sp_sym)92)
#define SPS_commenter ((sp_sym)93)
#define SPS_head ((sp_sym)94)
#define SPS_index ((sp_sym)96)
#define SPS_show ((sp_sym)97)
#define SPS_new ((sp_sym)98)
#define SPS_edit ((sp_sym)99)
#define SPS_create ((sp_sym)100)
#define SPS_update ((sp_sym)101)
#define SPS_destroy ((sp_sym)102)
#define SPS_json ((sp_sym)103)
#define SPS_articles ((sp_sym)104)
#define SPS_comments ((sp_sym)105)
#define SPS_success ((sp_sym)106)
#define SPS_redirect ((sp_sym)107)
#define SPS_missing ((sp_sym)108)
#define SPS_error ((sp_sym)109)
#define SPS_minimum ((sp_sym)110)
#define SPS_article ((sp_sym)111)
typedef struct{sp_sym*keys;mrb_int*vals;sp_sym*order;mrb_int len;mrb_int cap;mrb_int mask;}sp_SymIntHash;
static void sp_SymIntHash_fin(void*p){sp_SymIntHash*h=(sp_SymIntHash*)p;free(h->keys);free(h->vals);free(h->order);}
static sp_SymIntHash*sp_SymIntHash_new(void){sp_SymIntHash*h=(sp_SymIntHash*)sp_gc_alloc(sizeof(sp_SymIntHash),sp_SymIntHash_fin,NULL);h->cap=16;h->mask=15;h->keys=(sp_sym*)malloc(sizeof(sp_sym)*h->cap);for(mrb_int i=0;i<h->cap;i++)h->keys[i]=-1;h->vals=(mrb_int*)calloc(h->cap,sizeof(mrb_int));h->order=(sp_sym*)malloc(sizeof(sp_sym)*h->cap);h->len=0;return h;}
static void sp_SymIntHash_grow(sp_SymIntHash*h){mrb_int oc=h->cap;sp_sym*ok=h->keys;mrb_int*ov=h->vals;h->cap*=2;h->mask=h->cap-1;h->keys=(sp_sym*)malloc(sizeof(sp_sym)*h->cap);for(mrb_int i=0;i<h->cap;i++)h->keys[i]=-1;h->vals=(mrb_int*)calloc(h->cap,sizeof(mrb_int));h->order=(sp_sym*)realloc(h->order,sizeof(sp_sym)*h->cap);h->len=0;for(mrb_int i=0;i<oc;i++){if(ok[i]>=0){mrb_int idx=(mrb_int)(((mrb_int)ok[i])&h->mask);while(h->keys[idx]>=0)idx=(idx+1)&h->mask;h->keys[idx]=ok[i];h->vals[idx]=ov[i];h->len++;}}free(ok);free(ov);}
static mrb_int sp_SymIntHash_get(sp_SymIntHash*h,sp_sym k){if(!h)return 0;mrb_int idx=(mrb_int)(((mrb_int)k)&h->mask);while(h->keys[idx]>=0){if(h->keys[idx]==k)return h->vals[idx];idx=(idx+1)&h->mask;}return 0;}
static void sp_SymIntHash_set(sp_SymIntHash*h,sp_sym k,mrb_int v){if(h->len*2>=h->cap)sp_SymIntHash_grow(h);mrb_int idx=(mrb_int)(((mrb_int)k)&h->mask);while(h->keys[idx]>=0){if(h->keys[idx]==k){h->vals[idx]=v;return;}idx=(idx+1)&h->mask;}h->keys[idx]=k;h->vals[idx]=v;h->order[h->len]=k;h->len++;}
static mrb_bool sp_SymIntHash_has_key(sp_SymIntHash*h,sp_sym k){mrb_int idx=(mrb_int)(((mrb_int)k)&h->mask);while(h->keys[idx]>=0){if(h->keys[idx]==k)return TRUE;idx=(idx+1)&h->mask;}return FALSE;}
static mrb_int sp_SymIntHash_length(sp_SymIntHash*h){return h->len;}
static void sp_SymIntHash_delete(sp_SymIntHash*h,sp_sym k){mrb_int idx=(mrb_int)(((mrb_int)k)&h->mask);while(h->keys[idx]>=0){if(h->keys[idx]==k){h->keys[idx]=-1;h->vals[idx]=0;h->len--;mrb_int j=(idx+1)&h->mask;while(h->keys[j]>=0){mrb_int nj=(mrb_int)(((mrb_int)h->keys[j])&h->mask);if((j>idx&&(nj<=idx||nj>j))||(j<idx&&nj<=idx&&nj>j)){h->keys[idx]=h->keys[j];h->vals[idx]=h->vals[j];h->keys[j]=-1;h->vals[j]=0;idx=j;}j=(j+1)&h->mask;}{mrb_int oi=0;while(oi<=h->len){if(h->order[oi]==k){while(oi<h->len){h->order[oi]=h->order[oi+1];oi++;}break;}oi++;}}return;}idx=(idx+1)&h->mask;}}
static sp_IntArray*sp_SymIntHash_keys(sp_SymIntHash*h){sp_IntArray*a=sp_IntArray_new();for(mrb_int i=0;i<h->len;i++)sp_IntArray_push(a,(mrb_int)h->order[i]);return a;}
static sp_IntArray*sp_SymIntHash_values(sp_SymIntHash*h){sp_IntArray*a=sp_IntArray_new();for(mrb_int i=0;i<h->len;i++)sp_IntArray_push(a,sp_SymIntHash_get(h,h->order[i]));return a;}
static sp_SymIntHash*sp_SymIntHash_dup(sp_SymIntHash*h){sp_SymIntHash*r=sp_SymIntHash_new();for(mrb_int i=0;i<h->len;i++)sp_SymIntHash_set(r,h->order[i],sp_SymIntHash_get(h,h->order[i]));return r;}
static sp_SymIntHash*sp_SymIntHash_merge(sp_SymIntHash*a,sp_SymIntHash*b){sp_SymIntHash*r=sp_SymIntHash_new();for(mrb_int i=0;i<a->len;i++)sp_SymIntHash_set(r,a->order[i],sp_SymIntHash_get(a,a->order[i]));if(b){for(mrb_int i=0;i<b->len;i++)sp_SymIntHash_set(r,b->order[i],sp_SymIntHash_get(b,b->order[i]));}return r;}
static mrb_bool sp_SymIntHash_eq(sp_SymIntHash*a,sp_SymIntHash*b){if(!a||!b)return a==b;if(a->len!=b->len)return FALSE;for(mrb_int i=0;i<a->len;i++){sp_sym k=a->order[i];if(!sp_SymIntHash_has_key(b,k))return FALSE;if(sp_SymIntHash_get(a,k)!=sp_SymIntHash_get(b,k))return FALSE;}return TRUE;}
static const char*sp_SymIntHash_inspect(sp_SymIntHash*h){sp_String*s=sp_String_new("{");for(mrb_int i=0;i<h->len;i++){if(i>0)sp_String_append(s,", ");sp_String_append(s,sp_sym_to_s(h->order[i]));sp_String_append(s,": ");sp_String_append(s,sp_int_to_s(sp_SymIntHash_get(h,h->order[i])));}sp_String_append(s,"}");return s->data;}
static sp_SymIntHash*sp_SymArray_tally(sp_IntArray*a){sp_SymIntHash*h=sp_SymIntHash_new();for(mrb_int i=0;i<a->len;i++){sp_sym k=(sp_sym)a->data[a->start+i];sp_SymIntHash_set(h,k,sp_SymIntHash_get(h,k)+1);}return h;}
static sp_SymPolyHash*sp_SymPolyHash_merge_int(sp_SymPolyHash*a,sp_SymIntHash*b){sp_SymPolyHash*r=sp_SymPolyHash_new();for(mrb_int i=0;i<a->len;i++)sp_SymPolyHash_set(r,a->order[i],sp_SymPolyHash_get(a,a->order[i]));for(mrb_int i=0;i<b->len;i++)sp_SymPolyHash_set(r,b->order[i],sp_box_int(sp_SymIntHash_get(b,b->order[i])));return r;}
typedef struct{sp_sym*keys;const char**vals;sp_sym*order;mrb_int len;mrb_int cap;mrb_int mask;}sp_SymStrHash;
static void sp_SymStrHash_fin(void*p){sp_SymStrHash*h=(sp_SymStrHash*)p;free(h->keys);free(h->vals);free(h->order);}
static sp_SymStrHash*sp_SymStrHash_new(void){sp_SymStrHash*h=(sp_SymStrHash*)sp_gc_alloc(sizeof(sp_SymStrHash),sp_SymStrHash_fin,NULL);h->cap=16;h->mask=15;h->keys=(sp_sym*)malloc(sizeof(sp_sym)*h->cap);for(mrb_int i=0;i<h->cap;i++)h->keys[i]=-1;h->vals=(const char**)calloc(h->cap,sizeof(const char*));h->order=(sp_sym*)malloc(sizeof(sp_sym)*h->cap);h->len=0;return h;}
static void sp_SymStrHash_grow(sp_SymStrHash*h){mrb_int oc=h->cap;sp_sym*ok=h->keys;const char**ov=h->vals;h->cap*=2;h->mask=h->cap-1;h->keys=(sp_sym*)malloc(sizeof(sp_sym)*h->cap);for(mrb_int i=0;i<h->cap;i++)h->keys[i]=-1;h->vals=(const char**)calloc(h->cap,sizeof(const char*));h->order=(sp_sym*)realloc(h->order,sizeof(sp_sym)*h->cap);h->len=0;for(mrb_int i=0;i<oc;i++){if(ok[i]>=0){mrb_int idx=(mrb_int)(((mrb_int)ok[i])&h->mask);while(h->keys[idx]>=0)idx=(idx+1)&h->mask;h->keys[idx]=ok[i];h->vals[idx]=ov[i];h->len++;}}free(ok);free(ov);}
static const char*sp_SymStrHash_get(sp_SymStrHash*h,sp_sym k){if(!h)return sp_str_empty;mrb_int idx=(mrb_int)(((mrb_int)k)&h->mask);while(h->keys[idx]>=0){if(h->keys[idx]==k)return h->vals[idx];idx=(idx+1)&h->mask;}return sp_str_empty;}
static void sp_SymStrHash_set(sp_SymStrHash*h,sp_sym k,const char*v){if(h->len*2>=h->cap)sp_SymStrHash_grow(h);mrb_int idx=(mrb_int)(((mrb_int)k)&h->mask);while(h->keys[idx]>=0){if(h->keys[idx]==k){h->vals[idx]=v;return;}idx=(idx+1)&h->mask;}h->keys[idx]=k;h->vals[idx]=v;h->order[h->len]=k;h->len++;}
static mrb_bool sp_SymStrHash_has_key(sp_SymStrHash*h,sp_sym k){mrb_int idx=(mrb_int)(((mrb_int)k)&h->mask);while(h->keys[idx]>=0){if(h->keys[idx]==k)return TRUE;idx=(idx+1)&h->mask;}return FALSE;}
static mrb_int sp_SymStrHash_length(sp_SymStrHash*h){return h->len;}
static void sp_SymStrHash_delete(sp_SymStrHash*h,sp_sym k){mrb_int idx=(mrb_int)(((mrb_int)k)&h->mask);while(h->keys[idx]>=0){if(h->keys[idx]==k){h->keys[idx]=-1;h->vals[idx]=NULL;h->len--;mrb_int j=(idx+1)&h->mask;while(h->keys[j]>=0){mrb_int nj=(mrb_int)(((mrb_int)h->keys[j])&h->mask);if((j>idx&&(nj<=idx||nj>j))||(j<idx&&nj<=idx&&nj>j)){h->keys[idx]=h->keys[j];h->vals[idx]=h->vals[j];h->keys[j]=-1;h->vals[j]=NULL;idx=j;}j=(j+1)&h->mask;}{mrb_int oi=0;while(oi<=h->len){if(h->order[oi]==k){while(oi<h->len){h->order[oi]=h->order[oi+1];oi++;}break;}oi++;}}return;}idx=(idx+1)&h->mask;}}
static sp_IntArray*sp_SymStrHash_keys(sp_SymStrHash*h){sp_IntArray*a=sp_IntArray_new();for(mrb_int i=0;i<h->len;i++)sp_IntArray_push(a,(mrb_int)h->order[i]);return a;}
static sp_StrArray*sp_SymStrHash_values(sp_SymStrHash*h){sp_StrArray*a=sp_StrArray_new();for(mrb_int i=0;i<h->len;i++)sp_StrArray_push(a,sp_SymStrHash_get(h,h->order[i]));return a;}
static sp_SymStrHash*sp_SymStrHash_dup(sp_SymStrHash*h){sp_SymStrHash*r=sp_SymStrHash_new();for(mrb_int i=0;i<h->len;i++)sp_SymStrHash_set(r,h->order[i],sp_SymStrHash_get(h,h->order[i]));return r;}
static sp_SymStrHash*sp_SymStrHash_merge(sp_SymStrHash*a,sp_SymStrHash*b){sp_SymStrHash*r=sp_SymStrHash_new();for(mrb_int i=0;i<a->len;i++)sp_SymStrHash_set(r,a->order[i],sp_SymStrHash_get(a,a->order[i]));for(mrb_int i=0;i<b->len;i++)sp_SymStrHash_set(r,b->order[i],sp_SymStrHash_get(b,b->order[i]));return r;}
static mrb_bool sp_SymStrHash_eq(sp_SymStrHash*a,sp_SymStrHash*b){if(!a||!b)return a==b;if(a->len!=b->len)return FALSE;for(mrb_int i=0;i<a->len;i++){sp_sym k=a->order[i];if(!sp_SymStrHash_has_key(b,k))return FALSE;if(!sp_str_eq(sp_SymStrHash_get(a,k),sp_SymStrHash_get(b,k)))return FALSE;}return TRUE;}
static sp_SymPolyHash*sp_SymStrHash_to_sym_poly(sp_SymStrHash*h){sp_SymPolyHash*r=sp_SymPolyHash_new();for(mrb_int i=0;i<h->len;i++)sp_SymPolyHash_set(r,h->order[i],sp_box_str(sp_SymStrHash_get(h,h->order[i])));return r;}
static sp_SymPolyHash*sp_SymPolyHash_merge_str(sp_SymPolyHash*a,sp_SymStrHash*b){sp_SymPolyHash*r=sp_SymPolyHash_new();for(mrb_int i=0;i<a->len;i++)sp_SymPolyHash_set(r,a->order[i],sp_SymPolyHash_get(a,a->order[i]));for(mrb_int i=0;i<b->len;i++)sp_SymPolyHash_set(r,b->order[i],sp_box_str(sp_SymStrHash_get(b,b->order[i])));return r;}
/* ---- FFI externs ---- */
#include <stdint.h>
#include <stddef.h>
/* SPINEL_LINK: -lsqlite3 */
extern int sqlite3_open(const char *, void *);
extern int sqlite3_close(void *);
extern int sqlite3_exec(void *, const char *, void *, void *, void *);
extern int sqlite3_prepare_v2(void *, const char *, int, void *, void *);
extern int sqlite3_step(void *);
extern int sqlite3_finalize(void *);
extern int sqlite3_column_int(void *, int);
extern const char * sqlite3_column_text(void *, int);
extern int sqlite3_column_count(void *);
extern const char * sqlite3_column_name(void *, int);
extern const char * sqlite3_errmsg(void *);
extern long sqlite3_last_insert_rowid(void *);
extern int sqlite3_changes(void *);
static char sp_ffi_buf_SQL_db_out[8];
static char sp_ffi_buf_SQL_stmt_out[8];
static mrb_regexp_pattern *sp_re_pat_0;
static mrb_regexp_pattern *sp_re_pat_1;
static mrb_regexp_pattern *sp_re_pat_2;
static void sp_re_init(void) {
sp_re_pat_0 = re_compile("[&<>\"']", 7, 0);
sp_re_pat_1 = re_compile("[\\\\\"\\n\\r\\t\\b\\f]", 15, 0);
sp_re_pat_2 = re_compile("\\A[a-z]+", 8, 0);
}
static mrb_regexp_pattern *sp_re_dyn_0(const char *new_pat) {
static char *cached_str = NULL;
static mrb_regexp_pattern *cached_pat = NULL;
if (cached_str != NULL && strcmp(cached_str, new_pat) == 0) return cached_pat;
re_free(cached_pat);
free(cached_str);
cached_str = strdup(new_pat);
cached_pat = re_compile(new_pat, (int64_t)strlen(new_pat), 0);
return cached_pat;
}
/* sp_Class names table */
#define SP_CLASS_COUNT 96
static const char *const sp_class_names[96] = {(&("\xff" "BasicObject")[1]),(&("\xff" "Object")[1]),(&("\xff" "Kernel")[1]),(&("\xff" "Comparable")[1]),(&("\xff" "Enumerable")[1]),(&("\xff" "NilClass")[1]),(&("\xff" "TrueClass")[1]),(&("\xff" "FalseClass")[1]),(&("\xff" "Numeric")[1]),(&("\xff" "Integer")[1]),(&("\xff" "Float")[1]),(&("\xff" "String")[1]),(&("\xff" "Symbol")[1]),(&("\xff" "Array")[1]),(&("\xff" "Hash")[1]),(&("\xff" "Range")[1]),(&("\xff" "Time")[1]),(&("\xff" "Module")[1]),(&("\xff" "Class")[1]),(&("\xff" "Complex")[1]),(&("\xff" "Proc")[1]),(&("\xff" "ActiveRecord_RecordNotFound")[1]),(&("\xff" "ActiveRecord_RecordInvalid")[1]),(&("\xff" "ActiveRecord_Base")[1]),(&("\xff" "ActionDispatch_Router_Route")[1]),(&("\xff" "ActionDispatch_Router_MatchResult")[1]),(&("\xff" "ActionDispatch_Flash")[1]),(&("\xff" "ActionDispatch_Session")[1]),(&("\xff" "ActionView_ViewHelpers_FormBuilder")[1]),(&("\xff" "ActionController_Base")[1]),(&("\xff" "Broadcasts_SeedTransport")[1]),(&("\xff" "ActionDispatch_IntegrationTest")[1]),(&("\xff" "ApplicationController")[1]),(&("\xff" "ApplicationRecord")[1]),(&("\xff" "CommentRow")[1]),(&("\xff" "Comment")[1]),(&("\xff" "ArticleRow")[1]),(&("\xff" "Article")[1]),(&("\xff" "ArticleParams")[1]),(&("\xff" "ArticlesController")[1]),(&("\xff" "CommentParams")[1]),(&("\xff" "CommentsController")[1]),(&("\xff" "ActionResponse")[1]),(&("\xff" "TestBase")[1]),(&("\xff" "ArticlesControllerTest")[1]),(&("\xff" "Method")[1]),(&("\xff" "Base64")[1]),(&("\xff" "JSON")[1]),(&("\xff" "SQL")[1]),(&("\xff" "Db")[1]),(&("\xff" "ActiveRecord")[1]),(&("\xff" "ActiveRecord")[1]),(&("\xff" "Schema")[1]),(&("\xff" "ActionDispatch")[1]),(&("\xff" "ActionDispatch_Router")[1]),(&("\xff" "ActionDispatch")[1]),(&("\xff" "ActionDispatch")[1]),(&("\xff" "ActionView")[1]),(&("\xff" "ActionView_ViewHelpers")[1]),(&("\xff" "ActionController")[1]),(&("\xff" "JsonBuilder")[1]),(&("\xff" "Broadcasts")[1]),(&("\xff" "Importmap")[1]),(&("\xff" "Importmap")[1]),(&("\xff" "RouteHelpers")[1]),(&("\xff" "Views")[1]),(&("\xff" "Views_Comments")[1]),(&("\xff" "Inflector")[1]),(&("\xff" "Views")[1]),(&("\xff" "Views_Articles")[1]),(&("\xff" "Views")[1]),(&("\xff" "Views_Articles")[1]),(&("\xff" "Views")[1]),(&("\xff" "Views_Articles")[1]),(&("\xff" "Views")[1]),(&("\xff" "Views_Articles")[1]),(&("\xff" "Views")[1]),(&("\xff" "Views_Articles")[1]),(&("\xff" "Views")[1]),(&("\xff" "Views_Articles")[1]),(&("\xff" "Views")[1]),(&("\xff" "Views_Layouts")[1]),(&("\xff" "Views")[1]),(&("\xff" "Views_Articles")[1]),(&("\xff" "Views")[1]),(&("\xff" "Views_Articles")[1]),(&("\xff" "Views")[1]),(&("\xff" "Views_Articles")[1]),(&("\xff" "Routes")[1]),(&("\xff" "SchemaSetup")[1]),(&("\xff" "FixtureLoader")[1]),(&("\xff" "RequestDispatch")[1]),(&("\xff" "ActionDispatch")[1]),(&("\xff" "RequestDispatch")[1]),(&("\xff" "ArticlesFixtures")[1]),(&("\xff" "CommentsFixtures")[1])};
static const char *sp_class_to_s(sp_Class c) __attribute__((unused));
static const char *sp_class_to_s(sp_Class c){if(c.cls_id>=0&&c.cls_id<SP_CLASS_COUNT)return sp_class_names[c.cls_id];return "";}
static mrb_bool sp_class_eq(sp_Class a, sp_Class b) __attribute__((unused));
static mrb_bool sp_class_eq(sp_Class a, sp_Class b){return a.cls_id == b.cls_id;}
static const mrb_int sp_class_ancestors_off[97] __attribute__((unused)) = {0LL,1LL,4LL,5LL,6LL,7LL,11LL,15LL,19LL,24LL,30LL,36LL,41LL,46LL,51LL,56LL,61LL,66LL,70LL,75LL,81LL,85LL,86LL,87LL,88LL,89LL,90LL,91LL,92LL,93LL,94LL,95LL,98LL,100LL,102LL,103LL,106LL,107LL,110LL,111LL,114LL,115LL,118LL,119LL,120LL,124LL,125LL,126LL,127LL,128LL,129LL,130LL,131LL,132LL,133LL,134LL,135LL,136LL,137LL,138LL,139LL,140LL,141LL,142LL,143LL,144LL,145LL,146LL,147LL,148LL,149LL,150LL,151LL,152LL,153LL,154LL,155LL,156LL,157LL,158LL,159LL,160LL,161LL,162LL,163LL,164LL,165LL,166LL,167LL,168LL,169LL,170LL,171LL,172LL,173LL,174LL,175LL};
static const mrb_int sp_class_ancestors_flat[175] __attribute__((unused)) = {0LL,1LL,2LL,0LL,2LL,3LL,4LL,5LL,1LL,2LL,0LL,6LL,1LL,2LL,0LL,7LL,1LL,2LL,0LL,8LL,3LL,1LL,2LL,0LL,9LL,8LL,3LL,1LL,2LL,0LL,10LL,8LL,3LL,1LL,2LL,0LL,11LL,3LL,1LL,2LL,0LL,12LL,3LL,1LL,2LL,0LL,13LL,4LL,1LL,2LL,0LL,14LL,4LL,1LL,2LL,0LL,15LL,4LL,1LL,2LL,0LL,16LL,3LL,1LL,2LL,0LL,17LL,1LL,2LL,0LL,18LL,17LL,1LL,2LL,0LL,19LL,8LL,3LL,1LL,2LL,0LL,20LL,1LL,2LL,0LL,21LL,22LL,23LL,24LL,25LL,26LL,27LL,28LL,29LL,30LL,31LL,91LL,43LL,32LL,29LL,33LL,23LL,34LL,35LL,33LL,23LL,36LL,37LL,33LL,23LL,38LL,39LL,32LL,29LL,40LL,41LL,32LL,29LL,42LL,43LL,44LL,31LL,91LL,43LL,45LL,46LL,47LL,48LL,49LL,50LL,51LL,52LL,53LL,54LL,55LL,56LL,57LL,58LL,59LL,60LL,61LL,62LL,63LL,64LL,65LL,66LL,67LL,68LL,69LL,70LL,71LL,72LL,73LL,74LL,75LL,76LL,77LL,78LL,79LL,80LL,81LL,82LL,83LL,84LL,85LL,86LL,87LL,88LL,89LL,90LL,91LL,92LL,93LL,94LL,95LL};
static mrb_bool sp_class_le(sp_Class child, sp_Class anc) __attribute__((unused));
static mrb_bool sp_class_le(sp_Class child, sp_Class anc){if(child.cls_id<0||child.cls_id>=SP_CLASS_COUNT)return FALSE;mrb_int s=sp_class_ancestors_off[child.cls_id];mrb_int e=sp_class_ancestors_off[child.cls_id+1];for(mrb_int k=s;k<e;k++){if(sp_class_ancestors_flat[k]==anc.cls_id)return TRUE;}return FALSE;}
static mrb_bool sp_class_lt(sp_Class child, sp_Class anc) __attribute__((unused));
static mrb_bool sp_class_lt(sp_Class child, sp_Class anc){if(child.cls_id==anc.cls_id)return FALSE;return sp_class_le(child,anc);}
static sp_PolyArray *sp_class_ancestors_arr(sp_Class c) __attribute__((unused));
static sp_PolyArray *sp_class_ancestors_arr(sp_Class c){sp_PolyArray*r=sp_PolyArray_new();if(c.cls_id<0||c.cls_id>=SP_CLASS_COUNT)return r;mrb_int s=sp_class_ancestors_off[c.cls_id];mrb_int e=sp_class_ancestors_off[c.cls_id+1];for(mrb_int k=s;k<e;k++){sp_Class el={sp_class_ancestors_flat[k]};sp_PolyArray_push(r,sp_box_class(el));}return r;}
static sp_Class sp_class_for_poly(sp_RbVal v) __attribute__((unused));
static sp_Class sp_class_for_poly(sp_RbVal v){switch(v.tag){case SP_TAG_NIL:return (sp_Class){5};case SP_TAG_BOOL:return (sp_Class){v.v.b?6:7};case SP_TAG_INT:return (sp_Class){9};case SP_TAG_FLT:return (sp_Class){10};case SP_TAG_STR:return (sp_Class){11};case SP_TAG_SYM:return (sp_Class){12};case SP_TAG_CLASS:return (sp_Class){(mrb_int)v.cls_id};case SP_TAG_OBJ:if(v.cls_id>=0)return (sp_Class){(mrb_int)v.cls_id};switch(v.cls_id){case SP_BUILTIN_INT_ARRAY:case SP_BUILTIN_STR_ARRAY:case SP_BUILTIN_FLT_ARRAY:case SP_BUILTIN_SYM_ARRAY:case SP_BUILTIN_PTR_ARRAY:case SP_BUILTIN_POLY_ARRAY:return (sp_Class){13};case SP_BUILTIN_STR_INT_HASH:case SP_BUILTIN_STR_STR_HASH:case SP_BUILTIN_INT_STR_HASH:case SP_BUILTIN_SYM_INT_HASH:case SP_BUILTIN_SYM_STR_HASH:case SP_BUILTIN_STR_POLY_HASH:case SP_BUILTIN_SYM_POLY_HASH:case SP_BUILTIN_POLY_POLY_HASH:return (sp_Class){14};case SP_BUILTIN_RANGE:return (sp_Class){15};case SP_BUILTIN_TIME:return (sp_Class){16};case SP_BUILTIN_PROC:return (sp_Class){20};default:return (sp_Class){-1};}}return (sp_Class){-1};}
typedef struct sp_ActiveRecord_RecordNotFound_s sp_ActiveRecord_RecordNotFound;
typedef struct sp_ActiveRecord_RecordInvalid_s sp_ActiveRecord_RecordInvalid;
typedef struct sp_ActiveRecord_Base_s sp_ActiveRecord_Base;
typedef struct sp_ActionDispatch_Router_Route_s sp_ActionDispatch_Router_Route;
typedef struct sp_ActionDispatch_Router_MatchResult_s sp_ActionDispatch_Router_MatchResult;
typedef struct sp_ActionDispatch_Flash_s sp_ActionDispatch_Flash;
typedef struct sp_ActionDispatch_Session_s sp_ActionDispatch_Session;
typedef struct sp_ActionView_ViewHelpers_FormBuilder_s sp_ActionView_ViewHelpers_FormBuilder;
typedef struct sp_ActionController_Base_s sp_ActionController_Base;
typedef struct sp_Broadcasts_SeedTransport_s sp_Broadcasts_SeedTransport;
typedef struct sp_ActionDispatch_IntegrationTest_s sp_ActionDispatch_IntegrationTest;
typedef struct sp_ApplicationController_s sp_ApplicationController;
typedef struct sp_ApplicationRecord_s sp_ApplicationRecord;
typedef struct sp_CommentRow_s sp_CommentRow;
typedef struct sp_Comment_s sp_Comment;
typedef struct sp_ArticleRow_s sp_ArticleRow;
typedef struct sp_Article_s sp_Article;
typedef struct sp_ArticleParams_s sp_ArticleParams;
typedef struct sp_ArticlesController_s sp_ArticlesController;
typedef struct sp_CommentParams_s sp_CommentParams;
typedef struct sp_CommentsController_s sp_CommentsController;
typedef struct sp_ActionResponse_s sp_ActionResponse;
typedef struct sp_TestBase_s sp_TestBase;
typedef struct sp_ArticlesControllerTest_s sp_ArticlesControllerTest;
typedef struct sp_Method_s sp_Method;
struct sp_ActiveRecord_RecordNotFound_s {
mrb_int cls_id;
};
struct sp_ActiveRecord_RecordInvalid_s {
mrb_int cls_id;
sp_ActiveRecord_Base * iv_record;
};
struct sp_ActiveRecord_Base_s {
mrb_int cls_id;
sp_RbVal iv_id;
sp_StrArray * iv_errors;
mrb_bool iv_persisted;
mrb_bool iv_destroyed;
};
struct sp_ActionDispatch_Router_Route_s {
mrb_int cls_id;
const char * iv_verb;
const char * iv_pattern;
sp_sym iv_controller;
sp_sym iv_action;
};
struct sp_ActionDispatch_Router_MatchResult_s {
mrb_int cls_id;
sp_sym iv_controller;
sp_sym iv_action;
sp_StrStrHash * iv_path_params;
};
struct sp_ActionDispatch_Flash_s {
mrb_int cls_id;
sp_RbVal iv_notice;
sp_RbVal iv_alert;
};
struct sp_ActionDispatch_Session_s {
mrb_int cls_id;
sp_StrIntHash * iv_data;
};
struct sp_ActionView_ViewHelpers_FormBuilder_s {
mrb_int cls_id;
sp_RbVal iv_model;
const char * iv_model_name;
const char * iv_action;
sp_sym iv_method;
};
struct sp_ActionController_Base_s {
mrb_int cls_id;
sp_StrIntHash * iv_params;
sp_ActionDispatch_Session * iv_session;
sp_ActionDispatch_Flash * iv_flash;
mrb_int iv_status;
sp_RbVal iv_body;
const char * iv_location;
sp_sym iv_request_format;
const char * iv_content_type;
mrb_int iv_request_method;
mrb_int iv_request_path;
};
struct sp_Broadcasts_SeedTransport_s {
mrb_int cls_id;
};
struct sp_ActionDispatch_IntegrationTest_s {
mrb_int cls_id;
};
struct sp_ApplicationController_s {
mrb_int cls_id;
sp_StrIntHash * iv_params;
sp_ActionDispatch_Session * iv_session;
sp_ActionDispatch_Flash * iv_flash;
mrb_int iv_status;
sp_RbVal iv_body;
const char * iv_location;
sp_sym iv_request_format;
const char * iv_content_type;
mrb_int iv_request_method;
mrb_int iv_request_path;
};
struct sp_ApplicationRecord_s {
mrb_int cls_id;
sp_RbVal iv_id;
sp_StrArray * iv_errors;
mrb_bool iv_persisted;
mrb_bool iv_destroyed;
};
struct sp_CommentRow_s {
mrb_int cls_id;
sp_RbVal iv_id;
sp_RbVal iv_article_id;
sp_RbVal iv_body;
const char * iv_commenter;
const char * iv_created_at;
const char * iv_updated_at;
};
struct sp_Comment_s {
mrb_int cls_id;
sp_RbVal iv_id;
sp_StrArray * iv_errors;
mrb_bool iv_persisted;
mrb_bool iv_destroyed;
sp_RbVal iv_article_id;
sp_RbVal iv_body;
sp_RbVal iv_commenter;
sp_RbVal iv_created_at;
sp_RbVal iv_updated_at;
};
struct sp_ArticleRow_s {
mrb_int cls_id;
sp_RbVal iv_id;
sp_RbVal iv_body;
const char * iv_created_at;
const char * iv_title;
const char * iv_updated_at;
};
struct sp_Article_s {
mrb_int cls_id;
sp_RbVal iv_id;
sp_StrArray * iv_errors;
mrb_bool iv_persisted;
mrb_bool iv_destroyed;
sp_RbVal iv_body;
sp_RbVal iv_created_at;
sp_RbVal iv_title;
sp_RbVal iv_updated_at;
};
struct sp_ArticleParams_s {
mrb_int cls_id;
sp_RbVal iv_title;
sp_RbVal iv_body;
};
struct sp_ArticlesController_s {
mrb_int cls_id;
sp_StrIntHash * iv_params;
sp_ActionDispatch_Session * iv_session;
sp_ActionDispatch_Flash * iv_flash;
mrb_int iv_status;
sp_RbVal iv_body;
const char * iv_location;
sp_sym iv_request_format;
const char * iv_content_type;
mrb_int iv_request_method;
mrb_int iv_request_path;
sp_PtrArray * iv_articles;
sp_Article * iv_article;
};
struct sp_CommentParams_s {
mrb_int cls_id;
sp_RbVal iv_commenter;
sp_RbVal iv_body;
};
struct sp_CommentsController_s {
mrb_int cls_id;
sp_StrIntHash * iv_params;
sp_ActionDispatch_Session * iv_session;
sp_ActionDispatch_Flash * iv_flash;
mrb_int iv_status;
sp_RbVal iv_body;
const char * iv_location;
sp_sym iv_request_format;
const char * iv_content_type;
mrb_int iv_request_method;
mrb_int iv_request_path;
sp_Article * iv_article;
sp_Comment * iv_comment;
};
struct sp_ActionResponse_s {
mrb_int cls_id;
mrb_int iv_status;
sp_RbVal iv_body;
sp_RbVal iv_location;
sp_ActionDispatch_Flash * iv_flash;
};
struct sp_TestBase_s {
mrb_int cls_id;
};
struct sp_ArticlesControllerTest_s {
mrb_int cls_id;
sp_Article * iv_article;
};
struct sp_Method_s {
mrb_int cls_id;
sp_Method * iv_self_obj;
mrb_int iv_fn_ptr;
};
static void sp_ActiveRecord_RecordInvalid_gc_scan(void *p) {
sp_ActiveRecord_RecordInvalid *self = (sp_ActiveRecord_RecordInvalid *)p;
if (self->iv_record) sp_gc_mark((void *)self->iv_record);
}
static void sp_ActiveRecord_Base_gc_scan(void *p) {
sp_ActiveRecord_Base *self = (sp_ActiveRecord_Base *)p;
sp_mark_rbval(self->iv_id);
if (self->iv_errors) sp_gc_mark((void *)self->iv_errors);
}
static void sp_ActionDispatch_Router_Route_gc_scan(void *p) {
sp_ActionDispatch_Router_Route *self = (sp_ActionDispatch_Router_Route *)p;
if (self->iv_verb) sp_gc_mark((void *)self->iv_verb);
if (self->iv_pattern) sp_gc_mark((void *)self->iv_pattern);
}
static void sp_ActionDispatch_Router_MatchResult_gc_scan(void *p) {
sp_ActionDispatch_Router_MatchResult *self = (sp_ActionDispatch_Router_MatchResult *)p;
if (self->iv_path_params) sp_gc_mark((void *)self->iv_path_params);
}
static void sp_ActionDispatch_Flash_gc_scan(void *p) {
sp_ActionDispatch_Flash *self = (sp_ActionDispatch_Flash *)p;
sp_mark_rbval(self->iv_notice);
sp_mark_rbval(self->iv_alert);
}
static void sp_ActionDispatch_Session_gc_scan(void *p) {
sp_ActionDispatch_Session *self = (sp_ActionDispatch_Session *)p;
if (self->iv_data) sp_gc_mark((void *)self->iv_data);
}
static void sp_ActionView_ViewHelpers_FormBuilder_gc_scan(void *p) {
sp_ActionView_ViewHelpers_FormBuilder *self = (sp_ActionView_ViewHelpers_FormBuilder *)p;
sp_mark_rbval(self->iv_model);
if (self->iv_model_name) sp_gc_mark((void *)self->iv_model_name);
if (self->iv_action) sp_gc_mark((void *)self->iv_action);
}
static void sp_ActionController_Base_gc_scan(void *p) {
sp_ActionController_Base *self = (sp_ActionController_Base *)p;
if (self->iv_params) sp_gc_mark((void *)self->iv_params);
if (self->iv_session) sp_gc_mark((void *)self->iv_session);
if (self->iv_flash) sp_gc_mark((void *)self->iv_flash);
sp_mark_rbval(self->iv_body);
if (self->iv_location) sp_gc_mark((void *)self->iv_location);
if (self->iv_content_type) sp_gc_mark((void *)self->iv_content_type);
}
static void sp_ApplicationController_gc_scan(void *p) {
sp_ApplicationController *self = (sp_ApplicationController *)p;
if (self->iv_params) sp_gc_mark((void *)self->iv_params);
if (self->iv_session) sp_gc_mark((void *)self->iv_session);
if (self->iv_flash) sp_gc_mark((void *)self->iv_flash);
sp_mark_rbval(self->iv_body);
if (self->iv_location) sp_gc_mark((void *)self->iv_location);
if (self->iv_content_type) sp_gc_mark((void *)self->iv_content_type);
}
static void sp_ApplicationRecord_gc_scan(void *p) {
sp_ApplicationRecord *self = (sp_ApplicationRecord *)p;
sp_mark_rbval(self->iv_id);
if (self->iv_errors) sp_gc_mark((void *)self->iv_errors);
}
static void sp_CommentRow_gc_scan(void *p) {
sp_CommentRow *self = (sp_CommentRow *)p;
sp_mark_rbval(self->iv_id);
sp_mark_rbval(self->iv_article_id);
sp_mark_rbval(self->iv_body);
if (self->iv_commenter) sp_gc_mark((void *)self->iv_commenter);
if (self->iv_created_at) sp_gc_mark((void *)self->iv_created_at);
if (self->iv_updated_at) sp_gc_mark((void *)self->iv_updated_at);
}
static void sp_Comment_gc_scan(void *p) {
sp_Comment *self = (sp_Comment *)p;
sp_mark_rbval(self->iv_article_id);
sp_mark_rbval(self->iv_body);
sp_mark_rbval(self->iv_commenter);
sp_mark_rbval(self->iv_created_at);
sp_mark_rbval(self->iv_updated_at);
}
static void sp_ArticleRow_gc_scan(void *p) {
sp_ArticleRow *self = (sp_ArticleRow *)p;
sp_mark_rbval(self->iv_id);
sp_mark_rbval(self->iv_body);
if (self->iv_created_at) sp_gc_mark((void *)self->iv_created_at);
if (self->iv_title) sp_gc_mark((void *)self->iv_title);
if (self->iv_updated_at) sp_gc_mark((void *)self->iv_updated_at);
}
static void sp_Article_gc_scan(void *p) {
sp_Article *self = (sp_Article *)p;
sp_mark_rbval(self->iv_body);
sp_mark_rbval(self->iv_created_at);
sp_mark_rbval(self->iv_title);
sp_mark_rbval(self->iv_updated_at);
}
static void sp_ArticleParams_gc_scan(void *p) {
sp_ArticleParams *self = (sp_ArticleParams *)p;
sp_mark_rbval(self->iv_title);
sp_mark_rbval(self->iv_body);
}
static void sp_ArticlesController_gc_scan(void *p) {
sp_ArticlesController *self = (sp_ArticlesController *)p;
if (self->iv_articles) sp_gc_mark((void *)self->iv_articles);
if (self->iv_article) sp_gc_mark((void *)self->iv_article);
}
static void sp_CommentParams_gc_scan(void *p) {
sp_CommentParams *self = (sp_CommentParams *)p;
sp_mark_rbval(self->iv_commenter);
sp_mark_rbval(self->iv_body);
}
static void sp_CommentsController_gc_scan(void *p) {
sp_CommentsController *self = (sp_CommentsController *)p;
if (self->iv_article) sp_gc_mark((void *)self->iv_article);
if (self->iv_comment) sp_gc_mark((void *)self->iv_comment);
}
static void sp_ActionResponse_gc_scan(void *p) {
sp_ActionResponse *self = (sp_ActionResponse *)p;
sp_mark_rbval(self->iv_body);
sp_mark_rbval(self->iv_location);
if (self->iv_flash) sp_gc_mark((void *)self->iv_flash);
}
static void sp_ArticlesControllerTest_gc_scan(void *p) {
sp_ArticlesControllerTest *self = (sp_ArticlesControllerTest *)p;
if (self->iv_article) sp_gc_mark((void *)self->iv_article);
}
static void sp_Method_gc_scan(void *p) {
sp_Method *self = (sp_Method *)p;
if (self->iv_self_obj) sp_gc_mark((void *)self->iv_self_obj);
}
static const char * sp_Base64_cls_strict_encode64(const char * lv_s);
static inline const char * sp_JSON_cls_generate(const char * lv_value);
static const char * sp_JSON_cls_escape_string(const char * lv_s);
static inline mrb_int sp_Db_cls_configure(const char * lv_path);
static inline mrb_int sp_Db_cls_close(void);
static inline mrb_int sp_Db_cls_exec(const char * lv_sql);
static inline void * sp_Db_cls_prepare(const char * lv_sql);
static inline mrb_bool sp_Db_cls_step_p(void * lv_stmt);
static inline mrb_int sp_Db_cls_column_int(void * lv_stmt, mrb_int lv_i);
static inline const char * sp_Db_cls_column_text(void * lv_stmt, mrb_int lv_i);
static inline mrb_int sp_Db_cls_column_count(mrb_int lv_stmt);
static inline const char * sp_Db_cls_column_name(mrb_int lv_stmt, mrb_int lv_i);
static inline mrb_int sp_Db_cls_finalize(void * lv_stmt);
static inline mrb_int sp_Db_cls_last_insert_rowid(void);
static inline mrb_int sp_Db_cls_changes(void);
static inline const char * sp_Db_cls_escape_string(sp_RbVal lv_s);
static inline const char * sp_Db_cls_escape_int(sp_RbVal lv_n);
static inline const char * sp_Db_cls_escape_bool(mrb_int lv_b);
static inline mrb_bool sp_Db_cls_column_bool(void * lv_stmt, mrb_int lv_idx);
static inline sp_StrArray * sp_Schema_cls_statements(void);
static sp_ActionDispatch_Router_MatchResult * sp_ActionDispatch_Router_cls_match(const char * lv_method, const char * lv_path, sp_PtrArray * lv_table);
static sp_StrStrHash * sp_ActionDispatch_Router_cls_match_pattern(const char * lv_pattern, const char * lv_path);
static inline mrb_int sp_ActionView_ViewHelpers_cls_reset_slots_bang(void);
static inline mrb_int sp_ActionView_ViewHelpers_cls_content_for_set(sp_sym lv_slot, const char * lv_value);
static inline sp_RbVal sp_ActionView_ViewHelpers_cls_content_for_get(sp_sym lv_slot);
static inline sp_RbVal sp_ActionView_ViewHelpers_cls_get_slot(sp_sym lv_slot);
static inline sp_RbVal sp_ActionView_ViewHelpers_cls_get_yield(void);
static inline mrb_int sp_ActionView_ViewHelpers_cls_set_yield(mrb_int lv_content);
static inline const char * sp_ActionView_ViewHelpers_cls_html_escape(sp_RbVal lv_s);
static sp_RbVal sp_ActionView_ViewHelpers_cls_truncate(sp_RbVal lv_s, mrb_int lv_length, const char * lv_omission);
static inline const char * sp_ActionView_ViewHelpers_cls_dom_id(sp_RbVal lv_record, sp_sym lv_suffix);
static inline const char * sp_ActionView_ViewHelpers_cls_link_to(sp_RbVal lv_text, const char * lv_href, sp_SymStrHash * lv_opts);
static const char * sp_ActionView_ViewHelpers_cls_button_to(const char * lv_text, const char * lv_href, sp_SymPolyHash * lv_opts);
static inline const char * sp_ActionView_ViewHelpers_cls_csrf_meta_tags(void);
static inline const char * sp_ActionView_ViewHelpers_cls_csp_meta_tag(void);
static inline const char * sp_ActionView_ViewHelpers_cls_stylesheet_link_tag(const char * lv_name, sp_SymStrHash * lv_opts);
static const char * sp_ActionView_ViewHelpers_cls_javascript_importmap_tags(sp_PolyArray * lv_pins, const char * lv_entry);
static inline const char * sp_ActionView_ViewHelpers_cls_turbo_stream_from(const char * lv_stream);
static const char * sp_ActionView_ViewHelpers_cls_form_with(sp_RbVal lv_model, const char * lv_model_name, const char * lv_action, sp_sym lv_method, sp_SymStrHash * lv_opts);
static const char * sp_ActionView_ViewHelpers_cls_render_attrs(sp_RbVal lv_attrs);
static inline const char * sp_JsonBuilder_cls_encode_string(const char * lv_s);
static const char * sp_JsonBuilder_cls_encode_value(sp_RbVal lv_v);
static const char * sp_JsonBuilder_cls_encode_datetime(sp_RbVal lv_s);
static inline sp_PolyArray * sp_Broadcasts_cls_reset_log_bang(void);
static inline sp_PolyArray * sp_Broadcasts_cls_log(void);
static inline sp_IntArray * sp_Broadcasts_cls_set_transport(mrb_int lv_transport);
static inline mrb_int sp_Broadcasts_cls_append(const char * lv_stream, const char * lv_target, sp_String * lv_html);
static inline mrb_int sp_Broadcasts_cls_prepend(const char * lv_stream, const char * lv_target, sp_String * lv_html);
static inline mrb_int sp_Broadcasts_cls_replace(const char * lv_stream, const char * lv_target, sp_String * lv_html);
static inline mrb_int sp_Broadcasts_cls_remove(const char * lv_stream, const char * lv_target);
static mrb_int sp_Broadcasts_cls_record(sp_sym lv_action, const char * lv_stream, const char * lv_target, sp_RbVal lv_html);
static inline const char * sp_Broadcasts_cls_render_fragment(sp_sym lv_action, const char * lv_target, sp_RbVal lv_html);
static inline sp_PolyArray * sp_Importmap_cls_pins(void);
static inline const char * sp_Importmap_cls_entry(void);
static inline const char * sp_RouteHelpers_cls_root_path(void);
static inline const char * sp_RouteHelpers_cls_articles_path(void);
static inline const char * sp_RouteHelpers_cls_new_article_path(void);
static inline const char * sp_RouteHelpers_cls_article_path(sp_RbVal lv_id);
static inline const char * sp_RouteHelpers_cls_edit_article_path(sp_RbVal lv_id);
static inline const char * sp_RouteHelpers_cls_article_comments_path(sp_RbVal lv_article_id);
static inline const char * sp_RouteHelpers_cls_article_comment_path(sp_RbVal lv_article_id, sp_RbVal lv_id);
static sp_String * sp_Views_Comments_cls_comment(sp_RbVal lv_comment, sp_String * lv_notice, sp_String * lv_alert);
static inline const char * sp_Inflector_cls_pluralize(mrb_int lv_count, const char * lv_word);
static sp_String * sp_Views_Articles_cls_article(sp_Article * lv_article, sp_String * lv_notice, sp_String * lv_alert);
static inline sp_String * sp_Views_Articles_cls_form(sp_RbVal lv_article, sp_String * lv_notice, sp_String * lv_alert);
static sp_String * sp_Views_Articles_cls_index(sp_PtrArray * lv_articles, sp_RbVal lv_notice, sp_RbVal lv_alert);
static sp_String * sp_Views_Articles_cls_show(sp_Article * lv_article, sp_RbVal lv_notice, sp_RbVal lv_alert);
static sp_String * sp_Views_Articles_cls_new(sp_Article * lv_article, sp_RbVal lv_notice, sp_RbVal lv_alert);
static sp_String * sp_Views_Articles_cls_edit(sp_RbVal lv_article, sp_RbVal lv_notice, sp_RbVal lv_alert);
static sp_String * sp_Views_Layouts_cls_application(mrb_int lv_body, sp_String * lv_notice, sp_String * lv_alert);
static sp_String * sp_Views_Articles_cls_article_json(sp_RbVal lv_article);
static sp_String * sp_Views_Articles_cls_index_json(sp_PtrArray * lv_articles);
static inline sp_String * sp_Views_Articles_cls_show_json(sp_Article * lv_article);
static inline sp_PtrArray * sp_Routes_cls_table(void);
static inline sp_ActionDispatch_Router_Route * sp_Routes_cls_root(void);
static inline mrb_bool sp_SchemaSetup_cls_reset_bang(void);
static inline mrb_bool sp_FixtureLoader_cls_load_all_bang(void);
static inline sp_Article * sp_ArticlesFixtures_cls_one(void);
static inline sp_Article * sp_ArticlesFixtures_cls_two(void);
static mrb_bool sp_ArticlesFixtures_cls__fixtures_load_bang(void);
static inline sp_Comment * sp_CommentsFixtures_cls_one(void);
static inline sp_Comment * sp_CommentsFixtures_cls_two(void);
static mrb_bool sp_CommentsFixtures_cls__fixtures_load_bang(void);
static sp_ActiveRecord_RecordNotFound *sp_ActiveRecord_RecordNotFound_new(const char * lv_message);
static inline void sp_ActiveRecord_RecordNotFound_initialize(sp_ActiveRecord_RecordNotFound *self, const char * lv_message);
static sp_ActiveRecord_RecordInvalid *sp_ActiveRecord_RecordInvalid_new(sp_ActiveRecord_Base * lv_record);
static inline void sp_ActiveRecord_RecordInvalid_initialize(sp_ActiveRecord_RecordInvalid *self, sp_ActiveRecord_Base * lv_record);
static sp_ActiveRecord_Base *sp_ActiveRecord_Base_new(sp_StrIntHash * lv__attrs);
static inline void sp_ActiveRecord_Base_initialize(sp_ActiveRecord_Base *self, sp_StrIntHash * lv__attrs);
static inline sp_StrArray * sp_ActiveRecord_Base_errors(sp_ActiveRecord_Base *self);
static inline mrb_int sp_ActiveRecord_Base__adapter_insert(sp_ActiveRecord_Base *self);
static inline mrb_int sp_ActiveRecord_Base__adapter_update(sp_ActiveRecord_Base *self);
static inline mrb_int sp_ActiveRecord_Base__adapter_delete(sp_ActiveRecord_Base *self);
static sp_RbVal sp_ActiveRecord_Base__adapter_reload(sp_ActiveRecord_Base *self);
static inline sp_RbVal sp_ActiveRecord_Base_attributes(sp_ActiveRecord_Base *self);
static inline sp_RbVal sp_ActiveRecord_Base__aref(sp_ActiveRecord_Base *self, sp_RbVal lv__name);
static inline mrb_int sp_ActiveRecord_Base__aset(sp_ActiveRecord_Base *self, sp_sym lv__name, sp_RbVal lv__value);
static inline mrb_int sp_ActiveRecord_Base_assign_from_row(sp_ActiveRecord_Base *self, mrb_int lv__row);
static inline const char * sp_ActiveRecord_Base_dom_prefix(sp_ActiveRecord_Base *self);
static inline mrb_bool sp_ActiveRecord_Base_persisted_p(sp_ActiveRecord_Base *self);
static inline mrb_bool sp_ActiveRecord_Base_new_record_p(sp_ActiveRecord_Base *self);
static inline mrb_bool sp_ActiveRecord_Base_destroyed_p(sp_ActiveRecord_Base *self);
static inline mrb_int sp_ActiveRecord_Base_mark_persisted_bang(sp_ActiveRecord_Base *self);
static mrb_bool sp_ActiveRecord_Base_save(sp_ActiveRecord_Base *self);
static inline sp_ActiveRecord_Base * sp_ActiveRecord_Base_save_bang(sp_ActiveRecord_Base *self);
static sp_ActiveRecord_Base * sp_ActiveRecord_Base_destroy(sp_ActiveRecord_Base *self);
static inline sp_ActiveRecord_Base * sp_ActiveRecord_Base_reload(sp_ActiveRecord_Base *self);
static inline mrb_int sp_ActiveRecord_Base_before_validation(sp_ActiveRecord_Base *self);
static inline mrb_int sp_ActiveRecord_Base_after_validation(sp_ActiveRecord_Base *self);
static inline mrb_int sp_ActiveRecord_Base_before_save(sp_ActiveRecord_Base *self);
static inline mrb_int sp_ActiveRecord_Base_after_save(sp_ActiveRecord_Base *self);
static inline mrb_int sp_ActiveRecord_Base_before_create(sp_ActiveRecord_Base *self);
static inline mrb_int sp_ActiveRecord_Base_after_create(sp_ActiveRecord_Base *self);
static inline mrb_int sp_ActiveRecord_Base_before_update(sp_ActiveRecord_Base *self);
static inline mrb_int sp_ActiveRecord_Base_after_update(sp_ActiveRecord_Base *self);
static inline mrb_int sp_ActiveRecord_Base_before_destroy(sp_ActiveRecord_Base *self);
static inline mrb_int sp_ActiveRecord_Base_after_destroy(sp_ActiveRecord_Base *self);
static inline mrb_int sp_ActiveRecord_Base_after_commit(sp_ActiveRecord_Base *self);
static inline mrb_int sp_ActiveRecord_Base_after_create_commit(sp_ActiveRecord_Base *self);
static inline mrb_int sp_ActiveRecord_Base_after_update_commit(sp_ActiveRecord_Base *self);
static inline mrb_int sp_ActiveRecord_Base_after_destroy_commit(sp_ActiveRecord_Base *self);
static inline mrb_int sp_ActiveRecord_Base_after_save_commit(sp_ActiveRecord_Base *self);
static inline mrb_int sp_ActiveRecord_Base_after_touch(sp_ActiveRecord_Base *self);
static inline sp_StrArray * sp_ActiveRecord_Base_validate(sp_ActiveRecord_Base *self);
static mrb_int sp_ActiveRecord_Base_fill_timestamps(sp_ActiveRecord_Base *self, mrb_bool lv_creating);
static inline mrb_bool sp_ActiveRecord_Base_valid_p(sp_ActiveRecord_Base *self);
static mrb_int sp_ActiveRecord_Base_cls_table_name(void);
static mrb_int sp_ActiveRecord_Base_cls_schema_columns(void);
static sp_ActionDispatch_Router_Route *sp_ActionDispatch_Router_Route_new(const char * lv_verb, const char * lv_pattern, sp_sym lv_controller, sp_sym lv_action);
static inline void sp_ActionDispatch_Router_Route_initialize(sp_ActionDispatch_Router_Route *self, const char * lv_verb, const char * lv_pattern, sp_sym lv_controller, sp_sym lv_action);
static sp_ActionDispatch_Router_MatchResult *sp_ActionDispatch_Router_MatchResult_new(sp_sym lv_controller, sp_sym lv_action, sp_StrStrHash * lv_path_params);
static inline void sp_ActionDispatch_Router_MatchResult_initialize(sp_ActionDispatch_Router_MatchResult *self, sp_sym lv_controller, sp_sym lv_action, sp_StrStrHash * lv_path_params);
static sp_ActionDispatch_Flash *sp_ActionDispatch_Flash_new(sp_StrStrHash * lv_other);
static inline void sp_ActionDispatch_Flash_initialize(sp_ActionDispatch_Flash *self, sp_StrStrHash * lv_other);
static sp_RbVal sp_ActionDispatch_Flash__aref(sp_ActionDispatch_Flash *self, sp_RbVal lv_key);
static inline const char * sp_ActionDispatch_Flash__aset(sp_ActionDispatch_Flash *self, sp_sym lv_key, const char * lv_value);
static inline sp_RbVal sp_ActionDispatch_Flash_fetch(sp_ActionDispatch_Flash *self, mrb_int lv_key, sp_ActionDispatch_Flash * lv_default);
static inline mrb_bool sp_ActionDispatch_Flash_key_p(sp_ActionDispatch_Flash *self, sp_RbVal lv_key);
static inline mrb_bool sp_ActionDispatch_Flash_has_key_p(sp_ActionDispatch_Flash *self, mrb_int lv_key);
static inline mrb_bool sp_ActionDispatch_Flash_include_p(sp_ActionDispatch_Flash *self, sp_RbVal lv_key);
static sp_RbVal sp_ActionDispatch_Flash_delete(sp_ActionDispatch_Flash *self, mrb_int lv_key);
static mrb_int sp_ActionDispatch_Flash_length(sp_ActionDispatch_Flash *self);
static mrb_int sp_ActionDispatch_Flash_size(sp_ActionDispatch_Flash *self);
static inline mrb_bool sp_ActionDispatch_Flash_empty_p(sp_ActionDispatch_Flash *self);
static sp_StrArray * sp_ActionDispatch_Flash_keys(sp_ActionDispatch_Flash *self);
static sp_PolyArray * sp_ActionDispatch_Flash_values(sp_ActionDispatch_Flash *self);
static sp_ActionDispatch_Flash * sp_ActionDispatch_Flash_each(sp_ActionDispatch_Flash *self, void (*_block)(const char *, sp_RbVal, void*), void *_benv);
static sp_StrPolyHash * sp_ActionDispatch_Flash_to_h(sp_ActionDispatch_Flash *self);
static sp_ActionDispatch_Flash * sp_ActionDispatch_Flash_merge(sp_ActionDispatch_Flash *self, mrb_int lv_other);
static sp_ActionDispatch_Session *sp_ActionDispatch_Session_new(sp_StrIntHash * lv_other);
static inline void sp_ActionDispatch_Session_initialize(sp_ActionDispatch_Session *self, sp_StrIntHash * lv_other);
static mrb_int sp_ActionDispatch_Session__aref(sp_ActionDispatch_Session *self, sp_RbVal lv_key);
static mrb_int sp_ActionDispatch_Session__aset(sp_ActionDispatch_Session *self, mrb_int lv_key, mrb_int lv_value);
static inline mrb_int sp_ActionDispatch_Session_fetch(sp_ActionDispatch_Session *self, mrb_int lv_key, mrb_int lv_default);
static mrb_bool sp_ActionDispatch_Session_key_p(sp_ActionDispatch_Session *self, mrb_int lv_key);
static inline mrb_bool sp_ActionDispatch_Session_has_key_p(sp_ActionDispatch_Session *self, mrb_int lv_key);
static inline mrb_bool sp_ActionDispatch_Session_include_p(sp_ActionDispatch_Session *self, sp_RbVal lv_key);
static mrb_int sp_ActionDispatch_Session_delete(sp_ActionDispatch_Session *self, mrb_int lv_key);
static mrb_int sp_ActionDispatch_Session_length(sp_ActionDispatch_Session *self);
static inline mrb_int sp_ActionDispatch_Session_size(sp_ActionDispatch_Session *self);
static mrb_bool sp_ActionDispatch_Session_empty_p(sp_ActionDispatch_Session *self);
static sp_StrArray * sp_ActionDispatch_Session_keys(sp_ActionDispatch_Session *self);
static sp_IntArray * sp_ActionDispatch_Session_values(sp_ActionDispatch_Session *self);
static sp_ActionDispatch_Session * sp_ActionDispatch_Session_each(sp_ActionDispatch_Session *self, void (*_block)(const char *, mrb_int, void*), void *_benv);
static inline sp_StrIntHash * sp_ActionDispatch_Session_to_h(sp_ActionDispatch_Session *self);
static inline sp_ActionDispatch_Session * sp_ActionDispatch_Session_merge(sp_ActionDispatch_Session *self, mrb_int lv_other);
static sp_ActionView_ViewHelpers_FormBuilder *sp_ActionView_ViewHelpers_FormBuilder_new(sp_RbVal lv_model, const char * lv_model_name, const char * lv_action, sp_sym lv_method);
static inline void sp_ActionView_ViewHelpers_FormBuilder_initialize(sp_ActionView_ViewHelpers_FormBuilder *self, sp_RbVal lv_model, const char * lv_model_name, const char * lv_action, sp_sym lv_method);
static inline const char * sp_ActionView_ViewHelpers_FormBuilder_label(sp_ActionView_ViewHelpers_FormBuilder *self, sp_sym lv_field, sp_SymStrHash * lv_opts);
static const char * sp_ActionView_ViewHelpers_FormBuilder_text_field(sp_ActionView_ViewHelpers_FormBuilder *self, sp_sym lv_field, sp_SymStrHash * lv_opts);
static const char * sp_ActionView_ViewHelpers_FormBuilder_text_area(sp_ActionView_ViewHelpers_FormBuilder *self, sp_sym lv_field, sp_SymPolyHash * lv_opts);
static inline const char * sp_ActionView_ViewHelpers_FormBuilder_submit(sp_ActionView_ViewHelpers_FormBuilder *self, const char * lv_label, sp_SymStrHash * lv_opts);
static sp_ActionController_Base *sp_ActionController_Base_new(void);
static inline void sp_ActionController_Base_initialize(sp_ActionController_Base *self);
static inline mrb_int sp_ActionController_Base_process_action(sp_ActionController_Base *self, sp_sym lv__action_name);
static mrb_int sp_ActionController_Base_render(sp_ActionController_Base *self, sp_RbVal lv_body, sp_sym lv_status, const char * lv_content_type, const char * lv_location);
static mrb_int sp_ActionController_Base_redirect_to(sp_ActionController_Base *self, const char * lv_path, const char * lv_notice, const char * lv_alert, sp_sym lv_status);
static mrb_int sp_ActionController_Base_head(sp_ActionController_Base *self, sp_sym lv_status, const char * lv_content_type);
static inline mrb_int sp_ActionController_Base_resolve_status(sp_ActionController_Base *self, sp_sym lv_s);
static sp_Broadcasts_SeedTransport *sp_Broadcasts_SeedTransport_new(void);
static inline mrb_int sp_Broadcasts_SeedTransport_broadcast(sp_Broadcasts_SeedTransport *self, const char * lv_stream, const char * lv_fragment);
static sp_ActionDispatch_IntegrationTest *sp_ActionDispatch_IntegrationTest_new(void);
static inline mrb_int sp_ActionDispatch_IntegrationTest_get(sp_ActionDispatch_IntegrationTest *self, const char * lv_path, sp_StrIntHash * lv_params);
static inline mrb_int sp_ActionDispatch_IntegrationTest_post(sp_ActionDispatch_IntegrationTest *self, const char * lv_path, sp_SymPolyHash * lv_params);
static inline mrb_int sp_ActionDispatch_IntegrationTest_patch(sp_ActionDispatch_IntegrationTest *self, const char * lv_path, sp_SymPolyHash * lv_params);
static inline mrb_int sp_ActionDispatch_IntegrationTest_delete(sp_ActionDispatch_IntegrationTest *self, const char * lv_path, sp_StrIntHash * lv_params);
static mrb_int sp_ActionDispatch_IntegrationTest_dispatch_request(sp_ActionDispatch_IntegrationTest *self, const char * lv_method, const char * lv_path, sp_SymPolyHash * lv_params);
static sp_StrPolyHash * sp_ActionDispatch_IntegrationTest_stringify_keys(sp_ActionDispatch_IntegrationTest *self, mrb_int lv_value);
static mrb_int sp_ActionDispatch_IntegrationTest_assert_response(sp_ActionDispatch_IntegrationTest *self, sp_sym lv_expected, sp_ActionController_Base * lv_response);
static inline mrb_int sp_ActionDispatch_IntegrationTest_assert_redirected_to(sp_ActionDispatch_IntegrationTest *self, const char * lv_expected_path, sp_ActionResponse * lv_response);
static mrb_int sp_ActionDispatch_IntegrationTest_assert_select(sp_ActionDispatch_IntegrationTest *self, const char * lv_selector, sp_RbVal lv_content_or_opts, mrb_int lv_opts, sp_Proc * lv_block, void (*_block)(mrb_int, void*), void *_benv);
static sp_ApplicationController *sp_ApplicationController_new(void);
static sp_ApplicationRecord *sp_ApplicationRecord_new(sp_StrIntHash * lv__attrs);
static mrb_int sp_ApplicationRecord_cls_table_name(void);
static mrb_int sp_ApplicationRecord_cls_schema_columns(void);
static sp_CommentRow *sp_CommentRow_new(void);
static inline sp_RbVal sp_CommentRow_id(sp_CommentRow *self);
static inline mrb_int sp_CommentRow_id_eq(sp_CommentRow *self, sp_RbVal lv_value);
static inline sp_RbVal sp_CommentRow_article_id(sp_CommentRow *self);
static inline mrb_int sp_CommentRow_article_id_eq(sp_CommentRow *self, sp_RbVal lv_value);
static inline sp_RbVal sp_CommentRow_body(sp_CommentRow *self);
static inline mrb_int sp_CommentRow_body_eq(sp_CommentRow *self, sp_RbVal lv_value);
static inline const char * sp_CommentRow_commenter(sp_CommentRow *self);
static inline mrb_int sp_CommentRow_commenter_eq(sp_CommentRow *self, const char * lv_value);
static inline const char * sp_CommentRow_created_at(sp_CommentRow *self);
static inline mrb_int sp_CommentRow_created_at_eq(sp_CommentRow *self, const char * lv_value);
static inline const char * sp_CommentRow_updated_at(sp_CommentRow *self);
static inline mrb_int sp_CommentRow_updated_at_eq(sp_CommentRow *self, const char * lv_value);
static sp_CommentRow * sp_CommentRow_cls_from_raw(mrb_int lv_row);
static sp_Comment *sp_Comment_new(sp_StrIntHash * lv_attrs);
static inline void sp_Comment_initialize(sp_Comment *self, sp_StrIntHash * lv_attrs);
static inline sp_RbVal sp_Comment_id(sp_Comment *self);
static inline mrb_int sp_Comment_id_eq(sp_Comment *self, sp_RbVal lv_value);
static inline sp_RbVal sp_Comment_article_id(sp_Comment *self);
static inline mrb_int sp_Comment_article_id_eq(sp_Comment *self, sp_RbVal lv_value);
static inline sp_RbVal sp_Comment_body(sp_Comment *self);
static inline mrb_int sp_Comment_body_eq(sp_Comment *self, sp_RbVal lv_value);
static inline sp_RbVal sp_Comment_commenter(sp_Comment *self);
static inline mrb_int sp_Comment_commenter_eq(sp_Comment *self, sp_RbVal lv_value);
static inline sp_RbVal sp_Comment_created_at(sp_Comment *self);
static inline mrb_int sp_Comment_created_at_eq(sp_Comment *self, sp_RbVal lv_value);
static inline sp_RbVal sp_Comment_updated_at(sp_Comment *self);
static inline mrb_int sp_Comment_updated_at_eq(sp_Comment *self, sp_RbVal lv_value);
static mrb_int sp_Comment_assign_from_row(sp_Comment *self, sp_StrPolyHash * lv_row);
static inline sp_RbVal sp_Comment_attributes(sp_Comment *self);
static inline sp_RbVal sp_Comment__aref(sp_Comment *self, sp_RbVal lv_name);
static inline mrb_int sp_Comment__aset(sp_Comment *self, sp_sym lv_name, sp_RbVal lv_value);
static inline mrb_bool sp_Comment_update(sp_Comment *self, sp_CommentRow * lv_p);
static inline mrb_int sp_Comment__adapter_insert(sp_Comment *self);
static inline mrb_int sp_Comment__adapter_update(sp_Comment *self);
static inline mrb_int sp_Comment__adapter_delete(sp_Comment *self);
static sp_RbVal sp_Comment__adapter_reload(sp_Comment *self);
static inline sp_StrArray * sp_Comment_validate(sp_Comment *self);
static inline sp_Article * sp_Comment_article(sp_Comment *self);
static inline const char * sp_Comment_dom_prefix(sp_Comment *self);
static mrb_int sp_Comment_after_create_commit(sp_Comment *self);
static inline mrb_int sp_Comment_after_update_commit(sp_Comment *self);
static mrb_int sp_Comment_after_destroy_commit(sp_Comment *self);
static const char * sp_Comment_cls_table_name(void);
static sp_IntArray * sp_Comment_cls_schema_columns(void);
static sp_Comment * sp_Comment_cls_from_row(sp_CommentRow * lv_row);
static sp_Comment * sp_Comment_cls__adapter_find_by_id(mrb_int lv_id);
static mrb_int sp_Comment_cls__adapter_truncate(void);
static sp_Comment * sp_Comment_cls_from_params(sp_CommentParams * lv_p);
static sp_Comment * sp_Comment_cls_find(mrb_int lv_id);
static sp_ArticleRow *sp_ArticleRow_new(void);
static inline sp_RbVal sp_ArticleRow_id(sp_ArticleRow *self);
static inline mrb_int sp_ArticleRow_id_eq(sp_ArticleRow *self, sp_RbVal lv_value);
static inline sp_RbVal sp_ArticleRow_body(sp_ArticleRow *self);
static inline mrb_int sp_ArticleRow_body_eq(sp_ArticleRow *self, sp_RbVal lv_value);
static inline const char * sp_ArticleRow_created_at(sp_ArticleRow *self);
static inline mrb_int sp_ArticleRow_created_at_eq(sp_ArticleRow *self, const char * lv_value);
static inline const char * sp_ArticleRow_title(sp_ArticleRow *self);
static inline mrb_int sp_ArticleRow_title_eq(sp_ArticleRow *self, const char * lv_value);
static inline const char * sp_ArticleRow_updated_at(sp_ArticleRow *self);
static inline mrb_int sp_ArticleRow_updated_at_eq(sp_ArticleRow *self, const char * lv_value);
static sp_ArticleRow * sp_ArticleRow_cls_from_raw(mrb_int lv_row);
static sp_Article *sp_Article_new(sp_StrIntHash * lv_attrs);
static inline void sp_Article_initialize(sp_Article *self, sp_StrIntHash * lv_attrs);
static inline sp_RbVal sp_Article_id(sp_Article *self);
static inline mrb_int sp_Article_id_eq(sp_Article *self, sp_RbVal lv_value);
static inline sp_RbVal sp_Article_body(sp_Article *self);
static inline mrb_int sp_Article_body_eq(sp_Article *self, sp_RbVal lv_value);
static inline sp_RbVal sp_Article_created_at(sp_Article *self);
static inline mrb_int sp_Article_created_at_eq(sp_Article *self, sp_RbVal lv_value);
static inline sp_RbVal sp_Article_title(sp_Article *self);
static inline mrb_int sp_Article_title_eq(sp_Article *self, sp_RbVal lv_value);
static inline sp_RbVal sp_Article_updated_at(sp_Article *self);
static inline mrb_int sp_Article_updated_at_eq(sp_Article *self, sp_RbVal lv_value);
static mrb_int sp_Article_assign_from_row(sp_Article *self, sp_StrPolyHash * lv_row);
static inline sp_RbVal sp_Article_attributes(sp_Article *self);
static inline sp_RbVal sp_Article__aref(sp_Article *self, sp_RbVal lv_name);
static inline mrb_int sp_Article__aset(sp_Article *self, sp_sym lv_name, sp_RbVal lv_value);
static inline mrb_bool sp_Article_update(sp_Article *self, sp_RbVal lv_p);
static inline mrb_int sp_Article__adapter_insert(sp_Article *self);
static inline mrb_int sp_Article__adapter_update(sp_Article *self);
static inline mrb_int sp_Article__adapter_delete(sp_Article *self);
static sp_RbVal sp_Article__adapter_reload(sp_Article *self);
static inline sp_StrArray * sp_Article_validate(sp_Article *self);
static sp_PtrArray * sp_Article_comments(sp_Article *self);
static inline mrb_int sp_Article_before_destroy(sp_Article *self);
static inline const char * sp_Article_dom_prefix(sp_Article *self);
static inline mrb_int sp_Article_after_create_commit(sp_Article *self);
static inline mrb_int sp_Article_after_update_commit(sp_Article *self);
static inline mrb_int sp_Article_after_destroy_commit(sp_Article *self);
static const char * sp_Article_cls_table_name(void);
static sp_IntArray * sp_Article_cls_schema_columns(void);
static sp_Article * sp_Article_cls_from_row(sp_ArticleRow * lv_row);
static sp_Article * sp_Article_cls__adapter_find_by_id(mrb_int lv_id);
static sp_PtrArray * sp_Article_cls__adapter_all(void);
static mrb_int sp_Article_cls__adapter_count(void);
static mrb_bool sp_Article_cls__adapter_exists_by_id_p(sp_RbVal lv_id);
static mrb_int sp_Article_cls__adapter_truncate(void);
static sp_Article * sp_Article_cls_from_params(sp_ArticleParams * lv_p);
static sp_PtrArray * sp_Article_cls_all(void);
static sp_Article * sp_Article_cls_find(mrb_int lv_id);
static mrb_int sp_Article_cls_count(void);
static mrb_bool sp_Article_cls_exists_p(sp_RbVal lv_id);
static sp_Article * sp_Article_cls_last(void);
static sp_ArticleParams *sp_ArticleParams_new(void);
static inline sp_RbVal sp_ArticleParams_title(sp_ArticleParams *self);
static inline mrb_int sp_ArticleParams_title_eq(sp_ArticleParams *self, sp_RbVal lv_value);
static inline sp_RbVal sp_ArticleParams_body(sp_ArticleParams *self);
static inline mrb_int sp_ArticleParams_body_eq(sp_ArticleParams *self, sp_RbVal lv_value);
static inline sp_StrPolyHash * sp_ArticleParams_to_h(sp_ArticleParams *self);
static sp_ArticleParams * sp_ArticleParams_cls_from_raw(sp_StrIntHash * lv_params);
static sp_ArticlesController *sp_ArticlesController_new(void);
static inline mrb_int sp_ArticlesController_process_action(sp_ArticlesController *self, sp_sym lv_action_name);
static mrb_int sp_ArticlesController_index(sp_ArticlesController *self);
static mrb_int sp_ArticlesController_show(sp_ArticlesController *self);
static inline mrb_int sp_ArticlesController_new_action(sp_ArticlesController *self);
static mrb_int sp_ArticlesController_edit(sp_ArticlesController *self);
static inline mrb_int sp_ArticlesController_create(sp_ArticlesController *self);
static inline mrb_int sp_ArticlesController_update(sp_ArticlesController *self);
static mrb_int sp_ArticlesController_destroy(sp_ArticlesController *self);
static inline sp_ArticleParams * sp_ArticlesController_article_params(sp_ArticlesController *self);
static sp_CommentParams *sp_CommentParams_new(void);
static inline sp_RbVal sp_CommentParams_commenter(sp_CommentParams *self);
static inline mrb_int sp_CommentParams_commenter_eq(sp_CommentParams *self, sp_RbVal lv_value);
static inline sp_RbVal sp_CommentParams_body(sp_CommentParams *self);
static inline mrb_int sp_CommentParams_body_eq(sp_CommentParams *self, sp_RbVal lv_value);
static inline sp_StrPolyHash * sp_CommentParams_to_h(sp_CommentParams *self);
static sp_CommentParams * sp_CommentParams_cls_from_raw(sp_StrIntHash * lv_params);
static sp_CommentsController *sp_CommentsController_new(void);
static inline mrb_int sp_CommentsController_process_action(sp_CommentsController *self, sp_sym lv_action_name);
static mrb_int sp_CommentsController_create(sp_CommentsController *self);
static mrb_int sp_CommentsController_destroy(sp_CommentsController *self);
static inline sp_CommentParams * sp_CommentsController_comment_params(sp_CommentsController *self);
static sp_ActionResponse *sp_ActionResponse_new(mrb_int lv_status, sp_RbVal lv_body, sp_RbVal lv_location, sp_ActionDispatch_Flash * lv_flash);
static inline void sp_ActionResponse_initialize(sp_ActionResponse *self, mrb_int lv_status, sp_RbVal lv_body, sp_RbVal lv_location, sp_ActionDispatch_Flash * lv_flash);
static inline mrb_bool sp_ActionResponse_redirect_p(sp_ActionResponse *self);
static inline mrb_bool sp_ActionResponse_success_p(sp_ActionResponse *self);
static inline mrb_bool sp_ActionResponse_unprocessable_p(sp_ActionResponse *self);
static sp_TestBase *sp_TestBase_new(void);
static inline void sp_TestBase_initialize(sp_TestBase *self);
static inline mrb_bool sp_TestBase_setup(sp_TestBase *self);
static inline mrb_int sp_TestBase_teardown(sp_TestBase *self);
static inline mrb_int sp_TestBase_assert_operator(sp_TestBase *self, mrb_int lv_lhs, mrb_int lv_op, mrb_int lv_rhs, mrb_int lv_msg);
static inline mrb_int sp_TestBase_assert_match(sp_TestBase *self, mrb_int lv_pattern, mrb_int lv_value, mrb_int lv_msg);
static sp_ArticlesControllerTest *sp_ArticlesControllerTest_new(void);
static mrb_int sp_ArticlesControllerTest_test_should_get_index(sp_ArticlesControllerTest *self);
static mrb_int sp_ArticlesControllerTest_test_should_get_new(sp_ArticlesControllerTest *self);
static mrb_int sp_ArticlesControllerTest_test_should_create_article(sp_ArticlesControllerTest *self);
static mrb_int sp_ArticlesControllerTest_test_should_not_create_article_with_invalid_params(sp_ArticlesControllerTest *self);
static mrb_int sp_ArticlesControllerTest_test_should_show_article(sp_ArticlesControllerTest *self);
static mrb_int sp_ArticlesControllerTest_test_should_get_edit(sp_ArticlesControllerTest *self);
static mrb_int sp_ArticlesControllerTest_test_should_update_article(sp_ArticlesControllerTest *self);
static inline mrb_int sp_ArticlesControllerTest_test_should_not_update_article_with_invalid_params(sp_ArticlesControllerTest *self);
static mrb_int sp_ArticlesControllerTest_test_should_destroy_article(sp_ArticlesControllerTest *self);
static sp_Method *sp_Method_new(sp_Method * lv_self_obj, mrb_int lv_fn_ptr);
static inline void sp_Method_initialize(sp_Method *self, sp_Method * lv_self_obj, mrb_int lv_fn_ptr);
static const char * cst_Base64_ALPHABET = (&("\xff")[1]);
static mrb_int cst_SQL_OK = 0;
static mrb_int cst_SQL_ROW = 0;
static mrb_int cst_SQL_DONE = 0;
static void * cst_Db_db = NULL;
static sp_RbVal cst_ActiveRecord_adapter = {SP_TAG_NIL, 0, {0}};
static sp_SymPolyHash * cst_ActionView_ViewHelpers_slots = NULL;
static sp_StrStrHash * cst_ActionView_ViewHelpers_HTML_ESCAPES = NULL;
static mrb_int cst_ActionView_ViewHelpers_HTML_ESCAPE_PATTERN = 0;
static sp_SymIntHash * cst_ActionController_STATUS_CODES = NULL;
static sp_StrStrHash * cst_JsonBuilder_ESCAPES = NULL;
static mrb_int cst_JsonBuilder_ESCAPE_PATTERN = 0;
static sp_PolyArray * cst_Broadcasts_LOG = NULL;
static sp_IntArray * cst_Broadcasts_TRANSPORTS = NULL;
static sp_SymPolyHash * cst_RequestDispatch_STATUS_SYMBOLS = NULL;
SP_POOL_DEFINE(ActiveRecord_RecordNotFound)
static inline sp_ActiveRecord_RecordNotFound *sp_ActiveRecord_RecordNotFound_new(const char * lv_message) {
SP_GC_SAVE();
sp_ActiveRecord_RecordNotFound *self = SP_POOL_NEW(ActiveRecord_RecordNotFound, NULL);
self->cls_id = 21LL;
SP_GC_ROOT(self);
SP_GC_ROOT(lv_message);
SP_GC_RESTORE();
return self;
}
static inline void sp_ActiveRecord_RecordNotFound_initialize(sp_ActiveRecord_RecordNotFound *self, const char * lv_message) {
}
SP_POOL_DEFINE(ActiveRecord_RecordInvalid)
static inline sp_ActiveRecord_RecordInvalid *sp_ActiveRecord_RecordInvalid_new(sp_ActiveRecord_Base * lv_record) {
SP_GC_SAVE();
sp_ActiveRecord_RecordInvalid *self = SP_POOL_NEW(ActiveRecord_RecordInvalid, sp_ActiveRecord_RecordInvalid_gc_scan);
self->cls_id = 22LL;
SP_GC_ROOT(self);
self->iv_record = NULL;
SP_GC_ROOT(lv_record);
self->iv_record = lv_record;
SP_GC_RESTORE();
return self;
}
static inline void sp_ActiveRecord_RecordInvalid_initialize(sp_ActiveRecord_RecordInvalid *self, sp_ActiveRecord_Base * lv_record) {
self->iv_record = lv_record;
}
SP_POOL_DEFINE(ActiveRecord_Base)
static inline sp_ActiveRecord_Base *sp_ActiveRecord_Base_new(sp_StrIntHash * lv__attrs) {
SP_GC_SAVE();
sp_ActiveRecord_Base *self = SP_POOL_NEW(ActiveRecord_Base, sp_ActiveRecord_Base_gc_scan);
self->cls_id = 23LL;
SP_GC_ROOT(self);
self->iv_id = sp_box_nil();
self->iv_errors = NULL;
SP_GC_ROOT(lv__attrs);
self->iv_id = sp_box_int(0LL);
self->iv_errors = sp_StrArray_new();
self->iv_persisted = FALSE;
self->iv_destroyed = FALSE;
SP_GC_RESTORE();
return self;
}
static inline void sp_ActiveRecord_Base_initialize(sp_ActiveRecord_Base *self, sp_StrIntHash * lv__attrs) {
self->iv_id = sp_box_int(0LL);
self->iv_errors = sp_StrArray_new();
self->iv_persisted = FALSE;
self->iv_destroyed = FALSE;
}
static inline sp_StrArray * sp_ActiveRecord_Base_errors(sp_ActiveRecord_Base *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return self->iv_errors;
return NULL;
}
static inline mrb_int sp_ActiveRecord_Base__adapter_insert(sp_ActiveRecord_Base *self) {
return 0;
}
static inline mrb_int sp_ActiveRecord_Base__adapter_update(sp_ActiveRecord_Base *self) {
return 0;
}
static inline mrb_int sp_ActiveRecord_Base__adapter_delete(sp_ActiveRecord_Base *self) {
return 0;
}
static sp_RbVal sp_ActiveRecord_Base__adapter_reload(sp_ActiveRecord_Base *self) {
mrb_int lv_row = 0;
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t1 = cst_ActiveRecord_adapter;
sp_RbVal _t2 = sp_box_nil();
switch (self->cls_id) {
case 33LL: _t2 = sp_box_int(sp_ApplicationRecord_cls_table_name()); break;
case 35LL: _t2 = sp_box_str(sp_Comment_cls_table_name()); break;
case 37LL: _t2 = sp_box_str(sp_Article_cls_table_name()); break;
default: _t2 = sp_box_int(sp_ActiveRecord_Base_cls_table_name()); break;
}
mrb_int _t3 = 0;
if (_t1.tag == SP_TAG_OBJ) {
}
lv_row = _t3;
sp_ActiveRecord_Base_assign_from_row(self, lv_row);
sp_RbVal _t4 = sp_box_obj(self, 23);
SP_GC_RESTORE();
return _t4;
return sp_box_nil();
}
static inline sp_RbVal sp_ActiveRecord_Base_attributes(sp_ActiveRecord_Base *self) {
return sp_box_nil();
}
static inline sp_RbVal sp_ActiveRecord_Base__aref(sp_ActiveRecord_Base *self, sp_RbVal lv__name) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_raise_cls("NotImplementedError", (&("\xff" "[] must be overridden by subclass")[1]));
return sp_box_nil();
return sp_box_nil();
}
static inline mrb_int sp_ActiveRecord_Base__aset(sp_ActiveRecord_Base *self, sp_sym lv__name, sp_RbVal lv__value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_raise_cls("NotImplementedError", (&("\xff" "[]= must be overridden by subclass")[1]));
return 0;
return 0;
}
static inline mrb_int sp_ActiveRecord_Base_assign_from_row(sp_ActiveRecord_Base *self, mrb_int lv__row) {
return 0;
}
static inline const char * sp_ActiveRecord_Base_dom_prefix(sp_ActiveRecord_Base *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_raise_cls("NotImplementedError", (&("\xff" "dom_prefix must be overridden by subclass")[1]));
return (&("\xff")[1]);
return (&("\xff")[1]);
}
static inline mrb_bool sp_ActiveRecord_Base_persisted_p(sp_ActiveRecord_Base *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return self->iv_persisted;
return FALSE;
}
static inline mrb_bool sp_ActiveRecord_Base_new_record_p(sp_ActiveRecord_Base *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return (!self->iv_persisted);
return FALSE;
}
static inline mrb_bool sp_ActiveRecord_Base_destroyed_p(sp_ActiveRecord_Base *self) {
return FALSE;
}
static inline mrb_int sp_ActiveRecord_Base_mark_persisted_bang(sp_ActiveRecord_Base *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_persisted = TRUE;
self->iv_destroyed = FALSE;
return 0;
return 0;
}
static mrb_bool sp_ActiveRecord_Base_save(sp_ActiveRecord_Base *self) {
mrb_bool lv_ok = FALSE;
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_ActiveRecord_Base_before_validation(self);
lv_ok = sp_ActiveRecord_Base_valid_p(self);
sp_ActiveRecord_Base_after_validation(self);
if (!(lv_ok)) {
mrb_bool _t5 = FALSE;
SP_GC_RESTORE();
return _t5;
}
sp_ActiveRecord_Base_before_save(self);
if (sp_ActiveRecord_Base_new_record_p(self)) {
sp_ActiveRecord_Base_before_create(self);
sp_ActiveRecord_Base_fill_timestamps(self, TRUE);
mrb_int _t6 = 0;
switch (self->cls_id) {
case 35LL: _t6 = sp_Comment__adapter_insert((sp_Comment *)self); break;
case 37LL: _t6 = sp_Article__adapter_insert((sp_Article *)self); break;
default: _t6 = sp_ActiveRecord_Base__adapter_insert(self); break;
}
self->iv_id = sp_box_int(_t6);
self->iv_persisted = TRUE;
sp_ActiveRecord_Base_after_create(self);
mrb_int _t7 = 0;
switch (self->cls_id) {
case 35LL: _t7 = sp_Comment_after_create_commit((sp_Comment *)self); break;
case 37LL: _t7 = sp_Article_after_create_commit((sp_Article *)self); break;
default: _t7 = sp_ActiveRecord_Base_after_create_commit(self); break;
}
_t7;
} else {
sp_ActiveRecord_Base_before_update(self);
sp_ActiveRecord_Base_fill_timestamps(self, FALSE);
mrb_int _t8 = 0;
switch (self->cls_id) {
case 35LL: _t8 = sp_Comment__adapter_update((sp_Comment *)self); break;
case 37LL: _t8 = sp_Article__adapter_update((sp_Article *)self); break;
default: _t8 = sp_ActiveRecord_Base__adapter_update(self); break;
}
_t8;
sp_ActiveRecord_Base_after_update(self);
mrb_int _t9 = 0;
switch (self->cls_id) {
case 35LL: _t9 = sp_Comment_after_update_commit((sp_Comment *)self); break;
case 37LL: _t9 = sp_Article_after_update_commit((sp_Article *)self); break;
default: _t9 = sp_ActiveRecord_Base_after_update_commit(self); break;
}
_t9;
}
sp_ActiveRecord_Base_after_save(self);
sp_ActiveRecord_Base_after_save_commit(self);
sp_ActiveRecord_Base_after_commit(self);
return TRUE;
return FALSE;
}
static inline sp_ActiveRecord_Base * sp_ActiveRecord_Base_save_bang(sp_ActiveRecord_Base *self) {
return NULL;
}
static sp_ActiveRecord_Base * sp_ActiveRecord_Base_destroy(sp_ActiveRecord_Base *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
if (!(sp_ActiveRecord_Base_persisted_p(self))) {
sp_ActiveRecord_Base * _t10 = self;
SP_GC_RESTORE();
return _t10;
}
mrb_int _t11 = 0;
switch (self->cls_id) {
case 37LL: _t11 = sp_Article_before_destroy((sp_Article *)self); break;
default: _t11 = sp_ActiveRecord_Base_before_destroy(self); break;
}
_t11;
mrb_int _t12 = 0;
switch (self->cls_id) {
case 35LL: _t12 = sp_Comment__adapter_delete((sp_Comment *)self); break;
case 37LL: _t12 = sp_Article__adapter_delete((sp_Article *)self); break;
default: _t12 = sp_ActiveRecord_Base__adapter_delete(self); break;
}
_t12;
self->iv_persisted = FALSE;
self->iv_destroyed = TRUE;
sp_ActiveRecord_Base_after_destroy(self);
mrb_int _t13 = 0;
switch (self->cls_id) {
case 35LL: _t13 = sp_Comment_after_destroy_commit((sp_Comment *)self); break;
case 37LL: _t13 = sp_Article_after_destroy_commit((sp_Article *)self); break;
default: _t13 = sp_ActiveRecord_Base_after_destroy_commit(self); break;
}
_t13;
sp_ActiveRecord_Base_after_commit(self);
return self;
return NULL;
}
static inline sp_ActiveRecord_Base * sp_ActiveRecord_Base_reload(sp_ActiveRecord_Base *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t14 = sp_box_nil();
switch (self->cls_id) {
case 35LL: _t14 = sp_Comment__adapter_reload((sp_Comment *)self); break;
case 37LL: _t14 = sp_Article__adapter_reload((sp_Article *)self); break;
default: _t14 = sp_ActiveRecord_Base__adapter_reload(self); break;
}
_t14;
return self;
return NULL;
}
static inline mrb_int sp_ActiveRecord_Base_before_validation(sp_ActiveRecord_Base *self) {
return 0;
}
static inline mrb_int sp_ActiveRecord_Base_after_validation(sp_ActiveRecord_Base *self) {
return 0;
}
static inline mrb_int sp_ActiveRecord_Base_before_save(sp_ActiveRecord_Base *self) {
return 0;
}
static inline mrb_int sp_ActiveRecord_Base_after_save(sp_ActiveRecord_Base *self) {
return 0;
}
static inline mrb_int sp_ActiveRecord_Base_before_create(sp_ActiveRecord_Base *self) {
return 0;
}
static inline mrb_int sp_ActiveRecord_Base_after_create(sp_ActiveRecord_Base *self) {
return 0;
}
static inline mrb_int sp_ActiveRecord_Base_before_update(sp_ActiveRecord_Base *self) {
return 0;
}
static inline mrb_int sp_ActiveRecord_Base_after_update(sp_ActiveRecord_Base *self) {
return 0;
}
static inline mrb_int sp_ActiveRecord_Base_before_destroy(sp_ActiveRecord_Base *self) {
return 0;
}
static inline mrb_int sp_ActiveRecord_Base_after_destroy(sp_ActiveRecord_Base *self) {
return 0;
}
static inline mrb_int sp_ActiveRecord_Base_after_commit(sp_ActiveRecord_Base *self) {
return 0;
}
static inline mrb_int sp_ActiveRecord_Base_after_create_commit(sp_ActiveRecord_Base *self) {
return 0;
}
static inline mrb_int sp_ActiveRecord_Base_after_update_commit(sp_ActiveRecord_Base *self) {
return 0;
}
static inline mrb_int sp_ActiveRecord_Base_after_destroy_commit(sp_ActiveRecord_Base *self) {
return 0;
}
static inline mrb_int sp_ActiveRecord_Base_after_save_commit(sp_ActiveRecord_Base *self) {
return 0;
}
static inline mrb_int sp_ActiveRecord_Base_after_touch(sp_ActiveRecord_Base *self) {
return 0;
}
static inline sp_StrArray * sp_ActiveRecord_Base_validate(sp_ActiveRecord_Base *self) {
return NULL;
}
static mrb_int sp_ActiveRecord_Base_fill_timestamps(sp_ActiveRecord_Base *self, mrb_bool lv_creating) {
SP_GC_SAVE();
sp_RbVal lv_cols = sp_box_nil();
const char * lv_now = (&("\xff")[1]);
SP_GC_ROOT(lv_now);
SP_GC_ROOT(self);
sp_RbVal _t15 = sp_box_nil();
switch (self->cls_id) {
case 33LL: _t15 = sp_box_int(sp_ApplicationRecord_cls_schema_columns()); break;
case 35LL: _t15 = sp_box_sym_array(sp_Comment_cls_schema_columns()); break;
case 37LL: _t15 = sp_box_sym_array(sp_Article_cls_schema_columns()); break;
default: _t15 = sp_box_int(sp_ActiveRecord_Base_cls_schema_columns()); break;
}
lv_cols = _t15;
lv_now = sp_time_iso8601(sp_time_utc(sp_time_now()));
sp_RbVal _t16 = lv_cols;
mrb_bool _t17 = FALSE;
if (_t16.tag == SP_TAG_OBJ) {
if (_t16.cls_id == 26) _t17 = sp_ActionDispatch_Flash_include_p((sp_ActionDispatch_Flash *)_t16.v.p, sp_box_sym(SPS_updated_at));
if (_t16.cls_id == 27) _t17 = sp_ActionDispatch_Session_include_p((sp_ActionDispatch_Session *)_t16.v.p, sp_box_sym(SPS_updated_at));
if (_t16.cls_id == SP_BUILTIN_SYM_ARRAY) _t17 = sp_IntArray_include((sp_IntArray *)_t16.v.p, (mrb_int)(SPS_updated_at));
if (_t16.cls_id == SP_BUILTIN_SYM_INT_HASH) _t17 = sp_SymIntHash_has_key((sp_SymIntHash *)_t16.v.p, SPS_updated_at);
if (_t16.cls_id == SP_BUILTIN_SYM_STR_HASH) _t17 = sp_SymStrHash_has_key((sp_SymStrHash *)_t16.v.p, SPS_updated_at);
if (_t16.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t17 = sp_SymPolyHash_has_key((sp_SymPolyHash *)_t16.v.p, SPS_updated_at);
}
if (_t17) {
switch (self->cls_id) {
case 35LL: sp_Comment__aset((sp_Comment *)self, SPS_updated_at, sp_box_str(lv_now)); break;
case 37LL: sp_Article__aset((sp_Article *)self, SPS_updated_at, sp_box_str(lv_now)); break;
default: sp_ActiveRecord_Base__aset(self, SPS_updated_at, sp_box_str(lv_now)); break;
}
}
sp_RbVal _t18 = lv_cols;
mrb_bool _t19 = FALSE;
if (_t18.tag == SP_TAG_OBJ) {
if (_t18.cls_id == 26) _t19 = sp_ActionDispatch_Flash_include_p((sp_ActionDispatch_Flash *)_t18.v.p, sp_box_sym(SPS_created_at));
if (_t18.cls_id == 27) _t19 = sp_ActionDispatch_Session_include_p((sp_ActionDispatch_Session *)_t18.v.p, sp_box_sym(SPS_created_at));
if (_t18.cls_id == SP_BUILTIN_SYM_ARRAY) _t19 = sp_IntArray_include((sp_IntArray *)_t18.v.p, (mrb_int)(SPS_created_at));
if (_t18.cls_id == SP_BUILTIN_SYM_INT_HASH) _t19 = sp_SymIntHash_has_key((sp_SymIntHash *)_t18.v.p, SPS_created_at);
if (_t18.cls_id == SP_BUILTIN_SYM_STR_HASH) _t19 = sp_SymStrHash_has_key((sp_SymStrHash *)_t18.v.p, SPS_created_at);
if (_t18.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t19 = sp_SymPolyHash_has_key((sp_SymPolyHash *)_t18.v.p, SPS_created_at);
}
sp_RbVal _t20 = sp_box_nil();
switch (self->cls_id) {
case 35LL: _t20 = sp_Comment__aref((sp_Comment *)self, sp_box_sym(SPS_created_at)); break;
case 37LL: _t20 = sp_Article__aref((sp_Article *)self, sp_box_sym(SPS_created_at)); break;
default: _t20 = sp_ActiveRecord_Base__aref(self, sp_box_sym(SPS_created_at)); break;
}
if (((lv_creating && _t19) && sp_poly_nil_p(_t20))) {
switch (self->cls_id) {
case 35LL: sp_Comment__aset((sp_Comment *)self, SPS_created_at, sp_box_str(lv_now)); break;
case 37LL: sp_Article__aset((sp_Article *)self, SPS_created_at, sp_box_str(lv_now)); break;
default: sp_ActiveRecord_Base__aset(self, SPS_created_at, sp_box_str(lv_now)); break;
}
return 0;
} else {
return 0;
}
return 0;
}
static inline mrb_bool sp_ActiveRecord_Base_valid_p(sp_ActiveRecord_Base *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_errors = sp_StrArray_new();
sp_StrArray * _t21 = NULL;
switch (self->cls_id) {
case 35LL: _t21 = sp_Comment_validate((sp_Comment *)self); break;
case 37LL: _t21 = sp_Article_validate((sp_Article *)self); break;
default: _t21 = sp_ActiveRecord_Base_validate(self); break;
}
_t21;
return sp_StrArray_empty(self->iv_errors);
return FALSE;
}
static mrb_int sp_ActiveRecord_Base_cls_table_name(void) {
sp_raise_cls("NotImplementedError", sp_sprintf("%s.table_name must be overridden", sp_class_to_s(((sp_Class){23LL}))));
return 0;
return 0;
}
static mrb_int sp_ActiveRecord_Base_cls_schema_columns(void) {
sp_raise_cls("NotImplementedError", sp_sprintf("%s.schema_columns must be overridden", sp_class_to_s(((sp_Class){23LL}))));
return 0;
return 0;
}
SP_POOL_DEFINE(ActionDispatch_Router_Route)
static inline sp_ActionDispatch_Router_Route *sp_ActionDispatch_Router_Route_new(const char * lv_verb, const char * lv_pattern, sp_sym lv_controller, sp_sym lv_action) {
SP_GC_SAVE();
sp_ActionDispatch_Router_Route *self = SP_POOL_NEW(ActionDispatch_Router_Route, sp_ActionDispatch_Router_Route_gc_scan);
self->cls_id = 24LL;
SP_GC_ROOT(self);
self->iv_verb = NULL;
self->iv_pattern = NULL;
SP_GC_ROOT(lv_verb);
SP_GC_ROOT(lv_pattern);
self->iv_verb = lv_verb;
self->iv_pattern = lv_pattern;
self->iv_controller = lv_controller;
self->iv_action = lv_action;
SP_GC_RESTORE();
return self;
}
static inline void sp_ActionDispatch_Router_Route_initialize(sp_ActionDispatch_Router_Route *self, const char * lv_verb, const char * lv_pattern, sp_sym lv_controller, sp_sym lv_action) {
self->iv_verb = lv_verb;
self->iv_pattern = lv_pattern;
self->iv_controller = lv_controller;
self->iv_action = lv_action;
}
SP_POOL_DEFINE(ActionDispatch_Router_MatchResult)
static inline sp_ActionDispatch_Router_MatchResult *sp_ActionDispatch_Router_MatchResult_new(sp_sym lv_controller, sp_sym lv_action, sp_StrStrHash * lv_path_params) {
SP_GC_SAVE();
sp_ActionDispatch_Router_MatchResult *self = SP_POOL_NEW(ActionDispatch_Router_MatchResult, sp_ActionDispatch_Router_MatchResult_gc_scan);
self->cls_id = 25LL;
SP_GC_ROOT(self);
self->iv_path_params = NULL;
SP_GC_ROOT(lv_path_params);
self->iv_controller = lv_controller;
self->iv_action = lv_action;
self->iv_path_params = lv_path_params;
SP_GC_RESTORE();
return self;
}
static inline void sp_ActionDispatch_Router_MatchResult_initialize(sp_ActionDispatch_Router_MatchResult *self, sp_sym lv_controller, sp_sym lv_action, sp_StrStrHash * lv_path_params) {
self->iv_controller = lv_controller;
self->iv_action = lv_action;
self->iv_path_params = lv_path_params;
}
SP_POOL_DEFINE(ActionDispatch_Flash)
static inline sp_ActionDispatch_Flash *sp_ActionDispatch_Flash_new(sp_StrStrHash * lv_other) {
SP_GC_SAVE();
sp_ActionDispatch_Flash *self = SP_POOL_NEW(ActionDispatch_Flash, sp_ActionDispatch_Flash_gc_scan);
self->cls_id = 26LL;
SP_GC_ROOT(self);
self->iv_notice = sp_box_nil();
self->iv_alert = sp_box_nil();
SP_GC_ROOT(lv_other);
const char * lv_v = (&("\xff")[1]);
SP_GC_ROOT(lv_v);
self->iv_notice = ((void)(0), sp_box_nil());
self->iv_alert = ((void)(0), sp_box_nil());
if ((lv_other == NULL)) {
SP_GC_RESTORE();
return self;
}
lv_v = sp_StrStrHash_get(lv_other, (&("\xff" "notice")[1]));
if ((!(lv_v == NULL))) {
self->iv_notice = sp_box_str(lv_v);
}
lv_v = sp_StrStrHash_get(lv_other, (&("\xff" "alert")[1]));
if ((!(lv_v == NULL))) {
self->iv_alert = sp_box_str(lv_v);
}
SP_GC_RESTORE();
return self;
}
static inline void sp_ActionDispatch_Flash_initialize(sp_ActionDispatch_Flash *self, sp_StrStrHash * lv_other) {
SP_GC_SAVE();
const char * lv_v = (&("\xff")[1]);
SP_GC_ROOT(lv_v);
self->iv_notice = ((void)(0), sp_box_nil());
self->iv_alert = ((void)(0), sp_box_nil());
if ((lv_other == NULL)) {
SP_GC_RESTORE();
return;
}
lv_v = sp_StrStrHash_get(lv_other, (&("\xff" "notice")[1]));
if ((!(lv_v == NULL))) {
self->iv_notice = sp_box_str(lv_v);
}
lv_v = sp_StrStrHash_get(lv_other, (&("\xff" "alert")[1]));
if ((!(lv_v == NULL))) {
self->iv_alert = sp_box_str(lv_v);
}
}
static sp_RbVal sp_ActionDispatch_Flash__aref(sp_ActionDispatch_Flash *self, sp_RbVal lv_key) {
SP_GC_SAVE();
const char * lv_k = (&("\xff")[1]);
SP_GC_ROOT(lv_k);
SP_GC_ROOT(self);
lv_k = sp_poly_to_s(lv_key);
if (sp_str_eq(lv_k, (&("\xff" "notice")[1]))) {
sp_RbVal _t22 = self->iv_notice;
SP_GC_RESTORE();
return _t22;
}
if (sp_str_eq(lv_k, (&("\xff" "alert")[1]))) {
sp_RbVal _t23 = self->iv_alert;
SP_GC_RESTORE();
return _t23;
}
sp_RbVal _t24 = ((void)(0), sp_box_nil());
SP_GC_RESTORE();
return _t24;
return sp_box_nil();
}
static inline const char * sp_ActionDispatch_Flash__aset(sp_ActionDispatch_Flash *self, sp_sym lv_key, const char * lv_value) {
SP_GC_SAVE();
const char * lv_k = (&("\xff")[1]);
SP_GC_ROOT(lv_k);
SP_GC_ROOT(self);
SP_GC_ROOT(lv_value);
lv_k = sp_sym_to_s(lv_key);
if (sp_str_eq(lv_k, (&("\xff" "notice")[1]))) {
self->iv_notice = sp_box_nullable_str(lv_value);
} else {
if (sp_str_eq(lv_k, (&("\xff" "alert")[1]))) {
self->iv_alert = sp_box_nullable_str(lv_value);
}
}
return lv_value;
return NULL;
}
static inline sp_RbVal sp_ActionDispatch_Flash_fetch(sp_ActionDispatch_Flash *self, mrb_int lv_key, sp_ActionDispatch_Flash * lv_default) {
sp_RbVal lv_v = sp_box_nil();
SP_GC_SAVE();
SP_GC_ROOT(self);
SP_GC_ROOT(lv_default);
lv_v = sp_ActionDispatch_Flash__aref(self, sp_box_int(lv_key));
if ((!sp_poly_nil_p(lv_v))) {
sp_RbVal _t25 = lv_v;
SP_GC_RESTORE();
return _t25;
}
sp_RbVal _t26 = sp_box_nullable_obj(lv_default, 26);
SP_GC_RESTORE();
return _t26;
return sp_box_nil();
}
static inline mrb_bool sp_ActionDispatch_Flash_key_p(sp_ActionDispatch_Flash *self, sp_RbVal lv_key) {
sp_RbVal lv_v = sp_box_nil();
SP_GC_SAVE();
SP_GC_ROOT(self);
lv_v = sp_ActionDispatch_Flash__aref(self, lv_key);
return (!sp_poly_nil_p(lv_v));
return FALSE;
}
static inline mrb_bool sp_ActionDispatch_Flash_has_key_p(sp_ActionDispatch_Flash *self, mrb_int lv_key) {
(void)lv_key;
return FALSE;
}
static inline mrb_bool sp_ActionDispatch_Flash_include_p(sp_ActionDispatch_Flash *self, sp_RbVal lv_key) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return sp_ActionDispatch_Flash_key_p(self, lv_key);
return FALSE;
}
static sp_RbVal sp_ActionDispatch_Flash_delete(sp_ActionDispatch_Flash *self, mrb_int lv_key) {
SP_GC_SAVE();
const char * lv_k = (&("\xff")[1]);
sp_RbVal lv_v = sp_box_nil();
SP_GC_ROOT(lv_k);
SP_GC_ROOT(self);
lv_k = sp_int_to_s(lv_key);
if (sp_str_eq(lv_k, (&("\xff" "notice")[1]))) {
lv_v = self->iv_notice;
self->iv_notice = ((void)(0), sp_box_nil());
sp_RbVal _t27 = lv_v;
SP_GC_RESTORE();
return _t27;
}
if (sp_str_eq(lv_k, (&("\xff" "alert")[1]))) {
lv_v = self->iv_alert;
self->iv_alert = ((void)(0), sp_box_nil());
sp_RbVal _t28 = lv_v;
SP_GC_RESTORE();
return _t28;
}
sp_RbVal _t29 = ((void)(0), sp_box_nil());
SP_GC_RESTORE();
return _t29;
return sp_box_nil();
}
static mrb_int sp_ActionDispatch_Flash_length(sp_ActionDispatch_Flash *self) {
mrb_int lv_n = 0;
SP_GC_SAVE();
SP_GC_ROOT(self);
lv_n = 0LL;
if ((!sp_poly_nil_p(self->iv_notice))) {
lv_n += 1LL;
}
if ((!sp_poly_nil_p(self->iv_alert))) {
lv_n += 1LL;
}
return lv_n;
return 0;
}
static mrb_int sp_ActionDispatch_Flash_size(sp_ActionDispatch_Flash *self) {
mrb_int lv_n = 0;
SP_GC_SAVE();
SP_GC_ROOT(self);
lv_n = 0LL;
if ((!sp_poly_nil_p(self->iv_notice))) {
lv_n += 1LL;
}
if ((!sp_poly_nil_p(self->iv_alert))) {
lv_n += 1LL;
}
return lv_n;
return 0;
}
static inline mrb_bool sp_ActionDispatch_Flash_empty_p(sp_ActionDispatch_Flash *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return (sp_poly_nil_p(self->iv_notice) && sp_poly_nil_p(self->iv_alert));
return FALSE;
}
static sp_StrArray * sp_ActionDispatch_Flash_keys(sp_ActionDispatch_Flash *self) {
SP_GC_SAVE();
sp_StrArray * lv_result = NULL;
SP_GC_ROOT(lv_result);
SP_GC_ROOT(self);
lv_result = sp_StrArray_new();
if ((!sp_poly_nil_p(self->iv_notice))) {
sp_StrArray_push(lv_result, (&("\xff" "notice")[1]));
}
if ((!sp_poly_nil_p(self->iv_alert))) {
sp_StrArray_push(lv_result, (&("\xff" "alert")[1]));
}
return lv_result;
return NULL;
}
static sp_PolyArray * sp_ActionDispatch_Flash_values(sp_ActionDispatch_Flash *self) {
SP_GC_SAVE();
sp_PolyArray * lv_result = NULL;
SP_GC_ROOT(lv_result);
SP_GC_ROOT(self);
lv_result = sp_PolyArray_new();
if ((!sp_poly_nil_p(self->iv_notice))) {
(sp_PolyArray_push(lv_result, self->iv_notice), 0);
}
if ((!sp_poly_nil_p(self->iv_alert))) {
(sp_PolyArray_push(lv_result, self->iv_alert), 0);
}
return lv_result;
return NULL;
}
static sp_ActionDispatch_Flash * sp_ActionDispatch_Flash_each(sp_ActionDispatch_Flash *self, void (*_block)(const char *, sp_RbVal, void*), void *_benv) {
SP_GC_SAVE();
SP_GC_ROOT(self);
if ((!sp_poly_nil_p(self->iv_notice))) {
if (_block) _block((&("\xff" "notice")[1]), self->iv_notice, _benv);
}
if ((!sp_poly_nil_p(self->iv_alert))) {
if (_block) _block((&("\xff" "alert")[1]), self->iv_alert, _benv);
}
return self;
return NULL;
}
static sp_StrPolyHash * sp_ActionDispatch_Flash_to_h(sp_ActionDispatch_Flash *self) {
SP_GC_SAVE();
sp_StrPolyHash * lv_result = NULL;
SP_GC_ROOT(lv_result);
SP_GC_ROOT(self);
lv_result = sp_StrPolyHash_new();
if ((!sp_poly_nil_p(self->iv_notice))) {
sp_StrPolyHash_set(lv_result, (&("\xff" "notice")[1]), self->iv_notice);
}
if ((!sp_poly_nil_p(self->iv_alert))) {
sp_StrPolyHash_set(lv_result, (&("\xff" "alert")[1]), self->iv_alert);
}
return lv_result;
return NULL;
}
static sp_ActionDispatch_Flash * sp_ActionDispatch_Flash_merge(sp_ActionDispatch_Flash *self, mrb_int lv_other) {
SP_GC_SAVE();
sp_ActionDispatch_Flash * lv_result = NULL;
mrb_int lv_k = 0;
mrb_int lv_v = 0;
SP_GC_ROOT(lv_result);
SP_GC_ROOT(self);
lv_result = sp_ActionDispatch_Flash_new(0);
lv_result->iv_notice = self->iv_notice;
lv_result->iv_alert = self->iv_alert;
return lv_result;
return NULL;
}
SP_POOL_DEFINE(ActionDispatch_Session)
static inline sp_ActionDispatch_Session *sp_ActionDispatch_Session_new(sp_StrIntHash * lv_other) {
SP_GC_SAVE();
sp_ActionDispatch_Session *self = SP_POOL_NEW(ActionDispatch_Session, sp_ActionDispatch_Session_gc_scan);
self->cls_id = 27LL;
SP_GC_ROOT(self);
self->iv_data = NULL;
SP_GC_ROOT(lv_other);
sp_StrArray * lv_keys = NULL;
mrb_int lv_i = 0;
const char * lv_k = (&("\xff")[1]);
mrb_int lv_v = 0;
SP_GC_ROOT(lv_keys);
SP_GC_ROOT(lv_k);
self->iv_data = sp_StrIntHash_new();
if ((lv_other == NULL)) {
SP_GC_RESTORE();
return self;
}
lv_keys = sp_StrIntHash_keys(lv_other);
lv_i = 0LL;
mrb_int _t30 = sp_StrArray_length(lv_keys);
while ((lv_i < _t30)) {
sp_redo_1: ;
lv_k = sp_StrArray_get(lv_keys, lv_i);
lv_v = sp_StrIntHash_get(lv_other, lv_k);
sp_StrIntHash_set(self->iv_data, lv_k, lv_v);
lv_i += 1LL;
}
SP_GC_RESTORE();
return self;
}
static inline void sp_ActionDispatch_Session_initialize(sp_ActionDispatch_Session *self, sp_StrIntHash * lv_other) {
SP_GC_SAVE();
sp_StrArray * lv_keys = NULL;
mrb_int lv_i = 0;
const char * lv_k = (&("\xff")[1]);
mrb_int lv_v = 0;
SP_GC_ROOT(lv_keys);
SP_GC_ROOT(lv_k);
self->iv_data = sp_StrIntHash_new();
if ((lv_other == NULL)) {
SP_GC_RESTORE();
return;
}
lv_keys = sp_StrIntHash_keys(lv_other);
lv_i = 0LL;
mrb_int _t31 = sp_StrArray_length(lv_keys);
while ((lv_i < _t31)) {
sp_redo_2: ;
lv_k = sp_StrArray_get(lv_keys, lv_i);
lv_v = sp_StrIntHash_get(lv_other, lv_k);
sp_StrIntHash_set(self->iv_data, lv_k, lv_v);
lv_i += 1LL;
}
}
static mrb_int sp_ActionDispatch_Session__aref(sp_ActionDispatch_Session *self, sp_RbVal lv_key) {
SP_GC_SAVE();
const char * lv_k = (&("\xff")[1]);
SP_GC_ROOT(lv_k);
SP_GC_ROOT(self);
lv_k = sp_poly_to_s(lv_key);
if (sp_StrIntHash_has_key(self->iv_data, lv_k)) {
mrb_int _t32 = sp_StrIntHash_get(self->iv_data, lv_k);
SP_GC_RESTORE();
return _t32;
}
return 0;
return 0;
}
static mrb_int sp_ActionDispatch_Session__aset(sp_ActionDispatch_Session *self, mrb_int lv_key, mrb_int lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_StrIntHash_set(self->iv_data, sp_int_to_s(lv_key), lv_value);
return lv_value;
return 0;
}
static inline mrb_int sp_ActionDispatch_Session_fetch(sp_ActionDispatch_Session *self, mrb_int lv_key, mrb_int lv_default) {
SP_GC_SAVE();
const char * lv_k = (&("\xff")[1]);
SP_GC_ROOT(lv_k);
SP_GC_ROOT(self);
lv_k = sp_int_to_s(lv_key);
if (sp_StrIntHash_has_key(self->iv_data, lv_k)) {
mrb_int _t33 = sp_StrIntHash_get(self->iv_data, lv_k);
SP_GC_RESTORE();
return _t33;
}
return lv_default;
return 0;
}
static mrb_bool sp_ActionDispatch_Session_key_p(sp_ActionDispatch_Session *self, mrb_int lv_key) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return sp_StrIntHash_has_key(self->iv_data, sp_int_to_s(lv_key));
return FALSE;
}
static inline mrb_bool sp_ActionDispatch_Session_has_key_p(sp_ActionDispatch_Session *self, mrb_int lv_key) {
(void)lv_key;
return FALSE;
}
static inline mrb_bool sp_ActionDispatch_Session_include_p(sp_ActionDispatch_Session *self, sp_RbVal lv_key) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return sp_StrIntHash_has_key(self->iv_data, sp_poly_to_s(lv_key));
return FALSE;
}
static mrb_int sp_ActionDispatch_Session_delete(sp_ActionDispatch_Session *self, mrb_int lv_key) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_StrIntHash_delete(self->iv_data, sp_int_to_s(lv_key));
return 0;
return 0;
}
static mrb_int sp_ActionDispatch_Session_length(sp_ActionDispatch_Session *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return sp_StrIntHash_length(self->iv_data);
return 0;
}
static inline mrb_int sp_ActionDispatch_Session_size(sp_ActionDispatch_Session *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return sp_StrIntHash_length(self->iv_data);
return 0;
}
static mrb_bool sp_ActionDispatch_Session_empty_p(sp_ActionDispatch_Session *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return (sp_StrIntHash_length(self->iv_data) == 0);
return FALSE;
}
static sp_StrArray * sp_ActionDispatch_Session_keys(sp_ActionDispatch_Session *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return sp_StrIntHash_keys(self->iv_data);
return NULL;
}
static sp_IntArray * sp_ActionDispatch_Session_values(sp_ActionDispatch_Session *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return sp_StrIntHash_values(self->iv_data);
return NULL;
}
static sp_ActionDispatch_Session * sp_ActionDispatch_Session_each(sp_ActionDispatch_Session *self, void (*_block)(const char *, mrb_int, void*), void *_benv) {
SP_GC_SAVE();
sp_StrArray * lv_keys = NULL;
mrb_int lv_i = 0;
const char * lv_k = (&("\xff")[1]);
mrb_int lv_v = 0;
SP_GC_ROOT(lv_keys);
SP_GC_ROOT(lv_k);
SP_GC_ROOT(self);
lv_keys = sp_StrIntHash_keys(self->iv_data);
lv_i = 0LL;
mrb_int _t34 = sp_StrArray_length(lv_keys);
while ((lv_i < _t34)) {
sp_redo_3: ;
lv_k = sp_StrArray_get(lv_keys, lv_i);
lv_v = sp_StrIntHash_get(self->iv_data, lv_k);
if (_block) _block(lv_k, lv_v, _benv);
lv_i += 1LL;
}
return self;
return NULL;
}
static inline sp_StrIntHash * sp_ActionDispatch_Session_to_h(sp_ActionDispatch_Session *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return self->iv_data;
return NULL;
}
static inline sp_ActionDispatch_Session * sp_ActionDispatch_Session_merge(sp_ActionDispatch_Session *self, mrb_int lv_other) {
SP_GC_SAVE();
sp_ActionDispatch_Session * lv_result = NULL;
mrb_int lv_k = 0;
mrb_int lv_v = 0;
SP_GC_ROOT(lv_result);
SP_GC_ROOT(self);
lv_result = sp_ActionDispatch_Session_new(sp_ActionDispatch_Session_to_h(self));
return lv_result;
return NULL;
}
SP_POOL_DEFINE(ActionView_ViewHelpers_FormBuilder)
static inline sp_ActionView_ViewHelpers_FormBuilder *sp_ActionView_ViewHelpers_FormBuilder_new(sp_RbVal lv_model, const char * lv_model_name, const char * lv_action, sp_sym lv_method) {
SP_GC_SAVE();
sp_ActionView_ViewHelpers_FormBuilder *self = SP_POOL_NEW(ActionView_ViewHelpers_FormBuilder, sp_ActionView_ViewHelpers_FormBuilder_gc_scan);
self->cls_id = 28LL;
SP_GC_ROOT(self);
self->iv_model = sp_box_nil();
self->iv_model_name = NULL;
self->iv_action = NULL;
SP_GC_ROOT(lv_model_name);
SP_GC_ROOT(lv_action);
self->iv_model = lv_model;
self->iv_model_name = lv_model_name;
self->iv_action = lv_action;
self->iv_method = lv_method;
SP_GC_RESTORE();
return self;
}
static inline void sp_ActionView_ViewHelpers_FormBuilder_initialize(sp_ActionView_ViewHelpers_FormBuilder *self, sp_RbVal lv_model, const char * lv_model_name, const char * lv_action, sp_sym lv_method) {
self->iv_model = lv_model;
self->iv_model_name = lv_model_name;
self->iv_action = lv_action;
self->iv_method = lv_method;
}
static inline const char * sp_ActionView_ViewHelpers_FormBuilder_label(sp_ActionView_ViewHelpers_FormBuilder *self, sp_sym lv_field, sp_SymStrHash * lv_opts) {
SP_GC_SAVE();
const char * lv_attrs = (&("\xff")[1]);
SP_GC_ROOT(lv_attrs);
SP_GC_ROOT(self);
SP_GC_ROOT(lv_opts);
sp_SymStrHash *_t35 = sp_SymStrHash_new();
sp_SymStrHash_set(_t35, SPS_for, sp_sprintf("%s_%lld", self->iv_model_name, (long long)lv_field));
sp_SymStrHash * _t36 = _t35;
SP_GC_ROOT(_t36);
lv_attrs = sp_ActionView_ViewHelpers_cls_render_attrs(sp_box_obj((void *)(sp_SymStrHash_merge(_t36, lv_opts)), SP_BUILTIN_SYM_STR_HASH));
const char * _t37 = sp_sym_to_s(lv_field);
SP_GC_ROOT(_t37);
return sp_sprintf("<label%s>%s</label>", lv_attrs, sp_ActionView_ViewHelpers_cls_html_escape(sp_box_str(sp_str_capitalize(_t37))));
return (&("\xff")[1]);
}
static const char * sp_ActionView_ViewHelpers_FormBuilder_text_field(sp_ActionView_ViewHelpers_FormBuilder *self, sp_sym lv_field, sp_SymStrHash * lv_opts) {
SP_GC_SAVE();
sp_RbVal lv_value = sp_box_nil();
sp_SymStrHash * lv_base = NULL;
const char * lv_attrs = (&("\xff")[1]);
SP_GC_ROOT(lv_base);
SP_GC_ROOT(lv_attrs);
SP_GC_ROOT(self);
SP_GC_ROOT(lv_opts);
sp_RbVal _t38 = self->iv_model;
sp_RbVal _t39 = sp_box_nil();
if (_t38.tag == SP_TAG_OBJ) {
if (_t38.cls_id == 23) _t39 = sp_ActiveRecord_Base__aref((sp_ActiveRecord_Base *)_t38.v.p, sp_box_sym(lv_field));
if (_t38.cls_id == 26) _t39 = sp_ActionDispatch_Flash__aref((sp_ActionDispatch_Flash *)_t38.v.p, sp_box_sym(lv_field));
if (_t38.cls_id == 27) _t39 = sp_box_int(sp_ActionDispatch_Session__aref((sp_ActionDispatch_Session *)_t38.v.p, sp_box_sym(lv_field)));
if (_t38.cls_id == 33) _t39 = sp_ActiveRecord_Base__aref((sp_ActiveRecord_Base *)_t38.v.p, sp_box_sym(lv_field));
if (_t38.cls_id == 35) _t39 = sp_Comment__aref((sp_Comment *)_t38.v.p, sp_box_sym(lv_field));
if (_t38.cls_id == 37) _t39 = sp_Article__aref((sp_Article *)_t38.v.p, sp_box_sym(lv_field));
if (_t38.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t39 = sp_SymPolyHash_get((sp_SymPolyHash *)_t38.v.p, lv_field);
if (_t38.cls_id == SP_BUILTIN_SYM_INT_HASH) _t39 = sp_box_int(sp_SymIntHash_get((sp_SymIntHash *)_t38.v.p, lv_field));
if (_t38.cls_id == SP_BUILTIN_SYM_STR_HASH) _t39 = sp_box_str(sp_SymStrHash_get((sp_SymStrHash *)_t38.v.p, lv_field));
}
lv_value = _t39;
sp_SymStrHash *_t40 = sp_SymStrHash_new();
sp_SymStrHash_set(_t40, SPS_type, (&("\xff" "text")[1]));
sp_SymStrHash_set(_t40, SPS_name, sp_sprintf("%s[%lld]", self->iv_model_name, (long long)lv_field));
sp_SymStrHash_set(_t40, SPS_id, sp_sprintf("%s_%lld", self->iv_model_name, (long long)lv_field));
lv_base = _t40;
const char * _t41 = sp_poly_to_s(lv_value);
SP_GC_ROOT(_t41);
if (!((sp_poly_nil_p(lv_value) || (strlen(_t41) == 0)))) {
sp_SymStrHash_set(lv_base, SPS_value, sp_poly_to_s(lv_value));
}
lv_attrs = sp_ActionView_ViewHelpers_cls_render_attrs(sp_box_obj((void *)(sp_SymStrHash_merge(lv_base, lv_opts)), SP_BUILTIN_SYM_STR_HASH));
return sp_sprintf("<input%s>", lv_attrs);
return (&("\xff")[1]);
}
static const char * sp_ActionView_ViewHelpers_FormBuilder_text_area(sp_ActionView_ViewHelpers_FormBuilder *self, sp_sym lv_field, sp_SymPolyHash * lv_opts) {
SP_GC_SAVE();
sp_RbVal lv_value = sp_box_nil();
const char * lv_attrs = (&("\xff")[1]);
const char * lv_body_str = (&("\xff")[1]);
SP_GC_ROOT(lv_attrs);
SP_GC_ROOT(lv_body_str);
SP_GC_ROOT(self);
SP_GC_ROOT(lv_opts);
sp_RbVal _t42 = self->iv_model;
sp_RbVal _t43 = sp_box_nil();
if (_t42.tag == SP_TAG_OBJ) {
if (_t42.cls_id == 23) _t43 = sp_ActiveRecord_Base__aref((sp_ActiveRecord_Base *)_t42.v.p, sp_box_sym(lv_field));
if (_t42.cls_id == 26) _t43 = sp_ActionDispatch_Flash__aref((sp_ActionDispatch_Flash *)_t42.v.p, sp_box_sym(lv_field));
if (_t42.cls_id == 27) _t43 = sp_box_int(sp_ActionDispatch_Session__aref((sp_ActionDispatch_Session *)_t42.v.p, sp_box_sym(lv_field)));
if (_t42.cls_id == 33) _t43 = sp_ActiveRecord_Base__aref((sp_ActiveRecord_Base *)_t42.v.p, sp_box_sym(lv_field));
if (_t42.cls_id == 35) _t43 = sp_Comment__aref((sp_Comment *)_t42.v.p, sp_box_sym(lv_field));
if (_t42.cls_id == 37) _t43 = sp_Article__aref((sp_Article *)_t42.v.p, sp_box_sym(lv_field));
if (_t42.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t43 = sp_SymPolyHash_get((sp_SymPolyHash *)_t42.v.p, lv_field);
if (_t42.cls_id == SP_BUILTIN_SYM_INT_HASH) _t43 = sp_box_int(sp_SymIntHash_get((sp_SymIntHash *)_t42.v.p, lv_field));
if (_t42.cls_id == SP_BUILTIN_SYM_STR_HASH) _t43 = sp_box_str(sp_SymStrHash_get((sp_SymStrHash *)_t42.v.p, lv_field));
}
lv_value = _t43;
sp_SymStrHash *_t44 = sp_SymStrHash_new();
sp_SymStrHash_set(_t44, SPS_name, sp_sprintf("%s[%lld]", self->iv_model_name, (long long)lv_field));
sp_SymStrHash_set(_t44, SPS_id, sp_sprintf("%s_%lld", self->iv_model_name, (long long)lv_field));
sp_SymStrHash * _t45 = _t44;
SP_GC_ROOT(_t45);
lv_attrs = sp_ActionView_ViewHelpers_cls_render_attrs(sp_box_obj((void *)(sp_SymPolyHash_merge(sp_SymStrHash_to_sym_poly(_t45), lv_opts)), SP_BUILTIN_SYM_POLY_HASH));
lv_body_str = (sp_poly_nil_p(lv_value) ? (&("\xff" "")[1]) : sp_ActionView_ViewHelpers_cls_html_escape(sp_box_str(sp_poly_to_s(lv_value))));
return sp_sprintf("<textarea%s>%s</textarea>", lv_attrs, lv_body_str);
return (&("\xff")[1]);
}
static inline const char * sp_ActionView_ViewHelpers_FormBuilder_submit(sp_ActionView_ViewHelpers_FormBuilder *self, const char * lv_label, sp_SymStrHash * lv_opts) {
SP_GC_SAVE();
sp_RbVal lv_text = sp_box_nil();
const char * lv_attrs = (&("\xff")[1]);
SP_GC_ROOT(lv_attrs);
SP_GC_ROOT(self);
SP_GC_ROOT(lv_label);
SP_GC_ROOT(lv_opts);
const char * _t46 = lv_label;
lv_text = ((_t46 != NULL) ? sp_box_nullable_str(_t46) : sp_box_str(((self->iv_method == SPS_patch) ? sp_sprintf("Update %s", sp_str_capitalize(self->iv_model_name)) : sp_sprintf("Create %s", sp_str_capitalize(self->iv_model_name)))));
sp_SymPolyHash *_t47 = sp_SymPolyHash_new();
sp_SymPolyHash_set(_t47, SPS_type, sp_box_str((&("\xff" "submit")[1])));
sp_SymPolyHash_set(_t47, SPS_name, sp_box_str((&("\xff" "commit")[1])));
sp_SymPolyHash_set(_t47, SPS_value, lv_text);
sp_SymPolyHash_set(_t47, ((sp_sym)49), lv_text);
sp_SymPolyHash * _t48 = _t47;
SP_GC_ROOT(_t48);
sp_SymPolyHash *_t49 = sp_SymPolyHash_merge_str(_t48, lv_opts);
lv_attrs = sp_ActionView_ViewHelpers_cls_render_attrs(sp_box_obj((void *)(_t49), SP_BUILTIN_SYM_POLY_HASH));
return sp_sprintf("<input%s>", lv_attrs);
return (&("\xff")[1]);
}
SP_POOL_DEFINE(ActionController_Base)
static inline sp_ActionController_Base *sp_ActionController_Base_new(void) {
SP_GC_SAVE();
sp_ActionController_Base *self = SP_POOL_NEW(ActionController_Base, sp_ActionController_Base_gc_scan);
self->cls_id = 29LL;
SP_GC_ROOT(self);
self->iv_params = NULL;
self->iv_session = NULL;
self->iv_flash = NULL;
self->iv_body = sp_box_nil();
self->iv_location = NULL;
self->iv_content_type = NULL;
self->iv_params = sp_StrIntHash_new();
self->iv_session = sp_ActionDispatch_Session_new(0);
self->iv_flash = sp_ActionDispatch_Flash_new(0);
self->iv_status = 200LL;
self->iv_body = sp_box_str((&("\xff" "")[1]));
self->iv_location = 0;
self->iv_request_format = SPS_html;
self->iv_content_type = (&("\xff" "text/html; charset=utf-8")[1]);
SP_GC_RESTORE();
return self;
}
static inline void sp_ActionController_Base_initialize(sp_ActionController_Base *self) {
self->iv_params = sp_StrIntHash_new();
self->iv_session = sp_ActionDispatch_Session_new(0);
self->iv_flash = sp_ActionDispatch_Flash_new(0);
self->iv_status = 200LL;
self->iv_body = sp_box_str((&("\xff" "")[1]));
self->iv_location = 0;
self->iv_request_format = SPS_html;
self->iv_content_type = (&("\xff" "text/html; charset=utf-8")[1]);
}
static inline mrb_int sp_ActionController_Base_process_action(sp_ActionController_Base *self, sp_sym lv__action_name) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_raise_cls("NotImplementedError", (&("\xff" "process_action must be overridden by subclass")[1]));
return 0;
return 0;
}
static mrb_int sp_ActionController_Base_render(sp_ActionController_Base *self, sp_RbVal lv_body, sp_sym lv_status, const char * lv_content_type, const char * lv_location) {
SP_GC_SAVE();
SP_GC_ROOT(self);
SP_GC_ROOT(lv_content_type);
SP_GC_ROOT(lv_location);
self->iv_body = lv_body;
self->iv_status = sp_ActionController_Base_resolve_status(self, lv_status);
if (!((lv_content_type == NULL))) {
self->iv_content_type = lv_content_type;
}
if (!((lv_location == NULL))) {
self->iv_location = lv_location;
}
return 0;
return 0;
}
static mrb_int sp_ActionController_Base_redirect_to(sp_ActionController_Base *self, const char * lv_path, const char * lv_notice, const char * lv_alert, sp_sym lv_status) {
SP_GC_SAVE();
SP_GC_ROOT(self);
SP_GC_ROOT(lv_path);
SP_GC_ROOT(lv_notice);
SP_GC_ROOT(lv_alert);
self->iv_location = lv_path;
self->iv_status = sp_ActionController_Base_resolve_status(self, lv_status);
if (!((lv_notice == NULL))) {
sp_ActionDispatch_Flash__aset(self->iv_flash, SPS_notice, lv_notice);
}
if (!((lv_alert == NULL))) {
sp_ActionDispatch_Flash__aset(self->iv_flash, SPS_alert, lv_alert);
}
return 0;
return 0;
}
static mrb_int sp_ActionController_Base_head(sp_ActionController_Base *self, sp_sym lv_status, const char * lv_content_type) {
SP_GC_SAVE();
SP_GC_ROOT(self);
SP_GC_ROOT(lv_content_type);
self->iv_status = sp_ActionController_Base_resolve_status(self, lv_status);
self->iv_body = sp_box_str((&("\xff" "")[1]));
if (!((lv_content_type == NULL))) {
self->iv_content_type = lv_content_type;
}
return 0;
return 0;
}
static inline mrb_int sp_ActionController_Base_resolve_status(sp_ActionController_Base *self, sp_sym lv_s) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return (sp_SymIntHash_has_key(cst_ActionController_STATUS_CODES, lv_s) ? sp_SymIntHash_get(cst_ActionController_STATUS_CODES, lv_s) : 200LL);
return 0;
}
SP_POOL_DEFINE(Broadcasts_SeedTransport)
static inline sp_Broadcasts_SeedTransport *sp_Broadcasts_SeedTransport_new(void) {
SP_GC_SAVE();
sp_Broadcasts_SeedTransport *self = SP_POOL_NEW(Broadcasts_SeedTransport, NULL);
self->cls_id = 30LL;
SP_GC_ROOT(self);
SP_GC_RESTORE();
return self;
}
static inline mrb_int sp_Broadcasts_SeedTransport_broadcast(sp_Broadcasts_SeedTransport *self, const char * lv_stream, const char * lv_fragment) {
SP_GC_SAVE();
SP_GC_ROOT(self);
SP_GC_ROOT(lv_stream);
SP_GC_ROOT(lv_fragment);
return 0;
return 0;
}
SP_POOL_DEFINE(ActionDispatch_IntegrationTest)
static inline sp_ActionDispatch_IntegrationTest *sp_ActionDispatch_IntegrationTest_new(void) {
SP_GC_SAVE();
sp_ActionDispatch_IntegrationTest *self = SP_POOL_NEW(ActionDispatch_IntegrationTest, NULL);
self->cls_id = 31LL;
SP_GC_ROOT(self);
sp_TestBase_initialize((sp_TestBase *)self);
SP_GC_RESTORE();
return self;
}
static inline mrb_int sp_ActionDispatch_IntegrationTest_get(sp_ActionDispatch_IntegrationTest *self, const char * lv_path, sp_StrIntHash * lv_params) {
SP_GC_SAVE();
SP_GC_ROOT(self);
SP_GC_ROOT(lv_path);
SP_GC_ROOT(lv_params);
return sp_ActionDispatch_IntegrationTest_dispatch_request(self, (&("\xff" "GET")[1]), lv_path, lv_params);
return 0;
}
static inline mrb_int sp_ActionDispatch_IntegrationTest_post(sp_ActionDispatch_IntegrationTest *self, const char * lv_path, sp_SymPolyHash * lv_params) {
SP_GC_SAVE();
SP_GC_ROOT(self);
SP_GC_ROOT(lv_path);
SP_GC_ROOT(lv_params);
return sp_ActionDispatch_IntegrationTest_dispatch_request(self, (&("\xff" "POST")[1]), lv_path, lv_params);
return 0;
}
static inline mrb_int sp_ActionDispatch_IntegrationTest_patch(sp_ActionDispatch_IntegrationTest *self, const char * lv_path, sp_SymPolyHash * lv_params) {
SP_GC_SAVE();
SP_GC_ROOT(self);
SP_GC_ROOT(lv_path);
SP_GC_ROOT(lv_params);
return sp_ActionDispatch_IntegrationTest_dispatch_request(self, (&("\xff" "PATCH")[1]), lv_path, lv_params);
return 0;
}
static inline mrb_int sp_ActionDispatch_IntegrationTest_delete(sp_ActionDispatch_IntegrationTest *self, const char * lv_path, sp_StrIntHash * lv_params) {
SP_GC_SAVE();
SP_GC_ROOT(self);
SP_GC_ROOT(lv_path);
SP_GC_ROOT(lv_params);
return sp_ActionDispatch_IntegrationTest_dispatch_request(self, (&("\xff" "DELETE")[1]), lv_path, lv_params);
return 0;
}
static mrb_int sp_ActionDispatch_IntegrationTest_dispatch_request(sp_ActionDispatch_IntegrationTest *self, const char * lv_method, const char * lv_path, sp_SymPolyHash * lv_params) {
SP_GC_SAVE();
sp_ActionDispatch_Router_MatchResult * lv_matched = NULL;
volatile sp_RbVal lv_controller = sp_box_nil();
sp_StrStrHash * lv_merged = NULL;
volatile sp_sym lv_k = ((sp_sym)-1);
volatile sp_RbVal lv_v = sp_box_nil();
SP_GC_ROOT(lv_matched);
SP_GC_ROOT(lv_merged);
SP_GC_ROOT(self);
SP_GC_ROOT(lv_method);
SP_GC_ROOT(lv_path);
SP_GC_ROOT(lv_params);
lv_matched = sp_ActionDispatch_Router_cls_match((const char *)lv_method, (const char *)lv_path, sp_Routes_cls_table());
if ((lv_matched == NULL)) {
sp_raise(sp_sprintf("No route matches %s %s", lv_method, lv_path));
}
sp_RbVal _t50 = sp_box_nil();
mrb_int _t51 = lv_matched->iv_controller;
if (_t51 == SPS_articles) {
_t50 = sp_ArticlesController_new();
} else if (_t51 == SPS_comments) {
_t50 = sp_CommentsController_new();
}
lv_controller = _t50;
sp_StrStrHash * _t52 = lv_matched->iv_path_params;
SP_GC_ROOT(_t52);
lv_merged = 0;
for (mrb_int _t53 = 0; _t53 < lv_params->len; _t53++) {
lv_k = lv_params->order[_t53];
lv_v = sp_SymPolyHash_get(lv_params, lv_params->order[_t53]);
sp_redo_4: ;
}
sp_RbVal _t54 = lv_controller;
sp_StrIntHash * _t55 = NULL;
if (_t54.tag == SP_TAG_OBJ) {
if (_t54.cls_id == 29) { ((sp_ActionController_Base *)_t54.v.p)->iv_params = lv_merged; _t55 = lv_merged; }
if (_t54.cls_id == 32) { ((sp_ApplicationController *)_t54.v.p)->iv_params = lv_merged; _t55 = lv_merged; }
if (_t54.cls_id == 39) { ((sp_ArticlesController *)_t54.v.p)->iv_params = lv_merged; _t55 = lv_merged; }
if (_t54.cls_id == 41) { ((sp_CommentsController *)_t54.v.p)->iv_params = lv_merged; _t55 = lv_merged; }
}
_t55;
sp_RbVal _t56 = lv_controller;
if (!(self->iv___session)) {
self->iv___session = sp_ActionDispatch_Session_new(0);
}
sp_ActionDispatch_Session * _t57 = NULL;
if (_t56.tag == SP_TAG_OBJ) {
if (_t56.cls_id == 29) { ((sp_ActionController_Base *)_t56.v.p)->iv_session = self->iv___session; _t57 = self->iv___session; }
if (_t56.cls_id == 32) { ((sp_ApplicationController *)_t56.v.p)->iv_session = self->iv___session; _t57 = self->iv___session; }
if (_t56.cls_id == 39) { ((sp_ArticlesController *)_t56.v.p)->iv_session = self->iv___session; _t57 = self->iv___session; }
if (_t56.cls_id == 41) { ((sp_CommentsController *)_t56.v.p)->iv_session = self->iv___session; _t57 = self->iv___session; }
}
_t57;
sp_RbVal _t58 = lv_controller;
if (!(self->iv___flash)) {
self->iv___flash = sp_ActionDispatch_Flash_new(0);
}
sp_ActionDispatch_Flash * _t59 = NULL;
if (_t58.tag == SP_TAG_OBJ) {
if (_t58.cls_id == 29) { ((sp_ActionController_Base *)_t58.v.p)->iv_flash = self->iv___flash; _t59 = self->iv___flash; }
if (_t58.cls_id == 32) { ((sp_ApplicationController *)_t58.v.p)->iv_flash = self->iv___flash; _t59 = self->iv___flash; }
if (_t58.cls_id == 39) { ((sp_ArticlesController *)_t58.v.p)->iv_flash = self->iv___flash; _t59 = self->iv___flash; }
if (_t58.cls_id == 41) { ((sp_CommentsController *)_t58.v.p)->iv_flash = self->iv___flash; _t59 = self->iv___flash; }
}
_t59;
sp_RbVal _t60 = lv_controller;
mrb_int _t61 = 0;
if (_t60.tag == SP_TAG_OBJ) {
if (_t60.cls_id == 29) { ((sp_ActionController_Base *)_t60.v.p)->iv_request_method = lv_method; _t61 = lv_method; }
if (_t60.cls_id == 32) { ((sp_ApplicationController *)_t60.v.p)->iv_request_method = lv_method; _t61 = lv_method; }
if (_t60.cls_id == 39) { ((sp_ArticlesController *)_t60.v.p)->iv_request_method = lv_method; _t61 = lv_method; }
if (_t60.cls_id == 41) { ((sp_CommentsController *)_t60.v.p)->iv_request_method = lv_method; _t61 = lv_method; }
}
_t61;
sp_RbVal _t62 = lv_controller;
mrb_int _t63 = 0;
if (_t62.tag == SP_TAG_OBJ) {
if (_t62.cls_id == 29) { ((sp_ActionController_Base *)_t62.v.p)->iv_request_path = lv_path; _t63 = lv_path; }
if (_t62.cls_id == 32) { ((sp_ApplicationController *)_t62.v.p)->iv_request_path = lv_path; _t63 = lv_path; }
if (_t62.cls_id == 39) { ((sp_ArticlesController *)_t62.v.p)->iv_request_path = lv_path; _t63 = lv_path; }
if (_t62.cls_id == 41) { ((sp_CommentsController *)_t62.v.p)->iv_request_path = lv_path; _t63 = lv_path; }
}
_t63;
sp_RbVal _t64 = lv_controller;
sp_RbVal _t65 = sp_box_nil();
if (_t64.tag == SP_TAG_OBJ) {
if (_t64.cls_id == 29) _t65 = sp_box_int(sp_ActionController_Base_process_action((sp_ActionController_Base *)_t64.v.p, lv_matched->iv_action));
if (_t64.cls_id == 32) _t65 = sp_box_int(sp_ActionController_Base_process_action((sp_ActionController_Base *)_t64.v.p, lv_matched->iv_action));
if (_t64.cls_id == 39) _t65 = ((void)(sp_ArticlesController_process_action((sp_ArticlesController *)_t64.v.p, lv_matched->iv_action)), sp_box_nil());
if (_t64.cls_id == 41) _t65 = ((void)(sp_CommentsController_process_action((sp_CommentsController *)_t64.v.p, lv_matched->iv_action)), sp_box_nil());
}
_t65;
sp_RbVal _t66 = lv_controller;
sp_ActionDispatch_Flash * _t67 = NULL;
if (_t66.tag == SP_TAG_OBJ) {
if (_t66.cls_id == 29) _t67 = ((sp_ActionController_Base *)_t66.v.p)->iv_flash;
if (_t66.cls_id == 32) _t67 = ((sp_ApplicationController *)_t66.v.p)->iv_flash;
if (_t66.cls_id == 39) _t67 = ((sp_ArticlesController *)_t66.v.p)->iv_flash;
if (_t66.cls_id == 41) _t67 = ((sp_CommentsController *)_t66.v.p)->iv_flash;
if (_t66.cls_id == 42) _t67 = ((sp_ActionResponse *)_t66.v.p)->iv_flash;
}
self->iv___flash = _t67;
sp_RbVal _t68 = lv_controller;
mrb_int _t69 = 0;
if (_t68.tag == SP_TAG_OBJ) {
if (_t68.cls_id == 29) _t69 = ((sp_ActionController_Base *)_t68.v.p)->iv_status;
if (_t68.cls_id == 32) _t69 = ((sp_ApplicationController *)_t68.v.p)->iv_status;
if (_t68.cls_id == 39) _t69 = ((sp_ArticlesController *)_t68.v.p)->iv_status;
if (_t68.cls_id == 41) _t69 = ((sp_CommentsController *)_t68.v.p)->iv_status;
if (_t68.cls_id == 42) _t69 = ((sp_ActionResponse *)_t68.v.p)->iv_status;
}
sp_RbVal _t70 = lv_controller;
sp_RbVal _t71 = sp_box_nil();
if (_t70.tag == SP_TAG_OBJ) {
if (_t70.cls_id == 29) _t71 = ((sp_ActionController_Base *)_t70.v.p)->iv_body;
if (_t70.cls_id == 32) _t71 = ((sp_ApplicationController *)_t70.v.p)->iv_body;
if (_t70.cls_id == 34) _t71 = sp_CommentRow_body((sp_CommentRow *)_t70.v.p);
if (_t70.cls_id == 35) _t71 = sp_Comment_body((sp_Comment *)_t70.v.p);
if (_t70.cls_id == 36) _t71 = sp_ArticleRow_body((sp_ArticleRow *)_t70.v.p);
if (_t70.cls_id == 37) _t71 = sp_Article_body((sp_Article *)_t70.v.p);
if (_t70.cls_id == 38) _t71 = sp_ArticleParams_body((sp_ArticleParams *)_t70.v.p);
if (_t70.cls_id == 39) _t71 = ((sp_ArticlesController *)_t70.v.p)->iv_body;
if (_t70.cls_id == 40) _t71 = sp_CommentParams_body((sp_CommentParams *)_t70.v.p);
if (_t70.cls_id == 41) _t71 = ((sp_CommentsController *)_t70.v.p)->iv_body;
if (_t70.cls_id == 42) _t71 = ((sp_ActionResponse *)_t70.v.p)->iv_body;
}
sp_RbVal _t72 = lv_controller;
sp_RbVal _t73 = sp_box_nil();
if (_t72.tag == SP_TAG_OBJ) {
if (_t72.cls_id == 29) _t73 = sp_box_str(((sp_ActionController_Base *)_t72.v.p)->iv_location);
if (_t72.cls_id == 32) _t73 = sp_box_str(((sp_ApplicationController *)_t72.v.p)->iv_location);
if (_t72.cls_id == 39) _t73 = sp_box_str(((sp_ArticlesController *)_t72.v.p)->iv_location);
if (_t72.cls_id == 41) _t73 = sp_box_str(((sp_CommentsController *)_t72.v.p)->iv_location);
if (_t72.cls_id == 42) _t73 = ((sp_ActionResponse *)_t72.v.p)->iv_location;
}
sp_RbVal _t74 = lv_controller;
sp_ActionDispatch_Flash * _t75 = NULL;
if (_t74.tag == SP_TAG_OBJ) {
if (_t74.cls_id == 29) _t75 = ((sp_ActionController_Base *)_t74.v.p)->iv_flash;
if (_t74.cls_id == 32) _t75 = ((sp_ApplicationController *)_t74.v.p)->iv_flash;
if (_t74.cls_id == 39) _t75 = ((sp_ArticlesController *)_t74.v.p)->iv_flash;
if (_t74.cls_id == 41) _t75 = ((sp_CommentsController *)_t74.v.p)->iv_flash;
if (_t74.cls_id == 42) _t75 = ((sp_ActionResponse *)_t74.v.p)->iv_flash;
}
self->iv___response = sp_ActionResponse_new(_t69, _t71, _t73, _t75);
return self->iv___response;
return 0;
}
static sp_StrPolyHash * sp_ActionDispatch_IntegrationTest_stringify_keys(sp_ActionDispatch_IntegrationTest *self, mrb_int lv_value) {
SP_GC_SAVE();
sp_StrPolyHash * lv_out = NULL;
mrb_int lv_k = 0;
mrb_int lv_v = 0;
SP_GC_ROOT(lv_out);
SP_GC_ROOT(self);
mrb_int _t76 = lv_value;
SP_GC_RESTORE();
return _t76;
lv_out = sp_StrPolyHash_new();
return lv_out;
return NULL;
}
static mrb_int sp_ActionDispatch_IntegrationTest_assert_response(sp_ActionDispatch_IntegrationTest *self, sp_sym lv_expected, sp_ActionController_Base * lv_response) {
volatile mrb_int lv_actual = 0;
volatile sp_sym lv_expected_match = ((sp_sym)-1);
volatile mrb_bool lv_matches = FALSE;
SP_GC_SAVE();
SP_GC_ROOT(self);
SP_GC_ROOT(lv_response);
lv_actual = lv_response->iv_status;
lv_expected_match = (TRUE ? 0 : lv_expected);
mrb_bool _t77 = FALSE;
mrb_int _t78 = lv_expected_match;
if (0) {
_t77 = 0;
} else if (0) {
_t77 = FALSE;
} else {
_t77 = FALSE;
}
lv_matches = _t77;
if (!(lv_matches)) {
sp_RbVal _t79 = lv_response->iv_body;
sp_RbVal _t80 = sp_box_nil();
if (_t79.tag == SP_TAG_INT) _t80 = sp_box_int(((_t79.v.i >> (0LL)) & 1));
if (_t79.tag == SP_TAG_OBJ) {
if (_t79.cls_id == 23) _t80 = sp_ActiveRecord_Base__aref((sp_ActiveRecord_Base *)_t79.v.p, sp_box_int(0LL));
if (_t79.cls_id == 26) _t80 = sp_ActionDispatch_Flash__aref((sp_ActionDispatch_Flash *)_t79.v.p, sp_box_int(0LL));
if (_t79.cls_id == 27) _t80 = sp_box_int(sp_ActionDispatch_Session__aref((sp_ActionDispatch_Session *)_t79.v.p, sp_box_int(0LL)));
if (_t79.cls_id == 33) _t80 = sp_ActiveRecord_Base__aref((sp_ActiveRecord_Base *)_t79.v.p, sp_box_int(0LL));
if (_t79.cls_id == 35) _t80 = sp_Comment__aref((sp_Comment *)_t79.v.p, sp_box_int(0LL));
if (_t79.cls_id == 37) _t80 = sp_Article__aref((sp_Article *)_t79.v.p, sp_box_int(0LL));
if (_t79.cls_id == SP_BUILTIN_INT_ARRAY) _t80 = sp_box_int(sp_IntArray_get((sp_IntArray *)_t79.v.p, 0LL));
if (_t79.cls_id == SP_BUILTIN_FLT_ARRAY) _t80 = sp_box_float(sp_FloatArray_get((sp_FloatArray *)_t79.v.p, 0LL));
if (_t79.cls_id == SP_BUILTIN_STR_ARRAY) _t80 = sp_box_str(sp_StrArray_get((sp_StrArray *)_t79.v.p, 0LL));
if (_t79.cls_id == SP_BUILTIN_SYM_ARRAY) _t80 = sp_box_sym((sp_sym)sp_IntArray_get((sp_IntArray *)_t79.v.p, 0LL));
if (_t79.cls_id == SP_BUILTIN_PTR_ARRAY) { void *_pe = sp_PtrArray_get((sp_PtrArray *)_t79.v.p, 0LL); _t80 = sp_box_obj(_pe, sp_obj_cls_id_of(_pe)); }
if (_t79.cls_id == SP_BUILTIN_POLY_ARRAY) _t80 = sp_PolyArray_get((sp_PolyArray *)_t79.v.p, 0LL);
if (_t79.cls_id == 45) _t80 = sp_box_int((((sp_Method *)_t79.v.p) && ((sp_Method *)_t79.v.p)->iv_fn_ptr ? ((mrb_int (*)(void *, mrb_int, mrb_int))(uintptr_t)((sp_Method *)_t79.v.p)->iv_fn_ptr)((void *)((sp_Method *)_t79.v.p)->iv_self_obj, 0LL, 200LL) : 0));
}
sp_raise(sp_sprintf("expected response %s, got status=%lld body=%s", sp_str_concat(":", sp_sym_to_s(lv_expected)), (long long)lv_actual, sp_poly_inspect(_t80)));
return 0;
} else {
return 0;
}
return 0;
}
static inline mrb_int sp_ActionDispatch_IntegrationTest_assert_redirected_to(sp_ActionDispatch_IntegrationTest *self, const char * lv_expected_path, sp_ActionResponse * lv_response) {
SP_GC_SAVE();
SP_GC_ROOT(self);
SP_GC_ROOT(lv_expected_path);
SP_GC_ROOT(lv_response);
if (!(sp_ActionResponse_redirect_p(lv_response))) {
sp_raise(sp_sprintf("expected a redirect, got status=%lld location=%s", (long long)lv_response->iv_status, sp_poly_inspect(lv_response->iv_location)));
}
if (!(sp_poly_eq(sp_box_str(lv_expected_path), lv_response->iv_location))) {
sp_raise(sp_sprintf("expected redirect to %s, got %s", sp_str_inspect(lv_expected_path), sp_poly_inspect(lv_response->iv_location)));
return 0;
} else {
return 0;
}
return 0;
}
static mrb_int sp_ActionDispatch_IntegrationTest_assert_select(sp_ActionDispatch_IntegrationTest *self, const char * lv_selector, sp_RbVal lv_content_or_opts, mrb_int lv_opts, sp_Proc * lv_block, void (*_block)(mrb_int, void*), void *_benv) {
SP_GC_SAVE();
volatile sp_RbVal lv_body = sp_box_nil();
volatile sp_RbVal lv_content = sp_box_nil();
const char * lv_tag = (&("\xff")[1]);
sp_Regexp * lv_pattern = NULL;
const char * lv_id = (&("\xff")[1]);
const char * lv__tag = (&("\xff")[1]);
const char * lv_cls = (&("\xff")[1]);
SP_GC_ROOT(lv_tag);
SP_GC_ROOT(lv_pattern);
SP_GC_ROOT(lv_id);
SP_GC_ROOT(lv__tag);
SP_GC_ROOT(lv_cls);
SP_GC_ROOT(self);
SP_GC_ROOT(lv_selector);
SP_GC_ROOT(lv_block);
lv_body = ((sp_ActionController_Base *)self->iv___response)->iv_body;
sp_RbVal _t81 = lv_content_or_opts;
if ((_t81.tag == SP_TAG_OBJ && (_t81.cls_id == SP_BUILTIN_STR_INT_HASH || _t81.cls_id == SP_BUILTIN_STR_STR_HASH || _t81.cls_id == SP_BUILTIN_INT_STR_HASH || _t81.cls_id == SP_BUILTIN_SYM_INT_HASH || _t81.cls_id == SP_BUILTIN_SYM_STR_HASH || _t81.cls_id == SP_BUILTIN_STR_POLY_HASH || _t81.cls_id == SP_BUILTIN_SYM_POLY_HASH))) {
lv_opts = lv_content_or_opts;
lv_content = ((void)(0), sp_box_nil());
} else {
lv_content = lv_content_or_opts;
}
sp_RbVal _t82 = lv_content;
if ((_t82.tag == SP_TAG_STR)) {
lv_tag = sp_str_sub_range(lv_selector, 0, 1);
lv_pattern = ((lv_tag != NULL) ? 0 : 0);
if (!(0)) {
sp_raise(sp_sprintf("expected %s containing %s in response body", sp_str_inspect(lv_selector), sp_poly_inspect(lv_content)));
}
} else {
if (sp_str_start_with(lv_selector, (&("\xff" "#")[1]))) {
sp_StrArray * _t83 = sp_str_split(lv_selector, (&("\xff" " ")[1]));
SP_GC_ROOT(_t83);
const char * _t84 = sp_StrArray_get(_t83, 0);
SP_GC_ROOT(_t84);
const char * _t85 = _t84;
SP_GC_ROOT(_t85);
lv_id = sp_str_sub_range_r(_t85, 1LL, -1, 0);
sp_RbVal _t86 = lv_body;
mrb_bool _t87 = FALSE;
if (_t86.tag == SP_TAG_STR) _t87 = sp_str_include(_t86.v.s, sp_sprintf("id=\"%s\"", lv_id));
if (_t86.tag == SP_TAG_OBJ) {
if (_t86.cls_id == 26) _t87 = sp_ActionDispatch_Flash_include_p((sp_ActionDispatch_Flash *)_t86.v.p, sp_box_str(sp_sprintf("id=\"%s\"", lv_id)));
if (_t86.cls_id == 27) _t87 = sp_ActionDispatch_Session_include_p((sp_ActionDispatch_Session *)_t86.v.p, sp_box_str(sp_sprintf("id=\"%s\"", lv_id)));
if (_t86.cls_id == SP_BUILTIN_STR_ARRAY) _t87 = sp_StrArray_include((sp_StrArray *)_t86.v.p, sp_sprintf("id=\"%s\"", lv_id));
if (_t86.cls_id == SP_BUILTIN_STR_INT_HASH) _t87 = sp_StrIntHash_has_key((sp_StrIntHash *)_t86.v.p, sp_sprintf("id=\"%s\"", lv_id));
if (_t86.cls_id == SP_BUILTIN_STR_STR_HASH) _t87 = sp_StrStrHash_has_key((sp_StrStrHash *)_t86.v.p, sp_sprintf("id=\"%s\"", lv_id));
if (_t86.cls_id == SP_BUILTIN_STR_POLY_HASH) _t87 = sp_StrPolyHash_has_key((sp_StrPolyHash *)_t86.v.p, sp_sprintf("id=\"%s\"", lv_id));
}
if (!(_t87)) {
sp_raise(sp_sprintf("expected element with id %s in response body", sp_str_inspect(lv_id)));
}
} else {
if (sp_str_include(lv_selector, (&("\xff" ".")[1]))) {
sp_StrArray *_t88 = sp_str_split(lv_selector, (&("\xff" ".")[1]));
SP_GC_ROOT(_t88);
lv__tag = sp_StrArray_get(_t88, 0);
lv_cls = sp_StrArray_get(_t88, 1);
sp_RbVal _t89 = lv_body;
mrb_bool _t90 = FALSE;
if (_t89.tag == SP_TAG_STR) _t90 = sp_str_include(_t89.v.s, sp_sprintf("class=\"%s", lv_cls));
if (_t89.tag == SP_TAG_OBJ) {
if (_t89.cls_id == 26) _t90 = sp_ActionDispatch_Flash_include_p((sp_ActionDispatch_Flash *)_t89.v.p, sp_box_str(sp_sprintf("class=\"%s", lv_cls)));
if (_t89.cls_id == 27) _t90 = sp_ActionDispatch_Session_include_p((sp_ActionDispatch_Session *)_t89.v.p, sp_box_str(sp_sprintf("class=\"%s", lv_cls)));
if (_t89.cls_id == SP_BUILTIN_STR_ARRAY) _t90 = sp_StrArray_include((sp_StrArray *)_t89.v.p, sp_sprintf("class=\"%s", lv_cls));
if (_t89.cls_id == SP_BUILTIN_STR_INT_HASH) _t90 = sp_StrIntHash_has_key((sp_StrIntHash *)_t89.v.p, sp_sprintf("class=\"%s", lv_cls));
if (_t89.cls_id == SP_BUILTIN_STR_STR_HASH) _t90 = sp_StrStrHash_has_key((sp_StrStrHash *)_t89.v.p, sp_sprintf("class=\"%s", lv_cls));
if (_t89.cls_id == SP_BUILTIN_STR_POLY_HASH) _t90 = sp_StrPolyHash_has_key((sp_StrPolyHash *)_t89.v.p, sp_sprintf("class=\"%s", lv_cls));
}
sp_RbVal _t91 = lv_body;
mrb_int _t92 = 0;
if (_t91.tag == SP_TAG_OBJ) {
}
if (!((_t90 || _t92))) {
sp_raise(sp_sprintf("expected element with class %s in response body", sp_str_inspect(lv_cls)));
}
} else {
lv_tag = sp_str_sub_range(lv_selector, 0, 1);
sp_RbVal _t93 = lv_body;
mrb_bool _t94 = FALSE;
if (_t93.tag == SP_TAG_STR) _t94 = sp_str_include(_t93.v.s, sp_sprintf("<%s", lv_tag));
if (_t93.tag == SP_TAG_OBJ) {
if (_t93.cls_id == 26) _t94 = sp_ActionDispatch_Flash_include_p((sp_ActionDispatch_Flash *)_t93.v.p, sp_box_str(sp_sprintf("<%s", lv_tag)));
if (_t93.cls_id == 27) _t94 = sp_ActionDispatch_Session_include_p((sp_ActionDispatch_Session *)_t93.v.p, sp_box_str(sp_sprintf("<%s", lv_tag)));
if (_t93.cls_id == SP_BUILTIN_STR_ARRAY) _t94 = sp_StrArray_include((sp_StrArray *)_t93.v.p, sp_sprintf("<%s", lv_tag));
if (_t93.cls_id == SP_BUILTIN_STR_INT_HASH) _t94 = sp_StrIntHash_has_key((sp_StrIntHash *)_t93.v.p, sp_sprintf("<%s", lv_tag));
if (_t93.cls_id == SP_BUILTIN_STR_STR_HASH) _t94 = sp_StrStrHash_has_key((sp_StrStrHash *)_t93.v.p, sp_sprintf("<%s", lv_tag));
if (_t93.cls_id == SP_BUILTIN_STR_POLY_HASH) _t94 = sp_StrPolyHash_has_key((sp_StrPolyHash *)_t93.v.p, sp_sprintf("<%s", lv_tag));
}
if (!(((lv_tag != NULL) && _t94))) {
sp_raise(sp_sprintf("expected %s in response body", sp_str_inspect(lv_selector)));
}
}
}
}
if ((lv_block != NULL)) {
if (_block) _block(0, _benv);
else if (lv_block) sp_proc_call(lv_block, (mrb_int[]){0});
return 0;
} else {
return 0;
}
return 0;
}
SP_POOL_DEFINE(ApplicationController)
static inline sp_ApplicationController *sp_ApplicationController_new(void) {
SP_GC_SAVE();
sp_ApplicationController *self = SP_POOL_NEW(ApplicationController, sp_ApplicationController_gc_scan);
self->cls_id = 32LL;
SP_GC_ROOT(self);
self->iv_params = NULL;
self->iv_session = NULL;
self->iv_flash = NULL;
self->iv_body = sp_box_nil();
self->iv_location = NULL;
self->iv_content_type = NULL;
sp_ActionController_Base_initialize((sp_ActionController_Base *)self);
SP_GC_RESTORE();
return self;
}
SP_POOL_DEFINE(ApplicationRecord)
static inline sp_ApplicationRecord *sp_ApplicationRecord_new(sp_StrIntHash * lv__attrs) {
SP_GC_SAVE();
sp_ApplicationRecord *self = SP_POOL_NEW(ApplicationRecord, sp_ApplicationRecord_gc_scan);
self->cls_id = 33LL;
SP_GC_ROOT(self);
self->iv_id = sp_box_nil();
self->iv_errors = NULL;
sp_ActiveRecord_Base_initialize((sp_ActiveRecord_Base *)self, lv__attrs);
SP_GC_RESTORE();
return self;
}
static mrb_int sp_ApplicationRecord_cls_table_name(void) {
sp_raise_cls("NotImplementedError", sp_sprintf("%s.table_name must be overridden", sp_class_to_s(((sp_Class){33LL}))));
return 0;
return 0;
}
static mrb_int sp_ApplicationRecord_cls_schema_columns(void) {
sp_raise_cls("NotImplementedError", sp_sprintf("%s.schema_columns must be overridden", sp_class_to_s(((sp_Class){33LL}))));
return 0;
return 0;
}
SP_POOL_DEFINE(CommentRow)
static inline sp_CommentRow *sp_CommentRow_new(void) {
SP_GC_SAVE();
sp_CommentRow *self = SP_POOL_NEW(CommentRow, sp_CommentRow_gc_scan);
self->cls_id = 34LL;
SP_GC_ROOT(self);
self->iv_id = sp_box_nil();
self->iv_article_id = sp_box_nil();
self->iv_body = sp_box_nil();
self->iv_commenter = NULL;
self->iv_created_at = NULL;
self->iv_updated_at = NULL;
SP_GC_RESTORE();
return self;
}
static inline sp_RbVal sp_CommentRow_id(sp_CommentRow *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t95 = self->iv_id;
SP_GC_RESTORE();
return _t95;
return sp_box_nil();
}
static inline mrb_int sp_CommentRow_id_eq(sp_CommentRow *self, sp_RbVal lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_id = lv_value;
return 0;
return 0;
}
static inline sp_RbVal sp_CommentRow_article_id(sp_CommentRow *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t96 = self->iv_article_id;
SP_GC_RESTORE();
return _t96;
return sp_box_nil();
}
static inline mrb_int sp_CommentRow_article_id_eq(sp_CommentRow *self, sp_RbVal lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_article_id = lv_value;
return 0;
return 0;
}
static inline sp_RbVal sp_CommentRow_body(sp_CommentRow *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t97 = self->iv_body;
SP_GC_RESTORE();
return _t97;
return sp_box_nil();
}
static inline mrb_int sp_CommentRow_body_eq(sp_CommentRow *self, sp_RbVal lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_body = lv_value;
return 0;
return 0;
}
static inline const char * sp_CommentRow_commenter(sp_CommentRow *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return self->iv_commenter;
return (&("\xff")[1]);
}
static inline mrb_int sp_CommentRow_commenter_eq(sp_CommentRow *self, const char * lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
SP_GC_ROOT(lv_value);
self->iv_commenter = lv_value;
return 0;
return 0;
}
static inline const char * sp_CommentRow_created_at(sp_CommentRow *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return self->iv_created_at;
return (&("\xff")[1]);
}
static inline mrb_int sp_CommentRow_created_at_eq(sp_CommentRow *self, const char * lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
SP_GC_ROOT(lv_value);
self->iv_created_at = lv_value;
return 0;
return 0;
}
static inline const char * sp_CommentRow_updated_at(sp_CommentRow *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return self->iv_updated_at;
return (&("\xff")[1]);
}
static inline mrb_int sp_CommentRow_updated_at_eq(sp_CommentRow *self, const char * lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
SP_GC_ROOT(lv_value);
self->iv_updated_at = lv_value;
return 0;
return 0;
}
static sp_CommentRow * sp_CommentRow_cls_from_raw(mrb_int lv_row) {
SP_GC_SAVE();
sp_CommentRow * lv_instance = NULL;
SP_GC_ROOT(lv_instance);
lv_instance = sp_CommentRow_new();
mrb_int _t98 = 0;
sp_CommentRow_id_eq(lv_instance, sp_box_int((((_t98), TRUE) ? _t98 : 0LL)));
mrb_int _t99 = 0;
sp_CommentRow_article_id_eq(lv_instance, sp_box_int((((_t99), TRUE) ? _t99 : 0LL)));
sp_CommentRow_body_eq(lv_instance, sp_box_int(0));
sp_CommentRow_commenter_eq(lv_instance, sp_int_to_s(0));
sp_CommentRow_created_at_eq(lv_instance, sp_int_to_s(0));
sp_CommentRow_updated_at_eq(lv_instance, sp_int_to_s(0));
return lv_instance;
return NULL;
}
SP_POOL_DEFINE(Comment)
static inline sp_Comment *sp_Comment_new(sp_StrIntHash * lv_attrs) {
SP_GC_SAVE();
sp_Comment *self = SP_POOL_NEW(Comment, sp_Comment_gc_scan);
self->cls_id = 35LL;
SP_GC_ROOT(self);
self->iv_id = sp_box_nil();
self->iv_errors = NULL;
self->iv_article_id = sp_box_nil();
self->iv_body = sp_box_nil();
self->iv_commenter = sp_box_nil();
self->iv_created_at = sp_box_nil();
self->iv_updated_at = sp_box_nil();
SP_GC_ROOT(lv_attrs);
sp_ActiveRecord_Base_initialize((sp_ActiveRecord_Base *)self, NULL);
mrb_int _t100 = sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_id));
self->iv_id = sp_box_int((((_t100), TRUE) ? _t100 : 0LL));
mrb_int _t101 = sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_article_id));
sp_Comment_article_id_eq(self, sp_box_int((((_t101), TRUE) ? _t101 : 0LL)));
sp_Comment_body_eq(self, sp_box_int(sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_body))));
sp_Comment_commenter_eq(self, sp_box_int(sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_commenter))));
sp_Comment_created_at_eq(self, sp_box_int(sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_created_at))));
sp_Comment_updated_at_eq(self, sp_box_int(sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_updated_at))));
SP_GC_RESTORE();
return self;
}
static inline void sp_Comment_initialize(sp_Comment *self, sp_StrIntHash * lv_attrs) {
mrb_int _t102 = sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_id));
self->iv_id = sp_box_int((((_t102), TRUE) ? _t102 : 0LL));
mrb_int _t103 = sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_article_id));
sp_Comment_article_id_eq(self, sp_box_int((((_t103), TRUE) ? _t103 : 0LL)));
sp_Comment_body_eq(self, sp_box_int(sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_body))));
sp_Comment_commenter_eq(self, sp_box_int(sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_commenter))));
sp_Comment_created_at_eq(self, sp_box_int(sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_created_at))));
sp_Comment_updated_at_eq(self, sp_box_int(sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_updated_at))));
}
static inline sp_RbVal sp_Comment_id(sp_Comment *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t104 = self->iv_id;
SP_GC_RESTORE();
return _t104;
return sp_box_nil();
}
static inline mrb_int sp_Comment_id_eq(sp_Comment *self, sp_RbVal lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_id = lv_value;
return 0;
return 0;
}
static inline sp_RbVal sp_Comment_article_id(sp_Comment *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t105 = self->iv_article_id;
SP_GC_RESTORE();
return _t105;
return sp_box_nil();
}
static inline mrb_int sp_Comment_article_id_eq(sp_Comment *self, sp_RbVal lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_article_id = lv_value;
return 0;
return 0;
}
static inline sp_RbVal sp_Comment_body(sp_Comment *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t106 = self->iv_body;
SP_GC_RESTORE();
return _t106;
return sp_box_nil();
}
static inline mrb_int sp_Comment_body_eq(sp_Comment *self, sp_RbVal lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_body = lv_value;
return 0;
return 0;
}
static inline sp_RbVal sp_Comment_commenter(sp_Comment *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t107 = self->iv_commenter;
SP_GC_RESTORE();
return _t107;
return sp_box_nil();
}
static inline mrb_int sp_Comment_commenter_eq(sp_Comment *self, sp_RbVal lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_commenter = lv_value;
return 0;
return 0;
}
static inline sp_RbVal sp_Comment_created_at(sp_Comment *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t108 = self->iv_created_at;
SP_GC_RESTORE();
return _t108;
return sp_box_nil();
}
static inline mrb_int sp_Comment_created_at_eq(sp_Comment *self, sp_RbVal lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_created_at = lv_value;
return 0;
return 0;
}
static inline sp_RbVal sp_Comment_updated_at(sp_Comment *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t109 = self->iv_updated_at;
SP_GC_RESTORE();
return _t109;
return sp_box_nil();
}
static inline mrb_int sp_Comment_updated_at_eq(sp_Comment *self, sp_RbVal lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_updated_at = lv_value;
return 0;
return 0;
}
static mrb_int sp_Comment_assign_from_row(sp_Comment *self, sp_StrPolyHash * lv_row) {
SP_GC_SAVE();
SP_GC_ROOT(self);
SP_GC_ROOT(lv_row);
self->iv_id = sp_StrPolyHash_get(lv_row, (&("\xff" "id")[1]));
sp_Comment_article_id_eq(self, sp_StrPolyHash_get(lv_row, (&("\xff" "article_id")[1])));
sp_Comment_body_eq(self, sp_StrPolyHash_get(lv_row, (&("\xff" "body")[1])));
sp_Comment_commenter_eq(self, sp_StrPolyHash_get(lv_row, (&("\xff" "commenter")[1])));
sp_Comment_created_at_eq(self, sp_StrPolyHash_get(lv_row, (&("\xff" "created_at")[1])));
sp_Comment_updated_at_eq(self, sp_StrPolyHash_get(lv_row, (&("\xff" "updated_at")[1])));
return 0;
return 0;
}
static inline sp_RbVal sp_Comment_attributes(sp_Comment *self) {
return sp_box_nil();
}
static inline sp_RbVal sp_Comment__aref(sp_Comment *self, sp_RbVal lv_name) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t110 = lv_name;
if ((_t110.tag == SP_TAG_SYM && _t110.v.i == SPS_id)) {
sp_RbVal _t111 = self->iv_id;
SP_GC_RESTORE();
return _t111;
} else if ((_t110.tag == SP_TAG_SYM && _t110.v.i == SPS_article_id)) {
sp_RbVal _t112 = self->iv_article_id;
SP_GC_RESTORE();
return _t112;
} else if ((_t110.tag == SP_TAG_SYM && _t110.v.i == SPS_body)) {
sp_RbVal _t113 = self->iv_body;
SP_GC_RESTORE();
return _t113;
} else if ((_t110.tag == SP_TAG_SYM && _t110.v.i == SPS_commenter)) {
sp_RbVal _t114 = self->iv_commenter;
SP_GC_RESTORE();
return _t114;
} else if ((_t110.tag == SP_TAG_SYM && _t110.v.i == SPS_created_at)) {
sp_RbVal _t115 = self->iv_created_at;
SP_GC_RESTORE();
return _t115;
} else if ((_t110.tag == SP_TAG_SYM && _t110.v.i == SPS_updated_at)) {
sp_RbVal _t116 = self->iv_updated_at;
SP_GC_RESTORE();
return _t116;
}
return sp_box_nil();
}
static inline mrb_int sp_Comment__aset(sp_Comment *self, sp_sym lv_name, sp_RbVal lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
mrb_int _t117 = lv_name;
if (_t117 == SPS_id) {
self->iv_id = lv_value;
return 0;
} else if (_t117 == SPS_article_id) {
self->iv_article_id = lv_value;
return 0;
} else if (_t117 == SPS_body) {
self->iv_body = lv_value;
return 0;
} else if (_t117 == SPS_commenter) {
self->iv_commenter = lv_value;
return 0;
} else if (_t117 == SPS_created_at) {
self->iv_created_at = lv_value;
return 0;
} else if (_t117 == SPS_updated_at) {
self->iv_updated_at = lv_value;
return 0;
}
return 0;
}
static inline mrb_bool sp_Comment_update(sp_Comment *self, sp_CommentRow * lv_p) {
SP_GC_SAVE();
SP_GC_ROOT(self);
SP_GC_ROOT(lv_p);
const char * _t118 = lv_p->iv_commenter;
SP_GC_ROOT(_t118);
if ((_t118 == NULL)) {
} else {
sp_Comment_commenter_eq(self, sp_box_str(lv_p->iv_commenter));
}
if (sp_poly_nil_p(lv_p->iv_body)) {
} else {
sp_Comment_body_eq(self, lv_p->iv_body);
}
return sp_ActiveRecord_Base_save((sp_ActiveRecord_Base *)self);
return FALSE;
}
static inline mrb_int sp_Comment__adapter_insert(sp_Comment *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
const char * _t119 = (&("\xff" "INSERT INTO comments (article_id, body, commenter, created_at, updated_at) VALUES (")[1]);
SP_GC_ROOT(_t119);
const char * _t120 = sp_Db_cls_escape_int(self->iv_article_id);
SP_GC_ROOT(_t120);
const char * _t121 = (&("\xff" ", ")[1]);
SP_GC_ROOT(_t121);
const char * _t122 = sp_Db_cls_escape_string(self->iv_body);
SP_GC_ROOT(_t122);
const char * _t123 = (&("\xff" ", ")[1]);
SP_GC_ROOT(_t123);
const char * _t124 = sp_Db_cls_escape_string(self->iv_commenter);
SP_GC_ROOT(_t124);
const char * _t125 = (&("\xff" ", ")[1]);
SP_GC_ROOT(_t125);
const char * _t126 = sp_Db_cls_escape_string(self->iv_created_at);
SP_GC_ROOT(_t126);
const char * _t127 = (&("\xff" ", ")[1]);
SP_GC_ROOT(_t127);
const char * _t128 = sp_Db_cls_escape_string(self->iv_updated_at);
SP_GC_ROOT(_t128);
const char * _t129 = (&("\xff" ")")[1]);
SP_GC_ROOT(_t129);
sp_Db_cls_exec(sp_str_concat_arr((const char *const[]){_t119, _t120, _t121, _t122, _t123, _t124, _t125, _t126, _t127, _t128, _t129}, 11));
return sp_Db_cls_last_insert_rowid();
return 0;
}
static inline mrb_int sp_Comment__adapter_update(sp_Comment *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
const char * _t130 = (&("\xff" "UPDATE comments SET ")[1]);
SP_GC_ROOT(_t130);
const char * _t131 = (&("\xff" "article_id = ")[1]);
SP_GC_ROOT(_t131);
const char * _t132 = sp_Db_cls_escape_int(self->iv_article_id);
SP_GC_ROOT(_t132);
const char * _t133 = (&("\xff" ", body = ")[1]);
SP_GC_ROOT(_t133);
const char * _t134 = sp_Db_cls_escape_string(self->iv_body);
SP_GC_ROOT(_t134);
const char * _t135 = (&("\xff" ", commenter = ")[1]);
SP_GC_ROOT(_t135);
const char * _t136 = sp_Db_cls_escape_string(self->iv_commenter);
SP_GC_ROOT(_t136);
const char * _t137 = (&("\xff" ", created_at = ")[1]);
SP_GC_ROOT(_t137);
const char * _t138 = sp_Db_cls_escape_string(self->iv_created_at);
SP_GC_ROOT(_t138);
const char * _t139 = (&("\xff" ", updated_at = ")[1]);
SP_GC_ROOT(_t139);
const char * _t140 = sp_Db_cls_escape_string(self->iv_updated_at);
SP_GC_ROOT(_t140);
const char * _t141 = (&("\xff" " WHERE ")[1]);
SP_GC_ROOT(_t141);
const char * _t142 = (&("\xff" "id = ")[1]);
SP_GC_ROOT(_t142);
const char * _t143 = sp_Db_cls_escape_int(self->iv_id);
SP_GC_ROOT(_t143);
return sp_Db_cls_exec(sp_str_concat_arr((const char *const[]){_t130, _t131, _t132, _t133, _t134, _t135, _t136, _t137, _t138, _t139, _t140, _t141, _t142, _t143}, 14));
return 0;
}
static inline mrb_int sp_Comment__adapter_delete(sp_Comment *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return sp_Db_cls_exec(sp_str_concat4((&("\xff" "DELETE FROM comments")[1]), (&("\xff" " WHERE ")[1]), (&("\xff" "id = ")[1]), sp_Db_cls_escape_int(self->iv_id)));
return 0;
}
static sp_RbVal sp_Comment__adapter_reload(sp_Comment *self) {
SP_GC_SAVE();
void * lv_stmt = NULL;
sp_Comment * lv_result = NULL;
SP_GC_ROOT(lv_result);
SP_GC_ROOT(self);
lv_stmt = sp_Db_cls_prepare(sp_str_concat3((&("\xff" "SELECT id, article_id, body, commenter, created_at, updated_at FROM comments WHERE id = ")[1]), sp_Db_cls_escape_int(self->iv_id), (&("\xff" " LIMIT 1")[1])));
lv_result = NULL;
if (sp_Db_cls_step_p(lv_stmt)) {
self->iv_id = sp_box_int(sp_Db_cls_column_int(lv_stmt, 0LL));
self->iv_article_id = sp_box_int(sp_Db_cls_column_int(lv_stmt, 1LL));
self->iv_body = sp_box_str(sp_Db_cls_column_text(lv_stmt, 2LL));
self->iv_commenter = sp_box_str(sp_Db_cls_column_text(lv_stmt, 3LL));
self->iv_created_at = sp_box_str(sp_Db_cls_column_text(lv_stmt, 4LL));
self->iv_updated_at = sp_box_str(sp_Db_cls_column_text(lv_stmt, 5LL));
sp_ActiveRecord_Base_mark_persisted_bang((sp_ActiveRecord_Base *)self);
lv_result = self;
}
sp_Db_cls_finalize(lv_stmt);
sp_RbVal _t144 = sp_box_obj(lv_result, 35);
SP_GC_RESTORE();
return _t144;
return sp_box_nil();
}
static inline sp_StrArray * sp_Comment_validate(sp_Comment *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t145 = self->iv_commenter;
mrb_bool _t146 = FALSE;
if (_t145.tag == SP_TAG_STR) _t146 = (sp_str_length(_t145.v.s) == 0);
if (_t145.tag == SP_TAG_OBJ) {
if (_t145.cls_id == 26) _t146 = sp_ActionDispatch_Flash_empty_p((sp_ActionDispatch_Flash *)_t145.v.p);
if (_t145.cls_id == 27) _t146 = sp_ActionDispatch_Session_empty_p((sp_ActionDispatch_Session *)_t145.v.p);
if (_t145.cls_id == SP_BUILTIN_INT_ARRAY) _t146 = (sp_IntArray_length((sp_IntArray *)_t145.v.p) == 0);
if (_t145.cls_id == SP_BUILTIN_FLT_ARRAY) _t146 = (sp_FloatArray_length((sp_FloatArray *)_t145.v.p) == 0);
if (_t145.cls_id == SP_BUILTIN_STR_ARRAY) _t146 = (sp_StrArray_length((sp_StrArray *)_t145.v.p) == 0);
if (_t145.cls_id == SP_BUILTIN_SYM_ARRAY) _t146 = (sp_IntArray_length((sp_IntArray *)_t145.v.p) == 0);
if (_t145.cls_id == SP_BUILTIN_PTR_ARRAY) _t146 = (sp_PtrArray_length((sp_PtrArray *)_t145.v.p) == 0);
if (_t145.cls_id == SP_BUILTIN_POLY_ARRAY) _t146 = (sp_PolyArray_length((sp_PolyArray *)_t145.v.p) == 0);
if (_t145.cls_id == SP_BUILTIN_STR_INT_HASH) _t146 = (sp_StrIntHash_length((sp_StrIntHash *)_t145.v.p) == 0);
if (_t145.cls_id == SP_BUILTIN_STR_STR_HASH) _t146 = (sp_StrStrHash_length((sp_StrStrHash *)_t145.v.p) == 0);
if (_t145.cls_id == SP_BUILTIN_INT_STR_HASH) _t146 = (sp_IntStrHash_length((sp_IntStrHash *)_t145.v.p) == 0);
if (_t145.cls_id == SP_BUILTIN_STR_POLY_HASH) _t146 = (sp_StrPolyHash_length((sp_StrPolyHash *)_t145.v.p) == 0);
if (_t145.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t146 = (sp_SymPolyHash_length((sp_SymPolyHash *)_t145.v.p) == 0);
if (_t145.cls_id == SP_BUILTIN_POLY_POLY_HASH) _t146 = (sp_PolyPolyHash_length((sp_PolyPolyHash *)_t145.v.p) == 0);
}
if ((sp_poly_nil_p(self->iv_commenter) || _t146)) {
sp_StrArray * _t147 = sp_ActiveRecord_Base_errors((sp_ActiveRecord_Base *)self);
SP_GC_ROOT(_t147);
sp_StrArray_push(_t147, (&("\xff" "commenter can't be blank")[1]));
}
sp_RbVal _t148 = self->iv_body;
mrb_bool _t149 = FALSE;
if (_t148.tag == SP_TAG_STR) _t149 = (sp_str_length(_t148.v.s) == 0);
if (_t148.tag == SP_TAG_OBJ) {
if (_t148.cls_id == 26) _t149 = sp_ActionDispatch_Flash_empty_p((sp_ActionDispatch_Flash *)_t148.v.p);
if (_t148.cls_id == 27) _t149 = sp_ActionDispatch_Session_empty_p((sp_ActionDispatch_Session *)_t148.v.p);
if (_t148.cls_id == SP_BUILTIN_INT_ARRAY) _t149 = (sp_IntArray_length((sp_IntArray *)_t148.v.p) == 0);
if (_t148.cls_id == SP_BUILTIN_FLT_ARRAY) _t149 = (sp_FloatArray_length((sp_FloatArray *)_t148.v.p) == 0);
if (_t148.cls_id == SP_BUILTIN_STR_ARRAY) _t149 = (sp_StrArray_length((sp_StrArray *)_t148.v.p) == 0);
if (_t148.cls_id == SP_BUILTIN_SYM_ARRAY) _t149 = (sp_IntArray_length((sp_IntArray *)_t148.v.p) == 0);
if (_t148.cls_id == SP_BUILTIN_PTR_ARRAY) _t149 = (sp_PtrArray_length((sp_PtrArray *)_t148.v.p) == 0);
if (_t148.cls_id == SP_BUILTIN_POLY_ARRAY) _t149 = (sp_PolyArray_length((sp_PolyArray *)_t148.v.p) == 0);
if (_t148.cls_id == SP_BUILTIN_STR_INT_HASH) _t149 = (sp_StrIntHash_length((sp_StrIntHash *)_t148.v.p) == 0);
if (_t148.cls_id == SP_BUILTIN_STR_STR_HASH) _t149 = (sp_StrStrHash_length((sp_StrStrHash *)_t148.v.p) == 0);
if (_t148.cls_id == SP_BUILTIN_INT_STR_HASH) _t149 = (sp_IntStrHash_length((sp_IntStrHash *)_t148.v.p) == 0);
if (_t148.cls_id == SP_BUILTIN_STR_POLY_HASH) _t149 = (sp_StrPolyHash_length((sp_StrPolyHash *)_t148.v.p) == 0);
if (_t148.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t149 = (sp_SymPolyHash_length((sp_SymPolyHash *)_t148.v.p) == 0);
if (_t148.cls_id == SP_BUILTIN_POLY_POLY_HASH) _t149 = (sp_PolyPolyHash_length((sp_PolyPolyHash *)_t148.v.p) == 0);
}
if ((sp_poly_nil_p(self->iv_body) || _t149)) {
sp_StrArray * _t150 = sp_ActiveRecord_Base_errors((sp_ActiveRecord_Base *)self);
SP_GC_ROOT(_t150);
sp_StrArray_push(_t150, (&("\xff" "body can't be blank")[1]));
}
if (((sp_poly_nil_p(self->iv_article_id) || sp_poly_eq(self->iv_article_id, sp_box_int(0LL))) || (!sp_Article_cls_exists_p(self->iv_article_id)))) {
sp_StrArray * _t151 = sp_ActiveRecord_Base_errors((sp_ActiveRecord_Base *)self);
SP_GC_ROOT(_t151);
return (sp_StrArray_push(_t151, (&("\xff" "article must exist")[1])), _t151);
} else {
return NULL;
}
return NULL;
}
static inline sp_Article * sp_Comment_article(sp_Comment *self) {
SP_GC_SAVE();
void * lv_stmt = NULL;
sp_Article * lv_result = NULL;
sp_Article * lv_instance = NULL;
SP_GC_ROOT(lv_result);
SP_GC_ROOT(lv_instance);
SP_GC_ROOT(self);
if (sp_poly_eq(self->iv_article_id, sp_box_int(0LL))) {
return 0;
} else {
const char * _t152 = (&("\xff" "SELECT id, body, created_at, title, updated_at FROM articles")[1]);
SP_GC_ROOT(_t152);
const char * _t153 = (&("\xff" " WHERE ")[1]);
SP_GC_ROOT(_t153);
const char * _t154 = (&("\xff" "id = ")[1]);
SP_GC_ROOT(_t154);
const char * _t155 = sp_Db_cls_escape_int(self->iv_article_id);
SP_GC_ROOT(_t155);
const char * _t156 = (&("\xff" " LIMIT 1")[1]);
SP_GC_ROOT(_t156);
lv_stmt = sp_Db_cls_prepare(sp_str_concat_arr((const char *const[]){_t152, _t153, _t154, _t155, _t156}, 5));
lv_result = NULL;
if (sp_Db_cls_step_p(lv_stmt)) {
lv_instance = sp_Article_new(sp_StrIntHash_new());
lv_instance->iv_id = sp_box_int(sp_Db_cls_column_int(lv_stmt, 0LL));
sp_Article_body_eq(lv_instance, sp_box_str(sp_Db_cls_column_text(lv_stmt, 1LL)));
sp_Article_created_at_eq(lv_instance, sp_box_str(sp_Db_cls_column_text(lv_stmt, 2LL)));
sp_Article_title_eq(lv_instance, sp_box_str(sp_Db_cls_column_text(lv_stmt, 3LL)));
sp_Article_updated_at_eq(lv_instance, sp_box_str(sp_Db_cls_column_text(lv_stmt, 4LL)));
sp_ActiveRecord_Base_mark_persisted_bang((sp_ActiveRecord_Base *)lv_instance);
lv_result = lv_instance;
}
sp_Db_cls_finalize(lv_stmt);
return lv_result;
}
return NULL;
}
static inline const char * sp_Comment_dom_prefix(sp_Comment *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return (&("\xff" "comment")[1]);
return (&("\xff")[1]);
}
static mrb_int sp_Comment_after_create_commit(sp_Comment *self) {
SP_GC_SAVE();
sp_Article * lv_parent = NULL;
SP_GC_ROOT(lv_parent);
SP_GC_ROOT(self);
sp_Broadcasts_cls_append(sp_sprintf("article_%s_comments", sp_poly_to_s(self->iv_article_id)), (&("\xff" "comments")[1]), sp_Views_Comments_cls_comment(sp_box_obj(self, 35), 0, 0));
lv_parent = sp_Comment_article(self);
if ((lv_parent == NULL)) {
SP_GC_RESTORE();
return 0;
}
return sp_Broadcasts_cls_replace((&("\xff" "articles")[1]), sp_sprintf("article_%s", sp_poly_to_s(lv_parent->iv_id)), sp_Views_Articles_cls_article((sp_Article *)lv_parent, 0, 0));
return 0;
}
static inline mrb_int sp_Comment_after_update_commit(sp_Comment *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return sp_Broadcasts_cls_replace(sp_sprintf("article_%s_comments", sp_poly_to_s(self->iv_article_id)), sp_sprintf("comment_%s", sp_poly_to_s(self->iv_id)), sp_Views_Comments_cls_comment(sp_box_obj(self, 35), 0, 0));
return 0;
}
static mrb_int sp_Comment_after_destroy_commit(sp_Comment *self) {
SP_GC_SAVE();
sp_Article * lv_parent = NULL;
SP_GC_ROOT(lv_parent);
SP_GC_ROOT(self);
sp_Broadcasts_cls_remove(sp_sprintf("article_%s_comments", sp_poly_to_s(self->iv_article_id)), sp_sprintf("comment_%s", sp_poly_to_s(self->iv_id)));
lv_parent = sp_Comment_article(self);
if ((lv_parent == NULL)) {
SP_GC_RESTORE();
return 0;
}
return sp_Broadcasts_cls_replace((&("\xff" "articles")[1]), sp_sprintf("article_%s", sp_poly_to_s(lv_parent->iv_id)), sp_Views_Articles_cls_article((sp_Article *)lv_parent, 0, 0));
return 0;
}
static const char * sp_Comment_cls_table_name(void) {
return (&("\xff" "comments")[1]);
return (&("\xff")[1]);
}
static sp_IntArray * sp_Comment_cls_schema_columns(void) {
sp_IntArray *_t157 = sp_IntArray_new();
sp_IntArray_push(_t157, SPS_id);
sp_IntArray_push(_t157, SPS_article_id);
sp_IntArray_push(_t157, SPS_body);
sp_IntArray_push(_t157, SPS_commenter);
sp_IntArray_push(_t157, SPS_created_at);
sp_IntArray_push(_t157, SPS_updated_at);
return _t157;
return NULL;
}
static sp_Comment * sp_Comment_cls_from_row(sp_CommentRow * lv_row) {
SP_GC_SAVE();
sp_Comment * lv_instance = NULL;
SP_GC_ROOT(lv_instance);
lv_instance = sp_Comment_new(sp_StrIntHash_new());
lv_instance->iv_id = lv_row->iv_id;
sp_Comment_article_id_eq(lv_instance, lv_row->iv_article_id);
sp_Comment_body_eq(lv_instance, lv_row->iv_body);
sp_Comment_commenter_eq(lv_instance, sp_box_str(lv_row->iv_commenter));
sp_Comment_created_at_eq(lv_instance, sp_box_str(lv_row->iv_created_at));
sp_Comment_updated_at_eq(lv_instance, sp_box_str(lv_row->iv_updated_at));
return lv_instance;
return NULL;
}
static sp_Comment * sp_Comment_cls__adapter_find_by_id(mrb_int lv_id) {
SP_GC_SAVE();
void * lv_stmt = NULL;
sp_Comment * lv_result = NULL;
sp_Comment * lv_instance = NULL;
SP_GC_ROOT(lv_result);
SP_GC_ROOT(lv_instance);
const char * _t158 = (&("\xff" "SELECT id, article_id, body, commenter, created_at, updated_at FROM comments")[1]);
SP_GC_ROOT(_t158);
const char * _t159 = (&("\xff" " WHERE ")[1]);
SP_GC_ROOT(_t159);
const char * _t160 = (&("\xff" "id = ")[1]);
SP_GC_ROOT(_t160);
const char * _t161 = sp_Db_cls_escape_int(sp_box_int(lv_id));
SP_GC_ROOT(_t161);
const char * _t162 = (&("\xff" " LIMIT 1")[1]);
SP_GC_ROOT(_t162);
lv_stmt = sp_Db_cls_prepare(sp_str_concat_arr((const char *const[]){_t158, _t159, _t160, _t161, _t162}, 5));
lv_result = NULL;
if (sp_Db_cls_step_p(lv_stmt)) {
lv_instance = sp_Comment_new(sp_StrIntHash_new());
lv_instance->iv_id = sp_box_int(sp_Db_cls_column_int(lv_stmt, 0LL));
sp_Comment_article_id_eq(lv_instance, sp_box_int(sp_Db_cls_column_int(lv_stmt, 1LL)));
sp_Comment_body_eq(lv_instance, sp_box_str(sp_Db_cls_column_text(lv_stmt, 2LL)));
sp_Comment_commenter_eq(lv_instance, sp_box_str(sp_Db_cls_column_text(lv_stmt, 3LL)));
sp_Comment_created_at_eq(lv_instance, sp_box_str(sp_Db_cls_column_text(lv_stmt, 4LL)));
sp_Comment_updated_at_eq(lv_instance, sp_box_str(sp_Db_cls_column_text(lv_stmt, 5LL)));
sp_ActiveRecord_Base_mark_persisted_bang((sp_ActiveRecord_Base *)lv_instance);
lv_result = lv_instance;
}
sp_Db_cls_finalize(lv_stmt);
return lv_result;
return NULL;
}
static mrb_int sp_Comment_cls__adapter_truncate(void) {
sp_Db_cls_exec((&("\xff" "DELETE FROM comments")[1]));
return sp_Db_cls_exec((&("\xff" "DELETE FROM sqlite_sequence WHERE name = 'comments'")[1]));
return 0;
}
static sp_Comment * sp_Comment_cls_from_params(sp_CommentParams * lv_p) {
SP_GC_SAVE();
sp_Comment * lv_instance = NULL;
SP_GC_ROOT(lv_instance);
lv_instance = sp_Comment_new(sp_StrIntHash_new());
sp_Comment_commenter_eq(lv_instance, lv_p->iv_commenter);
sp_Comment_body_eq(lv_instance, lv_p->iv_body);
return lv_instance;
return NULL;
}
static sp_Comment * sp_Comment_cls_find(mrb_int lv_id) {
SP_GC_SAVE();
sp_Comment * lv_result = NULL;
SP_GC_ROOT(lv_result);
lv_result = sp_Comment_cls__adapter_find_by_id(lv_id);
if ((lv_result == NULL)) {
sp_raise_cls("RecordNotFound", sp_sprintf("Couldn't find %s with id=%lld", sp_class_to_s(((sp_Class){35LL})), (long long)lv_id));
}
return lv_result;
return NULL;
}
SP_POOL_DEFINE(ArticleRow)
static inline sp_ArticleRow *sp_ArticleRow_new(void) {
SP_GC_SAVE();
sp_ArticleRow *self = SP_POOL_NEW(ArticleRow, sp_ArticleRow_gc_scan);
self->cls_id = 36LL;
SP_GC_ROOT(self);
self->iv_id = sp_box_nil();
self->iv_body = sp_box_nil();
self->iv_created_at = NULL;
self->iv_title = NULL;
self->iv_updated_at = NULL;
SP_GC_RESTORE();
return self;
}
static inline sp_RbVal sp_ArticleRow_id(sp_ArticleRow *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t163 = self->iv_id;
SP_GC_RESTORE();
return _t163;
return sp_box_nil();
}
static inline mrb_int sp_ArticleRow_id_eq(sp_ArticleRow *self, sp_RbVal lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_id = lv_value;
return 0;
return 0;
}
static inline sp_RbVal sp_ArticleRow_body(sp_ArticleRow *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t164 = self->iv_body;
SP_GC_RESTORE();
return _t164;
return sp_box_nil();
}
static inline mrb_int sp_ArticleRow_body_eq(sp_ArticleRow *self, sp_RbVal lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_body = lv_value;
return 0;
return 0;
}
static inline const char * sp_ArticleRow_created_at(sp_ArticleRow *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return self->iv_created_at;
return (&("\xff")[1]);
}
static inline mrb_int sp_ArticleRow_created_at_eq(sp_ArticleRow *self, const char * lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
SP_GC_ROOT(lv_value);
self->iv_created_at = lv_value;
return 0;
return 0;
}
static inline const char * sp_ArticleRow_title(sp_ArticleRow *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return self->iv_title;
return (&("\xff")[1]);
}
static inline mrb_int sp_ArticleRow_title_eq(sp_ArticleRow *self, const char * lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
SP_GC_ROOT(lv_value);
self->iv_title = lv_value;
return 0;
return 0;
}
static inline const char * sp_ArticleRow_updated_at(sp_ArticleRow *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return self->iv_updated_at;
return (&("\xff")[1]);
}
static inline mrb_int sp_ArticleRow_updated_at_eq(sp_ArticleRow *self, const char * lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
SP_GC_ROOT(lv_value);
self->iv_updated_at = lv_value;
return 0;
return 0;
}
static sp_ArticleRow * sp_ArticleRow_cls_from_raw(mrb_int lv_row) {
SP_GC_SAVE();
sp_ArticleRow * lv_instance = NULL;
SP_GC_ROOT(lv_instance);
lv_instance = sp_ArticleRow_new();
mrb_int _t165 = 0;
sp_ArticleRow_id_eq(lv_instance, sp_box_int((((_t165), TRUE) ? _t165 : 0LL)));
sp_ArticleRow_body_eq(lv_instance, sp_box_int(0));
sp_ArticleRow_created_at_eq(lv_instance, sp_int_to_s(0));
sp_ArticleRow_title_eq(lv_instance, sp_int_to_s(0));
sp_ArticleRow_updated_at_eq(lv_instance, sp_int_to_s(0));
return lv_instance;
return NULL;
}
SP_POOL_DEFINE(Article)
static inline sp_Article *sp_Article_new(sp_StrIntHash * lv_attrs) {
SP_GC_SAVE();
sp_Article *self = SP_POOL_NEW(Article, sp_Article_gc_scan);
self->cls_id = 37LL;
SP_GC_ROOT(self);
self->iv_id = sp_box_nil();
self->iv_errors = NULL;
self->iv_body = sp_box_nil();
self->iv_created_at = sp_box_nil();
self->iv_title = sp_box_nil();
self->iv_updated_at = sp_box_nil();
SP_GC_ROOT(lv_attrs);
sp_ActiveRecord_Base_initialize((sp_ActiveRecord_Base *)self, NULL);
mrb_int _t166 = sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_id));
self->iv_id = sp_box_int((((_t166), TRUE) ? _t166 : 0LL));
sp_Article_body_eq(self, sp_box_int(sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_body))));
sp_Article_created_at_eq(self, sp_box_int(sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_created_at))));
sp_Article_title_eq(self, sp_box_int(sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_title))));
sp_Article_updated_at_eq(self, sp_box_int(sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_updated_at))));
SP_GC_RESTORE();
return self;
}
static inline void sp_Article_initialize(sp_Article *self, sp_StrIntHash * lv_attrs) {
mrb_int _t167 = sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_id));
self->iv_id = sp_box_int((((_t167), TRUE) ? _t167 : 0LL));
sp_Article_body_eq(self, sp_box_int(sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_body))));
sp_Article_created_at_eq(self, sp_box_int(sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_created_at))));
sp_Article_title_eq(self, sp_box_int(sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_title))));
sp_Article_updated_at_eq(self, sp_box_int(sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_updated_at))));
}
static inline sp_RbVal sp_Article_id(sp_Article *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t168 = self->iv_id;
SP_GC_RESTORE();
return _t168;
return sp_box_nil();
}
static inline mrb_int sp_Article_id_eq(sp_Article *self, sp_RbVal lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_id = lv_value;
return 0;
return 0;
}
static inline sp_RbVal sp_Article_body(sp_Article *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t169 = self->iv_body;
SP_GC_RESTORE();
return _t169;
return sp_box_nil();
}
static inline mrb_int sp_Article_body_eq(sp_Article *self, sp_RbVal lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_body = lv_value;
return 0;
return 0;
}
static inline sp_RbVal sp_Article_created_at(sp_Article *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t170 = self->iv_created_at;
SP_GC_RESTORE();
return _t170;
return sp_box_nil();
}
static inline mrb_int sp_Article_created_at_eq(sp_Article *self, sp_RbVal lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_created_at = lv_value;
return 0;
return 0;
}
static inline sp_RbVal sp_Article_title(sp_Article *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t171 = self->iv_title;
SP_GC_RESTORE();
return _t171;
return sp_box_nil();
}
static inline mrb_int sp_Article_title_eq(sp_Article *self, sp_RbVal lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_title = lv_value;
return 0;
return 0;
}
static inline sp_RbVal sp_Article_updated_at(sp_Article *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t172 = self->iv_updated_at;
SP_GC_RESTORE();
return _t172;
return sp_box_nil();
}
static inline mrb_int sp_Article_updated_at_eq(sp_Article *self, sp_RbVal lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_updated_at = lv_value;
return 0;
return 0;
}
static mrb_int sp_Article_assign_from_row(sp_Article *self, sp_StrPolyHash * lv_row) {
SP_GC_SAVE();
SP_GC_ROOT(self);
SP_GC_ROOT(lv_row);
self->iv_id = sp_StrPolyHash_get(lv_row, (&("\xff" "id")[1]));
sp_Article_body_eq(self, sp_StrPolyHash_get(lv_row, (&("\xff" "body")[1])));
sp_Article_created_at_eq(self, sp_StrPolyHash_get(lv_row, (&("\xff" "created_at")[1])));
sp_Article_title_eq(self, sp_StrPolyHash_get(lv_row, (&("\xff" "title")[1])));
sp_Article_updated_at_eq(self, sp_StrPolyHash_get(lv_row, (&("\xff" "updated_at")[1])));
return 0;
return 0;
}
static inline sp_RbVal sp_Article_attributes(sp_Article *self) {
return sp_box_nil();
}
static inline sp_RbVal sp_Article__aref(sp_Article *self, sp_RbVal lv_name) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t173 = lv_name;
if ((_t173.tag == SP_TAG_SYM && _t173.v.i == SPS_id)) {
sp_RbVal _t174 = self->iv_id;
SP_GC_RESTORE();
return _t174;
} else if ((_t173.tag == SP_TAG_SYM && _t173.v.i == SPS_body)) {
sp_RbVal _t175 = self->iv_body;
SP_GC_RESTORE();
return _t175;
} else if ((_t173.tag == SP_TAG_SYM && _t173.v.i == SPS_created_at)) {
sp_RbVal _t176 = self->iv_created_at;
SP_GC_RESTORE();
return _t176;
} else if ((_t173.tag == SP_TAG_SYM && _t173.v.i == SPS_title)) {
sp_RbVal _t177 = self->iv_title;
SP_GC_RESTORE();
return _t177;
} else if ((_t173.tag == SP_TAG_SYM && _t173.v.i == SPS_updated_at)) {
sp_RbVal _t178 = self->iv_updated_at;
SP_GC_RESTORE();
return _t178;
}
return sp_box_nil();
}
static inline mrb_int sp_Article__aset(sp_Article *self, sp_sym lv_name, sp_RbVal lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
mrb_int _t179 = lv_name;
if (_t179 == SPS_id) {
self->iv_id = lv_value;
return 0;
} else if (_t179 == SPS_body) {
self->iv_body = lv_value;
return 0;
} else if (_t179 == SPS_created_at) {
self->iv_created_at = lv_value;
return 0;
} else if (_t179 == SPS_title) {
self->iv_title = lv_value;
return 0;
} else if (_t179 == SPS_updated_at) {
self->iv_updated_at = lv_value;
return 0;
}
return 0;
}
static inline mrb_bool sp_Article_update(sp_Article *self, sp_RbVal lv_p) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t180 = lv_p;
sp_RbVal _t181 = sp_box_nil();
if (_t180.tag == SP_TAG_OBJ) {
if (_t180.cls_id == 36) _t181 = sp_box_str(sp_ArticleRow_title((sp_ArticleRow *)_t180.v.p));
if (_t180.cls_id == 37) _t181 = sp_Article_title((sp_Article *)_t180.v.p);
if (_t180.cls_id == 38) _t181 = sp_ArticleParams_title((sp_ArticleParams *)_t180.v.p);
}
if (sp_poly_nil_p(_t181)) {
} else {
sp_RbVal _t182 = lv_p;
sp_RbVal _t183 = sp_box_nil();
if (_t182.tag == SP_TAG_OBJ) {
if (_t182.cls_id == 36) _t183 = sp_box_str(sp_ArticleRow_title((sp_ArticleRow *)_t182.v.p));
if (_t182.cls_id == 37) _t183 = sp_Article_title((sp_Article *)_t182.v.p);
if (_t182.cls_id == 38) _t183 = sp_ArticleParams_title((sp_ArticleParams *)_t182.v.p);
}
sp_Article_title_eq(self, _t183);
}
sp_RbVal _t184 = lv_p;
sp_RbVal _t185 = sp_box_nil();
if (_t184.tag == SP_TAG_OBJ) {
if (_t184.cls_id == 29) _t185 = ((sp_ActionController_Base *)_t184.v.p)->iv_body;
if (_t184.cls_id == 32) _t185 = ((sp_ApplicationController *)_t184.v.p)->iv_body;
if (_t184.cls_id == 34) _t185 = sp_CommentRow_body((sp_CommentRow *)_t184.v.p);
if (_t184.cls_id == 35) _t185 = sp_Comment_body((sp_Comment *)_t184.v.p);
if (_t184.cls_id == 36) _t185 = sp_ArticleRow_body((sp_ArticleRow *)_t184.v.p);
if (_t184.cls_id == 37) _t185 = sp_Article_body((sp_Article *)_t184.v.p);
if (_t184.cls_id == 38) _t185 = sp_ArticleParams_body((sp_ArticleParams *)_t184.v.p);
if (_t184.cls_id == 39) _t185 = ((sp_ArticlesController *)_t184.v.p)->iv_body;
if (_t184.cls_id == 40) _t185 = sp_CommentParams_body((sp_CommentParams *)_t184.v.p);
if (_t184.cls_id == 41) _t185 = ((sp_CommentsController *)_t184.v.p)->iv_body;
if (_t184.cls_id == 42) _t185 = ((sp_ActionResponse *)_t184.v.p)->iv_body;
}
if (sp_poly_nil_p(_t185)) {
} else {
sp_RbVal _t186 = lv_p;
sp_RbVal _t187 = sp_box_nil();
if (_t186.tag == SP_TAG_OBJ) {
if (_t186.cls_id == 29) _t187 = ((sp_ActionController_Base *)_t186.v.p)->iv_body;
if (_t186.cls_id == 32) _t187 = ((sp_ApplicationController *)_t186.v.p)->iv_body;
if (_t186.cls_id == 34) _t187 = sp_CommentRow_body((sp_CommentRow *)_t186.v.p);
if (_t186.cls_id == 35) _t187 = sp_Comment_body((sp_Comment *)_t186.v.p);
if (_t186.cls_id == 36) _t187 = sp_ArticleRow_body((sp_ArticleRow *)_t186.v.p);
if (_t186.cls_id == 37) _t187 = sp_Article_body((sp_Article *)_t186.v.p);
if (_t186.cls_id == 38) _t187 = sp_ArticleParams_body((sp_ArticleParams *)_t186.v.p);
if (_t186.cls_id == 39) _t187 = ((sp_ArticlesController *)_t186.v.p)->iv_body;
if (_t186.cls_id == 40) _t187 = sp_CommentParams_body((sp_CommentParams *)_t186.v.p);
if (_t186.cls_id == 41) _t187 = ((sp_CommentsController *)_t186.v.p)->iv_body;
if (_t186.cls_id == 42) _t187 = ((sp_ActionResponse *)_t186.v.p)->iv_body;
}
sp_Article_body_eq(self, _t187);
}
return sp_ActiveRecord_Base_save((sp_ActiveRecord_Base *)self);
return FALSE;
}
static inline mrb_int sp_Article__adapter_insert(sp_Article *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
const char * _t188 = (&("\xff" "INSERT INTO articles (body, created_at, title, updated_at) VALUES (")[1]);
SP_GC_ROOT(_t188);
const char * _t189 = sp_Db_cls_escape_string(self->iv_body);
SP_GC_ROOT(_t189);
const char * _t190 = (&("\xff" ", ")[1]);
SP_GC_ROOT(_t190);
const char * _t191 = sp_Db_cls_escape_string(self->iv_created_at);
SP_GC_ROOT(_t191);
const char * _t192 = (&("\xff" ", ")[1]);
SP_GC_ROOT(_t192);
const char * _t193 = sp_Db_cls_escape_string(self->iv_title);
SP_GC_ROOT(_t193);
const char * _t194 = (&("\xff" ", ")[1]);
SP_GC_ROOT(_t194);
const char * _t195 = sp_Db_cls_escape_string(self->iv_updated_at);
SP_GC_ROOT(_t195);
const char * _t196 = (&("\xff" ")")[1]);
SP_GC_ROOT(_t196);
sp_Db_cls_exec(sp_str_concat_arr((const char *const[]){_t188, _t189, _t190, _t191, _t192, _t193, _t194, _t195, _t196}, 9));
return sp_Db_cls_last_insert_rowid();
return 0;
}
static inline mrb_int sp_Article__adapter_update(sp_Article *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
const char * _t197 = (&("\xff" "UPDATE articles SET ")[1]);
SP_GC_ROOT(_t197);
const char * _t198 = (&("\xff" "body = ")[1]);
SP_GC_ROOT(_t198);
const char * _t199 = sp_Db_cls_escape_string(self->iv_body);
SP_GC_ROOT(_t199);
const char * _t200 = (&("\xff" ", created_at = ")[1]);
SP_GC_ROOT(_t200);
const char * _t201 = sp_Db_cls_escape_string(self->iv_created_at);
SP_GC_ROOT(_t201);
const char * _t202 = (&("\xff" ", title = ")[1]);
SP_GC_ROOT(_t202);
const char * _t203 = sp_Db_cls_escape_string(self->iv_title);
SP_GC_ROOT(_t203);
const char * _t204 = (&("\xff" ", updated_at = ")[1]);
SP_GC_ROOT(_t204);
const char * _t205 = sp_Db_cls_escape_string(self->iv_updated_at);
SP_GC_ROOT(_t205);
const char * _t206 = (&("\xff" " WHERE ")[1]);
SP_GC_ROOT(_t206);
const char * _t207 = (&("\xff" "id = ")[1]);
SP_GC_ROOT(_t207);
const char * _t208 = sp_Db_cls_escape_int(self->iv_id);
SP_GC_ROOT(_t208);
return sp_Db_cls_exec(sp_str_concat_arr((const char *const[]){_t197, _t198, _t199, _t200, _t201, _t202, _t203, _t204, _t205, _t206, _t207, _t208}, 12));
return 0;
}
static inline mrb_int sp_Article__adapter_delete(sp_Article *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return sp_Db_cls_exec(sp_str_concat4((&("\xff" "DELETE FROM articles")[1]), (&("\xff" " WHERE ")[1]), (&("\xff" "id = ")[1]), sp_Db_cls_escape_int(self->iv_id)));
return 0;
}
static sp_RbVal sp_Article__adapter_reload(sp_Article *self) {
SP_GC_SAVE();
void * lv_stmt = NULL;
sp_Article * lv_result = NULL;
SP_GC_ROOT(lv_result);
SP_GC_ROOT(self);
lv_stmt = sp_Db_cls_prepare(sp_str_concat3((&("\xff" "SELECT id, body, created_at, title, updated_at FROM articles WHERE id = ")[1]), sp_Db_cls_escape_int(self->iv_id), (&("\xff" " LIMIT 1")[1])));
lv_result = NULL;
if (sp_Db_cls_step_p(lv_stmt)) {
self->iv_id = sp_box_int(sp_Db_cls_column_int(lv_stmt, 0LL));
self->iv_body = sp_box_str(sp_Db_cls_column_text(lv_stmt, 1LL));
self->iv_created_at = sp_box_str(sp_Db_cls_column_text(lv_stmt, 2LL));
self->iv_title = sp_box_str(sp_Db_cls_column_text(lv_stmt, 3LL));
self->iv_updated_at = sp_box_str(sp_Db_cls_column_text(lv_stmt, 4LL));
sp_ActiveRecord_Base_mark_persisted_bang((sp_ActiveRecord_Base *)self);
lv_result = self;
}
sp_Db_cls_finalize(lv_stmt);
sp_RbVal _t209 = sp_box_obj(lv_result, 37);
SP_GC_RESTORE();
return _t209;
return sp_box_nil();
}
static inline sp_StrArray * sp_Article_validate(sp_Article *self) {
mrb_int lv_len = 0;
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t210 = self->iv_title;
mrb_bool _t211 = FALSE;
if (_t210.tag == SP_TAG_STR) _t211 = (sp_str_length(_t210.v.s) == 0);
if (_t210.tag == SP_TAG_OBJ) {
if (_t210.cls_id == 26) _t211 = sp_ActionDispatch_Flash_empty_p((sp_ActionDispatch_Flash *)_t210.v.p);
if (_t210.cls_id == 27) _t211 = sp_ActionDispatch_Session_empty_p((sp_ActionDispatch_Session *)_t210.v.p);
if (_t210.cls_id == SP_BUILTIN_INT_ARRAY) _t211 = (sp_IntArray_length((sp_IntArray *)_t210.v.p) == 0);
if (_t210.cls_id == SP_BUILTIN_FLT_ARRAY) _t211 = (sp_FloatArray_length((sp_FloatArray *)_t210.v.p) == 0);
if (_t210.cls_id == SP_BUILTIN_STR_ARRAY) _t211 = (sp_StrArray_length((sp_StrArray *)_t210.v.p) == 0);
if (_t210.cls_id == SP_BUILTIN_SYM_ARRAY) _t211 = (sp_IntArray_length((sp_IntArray *)_t210.v.p) == 0);
if (_t210.cls_id == SP_BUILTIN_PTR_ARRAY) _t211 = (sp_PtrArray_length((sp_PtrArray *)_t210.v.p) == 0);
if (_t210.cls_id == SP_BUILTIN_POLY_ARRAY) _t211 = (sp_PolyArray_length((sp_PolyArray *)_t210.v.p) == 0);
if (_t210.cls_id == SP_BUILTIN_STR_INT_HASH) _t211 = (sp_StrIntHash_length((sp_StrIntHash *)_t210.v.p) == 0);
if (_t210.cls_id == SP_BUILTIN_STR_STR_HASH) _t211 = (sp_StrStrHash_length((sp_StrStrHash *)_t210.v.p) == 0);
if (_t210.cls_id == SP_BUILTIN_INT_STR_HASH) _t211 = (sp_IntStrHash_length((sp_IntStrHash *)_t210.v.p) == 0);
if (_t210.cls_id == SP_BUILTIN_STR_POLY_HASH) _t211 = (sp_StrPolyHash_length((sp_StrPolyHash *)_t210.v.p) == 0);
if (_t210.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t211 = (sp_SymPolyHash_length((sp_SymPolyHash *)_t210.v.p) == 0);
if (_t210.cls_id == SP_BUILTIN_POLY_POLY_HASH) _t211 = (sp_PolyPolyHash_length((sp_PolyPolyHash *)_t210.v.p) == 0);
}
if ((sp_poly_nil_p(self->iv_title) || _t211)) {
sp_StrArray * _t212 = sp_ActiveRecord_Base_errors((sp_ActiveRecord_Base *)self);
SP_GC_ROOT(_t212);
sp_StrArray_push(_t212, (&("\xff" "title can't be blank")[1]));
}
sp_RbVal _t213 = self->iv_body;
mrb_bool _t214 = FALSE;
if (_t213.tag == SP_TAG_STR) _t214 = (sp_str_length(_t213.v.s) == 0);
if (_t213.tag == SP_TAG_OBJ) {
if (_t213.cls_id == 26) _t214 = sp_ActionDispatch_Flash_empty_p((sp_ActionDispatch_Flash *)_t213.v.p);
if (_t213.cls_id == 27) _t214 = sp_ActionDispatch_Session_empty_p((sp_ActionDispatch_Session *)_t213.v.p);
if (_t213.cls_id == SP_BUILTIN_INT_ARRAY) _t214 = (sp_IntArray_length((sp_IntArray *)_t213.v.p) == 0);
if (_t213.cls_id == SP_BUILTIN_FLT_ARRAY) _t214 = (sp_FloatArray_length((sp_FloatArray *)_t213.v.p) == 0);
if (_t213.cls_id == SP_BUILTIN_STR_ARRAY) _t214 = (sp_StrArray_length((sp_StrArray *)_t213.v.p) == 0);
if (_t213.cls_id == SP_BUILTIN_SYM_ARRAY) _t214 = (sp_IntArray_length((sp_IntArray *)_t213.v.p) == 0);
if (_t213.cls_id == SP_BUILTIN_PTR_ARRAY) _t214 = (sp_PtrArray_length((sp_PtrArray *)_t213.v.p) == 0);
if (_t213.cls_id == SP_BUILTIN_POLY_ARRAY) _t214 = (sp_PolyArray_length((sp_PolyArray *)_t213.v.p) == 0);
if (_t213.cls_id == SP_BUILTIN_STR_INT_HASH) _t214 = (sp_StrIntHash_length((sp_StrIntHash *)_t213.v.p) == 0);
if (_t213.cls_id == SP_BUILTIN_STR_STR_HASH) _t214 = (sp_StrStrHash_length((sp_StrStrHash *)_t213.v.p) == 0);
if (_t213.cls_id == SP_BUILTIN_INT_STR_HASH) _t214 = (sp_IntStrHash_length((sp_IntStrHash *)_t213.v.p) == 0);
if (_t213.cls_id == SP_BUILTIN_STR_POLY_HASH) _t214 = (sp_StrPolyHash_length((sp_StrPolyHash *)_t213.v.p) == 0);
if (_t213.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t214 = (sp_SymPolyHash_length((sp_SymPolyHash *)_t213.v.p) == 0);
if (_t213.cls_id == SP_BUILTIN_POLY_POLY_HASH) _t214 = (sp_PolyPolyHash_length((sp_PolyPolyHash *)_t213.v.p) == 0);
}
if ((sp_poly_nil_p(self->iv_body) || _t214)) {
sp_StrArray * _t215 = sp_ActiveRecord_Base_errors((sp_ActiveRecord_Base *)self);
SP_GC_ROOT(_t215);
sp_StrArray_push(_t215, (&("\xff" "body can't be blank")[1]));
}
if ((!sp_poly_nil_p(self->iv_body))) {
sp_RbVal _t216 = self->iv_body;
mrb_int _t217 = 0;
if (_t216.tag == SP_TAG_STR) _t217 = sp_str_length(_t216.v.s);
if (_t216.tag == SP_TAG_OBJ) {
if (_t216.cls_id == 26) _t217 = sp_ActionDispatch_Flash_length((sp_ActionDispatch_Flash *)_t216.v.p);
if (_t216.cls_id == 27) _t217 = sp_ActionDispatch_Session_length((sp_ActionDispatch_Session *)_t216.v.p);
if (_t216.cls_id == SP_BUILTIN_INT_ARRAY) _t217 = sp_IntArray_length((sp_IntArray *)_t216.v.p);
if (_t216.cls_id == SP_BUILTIN_FLT_ARRAY) _t217 = sp_FloatArray_length((sp_FloatArray *)_t216.v.p);
if (_t216.cls_id == SP_BUILTIN_STR_ARRAY) _t217 = sp_StrArray_length((sp_StrArray *)_t216.v.p);
if (_t216.cls_id == SP_BUILTIN_SYM_ARRAY) _t217 = sp_IntArray_length((sp_IntArray *)_t216.v.p);
if (_t216.cls_id == SP_BUILTIN_PTR_ARRAY) _t217 = sp_PtrArray_length((sp_PtrArray *)_t216.v.p);
if (_t216.cls_id == SP_BUILTIN_POLY_ARRAY) _t217 = sp_PolyArray_length((sp_PolyArray *)_t216.v.p);
if (_t216.cls_id == SP_BUILTIN_STR_INT_HASH) _t217 = sp_StrIntHash_length((sp_StrIntHash *)_t216.v.p);
if (_t216.cls_id == SP_BUILTIN_STR_STR_HASH) _t217 = sp_StrStrHash_length((sp_StrStrHash *)_t216.v.p);
if (_t216.cls_id == SP_BUILTIN_INT_STR_HASH) _t217 = sp_IntStrHash_length((sp_IntStrHash *)_t216.v.p);
if (_t216.cls_id == SP_BUILTIN_STR_POLY_HASH) _t217 = sp_StrPolyHash_length((sp_StrPolyHash *)_t216.v.p);
if (_t216.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t217 = sp_SymPolyHash_length((sp_SymPolyHash *)_t216.v.p);
if (_t216.cls_id == SP_BUILTIN_POLY_POLY_HASH) _t217 = sp_PolyPolyHash_length((sp_PolyPolyHash *)_t216.v.p);
if (_t216.cls_id == SP_BUILTIN_INT_ARRAY) _t217 = sp_IntArray_length((sp_IntArray *)_t216.v.p);
if (_t216.cls_id == SP_BUILTIN_FLT_ARRAY) _t217 = sp_FloatArray_length((sp_FloatArray *)_t216.v.p);
if (_t216.cls_id == SP_BUILTIN_STR_ARRAY) _t217 = sp_StrArray_length((sp_StrArray *)_t216.v.p);
if (_t216.cls_id == SP_BUILTIN_SYM_ARRAY) _t217 = sp_IntArray_length((sp_IntArray *)_t216.v.p);
if (_t216.cls_id == SP_BUILTIN_PTR_ARRAY) _t217 = sp_PtrArray_length((sp_PtrArray *)_t216.v.p);
if (_t216.cls_id == SP_BUILTIN_POLY_ARRAY) _t217 = sp_PolyArray_length((sp_PolyArray *)_t216.v.p);
}
lv_len = _t217;
if ((lv_len < 10LL)) {
sp_StrArray * _t218 = sp_ActiveRecord_Base_errors((sp_ActiveRecord_Base *)self);
SP_GC_ROOT(_t218);
return (sp_StrArray_push(_t218, (&("\xff" "body is too short (minimum is 10)")[1])), _t218);
} else {
return NULL;
}
} else {
return NULL;
}
return NULL;
}
static sp_PtrArray * sp_Article_comments(sp_Article *self) {
SP_GC_SAVE();
void * lv_stmt = NULL;
sp_PtrArray * lv_results = NULL;
sp_Comment * lv_instance = NULL;
SP_GC_ROOT(lv_results);
SP_GC_ROOT(lv_instance);
SP_GC_ROOT(self);
lv_stmt = sp_Db_cls_prepare(sp_str_concat4((&("\xff" "SELECT id, article_id, body, commenter, created_at, updated_at FROM comments")[1]), (&("\xff" " WHERE ")[1]), (&("\xff" "article_id = ")[1]), sp_Db_cls_escape_int(self->iv_id)));
lv_results = sp_PtrArray_new();
while (sp_Db_cls_step_p(lv_stmt)) {
sp_redo_5: ;
lv_instance = sp_Comment_new(sp_StrIntHash_new());
lv_instance->iv_id = sp_box_int(sp_Db_cls_column_int(lv_stmt, 0LL));
sp_Comment_article_id_eq(lv_instance, sp_box_int(sp_Db_cls_column_int(lv_stmt, 1LL)));
sp_Comment_body_eq(lv_instance, sp_box_str(sp_Db_cls_column_text(lv_stmt, 2LL)));
sp_Comment_commenter_eq(lv_instance, sp_box_str(sp_Db_cls_column_text(lv_stmt, 3LL)));
sp_Comment_created_at_eq(lv_instance, sp_box_str(sp_Db_cls_column_text(lv_stmt, 4LL)));
sp_Comment_updated_at_eq(lv_instance, sp_box_str(sp_Db_cls_column_text(lv_stmt, 5LL)));
sp_ActiveRecord_Base_mark_persisted_bang((sp_ActiveRecord_Base *)lv_instance);
sp_PtrArray_push(lv_results, lv_instance);
}
sp_Db_cls_finalize(lv_stmt);
return lv_results;
return NULL;
}
static inline mrb_int sp_Article_before_destroy(sp_Article *self) {
SP_GC_SAVE();
sp_Comment * lv_c = NULL;
SP_GC_ROOT(lv_c);
SP_GC_ROOT(self);
sp_PtrArray * _t219 = sp_Article_comments(self);
SP_GC_ROOT(_t219);
for (mrb_int _t220 = 0; _t220 < sp_PtrArray_length(_t219); _t220++) {
sp_Comment * _t221 = (sp_Comment *)sp_PtrArray_get(_t219, _t220);
lv_c = _t221;
sp_redo_6: ;
sp_ActiveRecord_Base_destroy((sp_ActiveRecord_Base *)lv_c);
}
return 0;
return 0;
}
static inline const char * sp_Article_dom_prefix(sp_Article *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return (&("\xff" "article")[1]);
return (&("\xff")[1]);
}
static inline mrb_int sp_Article_after_create_commit(sp_Article *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_Broadcasts_cls_prepend((&("\xff" "articles")[1]), (&("\xff" "articles")[1]), sp_Views_Articles_cls_article(self, 0, 0));
return 0;
return 0;
}
static inline mrb_int sp_Article_after_update_commit(sp_Article *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return sp_Broadcasts_cls_replace((&("\xff" "articles")[1]), sp_sprintf("article_%s", sp_poly_to_s(self->iv_id)), sp_Views_Articles_cls_article(self, 0, 0));
return 0;
}
static inline mrb_int sp_Article_after_destroy_commit(sp_Article *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return sp_Broadcasts_cls_remove((&("\xff" "articles")[1]), sp_sprintf("article_%s", sp_poly_to_s(self->iv_id)));
return 0;
}
static const char * sp_Article_cls_table_name(void) {
return (&("\xff" "articles")[1]);
return (&("\xff")[1]);
}
static sp_IntArray * sp_Article_cls_schema_columns(void) {
sp_IntArray *_t222 = sp_IntArray_new();
sp_IntArray_push(_t222, SPS_id);
sp_IntArray_push(_t222, SPS_body);
sp_IntArray_push(_t222, SPS_created_at);
sp_IntArray_push(_t222, SPS_title);
sp_IntArray_push(_t222, SPS_updated_at);
return _t222;
return NULL;
}
static sp_Article * sp_Article_cls_from_row(sp_ArticleRow * lv_row) {
SP_GC_SAVE();
sp_Article * lv_instance = NULL;
SP_GC_ROOT(lv_instance);
lv_instance = sp_Article_new(sp_StrIntHash_new());
lv_instance->iv_id = lv_row->iv_id;
sp_Article_body_eq(lv_instance, lv_row->iv_body);
sp_Article_created_at_eq(lv_instance, sp_box_str(lv_row->iv_created_at));
sp_Article_title_eq(lv_instance, sp_box_str(lv_row->iv_title));
sp_Article_updated_at_eq(lv_instance, sp_box_str(lv_row->iv_updated_at));
return lv_instance;
return NULL;
}
static sp_Article * sp_Article_cls__adapter_find_by_id(mrb_int lv_id) {
SP_GC_SAVE();
void * lv_stmt = NULL;
sp_Article * lv_result = NULL;
sp_Article * lv_instance = NULL;
SP_GC_ROOT(lv_result);
SP_GC_ROOT(lv_instance);
const char * _t223 = (&("\xff" "SELECT id, body, created_at, title, updated_at FROM articles")[1]);
SP_GC_ROOT(_t223);
const char * _t224 = (&("\xff" " WHERE ")[1]);
SP_GC_ROOT(_t224);
const char * _t225 = (&("\xff" "id = ")[1]);
SP_GC_ROOT(_t225);
const char * _t226 = sp_Db_cls_escape_int(sp_box_int(lv_id));
SP_GC_ROOT(_t226);
const char * _t227 = (&("\xff" " LIMIT 1")[1]);
SP_GC_ROOT(_t227);
lv_stmt = sp_Db_cls_prepare(sp_str_concat_arr((const char *const[]){_t223, _t224, _t225, _t226, _t227}, 5));
lv_result = NULL;
if (sp_Db_cls_step_p(lv_stmt)) {
lv_instance = sp_Article_new(sp_StrIntHash_new());
lv_instance->iv_id = sp_box_int(sp_Db_cls_column_int(lv_stmt, 0LL));
sp_Article_body_eq(lv_instance, sp_box_str(sp_Db_cls_column_text(lv_stmt, 1LL)));
sp_Article_created_at_eq(lv_instance, sp_box_str(sp_Db_cls_column_text(lv_stmt, 2LL)));
sp_Article_title_eq(lv_instance, sp_box_str(sp_Db_cls_column_text(lv_stmt, 3LL)));
sp_Article_updated_at_eq(lv_instance, sp_box_str(sp_Db_cls_column_text(lv_stmt, 4LL)));
sp_ActiveRecord_Base_mark_persisted_bang((sp_ActiveRecord_Base *)lv_instance);
lv_result = lv_instance;
}
sp_Db_cls_finalize(lv_stmt);
return lv_result;
return NULL;
}
static sp_PtrArray * sp_Article_cls__adapter_all(void) {
SP_GC_SAVE();
void * lv_stmt = NULL;
sp_PtrArray * lv_results = NULL;
sp_Article * lv_instance = NULL;
SP_GC_ROOT(lv_results);
SP_GC_ROOT(lv_instance);
lv_stmt = sp_Db_cls_prepare((&("\xff" "SELECT id, body, created_at, title, updated_at FROM articles")[1]));
lv_results = sp_PtrArray_new();
while (sp_Db_cls_step_p(lv_stmt)) {
sp_redo_7: ;
lv_instance = sp_Article_new(sp_StrIntHash_new());
lv_instance->iv_id = sp_box_int(sp_Db_cls_column_int(lv_stmt, 0LL));
sp_Article_body_eq(lv_instance, sp_box_str(sp_Db_cls_column_text(lv_stmt, 1LL)));
sp_Article_created_at_eq(lv_instance, sp_box_str(sp_Db_cls_column_text(lv_stmt, 2LL)));
sp_Article_title_eq(lv_instance, sp_box_str(sp_Db_cls_column_text(lv_stmt, 3LL)));
sp_Article_updated_at_eq(lv_instance, sp_box_str(sp_Db_cls_column_text(lv_stmt, 4LL)));
sp_ActiveRecord_Base_mark_persisted_bang((sp_ActiveRecord_Base *)lv_instance);
sp_PtrArray_push(lv_results, lv_instance);
}
sp_Db_cls_finalize(lv_stmt);
return lv_results;
return NULL;
}
static mrb_int sp_Article_cls__adapter_count(void) {
void * lv_stmt = NULL;
mrb_int lv_result = 0;
lv_stmt = sp_Db_cls_prepare((&("\xff" "SELECT COUNT(*) FROM articles")[1]));
sp_Db_cls_step_p(lv_stmt);
lv_result = sp_Db_cls_column_int(lv_stmt, 0LL);
sp_Db_cls_finalize(lv_stmt);
return lv_result;
return 0;
}
static mrb_bool sp_Article_cls__adapter_exists_by_id_p(sp_RbVal lv_id) {
void * lv_stmt = NULL;
mrb_bool lv_result = FALSE;
const char * _t228 = (&("\xff" "SELECT 1 FROM articles")[1]);
SP_GC_ROOT(_t228);
const char * _t229 = (&("\xff" " WHERE ")[1]);
SP_GC_ROOT(_t229);
const char * _t230 = (&("\xff" "id = ")[1]);
SP_GC_ROOT(_t230);
const char * _t231 = sp_Db_cls_escape_int(lv_id);
SP_GC_ROOT(_t231);
const char * _t232 = (&("\xff" " LIMIT 1")[1]);
SP_GC_ROOT(_t232);
lv_stmt = sp_Db_cls_prepare(sp_str_concat_arr((const char *const[]){_t228, _t229, _t230, _t231, _t232}, 5));
lv_result = sp_Db_cls_step_p(lv_stmt);
sp_Db_cls_finalize(lv_stmt);
return lv_result;
return FALSE;
}
static mrb_int sp_Article_cls__adapter_truncate(void) {
sp_Db_cls_exec((&("\xff" "DELETE FROM articles")[1]));
return sp_Db_cls_exec((&("\xff" "DELETE FROM sqlite_sequence WHERE name = 'articles'")[1]));
return 0;
}
static sp_Article * sp_Article_cls_from_params(sp_ArticleParams * lv_p) {
SP_GC_SAVE();
sp_Article * lv_instance = NULL;
SP_GC_ROOT(lv_instance);
lv_instance = sp_Article_new(sp_StrIntHash_new());
sp_Article_title_eq(lv_instance, lv_p->iv_title);
sp_Article_body_eq(lv_instance, lv_p->iv_body);
return lv_instance;
return NULL;
}
static sp_PtrArray * sp_Article_cls_all(void) {
return sp_Article_cls__adapter_all();
return NULL;
}
static sp_Article * sp_Article_cls_find(mrb_int lv_id) {
SP_GC_SAVE();
sp_Article * lv_result = NULL;
SP_GC_ROOT(lv_result);
lv_result = sp_Article_cls__adapter_find_by_id(lv_id);
if ((lv_result == NULL)) {
sp_raise_cls("RecordNotFound", sp_sprintf("Couldn't find %s with id=%lld", sp_class_to_s(((sp_Class){37LL})), (long long)lv_id));
}
return lv_result;
return NULL;
}
static mrb_int sp_Article_cls_count(void) {
return sp_Article_cls__adapter_count();
return 0;
}
static mrb_bool sp_Article_cls_exists_p(sp_RbVal lv_id) {
return sp_Article_cls__adapter_exists_by_id_p(lv_id);
return FALSE;
}
static sp_Article * sp_Article_cls_last(void) {
SP_GC_SAVE();
sp_PtrArray * lv_records = NULL;
SP_GC_ROOT(lv_records);
lv_records = sp_Article_cls_all();
if (sp_PtrArray_empty(lv_records)) {
return 0;
} else {
return ((sp_Article *)sp_PtrArray_get(lv_records, -1LL));
}
return NULL;
}
SP_POOL_DEFINE(ArticleParams)
static inline sp_ArticleParams *sp_ArticleParams_new(void) {
SP_GC_SAVE();
sp_ArticleParams *self = SP_POOL_NEW(ArticleParams, sp_ArticleParams_gc_scan);
self->cls_id = 38LL;
SP_GC_ROOT(self);
self->iv_title = sp_box_nil();
self->iv_body = sp_box_nil();
SP_GC_RESTORE();
return self;
}
static inline sp_RbVal sp_ArticleParams_title(sp_ArticleParams *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t233 = self->iv_title;
SP_GC_RESTORE();
return _t233;
return sp_box_nil();
}
static inline mrb_int sp_ArticleParams_title_eq(sp_ArticleParams *self, sp_RbVal lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_title = lv_value;
return 0;
return 0;
}
static inline sp_RbVal sp_ArticleParams_body(sp_ArticleParams *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t234 = self->iv_body;
SP_GC_RESTORE();
return _t234;
return sp_box_nil();
}
static inline mrb_int sp_ArticleParams_body_eq(sp_ArticleParams *self, sp_RbVal lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_body = lv_value;
return 0;
return 0;
}
static inline sp_StrPolyHash * sp_ArticleParams_to_h(sp_ArticleParams *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_StrPolyHash *_t235 = sp_StrPolyHash_new();
sp_StrPolyHash_set(_t235, (&("\xff" "title")[1]), self->iv_title);
sp_StrPolyHash_set(_t235, (&("\xff" "body")[1]), self->iv_body);
return _t235;
return NULL;
}
static sp_ArticleParams * sp_ArticleParams_cls_from_raw(sp_StrIntHash * lv_params) {
SP_GC_SAVE();
sp_RbVal lv_raw_sub = sp_box_nil();
sp_RbVal lv_sub = sp_box_nil();
sp_ArticleParams * lv_instance = NULL;
sp_RbVal lv_raw_title = sp_box_nil();
sp_RbVal lv_raw_body = sp_box_nil();
SP_GC_ROOT(lv_instance);
lv_raw_sub = (sp_StrIntHash_has_key(lv_params, (&("\xff" "article")[1])) ? sp_box_int(sp_StrIntHash_get(lv_params, (&("\xff" "article")[1]))) : sp_box_obj((void *)(sp_StrIntHash_new()), SP_BUILTIN_STR_INT_HASH));
sp_RbVal _t236 = lv_raw_sub;
lv_sub = ((_t236.tag == SP_TAG_OBJ && (_t236.cls_id == SP_BUILTIN_STR_INT_HASH || _t236.cls_id == SP_BUILTIN_STR_STR_HASH || _t236.cls_id == SP_BUILTIN_INT_STR_HASH || _t236.cls_id == SP_BUILTIN_SYM_INT_HASH || _t236.cls_id == SP_BUILTIN_SYM_STR_HASH || _t236.cls_id == SP_BUILTIN_STR_POLY_HASH || _t236.cls_id == SP_BUILTIN_SYM_POLY_HASH)) ? lv_raw_sub : sp_box_obj((void *)(sp_StrIntHash_new()), SP_BUILTIN_STR_INT_HASH));
lv_instance = sp_ArticleParams_new();
sp_RbVal _t237 = lv_sub;
sp_RbVal _t238 = sp_box_nil();
if (_t237.tag == SP_TAG_OBJ) {
if (_t237.cls_id == SP_BUILTIN_STR_INT_HASH) _t238 = sp_StrIntHash_has_key((sp_StrIntHash *)_t237.v.p, (&("\xff" "title")[1])) ? sp_box_int(sp_StrIntHash_get((sp_StrIntHash *)_t237.v.p, (&("\xff" "title")[1]))) : sp_box_str((&("\xff" "")[1]));
if (_t237.cls_id == SP_BUILTIN_STR_STR_HASH) _t238 = sp_StrStrHash_has_key((sp_StrStrHash *)_t237.v.p, (&("\xff" "title")[1])) ? sp_box_str(sp_StrStrHash_get((sp_StrStrHash *)_t237.v.p, (&("\xff" "title")[1]))) : sp_box_str((&("\xff" "")[1]));
if (_t237.cls_id == SP_BUILTIN_STR_POLY_HASH) _t238 = sp_StrPolyHash_has_key((sp_StrPolyHash *)_t237.v.p, (&("\xff" "title")[1])) ? sp_StrPolyHash_get((sp_StrPolyHash *)_t237.v.p, (&("\xff" "title")[1])) : sp_box_str((&("\xff" "")[1]));
}
lv_raw_title = _t238;
sp_RbVal _t239 = lv_raw_title;
sp_ArticleParams_title_eq(lv_instance, ((_t239.tag == SP_TAG_STR) ? lv_raw_title : sp_box_str((&("\xff" "")[1]))));
sp_RbVal _t240 = lv_sub;
sp_RbVal _t241 = sp_box_nil();
if (_t240.tag == SP_TAG_OBJ) {
if (_t240.cls_id == SP_BUILTIN_STR_INT_HASH) _t241 = sp_StrIntHash_has_key((sp_StrIntHash *)_t240.v.p, (&("\xff" "body")[1])) ? sp_box_int(sp_StrIntHash_get((sp_StrIntHash *)_t240.v.p, (&("\xff" "body")[1]))) : sp_box_str((&("\xff" "")[1]));
if (_t240.cls_id == SP_BUILTIN_STR_STR_HASH) _t241 = sp_StrStrHash_has_key((sp_StrStrHash *)_t240.v.p, (&("\xff" "body")[1])) ? sp_box_str(sp_StrStrHash_get((sp_StrStrHash *)_t240.v.p, (&("\xff" "body")[1]))) : sp_box_str((&("\xff" "")[1]));
if (_t240.cls_id == SP_BUILTIN_STR_POLY_HASH) _t241 = sp_StrPolyHash_has_key((sp_StrPolyHash *)_t240.v.p, (&("\xff" "body")[1])) ? sp_StrPolyHash_get((sp_StrPolyHash *)_t240.v.p, (&("\xff" "body")[1])) : sp_box_str((&("\xff" "")[1]));
}
lv_raw_body = _t241;
sp_RbVal _t242 = lv_raw_body;
sp_ArticleParams_body_eq(lv_instance, ((_t242.tag == SP_TAG_STR) ? lv_raw_body : sp_box_str((&("\xff" "")[1]))));
return lv_instance;
return NULL;
}
SP_POOL_DEFINE(ArticlesController)
static inline sp_ArticlesController *sp_ArticlesController_new(void) {
SP_GC_SAVE();
sp_ArticlesController *self = SP_POOL_NEW(ArticlesController, sp_ArticlesController_gc_scan);
self->cls_id = 39LL;
SP_GC_ROOT(self);
self->iv_params = NULL;
self->iv_session = NULL;
self->iv_flash = NULL;
self->iv_body = sp_box_nil();
self->iv_location = NULL;
self->iv_content_type = NULL;
self->iv_articles = NULL;
self->iv_article = NULL;
sp_ActionController_Base_initialize((sp_ActionController_Base *)self);
SP_GC_RESTORE();
return self;
}
static inline mrb_int sp_ArticlesController_process_action(sp_ArticlesController *self, sp_sym lv_action_name) {
SP_GC_SAVE();
SP_GC_ROOT(self);
mrb_int _t243 = lv_action_name;
if (_t243 == SPS_index) {
return sp_ArticlesController_index(self);
} else if (_t243 == SPS_show) {
return sp_ArticlesController_show(self);
} else if (_t243 == SPS_new) {
return sp_ArticlesController_new_action(self);
} else if (_t243 == SPS_edit) {
return sp_ArticlesController_edit(self);
} else if (_t243 == SPS_create) {
return sp_ArticlesController_create(self);
} else if (_t243 == SPS_update) {
return sp_ArticlesController_update(self);
} else if (_t243 == SPS_destroy) {
return sp_ArticlesController_destroy(self);
}
return 0;
}
static mrb_int sp_ArticlesController_index(sp_ArticlesController *self) {
SP_GC_SAVE();
void * lv_stmt = NULL;
sp_PtrArray * lv_results = NULL;
sp_Article * lv_instance = NULL;
SP_GC_ROOT(lv_results);
SP_GC_ROOT(lv_instance);
SP_GC_ROOT(self);
lv_stmt = sp_Db_cls_prepare(sp_str_concat((&("\xff" "SELECT id, body, created_at, title, updated_at FROM articles")[1]), (&("\xff" " ORDER BY created_at DESC")[1])));
lv_results = sp_PtrArray_new();
while (sp_Db_cls_step_p(lv_stmt)) {
sp_redo_8: ;
lv_instance = sp_Article_new(sp_StrIntHash_new());
lv_instance->iv_id = sp_box_int(sp_Db_cls_column_int(lv_stmt, 0LL));
sp_Article_body_eq(lv_instance, sp_box_str(sp_Db_cls_column_text(lv_stmt, 1LL)));
sp_Article_created_at_eq(lv_instance, sp_box_str(sp_Db_cls_column_text(lv_stmt, 2LL)));
sp_Article_title_eq(lv_instance, sp_box_str(sp_Db_cls_column_text(lv_stmt, 3LL)));
sp_Article_updated_at_eq(lv_instance, sp_box_str(sp_Db_cls_column_text(lv_stmt, 4LL)));
sp_ActiveRecord_Base_mark_persisted_bang((sp_ActiveRecord_Base *)lv_instance);
sp_PtrArray_push(lv_results, lv_instance);
}
sp_Db_cls_finalize(lv_stmt);
self->iv_articles = lv_results;
if ((self->iv_request_format == SPS_json)) {
return sp_ActionController_Base_render((sp_ActionController_Base *)self, ({ sp_String *_t244 = sp_Views_Articles_cls_index_json(self->iv_articles); _t244 ? sp_box_str(_t244->data) : sp_box_nil(); }), SPS_ok, (&("\xff" "application/json")[1]), (&("\xff")[1]));
} else {
return sp_ActionController_Base_render((sp_ActionController_Base *)self, ({ sp_String *_t245 = sp_Views_Articles_cls_index(self->iv_articles, sp_ActionDispatch_Flash__aref(self->iv_flash, sp_box_sym(SPS_notice)), sp_ActionDispatch_Flash__aref(self->iv_flash, sp_box_sym(SPS_alert))); _t245 ? sp_box_str(_t245->data) : sp_box_nil(); }), SPS_ok, NULL, (&("\xff")[1]));
}
return 0;
}
static mrb_int sp_ArticlesController_show(sp_ArticlesController *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
const char * _t246 = (sp_StrIntHash_has_key(self->iv_params, (&("\xff" "id")[1])) ? sp_int_to_s(sp_StrIntHash_get(self->iv_params, (&("\xff" "id")[1]))) : (&("\xff" "0")[1]));
SP_GC_ROOT(_t246);
const char * _t247 = _t246;
SP_GC_ROOT(_t247);
self->iv_article = sp_Article_cls_find(((mrb_int)atoll(_t247)));
if ((self->iv_request_format == SPS_json)) {
return sp_ActionController_Base_render((sp_ActionController_Base *)self, ({ sp_String *_t248 = sp_Views_Articles_cls_show_json(self->iv_article); _t248 ? sp_box_str(_t248->data) : sp_box_nil(); }), SPS_ok, (&("\xff" "application/json")[1]), (&("\xff")[1]));
} else {
return sp_ActionController_Base_render((sp_ActionController_Base *)self, ({ sp_String *_t249 = sp_Views_Articles_cls_show(self->iv_article, sp_ActionDispatch_Flash__aref(self->iv_flash, sp_box_sym(SPS_notice)), sp_ActionDispatch_Flash__aref(self->iv_flash, sp_box_sym(SPS_alert))); _t249 ? sp_box_str(_t249->data) : sp_box_nil(); }), SPS_ok, NULL, (&("\xff")[1]));
}
return 0;
}
static inline mrb_int sp_ArticlesController_new_action(sp_ArticlesController *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_article = sp_Article_new(sp_StrIntHash_new());
return sp_ActionController_Base_render((sp_ActionController_Base *)self, sp_box_obj(sp_Views_Articles_cls_new(self->iv_article, sp_ActionDispatch_Flash__aref(self->iv_flash, sp_box_sym(SPS_notice)), sp_ActionDispatch_Flash__aref(self->iv_flash, sp_box_sym(SPS_alert))), 20), SPS_ok, NULL, (&("\xff")[1]));
return 0;
}
static mrb_int sp_ArticlesController_edit(sp_ArticlesController *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
const char * _t250 = (sp_StrIntHash_has_key(self->iv_params, (&("\xff" "id")[1])) ? sp_int_to_s(sp_StrIntHash_get(self->iv_params, (&("\xff" "id")[1]))) : (&("\xff" "0")[1]));
SP_GC_ROOT(_t250);
const char * _t251 = _t250;
SP_GC_ROOT(_t251);
self->iv_article = sp_Article_cls_find(((mrb_int)atoll(_t251)));
return sp_ActionController_Base_render((sp_ActionController_Base *)self, ({ sp_String *_t252 = sp_Views_Articles_cls_edit(sp_box_nullable_obj(self->iv_article, 37), sp_ActionDispatch_Flash__aref(self->iv_flash, sp_box_sym(SPS_notice)), sp_ActionDispatch_Flash__aref(self->iv_flash, sp_box_sym(SPS_alert))); _t252 ? sp_box_str(_t252->data) : sp_box_nil(); }), SPS_ok, NULL, (&("\xff")[1]));
return 0;
}
static inline mrb_int sp_ArticlesController_create(sp_ArticlesController *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_article = sp_Article_cls_from_params(sp_ArticlesController_article_params(self));
if (sp_ActiveRecord_Base_save((sp_ActiveRecord_Base *)self->iv_article)) {
if ((self->iv_request_format == SPS_json)) {
return sp_ActionController_Base_render((sp_ActionController_Base *)self, ({ sp_String *_t253 = sp_Views_Articles_cls_show_json(self->iv_article); _t253 ? sp_box_str(_t253->data) : sp_box_nil(); }), SPS_created, (&("\xff" "application/json")[1]), sp_RouteHelpers_cls_article_path(self->iv_article->iv_id));
} else {
return sp_ActionController_Base_redirect_to((sp_ActionController_Base *)self, sp_RouteHelpers_cls_article_path(self->iv_article->iv_id), (&("\xff" "Article was successfully created.")[1]), NULL, SPS_found);
}
} else {
return sp_ActionController_Base_render((sp_ActionController_Base *)self, sp_box_obj(sp_Views_Articles_cls_new(self->iv_article, sp_ActionDispatch_Flash__aref(self->iv_flash, sp_box_sym(SPS_notice)), sp_ActionDispatch_Flash__aref(self->iv_flash, sp_box_sym(SPS_alert))), 20), SPS_unprocessable_content, NULL, (&("\xff")[1]));
}
return 0;
}
static inline mrb_int sp_ArticlesController_update(sp_ArticlesController *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
const char * _t254 = (sp_StrIntHash_has_key(self->iv_params, (&("\xff" "id")[1])) ? sp_int_to_s(sp_StrIntHash_get(self->iv_params, (&("\xff" "id")[1]))) : (&("\xff" "0")[1]));
SP_GC_ROOT(_t254);
const char * _t255 = _t254;
SP_GC_ROOT(_t255);
self->iv_article = sp_Article_cls_find(((mrb_int)atoll(_t255)));
if (sp_Article_update(self->iv_article, sp_box_obj(sp_ArticlesController_article_params(self), 38))) {
if ((self->iv_request_format == SPS_json)) {
return sp_ActionController_Base_render((sp_ActionController_Base *)self, ({ sp_String *_t256 = sp_Views_Articles_cls_show_json(self->iv_article); _t256 ? sp_box_str(_t256->data) : sp_box_nil(); }), SPS_ok, (&("\xff" "application/json")[1]), sp_RouteHelpers_cls_article_path(self->iv_article->iv_id));
} else {
return sp_ActionController_Base_redirect_to((sp_ActionController_Base *)self, sp_RouteHelpers_cls_article_path(self->iv_article->iv_id), (&("\xff" "Article was successfully updated.")[1]), NULL, SPS_see_other);
}
} else {
return sp_ActionController_Base_render((sp_ActionController_Base *)self, ({ sp_String *_t257 = sp_Views_Articles_cls_edit(sp_box_nullable_obj(self->iv_article, 37), sp_ActionDispatch_Flash__aref(self->iv_flash, sp_box_sym(SPS_notice)), sp_ActionDispatch_Flash__aref(self->iv_flash, sp_box_sym(SPS_alert))); _t257 ? sp_box_str(_t257->data) : sp_box_nil(); }), SPS_unprocessable_content, NULL, (&("\xff")[1]));
}
return 0;
}
static mrb_int sp_ArticlesController_destroy(sp_ArticlesController *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
const char * _t258 = (sp_StrIntHash_has_key(self->iv_params, (&("\xff" "id")[1])) ? sp_int_to_s(sp_StrIntHash_get(self->iv_params, (&("\xff" "id")[1]))) : (&("\xff" "0")[1]));
SP_GC_ROOT(_t258);
const char * _t259 = _t258;
SP_GC_ROOT(_t259);
self->iv_article = sp_Article_cls_find(((mrb_int)atoll(_t259)));
sp_ActiveRecord_Base_destroy((sp_ActiveRecord_Base *)self->iv_article);
if ((self->iv_request_format == SPS_json)) {
return sp_ActionController_Base_head((sp_ActionController_Base *)self, SPS_no_content, (&("\xff" "application/json")[1]));
} else {
return sp_ActionController_Base_redirect_to((sp_ActionController_Base *)self, sp_RouteHelpers_cls_articles_path(), (&("\xff" "Article was successfully destroyed.")[1]), NULL, SPS_see_other);
}
return 0;
}
static inline sp_ArticleParams * sp_ArticlesController_article_params(sp_ArticlesController *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return sp_ArticleParams_cls_from_raw(self->iv_params);
return NULL;
}
SP_POOL_DEFINE(CommentParams)
static inline sp_CommentParams *sp_CommentParams_new(void) {
SP_GC_SAVE();
sp_CommentParams *self = SP_POOL_NEW(CommentParams, sp_CommentParams_gc_scan);
self->cls_id = 40LL;
SP_GC_ROOT(self);
self->iv_commenter = sp_box_nil();
self->iv_body = sp_box_nil();
SP_GC_RESTORE();
return self;
}
static inline sp_RbVal sp_CommentParams_commenter(sp_CommentParams *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t260 = self->iv_commenter;
SP_GC_RESTORE();
return _t260;
return sp_box_nil();
}
static inline mrb_int sp_CommentParams_commenter_eq(sp_CommentParams *self, sp_RbVal lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_commenter = lv_value;
return 0;
return 0;
}
static inline sp_RbVal sp_CommentParams_body(sp_CommentParams *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t261 = self->iv_body;
SP_GC_RESTORE();
return _t261;
return sp_box_nil();
}
static inline mrb_int sp_CommentParams_body_eq(sp_CommentParams *self, sp_RbVal lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_body = lv_value;
return 0;
return 0;
}
static inline sp_StrPolyHash * sp_CommentParams_to_h(sp_CommentParams *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_StrPolyHash *_t262 = sp_StrPolyHash_new();
sp_StrPolyHash_set(_t262, (&("\xff" "commenter")[1]), self->iv_commenter);
sp_StrPolyHash_set(_t262, (&("\xff" "body")[1]), self->iv_body);
return _t262;
return NULL;
}
static sp_CommentParams * sp_CommentParams_cls_from_raw(sp_StrIntHash * lv_params) {
SP_GC_SAVE();
sp_RbVal lv_raw_sub = sp_box_nil();
sp_RbVal lv_sub = sp_box_nil();
sp_CommentParams * lv_instance = NULL;
sp_RbVal lv_raw_commenter = sp_box_nil();
sp_RbVal lv_raw_body = sp_box_nil();
SP_GC_ROOT(lv_instance);
lv_raw_sub = (sp_StrIntHash_has_key(lv_params, (&("\xff" "comment")[1])) ? sp_box_int(sp_StrIntHash_get(lv_params, (&("\xff" "comment")[1]))) : sp_box_obj((void *)(sp_StrIntHash_new()), SP_BUILTIN_STR_INT_HASH));
sp_RbVal _t263 = lv_raw_sub;
lv_sub = ((_t263.tag == SP_TAG_OBJ && (_t263.cls_id == SP_BUILTIN_STR_INT_HASH || _t263.cls_id == SP_BUILTIN_STR_STR_HASH || _t263.cls_id == SP_BUILTIN_INT_STR_HASH || _t263.cls_id == SP_BUILTIN_SYM_INT_HASH || _t263.cls_id == SP_BUILTIN_SYM_STR_HASH || _t263.cls_id == SP_BUILTIN_STR_POLY_HASH || _t263.cls_id == SP_BUILTIN_SYM_POLY_HASH)) ? lv_raw_sub : sp_box_obj((void *)(sp_StrIntHash_new()), SP_BUILTIN_STR_INT_HASH));
lv_instance = sp_CommentParams_new();
sp_RbVal _t264 = lv_sub;
sp_RbVal _t265 = sp_box_nil();
if (_t264.tag == SP_TAG_OBJ) {
if (_t264.cls_id == SP_BUILTIN_STR_INT_HASH) _t265 = sp_StrIntHash_has_key((sp_StrIntHash *)_t264.v.p, (&("\xff" "commenter")[1])) ? sp_box_int(sp_StrIntHash_get((sp_StrIntHash *)_t264.v.p, (&("\xff" "commenter")[1]))) : sp_box_str((&("\xff" "")[1]));
if (_t264.cls_id == SP_BUILTIN_STR_STR_HASH) _t265 = sp_StrStrHash_has_key((sp_StrStrHash *)_t264.v.p, (&("\xff" "commenter")[1])) ? sp_box_str(sp_StrStrHash_get((sp_StrStrHash *)_t264.v.p, (&("\xff" "commenter")[1]))) : sp_box_str((&("\xff" "")[1]));
if (_t264.cls_id == SP_BUILTIN_STR_POLY_HASH) _t265 = sp_StrPolyHash_has_key((sp_StrPolyHash *)_t264.v.p, (&("\xff" "commenter")[1])) ? sp_StrPolyHash_get((sp_StrPolyHash *)_t264.v.p, (&("\xff" "commenter")[1])) : sp_box_str((&("\xff" "")[1]));
}
lv_raw_commenter = _t265;
sp_RbVal _t266 = lv_raw_commenter;
sp_CommentParams_commenter_eq(lv_instance, ((_t266.tag == SP_TAG_STR) ? lv_raw_commenter : sp_box_str((&("\xff" "")[1]))));
sp_RbVal _t267 = lv_sub;
sp_RbVal _t268 = sp_box_nil();
if (_t267.tag == SP_TAG_OBJ) {
if (_t267.cls_id == SP_BUILTIN_STR_INT_HASH) _t268 = sp_StrIntHash_has_key((sp_StrIntHash *)_t267.v.p, (&("\xff" "body")[1])) ? sp_box_int(sp_StrIntHash_get((sp_StrIntHash *)_t267.v.p, (&("\xff" "body")[1]))) : sp_box_str((&("\xff" "")[1]));
if (_t267.cls_id == SP_BUILTIN_STR_STR_HASH) _t268 = sp_StrStrHash_has_key((sp_StrStrHash *)_t267.v.p, (&("\xff" "body")[1])) ? sp_box_str(sp_StrStrHash_get((sp_StrStrHash *)_t267.v.p, (&("\xff" "body")[1]))) : sp_box_str((&("\xff" "")[1]));
if (_t267.cls_id == SP_BUILTIN_STR_POLY_HASH) _t268 = sp_StrPolyHash_has_key((sp_StrPolyHash *)_t267.v.p, (&("\xff" "body")[1])) ? sp_StrPolyHash_get((sp_StrPolyHash *)_t267.v.p, (&("\xff" "body")[1])) : sp_box_str((&("\xff" "")[1]));
}
lv_raw_body = _t268;
sp_RbVal _t269 = lv_raw_body;
sp_CommentParams_body_eq(lv_instance, ((_t269.tag == SP_TAG_STR) ? lv_raw_body : sp_box_str((&("\xff" "")[1]))));
return lv_instance;
return NULL;
}
SP_POOL_DEFINE(CommentsController)
static inline sp_CommentsController *sp_CommentsController_new(void) {
SP_GC_SAVE();
sp_CommentsController *self = SP_POOL_NEW(CommentsController, sp_CommentsController_gc_scan);
self->cls_id = 41LL;
SP_GC_ROOT(self);
self->iv_params = NULL;
self->iv_session = NULL;
self->iv_flash = NULL;
self->iv_body = sp_box_nil();
self->iv_location = NULL;
self->iv_content_type = NULL;
self->iv_article = NULL;
self->iv_comment = NULL;
sp_ActionController_Base_initialize((sp_ActionController_Base *)self);
SP_GC_RESTORE();
return self;
}
static inline mrb_int sp_CommentsController_process_action(sp_CommentsController *self, sp_sym lv_action_name) {
SP_GC_SAVE();
SP_GC_ROOT(self);
mrb_int _t270 = lv_action_name;
if (_t270 == SPS_create) {
return sp_CommentsController_create(self);
} else if (_t270 == SPS_destroy) {
return sp_CommentsController_destroy(self);
}
return 0;
}
static mrb_int sp_CommentsController_create(sp_CommentsController *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
const char * _t271 = (sp_StrIntHash_has_key(self->iv_params, (&("\xff" "article_id")[1])) ? sp_int_to_s(sp_StrIntHash_get(self->iv_params, (&("\xff" "article_id")[1]))) : (&("\xff" "0")[1]));
SP_GC_ROOT(_t271);
const char * _t272 = _t271;
SP_GC_ROOT(_t272);
self->iv_article = sp_Article_cls_find(((mrb_int)atoll(_t272)));
self->iv_comment = sp_Comment_cls_from_params(sp_CommentsController_comment_params(self));
sp_Comment_article_id_eq(self->iv_comment, self->iv_article->iv_id);
if (sp_ActiveRecord_Base_save((sp_ActiveRecord_Base *)self->iv_comment)) {
return sp_ActionController_Base_redirect_to((sp_ActionController_Base *)self, sp_RouteHelpers_cls_article_path(self->iv_article->iv_id), (&("\xff" "Comment was successfully created.")[1]), NULL, SPS_found);
} else {
return sp_ActionController_Base_redirect_to((sp_ActionController_Base *)self, sp_RouteHelpers_cls_article_path(self->iv_article->iv_id), NULL, (&("\xff" "Could not create comment.")[1]), SPS_found);
}
return 0;
}
static mrb_int sp_CommentsController_destroy(sp_CommentsController *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
const char * _t273 = (sp_StrIntHash_has_key(self->iv_params, (&("\xff" "article_id")[1])) ? sp_int_to_s(sp_StrIntHash_get(self->iv_params, (&("\xff" "article_id")[1]))) : (&("\xff" "0")[1]));
SP_GC_ROOT(_t273);
const char * _t274 = _t273;
SP_GC_ROOT(_t274);
self->iv_article = sp_Article_cls_find(((mrb_int)atoll(_t274)));
const char * _t275 = (sp_StrIntHash_has_key(self->iv_params, (&("\xff" "id")[1])) ? sp_int_to_s(sp_StrIntHash_get(self->iv_params, (&("\xff" "id")[1]))) : (&("\xff" "0")[1]));
SP_GC_ROOT(_t275);
const char * _t276 = _t275;
SP_GC_ROOT(_t276);
self->iv_comment = sp_Comment_cls_find(((mrb_int)atoll(_t276)));
if ((!sp_poly_eq(self->iv_comment->iv_article_id, self->iv_article->iv_id))) {
sp_ActionController_Base_head((sp_ActionController_Base *)self, SPS_not_found, NULL);
SP_GC_RESTORE();
return 0;
}
sp_ActiveRecord_Base_destroy((sp_ActiveRecord_Base *)self->iv_comment);
return sp_ActionController_Base_redirect_to((sp_ActionController_Base *)self, sp_RouteHelpers_cls_article_path(self->iv_article->iv_id), (&("\xff" "Comment was successfully deleted.")[1]), NULL, SPS_found);
return 0;
}
static inline sp_CommentParams * sp_CommentsController_comment_params(sp_CommentsController *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return sp_CommentParams_cls_from_raw(self->iv_params);
return NULL;
}
SP_POOL_DEFINE(ActionResponse)
static inline sp_ActionResponse *sp_ActionResponse_new(mrb_int lv_status, sp_RbVal lv_body, sp_RbVal lv_location, sp_ActionDispatch_Flash * lv_flash) {
SP_GC_SAVE();
sp_ActionResponse *self = SP_POOL_NEW(ActionResponse, sp_ActionResponse_gc_scan);
self->cls_id = 42LL;
SP_GC_ROOT(self);
self->iv_body = sp_box_nil();
self->iv_location = sp_box_nil();
self->iv_flash = NULL;
SP_GC_ROOT(lv_flash);
self->iv_status = lv_status;
self->iv_body = lv_body;
self->iv_location = lv_location;
self->iv_flash = lv_flash;
SP_GC_RESTORE();
return self;
}
static inline void sp_ActionResponse_initialize(sp_ActionResponse *self, mrb_int lv_status, sp_RbVal lv_body, sp_RbVal lv_location, sp_ActionDispatch_Flash * lv_flash) {
self->iv_status = lv_status;
self->iv_body = lv_body;
self->iv_location = lv_location;
self->iv_flash = lv_flash;
}
static inline mrb_bool sp_ActionResponse_redirect_p(sp_ActionResponse *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
return (((!sp_poly_nil_p(self->iv_location)) && (self->iv_status >= 300LL)) && (self->iv_status < 400LL));
return FALSE;
}
static inline mrb_bool sp_ActionResponse_success_p(sp_ActionResponse *self) {
return FALSE;
}
static inline mrb_bool sp_ActionResponse_unprocessable_p(sp_ActionResponse *self) {
return FALSE;
}
SP_POOL_DEFINE(TestBase)
static inline sp_TestBase *sp_TestBase_new(void) {
SP_GC_SAVE();
sp_TestBase *self = SP_POOL_NEW(TestBase, NULL);
self->cls_id = 43LL;
SP_GC_ROOT(self);
SP_GC_RESTORE();
return self;
}
static inline void sp_TestBase_initialize(sp_TestBase *self) {
}
static inline mrb_bool sp_TestBase_setup(sp_TestBase *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
if ((("expression"), TRUE)) {
return sp_SchemaSetup_cls_reset_bang();
} else {
return FALSE;
}
return FALSE;
}
static inline mrb_int sp_TestBase_teardown(sp_TestBase *self) {
return 0;
}
static inline mrb_int sp_TestBase_assert_operator(sp_TestBase *self, mrb_int lv_lhs, mrb_int lv_op, mrb_int lv_rhs, mrb_int lv_msg) {
(void)lv_lhs;
(void)lv_op;
(void)lv_rhs;
(void)lv_msg;
return 0;
}
static inline mrb_int sp_TestBase_assert_match(sp_TestBase *self, mrb_int lv_pattern, mrb_int lv_value, mrb_int lv_msg) {
(void)lv_pattern;
(void)lv_value;
(void)lv_msg;
return 0;
}
SP_POOL_DEFINE(ArticlesControllerTest)
static inline sp_ArticlesControllerTest *sp_ArticlesControllerTest_new(void) {
SP_GC_SAVE();
sp_ArticlesControllerTest *self = SP_POOL_NEW(ArticlesControllerTest, sp_ArticlesControllerTest_gc_scan);
self->cls_id = 44LL;
SP_GC_ROOT(self);
self->iv_article = NULL;
sp_TestBase_initialize((sp_TestBase *)self);
SP_GC_RESTORE();
return self;
}
static mrb_int sp_ArticlesControllerTest_test_should_get_index(sp_ArticlesControllerTest *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_article = sp_ArticlesFixtures_cls_one();
sp_ActionDispatch_IntegrationTest_get((sp_ActionDispatch_IntegrationTest *)self, sp_RouteHelpers_cls_articles_path(), sp_StrIntHash_new());
sp_ActionDispatch_IntegrationTest_assert_response((sp_ActionDispatch_IntegrationTest *)self, SPS_success, self->iv___response);
sp_ActionDispatch_IntegrationTest_assert_select((sp_ActionDispatch_IntegrationTest *)self, (&("\xff" "h1")[1]), sp_box_str((&("\xff" "Articles")[1])), 0, 0, NULL, NULL);
const char * lv_selector_y1 = (&("\xff" "#articles")[1]);
sp_RbVal lv_content_or_opts_y1 = 0;
mrb_int lv_opts_y1 = 0;
sp_Proc * lv_block_y1 = 0;
sp_RbVal lv_body_y1 = sp_box_nil();
sp_RbVal lv_content_y1 = sp_box_nil();
const char * lv_tag_y1 = (&("\xff")[1]);
sp_Regexp * lv_pattern_y1 = NULL;
const char * lv_id_y1 = (&("\xff")[1]);
const char * lv__tag_y1 = (&("\xff")[1]);
const char * lv_cls_y1 = (&("\xff")[1]);
lv_body_y1 = ((sp_ActionController_Base *)self->iv___response)->iv_body;
if (FALSE) {
lv_opts_y1 = lv_content_or_opts_y1;
lv_content_y1 = 0;
} else {
lv_content_y1 = lv_content_or_opts_y1;
}
if (FALSE) {
lv_tag_y1 = (((lv_selector_y1) >> (0)) & 1);
lv_pattern_y1 = (((lv_tag_y1), TRUE) ? 0 : 0);
if (!(0)) {
sp_raise(sp_sprintf("expected %s containing %s in response body", sp_int_to_s(lv_selector_y1), sp_int_to_s(lv_content_y1)));
}
} else
if (0) {
sp_StrArray * _t277 = 0;
SP_GC_ROOT(_t277);
sp_StrArray * _t278 = 0;
SP_GC_ROOT(_t278);
const char * _t279 = sp_StrArray_get(_t278, 0);
SP_GC_ROOT(_t279);
const char * _t280 = _t279;
SP_GC_ROOT(_t280);
lv_id_y1 = sp_str_sub_range_r(_t280, 1LL, -1, 0);
if (!(0)) {
sp_raise(sp_sprintf("expected element with id %s in response body", sp_int_to_s(lv_id_y1)));
}
} else
if (0) {
sp_StrArray *_t281 = 0;
SP_GC_ROOT(_t281);
lv__tag_y1 = sp_StrArray_get(_t281, 0);
lv_cls_y1 = sp_StrArray_get(_t281, 1);
if (!((0 || 0))) {
sp_raise(sp_sprintf("expected element with class %s in response body", sp_int_to_s(lv_cls_y1)));
}
} else {
lv_tag_y1 = (((lv_selector_y1) >> (0)) & 1);
if (!((((lv_tag_y1), TRUE) && 0))) {
sp_raise(sp_sprintf("expected %s in response body", sp_int_to_s(lv_selector_y1)));
}
}
if (lv_block_y1) {
sp_ActionDispatch_IntegrationTest_assert_select(self, (&("\xff" "h2")[1]), ((void)(0), sp_box_nil()), 0, 0, NULL, NULL);
}
return 0;
return 0;
}
static mrb_int sp_ArticlesControllerTest_test_should_get_new(sp_ArticlesControllerTest *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_article = sp_ArticlesFixtures_cls_one();
sp_ActionDispatch_IntegrationTest_get((sp_ActionDispatch_IntegrationTest *)self, sp_RouteHelpers_cls_new_article_path(), sp_StrIntHash_new());
sp_ActionDispatch_IntegrationTest_assert_response((sp_ActionDispatch_IntegrationTest *)self, SPS_success, self->iv___response);
return sp_ActionDispatch_IntegrationTest_assert_select((sp_ActionDispatch_IntegrationTest *)self, (&("\xff" "form")[1]), ((void)(0), sp_box_nil()), 0, 0, NULL, NULL);
return 0;
}
static mrb_int sp_ArticlesControllerTest_test_should_create_article(sp_ArticlesControllerTest *self) {
volatile mrb_int lv___diff_before = 0;
volatile mrb_int lv___diff_after = 0;
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_article = sp_ArticlesFixtures_cls_one();
lv___diff_before = sp_Article_cls_count();
sp_SymPolyHash *_t282 = sp_SymPolyHash_new();
sp_SymStrHash *_t283 = sp_SymStrHash_new();
sp_SymStrHash_set(_t283, SPS_body, (&("\xff" "A sufficiently long body for validation.")[1]));
sp_SymStrHash_set(_t283, SPS_title, (&("\xff" "New Title")[1]));
sp_SymPolyHash_set(_t282, SPS_article, sp_box_obj((void *)(_t283), SP_BUILTIN_SYM_STR_HASH));
sp_ActionDispatch_IntegrationTest_post((sp_ActionDispatch_IntegrationTest *)self, sp_RouteHelpers_cls_articles_path(), _t282);
lv___diff_after = sp_Article_cls_count();
if (((lv___diff_after - lv___diff_before) != 1LL)) {
sp_raise((&("\xff" "Article.count didn't change by 1")[1]));
}
sp_Article * _t284 = sp_Article_cls_last();
SP_GC_ROOT(_t284);
sp_ActionDispatch_IntegrationTest_assert_redirected_to((sp_ActionDispatch_IntegrationTest *)self, sp_RouteHelpers_cls_article_path(_t284->iv_id), self->iv___response);
sp_Article * _t285 = sp_Article_cls_last();
SP_GC_ROOT(_t285);
if ((!sp_poly_eq(sp_box_str((&("\xff" "New Title")[1])), _t285->iv_title))) {
sp_raise((&("\xff" "assert_equal failed")[1]));
return 0;
} else {
return 0;
}
return 0;
}
static mrb_int sp_ArticlesControllerTest_test_should_not_create_article_with_invalid_params(sp_ArticlesControllerTest *self) {
volatile mrb_int lv___diff_before = 0;
volatile mrb_int lv___diff_after = 0;
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_article = sp_ArticlesFixtures_cls_one();
lv___diff_before = sp_Article_cls_count();
sp_SymPolyHash *_t286 = sp_SymPolyHash_new();
sp_SymStrHash *_t287 = sp_SymStrHash_new();
sp_SymStrHash_set(_t287, SPS_title, (&("\xff" "")[1]));
sp_SymStrHash_set(_t287, SPS_body, (&("\xff" "")[1]));
sp_SymPolyHash_set(_t286, SPS_article, sp_box_obj((void *)(_t287), SP_BUILTIN_SYM_STR_HASH));
sp_ActionDispatch_IntegrationTest_post((sp_ActionDispatch_IntegrationTest *)self, sp_RouteHelpers_cls_articles_path(), _t286);
lv___diff_after = sp_Article_cls_count();
if (((lv___diff_after - lv___diff_before) != 0LL)) {
sp_raise((&("\xff" "Article.count didn't change by 0")[1]));
}
return sp_ActionDispatch_IntegrationTest_assert_response((sp_ActionDispatch_IntegrationTest *)self, SPS_unprocessable_entity, self->iv___response);
return 0;
}
static mrb_int sp_ArticlesControllerTest_test_should_show_article(sp_ArticlesControllerTest *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_article = sp_ArticlesFixtures_cls_one();
sp_ActionDispatch_IntegrationTest_get((sp_ActionDispatch_IntegrationTest *)self, sp_RouteHelpers_cls_article_path(self->iv_article->iv_id), sp_StrIntHash_new());
sp_ActionDispatch_IntegrationTest_assert_response((sp_ActionDispatch_IntegrationTest *)self, SPS_success, self->iv___response);
sp_ActionDispatch_IntegrationTest_assert_select((sp_ActionDispatch_IntegrationTest *)self, (&("\xff" "h1")[1]), self->iv_article->iv_title, 0, 0, NULL, NULL);
sp_ActionDispatch_IntegrationTest_assert_select((sp_ActionDispatch_IntegrationTest *)self, (&("\xff" "h2")[1]), sp_box_str((&("\xff" "Comments")[1])), 0, 0, NULL, NULL);
return sp_ActionDispatch_IntegrationTest_assert_select((sp_ActionDispatch_IntegrationTest *)self, (&("\xff" "#comments .p-4")[1]), ((void)(0), sp_box_nil()), 0, 0, NULL, NULL);
return 0;
}
static mrb_int sp_ArticlesControllerTest_test_should_get_edit(sp_ArticlesControllerTest *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_article = sp_ArticlesFixtures_cls_one();
sp_ActionDispatch_IntegrationTest_get((sp_ActionDispatch_IntegrationTest *)self, sp_RouteHelpers_cls_edit_article_path(self->iv_article->iv_id), sp_StrIntHash_new());
sp_ActionDispatch_IntegrationTest_assert_response((sp_ActionDispatch_IntegrationTest *)self, SPS_success, self->iv___response);
return sp_ActionDispatch_IntegrationTest_assert_select((sp_ActionDispatch_IntegrationTest *)self, (&("\xff" "form")[1]), ((void)(0), sp_box_nil()), 0, 0, NULL, NULL);
return 0;
}
static mrb_int sp_ArticlesControllerTest_test_should_update_article(sp_ArticlesControllerTest *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_article = sp_ArticlesFixtures_cls_one();
sp_SymPolyHash *_t288 = sp_SymPolyHash_new();
sp_SymPolyHash *_t289 = sp_SymPolyHash_new();
sp_SymPolyHash_set(_t289, SPS_body, self->iv_article->iv_body);
sp_SymPolyHash_set(_t289, SPS_title, sp_box_str((&("\xff" "Updated Title")[1])));
sp_SymPolyHash_set(_t288, SPS_article, sp_box_obj((void *)(_t289), SP_BUILTIN_SYM_POLY_HASH));
sp_ActionDispatch_IntegrationTest_patch((sp_ActionDispatch_IntegrationTest *)self, sp_RouteHelpers_cls_article_path(self->iv_article->iv_id), _t288);
sp_ActionDispatch_IntegrationTest_assert_redirected_to((sp_ActionDispatch_IntegrationTest *)self, sp_RouteHelpers_cls_article_path(self->iv_article->iv_id), self->iv___response);
sp_ActiveRecord_Base_reload((sp_ActiveRecord_Base *)self->iv_article);
if ((!sp_poly_eq(sp_box_str((&("\xff" "Updated Title")[1])), self->iv_article->iv_title))) {
sp_raise((&("\xff" "assert_equal failed")[1]));
return 0;
} else {
return 0;
}
return 0;
}
static inline mrb_int sp_ArticlesControllerTest_test_should_not_update_article_with_invalid_params(sp_ArticlesControllerTest *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_article = sp_ArticlesFixtures_cls_one();
sp_SymPolyHash *_t290 = sp_SymPolyHash_new();
sp_SymStrHash *_t291 = sp_SymStrHash_new();
sp_SymStrHash_set(_t291, SPS_title, (&("\xff" "")[1]));
sp_SymStrHash_set(_t291, SPS_body, (&("\xff" "")[1]));
sp_SymPolyHash_set(_t290, SPS_article, sp_box_obj((void *)(_t291), SP_BUILTIN_SYM_STR_HASH));
sp_ActionDispatch_IntegrationTest_patch((sp_ActionDispatch_IntegrationTest *)self, sp_RouteHelpers_cls_article_path(self->iv_article->iv_id), _t290);
return sp_ActionDispatch_IntegrationTest_assert_response((sp_ActionDispatch_IntegrationTest *)self, SPS_unprocessable_entity, self->iv___response);
return 0;
}
static mrb_int sp_ArticlesControllerTest_test_should_destroy_article(sp_ArticlesControllerTest *self) {
volatile mrb_int lv___diff_before = 0;
volatile mrb_int lv___diff_after = 0;
SP_GC_SAVE();
SP_GC_ROOT(self);
self->iv_article = sp_ArticlesFixtures_cls_one();
lv___diff_before = sp_Article_cls_count();
sp_ActionDispatch_IntegrationTest_delete((sp_ActionDispatch_IntegrationTest *)self, sp_RouteHelpers_cls_article_path(self->iv_article->iv_id), sp_StrIntHash_new());
lv___diff_after = sp_Article_cls_count();
if (((lv___diff_after - lv___diff_before) != -1LL)) {
sp_raise((&("\xff" "Article.count didn't change by -1")[1]));
}
return sp_ActionDispatch_IntegrationTest_assert_redirected_to((sp_ActionDispatch_IntegrationTest *)self, sp_RouteHelpers_cls_articles_path(), self->iv___response);
return 0;
}
SP_POOL_DEFINE(Method)
static inline sp_Method *sp_Method_new(sp_Method * lv_self_obj, mrb_int lv_fn_ptr) {
SP_GC_SAVE();
sp_Method *self = SP_POOL_NEW(Method, sp_Method_gc_scan);
self->cls_id = 45LL;
SP_GC_ROOT(self);
self->iv_self_obj = NULL;
SP_GC_ROOT(lv_self_obj);
self->iv_self_obj = lv_self_obj;
self->iv_fn_ptr = lv_fn_ptr;
SP_GC_RESTORE();
return self;
}
static inline void sp_Method_initialize(sp_Method *self, sp_Method * lv_self_obj, mrb_int lv_fn_ptr) {
}
/* sp_Class new-dispatch table Tier 5) */
typedef sp_RbVal (*sp_class_new_fn)(void);
static sp_RbVal sp_class_new_nil_fallback(void) __attribute__((unused));
static sp_RbVal sp_class_new_nil_fallback(void){return sp_box_nil();}
static sp_RbVal sp_ActionController_Base_new_dispatch_adapter(void) __attribute__((unused));
static sp_RbVal sp_ActionController_Base_new_dispatch_adapter(void){return sp_box_obj(sp_ActionController_Base_new(), 29);}
static sp_RbVal sp_Broadcasts_SeedTransport_new_dispatch_adapter(void) __attribute__((unused));
static sp_RbVal sp_Broadcasts_SeedTransport_new_dispatch_adapter(void){return sp_box_obj(sp_Broadcasts_SeedTransport_new(), 30);}
static sp_RbVal sp_ActionDispatch_IntegrationTest_new_dispatch_adapter(void) __attribute__((unused));
static sp_RbVal sp_ActionDispatch_IntegrationTest_new_dispatch_adapter(void){return sp_box_obj(sp_ActionDispatch_IntegrationTest_new(), 31);}
static sp_RbVal sp_ApplicationController_new_dispatch_adapter(void) __attribute__((unused));
static sp_RbVal sp_ApplicationController_new_dispatch_adapter(void){return sp_box_obj(sp_ApplicationController_new(), 32);}
static sp_RbVal sp_CommentRow_new_dispatch_adapter(void) __attribute__((unused));
static sp_RbVal sp_CommentRow_new_dispatch_adapter(void){return sp_box_obj(sp_CommentRow_new(), 34);}
static sp_RbVal sp_ArticleRow_new_dispatch_adapter(void) __attribute__((unused));
static sp_RbVal sp_ArticleRow_new_dispatch_adapter(void){return sp_box_obj(sp_ArticleRow_new(), 36);}
static sp_RbVal sp_ArticleParams_new_dispatch_adapter(void) __attribute__((unused));
static sp_RbVal sp_ArticleParams_new_dispatch_adapter(void){return sp_box_obj(sp_ArticleParams_new(), 38);}
static sp_RbVal sp_ArticlesController_new_dispatch_adapter(void) __attribute__((unused));
static sp_RbVal sp_ArticlesController_new_dispatch_adapter(void){return sp_box_obj(sp_ArticlesController_new(), 39);}
static sp_RbVal sp_CommentParams_new_dispatch_adapter(void) __attribute__((unused));
static sp_RbVal sp_CommentParams_new_dispatch_adapter(void){return sp_box_obj(sp_CommentParams_new(), 40);}
static sp_RbVal sp_CommentsController_new_dispatch_adapter(void) __attribute__((unused));
static sp_RbVal sp_CommentsController_new_dispatch_adapter(void){return sp_box_obj(sp_CommentsController_new(), 41);}
static sp_RbVal sp_TestBase_new_dispatch_adapter(void) __attribute__((unused));
static sp_RbVal sp_TestBase_new_dispatch_adapter(void){return sp_box_obj(sp_TestBase_new(), 43);}
static sp_RbVal sp_ArticlesControllerTest_new_dispatch_adapter(void) __attribute__((unused));
static sp_RbVal sp_ArticlesControllerTest_new_dispatch_adapter(void){return sp_box_obj(sp_ArticlesControllerTest_new(), 44);}
static const sp_class_new_fn sp_class_constructors[SP_CLASS_COUNT] __attribute__((unused)) = {sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_ActionController_Base_new_dispatch_adapter,sp_Broadcasts_SeedTransport_new_dispatch_adapter,sp_ActionDispatch_IntegrationTest_new_dispatch_adapter,sp_ApplicationController_new_dispatch_adapter,sp_class_new_nil_fallback,sp_CommentRow_new_dispatch_adapter,sp_class_new_nil_fallback,sp_ArticleRow_new_dispatch_adapter,sp_class_new_nil_fallback,sp_ArticleParams_new_dispatch_adapter,sp_ArticlesController_new_dispatch_adapter,sp_CommentParams_new_dispatch_adapter,sp_CommentsController_new_dispatch_adapter,sp_class_new_nil_fallback,sp_TestBase_new_dispatch_adapter,sp_ArticlesControllerTest_new_dispatch_adapter,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback,sp_class_new_nil_fallback};
static sp_RbVal sp_class_new_dispatch(sp_Class c) __attribute__((unused));
static sp_RbVal sp_class_new_dispatch(sp_Class c){if(c.cls_id<0||c.cls_id>=SP_CLASS_COUNT)return sp_box_nil();return sp_class_constructors[c.cls_id]();}
static const char * sp_Base64_cls_strict_encode64(const char * lv_s) {
SP_GC_SAVE();
sp_IntArray * lv_bytes = NULL;
mrb_int lv_n = 0;
const char * lv_out = (&("\xff")[1]);
mrb_int lv_i = 0;
mrb_int lv_b0 = 0;
mrb_int lv_b1 = 0;
mrb_int lv_b2 = 0;
mrb_int lv_rem = 0;
SP_GC_ROOT(lv_bytes);
SP_GC_ROOT(lv_out);
SP_GC_ROOT(lv_s);
lv_bytes = sp_str_bytes(lv_s);
lv_n = sp_IntArray_length(lv_bytes);
lv_out = (&("\xff" "")[1]);
lv_i = 0LL;
while (((lv_i + 3LL) <= lv_n)) {
sp_redo_9: ;
lv_b0 = sp_IntArray_get(lv_bytes, lv_i);
lv_b1 = sp_IntArray_get(lv_bytes, (lv_i + 1LL));
lv_b2 = sp_IntArray_get(lv_bytes, (lv_i + 2LL));
const char * _t292 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), ((lv_b0 >> 2LL) & 63LL), 1);
SP_GC_ROOT(_t292);
const char * _t293 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), ((lv_b0 >> 2LL) & 63LL), 1);
SP_GC_ROOT(_t293);
lv_out = sp_str_concat(lv_out, _t293);
const char * _t294 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), (((lv_b0 << 4LL) | (lv_b1 >> 4LL)) & 63LL), 1);
SP_GC_ROOT(_t294);
const char * _t295 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), (((lv_b0 << 4LL) | (lv_b1 >> 4LL)) & 63LL), 1);
SP_GC_ROOT(_t295);
lv_out = sp_str_concat(lv_out, _t295);
const char * _t296 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), (((lv_b1 << 2LL) | (lv_b2 >> 6LL)) & 63LL), 1);
SP_GC_ROOT(_t296);
const char * _t297 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), (((lv_b1 << 2LL) | (lv_b2 >> 6LL)) & 63LL), 1);
SP_GC_ROOT(_t297);
lv_out = sp_str_concat(lv_out, _t297);
const char * _t298 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), (lv_b2 & 63LL), 1);
SP_GC_ROOT(_t298);
const char * _t299 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), (lv_b2 & 63LL), 1);
SP_GC_ROOT(_t299);
lv_out = sp_str_concat(lv_out, _t299);
lv_i = (lv_i + 3LL);
}
lv_rem = (lv_n - lv_i);
if ((lv_rem == 1LL)) {
lv_b0 = sp_IntArray_get(lv_bytes, lv_i);
const char * _t300 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), ((lv_b0 >> 2LL) & 63LL), 1);
SP_GC_ROOT(_t300);
const char * _t301 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), ((lv_b0 >> 2LL) & 63LL), 1);
SP_GC_ROOT(_t301);
lv_out = sp_str_concat(lv_out, _t301);
const char * _t302 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), ((lv_b0 << 4LL) & 63LL), 1);
SP_GC_ROOT(_t302);
const char * _t303 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), ((lv_b0 << 4LL) & 63LL), 1);
SP_GC_ROOT(_t303);
lv_out = sp_str_concat(lv_out, _t303);
lv_out = sp_str_concat(lv_out, (&("\xff" "==")[1]));
} else {
if ((lv_rem == 2LL)) {
lv_b0 = sp_IntArray_get(lv_bytes, lv_i);
lv_b1 = sp_IntArray_get(lv_bytes, (lv_i + 1LL));
const char * _t304 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), ((lv_b0 >> 2LL) & 63LL), 1);
SP_GC_ROOT(_t304);
const char * _t305 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), ((lv_b0 >> 2LL) & 63LL), 1);
SP_GC_ROOT(_t305);
lv_out = sp_str_concat(lv_out, _t305);
const char * _t306 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), (((lv_b0 << 4LL) | (lv_b1 >> 4LL)) & 63LL), 1);
SP_GC_ROOT(_t306);
const char * _t307 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), (((lv_b0 << 4LL) | (lv_b1 >> 4LL)) & 63LL), 1);
SP_GC_ROOT(_t307);
lv_out = sp_str_concat(lv_out, _t307);
const char * _t308 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), ((lv_b1 << 2LL) & 63LL), 1);
SP_GC_ROOT(_t308);
const char * _t309 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), ((lv_b1 << 2LL) & 63LL), 1);
SP_GC_ROOT(_t309);
lv_out = sp_str_concat(lv_out, _t309);
lv_out = sp_str_concat(lv_out, (&("\xff" "=")[1]));
}
}
return lv_out;
return (&("\xff")[1]);
}
static inline const char * sp_JSON_cls_generate(const char * lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(lv_value);
if (TRUE) {
return sp_str_concat3((&("\xff" "\"")[1]), sp_JSON_cls_escape_string((const char *)lv_value), (&("\xff" "\"")[1]));
} else {
return lv_value;
}
return (&("\xff")[1]);
}
static const char * sp_JSON_cls_escape_string(const char * lv_s) {
SP_GC_SAVE();
const char * lv_out = (&("\xff")[1]);
mrb_int lv_i = 0;
mrb_int lv_n = 0;
const char * lv_c = (&("\xff")[1]);
SP_GC_ROOT(lv_out);
SP_GC_ROOT(lv_c);
SP_GC_ROOT(lv_s);
lv_out = (&("\xff" "")[1]);
lv_i = 0LL;
lv_n = sp_str_length(lv_s);
while ((lv_i < lv_n)) {
sp_redo_10: ;
lv_c = sp_str_sub_range(lv_s, lv_i, 1);
if (sp_str_eq(lv_c, (&("\xff" "\"")[1]))) {
lv_out = sp_str_concat(lv_out, (&("\xff" "\\\"")[1]));
} else {
if (sp_str_eq(lv_c, (&("\xff" "\\")[1]))) {
lv_out = sp_str_concat(lv_out, (&("\xff" "\\\\")[1]));
} else {
if (sp_str_eq(lv_c, (&("\xff" "\n")[1]))) {
lv_out = sp_str_concat(lv_out, (&("\xff" "\\n")[1]));
} else {
if (sp_str_eq(lv_c, (&("\xff" "\r")[1]))) {
lv_out = sp_str_concat(lv_out, (&("\xff" "\\r")[1]));
} else {
if (sp_str_eq(lv_c, (&("\xff" "\t")[1]))) {
lv_out = sp_str_concat(lv_out, (&("\xff" "\\t")[1]));
} else {
lv_out = sp_str_concat(lv_out, lv_c);
}
}
}
}
}
lv_i = (lv_i + 1LL);
}
return lv_out;
return (&("\xff")[1]);
}
static inline mrb_int sp_Db_cls_configure(const char * lv_path) {
volatile mrb_int lv_rc = 0;
SP_GC_SAVE();
SP_GC_ROOT(lv_path);
lv_rc = sqlite3_open(lv_path, ((void *)((void *)sp_ffi_buf_SQL_db_out)));
if ((lv_rc != cst_SQL_OK)) {
const char * _t310 = (&("\xff" "Db.configure: sqlite3_open(")[1]);
SP_GC_ROOT(_t310);
const char * _t311 = lv_path;
SP_GC_ROOT(_t311);
const char * _t312 = (&("\xff" ") failed (")[1]);
SP_GC_ROOT(_t312);
const char * _t313 = sp_int_to_s(lv_rc);
SP_GC_ROOT(_t313);
const char * _t314 = (&("\xff" ")")[1]);
SP_GC_ROOT(_t314);
sp_raise(sp_str_concat_arr((const char *const[]){_t310, _t311, _t312, _t313, _t314}, 5));
}
cst_Db_db = ((void *)(*((void * *)((char *)((void *)sp_ffi_buf_SQL_db_out) + 0))));
return 0;
return 0;
}
static inline mrb_int sp_Db_cls_close(void) {
SP_GC_SAVE();
if ((!FALSE)) {
sqlite3_close(((void *)cst_Db_db));
cst_Db_db = 0;
return 0;
} else {
return 0;
}
return 0;
}
static inline mrb_int sp_Db_cls_exec(const char * lv_sql) {
volatile mrb_int lv_rc = 0;
SP_GC_SAVE();
SP_GC_ROOT(lv_sql);
lv_rc = sqlite3_exec(((void *)cst_Db_db), lv_sql, ((void *)0), ((void *)0), ((void *)0));
if ((lv_rc != cst_SQL_OK)) {
const char * _t315 = (&("\xff" "Db.exec failed (")[1]);
SP_GC_ROOT(_t315);
const char * _t316 = sp_int_to_s(lv_rc);
SP_GC_ROOT(_t316);
const char * _t317 = (&("\xff" "): ")[1]);
SP_GC_ROOT(_t317);
const char * _t318 = sqlite3_errmsg(((void *)cst_Db_db));
SP_GC_ROOT(_t318);
const char * _t319 = (&("\xff" " — sql: ")[1]);
SP_GC_ROOT(_t319);
const char * _t320 = lv_sql;
SP_GC_ROOT(_t320);
sp_raise(sp_str_concat_arr((const char *const[]){_t315, _t316, _t317, _t318, _t319, _t320}, 6));
return 0;
} else {
return 0;
}
return 0;
}
static inline void * sp_Db_cls_prepare(const char * lv_sql) {
volatile mrb_int lv_rc = 0;
SP_GC_SAVE();
SP_GC_ROOT(lv_sql);
lv_rc = sqlite3_prepare_v2(((void *)cst_Db_db), lv_sql, ((int)(-1LL)), ((void *)((void *)sp_ffi_buf_SQL_stmt_out)), ((void *)0));
if ((lv_rc != cst_SQL_OK)) {
const char * _t321 = (&("\xff" "Db.prepare failed (")[1]);
SP_GC_ROOT(_t321);
const char * _t322 = sp_int_to_s(lv_rc);
SP_GC_ROOT(_t322);
const char * _t323 = (&("\xff" "): ")[1]);
SP_GC_ROOT(_t323);
const char * _t324 = sqlite3_errmsg(((void *)cst_Db_db));
SP_GC_ROOT(_t324);
const char * _t325 = (&("\xff" " — sql: ")[1]);
SP_GC_ROOT(_t325);
const char * _t326 = lv_sql;
SP_GC_ROOT(_t326);
sp_raise(sp_str_concat_arr((const char *const[]){_t321, _t322, _t323, _t324, _t325, _t326}, 6));
}
return ((void *)(*((void * *)((char *)((void *)sp_ffi_buf_SQL_stmt_out) + 0))));
return NULL;
}
static inline mrb_bool sp_Db_cls_step_p(void * lv_stmt) {
SP_GC_SAVE();
return (sqlite3_step(((void *)lv_stmt)) == cst_SQL_ROW);
return FALSE;
}
static inline mrb_int sp_Db_cls_column_int(void * lv_stmt, mrb_int lv_i) {
SP_GC_SAVE();
return sqlite3_column_int(((void *)lv_stmt), ((int)(lv_i)));
return 0;
}
static inline const char * sp_Db_cls_column_text(void * lv_stmt, mrb_int lv_i) {
SP_GC_SAVE();
const char * lv_s = (&("\xff")[1]);
SP_GC_ROOT(lv_s);
lv_s = sqlite3_column_text(((void *)lv_stmt), ((int)(lv_i)));
if ((lv_s == NULL)) {
return (&("\xff" "")[1]);
} else {
return sp_str_concat(lv_s, (&("\xff" "")[1]));
}
return (&("\xff")[1]);
}
static inline mrb_int sp_Db_cls_column_count(mrb_int lv_stmt) {
SP_GC_SAVE();
return sqlite3_column_count(((void *)lv_stmt));
return 0;
}
static inline const char * sp_Db_cls_column_name(mrb_int lv_stmt, mrb_int lv_i) {
SP_GC_SAVE();
const char * lv_s = (&("\xff")[1]);
SP_GC_ROOT(lv_s);
lv_s = sqlite3_column_name(((void *)lv_stmt), ((int)(lv_i)));
if ((lv_s == NULL)) {
return (&("\xff" "")[1]);
} else {
return sp_str_concat(lv_s, (&("\xff" "")[1]));
}
return (&("\xff")[1]);
}
static inline mrb_int sp_Db_cls_finalize(void * lv_stmt) {
SP_GC_SAVE();
return sqlite3_finalize(((void *)lv_stmt));
return 0;
}
static inline mrb_int sp_Db_cls_last_insert_rowid(void) {
SP_GC_SAVE();
return sqlite3_last_insert_rowid(((void *)cst_Db_db));
return 0;
}
static inline mrb_int sp_Db_cls_changes(void) {
SP_GC_SAVE();
return sqlite3_changes(((void *)cst_Db_db));
return 0;
}
static inline const char * sp_Db_cls_escape_string(sp_RbVal lv_s) {
SP_GC_SAVE();
const char * _t327 = sp_poly_to_s(lv_s);
SP_GC_ROOT(_t327);
return sp_str_concat3((&("\xff" "'")[1]), sp_str_gsub(_t327, (&("\xff" "'")[1]), (&("\xff" "''")[1])), (&("\xff" "'")[1]));
return (&("\xff")[1]);
}
static inline const char * sp_Db_cls_escape_int(sp_RbVal lv_n) {
SP_GC_SAVE();
sp_RbVal _t329 = lv_n;
mrb_int _t328 = (_t329.tag == SP_TAG_INT) ? _t329.v.i : 0;
return sp_int_to_s(_t328);
return (&("\xff")[1]);
}
static inline const char * sp_Db_cls_escape_bool(mrb_int lv_b) {
SP_GC_SAVE();
if (((lv_b), TRUE)) {
return (&("\xff" "1")[1]);
} else {
return (&("\xff" "0")[1]);
}
return (&("\xff")[1]);
}
static inline mrb_bool sp_Db_cls_column_bool(void * lv_stmt, mrb_int lv_idx) {
SP_GC_SAVE();
return (sp_Db_cls_column_int(lv_stmt, lv_idx) != 0LL);
return FALSE;
}
static inline sp_StrArray * sp_Schema_cls_statements(void) {
SP_GC_SAVE();
sp_StrArray *_t330 = sp_StrArray_new();
sp_StrArray_push(_t330, (&("\xff" "CREATE TABLE IF NOT EXISTS articles (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n body TEXT,\n created_at TEXT NOT NULL,\n title TEXT,\n updated_at TEXT NOT NULL\n)")[1]));
sp_StrArray_push(_t330, (&("\xff" "CREATE TABLE IF NOT EXISTS comments (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n article_id INTEGER NOT NULL,\n body TEXT,\n commenter TEXT,\n created_at TEXT NOT NULL,\n updated_at TEXT NOT NULL\n)")[1]));
sp_StrArray_push(_t330, (&("\xff" "CREATE INDEX IF NOT EXISTS index_comments_on_article_id ON comments (article_id)")[1]));
return _t330;
return NULL;
}
static sp_ActionDispatch_Router_MatchResult * sp_ActionDispatch_Router_cls_match(const char * lv_method, const char * lv_path, sp_PtrArray * lv_table) {
SP_GC_SAVE();
const char * lv_method_upcase = (&("\xff")[1]);
mrb_int lv_i = 0;
sp_ActionDispatch_Router_Route * lv_route = NULL;
sp_StrStrHash * lv_params = NULL;
SP_GC_ROOT(lv_method_upcase);
SP_GC_ROOT(lv_route);
SP_GC_ROOT(lv_params);
SP_GC_ROOT(lv_method);
SP_GC_ROOT(lv_path);
SP_GC_ROOT(lv_table);
const char * _t331 = lv_method;
SP_GC_ROOT(_t331);
lv_method_upcase = sp_str_upcase(_t331);
lv_i = 0LL;
mrb_int _t332 = sp_PtrArray_length(lv_table);
while ((lv_i < _t332)) {
sp_redo_11: ;
lv_route = ((sp_ActionDispatch_Router_Route *)sp_PtrArray_get(lv_table, lv_i));
const char * _t333 = lv_route->iv_verb;
SP_GC_ROOT(_t333);
if (sp_str_eq(_t333, lv_method_upcase)) {
const char * _t334 = lv_route->iv_pattern;
SP_GC_ROOT(_t334);
lv_params = sp_ActionDispatch_Router_cls_match_pattern(_t334, (const char *)lv_path);
if (!((lv_params == NULL))) {
sp_ActionDispatch_Router_MatchResult * _t335 = sp_ActionDispatch_Router_MatchResult_new(lv_route->iv_controller, lv_route->iv_action, lv_params);
SP_GC_RESTORE();
return _t335;
}
}
lv_i += 1LL;
}
return 0;
return NULL;
}
static sp_StrStrHash * sp_ActionDispatch_Router_cls_match_pattern(const char * lv_pattern, const char * lv_path) {
SP_GC_SAVE();
sp_StrArray * lv_pattern_parts = NULL;
sp_StrArray * lv_path_parts = NULL;
sp_StrStrHash * lv_params = NULL;
mrb_int lv_i = 0;
const char * lv_pp = (&("\xff")[1]);
const char * lv_ap = (&("\xff")[1]);
SP_GC_ROOT(lv_pattern_parts);
SP_GC_ROOT(lv_path_parts);
SP_GC_ROOT(lv_params);
SP_GC_ROOT(lv_pp);
SP_GC_ROOT(lv_ap);
SP_GC_ROOT(lv_pattern);
SP_GC_ROOT(lv_path);
lv_pattern_parts = sp_str_split(lv_pattern, (&("\xff" "/")[1]));
lv_path_parts = sp_str_split(lv_path, (&("\xff" "/")[1]));
if ((sp_StrArray_length(lv_pattern_parts) != sp_StrArray_length(lv_path_parts))) {
SP_GC_RESTORE();
return NULL;
}
lv_params = sp_StrStrHash_new();
lv_i = 0LL;
mrb_int _t336 = sp_StrArray_length(lv_pattern_parts);
while ((lv_i < _t336)) {
sp_redo_12: ;
lv_pp = sp_StrArray_get(lv_pattern_parts, lv_i);
lv_ap = sp_StrArray_get(lv_path_parts, lv_i);
if (sp_str_start_with(lv_pp, (&("\xff" ":")[1]))) {
sp_StrStrHash_set(lv_params, sp_str_sub_range_r(lv_pp, 1LL, -1, 0), lv_ap);
} else {
if ((!sp_str_eq(lv_pp, lv_ap))) {
SP_GC_RESTORE();
return NULL;
}
}
lv_i += 1LL;
}
return lv_params;
return NULL;
}
static inline mrb_int sp_ActionView_ViewHelpers_cls_reset_slots_bang(void) {
SP_GC_SAVE();
cst_ActionView_ViewHelpers_slots = sp_SymPolyHash_new();
return 0;
return 0;
}
static inline mrb_int sp_ActionView_ViewHelpers_cls_content_for_set(sp_sym lv_slot, const char * lv_value) {
SP_GC_SAVE();
SP_GC_ROOT(lv_value);
sp_SymPolyHash_set(cst_ActionView_ViewHelpers_slots, lv_slot, sp_box_str(lv_value));
return 0;
return 0;
}
static inline sp_RbVal sp_ActionView_ViewHelpers_cls_content_for_get(sp_sym lv_slot) {
SP_GC_SAVE();
sp_RbVal _t337 = (sp_SymPolyHash_has_key(cst_ActionView_ViewHelpers_slots, lv_slot) ? sp_SymPolyHash_get(cst_ActionView_ViewHelpers_slots, lv_slot) : (((void)(0), sp_box_nil())));
SP_GC_RESTORE();
return _t337;
return sp_box_nil();
}
static inline sp_RbVal sp_ActionView_ViewHelpers_cls_get_slot(sp_sym lv_slot) {
SP_GC_SAVE();
sp_RbVal _t338 = sp_SymPolyHash_get((sp_SymPolyHash *)(cst_ActionView_ViewHelpers_slots), lv_slot);
sp_RbVal _t339 = (sp_poly_truthy(_t338) ? _t338 : sp_box_str((&("\xff" "")[1])));
SP_GC_RESTORE();
return _t339;
return sp_box_nil();
}
static inline sp_RbVal sp_ActionView_ViewHelpers_cls_get_yield(void) {
SP_GC_SAVE();
sp_RbVal _t340 = sp_SymPolyHash_get((sp_SymPolyHash *)(cst_ActionView_ViewHelpers_slots), SPS___body__);
sp_RbVal _t341 = (sp_poly_truthy(_t340) ? _t340 : sp_box_str((&("\xff" "")[1])));
SP_GC_RESTORE();
return _t341;
return sp_box_nil();
}
static inline mrb_int sp_ActionView_ViewHelpers_cls_set_yield(mrb_int lv_content) {
SP_GC_SAVE();
sp_SymPolyHash_set(cst_ActionView_ViewHelpers_slots, SPS___body__, sp_box_int(lv_content));
return 0;
return 0;
}
static inline const char * sp_ActionView_ViewHelpers_cls_html_escape(sp_RbVal lv_s) {
SP_GC_SAVE();
sp_RbVal _t342 = lv_s;
const char * _t343 = (&("\xff")[1]);
if (_t342.tag == SP_TAG_STR) _t343 = sp_re_gsub_str_str_hash(sp_re_pat_0, _t342.v.s, cst_ActionView_ViewHelpers_HTML_ESCAPES);
if (_t342.tag == SP_TAG_OBJ) {
}
return _t343;
return (&("\xff")[1]);
}
static sp_RbVal sp_ActionView_ViewHelpers_cls_truncate(sp_RbVal lv_s, mrb_int lv_length, const char * lv_omission) {
mrb_int lv_cutoff = 0;
SP_GC_SAVE();
SP_GC_ROOT(lv_omission);
sp_RbVal _t344 = lv_s;
mrb_int _t345 = 0;
if (_t344.tag == SP_TAG_STR) _t345 = sp_str_length(_t344.v.s);
if (_t344.tag == SP_TAG_OBJ) {
if (_t344.cls_id == 26) _t345 = sp_ActionDispatch_Flash_length((sp_ActionDispatch_Flash *)_t344.v.p);
if (_t344.cls_id == 27) _t345 = sp_ActionDispatch_Session_length((sp_ActionDispatch_Session *)_t344.v.p);
if (_t344.cls_id == SP_BUILTIN_INT_ARRAY) _t345 = sp_IntArray_length((sp_IntArray *)_t344.v.p);
if (_t344.cls_id == SP_BUILTIN_FLT_ARRAY) _t345 = sp_FloatArray_length((sp_FloatArray *)_t344.v.p);
if (_t344.cls_id == SP_BUILTIN_STR_ARRAY) _t345 = sp_StrArray_length((sp_StrArray *)_t344.v.p);
if (_t344.cls_id == SP_BUILTIN_SYM_ARRAY) _t345 = sp_IntArray_length((sp_IntArray *)_t344.v.p);
if (_t344.cls_id == SP_BUILTIN_PTR_ARRAY) _t345 = sp_PtrArray_length((sp_PtrArray *)_t344.v.p);
if (_t344.cls_id == SP_BUILTIN_POLY_ARRAY) _t345 = sp_PolyArray_length((sp_PolyArray *)_t344.v.p);
if (_t344.cls_id == SP_BUILTIN_STR_INT_HASH) _t345 = sp_StrIntHash_length((sp_StrIntHash *)_t344.v.p);
if (_t344.cls_id == SP_BUILTIN_STR_STR_HASH) _t345 = sp_StrStrHash_length((sp_StrStrHash *)_t344.v.p);
if (_t344.cls_id == SP_BUILTIN_INT_STR_HASH) _t345 = sp_IntStrHash_length((sp_IntStrHash *)_t344.v.p);
if (_t344.cls_id == SP_BUILTIN_STR_POLY_HASH) _t345 = sp_StrPolyHash_length((sp_StrPolyHash *)_t344.v.p);
if (_t344.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t345 = sp_SymPolyHash_length((sp_SymPolyHash *)_t344.v.p);
if (_t344.cls_id == SP_BUILTIN_POLY_POLY_HASH) _t345 = sp_PolyPolyHash_length((sp_PolyPolyHash *)_t344.v.p);
if (_t344.cls_id == SP_BUILTIN_INT_ARRAY) _t345 = sp_IntArray_length((sp_IntArray *)_t344.v.p);
if (_t344.cls_id == SP_BUILTIN_FLT_ARRAY) _t345 = sp_FloatArray_length((sp_FloatArray *)_t344.v.p);
if (_t344.cls_id == SP_BUILTIN_STR_ARRAY) _t345 = sp_StrArray_length((sp_StrArray *)_t344.v.p);
if (_t344.cls_id == SP_BUILTIN_SYM_ARRAY) _t345 = sp_IntArray_length((sp_IntArray *)_t344.v.p);
if (_t344.cls_id == SP_BUILTIN_PTR_ARRAY) _t345 = sp_PtrArray_length((sp_PtrArray *)_t344.v.p);
if (_t344.cls_id == SP_BUILTIN_POLY_ARRAY) _t345 = sp_PolyArray_length((sp_PolyArray *)_t344.v.p);
}
if ((_t345 <= lv_length)) {
sp_RbVal _t346 = lv_s;
SP_GC_RESTORE();
return _t346;
}
lv_cutoff = (lv_length - sp_str_length(lv_omission));
if ((lv_cutoff < 0LL)) {
lv_cutoff = 0LL;
}
sp_RbVal _t347 = lv_s;
sp_RbVal _t348 = sp_box_nil();
if (_t347.tag == SP_TAG_INT) _t348 = sp_box_int(((_t347.v.i >> (0LL)) & 1));
if (_t347.tag == SP_TAG_OBJ) {
if (_t347.cls_id == 23) _t348 = sp_ActiveRecord_Base__aref((sp_ActiveRecord_Base *)_t347.v.p, sp_box_int(0LL));
if (_t347.cls_id == 26) _t348 = sp_ActionDispatch_Flash__aref((sp_ActionDispatch_Flash *)_t347.v.p, sp_box_int(0LL));
if (_t347.cls_id == 27) _t348 = sp_box_int(sp_ActionDispatch_Session__aref((sp_ActionDispatch_Session *)_t347.v.p, sp_box_int(0LL)));
if (_t347.cls_id == 33) _t348 = sp_ActiveRecord_Base__aref((sp_ActiveRecord_Base *)_t347.v.p, sp_box_int(0LL));
if (_t347.cls_id == 35) _t348 = sp_Comment__aref((sp_Comment *)_t347.v.p, sp_box_int(0LL));
if (_t347.cls_id == 37) _t348 = sp_Article__aref((sp_Article *)_t347.v.p, sp_box_int(0LL));
if (_t347.cls_id == SP_BUILTIN_INT_ARRAY) _t348 = sp_box_int(sp_IntArray_get((sp_IntArray *)_t347.v.p, 0LL));
if (_t347.cls_id == SP_BUILTIN_FLT_ARRAY) _t348 = sp_box_float(sp_FloatArray_get((sp_FloatArray *)_t347.v.p, 0LL));
if (_t347.cls_id == SP_BUILTIN_STR_ARRAY) _t348 = sp_box_str(sp_StrArray_get((sp_StrArray *)_t347.v.p, 0LL));
if (_t347.cls_id == SP_BUILTIN_SYM_ARRAY) _t348 = sp_box_sym((sp_sym)sp_IntArray_get((sp_IntArray *)_t347.v.p, 0LL));
if (_t347.cls_id == SP_BUILTIN_PTR_ARRAY) { void *_pe = sp_PtrArray_get((sp_PtrArray *)_t347.v.p, 0LL); _t348 = sp_box_obj(_pe, sp_obj_cls_id_of(_pe)); }
if (_t347.cls_id == SP_BUILTIN_POLY_ARRAY) _t348 = sp_PolyArray_get((sp_PolyArray *)_t347.v.p, 0LL);
if (_t347.cls_id == 45) _t348 = sp_box_int((((sp_Method *)_t347.v.p) && ((sp_Method *)_t347.v.p)->iv_fn_ptr ? ((mrb_int (*)(void *, mrb_int, mrb_int))(uintptr_t)((sp_Method *)_t347.v.p)->iv_fn_ptr)((void *)((sp_Method *)_t347.v.p)->iv_self_obj, 0LL, lv_cutoff) : 0));
}
sp_RbVal _t349 = sp_box_str(sp_sprintf("%s%s", sp_poly_to_s(_t348), lv_omission));
SP_GC_RESTORE();
return _t349;
return sp_box_nil();
}
static inline const char * sp_ActionView_ViewHelpers_cls_dom_id(sp_RbVal lv_record, sp_sym lv_suffix) {
SP_GC_SAVE();
if (FALSE) {
sp_RbVal _t350 = lv_record;
const char * _t351 = (&("\xff")[1]);
if (_t350.tag == SP_TAG_OBJ) {
if (_t350.cls_id == 23) _t351 = sp_ActiveRecord_Base_dom_prefix((sp_ActiveRecord_Base *)_t350.v.p);
if (_t350.cls_id == 33) _t351 = sp_ActiveRecord_Base_dom_prefix((sp_ActiveRecord_Base *)_t350.v.p);
if (_t350.cls_id == 35) _t351 = sp_Comment_dom_prefix((sp_Comment *)_t350.v.p);
if (_t350.cls_id == 37) _t351 = sp_Article_dom_prefix((sp_Article *)_t350.v.p);
}
sp_RbVal _t352 = lv_record;
sp_RbVal _t353 = sp_box_nil();
if (_t352.tag == SP_TAG_OBJ) {
if (_t352.cls_id == 23) _t353 = ((sp_ActiveRecord_Base *)_t352.v.p)->iv_id;
if (_t352.cls_id == 33) _t353 = ((sp_ApplicationRecord *)_t352.v.p)->iv_id;
if (_t352.cls_id == 34) _t353 = sp_CommentRow_id((sp_CommentRow *)_t352.v.p);
if (_t352.cls_id == 35) _t353 = sp_Comment_id((sp_Comment *)_t352.v.p);
if (_t352.cls_id == 36) _t353 = sp_ArticleRow_id((sp_ArticleRow *)_t352.v.p);
if (_t352.cls_id == 37) _t353 = sp_Article_id((sp_Article *)_t352.v.p);
}
return sp_sprintf("%s_%s", _t351, sp_poly_to_s(_t353));
} else {
sp_RbVal _t354 = lv_record;
const char * _t355 = (&("\xff")[1]);
if (_t354.tag == SP_TAG_OBJ) {
if (_t354.cls_id == 23) _t355 = sp_ActiveRecord_Base_dom_prefix((sp_ActiveRecord_Base *)_t354.v.p);
if (_t354.cls_id == 33) _t355 = sp_ActiveRecord_Base_dom_prefix((sp_ActiveRecord_Base *)_t354.v.p);
if (_t354.cls_id == 35) _t355 = sp_Comment_dom_prefix((sp_Comment *)_t354.v.p);
if (_t354.cls_id == 37) _t355 = sp_Article_dom_prefix((sp_Article *)_t354.v.p);
}
sp_RbVal _t356 = lv_record;
sp_RbVal _t357 = sp_box_nil();
if (_t356.tag == SP_TAG_OBJ) {
if (_t356.cls_id == 23) _t357 = ((sp_ActiveRecord_Base *)_t356.v.p)->iv_id;
if (_t356.cls_id == 33) _t357 = ((sp_ApplicationRecord *)_t356.v.p)->iv_id;
if (_t356.cls_id == 34) _t357 = sp_CommentRow_id((sp_CommentRow *)_t356.v.p);
if (_t356.cls_id == 35) _t357 = sp_Comment_id((sp_Comment *)_t356.v.p);
if (_t356.cls_id == 36) _t357 = sp_ArticleRow_id((sp_ArticleRow *)_t356.v.p);
if (_t356.cls_id == 37) _t357 = sp_Article_id((sp_Article *)_t356.v.p);
}
return sp_sprintf("%lld_%s_%s", (long long)lv_suffix, _t355, sp_poly_to_s(_t357));
}
return (&("\xff")[1]);
}
static inline const char * sp_ActionView_ViewHelpers_cls_link_to(sp_RbVal lv_text, const char * lv_href, sp_SymStrHash * lv_opts) {
SP_GC_SAVE();
const char * lv_attrs = (&("\xff")[1]);
SP_GC_ROOT(lv_attrs);
SP_GC_ROOT(lv_href);
SP_GC_ROOT(lv_opts);
sp_SymStrHash *_t358 = sp_SymStrHash_new();
sp_SymStrHash_set(_t358, SPS_href, lv_href);
sp_SymStrHash * _t359 = _t358;
SP_GC_ROOT(_t359);
lv_attrs = sp_ActionView_ViewHelpers_cls_render_attrs(sp_box_obj((void *)(sp_SymStrHash_merge(_t359, lv_opts)), SP_BUILTIN_SYM_STR_HASH));
return sp_sprintf("<a%s>%s</a>", lv_attrs, sp_ActionView_ViewHelpers_cls_html_escape(lv_text));
return (&("\xff")[1]);
}
static const char * sp_ActionView_ViewHelpers_cls_button_to(const char * lv_text, const char * lv_href, sp_SymPolyHash * lv_opts) {
SP_GC_SAVE();
sp_RbVal lv_method = sp_box_nil();
sp_RbVal lv_form_class = sp_box_nil();
sp_SymPolyHash * lv_inner_opts = NULL;
sp_SymStrHash * lv_form_attrs = NULL;
const char * lv_button_attrs = (&("\xff")[1]);
const char * lv_method_input = (&("\xff")[1]);
const char * lv_auth_token_input = (&("\xff")[1]);
SP_GC_ROOT(lv_inner_opts);
SP_GC_ROOT(lv_form_attrs);
SP_GC_ROOT(lv_button_attrs);
SP_GC_ROOT(lv_method_input);
SP_GC_ROOT(lv_auth_token_input);
SP_GC_ROOT(lv_text);
SP_GC_ROOT(lv_href);
SP_GC_ROOT(lv_opts);
lv_method = (sp_SymPolyHash_has_key(lv_opts, SPS_method) ? sp_SymPolyHash_get(lv_opts, SPS_method) : (((void)(0), sp_box_nil())));
lv_form_class = (sp_SymPolyHash_has_key(lv_opts, SPS_form_class) ? sp_SymPolyHash_get(lv_opts, SPS_form_class) : (((void)(0), sp_box_nil())));
sp_SymPolyHash * _t360 = lv_opts;
SP_GC_ROOT(_t360);
lv_inner_opts = sp_SymPolyHash_dup(_t360);
(sp_SymPolyHash_delete(lv_inner_opts, SPS_method), sp_box_nil());
(sp_SymPolyHash_delete(lv_inner_opts, SPS_form_class), sp_box_nil());
sp_SymStrHash *_t361 = sp_SymStrHash_new();
sp_SymStrHash_set(_t361, SPS_action, lv_href);
sp_SymStrHash_set(_t361, SPS_method, (&("\xff" "post")[1]));
lv_form_attrs = _t361;
sp_RbVal _t362 = lv_form_class;
sp_SymStrHash_set(lv_form_attrs, SPS_class, sp_poly_to_s((sp_poly_truthy(_t362) ? _t362 : sp_box_str((&("\xff" "button_to")[1])))));
sp_SymStrHash *_t363 = sp_SymStrHash_new();
sp_SymStrHash_set(_t363, SPS_type, (&("\xff" "submit")[1]));
lv_button_attrs = sp_ActionView_ViewHelpers_cls_render_attrs(sp_box_obj((void *)(sp_SymPolyHash_merge(sp_SymStrHash_to_sym_poly(_t363), lv_inner_opts)), SP_BUILTIN_SYM_POLY_HASH));
lv_method_input = (((!sp_poly_nil_p(lv_method)) && (!sp_str_eq(sp_poly_to_s(lv_method), (&("\xff" "post")[1])))) ? sp_sprintf("<input type=\"hidden\" name=\"_method\" value=\"%s\">", sp_poly_to_s(lv_method)) : (&("\xff" "")[1]));
lv_auth_token_input = (&("\xff" "<input type=\"hidden\" name=\"authenticity_token\" value=\"\">")[1]);
return sp_sprintf("<form%s>%s<button%s>%s</button>%s</form>", sp_ActionView_ViewHelpers_cls_render_attrs(sp_box_obj((void *)(lv_form_attrs), SP_BUILTIN_SYM_STR_HASH)), lv_method_input, lv_button_attrs, sp_ActionView_ViewHelpers_cls_html_escape(sp_box_str(lv_text)), lv_auth_token_input);
return (&("\xff")[1]);
}
static inline const char * sp_ActionView_ViewHelpers_cls_csrf_meta_tags(void) {
SP_GC_SAVE();
return (&("\xff" "<meta name=\"csrf-param\" content=\"authenticity_token\" />\n<meta name=\"csrf-token\" content=\"\" />")[1]);
return (&("\xff")[1]);
}
static inline const char * sp_ActionView_ViewHelpers_cls_csp_meta_tag(void) {
SP_GC_SAVE();
return (&("\xff" "")[1]);
return (&("\xff")[1]);
}
static inline const char * sp_ActionView_ViewHelpers_cls_stylesheet_link_tag(const char * lv_name, sp_SymStrHash * lv_opts) {
SP_GC_SAVE();
const char * lv_href = (&("\xff")[1]);
const char * lv_attrs = (&("\xff")[1]);
SP_GC_ROOT(lv_href);
SP_GC_ROOT(lv_attrs);
SP_GC_ROOT(lv_name);
SP_GC_ROOT(lv_opts);
lv_href = sp_sprintf("/assets/%s.css", lv_name);
sp_SymStrHash *_t364 = sp_SymStrHash_new();
sp_SymStrHash_set(_t364, SPS_rel, (&("\xff" "stylesheet")[1]));
sp_SymStrHash_set(_t364, SPS_href, lv_href);
sp_SymStrHash * _t365 = _t364;
SP_GC_ROOT(_t365);
lv_attrs = sp_ActionView_ViewHelpers_cls_render_attrs(sp_box_obj((void *)(sp_SymStrHash_merge(_t365, lv_opts)), SP_BUILTIN_SYM_STR_HASH));
return sp_sprintf("<link%s>", lv_attrs);
return (&("\xff")[1]);
}
static const char * sp_ActionView_ViewHelpers_cls_javascript_importmap_tags(sp_PolyArray * lv_pins, const char * lv_entry) {
SP_GC_SAVE();
const char * lv_json = (&("\xff")[1]);
const char * lv_import_lines = (&("\xff")[1]);
sp_RbVal lv_p = sp_box_nil();
sp_StrArray * lv_parts = NULL;
SP_GC_ROOT(lv_json);
SP_GC_ROOT(lv_import_lines);
SP_GC_ROOT(lv_parts);
SP_GC_ROOT(lv_pins);
SP_GC_ROOT(lv_entry);
if (((lv_pins == NULL) || (sp_PolyArray_length(lv_pins) == 0))) {
lv_json = (&("\xff" "{\n \"imports\": {\n \"@hotwired/turbo\": \"/assets/turbo.min.js\"\n }\n}")[1]);
const char * _t366 = (&("\xff" "<script type=\"importmap\" data-turbo-track=\"reload\">")[1]);
SP_GC_ROOT(_t366);
const char * _t367 = lv_json;
SP_GC_ROOT(_t367);
const char * _t368 = (&("\xff" "</script>")[1]);
SP_GC_ROOT(_t368);
const char * _t369 = (&("\xff" "\n")[1]);
SP_GC_ROOT(_t369);
const char * _t370 = (&("\xff" "<link rel=\"modulepreload\" href=\"/assets/turbo.min.js\">")[1]);
SP_GC_ROOT(_t370);
const char * _t371 = (&("\xff" "\n")[1]);
SP_GC_ROOT(_t371);
const char * _t372 = (&("\xff" "<script type=\"module\">import \"@hotwired/turbo\"</script>")[1]);
SP_GC_ROOT(_t372);
const char * _t373 = sp_str_concat_arr((const char *const[]){_t366, _t367, _t368, _t369, _t370, _t371, _t372}, 7);
SP_GC_RESTORE();
return _t373;
}
SP_GC_ROOT(lv_pins);
sp_StrArray *_t374 = sp_StrArray_new();
SP_GC_ROOT(_t374);
for (mrb_int _t375 = 0; _t375 < sp_PolyArray_length(lv_pins); _t375++) {
sp_RbVal lv_p = sp_PolyArray_get(lv_pins, _t375);
sp_RbVal _t376 = lv_p;
sp_RbVal _t377 = sp_box_nil();
if (_t376.tag == SP_TAG_OBJ) {
if (_t376.cls_id == 23) _t377 = sp_ActiveRecord_Base__aref((sp_ActiveRecord_Base *)_t376.v.p, sp_box_sym(SPS_name));
if (_t376.cls_id == 26) _t377 = sp_ActionDispatch_Flash__aref((sp_ActionDispatch_Flash *)_t376.v.p, sp_box_sym(SPS_name));
if (_t376.cls_id == 27) _t377 = sp_box_int(sp_ActionDispatch_Session__aref((sp_ActionDispatch_Session *)_t376.v.p, sp_box_sym(SPS_name)));
if (_t376.cls_id == 33) _t377 = sp_ActiveRecord_Base__aref((sp_ActiveRecord_Base *)_t376.v.p, sp_box_sym(SPS_name));
if (_t376.cls_id == 35) _t377 = sp_Comment__aref((sp_Comment *)_t376.v.p, sp_box_sym(SPS_name));
if (_t376.cls_id == 37) _t377 = sp_Article__aref((sp_Article *)_t376.v.p, sp_box_sym(SPS_name));
if (_t376.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t377 = sp_SymPolyHash_get((sp_SymPolyHash *)_t376.v.p, SPS_name);
if (_t376.cls_id == SP_BUILTIN_SYM_INT_HASH) _t377 = sp_box_int(sp_SymIntHash_get((sp_SymIntHash *)_t376.v.p, SPS_name));
if (_t376.cls_id == SP_BUILTIN_SYM_STR_HASH) _t377 = sp_box_str(sp_SymStrHash_get((sp_SymStrHash *)_t376.v.p, SPS_name));
}
sp_RbVal _t378 = lv_p;
sp_RbVal _t379 = sp_box_nil();
if (_t378.tag == SP_TAG_OBJ) {
if (_t378.cls_id == 23) _t379 = sp_ActiveRecord_Base__aref((sp_ActiveRecord_Base *)_t378.v.p, sp_box_sym(SPS_path));
if (_t378.cls_id == 26) _t379 = sp_ActionDispatch_Flash__aref((sp_ActionDispatch_Flash *)_t378.v.p, sp_box_sym(SPS_path));
if (_t378.cls_id == 27) _t379 = sp_box_int(sp_ActionDispatch_Session__aref((sp_ActionDispatch_Session *)_t378.v.p, sp_box_sym(SPS_path)));
if (_t378.cls_id == 33) _t379 = sp_ActiveRecord_Base__aref((sp_ActiveRecord_Base *)_t378.v.p, sp_box_sym(SPS_path));
if (_t378.cls_id == 35) _t379 = sp_Comment__aref((sp_Comment *)_t378.v.p, sp_box_sym(SPS_path));
if (_t378.cls_id == 37) _t379 = sp_Article__aref((sp_Article *)_t378.v.p, sp_box_sym(SPS_path));
if (_t378.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t379 = sp_SymPolyHash_get((sp_SymPolyHash *)_t378.v.p, SPS_path);
if (_t378.cls_id == SP_BUILTIN_SYM_INT_HASH) _t379 = sp_box_int(sp_SymIntHash_get((sp_SymIntHash *)_t378.v.p, SPS_path));
if (_t378.cls_id == SP_BUILTIN_SYM_STR_HASH) _t379 = sp_box_str(sp_SymStrHash_get((sp_SymStrHash *)_t378.v.p, SPS_path));
}
sp_StrArray_push(_t374, sp_sprintf(" \"%s\": \"%s\"", sp_poly_to_s(_t377), sp_poly_to_s(_t379)));
}
sp_StrArray * _t380 = _t374;
SP_GC_ROOT(_t380);
lv_import_lines = sp_StrArray_join(_t380, (&("\xff" ",\n")[1]));
lv_json = sp_str_concat3((&("\xff" "{\n \"imports\": {\n")[1]), lv_import_lines, (&("\xff" "\n }\n}")[1]));
lv_parts = sp_StrArray_new();
sp_StrArray_push(lv_parts, sp_str_concat3((&("\xff" "<script type=\"importmap\" data-turbo-track=\"reload\">")[1]), lv_json, (&("\xff" "</script>")[1])));
for (mrb_int _t381 = 0; _t381 < sp_PolyArray_length(lv_pins); _t381++) {
lv_p = sp_PolyArray_get(lv_pins, _t381);
sp_redo_13: ;
sp_RbVal _t382 = lv_p;
sp_RbVal _t383 = sp_box_nil();
if (_t382.tag == SP_TAG_OBJ) {
if (_t382.cls_id == 23) _t383 = sp_ActiveRecord_Base__aref((sp_ActiveRecord_Base *)_t382.v.p, sp_box_sym(SPS_path));
if (_t382.cls_id == 26) _t383 = sp_ActionDispatch_Flash__aref((sp_ActionDispatch_Flash *)_t382.v.p, sp_box_sym(SPS_path));
if (_t382.cls_id == 27) _t383 = sp_box_int(sp_ActionDispatch_Session__aref((sp_ActionDispatch_Session *)_t382.v.p, sp_box_sym(SPS_path)));
if (_t382.cls_id == 33) _t383 = sp_ActiveRecord_Base__aref((sp_ActiveRecord_Base *)_t382.v.p, sp_box_sym(SPS_path));
if (_t382.cls_id == 35) _t383 = sp_Comment__aref((sp_Comment *)_t382.v.p, sp_box_sym(SPS_path));
if (_t382.cls_id == 37) _t383 = sp_Article__aref((sp_Article *)_t382.v.p, sp_box_sym(SPS_path));
if (_t382.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t383 = sp_SymPolyHash_get((sp_SymPolyHash *)_t382.v.p, SPS_path);
if (_t382.cls_id == SP_BUILTIN_SYM_INT_HASH) _t383 = sp_box_int(sp_SymIntHash_get((sp_SymIntHash *)_t382.v.p, SPS_path));
if (_t382.cls_id == SP_BUILTIN_SYM_STR_HASH) _t383 = sp_box_str(sp_SymStrHash_get((sp_SymStrHash *)_t382.v.p, SPS_path));
}
sp_StrArray_push(lv_parts, sp_sprintf("<link rel=\"modulepreload\" href=\"%s\">", sp_poly_to_s(_t383)));
}
sp_StrArray_push(lv_parts, sp_sprintf("<script type=\"module\">import \"%s\"</script>", lv_entry));
return sp_StrArray_join(lv_parts, (&("\xff" "\n")[1]));
return (&("\xff")[1]);
}
static inline const char * sp_ActionView_ViewHelpers_cls_turbo_stream_from(const char * lv_stream) {
SP_GC_SAVE();
const char * lv_encoded = (&("\xff")[1]);
SP_GC_ROOT(lv_encoded);
SP_GC_ROOT(lv_stream);
lv_encoded = sp_Base64_cls_strict_encode64(sp_JSON_cls_generate((const char *)lv_stream));
return sp_sprintf("<turbo-cable-stream-source channel=\"Turbo::StreamsChannel\" signed-stream-name=\"%s--unsigned\"></turbo-cable-stream-source>", lv_encoded);
return (&("\xff")[1]);
}
static const char * sp_ActionView_ViewHelpers_cls_form_with(sp_RbVal lv_model, const char * lv_model_name, const char * lv_action, sp_sym lv_method, sp_SymStrHash * lv_opts) {
SP_GC_SAVE();
sp_ActionView_ViewHelpers_FormBuilder * lv_builder = NULL;
mrb_int lv_body = 0;
const char * lv_method_str = (&("\xff")[1]);
const char * lv_method_input = (&("\xff")[1]);
const char * lv_auth_token_input = (&("\xff")[1]);
const char * lv_form_method = (&("\xff")[1]);
const char * lv_attrs = (&("\xff")[1]);
SP_GC_ROOT(lv_builder);
SP_GC_ROOT(lv_method_str);
SP_GC_ROOT(lv_method_input);
SP_GC_ROOT(lv_auth_token_input);
SP_GC_ROOT(lv_form_method);
SP_GC_ROOT(lv_attrs);
SP_GC_ROOT(lv_model_name);
SP_GC_ROOT(lv_action);
SP_GC_ROOT(lv_opts);
lv_builder = sp_ActionView_ViewHelpers_FormBuilder_new(lv_model, lv_model_name, lv_action, lv_method);
lv_body = 0;
lv_method_str = sp_sym_to_s(lv_method);
lv_method_input = (((!sp_str_eq(lv_method_str, (&("\xff" "get")[1]))) && (!sp_str_eq(lv_method_str, (&("\xff" "post")[1])))) ? sp_sprintf("<input type=\"hidden\" name=\"_method\" value=\"%s\">", lv_method_str) : (&("\xff" "")[1]));
lv_auth_token_input = (&("\xff" "<input type=\"hidden\" name=\"authenticity_token\" value=\"\">")[1]);
lv_form_method = (sp_str_eq(lv_method_str, (&("\xff" "get")[1])) ? (&("\xff" "get")[1]) : (&("\xff" "post")[1]));
sp_SymStrHash *_t384 = sp_SymStrHash_new();
sp_SymStrHash_set(_t384, SPS_action, lv_action);
sp_SymStrHash_set(_t384, ((sp_sym)51), (&("\xff" "UTF-8")[1]));
sp_SymStrHash_set(_t384, SPS_method, lv_form_method);
sp_SymStrHash * _t385 = _t384;
SP_GC_ROOT(_t385);
lv_attrs = sp_ActionView_ViewHelpers_cls_render_attrs(sp_box_obj((void *)(sp_SymStrHash_merge(_t385, lv_opts)), SP_BUILTIN_SYM_STR_HASH));
return sp_sprintf("<form%s>%s%s%lld</form>", lv_attrs, lv_method_input, lv_auth_token_input, (long long)lv_body);
return (&("\xff")[1]);
}
static const char * sp_ActionView_ViewHelpers_cls_render_attrs(sp_RbVal lv_attrs) {
SP_GC_SAVE();
sp_StrArray * lv_pairs = NULL;
mrb_int lv_k = 0;
mrb_int lv_v = 0;
const char * lv_name = (&("\xff")[1]);
mrb_int lv_inner_k = 0;
mrb_int lv_inner_v = 0;
const char * lv_inner_name = (&("\xff")[1]);
SP_GC_ROOT(lv_pairs);
SP_GC_ROOT(lv_name);
SP_GC_ROOT(lv_inner_name);
sp_RbVal _t386 = lv_attrs;
mrb_bool _t387 = FALSE;
if (_t386.tag == SP_TAG_STR) _t387 = (sp_str_length(_t386.v.s) == 0);
if (_t386.tag == SP_TAG_OBJ) {
if (_t386.cls_id == 26) _t387 = sp_ActionDispatch_Flash_empty_p((sp_ActionDispatch_Flash *)_t386.v.p);
if (_t386.cls_id == 27) _t387 = sp_ActionDispatch_Session_empty_p((sp_ActionDispatch_Session *)_t386.v.p);
if (_t386.cls_id == SP_BUILTIN_INT_ARRAY) _t387 = (sp_IntArray_length((sp_IntArray *)_t386.v.p) == 0);
if (_t386.cls_id == SP_BUILTIN_FLT_ARRAY) _t387 = (sp_FloatArray_length((sp_FloatArray *)_t386.v.p) == 0);
if (_t386.cls_id == SP_BUILTIN_STR_ARRAY) _t387 = (sp_StrArray_length((sp_StrArray *)_t386.v.p) == 0);
if (_t386.cls_id == SP_BUILTIN_SYM_ARRAY) _t387 = (sp_IntArray_length((sp_IntArray *)_t386.v.p) == 0);
if (_t386.cls_id == SP_BUILTIN_PTR_ARRAY) _t387 = (sp_PtrArray_length((sp_PtrArray *)_t386.v.p) == 0);
if (_t386.cls_id == SP_BUILTIN_POLY_ARRAY) _t387 = (sp_PolyArray_length((sp_PolyArray *)_t386.v.p) == 0);
if (_t386.cls_id == SP_BUILTIN_STR_INT_HASH) _t387 = (sp_StrIntHash_length((sp_StrIntHash *)_t386.v.p) == 0);
if (_t386.cls_id == SP_BUILTIN_STR_STR_HASH) _t387 = (sp_StrStrHash_length((sp_StrStrHash *)_t386.v.p) == 0);
if (_t386.cls_id == SP_BUILTIN_INT_STR_HASH) _t387 = (sp_IntStrHash_length((sp_IntStrHash *)_t386.v.p) == 0);
if (_t386.cls_id == SP_BUILTIN_STR_POLY_HASH) _t387 = (sp_StrPolyHash_length((sp_StrPolyHash *)_t386.v.p) == 0);
if (_t386.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t387 = (sp_SymPolyHash_length((sp_SymPolyHash *)_t386.v.p) == 0);
if (_t386.cls_id == SP_BUILTIN_POLY_POLY_HASH) _t387 = (sp_PolyPolyHash_length((sp_PolyPolyHash *)_t386.v.p) == 0);
}
if (_t387) {
const char * _t388 = (&("\xff" "")[1]);
SP_GC_RESTORE();
return _t388;
}
lv_pairs = sp_StrArray_new();
sp_RbVal _t389 = lv_attrs;
if (_t389.tag == SP_TAG_OBJ) {
mrb_int _t390_len = 0;
if (_t389.cls_id == SP_BUILTIN_RANGE) _t390_len = ((sp_Range *)_t389.v.p)->last - ((sp_Range *)_t389.v.p)->first + 1;
else if (_t389.cls_id == SP_BUILTIN_INT_ARRAY) _t390_len = sp_IntArray_length((sp_IntArray *)_t389.v.p);
else if (_t389.cls_id == SP_BUILTIN_FLT_ARRAY) _t390_len = sp_FloatArray_length((sp_FloatArray *)_t389.v.p);
else if (_t389.cls_id == SP_BUILTIN_STR_ARRAY) _t390_len = sp_StrArray_length((sp_StrArray *)_t389.v.p);
else if (_t389.cls_id == SP_BUILTIN_SYM_ARRAY) _t390_len = sp_IntArray_length((sp_IntArray *)_t389.v.p);
else if (_t389.cls_id == SP_BUILTIN_PTR_ARRAY) _t390_len = sp_PtrArray_length((sp_PtrArray *)_t389.v.p);
else if (_t389.cls_id == SP_BUILTIN_POLY_ARRAY) _t390_len = sp_PolyArray_length((sp_PolyArray *)_t389.v.p);
for (mrb_int _t390 = 0; _t390 < _t390_len; _t390++) {
sp_RbVal _t391 = sp_box_nil();
if (_t389.cls_id == SP_BUILTIN_RANGE) _t391 = sp_box_int(((sp_Range *)_t389.v.p)->first + _t390);
else if (_t389.cls_id == SP_BUILTIN_INT_ARRAY) _t391 = sp_box_int(sp_IntArray_get((sp_IntArray *)_t389.v.p, _t390));
else if (_t389.cls_id == SP_BUILTIN_FLT_ARRAY) _t391 = sp_box_float(sp_FloatArray_get((sp_FloatArray *)_t389.v.p, _t390));
else if (_t389.cls_id == SP_BUILTIN_STR_ARRAY) _t391 = sp_box_str(sp_StrArray_get((sp_StrArray *)_t389.v.p, _t390));
else if (_t389.cls_id == SP_BUILTIN_SYM_ARRAY) _t391 = sp_box_sym((sp_sym)sp_IntArray_get((sp_IntArray *)_t389.v.p, _t390));
else if (_t389.cls_id == SP_BUILTIN_PTR_ARRAY) { void *_pe = sp_PtrArray_get((sp_PtrArray *)_t389.v.p, _t390); _t391 = sp_box_obj(_pe, sp_obj_cls_id_of(_pe)); }
else if (_t389.cls_id == SP_BUILTIN_POLY_ARRAY) _t391 = sp_PolyArray_get((sp_PolyArray *)_t389.v.p, _t390);
sp_RbVal lv_k = sp_box_nil();
sp_RbVal lv_v = sp_box_nil();
if (_t391.tag == SP_TAG_OBJ && _t391.cls_id == SP_BUILTIN_POLY_ARRAY) {
sp_PolyArray *_pa = (sp_PolyArray *)_t391.v.p;
if (sp_PolyArray_length(_pa) > 0) lv_k = sp_PolyArray_get(_pa, 0);
if (sp_PolyArray_length(_pa) > 1) lv_v = sp_PolyArray_get(_pa, 1);
} else if (_t391.tag == SP_TAG_OBJ && _t391.cls_id == SP_BUILTIN_INT_ARRAY) {
sp_IntArray *_ia = (sp_IntArray *)_t391.v.p;
if (sp_IntArray_length(_ia) > 0) lv_k = sp_box_int(sp_IntArray_get(_ia, 0));
if (sp_IntArray_length(_ia) > 1) lv_v = sp_box_int(sp_IntArray_get(_ia, 1));
} else {
lv_k = _t391;
}
sp_redo_14: ;
if (sp_poly_nil_p(lv_v)) {
continue;
}
lv_name = sp_poly_to_s(lv_k);
sp_RbVal _t392 = lv_v;
if ((_t392.tag == SP_TAG_OBJ && (_t392.cls_id == SP_BUILTIN_STR_INT_HASH || _t392.cls_id == SP_BUILTIN_STR_STR_HASH || _t392.cls_id == SP_BUILTIN_INT_STR_HASH || _t392.cls_id == SP_BUILTIN_SYM_INT_HASH || _t392.cls_id == SP_BUILTIN_SYM_STR_HASH || _t392.cls_id == SP_BUILTIN_STR_POLY_HASH || _t392.cls_id == SP_BUILTIN_SYM_POLY_HASH))) {
sp_RbVal _t393 = lv_v;
if (_t393.tag == SP_TAG_OBJ) {
mrb_int _t394_len = 0;
if (_t393.cls_id == SP_BUILTIN_RANGE) _t394_len = ((sp_Range *)_t393.v.p)->last - ((sp_Range *)_t393.v.p)->first + 1;
else if (_t393.cls_id == SP_BUILTIN_INT_ARRAY) _t394_len = sp_IntArray_length((sp_IntArray *)_t393.v.p);
else if (_t393.cls_id == SP_BUILTIN_FLT_ARRAY) _t394_len = sp_FloatArray_length((sp_FloatArray *)_t393.v.p);
else if (_t393.cls_id == SP_BUILTIN_STR_ARRAY) _t394_len = sp_StrArray_length((sp_StrArray *)_t393.v.p);
else if (_t393.cls_id == SP_BUILTIN_SYM_ARRAY) _t394_len = sp_IntArray_length((sp_IntArray *)_t393.v.p);
else if (_t393.cls_id == SP_BUILTIN_PTR_ARRAY) _t394_len = sp_PtrArray_length((sp_PtrArray *)_t393.v.p);
else if (_t393.cls_id == SP_BUILTIN_POLY_ARRAY) _t394_len = sp_PolyArray_length((sp_PolyArray *)_t393.v.p);
for (mrb_int _t394 = 0; _t394 < _t394_len; _t394++) {
sp_RbVal _t395 = sp_box_nil();
if (_t393.cls_id == SP_BUILTIN_RANGE) _t395 = sp_box_int(((sp_Range *)_t393.v.p)->first + _t394);
else if (_t393.cls_id == SP_BUILTIN_INT_ARRAY) _t395 = sp_box_int(sp_IntArray_get((sp_IntArray *)_t393.v.p, _t394));
else if (_t393.cls_id == SP_BUILTIN_FLT_ARRAY) _t395 = sp_box_float(sp_FloatArray_get((sp_FloatArray *)_t393.v.p, _t394));
else if (_t393.cls_id == SP_BUILTIN_STR_ARRAY) _t395 = sp_box_str(sp_StrArray_get((sp_StrArray *)_t393.v.p, _t394));
else if (_t393.cls_id == SP_BUILTIN_SYM_ARRAY) _t395 = sp_box_sym((sp_sym)sp_IntArray_get((sp_IntArray *)_t393.v.p, _t394));
else if (_t393.cls_id == SP_BUILTIN_PTR_ARRAY) { void *_pe = sp_PtrArray_get((sp_PtrArray *)_t393.v.p, _t394); _t395 = sp_box_obj(_pe, sp_obj_cls_id_of(_pe)); }
else if (_t393.cls_id == SP_BUILTIN_POLY_ARRAY) _t395 = sp_PolyArray_get((sp_PolyArray *)_t393.v.p, _t394);
sp_RbVal lv_inner_k = sp_box_nil();
sp_RbVal lv_inner_v = sp_box_nil();
if (_t395.tag == SP_TAG_OBJ && _t395.cls_id == SP_BUILTIN_POLY_ARRAY) {
sp_PolyArray *_pa = (sp_PolyArray *)_t395.v.p;
if (sp_PolyArray_length(_pa) > 0) lv_inner_k = sp_PolyArray_get(_pa, 0);
if (sp_PolyArray_length(_pa) > 1) lv_inner_v = sp_PolyArray_get(_pa, 1);
} else if (_t395.tag == SP_TAG_OBJ && _t395.cls_id == SP_BUILTIN_INT_ARRAY) {
sp_IntArray *_ia = (sp_IntArray *)_t395.v.p;
if (sp_IntArray_length(_ia) > 0) lv_inner_k = sp_box_int(sp_IntArray_get(_ia, 0));
if (sp_IntArray_length(_ia) > 1) lv_inner_v = sp_box_int(sp_IntArray_get(_ia, 1));
} else {
lv_inner_k = _t395;
}
sp_redo_15: ;
if (sp_poly_nil_p(lv_inner_v)) {
continue;
}
const char * _t396 = sp_poly_to_s(lv_inner_k);
SP_GC_ROOT(_t396);
lv_inner_name = sp_str_tr(_t396, (&("\xff" "_")[1]), (&("\xff" "-")[1]));
sp_StrArray_push(lv_pairs, sp_sprintf(" %s-%s=\"%s\"", lv_name, lv_inner_name, sp_ActionView_ViewHelpers_cls_html_escape(sp_box_str(sp_poly_to_s(lv_inner_v)))));
}
}
} else {
sp_StrArray_push(lv_pairs, sp_sprintf(" %s=\"%s\"", lv_name, sp_ActionView_ViewHelpers_cls_html_escape(sp_box_str(sp_poly_to_s(lv_v)))));
}
}
}
return sp_StrArray_join(lv_pairs, "");
return (&("\xff")[1]);
}
static inline const char * sp_JsonBuilder_cls_encode_string(const char * lv_s) {
SP_GC_SAVE();
SP_GC_ROOT(lv_s);
return sp_re_gsub_str_str_hash(sp_re_pat_1, lv_s, cst_JsonBuilder_ESCAPES);
return (&("\xff")[1]);
}
static const char * sp_JsonBuilder_cls_encode_value(sp_RbVal lv_v) {
SP_GC_SAVE();
if (sp_poly_nil_p(lv_v)) {
const char * _t397 = (&("\xff" "null")[1]);
SP_GC_RESTORE();
return _t397;
}
sp_RbVal _t398 = lv_v;
if ((_t398.tag == SP_TAG_BOOL && _t398.v.b)) {
const char * _t399 = (&("\xff" "true")[1]);
SP_GC_RESTORE();
return _t399;
}
sp_RbVal _t400 = lv_v;
if ((_t400.tag == SP_TAG_BOOL && !_t400.v.b)) {
const char * _t401 = (&("\xff" "false")[1]);
SP_GC_RESTORE();
return _t401;
}
sp_RbVal _t402 = lv_v;
if ((_t402.tag == SP_TAG_INT)) {
const char * _t403 = sp_poly_to_s(lv_v);
SP_GC_RESTORE();
return _t403;
}
sp_RbVal _t404 = lv_v;
if ((_t404.tag == SP_TAG_FLT)) {
const char * _t405 = sp_poly_to_s(lv_v);
SP_GC_RESTORE();
return _t405;
}
sp_RbVal _t406 = lv_v;
if ((_t406.tag == SP_TAG_STR)) {
const char * _t407 = sp_sprintf("\"%s\"", sp_JsonBuilder_cls_encode_string((lv_v).v.s));
SP_GC_RESTORE();
return _t407;
}
return sp_sprintf("\"%s\"", sp_JsonBuilder_cls_encode_string(sp_poly_to_s(lv_v)));
return (&("\xff")[1]);
}
static const char * sp_JsonBuilder_cls_encode_datetime(sp_RbVal lv_s) {
SP_GC_SAVE();
const char * lv_str = (&("\xff")[1]);
const char * lv_date = (&("\xff")[1]);
const char * lv_time = (&("\xff")[1]);
const char * lv_ms = (&("\xff")[1]);
const char * lv_frac = (&("\xff")[1]);
const char * lv_padded = (&("\xff")[1]);
SP_GC_ROOT(lv_str);
SP_GC_ROOT(lv_date);
SP_GC_ROOT(lv_time);
SP_GC_ROOT(lv_ms);
SP_GC_ROOT(lv_frac);
SP_GC_ROOT(lv_padded);
if (sp_poly_nil_p(lv_s)) {
const char * _t408 = (&("\xff" "null")[1]);
SP_GC_RESTORE();
return _t408;
}
lv_str = sp_poly_to_s(lv_s);
if ((sp_str_length(lv_str) < 19LL)) {
const char * _t409 = sp_sprintf("\"%s\"", sp_JsonBuilder_cls_encode_string((const char *)lv_str));
SP_GC_RESTORE();
return _t409;
}
lv_date = sp_str_sub_range(lv_str, 0LL, 10LL);
lv_time = sp_str_sub_range(lv_str, 11LL, 8LL);
lv_ms = (&("\xff" "000")[1]);
if (((sp_str_length(lv_str) > 20LL) && (lv_str[(mrb_int)19LL] == '.'))) {
lv_frac = sp_str_sub_range_r(lv_str, 20LL, -1, 0);
lv_padded = sp_sprintf("%s000", lv_frac);
lv_ms = sp_str_sub_range(lv_padded, 0LL, 3LL);
}
return sp_sprintf("\"%sT%s.%sZ\"", lv_date, lv_time, lv_ms);
return (&("\xff")[1]);
}
static inline sp_PolyArray * sp_Broadcasts_cls_reset_log_bang(void) {
SP_GC_SAVE();
cst_Broadcasts_LOG->len = 0;
return NULL;
return NULL;
}
static inline sp_PolyArray * sp_Broadcasts_cls_log(void) {
SP_GC_SAVE();
return sp_PolyArray_dup(cst_Broadcasts_LOG);
return NULL;
}
static inline sp_IntArray * sp_Broadcasts_cls_set_transport(mrb_int lv_transport) {
SP_GC_SAVE();
cst_Broadcasts_TRANSPORTS->len = 0; cst_Broadcasts_TRANSPORTS->start = 0;
return (sp_IntArray_push(cst_Broadcasts_TRANSPORTS, lv_transport), cst_Broadcasts_TRANSPORTS);
return NULL;
}
static inline mrb_int sp_Broadcasts_cls_append(const char * lv_stream, const char * lv_target, sp_String * lv_html) {
SP_GC_SAVE();
SP_GC_ROOT(lv_stream);
SP_GC_ROOT(lv_target);
SP_GC_ROOT(lv_html);
return sp_Broadcasts_cls_record(SPS_append, lv_stream, lv_target, ({ sp_String *_t410 = lv_html; _t410 ? sp_box_str(_t410->data) : sp_box_nil(); }));
return 0;
}
static inline mrb_int sp_Broadcasts_cls_prepend(const char * lv_stream, const char * lv_target, sp_String * lv_html) {
SP_GC_SAVE();
SP_GC_ROOT(lv_stream);
SP_GC_ROOT(lv_target);
SP_GC_ROOT(lv_html);
return sp_Broadcasts_cls_record(SPS_prepend, lv_stream, lv_target, ({ sp_String *_t411 = lv_html; _t411 ? sp_box_str(_t411->data) : sp_box_nil(); }));
return 0;
}
static inline mrb_int sp_Broadcasts_cls_replace(const char * lv_stream, const char * lv_target, sp_String * lv_html) {
SP_GC_SAVE();
SP_GC_ROOT(lv_stream);
SP_GC_ROOT(lv_target);
SP_GC_ROOT(lv_html);
return sp_Broadcasts_cls_record(SPS_replace, lv_stream, lv_target, ({ sp_String *_t412 = lv_html; _t412 ? sp_box_str(_t412->data) : sp_box_nil(); }));
return 0;
}
static inline mrb_int sp_Broadcasts_cls_remove(const char * lv_stream, const char * lv_target) {
SP_GC_SAVE();
SP_GC_ROOT(lv_stream);
SP_GC_ROOT(lv_target);
return sp_Broadcasts_cls_record(SPS_remove, lv_stream, lv_target, sp_box_str((&("\xff" "")[1])));
return 0;
}
static mrb_int sp_Broadcasts_cls_record(sp_sym lv_action, const char * lv_stream, const char * lv_target, sp_RbVal lv_html) {
SP_GC_SAVE();
sp_SymPolyHash * lv_entry = NULL;
const char * lv_fragment = (&("\xff")[1]);
SP_GC_ROOT(lv_entry);
SP_GC_ROOT(lv_fragment);
SP_GC_ROOT(lv_stream);
SP_GC_ROOT(lv_target);
sp_SymPolyHash *_t413 = sp_SymPolyHash_new();
sp_SymPolyHash_set(_t413, SPS_action, sp_box_sym(lv_action));
sp_SymPolyHash_set(_t413, SPS_stream, sp_box_str(lv_stream));
sp_SymPolyHash_set(_t413, SPS_target, sp_box_str(lv_target));
sp_SymPolyHash_set(_t413, SPS_html, lv_html);
lv_entry = _t413;
sp_PolyArray_push(cst_Broadcasts_LOG, sp_box_obj((void *)(lv_entry), SP_BUILTIN_SYM_POLY_HASH));
if ((sp_IntArray_length(cst_Broadcasts_TRANSPORTS) > 0LL)) {
lv_fragment = sp_Broadcasts_cls_render_fragment(lv_action, lv_target, lv_html);
sp_Broadcasts_SeedTransport_broadcast((sp_Broadcasts_SeedTransport *)sp_IntArray_get(cst_Broadcasts_TRANSPORTS, 0LL), lv_stream, lv_fragment);
}
return 0;
return 0;
}
static inline const char * sp_Broadcasts_cls_render_fragment(sp_sym lv_action, const char * lv_target, sp_RbVal lv_html) {
SP_GC_SAVE();
SP_GC_ROOT(lv_target);
if ((lv_action == SPS_remove)) {
return sp_sprintf("<turbo-stream action=\"remove\" target=\"%s\"></turbo-stream>", lv_target);
} else {
return sp_sprintf("<turbo-stream action=\"%lld\" target=\"%s\"><template>%s</template></turbo-stream>", (long long)lv_action, lv_target, sp_poly_to_s(lv_html));
}
return (&("\xff")[1]);
}
static inline sp_PolyArray * sp_Importmap_cls_pins(void) {
SP_GC_SAVE();
sp_PolyArray *_t414 = sp_PolyArray_new();
sp_SymStrHash *_t415 = sp_SymStrHash_new();
sp_SymStrHash_set(_t415, SPS_name, (&("\xff" "application")[1]));
sp_SymStrHash_set(_t415, SPS_path, (&("\xff" "/assets/application.js")[1]));
sp_PolyArray_push(_t414, sp_box_obj((void *)(_t415), SP_BUILTIN_SYM_STR_HASH));
sp_SymStrHash *_t416 = sp_SymStrHash_new();
sp_SymStrHash_set(_t416, SPS_name, (&("\xff" "@hotwired/turbo-rails")[1]));
sp_SymStrHash_set(_t416, SPS_path, (&("\xff" "/assets/turbo.min.js")[1]));
sp_PolyArray_push(_t414, sp_box_obj((void *)(_t416), SP_BUILTIN_SYM_STR_HASH));
sp_SymStrHash *_t417 = sp_SymStrHash_new();
sp_SymStrHash_set(_t417, SPS_name, (&("\xff" "@hotwired/stimulus")[1]));
sp_SymStrHash_set(_t417, SPS_path, (&("\xff" "/assets/stimulus.min.js")[1]));
sp_PolyArray_push(_t414, sp_box_obj((void *)(_t417), SP_BUILTIN_SYM_STR_HASH));
sp_SymStrHash *_t418 = sp_SymStrHash_new();
sp_SymStrHash_set(_t418, SPS_name, (&("\xff" "@hotwired/stimulus-loading")[1]));
sp_SymStrHash_set(_t418, SPS_path, (&("\xff" "/assets/stimulus-loading.js")[1]));
sp_PolyArray_push(_t414, sp_box_obj((void *)(_t418), SP_BUILTIN_SYM_STR_HASH));
sp_SymStrHash *_t419 = sp_SymStrHash_new();
sp_SymStrHash_set(_t419, SPS_name, (&("\xff" "controllers/application")[1]));
sp_SymStrHash_set(_t419, SPS_path, (&("\xff" "/assets/controllers/application.js")[1]));
sp_PolyArray_push(_t414, sp_box_obj((void *)(_t419), SP_BUILTIN_SYM_STR_HASH));
sp_SymStrHash *_t420 = sp_SymStrHash_new();
sp_SymStrHash_set(_t420, SPS_name, (&("\xff" "controllers/hello_controller")[1]));
sp_SymStrHash_set(_t420, SPS_path, (&("\xff" "/assets/controllers/hello_controller.js")[1]));
sp_PolyArray_push(_t414, sp_box_obj((void *)(_t420), SP_BUILTIN_SYM_STR_HASH));
sp_SymStrHash *_t421 = sp_SymStrHash_new();
sp_SymStrHash_set(_t421, SPS_name, (&("\xff" "controllers")[1]));
sp_SymStrHash_set(_t421, SPS_path, (&("\xff" "/assets/controllers/index.js")[1]));
sp_PolyArray_push(_t414, sp_box_obj((void *)(_t421), SP_BUILTIN_SYM_STR_HASH));
return _t414;
return NULL;
}
static inline const char * sp_Importmap_cls_entry(void) {
SP_GC_SAVE();
return (&("\xff" "application")[1]);
return (&("\xff")[1]);
}
static inline const char * sp_RouteHelpers_cls_root_path(void) {
SP_GC_SAVE();
return (&("\xff" "/")[1]);
return (&("\xff")[1]);
}
static inline const char * sp_RouteHelpers_cls_articles_path(void) {
SP_GC_SAVE();
return (&("\xff" "/articles")[1]);
return (&("\xff")[1]);
}
static inline const char * sp_RouteHelpers_cls_new_article_path(void) {
SP_GC_SAVE();
return (&("\xff" "/articles/new")[1]);
return (&("\xff")[1]);
}
static inline const char * sp_RouteHelpers_cls_article_path(sp_RbVal lv_id) {
SP_GC_SAVE();
return sp_sprintf("/articles/%s", sp_poly_to_s(lv_id));
return (&("\xff")[1]);
}
static inline const char * sp_RouteHelpers_cls_edit_article_path(sp_RbVal lv_id) {
SP_GC_SAVE();
return sp_sprintf("/articles/%s/edit", sp_poly_to_s(lv_id));
return (&("\xff")[1]);
}
static inline const char * sp_RouteHelpers_cls_article_comments_path(sp_RbVal lv_article_id) {
SP_GC_SAVE();
return sp_sprintf("/articles/%s/comments", sp_poly_to_s(lv_article_id));
return (&("\xff")[1]);
}
static inline const char * sp_RouteHelpers_cls_article_comment_path(sp_RbVal lv_article_id, sp_RbVal lv_id) {
SP_GC_SAVE();
return sp_sprintf("/articles/%s/comments/%s", sp_poly_to_s(lv_article_id), sp_poly_to_s(lv_id));
return (&("\xff")[1]);
}
static sp_String * sp_Views_Comments_cls_comment(sp_RbVal lv_comment, sp_String * lv_notice, sp_String * lv_alert) {
SP_GC_SAVE();
sp_String * lv_io = NULL;
SP_GC_ROOT(lv_io);
SP_GC_ROOT(lv_notice);
SP_GC_ROOT(lv_alert);
lv_io = sp_String_new("");
sp_String_append(lv_io, (&("\xff" "<div id=\"")[1]));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_dom_id(lv_comment, 0));
sp_String_append(lv_io, (&("\xff" "\" class=\"p-4 bg-gray-50 rounded\">\n <p class=\"font-semibold\">")[1]));
sp_RbVal _t422 = lv_comment;
sp_RbVal _t423 = sp_box_nil();
if (_t422.tag == SP_TAG_OBJ) {
if (_t422.cls_id == 34) _t423 = sp_box_str(sp_CommentRow_commenter((sp_CommentRow *)_t422.v.p));
if (_t422.cls_id == 35) _t423 = sp_Comment_commenter((sp_Comment *)_t422.v.p);
if (_t422.cls_id == 40) _t423 = sp_CommentParams_commenter((sp_CommentParams *)_t422.v.p);
}
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_html_escape(_t423));
sp_String_append(lv_io, (&("\xff" "</p>\n <p class=\"text-gray-700\">")[1]));
sp_RbVal _t424 = lv_comment;
sp_RbVal _t425 = sp_box_nil();
if (_t424.tag == SP_TAG_OBJ) {
if (_t424.cls_id == 29) _t425 = ((sp_ActionController_Base *)_t424.v.p)->iv_body;
if (_t424.cls_id == 32) _t425 = ((sp_ApplicationController *)_t424.v.p)->iv_body;
if (_t424.cls_id == 34) _t425 = sp_CommentRow_body((sp_CommentRow *)_t424.v.p);
if (_t424.cls_id == 35) _t425 = sp_Comment_body((sp_Comment *)_t424.v.p);
if (_t424.cls_id == 36) _t425 = sp_ArticleRow_body((sp_ArticleRow *)_t424.v.p);
if (_t424.cls_id == 37) _t425 = sp_Article_body((sp_Article *)_t424.v.p);
if (_t424.cls_id == 38) _t425 = sp_ArticleParams_body((sp_ArticleParams *)_t424.v.p);
if (_t424.cls_id == 39) _t425 = ((sp_ArticlesController *)_t424.v.p)->iv_body;
if (_t424.cls_id == 40) _t425 = sp_CommentParams_body((sp_CommentParams *)_t424.v.p);
if (_t424.cls_id == 41) _t425 = ((sp_CommentsController *)_t424.v.p)->iv_body;
if (_t424.cls_id == 42) _t425 = ((sp_ActionResponse *)_t424.v.p)->iv_body;
}
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_html_escape(_t425));
sp_String_append(lv_io, (&("\xff" "</p>\n ")[1]));
sp_RbVal _t426 = lv_comment;
sp_RbVal _t427 = sp_box_nil();
if (_t426.tag == SP_TAG_OBJ) {
if (_t426.cls_id == 34) _t427 = sp_CommentRow_article_id((sp_CommentRow *)_t426.v.p);
if (_t426.cls_id == 35) _t427 = sp_Comment_article_id((sp_Comment *)_t426.v.p);
}
sp_RbVal _t428 = lv_comment;
sp_RbVal _t429 = sp_box_nil();
if (_t428.tag == SP_TAG_OBJ) {
if (_t428.cls_id == 23) _t429 = ((sp_ActiveRecord_Base *)_t428.v.p)->iv_id;
if (_t428.cls_id == 33) _t429 = ((sp_ApplicationRecord *)_t428.v.p)->iv_id;
if (_t428.cls_id == 34) _t429 = sp_CommentRow_id((sp_CommentRow *)_t428.v.p);
if (_t428.cls_id == 35) _t429 = sp_Comment_id((sp_Comment *)_t428.v.p);
if (_t428.cls_id == 36) _t429 = sp_ArticleRow_id((sp_ArticleRow *)_t428.v.p);
if (_t428.cls_id == 37) _t429 = sp_Article_id((sp_Article *)_t428.v.p);
}
sp_SymPolyHash *_t430 = sp_SymPolyHash_new();
sp_SymPolyHash_set(_t430, SPS_method, sp_box_sym(SPS_delete));
sp_SymPolyHash_set(_t430, SPS_class, sp_box_str((&("\xff" "text-red-600 text-sm mt-2")[1])));
sp_SymStrHash *_t431 = sp_SymStrHash_new();
sp_SymStrHash_set(_t431, SPS_turbo_confirm, (&("\xff" "Are you sure?")[1]));
sp_SymPolyHash_set(_t430, SPS_data, sp_box_obj((void *)(_t431), SP_BUILTIN_SYM_STR_HASH));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_button_to((&("\xff" "Delete")[1]), sp_RouteHelpers_cls_article_comment_path(_t427, _t429), _t430));
sp_String_append(lv_io, (&("\xff" "\n</div>\n")[1]));
return lv_io;
return NULL;
}
static inline const char * sp_Inflector_cls_pluralize(mrb_int lv_count, const char * lv_word) {
SP_GC_SAVE();
SP_GC_ROOT(lv_word);
if ((lv_count == 1LL)) {
return sp_sprintf("1 %s", lv_word);
} else {
return sp_sprintf("%lld %ss", (long long)lv_count, lv_word);
}
return (&("\xff")[1]);
}
static sp_String * sp_Views_Articles_cls_article(sp_Article * lv_article, sp_String * lv_notice, sp_String * lv_alert) {
SP_GC_SAVE();
sp_String * lv_io = NULL;
SP_GC_ROOT(lv_io);
SP_GC_ROOT(lv_article);
SP_GC_ROOT(lv_notice);
SP_GC_ROOT(lv_alert);
lv_io = sp_String_new("");
sp_String_append(lv_io, (&("\xff" "<div id=\"")[1]));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_dom_id(sp_box_nullable_obj(lv_article, 37), 0));
sp_String_append(lv_io, (&("\xff" "\" class=\"flex flex-col sm:flex-row justify-between items-center pb-5 sm:pb-0\">\n <div class=\"p-4 border rounded mb-4 flex-grow\">\n <h2 class=\"text-xl font-bold\">\n ")[1]));
sp_SymStrHash *_t432 = sp_SymStrHash_new();
sp_SymStrHash_set(_t432, SPS_class, (&("\xff" "text-blue-600 hover:underline")[1]));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_link_to(lv_article->iv_title, sp_RouteHelpers_cls_article_path(lv_article->iv_id), _t432));
sp_String_append(lv_io, (&("\xff" "\n <span id=\"")[1]));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_dom_id(sp_box_nullable_obj(lv_article, 37), SPS_comments_count));
sp_String_append(lv_io, (&("\xff" "\" class=\"text-gray-500 text-sm font-normal ml-2\">\n (")[1]));
sp_PtrArray * _t433 = sp_Article_comments(lv_article);
SP_GC_ROOT(_t433);
sp_String_append(lv_io, sp_Inflector_cls_pluralize(sp_PtrArray_length(_t433), (&("\xff" "comment")[1])));
sp_String_append(lv_io, (&("\xff" ")\n </span>\n </h2>\n <p class=\"text-gray-700 mt-2\">")[1]));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_html_escape(sp_ActionView_ViewHelpers_cls_truncate(lv_article->iv_body, 100LL, (&("\xff" "...")[1]))));
sp_String_append(lv_io, (&("\xff" "</p>\n </div>\n <div class=\"w-full sm:w-auto flex flex-col sm:flex-row space-x-2 space-y-2\">\n ")[1]));
sp_SymStrHash *_t434 = sp_SymStrHash_new();
sp_SymStrHash_set(_t434, SPS_class, (&("\xff" "w-full sm:w-auto text-center rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium")[1]));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_link_to(sp_box_str((&("\xff" "Show")[1])), sp_RouteHelpers_cls_article_path(lv_article->iv_id), _t434));
sp_String_append(lv_io, (&("\xff" "\n ")[1]));
sp_SymStrHash *_t435 = sp_SymStrHash_new();
sp_SymStrHash_set(_t435, SPS_class, (&("\xff" "w-full sm:w-auto text-center rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium")[1]));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_link_to(sp_box_str((&("\xff" "Edit")[1])), sp_RouteHelpers_cls_edit_article_path(lv_article->iv_id), _t435));
sp_String_append(lv_io, (&("\xff" "\n ")[1]));
sp_SymPolyHash *_t436 = sp_SymPolyHash_new();
sp_SymPolyHash_set(_t436, SPS_method, sp_box_sym(SPS_delete));
sp_SymPolyHash_set(_t436, SPS_class, sp_box_str((&("\xff" "w-full sm:w-auto rounded-md px-3.5 py-2.5 text-white bg-red-600 hover:bg-red-500 font-medium cursor-pointer")[1])));
sp_SymStrHash *_t437 = sp_SymStrHash_new();
sp_SymStrHash_set(_t437, SPS_turbo_confirm, (&("\xff" "Are you sure?")[1]));
sp_SymPolyHash_set(_t436, SPS_data, sp_box_obj((void *)(_t437), SP_BUILTIN_SYM_STR_HASH));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_button_to((&("\xff" "Destroy")[1]), sp_RouteHelpers_cls_article_path(lv_article->iv_id), _t436));
sp_String_append(lv_io, (&("\xff" "\n </div>\n</div>\n")[1]));
return lv_io;
return NULL;
}
static inline sp_String * sp_Views_Articles_cls_form(sp_RbVal lv_article, sp_String * lv_notice, sp_String * lv_alert) {
SP_GC_SAVE();
sp_String * lv_io = NULL;
mrb_int lv_form = 0;
sp_String * lv_body = NULL;
const char * lv_error = (&("\xff")[1]);
SP_GC_ROOT(lv_io);
SP_GC_ROOT(lv_body);
SP_GC_ROOT(lv_error);
SP_GC_ROOT(lv_notice);
SP_GC_ROOT(lv_alert);
lv_io = sp_String_new("");
sp_RbVal _t438 = lv_article;
mrb_bool _t439 = FALSE;
if (_t438.tag == SP_TAG_OBJ) {
if (_t438.cls_id == 23) _t439 = sp_ActiveRecord_Base_persisted_p((sp_ActiveRecord_Base *)_t438.v.p);
if (_t438.cls_id == 33) _t439 = sp_ActiveRecord_Base_persisted_p((sp_ActiveRecord_Base *)_t438.v.p);
if (_t438.cls_id == 35) _t439 = sp_ActiveRecord_Base_persisted_p((sp_ActiveRecord_Base *)_t438.v.p);
if (_t438.cls_id == 37) _t439 = sp_ActiveRecord_Base_persisted_p((sp_ActiveRecord_Base *)_t438.v.p);
}
sp_RbVal _t440 = lv_article;
sp_RbVal _t441 = sp_box_nil();
if (_t440.tag == SP_TAG_OBJ) {
if (_t440.cls_id == 23) _t441 = ((sp_ActiveRecord_Base *)_t440.v.p)->iv_id;
if (_t440.cls_id == 33) _t441 = ((sp_ApplicationRecord *)_t440.v.p)->iv_id;
if (_t440.cls_id == 34) _t441 = sp_CommentRow_id((sp_CommentRow *)_t440.v.p);
if (_t440.cls_id == 35) _t441 = sp_Comment_id((sp_Comment *)_t440.v.p);
if (_t440.cls_id == 36) _t441 = sp_ArticleRow_id((sp_ArticleRow *)_t440.v.p);
if (_t440.cls_id == 37) _t441 = sp_Article_id((sp_Article *)_t440.v.p);
}
sp_RbVal _t442 = lv_article;
mrb_bool _t443 = FALSE;
if (_t442.tag == SP_TAG_OBJ) {
if (_t442.cls_id == 23) _t443 = sp_ActiveRecord_Base_persisted_p((sp_ActiveRecord_Base *)_t442.v.p);
if (_t442.cls_id == 33) _t443 = sp_ActiveRecord_Base_persisted_p((sp_ActiveRecord_Base *)_t442.v.p);
if (_t442.cls_id == 35) _t443 = sp_ActiveRecord_Base_persisted_p((sp_ActiveRecord_Base *)_t442.v.p);
if (_t442.cls_id == 37) _t443 = sp_ActiveRecord_Base_persisted_p((sp_ActiveRecord_Base *)_t442.v.p);
}
sp_SymStrHash *_t444 = sp_SymStrHash_new();
sp_SymStrHash_set(_t444, SPS_class, (&("\xff" "contents")[1]));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_form_with(lv_article, (&("\xff" "article")[1]), (_t439 ? sp_RouteHelpers_cls_article_path(_t441) : sp_RouteHelpers_cls_articles_path()), (_t443 ? SPS_patch : SPS_post), _t444));
return lv_io;
return NULL;
}
static sp_String * sp_Views_Articles_cls_index(sp_PtrArray * lv_articles, sp_RbVal lv_notice, sp_RbVal lv_alert) {
SP_GC_SAVE();
sp_String * lv_io = NULL;
sp_Article * lv_a = NULL;
SP_GC_ROOT(lv_io);
SP_GC_ROOT(lv_a);
SP_GC_ROOT(lv_articles);
lv_io = sp_String_new("");
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_turbo_stream_from((&("\xff" "articles")[1])));
sp_String_append(lv_io, (&("\xff" "\n\n")[1]));
sp_ActionView_ViewHelpers_cls_content_for_set(SPS_title, (&("\xff" "Articles")[1]));
sp_String_append(lv_io, (&("\xff" "\n<div class=\"w-full\">\n")[1]));
sp_RbVal _t445 = lv_notice;
mrb_bool _t446 = FALSE;
if (_t445.tag == SP_TAG_STR) _t446 = (sp_str_length(_t445.v.s) == 0);
if (_t445.tag == SP_TAG_OBJ) {
if (_t445.cls_id == 26) _t446 = sp_ActionDispatch_Flash_empty_p((sp_ActionDispatch_Flash *)_t445.v.p);
if (_t445.cls_id == 27) _t446 = sp_ActionDispatch_Session_empty_p((sp_ActionDispatch_Session *)_t445.v.p);
if (_t445.cls_id == SP_BUILTIN_INT_ARRAY) _t446 = (sp_IntArray_length((sp_IntArray *)_t445.v.p) == 0);
if (_t445.cls_id == SP_BUILTIN_FLT_ARRAY) _t446 = (sp_FloatArray_length((sp_FloatArray *)_t445.v.p) == 0);
if (_t445.cls_id == SP_BUILTIN_STR_ARRAY) _t446 = (sp_StrArray_length((sp_StrArray *)_t445.v.p) == 0);
if (_t445.cls_id == SP_BUILTIN_SYM_ARRAY) _t446 = (sp_IntArray_length((sp_IntArray *)_t445.v.p) == 0);
if (_t445.cls_id == SP_BUILTIN_PTR_ARRAY) _t446 = (sp_PtrArray_length((sp_PtrArray *)_t445.v.p) == 0);
if (_t445.cls_id == SP_BUILTIN_POLY_ARRAY) _t446 = (sp_PolyArray_length((sp_PolyArray *)_t445.v.p) == 0);
if (_t445.cls_id == SP_BUILTIN_STR_INT_HASH) _t446 = (sp_StrIntHash_length((sp_StrIntHash *)_t445.v.p) == 0);
if (_t445.cls_id == SP_BUILTIN_STR_STR_HASH) _t446 = (sp_StrStrHash_length((sp_StrStrHash *)_t445.v.p) == 0);
if (_t445.cls_id == SP_BUILTIN_INT_STR_HASH) _t446 = (sp_IntStrHash_length((sp_IntStrHash *)_t445.v.p) == 0);
if (_t445.cls_id == SP_BUILTIN_STR_POLY_HASH) _t446 = (sp_StrPolyHash_length((sp_StrPolyHash *)_t445.v.p) == 0);
if (_t445.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t446 = (sp_SymPolyHash_length((sp_SymPolyHash *)_t445.v.p) == 0);
if (_t445.cls_id == SP_BUILTIN_POLY_POLY_HASH) _t446 = (sp_PolyPolyHash_length((sp_PolyPolyHash *)_t445.v.p) == 0);
}
if (((!sp_poly_nil_p(lv_notice)) && (!_t446))) {
sp_String_append(lv_io, (&("\xff" " <p class=\"py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-md inline-block\" id=\"notice\">")[1]));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_html_escape(lv_notice));
sp_String_append(lv_io, (&("\xff" "</p>\n")[1]));
}
sp_String_append(lv_io, (&("\xff" "\n <div class=\"flex justify-between items-center\">\n <h1 class=\"font-bold text-4xl\">Articles</h1>\n ")[1]));
sp_SymStrHash *_t447 = sp_SymStrHash_new();
sp_SymStrHash_set(_t447, SPS_class, (&("\xff" "rounded-md px-3.5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white block font-medium")[1]));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_link_to(sp_box_str((&("\xff" "New article")[1])), sp_RouteHelpers_cls_new_article_path(), _t447));
sp_String_append(lv_io, (&("\xff" "\n </div>\n\n <div id=\"articles\" class=\"min-w-full divide-y divide-gray-200 space-y-5\">\n")[1]));
if ((!sp_PtrArray_empty(lv_articles))) {
sp_String_append(lv_io, (&("\xff" " ")[1]));
for (mrb_int _t448 = 0; _t448 < sp_PtrArray_length(lv_articles); _t448++) {
sp_Article * _t449 = (sp_Article *)sp_PtrArray_get(lv_articles, _t448);
lv_a = _t449;
sp_redo_16: ;
sp_String_append(lv_io, sp_Views_Articles_cls_article((sp_Article *)lv_a, 0, 0)->data);
}
sp_String_append(lv_io, (&("\xff" "\n")[1]));
} else {
sp_String_append(lv_io, (&("\xff" " <p class=\"text-center my-10\">No articles found.</p>\n")[1]));
}
sp_String_append(lv_io, (&("\xff" " </div>\n</div>\n")[1]));
return lv_io;
return NULL;
}
static sp_String * sp_Views_Articles_cls_show(sp_Article * lv_article, sp_RbVal lv_notice, sp_RbVal lv_alert) {
SP_GC_SAVE();
sp_String * lv_io = NULL;
sp_Comment * lv_c = NULL;
mrb_int lv_form = 0;
sp_String * lv_body = NULL;
SP_GC_ROOT(lv_io);
SP_GC_ROOT(lv_c);
SP_GC_ROOT(lv_body);
SP_GC_ROOT(lv_article);
lv_io = sp_String_new("");
sp_ActionView_ViewHelpers_cls_content_for_set(SPS_title, (&("\xff" "Showing article")[1]));
sp_String_append(lv_io, (&("\xff" "\n<div class=\"md:w-2/3 w-full\">\n")[1]));
sp_RbVal _t450 = lv_notice;
mrb_bool _t451 = FALSE;
if (_t450.tag == SP_TAG_STR) _t451 = (sp_str_length(_t450.v.s) == 0);
if (_t450.tag == SP_TAG_OBJ) {
if (_t450.cls_id == 26) _t451 = sp_ActionDispatch_Flash_empty_p((sp_ActionDispatch_Flash *)_t450.v.p);
if (_t450.cls_id == 27) _t451 = sp_ActionDispatch_Session_empty_p((sp_ActionDispatch_Session *)_t450.v.p);
if (_t450.cls_id == SP_BUILTIN_INT_ARRAY) _t451 = (sp_IntArray_length((sp_IntArray *)_t450.v.p) == 0);
if (_t450.cls_id == SP_BUILTIN_FLT_ARRAY) _t451 = (sp_FloatArray_length((sp_FloatArray *)_t450.v.p) == 0);
if (_t450.cls_id == SP_BUILTIN_STR_ARRAY) _t451 = (sp_StrArray_length((sp_StrArray *)_t450.v.p) == 0);
if (_t450.cls_id == SP_BUILTIN_SYM_ARRAY) _t451 = (sp_IntArray_length((sp_IntArray *)_t450.v.p) == 0);
if (_t450.cls_id == SP_BUILTIN_PTR_ARRAY) _t451 = (sp_PtrArray_length((sp_PtrArray *)_t450.v.p) == 0);
if (_t450.cls_id == SP_BUILTIN_POLY_ARRAY) _t451 = (sp_PolyArray_length((sp_PolyArray *)_t450.v.p) == 0);
if (_t450.cls_id == SP_BUILTIN_STR_INT_HASH) _t451 = (sp_StrIntHash_length((sp_StrIntHash *)_t450.v.p) == 0);
if (_t450.cls_id == SP_BUILTIN_STR_STR_HASH) _t451 = (sp_StrStrHash_length((sp_StrStrHash *)_t450.v.p) == 0);
if (_t450.cls_id == SP_BUILTIN_INT_STR_HASH) _t451 = (sp_IntStrHash_length((sp_IntStrHash *)_t450.v.p) == 0);
if (_t450.cls_id == SP_BUILTIN_STR_POLY_HASH) _t451 = (sp_StrPolyHash_length((sp_StrPolyHash *)_t450.v.p) == 0);
if (_t450.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t451 = (sp_SymPolyHash_length((sp_SymPolyHash *)_t450.v.p) == 0);
if (_t450.cls_id == SP_BUILTIN_POLY_POLY_HASH) _t451 = (sp_PolyPolyHash_length((sp_PolyPolyHash *)_t450.v.p) == 0);
}
if (((!sp_poly_nil_p(lv_notice)) && (!_t451))) {
sp_String_append(lv_io, (&("\xff" " <p class=\"py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-md inline-block\" id=\"notice\">")[1]));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_html_escape(lv_notice));
sp_String_append(lv_io, (&("\xff" "</p>\n")[1]));
}
sp_String_append(lv_io, (&("\xff" "\n <h1 class=\"font-bold text-4xl\">")[1]));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_html_escape(lv_article->iv_title));
sp_String_append(lv_io, (&("\xff" "</h1>\n\n <div class=\"my-4\">\n <p class=\"text-gray-700\">")[1]));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_html_escape(lv_article->iv_body));
sp_String_append(lv_io, (&("\xff" "</p>\n </div>\n\n ")[1]));
sp_SymStrHash *_t452 = sp_SymStrHash_new();
sp_SymStrHash_set(_t452, SPS_class, (&("\xff" "w-full sm:w-auto text-center rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium")[1]));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_link_to(sp_box_str((&("\xff" "Edit this article")[1])), sp_RouteHelpers_cls_edit_article_path(lv_article->iv_id), _t452));
sp_String_append(lv_io, (&("\xff" "\n ")[1]));
sp_SymStrHash *_t453 = sp_SymStrHash_new();
sp_SymStrHash_set(_t453, SPS_class, (&("\xff" "w-full sm:w-auto text-center mt-2 sm:mt-0 sm:ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium")[1]));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_link_to(sp_box_str((&("\xff" "Back to articles")[1])), sp_RouteHelpers_cls_articles_path(), _t453));
sp_String_append(lv_io, (&("\xff" "\n ")[1]));
sp_SymPolyHash *_t454 = sp_SymPolyHash_new();
sp_SymPolyHash_set(_t454, SPS_method, sp_box_sym(SPS_delete));
sp_SymPolyHash_set(_t454, SPS_form_class, sp_box_str((&("\xff" "sm:inline-block mt-2 sm:mt-0 sm:ml-2")[1])));
sp_SymPolyHash_set(_t454, SPS_class, sp_box_str((&("\xff" "w-full rounded-md px-3.5 py-2.5 text-white bg-red-600 hover:bg-red-500 font-medium cursor-pointer")[1])));
sp_SymStrHash *_t455 = sp_SymStrHash_new();
sp_SymStrHash_set(_t455, SPS_turbo_confirm, (&("\xff" "Are you sure?")[1]));
sp_SymPolyHash_set(_t454, SPS_data, sp_box_obj((void *)(_t455), SP_BUILTIN_SYM_STR_HASH));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_button_to((&("\xff" "Destroy this article")[1]), sp_RouteHelpers_cls_article_path(lv_article->iv_id), _t454));
sp_String_append(lv_io, (&("\xff" "\n</div>\n\n<hr class=\"my-8\">\n\n<h2 class=\"text-xl font-bold mb-4\">Comments</h2>\n\n")[1]));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_turbo_stream_from(sp_sprintf("article_%s_comments", sp_poly_to_s(lv_article->iv_id))));
sp_String_append(lv_io, (&("\xff" "\n\n<div id=\"comments\" class=\"space-y-4 mb-8\">\n ")[1]));
sp_PtrArray * _t456 = sp_Article_comments(lv_article);
SP_GC_ROOT(_t456);
for (mrb_int _t457 = 0; _t457 < sp_PtrArray_length(_t456); _t457++) {
sp_Comment * _t458 = (sp_Comment *)sp_PtrArray_get(_t456, _t457);
lv_c = _t458;
sp_redo_17: ;
sp_String_append(lv_io, sp_Views_Comments_cls_comment(sp_box_obj(lv_c, 35), 0, 0)->data);
}
sp_String_append(lv_io, (&("\xff" "\n</div>\n\n<h3 class=\"text-lg font-semibold mb-2\">Add a Comment</h3>\n\n")[1]));
sp_SymStrHash *_t459 = sp_SymStrHash_new();
sp_SymStrHash_set(_t459, SPS_class, (&("\xff" "space-y-4")[1]));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_form_with(sp_box_obj(sp_Comment_new(sp_StrIntHash_new()), 35), (&("\xff" "comment")[1]), sp_RouteHelpers_cls_article_comments_path(lv_article->iv_id), SPS_post, _t459));
return lv_io;
return NULL;
}
static sp_String * sp_Views_Articles_cls_new(sp_Article * lv_article, sp_RbVal lv_notice, sp_RbVal lv_alert) {
SP_GC_SAVE();
sp_String * lv_io = NULL;
SP_GC_ROOT(lv_io);
SP_GC_ROOT(lv_article);
lv_io = sp_String_new("");
sp_ActionView_ViewHelpers_cls_content_for_set(SPS_title, (&("\xff" "New article")[1]));
sp_String_append(lv_io, (&("\xff" "\n<div class=\"md:w-2/3 w-full\">\n <h1 class=\"font-bold text-4xl\">New article</h1>\n\n ")[1]));
sp_String_append(lv_io, sp_Views_Articles_cls_form(sp_box_nullable_obj(lv_article, 37), 0, 0)->data);
sp_String_append(lv_io, (&("\xff" "\n\n ")[1]));
sp_SymStrHash *_t460 = sp_SymStrHash_new();
sp_SymStrHash_set(_t460, SPS_class, (&("\xff" "w-full sm:w-auto text-center mt-2 sm:mt-0 sm:ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium")[1]));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_link_to(sp_box_str((&("\xff" "Back to articles")[1])), sp_RouteHelpers_cls_articles_path(), _t460));
sp_String_append(lv_io, (&("\xff" "\n</div>\n")[1]));
return lv_io;
return NULL;
}
static sp_String * sp_Views_Articles_cls_edit(sp_RbVal lv_article, sp_RbVal lv_notice, sp_RbVal lv_alert) {
SP_GC_SAVE();
sp_String * lv_io = NULL;
SP_GC_ROOT(lv_io);
lv_io = sp_String_new("");
sp_ActionView_ViewHelpers_cls_content_for_set(SPS_title, (&("\xff" "Editing article")[1]));
sp_String_append(lv_io, (&("\xff" "\n<div class=\"md:w-2/3 w-full\">\n <h1 class=\"font-bold text-4xl\">Editing article</h1>\n\n ")[1]));
sp_String_append(lv_io, sp_Views_Articles_cls_form(lv_article, 0, 0)->data);
sp_String_append(lv_io, (&("\xff" "\n\n ")[1]));
sp_RbVal _t461 = lv_article;
sp_RbVal _t462 = sp_box_nil();
if (_t461.tag == SP_TAG_OBJ) {
if (_t461.cls_id == 23) _t462 = ((sp_ActiveRecord_Base *)_t461.v.p)->iv_id;
if (_t461.cls_id == 33) _t462 = ((sp_ApplicationRecord *)_t461.v.p)->iv_id;
if (_t461.cls_id == 34) _t462 = sp_CommentRow_id((sp_CommentRow *)_t461.v.p);
if (_t461.cls_id == 35) _t462 = sp_Comment_id((sp_Comment *)_t461.v.p);
if (_t461.cls_id == 36) _t462 = sp_ArticleRow_id((sp_ArticleRow *)_t461.v.p);
if (_t461.cls_id == 37) _t462 = sp_Article_id((sp_Article *)_t461.v.p);
}
sp_SymStrHash *_t463 = sp_SymStrHash_new();
sp_SymStrHash_set(_t463, SPS_class, (&("\xff" "w-full sm:w-auto text-center mt-2 sm:mt-0 sm:ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium")[1]));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_link_to(sp_box_str((&("\xff" "Show this article")[1])), sp_RouteHelpers_cls_article_path(_t462), _t463));
sp_String_append(lv_io, (&("\xff" "\n ")[1]));
sp_SymStrHash *_t464 = sp_SymStrHash_new();
sp_SymStrHash_set(_t464, SPS_class, (&("\xff" "w-full sm:w-auto text-center mt-2 sm:mt-0 sm:ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium")[1]));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_link_to(sp_box_str((&("\xff" "Back to articles")[1])), sp_RouteHelpers_cls_articles_path(), _t464));
sp_String_append(lv_io, (&("\xff" "\n</div>\n")[1]));
return lv_io;
return NULL;
}
static sp_String * sp_Views_Layouts_cls_application(mrb_int lv_body, sp_String * lv_notice, sp_String * lv_alert) {
SP_GC_SAVE();
sp_String * lv_io = NULL;
SP_GC_ROOT(lv_io);
SP_GC_ROOT(lv_notice);
SP_GC_ROOT(lv_alert);
lv_io = sp_String_new("");
sp_String_append(lv_io, (&("\xff" "<!DOCTYPE html>\n<html>\n <head>\n <title>")[1]));
sp_RbVal _t465 = sp_ActionView_ViewHelpers_cls_content_for_get(SPS_title);
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_html_escape((sp_poly_truthy(_t465) ? _t465 : sp_box_str((&("\xff" "Real Blog")[1])))));
sp_String_append(lv_io, (&("\xff" "</title>\n <meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\n <meta name=\"apple-mobile-web-app-capable\" content=\"yes\">\n <meta name=\"application-name\" content=\"Real Blog\">\n <meta name=\"mobile-web-app-capable\" content=\"yes\">\n ")[1]));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_csrf_meta_tags());
sp_String_append(lv_io, (&("\xff" "\n ")[1]));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_csp_meta_tag());
sp_String_append(lv_io, (&("\xff" "\n\n ")[1]));
sp_String_append(lv_io, sp_poly_to_s(sp_ActionView_ViewHelpers_cls_get_slot(SPS_head)));
sp_String_append(lv_io, (&("\xff" "\n\n\n <link rel=\"icon\" href=\"/icon.png\" type=\"image/png\">\n <link rel=\"icon\" href=\"/icon.svg\" type=\"image/svg+xml\">\n <link rel=\"apple-touch-icon\" href=\"/icon.png\">\n\n ")[1]));
sp_SymStrHash *_t466 = sp_SymStrHash_new();
sp_SymStrHash_set(_t466, ((sp_sym)95), (&("\xff" "reload")[1]));
sp_SymStrHash *_t467 = sp_SymStrHash_new();
sp_SymStrHash_set(_t467, ((sp_sym)95), (&("\xff" "reload")[1]));
sp_String_append(lv_io, sp_str_concat3(sp_ActionView_ViewHelpers_cls_stylesheet_link_tag((&("\xff" "application")[1]), _t466), (&("\xff" "\n")[1]), sp_ActionView_ViewHelpers_cls_stylesheet_link_tag((&("\xff" "tailwind")[1]), _t467)));
sp_String_append(lv_io, (&("\xff" "\n ")[1]));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_javascript_importmap_tags(sp_Importmap_cls_pins(), sp_Importmap_cls_entry()));
sp_String_append(lv_io, (&("\xff" "\n </head>\n\n <body>\n <main class=\"container mx-auto mt-28 px-5 flex flex-col\">\n ")[1]));
sp_String_append(lv_io, sp_int_to_s(lv_body));
sp_String_append(lv_io, (&("\xff" "\n </main>\n </body>\n</html>\n")[1]));
return lv_io;
return NULL;
}
static sp_String * sp_Views_Articles_cls_article_json(sp_RbVal lv_article) {
SP_GC_SAVE();
sp_String * lv_io = NULL;
SP_GC_ROOT(lv_io);
lv_io = sp_String_new("");
sp_String_append(lv_io, (&("\xff" "{")[1]));
sp_String_append(lv_io, (&("\xff" "\"id\":")[1]));
sp_RbVal _t468 = lv_article;
sp_RbVal _t469 = sp_box_nil();
if (_t468.tag == SP_TAG_OBJ) {
if (_t468.cls_id == 23) _t469 = ((sp_ActiveRecord_Base *)_t468.v.p)->iv_id;
if (_t468.cls_id == 33) _t469 = ((sp_ApplicationRecord *)_t468.v.p)->iv_id;
if (_t468.cls_id == 34) _t469 = sp_CommentRow_id((sp_CommentRow *)_t468.v.p);
if (_t468.cls_id == 35) _t469 = sp_Comment_id((sp_Comment *)_t468.v.p);
if (_t468.cls_id == 36) _t469 = sp_ArticleRow_id((sp_ArticleRow *)_t468.v.p);
if (_t468.cls_id == 37) _t469 = sp_Article_id((sp_Article *)_t468.v.p);
}
sp_String_append(lv_io, sp_JsonBuilder_cls_encode_value(_t469));
sp_String_append(lv_io, (&("\xff" ",")[1]));
sp_String_append(lv_io, (&("\xff" "\"title\":")[1]));
sp_RbVal _t470 = lv_article;
sp_RbVal _t471 = sp_box_nil();
if (_t470.tag == SP_TAG_OBJ) {
if (_t470.cls_id == 36) _t471 = sp_box_str(sp_ArticleRow_title((sp_ArticleRow *)_t470.v.p));
if (_t470.cls_id == 37) _t471 = sp_Article_title((sp_Article *)_t470.v.p);
if (_t470.cls_id == 38) _t471 = sp_ArticleParams_title((sp_ArticleParams *)_t470.v.p);
}
sp_String_append(lv_io, sp_JsonBuilder_cls_encode_value(_t471));
sp_String_append(lv_io, (&("\xff" ",")[1]));
sp_String_append(lv_io, (&("\xff" "\"body\":")[1]));
sp_RbVal _t472 = lv_article;
sp_RbVal _t473 = sp_box_nil();
if (_t472.tag == SP_TAG_OBJ) {
if (_t472.cls_id == 29) _t473 = ((sp_ActionController_Base *)_t472.v.p)->iv_body;
if (_t472.cls_id == 32) _t473 = ((sp_ApplicationController *)_t472.v.p)->iv_body;
if (_t472.cls_id == 34) _t473 = sp_CommentRow_body((sp_CommentRow *)_t472.v.p);
if (_t472.cls_id == 35) _t473 = sp_Comment_body((sp_Comment *)_t472.v.p);
if (_t472.cls_id == 36) _t473 = sp_ArticleRow_body((sp_ArticleRow *)_t472.v.p);
if (_t472.cls_id == 37) _t473 = sp_Article_body((sp_Article *)_t472.v.p);
if (_t472.cls_id == 38) _t473 = sp_ArticleParams_body((sp_ArticleParams *)_t472.v.p);
if (_t472.cls_id == 39) _t473 = ((sp_ArticlesController *)_t472.v.p)->iv_body;
if (_t472.cls_id == 40) _t473 = sp_CommentParams_body((sp_CommentParams *)_t472.v.p);
if (_t472.cls_id == 41) _t473 = ((sp_CommentsController *)_t472.v.p)->iv_body;
if (_t472.cls_id == 42) _t473 = ((sp_ActionResponse *)_t472.v.p)->iv_body;
}
sp_String_append(lv_io, sp_JsonBuilder_cls_encode_value(_t473));
sp_String_append(lv_io, (&("\xff" ",")[1]));
sp_String_append(lv_io, (&("\xff" "\"created_at\":")[1]));
sp_RbVal _t474 = lv_article;
sp_RbVal _t475 = sp_box_nil();
if (_t474.tag == SP_TAG_OBJ) {
if (_t474.cls_id == 34) _t475 = sp_box_str(sp_CommentRow_created_at((sp_CommentRow *)_t474.v.p));
if (_t474.cls_id == 35) _t475 = sp_Comment_created_at((sp_Comment *)_t474.v.p);
if (_t474.cls_id == 36) _t475 = sp_box_str(sp_ArticleRow_created_at((sp_ArticleRow *)_t474.v.p));
if (_t474.cls_id == 37) _t475 = sp_Article_created_at((sp_Article *)_t474.v.p);
}
sp_String_append(lv_io, sp_JsonBuilder_cls_encode_datetime(_t475));
sp_String_append(lv_io, (&("\xff" ",")[1]));
sp_String_append(lv_io, (&("\xff" "\"updated_at\":")[1]));
sp_RbVal _t476 = lv_article;
sp_RbVal _t477 = sp_box_nil();
if (_t476.tag == SP_TAG_OBJ) {
if (_t476.cls_id == 34) _t477 = sp_box_str(sp_CommentRow_updated_at((sp_CommentRow *)_t476.v.p));
if (_t476.cls_id == 35) _t477 = sp_Comment_updated_at((sp_Comment *)_t476.v.p);
if (_t476.cls_id == 36) _t477 = sp_box_str(sp_ArticleRow_updated_at((sp_ArticleRow *)_t476.v.p));
if (_t476.cls_id == 37) _t477 = sp_Article_updated_at((sp_Article *)_t476.v.p);
}
sp_String_append(lv_io, sp_JsonBuilder_cls_encode_datetime(_t477));
sp_String_append(lv_io, (&("\xff" ",")[1]));
sp_String_append(lv_io, (&("\xff" "\"url\":")[1]));
sp_RbVal _t478 = lv_article;
sp_RbVal _t479 = sp_box_nil();
if (_t478.tag == SP_TAG_OBJ) {
if (_t478.cls_id == 23) _t479 = ((sp_ActiveRecord_Base *)_t478.v.p)->iv_id;
if (_t478.cls_id == 33) _t479 = ((sp_ApplicationRecord *)_t478.v.p)->iv_id;
if (_t478.cls_id == 34) _t479 = sp_CommentRow_id((sp_CommentRow *)_t478.v.p);
if (_t478.cls_id == 35) _t479 = sp_Comment_id((sp_Comment *)_t478.v.p);
if (_t478.cls_id == 36) _t479 = sp_ArticleRow_id((sp_ArticleRow *)_t478.v.p);
if (_t478.cls_id == 37) _t479 = sp_Article_id((sp_Article *)_t478.v.p);
}
sp_RbVal _t480 = lv_article;
sp_RbVal _t481 = sp_box_nil();
if (_t480.tag == SP_TAG_OBJ) {
if (_t480.cls_id == 23) _t481 = ((sp_ActiveRecord_Base *)_t480.v.p)->iv_id;
if (_t480.cls_id == 33) _t481 = ((sp_ApplicationRecord *)_t480.v.p)->iv_id;
if (_t480.cls_id == 34) _t481 = sp_CommentRow_id((sp_CommentRow *)_t480.v.p);
if (_t480.cls_id == 35) _t481 = sp_Comment_id((sp_Comment *)_t480.v.p);
if (_t480.cls_id == 36) _t481 = sp_ArticleRow_id((sp_ArticleRow *)_t480.v.p);
if (_t480.cls_id == 37) _t481 = sp_Article_id((sp_Article *)_t480.v.p);
}
sp_String_append(lv_io, sp_JsonBuilder_cls_encode_value(sp_box_str(sp_str_concat(sp_RouteHelpers_cls_article_path(_t481), (&("\xff" ".json")[1])))));
sp_String_append(lv_io, (&("\xff" "}")[1]));
return lv_io;
return NULL;
}
static sp_String * sp_Views_Articles_cls_index_json(sp_PtrArray * lv_articles) {
SP_GC_SAVE();
sp_String * lv_io = NULL;
sp_Article * lv_article = NULL;
SP_GC_ROOT(lv_io);
SP_GC_ROOT(lv_article);
SP_GC_ROOT(lv_articles);
lv_io = sp_String_new("");
sp_String_append(lv_io, (&("\xff" "[")[1]));
SP_GC_ROOT(lv_articles);
sp_PtrArray *_t482 = sp_PtrArray_new();
SP_GC_ROOT(_t482);
for (mrb_int _t483 = 0; _t483 < sp_PtrArray_length(lv_articles); _t483++) {
sp_Article * lv_article = (sp_Article *)sp_PtrArray_get(lv_articles, _t483);
sp_PtrArray_push(_t482, (void *)(sp_Views_Articles_cls_article_json(sp_box_obj(lv_article, 37))));
}
sp_PtrArray * _t484 = _t482;
SP_GC_ROOT(_t484);
sp_String_append(lv_io, sp_PtrArray_str_join(_t484, (&("\xff" ",")[1])));
sp_String_append(lv_io, (&("\xff" "]")[1]));
return lv_io;
return NULL;
}
static inline sp_String * sp_Views_Articles_cls_show_json(sp_Article * lv_article) {
SP_GC_SAVE();
sp_String * lv_io = NULL;
SP_GC_ROOT(lv_io);
SP_GC_ROOT(lv_article);
lv_io = sp_String_new("");
sp_String_append(lv_io, sp_Views_Articles_cls_article_json(sp_box_nullable_obj(lv_article, 37))->data);
return lv_io;
return NULL;
}
static inline sp_PtrArray * sp_Routes_cls_table(void) {
SP_GC_SAVE();
sp_PtrArray *_t485 = sp_PtrArray_new();
SP_GC_ROOT(_t485);
sp_PtrArray_push(_t485, sp_ActionDispatch_Router_Route_new((&("\xff" "GET")[1]), (&("\xff" "/articles")[1]), SPS_articles, SPS_index));
sp_PtrArray_push(_t485, sp_ActionDispatch_Router_Route_new((&("\xff" "GET")[1]), (&("\xff" "/articles/new")[1]), SPS_articles, SPS_new));
sp_PtrArray_push(_t485, sp_ActionDispatch_Router_Route_new((&("\xff" "POST")[1]), (&("\xff" "/articles")[1]), SPS_articles, SPS_create));
sp_PtrArray_push(_t485, sp_ActionDispatch_Router_Route_new((&("\xff" "GET")[1]), (&("\xff" "/articles/:id")[1]), SPS_articles, SPS_show));
sp_PtrArray_push(_t485, sp_ActionDispatch_Router_Route_new((&("\xff" "GET")[1]), (&("\xff" "/articles/:id/edit")[1]), SPS_articles, SPS_edit));
sp_PtrArray_push(_t485, sp_ActionDispatch_Router_Route_new((&("\xff" "PATCH")[1]), (&("\xff" "/articles/:id")[1]), SPS_articles, SPS_update));
sp_PtrArray_push(_t485, sp_ActionDispatch_Router_Route_new((&("\xff" "DELETE")[1]), (&("\xff" "/articles/:id")[1]), SPS_articles, SPS_destroy));
sp_PtrArray_push(_t485, sp_ActionDispatch_Router_Route_new((&("\xff" "POST")[1]), (&("\xff" "/articles/:article_id/comments")[1]), SPS_comments, SPS_create));
sp_PtrArray_push(_t485, sp_ActionDispatch_Router_Route_new((&("\xff" "DELETE")[1]), (&("\xff" "/articles/:article_id/comments/:id")[1]), SPS_comments, SPS_destroy));
return _t485;
return NULL;
}
static inline sp_ActionDispatch_Router_Route * sp_Routes_cls_root(void) {
SP_GC_SAVE();
return sp_ActionDispatch_Router_Route_new((&("\xff" "GET")[1]), (&("\xff" "/")[1]), SPS_articles, SPS_index);
return NULL;
}
static inline mrb_bool sp_SchemaSetup_cls_reset_bang(void) {
SP_GC_SAVE();
if ((("expression"), TRUE)) {
sp_Article_cls__adapter_truncate();
}
if ((("expression"), TRUE)) {
sp_Comment_cls__adapter_truncate();
}
return sp_FixtureLoader_cls_load_all_bang();
return FALSE;
}
static inline mrb_bool sp_FixtureLoader_cls_load_all_bang(void) {
SP_GC_SAVE();
sp_ArticlesFixtures_cls__fixtures_load_bang();
return sp_CommentsFixtures_cls__fixtures_load_bang();
return FALSE;
}
static inline sp_Article * sp_ArticlesFixtures_cls_one(void) {
SP_GC_SAVE();
return sp_Article_cls_find(1LL);
return NULL;
}
static inline sp_Article * sp_ArticlesFixtures_cls_two(void) {
SP_GC_SAVE();
return sp_Article_cls_find(2LL);
return NULL;
}
static mrb_bool sp_ArticlesFixtures_cls__fixtures_load_bang(void) {
SP_GC_SAVE();
sp_Article * lv_instance = NULL;
SP_GC_ROOT(lv_instance);
lv_instance = sp_Article_new(sp_StrIntHash_new());
lv_instance->iv_id = sp_box_int(1LL);
sp_Article_title_eq(lv_instance, sp_box_str((&("\xff" "Getting Started with Rails")[1])));
sp_Article_body_eq(lv_instance, sp_box_str((&("\xff" "Rails is a web application framework running on the Ruby programming language.")[1])));
sp_ActiveRecord_Base_save((sp_ActiveRecord_Base *)lv_instance);
lv_instance = sp_Article_new(sp_StrIntHash_new());
lv_instance->iv_id = sp_box_int(2LL);
sp_Article_title_eq(lv_instance, sp_box_str((&("\xff" "Understanding MVC Architecture")[1])));
sp_Article_body_eq(lv_instance, sp_box_str((&("\xff" "MVC stands for Model-View-Controller. Models handle data and business logic.")[1])));
return sp_ActiveRecord_Base_save((sp_ActiveRecord_Base *)lv_instance);
return FALSE;
}
static inline sp_Comment * sp_CommentsFixtures_cls_one(void) {
SP_GC_SAVE();
return sp_Comment_cls_find(1LL);
return NULL;
}
static inline sp_Comment * sp_CommentsFixtures_cls_two(void) {
SP_GC_SAVE();
return sp_Comment_cls_find(2LL);
return NULL;
}
static mrb_bool sp_CommentsFixtures_cls__fixtures_load_bang(void) {
SP_GC_SAVE();
sp_Comment * lv_instance = NULL;
SP_GC_ROOT(lv_instance);
lv_instance = sp_Comment_new(sp_StrIntHash_new());
lv_instance->iv_id = sp_box_int(1LL);
sp_Comment_article_id_eq(lv_instance, sp_box_int(1LL));
sp_Comment_commenter_eq(lv_instance, sp_box_str((&("\xff" "Alice")[1])));
sp_Comment_body_eq(lv_instance, sp_box_str((&("\xff" "Great introduction! Rails really does make development faster.")[1])));
sp_ActiveRecord_Base_save((sp_ActiveRecord_Base *)lv_instance);
lv_instance = sp_Comment_new(sp_StrIntHash_new());
lv_instance->iv_id = sp_box_int(2LL);
sp_Comment_article_id_eq(lv_instance, sp_box_int(2LL));
sp_Comment_commenter_eq(lv_instance, sp_box_str((&("\xff" "Bob")[1])));
sp_Comment_body_eq(lv_instance, sp_box_str((&("\xff" "This pattern really helps keep code organized!")[1])));
return sp_ActiveRecord_Base_save((sp_ActiveRecord_Base *)lv_instance);
return FALSE;
}
int main(int argc,char**argv){
sp_re_init();
SP_GC_SAVE();
const char *lv_sql = (&("\xff")[1]);
SP_GC_ROOT(lv_sql);
sp_ArticlesControllerTest *lv___t = NULL;
SP_GC_ROOT(lv___t);
cst_Base64_ALPHABET = (&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]);
SP_GC_ROOT(cst_Base64_ALPHABET);
cst_SQL_OK = 0LL;
cst_SQL_ROW = 100LL;
cst_SQL_DONE = 101LL;
cst_Db_db = 0;
cst_ActionView_ViewHelpers_slots = sp_SymPolyHash_new();
SP_GC_ROOT(cst_ActionView_ViewHelpers_slots);
sp_StrStrHash *_t486 = sp_StrStrHash_new();
sp_StrStrHash_set(_t486, (&("\xff" "&")[1]), (&("\xff" "&amp;")[1]));
sp_StrStrHash_set(_t486, (&("\xff" "<")[1]), (&("\xff" "&lt;")[1]));
sp_StrStrHash_set(_t486, (&("\xff" ">")[1]), (&("\xff" "&gt;")[1]));
sp_StrStrHash_set(_t486, (&("\xff" "\"")[1]), (&("\xff" "&quot;")[1]));
sp_StrStrHash_set(_t486, (&("\xff" "'")[1]), (&("\xff" "&#39;")[1]));
cst_ActionView_ViewHelpers_HTML_ESCAPES = _t486;
SP_GC_ROOT(cst_ActionView_ViewHelpers_HTML_ESCAPES);
cst_ActionView_ViewHelpers_HTML_ESCAPE_PATTERN = 0;
sp_SymIntHash *_t487 = sp_SymIntHash_new();
sp_SymIntHash_set(_t487, SPS_ok, 200LL);
sp_SymIntHash_set(_t487, SPS_created, 201LL);
sp_SymIntHash_set(_t487, SPS_accepted, 202LL);
sp_SymIntHash_set(_t487, SPS_no_content, 204LL);
sp_SymIntHash_set(_t487, SPS_moved_permanently, 301LL);
sp_SymIntHash_set(_t487, SPS_found, 302LL);
sp_SymIntHash_set(_t487, SPS_see_other, 303LL);
sp_SymIntHash_set(_t487, SPS_not_modified, 304LL);
sp_SymIntHash_set(_t487, SPS_bad_request, 400LL);
sp_SymIntHash_set(_t487, SPS_unauthorized, 401LL);
sp_SymIntHash_set(_t487, SPS_forbidden, 403LL);
sp_SymIntHash_set(_t487, SPS_not_found, 404LL);
sp_SymIntHash_set(_t487, SPS_unprocessable_entity, 422LL);
sp_SymIntHash_set(_t487, SPS_unprocessable_content, 422LL);
sp_SymIntHash_set(_t487, SPS_internal_server_error, 500LL);
cst_ActionController_STATUS_CODES = _t487;
SP_GC_ROOT(cst_ActionController_STATUS_CODES);
sp_StrStrHash *_t488 = sp_StrStrHash_new();
sp_StrStrHash_set(_t488, (&("\xff" "\\")[1]), (&("\xff" "\\\\")[1]));
sp_StrStrHash_set(_t488, (&("\xff" "\"")[1]), (&("\xff" "\\\"")[1]));
sp_StrStrHash_set(_t488, (&("\xff" "\n")[1]), (&("\xff" "\\n")[1]));
sp_StrStrHash_set(_t488, (&("\xff" "\r")[1]), (&("\xff" "\\r")[1]));
sp_StrStrHash_set(_t488, (&("\xff" "\t")[1]), (&("\xff" "\\t")[1]));
sp_StrStrHash_set(_t488, (&("\xff" "")[1]), (&("\xff" "\\b")[1]));
sp_StrStrHash_set(_t488, (&("\xff" " ")[1]), (&("\xff" "\\f")[1]));
cst_JsonBuilder_ESCAPES = _t488;
SP_GC_ROOT(cst_JsonBuilder_ESCAPES);
cst_JsonBuilder_ESCAPE_PATTERN = 0;
cst_Broadcasts_LOG = sp_PolyArray_new();
SP_GC_ROOT(cst_Broadcasts_LOG);
cst_Broadcasts_TRANSPORTS = sp_IntArray_new();
SP_GC_ROOT(cst_Broadcasts_TRANSPORTS);
sp_SymPolyHash *_t489 = sp_SymPolyHash_new();
sp_SymPolyHash_set(_t489, SPS_success, sp_box_range(sp_range_new(200LL, 299LL)));
sp_SymPolyHash_set(_t489, SPS_redirect, sp_box_range(sp_range_new(300LL, 399LL)));
sp_SymPolyHash_set(_t489, SPS_missing, sp_box_int(404LL));
sp_SymPolyHash_set(_t489, SPS_not_found, sp_box_int(404LL));
sp_SymPolyHash_set(_t489, SPS_error, sp_box_range(sp_range_new(500LL, 599LL)));
sp_SymPolyHash_set(_t489, SPS_ok, sp_box_int(200LL));
sp_SymPolyHash_set(_t489, SPS_created, sp_box_int(201LL));
sp_SymPolyHash_set(_t489, SPS_no_content, sp_box_int(204LL));
sp_SymPolyHash_set(_t489, SPS_moved_permanently, sp_box_int(301LL));
sp_SymPolyHash_set(_t489, SPS_found, sp_box_int(302LL));
sp_SymPolyHash_set(_t489, SPS_see_other, sp_box_int(303LL));
sp_SymPolyHash_set(_t489, SPS_bad_request, sp_box_int(400LL));
sp_SymPolyHash_set(_t489, SPS_unauthorized, sp_box_int(401LL));
sp_SymPolyHash_set(_t489, SPS_forbidden, sp_box_int(403LL));
sp_SymPolyHash_set(_t489, SPS_unprocessable_entity, sp_box_int(422LL));
sp_SymPolyHash_set(_t489, SPS_unprocessable_content, sp_box_int(422LL));
sp_SymPolyHash_set(_t489, SPS_internal_server_error, sp_box_int(500LL));
cst_RequestDispatch_STATUS_SYMBOLS = _t489;
SP_GC_ROOT(cst_RequestDispatch_STATUS_SYMBOLS);
sp_Db_cls_configure((&("\xff" ":memory:")[1]));
sp_StrArray * _t490 = sp_Schema_cls_statements();
SP_GC_ROOT(_t490);
for (mrb_int _t491 = 0; _t491 < sp_StrArray_length(_t490); _t491++) {
const char * lv_sql = sp_StrArray_get(_t490, _t491);
sp_redo_18: ;
sp_Db_cls_exec((const char *)lv_sql);
}
lv___t = sp_ArticlesControllerTest_new();
sp_Article_cls__adapter_truncate();
sp_Comment_cls__adapter_truncate();
sp_ArticlesFixtures_cls__fixtures_load_bang();
sp_CommentsFixtures_cls__fixtures_load_bang();
sp_TestBase_setup((sp_TestBase *)lv___t);
sp_ArticlesControllerTest_test_should_get_index(lv___t);
sp_TestBase_teardown((sp_TestBase *)lv___t);
lv___t = sp_ArticlesControllerTest_new();
sp_Article_cls__adapter_truncate();
sp_Comment_cls__adapter_truncate();
sp_ArticlesFixtures_cls__fixtures_load_bang();
sp_CommentsFixtures_cls__fixtures_load_bang();
sp_TestBase_setup((sp_TestBase *)lv___t);
sp_ArticlesControllerTest_test_should_get_new(lv___t);
sp_TestBase_teardown((sp_TestBase *)lv___t);
lv___t = sp_ArticlesControllerTest_new();
sp_Article_cls__adapter_truncate();
sp_Comment_cls__adapter_truncate();
sp_ArticlesFixtures_cls__fixtures_load_bang();
sp_CommentsFixtures_cls__fixtures_load_bang();
sp_TestBase_setup((sp_TestBase *)lv___t);
sp_ArticlesControllerTest_test_should_create_article(lv___t);
sp_TestBase_teardown((sp_TestBase *)lv___t);
lv___t = sp_ArticlesControllerTest_new();
sp_Article_cls__adapter_truncate();
sp_Comment_cls__adapter_truncate();
sp_ArticlesFixtures_cls__fixtures_load_bang();
sp_CommentsFixtures_cls__fixtures_load_bang();
sp_TestBase_setup((sp_TestBase *)lv___t);
sp_ArticlesControllerTest_test_should_not_create_article_with_invalid_params(lv___t);
sp_TestBase_teardown((sp_TestBase *)lv___t);
lv___t = sp_ArticlesControllerTest_new();
sp_Article_cls__adapter_truncate();
sp_Comment_cls__adapter_truncate();
sp_ArticlesFixtures_cls__fixtures_load_bang();
sp_CommentsFixtures_cls__fixtures_load_bang();
sp_TestBase_setup((sp_TestBase *)lv___t);
sp_ArticlesControllerTest_test_should_show_article(lv___t);
sp_TestBase_teardown((sp_TestBase *)lv___t);
lv___t = sp_ArticlesControllerTest_new();
sp_Article_cls__adapter_truncate();
sp_Comment_cls__adapter_truncate();
sp_ArticlesFixtures_cls__fixtures_load_bang();
sp_CommentsFixtures_cls__fixtures_load_bang();
sp_TestBase_setup((sp_TestBase *)lv___t);
sp_ArticlesControllerTest_test_should_get_edit(lv___t);
sp_TestBase_teardown((sp_TestBase *)lv___t);
lv___t = sp_ArticlesControllerTest_new();
sp_Article_cls__adapter_truncate();
sp_Comment_cls__adapter_truncate();
sp_ArticlesFixtures_cls__fixtures_load_bang();
sp_CommentsFixtures_cls__fixtures_load_bang();
sp_TestBase_setup((sp_TestBase *)lv___t);
sp_ArticlesControllerTest_test_should_update_article(lv___t);
sp_TestBase_teardown((sp_TestBase *)lv___t);
lv___t = sp_ArticlesControllerTest_new();
sp_Article_cls__adapter_truncate();
sp_Comment_cls__adapter_truncate();
sp_ArticlesFixtures_cls__fixtures_load_bang();
sp_CommentsFixtures_cls__fixtures_load_bang();
sp_TestBase_setup((sp_TestBase *)lv___t);
sp_ArticlesControllerTest_test_should_not_update_article_with_invalid_params(lv___t);
sp_TestBase_teardown((sp_TestBase *)lv___t);
lv___t = sp_ArticlesControllerTest_new();
sp_Article_cls__adapter_truncate();
sp_Comment_cls__adapter_truncate();
sp_ArticlesFixtures_cls__fixtures_load_bang();
sp_CommentsFixtures_cls__fixtures_load_bang();
sp_TestBase_setup((sp_TestBase *)lv___t);
sp_ArticlesControllerTest_test_should_destroy_article(lv___t);
sp_TestBase_teardown((sp_TestBase *)lv___t);
{ const char *_ps = (const char *)((&("\xff" "ArticlesControllerTest: 9 tests passed")[1])); if (_ps) { fputs(_ps, stdout); if (!*_ps || _ps[strlen(_ps)-1] != '\n') putchar('\n'); } else putchar('\n'); }
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment