static void objet_destroy(Objet *ob) { text_destroy(ob->text); text_destroy(ob->attributes); g_free(ob->stereotype); g_free(ob->st_stereotype); g_free(ob->exstate); g_free(ob->attrib); element_destroy(&ob->element); }
static void function_destroy(Function *pkg) { text_destroy(pkg->text); element_destroy(&pkg->element); }
static void smallpackage_destroy(SmallPackage *pkg) { text_destroy(pkg->text); element_destroy(&pkg->element); }
static void actor_destroy(Actor *actor) { text_destroy(actor->text); element_destroy(&actor->element); }
static void state_destroy(State *state) { text_destroy(state->text); element_destroy(&state->element); }
static void annotation_destroy(Annotation *annotation) { connection_destroy(&annotation->connection); text_destroy(annotation->text); }
static void box_destroy(Box *box) { text_destroy(box->text); element_destroy(&box->element); }
static void ellipse_destroy(Ellipse *ellipse) { text_destroy(ellipse->text); element_destroy(&ellipse->element); }
static void diamond_destroy(Diamond *diamond) { text_destroy(diamond->text); element_destroy(&diamond->element); }
static void note_destroy(Note *note) { text_destroy(note->text); element_destroy(¬e->element); }
static void usecase_destroy(Usecase *usecase) { text_destroy(usecase->text); element_destroy(&usecase->element); }
static void pgram_destroy(Pgram *pgram) { text_destroy(pgram->text); element_destroy(&pgram->element); }
static void req_destroy(Requirement *req) { text_destroy(req->text); element_destroy(&req->element); }
static void basestation_destroy(Basestation *basestation) { text_destroy(basestation->text); element_destroy(&basestation->element); }
static void textobj_destroy(Textobj *textobj) { text_destroy(textobj->text); g_free (textobj->object.enclosing_box); textobj->object.enclosing_box = NULL; object_destroy(&textobj->object); }
static void rendobj_destroy(RenderObject *rend_obj) { element_destroy(&rend_obj->element); if (rend_obj->desc->use_text) text_destroy(rend_obj->text); g_free(rend_obj->connections); }
static void component_destroy(Component *cmp) { text_destroy(cmp->text); g_free(cmp->stereotype); g_free(cmp->st_stereotype); element_destroy(&cmp->element); }
static void other_destroy(Other *other) { text_destroy(other->text); connpointline_destroy(other->east); connpointline_destroy(other->south); connpointline_destroy(other->west); connpointline_destroy(other->north); element_destroy(&other->element); }
static void compfeat_destroy(Compfeat *compfeat) { OrthConn *orth = &compfeat->orth; if (compfeat->role == COMPPROP_FACET || compfeat->role == COMPPROP_EVENTSOURCE) { object_remove_connectionpoint(&orth->object, &compfeat->cp); } text_destroy(compfeat->text); orthconn_destroy(&compfeat->orth); }
void aadlbox_destroy(Aadlbox *aadlbox) { int i; text_destroy(aadlbox->name); /* object_unconnect needs valid handles (from ports) */ element_destroy(&aadlbox->element); for (i=0; i<aadlbox->num_ports; i++) free_port(aadlbox->ports[i]); }
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow) { /* make a test window */ tw = text_new(); if (!hPrevInstance) { HICON hicon = LoadIcon(NULL, IDI_APPLICATION); text_register_class(hicon); } text_font(tw, "Courier New", 10); text_size(tw, 80, 80); text_drag(tw, "(", ") run\r"); /* show the text window */ if (!text_create(tw, "Application Name", nCmdShow)) { /* do the real work here */ /* TESTING */ int ch; int len; char *line = new char[256]; while ( (len = text_read_line(tw, line, 256-1)) != 0 ) { text_write_buf(tw, line, len); } /* while ( text_gets(tw, line, 256-1) ) { text_puts(tw, line); } */ /* while ( (ch = text_getch(tw, )) != 4 ) text_putch(tw, ch); */ } else { } /* clean up */ text_destroy(tw); /* end program */ return 0; }
/** * Initializes the timestamp library with a font file and face index. */ void subtitle_init(const char *font_file, long face_index, int points, int dpi) { if (text_id != -1) { text_destroy(text_id); } text_id = text_create( font_file, face_index, points, dpi ); text_set_stroke_color(text_id, 0x000000); text_set_letter_spacing(text_id, 1); text_set_color(text_id, 0xffffff); text_set_layout(text_id, LAYOUT_ALIGN_BOTTOM | LAYOUT_ALIGN_CENTER, // layout alignment for the box 0, // horizontal margin from the right edge 30); // vertical margin from the bottom edge text_set_align(text_id, TEXT_ALIGN_CENTER); // text alignment inside the box }
void text_create_and_render(Shader *shader, Font *font, int size, const char *fmt, ...) { char *string; va_list va; Text *text; va_start(va, fmt); string = ralloc_vasprintf(NULL, fmt, va); va_end(va); if (string == NULL) return; text = text_create(font, string, size); ralloc_free(string); if (text == NULL) return; text_upload_to_gpu(shader, text); text_render(shader, text); text_destroy(text); }
static void flow_destroy(Flow *flow) { connection_destroy(&flow->connection); text_destroy(flow->text) ; }
static void textobj_destroy(Textobj *textobj) { text_destroy(textobj->text); object_destroy(&textobj->object); }
/** * Destroys the resources used by timestamp library. */ void subtitle_shutdown() { if (text_id != -1) { text_destroy(text_id); text_id = -1; } }
static void node_destroy(Node *node) { text_destroy(node->name); element_destroy(&node->element); }
static void classicon_destroy(Classicon *cicon) { text_destroy(cicon->text); element_destroy(&cicon->element); }
void test_text(void) { assert(text_creer_depuis_texte(NULL) == NULL); assert(text_creer_depuis_texte("a") != NULL); assert(text_creer_depuis_texte("") != NULL); assert(text_creer_depuis_texte("abcdef") != NULL); assert(text_obtenir_taille(text_creer_depuis_texte("abcdef")) == 6); assert(strcmp(text_obtenir_texte(text_creer_depuis_texte("abc")), "abc") == 0); assert(text_creer_depuis_sous_texte("abcdef",4,4) == NULL); assert(text_creer_depuis_sous_texte("abcdef",2,4) != NULL); assert(text_obtenir_taille(text_creer_depuis_sous_texte("abcdef",2,4))==4); assert(strcmp(text_obtenir_texte(text_creer_depuis_sous_texte("abcdef", 0, 2)), "ab") == 0); assert(strcmp(text_obtenir_texte(text_creer_depuis_sous_texte("abcdef", 4, 2)), "ef") == 0); assert(strcmp(text_obtenir_texte(text_creer_depuis_sous_texte("abcdef", 0, 6)), "abcdef") == 0); assert(text_destroy(text_creer_depuis_texte("")) == 1); assert(text_retirer_espaces(NULL) == -1); assert(text_retirer_espaces(text_creer_depuis_texte("abcdef")) == 1); Text t0 = text_creer_depuis_texte(" er ff d grg "); text_retirer_espaces(t0); assert(strcmp(text_obtenir_texte(t0), "erffdgrg") == 0); assert(text_obtenir_texte(NULL) == NULL); assert(text_obtenir_texte(text_creer_depuis_texte("")) != NULL); unsigned int c; Text *tt; assert(text_decoupe_premier_niveau(text_creer_depuis_texte(""), ' ', NULL, &c) == -1); assert(text_decoupe_premier_niveau(text_creer_depuis_texte(""), ' ', &tt, NULL) == -1); assert(text_decoupe_premier_niveau(NULL, ' ', &tt, &c) == -1); Text *output1; unsigned count1; assert(text_decoupe_premier_niveau(text_creer_depuis_texte("ab,cd,ef"),',',&output1,&count1) == 1); assert(count1 == 3); assert(strcmp(text_obtenir_texte(output1[0]), "ab") == 0); assert(strcmp(text_obtenir_texte(output1[1]), "cd") == 0); assert(strcmp(text_obtenir_texte(output1[2]), "ef") == 0); Text *output2; unsigned count2; assert(text_decoupe_premier_niveau(text_creer_depuis_texte("f1(x1,x2)=f1(f2(f3(x3))),f4(x4,x5)=f4(f5(x5)),x3=x4"),',',&output2,&count2) == 1); assert(count2 == 3); assert(strcmp(text_obtenir_texte(output2[0]), "f1(x1,x2)=f1(f2(f3(x3)))") == 0); assert(strcmp(text_obtenir_texte(output2[1]), "f4(x4,x5)=f4(f5(x5))") == 0); assert(strcmp(text_obtenir_texte(output2[2]), "x3=x4") == 0); Text *output3; unsigned count3; assert(text_decoupe_premier_niveau(text_creer_depuis_texte("f1=f2"),',',&output3,&count3) == 1); assert(count3 == 1); assert(strcmp(text_obtenir_texte(output3[0]), "f1=f2") == 0); Text *output4; unsigned count4; text_decoupe_premier_niveau(text_creer_depuis_texte("99,11,22"), ',', &output4, &count4); assert(count4 == 3); assert(output4[0] != NULL); assert(output4[1] != NULL); assert(output4[2] != NULL); assert(strcmp(text_obtenir_texte(output4[0]), "99") == 0); assert(strcmp(text_obtenir_texte(output4[1]), "11") == 0); assert(strcmp(text_obtenir_texte(output4[2]), "22") == 0); assert(text_contient_char(NULL,' ')==-1); assert(text_contient_char(text_creer_depuis_texte("ab,cd,ef"),' ')==0); assert(text_contient_char(text_creer_depuis_texte("ab ,cd,ef"),' ')==1); assert(text_trim_char(NULL,' ')==-1); Text t1 ; t1 = text_creer_depuis_texte(" ab ,cd,ef "); assert(text_trim_char(t1,' ')==1); //printf("'%s'\n",text_obtenir_texte(t1)); assert(strcmp(text_obtenir_texte(t1), "ab ,cd,ef")== 0); assert(text_retirer_prefix(NULL,' ')==-1); Text t2 ; t2 = text_creer_depuis_texte(" ab, cd , ef"); assert(text_retirer_prefix(t2,' ')==1); //printf("'%s'\n",text_obtenir_texte(t2)); assert(strcmp(text_obtenir_texte(t2), " ab, cd , ef")== 0); assert(text_retirer_suffix(text_creer_depuis_texte("ab"), 'b') == 1); assert(text_retirer_suffix(text_creer_depuis_texte("ab"), 'a') == -1); Text t3 = text_creer_depuis_texte("abc"); text_retirer_suffix(t3, 'c'); assert(strcmp("ab", text_obtenir_texte(t3)) == 0); }
static void goal_destroy(Goal *goal) { text_destroy(goal->text); element_destroy(&goal->element); }