Skip to content
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

generate java enum from C enum? generate both C and java from yaml? #2102

Closed
rusefillc opened this issue Dec 18, 2020 · 13 comments
Closed

generate java enum from C enum? generate both C and java from yaml? #2102

rusefillc opened this issue Dec 18, 2020 · 13 comments
Assignees

Comments

@rusefillc
Copy link
Contributor

at the moment in order to sync C and java enums we have the

#define ET_DODGE_NEON_1995 2
#define ET_FORD_ASPIRE 3
#define ET_FORD_FIESTA 4

in .txt while both C and java is generated

it would be more efficient to generate some java based on C .h header without .txt involvment

@rusefillc
Copy link
Contributor Author

we already read C .h see gen_enum_to_string.sh so some building pieces are already there

rusefillc pushed a commit that referenced this issue Dec 18, 2020
rusefillc pushed a commit that referenced this issue Dec 18, 2020
@rusefillc rusefillc changed the title generate java enum from C enum generate java enum from C enum? generate both C and java from yaml? Dec 31, 2020
@rusefillc
Copy link
Contributor Author

typedef enum {
	DEFAULT_FRANKENSO = ET_DEFAULT_FRANKENSO,
	/**
	 * 1995 Dodge Neon
	 * http://rusefi.com/forum/viewtopic.php?t=360
	 */
	DODGE_NEON_1995 = ET_DODGE_NEON_1995,
	/**
	 * 1996 1.3 Ford Aspire
	 * http://rusefi.com/forum/viewtopic.php?t=375
	 */
	FORD_ASPIRE_1996 = ET_FORD_ASPIRE,

	NISSAN_PRIMERA = 5,
	HONDA_ACCORD_CD = 6,

@chuckwagoncomputing
Copy link
Member

Just to be clear, we decided that we want to generate the Java enum from the C enum, and not have a .yaml. Is that correct?

@rusefillc
Copy link
Contributor Author

yes, not yaml as source but C

@rusefillc
Copy link
Contributor Author

but that leaves question of how to define human-readable TS literals

@chuckwagoncomputing
Copy link
Member

What about writing C from the info from rusefi_config.txt?

@chuckwagoncomputing
Copy link
Member

We are already writing rusefi_generated.h. Does that not contain all the information that C needs, just not in an enum?

@rusefillc
Copy link
Contributor Author

text has horrible by index management, it's a nightmare to support

@mck1117 @andreika-git ideas?

@chuckwagoncomputing
Copy link
Member

Where are the TS engine types currently? I see the trigger type names in rusefi_config.txt, but not engine type names.

@rusefillc
Copy link
Contributor Author

engine types not in TS, I was talking generally

output pins would be a case of scary enum drama for TS >> C mapping

@chuckwagoncomputing
Copy link
Member

So you are interested in reading more things from C and removing them from rusefi_config.txt, and want to follow the same pattern?

@rusefillc
Copy link
Contributor Author

there is clearly a problem with manual sync of entities but also no great solution at the moment

I am not happy with yaml as source of truth here, my preference is C as source of enums

but literals are needed, maybe extend java enum reader to parse

VAL/name=Value/=3,

rusefillc pushed a commit that referenced this issue Oct 23, 2021
rusefillc pushed a commit that referenced this issue Oct 23, 2021
@rusefillc
Copy link
Contributor Author

Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants