/* Chrysalide - Outil d'analyse de fichiers binaires
* immediate.h - prototypes pour les opérandes représentant des valeurs numériques
*
* Copyright (C) 2020-2024 Cyrille Bagard
*
* This file is part of Chrysalide.
*
* Chrysalide is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Chrysalide is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Chrysalide. If not, see .
*/
#ifndef _ARCH_OPERANDS_IMMEDIATE_H
#define _ARCH_OPERANDS_IMMEDIATE_H
#include
#include
#include "../operand.h"
#include "../../analysis/content.h"
#include "../../common/datatypes.h"
#include "../../glibext/helpers.h"
#define G_TYPE_IMMEDIATE_OPERAND (g_immediate_operand_get_type())
DECLARE_GTYPE(GImmediateOperand, g_immediate_operand, G, IMMEDIATE_OPERAND);
/* Etats particuliers d'un opérande de valeur immédiate */
typedef enum _ImmOpFlag
{
IOF_ZERO_PADDING_BY_DEFAULT = AOF_USER_FLAG(0), /* Bourrage avec 0 par défaut ?*/
IOF_ZERO_PADDING = AOF_USER_FLAG(1), /* Bourrage avec 0 ? */
} ImmOpFlag;
/* Grande ligne d'un format d'affichage */
typedef enum _ImmOperandDisplay
{
IOD_BIN, /* Impression en binaire */
IOD_OCT, /* Impression en octal */
IOD_DEC, /* Impression en décimal */
IOD_HEX, /* Impression en hexadécimal */
IOD_CHAR, /* Impression en base 26 */
IOD_COUNT
} ImmOperandDisplay;
/* Crée un opérande réprésentant une valeur numérique. */
GArchOperand *g_immediate_operand_new_from_value(MemoryDataSize, uint64_t);
/* Crée un opérande réprésentant une valeur numérique. */
GArchOperand *g_immediate_operand_new_from_data(MemoryDataSize, const GBinContent *, vmpa2t *, bool *, SourceEndian);
/* Renseigne la taille de la valeur indiquée à la construction. */
MemoryDataSize g_immediate_operand_get_size(const GImmediateOperand *);
/* Fournit la valeur portée par une opérande numérique. */
bool g_immediate_operand_get_value(const GImmediateOperand *, MemoryDataSize, ...);
/* Définit la nouvelle valeur de l'opérande à une valeur. */
void g_immediate_operand_set_value(GImmediateOperand *, MemoryDataSize, uint64_t);
/* Fournit la valeur brute représentée par l'opérande. */
uint64_t g_immediate_operand_get_raw_value(const GImmediateOperand *);
/* Indique le signe d'une valeur immédiate. */
bool g_immediate_operand_is_negative(const GImmediateOperand *);
/* Définit le format textuel par défaut de la valeur. */
void g_immediate_operand_set_default_display(GImmediateOperand *, ImmOperandDisplay);
/* Indique le format textuel par défaut de la valeur. */
ImmOperandDisplay g_immediate_operand_get_default_display(const GImmediateOperand *);
/* Définit la grande ligne du format textuel de la valeur. */
void g_immediate_operand_set_display(GImmediateOperand *, ImmOperandDisplay);
/* Indique la grande ligne du format textuel de la valeur. */
ImmOperandDisplay g_immediate_operand_get_display(const GImmediateOperand *);
#endif /* _ARCH_OPERANDS_IMMEDIATE_H */