1

Let's say I have this kind of string information:

/*
    There are a total of 10 entries in the algebraic variable array.
    There are a total of 4 entries in each of the rate and state variable arrays.
    There are a total of 8 entries in the constant variable array.
*/
    #include "HEADER_NAME"        // change it according to your actual header name

/*
 * TIME is time in component environment (millisecond).
 * NV_Ith_S(STATES,0) is V in component membrane (millivolt).
 * CONSTANTS[0] is E_R in component membrane (millivolt).
 * CONSTANTS[1] is Cm in component membrane (microF_per_cm2).
 * ALGEBRAIC[4] is i_Na in component sodium_channel (microA_per_cm2).
 * ALGEBRAIC[8] is i_K in component potassium_channel (microA_per_cm2).
 * ALGEBRAIC[9] is i_L in component leakage_current (microA_per_cm2).
 * ALGEBRAIC[0] is i_Stim in component membrane (microA_per_cm2).
 * CONSTANTS[2] is g_Na in component sodium_channel (milliS_per_cm2).
 * CONSTANTS[5] is E_Na in component sodium_channel (millivolt).
 * NV_Ith_S(STATES,1) is m in component sodium_channel_m_gate (dimensionless).
 * NV_Ith_S(STATES,2) is h in component sodium_channel_h_gate (dimensionless).
 * ALGEBRAIC[1] is alpha_m in component sodium_channel_m_gate (per_millisecond).
 * ALGEBRAIC[5] is beta_m in component sodium_channel_m_gate (per_millisecond).
 * ALGEBRAIC[2] is alpha_h in component sodium_channel_h_gate (per_millisecond).
 * ALGEBRAIC[6] is beta_h in component sodium_channel_h_gate (per_millisecond).
 * CONSTANTS[3] is g_K in component potassium_channel (milliS_per_cm2).
 * CONSTANTS[6] is E_K in component potassium_channel (millivolt).
 * NV_Ith_S(STATES,3) is n in component potassium_channel_n_gate (dimensionless).
 * ALGEBRAIC[3] is alpha_n in component potassium_channel_n_gate (per_millisecond).
 * ALGEBRAIC[7] is beta_n in component potassium_channel_n_gate (per_millisecond).
 * CONSTANTS[4] is g_L in component leakage_current (milliS_per_cm2).
 * CONSTANTS[7] is E_L in component leakage_current (millivolt).
 * NV_Ith_S(RATES,0) is d/dt V in component membrane (millivolt).
 * NV_Ith_S(RATES,1) is d/dt m in component sodium_channel_m_gate (dimensionless).
 * NV_Ith_S(RATES,2) is d/dt h in component sodium_channel_h_gate (dimensionless).
 * NV_Ith_S(RATES,3) is d/dt n in component potassium_channel_n_gate (dimensionless).
 */

The first 3 numbers are the size of each respective arrays.

The long description after that are the indices and the name label of each array (assume ALGEBRAIC, STATES, CONSTANTS, and RATES are arrays)

How can I store this information into an array of map or something like that in ANSI-C? I know that we don't have Map in ANSI-C, but I want to know whether we can extract those information from this string into an array of list or not.

Already tried using REGEX, but still failed.

0 Answers0