cybop-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cybop-developers] CYBOI String Constants


From: Christian Heller
Subject: [cybop-developers] CYBOI String Constants
Date: Mon, 06 Mar 2017 20:42:29 +0100
User-agent: KMail/4.14.1 (Linux/3.16.0-4-686-pae; KDE/4.14.2; i686; ; )

Hi Enrico,

in early days I had written string constant values as array elements,
in order to avoid the string termination '\0' only polluting memory.

For example, see the current (OLD) state in file:
cybop/src/constant/name/cybol/super_cybol_name.c

/** The super cybol name. */
static wchar_t SUPER_CYBOL_NAME_ARRAY[] = {L's', L'u', L'p', L'e', L'r'};
static wchar_t* SUPER_CYBOL_NAME = SUPER_CYBOL_NAME_ARRAY;
static int* SUPER_CYBOL_NAME_COUNT = NUMBER_5_INTEGER_STATE_CYBOI_MODEL_ARRAY;

However, meanwhile students and me decided to write string literals
normally. This would mean to replace constant array values like
{L's', L'u', L'p', L'e', L'r'} with a string like L"super".

Example for (NEW) target state:

/** The super cybol name. */
static wchar_t* SUPER_CYBOL_NAME = L"super";
static int* SUPER_CYBOL_NAME_COUNT = NUMBER_5_INTEGER_STATE_CYBOI_MODEL_ARRAY;

Note:
- the first line (after the comment) gets deleted
- in the second line, the string L"super" gets inserted after the =
- mind the "L" prefix before the string, which is for wide characters
- the third line remains unchanged

To what concerns the task of changing constants to strings,
I had already edited the following directories myself:
cybop/src/constant/channel/
cybop/src/constant/encoding/
cybop/src/constant/format/
cybop/src/constant/language/
cybop/src/constant/type/

The following two are yet to be done:
cybop/src/constant/name/
cybop/src/constant/model/

So if you find the time to change these as described above,
I would be very happy since it would save me a lot of time.

CAUTION!
However, there are some rare exceptions, where a replacement is
NOT wanted, e.g. in sub directories:
cybop/src/constant/model/ansi_escape_code/
cybop/src/constant/model/character_code/
If you are unsure, just send me a list of those files that you are unsure
about and I tell you one-by-one, which ones to edit and which ones not.

Thanks
Christian





reply via email to

[Prev in Thread] Current Thread [Next in Thread]