{"id":18822374,"url":"https://github.com/zardoz89/csvdll","last_synced_at":"2025-06-28T16:41:36.098Z","repository":{"id":138164039,"uuid":"244198772","full_name":"Zardoz89/csvDll","owner":"Zardoz89","description":"CSV DLL for DIV2","archived":false,"fork":false,"pushed_at":"2021-10-30T18:49:15.000Z","size":198,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-22T10:17:04.551Z","etag":null,"topics":["c","div2","gemix","library","watcom"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Zardoz89.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-01T18:06:56.000Z","updated_at":"2021-11-08T23:07:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"ac0d760d-d983-4b82-b99b-c9b818d88377","html_url":"https://github.com/Zardoz89/csvDll","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/Zardoz89/csvDll","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zardoz89%2FcsvDll","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zardoz89%2FcsvDll/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zardoz89%2FcsvDll/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zardoz89%2FcsvDll/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Zardoz89","download_url":"https://codeload.github.com/Zardoz89/csvDll/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zardoz89%2FcsvDll/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262461362,"owners_count":23314936,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","div2","gemix","library","watcom"],"created_at":"2024-11-08T00:49:09.622Z","updated_at":"2025-06-28T16:41:36.079Z","avatar_url":"https://github.com/Zardoz89.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"DLL para lectura de ficheros CSV simples\n----------------------------------------\n\nv0.3.1\n\nEsta DLL implementa funciones para parsear ficheros CSV, donde se utiliza el\ncarácter ',' como elemento separador, y solo contienen valores numéricos. El\ncarácter '#' marca que el resto de la linea se ignore, siendo útil para agregar\ncomentarios y cabeceras en los ficheros.\n\nSi un número comience con \"0x\" se interpretará en hexadecimal. Si comienca\nprecedido de un 0, entonces se interpretará en base octal.\n\nTodos los buffers internos son de 256 bytes, con lo puede que no pueda procesar\ncorrectamente lineas mas largas de 255 bytes;\n\n## How build\n\n### Original DIV 2 for MS-DOS\n\nRequires Watcom C 10.6 installed on a DOS enviroment (dosbox, dosemu, virtual\nmachine or native install of MS-DOS/PC-DOS/DR-DOS, FreeDOs or OpenDOS).\n\nTo compile, simply launch make2.bat like if it was make coommand :\n\n```\nmake2 all\n```\n\nA *debug* version could be generated. The debug version generates a CSV.LOG\nfile with information about the data being readed by the DLL. On every\ninvocation or execution, new content its append at the end of the log file.\n\n```\nmake2 csv_dbg.dll\n```\n\n### DIV DX\n\nActually only works with [CicTec's fork](https://github.com/CicTec/DIV-Games-Studio) on Linux (64 bit). Simple launch\n`./makeDll.sh` and it will generate a `csv.so` that could be used on DIV DX.\n\n## Functions list\n\n`INT setCSVSeparator(STRING separator)`\n\nSets the seperator token. The string it's used by C's strok function.\n\n\n`INT readCSVToIntArray(STRING fileName, OFFSET offset, INT numberOfElements)`\n\nReads a CSV file on the path stored on the string *fileName*, and stores the\nvalues in an integer array or struct pointed by *offset*. The max number of elements\nread will be determinated by *numberOfElements*. The return value by the\nfunction, it's the number of elements read or -1 if there was an error.\nIf *offset* is 0, then will not store any read element. It only will return the\nnumber of elements that are on the CSV file.\n\n`INT readCSVToWordArray(STRING fileName, OFFSET offset, INT numberOfElements)`\n\nReads a CSV file on the path stored on the string *fileName*, and stores the\nvalues in an word array pointed by *offset*. The max number of elements\nread will be determinated by *numberOfElements*. The return value by the\nfunction, it's the number of elements read or -1 if there was an error.\nIf *offset* is 0, then will not store any read element. It only will return the\nnumber of elements that are on the CSV file.\n\n`INT readCSVToByteArray(STRING fileName, OFFSET offset, INT numberOfElements)`\n\nReads a CSV file on the path stored on the string *fileName*, and stores the\nvalues in an byte array pointed by *offset*. The max number of elements\nread will be determinated by *numberOfElements*. The return value by the\nfunction, it's the number of elements read or -1 if there was an error.\nIf *offset* is 0, then will not store any read element. It only will return the\nnumber of elements that are on the CSV file.\n\n\n## Ejemplo de uso\n\nUso típico:\n\n```div2\n/**\n * Genera la ruta relativa a los ficheros del juego\n */\nfunction pathResolve(file)\nbegin\n  return (/* \"\\foo\\bar\\\" + */ file);\nend\n\n/**\n * Lee un fichero CSV con datos de juego\n */\nfunction loadData(dataFile, _offset, size)\nprivate\n  string _path;\n  int _retVal = 0;\n  string _msg;\nbegin\n  _path = pathResolve(dataFile);\n  _retVal = readCSVToIntArray(_path, _offset, size);\n  if (_retVal \u003c= 0)\n    _msg = \"Error al abrir fichero de datos: \" + _path;\n    write(0, 0, 0, 0, _msg);\n    loop\n      // abortamos ejecución\n      if (key(_q) || key(_esc))\n        let_me_alone();\n        break;\n      end\n\n      frame;\n    end\n  end\n  return(_retVal);\nend\n\n...\n\nloadData(\"dat\\mydata.dat\", offset myArray, sizeof(myArray));\n```\n\nDeterminar la cantidad de elementos en un fichero antes de cargar el contenido:\n\n```div2\n/**\n * Función que carga el contenido de un fichero CSV en un array dinamico\n (generado por malloc)\n * Devuelve un puntero al array dinamico\n */\nfunction loadAndAllocateData(dataFile)\nprivate\n  string _path;\n  int _retVal = 0;\n  int _nElements = 0;\n  string _msg;\n  int pointer _data;\nbegin\n  _path = pathResolve(dataFile);\n  _nElements = readCSVToIntArray(_path, 0, max_int);\n  if (_nElements \u003c= 0)\n    _msg = \"Error al abrir fichero de datos: \" + _path;\n    write(0, 0, 0, 0, _msg);\n    loop\n      // abortamos ejecución\n      if (key(_q) || key(_esc))\n        let_me_alone();\n        break;\n      end\n\n      frame;\n    end\n  end\n  _data = malloc(_nElements);\n  readCSVToIntArray(_path, _data, _nElements);\n  return(_data);\nend\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzardoz89%2Fcsvdll","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzardoz89%2Fcsvdll","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzardoz89%2Fcsvdll/lists"}