static LISP x_get_string(LISP row, LISP col, LISP bname) { int r, c; int s; char *p; buffer *buf; r = get_c_long(row); c = get_c_long(col); if (r < 1 || r > BUFFER_ROWS || c < 1 || c > BUFFER_COLS) return NIL; if (NULLP(bname)) { buf = siag_buffer; s = siag_sht; } else if (TYPEP(bname, tc_string)) { buf = find_sheet_by_name(bname->storage_as.string.data, siag_buffer, &s); if (buf == NULL) return NIL; } else return NIL; if (ret_type(buf, s, r, c) == ERROR) p = ""; else p = ret_pvalue(NULL, buf, s, r, c, -1); return strcons(strlen(p), p); }
static LISP x_get_cell(LISP row, LISP col, LISP bname) { int r, c; char *p; buffer *buf; int s; r = get_c_long(row); c = get_c_long(col); if (r < 1 || r > BUFFER_ROWS || c < 1 || c > BUFFER_COLS) return NIL; if (NULLP(bname)) { buf = siag_buffer; s = siag_sht; } else if (TYPEP(bname, tc_string)) { buf = find_sheet_by_name(bname->storage_as.string.data, siag_buffer, &s); if (buf == NULL) return NIL; } else return NIL; switch (ret_type(buf, s, r, c)) { case STRING: p = ret_string(buf, s, r, c); return strcons(strlen(p), p); case LABEL: p = ret_text(buf, s, r, c); return strcons(strlen(p), p); case EMPTY: case ERROR: return NIL; default: return flocons(ret_val(buf, s, r, c).number); } }
sheet* document::get_sheet(const pstring& sheet_name) { boost::ptr_vector<sheet_item>::iterator it = std::find_if(mp_impl->m_sheets.begin(), mp_impl->m_sheets.end(), find_sheet_by_name(sheet_name)); if (it == mp_impl->m_sheets.end()) return NULL; return &it->data; }
sheet_t document::get_sheet_index(const pstring& name) const { boost::ptr_vector<sheet_item>::const_iterator it = std::find_if(mp_impl->m_sheets.begin(), mp_impl->m_sheets.end(), find_sheet_by_name(name)); if (it == mp_impl->m_sheets.end()) return ixion::invalid_sheet; boost::ptr_vector<sheet_item>::const_iterator it_beg = mp_impl->m_sheets.begin(); size_t pos = std::distance(it_beg, it); return static_cast<sheet_t>(pos); }
static LISP get_type(LISP bname, LISP row, LISP col) { buffer *buf; int s, t, r, c; if (NULLP (bname)) { buf = buffer_of_window(w_list); s = w_list->sht; } else { buf = find_sheet_by_name(get_c_string(bname), w_list->buf, &s); } r = get_c_long(row); c = get_c_long(col); t = ret_type(buf, s, r, c); return flocons(t); }