Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save rubys/713d0fc0e17093de00c361e2509edb94 to your computer and use it in GitHub Desktop.
comment_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 110
static const char *const sp_sym_names[110] = {(&("\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])};
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)
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" "CommentTest")[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,122LL,123LL,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};
static const mrb_int sp_class_ancestors_flat[173] __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,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_CommentTest_s sp_CommentTest;
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_CommentTest_s {
mrb_int cls_id;
};
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_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, mrb_int 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, mrb_int lv_path, sp_StrIntHash * lv_params);
static inline mrb_int sp_ActionDispatch_IntegrationTest_post(sp_ActionDispatch_IntegrationTest *self, mrb_int lv_path, sp_StrIntHash * lv_params);
static inline mrb_int sp_ActionDispatch_IntegrationTest_patch(sp_ActionDispatch_IntegrationTest *self, mrb_int lv_path, sp_StrIntHash * lv_params);
static inline mrb_int sp_ActionDispatch_IntegrationTest_delete(sp_ActionDispatch_IntegrationTest *self, mrb_int lv_path, sp_StrIntHash * lv_params);
static mrb_int sp_ActionDispatch_IntegrationTest_dispatch_request(sp_ActionDispatch_IntegrationTest *self, const char * lv_method, mrb_int lv_path, sp_StrIntHash * 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, mrb_int lv_expected, sp_ActionController_Base * lv_response);
static inline mrb_int sp_ActionDispatch_IntegrationTest_assert_redirected_to(sp_ActionDispatch_IntegrationTest *self, mrb_int lv_expected_path, sp_ActionResponse * lv_response);
static mrb_int sp_ActionDispatch_IntegrationTest_assert_select(sp_ActionDispatch_IntegrationTest *self, const char * lv_selector, mrb_int 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_Comment * sp_Comment_cls_create(sp_StrIntHash * lv_attrs);
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 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_Article * sp_Article_cls_find(mrb_int lv_id);
static mrb_bool sp_Article_cls_exists_p(sp_RbVal lv_id);
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_CommentTest *sp_CommentTest_new(void);
static inline mrb_int sp_CommentTest_test_creates_a_comment_on_an_article(sp_CommentTest *self);
static inline mrb_int sp_CommentTest_test_belongs_to_article_association(sp_CommentTest *self);
static inline mrb_int sp_CommentTest_test_requires_commenter(sp_CommentTest *self);
static inline mrb_int sp_CommentTest_test_requires_body(sp_CommentTest *self);
static inline mrb_int sp_CommentTest_test_requires_valid_article(sp_CommentTest *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) {
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 _t14 = sp_box_nil();
switch (self->cls_id) {
case 33LL: _t14 = sp_box_int(sp_ApplicationRecord_cls_schema_columns()); break;
case 35LL: _t14 = sp_box_sym_array(sp_Comment_cls_schema_columns()); break;
case 37LL: _t14 = sp_box_sym_array(sp_Article_cls_schema_columns()); break;
default: _t14 = sp_box_int(sp_ActiveRecord_Base_cls_schema_columns()); break;
}
lv_cols = _t14;
lv_now = sp_time_iso8601(sp_time_utc(sp_time_now()));
sp_RbVal _t15 = lv_cols;
mrb_bool _t16 = FALSE;
if (_t15.tag == SP_TAG_OBJ) {
if (_t15.cls_id == 26) _t16 = sp_ActionDispatch_Flash_include_p((sp_ActionDispatch_Flash *)_t15.v.p, sp_box_sym(SPS_updated_at));
if (_t15.cls_id == 27) _t16 = sp_ActionDispatch_Session_include_p((sp_ActionDispatch_Session *)_t15.v.p, sp_box_sym(SPS_updated_at));
if (_t15.cls_id == SP_BUILTIN_SYM_ARRAY) _t16 = sp_IntArray_include((sp_IntArray *)_t15.v.p, (mrb_int)(SPS_updated_at));
if (_t15.cls_id == SP_BUILTIN_SYM_INT_HASH) _t16 = sp_SymIntHash_has_key((sp_SymIntHash *)_t15.v.p, SPS_updated_at);
if (_t15.cls_id == SP_BUILTIN_SYM_STR_HASH) _t16 = sp_SymStrHash_has_key((sp_SymStrHash *)_t15.v.p, SPS_updated_at);
if (_t15.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t16 = sp_SymPolyHash_has_key((sp_SymPolyHash *)_t15.v.p, SPS_updated_at);
}
if (_t16) {
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 _t17 = lv_cols;
mrb_bool _t18 = FALSE;
if (_t17.tag == SP_TAG_OBJ) {
if (_t17.cls_id == 26) _t18 = sp_ActionDispatch_Flash_include_p((sp_ActionDispatch_Flash *)_t17.v.p, sp_box_sym(SPS_created_at));
if (_t17.cls_id == 27) _t18 = sp_ActionDispatch_Session_include_p((sp_ActionDispatch_Session *)_t17.v.p, sp_box_sym(SPS_created_at));
if (_t17.cls_id == SP_BUILTIN_SYM_ARRAY) _t18 = sp_IntArray_include((sp_IntArray *)_t17.v.p, (mrb_int)(SPS_created_at));
if (_t17.cls_id == SP_BUILTIN_SYM_INT_HASH) _t18 = sp_SymIntHash_has_key((sp_SymIntHash *)_t17.v.p, SPS_created_at);
if (_t17.cls_id == SP_BUILTIN_SYM_STR_HASH) _t18 = sp_SymStrHash_has_key((sp_SymStrHash *)_t17.v.p, SPS_created_at);
if (_t17.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t18 = sp_SymPolyHash_has_key((sp_SymPolyHash *)_t17.v.p, SPS_created_at);
}
sp_RbVal _t19 = sp_box_nil();
switch (self->cls_id) {
case 35LL: _t19 = sp_Comment__aref((sp_Comment *)self, sp_box_sym(SPS_created_at)); break;
case 37LL: _t19 = sp_Article__aref((sp_Article *)self, sp_box_sym(SPS_created_at)); break;
default: _t19 = sp_ActiveRecord_Base__aref(self, sp_box_sym(SPS_created_at)); break;
}
if (((lv_creating && _t18) && sp_poly_nil_p(_t19))) {
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 * _t20 = NULL;
switch (self->cls_id) {
case 35LL: _t20 = sp_Comment_validate((sp_Comment *)self); break;
case 37LL: _t20 = sp_Article_validate((sp_Article *)self); break;
default: _t20 = sp_ActiveRecord_Base_validate(self); break;
}
_t20;
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 _t21 = self->iv_notice;
SP_GC_RESTORE();
return _t21;
}
if (sp_str_eq(lv_k, (&("\xff" "alert")[1]))) {
sp_RbVal _t22 = self->iv_alert;
SP_GC_RESTORE();
return _t22;
}
sp_RbVal _t23 = ((void)(0), sp_box_nil());
SP_GC_RESTORE();
return _t23;
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 _t24 = lv_v;
SP_GC_RESTORE();
return _t24;
}
sp_RbVal _t25 = sp_box_nullable_obj(lv_default, 26);
SP_GC_RESTORE();
return _t25;
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 _t26 = lv_v;
SP_GC_RESTORE();
return _t26;
}
if (sp_str_eq(lv_k, (&("\xff" "alert")[1]))) {
lv_v = self->iv_alert;
self->iv_alert = ((void)(0), sp_box_nil());
sp_RbVal _t27 = lv_v;
SP_GC_RESTORE();
return _t27;
}
sp_RbVal _t28 = ((void)(0), sp_box_nil());
SP_GC_RESTORE();
return _t28;
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 _t29 = sp_StrArray_length(lv_keys);
while ((lv_i < _t29)) {
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 _t30 = sp_StrArray_length(lv_keys);
while ((lv_i < _t30)) {
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 _t31 = sp_StrIntHash_get(self->iv_data, lv_k);
SP_GC_RESTORE();
return _t31;
}
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 _t32 = sp_StrIntHash_get(self->iv_data, lv_k);
SP_GC_RESTORE();
return _t32;
}
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 _t33 = sp_StrArray_length(lv_keys);
while ((lv_i < _t33)) {
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 *_t34 = sp_SymStrHash_new();
sp_SymStrHash_set(_t34, SPS_for, sp_sprintf("%s_%lld", self->iv_model_name, (long long)lv_field));
sp_SymStrHash * _t35 = _t34;
SP_GC_ROOT(_t35);
lv_attrs = sp_ActionView_ViewHelpers_cls_render_attrs(sp_box_obj((void *)(sp_SymStrHash_merge(_t35, lv_opts)), SP_BUILTIN_SYM_STR_HASH));
const char * _t36 = sp_sym_to_s(lv_field);
SP_GC_ROOT(_t36);
return sp_sprintf("<label%s>%s</label>", lv_attrs, sp_ActionView_ViewHelpers_cls_html_escape(sp_box_str(sp_str_capitalize(_t36))));
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 _t37 = self->iv_model;
sp_RbVal _t38 = sp_box_nil();
if (_t37.tag == SP_TAG_OBJ) {
if (_t37.cls_id == 23) _t38 = sp_ActiveRecord_Base__aref((sp_ActiveRecord_Base *)_t37.v.p, sp_box_sym(lv_field));
if (_t37.cls_id == 26) _t38 = sp_ActionDispatch_Flash__aref((sp_ActionDispatch_Flash *)_t37.v.p, sp_box_sym(lv_field));
if (_t37.cls_id == 27) _t38 = sp_box_int(sp_ActionDispatch_Session__aref((sp_ActionDispatch_Session *)_t37.v.p, sp_box_sym(lv_field)));
if (_t37.cls_id == 33) _t38 = sp_ActiveRecord_Base__aref((sp_ActiveRecord_Base *)_t37.v.p, sp_box_sym(lv_field));
if (_t37.cls_id == 35) _t38 = sp_Comment__aref((sp_Comment *)_t37.v.p, sp_box_sym(lv_field));
if (_t37.cls_id == 37) _t38 = sp_Article__aref((sp_Article *)_t37.v.p, sp_box_sym(lv_field));
if (_t37.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t38 = sp_SymPolyHash_get((sp_SymPolyHash *)_t37.v.p, lv_field);
if (_t37.cls_id == SP_BUILTIN_SYM_INT_HASH) _t38 = sp_box_int(sp_SymIntHash_get((sp_SymIntHash *)_t37.v.p, lv_field));
if (_t37.cls_id == SP_BUILTIN_SYM_STR_HASH) _t38 = sp_box_str(sp_SymStrHash_get((sp_SymStrHash *)_t37.v.p, lv_field));
}
lv_value = _t38;
sp_SymStrHash *_t39 = sp_SymStrHash_new();
sp_SymStrHash_set(_t39, SPS_type, (&("\xff" "text")[1]));
sp_SymStrHash_set(_t39, SPS_name, sp_sprintf("%s[%lld]", self->iv_model_name, (long long)lv_field));
sp_SymStrHash_set(_t39, SPS_id, sp_sprintf("%s_%lld", self->iv_model_name, (long long)lv_field));
lv_base = _t39;
const char * _t40 = sp_poly_to_s(lv_value);
SP_GC_ROOT(_t40);
if (!((sp_poly_nil_p(lv_value) || (strlen(_t40) == 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 _t41 = self->iv_model;
sp_RbVal _t42 = sp_box_nil();
if (_t41.tag == SP_TAG_OBJ) {
if (_t41.cls_id == 23) _t42 = sp_ActiveRecord_Base__aref((sp_ActiveRecord_Base *)_t41.v.p, sp_box_sym(lv_field));
if (_t41.cls_id == 26) _t42 = sp_ActionDispatch_Flash__aref((sp_ActionDispatch_Flash *)_t41.v.p, sp_box_sym(lv_field));
if (_t41.cls_id == 27) _t42 = sp_box_int(sp_ActionDispatch_Session__aref((sp_ActionDispatch_Session *)_t41.v.p, sp_box_sym(lv_field)));
if (_t41.cls_id == 33) _t42 = sp_ActiveRecord_Base__aref((sp_ActiveRecord_Base *)_t41.v.p, sp_box_sym(lv_field));
if (_t41.cls_id == 35) _t42 = sp_Comment__aref((sp_Comment *)_t41.v.p, sp_box_sym(lv_field));
if (_t41.cls_id == 37) _t42 = sp_Article__aref((sp_Article *)_t41.v.p, sp_box_sym(lv_field));
if (_t41.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t42 = sp_SymPolyHash_get((sp_SymPolyHash *)_t41.v.p, lv_field);
if (_t41.cls_id == SP_BUILTIN_SYM_INT_HASH) _t42 = sp_box_int(sp_SymIntHash_get((sp_SymIntHash *)_t41.v.p, lv_field));
if (_t41.cls_id == SP_BUILTIN_SYM_STR_HASH) _t42 = sp_box_str(sp_SymStrHash_get((sp_SymStrHash *)_t41.v.p, lv_field));
}
lv_value = _t42;
sp_SymStrHash *_t43 = sp_SymStrHash_new();
sp_SymStrHash_set(_t43, SPS_name, sp_sprintf("%s[%lld]", self->iv_model_name, (long long)lv_field));
sp_SymStrHash_set(_t43, SPS_id, sp_sprintf("%s_%lld", self->iv_model_name, (long long)lv_field));
sp_SymStrHash * _t44 = _t43;
SP_GC_ROOT(_t44);
lv_attrs = sp_ActionView_ViewHelpers_cls_render_attrs(sp_box_obj((void *)(sp_SymPolyHash_merge(sp_SymStrHash_to_sym_poly(_t44), 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 * _t45 = lv_label;
lv_text = ((_t45 != NULL) ? sp_box_nullable_str(_t45) : 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 *_t46 = sp_SymPolyHash_new();
sp_SymPolyHash_set(_t46, SPS_type, sp_box_str((&("\xff" "submit")[1])));
sp_SymPolyHash_set(_t46, SPS_name, sp_box_str((&("\xff" "commit")[1])));
sp_SymPolyHash_set(_t46, SPS_value, lv_text);
sp_SymPolyHash_set(_t46, ((sp_sym)49), lv_text);
sp_SymPolyHash * _t47 = _t46;
SP_GC_ROOT(_t47);
sp_SymPolyHash *_t48 = sp_SymPolyHash_merge_str(_t47, lv_opts);
lv_attrs = sp_ActionView_ViewHelpers_cls_render_attrs(sp_box_obj((void *)(_t48), 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, mrb_int lv_path, sp_StrIntHash * lv_params) {
(void)lv_path;
(void)lv_params;
return 0;
}
static inline mrb_int sp_ActionDispatch_IntegrationTest_post(sp_ActionDispatch_IntegrationTest *self, mrb_int lv_path, sp_StrIntHash * lv_params) {
SP_GC_SAVE();
SP_GC_ROOT(self);
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, mrb_int lv_path, sp_StrIntHash * lv_params) {
SP_GC_SAVE();
SP_GC_ROOT(self);
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, mrb_int lv_path, sp_StrIntHash * lv_params) {
SP_GC_SAVE();
SP_GC_ROOT(self);
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, mrb_int lv_path, sp_StrIntHash * 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;
const char * lv_k = (&("\xff")[1]);
volatile mrb_int lv_v = 0;
SP_GC_ROOT(lv_matched);
SP_GC_ROOT(lv_merged);
SP_GC_ROOT(lv_k);
SP_GC_ROOT(self);
SP_GC_ROOT(lv_method);
SP_GC_ROOT(lv_params);
lv_matched = sp_ActionDispatch_Router_cls_match((const char *)lv_method, lv_path, sp_Routes_cls_table());
if ((lv_matched == NULL)) {
sp_raise(sp_sprintf("No route matches %s %lld", lv_method, (long long)lv_path));
}
sp_RbVal _t49 = sp_box_nil();
mrb_int _t50 = lv_matched->iv_controller;
if (_t50 == SPS_articles) {
_t49 = sp_ArticlesController_new();
} else if (_t50 == SPS_comments) {
_t49 = sp_CommentsController_new();
}
lv_controller = _t49;
sp_StrStrHash * _t51 = lv_matched->iv_path_params;
SP_GC_ROOT(_t51);
lv_merged = 0;
for (mrb_int _t52 = 0; _t52 < lv_params->len; _t52++) {
lv_k = lv_params->order[_t52];
lv_v = sp_StrIntHash_get(lv_params, lv_params->order[_t52]);
sp_redo_4: ;
}
sp_RbVal _t53 = lv_controller;
sp_StrIntHash * _t54 = NULL;
if (_t53.tag == SP_TAG_OBJ) {
if (_t53.cls_id == 29) { ((sp_ActionController_Base *)_t53.v.p)->iv_params = lv_merged; _t54 = lv_merged; }
if (_t53.cls_id == 32) { ((sp_ApplicationController *)_t53.v.p)->iv_params = lv_merged; _t54 = lv_merged; }
if (_t53.cls_id == 39) { ((sp_ArticlesController *)_t53.v.p)->iv_params = lv_merged; _t54 = lv_merged; }
if (_t53.cls_id == 41) { ((sp_CommentsController *)_t53.v.p)->iv_params = lv_merged; _t54 = lv_merged; }
}
_t54;
sp_RbVal _t55 = lv_controller;
if (!(self->iv___session)) {
self->iv___session = sp_ActionDispatch_Session_new(0);
}
sp_ActionDispatch_Session * _t56 = NULL;
if (_t55.tag == SP_TAG_OBJ) {
if (_t55.cls_id == 29) { ((sp_ActionController_Base *)_t55.v.p)->iv_session = self->iv___session; _t56 = self->iv___session; }
if (_t55.cls_id == 32) { ((sp_ApplicationController *)_t55.v.p)->iv_session = self->iv___session; _t56 = self->iv___session; }
if (_t55.cls_id == 39) { ((sp_ArticlesController *)_t55.v.p)->iv_session = self->iv___session; _t56 = self->iv___session; }
if (_t55.cls_id == 41) { ((sp_CommentsController *)_t55.v.p)->iv_session = self->iv___session; _t56 = self->iv___session; }
}
_t56;
sp_RbVal _t57 = lv_controller;
if (!(self->iv___flash)) {
self->iv___flash = sp_ActionDispatch_Flash_new(0);
}
sp_ActionDispatch_Flash * _t58 = NULL;
if (_t57.tag == SP_TAG_OBJ) {
if (_t57.cls_id == 29) { ((sp_ActionController_Base *)_t57.v.p)->iv_flash = self->iv___flash; _t58 = self->iv___flash; }
if (_t57.cls_id == 32) { ((sp_ApplicationController *)_t57.v.p)->iv_flash = self->iv___flash; _t58 = self->iv___flash; }
if (_t57.cls_id == 39) { ((sp_ArticlesController *)_t57.v.p)->iv_flash = self->iv___flash; _t58 = self->iv___flash; }
if (_t57.cls_id == 41) { ((sp_CommentsController *)_t57.v.p)->iv_flash = self->iv___flash; _t58 = self->iv___flash; }
}
_t58;
sp_RbVal _t59 = lv_controller;
mrb_int _t60 = 0;
if (_t59.tag == SP_TAG_OBJ) {
if (_t59.cls_id == 29) { ((sp_ActionController_Base *)_t59.v.p)->iv_request_method = lv_method; _t60 = lv_method; }
if (_t59.cls_id == 32) { ((sp_ApplicationController *)_t59.v.p)->iv_request_method = lv_method; _t60 = lv_method; }
if (_t59.cls_id == 39) { ((sp_ArticlesController *)_t59.v.p)->iv_request_method = lv_method; _t60 = lv_method; }
if (_t59.cls_id == 41) { ((sp_CommentsController *)_t59.v.p)->iv_request_method = lv_method; _t60 = lv_method; }
}
_t60;
sp_RbVal _t61 = lv_controller;
mrb_int _t62 = 0;
if (_t61.tag == SP_TAG_OBJ) {
if (_t61.cls_id == 29) { ((sp_ActionController_Base *)_t61.v.p)->iv_request_path = lv_path; _t62 = lv_path; }
if (_t61.cls_id == 32) { ((sp_ApplicationController *)_t61.v.p)->iv_request_path = lv_path; _t62 = lv_path; }
if (_t61.cls_id == 39) { ((sp_ArticlesController *)_t61.v.p)->iv_request_path = lv_path; _t62 = lv_path; }
if (_t61.cls_id == 41) { ((sp_CommentsController *)_t61.v.p)->iv_request_path = lv_path; _t62 = lv_path; }
}
_t62;
sp_RbVal _t63 = lv_controller;
sp_RbVal _t64 = sp_box_nil();
if (_t63.tag == SP_TAG_OBJ) {
if (_t63.cls_id == 29) _t64 = sp_box_int(sp_ActionController_Base_process_action((sp_ActionController_Base *)_t63.v.p, lv_matched->iv_action));
if (_t63.cls_id == 32) _t64 = sp_box_int(sp_ActionController_Base_process_action((sp_ActionController_Base *)_t63.v.p, lv_matched->iv_action));
if (_t63.cls_id == 39) _t64 = ((void)(sp_ArticlesController_process_action((sp_ArticlesController *)_t63.v.p, lv_matched->iv_action)), sp_box_nil());
if (_t63.cls_id == 41) _t64 = ((void)(sp_CommentsController_process_action((sp_CommentsController *)_t63.v.p, lv_matched->iv_action)), sp_box_nil());
}
_t64;
sp_RbVal _t65 = lv_controller;
sp_ActionDispatch_Flash * _t66 = NULL;
if (_t65.tag == SP_TAG_OBJ) {
if (_t65.cls_id == 29) _t66 = ((sp_ActionController_Base *)_t65.v.p)->iv_flash;
if (_t65.cls_id == 32) _t66 = ((sp_ApplicationController *)_t65.v.p)->iv_flash;
if (_t65.cls_id == 39) _t66 = ((sp_ArticlesController *)_t65.v.p)->iv_flash;
if (_t65.cls_id == 41) _t66 = ((sp_CommentsController *)_t65.v.p)->iv_flash;
if (_t65.cls_id == 42) _t66 = ((sp_ActionResponse *)_t65.v.p)->iv_flash;
}
self->iv___flash = _t66;
sp_RbVal _t67 = lv_controller;
mrb_int _t68 = 0;
if (_t67.tag == SP_TAG_OBJ) {
if (_t67.cls_id == 29) _t68 = ((sp_ActionController_Base *)_t67.v.p)->iv_status;
if (_t67.cls_id == 32) _t68 = ((sp_ApplicationController *)_t67.v.p)->iv_status;
if (_t67.cls_id == 39) _t68 = ((sp_ArticlesController *)_t67.v.p)->iv_status;
if (_t67.cls_id == 41) _t68 = ((sp_CommentsController *)_t67.v.p)->iv_status;
if (_t67.cls_id == 42) _t68 = ((sp_ActionResponse *)_t67.v.p)->iv_status;
}
sp_RbVal _t69 = lv_controller;
sp_RbVal _t70 = sp_box_nil();
if (_t69.tag == SP_TAG_OBJ) {
if (_t69.cls_id == 29) _t70 = ((sp_ActionController_Base *)_t69.v.p)->iv_body;
if (_t69.cls_id == 32) _t70 = ((sp_ApplicationController *)_t69.v.p)->iv_body;
if (_t69.cls_id == 34) _t70 = sp_CommentRow_body((sp_CommentRow *)_t69.v.p);
if (_t69.cls_id == 35) _t70 = sp_Comment_body((sp_Comment *)_t69.v.p);
if (_t69.cls_id == 36) _t70 = sp_ArticleRow_body((sp_ArticleRow *)_t69.v.p);
if (_t69.cls_id == 37) _t70 = sp_Article_body((sp_Article *)_t69.v.p);
if (_t69.cls_id == 38) _t70 = sp_ArticleParams_body((sp_ArticleParams *)_t69.v.p);
if (_t69.cls_id == 39) _t70 = ((sp_ArticlesController *)_t69.v.p)->iv_body;
if (_t69.cls_id == 40) _t70 = sp_CommentParams_body((sp_CommentParams *)_t69.v.p);
if (_t69.cls_id == 41) _t70 = ((sp_CommentsController *)_t69.v.p)->iv_body;
if (_t69.cls_id == 42) _t70 = ((sp_ActionResponse *)_t69.v.p)->iv_body;
}
sp_RbVal _t71 = lv_controller;
sp_RbVal _t72 = sp_box_nil();
if (_t71.tag == SP_TAG_OBJ) {
if (_t71.cls_id == 29) _t72 = sp_box_str(((sp_ActionController_Base *)_t71.v.p)->iv_location);
if (_t71.cls_id == 32) _t72 = sp_box_str(((sp_ApplicationController *)_t71.v.p)->iv_location);
if (_t71.cls_id == 39) _t72 = sp_box_str(((sp_ArticlesController *)_t71.v.p)->iv_location);
if (_t71.cls_id == 41) _t72 = sp_box_str(((sp_CommentsController *)_t71.v.p)->iv_location);
if (_t71.cls_id == 42) _t72 = ((sp_ActionResponse *)_t71.v.p)->iv_location;
}
sp_RbVal _t73 = lv_controller;
sp_ActionDispatch_Flash * _t74 = NULL;
if (_t73.tag == SP_TAG_OBJ) {
if (_t73.cls_id == 29) _t74 = ((sp_ActionController_Base *)_t73.v.p)->iv_flash;
if (_t73.cls_id == 32) _t74 = ((sp_ApplicationController *)_t73.v.p)->iv_flash;
if (_t73.cls_id == 39) _t74 = ((sp_ArticlesController *)_t73.v.p)->iv_flash;
if (_t73.cls_id == 41) _t74 = ((sp_CommentsController *)_t73.v.p)->iv_flash;
if (_t73.cls_id == 42) _t74 = ((sp_ActionResponse *)_t73.v.p)->iv_flash;
}
self->iv___response = sp_ActionResponse_new(_t68, _t70, _t72, _t74);
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 _t75 = lv_value;
SP_GC_RESTORE();
return _t75;
lv_out = sp_StrPolyHash_new();
return lv_out;
return NULL;
}
static mrb_int sp_ActionDispatch_IntegrationTest_assert_response(sp_ActionDispatch_IntegrationTest *self, mrb_int lv_expected, sp_ActionController_Base * lv_response) {
(void)lv_expected;
(void)lv_response;
return 0;
}
static inline mrb_int sp_ActionDispatch_IntegrationTest_assert_redirected_to(sp_ActionDispatch_IntegrationTest *self, mrb_int lv_expected_path, sp_ActionResponse * lv_response) {
(void)lv_expected_path;
(void)lv_response;
return 0;
}
static mrb_int sp_ActionDispatch_IntegrationTest_assert_select(sp_ActionDispatch_IntegrationTest *self, const char * lv_selector, mrb_int lv_content_or_opts, mrb_int lv_opts, sp_Proc * lv_block, void (*_block)(mrb_int, void*), void *_benv) {
(void)lv_selector;
(void)lv_content_or_opts;
(void)lv_opts;
(void)lv_block;
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 _t76 = self->iv_id;
SP_GC_RESTORE();
return _t76;
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 _t77 = self->iv_article_id;
SP_GC_RESTORE();
return _t77;
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 _t78 = self->iv_body;
SP_GC_RESTORE();
return _t78;
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 _t79 = 0;
sp_CommentRow_id_eq(lv_instance, sp_box_int((((_t79), TRUE) ? _t79 : 0LL)));
mrb_int _t80 = 0;
sp_CommentRow_article_id_eq(lv_instance, sp_box_int((((_t80), TRUE) ? _t80 : 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 _t81 = sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_id));
self->iv_id = sp_box_int((((_t81), TRUE) ? _t81 : 0LL));
mrb_int _t82 = sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_article_id));
sp_Comment_article_id_eq(self, sp_box_int((((_t82), TRUE) ? _t82 : 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 _t83 = sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_id));
self->iv_id = sp_box_int((((_t83), TRUE) ? _t83 : 0LL));
mrb_int _t84 = sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_article_id));
sp_Comment_article_id_eq(self, sp_box_int((((_t84), TRUE) ? _t84 : 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 _t85 = self->iv_id;
SP_GC_RESTORE();
return _t85;
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 _t86 = self->iv_article_id;
SP_GC_RESTORE();
return _t86;
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 _t87 = self->iv_body;
SP_GC_RESTORE();
return _t87;
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 _t88 = self->iv_commenter;
SP_GC_RESTORE();
return _t88;
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 _t89 = self->iv_created_at;
SP_GC_RESTORE();
return _t89;
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 _t90 = self->iv_updated_at;
SP_GC_RESTORE();
return _t90;
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 _t91 = lv_name;
if ((_t91.tag == SP_TAG_SYM && _t91.v.i == SPS_id)) {
sp_RbVal _t92 = self->iv_id;
SP_GC_RESTORE();
return _t92;
} else if ((_t91.tag == SP_TAG_SYM && _t91.v.i == SPS_article_id)) {
sp_RbVal _t93 = self->iv_article_id;
SP_GC_RESTORE();
return _t93;
} else if ((_t91.tag == SP_TAG_SYM && _t91.v.i == SPS_body)) {
sp_RbVal _t94 = self->iv_body;
SP_GC_RESTORE();
return _t94;
} else if ((_t91.tag == SP_TAG_SYM && _t91.v.i == SPS_commenter)) {
sp_RbVal _t95 = self->iv_commenter;
SP_GC_RESTORE();
return _t95;
} else if ((_t91.tag == SP_TAG_SYM && _t91.v.i == SPS_created_at)) {
sp_RbVal _t96 = self->iv_created_at;
SP_GC_RESTORE();
return _t96;
} else if ((_t91.tag == SP_TAG_SYM && _t91.v.i == SPS_updated_at)) {
sp_RbVal _t97 = self->iv_updated_at;
SP_GC_RESTORE();
return _t97;
}
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 _t98 = lv_name;
if (_t98 == SPS_id) {
self->iv_id = lv_value;
return 0;
} else if (_t98 == SPS_article_id) {
self->iv_article_id = lv_value;
return 0;
} else if (_t98 == SPS_body) {
self->iv_body = lv_value;
return 0;
} else if (_t98 == SPS_commenter) {
self->iv_commenter = lv_value;
return 0;
} else if (_t98 == SPS_created_at) {
self->iv_created_at = lv_value;
return 0;
} else if (_t98 == 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 * _t99 = lv_p->iv_commenter;
SP_GC_ROOT(_t99);
if ((_t99 == 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 * _t100 = (&("\xff" "INSERT INTO comments (article_id, body, commenter, created_at, updated_at) VALUES (")[1]);
SP_GC_ROOT(_t100);
const char * _t101 = sp_Db_cls_escape_int(self->iv_article_id);
SP_GC_ROOT(_t101);
const char * _t102 = (&("\xff" ", ")[1]);
SP_GC_ROOT(_t102);
const char * _t103 = sp_Db_cls_escape_string(self->iv_body);
SP_GC_ROOT(_t103);
const char * _t104 = (&("\xff" ", ")[1]);
SP_GC_ROOT(_t104);
const char * _t105 = sp_Db_cls_escape_string(self->iv_commenter);
SP_GC_ROOT(_t105);
const char * _t106 = (&("\xff" ", ")[1]);
SP_GC_ROOT(_t106);
const char * _t107 = sp_Db_cls_escape_string(self->iv_created_at);
SP_GC_ROOT(_t107);
const char * _t108 = (&("\xff" ", ")[1]);
SP_GC_ROOT(_t108);
const char * _t109 = sp_Db_cls_escape_string(self->iv_updated_at);
SP_GC_ROOT(_t109);
const char * _t110 = (&("\xff" ")")[1]);
SP_GC_ROOT(_t110);
sp_Db_cls_exec(sp_str_concat_arr((const char *const[]){_t100, _t101, _t102, _t103, _t104, _t105, _t106, _t107, _t108, _t109, _t110}, 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 * _t111 = (&("\xff" "UPDATE comments SET ")[1]);
SP_GC_ROOT(_t111);
const char * _t112 = (&("\xff" "article_id = ")[1]);
SP_GC_ROOT(_t112);
const char * _t113 = sp_Db_cls_escape_int(self->iv_article_id);
SP_GC_ROOT(_t113);
const char * _t114 = (&("\xff" ", body = ")[1]);
SP_GC_ROOT(_t114);
const char * _t115 = sp_Db_cls_escape_string(self->iv_body);
SP_GC_ROOT(_t115);
const char * _t116 = (&("\xff" ", commenter = ")[1]);
SP_GC_ROOT(_t116);
const char * _t117 = sp_Db_cls_escape_string(self->iv_commenter);
SP_GC_ROOT(_t117);
const char * _t118 = (&("\xff" ", created_at = ")[1]);
SP_GC_ROOT(_t118);
const char * _t119 = sp_Db_cls_escape_string(self->iv_created_at);
SP_GC_ROOT(_t119);
const char * _t120 = (&("\xff" ", updated_at = ")[1]);
SP_GC_ROOT(_t120);
const char * _t121 = sp_Db_cls_escape_string(self->iv_updated_at);
SP_GC_ROOT(_t121);
const char * _t122 = (&("\xff" " WHERE ")[1]);
SP_GC_ROOT(_t122);
const char * _t123 = (&("\xff" "id = ")[1]);
SP_GC_ROOT(_t123);
const char * _t124 = sp_Db_cls_escape_int(self->iv_id);
SP_GC_ROOT(_t124);
return sp_Db_cls_exec(sp_str_concat_arr((const char *const[]){_t111, _t112, _t113, _t114, _t115, _t116, _t117, _t118, _t119, _t120, _t121, _t122, _t123, _t124}, 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 _t125 = sp_box_obj(lv_result, 35);
SP_GC_RESTORE();
return _t125;
return sp_box_nil();
}
static inline sp_StrArray * sp_Comment_validate(sp_Comment *self) {
SP_GC_SAVE();
SP_GC_ROOT(self);
sp_RbVal _t126 = self->iv_commenter;
mrb_bool _t127 = FALSE;
if (_t126.tag == SP_TAG_STR) _t127 = (sp_str_length(_t126.v.s) == 0);
if (_t126.tag == SP_TAG_OBJ) {
if (_t126.cls_id == 26) _t127 = sp_ActionDispatch_Flash_empty_p((sp_ActionDispatch_Flash *)_t126.v.p);
if (_t126.cls_id == 27) _t127 = sp_ActionDispatch_Session_empty_p((sp_ActionDispatch_Session *)_t126.v.p);
if (_t126.cls_id == SP_BUILTIN_INT_ARRAY) _t127 = (sp_IntArray_length((sp_IntArray *)_t126.v.p) == 0);
if (_t126.cls_id == SP_BUILTIN_FLT_ARRAY) _t127 = (sp_FloatArray_length((sp_FloatArray *)_t126.v.p) == 0);
if (_t126.cls_id == SP_BUILTIN_STR_ARRAY) _t127 = (sp_StrArray_length((sp_StrArray *)_t126.v.p) == 0);
if (_t126.cls_id == SP_BUILTIN_SYM_ARRAY) _t127 = (sp_IntArray_length((sp_IntArray *)_t126.v.p) == 0);
if (_t126.cls_id == SP_BUILTIN_PTR_ARRAY) _t127 = (sp_PtrArray_length((sp_PtrArray *)_t126.v.p) == 0);
if (_t126.cls_id == SP_BUILTIN_POLY_ARRAY) _t127 = (sp_PolyArray_length((sp_PolyArray *)_t126.v.p) == 0);
if (_t126.cls_id == SP_BUILTIN_STR_INT_HASH) _t127 = (sp_StrIntHash_length((sp_StrIntHash *)_t126.v.p) == 0);
if (_t126.cls_id == SP_BUILTIN_STR_STR_HASH) _t127 = (sp_StrStrHash_length((sp_StrStrHash *)_t126.v.p) == 0);
if (_t126.cls_id == SP_BUILTIN_INT_STR_HASH) _t127 = (sp_IntStrHash_length((sp_IntStrHash *)_t126.v.p) == 0);
if (_t126.cls_id == SP_BUILTIN_STR_POLY_HASH) _t127 = (sp_StrPolyHash_length((sp_StrPolyHash *)_t126.v.p) == 0);
if (_t126.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t127 = (sp_SymPolyHash_length((sp_SymPolyHash *)_t126.v.p) == 0);
if (_t126.cls_id == SP_BUILTIN_POLY_POLY_HASH) _t127 = (sp_PolyPolyHash_length((sp_PolyPolyHash *)_t126.v.p) == 0);
}
if ((sp_poly_nil_p(self->iv_commenter) || _t127)) {
sp_StrArray * _t128 = sp_ActiveRecord_Base_errors((sp_ActiveRecord_Base *)self);
SP_GC_ROOT(_t128);
sp_StrArray_push(_t128, (&("\xff" "commenter can't be blank")[1]));
}
sp_RbVal _t129 = self->iv_body;
mrb_bool _t130 = FALSE;
if (_t129.tag == SP_TAG_STR) _t130 = (sp_str_length(_t129.v.s) == 0);
if (_t129.tag == SP_TAG_OBJ) {
if (_t129.cls_id == 26) _t130 = sp_ActionDispatch_Flash_empty_p((sp_ActionDispatch_Flash *)_t129.v.p);
if (_t129.cls_id == 27) _t130 = sp_ActionDispatch_Session_empty_p((sp_ActionDispatch_Session *)_t129.v.p);
if (_t129.cls_id == SP_BUILTIN_INT_ARRAY) _t130 = (sp_IntArray_length((sp_IntArray *)_t129.v.p) == 0);
if (_t129.cls_id == SP_BUILTIN_FLT_ARRAY) _t130 = (sp_FloatArray_length((sp_FloatArray *)_t129.v.p) == 0);
if (_t129.cls_id == SP_BUILTIN_STR_ARRAY) _t130 = (sp_StrArray_length((sp_StrArray *)_t129.v.p) == 0);
if (_t129.cls_id == SP_BUILTIN_SYM_ARRAY) _t130 = (sp_IntArray_length((sp_IntArray *)_t129.v.p) == 0);
if (_t129.cls_id == SP_BUILTIN_PTR_ARRAY) _t130 = (sp_PtrArray_length((sp_PtrArray *)_t129.v.p) == 0);
if (_t129.cls_id == SP_BUILTIN_POLY_ARRAY) _t130 = (sp_PolyArray_length((sp_PolyArray *)_t129.v.p) == 0);
if (_t129.cls_id == SP_BUILTIN_STR_INT_HASH) _t130 = (sp_StrIntHash_length((sp_StrIntHash *)_t129.v.p) == 0);
if (_t129.cls_id == SP_BUILTIN_STR_STR_HASH) _t130 = (sp_StrStrHash_length((sp_StrStrHash *)_t129.v.p) == 0);
if (_t129.cls_id == SP_BUILTIN_INT_STR_HASH) _t130 = (sp_IntStrHash_length((sp_IntStrHash *)_t129.v.p) == 0);
if (_t129.cls_id == SP_BUILTIN_STR_POLY_HASH) _t130 = (sp_StrPolyHash_length((sp_StrPolyHash *)_t129.v.p) == 0);
if (_t129.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t130 = (sp_SymPolyHash_length((sp_SymPolyHash *)_t129.v.p) == 0);
if (_t129.cls_id == SP_BUILTIN_POLY_POLY_HASH) _t130 = (sp_PolyPolyHash_length((sp_PolyPolyHash *)_t129.v.p) == 0);
}
if ((sp_poly_nil_p(self->iv_body) || _t130)) {
sp_StrArray * _t131 = sp_ActiveRecord_Base_errors((sp_ActiveRecord_Base *)self);
SP_GC_ROOT(_t131);
sp_StrArray_push(_t131, (&("\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 * _t132 = sp_ActiveRecord_Base_errors((sp_ActiveRecord_Base *)self);
SP_GC_ROOT(_t132);
return (sp_StrArray_push(_t132, (&("\xff" "article must exist")[1])), _t132);
} 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 * _t133 = (&("\xff" "SELECT id, body, created_at, title, updated_at FROM articles")[1]);
SP_GC_ROOT(_t133);
const char * _t134 = (&("\xff" " WHERE ")[1]);
SP_GC_ROOT(_t134);
const char * _t135 = (&("\xff" "id = ")[1]);
SP_GC_ROOT(_t135);
const char * _t136 = sp_Db_cls_escape_int(self->iv_article_id);
SP_GC_ROOT(_t136);
const char * _t137 = (&("\xff" " LIMIT 1")[1]);
SP_GC_ROOT(_t137);
lv_stmt = sp_Db_cls_prepare(sp_str_concat_arr((const char *const[]){_t133, _t134, _t135, _t136, _t137}, 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 *_t138 = sp_IntArray_new();
sp_IntArray_push(_t138, SPS_id);
sp_IntArray_push(_t138, SPS_article_id);
sp_IntArray_push(_t138, SPS_body);
sp_IntArray_push(_t138, SPS_commenter);
sp_IntArray_push(_t138, SPS_created_at);
sp_IntArray_push(_t138, SPS_updated_at);
return _t138;
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 * _t139 = (&("\xff" "SELECT id, article_id, body, commenter, created_at, updated_at FROM comments")[1]);
SP_GC_ROOT(_t139);
const char * _t140 = (&("\xff" " WHERE ")[1]);
SP_GC_ROOT(_t140);
const char * _t141 = (&("\xff" "id = ")[1]);
SP_GC_ROOT(_t141);
const char * _t142 = sp_Db_cls_escape_int(sp_box_int(lv_id));
SP_GC_ROOT(_t142);
const char * _t143 = (&("\xff" " LIMIT 1")[1]);
SP_GC_ROOT(_t143);
lv_stmt = sp_Db_cls_prepare(sp_str_concat_arr((const char *const[]){_t139, _t140, _t141, _t142, _t143}, 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;
}
static sp_Comment * sp_Comment_cls_create(sp_StrIntHash * lv_attrs) {
SP_GC_SAVE();
sp_Comment * lv_instance = NULL;
SP_GC_ROOT(lv_instance);
lv_instance = sp_Comment_new(lv_attrs);
sp_ActiveRecord_Base_save((sp_ActiveRecord_Base *)lv_instance);
return lv_instance;
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 _t144 = self->iv_id;
SP_GC_RESTORE();
return _t144;
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 _t145 = self->iv_body;
SP_GC_RESTORE();
return _t145;
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 _t146 = 0;
sp_ArticleRow_id_eq(lv_instance, sp_box_int((((_t146), TRUE) ? _t146 : 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 _t147 = sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_id));
self->iv_id = sp_box_int((((_t147), TRUE) ? _t147 : 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 _t148 = sp_StrIntHash_get(lv_attrs, sp_sym_to_s(SPS_id));
self->iv_id = sp_box_int((((_t148), TRUE) ? _t148 : 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 _t149 = self->iv_id;
SP_GC_RESTORE();
return _t149;
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 _t150 = self->iv_body;
SP_GC_RESTORE();
return _t150;
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 _t151 = self->iv_created_at;
SP_GC_RESTORE();
return _t151;
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 _t152 = self->iv_title;
SP_GC_RESTORE();
return _t152;
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 _t153 = self->iv_updated_at;
SP_GC_RESTORE();
return _t153;
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 _t154 = lv_name;
if ((_t154.tag == SP_TAG_SYM && _t154.v.i == SPS_id)) {
sp_RbVal _t155 = self->iv_id;
SP_GC_RESTORE();
return _t155;
} else if ((_t154.tag == SP_TAG_SYM && _t154.v.i == SPS_body)) {
sp_RbVal _t156 = self->iv_body;
SP_GC_RESTORE();
return _t156;
} else if ((_t154.tag == SP_TAG_SYM && _t154.v.i == SPS_created_at)) {
sp_RbVal _t157 = self->iv_created_at;
SP_GC_RESTORE();
return _t157;
} else if ((_t154.tag == SP_TAG_SYM && _t154.v.i == SPS_title)) {
sp_RbVal _t158 = self->iv_title;
SP_GC_RESTORE();
return _t158;
} else if ((_t154.tag == SP_TAG_SYM && _t154.v.i == SPS_updated_at)) {
sp_RbVal _t159 = self->iv_updated_at;
SP_GC_RESTORE();
return _t159;
}
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 _t160 = lv_name;
if (_t160 == SPS_id) {
self->iv_id = lv_value;
return 0;
} else if (_t160 == SPS_body) {
self->iv_body = lv_value;
return 0;
} else if (_t160 == SPS_created_at) {
self->iv_created_at = lv_value;
return 0;
} else if (_t160 == SPS_title) {
self->iv_title = lv_value;
return 0;
} else if (_t160 == 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 _t161 = lv_p;
sp_RbVal _t162 = sp_box_nil();
if (_t161.tag == SP_TAG_OBJ) {
if (_t161.cls_id == 36) _t162 = sp_box_str(sp_ArticleRow_title((sp_ArticleRow *)_t161.v.p));
if (_t161.cls_id == 37) _t162 = sp_Article_title((sp_Article *)_t161.v.p);
if (_t161.cls_id == 38) _t162 = sp_ArticleParams_title((sp_ArticleParams *)_t161.v.p);
}
if (sp_poly_nil_p(_t162)) {
} else {
sp_RbVal _t163 = lv_p;
sp_RbVal _t164 = sp_box_nil();
if (_t163.tag == SP_TAG_OBJ) {
if (_t163.cls_id == 36) _t164 = sp_box_str(sp_ArticleRow_title((sp_ArticleRow *)_t163.v.p));
if (_t163.cls_id == 37) _t164 = sp_Article_title((sp_Article *)_t163.v.p);
if (_t163.cls_id == 38) _t164 = sp_ArticleParams_title((sp_ArticleParams *)_t163.v.p);
}
sp_Article_title_eq(self, _t164);
}
sp_RbVal _t165 = lv_p;
sp_RbVal _t166 = sp_box_nil();
if (_t165.tag == SP_TAG_OBJ) {
if (_t165.cls_id == 29) _t166 = ((sp_ActionController_Base *)_t165.v.p)->iv_body;
if (_t165.cls_id == 32) _t166 = ((sp_ApplicationController *)_t165.v.p)->iv_body;
if (_t165.cls_id == 34) _t166 = sp_CommentRow_body((sp_CommentRow *)_t165.v.p);
if (_t165.cls_id == 35) _t166 = sp_Comment_body((sp_Comment *)_t165.v.p);
if (_t165.cls_id == 36) _t166 = sp_ArticleRow_body((sp_ArticleRow *)_t165.v.p);
if (_t165.cls_id == 37) _t166 = sp_Article_body((sp_Article *)_t165.v.p);
if (_t165.cls_id == 38) _t166 = sp_ArticleParams_body((sp_ArticleParams *)_t165.v.p);
if (_t165.cls_id == 39) _t166 = ((sp_ArticlesController *)_t165.v.p)->iv_body;
if (_t165.cls_id == 40) _t166 = sp_CommentParams_body((sp_CommentParams *)_t165.v.p);
if (_t165.cls_id == 41) _t166 = ((sp_CommentsController *)_t165.v.p)->iv_body;
if (_t165.cls_id == 42) _t166 = ((sp_ActionResponse *)_t165.v.p)->iv_body;
}
if (sp_poly_nil_p(_t166)) {
} else {
sp_RbVal _t167 = lv_p;
sp_RbVal _t168 = sp_box_nil();
if (_t167.tag == SP_TAG_OBJ) {
if (_t167.cls_id == 29) _t168 = ((sp_ActionController_Base *)_t167.v.p)->iv_body;
if (_t167.cls_id == 32) _t168 = ((sp_ApplicationController *)_t167.v.p)->iv_body;
if (_t167.cls_id == 34) _t168 = sp_CommentRow_body((sp_CommentRow *)_t167.v.p);
if (_t167.cls_id == 35) _t168 = sp_Comment_body((sp_Comment *)_t167.v.p);
if (_t167.cls_id == 36) _t168 = sp_ArticleRow_body((sp_ArticleRow *)_t167.v.p);
if (_t167.cls_id == 37) _t168 = sp_Article_body((sp_Article *)_t167.v.p);
if (_t167.cls_id == 38) _t168 = sp_ArticleParams_body((sp_ArticleParams *)_t167.v.p);
if (_t167.cls_id == 39) _t168 = ((sp_ArticlesController *)_t167.v.p)->iv_body;
if (_t167.cls_id == 40) _t168 = sp_CommentParams_body((sp_CommentParams *)_t167.v.p);
if (_t167.cls_id == 41) _t168 = ((sp_CommentsController *)_t167.v.p)->iv_body;
if (_t167.cls_id == 42) _t168 = ((sp_ActionResponse *)_t167.v.p)->iv_body;
}
sp_Article_body_eq(self, _t168);
}
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 * _t169 = (&("\xff" "INSERT INTO articles (body, created_at, title, updated_at) VALUES (")[1]);
SP_GC_ROOT(_t169);
const char * _t170 = sp_Db_cls_escape_string(self->iv_body);
SP_GC_ROOT(_t170);
const char * _t171 = (&("\xff" ", ")[1]);
SP_GC_ROOT(_t171);
const char * _t172 = sp_Db_cls_escape_string(self->iv_created_at);
SP_GC_ROOT(_t172);
const char * _t173 = (&("\xff" ", ")[1]);
SP_GC_ROOT(_t173);
const char * _t174 = sp_Db_cls_escape_string(self->iv_title);
SP_GC_ROOT(_t174);
const char * _t175 = (&("\xff" ", ")[1]);
SP_GC_ROOT(_t175);
const char * _t176 = sp_Db_cls_escape_string(self->iv_updated_at);
SP_GC_ROOT(_t176);
const char * _t177 = (&("\xff" ")")[1]);
SP_GC_ROOT(_t177);
sp_Db_cls_exec(sp_str_concat_arr((const char *const[]){_t169, _t170, _t171, _t172, _t173, _t174, _t175, _t176, _t177}, 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 * _t178 = (&("\xff" "UPDATE articles SET ")[1]);
SP_GC_ROOT(_t178);
const char * _t179 = (&("\xff" "body = ")[1]);
SP_GC_ROOT(_t179);
const char * _t180 = sp_Db_cls_escape_string(self->iv_body);
SP_GC_ROOT(_t180);
const char * _t181 = (&("\xff" ", created_at = ")[1]);
SP_GC_ROOT(_t181);
const char * _t182 = sp_Db_cls_escape_string(self->iv_created_at);
SP_GC_ROOT(_t182);
const char * _t183 = (&("\xff" ", title = ")[1]);
SP_GC_ROOT(_t183);
const char * _t184 = sp_Db_cls_escape_string(self->iv_title);
SP_GC_ROOT(_t184);
const char * _t185 = (&("\xff" ", updated_at = ")[1]);
SP_GC_ROOT(_t185);
const char * _t186 = sp_Db_cls_escape_string(self->iv_updated_at);
SP_GC_ROOT(_t186);
const char * _t187 = (&("\xff" " WHERE ")[1]);
SP_GC_ROOT(_t187);
const char * _t188 = (&("\xff" "id = ")[1]);
SP_GC_ROOT(_t188);
const char * _t189 = sp_Db_cls_escape_int(self->iv_id);
SP_GC_ROOT(_t189);
return sp_Db_cls_exec(sp_str_concat_arr((const char *const[]){_t178, _t179, _t180, _t181, _t182, _t183, _t184, _t185, _t186, _t187, _t188, _t189}, 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 _t190 = sp_box_obj(lv_result, 37);
SP_GC_RESTORE();
return _t190;
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 _t191 = self->iv_title;
mrb_bool _t192 = FALSE;
if (_t191.tag == SP_TAG_STR) _t192 = (sp_str_length(_t191.v.s) == 0);
if (_t191.tag == SP_TAG_OBJ) {
if (_t191.cls_id == 26) _t192 = sp_ActionDispatch_Flash_empty_p((sp_ActionDispatch_Flash *)_t191.v.p);
if (_t191.cls_id == 27) _t192 = sp_ActionDispatch_Session_empty_p((sp_ActionDispatch_Session *)_t191.v.p);
if (_t191.cls_id == SP_BUILTIN_INT_ARRAY) _t192 = (sp_IntArray_length((sp_IntArray *)_t191.v.p) == 0);
if (_t191.cls_id == SP_BUILTIN_FLT_ARRAY) _t192 = (sp_FloatArray_length((sp_FloatArray *)_t191.v.p) == 0);
if (_t191.cls_id == SP_BUILTIN_STR_ARRAY) _t192 = (sp_StrArray_length((sp_StrArray *)_t191.v.p) == 0);
if (_t191.cls_id == SP_BUILTIN_SYM_ARRAY) _t192 = (sp_IntArray_length((sp_IntArray *)_t191.v.p) == 0);
if (_t191.cls_id == SP_BUILTIN_PTR_ARRAY) _t192 = (sp_PtrArray_length((sp_PtrArray *)_t191.v.p) == 0);
if (_t191.cls_id == SP_BUILTIN_POLY_ARRAY) _t192 = (sp_PolyArray_length((sp_PolyArray *)_t191.v.p) == 0);
if (_t191.cls_id == SP_BUILTIN_STR_INT_HASH) _t192 = (sp_StrIntHash_length((sp_StrIntHash *)_t191.v.p) == 0);
if (_t191.cls_id == SP_BUILTIN_STR_STR_HASH) _t192 = (sp_StrStrHash_length((sp_StrStrHash *)_t191.v.p) == 0);
if (_t191.cls_id == SP_BUILTIN_INT_STR_HASH) _t192 = (sp_IntStrHash_length((sp_IntStrHash *)_t191.v.p) == 0);
if (_t191.cls_id == SP_BUILTIN_STR_POLY_HASH) _t192 = (sp_StrPolyHash_length((sp_StrPolyHash *)_t191.v.p) == 0);
if (_t191.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t192 = (sp_SymPolyHash_length((sp_SymPolyHash *)_t191.v.p) == 0);
if (_t191.cls_id == SP_BUILTIN_POLY_POLY_HASH) _t192 = (sp_PolyPolyHash_length((sp_PolyPolyHash *)_t191.v.p) == 0);
}
if ((sp_poly_nil_p(self->iv_title) || _t192)) {
sp_StrArray * _t193 = sp_ActiveRecord_Base_errors((sp_ActiveRecord_Base *)self);
SP_GC_ROOT(_t193);
sp_StrArray_push(_t193, (&("\xff" "title can't be blank")[1]));
}
sp_RbVal _t194 = self->iv_body;
mrb_bool _t195 = FALSE;
if (_t194.tag == SP_TAG_STR) _t195 = (sp_str_length(_t194.v.s) == 0);
if (_t194.tag == SP_TAG_OBJ) {
if (_t194.cls_id == 26) _t195 = sp_ActionDispatch_Flash_empty_p((sp_ActionDispatch_Flash *)_t194.v.p);
if (_t194.cls_id == 27) _t195 = sp_ActionDispatch_Session_empty_p((sp_ActionDispatch_Session *)_t194.v.p);
if (_t194.cls_id == SP_BUILTIN_INT_ARRAY) _t195 = (sp_IntArray_length((sp_IntArray *)_t194.v.p) == 0);
if (_t194.cls_id == SP_BUILTIN_FLT_ARRAY) _t195 = (sp_FloatArray_length((sp_FloatArray *)_t194.v.p) == 0);
if (_t194.cls_id == SP_BUILTIN_STR_ARRAY) _t195 = (sp_StrArray_length((sp_StrArray *)_t194.v.p) == 0);
if (_t194.cls_id == SP_BUILTIN_SYM_ARRAY) _t195 = (sp_IntArray_length((sp_IntArray *)_t194.v.p) == 0);
if (_t194.cls_id == SP_BUILTIN_PTR_ARRAY) _t195 = (sp_PtrArray_length((sp_PtrArray *)_t194.v.p) == 0);
if (_t194.cls_id == SP_BUILTIN_POLY_ARRAY) _t195 = (sp_PolyArray_length((sp_PolyArray *)_t194.v.p) == 0);
if (_t194.cls_id == SP_BUILTIN_STR_INT_HASH) _t195 = (sp_StrIntHash_length((sp_StrIntHash *)_t194.v.p) == 0);
if (_t194.cls_id == SP_BUILTIN_STR_STR_HASH) _t195 = (sp_StrStrHash_length((sp_StrStrHash *)_t194.v.p) == 0);
if (_t194.cls_id == SP_BUILTIN_INT_STR_HASH) _t195 = (sp_IntStrHash_length((sp_IntStrHash *)_t194.v.p) == 0);
if (_t194.cls_id == SP_BUILTIN_STR_POLY_HASH) _t195 = (sp_StrPolyHash_length((sp_StrPolyHash *)_t194.v.p) == 0);
if (_t194.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t195 = (sp_SymPolyHash_length((sp_SymPolyHash *)_t194.v.p) == 0);
if (_t194.cls_id == SP_BUILTIN_POLY_POLY_HASH) _t195 = (sp_PolyPolyHash_length((sp_PolyPolyHash *)_t194.v.p) == 0);
}
if ((sp_poly_nil_p(self->iv_body) || _t195)) {
sp_StrArray * _t196 = sp_ActiveRecord_Base_errors((sp_ActiveRecord_Base *)self);
SP_GC_ROOT(_t196);
sp_StrArray_push(_t196, (&("\xff" "body can't be blank")[1]));
}
if ((!sp_poly_nil_p(self->iv_body))) {
sp_RbVal _t197 = self->iv_body;
mrb_int _t198 = 0;
if (_t197.tag == SP_TAG_STR) _t198 = sp_str_length(_t197.v.s);
if (_t197.tag == SP_TAG_OBJ) {
if (_t197.cls_id == 26) _t198 = sp_ActionDispatch_Flash_length((sp_ActionDispatch_Flash *)_t197.v.p);
if (_t197.cls_id == 27) _t198 = sp_ActionDispatch_Session_length((sp_ActionDispatch_Session *)_t197.v.p);
if (_t197.cls_id == SP_BUILTIN_INT_ARRAY) _t198 = sp_IntArray_length((sp_IntArray *)_t197.v.p);
if (_t197.cls_id == SP_BUILTIN_FLT_ARRAY) _t198 = sp_FloatArray_length((sp_FloatArray *)_t197.v.p);
if (_t197.cls_id == SP_BUILTIN_STR_ARRAY) _t198 = sp_StrArray_length((sp_StrArray *)_t197.v.p);
if (_t197.cls_id == SP_BUILTIN_SYM_ARRAY) _t198 = sp_IntArray_length((sp_IntArray *)_t197.v.p);
if (_t197.cls_id == SP_BUILTIN_PTR_ARRAY) _t198 = sp_PtrArray_length((sp_PtrArray *)_t197.v.p);
if (_t197.cls_id == SP_BUILTIN_POLY_ARRAY) _t198 = sp_PolyArray_length((sp_PolyArray *)_t197.v.p);
if (_t197.cls_id == SP_BUILTIN_STR_INT_HASH) _t198 = sp_StrIntHash_length((sp_StrIntHash *)_t197.v.p);
if (_t197.cls_id == SP_BUILTIN_STR_STR_HASH) _t198 = sp_StrStrHash_length((sp_StrStrHash *)_t197.v.p);
if (_t197.cls_id == SP_BUILTIN_INT_STR_HASH) _t198 = sp_IntStrHash_length((sp_IntStrHash *)_t197.v.p);
if (_t197.cls_id == SP_BUILTIN_STR_POLY_HASH) _t198 = sp_StrPolyHash_length((sp_StrPolyHash *)_t197.v.p);
if (_t197.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t198 = sp_SymPolyHash_length((sp_SymPolyHash *)_t197.v.p);
if (_t197.cls_id == SP_BUILTIN_POLY_POLY_HASH) _t198 = sp_PolyPolyHash_length((sp_PolyPolyHash *)_t197.v.p);
if (_t197.cls_id == SP_BUILTIN_INT_ARRAY) _t198 = sp_IntArray_length((sp_IntArray *)_t197.v.p);
if (_t197.cls_id == SP_BUILTIN_FLT_ARRAY) _t198 = sp_FloatArray_length((sp_FloatArray *)_t197.v.p);
if (_t197.cls_id == SP_BUILTIN_STR_ARRAY) _t198 = sp_StrArray_length((sp_StrArray *)_t197.v.p);
if (_t197.cls_id == SP_BUILTIN_SYM_ARRAY) _t198 = sp_IntArray_length((sp_IntArray *)_t197.v.p);
if (_t197.cls_id == SP_BUILTIN_PTR_ARRAY) _t198 = sp_PtrArray_length((sp_PtrArray *)_t197.v.p);
if (_t197.cls_id == SP_BUILTIN_POLY_ARRAY) _t198 = sp_PolyArray_length((sp_PolyArray *)_t197.v.p);
}
lv_len = _t198;
if ((lv_len < 10LL)) {
sp_StrArray * _t199 = sp_ActiveRecord_Base_errors((sp_ActiveRecord_Base *)self);
SP_GC_ROOT(_t199);
return (sp_StrArray_push(_t199, (&("\xff" "body is too short (minimum is 10)")[1])), _t199);
} 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 * _t200 = sp_Article_comments(self);
SP_GC_ROOT(_t200);
for (mrb_int _t201 = 0; _t201 < sp_PtrArray_length(_t200); _t201++) {
sp_Comment * _t202 = (sp_Comment *)sp_PtrArray_get(_t200, _t201);
lv_c = _t202;
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 *_t203 = sp_IntArray_new();
sp_IntArray_push(_t203, SPS_id);
sp_IntArray_push(_t203, SPS_body);
sp_IntArray_push(_t203, SPS_created_at);
sp_IntArray_push(_t203, SPS_title);
sp_IntArray_push(_t203, SPS_updated_at);
return _t203;
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 * _t204 = (&("\xff" "SELECT id, body, created_at, title, updated_at FROM articles")[1]);
SP_GC_ROOT(_t204);
const char * _t205 = (&("\xff" " WHERE ")[1]);
SP_GC_ROOT(_t205);
const char * _t206 = (&("\xff" "id = ")[1]);
SP_GC_ROOT(_t206);
const char * _t207 = sp_Db_cls_escape_int(sp_box_int(lv_id));
SP_GC_ROOT(_t207);
const char * _t208 = (&("\xff" " LIMIT 1")[1]);
SP_GC_ROOT(_t208);
lv_stmt = sp_Db_cls_prepare(sp_str_concat_arr((const char *const[]){_t204, _t205, _t206, _t207, _t208}, 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 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 * _t209 = (&("\xff" "SELECT 1 FROM articles")[1]);
SP_GC_ROOT(_t209);
const char * _t210 = (&("\xff" " WHERE ")[1]);
SP_GC_ROOT(_t210);
const char * _t211 = (&("\xff" "id = ")[1]);
SP_GC_ROOT(_t211);
const char * _t212 = sp_Db_cls_escape_int(lv_id);
SP_GC_ROOT(_t212);
const char * _t213 = (&("\xff" " LIMIT 1")[1]);
SP_GC_ROOT(_t213);
lv_stmt = sp_Db_cls_prepare(sp_str_concat_arr((const char *const[]){_t209, _t210, _t211, _t212, _t213}, 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_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_bool sp_Article_cls_exists_p(sp_RbVal lv_id) {
return sp_Article_cls__adapter_exists_by_id_p(lv_id);
return FALSE;
}
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 _t214 = self->iv_title;
SP_GC_RESTORE();
return _t214;
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 _t215 = self->iv_body;
SP_GC_RESTORE();
return _t215;
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 *_t216 = sp_StrPolyHash_new();
sp_StrPolyHash_set(_t216, (&("\xff" "title")[1]), self->iv_title);
sp_StrPolyHash_set(_t216, (&("\xff" "body")[1]), self->iv_body);
return _t216;
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 _t217 = lv_raw_sub;
lv_sub = ((_t217.tag == SP_TAG_OBJ && (_t217.cls_id == SP_BUILTIN_STR_INT_HASH || _t217.cls_id == SP_BUILTIN_STR_STR_HASH || _t217.cls_id == SP_BUILTIN_INT_STR_HASH || _t217.cls_id == SP_BUILTIN_SYM_INT_HASH || _t217.cls_id == SP_BUILTIN_SYM_STR_HASH || _t217.cls_id == SP_BUILTIN_STR_POLY_HASH || _t217.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 _t218 = lv_sub;
sp_RbVal _t219 = sp_box_nil();
if (_t218.tag == SP_TAG_OBJ) {
if (_t218.cls_id == SP_BUILTIN_STR_INT_HASH) _t219 = sp_StrIntHash_has_key((sp_StrIntHash *)_t218.v.p, (&("\xff" "title")[1])) ? sp_box_int(sp_StrIntHash_get((sp_StrIntHash *)_t218.v.p, (&("\xff" "title")[1]))) : sp_box_str((&("\xff" "")[1]));
if (_t218.cls_id == SP_BUILTIN_STR_STR_HASH) _t219 = sp_StrStrHash_has_key((sp_StrStrHash *)_t218.v.p, (&("\xff" "title")[1])) ? sp_box_str(sp_StrStrHash_get((sp_StrStrHash *)_t218.v.p, (&("\xff" "title")[1]))) : sp_box_str((&("\xff" "")[1]));
if (_t218.cls_id == SP_BUILTIN_STR_POLY_HASH) _t219 = sp_StrPolyHash_has_key((sp_StrPolyHash *)_t218.v.p, (&("\xff" "title")[1])) ? sp_StrPolyHash_get((sp_StrPolyHash *)_t218.v.p, (&("\xff" "title")[1])) : sp_box_str((&("\xff" "")[1]));
}
lv_raw_title = _t219;
sp_RbVal _t220 = lv_raw_title;
sp_ArticleParams_title_eq(lv_instance, ((_t220.tag == SP_TAG_STR) ? lv_raw_title : sp_box_str((&("\xff" "")[1]))));
sp_RbVal _t221 = lv_sub;
sp_RbVal _t222 = sp_box_nil();
if (_t221.tag == SP_TAG_OBJ) {
if (_t221.cls_id == SP_BUILTIN_STR_INT_HASH) _t222 = sp_StrIntHash_has_key((sp_StrIntHash *)_t221.v.p, (&("\xff" "body")[1])) ? sp_box_int(sp_StrIntHash_get((sp_StrIntHash *)_t221.v.p, (&("\xff" "body")[1]))) : sp_box_str((&("\xff" "")[1]));
if (_t221.cls_id == SP_BUILTIN_STR_STR_HASH) _t222 = sp_StrStrHash_has_key((sp_StrStrHash *)_t221.v.p, (&("\xff" "body")[1])) ? sp_box_str(sp_StrStrHash_get((sp_StrStrHash *)_t221.v.p, (&("\xff" "body")[1]))) : sp_box_str((&("\xff" "")[1]));
if (_t221.cls_id == SP_BUILTIN_STR_POLY_HASH) _t222 = sp_StrPolyHash_has_key((sp_StrPolyHash *)_t221.v.p, (&("\xff" "body")[1])) ? sp_StrPolyHash_get((sp_StrPolyHash *)_t221.v.p, (&("\xff" "body")[1])) : sp_box_str((&("\xff" "")[1]));
}
lv_raw_body = _t222;
sp_RbVal _t223 = lv_raw_body;
sp_ArticleParams_body_eq(lv_instance, ((_t223.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 _t224 = lv_action_name;
if (_t224 == SPS_index) {
return sp_ArticlesController_index(self);
} else if (_t224 == SPS_show) {
return sp_ArticlesController_show(self);
} else if (_t224 == SPS_new) {
return sp_ArticlesController_new_action(self);
} else if (_t224 == SPS_edit) {
return sp_ArticlesController_edit(self);
} else if (_t224 == SPS_create) {
return sp_ArticlesController_create(self);
} else if (_t224 == SPS_update) {
return sp_ArticlesController_update(self);
} else if (_t224 == 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_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);
self->iv_articles = lv_results;
if ((self->iv_request_format == SPS_json)) {
return sp_ActionController_Base_render((sp_ActionController_Base *)self, ({ sp_String *_t225 = sp_Views_Articles_cls_index_json(self->iv_articles); _t225 ? sp_box_str(_t225->data) : sp_box_nil(); }), SPS_ok, (&("\xff" "application/json")[1]), (&("\xff")[1]));
} else {
return sp_ActionController_Base_render((sp_ActionController_Base *)self, ({ sp_String *_t226 = 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))); _t226 ? sp_box_str(_t226->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 * _t227 = (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(_t227);
const char * _t228 = _t227;
SP_GC_ROOT(_t228);
self->iv_article = sp_Article_cls_find(((mrb_int)atoll(_t228)));
if ((self->iv_request_format == SPS_json)) {
return sp_ActionController_Base_render((sp_ActionController_Base *)self, ({ sp_String *_t229 = sp_Views_Articles_cls_show_json(self->iv_article); _t229 ? sp_box_str(_t229->data) : sp_box_nil(); }), SPS_ok, (&("\xff" "application/json")[1]), (&("\xff")[1]));
} else {
return sp_ActionController_Base_render((sp_ActionController_Base *)self, ({ sp_String *_t230 = 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))); _t230 ? sp_box_str(_t230->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 * _t231 = (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(_t231);
const char * _t232 = _t231;
SP_GC_ROOT(_t232);
self->iv_article = sp_Article_cls_find(((mrb_int)atoll(_t232)));
return sp_ActionController_Base_render((sp_ActionController_Base *)self, ({ sp_String *_t233 = 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))); _t233 ? sp_box_str(_t233->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 *_t234 = sp_Views_Articles_cls_show_json(self->iv_article); _t234 ? sp_box_str(_t234->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 * _t235 = (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(_t235);
const char * _t236 = _t235;
SP_GC_ROOT(_t236);
self->iv_article = sp_Article_cls_find(((mrb_int)atoll(_t236)));
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 *_t237 = sp_Views_Articles_cls_show_json(self->iv_article); _t237 ? sp_box_str(_t237->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 *_t238 = 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))); _t238 ? sp_box_str(_t238->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 * _t239 = (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(_t239);
const char * _t240 = _t239;
SP_GC_ROOT(_t240);
self->iv_article = sp_Article_cls_find(((mrb_int)atoll(_t240)));
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 _t241 = self->iv_commenter;
SP_GC_RESTORE();
return _t241;
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 _t242 = self->iv_body;
SP_GC_RESTORE();
return _t242;
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 *_t243 = sp_StrPolyHash_new();
sp_StrPolyHash_set(_t243, (&("\xff" "commenter")[1]), self->iv_commenter);
sp_StrPolyHash_set(_t243, (&("\xff" "body")[1]), self->iv_body);
return _t243;
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 _t244 = lv_raw_sub;
lv_sub = ((_t244.tag == SP_TAG_OBJ && (_t244.cls_id == SP_BUILTIN_STR_INT_HASH || _t244.cls_id == SP_BUILTIN_STR_STR_HASH || _t244.cls_id == SP_BUILTIN_INT_STR_HASH || _t244.cls_id == SP_BUILTIN_SYM_INT_HASH || _t244.cls_id == SP_BUILTIN_SYM_STR_HASH || _t244.cls_id == SP_BUILTIN_STR_POLY_HASH || _t244.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 _t245 = lv_sub;
sp_RbVal _t246 = sp_box_nil();
if (_t245.tag == SP_TAG_OBJ) {
if (_t245.cls_id == SP_BUILTIN_STR_INT_HASH) _t246 = sp_StrIntHash_has_key((sp_StrIntHash *)_t245.v.p, (&("\xff" "commenter")[1])) ? sp_box_int(sp_StrIntHash_get((sp_StrIntHash *)_t245.v.p, (&("\xff" "commenter")[1]))) : sp_box_str((&("\xff" "")[1]));
if (_t245.cls_id == SP_BUILTIN_STR_STR_HASH) _t246 = sp_StrStrHash_has_key((sp_StrStrHash *)_t245.v.p, (&("\xff" "commenter")[1])) ? sp_box_str(sp_StrStrHash_get((sp_StrStrHash *)_t245.v.p, (&("\xff" "commenter")[1]))) : sp_box_str((&("\xff" "")[1]));
if (_t245.cls_id == SP_BUILTIN_STR_POLY_HASH) _t246 = sp_StrPolyHash_has_key((sp_StrPolyHash *)_t245.v.p, (&("\xff" "commenter")[1])) ? sp_StrPolyHash_get((sp_StrPolyHash *)_t245.v.p, (&("\xff" "commenter")[1])) : sp_box_str((&("\xff" "")[1]));
}
lv_raw_commenter = _t246;
sp_RbVal _t247 = lv_raw_commenter;
sp_CommentParams_commenter_eq(lv_instance, ((_t247.tag == SP_TAG_STR) ? lv_raw_commenter : sp_box_str((&("\xff" "")[1]))));
sp_RbVal _t248 = lv_sub;
sp_RbVal _t249 = sp_box_nil();
if (_t248.tag == SP_TAG_OBJ) {
if (_t248.cls_id == SP_BUILTIN_STR_INT_HASH) _t249 = sp_StrIntHash_has_key((sp_StrIntHash *)_t248.v.p, (&("\xff" "body")[1])) ? sp_box_int(sp_StrIntHash_get((sp_StrIntHash *)_t248.v.p, (&("\xff" "body")[1]))) : sp_box_str((&("\xff" "")[1]));
if (_t248.cls_id == SP_BUILTIN_STR_STR_HASH) _t249 = sp_StrStrHash_has_key((sp_StrStrHash *)_t248.v.p, (&("\xff" "body")[1])) ? sp_box_str(sp_StrStrHash_get((sp_StrStrHash *)_t248.v.p, (&("\xff" "body")[1]))) : sp_box_str((&("\xff" "")[1]));
if (_t248.cls_id == SP_BUILTIN_STR_POLY_HASH) _t249 = sp_StrPolyHash_has_key((sp_StrPolyHash *)_t248.v.p, (&("\xff" "body")[1])) ? sp_StrPolyHash_get((sp_StrPolyHash *)_t248.v.p, (&("\xff" "body")[1])) : sp_box_str((&("\xff" "")[1]));
}
lv_raw_body = _t249;
sp_RbVal _t250 = lv_raw_body;
sp_CommentParams_body_eq(lv_instance, ((_t250.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 _t251 = lv_action_name;
if (_t251 == SPS_create) {
return sp_CommentsController_create(self);
} else if (_t251 == 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 * _t252 = (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(_t252);
const char * _t253 = _t252;
SP_GC_ROOT(_t253);
self->iv_article = sp_Article_cls_find(((mrb_int)atoll(_t253)));
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 * _t254 = (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(_t254);
const char * _t255 = _t254;
SP_GC_ROOT(_t255);
self->iv_article = sp_Article_cls_find(((mrb_int)atoll(_t255)));
const char * _t256 = (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(_t256);
const char * _t257 = _t256;
SP_GC_ROOT(_t257);
self->iv_comment = sp_Comment_cls_find(((mrb_int)atoll(_t257)));
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(CommentTest)
static inline sp_CommentTest *sp_CommentTest_new(void) {
SP_GC_SAVE();
sp_CommentTest *self = SP_POOL_NEW(CommentTest, NULL);
self->cls_id = 44LL;
SP_GC_ROOT(self);
sp_TestBase_initialize((sp_TestBase *)self);
SP_GC_RESTORE();
return self;
}
static inline mrb_int sp_CommentTest_test_creates_a_comment_on_an_article(sp_CommentTest *self) {
SP_GC_SAVE();
sp_Comment * lv_comment = NULL;
SP_GC_ROOT(lv_comment);
SP_GC_ROOT(self);
lv_comment = sp_CommentsFixtures_cls_one();
if (sp_poly_nil_p(lv_comment->iv_id)) {
sp_raise((&("\xff" "refute_nil failed")[1]));
}
sp_Article * _t258 = sp_ArticlesFixtures_cls_one();
SP_GC_ROOT(_t258);
if ((!sp_poly_eq(_t258->iv_id, lv_comment->iv_article_id))) {
sp_raise((&("\xff" "assert_equal failed")[1]));
return 0;
} else {
return 0;
}
return 0;
}
static inline mrb_int sp_CommentTest_test_belongs_to_article_association(sp_CommentTest *self) {
SP_GC_SAVE();
sp_Article * lv_article = NULL;
sp_Comment * lv_comment = NULL;
SP_GC_ROOT(lv_article);
SP_GC_ROOT(lv_comment);
SP_GC_ROOT(self);
lv_article = sp_ArticlesFixtures_cls_one();
lv_comment = sp_Comment_cls_create(sp_StrIntHash_new());
if ((!sp_poly_eq(lv_article->iv_id, lv_comment->iv_article_id))) {
sp_raise((&("\xff" "assert_equal failed")[1]));
return 0;
} else {
return 0;
}
return 0;
}
static inline mrb_int sp_CommentTest_test_requires_commenter(sp_CommentTest *self) {
SP_GC_SAVE();
sp_Article * lv_article = NULL;
sp_Comment * lv_comment = NULL;
SP_GC_ROOT(lv_article);
SP_GC_ROOT(lv_comment);
SP_GC_ROOT(self);
lv_article = sp_ArticlesFixtures_cls_one();
lv_comment = sp_Comment_new(0);
if (sp_ActiveRecord_Base_save((sp_ActiveRecord_Base *)lv_comment)) {
sp_raise((&("\xff" "refute failed")[1]));
return 0;
} else {
return 0;
}
return 0;
}
static inline mrb_int sp_CommentTest_test_requires_body(sp_CommentTest *self) {
SP_GC_SAVE();
sp_Article * lv_article = NULL;
sp_Comment * lv_comment = NULL;
SP_GC_ROOT(lv_article);
SP_GC_ROOT(lv_comment);
SP_GC_ROOT(self);
lv_article = sp_ArticlesFixtures_cls_one();
lv_comment = sp_Comment_new(0);
if (sp_ActiveRecord_Base_save((sp_ActiveRecord_Base *)lv_comment)) {
sp_raise((&("\xff" "refute failed")[1]));
return 0;
} else {
return 0;
}
return 0;
}
static inline mrb_int sp_CommentTest_test_requires_valid_article(sp_CommentTest *self) {
SP_GC_SAVE();
sp_Comment * lv_comment = NULL;
SP_GC_ROOT(lv_comment);
SP_GC_ROOT(self);
lv_comment = sp_Comment_new(0);
if (sp_ActiveRecord_Base_save((sp_ActiveRecord_Base *)lv_comment)) {
sp_raise((&("\xff" "refute failed")[1]));
return 0;
} else {
return 0;
}
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_CommentTest_new_dispatch_adapter(void) __attribute__((unused));
static sp_RbVal sp_CommentTest_new_dispatch_adapter(void){return sp_box_obj(sp_CommentTest_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_CommentTest_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_8: ;
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 * _t259 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), ((lv_b0 >> 2LL) & 63LL), 1);
SP_GC_ROOT(_t259);
const char * _t260 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), ((lv_b0 >> 2LL) & 63LL), 1);
SP_GC_ROOT(_t260);
lv_out = sp_str_concat(lv_out, _t260);
const char * _t261 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), (((lv_b0 << 4LL) | (lv_b1 >> 4LL)) & 63LL), 1);
SP_GC_ROOT(_t261);
const char * _t262 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), (((lv_b0 << 4LL) | (lv_b1 >> 4LL)) & 63LL), 1);
SP_GC_ROOT(_t262);
lv_out = sp_str_concat(lv_out, _t262);
const char * _t263 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), (((lv_b1 << 2LL) | (lv_b2 >> 6LL)) & 63LL), 1);
SP_GC_ROOT(_t263);
const char * _t264 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), (((lv_b1 << 2LL) | (lv_b2 >> 6LL)) & 63LL), 1);
SP_GC_ROOT(_t264);
lv_out = sp_str_concat(lv_out, _t264);
const char * _t265 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), (lv_b2 & 63LL), 1);
SP_GC_ROOT(_t265);
const char * _t266 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), (lv_b2 & 63LL), 1);
SP_GC_ROOT(_t266);
lv_out = sp_str_concat(lv_out, _t266);
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 * _t267 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), ((lv_b0 >> 2LL) & 63LL), 1);
SP_GC_ROOT(_t267);
const char * _t268 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), ((lv_b0 >> 2LL) & 63LL), 1);
SP_GC_ROOT(_t268);
lv_out = sp_str_concat(lv_out, _t268);
const char * _t269 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), ((lv_b0 << 4LL) & 63LL), 1);
SP_GC_ROOT(_t269);
const char * _t270 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), ((lv_b0 << 4LL) & 63LL), 1);
SP_GC_ROOT(_t270);
lv_out = sp_str_concat(lv_out, _t270);
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 * _t271 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), ((lv_b0 >> 2LL) & 63LL), 1);
SP_GC_ROOT(_t271);
const char * _t272 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), ((lv_b0 >> 2LL) & 63LL), 1);
SP_GC_ROOT(_t272);
lv_out = sp_str_concat(lv_out, _t272);
const char * _t273 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), (((lv_b0 << 4LL) | (lv_b1 >> 4LL)) & 63LL), 1);
SP_GC_ROOT(_t273);
const char * _t274 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), (((lv_b0 << 4LL) | (lv_b1 >> 4LL)) & 63LL), 1);
SP_GC_ROOT(_t274);
lv_out = sp_str_concat(lv_out, _t274);
const char * _t275 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), ((lv_b1 << 2LL) & 63LL), 1);
SP_GC_ROOT(_t275);
const char * _t276 = sp_str_sub_range((&("\xff" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")[1]), ((lv_b1 << 2LL) & 63LL), 1);
SP_GC_ROOT(_t276);
lv_out = sp_str_concat(lv_out, _t276);
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_9: ;
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 * _t277 = (&("\xff" "Db.configure: sqlite3_open(")[1]);
SP_GC_ROOT(_t277);
const char * _t278 = lv_path;
SP_GC_ROOT(_t278);
const char * _t279 = (&("\xff" ") failed (")[1]);
SP_GC_ROOT(_t279);
const char * _t280 = sp_int_to_s(lv_rc);
SP_GC_ROOT(_t280);
const char * _t281 = (&("\xff" ")")[1]);
SP_GC_ROOT(_t281);
sp_raise(sp_str_concat_arr((const char *const[]){_t277, _t278, _t279, _t280, _t281}, 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 * _t282 = (&("\xff" "Db.exec failed (")[1]);
SP_GC_ROOT(_t282);
const char * _t283 = sp_int_to_s(lv_rc);
SP_GC_ROOT(_t283);
const char * _t284 = (&("\xff" "): ")[1]);
SP_GC_ROOT(_t284);
const char * _t285 = sqlite3_errmsg(((void *)cst_Db_db));
SP_GC_ROOT(_t285);
const char * _t286 = (&("\xff" " — sql: ")[1]);
SP_GC_ROOT(_t286);
const char * _t287 = lv_sql;
SP_GC_ROOT(_t287);
sp_raise(sp_str_concat_arr((const char *const[]){_t282, _t283, _t284, _t285, _t286, _t287}, 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 * _t288 = (&("\xff" "Db.prepare failed (")[1]);
SP_GC_ROOT(_t288);
const char * _t289 = sp_int_to_s(lv_rc);
SP_GC_ROOT(_t289);
const char * _t290 = (&("\xff" "): ")[1]);
SP_GC_ROOT(_t290);
const char * _t291 = sqlite3_errmsg(((void *)cst_Db_db));
SP_GC_ROOT(_t291);
const char * _t292 = (&("\xff" " — sql: ")[1]);
SP_GC_ROOT(_t292);
const char * _t293 = lv_sql;
SP_GC_ROOT(_t293);
sp_raise(sp_str_concat_arr((const char *const[]){_t288, _t289, _t290, _t291, _t292, _t293}, 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 * _t294 = sp_poly_to_s(lv_s);
SP_GC_ROOT(_t294);
return sp_str_concat3((&("\xff" "'")[1]), sp_str_gsub(_t294, (&("\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 _t296 = lv_n;
mrb_int _t295 = (_t296.tag == SP_TAG_INT) ? _t296.v.i : 0;
return sp_int_to_s(_t295);
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 *_t297 = sp_StrArray_new();
sp_StrArray_push(_t297, (&("\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(_t297, (&("\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(_t297, (&("\xff" "CREATE INDEX IF NOT EXISTS index_comments_on_article_id ON comments (article_id)")[1]));
return _t297;
return NULL;
}
static sp_ActionDispatch_Router_MatchResult * sp_ActionDispatch_Router_cls_match(const char * lv_method, mrb_int 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_table);
const char * _t298 = lv_method;
SP_GC_ROOT(_t298);
lv_method_upcase = sp_str_upcase(_t298);
lv_i = 0LL;
mrb_int _t299 = sp_PtrArray_length(lv_table);
while ((lv_i < _t299)) {
sp_redo_10: ;
lv_route = ((sp_ActionDispatch_Router_Route *)sp_PtrArray_get(lv_table, lv_i));
const char * _t300 = lv_route->iv_verb;
SP_GC_ROOT(_t300);
if (sp_str_eq(_t300, lv_method_upcase)) {
const char * _t301 = lv_route->iv_pattern;
SP_GC_ROOT(_t301);
lv_params = sp_ActionDispatch_Router_cls_match_pattern(_t301, sp_int_to_s(lv_path));
if (!((lv_params == NULL))) {
sp_ActionDispatch_Router_MatchResult * _t302 = sp_ActionDispatch_Router_MatchResult_new(lv_route->iv_controller, lv_route->iv_action, lv_params);
SP_GC_RESTORE();
return _t302;
}
}
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 _t303 = sp_StrArray_length(lv_pattern_parts);
while ((lv_i < _t303)) {
sp_redo_11: ;
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 _t304 = (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 _t304;
return sp_box_nil();
}
static inline sp_RbVal sp_ActionView_ViewHelpers_cls_get_slot(sp_sym lv_slot) {
SP_GC_SAVE();
sp_RbVal _t305 = sp_SymPolyHash_get((sp_SymPolyHash *)(cst_ActionView_ViewHelpers_slots), lv_slot);
sp_RbVal _t306 = (sp_poly_truthy(_t305) ? _t305 : sp_box_str((&("\xff" "")[1])));
SP_GC_RESTORE();
return _t306;
return sp_box_nil();
}
static inline sp_RbVal sp_ActionView_ViewHelpers_cls_get_yield(void) {
SP_GC_SAVE();
sp_RbVal _t307 = sp_SymPolyHash_get((sp_SymPolyHash *)(cst_ActionView_ViewHelpers_slots), SPS___body__);
sp_RbVal _t308 = (sp_poly_truthy(_t307) ? _t307 : sp_box_str((&("\xff" "")[1])));
SP_GC_RESTORE();
return _t308;
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 _t309 = lv_s;
const char * _t310 = (&("\xff")[1]);
if (_t309.tag == SP_TAG_STR) _t310 = sp_re_gsub_str_str_hash(sp_re_pat_0, _t309.v.s, cst_ActionView_ViewHelpers_HTML_ESCAPES);
if (_t309.tag == SP_TAG_OBJ) {
}
return _t310;
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 _t311 = lv_s;
mrb_int _t312 = 0;
if (_t311.tag == SP_TAG_STR) _t312 = sp_str_length(_t311.v.s);
if (_t311.tag == SP_TAG_OBJ) {
if (_t311.cls_id == 26) _t312 = sp_ActionDispatch_Flash_length((sp_ActionDispatch_Flash *)_t311.v.p);
if (_t311.cls_id == 27) _t312 = sp_ActionDispatch_Session_length((sp_ActionDispatch_Session *)_t311.v.p);
if (_t311.cls_id == SP_BUILTIN_INT_ARRAY) _t312 = sp_IntArray_length((sp_IntArray *)_t311.v.p);
if (_t311.cls_id == SP_BUILTIN_FLT_ARRAY) _t312 = sp_FloatArray_length((sp_FloatArray *)_t311.v.p);
if (_t311.cls_id == SP_BUILTIN_STR_ARRAY) _t312 = sp_StrArray_length((sp_StrArray *)_t311.v.p);
if (_t311.cls_id == SP_BUILTIN_SYM_ARRAY) _t312 = sp_IntArray_length((sp_IntArray *)_t311.v.p);
if (_t311.cls_id == SP_BUILTIN_PTR_ARRAY) _t312 = sp_PtrArray_length((sp_PtrArray *)_t311.v.p);
if (_t311.cls_id == SP_BUILTIN_POLY_ARRAY) _t312 = sp_PolyArray_length((sp_PolyArray *)_t311.v.p);
if (_t311.cls_id == SP_BUILTIN_STR_INT_HASH) _t312 = sp_StrIntHash_length((sp_StrIntHash *)_t311.v.p);
if (_t311.cls_id == SP_BUILTIN_STR_STR_HASH) _t312 = sp_StrStrHash_length((sp_StrStrHash *)_t311.v.p);
if (_t311.cls_id == SP_BUILTIN_INT_STR_HASH) _t312 = sp_IntStrHash_length((sp_IntStrHash *)_t311.v.p);
if (_t311.cls_id == SP_BUILTIN_STR_POLY_HASH) _t312 = sp_StrPolyHash_length((sp_StrPolyHash *)_t311.v.p);
if (_t311.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t312 = sp_SymPolyHash_length((sp_SymPolyHash *)_t311.v.p);
if (_t311.cls_id == SP_BUILTIN_POLY_POLY_HASH) _t312 = sp_PolyPolyHash_length((sp_PolyPolyHash *)_t311.v.p);
if (_t311.cls_id == SP_BUILTIN_INT_ARRAY) _t312 = sp_IntArray_length((sp_IntArray *)_t311.v.p);
if (_t311.cls_id == SP_BUILTIN_FLT_ARRAY) _t312 = sp_FloatArray_length((sp_FloatArray *)_t311.v.p);
if (_t311.cls_id == SP_BUILTIN_STR_ARRAY) _t312 = sp_StrArray_length((sp_StrArray *)_t311.v.p);
if (_t311.cls_id == SP_BUILTIN_SYM_ARRAY) _t312 = sp_IntArray_length((sp_IntArray *)_t311.v.p);
if (_t311.cls_id == SP_BUILTIN_PTR_ARRAY) _t312 = sp_PtrArray_length((sp_PtrArray *)_t311.v.p);
if (_t311.cls_id == SP_BUILTIN_POLY_ARRAY) _t312 = sp_PolyArray_length((sp_PolyArray *)_t311.v.p);
}
if ((_t312 <= lv_length)) {
sp_RbVal _t313 = lv_s;
SP_GC_RESTORE();
return _t313;
}
lv_cutoff = (lv_length - sp_str_length(lv_omission));
if ((lv_cutoff < 0LL)) {
lv_cutoff = 0LL;
}
sp_RbVal _t314 = lv_s;
sp_RbVal _t315 = sp_box_nil();
if (_t314.tag == SP_TAG_INT) _t315 = sp_box_int(((_t314.v.i >> (0LL)) & 1));
if (_t314.tag == SP_TAG_OBJ) {
if (_t314.cls_id == 23) _t315 = sp_ActiveRecord_Base__aref((sp_ActiveRecord_Base *)_t314.v.p, sp_box_int(0LL));
if (_t314.cls_id == 26) _t315 = sp_ActionDispatch_Flash__aref((sp_ActionDispatch_Flash *)_t314.v.p, sp_box_int(0LL));
if (_t314.cls_id == 27) _t315 = sp_box_int(sp_ActionDispatch_Session__aref((sp_ActionDispatch_Session *)_t314.v.p, sp_box_int(0LL)));
if (_t314.cls_id == 33) _t315 = sp_ActiveRecord_Base__aref((sp_ActiveRecord_Base *)_t314.v.p, sp_box_int(0LL));
if (_t314.cls_id == 35) _t315 = sp_Comment__aref((sp_Comment *)_t314.v.p, sp_box_int(0LL));
if (_t314.cls_id == 37) _t315 = sp_Article__aref((sp_Article *)_t314.v.p, sp_box_int(0LL));
if (_t314.cls_id == SP_BUILTIN_INT_ARRAY) _t315 = sp_box_int(sp_IntArray_get((sp_IntArray *)_t314.v.p, 0LL));
if (_t314.cls_id == SP_BUILTIN_FLT_ARRAY) _t315 = sp_box_float(sp_FloatArray_get((sp_FloatArray *)_t314.v.p, 0LL));
if (_t314.cls_id == SP_BUILTIN_STR_ARRAY) _t315 = sp_box_str(sp_StrArray_get((sp_StrArray *)_t314.v.p, 0LL));
if (_t314.cls_id == SP_BUILTIN_SYM_ARRAY) _t315 = sp_box_sym((sp_sym)sp_IntArray_get((sp_IntArray *)_t314.v.p, 0LL));
if (_t314.cls_id == SP_BUILTIN_PTR_ARRAY) { void *_pe = sp_PtrArray_get((sp_PtrArray *)_t314.v.p, 0LL); _t315 = sp_box_obj(_pe, sp_obj_cls_id_of(_pe)); }
if (_t314.cls_id == SP_BUILTIN_POLY_ARRAY) _t315 = sp_PolyArray_get((sp_PolyArray *)_t314.v.p, 0LL);
if (_t314.cls_id == 45) _t315 = sp_box_int((((sp_Method *)_t314.v.p) && ((sp_Method *)_t314.v.p)->iv_fn_ptr ? ((mrb_int (*)(void *, mrb_int, mrb_int))(uintptr_t)((sp_Method *)_t314.v.p)->iv_fn_ptr)((void *)((sp_Method *)_t314.v.p)->iv_self_obj, 0LL, lv_cutoff) : 0));
}
sp_RbVal _t316 = sp_box_str(sp_sprintf("%s%s", sp_poly_to_s(_t315), lv_omission));
SP_GC_RESTORE();
return _t316;
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 _t317 = lv_record;
const char * _t318 = (&("\xff")[1]);
if (_t317.tag == SP_TAG_OBJ) {
if (_t317.cls_id == 23) _t318 = sp_ActiveRecord_Base_dom_prefix((sp_ActiveRecord_Base *)_t317.v.p);
if (_t317.cls_id == 33) _t318 = sp_ActiveRecord_Base_dom_prefix((sp_ActiveRecord_Base *)_t317.v.p);
if (_t317.cls_id == 35) _t318 = sp_Comment_dom_prefix((sp_Comment *)_t317.v.p);
if (_t317.cls_id == 37) _t318 = sp_Article_dom_prefix((sp_Article *)_t317.v.p);
}
sp_RbVal _t319 = lv_record;
sp_RbVal _t320 = sp_box_nil();
if (_t319.tag == SP_TAG_OBJ) {
if (_t319.cls_id == 23) _t320 = ((sp_ActiveRecord_Base *)_t319.v.p)->iv_id;
if (_t319.cls_id == 33) _t320 = ((sp_ApplicationRecord *)_t319.v.p)->iv_id;
if (_t319.cls_id == 34) _t320 = sp_CommentRow_id((sp_CommentRow *)_t319.v.p);
if (_t319.cls_id == 35) _t320 = sp_Comment_id((sp_Comment *)_t319.v.p);
if (_t319.cls_id == 36) _t320 = sp_ArticleRow_id((sp_ArticleRow *)_t319.v.p);
if (_t319.cls_id == 37) _t320 = sp_Article_id((sp_Article *)_t319.v.p);
}
return sp_sprintf("%s_%s", _t318, sp_poly_to_s(_t320));
} else {
sp_RbVal _t321 = lv_record;
const char * _t322 = (&("\xff")[1]);
if (_t321.tag == SP_TAG_OBJ) {
if (_t321.cls_id == 23) _t322 = sp_ActiveRecord_Base_dom_prefix((sp_ActiveRecord_Base *)_t321.v.p);
if (_t321.cls_id == 33) _t322 = sp_ActiveRecord_Base_dom_prefix((sp_ActiveRecord_Base *)_t321.v.p);
if (_t321.cls_id == 35) _t322 = sp_Comment_dom_prefix((sp_Comment *)_t321.v.p);
if (_t321.cls_id == 37) _t322 = sp_Article_dom_prefix((sp_Article *)_t321.v.p);
}
sp_RbVal _t323 = lv_record;
sp_RbVal _t324 = sp_box_nil();
if (_t323.tag == SP_TAG_OBJ) {
if (_t323.cls_id == 23) _t324 = ((sp_ActiveRecord_Base *)_t323.v.p)->iv_id;
if (_t323.cls_id == 33) _t324 = ((sp_ApplicationRecord *)_t323.v.p)->iv_id;
if (_t323.cls_id == 34) _t324 = sp_CommentRow_id((sp_CommentRow *)_t323.v.p);
if (_t323.cls_id == 35) _t324 = sp_Comment_id((sp_Comment *)_t323.v.p);
if (_t323.cls_id == 36) _t324 = sp_ArticleRow_id((sp_ArticleRow *)_t323.v.p);
if (_t323.cls_id == 37) _t324 = sp_Article_id((sp_Article *)_t323.v.p);
}
return sp_sprintf("%lld_%s_%s", (long long)lv_suffix, _t322, sp_poly_to_s(_t324));
}
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 *_t325 = sp_SymStrHash_new();
sp_SymStrHash_set(_t325, SPS_href, lv_href);
sp_SymStrHash * _t326 = _t325;
SP_GC_ROOT(_t326);
lv_attrs = sp_ActionView_ViewHelpers_cls_render_attrs(sp_box_obj((void *)(sp_SymStrHash_merge(_t326, 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 * _t327 = lv_opts;
SP_GC_ROOT(_t327);
lv_inner_opts = sp_SymPolyHash_dup(_t327);
(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 *_t328 = sp_SymStrHash_new();
sp_SymStrHash_set(_t328, SPS_action, lv_href);
sp_SymStrHash_set(_t328, SPS_method, (&("\xff" "post")[1]));
lv_form_attrs = _t328;
sp_RbVal _t329 = lv_form_class;
sp_SymStrHash_set(lv_form_attrs, SPS_class, sp_poly_to_s((sp_poly_truthy(_t329) ? _t329 : sp_box_str((&("\xff" "button_to")[1])))));
sp_SymStrHash *_t330 = sp_SymStrHash_new();
sp_SymStrHash_set(_t330, 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(_t330), 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 *_t331 = sp_SymStrHash_new();
sp_SymStrHash_set(_t331, SPS_rel, (&("\xff" "stylesheet")[1]));
sp_SymStrHash_set(_t331, SPS_href, lv_href);
sp_SymStrHash * _t332 = _t331;
SP_GC_ROOT(_t332);
lv_attrs = sp_ActionView_ViewHelpers_cls_render_attrs(sp_box_obj((void *)(sp_SymStrHash_merge(_t332, 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 * _t333 = (&("\xff" "<script type=\"importmap\" data-turbo-track=\"reload\">")[1]);
SP_GC_ROOT(_t333);
const char * _t334 = lv_json;
SP_GC_ROOT(_t334);
const char * _t335 = (&("\xff" "</script>")[1]);
SP_GC_ROOT(_t335);
const char * _t336 = (&("\xff" "\n")[1]);
SP_GC_ROOT(_t336);
const char * _t337 = (&("\xff" "<link rel=\"modulepreload\" href=\"/assets/turbo.min.js\">")[1]);
SP_GC_ROOT(_t337);
const char * _t338 = (&("\xff" "\n")[1]);
SP_GC_ROOT(_t338);
const char * _t339 = (&("\xff" "<script type=\"module\">import \"@hotwired/turbo\"</script>")[1]);
SP_GC_ROOT(_t339);
const char * _t340 = sp_str_concat_arr((const char *const[]){_t333, _t334, _t335, _t336, _t337, _t338, _t339}, 7);
SP_GC_RESTORE();
return _t340;
}
SP_GC_ROOT(lv_pins);
sp_StrArray *_t341 = sp_StrArray_new();
SP_GC_ROOT(_t341);
for (mrb_int _t342 = 0; _t342 < sp_PolyArray_length(lv_pins); _t342++) {
sp_RbVal lv_p = sp_PolyArray_get(lv_pins, _t342);
sp_RbVal _t343 = lv_p;
sp_RbVal _t344 = sp_box_nil();
if (_t343.tag == SP_TAG_OBJ) {
if (_t343.cls_id == 23) _t344 = sp_ActiveRecord_Base__aref((sp_ActiveRecord_Base *)_t343.v.p, sp_box_sym(SPS_name));
if (_t343.cls_id == 26) _t344 = sp_ActionDispatch_Flash__aref((sp_ActionDispatch_Flash *)_t343.v.p, sp_box_sym(SPS_name));
if (_t343.cls_id == 27) _t344 = sp_box_int(sp_ActionDispatch_Session__aref((sp_ActionDispatch_Session *)_t343.v.p, sp_box_sym(SPS_name)));
if (_t343.cls_id == 33) _t344 = sp_ActiveRecord_Base__aref((sp_ActiveRecord_Base *)_t343.v.p, sp_box_sym(SPS_name));
if (_t343.cls_id == 35) _t344 = sp_Comment__aref((sp_Comment *)_t343.v.p, sp_box_sym(SPS_name));
if (_t343.cls_id == 37) _t344 = sp_Article__aref((sp_Article *)_t343.v.p, sp_box_sym(SPS_name));
if (_t343.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t344 = sp_SymPolyHash_get((sp_SymPolyHash *)_t343.v.p, SPS_name);
if (_t343.cls_id == SP_BUILTIN_SYM_INT_HASH) _t344 = sp_box_int(sp_SymIntHash_get((sp_SymIntHash *)_t343.v.p, SPS_name));
if (_t343.cls_id == SP_BUILTIN_SYM_STR_HASH) _t344 = sp_box_str(sp_SymStrHash_get((sp_SymStrHash *)_t343.v.p, SPS_name));
}
sp_RbVal _t345 = lv_p;
sp_RbVal _t346 = sp_box_nil();
if (_t345.tag == SP_TAG_OBJ) {
if (_t345.cls_id == 23) _t346 = sp_ActiveRecord_Base__aref((sp_ActiveRecord_Base *)_t345.v.p, sp_box_sym(SPS_path));
if (_t345.cls_id == 26) _t346 = sp_ActionDispatch_Flash__aref((sp_ActionDispatch_Flash *)_t345.v.p, sp_box_sym(SPS_path));
if (_t345.cls_id == 27) _t346 = sp_box_int(sp_ActionDispatch_Session__aref((sp_ActionDispatch_Session *)_t345.v.p, sp_box_sym(SPS_path)));
if (_t345.cls_id == 33) _t346 = sp_ActiveRecord_Base__aref((sp_ActiveRecord_Base *)_t345.v.p, sp_box_sym(SPS_path));
if (_t345.cls_id == 35) _t346 = sp_Comment__aref((sp_Comment *)_t345.v.p, sp_box_sym(SPS_path));
if (_t345.cls_id == 37) _t346 = sp_Article__aref((sp_Article *)_t345.v.p, sp_box_sym(SPS_path));
if (_t345.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t346 = sp_SymPolyHash_get((sp_SymPolyHash *)_t345.v.p, SPS_path);
if (_t345.cls_id == SP_BUILTIN_SYM_INT_HASH) _t346 = sp_box_int(sp_SymIntHash_get((sp_SymIntHash *)_t345.v.p, SPS_path));
if (_t345.cls_id == SP_BUILTIN_SYM_STR_HASH) _t346 = sp_box_str(sp_SymStrHash_get((sp_SymStrHash *)_t345.v.p, SPS_path));
}
sp_StrArray_push(_t341, sp_sprintf(" \"%s\": \"%s\"", sp_poly_to_s(_t344), sp_poly_to_s(_t346)));
}
sp_StrArray * _t347 = _t341;
SP_GC_ROOT(_t347);
lv_import_lines = sp_StrArray_join(_t347, (&("\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 _t348 = 0; _t348 < sp_PolyArray_length(lv_pins); _t348++) {
lv_p = sp_PolyArray_get(lv_pins, _t348);
sp_redo_12: ;
sp_RbVal _t349 = lv_p;
sp_RbVal _t350 = sp_box_nil();
if (_t349.tag == SP_TAG_OBJ) {
if (_t349.cls_id == 23) _t350 = sp_ActiveRecord_Base__aref((sp_ActiveRecord_Base *)_t349.v.p, sp_box_sym(SPS_path));
if (_t349.cls_id == 26) _t350 = sp_ActionDispatch_Flash__aref((sp_ActionDispatch_Flash *)_t349.v.p, sp_box_sym(SPS_path));
if (_t349.cls_id == 27) _t350 = sp_box_int(sp_ActionDispatch_Session__aref((sp_ActionDispatch_Session *)_t349.v.p, sp_box_sym(SPS_path)));
if (_t349.cls_id == 33) _t350 = sp_ActiveRecord_Base__aref((sp_ActiveRecord_Base *)_t349.v.p, sp_box_sym(SPS_path));
if (_t349.cls_id == 35) _t350 = sp_Comment__aref((sp_Comment *)_t349.v.p, sp_box_sym(SPS_path));
if (_t349.cls_id == 37) _t350 = sp_Article__aref((sp_Article *)_t349.v.p, sp_box_sym(SPS_path));
if (_t349.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t350 = sp_SymPolyHash_get((sp_SymPolyHash *)_t349.v.p, SPS_path);
if (_t349.cls_id == SP_BUILTIN_SYM_INT_HASH) _t350 = sp_box_int(sp_SymIntHash_get((sp_SymIntHash *)_t349.v.p, SPS_path));
if (_t349.cls_id == SP_BUILTIN_SYM_STR_HASH) _t350 = sp_box_str(sp_SymStrHash_get((sp_SymStrHash *)_t349.v.p, SPS_path));
}
sp_StrArray_push(lv_parts, sp_sprintf("<link rel=\"modulepreload\" href=\"%s\">", sp_poly_to_s(_t350)));
}
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 *_t351 = sp_SymStrHash_new();
sp_SymStrHash_set(_t351, SPS_action, lv_action);
sp_SymStrHash_set(_t351, ((sp_sym)51), (&("\xff" "UTF-8")[1]));
sp_SymStrHash_set(_t351, SPS_method, lv_form_method);
sp_SymStrHash * _t352 = _t351;
SP_GC_ROOT(_t352);
lv_attrs = sp_ActionView_ViewHelpers_cls_render_attrs(sp_box_obj((void *)(sp_SymStrHash_merge(_t352, 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 _t353 = lv_attrs;
mrb_bool _t354 = FALSE;
if (_t353.tag == SP_TAG_STR) _t354 = (sp_str_length(_t353.v.s) == 0);
if (_t353.tag == SP_TAG_OBJ) {
if (_t353.cls_id == 26) _t354 = sp_ActionDispatch_Flash_empty_p((sp_ActionDispatch_Flash *)_t353.v.p);
if (_t353.cls_id == 27) _t354 = sp_ActionDispatch_Session_empty_p((sp_ActionDispatch_Session *)_t353.v.p);
if (_t353.cls_id == SP_BUILTIN_INT_ARRAY) _t354 = (sp_IntArray_length((sp_IntArray *)_t353.v.p) == 0);
if (_t353.cls_id == SP_BUILTIN_FLT_ARRAY) _t354 = (sp_FloatArray_length((sp_FloatArray *)_t353.v.p) == 0);
if (_t353.cls_id == SP_BUILTIN_STR_ARRAY) _t354 = (sp_StrArray_length((sp_StrArray *)_t353.v.p) == 0);
if (_t353.cls_id == SP_BUILTIN_SYM_ARRAY) _t354 = (sp_IntArray_length((sp_IntArray *)_t353.v.p) == 0);
if (_t353.cls_id == SP_BUILTIN_PTR_ARRAY) _t354 = (sp_PtrArray_length((sp_PtrArray *)_t353.v.p) == 0);
if (_t353.cls_id == SP_BUILTIN_POLY_ARRAY) _t354 = (sp_PolyArray_length((sp_PolyArray *)_t353.v.p) == 0);
if (_t353.cls_id == SP_BUILTIN_STR_INT_HASH) _t354 = (sp_StrIntHash_length((sp_StrIntHash *)_t353.v.p) == 0);
if (_t353.cls_id == SP_BUILTIN_STR_STR_HASH) _t354 = (sp_StrStrHash_length((sp_StrStrHash *)_t353.v.p) == 0);
if (_t353.cls_id == SP_BUILTIN_INT_STR_HASH) _t354 = (sp_IntStrHash_length((sp_IntStrHash *)_t353.v.p) == 0);
if (_t353.cls_id == SP_BUILTIN_STR_POLY_HASH) _t354 = (sp_StrPolyHash_length((sp_StrPolyHash *)_t353.v.p) == 0);
if (_t353.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t354 = (sp_SymPolyHash_length((sp_SymPolyHash *)_t353.v.p) == 0);
if (_t353.cls_id == SP_BUILTIN_POLY_POLY_HASH) _t354 = (sp_PolyPolyHash_length((sp_PolyPolyHash *)_t353.v.p) == 0);
}
if (_t354) {
const char * _t355 = (&("\xff" "")[1]);
SP_GC_RESTORE();
return _t355;
}
lv_pairs = sp_StrArray_new();
sp_RbVal _t356 = lv_attrs;
if (_t356.tag == SP_TAG_OBJ) {
mrb_int _t357_len = 0;
if (_t356.cls_id == SP_BUILTIN_RANGE) _t357_len = ((sp_Range *)_t356.v.p)->last - ((sp_Range *)_t356.v.p)->first + 1;
else if (_t356.cls_id == SP_BUILTIN_INT_ARRAY) _t357_len = sp_IntArray_length((sp_IntArray *)_t356.v.p);
else if (_t356.cls_id == SP_BUILTIN_FLT_ARRAY) _t357_len = sp_FloatArray_length((sp_FloatArray *)_t356.v.p);
else if (_t356.cls_id == SP_BUILTIN_STR_ARRAY) _t357_len = sp_StrArray_length((sp_StrArray *)_t356.v.p);
else if (_t356.cls_id == SP_BUILTIN_SYM_ARRAY) _t357_len = sp_IntArray_length((sp_IntArray *)_t356.v.p);
else if (_t356.cls_id == SP_BUILTIN_PTR_ARRAY) _t357_len = sp_PtrArray_length((sp_PtrArray *)_t356.v.p);
else if (_t356.cls_id == SP_BUILTIN_POLY_ARRAY) _t357_len = sp_PolyArray_length((sp_PolyArray *)_t356.v.p);
for (mrb_int _t357 = 0; _t357 < _t357_len; _t357++) {
sp_RbVal _t358 = sp_box_nil();
if (_t356.cls_id == SP_BUILTIN_RANGE) _t358 = sp_box_int(((sp_Range *)_t356.v.p)->first + _t357);
else if (_t356.cls_id == SP_BUILTIN_INT_ARRAY) _t358 = sp_box_int(sp_IntArray_get((sp_IntArray *)_t356.v.p, _t357));
else if (_t356.cls_id == SP_BUILTIN_FLT_ARRAY) _t358 = sp_box_float(sp_FloatArray_get((sp_FloatArray *)_t356.v.p, _t357));
else if (_t356.cls_id == SP_BUILTIN_STR_ARRAY) _t358 = sp_box_str(sp_StrArray_get((sp_StrArray *)_t356.v.p, _t357));
else if (_t356.cls_id == SP_BUILTIN_SYM_ARRAY) _t358 = sp_box_sym((sp_sym)sp_IntArray_get((sp_IntArray *)_t356.v.p, _t357));
else if (_t356.cls_id == SP_BUILTIN_PTR_ARRAY) { void *_pe = sp_PtrArray_get((sp_PtrArray *)_t356.v.p, _t357); _t358 = sp_box_obj(_pe, sp_obj_cls_id_of(_pe)); }
else if (_t356.cls_id == SP_BUILTIN_POLY_ARRAY) _t358 = sp_PolyArray_get((sp_PolyArray *)_t356.v.p, _t357);
sp_RbVal lv_k = sp_box_nil();
sp_RbVal lv_v = sp_box_nil();
if (_t358.tag == SP_TAG_OBJ && _t358.cls_id == SP_BUILTIN_POLY_ARRAY) {
sp_PolyArray *_pa = (sp_PolyArray *)_t358.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 (_t358.tag == SP_TAG_OBJ && _t358.cls_id == SP_BUILTIN_INT_ARRAY) {
sp_IntArray *_ia = (sp_IntArray *)_t358.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 = _t358;
}
sp_redo_13: ;
if (sp_poly_nil_p(lv_v)) {
continue;
}
lv_name = sp_poly_to_s(lv_k);
sp_RbVal _t359 = lv_v;
if ((_t359.tag == SP_TAG_OBJ && (_t359.cls_id == SP_BUILTIN_STR_INT_HASH || _t359.cls_id == SP_BUILTIN_STR_STR_HASH || _t359.cls_id == SP_BUILTIN_INT_STR_HASH || _t359.cls_id == SP_BUILTIN_SYM_INT_HASH || _t359.cls_id == SP_BUILTIN_SYM_STR_HASH || _t359.cls_id == SP_BUILTIN_STR_POLY_HASH || _t359.cls_id == SP_BUILTIN_SYM_POLY_HASH))) {
sp_RbVal _t360 = lv_v;
if (_t360.tag == SP_TAG_OBJ) {
mrb_int _t361_len = 0;
if (_t360.cls_id == SP_BUILTIN_RANGE) _t361_len = ((sp_Range *)_t360.v.p)->last - ((sp_Range *)_t360.v.p)->first + 1;
else if (_t360.cls_id == SP_BUILTIN_INT_ARRAY) _t361_len = sp_IntArray_length((sp_IntArray *)_t360.v.p);
else if (_t360.cls_id == SP_BUILTIN_FLT_ARRAY) _t361_len = sp_FloatArray_length((sp_FloatArray *)_t360.v.p);
else if (_t360.cls_id == SP_BUILTIN_STR_ARRAY) _t361_len = sp_StrArray_length((sp_StrArray *)_t360.v.p);
else if (_t360.cls_id == SP_BUILTIN_SYM_ARRAY) _t361_len = sp_IntArray_length((sp_IntArray *)_t360.v.p);
else if (_t360.cls_id == SP_BUILTIN_PTR_ARRAY) _t361_len = sp_PtrArray_length((sp_PtrArray *)_t360.v.p);
else if (_t360.cls_id == SP_BUILTIN_POLY_ARRAY) _t361_len = sp_PolyArray_length((sp_PolyArray *)_t360.v.p);
for (mrb_int _t361 = 0; _t361 < _t361_len; _t361++) {
sp_RbVal _t362 = sp_box_nil();
if (_t360.cls_id == SP_BUILTIN_RANGE) _t362 = sp_box_int(((sp_Range *)_t360.v.p)->first + _t361);
else if (_t360.cls_id == SP_BUILTIN_INT_ARRAY) _t362 = sp_box_int(sp_IntArray_get((sp_IntArray *)_t360.v.p, _t361));
else if (_t360.cls_id == SP_BUILTIN_FLT_ARRAY) _t362 = sp_box_float(sp_FloatArray_get((sp_FloatArray *)_t360.v.p, _t361));
else if (_t360.cls_id == SP_BUILTIN_STR_ARRAY) _t362 = sp_box_str(sp_StrArray_get((sp_StrArray *)_t360.v.p, _t361));
else if (_t360.cls_id == SP_BUILTIN_SYM_ARRAY) _t362 = sp_box_sym((sp_sym)sp_IntArray_get((sp_IntArray *)_t360.v.p, _t361));
else if (_t360.cls_id == SP_BUILTIN_PTR_ARRAY) { void *_pe = sp_PtrArray_get((sp_PtrArray *)_t360.v.p, _t361); _t362 = sp_box_obj(_pe, sp_obj_cls_id_of(_pe)); }
else if (_t360.cls_id == SP_BUILTIN_POLY_ARRAY) _t362 = sp_PolyArray_get((sp_PolyArray *)_t360.v.p, _t361);
sp_RbVal lv_inner_k = sp_box_nil();
sp_RbVal lv_inner_v = sp_box_nil();
if (_t362.tag == SP_TAG_OBJ && _t362.cls_id == SP_BUILTIN_POLY_ARRAY) {
sp_PolyArray *_pa = (sp_PolyArray *)_t362.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 (_t362.tag == SP_TAG_OBJ && _t362.cls_id == SP_BUILTIN_INT_ARRAY) {
sp_IntArray *_ia = (sp_IntArray *)_t362.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 = _t362;
}
sp_redo_14: ;
if (sp_poly_nil_p(lv_inner_v)) {
continue;
}
const char * _t363 = sp_poly_to_s(lv_inner_k);
SP_GC_ROOT(_t363);
lv_inner_name = sp_str_tr(_t363, (&("\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 * _t364 = (&("\xff" "null")[1]);
SP_GC_RESTORE();
return _t364;
}
sp_RbVal _t365 = lv_v;
if ((_t365.tag == SP_TAG_BOOL && _t365.v.b)) {
const char * _t366 = (&("\xff" "true")[1]);
SP_GC_RESTORE();
return _t366;
}
sp_RbVal _t367 = lv_v;
if ((_t367.tag == SP_TAG_BOOL && !_t367.v.b)) {
const char * _t368 = (&("\xff" "false")[1]);
SP_GC_RESTORE();
return _t368;
}
sp_RbVal _t369 = lv_v;
if ((_t369.tag == SP_TAG_INT)) {
const char * _t370 = sp_poly_to_s(lv_v);
SP_GC_RESTORE();
return _t370;
}
sp_RbVal _t371 = lv_v;
if ((_t371.tag == SP_TAG_FLT)) {
const char * _t372 = sp_poly_to_s(lv_v);
SP_GC_RESTORE();
return _t372;
}
sp_RbVal _t373 = lv_v;
if ((_t373.tag == SP_TAG_STR)) {
const char * _t374 = sp_sprintf("\"%s\"", sp_JsonBuilder_cls_encode_string((lv_v).v.s));
SP_GC_RESTORE();
return _t374;
}
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 * _t375 = (&("\xff" "null")[1]);
SP_GC_RESTORE();
return _t375;
}
lv_str = sp_poly_to_s(lv_s);
if ((sp_str_length(lv_str) < 19LL)) {
const char * _t376 = sp_sprintf("\"%s\"", sp_JsonBuilder_cls_encode_string((const char *)lv_str));
SP_GC_RESTORE();
return _t376;
}
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 *_t377 = lv_html; _t377 ? sp_box_str(_t377->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 *_t378 = lv_html; _t378 ? sp_box_str(_t378->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 *_t379 = lv_html; _t379 ? sp_box_str(_t379->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 *_t380 = sp_SymPolyHash_new();
sp_SymPolyHash_set(_t380, SPS_action, sp_box_sym(lv_action));
sp_SymPolyHash_set(_t380, SPS_stream, sp_box_str(lv_stream));
sp_SymPolyHash_set(_t380, SPS_target, sp_box_str(lv_target));
sp_SymPolyHash_set(_t380, SPS_html, lv_html);
lv_entry = _t380;
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 *_t381 = sp_PolyArray_new();
sp_SymStrHash *_t382 = sp_SymStrHash_new();
sp_SymStrHash_set(_t382, SPS_name, (&("\xff" "application")[1]));
sp_SymStrHash_set(_t382, SPS_path, (&("\xff" "/assets/application.js")[1]));
sp_PolyArray_push(_t381, sp_box_obj((void *)(_t382), SP_BUILTIN_SYM_STR_HASH));
sp_SymStrHash *_t383 = sp_SymStrHash_new();
sp_SymStrHash_set(_t383, SPS_name, (&("\xff" "@hotwired/turbo-rails")[1]));
sp_SymStrHash_set(_t383, SPS_path, (&("\xff" "/assets/turbo.min.js")[1]));
sp_PolyArray_push(_t381, sp_box_obj((void *)(_t383), SP_BUILTIN_SYM_STR_HASH));
sp_SymStrHash *_t384 = sp_SymStrHash_new();
sp_SymStrHash_set(_t384, SPS_name, (&("\xff" "@hotwired/stimulus")[1]));
sp_SymStrHash_set(_t384, SPS_path, (&("\xff" "/assets/stimulus.min.js")[1]));
sp_PolyArray_push(_t381, sp_box_obj((void *)(_t384), SP_BUILTIN_SYM_STR_HASH));
sp_SymStrHash *_t385 = sp_SymStrHash_new();
sp_SymStrHash_set(_t385, SPS_name, (&("\xff" "@hotwired/stimulus-loading")[1]));
sp_SymStrHash_set(_t385, SPS_path, (&("\xff" "/assets/stimulus-loading.js")[1]));
sp_PolyArray_push(_t381, sp_box_obj((void *)(_t385), SP_BUILTIN_SYM_STR_HASH));
sp_SymStrHash *_t386 = sp_SymStrHash_new();
sp_SymStrHash_set(_t386, SPS_name, (&("\xff" "controllers/application")[1]));
sp_SymStrHash_set(_t386, SPS_path, (&("\xff" "/assets/controllers/application.js")[1]));
sp_PolyArray_push(_t381, sp_box_obj((void *)(_t386), SP_BUILTIN_SYM_STR_HASH));
sp_SymStrHash *_t387 = sp_SymStrHash_new();
sp_SymStrHash_set(_t387, SPS_name, (&("\xff" "controllers/hello_controller")[1]));
sp_SymStrHash_set(_t387, SPS_path, (&("\xff" "/assets/controllers/hello_controller.js")[1]));
sp_PolyArray_push(_t381, sp_box_obj((void *)(_t387), SP_BUILTIN_SYM_STR_HASH));
sp_SymStrHash *_t388 = sp_SymStrHash_new();
sp_SymStrHash_set(_t388, SPS_name, (&("\xff" "controllers")[1]));
sp_SymStrHash_set(_t388, SPS_path, (&("\xff" "/assets/controllers/index.js")[1]));
sp_PolyArray_push(_t381, sp_box_obj((void *)(_t388), SP_BUILTIN_SYM_STR_HASH));
return _t381;
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 _t389 = lv_comment;
sp_RbVal _t390 = sp_box_nil();
if (_t389.tag == SP_TAG_OBJ) {
if (_t389.cls_id == 34) _t390 = sp_box_str(sp_CommentRow_commenter((sp_CommentRow *)_t389.v.p));
if (_t389.cls_id == 35) _t390 = sp_Comment_commenter((sp_Comment *)_t389.v.p);
if (_t389.cls_id == 40) _t390 = sp_CommentParams_commenter((sp_CommentParams *)_t389.v.p);
}
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_html_escape(_t390));
sp_String_append(lv_io, (&("\xff" "</p>\n <p class=\"text-gray-700\">")[1]));
sp_RbVal _t391 = lv_comment;
sp_RbVal _t392 = sp_box_nil();
if (_t391.tag == SP_TAG_OBJ) {
if (_t391.cls_id == 29) _t392 = ((sp_ActionController_Base *)_t391.v.p)->iv_body;
if (_t391.cls_id == 32) _t392 = ((sp_ApplicationController *)_t391.v.p)->iv_body;
if (_t391.cls_id == 34) _t392 = sp_CommentRow_body((sp_CommentRow *)_t391.v.p);
if (_t391.cls_id == 35) _t392 = sp_Comment_body((sp_Comment *)_t391.v.p);
if (_t391.cls_id == 36) _t392 = sp_ArticleRow_body((sp_ArticleRow *)_t391.v.p);
if (_t391.cls_id == 37) _t392 = sp_Article_body((sp_Article *)_t391.v.p);
if (_t391.cls_id == 38) _t392 = sp_ArticleParams_body((sp_ArticleParams *)_t391.v.p);
if (_t391.cls_id == 39) _t392 = ((sp_ArticlesController *)_t391.v.p)->iv_body;
if (_t391.cls_id == 40) _t392 = sp_CommentParams_body((sp_CommentParams *)_t391.v.p);
if (_t391.cls_id == 41) _t392 = ((sp_CommentsController *)_t391.v.p)->iv_body;
if (_t391.cls_id == 42) _t392 = ((sp_ActionResponse *)_t391.v.p)->iv_body;
}
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_html_escape(_t392));
sp_String_append(lv_io, (&("\xff" "</p>\n ")[1]));
sp_RbVal _t393 = lv_comment;
sp_RbVal _t394 = sp_box_nil();
if (_t393.tag == SP_TAG_OBJ) {
if (_t393.cls_id == 34) _t394 = sp_CommentRow_article_id((sp_CommentRow *)_t393.v.p);
if (_t393.cls_id == 35) _t394 = sp_Comment_article_id((sp_Comment *)_t393.v.p);
}
sp_RbVal _t395 = lv_comment;
sp_RbVal _t396 = sp_box_nil();
if (_t395.tag == SP_TAG_OBJ) {
if (_t395.cls_id == 23) _t396 = ((sp_ActiveRecord_Base *)_t395.v.p)->iv_id;
if (_t395.cls_id == 33) _t396 = ((sp_ApplicationRecord *)_t395.v.p)->iv_id;
if (_t395.cls_id == 34) _t396 = sp_CommentRow_id((sp_CommentRow *)_t395.v.p);
if (_t395.cls_id == 35) _t396 = sp_Comment_id((sp_Comment *)_t395.v.p);
if (_t395.cls_id == 36) _t396 = sp_ArticleRow_id((sp_ArticleRow *)_t395.v.p);
if (_t395.cls_id == 37) _t396 = sp_Article_id((sp_Article *)_t395.v.p);
}
sp_SymPolyHash *_t397 = sp_SymPolyHash_new();
sp_SymPolyHash_set(_t397, SPS_method, sp_box_sym(SPS_delete));
sp_SymPolyHash_set(_t397, SPS_class, sp_box_str((&("\xff" "text-red-600 text-sm mt-2")[1])));
sp_SymStrHash *_t398 = sp_SymStrHash_new();
sp_SymStrHash_set(_t398, SPS_turbo_confirm, (&("\xff" "Are you sure?")[1]));
sp_SymPolyHash_set(_t397, SPS_data, sp_box_obj((void *)(_t398), 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(_t394, _t396), _t397));
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 *_t399 = sp_SymStrHash_new();
sp_SymStrHash_set(_t399, 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), _t399));
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 * _t400 = sp_Article_comments(lv_article);
SP_GC_ROOT(_t400);
sp_String_append(lv_io, sp_Inflector_cls_pluralize(sp_PtrArray_length(_t400), (&("\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 *_t401 = sp_SymStrHash_new();
sp_SymStrHash_set(_t401, 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), _t401));
sp_String_append(lv_io, (&("\xff" "\n ")[1]));
sp_SymStrHash *_t402 = sp_SymStrHash_new();
sp_SymStrHash_set(_t402, 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), _t402));
sp_String_append(lv_io, (&("\xff" "\n ")[1]));
sp_SymPolyHash *_t403 = sp_SymPolyHash_new();
sp_SymPolyHash_set(_t403, SPS_method, sp_box_sym(SPS_delete));
sp_SymPolyHash_set(_t403, 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 *_t404 = sp_SymStrHash_new();
sp_SymStrHash_set(_t404, SPS_turbo_confirm, (&("\xff" "Are you sure?")[1]));
sp_SymPolyHash_set(_t403, SPS_data, sp_box_obj((void *)(_t404), 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), _t403));
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 _t405 = lv_article;
mrb_bool _t406 = FALSE;
if (_t405.tag == SP_TAG_OBJ) {
if (_t405.cls_id == 23) _t406 = sp_ActiveRecord_Base_persisted_p((sp_ActiveRecord_Base *)_t405.v.p);
if (_t405.cls_id == 33) _t406 = sp_ActiveRecord_Base_persisted_p((sp_ActiveRecord_Base *)_t405.v.p);
if (_t405.cls_id == 35) _t406 = sp_ActiveRecord_Base_persisted_p((sp_ActiveRecord_Base *)_t405.v.p);
if (_t405.cls_id == 37) _t406 = sp_ActiveRecord_Base_persisted_p((sp_ActiveRecord_Base *)_t405.v.p);
}
sp_RbVal _t407 = lv_article;
sp_RbVal _t408 = sp_box_nil();
if (_t407.tag == SP_TAG_OBJ) {
if (_t407.cls_id == 23) _t408 = ((sp_ActiveRecord_Base *)_t407.v.p)->iv_id;
if (_t407.cls_id == 33) _t408 = ((sp_ApplicationRecord *)_t407.v.p)->iv_id;
if (_t407.cls_id == 34) _t408 = sp_CommentRow_id((sp_CommentRow *)_t407.v.p);
if (_t407.cls_id == 35) _t408 = sp_Comment_id((sp_Comment *)_t407.v.p);
if (_t407.cls_id == 36) _t408 = sp_ArticleRow_id((sp_ArticleRow *)_t407.v.p);
if (_t407.cls_id == 37) _t408 = sp_Article_id((sp_Article *)_t407.v.p);
}
sp_RbVal _t409 = lv_article;
mrb_bool _t410 = FALSE;
if (_t409.tag == SP_TAG_OBJ) {
if (_t409.cls_id == 23) _t410 = sp_ActiveRecord_Base_persisted_p((sp_ActiveRecord_Base *)_t409.v.p);
if (_t409.cls_id == 33) _t410 = sp_ActiveRecord_Base_persisted_p((sp_ActiveRecord_Base *)_t409.v.p);
if (_t409.cls_id == 35) _t410 = sp_ActiveRecord_Base_persisted_p((sp_ActiveRecord_Base *)_t409.v.p);
if (_t409.cls_id == 37) _t410 = sp_ActiveRecord_Base_persisted_p((sp_ActiveRecord_Base *)_t409.v.p);
}
sp_SymStrHash *_t411 = sp_SymStrHash_new();
sp_SymStrHash_set(_t411, SPS_class, (&("\xff" "contents")[1]));
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_form_with(lv_article, (&("\xff" "article")[1]), (_t406 ? sp_RouteHelpers_cls_article_path(_t408) : sp_RouteHelpers_cls_articles_path()), (_t410 ? SPS_patch : SPS_post), _t411));
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 _t412 = lv_notice;
mrb_bool _t413 = FALSE;
if (_t412.tag == SP_TAG_STR) _t413 = (sp_str_length(_t412.v.s) == 0);
if (_t412.tag == SP_TAG_OBJ) {
if (_t412.cls_id == 26) _t413 = sp_ActionDispatch_Flash_empty_p((sp_ActionDispatch_Flash *)_t412.v.p);
if (_t412.cls_id == 27) _t413 = sp_ActionDispatch_Session_empty_p((sp_ActionDispatch_Session *)_t412.v.p);
if (_t412.cls_id == SP_BUILTIN_INT_ARRAY) _t413 = (sp_IntArray_length((sp_IntArray *)_t412.v.p) == 0);
if (_t412.cls_id == SP_BUILTIN_FLT_ARRAY) _t413 = (sp_FloatArray_length((sp_FloatArray *)_t412.v.p) == 0);
if (_t412.cls_id == SP_BUILTIN_STR_ARRAY) _t413 = (sp_StrArray_length((sp_StrArray *)_t412.v.p) == 0);
if (_t412.cls_id == SP_BUILTIN_SYM_ARRAY) _t413 = (sp_IntArray_length((sp_IntArray *)_t412.v.p) == 0);
if (_t412.cls_id == SP_BUILTIN_PTR_ARRAY) _t413 = (sp_PtrArray_length((sp_PtrArray *)_t412.v.p) == 0);
if (_t412.cls_id == SP_BUILTIN_POLY_ARRAY) _t413 = (sp_PolyArray_length((sp_PolyArray *)_t412.v.p) == 0);
if (_t412.cls_id == SP_BUILTIN_STR_INT_HASH) _t413 = (sp_StrIntHash_length((sp_StrIntHash *)_t412.v.p) == 0);
if (_t412.cls_id == SP_BUILTIN_STR_STR_HASH) _t413 = (sp_StrStrHash_length((sp_StrStrHash *)_t412.v.p) == 0);
if (_t412.cls_id == SP_BUILTIN_INT_STR_HASH) _t413 = (sp_IntStrHash_length((sp_IntStrHash *)_t412.v.p) == 0);
if (_t412.cls_id == SP_BUILTIN_STR_POLY_HASH) _t413 = (sp_StrPolyHash_length((sp_StrPolyHash *)_t412.v.p) == 0);
if (_t412.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t413 = (sp_SymPolyHash_length((sp_SymPolyHash *)_t412.v.p) == 0);
if (_t412.cls_id == SP_BUILTIN_POLY_POLY_HASH) _t413 = (sp_PolyPolyHash_length((sp_PolyPolyHash *)_t412.v.p) == 0);
}
if (((!sp_poly_nil_p(lv_notice)) && (!_t413))) {
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 *_t414 = sp_SymStrHash_new();
sp_SymStrHash_set(_t414, 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(), _t414));
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 _t415 = 0; _t415 < sp_PtrArray_length(lv_articles); _t415++) {
sp_Article * _t416 = (sp_Article *)sp_PtrArray_get(lv_articles, _t415);
lv_a = _t416;
sp_redo_15: ;
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 _t417 = lv_notice;
mrb_bool _t418 = FALSE;
if (_t417.tag == SP_TAG_STR) _t418 = (sp_str_length(_t417.v.s) == 0);
if (_t417.tag == SP_TAG_OBJ) {
if (_t417.cls_id == 26) _t418 = sp_ActionDispatch_Flash_empty_p((sp_ActionDispatch_Flash *)_t417.v.p);
if (_t417.cls_id == 27) _t418 = sp_ActionDispatch_Session_empty_p((sp_ActionDispatch_Session *)_t417.v.p);
if (_t417.cls_id == SP_BUILTIN_INT_ARRAY) _t418 = (sp_IntArray_length((sp_IntArray *)_t417.v.p) == 0);
if (_t417.cls_id == SP_BUILTIN_FLT_ARRAY) _t418 = (sp_FloatArray_length((sp_FloatArray *)_t417.v.p) == 0);
if (_t417.cls_id == SP_BUILTIN_STR_ARRAY) _t418 = (sp_StrArray_length((sp_StrArray *)_t417.v.p) == 0);
if (_t417.cls_id == SP_BUILTIN_SYM_ARRAY) _t418 = (sp_IntArray_length((sp_IntArray *)_t417.v.p) == 0);
if (_t417.cls_id == SP_BUILTIN_PTR_ARRAY) _t418 = (sp_PtrArray_length((sp_PtrArray *)_t417.v.p) == 0);
if (_t417.cls_id == SP_BUILTIN_POLY_ARRAY) _t418 = (sp_PolyArray_length((sp_PolyArray *)_t417.v.p) == 0);
if (_t417.cls_id == SP_BUILTIN_STR_INT_HASH) _t418 = (sp_StrIntHash_length((sp_StrIntHash *)_t417.v.p) == 0);
if (_t417.cls_id == SP_BUILTIN_STR_STR_HASH) _t418 = (sp_StrStrHash_length((sp_StrStrHash *)_t417.v.p) == 0);
if (_t417.cls_id == SP_BUILTIN_INT_STR_HASH) _t418 = (sp_IntStrHash_length((sp_IntStrHash *)_t417.v.p) == 0);
if (_t417.cls_id == SP_BUILTIN_STR_POLY_HASH) _t418 = (sp_StrPolyHash_length((sp_StrPolyHash *)_t417.v.p) == 0);
if (_t417.cls_id == SP_BUILTIN_SYM_POLY_HASH) _t418 = (sp_SymPolyHash_length((sp_SymPolyHash *)_t417.v.p) == 0);
if (_t417.cls_id == SP_BUILTIN_POLY_POLY_HASH) _t418 = (sp_PolyPolyHash_length((sp_PolyPolyHash *)_t417.v.p) == 0);
}
if (((!sp_poly_nil_p(lv_notice)) && (!_t418))) {
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 *_t419 = sp_SymStrHash_new();
sp_SymStrHash_set(_t419, 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), _t419));
sp_String_append(lv_io, (&("\xff" "\n ")[1]));
sp_SymStrHash *_t420 = sp_SymStrHash_new();
sp_SymStrHash_set(_t420, 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(), _t420));
sp_String_append(lv_io, (&("\xff" "\n ")[1]));
sp_SymPolyHash *_t421 = sp_SymPolyHash_new();
sp_SymPolyHash_set(_t421, SPS_method, sp_box_sym(SPS_delete));
sp_SymPolyHash_set(_t421, SPS_form_class, sp_box_str((&("\xff" "sm:inline-block mt-2 sm:mt-0 sm:ml-2")[1])));
sp_SymPolyHash_set(_t421, 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 *_t422 = sp_SymStrHash_new();
sp_SymStrHash_set(_t422, SPS_turbo_confirm, (&("\xff" "Are you sure?")[1]));
sp_SymPolyHash_set(_t421, SPS_data, sp_box_obj((void *)(_t422), 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), _t421));
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 * _t423 = sp_Article_comments(lv_article);
SP_GC_ROOT(_t423);
for (mrb_int _t424 = 0; _t424 < sp_PtrArray_length(_t423); _t424++) {
sp_Comment * _t425 = (sp_Comment *)sp_PtrArray_get(_t423, _t424);
lv_c = _t425;
sp_redo_16: ;
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 *_t426 = sp_SymStrHash_new();
sp_SymStrHash_set(_t426, 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, _t426));
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 *_t427 = sp_SymStrHash_new();
sp_SymStrHash_set(_t427, 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(), _t427));
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 _t428 = lv_article;
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_SymStrHash *_t430 = sp_SymStrHash_new();
sp_SymStrHash_set(_t430, 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(_t429), _t430));
sp_String_append(lv_io, (&("\xff" "\n ")[1]));
sp_SymStrHash *_t431 = sp_SymStrHash_new();
sp_SymStrHash_set(_t431, 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(), _t431));
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 _t432 = sp_ActionView_ViewHelpers_cls_content_for_get(SPS_title);
sp_String_append(lv_io, sp_ActionView_ViewHelpers_cls_html_escape((sp_poly_truthy(_t432) ? _t432 : 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 *_t433 = sp_SymStrHash_new();
sp_SymStrHash_set(_t433, ((sp_sym)95), (&("\xff" "reload")[1]));
sp_SymStrHash *_t434 = sp_SymStrHash_new();
sp_SymStrHash_set(_t434, ((sp_sym)95), (&("\xff" "reload")[1]));
sp_String_append(lv_io, sp_str_concat3(sp_ActionView_ViewHelpers_cls_stylesheet_link_tag((&("\xff" "application")[1]), _t433), (&("\xff" "\n")[1]), sp_ActionView_ViewHelpers_cls_stylesheet_link_tag((&("\xff" "tailwind")[1]), _t434)));
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 _t435 = lv_article;
sp_RbVal _t436 = sp_box_nil();
if (_t435.tag == SP_TAG_OBJ) {
if (_t435.cls_id == 23) _t436 = ((sp_ActiveRecord_Base *)_t435.v.p)->iv_id;
if (_t435.cls_id == 33) _t436 = ((sp_ApplicationRecord *)_t435.v.p)->iv_id;
if (_t435.cls_id == 34) _t436 = sp_CommentRow_id((sp_CommentRow *)_t435.v.p);
if (_t435.cls_id == 35) _t436 = sp_Comment_id((sp_Comment *)_t435.v.p);
if (_t435.cls_id == 36) _t436 = sp_ArticleRow_id((sp_ArticleRow *)_t435.v.p);
if (_t435.cls_id == 37) _t436 = sp_Article_id((sp_Article *)_t435.v.p);
}
sp_String_append(lv_io, sp_JsonBuilder_cls_encode_value(_t436));
sp_String_append(lv_io, (&("\xff" ",")[1]));
sp_String_append(lv_io, (&("\xff" "\"title\":")[1]));
sp_RbVal _t437 = lv_article;
sp_RbVal _t438 = sp_box_nil();
if (_t437.tag == SP_TAG_OBJ) {
if (_t437.cls_id == 36) _t438 = sp_box_str(sp_ArticleRow_title((sp_ArticleRow *)_t437.v.p));
if (_t437.cls_id == 37) _t438 = sp_Article_title((sp_Article *)_t437.v.p);
if (_t437.cls_id == 38) _t438 = sp_ArticleParams_title((sp_ArticleParams *)_t437.v.p);
}
sp_String_append(lv_io, sp_JsonBuilder_cls_encode_value(_t438));
sp_String_append(lv_io, (&("\xff" ",")[1]));
sp_String_append(lv_io, (&("\xff" "\"body\":")[1]));
sp_RbVal _t439 = lv_article;
sp_RbVal _t440 = sp_box_nil();
if (_t439.tag == SP_TAG_OBJ) {
if (_t439.cls_id == 29) _t440 = ((sp_ActionController_Base *)_t439.v.p)->iv_body;
if (_t439.cls_id == 32) _t440 = ((sp_ApplicationController *)_t439.v.p)->iv_body;
if (_t439.cls_id == 34) _t440 = sp_CommentRow_body((sp_CommentRow *)_t439.v.p);
if (_t439.cls_id == 35) _t440 = sp_Comment_body((sp_Comment *)_t439.v.p);
if (_t439.cls_id == 36) _t440 = sp_ArticleRow_body((sp_ArticleRow *)_t439.v.p);
if (_t439.cls_id == 37) _t440 = sp_Article_body((sp_Article *)_t439.v.p);
if (_t439.cls_id == 38) _t440 = sp_ArticleParams_body((sp_ArticleParams *)_t439.v.p);
if (_t439.cls_id == 39) _t440 = ((sp_ArticlesController *)_t439.v.p)->iv_body;
if (_t439.cls_id == 40) _t440 = sp_CommentParams_body((sp_CommentParams *)_t439.v.p);
if (_t439.cls_id == 41) _t440 = ((sp_CommentsController *)_t439.v.p)->iv_body;
if (_t439.cls_id == 42) _t440 = ((sp_ActionResponse *)_t439.v.p)->iv_body;
}
sp_String_append(lv_io, sp_JsonBuilder_cls_encode_value(_t440));
sp_String_append(lv_io, (&("\xff" ",")[1]));
sp_String_append(lv_io, (&("\xff" "\"created_at\":")[1]));
sp_RbVal _t441 = lv_article;
sp_RbVal _t442 = sp_box_nil();
if (_t441.tag == SP_TAG_OBJ) {
if (_t441.cls_id == 34) _t442 = sp_box_str(sp_CommentRow_created_at((sp_CommentRow *)_t441.v.p));
if (_t441.cls_id == 35) _t442 = sp_Comment_created_at((sp_Comment *)_t441.v.p);
if (_t441.cls_id == 36) _t442 = sp_box_str(sp_ArticleRow_created_at((sp_ArticleRow *)_t441.v.p));
if (_t441.cls_id == 37) _t442 = sp_Article_created_at((sp_Article *)_t441.v.p);
}
sp_String_append(lv_io, sp_JsonBuilder_cls_encode_datetime(_t442));
sp_String_append(lv_io, (&("\xff" ",")[1]));
sp_String_append(lv_io, (&("\xff" "\"updated_at\":")[1]));
sp_RbVal _t443 = lv_article;
sp_RbVal _t444 = sp_box_nil();
if (_t443.tag == SP_TAG_OBJ) {
if (_t443.cls_id == 34) _t444 = sp_box_str(sp_CommentRow_updated_at((sp_CommentRow *)_t443.v.p));
if (_t443.cls_id == 35) _t444 = sp_Comment_updated_at((sp_Comment *)_t443.v.p);
if (_t443.cls_id == 36) _t444 = sp_box_str(sp_ArticleRow_updated_at((sp_ArticleRow *)_t443.v.p));
if (_t443.cls_id == 37) _t444 = sp_Article_updated_at((sp_Article *)_t443.v.p);
}
sp_String_append(lv_io, sp_JsonBuilder_cls_encode_datetime(_t444));
sp_String_append(lv_io, (&("\xff" ",")[1]));
sp_String_append(lv_io, (&("\xff" "\"url\":")[1]));
sp_RbVal _t445 = lv_article;
sp_RbVal _t446 = sp_box_nil();
if (_t445.tag == SP_TAG_OBJ) {
if (_t445.cls_id == 23) _t446 = ((sp_ActiveRecord_Base *)_t445.v.p)->iv_id;
if (_t445.cls_id == 33) _t446 = ((sp_ApplicationRecord *)_t445.v.p)->iv_id;
if (_t445.cls_id == 34) _t446 = sp_CommentRow_id((sp_CommentRow *)_t445.v.p);
if (_t445.cls_id == 35) _t446 = sp_Comment_id((sp_Comment *)_t445.v.p);
if (_t445.cls_id == 36) _t446 = sp_ArticleRow_id((sp_ArticleRow *)_t445.v.p);
if (_t445.cls_id == 37) _t446 = sp_Article_id((sp_Article *)_t445.v.p);
}
sp_RbVal _t447 = lv_article;
sp_RbVal _t448 = sp_box_nil();
if (_t447.tag == SP_TAG_OBJ) {
if (_t447.cls_id == 23) _t448 = ((sp_ActiveRecord_Base *)_t447.v.p)->iv_id;
if (_t447.cls_id == 33) _t448 = ((sp_ApplicationRecord *)_t447.v.p)->iv_id;
if (_t447.cls_id == 34) _t448 = sp_CommentRow_id((sp_CommentRow *)_t447.v.p);
if (_t447.cls_id == 35) _t448 = sp_Comment_id((sp_Comment *)_t447.v.p);
if (_t447.cls_id == 36) _t448 = sp_ArticleRow_id((sp_ArticleRow *)_t447.v.p);
if (_t447.cls_id == 37) _t448 = sp_Article_id((sp_Article *)_t447.v.p);
}
sp_String_append(lv_io, sp_JsonBuilder_cls_encode_value(sp_box_str(sp_str_concat(sp_RouteHelpers_cls_article_path(_t448), (&("\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 *_t449 = sp_PtrArray_new();
SP_GC_ROOT(_t449);
for (mrb_int _t450 = 0; _t450 < sp_PtrArray_length(lv_articles); _t450++) {
sp_Article * lv_article = (sp_Article *)sp_PtrArray_get(lv_articles, _t450);
sp_PtrArray_push(_t449, (void *)(sp_Views_Articles_cls_article_json(sp_box_obj(lv_article, 37))));
}
sp_PtrArray * _t451 = _t449;
SP_GC_ROOT(_t451);
sp_String_append(lv_io, sp_PtrArray_str_join(_t451, (&("\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 *_t452 = sp_PtrArray_new();
SP_GC_ROOT(_t452);
sp_PtrArray_push(_t452, sp_ActionDispatch_Router_Route_new((&("\xff" "GET")[1]), (&("\xff" "/articles")[1]), SPS_articles, SPS_index));
sp_PtrArray_push(_t452, sp_ActionDispatch_Router_Route_new((&("\xff" "GET")[1]), (&("\xff" "/articles/new")[1]), SPS_articles, SPS_new));
sp_PtrArray_push(_t452, sp_ActionDispatch_Router_Route_new((&("\xff" "POST")[1]), (&("\xff" "/articles")[1]), SPS_articles, SPS_create));
sp_PtrArray_push(_t452, sp_ActionDispatch_Router_Route_new((&("\xff" "GET")[1]), (&("\xff" "/articles/:id")[1]), SPS_articles, SPS_show));
sp_PtrArray_push(_t452, sp_ActionDispatch_Router_Route_new((&("\xff" "GET")[1]), (&("\xff" "/articles/:id/edit")[1]), SPS_articles, SPS_edit));
sp_PtrArray_push(_t452, sp_ActionDispatch_Router_Route_new((&("\xff" "PATCH")[1]), (&("\xff" "/articles/:id")[1]), SPS_articles, SPS_update));
sp_PtrArray_push(_t452, sp_ActionDispatch_Router_Route_new((&("\xff" "DELETE")[1]), (&("\xff" "/articles/:id")[1]), SPS_articles, SPS_destroy));
sp_PtrArray_push(_t452, sp_ActionDispatch_Router_Route_new((&("\xff" "POST")[1]), (&("\xff" "/articles/:article_id/comments")[1]), SPS_comments, SPS_create));
sp_PtrArray_push(_t452, sp_ActionDispatch_Router_Route_new((&("\xff" "DELETE")[1]), (&("\xff" "/articles/:article_id/comments/:id")[1]), SPS_comments, SPS_destroy));
return _t452;
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_CommentTest *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 *_t453 = sp_StrStrHash_new();
sp_StrStrHash_set(_t453, (&("\xff" "&")[1]), (&("\xff" "&amp;")[1]));
sp_StrStrHash_set(_t453, (&("\xff" "<")[1]), (&("\xff" "&lt;")[1]));
sp_StrStrHash_set(_t453, (&("\xff" ">")[1]), (&("\xff" "&gt;")[1]));
sp_StrStrHash_set(_t453, (&("\xff" "\"")[1]), (&("\xff" "&quot;")[1]));
sp_StrStrHash_set(_t453, (&("\xff" "'")[1]), (&("\xff" "&#39;")[1]));
cst_ActionView_ViewHelpers_HTML_ESCAPES = _t453;
SP_GC_ROOT(cst_ActionView_ViewHelpers_HTML_ESCAPES);
cst_ActionView_ViewHelpers_HTML_ESCAPE_PATTERN = 0;
sp_SymIntHash *_t454 = sp_SymIntHash_new();
sp_SymIntHash_set(_t454, SPS_ok, 200LL);
sp_SymIntHash_set(_t454, SPS_created, 201LL);
sp_SymIntHash_set(_t454, SPS_accepted, 202LL);
sp_SymIntHash_set(_t454, SPS_no_content, 204LL);
sp_SymIntHash_set(_t454, SPS_moved_permanently, 301LL);
sp_SymIntHash_set(_t454, SPS_found, 302LL);
sp_SymIntHash_set(_t454, SPS_see_other, 303LL);
sp_SymIntHash_set(_t454, SPS_not_modified, 304LL);
sp_SymIntHash_set(_t454, SPS_bad_request, 400LL);
sp_SymIntHash_set(_t454, SPS_unauthorized, 401LL);
sp_SymIntHash_set(_t454, SPS_forbidden, 403LL);
sp_SymIntHash_set(_t454, SPS_not_found, 404LL);
sp_SymIntHash_set(_t454, SPS_unprocessable_entity, 422LL);
sp_SymIntHash_set(_t454, SPS_unprocessable_content, 422LL);
sp_SymIntHash_set(_t454, SPS_internal_server_error, 500LL);
cst_ActionController_STATUS_CODES = _t454;
SP_GC_ROOT(cst_ActionController_STATUS_CODES);
sp_StrStrHash *_t455 = sp_StrStrHash_new();
sp_StrStrHash_set(_t455, (&("\xff" "\\")[1]), (&("\xff" "\\\\")[1]));
sp_StrStrHash_set(_t455, (&("\xff" "\"")[1]), (&("\xff" "\\\"")[1]));
sp_StrStrHash_set(_t455, (&("\xff" "\n")[1]), (&("\xff" "\\n")[1]));
sp_StrStrHash_set(_t455, (&("\xff" "\r")[1]), (&("\xff" "\\r")[1]));
sp_StrStrHash_set(_t455, (&("\xff" "\t")[1]), (&("\xff" "\\t")[1]));
sp_StrStrHash_set(_t455, (&("\xff" "")[1]), (&("\xff" "\\b")[1]));
sp_StrStrHash_set(_t455, (&("\xff" " ")[1]), (&("\xff" "\\f")[1]));
cst_JsonBuilder_ESCAPES = _t455;
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 *_t456 = sp_SymPolyHash_new();
sp_SymPolyHash_set(_t456, SPS_success, sp_box_range(sp_range_new(200LL, 299LL)));
sp_SymPolyHash_set(_t456, SPS_redirect, sp_box_range(sp_range_new(300LL, 399LL)));
sp_SymPolyHash_set(_t456, SPS_missing, sp_box_int(404LL));
sp_SymPolyHash_set(_t456, SPS_not_found, sp_box_int(404LL));
sp_SymPolyHash_set(_t456, SPS_error, sp_box_range(sp_range_new(500LL, 599LL)));
sp_SymPolyHash_set(_t456, SPS_ok, sp_box_int(200LL));
sp_SymPolyHash_set(_t456, SPS_created, sp_box_int(201LL));
sp_SymPolyHash_set(_t456, SPS_no_content, sp_box_int(204LL));
sp_SymPolyHash_set(_t456, SPS_moved_permanently, sp_box_int(301LL));
sp_SymPolyHash_set(_t456, SPS_found, sp_box_int(302LL));
sp_SymPolyHash_set(_t456, SPS_see_other, sp_box_int(303LL));
sp_SymPolyHash_set(_t456, SPS_bad_request, sp_box_int(400LL));
sp_SymPolyHash_set(_t456, SPS_unauthorized, sp_box_int(401LL));
sp_SymPolyHash_set(_t456, SPS_forbidden, sp_box_int(403LL));
sp_SymPolyHash_set(_t456, SPS_unprocessable_entity, sp_box_int(422LL));
sp_SymPolyHash_set(_t456, SPS_unprocessable_content, sp_box_int(422LL));
sp_SymPolyHash_set(_t456, SPS_internal_server_error, sp_box_int(500LL));
cst_RequestDispatch_STATUS_SYMBOLS = _t456;
SP_GC_ROOT(cst_RequestDispatch_STATUS_SYMBOLS);
sp_Db_cls_configure((&("\xff" ":memory:")[1]));
sp_StrArray * _t457 = sp_Schema_cls_statements();
SP_GC_ROOT(_t457);
for (mrb_int _t458 = 0; _t458 < sp_StrArray_length(_t457); _t458++) {
const char * lv_sql = sp_StrArray_get(_t457, _t458);
sp_redo_17: ;
sp_Db_cls_exec((const char *)lv_sql);
}
lv___t = sp_CommentTest_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_CommentTest_test_creates_a_comment_on_an_article(lv___t);
sp_TestBase_teardown((sp_TestBase *)lv___t);
lv___t = sp_CommentTest_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_CommentTest_test_belongs_to_article_association(lv___t);
sp_TestBase_teardown((sp_TestBase *)lv___t);
lv___t = sp_CommentTest_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_CommentTest_test_requires_commenter(lv___t);
sp_TestBase_teardown((sp_TestBase *)lv___t);
lv___t = sp_CommentTest_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_CommentTest_test_requires_body(lv___t);
sp_TestBase_teardown((sp_TestBase *)lv___t);
lv___t = sp_CommentTest_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_CommentTest_test_requires_valid_article(lv___t);
sp_TestBase_teardown((sp_TestBase *)lv___t);
{ const char *_ps = (const char *)((&("\xff" "CommentTest: 5 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