void string_cat(char *s1, size_t len) { static char *str = NULL; if (!str || !s1) { if (!s1) str = NULL; else str = s1; g_stacks[1][0] = -1; g_stacks[0][0] = -1; g_ci = 0; g_bi = 0; return ; } while (len-- > 0) { if (len >= 4 && *s1 == ':' && s1[4] == ':' && coi(s1) < NUM_C_TAGS * 2) len -= track_color_tags(&str, &s1); else { if (len >= 4 && !ft_strncmp(s1, "\033[", 2)) track_escape_code(s1); *str++ = *s1++; } } }
//! Put date into an ostream static void date_put(const date_type& d, ostream_type& os, const facet_type& f) { special_values sv = d.as_special(); if (sv == not_special) { ymd_type ymd = d.year_month_day(); ostream_ymd_formatter<ymd_type, facet_type, charT>::ymd_put(ymd, os, f); } else { // output a special value std::ostreambuf_iterator<charT> coi(os); f.put_special_value(coi, sv); } }
//! [0] GLWidget::GLWidget(QWidget *parent) : QGLWidget(QGLFormat(QGL::SampleBuffers), parent) { qtGreen = QColor::fromCmykF(0.40, 0.0, 1.0, 0.0); qtPurple = QColor::fromCmykF(0.29, 0.29, 0.20, 0.0); QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(simulate())); timer->start(60); fCamera = new BaseCamera(); Vector3F eye(0.f, 0.f, 500.f); Vector3F coi(0.f, 0.f, 0.f); fCamera->lookFromTo(eye, coi); _dome = new GeodesicHemisphereMesh(127); _vertexBuffer = new CUDABuffer; _program = new HemisphereProgram; _drawer = new ShapeDrawer; BRDFProgram::setVTheta(0.76f); }
static size_t track_color_tags(char **strp, char **s1p) { int j; if ((j = coi(*s1p)) >= NUM_C_TAGS * 2) return (0); ft_strcpy(*strp, g_color_tags[j + 1]); if (j == EOCALL_ID || j == EOF_ID) g_ci = 0; if (j == EOBALL_ID || j == EOF_ID) g_bi = 0; if (j >= CMIN_ID && j <= CMAX_ID) g_stacks[0][++g_ci] = (j - CMIN_ID) / 2; else if (j >= BMIN_ID && j <= BMAX_ID) g_stacks[1][++g_bi] = (j - BMIN_ID) / 2; else if (j == EOC_ID || j == EOCALL_ID) apply_previous_color(&(*strp)[3], 1); else if (j == EOB_ID || j == EOBALL_ID) apply_previous_color(&(*strp)[3], 0); *s1p += 5; (*strp) += (j < NUM_SMALLC_TAGS * 2) ? 4 : 5; return (4); }