My approach. The core is the engine. - page 11

 
Vasiliy Sokolov:

OK, let's say you have a number under the name (wild, of course, but let's say it is). But each button has a caption, a text, for example "Cancel" or something like that. How do you specify this property? Right:

I was going to look into this further.

Very simple. We make an array of

string Button_names[] = {"Cancel", "Ok", "Hello World!"...};

We loop through the main kernel and arrange the indexes of the text cells in it.

 
Реter Konow:

It means that the size of the kernel must match the number of properties of the object. If you change the number of properties and do not change the size of the kernel, you will be out of the array.

So, while you are writing code, you should control that the number of properties and the size of the kernel coincide everywhere.

...

You are a real monster :) You make your own problems and solve them. :)

If you were to abandon this "heresy" and embrace the OOP "religion". :) Then you would have found a way to make everything much simpler, more flexible and expandable.

 
Vitalii Ananev:

That is, as you write your code, you must constantly check that the number of properties and the size of the kernel are the same everywhere.


What is the problem with controlling? We add a property and increase the size of the kernel rows. That is all.

 

And by the way, even this code won't compile for you. Here you are creating a 3x10 two-dimensional array:

int P_CORE[3][10] = {
//Основание кнопки.-----------------------------
//
//1)NAME   2)TYPE  3)ELEMENT    4)X    5)Y     6)X_SIZE  7)Y_SIZE       8)COLOR
//----------------------------------------------
{ 100001,  base,  button,    100, 100,    200,    50,    C'245,245,245'}, 
//---------------------------------------------- 
//Текст кнопки.---------------------------------
//
//NAME    TYPE   ELEMENT   X    Y     X_SIZE  Y_SIZE       COLOR 
//----------------------------------------------
{100002,  text,  button,  120, 120,     0,      0,       C'245,0,0'},
//---------------------------------------------- 
//Иконка кнопки.-------------------------------- 
//
//NAME    TYPE     ELEMENT   X    Y     X_SIZE  Y_SIZE       COLOR 
{100003,  icon,    button,  140, 140,     16,     16,           0},

Even though you only have eight properties to define.

Then you do a search again for 10 properties:

#define  All_objects     30
#define  All_properties  10
//Далее, строим G_CORE:
//--------------------------------------
int q = 0;
//--------------
for(int a1 = 0; a1 < All_objects; a1++)
  {
   for(int a2 = 0; a2 < All_properties; a2++)
    {
     G_CORE[a1][a2] = P_CORE[q][a2];
    }
     q++;
     if(q == 3)q = 0;    
  }

What does that even mean?

 
Vasiliy Sokolov:

And by the way, even this code won't compile for you. Here you are creating a 3x10 two-dimensional array:

Even though you only have eight properties to define.

Then you do a search again for 10 properties:

What does that even mean?

This is just an example. Not for compilation.

 
Реter Konow:

This is just an example. Not for compilation.

Oh, yeah. So you're trying to explain your code to us with a non-working example.

 
Vasiliy Sokolov:

Oh, boy. So you're trying to explain your code to us, using examples that don't really work.

I'm not explaining the code, I'm explaining the approach.

 
Реter Konow:

Not the kernel, the engine. The core is simply an array of data.

It communicates via EventChartCustom();

Yeah, sorry. I get confused all the time. Core and engine sound equivalent. The terminology is unfortunate in my opinion.
Peter, please draw in any graphic editor, at least some block diagram with kernel, engine, program body and arrows between them, indicating the ways of interaction (where through global variables of the terminal, where through files, where through user interrupts, where through resources, where through the indicator buffer, etc.). It's just that I'm a visualist (I think I'm not the only one), not an audialist, and in this jungle of words I get lost and my puzzles don't fit together.
 
For those who are actually interested, I'll continue later. For now, it's a break.
 
Nikolai Semko:
Yeah, sorry. I keep getting confused. Kernel and engine sound the same. The terminology is unfortunate in my opinion.
Peter, please draw in any graphical editor at least some block diagram with kernel, engine, program body and arrows between them with indication of interaction methods (where through global variables of terminal, where through files, where through user interrupts, where through resources, where through indicator buffer, etc.). It's just that I'm a visualist (I think I'm not the only one) rather than an audialist, and in this jungle of words I get lost and my puzzles don't add up.

The kernel is an array. The engine is the code.

I'll draw it.