/* * Function: window_load * ---------------------------------------------------------------------------- * Overview window load handler. * Creates and inits the needed layers and sets the mood. * * window: the window that has been loaded * ---------------------------------------------------------------------------- */ static void window_load(Window *window) { Layer *window_layer = window_get_root_layer(window); GRect bounds = layer_get_bounds(window_layer); // Create Mood avg + median info Text Layer s_text_layer = text_layer_create(GRect(0, 0, bounds.size.w, TOP_TEXT_H)); text_layer_set_text_alignment(s_text_layer, GTextAlignmentCenter); text_layer_set_font(s_text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD)); layer_add_child(window_layer, (Layer *)s_text_layer); set_mood(); s_mood_min = storage_read_int(KEY_MOOD_MIN, NUM_MOOD_MIN); s_mood_max = storage_read_int(KEY_MOOD_MAX, NUM_MOOD_MAX); s_mood_step = storage_read_int(KEY_MOOD_STEP, NUM_MOOD_STEP); s_num_moods = (abs(s_mood_min) + s_mood_max); // Create Graph Canvas Layer s_canvas_layer = layer_create(GRect(0, TOP_TEXT_H, bounds.size.w, bounds.size.h-TOP_TEXT_H)); layer_add_child(window_layer, s_canvas_layer); // Set the Graph Layer update_proc layer_set_update_proc(s_canvas_layer, canvas_update_proc); }
CompatKeys(char *keys1, char *keys2, gk_string *gstr) { gk_string Gstr; gk_string Gstr2; gk_word * BlnkGkword; int rval = 0; int is_deriv = 0; BlnkGkword = CreatGkword(1); is_deriv = has_morphflag(morphflags_of(gstr),IS_DERIV); Gstr = BlankGkend; Gstr2 = BlankGkend; *gstr = BlankGkend; if( is_deriv ) add_morphflag(morphflags_of(gstr),IS_DERIV); ScanAsciiKeys(keys1,BlnkGkword,gstr,NULL); ScanAsciiKeys(keys2,BlnkGkword,&Gstr2,NULL); FreeGkword(BlnkGkword); rval = EndingOk(keys2,gstr,&Gstr,1); /* * grc 3/16/91 * * suppose we match a stem "a):ss:pres" against "ss:aor2_pass". we don't at this * point decide whether or not the aor2_pass stem type could be a present. we just * make sure that only present forms will be generated -- thus we will generate no * present forms and filter out the problem later. */ if( rval ) { if( tense_of(forminfo_of(&Gstr2)) ) set_tense(forminfo_of(gstr),tense_of(forminfo_of(&Gstr2))); if( mood_of(forminfo_of(&Gstr2)) ) set_mood(forminfo_of(gstr),mood_of(forminfo_of(&Gstr2))); if( voice_of(forminfo_of(&Gstr2)) ) set_voice(forminfo_of(gstr),voice_of(forminfo_of(&Gstr2))); } return(rval); }
/* * this has to do a better job with dialects at some point * * grc 3/21/91 * * this thing checks for whether you are undoing an reduplication * * if not, then these stems should only be attached to indicatives */ unaugment(char *s, gk_string *possibs[], gk_string *qpossibs[], int maxstems, Dialect dial, int wantsyllaugs, int wantredupl) { int rval = 0; int compval; int i; char augnoquant[MAXWORDSIZE]; Dialect d; if( ! Xstrncmp(s,"e)rr",4) ) { rval = 1; Xstrncpy(gkstring_of(possibs[0]),"r(",MAXWORDSIZE); Xstrncat(gkstring_of(possibs[0]),s+4,MAXWORDSIZE); if( ! wantredupl ) { set_mood(forminfo_of(possibs[0]),INDICATIVE); } return(rval); } if( ! Xstrncmp(s,"e)r",3) ) { rval = 1; Xstrncpy(gkstring_of(possibs[0]),"r(",MAXWORDSIZE); Xstrncat(gkstring_of(possibs[0]),s+3,MAXWORDSIZE); add_morphflag(morphflags_of(possibs[0]),RAW_SONANT); if( ! wantredupl ) { set_mood(forminfo_of(possibs[0]),INDICATIVE); } return(rval); } if( ! Xstrncmp(s,"e)",2) && Is_cons(*(s+2)) ) { rval = 1; Xstrncpy(gkstring_of(possibs[0]),s+2,MAXWORDSIZE); if(*(s+2) == *(s+3) ) { /* e)/llabe, e)ssei/onto 429 a. D */ rval = 2; Xstrncpy(gkstring_of(possibs[1]),s+3,MAXWORDSIZE); add_morphflag(morphflags_of(possibs[1]),SYLL_AUGMENT); } if( ! wantredupl ) { set_mood(forminfo_of(possibs[0]),INDICATIVE); } return(rval); } for(i=0;TempAugments[i].noaug[0] && rval<maxstems;i++) { Xstrncpy(augnoquant,TempAugments[i].withaug,MAXWORDSIZE); stripquant(augnoquant); compval = morphstrncmp( augnoquant , s , strlen(augnoquant) ); if( ! compval ) { char tmp[128]; Xstrncpy(tmp,TempAugments[i].noaug,MAXWORDSIZE); /* Xstrncat(tmp,s+Xstrlen(TempAugments[i].withaug),MAXWORDSIZE ); */ Xstrncat(tmp,s+Xstrlen(augnoquant) ,MAXWORDSIZE); Xstrncpy(gkstring_of(possibs[rval]),tmp,MAXWORDSIZE); if( strcmp(augnoquant,TempAugments[i].withaug) ) { Xstrncpy(tmp,TempAugments[i].withaug,MAXWORDSIZE); Xstrncat(tmp,s+Xstrlen(augnoquant) ,MAXWORDSIZE); Xstrncpy(gkstring_of(qpossibs[rval]),tmp,MAXWORDSIZE); set_dialect(possibs[rval],TempAugments[i].augdial ); } if( ! wantredupl ) { set_mood(forminfo_of(possibs[rval]),INDICATIVE); } rval++; } } if( ! wantsyllaugs ) return(rval); for(i=0;SyllAugments[i].noaug[0] && rval<maxstems;i++) { Xstrncpy(augnoquant,SyllAugments[i].withaug,MAXWORDSIZE); stripquant(augnoquant); compval = morphstrncmp( augnoquant , s , strlen(augnoquant) ); if( ! compval ) { char tmp[128]; Xstrncpy(tmp,SyllAugments[i].noaug,MAXWORDSIZE); /* Xstrncat(tmp,s+Xstrlen(SyllAugments[i].withaug) ,MAXWORDSIZE); */ Xstrncat(tmp,s+Xstrlen(augnoquant) ,MAXWORDSIZE); Xstrncpy(gkstring_of(possibs[rval]),tmp,MAXWORDSIZE); set_dialect(possibs[rval],SyllAugments[i].augdial); add_morphflag(morphflags_of(possibs[rval]),SYLL_AUGMENT); if( ! wantredupl ) { set_mood(forminfo_of(possibs[rval]),INDICATIVE); } rval++; } } return(rval); }