Differences From Artifact [ba7732f086]:
- File
src/runtime/morphos-library.m
— part of check-in
[0d6873e122]
at
2017-06-13 23:08:34
on branch trunk
— runtime: Add initial morphos-library.m
This allows opening and closing the library, but does not do all the
initialization yet and does not export any functions. (user: js, size: 3747) [annotate] [blame] [check-ins using]
To Artifact [eba1cadc74]:
- File src/runtime/morphos-library.m — part of check-in [8c76d90af0] at 2017-07-08 23:31:42 on branch trunk — src/morphos-library.m: Fix expunging (user: js, size: 3956) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | exit_fn = exit_fn_; } /* Standard library functions */ static struct Library *lib_init(struct ObjFWRTBase *base, BPTR seg_list, struct ExecBase *exec_base) { base->seg_list = seg_list; return &base->library; } static struct Library * lib_open(void) { struct ObjFWRTBase *base = (struct ObjFWRTBase *)REG_A6; base->library.lib_OpenCnt++; base->library.lib_Flags &= ~LIBF_DELEXP; return &base->library; } static BPTR lib_close(void) { struct ObjFWRTBase *base = (struct ObjFWRTBase *)REG_A6; /* Not used anymore and delayed expunge flag set -> expunge */ if (--base->library.lib_OpenCnt == 0 && (base->library.lib_Flags & LIBF_DELEXP)) | > > > > > > > > > > > > > > > > > > | | < < < < < < < < | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | exit_fn = exit_fn_; } /* Standard library functions */ static struct Library *lib_init(struct ObjFWRTBase *base, BPTR seg_list, struct ExecBase *exec_base) { SysBase = exec_base; base->seg_list = seg_list; return &base->library; } static struct Library * lib_open(void) { struct ObjFWRTBase *base = (struct ObjFWRTBase *)REG_A6; base->library.lib_OpenCnt++; base->library.lib_Flags &= ~LIBF_DELEXP; return &base->library; } static BPTR expunge(struct ObjFWRTBase *base) { /* Still in use - set delayed expunge flag and refuse to expunge */ if (base->library.lib_OpenCnt > 0) { base->library.lib_Flags |= LIBF_DELEXP; return 0; } Remove(&base->library.lib_Node); FreeMem((char *)base - base->library.lib_NegSize, base->library.lib_NegSize + base->library.lib_PosSize); return base->seg_list; } static BPTR lib_close(void) { struct ObjFWRTBase *base = (struct ObjFWRTBase *)REG_A6; /* Not used anymore and delayed expunge flag set -> expunge */ if (--base->library.lib_OpenCnt == 0 && (base->library.lib_Flags & LIBF_DELEXP)) return expunge(base); return 0; } static BPTR lib_expunge(void) { return expunge((struct ObjFWRTBase *)REG_A6); } static void lib_null(void) { } |