smart_map get_smart_map (tree fn) { string name= recompose (tuple_as_array (fn), "-"); if (smart_map::instances -> contains (name)) return smart_map (name); return make (smart_map, name, tm_new<smart_map_rep> (name, fn)); }
void Camera::setOrientation(const glm::quat& orientation) { _orientation = orientation; recompose(); if (_isKeepLookingAt) { lookAt(_lookingAt); } }
void TransformationMatrix::blend(const TransformationMatrix& from, double progress) { if (from.isIdentity() && isIdentity()) return; // decompose DecomposedType fromDecomp; DecomposedType toDecomp; from.decompose(fromDecomp); decompose(toDecomp); // interpolate blendFloat(fromDecomp.scaleX, toDecomp.scaleX, progress); blendFloat(fromDecomp.scaleY, toDecomp.scaleY, progress); blendFloat(fromDecomp.scaleZ, toDecomp.scaleZ, progress); blendFloat(fromDecomp.skewXY, toDecomp.skewXY, progress); blendFloat(fromDecomp.skewXZ, toDecomp.skewXZ, progress); blendFloat(fromDecomp.skewYZ, toDecomp.skewYZ, progress); blendFloat(fromDecomp.translateX, toDecomp.translateX, progress); blendFloat(fromDecomp.translateY, toDecomp.translateY, progress); blendFloat(fromDecomp.translateZ, toDecomp.translateZ, progress); blendFloat(fromDecomp.perspectiveX, toDecomp.perspectiveX, progress); blendFloat(fromDecomp.perspectiveY, toDecomp.perspectiveY, progress); blendFloat(fromDecomp.perspectiveZ, toDecomp.perspectiveZ, progress); blendFloat(fromDecomp.perspectiveW, toDecomp.perspectiveW, progress); slerp(&fromDecomp.quaternionX, &toDecomp.quaternionX, progress); // recompose recompose(fromDecomp); }
void Camera::setPosition(const glm::vec3& position) { _position = position; recompose(); if (_isKeepLookingAt) { lookAt(_lookingAt); } }
void setShear(float k) { if ( !decompositionValid ) __decompose(); decomposition.shear = k; recompose(ownMatrix, decomposition); };
void setRotation(float radians) { if ( !decompositionValid ) __decompose(); decomposition.rotation = radians; recompose(ownMatrix, decomposition); };
void setScale(float scaleX, float scaleY) { if ( !decompositionValid ) __decompose(); decomposition.scaleX = scaleX; decomposition.scaleY = scaleY; recompose(ownMatrix, decomposition); };
static array<tree> parse_vernac_proof (string s) { array<tree> r; array<string> a= split_command (s); if (N(a) == 0) return r; r << compound ("coq-command", "", "dark grey", parse_subcommand (a[0])); if (N(a) > 1) { string pf= recompose (range (a, 1, N(a)), " "); r << parse_vernac_command (pf); } return r; }
void handler(int signum, siginfo_t *strct, void *ucontext) { t_elem *client; if (signum != SIGUSR1 && signum != SIGUSR2) my_error(1, 1); if (!(client = check_client(strct->si_pid)) && signum == SIGUSR2) { if (!(client = my_add_client(strct->si_pid))) my_error(4, 2); } else recompose(signum, client); }
font smart_font (string family, string variant, string series, string shape, int sz, int dpi) { if (!new_fonts) return find_font (family, variant, series, shape, sz, dpi); if (starts (family, "tc")) // FIXME: temporary hack for symbols from std-symbol.ts return find_font (family, variant, series, shape, sz, dpi); if (starts (family, "sys-")) { if (family == "sys-chinese") { string name= default_chinese_font_name (); family= "cjk=" * name * ",roman"; } if (family == "sys-japanese") { string name= default_japanese_font_name (); family= "cjk=" * name * ",roman"; } if (family == "sys-korean") { string name= default_korean_font_name (); family= "cjk=" * name * ",roman"; } } string name= family * "-" * variant * "-" * series * "-" * shape * "-" * as_string (sz) * "-" * as_string (dpi) * "-smart"; if (font::instances->contains (name)) return font (name); if (starts (shape, "math")) { array<string> a= trimmed_tokenize (family, ","), b; for (int i=0; i<N(a); i++) if (starts (a[i], "math=")) b << a[i] (5, N(a[i])); else b << a[i]; family= recompose (b, ","); } string sh= shape; if (shape == "mathitalic" || shape == "mathshape") sh= "right"; string mfam= main_family (family); font base_fn= closest_font (mfam, variant, series, sh, sz, dpi); if (is_nil (base_fn)) return font (); font sec_fn= closest_font ("roman", "ss", "medium", "right", sz, dpi); font err_fn= error_font (sec_fn); return make (font, name, tm_new<smart_font_rep> (name, base_fn, err_fn, family, variant, series, shape, sz, dpi)); }
int unix_system (array<string> arg, array<int> fd_in, array<string> str_in, array<int> fd_out, array<string*> str_out) { // Run command arg[0] with arguments arg[i], i >= 1. // str_in[i] is sent to the file descriptor fd_in[i]. // str_out[i] is filled from the file descriptor fd_out[i]. // If str_in[i] is -1 then $$i automatically replaced by a valid // file descriptor in arg. if (N(arg) == 0) return 0; string which= recompose (arg, " "); int n_in= N(fd_in), n_out= N(fd_out); ASSERT(N(str_in) == n_in, "size mismatch"); ASSERT(N(str_out) == n_out, "size mismatch"); array<_pipe_t> pp_in (n_in), pp_out (n_out); _file_actions_t file_actions; for (int i= 0; i < n_in; i++) { if (posix_spawn_file_actions_addclose (&file_actions.rep, pp_in[i].out ()) != 0) return -1; if (fd_in[i] >= 0) { if (posix_spawn_file_actions_adddup2 (&file_actions.rep, pp_in[i].in (), fd_in[i]) != 0) return -1; if (posix_spawn_file_actions_addclose (&file_actions.rep, pp_in[i].in ()) != 0) return -1; } } for (int i= 0; i < n_out; i++) { if (posix_spawn_file_actions_addclose (&file_actions.rep, pp_out[i].in ()) != 0) return -1; if (posix_spawn_file_actions_adddup2 (&file_actions.rep, pp_out[i].out (), fd_out[i]) != 0) return -1; if (posix_spawn_file_actions_addclose (&file_actions.rep, pp_out[i].out ()) != 0) return -1; } array<string> arg_= arg; for (int j= 0; j < N(arg); j++) for (int i= 0; i < n_in; i++) if (fd_in[i] < 0) arg_[j]= replace (arg_[j], "$$" * as_string (i), as_string (pp_in[i].in ())); if (DEBUG_IO) debug_io << "unix_system, launching: " << arg_ << "\n"; array<char*> _arg; for (int j= 0; j < N(arg_); j++) _arg << as_charp (arg_[j]); _arg << (char*) NULL; pid_t pid; int status= posix_spawnp (&pid, _arg[0], &file_actions.rep, NULL, A(_arg), environ); for (int j= 0; j < N(arg_); j++) tm_delete_array (_arg[j]); if (status != 0) { if (DEBUG_IO) debug_io << "unix_system, failed" << "\n"; return -1; } if (DEBUG_IO) debug_io << "unix_system, succeeded to create pid " << pid << "\n"; // close useless ports for (int i= 0; i < n_in ; i++) close (pp_in[i].in ()); for (int i= 0; i < n_out; i++) close (pp_out[i].out ()); // write to spawn process array<_channel> channels_in (n_in); array<pthread_t> threads_write (n_in); for (int i= 0; i < n_in; i++) { channels_in[i]._init_in (pp_in[i].out (), str_in[i], 1 << 12); if (pthread_create (&threads_write[i], NULL /* &attr */, _background_write_task, (void *) &(channels_in[i]))) return -1; } // read from spawn process array<_channel> channels_out (n_out); array<pthread_t> threads_read (n_out); for (int i= 0; i < n_out; i++) { channels_out[i]._init_out (pp_out[i].in (), 1 << 12); if (pthread_create (&threads_read[i], NULL /* &attr */, _background_read_task, (void *) &(channels_out[i]))) return -1; } int wret; time_t last_wait_time= texmacs_time (); while ((wret= waitpid (pid, &status, WNOHANG)) == 0) { usleep (100); if (texmacs_time () - last_wait_time > 5000) { last_wait_time= texmacs_time (); _unix_system_warn (pid, which, "waiting spawn process"); } } if (DEBUG_IO) debug_io << "unix_system, pid " << pid << " terminated" << "\n"; // wait for terminating threads void* exit_status; int thread_status= 0; for (int i= 0; i < n_in; i++) { pthread_join (threads_write[i], &exit_status); if (channels_in[i].status < 0) thread_status= -1; } for (int i= 0; i < n_out; i++) { pthread_join (threads_read[i], &exit_status); *(str_out[i])= string (channels_out[i].data.data (), channels_out[i].data.length ()); if (channels_out[i].status < 0) thread_status= -1; } if (thread_status < 0) return thread_status; if (wret < 0 || WIFEXITED(status) == 0) return -1; return WEXITSTATUS(status); }
Json::Value GeneralizedTransform::get(std::string const &leaf) const { return recompose(leaf.empty() ? Json::nullValue : Json::Value(leaf)); }
Json::Value GeneralizedTransform::get() const { return recompose(); }