- {
- return;
- }
-
- memset (file->cache_starts, 0, 512);
- /* Cache miss */
- if (file->const_cache.string)
- {
- ss_dealloc (&file->const_cache);
- }
- ss_alloc_substring_pool (&file->const_cache,
- PSPPIRE_TEXT_FILE (file->child)->lines[n], NULL);
- struct substring cs = file->const_cache;
- int field = 0;
- file->cache_starts[0] = cs.string;
- gint enc = -1;
- for (;
- UINT32_MAX != ss_first_mb (cs);
- ss_get_mb (&cs))
- {
- ucs4_t character = ss_first_mb (cs);
- gboolean char_is_quote = FALSE;
- if (enc == -1)
- {
- gint i;
- for (i = 0; i < 3; ++i)
- {
- if (character == enclosures[i].opening)
- {
- enc = i;
- char_is_quote = TRUE;
- file->cache_starts[field] += ss_first_mblen (cs);
- break;
- }
- }
- }
- else if (character == enclosures[enc].closing)
- {
- char_is_quote = TRUE;
- nullify_char (cs);
- enc = -1;
- }
-
- if (enc == -1 && char_is_quote == FALSE)
- {
- GSList *del;
- for (del = file->delimiters; del; del = g_slist_next (del))
- {
- if (character == GPOINTER_TO_INT (del->data))
- {
- field++;
- int char_len = ss_first_mblen (cs);
- file->cache_starts[field] = cs.string + char_len;
- nullify_char (cs);
- break;
- }
- }
- }
- }