[segyio] 177/376: Namespace enums.

Jørgen Kvalsvik jokva-guest at moszumanska.debian.org
Wed Sep 20 08:04:28 UTC 2017


This is an automated email from the git hooks/post-receive script.

jokva-guest pushed a commit to branch debian
in repository segyio.

commit 1d37e3e9c32f9c5576620c70b5bcc8ca6bec797b
Author: Jørgen Kvalsvik <jokva at statoil.com>
Date:   Wed Feb 15 09:47:30 2017 +0100

    Namespace enums.
    
    Prefixes the enums with SEGY_, so that they no longer introduce
    potential name conflicts with common local variables. All enums and
    other global constants are now underscore-separated all-caps
    identifiers.
    
    A consequence of this namespacing is that identifiers become *very* long
    and verbose, but on the flipside it makes it rather clear when something
    is a aliased constant. The worst offender is offset (field 37 in trace
    headers) which is a commonly used name for local variables.
---
 applications/segyinfo.c    |  14 +--
 applications/segyinspect.c |  24 ++--
 lib/include/segyio/segy.h  | 270 ++++++++++++++++++++--------------------
 lib/src/segy.c             | 302 ++++++++++++++++++++++-----------------------
 lib/test/segy.c            |  50 ++++----
 mex/segy_get_traces_mex.c  |   2 +-
 mex/segyutil.c             |   4 +-
 python/segyio/_segyio.c    |   4 +-
 8 files changed, 333 insertions(+), 337 deletions(-)

