Re: Back & Forth - 4tH I/O and You

Liste des GroupesRevenir à cl forth 
Sujet : Re: Back & Forth - 4tH I/O and You
De : mhx (at) *nospam* iae.nl (mhx)
Groupes : comp.lang.forth
Date : 18. May 2025, 20:10:34
Autres entêtes
Organisation : novaBBS
Message-ID : <fce9942b8d6e52702b330d5edcde5b4f@www.novabbs.com>
References : 1 2 3 4
User-Agent : Rocksolid Light
On Sun, 18 May 2025 18:55:27 +0000, albert@spenarnc.xs4all.nl wrote:

In article <nnd$68843db9$0f3297b6@f356aed0e515fe8b>,

The integration with the OS-es makes for useful applications.
~/PROJECT/ciforths/ciforth/TOOLS/ALLOCATE: cat printhex.frt
: doit 1 ARG[] EVALUATE HEX . ;
~/PROJECT/ciforths/ciforth/TOOLS/ALLOCATE: printhex 1024;echo
400
>
[lina -c printhex.frt]
In iForth we can redirect to a string:
: ngspice-POSTLUDE ( -- c-addr u )
DRY-RUN ( using TASK-DATA setup by SP>NGSPICE )
|head .paramdata LOCAL mem
<$$    ." * Generated by iSPICE on " .TIME$ ."  -- do not edit"
CR
CR ." .control"
CR ."     unset ltspice"
CR ."     unset dotstep"
CR ."     set numthreads=1
CR ."     set ispice = " #|params 0<> 1 AND .
CR ."     "
   ." let spiceidx = $SPICEIDX ; "
   ." let ntasks="   #|tasks   ."#"
   ." let ncpus="    #|cpus    ."#"
   ." let nparams="  #|params  ."#"
   ." let nresults=" #|results ."#"
#|params
   IF CR    ."     compose p values "
#|tasks 0 ?DO CR ." +       "
#|params 0 ?DO   mem DF@+ TO mem
                                                         F.N2+_
                                                  LOOP
LOOP
CR #|params 1 > IF  ."         reshape p[" #|tasks
                                            0DEC.R ." ][" #|params
0DEC.R ." ]"
                                     ENDIF
ENDIF
CR ."         let ignore = 0"
CR ."         let buf    = 0"
CR ."         let done   = 0"
CR ."         let ix     = spiceidx"
CR ."         compose arg    values  " #|tasks #|results * .
                              #|results 0DEC.R ."   ix  0  0.0"
CR ."         compose status values  ncpus  spiceidx"
CR ."         dowhile ix < ntasks"
#|params  0 ?DO CR #|params 1 > IF  ." let buf = p[ix][" I
                                                    0DEC.R ." ]"
         ELSE  ." let buf = p[ix]"
       ENDIF
CR ." alterparam " |head .pnames I CSTR[] .$
                                   ."  = $&buf"
   LOOP
#|params   IF   CR ."             mc_source"   ENDIF
CR ."             " $SIM @+ 1 /STRING TYPE
#|results 0 ?DO CR ."             let arg[3] = " I ."#"
CR ."                " I (meashead) TYPE
                                   ." arg[4] " I (measbody) TYPE
CR ."             let ignore=setresult(arg) "
   LOOP
CR ."             let ix = ix + ncpus"
CR ."             let arg[2] = ix"
CR ."             write " RAWDATA-NAME
                                                  NO-EXTENSION
                                                  S" _{$spiceidx}{.raw}"
$+ TYPE
#|tasks    IF CR ."             set appendwrite"  ENDIF
CR ."         end"
CR ."         let done = setfinish(status)"
CR ."         quit"
CR ." .endc"
$$>
SCRIPTFILE-NAME DUMP-TO-FILE
CR ." Please manually add the following lines to `" cktfile .$ ." .sp`"
CR
CR ." .LIBRARY basic.lib basicstuff"
CR ." .OPTION savecurrents"
CR ." .INC " cktfile .$ ." .iscript"
CR ; PRIVATE
( This mixes Forth with the SPICE shell script language )
Result:
* Generated by iSPICE on 23:19:11, December 9, 2024 -- do not edit
control
    unset ltspice
    unset dotstep
    set numthreads=1  $ make sure spinit has this too; we can't overrule
spinit!
    set ispice = 0
    let spiceidx = $SPICEIDX ; let ntasks=1; let ncpus=8;
                               let nparams=0; let nresults=2;
        let ignore = 0
        let buf    = 0
        let done   = 0
        let ix     = spiceidx
        compose arg    values  2 2  ix  0  0.0
        compose status values  ncpus  spiceidx
        dowhile ix < ntasks
            TRAN 30u 30ms 0 30u
            let arg[3] = 0;
               meas tran arg[4] AVG @i1[current]
            let ignore=setresult(arg)
            let arg[3] = 1;
               meas tran arg[4] AVG @i2[current]
            let ignore=setresult(arg)
            let ix = ix + ncpus
            let arg[2] = ix
            write f:/2jsource_test_{$spiceidx}{.raw}
            set appendwrite
        end
        let done = setfinish(status)
        quit
endc
-marcel

Date Sujet#  Auteur
17 May 25 * Back & Forth - 4tH I/O and You13Hans Bezemer
18 May 25 +* Re: Back & Forth - 4tH I/O and You11dxf
18 May 25 i+* Re: Back & Forth - 4tH I/O and You2mhx
19 May 25 ii`- Re: Back & Forth - 4tH I/O and You1mhx
19 May 25 i`* Re: Back & Forth - 4tH I/O and You8dxf
19 May 25 i +- Re: Back & Forth - 4tH I/O and You1dxf
19 May 25 i +- Re: Back & Forth - 4tH I/O and You1albert
19 May 25 i `* Re: Back & Forth - 4tH I/O and You5dxf
20 May 25 i  `* Re: Back & Forth - 4tH I/O and You4dxf
20 May 25 i   +* Re: Back & Forth - 4tH I/O and You2albert
21 May 25 i   i`- Re: Back & Forth - 4tH I/O and You1dxf
22 May 25 i   `- Re: Back & Forth - 4tH I/O and You1dxf
20 May 25 `- EOC [Re: Back & Forth - 4tH I/O and You]1Buzz McCool

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal