Feature Request: Read text file as a string

Abierto
#42 5 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
55/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
c
Área
backend

Línea de trabajo

Start by reading _list.def:338 and _convert.def:362 and :377, which the issue identifies as existing expression language functions. Check how those functions are exposed and how file paths are handled; the issue does not name a file-loading entry point or test. Done means adding a way to read a text file as a string or lines, with a clear decision about whether text belongs in nip4's expression language.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

#enhancement

Issue
I am currently working on a colour calibration workflow and currently there is no native way to import and parse a CGATS/OQM reference lab files.
There is vips_csvload, however one can only skip a fixed number of lines, split on a delimiter (e.g. a whitespace), and convert cells to a float.

Context
When importing CGATS.17 file format, there is a large variation across files and the order of the columns. Some files contain online LAB values, others contain spectra values, and so on. They have some labels BEGIN_DATA_FORMAT, END_DATA_FORMAT, BEGIN_DATA, BEGIN_DATA.

As an example, I created a workspace to read a specific CGATS.17 formatted file, then I swapped the file with another file with 3 extra header lines which shifted my $skip count, and vips_csvload didn't error, it just silently read numbers from the wrong row. How common are such differences across CGATS.17? Very common, there is unfortunately no standardisation, out of 13 files I checked, all columns were in different orders and different header sizes.

Feature Request
Therefore in order to create a simple text parser within nip4, it would be great to have a way to convert a text file into a string, e.g. read_file : Pathname -> [char] or read_lines : Pathname -> [[char]]

I have checked the source code (_list.def:338, _convert.def:362/:377) and nip already has functions like split, parse_int, parse_float etc, so the request would be to create this file conversion rather than build a parsing framework from scratch.

Is nip4's expression language meant to stay numeric/image-only, or would it be possible to include text too?

Lenguaje dominante
C
Estrellas
106
Forks
5
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de libvips/nip4

Todos los issues de libvips/nip4

Issues similares

Más issues de C

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.