{"id":16847457,"url":"https://github.com/koute/cdata","last_synced_at":"2025-07-05T07:04:10.010Z","repository":{"id":3899677,"uuid":"4987777","full_name":"koute/cdata","owner":"koute","description":null,"archived":false,"fork":false,"pushed_at":"2013-04-26T18:01:47.000Z","size":152,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T07:17:08.827Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/koute.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-07-11T10:48:44.000Z","updated_at":"2015-07-12T18:27:41.000Z","dependencies_parsed_at":"2022-07-31T14:49:04.575Z","dependency_job_id":null,"html_url":"https://github.com/koute/cdata","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/koute/cdata","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koute%2Fcdata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koute%2Fcdata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koute%2Fcdata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koute%2Fcdata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koute","download_url":"https://codeload.github.com/koute/cdata/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koute%2Fcdata/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263699742,"owners_count":23497962,"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":[],"created_at":"2024-10-13T13:08:01.202Z","updated_at":"2025-07-05T07:04:09.994Z","avatar_url":"https://github.com/koute.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"What is cdata?\n--------------\n\nCData lets you serialize arbitrary Ruby structures into static C++ data.\n\nTry running this:\n\n    require 'cdata'\n\n    s = CData::Serializer.new\n    s.serialize [ 1, 2, 3 ], 'g_array'\n\n    s.source_prologue \u003c\u003c '#include \"data.h\"'\n    s.generate\n\n    File.open( \"data.h\", \"wb\" ) { |fp| fp.puts s.header }\n    File.open( \"data.cpp\", \"wb\" ) { |fp| fp.puts s.source }\n\n\nThen compile this:\n\n    #include \u003cstdio.h\u003e\n    #include \"data.h\"\n\n    int main()\n    {\n        for( auto value: g_array )\n            printf( \"%i\\n\", value );\n        return 0;\n    }\n\nOutput:\n\n    $ g++ data.cpp main.cpp -std=c++0x\n    $ ./a.out\n    1\n    2\n    3\n\nSupported features\n-----------------\n\n* All basic Ruby types (Integers, Arrays, Hashes, Strings, etc.)\n* Custom user defined types. (Just define self.cdata_methods() that returns\n  a list of symbols you want serialized.)\n* Space efficient - variable types are picked according to the content.\n  For example - if you only have integers less than 256 in an array then\n  they will be serialized as unsigned chars.)\n* Cyclic dependencies between objects.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoute%2Fcdata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoute%2Fcdata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoute%2Fcdata/lists"}