Expected constructor, destructor or type conversion before...

Discussion in 'C++' started by algatt, Jul 19, 2007.

  1. algatt

    algatt Guest

    Hello, I am trying to compile the TPIE files but there is a file
    that's constantly giving errors about the templates. I am using gcc
    3.4.5 on Eclipse using Windows XP. The following is the code of the
    file that I am trying to compile:

    Code:

    1.
    // Copyright (c) 1994 Darren Erik Vengroff
    2.
    //
    3.
    // File: ami_scan_mac.h
    4.
    // Author: Darren Erik Vengroff <>
    5.
    // Created: 5/24/94
    6.
    //
    7.
    // $Id: ami_scan_mac.h,v 1.10 2003/04/25 00:06:56 tavi Exp $
    8.
    //
    9.
    #ifndef _AMI_SCAN_MAC_H
    10.
    #define _AMI_SCAN_MAC_H
    11.

    12.
    // Macros for defining parameters to AMI_scan()
    13.
    #define __SPARM_BASE(T,io,n) AMI_STREAM< T ## n > *io ## n
    14.
    #define __SPARM_1(T,io) __SPARM_BASE(T,io,1)
    15.
    #define __SPARM_2(T,io) __SPARM_1(T,io), __SPARM_BASE(T,io,2)
    16.
    #define __SPARM_3(T,io) __SPARM_2(T,io), __SPARM_BASE(T,io,3)
    17.
    #define __SPARM_4(T,io) __SPARM_3(T,io), __SPARM_BASE(T,io,4)
    18.

    19.
    // Macros for defining types in a template for AMI_scan()
    20.
    #define __STEMP_BASE(T,n) class T ## n
    21.
    #define __STEMP_1(T) __STEMP_BASE(T,1)
    22.
    #define __STEMP_2(T) __STEMP_1(T), __STEMP_BASE(T,2)
    23.
    #define __STEMP_3(T) __STEMP_2(T), __STEMP_BASE(T,3)
    24.
    #define __STEMP_4(T) __STEMP_3(T), __STEMP_BASE(T,4)
    25.

    26.
    // Temporary space used within AMI_scan
    27.
    #define __STS_BASE(T,t,n) T ## n t ## n
    28.
    #define __STSPACE_1(T,t) __STS_BASE(T,t,1)
    29.
    #define __STSPACE_2(T,t) __STSPACE_1(T,t) ; __STS_BASE(T,t,2)
    30.
    #define __STSPACE_3(T,t) __STSPACE_2(T,t) ; __STS_BASE(T,t,3)
    31.
    #define __STSPACE_4(T,t) __STSPACE_3(T,t) ; __STS_BASE(T,t,4)
    32.

    33.
    // An array of flags.
    34.
    #define __FSPACE(f,n) AMI_SCAN_FLAG f[n]
    35.

    36.

    37.
    // Check stream validity.
    38.
    #define __CHK_BASE(T,n)
    { \
    39.
    if (T ## n == NULL || T ## n -> status() !=
    AMI_STREAM_STATUS_VALID) {\
    40.
    return
    AMI_ERROR_GENERIC_ERROR; \
    41.
    }
    \
    42.
    }
    43.

    44.
    #define __CHKSTR_1(T) __CHK_BASE(T,1)
    45.
    #define __CHKSTR_2(T) __CHKSTR_1(T) __CHK_BASE(T,2)
    46.
    #define __CHKSTR_3(T) __CHKSTR_2(T) __CHK_BASE(T,3)
    47.
    #define __CHKSTR_4(T) __CHKSTR_3(T) __CHK_BASE(T,4)
    48.

    49.

    50.
    // Rewind the input streams prior to performing the scan.
    51.
    #define __REW_BASE(T,n) { \
    52.
    if ((_ami_err_ = T ## n -> seek(0)) != AMI_ERROR_NO_ERROR)
    { \
    53.
    return _ami_err_; \
    54.
    } \
    55.
    }
    56.

    57.
    #define __REWIND_1(T) __REW_BASE(T,1)
    58.
    #define __REWIND_2(T) __REWIND_1(T) __REW_BASE(T,2)
    59.
    #define __REWIND_3(T) __REWIND_2(T) __REW_BASE(T,3)
    60.
    #define __REWIND_4(T) __REWIND_3(T) __REW_BASE(T,4)
    61.

    62.

    63.
    // Set the input flags to true before entering the do loop so
    that the
    64.
    // initial values will be read.
    65.
    #define __SET_IF_BASE(f,n) f[n-1] = 1
    66.

    67.
    #define __SET_IF_1(f) __SET_IF_BASE(f,1)
    68.
    #define __SET_IF_2(f) __SET_IF_1(f); __SET_IF_BASE(f,2)
    69.
    #define __SET_IF_3(f) __SET_IF_2(f); __SET_IF_BASE(f,3)
    70.
    #define __SET_IF_4(f) __SET_IF_3(f); __SET_IF_BASE(f,4)
    71.

    72.
    // If the flag is set, then read inputs into temporary space.
    Set the
    73.
    // flag based on whether the read was succesful or not. If it
    was
    74.
    // unsuccessful for any reason other than EOS, then break out of
    the
    75.
    // scan loop. If the flag is not currently set, then either the
    scan
    76.
    // management object did not take the last input or the last
    time we
    77.
    // tried to read from this file we failed. If we read
    successfully
    78.
    // last time, then reset the flag.
    79.
    #define __STSR_BASE(t,ts,f,g,e,n) \
    80.
    if (f[n-1]) { \
    81.
    if (!(f[n-1] = g[n-1] = \
    82.
    ((e = ts ## n->read_item(&t ## n)) ==
    AMI_ERROR_NO_ERROR))) { \
    83.
    if (e != AMI_ERROR_END_OF_STREAM) { \
    84.
    break; \
    85.
    } \
    86.
    } \
    87.
    } else { \
    88.
    f[n-1] = g[n-1]; \
    89.
    }
    90.

    91.
    #define __STS_READ_1(t,ts,f,g,e) __STSR_BASE(t,ts,f,g,e,1)
    92.
    #define __STS_READ_2(t,ts,f,g,e)
    __STS_READ_1(t,ts,f,g,e) \
    93.
    __STSR_BASE(t,ts,f,g,e,2)
    94.
    #define __STS_READ_3(t,ts,f,g,e)
    __STS_READ_2(t,ts,f,g,e) \
    95.
    __STSR_BASE(t,ts,f,g,e,3)
    96.
    #define __STS_READ_4(t,ts,f,g,e)
    __STS_READ_3(t,ts,f,g,e) \
    97.
    __STSR_BASE(t,ts,f,g,e,4)
    98.

    99.
    // Write outputs. Only write if the flag is set. If there is
    an
    100.
    // error during the write, then break out of the scan loop.
    101.
    #define __STSW_BASE(u,us,f,e,n) \
    102.
    if (f[n-1] && (e = us ## n -> write_item(u ## n)) !=
    AMI_ERROR_NO_ERROR) { \
    103.
    break; \
    104.
    }
    105.

    106.
    #define __STS_WRITE_1(u,us,f,e) __STSW_BASE(u,us,f,e,1)
    107.
    #define __STS_WRITE_2(u,us,f,e) __STS_WRITE_1(u,us,f,e)
    __STSW_BASE(u,us,f,e,2)
    108.
    #define __STS_WRITE_3(u,us,f,e) __STS_WRITE_2(u,us,f,e)
    __STSW_BASE(u,us,f,e,3)
    109.
    #define __STS_WRITE_4(u,us,f,e) __STS_WRITE_3(u,us,f,e)
    __STSW_BASE(u,us,f,e,4)
    110.

    111.

    112.
    // Arguments to the operate() call
    113.
    #define __SCA_BASE(t,n) t ## n
    114.
    #define __SCALL_ARGS_1(t) __SCA_BASE(t,1)
    115.
    #define __SCALL_ARGS_2(t) __SCALL_ARGS_1(t), __SCA_BASE(t,2)
    116.
    #define __SCALL_ARGS_3(t) __SCALL_ARGS_2(t), __SCA_BASE(t,3)
    117.
    #define __SCALL_ARGS_4(t) __SCALL_ARGS_3(t), __SCA_BASE(t,4)
    118.

    119.
    // Operate on the inputs to produce the outputs.
    120.
    #define __SCALL_BASE(t,nt,if,sop,u,nu,of) \
    121.
    sop->operate(__SCALL_ARGS_ ## nt (*t), if, __SCALL_ARGS_ ##
    nu (&u), of)
    122.

    123.
    #define __SCALL_OP_1_1(t,if,sop,u,of) __SCALL_BASE(t,1,if,sop,u,
    1,of)
    124.
    #define __SCALL_OP_1_2(t,if,sop,u,of) __SCALL_BASE(t,1,if,sop,u,
    2,of)
    125.
    #define __SCALL_OP_1_3(t,if,sop,u,of) __SCALL_BASE(t,1,if,sop,u,
    3,of)
    126.
    #define __SCALL_OP_1_4(t,if,sop,u,of) __SCALL_BASE(t,1,if,sop,u,
    4,of)
    127.

    128.
    #define __SCALL_OP_2_1(t,if,sop,u,of) __SCALL_BASE(t,2,if,sop,u,
    1,of)
    129.
    #define __SCALL_OP_2_2(t,if,sop,u,of) __SCALL_BASE(t,2,if,sop,u,
    2,of)
    130.
    #define __SCALL_OP_2_3(t,if,sop,u,of) __SCALL_BASE(t,2,if,sop,u,
    3,of)
    131.
    #define __SCALL_OP_2_4(t,if,sop,u,of) __SCALL_BASE(t,2,if,sop,u,
    4,of)
    132.

    133.
    #define __SCALL_OP_3_1(t,if,sop,u,of) __SCALL_BASE(t,3,if,sop,u,
    1,of)
    134.
    #define __SCALL_OP_3_2(t,if,sop,u,of) __SCALL_BASE(t,3,if,sop,u,
    2,of)
    135.
    #define __SCALL_OP_3_3(t,if,sop,u,of) __SCALL_BASE(t,3,if,sop,u,
    3,of)
    136.
    #define __SCALL_OP_3_4(t,if,sop,u,of) __SCALL_BASE(t,3,if,sop,u,
    4,of)
    137.

    138.
    #define __SCALL_OP_4_1(t,if,sop,u,of) __SCALL_BASE(t,4,if,sop,u,
    1,of)
    139.
    #define __SCALL_OP_4_2(t,if,sop,u,of) __SCALL_BASE(t,4,if,sop,u,
    2,of)
    140.
    #define __SCALL_OP_4_3(t,if,sop,u,of) __SCALL_BASE(t,4,if,sop,u,
    3,of)
    141.
    #define __SCALL_OP_4_4(t,if,sop,u,of) __SCALL_BASE(t,4,if,sop,u,
    4,of)
    142.

    143.
    // Handle the no input case.
    144.
    #define __SCALL_BASE_O(sop,u,nu,of) \
    145.
    sop->operate(__SCALL_ARGS_ ## nu (&u), of)
    146.

    147.
    #define __SCALL_OP_O_1(sop,u,of) __SCALL_BASE_O(sop,u,1,of)
    148.
    #define __SCALL_OP_O_2(sop,u,of) __SCALL_BASE_O(sop,u,2,of)
    149.
    #define __SCALL_OP_O_3(sop,u,of) __SCALL_BASE_O(sop,u,3,of)
    150.
    #define __SCALL_OP_O_4(sop,u,of) __SCALL_BASE_O(sop,u,4,of)
    151.

    152.
    // Handle the no output case.
    153.
    #define __SCALL_BASE_I(t,nt,if,sop) \
    154.
    sop->operate(__SCALL_ARGS_ ## nt (*t), if)
    155.

    156.
    #define __SCALL_OP_I_1(t,if,sop) __SCALL_BASE_I(t,1,if,sop)
    157.
    #define __SCALL_OP_I_2(t,if,sop) __SCALL_BASE_I(t,2,if,sop)
    158.
    #define __SCALL_OP_I_3(t,if,sop) __SCALL_BASE_I(t,3,if,sop)
    159.
    #define __SCALL_OP_I_4(t,if,sop) __SCALL_BASE_I(t,4,if,sop)
    160.

    161.

    162.
    // The template for the whole AMI_scan(), with inputs and
    outputs.
    163.
    #define __STEMPLATE(in_arity, out_arity) \
    164.
    template< __STEMP_ ## in_arity (T), class SC, __STEMP_ ##
    out_arity (U) > \
    165.
    AMI_err AMI_scan( __SPARM_ ## in_arity (T,_ts_), \
    166.
    SC *soper, __SPARM_ ## out_arity
    (U,_us_)) \
    167.
    { \
    168.
    __STSPACE_ ## in_arity (T,*_t_); \
    169.
    __STSPACE_ ## out_arity (U,_u_); \
    170.
    \
    171.
    __FSPACE(_if_,in_arity); \
    172.
    __FSPACE(_lif_,in_arity); \
    173.
    __FSPACE(_of_,out_arity); \
    174.
    \
    175.
    AMI_err _op_err_, _ami_err_; \
    176.
    \
    177.
    __CHKSTR_ ## in_arity
    (_ts_) \
    178.
    __CHKSTR_ ## out_arity
    (_us_) \
    179.
    __REWIND_ ## in_arity (_ts_) \
    180.
    soper->initialize(); \
    181.

    \
    182.
    __SET_IF_ ## in_arity (_if_); \
    183.

    \
    184.
    do { \
    185.
    \
    186.
    __STS_READ_ ## in_arity
    (_t_,_ts_,_if_,_lif_,_ami_err_) \
    187.
    \
    188.
    _op_err_ = __SCALL_OP_ ## in_arity ## _ ## \
    189.
    out_arity(_t_,_if_,soper,_u_,_of_); \
    190.
    \
    191.
    __STS_WRITE_ ##
    out_arity(_u_,_us_,_of_,_ami_err_) \
    192.
    \
    193.
    } while (_op_err_ == AMI_SCAN_CONTINUE);
    \
    194.
    \
    195.
    if ((_ami_err_ != AMI_ERROR_NO_ERROR) &&
    \
    196.
    (_ami_err_ != AMI_ERROR_END_OF_STREAM)) { \
    197.
    return _ami_err_; \
    198.
    } \
    199.
    \
    200.
    return AMI_ERROR_NO_ERROR; \
    201.
    }
    202.

    203.
    // The template for the whole AMI_scan(), with no inputs. This
    is
    204.
    // based on __STEMPLATE_() and could be merged into one big
    macro at
    205.
    // the expense of having to define multiple versions of
    __STEMP_N()
    206.
    // and __SPARM_N() to handle the case N = 0.
    207.
    #define __STEMPLATE_O(out_arity) \
    208.
    template< class SC, __STEMP_ ## out_arity (U) > \
    209.
    AMI_err AMI_scan( SC *soper, __SPARM_ ## out_arity
    (U,_us_)) \
    210.
    { \
    211.
    __STSPACE_ ## out_arity (U,_u_); \
    212.
    \
    213.
    __FSPACE(_of_,out_arity); \
    214.
    \
    215.
    AMI_err _op_err_, _ami_err_; \
    216.

    \
    217.
    __CHKSTR_ ## out_arity
    (_us_) \
    218.
    soper->initialize(); \
    219.
    \
    220.
    do { \
    221.
    \
    222.
    _op_err_ = __SCALL_OP_O_ ##
    out_arity(soper,_u_,_of_); \
    223.
    \
    224.
    __STS_WRITE_ ##
    out_arity(_u_,_us_,_of_,_ami_err_) \
    225.
    \
    226.
    } while (_op_err_ == AMI_SCAN_CONTINUE);
    \
    227.
    \
    228.
    if ((_ami_err_ != AMI_ERROR_NO_ERROR) &&
    \
    229.
    (_ami_err_ != AMI_ERROR_END_OF_STREAM)) { \
    230.
    return _ami_err_; \
    231.
    } \
    232.
    \
    233.
    return AMI_ERROR_NO_ERROR; \
    234.
    }
    235.

    236.
    // The template for the whole AMI_scan(), with no outputs.
    237.
    #define __STEMPLATE_I(in_arity) \
    238.
    template< __STEMP_ ## in_arity (T), class SC > \
    239.
    AMI_err AMI_scan( __SPARM_ ## in_arity (T,_ts_), SC
    *soper) \
    240.
    { \
    241.
    __STSPACE_ ## in_arity (T,*_t_); \
    242.
    \
    243.
    __FSPACE(_if_,in_arity); \
    244.
    __FSPACE(_lif_,in_arity); \
    245.
    \
    246.
    AMI_err _op_err_, _ami_err_; \
    247.
    \
    248.
    __CHKSTR_ ## in_arity
    (_ts_) \
    249.
    __REWIND_ ## in_arity (_ts_); \
    250.
    \
    251.
    soper->initialize(); \
    252.

    \
    253.
    __SET_IF_ ## in_arity (_if_); \
    254.

    \
    255.
    do { \
    256.
    \
    257.
    __STS_READ_ ## in_arity
    (_t_,_ts_,_if_,_lif_,_ami_err_) \
    258.
    \
    259.
    _op_err_ = __SCALL_OP_I_ ## in_arity
    (_t_,_if_,soper); \
    260.
    \
    261.
    } while (_op_err_ == AMI_SCAN_CONTINUE);
    \
    262.
    \
    263.
    if ((_ami_err_ != AMI_ERROR_NO_ERROR) &&
    \
    264.
    (_ami_err_ != AMI_ERROR_END_OF_STREAM)) { \
    265.
    return _ami_err_; \
    266.
    } \
    267.
    \
    268.
    return AMI_ERROR_NO_ERROR; \
    269.
    }
    270.

    271.

    272.
    // Finally, the templates themsleves.
    273.

    274.
    __STEMPLATE(1,1); __STEMPLATE(1,2); __STEMPLATE(1,3);
    __STEMPLATE(1,4);
    275.
    __STEMPLATE(2,1); __STEMPLATE(2,2); __STEMPLATE(2,3);
    __STEMPLATE(2,4);
    276.
    __STEMPLATE(3,1); __STEMPLATE(3,2); __STEMPLATE(3,3);
    __STEMPLATE(3,4);
    277.
    __STEMPLATE(4,1); __STEMPLATE(4,2); __STEMPLATE(4,3);
    __STEMPLATE(4,4);
    278.

    279.
    __STEMPLATE_O(1); __STEMPLATE_O(2); __STEMPLATE_O(3);
    __STEMPLATE_O(4);
    280.

    281.
    __STEMPLATE_I(1); __STEMPLATE_I(2); __STEMPLATE_I(3);
    __STEMPLATE_I(4);
    282.

    283.
    #endif // _AMI_SCAN_MAC_H



    The error messages are Expected constructor, destructor or type
    conversion before... in each of the following lines 274-281!

    Any ideas? Thanks
     
    algatt, Jul 19, 2007
    #1
    1. Advertising

  2. On 2007-07-19 15:08, algatt wrote:
    > Hello, I am trying to compile the TPIE files but there is a file
    > that's constantly giving errors about the templates. I am using gcc
    > 3.4.5 on Eclipse using Windows XP. The following is the code of the
    > file that I am trying to compile:
    >
    > Code:
    >
    > 1.
    > // Copyright (c) 1994 Darren Erik Vengroff
    > 2.
    > //
    > 3.
    > // File: ami_scan_mac.h
    > 4.
    > // Author: Darren Erik Vengroff <>
    > 5.
    > // Created: 5/24/94
    > 6.
    > //
    > 7.
    > // $Id: ami_scan_mac.h,v 1.10 2003/04/25 00:06:56 tavi Exp $
    > 8.
    > //
    > 9.
    > #ifndef _AMI_SCAN_MAC_H
    > 10.
    > #define _AMI_SCAN_MAC_H
    > 11.
    >
    > 12.
    > // Macros for defining parameters to AMI_scan()
    > 13.
    > #define __SPARM_BASE(T,io,n) AMI_STREAM< T ## n > *io ## n
    > 14.
    > #define __SPARM_1(T,io) __SPARM_BASE(T,io,1)
    > 15.
    > #define __SPARM_2(T,io) __SPARM_1(T,io), __SPARM_BASE(T,io,2)
    > 16.
    > #define __SPARM_3(T,io) __SPARM_2(T,io), __SPARM_BASE(T,io,3)
    > 17.
    > #define __SPARM_4(T,io) __SPARM_3(T,io), __SPARM_BASE(T,io,4)
    > 18.
    >
    > 19.
    > // Macros for defining types in a template for AMI_scan()
    > 20.
    > #define __STEMP_BASE(T,n) class T ## n
    > 21.
    > #define __STEMP_1(T) __STEMP_BASE(T,1)
    > 22.
    > #define __STEMP_2(T) __STEMP_1(T), __STEMP_BASE(T,2)
    > 23.
    > #define __STEMP_3(T) __STEMP_2(T), __STEMP_BASE(T,3)
    > 24.
    > #define __STEMP_4(T) __STEMP_3(T), __STEMP_BASE(T,4)
    > 25.
    >
    > 26.
    > // Temporary space used within AMI_scan
    > 27.
    > #define __STS_BASE(T,t,n) T ## n t ## n
    > 28.
    > #define __STSPACE_1(T,t) __STS_BASE(T,t,1)
    > 29.
    > #define __STSPACE_2(T,t) __STSPACE_1(T,t) ; __STS_BASE(T,t,2)
    > 30.
    > #define __STSPACE_3(T,t) __STSPACE_2(T,t) ; __STS_BASE(T,t,3)
    > 31.
    > #define __STSPACE_4(T,t) __STSPACE_3(T,t) ; __STS_BASE(T,t,4)
    > 32.
    >
    > 33.
    > // An array of flags.
    > 34.
    > #define __FSPACE(f,n) AMI_SCAN_FLAG f[n]
    > 35.
    >
    > 36.
    >
    > 37.
    > // Check stream validity.
    > 38.
    > #define __CHK_BASE(T,n)
    > { \
    > 39.
    > if (T ## n == NULL || T ## n -> status() !=
    > AMI_STREAM_STATUS_VALID) {\
    > 40.
    > return
    > AMI_ERROR_GENERIC_ERROR; \
    > 41.
    > }
    > \
    > 42.
    > }
    > 43.
    >
    > 44.
    > #define __CHKSTR_1(T) __CHK_BASE(T,1)
    > 45.
    > #define __CHKSTR_2(T) __CHKSTR_1(T) __CHK_BASE(T,2)
    > 46.
    > #define __CHKSTR_3(T) __CHKSTR_2(T) __CHK_BASE(T,3)
    > 47.
    > #define __CHKSTR_4(T) __CHKSTR_3(T) __CHK_BASE(T,4)
    > 48.
    >
    > 49.
    >
    > 50.
    > // Rewind the input streams prior to performing the scan.
    > 51.
    > #define __REW_BASE(T,n) { \
    > 52.
    > if ((_ami_err_ = T ## n -> seek(0)) != AMI_ERROR_NO_ERROR)
    > { \
    > 53.
    > return _ami_err_; \
    > 54.
    > } \
    > 55.
    > }
    > 56.
    >
    > 57.
    > #define __REWIND_1(T) __REW_BASE(T,1)
    > 58.
    > #define __REWIND_2(T) __REWIND_1(T) __REW_BASE(T,2)
    > 59.
    > #define __REWIND_3(T) __REWIND_2(T) __REW_BASE(T,3)
    > 60.
    > #define __REWIND_4(T) __REWIND_3(T) __REW_BASE(T,4)
    > 61.
    >
    > 62.
    >
    > 63.
    > // Set the input flags to true before entering the do loop so
    > that the
    > 64.
    > // initial values will be read.
    > 65.
    > #define __SET_IF_BASE(f,n) f[n-1] = 1
    > 66.
    >
    > 67.
    > #define __SET_IF_1(f) __SET_IF_BASE(f,1)
    > 68.
    > #define __SET_IF_2(f) __SET_IF_1(f); __SET_IF_BASE(f,2)
    > 69.
    > #define __SET_IF_3(f) __SET_IF_2(f); __SET_IF_BASE(f,3)
    > 70.
    > #define __SET_IF_4(f) __SET_IF_3(f); __SET_IF_BASE(f,4)
    > 71.
    >
    > 72.
    > // If the flag is set, then read inputs into temporary space.
    > Set the
    > 73.
    > // flag based on whether the read was succesful or not. If it
    > was
    > 74.
    > // unsuccessful for any reason other than EOS, then break out of
    > the
    > 75.
    > // scan loop. If the flag is not currently set, then either the
    > scan
    > 76.
    > // management object did not take the last input or the last
    > time we
    > 77.
    > // tried to read from this file we failed. If we read
    > successfully
    > 78.
    > // last time, then reset the flag.
    > 79.
    > #define __STSR_BASE(t,ts,f,g,e,n) \
    > 80.
    > if (f[n-1]) { \
    > 81.
    > if (!(f[n-1] = g[n-1] = \
    > 82.
    > ((e = ts ## n->read_item(&t ## n)) ==
    > AMI_ERROR_NO_ERROR))) { \
    > 83.
    > if (e != AMI_ERROR_END_OF_STREAM) { \
    > 84.
    > break; \
    > 85.
    > } \
    > 86.
    > } \
    > 87.
    > } else { \
    > 88.
    > f[n-1] = g[n-1]; \
    > 89.
    > }
    > 90.
    >
    > 91.
    > #define __STS_READ_1(t,ts,f,g,e) __STSR_BASE(t,ts,f,g,e,1)
    > 92.
    > #define __STS_READ_2(t,ts,f,g,e)
    > __STS_READ_1(t,ts,f,g,e) \
    > 93.
    > __STSR_BASE(t,ts,f,g,e,2)
    > 94.
    > #define __STS_READ_3(t,ts,f,g,e)
    > __STS_READ_2(t,ts,f,g,e) \
    > 95.
    > __STSR_BASE(t,ts,f,g,e,3)
    > 96.
    > #define __STS_READ_4(t,ts,f,g,e)
    > __STS_READ_3(t,ts,f,g,e) \
    > 97.
    > __STSR_BASE(t,ts,f,g,e,4)
    > 98.
    >
    > 99.
    > // Write outputs. Only write if the flag is set. If there is
    > an
    > 100.
    > // error during the write, then break out of the scan loop.
    > 101.
    > #define __STSW_BASE(u,us,f,e,n) \
    > 102.
    > if (f[n-1] && (e = us ## n -> write_item(u ## n)) !=
    > AMI_ERROR_NO_ERROR) { \
    > 103.
    > break; \
    > 104.
    > }
    > 105.
    >
    > 106.
    > #define __STS_WRITE_1(u,us,f,e) __STSW_BASE(u,us,f,e,1)
    > 107.
    > #define __STS_WRITE_2(u,us,f,e) __STS_WRITE_1(u,us,f,e)
    > __STSW_BASE(u,us,f,e,2)
    > 108.
    > #define __STS_WRITE_3(u,us,f,e) __STS_WRITE_2(u,us,f,e)
    > __STSW_BASE(u,us,f,e,3)
    > 109.
    > #define __STS_WRITE_4(u,us,f,e) __STS_WRITE_3(u,us,f,e)
    > __STSW_BASE(u,us,f,e,4)
    > 110.
    >
    > 111.
    >
    > 112.
    > // Arguments to the operate() call
    > 113.
    > #define __SCA_BASE(t,n) t ## n
    > 114.
    > #define __SCALL_ARGS_1(t) __SCA_BASE(t,1)
    > 115.
    > #define __SCALL_ARGS_2(t) __SCALL_ARGS_1(t), __SCA_BASE(t,2)
    > 116.
    > #define __SCALL_ARGS_3(t) __SCALL_ARGS_2(t), __SCA_BASE(t,3)
    > 117.
    > #define __SCALL_ARGS_4(t) __SCALL_ARGS_3(t), __SCA_BASE(t,4)
    > 118.
    >
    > 119.
    > // Operate on the inputs to produce the outputs.
    > 120.
    > #define __SCALL_BASE(t,nt,if,sop,u,nu,of) \
    > 121.
    > sop->operate(__SCALL_ARGS_ ## nt (*t), if, __SCALL_ARGS_ ##
    > nu (&u), of)
    > 122.
    >
    > 123.
    > #define __SCALL_OP_1_1(t,if,sop,u,of) __SCALL_BASE(t,1,if,sop,u,
    > 1,of)
    > 124.
    > #define __SCALL_OP_1_2(t,if,sop,u,of) __SCALL_BASE(t,1,if,sop,u,
    > 2,of)
    > 125.
    > #define __SCALL_OP_1_3(t,if,sop,u,of) __SCALL_BASE(t,1,if,sop,u,
    > 3,of)
    > 126.
    > #define __SCALL_OP_1_4(t,if,sop,u,of) __SCALL_BASE(t,1,if,sop,u,
    > 4,of)
    > 127.
    >
    > 128.
    > #define __SCALL_OP_2_1(t,if,sop,u,of) __SCALL_BASE(t,2,if,sop,u,
    > 1,of)
    > 129.
    > #define __SCALL_OP_2_2(t,if,sop,u,of) __SCALL_BASE(t,2,if,sop,u,
    > 2,of)
    > 130.
    > #define __SCALL_OP_2_3(t,if,sop,u,of) __SCALL_BASE(t,2,if,sop,u,
    > 3,of)
    > 131.
    > #define __SCALL_OP_2_4(t,if,sop,u,of) __SCALL_BASE(t,2,if,sop,u,
    > 4,of)
    > 132.
    >
    > 133.
    > #define __SCALL_OP_3_1(t,if,sop,u,of) __SCALL_BASE(t,3,if,sop,u,
    > 1,of)
    > 134.
    > #define __SCALL_OP_3_2(t,if,sop,u,of) __SCALL_BASE(t,3,if,sop,u,
    > 2,of)
    > 135.
    > #define __SCALL_OP_3_3(t,if,sop,u,of) __SCALL_BASE(t,3,if,sop,u,
    > 3,of)
    > 136.
    > #define __SCALL_OP_3_4(t,if,sop,u,of) __SCALL_BASE(t,3,if,sop,u,
    > 4,of)
    > 137.
    >
    > 138.
    > #define __SCALL_OP_4_1(t,if,sop,u,of) __SCALL_BASE(t,4,if,sop,u,
    > 1,of)
    > 139.
    > #define __SCALL_OP_4_2(t,if,sop,u,of) __SCALL_BASE(t,4,if,sop,u,
    > 2,of)
    > 140.
    > #define __SCALL_OP_4_3(t,if,sop,u,of) __SCALL_BASE(t,4,if,sop,u,
    > 3,of)
    > 141.
    > #define __SCALL_OP_4_4(t,if,sop,u,of) __SCALL_BASE(t,4,if,sop,u,
    > 4,of)
    > 142.
    >
    > 143.
    > // Handle the no input case.
    > 144.
    > #define __SCALL_BASE_O(sop,u,nu,of) \
    > 145.
    > sop->operate(__SCALL_ARGS_ ## nu (&u), of)
    > 146.
    >
    > 147.
    > #define __SCALL_OP_O_1(sop,u,of) __SCALL_BASE_O(sop,u,1,of)
    > 148.
    > #define __SCALL_OP_O_2(sop,u,of) __SCALL_BASE_O(sop,u,2,of)
    > 149.
    > #define __SCALL_OP_O_3(sop,u,of) __SCALL_BASE_O(sop,u,3,of)
    > 150.
    > #define __SCALL_OP_O_4(sop,u,of) __SCALL_BASE_O(sop,u,4,of)
    > 151.
    >
    > 152.
    > // Handle the no output case.
    > 153.
    > #define __SCALL_BASE_I(t,nt,if,sop) \
    > 154.
    > sop->operate(__SCALL_ARGS_ ## nt (*t), if)
    > 155.
    >
    > 156.
    > #define __SCALL_OP_I_1(t,if,sop) __SCALL_BASE_I(t,1,if,sop)
    > 157.
    > #define __SCALL_OP_I_2(t,if,sop) __SCALL_BASE_I(t,2,if,sop)
    > 158.
    > #define __SCALL_OP_I_3(t,if,sop) __SCALL_BASE_I(t,3,if,sop)
    > 159.
    > #define __SCALL_OP_I_4(t,if,sop) __SCALL_BASE_I(t,4,if,sop)
    > 160.
    >
    > 161.
    >
    > 162.
    > // The template for the whole AMI_scan(), with inputs and
    > outputs.
    > 163.
    > #define __STEMPLATE(in_arity, out_arity) \
    > 164.
    > template< __STEMP_ ## in_arity (T), class SC, __STEMP_ ##
    > out_arity (U) > \
    > 165.
    > AMI_err AMI_scan( __SPARM_ ## in_arity (T,_ts_), \
    > 166.
    > SC *soper, __SPARM_ ## out_arity
    > (U,_us_)) \
    > 167.
    > { \
    > 168.
    > __STSPACE_ ## in_arity (T,*_t_); \
    > 169.
    > __STSPACE_ ## out_arity (U,_u_); \
    > 170.
    > \
    > 171.
    > __FSPACE(_if_,in_arity); \
    > 172.
    > __FSPACE(_lif_,in_arity); \
    > 173.
    > __FSPACE(_of_,out_arity); \
    > 174.
    > \
    > 175.
    > AMI_err _op_err_, _ami_err_; \
    > 176.
    > \
    > 177.
    > __CHKSTR_ ## in_arity
    > (_ts_) \
    > 178.
    > __CHKSTR_ ## out_arity
    > (_us_) \
    > 179.
    > __REWIND_ ## in_arity (_ts_) \
    > 180.
    > soper->initialize(); \
    > 181.
    >
    > \
    > 182.
    > __SET_IF_ ## in_arity (_if_); \
    > 183.
    >
    > \
    > 184.
    > do { \
    > 185.
    > \
    > 186.
    > __STS_READ_ ## in_arity
    > (_t_,_ts_,_if_,_lif_,_ami_err_) \
    > 187.
    > \
    > 188.
    > _op_err_ = __SCALL_OP_ ## in_arity ## _ ## \
    > 189.
    > out_arity(_t_,_if_,soper,_u_,_of_); \
    > 190.
    > \
    > 191.
    > __STS_WRITE_ ##
    > out_arity(_u_,_us_,_of_,_ami_err_) \
    > 192.
    > \
    > 193.
    > } while (_op_err_ == AMI_SCAN_CONTINUE);
    > \
    > 194.
    > \
    > 195.
    > if ((_ami_err_ != AMI_ERROR_NO_ERROR) &&
    > \
    > 196.
    > (_ami_err_ != AMI_ERROR_END_OF_STREAM)) { \
    > 197.
    > return _ami_err_; \
    > 198.
    > } \
    > 199.
    > \
    > 200.
    > return AMI_ERROR_NO_ERROR; \
    > 201.
    > }
    > 202.
    >
    > 203.
    > // The template for the whole AMI_scan(), with no inputs. This
    > is
    > 204.
    > // based on __STEMPLATE_() and could be merged into one big
    > macro at
    > 205.
    > // the expense of having to define multiple versions of
    > __STEMP_N()
    > 206.
    > // and __SPARM_N() to handle the case N = 0.
    > 207.
    > #define __STEMPLATE_O(out_arity) \
    > 208.
    > template< class SC, __STEMP_ ## out_arity (U) > \
    > 209.
    > AMI_err AMI_scan( SC *soper, __SPARM_ ## out_arity
    > (U,_us_)) \
    > 210.
    > { \
    > 211.
    > __STSPACE_ ## out_arity (U,_u_); \
    > 212.
    > \
    > 213.
    > __FSPACE(_of_,out_arity); \
    > 214.
    > \
    > 215.
    > AMI_err _op_err_, _ami_err_; \
    > 216.
    >
    > \
    > 217.
    > __CHKSTR_ ## out_arity
    > (_us_) \
    > 218.
    > soper->initialize(); \
    > 219.
    > \
    > 220.
    > do { \
    > 221.
    > \
    > 222.
    > _op_err_ = __SCALL_OP_O_ ##
    > out_arity(soper,_u_,_of_); \
    > 223.
    > \
    > 224.
    > __STS_WRITE_ ##
    > out_arity(_u_,_us_,_of_,_ami_err_) \
    > 225.
    > \
    > 226.
    > } while (_op_err_ == AMI_SCAN_CONTINUE);
    > \
    > 227.
    > \
    > 228.
    > if ((_ami_err_ != AMI_ERROR_NO_ERROR) &&
    > \
    > 229.
    > (_ami_err_ != AMI_ERROR_END_OF_STREAM)) { \
    > 230.
    > return _ami_err_; \
    > 231.
    > } \
    > 232.
    > \
    > 233.
    > return AMI_ERROR_NO_ERROR; \
    > 234.
    > }
    > 235.
    >
    > 236.
    > // The template for the whole AMI_scan(), with no outputs.
    > 237.
    > #define __STEMPLATE_I(in_arity) \
    > 238.
    > template< __STEMP_ ## in_arity (T), class SC > \
    > 239.
    > AMI_err AMI_scan( __SPARM_ ## in_arity (T,_ts_), SC
    > *soper) \
    > 240.
    > { \
    > 241.
    > __STSPACE_ ## in_arity (T,*_t_); \
    > 242.
    > \
    > 243.
    > __FSPACE(_if_,in_arity); \
    > 244.
    > __FSPACE(_lif_,in_arity); \
    > 245.
    > \
    > 246.
    > AMI_err _op_err_, _ami_err_; \
    > 247.
    > \
    > 248.
    > __CHKSTR_ ## in_arity
    > (_ts_) \
    > 249.
    > __REWIND_ ## in_arity (_ts_); \
    > 250.
    > \
    > 251.
    > soper->initialize(); \
    > 252.
    >
    > \
    > 253.
    > __SET_IF_ ## in_arity (_if_); \
    > 254.
    >
    > \
    > 255.
    > do { \
    > 256.
    > \
    > 257.
    > __STS_READ_ ## in_arity
    > (_t_,_ts_,_if_,_lif_,_ami_err_) \
    > 258.
    > \
    > 259.
    > _op_err_ = __SCALL_OP_I_ ## in_arity
    > (_t_,_if_,soper); \
    > 260.
    > \
    > 261.
    > } while (_op_err_ == AMI_SCAN_CONTINUE);
    > \
    > 262.
    > \
    > 263.
    > if ((_ami_err_ != AMI_ERROR_NO_ERROR) &&
    > \
    > 264.
    > (_ami_err_ != AMI_ERROR_END_OF_STREAM)) { \
    > 265.
    > return _ami_err_; \
    > 266.
    > } \
    > 267.
    > \
    > 268.
    > return AMI_ERROR_NO_ERROR; \
    > 269.
    > }
    > 270.
    >
    > 271.
    >
    > 272.
    > // Finally, the templates themsleves.
    > 273.
    >
    > 274.
    > __STEMPLATE(1,1); __STEMPLATE(1,2); __STEMPLATE(1,3);
    > __STEMPLATE(1,4);
    > 275.
    > __STEMPLATE(2,1); __STEMPLATE(2,2); __STEMPLATE(2,3);
    > __STEMPLATE(2,4);
    > 276.
    > __STEMPLATE(3,1); __STEMPLATE(3,2); __STEMPLATE(3,3);
    > __STEMPLATE(3,4);
    > 277.
    > __STEMPLATE(4,1); __STEMPLATE(4,2); __STEMPLATE(4,3);
    > __STEMPLATE(4,4);
    > 278.
    >
    > 279.
    > __STEMPLATE_O(1); __STEMPLATE_O(2); __STEMPLATE_O(3);
    > __STEMPLATE_O(4);
    > 280.
    >
    > 281.
    > __STEMPLATE_I(1); __STEMPLATE_I(2); __STEMPLATE_I(3);
    > __STEMPLATE_I(4);
    > 282.
    >
    > 283.
    > #endif // _AMI_SCAN_MAC_H
    >
    >
    >
    > The error messages are Expected constructor, destructor or type
    > conversion before... in each of the following lines 274-281!


    Run it through the pre-processor and then a code prettyfier and try to
    compile that, if you still don't find the error post that code instead.
    Is there anything that's not a macro in there, I hope that it's
    generated and none actually wrote that.

    --
    Erik Wikström
     
    =?ISO-8859-1?Q?Erik_Wikstr=F6m?=, Jul 19, 2007
    #2
    1. Advertising

  3. algatt wrote:
    > Hello, I am trying to compile the TPIE files but there is a file
    > that's constantly giving errors about the templates. I am using gcc
    > 3.4.5 on Eclipse using Windows XP. The following is the code of the
    > file that I am trying to compile:
    >
    > Code:
    >


    Well the first error is that AMI_err is used in the generated code but
    defined nowhere. Could also say the same about AMI_STREAM, AMI_SCAN_FLAG
    and probably many others.

    If the code is not total rubbish then the problem probably is that you
    are missing a header file or two. Why the missing header files aren't
    included in that header file is only a question the code author could
    answer. Why don't you email him, his address is at the head of the
    source code (you probably should have removed that before posting).

    john
     
    John Harrison, Jul 19, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Preben
    Replies:
    6
    Views:
    3,902
    Preben
    Sep 20, 2006
  2. Damien
    Replies:
    5
    Views:
    14,703
    Damien
    Dec 13, 2006
  3. Replies:
    1
    Views:
    330
    Victor Bazarov
    Oct 19, 2007
  4. Replies:
    5
    Views:
    23,705
  5. mhubbard
    Replies:
    0
    Views:
    3,465
    mhubbard
    Apr 4, 2008
Loading...

Share This Page