diff --git a/applications/segyinfo.c b/applications/segyinfo.c
index 343bc1a..edf9db0 100644
--- a/applications/segyinfo.c
+++ b/applications/segyinfo.c
@@ -8,10 +8,10 @@
 
 static void printSegyTraceInfo( const char* buf ) {
     int cdp, tsf, xl, il;
-    segy_get_field( buf, CDP, &cdp );
-    segy_get_field( buf, TRACE_SEQUENCE_FILE, &tsf );
-    segy_get_field( buf, CROSSLINE_3D, &xl );
-    segy_get_field( buf, INLINE_3D, &il );
+    segy_get_field( buf, SEGY_TR_ENSEMBLE, &cdp );
+    segy_get_field( buf, SEGY_TR_SEQ_FILE, &tsf );
+    segy_get_field( buf, SEGY_TR_CROSSLINE, &xl );
+    segy_get_field( buf, SEGY_TR_INLINE, &il );
 
     printf("cdp:               %d\n", cdp );
     printf("TraceSequenceFile: %d\n", tsf );
@@ -53,7 +53,7 @@ int main(int argc, char* argv[]) {
     const long trace0 = segy_trace0( header );
     const unsigned int trace_bsize = segy_trace_bsize( samples );
     int extended_headers;
-    err = segy_get_bfield( header, BIN_ExtendedHeaders, &extended_headers );
+    err = segy_get_bfield( header, SEGY_BIN_EXT_HEADERS, &extended_headers );
 
     if( err != 0 ) {
         perror( "Can't read 'extended headers' field from binary header" );
@@ -111,10 +111,10 @@ int main(int argc, char* argv[]) {
         }
 
         int sample_count;
-        err = segy_get_field( traceh, TRACE_SAMPLE_COUNT, &sample_count );
+        err = segy_get_field( traceh, SEGY_TR_SAMPLE_COUNT, &sample_count );
 
         if( err != 0 ) {
-            fprintf( stderr, "Invalid trace header field: %d\n", TRACE_SAMPLE_COUNT );
+            fprintf( stderr, "Invalid trace header field: %d\n", SEGY_TR_SAMPLE_COUNT );
             exit( err );
         }
 
diff --git a/applications/segyinspect.c b/applications/segyinspect.c
index 30ca5da..1dd7332 100644
--- a/applications/segyinspect.c
+++ b/applications/segyinspect.c
@@ -7,21 +7,21 @@
 
 static const char* getSampleFormatName( int format ) {
     switch( format ) {
-        case IBM_FLOAT_4_BYTE:
+        case SEGY_IBM_FLOAT_4_BYTE:
             return "IBM Float";         
-        case SIGNED_INTEGER_4_BYTE:
+        case SEGY_SIGNED_INTEGER_4_BYTE:
             return "Int 32";         
-        case SIGNED_SHORT_2_BYTE:
+        case SEGY_SIGNED_SHORT_2_BYTE:
             return "Int 16";         
-        case FIXED_POINT_WITH_GAIN_4_BYTE:
+        case SEGY_FIXED_POINT_WITH_GAIN_4_BYTE:
             return "Fixed Point with gain (Obsolete)";         
-        case IEEE_FLOAT_4_BYTE:
+        case SEGY_IEEE_FLOAT_4_BYTE:
             return "IEEE Float";         
-        case NOT_IN_USE_1:
+        case SEGY_NOT_IN_USE_1:
             return "Not in Use 1";         
-        case NOT_IN_USE_2:
+        case SEGY_NOT_IN_USE_2:
             return "Not in Use 2";         
-        case SIGNED_CHAR_1_BYTE:
+        case SEGY_SIGNED_CHAR_1_BYTE:
             return "Int 8";         
         default:
             return "Unknown";
@@ -29,7 +29,7 @@ static const char* getSampleFormatName( int format ) {
 }
 
 static const char* getFastestDirectionName( int sorting ) {
-    if ( sorting == CROSSLINE_SORTING) {
+    if ( sorting == SEGY_CROSSLINE_SORTING) {
         return "CROSSLINE";
     } else {
         return "INLINE_SORTING";
@@ -45,8 +45,8 @@ int main(int argc, char* argv[]) {
         exit(1);
     }
 
-    int xl_field = CROSSLINE_3D;
-    int il_field = INLINE_3D;
+    int xl_field = SEGY_TR_CROSSLINE;
+    int il_field = SEGY_TR_INLINE;
 
     bool memory_map = argc > 2 && strcmp( argv[ 2 ], "mmap" ) == 0;
 
@@ -102,7 +102,7 @@ int main(int argc, char* argv[]) {
     }
 
     unsigned int inline_count, crossline_count;
-    if( sorting == INLINE_SORTING ) {
+    if( sorting == SEGY_INLINE_SORTING ) {
         err = segy_count_lines( fp, xl_field, offsets, &inline_count, &crossline_count, trace0, trace_bsize );
     } else {
         err = segy_count_lines( fp, il_field, offsets, &crossline_count, &inline_count, trace0, trace_bsize );
diff --git a/lib/include/segyio/segy.h b/lib/include/segyio/segy.h
index 3d2a576..eb6f13b 100644
--- a/lib/include/segyio/segy.h
+++ b/lib/include/segyio/segy.h
@@ -265,151 +265,149 @@ int segy_crossline_stride( int sorting,
                            unsigned int* stride );
 
 typedef enum {
-    TRACE_SEQUENCE_LINE = 1,
-    TRACE_SEQUENCE_FILE = 5,
-    FieldRecord = 9,
-    TraceNumber = 13,
-    EnergySourcePoint = 17,
-    CDP = 21,
-    CDP_TRACE = 25,
-    TraceIdentificationCode = 29,
-    NSummedTraces = 31,
-    NStackedTraces = 33,
-    DataUse = 35,
-    offset = 37,
-    ReceiverGroupElevation = 41,
-    SourceSurfaceElevation = 45,
-    SourceDepth = 49,
-    ReceiverDatumElevation = 53,
-    SourceDatumElevation = 57,
-    SourceWaterDepth = 61,
-    GroupWaterDepth = 65,
-    ElevationScalar = 69,
-    SourceGroupScalar = 71,
-    SourceX = 73,
-    SourceY = 77,
-    GroupX = 81,
-    GroupY = 85,
-    CoordinateUnits = 89,
-    WeatheringVelocity = 91,
-    SubWeatheringVelocity = 93,
-    SourceUpholeTime = 95,
-    GroupUpholeTime = 97,
-    SourceStaticCorrection = 99,
-    GroupStaticCorrection = 101,
-    TotalStaticApplied = 103,
-    LagTimeA = 105,
-    LagTimeB = 107,
-    DelayRecordingTime = 109,
-    MuteTimeStart = 111,
-    MuteTimeEND = 113,
-    TRACE_SAMPLE_COUNT = 115,
-    TRACE_SAMPLE_INTERVAL = 117,
-    GainType = 119,
-    InstrumentGainConstant = 121,
-    InstrumentInitialGain = 123,
-    Correlated = 125,
-    SweepFrequencyStart = 127,
-    SweepFrequencyEnd = 129,
-    SweepLength = 131,
-    SweepType = 133,
-    SweepTraceTaperLengthStart = 135,
-    SweepTraceTaperLengthEnd = 137,
-    TaperType = 139,
-    AliasFilterFrequency = 141,
-    AliasFilterSlope = 143,
-    NotchFilterFrequency = 145,
-    NotchFilterSlope = 147,
-    LowCutFrequency = 149,
-    HighCutFrequency = 151,
-    LowCutSlope = 153,
-    HighCutSlope = 155,
-    YearDataRecorded = 157,
-    DayOfYear = 159,
-    HourOfDay = 161,
-    MinuteOfHour = 163,
-    SecondOfMinute = 165,
-    TimeBaseCode = 167,
-    TraceWeightingFactor = 169,
-    GeophoneGroupNumberRoll1 = 171,
-    GeophoneGroupNumberFirstTraceOrigField = 173,
-    GeophoneGroupNumberLastTraceOrigField = 175,
-    GapSize = 177,
-    OverTravel = 179,
-    CDP_X = 181,
-    CDP_Y = 185,
-    INLINE_3D = 189,
-    CROSSLINE_3D = 193,
-    ShotPoint = 197,
-    ShotPointScalar = 201,
-    TraceValueMeasurementUnit = 203,
-    TransductionConstantMantissa = 205,
-    TransductionConstantPower = 209,
-    TransductionUnit = 211,
-    TraceIdentifier = 213,
-    ScalarTraceHeader = 215,
-    SourceType = 217,
-    SourceEnergyDirectionMantissa = 219,
-    SourceEnergyDirectionExponent = 223,
-    SourceMeasurementMantissa = 225,
-    SourceMeasurementExponent = 229,
-    SourceMeasurementUnit = 231,
-    UnassignedInt1 = 233,
-    UnassignedInt2 = 237
-
+    SEGY_TR_SEQ_LINE                = 1,
+    SEGY_TR_SEQ_FILE                = 5,
+    SEGY_TR_FIELD_RECORD            = 9,
+    SEGY_TR_NUMBER_ORIG_FIELD       = 13,
+    SEGY_TR_ENERGY_SOURCE_POINT     = 17,
+    SEGY_TR_ENSEMBLE                = 21,
+    SEGY_TR_NUM_IN_ENSEMBLE         = 25,
+    SEGY_TR_TRACE_ID                = 29,
+    SEGY_TR_SUMMED_TRACES           = 31,
+    SEGY_TR_STACKED_TRACES          = 33,
+    SEGY_TR_DATA_USE                = 35,
+    SEGY_TR_OFFSET                  = 37,
+    SEGY_TR_RECV_GROUP_ELEV         = 41,
+    SEGY_TR_SOURCE_SURF_ELEV        = 45,
+    SEGY_TR_SOURCE_DEPTH            = 49,
+    SEGY_TR_RECV_DATUM_ELEV         = 53,
+    SEGY_TR_SOURCE_DATUM_ELEV       = 57,
+    SEGY_TR_SOURCE_WATER_DEPTH      = 61,
+    SEGY_TR_GROUP_WATER_DEPTH       = 65,
+    SEGY_TR_ELEV_SCALAR             = 69,
+    SEGY_TR_SOURCE_GROUP_SCALAR     = 71,
+    SEGY_TR_SOURCE_X                = 73,
+    SEGY_TR_SOURCE_Y                = 77,
+    SEGY_TR_GROUP_X                 = 81,
+    SEGY_TR_GROUP_Y                 = 85,
+    SEGY_TR_COORD_UNITS             = 89,
+    SEGY_TR_WEATHERING_VELO         = 91,
+    SEGY_TR_SUBWEATHERING_VELO      = 93,
+    SEGY_TR_SOURCE_UPHOLE_TIME      = 95,
+    SEGY_TR_GROUP_UPHOLE_TIME       = 97,
+    SEGY_TR_SOURCE_STATIC_CORR      = 99,
+    SEGY_TR_GROUP_STATIC_CORR       = 101,
+    SEGY_TR_TOT_STATIC_APPLIED      = 103,
+    SEGY_TR_LAG_A                   = 105,
+    SEGY_TR_LAG_B                   = 107,
+    SEGY_TR_DELAY_REC_TIME          = 109,
+    SEGY_TR_MUTE_TIME_START         = 111,
+    SEGY_TR_MUTE_TIME_END           = 113,
+    SEGY_TR_SAMPLE_COUNT            = 115,
+    SEGY_TR_SAMPLE_INTER            = 117,
+    SEGY_TR_GAIN_TYPE               = 119,
+    SEGY_TR_INSTR_GAIN_CONST        = 121,
+    SEGY_TR_INSTR_INIT_GAIN         = 123,
+    SEGY_TR_CORRELATED              = 125,
+    SEGY_TR_SWEEP_FREQ_START        = 127,
+    SEGY_TR_SWEEP_FREQ_END          = 129,
+    SEGY_TR_SWEEP_LENGTH            = 131,
+    SEGY_TR_SWEEP_TYPE              = 133,
+    SEGY_TR_SWEEP_TAPERLEN_START    = 135,
+    SEGY_TR_SWEEP_TAPERLEN_END      = 137,
+    SEGY_TR_TAPER_TYPE              = 139,
+    SEGY_TR_ALIAS_FILT_FREQ         = 141,
+    SEGY_TR_ALIAS_FILT_SLOPE        = 143,
+    SEGY_TR_NOTCH_FILT_FREQ         = 145,
+    SEGY_TR_NOTCH_FILT_SLOPE        = 147,
+    SEGY_TR_LOW_CUT_FREQ            = 149,
+    SEGY_TR_HIGH_CUT_FREQ           = 151,
+    SEGY_TR_LOW_CUT_SLOPE           = 153,
+    SEGY_TR_HIGH_CUT_SLOPE          = 155,
+    SEGY_TR_YEAR_DATA_REC           = 157,
+    SEGY_TR_DAY_OF_YEAR             = 159,
+    SEGY_TR_HOUR_OF_DAY             = 161,
+    SEGY_TR_MIN_OF_HOUR             = 163,
+    SEGY_TR_SEC_OF_MIN              = 165,
+    SEGY_TR_TIME_BASE_CODE          = 167,
+    SEGY_TR_WEIGHTING_FAC           = 169,
+    SEGY_TR_GEOPHONE_GROUP_ROLL1    = 171,
+    SEGY_TR_GEOPHONE_GROUP_FIRST    = 173,
+    SEGY_TR_GEOPHONE_GROUP_LAST     = 175,
+    SEGY_TR_GAP_SIZE                = 177,
+    SEGY_TR_OVER_TRAVEL             = 179,
+    SEGY_TR_CDP_X                   = 181,
+    SEGY_TR_CDP_Y                   = 185,
+    SEGY_TR_INLINE                  = 189,
+    SEGY_TR_CROSSLINE               = 193,
+    SEGY_TR_SHOT_POINT              = 197,
+    SEGY_TR_SHOT_POINT_SCALAR       = 201,
+    SEGY_TR_MEASURE_UNIT            = 203,
+    SEGY_TR_TRANSDUCTION_MANT       = 205,
+    SEGY_TR_TRANSDUCTION_EXP        = 209,
+    SEGY_TR_TRANSDUCTION_UNIT       = 211,
+    SEGY_TR_DEVICE_ID               = 213,
+    SEGY_TR_SCALAR_TRACE_HEADER     = 215,
+    SEGY_TR_SOURCE_TYPE             = 217,
+    SEGY_TR_SOURCE_ENERGY_DIR_MANT  = 219,
+    SEGY_TR_SOURCE_ENERGY_DIR_EXP   = 223,
+    SEGY_TR_SOURCE_MEASURE_MANT     = 225,
+    SEGY_TR_SOURCE_MEASURE_EXP      = 229,
+    SEGY_TR_SOURCE_MEASURE_UNIT     = 231,
+    SEGY_TR_UNASSIGNED1             = 233,
+    SEGY_TR_UNASSIGNED2             = 237
 } SEGY_FIELD;
 
 typedef enum {
-    BIN_JobID = 3201,
-    BIN_LineNumber = 3205,
-    BIN_ReelNumber = 3209,
-    BIN_Traces = 3213,
-    BIN_AuxTraces = 3215,
-    BIN_Interval = 3217,
-    BIN_IntervalOriginal = 3219,
-    BIN_Samples = 3221,
-    BIN_SamplesOriginal = 3223,
-    BIN_Format = 3225,
-    BIN_EnsembleFold = 3227,
-    BIN_SortingCode = 3229,
-    BIN_VerticalSum = 3231,
-    BIN_SweepFrequencyStart = 3233,
-    BIN_SweepFrequencyEnd = 3235,
-    BIN_SweepLength = 3237,
-    BIN_Sweep = 3239,
-    BIN_SweepChannel = 3241,
-    BIN_SweepTaperStart = 3243,
-    BIN_SweepTaperEnd = 3245,
-    BIN_Taper = 3247,
-    BIN_CorrelatedTraces = 3249,
-    BIN_BinaryGainRecovery = 3251,
-    BIN_AmplitudeRecovery = 3253,
-    BIN_MeasurementSystem = 3255,
-    BIN_ImpulseSignalPolarity = 3257,
-    BIN_VibratoryPolarity = 3259,
-    BIN_Unassigned1 = 3261,
-    BIN_SEGYRevision = 3501,
-    BIN_TraceFlag = 3503,
-    BIN_ExtendedHeaders = 3505,
-    BIN_Unassigned2 = 3507,
+    SEGY_BIN_JOB_ID                 = 3201,
+    SEGY_BIN_LINE_NUMBER            = 3205,
+    SEGY_BIN_REEL_NUMBER            = 3209,
+    SEGY_BIN_TRACES                 = 3213,
+    SEGY_BIN_AUX_TRACES             = 3215,
+    SEGY_BIN_INTERVAL               = 3217,
+    SEGY_BIN_INTERVAL_ORIG          = 3219,
+    SEGY_BIN_SAMPLES                = 3221,
+    SEGY_BIN_SAMPLES_ORIG           = 3223,
+    SEGY_BIN_FORMAT                 = 3225,
+    SEGY_BIN_ENSEMBLE_FOLD          = 3227,
+    SEGY_BIN_SORTING_CODE           = 3229,
+    SEGY_BIN_VERTICAL_SUM           = 3231,
+    SEGY_BIN_SWEEP_FREQ_START       = 3233,
+    SEGY_BIN_SWEEP_FREQ_END         = 3235,
+    SEGY_BIN_SWEEP_LENGTH           = 3237,
+    SEGY_BIN_SWEEP                  = 3239,
+    SEGY_BIN_SWEEP_CHANNEL          = 3241,
+    SEGY_BIN_SWEEP_TAPER_START      = 3243,
+    SEGY_BIN_SWEEP_TAPER_END        = 3245,
+    SEGY_BIN_TAPER                  = 3247,
+    SEGY_BIN_CORRELATED_TRACES      = 3249,
+    SEGY_BIN_BIN_GAIN_RECOVERY      = 3251,
+    SEGY_BIN_AMPLITUDE_RECOVERY     = 3253,
+    SEGY_BIN_MEASUREMENT_SYSTEM     = 3255,
+    SEGY_BIN_IMPULSE_POLARITY       = 3257,
+    SEGY_BIN_VIBRATORY_POLARITY     = 3259,
+    SEGY_BIN_UNASSIGNED1            = 3261,
+    SEGY_BIN_SEGY_REVISION          = 3501,
+    SEGY_BIN_TRACE_FLAG             = 3503,
+    SEGY_BIN_EXT_HEADERS            = 3505,
+    SEGY_BIN_UNASSIGNED2            = 3507,
 } SEGY_BINFIELD;
 
 typedef enum {
-    IBM_FLOAT_4_BYTE = 1,
-    SIGNED_INTEGER_4_BYTE = 2,
-    SIGNED_SHORT_2_BYTE = 3,
-    FIXED_POINT_WITH_GAIN_4_BYTE = 4, // Obsolete
-    IEEE_FLOAT_4_BYTE = 5,
-    NOT_IN_USE_1 = 6,
-    NOT_IN_USE_2 = 7,
-    SIGNED_CHAR_1_BYTE = 8
+    SEGY_IBM_FLOAT_4_BYTE = 1,
+    SEGY_SIGNED_INTEGER_4_BYTE = 2,
+    SEGY_SIGNED_SHORT_2_BYTE = 3,
+    SEGY_FIXED_POINT_WITH_GAIN_4_BYTE = 4, // Obsolete
+    SEGY_IEEE_FLOAT_4_BYTE = 5,
+    SEGY_NOT_IN_USE_1 = 6,
+    SEGY_NOT_IN_USE_2 = 7,
+    SEGY_SIGNED_CHAR_1_BYTE = 8
 } SEGY_FORMAT;
 
 typedef enum {
-    UNKNOWN_SORTING = 0,
-    CROSSLINE_SORTING = 1,
-    INLINE_SORTING = 2,
-
+    SEGY_UNKNOWN_SORTING = 0,
+    SEGY_CROSSLINE_SORTING = 1,
+    SEGY_INLINE_SORTING = 2,
 } SEGY_SORTING;
 
 typedef enum {
diff --git a/lib/src/segy.c b/lib/src/segy.c
index b33c950..b3975ff 100644
--- a/lib/src/segy.c
+++ b/lib/src/segy.c
@@ -161,98 +161,98 @@ done:
 
 /* Lookup table for field sizes. All values not explicitly set are 0 */
 static int field_size[] = {
-    [CDP]                                     =  4,
-    [CDP_TRACE]                               =  4,
-    [CDP_X]                                   =  4,
-    [CDP_Y]                                   =  4,
-    [CROSSLINE_3D]                            =  4,
-    [EnergySourcePoint]                       =  4,
-    [FieldRecord]                             =  4,
-    [GroupWaterDepth]                         =  4,
-    [GroupX]                                  =  4,
-    [GroupY]                                  =  4,
-    [INLINE_3D]                               =  4,
-    [offset]                                  =  4,
-    [ReceiverDatumElevation]                  =  4,
-    [ReceiverGroupElevation]                  =  4,
-    [ShotPoint]                               =  4,
-    [SourceDatumElevation]                    =  4,
-    [SourceDepth]                             =  4,
-    [SourceEnergyDirectionMantissa]           =  4,
-    [SourceMeasurementExponent]               =  4,
-    [SourceSurfaceElevation]                  =  4,
-    [SourceWaterDepth]                        =  4,
-    [SourceX]                                 =  4,
-    [SourceY]                                 =  4,
-    [TraceNumber]                             =  4,
-    [TRACE_SEQUENCE_FILE]                     =  4,
-    [TRACE_SEQUENCE_LINE]                     =  4,
-    [TransductionConstantMantissa]            =  4,
-    [UnassignedInt1]                          =  4,
-    [UnassignedInt2]                          =  4,
-
-    [AliasFilterFrequency]                    =  2,
-    [AliasFilterSlope]                        =  2,
-    [CoordinateUnits]                         =  2,
-    [Correlated]                              =  2,
-    [DataUse]                                 =  2,
-    [DayOfYear]                               =  2,
-    [DelayRecordingTime]                      =  2,
-    [ElevationScalar]                         =  2,
-    [GainType]                                =  2,
-    [GapSize]                                 =  2,
-    [GeophoneGroupNumberFirstTraceOrigField]  =  2,
-    [GeophoneGroupNumberLastTraceOrigField]   =  2,
-    [GeophoneGroupNumberRoll1]                =  2,
-    [GroupStaticCorrection]                   =  2,
-    [GroupUpholeTime]                         =  2,
-    [HighCutFrequency]                        =  2,
-    [HighCutSlope]                            =  2,
-    [HourOfDay]                               =  2,
-    [InstrumentGainConstant]                  =  2,
-    [InstrumentInitialGain]                   =  2,
-    [LagTimeA]                                =  2,
-    [LagTimeB]                                =  2,
-    [LowCutFrequency]                         =  2,
-    [LowCutSlope]                             =  2,
-    [MinuteOfHour]                            =  2,
-    [MuteTimeEND]                             =  2,
-    [MuteTimeStart]                           =  2,
-    [NotchFilterFrequency]                    =  2,
-    [NotchFilterSlope]                        =  2,
-    [NStackedTraces]                          =  2,
-    [NSummedTraces]                           =  2,
-    [OverTravel]                              =  2,
-    [ScalarTraceHeader]                       =  2,
-    [SecondOfMinute]                          =  2,
-    [ShotPointScalar]                         =  2,
-    [SourceEnergyDirectionExponent]           =  2,
-    [SourceGroupScalar]                       =  2,
-    [SourceMeasurementMantissa]               =  2,
-    [SourceMeasurementUnit]                   =  2,
-    [SourceStaticCorrection]                  =  2,
-    [SourceType]                              =  2,
-    [SourceUpholeTime]                        =  2,
-    [SubWeatheringVelocity]                   =  2,
-    [SweepFrequencyEnd]                       =  2,
-    [SweepFrequencyStart]                     =  2,
-    [SweepLength]                             =  2,
-    [SweepTraceTaperLengthEnd]                =  2,
-    [SweepTraceTaperLengthStart]              =  2,
-    [SweepType]                               =  2,
-    [TaperType]                               =  2,
-    [TimeBaseCode]                            =  2,
-    [TotalStaticApplied]                      =  2,
-    [TraceIdentificationCode]                 =  2,
-    [TraceIdentifier]                         =  2,
-    [TRACE_SAMPLE_COUNT]                      =  2,
-    [TRACE_SAMPLE_INTERVAL]                   =  2,
-    [TraceValueMeasurementUnit]               =  2,
-    [TraceWeightingFactor]                    =  2,
-    [TransductionConstantPower]               =  2,
-    [TransductionUnit]                        =  2,
-    [WeatheringVelocity]                      =  2,
-    [YearDataRecorded]                        =  2,
+    [SEGY_TR_CDP_X                  ] = 4,
+    [SEGY_TR_CDP_Y                  ] = 4,
+    [SEGY_TR_CROSSLINE              ] = 4,
+    [SEGY_TR_ENERGY_SOURCE_POINT    ] = 4,
+    [SEGY_TR_ENSEMBLE               ] = 4,
+    [SEGY_TR_FIELD_RECORD           ] = 4,
+    [SEGY_TR_GROUP_WATER_DEPTH      ] = 4,
+    [SEGY_TR_GROUP_X                ] = 4,
+    [SEGY_TR_GROUP_Y                ] = 4,
+    [SEGY_TR_INLINE                 ] = 4,
+    [SEGY_TR_NUMBER_ORIG_FIELD      ] = 4,
+    [SEGY_TR_NUM_IN_ENSEMBLE        ] = 4,
+    [SEGY_TR_OFFSET                 ] = 4,
+    [SEGY_TR_RECV_DATUM_ELEV        ] = 4,
+    [SEGY_TR_RECV_GROUP_ELEV        ] = 4,
+    [SEGY_TR_SEQ_FILE               ] = 4,
+    [SEGY_TR_SEQ_LINE               ] = 4,
+    [SEGY_TR_SHOT_POINT             ] = 4,
+    [SEGY_TR_SOURCE_DATUM_ELEV      ] = 4,
+    [SEGY_TR_SOURCE_DEPTH           ] = 4,
+    [SEGY_TR_SOURCE_ENERGY_DIR_MANT ] = 4,
+    [SEGY_TR_SOURCE_MEASURE_MANT    ] = 4,
+    [SEGY_TR_SOURCE_SURF_ELEV       ] = 4,
+    [SEGY_TR_SOURCE_X               ] = 4,
+    [SEGY_TR_SOURCE_Y               ] = 4,
+    [SEGY_TR_TRANSDUCTION_MANT      ] = 4,
+    [SEGY_TR_UNASSIGNED1            ] = 4,
+    [SEGY_TR_UNASSIGNED2            ] = 4,
+
+    [SEGY_TR_ALIAS_FILT_FREQ        ] = 2,
+    [SEGY_TR_ALIAS_FILT_SLOPE       ] = 2,
+    [SEGY_TR_COORD_UNITS            ] = 2,
+    [SEGY_TR_CORRELATED             ] = 2,
+    [SEGY_TR_DATA_USE               ] = 2,
+    [SEGY_TR_DAY_OF_YEAR            ] = 2,
+    [SEGY_TR_DELAY_REC_TIME         ] = 2,
+    [SEGY_TR_DEVICE_ID              ] = 2,
+    [SEGY_TR_ELEV_SCALAR            ] = 2,
+    [SEGY_TR_GAIN_TYPE              ] = 2,
+    [SEGY_TR_GAP_SIZE               ] = 2,
+    [SEGY_TR_GEOPHONE_GROUP_FIRST   ] = 2,
+    [SEGY_TR_GEOPHONE_GROUP_LAST    ] = 2,
+    [SEGY_TR_GEOPHONE_GROUP_ROLL1   ] = 2,
+    [SEGY_TR_GROUP_STATIC_CORR      ] = 2,
+    [SEGY_TR_GROUP_UPHOLE_TIME      ] = 2,
+    [SEGY_TR_HIGH_CUT_FREQ          ] = 2,
+    [SEGY_TR_HIGH_CUT_SLOPE         ] = 2,
+    [SEGY_TR_HOUR_OF_DAY            ] = 2,
+    [SEGY_TR_INSTR_GAIN_CONST       ] = 2,
+    [SEGY_TR_INSTR_INIT_GAIN        ] = 2,
+    [SEGY_TR_LAG_A                  ] = 2,
+    [SEGY_TR_LAG_B                  ] = 2,
+    [SEGY_TR_LOW_CUT_FREQ           ] = 2,
+    [SEGY_TR_LOW_CUT_SLOPE          ] = 2,
+    [SEGY_TR_MEASURE_UNIT           ] = 2,
+    [SEGY_TR_MIN_OF_HOUR            ] = 2,
+    [SEGY_TR_MUTE_TIME_END          ] = 2,
+    [SEGY_TR_MUTE_TIME_START        ] = 2,
+    [SEGY_TR_NOTCH_FILT_FREQ        ] = 2,
+    [SEGY_TR_NOTCH_FILT_SLOPE       ] = 2,
+    [SEGY_TR_OVER_TRAVEL            ] = 2,
+    [SEGY_TR_SAMPLE_COUNT           ] = 2,
+    [SEGY_TR_SAMPLE_INTER           ] = 2,
+    [SEGY_TR_SCALAR_TRACE_HEADER    ] = 2,
+    [SEGY_TR_SEC_OF_MIN             ] = 2,
+    [SEGY_TR_SHOT_POINT_SCALAR      ] = 2,
+    [SEGY_TR_SOURCE_ENERGY_DIR_EXP  ] = 2,
+    [SEGY_TR_SOURCE_GROUP_SCALAR    ] = 2,
+    [SEGY_TR_SOURCE_MEASURE_EXP     ] = 2,
+    [SEGY_TR_SOURCE_MEASURE_UNIT    ] = 2,
+    [SEGY_TR_SOURCE_STATIC_CORR     ] = 2,
+    [SEGY_TR_SOURCE_TYPE            ] = 2,
+    [SEGY_TR_SOURCE_UPHOLE_TIME     ] = 2,
+    [SEGY_TR_SOURCE_WATER_DEPTH     ] = 2,
+    [SEGY_TR_STACKED_TRACES         ] = 2,
+    [SEGY_TR_SUBWEATHERING_VELO     ] = 2,
+    [SEGY_TR_SUMMED_TRACES          ] = 2,
+    [SEGY_TR_SWEEP_FREQ_END         ] = 2,
+    [SEGY_TR_SWEEP_FREQ_START       ] = 2,
+    [SEGY_TR_SWEEP_LENGTH           ] = 2,
+    [SEGY_TR_SWEEP_TAPERLEN_END     ] = 2,
+    [SEGY_TR_SWEEP_TAPERLEN_START   ] = 2,
+    [SEGY_TR_SWEEP_TYPE             ] = 2,
+    [SEGY_TR_TAPER_TYPE             ] = 2,
+    [SEGY_TR_TIME_BASE_CODE         ] = 2,
+    [SEGY_TR_TOT_STATIC_APPLIED     ] = 2,
+    [SEGY_TR_TRACE_ID               ] = 2,
+    [SEGY_TR_TRANSDUCTION_EXP       ] = 2,
+    [SEGY_TR_TRANSDUCTION_UNIT      ] = 2,
+    [SEGY_TR_WEATHERING_VELO        ] = 2,
+    [SEGY_TR_WEIGHTING_FAC          ] = 2,
+    [SEGY_TR_YEAR_DATA_REC          ] = 2,
 };
 
 #define HEADER_SIZE SEGY_TEXT_HEADER_SIZE
@@ -262,42 +262,40 @@ static int field_size[] = {
  * start of the *text header*, not the binary header.
  */
 static int bfield_size[] = {
-    [- HEADER_SIZE + BIN_JobID]                 =  4,
-    [- HEADER_SIZE + BIN_LineNumber]            =  4,
-    [- HEADER_SIZE + BIN_ReelNumber]            =  4,
-
-    [- HEADER_SIZE + BIN_Traces]                =  2,
-    [- HEADER_SIZE + BIN_AuxTraces]             =  2,
-    [- HEADER_SIZE + BIN_Interval]              =  2,
-    [- HEADER_SIZE + BIN_IntervalOriginal]      =  2,
-    [- HEADER_SIZE + BIN_Samples]               =  2,
-    [- HEADER_SIZE + BIN_SamplesOriginal]       =  2,
-    [- HEADER_SIZE + BIN_Format]                =  2,
-    [- HEADER_SIZE + BIN_EnsembleFold]          =  2,
-    [- HEADER_SIZE + BIN_SortingCode]           =  2,
-    [- HEADER_SIZE + BIN_VerticalSum]           =  2,
-    [- HEADER_SIZE + BIN_SweepFrequencyStart]   =  2,
-    [- HEADER_SIZE + BIN_SweepFrequencyEnd]     =  2,
-    [- HEADER_SIZE + BIN_SweepLength]           =  2,
-    [- HEADER_SIZE + BIN_Sweep]                 =  2,
-    [- HEADER_SIZE + BIN_SweepChannel]          =  2,
-    [- HEADER_SIZE + BIN_SweepTaperStart]       =  2,
-    [- HEADER_SIZE + BIN_SweepTaperEnd]         =  2,
-    [- HEADER_SIZE + BIN_Taper]                 =  2,
-    [- HEADER_SIZE + BIN_CorrelatedTraces]      =  2,
-    [- HEADER_SIZE + BIN_BinaryGainRecovery]    =  2,
-    [- HEADER_SIZE + BIN_AmplitudeRecovery]     =  2,
-    [- HEADER_SIZE + BIN_MeasurementSystem]     =  2,
-    [- HEADER_SIZE + BIN_ImpulseSignalPolarity] =  2,
-    [- HEADER_SIZE + BIN_VibratoryPolarity]     =  2,
-
-    [- HEADER_SIZE + BIN_Unassigned1]           =  0,
-
-    [- HEADER_SIZE + BIN_SEGYRevision]          =  2,
-    [- HEADER_SIZE + BIN_TraceFlag]             =  2,
-    [- HEADER_SIZE + BIN_ExtendedHeaders]       =  2,
-
-    [- HEADER_SIZE + BIN_Unassigned2]           =  0,
+    [- HEADER_SIZE + SEGY_BIN_JOB_ID                ] = 4,
+    [- HEADER_SIZE + SEGY_BIN_LINE_NUMBER           ] = 4,
+    [- HEADER_SIZE + SEGY_BIN_REEL_NUMBER           ] = 4,
+
+    [- HEADER_SIZE + SEGY_BIN_TRACES                ] = 2,
+    [- HEADER_SIZE + SEGY_BIN_AUX_TRACES            ] = 2,
+    [- HEADER_SIZE + SEGY_BIN_INTERVAL              ] = 2,
+    [- HEADER_SIZE + SEGY_BIN_INTERVAL_ORIG         ] = 2,
+    [- HEADER_SIZE + SEGY_BIN_SAMPLES               ] = 2,
+    [- HEADER_SIZE + SEGY_BIN_SAMPLES_ORIG          ] = 2,
+    [- HEADER_SIZE + SEGY_BIN_FORMAT                ] = 2,
+    [- HEADER_SIZE + SEGY_BIN_ENSEMBLE_FOLD         ] = 2,
+    [- HEADER_SIZE + SEGY_BIN_SORTING_CODE          ] = 2,
+    [- HEADER_SIZE + SEGY_BIN_VERTICAL_SUM          ] = 2,
+    [- HEADER_SIZE + SEGY_BIN_SWEEP_FREQ_START      ] = 2,
+    [- HEADER_SIZE + SEGY_BIN_SWEEP_FREQ_END        ] = 2,
+    [- HEADER_SIZE + SEGY_BIN_SWEEP_LENGTH          ] = 2,
+    [- HEADER_SIZE + SEGY_BIN_SWEEP                 ] = 2,
+    [- HEADER_SIZE + SEGY_BIN_SWEEP_CHANNEL         ] = 2,
+    [- HEADER_SIZE + SEGY_BIN_SWEEP_TAPER_START     ] = 2,
+    [- HEADER_SIZE + SEGY_BIN_SWEEP_TAPER_END       ] = 2,
+    [- HEADER_SIZE + SEGY_BIN_TAPER                 ] = 2,
+    [- HEADER_SIZE + SEGY_BIN_CORRELATED_TRACES     ] = 2,
+    [- HEADER_SIZE + SEGY_BIN_BIN_GAIN_RECOVERY     ] = 2,
+    [- HEADER_SIZE + SEGY_BIN_AMPLITUDE_RECOVERY    ] = 2,
+    [- HEADER_SIZE + SEGY_BIN_MEASUREMENT_SYSTEM    ] = 2,
+    [- HEADER_SIZE + SEGY_BIN_IMPULSE_POLARITY      ] = 2,
+    [- HEADER_SIZE + SEGY_BIN_VIBRATORY_POLARITY    ] = 2,
+    [- HEADER_SIZE + SEGY_BIN_SEGY_REVISION         ] = 2,
+    [- HEADER_SIZE + SEGY_BIN_TRACE_FLAG            ] = 2,
+    [- HEADER_SIZE + SEGY_BIN_EXT_HEADERS           ] = 2,
+
+    [- HEADER_SIZE + SEGY_BIN_UNASSIGNED1           ] = 0,
+    [- HEADER_SIZE + SEGY_BIN_UNASSIGNED2           ] = 0,
 };
 
 /*
@@ -527,13 +525,13 @@ int segy_write_binheader( segy_file* fp, const char* buf ) {
 
 int segy_format( const char* buf ) {
     int format;
-    segy_get_bfield( buf, BIN_Format, &format );
+    segy_get_bfield( buf, SEGY_BIN_FORMAT, &format );
     return format;
 }
 
 unsigned int segy_samples( const char* buf ) {
     int32_t samples;
-    segy_get_bfield( buf, BIN_Samples, &samples );
+    segy_get_bfield( buf, SEGY_BIN_SAMPLES, &samples );
     return (unsigned int) samples;
 }
 
@@ -544,7 +542,7 @@ unsigned int segy_trace_bsize( unsigned int samples ) {
 
 long segy_trace0( const char* binheader ) {
     int extra_headers;
-    segy_get_bfield( binheader, BIN_ExtendedHeaders, &extra_headers );
+    segy_get_bfield( binheader, SEGY_BIN_EXT_HEADERS, &extra_headers );
 
     return SEGY_TEXT_HEADER_SIZE + SEGY_BINARY_HEADER_SIZE +
            SEGY_TEXT_HEADER_SIZE * extra_headers;
@@ -662,8 +660,8 @@ int segy_sample_interval( segy_file* fp, double* dt) {
     int binary_header_dt_us;
     int trace_header_dt_us;
 
-    segy_get_bfield(bin_header, BIN_Interval, &binary_header_dt_us);
-    segy_get_field(trace_header, TRACE_SAMPLE_INTERVAL, &trace_header_dt_us);
+    segy_get_bfield(bin_header, SEGY_BIN_INTERVAL, &binary_header_dt_us);
+    segy_get_field(trace_header, SEGY_TR_SAMPLE_INTER, &trace_header_dt_us);
 
     // milliseconds: ms
     double binary_header_dt_ms = binary_header_dt_us/1000.0;
@@ -734,7 +732,7 @@ int segy_sorting( segy_file* fp,
 
     segy_get_field( traceheader, il, &il0 );
     segy_get_field( traceheader, xl, &xl0 );
-    segy_get_field( traceheader, offset, &off0 );
+    segy_get_field( traceheader, SEGY_TR_OFFSET, &off0 );
 
     size_t traces_size_t;
     err = segy_traces( fp, &traces_size_t, trace0, trace_bsize );
@@ -748,7 +746,7 @@ int segy_sorting( segy_file* fp,
 
         segy_get_field( traceheader, il, &il1 );
         segy_get_field( traceheader, xl, &xl1 );
-        segy_get_field( traceheader, offset, &off1 );
+        segy_get_field( traceheader, SEGY_TR_OFFSET, &off1 );
         ++traceno;
     } while( off0 != off1 && traceno < traces );
 
@@ -764,10 +762,10 @@ int segy_sorting( segy_file* fp,
     segy_get_field( traceheader, il, &il_last );
     segy_get_field( traceheader, xl, &xl_last );
 
-    if     ( il0 == il_last ) *sorting = CROSSLINE_SORTING;
-    else if( xl0 == xl_last ) *sorting = INLINE_SORTING;
-    else if( il0 == il1 )     *sorting = INLINE_SORTING;
-    else if( xl0 == xl1 )     *sorting = CROSSLINE_SORTING;
+    if     ( il0 == il_last ) *sorting = SEGY_CROSSLINE_SORTING;
+    else if( xl0 == xl_last ) *sorting = SEGY_INLINE_SORTING;
+    else if( il0 == il1 )     *sorting = SEGY_INLINE_SORTING;
+    else if( xl0 == xl1 )     *sorting = SEGY_CROSSLINE_SORTING;
     else return SEGY_INVALID_SORTING;
 
     return SEGY_OK;
@@ -947,12 +945,12 @@ int segy_lines_count( segy_file* fp,
                       long trace0,
                       unsigned int trace_bsize ) {
 
-    if( sorting == UNKNOWN_SORTING ) return SEGY_INVALID_SORTING;
+    if( sorting == SEGY_UNKNOWN_SORTING ) return SEGY_INVALID_SORTING;
 
     int field;
     unsigned int l1out, l2out;
 
-    if( sorting == INLINE_SORTING ) field = xl;
+    if( sorting == SEGY_INLINE_SORTING ) field = xl;
     else field = il;
 
     int err = segy_count_lines( fp, field, offsets,
@@ -961,7 +959,7 @@ int segy_lines_count( segy_file* fp,
 
     if( err != SEGY_OK ) return err;
 
-    if( sorting == INLINE_SORTING ) {
+    if( sorting == SEGY_INLINE_SORTING ) {
         *il_count = l1out;
         *xl_count = l2out;
     } else {
@@ -991,7 +989,7 @@ int segy_inline_indices( segy_file* fp,
                          unsigned int trace_bsize) {
     int err;
 
-    if( sorting == INLINE_SORTING ) {
+    if( sorting == SEGY_INLINE_SORTING ) {
         size_t traces;
         err = segy_traces( fp, &traces, trace0, trace_bsize );
         if( err != 0 ) return err;
@@ -1000,7 +998,7 @@ int segy_inline_indices( segy_file* fp,
         return segy_line_indices( fp, il, 0, stride, inline_count, buf, trace0, trace_bsize );
     }
 
-    if( sorting == CROSSLINE_SORTING ) {
+    if( sorting == SEGY_CROSSLINE_SORTING ) {
         return segy_line_indices( fp, il, 0, offsets, inline_count, buf, trace0, trace_bsize );
     }
 
@@ -1019,11 +1017,11 @@ int segy_crossline_indices( segy_file* fp,
 
     int err;
 
-    if( sorting == INLINE_SORTING ) {
+    if( sorting == SEGY_INLINE_SORTING ) {
         return segy_line_indices( fp, xl, 0, offsets, crossline_count, buf, trace0, trace_bsize );
     }
 
-    if( sorting == CROSSLINE_SORTING ) {
+    if( sorting == SEGY_CROSSLINE_SORTING ) {
         size_t traces;
         err = segy_traces( fp, &traces, trace0, trace_bsize );
         if( err != 0 ) return err;
@@ -1101,7 +1099,7 @@ int segy_to_native( int format,
     assert( sizeof( float ) == sizeof( uint32_t ) );
 
     uint32_t u;
-    if( format == IEEE_FLOAT_4_BYTE ) {
+    if( format == SEGY_IEEE_FLOAT_4_BYTE ) {
         while( size-- ) {
             memcpy( &u, buf, sizeof( float ) );
             u = ntohl( u );
@@ -1125,7 +1123,7 @@ int segy_from_native( int format,
     assert( sizeof( float ) == sizeof( uint32_t ) );
 
     uint32_t u;
-    if( format == IEEE_FLOAT_4_BYTE ) {
+    if( format == SEGY_IEEE_FLOAT_4_BYTE ) {
         while( size-- ) {
             memcpy( &u, buf, sizeof( float ) );
             u = htonl( u );
@@ -1246,11 +1244,11 @@ int segy_inline_stride( int sorting,
                         unsigned int inline_count,
                         unsigned int* stride ) {
     switch( sorting ) {
-        case CROSSLINE_SORTING:
+        case SEGY_CROSSLINE_SORTING:
             *stride = inline_count;
             return SEGY_OK;
 
-        case INLINE_SORTING:
+        case SEGY_INLINE_SORTING:
             *stride = 1;
             return SEGY_OK;
 
@@ -1263,11 +1261,11 @@ int segy_crossline_stride( int sorting,
                            unsigned int crossline_count,
                            unsigned int* stride ) {
     switch( sorting ) {
-        case CROSSLINE_SORTING:
+        case SEGY_CROSSLINE_SORTING:
             *stride = 1;
             return SEGY_OK;
 
-        case INLINE_SORTING:
+        case SEGY_INLINE_SORTING:
             *stride = crossline_count;
             return SEGY_OK;
 
diff --git a/lib/test/segy.c b/lib/test/segy.c
index f4f053e..fd2607c 100644
--- a/lib/test/segy.c
+++ b/lib/test/segy.c
@@ -20,8 +20,8 @@ static void test_interpret_file() {
     unsigned int inlines_sz, crosslines_sz;
     unsigned int offsets, stride;
     unsigned int line_trace0, line_length;
-    const int il = INLINE_3D;
-    const int xl = CROSSLINE_3D;
+    const int il = SEGY_TR_INLINE;
+    const int xl = SEGY_TR_CROSSLINE;
 
     segy_file* fp = segy_open( file, "rb" );
 
@@ -46,11 +46,11 @@ static void test_interpret_file() {
 
     err = segy_sorting( fp, xl, il, &sorting, trace0, trace_bsize );
     assertTrue( err == 0, "Could not figure out file sorting." );
-    assertTrue( sorting == CROSSLINE_SORTING, "Expected crossline sorting." );
+    assertTrue( sorting == SEGY_CROSSLINE_SORTING, "Expected crossline sorting." );
 
     err = segy_sorting( fp, il, xl, &sorting, trace0, trace_bsize );
     assertTrue( err == 0, "Could not figure out file sorting." );
-    assertTrue( sorting == INLINE_SORTING, "Expected inline sorting." );
+    assertTrue( sorting == SEGY_INLINE_SORTING, "Expected inline sorting." );
 
     err = segy_offsets( fp, il, xl, traces, &offsets, trace0, trace_bsize );
     assertTrue( err == 0, "Could not figure out offsets." );
@@ -119,8 +119,8 @@ void test_interpret_file_prestack() {
     unsigned int inlines_sz, crosslines_sz;
     unsigned int offsets, stride;
     unsigned int line_trace0, line_length;
-    const int il = INLINE_3D;
-    const int xl = CROSSLINE_3D;
+    const int il = SEGY_TR_INLINE;
+    const int xl = SEGY_TR_CROSSLINE;
 
     FILE* fp = fopen( file, "r" );
 
@@ -145,11 +145,11 @@ void test_interpret_file_prestack() {
 
     err = segy_sorting( fp, xl, il, &sorting, trace0, trace_bsize );
     assertTrue( err == 0, "Could not figure out file sorting." );
-    assertTrue( sorting == CROSSLINE_SORTING, "Expected crossline sorting." );
+    assertTrue( sorting == SEGY_CROSSLINE_SORTING, "Expected crossline sorting." );
 
     err = segy_sorting( fp, il, xl, &sorting, trace0, trace_bsize );
     assertTrue( err == 0, "Could not figure out file sorting." );
-    assertTrue( sorting == INLINE_SORTING, "Expected inline sorting." );
+    assertTrue( sorting == SEGY_INLINE_SORTING, "Expected inline sorting." );
 
     err = segy_offsets( fp, il, xl, traces, &offsets, trace0, trace_bsize );
     assertTrue( err == 0, "Could not figure out offsets." );
@@ -213,7 +213,7 @@ static void testReadInLine_4(){
     unsigned int line_trace0, line_length;
 
     /* test specific consts */
-    const int il = INLINE_3D, xl = CROSSLINE_3D;
+    const int il = SEGY_TR_INLINE, xl = SEGY_TR_CROSSLINE;
 
     char header[ SEGY_BINARY_HEADER_SIZE ];
 
@@ -288,7 +288,7 @@ static void testReadCrossLine_22(){
     unsigned int line_trace0, line_length;
 
     /* test specific consts */
-    const int il = INLINE_3D, xl = CROSSLINE_3D;
+    const int il = SEGY_TR_INLINE, xl = SEGY_TR_CROSSLINE;
 
     char header[ SEGY_BINARY_HEADER_SIZE ];
 
@@ -373,14 +373,14 @@ static void test_modify_trace_header() {
     assertTrue( err == 0, "Error while reading trace header." );
 
     int ilno;
-    err = segy_get_field( traceh, INLINE_3D, &ilno );
+    err = segy_get_field( traceh, SEGY_TR_INLINE, &ilno );
     assertTrue( err == 0, "Error while reading iline no from field." );
     assertTrue( ilno == 1, "Wrong iline no." );
 
-    err = segy_set_field( traceh, INLINE_3D, ilno + 1 );
+    err = segy_set_field( traceh, SEGY_TR_INLINE, ilno + 1 );
     assertTrue( err == 0, "Error writing to trace header buffer." );
 
-    err = segy_get_field( traceh, INLINE_3D, &ilno );
+    err = segy_get_field( traceh, SEGY_TR_INLINE, &ilno );
     assertTrue( err == 0, "Error while reading iline no from dirty field." );
     assertTrue( ilno == 2, "Wrong iline no." );
 
@@ -389,19 +389,19 @@ static void test_modify_trace_header() {
 
     err = segy_traceheader( fp, 0, traceh, trace0, trace_bsize );
     assertTrue( err == 0, "Error while reading trace header." );
-    err = segy_get_field( traceh, INLINE_3D, &ilno );
+    err = segy_get_field( traceh, SEGY_TR_INLINE, &ilno );
     assertTrue( err == 0, "Error while reading iline no from dirty field." );
     assertTrue( ilno == 2, "Wrong iline no." );
 
-    err = segy_set_field( traceh, INLINE_3D, 1 );
+    err = segy_set_field( traceh, SEGY_TR_INLINE, 1 );
     assertTrue( err == 0, "Error writing to trace header buffer." );
     err = segy_write_traceheader( fp, 0, traceh, trace0, trace_bsize );
     assertTrue( err == 0, "Error writing traceheader." );
 
-    err = segy_set_field( traceh, SourceGroupScalar, -100 );
+    err = segy_set_field( traceh, SEGY_TR_SOURCE_GROUP_SCALAR, -100 );
     assertTrue( err == 0, "Error writing to trace header buffer." );
     int32_t scale;
-    err = segy_get_field( traceh, SourceGroupScalar, &scale );
+    err = segy_get_field( traceh, SEGY_TR_SOURCE_GROUP_SCALAR, &scale );
     assertTrue( err == 0, "Error while reading SourceGroupScalar from dirty field." );
 
     segy_close( fp );
@@ -484,13 +484,13 @@ static void test_trace_header_errors() {
     assertTrue( err == SEGY_INVALID_FIELD, "Reading outside trace header." );
 
     /* Reading between known byte offsets should yield error */
-    err = segy_get_field( header, INLINE_3D + 1, &field );
+    err = segy_get_field( header, SEGY_TR_INLINE + 1, &field );
     assertTrue( err == SEGY_INVALID_FIELD, "Reading between ok byte offsets." );
 
-    err = segy_get_field( header, INLINE_3D, &field );
+    err = segy_get_field( header, SEGY_TR_INLINE, &field );
     assertTrue( err == SEGY_OK, "Reading failed at valid byte offset." );
 
-    err = segy_get_field( header, DayOfYear, &field );
+    err = segy_get_field( header, SEGY_TR_DAY_OF_YEAR, &field );
     assertTrue( err == SEGY_OK, "Reading failed at valid byte offset." );
 
     segy_close( fp );
@@ -522,13 +522,13 @@ static void test_file_error_codes() {
     assertTrue( err == SEGY_INVALID_FIELD, "Reading outside trace header." );
 
     /* Reading between known byte offsets should yield error */
-    err = segy_get_field( header, INLINE_3D + 1, &field );
+    err = segy_get_field( header, SEGY_TR_INLINE + 1, &field );
     assertTrue( err == SEGY_INVALID_FIELD, "Reading between ok byte offsets." );
 
-    err = segy_get_field( header, INLINE_3D, &field );
+    err = segy_get_field( header, SEGY_TR_INLINE, &field );
     assertTrue( err == SEGY_OK, "Reading failed at valid byte offset." );
 
-    err = segy_get_field( header, DayOfYear, &field );
+    err = segy_get_field( header, SEGY_TR_DAY_OF_YEAR, &field );
     assertTrue( err == SEGY_OK, "Reading failed at valid byte offset." );
 
     err = segy_read_textheader(fp, NULL);
@@ -562,11 +562,11 @@ static void test_error_codes_sans_file() {
                 "Found line number that shouldn't exist." );
 
     unsigned int stride;
-    err = segy_inline_stride( INLINE_SORTING + 3, 10, &stride );
+    err = segy_inline_stride( SEGY_INLINE_SORTING + 3, 10, &stride );
     assertTrue( err == SEGY_INVALID_SORTING,
                 "Expected sorting to be invalid." );
 
-    err = segy_crossline_stride( INLINE_SORTING + 3, 10, &stride );
+    err = segy_crossline_stride( SEGY_INLINE_SORTING + 3, 10, &stride );
     assertTrue( err == SEGY_INVALID_SORTING,
                 "Expected sorting to be invalid." );
 }
diff --git a/mex/segy_get_traces_mex.c b/mex/segy_get_traces_mex.c
index 30fde3f..b103ed1 100644
--- a/mex/segy_get_traces_mex.c
+++ b/mex/segy_get_traces_mex.c
@@ -63,7 +63,7 @@ void mexFunction(int nlhs, mxArray *plhs[],
     segy_to_native( fmt.format, fmt.samples * traces, mxGetData( plhs[ 0 ] ) );
 
     int interval;
-    segy_get_bfield( binary, BIN_Interval, &interval );
+    segy_get_bfield( binary, SEGY_BIN_INTERVAL, &interval );
     plhs[ 1 ] = mxCreateDoubleScalar( interval );
     plhs[ 2 ] = mxCreateDoubleScalar( fmt.format );
 
diff --git a/mex/segyutil.c b/mex/segyutil.c
index 4feaca7..07ec51e 100644
--- a/mex/segyutil.c
+++ b/mex/segyutil.c
@@ -65,11 +65,11 @@ int segyCreateSpec(SegySpec* spec, const char* file, unsigned int inline_field,
     unsigned int* l1;
     unsigned int* l2;
     unsigned int field;
-    if (spec->trace_sorting_format == INLINE_SORTING) {
+    if (spec->trace_sorting_format == SEGY_INLINE_SORTING) {
         field = crossline_field;
         l1 = &spec->inline_count;
         l2 = &spec->crossline_count;
-    } else if (spec->trace_sorting_format == CROSSLINE_SORTING) {
+    } else if (spec->trace_sorting_format == SEGY_CROSSLINE_SORTING) {
         field = inline_field;
         l2 = &spec->inline_count;
         l1 = &spec->crossline_count;
diff --git a/python/segyio/_segyio.c b/python/segyio/_segyio.c
index a274071..d7a72b4 100644
--- a/python/segyio/_segyio.c
+++ b/python/segyio/_segyio.c
@@ -600,11 +600,11 @@ static PyObject *py_init_metrics(PyObject *self, PyObject *args) {
     unsigned int *l1out;
     unsigned int *l2out;
 
-    if (sorting == CROSSLINE_SORTING) {
+    if (sorting == SEGY_CROSSLINE_SORTING) {
         field = il_field;
         l1out = &xl_count;
         l2out = &il_count;
-    } else if (sorting == INLINE_SORTING) {
+    } else if (sorting == SEGY_INLINE_SORTING) {
         field = xl_field;
         l1out = &il_count;
         l2out = &xl_count;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/segyio.git



More information about the debian-science-commits mailing list