Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
December 17, 2022 [Issue 23513] ImportC doesn't export ncurses' attributes (C macros) | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23513 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P3 -- |
January 10, 2023 [Issue 23513] ImportC doesn't export ncurses' attributes (C macros) | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23513 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@digitalmars.com --- Comment #1 from Walter Bright <bugzilla@digitalmars.com> --- What does the definition of A_BOLD look like in the .h files on your machine? -- |
January 10, 2023 [Issue 23513] ImportC doesn't export ncurses' attributes (C macros) | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23513 --- Comment #2 from Tomas Ortin Fernandez <quanrong@mailbox.org> --- This is the definition: #define A_BOLD NCURSES_BITS(1U,13) And NCURSES_BITS is defined as follows: #define NCURSES_BITS(mask,shift) (NCURSES_CAST(chtype,(mask)) << ((shift) + NCURSES_ATTR_SHIFT)) NCURSES_CAST is defined as: #ifdef __cplusplus extern "C" { #define NCURSES_CAST(type,value) static_cast<type>(value) #else #define NCURSES_CAST(type,value) (type)(value) #endif And NCURSES_ATTR_SHIFT is just 8 I'm using the stable version of this implementation (I can attach the .h file if it's better) https://invisible-island.net/ncurses/ncurses.html Note that it doesn't just happen with A_BOLD, it happens with all the ncurses "character attributes". -- |
February 15, 2023 [Issue 23513] ImportC doesn't export ncurses' attributes (C macros) | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23513 Alex Bryan <abryancs@proton.me> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |abryancs@proton.me --- Comment #3 from Alex Bryan <abryancs@proton.me> --- It seems like the root of the problem is an inability for importC to convert function like macros that are able to be evaluated at compile time into enum definitions. For example: alex@compy programming/importc_test dmd --version 19:33:22 23-02-14 DMD64 D Compiler v2.102.0 Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved written by Walter Bright alex@compy programming/importc_test cat source/foo.h 19:33:28 23-02-14 #define CONSTANT 6 #define CONTSTANT_PLUS (6 + 1) alex@compy programming/importc_test cat source/foo.c 19:34:02 23-02-14 #include "foo.h" alex@compy programming/importc_test cat source/app.d 19:34:03 23-02-14 import std.stdio; import foo; void main() { writeln("%d", CONSTANT); //works writeln("%d", CONSTANT_PLUS); //does not work } alex@compy programming/importc_test dmd source/*.d source/*.c 19:34:08 23-02-14 source/app.d(7): Error: undefined identifier `CONSTANT_PLUS` alex@compy programming/importc_test dub build 19:36:10 23-02-14 Starting Performing "debug" build using /usr/bin/dmd for x86_64. Building importc_test ~master: building configuration [application] source/app.d(7,16): Error: undefined identifier `CONSTANT_PLUS` Error /usr/bin/dmd failed with exit code 1. -- |
March 20, 2023 [Issue 23513] ImportC doesn't export ncurses' attributes (C macros) | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23513 --- Comment #4 from Walter Bright <bugzilla@digitalmars.com> --- ImportC is currently only able to convert simple #defines to enums, i.e. ones that are only a single token, like: #define A 3 More complex ones are quite a bit more difficult to programmaticaly figure out what they are. One pragmatic approach is to prepare by hand a table of triples: 1. the file name 2. the contents of the macro 3. the hand-crafted D translation But, of course, this has its limits. -- |
December 02, 2023 [Issue 23513] ImportC doesn't export ncurses' attributes (C macros) | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23513 --- Comment #5 from Walter Bright <bugzilla@digitalmars.com> --- Progress: https://github.com/dlang/dmd/pull/15871 -- |
Copyright © 1999-2021 by the D Language Foundation