1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//
// GENERATED FILE
//
use super::*;
use f2rust_std::*;
const FPARSZ: i32 = 1;
const SGTIDX: i32 = 1;
//$Procedure ZZEKMLOC ( EK, return integer metadata location )
pub fn ZZEKMLOC(
HANDLE: i32,
SEGNO: i32,
PAGE: &mut i32,
BASE: &mut i32,
ctx: &mut Context,
) -> f2rust_std::Result<()> {
let mut NSEG: i32 = 0;
let mut TBASE: i32 = 0;
let mut TREE: i32 = 0;
//
// SPICELIB functions
//
//
// Non-SPICELIB functions
//
//
// Local variables
//
//
// Use discovery check-in.
//
//
// Validate the segment number to start out.
//
//
// Get the segment count; validate SEGNO.
//
NSEG = EKNSEG(HANDLE, ctx)?;
//
// Check out SEGNO.
//
if ((SEGNO < 1) || (SEGNO > NSEG)) {
CHKIN(b"ZZEKMLOC", ctx)?;
SETMSG(b"Segment number = #; valid range is 1:#.", ctx);
ERRINT(b"#", SEGNO, ctx);
ERRINT(b"#", NSEG, ctx);
SIGERR(b"SPICE(INVALIDINDEX)", ctx)?;
CHKOUT(b"ZZEKMLOC", ctx)?;
return Ok(());
}
//
// Find the segment in the segment tree.
// Obtain the base address of the first integer page.
//
TBASE = ZZEKTRBS(1, ctx)?;
//
// Look up the head node of the segment tree.
//
DASRDI(
HANDLE,
(TBASE + SGTIDX),
(TBASE + SGTIDX),
std::slice::from_mut(&mut TREE),
ctx,
)?;
//
// Get the segment pointer for the segment having index SEGNO.
// This pointer is actually the page number we're looking for.
//
ZZEKTRDP(HANDLE, TREE, SEGNO, PAGE, ctx)?;
//
// Return the base address of the metadata page as well.
//
*BASE = ZZEKTRBS(*PAGE, ctx)?;
Ok(())
}