{"action":"created","issue":{"url":"https://api.github.com/repos/nasa/trick/issues/88","labels_url":"https://api.github.com/repos/nasa/trick/issues/88/labels{/name}","comments_url":"https://api.github.com/repos/nasa/trick/issues/88/comments","events_url":"https://api.github.com/repos/nasa/trick/issues/88/events","html_url":"https://github.com/nasa/trick/issues/88","id":96426807,"number":88,"title":"\"Could not find Data Record variable\" for union members","user":{"login":"mohawkjohn","id":165284,"avatar_url":"https://avatars.githubusercontent.com/u/165284?v=3","gravatar_id":"","url":"https://api.github.com/users/mohawkjohn","html_url":"https://github.com/mohawkjohn","followers_url":"https://api.github.com/users/mohawkjohn/followers","following_url":"https://api.github.com/users/mohawkjohn/following{/other_user}","gists_url":"https://api.github.com/users/mohawkjohn/gists{/gist_id}","starred_url":"https://api.github.com/users/mohawkjohn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mohawkjohn/subscriptions","organizations_url":"https://api.github.com/users/mohawkjohn/orgs","repos_url":"https://api.github.com/users/mohawkjohn/repos","events_url":"https://api.github.com/users/mohawkjohn/events{/privacy}","received_events_url":"https://api.github.com/users/mohawkjohn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-21T22:05:53Z","updated_at":"2015-07-22T19:30:36Z","closed_at":null,"body":"Hi there. I've got a C struct which includes a union, like so:\r\n\r\n```\r\ntypedef struct SENSOR_MEAS_T {\r\n  double                time_tag;\r\n  union {\r\n    POS_VEL_DATA_T      ground_point;\r\n    GPS_DATA_T          gps;\r\n    ALTIMETER_DATA_T    altimeter;\r\n    STAR_TRACKER_DATA_T star_tracker;\r\n    //    BEARING_DATA_T      bearing;\r\n  } sensor;\r\n  // This union includes 6 characters, which leaves us with\r\n  // space for two more before the 8-byte boundary:\r\n  uint8                 valid_measurement;\r\n  NAV_SENSOR_CONFIG_T   sensor_type; // Specifies which union member is included; must be 1 byte\r\n} SENSOR_MEAS_T;\r\n```\r\n\r\nTrick seems able to see `time_tag`, `valid_measurement`, and `sensor_type`; but it gives me errors for the other variables:\r\n```\r\n|L   2|2015/07/21,14:52:39|im-dev| |T 0|0.000000| Could not find Data Record variable MsgBus.msg_bus_data.sensor_out_data[1].data.sensor.gps.gps_time.\r\n|L   2|2015/07/21,14:52:39|im-dev| |T 0|0.000000| Could not find Data Record variable MsgBus.msg_bus_data.sensor_out_data[1].data.sensor.gps.valid_measurement.\r\n|L   2|2015/07/21,14:52:39|im-dev| |T 0|0.000000| Could not find Data Record variable MsgBus.msg_bus_data.sensor_out_data[0].data.sensor.star_tracker.QR_meas.s.\r\n|L   2|2015/07/21,14:52:39|im-dev| |T 0|0.000000| Could not find Data Record variable MsgBus.msg_bus_data.sensor_out_data[1].data.sensor.gps.position[0].\r\n|L   2|2015/07/21,14:52:39|im-dev| |T 0|0.000000| Could not find Data Record variable MsgBus.msg_bus_data.sensor_out_data[1].data.sensor.gps.velocity[0].\r\n|L   2|2015/07/21,14:52:39|im-dev| |T 0|0.000000| Could not find Data Record variable MsgBus.msg_bus_data.sensor_out_data[0].data.sensor.star_tracker.QR_meas.v[0].\r\n|L   2|2015/07/21,14:52:39|im-dev| |T 0|0.000000| Could not find Data Record variable MsgBus.msg_bus_data.sensor_out_data[1].data.sensor.gps.position[1].\r\n|L   2|2015/07/21,14:52:39|im-dev| |T 0|0.000000| Could not find Data Record variable MsgBus.msg_bus_data.sensor_out_data[1].data.sensor.gps.velocity[1].\r\n|L   2|2015/07/21,14:52:39|im-dev| |T 0|0.000000| Could not find Data Record variable MsgBus.msg_bus_data.sensor_out_data[0].data.sensor.star_tracker.QR_meas.v[1].\r\n|L   2|2015/07/21,14:52:39|im-dev| |T 0|0.000000| Could not find Data Record variable MsgBus.msg_bus_data.sensor_out_data[1].data.sensor.gps.position[2].\r\n|L   2|2015/07/21,14:52:39|im-dev| |T 0|0.000000| Could not find Data Record variable MsgBus.msg_bus_data.sensor_out_data[1].data.sensor.gps.velocity[2].\r\n|L   2|2015/07/21,14:52:39|im-dev| |T 0|0.000000| Could not find Data Record variable MsgBus.msg_bus_data.sensor_out_data[0].data.sensor.star_tracker.QR_meas.v[2].\r\n```\r\n\r\nThe ones it can't find all have the distinction that they are members of structs inside of the union.\r\n\r\nThe docs say Trick should be able to understand unions. Do I need to do something special?"},"comment":{"url":"https://api.github.com/repos/nasa/trick/issues/comments/123836451","html_url":"https://github.com/nasa/trick/issues/88#issuecomment-123836451","issue_url":"https://api.github.com/repos/nasa/trick/issues/88","id":123836451,"user":{"login":"alexlin0","id":8008141,"avatar_url":"https://avatars.githubusercontent.com/u/8008141?v=3","gravatar_id":"","url":"https://api.github.com/users/alexlin0","html_url":"https://github.com/alexlin0","followers_url":"https://api.github.com/users/alexlin0/followers","following_url":"https://api.github.com/users/alexlin0/following{/other_user}","gists_url":"https://api.github.com/users/alexlin0/gists{/gist_id}","starred_url":"https://api.github.com/users/alexlin0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexlin0/subscriptions","organizations_url":"https://api.github.com/users/alexlin0/orgs","repos_url":"https://api.github.com/users/alexlin0/repos","events_url":"https://api.github.com/users/alexlin0/events{/privacy}","received_events_url":"https://api.github.com/users/alexlin0/received_events","type":"User","site_admin":false},"created_at":"2015-07-22T19:30:36Z","updated_at":"2015-07-22T19:30:36Z","body":"Trick cannot handle nested structs or unions.  You will have to pull that union out.  It won't change your variable names:\r\n\r\n```\r\ntypedef union {\r\n    POS_VEL_DATA_T      ground_point;\r\n    GPS_DATA_T          gps;\r\n    ALTIMETER_DATA_T    altimeter;\r\n    STAR_TRACKER_DATA_T star_tracker;\r\n    //    BEARING_DATA_T      bearing;\r\n  } SENSOR_TYPE ;\r\n\r\ntypedef struct SENSOR_MEAS_T {\r\n  double                time_tag;\r\n  SENSOR_TYPE  sensor;\r\n  // This union includes 6 characters, which leaves us with\r\n  // space for two more before the 8-byte boundary:\r\n  uint8                 valid_measurement;\r\n  NAV_SENSOR_CONFIG_T   sensor_type; // Specifies which union member is included; must be 1 byte\r\n} SENSOR_MEAS_T;\r\n```\r\n"}}