[
The BFStack standard library. It resides in module 1.

use "dispatch.bf"
use "sum_words.bf"
]

>

std{
mod std(1)
dispatch/mod_start{ [>+<-[[<+>-]>-<]>[<+>-]<[-<<<[>>+>+<<<-]>>[<<+>>-]> }
    sub abort(1)
    dispatch/sub_start{ [>+<-[[<+>-]>-<]>[<+>-]<[-<<[>+>+<<-]>[<+>-]>[>+<-[[<+>-]>-<]>[<+>-]<[->+> }
        causes the program to complete
        = M S L 0 | 0 1 | `* * * *
        set the abort code
        <+>
        = M S L 0 | 0 2 | `*
    dispatch/sub_end{ <<]]<[>+<-]>[>[-]+++++<[-]]]]<[>+<-]> }

    sub sum_words(1)
    dispatch/sub_start{ [>+<-[[<+>-]>-<]>[<+>-]<[-<<[>+>+<<-]>[<+>-]>[>+<-[[<+>-]>-<]>[<+>-]<[->+> }
        sums two words (signed or unsigned)
        = M S L 0 | 0 1 | `A0 A1 A2 A3 | 0 0 | B0 B1 B2 B3 | 0 0 | 0 0 0 0
        sum_words/sum_words{
            >>>[>>>>>>>>>+<<<<<<<<<-]>>>>>>[>>>>+<<<<-]>>>>>>[<<<+[[>>+<<-]>>>[-]<<<]>>[<<+>
            >-]>[<+>-]]<[>+<-]<[>>+<<<+[[>>+<<-]>>>-<<<]>>[<<+>>-]<-]<[<<<<<<<<<+>>>>>>>>>-]
            <<<<<<<<<<[>>>>>>>>>>+<<<<<<<<<<-]>>>>>>[>>>>>+<<<<<-]>>>>>>>[<<<+[[>>+<<-]>>>[-
            ]<<<]>>[<<+>>-]>[<+>-]]<[>+<-]<[>>+<<<+[[>>+<<-]>>>-<<<]>>[<<+>>-]<-]<[<<<<<<<<<
            <+>>>>>>>>>>-]<<<<<<<<<<<[>>>>>>>>>>>+<<<<<<<<<<<-]>>>>>>[>>>>>>+<<<<<<-]>>>>>>>
            >[<<<+[[>>+<<-]>>>[-]<<<]>>[<<+>>-]>[<+>-]]<[>+<-]<[>>+<<<+[[>>+<<-]>>>-<<<]>>[<
            <+>>-]<-]<[<<<<<<<<<<<+>>>>>>>>>>>-]<<<<<<<<<<<<[>>>>>>>>>>>>+<<<<<<<<<<<<-]>>>>
            >>[>>>>>>>+<<<<<<<-]>>>>>>>>>[<<<+[[>>+<<-]>>>[-]<<<]>>[<<+>>-]>[<+>-]]<[>+<-]<[
            >>+<<<+[[>>+<<-]>>>-<<<]>>[<<+>>-]<-]<>>>[-]<<<[<<<<<<<<<<<<+>>>>>>>>>>>>-]<<<<<
            <<<<<<<
        }
        = M S L 0 | 0 1 | `C0 C1 C2 C3 | 0 0 | 0 0 0 0 | 0 0 | 0 0 0 0
    dispatch/sub_end{ <<]]<[>+<-]>[>[-]+++++<[-]]]]<[>+<-]> }
dispatch/mod_end{ [>[-]++++<[-]]]]<[>+<-]> }
}
