c2go icon indicating copy to clipboard operation
c2go copied to clipboard

SQLite

Open markbates opened this issue 7 years ago • 4 comments

I wish I could contribute to this project, but unfortunately my python skills are beyond non-existent. :( Have you considered moving this to Go instead?

The bane of my existence these days is SQLite, because it requires cgo. For giggles I thought I would run this against it to see what I got. Here are the results:

There is no regex for 'ParenType'.
I will print out all the lines so a regex can be created:

 0x7fa205805b00 'int (void *, int, char **, char **)' sugar
 0x7fa20580b670 'void (void)' sugar
 0x7fa20580f660 'void (void *)' sugar
 0x7fa20584cdc0 'void (const Fts5ExtensionApi *, Fts5Context *, sqlite3_context *, int, sqlite3_value **)' sugar
 0x7fa205872be0 'void (int)' sugar
 0x7fa206058270 'int (int, const void *, UnpackedRecord *)' sugar
 0x7fa205815e30 'int (void *, int, const char *, const char *, const char *, const char *)' sugar
 0x7fa205098b40 'const sqlite3_io_methods *(const char *, unixFile *)' sugar
 0x7fa20690d4e0 'int (SortSubtask *, int *, const void *, int, const void *, int)' sugar
 0x7fa205c496c0 'int (sqlite3 *, char **, const sqlite3_api_routines *)' sugar
   `-ParenType 0x7fa206091310 'void (void *, int, const char *)' sugar
   `-ParenType 0x7fa20580fc10 'int (int)' sugar
   `-ParenType 0x7fa20580b670 'void (void)' sugar

Traceback (most recent call last):
  File "c2go.py", line 568, in <module>
    raise e
ValueError: No JSON object could be decoded

While that is probably not very helpful to you, I thought that giving you more examples might be of at least some help.

If you move this project to Go, or decide to set up a patreon.com page, please let me know.

I am willing to throw some money at converting SQLite to pure Go! :)

Goodluck

markbates avatar Mar 30 '17 14:03 markbates

Hi Mark! Thanks for that - it funny you bring up SQLite3... It's one of my favourite projects, and it's source is the perfect candidate for a stable version of c2go (I have updated the README to reflect this).

Unfortunately c2go is far from being able to convert the SQLite3 codebase - but I don't think it's at all impossible with the right help.

Every issue is helpful to the project, if you could provide slices of the codebase that currently don't transpire they can be individually dealt with... (doesn't have to be part of the SQLite3 codebase, any really)

elliotchance avatar Mar 30 '17 21:03 elliotchance

@markbates how about your Go skills? The project has been converted to pure Go for a few versions now.

elliotchance avatar May 14 '17 09:05 elliotchance

SQLite project https://www.sqlite.org/index.html

Konstantin8105 avatar Jun 30 '17 20:06 Konstantin8105

Present amount of warnings:

○ → c2go transpile sqlite3.c

○ → cat sqlite3.go | grep "Warning" | wc -l
9236

○ → cat sqlite3.go | grep "Warning" | grep "function pointer" | wc -l
564

○ → cat sqlite3.go | grep "Warning" | grep "anon" | wc -l
1416

○ → cat sqlite3.go | grep "Warning" | grep "I couldn't find an appropriate Go type" | wc -l
1000

○ → cat sqlite3.go | grep "Warning" | grep "cannot determine type for LHS" | wc -l
3482

○ → cat sqlite3.go | grep "Warning" | grep "pointer of array is nil" | wc -l
556

○ → cat sqlite3.go | grep "Warning" | grep "probably an incorrect type translation" | wc -l
1308

Konstantin8105 avatar Dec 21 '17 18:12 Konstantin8105