static spif_bool_t action_handle_echo(event_t *ev, spif_eterm_action_t action) { REQUIRE_RVAL(!SPIF_PTR_ISNULL(ev), FALSE); REQUIRE_RVAL(!SPIF_STR_ISNULL(action->parameter), FALSE); #ifdef ESCREEN if (TermWin.screen && TermWin.screen->backend) { # ifdef NS_HAVE_SCREEN /* translate escapes */ ns_parse_screen_interactive(TermWin.screen, SPIF_STR_STR(action->parameter)); # endif } else #endif tt_write(SPIF_STR_STR(action->parameter), spif_str_get_len(SPIF_STR(action->parameter))); return 1; }
// ################################################################# // バイナリー出力 void Glyph::writeBinary(const string outFile) { if (0 == element) return; if ( outFile.empty() ) return; unsigned long len = outFile.size() + 14; // id(9) + postfix(4) + 1 char* tmp = new char[len]; memset(tmp, 0, sizeof(char)*len); sprintf(tmp, "%s_id%06d.%s", outFile.c_str(), myRank, "stl"); ofstream ofs(tmp, ios::out | ios::binary); if (!ofs) { cout << "\tFile '" << outFile.c_str() << "' could not open." << endl; Exit(0); } unsigned short c=0; char head[STL_HEAD]; char *pch=NULL; pch = &head[0]; for (int i=0; i<STL_HEAD; i++) *pch++ = 0x00; strcpy(head, "CutGlyph"); tt_write(ofs, head, sizeof(char), STL_HEAD); tt_write(ofs, &element, sizeof(unsigned), 1); float v[3]; for (unsigned m=0; m<element; m++) { int q = b_id[m]; c = 0; c |= (0x1 << 15); // extend color format c |= (q << 10); // R c |= (q << 5); // G c |= (q << 0); // B v[0] = nvc[m].x; v[1] = nvc[m].y; v[2] = nvc[m].z; tt_write(ofs, v, sizeof(float), 3); v[0] = xyz[3*m ].x; v[1] = xyz[3*m ].y; v[2] = xyz[3*m ].z; tt_write(ofs, v, sizeof(float), 3); v[0] = xyz[3*m+1].x; v[1] = xyz[3*m+1].y; v[2] = xyz[3*m+1].z; tt_write(ofs, v, sizeof(float), 3); v[0] = xyz[3*m+2].x; v[1] = xyz[3*m+2].y; v[2] = xyz[3*m+2].z; tt_write(ofs, v, sizeof(float), 3); tt_write(ofs, &c, sizeof(unsigned short), 1); } ofs.close(); }