diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/format/strsym.c | 41 | ||||
| -rw-r--r-- | src/format/strsym.h | 3 | 
2 files changed, 44 insertions, 0 deletions
diff --git a/src/format/strsym.c b/src/format/strsym.c index b60bd02..073e77f 100644 --- a/src/format/strsym.c +++ b/src/format/strsym.c @@ -220,6 +220,47 @@ GBinSymbol *g_string_symbol_new_read_only(GBinFormat *format, const mrange_t *ra  /******************************************************************************  *                                                                             * +*  Paramètres  : string   = contenu de la chaîne de caractères.               * +*                addr     = emplacement de cette chaîne virtuelle.            * +*                encoding = encodage de la chaîne de caractères à représenter.* +*                                                                             * +*  Description : Crée un nouveau symbole pour chaîne de caractères.           * +*                                                                             * +*  Retour      : Adresse de l'instance mise en place ou NULL en cas d'échec.  * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GBinSymbol *g_string_symbol_new_dynamic(const char *string, const vmpa2t *addr, StringEncodingType encoding) +{ +    GStrSymbol *result;                     /* Nouveau symbole à renvoyer  */ +    GBinSymbol *parent;                     /* Type d'instance parent      */ +    mrange_t range;                         /* Emplacement à constituer    */ + +    result = g_object_new(G_TYPE_STR_SYMBOL, NULL); + +    parent = G_BIN_SYMBOL(result); + +    init_mrange(&range, addr, strlen(string)); + +    g_binary_symbol_set_range(parent, &range); +    g_binary_symbol_set_target_type(parent, STP_DYN_STRING); + +    result->encoding = encoding; + +    result->string = strdup(string); +    result->has_content = false; + +    g_string_symbol_check_encoding(result); + +    return G_BIN_SYMBOL(result); + +} + + +/****************************************************************************** +*                                                                             *  *  Paramètres  : symbol = symbole à venir consulter.                          *  *                                                                             *  *  Description : Vérifie la pertinence de l'encodage attribué à une chaîne.   * diff --git a/src/format/strsym.h b/src/format/strsym.h index b3c7a44..eef5e9b 100644 --- a/src/format/strsym.h +++ b/src/format/strsym.h @@ -69,6 +69,9 @@ GType g_string_symbol_get_type(void);  /* Crée un nouveau symbole pour chaîne de caractères. */  GBinSymbol *g_string_symbol_new_read_only(GBinFormat *, const mrange_t *, StringEncodingType); +/* Crée un nouveau symbole pour chaîne de caractères. */ +GBinSymbol *g_string_symbol_new_dynamic(const char *, const vmpa2t *, StringEncodingType); +  /* Fournit l'encodage d'une chaîne de caractères. */  StringEncodingType g_string_symbol_get_encoding(const GStrSymbol *);  | 
