lib/types.js
function map (type) {
  if (!type) throw new Error('got falsey "type" to map ('+type+'). this should NOT happen!');
  if (type.type) type = type.type;
  if (isStruct(type)) return getStruct(type);
  type = type.replace(methodEncodingsTest, '')
  // if the first letter is a ^ then it's a "pointer" type
  if (type[0] === '^') return 'pointer'
  // now we can try matching from the typeEncodings map
  var rtn = typeEncodings[type]
  if (rtn) return rtn
  // last shot... try the last char? this may be a bad idea...
  rtn = typeEncodings[type[type.length-1]]
  if (rtn) return rtn
  // couldn't find the type. throw a descriptive error as to why:
  if (type[0] == '[') return 'pointer';
    //throw new Error('Array types not yet supported: ' + type)
  if (type[0] == '(') return 'pointer';
    //throw new Error('Union types not yet supported: ' + type)
  if (type[0] == 'b') return 'pointer';
    //throw new Error('Bit field types not yet supported: ' + type)
  throw new Error('Could not convert type: ' + type)
}
function map (type) {
  if (!type) throw new Error('got falsey "type" to map ('+type+'). this should NOT happen!');
  if (type.type) type = type.type;
  if (isStruct(type)) return getStruct(type);
  type = type.replace(methodEncodingsTest, '')
  // if the first letter is a ^ then it's a "pointer" type
  if (type[0] === '^') return 'pointer'
  // now we can try matching from the typeEncodings map
  var rtn = typeEncodings[type]
  if (rtn) return rtn
  // last shot... try the last char? this may be a bad idea...
  rtn = typeEncodings[type[type.length-1]]
  if (rtn) return rtn
  // couldn't find the type. throw a descriptive error as to why:
  if (type[0] == '[') return 'pointer';
    //throw new Error('Array types not yet supported: ' + type)
  if (type[0] == '(') return 'pointer';
    //throw new Error('Union types not yet supported: ' + type)
  if (type[0] == 'b') return 'pointer';
    //throw new Error('Bit field types not yet supported: ' + type)
  throw new Error('Could not convert type: ' + type)
}
function map ( type ) { if ( ! type ) throw new Error ( 'got falsey "type" to map (' + type + '). this should NOT happen!' ) ; if ( type . type ) type = type . type ; if ( isStruct ( type ) ) return getStruct ( type ) ; type = type . replace ( methodEncodingsTest , '' ) // if the first letter is a ^ then it's a "pointer" type if ( type [ 0 ] === '^' ) return 'pointer' // now we can try matching from the typeEncodings map var rtn = typeEncodings [ type ] if ( rtn ) return rtn // last shot... try the last char? this may be a bad idea... rtn = typeEncodings [ type [ type . length - 1 ] ] if ( rtn ) return rtn // couldn't find the type. throw a descriptive error as to why: if ( type [ 0 ] == '[' ) return 'pointer' ; //throw new Error('Array types not yet supported: ' + type) if ( type [ 0 ] == '(' ) return 'pointer' ; //throw new Error('Union types not yet supported: ' + type) if ( type [ 0 ] == 'b' ) return 'pointer' ; //throw new Error('Bit field types not yet supported: ' + type) throw new Error ( 'Could not convert type: ' + type ) }
Maps a single Obj-C 'type' into a valid node-ffi type.
This mapping logic is kind of a mess...
Maps a single Obj - C type into a valid node - ffi type . This mapping logic is kind of a mess ...