Click here to Skip to main content
15,921,276 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Image sequence display in Dialog Pin
Hamid_RT22-Oct-06 1:28
Hamid_RT22-Oct-06 1:28 
QuestionElegant solution for alignment Pin
Andre xxxxxxx6-Oct-06 7:10
Andre xxxxxxx6-Oct-06 7:10 
AnswerRe: Elegant solution for alignment Pin
led mike6-Oct-06 8:39
led mike6-Oct-06 8:39 
GeneralRe: Elegant solution for alignment Pin
Andre xxxxxxx6-Oct-06 9:34
Andre xxxxxxx6-Oct-06 9:34 
GeneralRe: Elegant solution for alignment Pin
led mike6-Oct-06 9:37
led mike6-Oct-06 9:37 
GeneralRe: Elegant solution for alignment Pin
Andre xxxxxxx6-Oct-06 9:45
Andre xxxxxxx6-Oct-06 9:45 
GeneralRe: Elegant solution for alignment Pin
led mike6-Oct-06 11:03
led mike6-Oct-06 11:03 
AnswerRe: Elegant solution for alignment Pin
James Brown7-Oct-06 7:04
James Brown7-Oct-06 7:04 
The most elegant solution would be to use a custom compiler, which is used to generate reader+writer functions for each of your structures.

i.e. you define your structures in a separate file:

/* core_types.h */
struct TestStruct
{
char first;
short second;
};

your project has a separate build-step which compiles core_types.h and results in:

void write_struct_TestStruct(struct TestStruct *tptr)
{
write(serial_device, tptr->first);
write(serial_device, tptr->second);
}

...and similar routines for all other types you define. Its sorta like an IDL compiler (i.e. MIDL.EXE for Windows) but designed to target your serial device instead of RPC. The idea is, all of the code to write structures is created automatically from your structure definitions so you don't have to write+maintain it by hand. Your structures stay as 'pure C' for portability.

Lots of tools are available to help you build compilers like this, google for 'lexx', 'antlr' etc. All you need is to parse a subset of 'C' - just C declarations. Maybe even the UNIX 'cdecl' program would be a good starting point.

James





QuestionDebugger - Visualizer (VS2005) [modified] Pin
Abyss6-Oct-06 6:33
Abyss6-Oct-06 6:33 
QuestionChange color of dialog border Pin
vasmvr6-Oct-06 6:13
vasmvr6-Oct-06 6:13 
AnswerRe: Change color of dialog border Pin
Hamid_RT19-Oct-06 8:39
Hamid_RT19-Oct-06 8:39 
QuestionUninstall VS2003 SP1? Pin
Todd Smith6-Oct-06 5:52
Todd Smith6-Oct-06 5:52 
AnswerRe: Uninstall VS2003 SP1? Pin
David Crow6-Oct-06 6:03
David Crow6-Oct-06 6:03 
GeneralRe: Uninstall VS2003 SP1? Pin
Todd Smith6-Oct-06 6:07
Todd Smith6-Oct-06 6:07 
QuestionRuntime change MDI/SDI Pin
Endaroza6-Oct-06 5:28
Endaroza6-Oct-06 5:28 
AnswerRe: Runtime change MDI/SDI Pin
led mike6-Oct-06 5:49
led mike6-Oct-06 5:49 
GeneralRe: Runtime change MDI/SDI Pin
Mark Salsbery6-Oct-06 5:52
Mark Salsbery6-Oct-06 5:52 
AnswerRe: Runtime change MDI/SDI Pin
Mark Salsbery6-Oct-06 6:03
Mark Salsbery6-Oct-06 6:03 
GeneralRe: Runtime change MDI/SDI Pin
led mike6-Oct-06 7:15
led mike6-Oct-06 7:15 
GeneralRe: Runtime change MDI/SDI Pin
Mark Salsbery6-Oct-06 14:47
Mark Salsbery6-Oct-06 14:47 
AnswerRe: Runtime change MDI/SDI Pin
Andre xxxxxxx6-Oct-06 7:23
Andre xxxxxxx6-Oct-06 7:23 
AnswerRe: Runtime change MDI/SDI Pin
PJ Arends6-Oct-06 14:57
professionalPJ Arends6-Oct-06 14:57 
AnswerGOTCHA!!! Pin
Endaroza5-May-07 5:41
Endaroza5-May-07 5:41 
QuestionGetPixel Pin
Johpoke6-Oct-06 5:08
Johpoke6-Oct-06 5:08 
AnswerRe: GetPixel Pin
Mark Salsbery6-Oct-06 5:16
Mark Salsbery6-Oct-06 5:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.