source: to-imperative/trunk/library/Vector/vector_length.cc @ 1043

Last change on this file since 1043 was 1043, checked in by sveta, 18 years ago
  • Library VECTOR.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 506 bytes
Line 
1#include <rf_core.hh>
2#include <rf_types.hh>
3
4using namespace rfrt;
5
6namespace refal
7{
8
9namespace Vector
10{
11
12RF_DECL(Vector_m_Length);
13
14RF_FUNC (Vector_m_Length, (RF_ARG _vector), (RF_RES _len))
15
16  if (_vector.get_len() == 1) {
17    Term* p_vector = _vector.get_first();
18    rftype::Vector* v = p_vector->cast_to<rftype::Vector>(type_vector);
19    if (!v)
20      RF_LIB_ERROR("Invalid argument");
21    _len = ShortInt::create_expr(v->get_length());
22  } else
23      RF_LIB_ERROR("Invalid argument");
24
25RF_END
26
27}
28}
Note: See TracBrowser for help on using the repository browser.