Beispiel #1
0
 MD::MarkovData(const MarkovData &rhs, bool copy_links) : Data(rhs), CD(rhs) {
   if (copy_links) {
     links = rhs.links;
   } else {
     clear_links();
   }
 }
void
event_list::verify_and_link (midipulse slength)
{
    clear_links();
    for (event_list::iterator on = m_events.begin(); on != m_events.end(); on++)
    {
        event & eon = dref(on);
        if (eon.is_note_on())               /* Note On, find its Note Off   */
        {
            event_list::iterator off = on;  /* get next possible Note Off   */
            off++;
            bool endfound = false;
            while (off != m_events.end())
            {
                event & eoff = dref(off);
                if                          /* Off, == notes, not marked    */
                (
                    eoff.is_note_off() &&
                    eoff.get_note() == eon.get_note() &&
                    ! eoff.is_marked()
                )
                {
                    eon.link(&eoff);                    /* link + mark */
                    eoff.link(&eon);
                    eon.mark();
                    eoff.mark();
                    endfound = true;
                    break;
                }
                off++;
            }
            if (! endfound)
            {
                off = m_events.begin();
                while (off != on)
                {
                    event & eoff = dref(off);
                    if
                    (
                        eoff.is_note_off() &&
                        eoff.get_note() == eon.get_note() &&
                        ! eoff.is_marked()
                    )
                    {
                        eon.link(&eoff);                /* link + mark */
                        eoff.link(&eon);
                        eon.mark();
                        eoff.mark();
                        endfound = true;
                        break;
                    }
                    off++;
                }
            }
        }
    }
    unmark_all();
    mark_out_of_range(slength);
}
Beispiel #3
0
void view_directory(const char *host, const char *port,
        const char *selector, int make_current)
{
    int     is_dir;
    int     srvfd, i, head_read;
    char    line[1024];
    char    head[HEAD_CHECK_LEN][1024];

    srvfd = dial(host, port, selector);
    if (srvfd != -1) {  /* only adapt current prompt when successful */
        /* make history entry */
        if (make_current)
            add_history();
        /* don't overwrite the current_* things... */
        if (host != current_host)
            snprintf(current_host, sizeof(current_host), "%s", host);
        if (port != current_port)
            snprintf(current_port, sizeof(current_port), "%s", port);
        if (selector != current_selector)
            snprintf(current_selector, sizeof(current_selector),
                    "%s", selector);
    }
    clear_links();  /* clear links *AFTER* dialing out!! */
    if (srvfd == -1)
        return; /* quit if not successful */
    head_read = 0;
    is_dir = 1;
    while (head_read < HEAD_CHECK_LEN && read_line(srvfd, line, sizeof(line))) {
        strcpy(head[head_read], line);
        if (!is_valid_directory_entry(head[head_read])) {
            is_dir = 0;
            break;
        }
        head_read++;
    }
    if (!is_dir) {
        puts("error: Not a directory.");
        close(srvfd);
        return;
    }
    for (i = 0; i < head_read; i++) {
        handle_directory_line(head[i]);
    }
    while (read_line(srvfd, line, sizeof(line))) {
        handle_directory_line(line);
    }
    close(srvfd);
}
Beispiel #4
0
void fixup_links(item_t *item)
{
  if (!item) return;
  fpos_t position;
  fgetpos(output_file, &position);
  link_t *link = item->links;
  while (link) {
    fsetpos(output_file, &link->position);
    fprintf(output_file, BACKEND_EMPTY_LABEL);
    fsetpos(output_file, &link->position);
    fprintf(output_file, "%s", item->label);
    link = link->next;
  }
  clear_links(&item->links);
  fsetpos(output_file, &position);
}
Beispiel #5
0
 MD::MarkovData(const string &lab, pKey labs, bool grow)
   : CD(lab, labs, grow)
 {
   clear_links();
 }
Beispiel #6
0
 MD::MarkovData(uint val, pKey labs)
   : CD(val, labs)
 {
   clear_links();
 }
Beispiel #7
0
 MD::MarkovData(uint val, uint Nlev)
   : CD(val, Nlev)
 {
   clear_links();
 }
Beispiel #8
0
 MD::MarkovData(uint val, const Ptr<CatKeyBase> &key) : CD(val, key) {
   clear_links();
 }