-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compile knightstour.c #67
Comments
After checking, Transpiling that file without panic with just 32 warnings. |
Please post the warnings so we can create issues out of them. |
Warnings given out by
When building it, it doesn't recognize what coord is.
|
Full warnings: warnings.txt |
type coord struct {
x int
y int
}
type extCoord struct {
position coord
possibleSteps int
} Should have been included into the go file. |
@carstenhag , thanks, I will check later, again. |
Present result: // Warning (FieldDecl): 85: probably an incorrect type translation 3
// Warning (TypedefDecl): 333: function pointers are not supported
// Warning (TypedefDecl): 341: function pointers are not supported
// Warning (TypedefDecl): 350: function pointers are not supported
// Warning (TypedefDecl): 353: function pointers are not supported
// Warning (FieldDecl): 69: I couldn't find an appropriate Go type for the C type '(anonymous struct at /usr/include/x86_64-linux-gnu/bits/waitstatus.h:69:5)'.
// Warning (FieldDecl): 84: I couldn't find an appropriate Go type for the C type '(anonymous struct at /usr/include/x86_64-linux-gnu/bits/waitstatus.h:84:5)'.
// Warning (RecordDecl): 66: could not determine the size of type `union wait` for that reason: cannot determine size of: `struct (anonymous struct at /usr/include/x86_64-linux-gnu/bits/waitstatus.h:84:5)`
// Warning (TransparentUnionAttr): 71: could not parse &{55956192 {/usr/include/stdlib.h 71 0 35 0 } []}
// Warning (FieldDecl): 141: I couldn't find an appropriate Go type for the C type '(anonymous struct at /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:141:3)'.
// Warning (FieldDecl): 177: I couldn't find an appropriate Go type for the C type '(anonymous struct at /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:177:3)'.
// Warning (TypedefDecl): 741: function pointers are not supported
// Warning (EnumDecl): 209: Add support of continues counter for type : *ast.BasicLit
// Warning (EnumDecl): 209: Add support of continues counter for type : *ast.BasicLit
// Warning (EnumDecl): 209: Add support of continues counter for type : *ast.BasicLit
// Warning (EnumDecl): 209: Add support of continues counter for type : *ast.BasicLit
// Warning (EnumDecl): 209: Add support of continues counter for type : *ast.BasicLit
// Warning (EnumDecl): 347: Add support of continues counter for type : *ast.UnaryExpr
// Warning (ImplicitValueInitExpr): 192: cannot transpile to expr
// Warning (ImplicitValueInitExpr): 192: cannot transpile to expr
// Warning (ImplicitValueInitExpr): 193: cannot transpile to expr
// Warning (ImplicitValueInitExpr): 193: cannot transpile to expr
// Warning (ImplicitValueInitExpr): 194: cannot transpile to expr
// Warning (ImplicitValueInitExpr): 194: cannot transpile to expr
// Warning (ImplicitValueInitExpr): 195: cannot transpile to expr
// Warning (ImplicitValueInitExpr): 195: cannot transpile to expr
// Warning (UnaryExprOrTypeTraitExpr): 210: cannot determine size of: `extCoord`
// Warning (CallExpr): 210: function pointers are not supported
// Warning (UnaryExprOrTypeTraitExpr): 288: cannot determine size of: `_Bool`
// Warning (UnaryExprOrTypeTraitExpr): 288: cannot determine size of: `_Bool`
// Error (BinaryOperator): 288: cannot determine size of: `_Bool`
// Warning (ForStmt): 0: ForStmt cannot be nil
// Error (WhileStmt): 345: Stmts inside Block cannot be nil
|
After #469:
|
For present version
|
Dear @elliotchance ,
But, I have not idea - How to test? |
Hey @Konstantin8105 and the others, thanks for improving c2go so much that it even builds now! It's about (as the name says :P) the Knight's Tour problem. The first option uses the position (1,1) (1-indexed) and lets you choose a board size. You can compare the transpiled version with the original C one. Verifying that the output is right is relatively easy, just follow the step numbers like a knight would/could: |
@Konstantin8105 I tried to run it with your mallocIssue67 branch, https://github.com/Konstantin8105/c2go/tree/mallocIssue67, but it seems to give me the following errors:
|
Dear @carstenhag , please wait little bit for transpilation, because 2 PR are on review. |
I'm not quite sure what you mean with "prepare some tests in according to gcc version", but I've just compiled the c program on
|
for example if I execute gcc version of that program and chose 1 in menu - What I will can enter for success? |
Ooh sorry, I forgot that. |
@carstenhag , thank you for clarification. We will return to that discussion later. |
Dear @elliotchance , @carstenhag , Result of Go program: 2018-01-14 15:34:47 ⌚ lepricon-AOD270 in ~/go/bin/king
○ → go run king.go
1: Startfeld wird vom Programm gewählt.
2: Startfeld wird vom Anwender frei gewählt.
3: Startfeld wird vom Anwender frei gewählt, der Springer geht einen geschlossenen Pfad.
Wählen Sie bitte zwischen den Optionen 1, 2 und 3 aus: 1
Board Size (x): 5
Board Size (y): 6
Starting at Position (1,1).
A solution has been found!
Solution Steps:
01 16 19 26 03 10
18 25 02 09 20 27
15 08 17 24 11 04
30 23 06 13 28 21
07 14 29 22 05 12 Result of C program: 2018-01-14 15:54:09 ⌚ lepricon-AOD270 in ~/go/bin/king
○ → ./out
1: Startfeld wird vom Programm gewählt.
2: Startfeld wird vom Anwender frei gewählt.
3: Startfeld wird vom Anwender frei gewählt, der Springer geht einen geschlossenen Pfad.
Wählen Sie bitte zwischen den Optionen 1, 2 und 3 aus: 1
Board Size (x): 5
Board Size (y): 6
Starting at Position (1,1).
A solution has been found!
Solution Steps:
01 16 21 28 07 14
22 29 08 15 20 27
09 02 17 24 13 06
30 23 04 11 26 19
03 10 25 18 05 12 |
That's so awesome @Konstantin8105! I'm happy to close this now |
This was an issue raise originally by @carstenhag with #27.
The original ticket was fixed but the example program was very good. This issue will outline what we need to do to get knightstour.c working.
stdio.h
(Support for stdio.h #61)stdlib.h
stdbool.h
(Added support for stdbool.h #65)string.h
math.h
(Math #9)coord
andextCoord
(MemberExpr does not know member types #49)qsort()
calloc()
andfree()
.sizeof()
(Support sizeof() #102)The text was updated successfully, but these errors were encountered: