Processes

Introduction

The process opcodes are for launching programs from nano.
Processes can be started synchron or asynchron. Synchron means that nano
halts until the program is finished. An asynchron launched program will run
parallel, nano continues running.

The following example launches the windows notepad:


//  process.na
//  launching a program

    #setreg_l       L0, null;
    #setreg_l       L1, one;
    #setreg_l       L2, two;
    #setreg_l       L3, process;
    #setreg_l       L4, retcode;

    push_i          0, null;
    push_i          1, one;
    push_i          2, two;


    string prog[256];


    move_s          "C:/windows/system32/notepad.exe", prog;

    print_s         "running notepad...";
    print_n         one;

    runpr           prog, process;

//  wait until process ends
    waitpr          process, retcode;

    print_s         "return code: ";
    print_l         retcode;
    print_n         two;

    exit            null;

Opcodes

    L = long register, SV = string variable

    runpr           SV (program name), L (process number);          launch program
    runsh           SV (program name), L (return code);             launch shell

    waitpr          L (process number), L (return code);            wait until process ends

error codes

The process opcodes return a error code to the variable "_process".
Take a look at the "process.nah" include for more info.


Amiga Notes:

This is not implemented in the Amiga port.
The reason is simple: I couldn't get any valuable information.
If you know more, then please contact me.



Prev: TCP/IP Sockets | Next: Stack