.NAME Stream input/output library

.DESCRIPTION
	The stream input/output library <cstdio> shall not be used.

.COMMENT V7.0

.SEVERITY Required

.COMMENT
Please refer to the MISRA C++:2008 document for further details (www.misra-cpp.com)

.COMMAND tcl

.CODE

::logiscope::include -once common utilities.tcl

proc compute {standardName tree} {
  variable CurrentParameterList
  # Look for an include cstdio directive
  utilities::filterTree $tree [list [namespace current]::check]
}

proc check { node } {
  # Look for an include cstdio directive
  set curOperator [::logiscope::treeOperator $node]
  set curOperatorName [::logiscope::opName $curOperator]
  if {[string equal $curOperatorName pp_include]} {
    # Check if the included file is cstdio
	set operatorNode [::logiscope::treeDown $node 0]
    set operatorAtom [::logiscope::treeAtomValue $operatorNode]
    set operatorAtomValue [::logiscope::stringValue $operatorAtom]
  if {[string equal $operatorAtomValue cstdio]} {
	  ::logiscope::addViolation $node
	  return 0
	}
  }
  return 1
}
