aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-semihosting/src/export.rs
blob: 0bbd09f5e036ce4f4361ae2641840204eb1b804d (plain) (blame)
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
//! IMPLEMENTATION DETAILS USED BY MACROS

use core::fmt::{self, Write};

use cortex_m::interrupt;

use crate::hio::{self, HostStream};

static mut HSTDOUT: Option<HostStream> = None;

pub fn hstdout_str(s: &str) {
    let _result = interrupt::free(|_| unsafe {
        if HSTDOUT.is_none() {
            HSTDOUT = Some(hio::hstdout()?);
        }

        HSTDOUT.as_mut().unwrap().write_str(s).map_err(drop)
    });
}

pub fn hstdout_fmt(args: fmt::Arguments) {
    let _result = interrupt::free(|_| unsafe {
        if HSTDOUT.is_none() {
            HSTDOUT = Some(hio::hstdout()?);
        }

        HSTDOUT.as_mut().unwrap().write_fmt(args).map_err(drop)
    });
}

static mut HSTDERR: Option<HostStream> = None;

pub fn hstderr_str(s: &str) {
    let _result = interrupt::free(|_| unsafe {
        if HSTDERR.is_none() {
            HSTDERR = Some(hio::hstderr()?);
        }

        HSTDERR.as_mut().unwrap().write_str(s).map_err(drop)
    });
}

pub fn hstderr_fmt(args: fmt::Arguments) {
    let _result = interrupt::free(|_| unsafe {
        if HSTDERR.is_none() {
            HSTDERR = Some(hio::hstderr()?);
        }

        HSTDERR.as_mut().unwrap().write_fmt(args).map_err(drop)
    });
}
option> Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
path: root/docs/cli/bun-dev.md (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2023-07-28Add todoGravatar Jarred Sumner 2-0/+8
cc @cirospaciari
2023-07-28Update pull_request_template.mdGravatar Jarred Sumner 1-1/+1
2023-07-28Update pull_request_template.mdGravatar Jarred Sumner 1-11/+16
2023-07-27Fix bug with // @bun annotation in main thread (#3855)Gravatar Jarred Sumner 4-2/+53
* Uncomment test * Fix bug with // @bun + async transpiler --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-07-27Add `Bun.isMainThread`Gravatar Jarred Sumner 7-3/+48
2023-07-27Uncomment testGravatar Jarred Sumner 1-1/+1
2023-07-27Resolve watch directories outside main thread + async iterator and symlink ↵Gravatar Ciro Spaciari 8-197/+523
fixes (#3846) * linux working pending tests with FSEvents * add more tests, fix async iterator * remove unnecessary check * fix macos symlink on directories * remove indirection layer * todos * fixes and some permission test * fix opsie and make prisma test more reliable * rebase with main * add comptime check for macOS * oops * oops2 * fix symlinks cascade on FSEvents * use JSC.WorkPool * use withResolver, createFIFO and fix close event on async iterator * remove unused events --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2023-07-27Update pull_request_template.mdGravatar Jarred Sumner 1-1/+1
2023-07-27Update pull_request_template.mdGravatar Jarred Sumner 1-1/+1
2023-07-27Update pull_request_template.mdGravatar Jarred Sumner 1-1/+1
2023-07-27Update pull_request_template.mdGravatar Jarred Sumner 1-2/+2
2023-07-27Update pull_request_template.mdGravatar Jarred Sumner 1-0/+4
2023-07-27Update pull_request_template.mdGravatar Jarred Sumner 1-5/+11