Skip to content

Commit 988c9a1

Browse files
committed
add basic crash report logging
1 parent e8f97cb commit 988c9a1

13 files changed

Lines changed: 126 additions & 10 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ eframe = { version = "0.34",features=[
4242
"x11",
4343
"persistence", "wgpu"] }
4444
wgpu = { version = "29", features = [ "webgpu", "webgl", "vulkan", "metal", "gles", "wgsl", ] }
45+
4546
bytemuck = "1"
4647
cfg-if = "1"
4748
egui_plot="0.35"
@@ -77,6 +78,7 @@ getrandom = { version = "0.3", features = ["wasm_js"] }
7778
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
7879
puffin = { version = "0.20", optional = true }
7980
puffin_http = { version = "0.17", optional = true }
81+
directories = "6"
8082

8183
[target.'cfg(target_arch = "wasm32")'.dependencies]
8284
wasm-bindgen-futures = "0.4"

evalexpr/src/flat_node/compile.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,10 @@ fn compile_operator_function<NumericTypes: EvalexprFloat>(
784784
expect_function_argument_amount(arg_num, 1)?;
785785
Some(FlatOperator::Floor)
786786
},
787+
"trunc" => {
788+
expect_function_argument_amount(arg_num, 1)?;
789+
Some(FlatOperator::Trunc)
790+
},
787791
"round" => {
788792
expect_function_argument_amount(arg_num, 1)?;
789793
Some(FlatOperator::Round)

evalexpr/src/flat_node/eval.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,10 @@ fn eval_priv_inner<F: EvalexprFloat>(
584584
let x = stack.pop_unchecked();
585585
stack.push(floor(x)?);
586586
},
587+
FlatOperator::Trunc => {
588+
let x = stack.pop_unchecked();
589+
stack.push(trunc(x)?);
590+
},
587591
FlatOperator::Round => {
588592
let x = stack.pop_unchecked();
589593
stack.push(round(x)?);
@@ -1275,6 +1279,9 @@ pub fn abs<F: EvalexprFloat>(value: Value<F>) -> EvalexprResult<Value<F>, F> {
12751279
pub fn floor<F: EvalexprFloat>(value: Value<F>) -> EvalexprResult<Value<F>, F> {
12761280
math_unary(value, "floor", |v| v.floor())
12771281
}
1282+
pub fn trunc<F: EvalexprFloat>(value: Value<F>) -> EvalexprResult<Value<F>, F> {
1283+
math_unary(value, "trunc", |v| v.trunc())
1284+
}
12781285
pub fn round<F: EvalexprFloat>(value: Value<F>) -> EvalexprResult<Value<F>, F> {
12791286
math_unary(value, "round", |v| v.round())
12801287
}

evalexpr/src/flat_node/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ pub enum FlatOperator<F: EvalexprFloat> {
185185
Floor,
186186
Round,
187187
Ceil,
188+
Trunc,
189+
188190
Ln,
189191
Log, // 2 params
190192
Log2,

evalexpr/src/flat_node/subexpression_elemination.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ fn num_args<F: EvalexprFloat>(op: &FlatOperator<F>) -> usize {
431431
| FlatOperator::Cbrt
432432
| FlatOperator::Abs
433433
| FlatOperator::Floor
434+
| FlatOperator::Trunc
434435
| FlatOperator::Round
435436
| FlatOperator::Ceil
436437
| FlatOperator::Ln

evalexpr/src/flat_node/variable_inlining.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,9 @@ pub fn inline_variables_and_fold<F: EvalexprFloat>(
413413
FlatOperator::Floor => {
414414
fold_unary_op(&mut new_ops, source_op, eval::floor)?;
415415
},
416+
FlatOperator::Trunc => {
417+
fold_unary_op(&mut new_ops, source_op, eval::trunc)?;
418+
},
416419
FlatOperator::Round => {
417420
fold_unary_op(&mut new_ops, source_op, eval::round)?;
418421
},

evalexpr/src/value/numeric_types.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ pub trait EvalexprFloat:
154154
/// Compute the largest integer less than or equal to `self`.
155155
fn floor(&self) -> Self;
156156

157+
158+
/// `self` rounded towards zero.
159+
fn trunc(&self) -> Self;
160+
157161
/// Returns the nearest integer to `self`. If a value is half-way between two integers, round away from
158162
/// `0.0`.
159163
fn round(&self) -> Self;

evalexpr/src/value/numeric_types/default_numeric_types.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ impl EvalexprFloat for f64 {
102102
fn hypot(&self, other: &Self) -> Self { (*self).hypot(*other) }
103103

104104
fn floor(&self) -> Self { (*self).floor() }
105+
fn trunc(&self) -> Self { (*self).trunc() }
105106

106107
fn round(&self) -> Self { (*self).round() }
107108

evalexpr/src/value/numeric_types/f32_numeric_types.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ impl EvalexprFloat for f32 {
9797
fn hypot(&self, other: &Self) -> Self { (*self).hypot(*other) }
9898

9999
fn floor(&self) -> Self { (*self).floor() }
100+
fn trunc(&self) -> Self { (*self).trunc() }
100101

101102
fn round(&self) -> Self { (*self).round() }
102103

0 commit comments

Comments
 (0)