Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Frida
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coenen, Joachim
Frida
Commits
55a11702
Commit
55a11702
authored
10 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
first arithmetic operation work again.
parent
cb6028e2
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pub/lib/func.hpp
+2
-0
2 additions, 0 deletions
pub/lib/func.hpp
pub/lib/node.cpp
+50
-2
50 additions, 2 deletions
pub/lib/node.cpp
pub/lib/obj.hpp
+7
-5
7 additions, 5 deletions
pub/lib/obj.hpp
with
59 additions
and
7 deletions
pub/lib/func.hpp
+
2
−
0
View file @
55a11702
...
...
@@ -25,6 +25,8 @@ typedef double (*func_d_di) (double, int);
typedef
double
(
*
func_d_dd
)
(
double
,
double
);
typedef
void
(
*
func_e_ee
)
(
double
&
,
double
&
,
double
,
double
,
double
,
double
);
typedef
void
(
*
func_e_eee
)
(
double
&
,
double
&
,
double
,
double
,
double
,
double
,
double
,
double
);
typedef
double
(
*
func_f1
)
(
double
);
typedef
double
(
*
func_f2
)
(
double
,
double
);
typedef
double
(
*
func_f3
)
(
double
,
double
,
double
);
...
...
This diff is collapsed.
Click to expand it.
pub/lib/node.cpp
+
50
−
2
View file @
55a11702
...
...
@@ -185,9 +185,57 @@ const RObj CNodeFun::tree_val( const CContext& ctx ) const
const
CTypedFunc
*
tf
=
fu
->
find_tyfu
(
base_types
,
ctx
.
want_error
);
if
(
!
tf
)
throw
"function "
+
fu
->
tag
+
" not implemented for argument types "
+
base_types
;
void
*
f
=
tf
->
f
;
if
(
is_scalar
)
{
if
(
tf
->
outtype
==
"i"
)
{
PObjInt
pret
(
new
CObjInt
()
);
if
(
tf
->
intypes
==
"i"
)
pret
->
val
=
(
*
(
func_i_i
)(
f
))(
pa
[
0
]
->
to_i
()
);
else
if
(
tf
->
intypes
==
"d"
)
pret
->
val
=
(
*
(
func_i_d
)(
f
))(
pa
[
0
]
->
to_r
()
);
else
if
(
tf
->
intypes
==
"ii"
)
pret
->
val
=
(
*
(
func_i_ii
)(
f
))(
pa
[
0
]
->
to_i
(),
pa
[
1
]
->
to_i
()
);
else
if
(
tf
->
intypes
==
"dd"
)
pret
->
val
=
(
*
(
func_i_dd
)(
f
))(
pa
[
0
]
->
to_r
(),
pa
[
1
]
->
to_r
()
);
else
throw
"BUG: unexpected intypes"
;
return
pret
;
}
else
if
(
tf
->
outtype
==
"d"
)
{
PObjDble
pret
(
new
CObjDble
()
);
if
(
tf
->
intypes
==
"i"
)
pret
->
val
=
(
*
(
func_d_i
)(
f
))(
pa
[
0
]
->
to_i
()
);
else
if
(
tf
->
intypes
==
"d"
)
pret
->
val
=
(
*
(
func_d_d
)(
f
))(
pa
[
0
]
->
to_r
()
);
else
if
(
tf
->
intypes
==
"ii"
)
pret
->
val
=
(
*
(
func_d_ii
)(
f
))(
pa
[
0
]
->
to_i
(),
pa
[
1
]
->
to_i
()
);
else
if
(
tf
->
intypes
==
"dd"
)
pret
->
val
=
(
*
(
func_d_dd
)(
f
))(
pa
[
0
]
->
to_r
(),
pa
[
1
]
->
to_r
()
);
else
throw
"BUG: unexpected intypes"
;
return
pret
;
}
else
if
(
tf
->
outtype
==
"e"
)
{
PObjDble
pret
(
new
CObjDble
()
);
if
(
tf
->
intypes
==
"e"
)
(
*
(
func_e_e
)(
f
))(
pret
->
val
,
pret
->
err
,
pa
[
0
]
->
to_r
(),
pa
[
0
]
->
to_dr
()
);
else
if
(
tf
->
intypes
==
"ee"
)
(
*
(
func_e_ee
)(
f
))(
pret
->
val
,
pret
->
err
,
pa
[
0
]
->
to_r
(),
pa
[
0
]
->
to_dr
(),
pa
[
1
]
->
to_r
(),
pa
[
1
]
->
to_dr
()
);
else
if
(
tf
->
intypes
==
"eee"
)
(
*
(
func_e_eee
)(
f
))(
pret
->
val
,
pret
->
err
,
pa
[
0
]
->
to_r
(),
pa
[
0
]
->
to_dr
(),
pa
[
1
]
->
to_r
(),
pa
[
1
]
->
to_dr
(),
pa
[
2
]
->
to_r
(),
pa
[
2
]
->
to_dr
()
);
else
throw
"BUG: unexpected intypes"
;
return
pret
;
}
else
throw
"BUG: unexpected outtype"
;
}
if
(
is_scalar
||
1
)
throw
"incomplete"
;
throw
"incomplete"
;
/*
bool want_err = ctx.want_error && fu->d3 &&
( pa[0]->has_err()||pa[1]->has_err()||pa[2]->has_err());
...
...
This diff is collapsed.
Click to expand it.
pub/lib/obj.hpp
+
7
−
5
View file @
55a11702
...
...
@@ -19,10 +19,12 @@ class CObj {
virtual
bool
has_err
()
const
=
0
;
virtual
char
base_type
()
const
=
0
;
virtual
string
result_info
()
const
=
0
;
virtual
int
to_i
(
int
i
)
const
{
throw
"to_i(i) not available"
;
};
virtual
double
to_r
(
int
i
)
const
=
0
;
virtual
double
to_dr
(
int
i
)
const
=
0
;
virtual
double
to_r
()
const
=
0
;
virtual
double
to_dr
()
const
=
0
;
virtual
int
to_i
()
const
{
throw
"to_i() not available"
;
};
virtual
double
to_r
()
const
{
throw
"to_r() not available"
;
};
virtual
double
to_dr
()
const
{
throw
"to_r() not available"
;
};
virtual
bool
to_b
()
const
=
0
;
virtual
string
to_s
()
const
=
0
;
};
...
...
@@ -55,8 +57,10 @@ class CObjInt : public CObjNumber {
bool
has_err
()
const
{
return
false
;
};
char
base_type
()
const
{
return
'i'
;
};
string
result_info
()
const
{
return
"CObjInt("
+
S
(
val
)
+
")"
;
};
double
to_r
(
int
i
)
const
{
return
val
?
0.
:
1.
;
};
int
to_i
(
int
i
)
const
{
return
val
;
};
double
to_r
(
int
i
)
const
{
return
val
;
};
double
to_dr
(
int
i
)
const
{
return
0.
;
};
int
to_i
()
const
{
return
val
;
};
double
to_r
()
const
{
return
val
;
};
double
to_dr
()
const
{
return
0.
;
}
;
string
to_s
()
const
;
...
...
@@ -82,8 +86,6 @@ class CObjVecDble : public CObjVec {
string
result_info
()
const
;
double
to_r
(
int
i
)
const
{
return
v
[
i
];
};
double
to_dr
(
int
i
)
const
{
return
dv
.
size
()
?
dv
[
i
]
:
0
;
}
;
double
to_r
()
const
{
throw
"to_r() not available for vector"
;
};
double
to_dr
()
const
{
throw
"to_r() not available for vector"
;
};
string
to_s
()
const
;
bool
to_b
()
const
{
return
v
.
size
();
};
};
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment