Announcement

Collapse
No announcement yet.

C enum, struct und union > Delphi

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • C enum, struct und union > Delphi

    Wie kann ich folgenden code in der Delphi Sprache übersetzen?

    enum AOP_Status {
    S_OK = 0,
    E_BSS = 1,
    W_BSS = 2,
    E_SSS = 3,
    W_SSS = 4,
    E_NOTOPEN = 13,
    E_DAC = 21,
    E_SECURITY = 41,
    E_LICENSE = 42,
    E_MISC = 99,
    };

    struct AOP_ValMap {
    AOP_DataType dtyp;
    union {
    struct {
    u_int aval_len;
    char *aval_val;
    } aval;
    struct {
    u_int sval_len;
    short *sval_val;
    } sval;
    struct {
    u_int fval_len;
    float *fval_val;
    } fval;
    struct {
    u_int lval_len;
    long *lval_val;
    } lval;
    struct {
    u_int dval_len;
    double *dval_val;
    } dval;
    struct {
    u_int bval_len;
    u_char *bval_val;
    } bval;
    struct {
    u_int tval_len;
    char *tval_val;
    } tval;
    struct {
    u_int cval_len;
    bstream *cval_val;
    } cval;
    Blob blob;
    } AOP_ValMap_u;
    };

    Danke

    Agustin Angeles

  • #2
    Fuer Delphi 6 kannst du das enum praktisch unveraendert uebernehmen, nur ein {$MINENUMSIZE 4} wird benoetigt, damit Delphi dem enum die gleiche Datentypgroesse gibt.<br>
    Eine union entspricht einem variant record. Ein struct ist ein record.<br>
    Poste doch bitte den C Code nochmal in PRE Tags

    Comment


    • #3
      Fuer Delphi 5 etc setze die Elemente des Enums in Konstanten um und AOP_Status als Typ DWORD

      Comment

      Working...
      X