www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - rdmd

Attached is a program to compile, cache and execute D source code files or
'pseudo shell scripts' (using the she-bang syntax with dmd v0.146 or above)
on Linux systems.

It will cache the executable in the /tmp directory by default and will
re-compile the executable if any of the source file, the compiler or rdmd
itself is newer than the cached executable. It can optionally use gdmd if
specified, but uses dmd by default.

# rdmd --help
Usage:
        rdmd [D compiler arguments] [rdmd arguments] progfile.d [program
arguments]

rdmd arguments:
        --help                  This message
        --force                 Force re-compilation of source code [default
= do not force]
        --compiler=(dmd|gdmd)   Specify compiler [default = dmd]
        --tmpdir=tmp_dir_path   Specify directory to store cached program
and other temporaries [default = /tmp]

Notes:
        dmd or gdmd must be in the current user context $PATH
        rdmd does not support execution of D source code via stdin
        rdmd will only compile and execute files with a '.d' file extension
;---


begin 666 rdmd.d
M+R\ <F1M9" M(&$ <')O9W)A;2!T;R!C;VUP:6QE+"!C86-H92!A;F0 97AE
M8W5T92!$('!R;V=R86UM:6YG"B\O(&QA;F=U86=E('-O=7)C92!F:6QE<R!V
M:6$ 96ET:&5R('1H92!C;VUM86YD+6QI;F4 ;W( 87, 80HO+R G<'-E=61O
M('-H96QL('-C<FEP="< ;VX 4$]325  8V]N9F]R;6EN9R!,:6YU>"!S>7-T
M96US+ HO+PHO+R!7<FET=&5N(&)Y($1A=F4 1FQA9&5B;R!A;F0 <F5L96%S
M960 :6YT;R!T:&4 <'5B;&EC(&1O;6%I;B!A<PHO+R!E>'!L86EN960 8GD 
M:'1T<#HO+V-R96%T:79E8V]M;6]N<RYO<F<O;&EC96YS97,O<'5B;&EC9&]M
M86EN"B\O"B\O(%1H:7, <V]F='=A<F4 :7, <')O=FED960 (D%3($E3(B!A
M;F0 =VET:&]U="!A;GD 97AP<F5S<R!O< HO+R!I;7!L:65D('=A<G)A;G1I
M97,L(&EN8VQU9&EN9R!A;F0 =VET:&]U="!L:6UI=&%T:6]N('1O+"!A;GD*
M+R\ =V%R<F%N='D ;V8 ;65R8VAA;G1A8FEL:71Y(&]R(&9I=&YE<W, 9F]R
M(&%N>2!P=7)P;W-E+ HO+PHO+R!V97)S:6]N(#$N, H*:6UP;W)T('-T9"YC
M+FQI;G5X+FQI;G5X+"!S=&0N8RYS=&1L:6(L('-T9"YF:6QE+"!S=&0N;60U
M+"!S=&0N<')O8V5S<RP <W1D+G-T9&EO+"!S=&0N<W1R:6YG.PH*:6YT(&UA
M:6XH8VAA<EM=6UT 87)G<RD*>PH ("  :6YT(')E='9A;" ]("TQ.PH ("  
M8F]O;"!H879E9FEL92 ](&9A;'-E+"!F;W)C92 ](&9A;'-E.PH ("  8VAA
M<EM=6UT 8VUP=BP 87)G=CL ("  +R\ 8VUP=B ](&-O;7!I;&5R(&%R9W5M
M96YT<RP 87)G=B ]('!R;V=R86T 87)G=6UE;G1S"B  ("!C:&%R6UT 97AE
M<&%T:"P 9&9I;&5P871H+"!C;VUP:6QE<B ](")D;60B+"!T;7!D:7( /2 B
M+W1M<"([" H ("  +FUY;F%M92 ](&%R9W-;,%T[" H ("  9F]R96%C:"AI
M;G0 :2P 8VAA<EM=(&%R9SL 87)G<RD*("  ('L*("  ("  ("!I9BAI(#T]
M(# I"B  ("  ("  ("  (&-O;G1I;G5E.PH*("  ("  ("!I9BAF:6YD*&%R
M9RPB+F0B*2 ^/2 P*0H ("  ("  ('L*("  ("  ("  ("  :&%V969I;&4 
M/2!T<G5E.PH ("  ("  ("  ("!D9FEL97!A=&  /2!A<F<["B  ("  ("  
M?0H ("  ("  (&5L<V4*("  ("  ("!["B  ("  ("  ("  (&EF*&AA=F5F
M:6QE(#T](&9A;'-E*0H ("  ("  ("  ("!["B  ("  ("  ("  ("  ("!B
M;V]L('-K:7  /2!F86QS93L*("  ("  ("  ("  ("  (&EF*&%R9R ]/2 B
M+2UH96QP(BD*("  ("  ("  ("  ("  ("  ("!U<V%G93L*("  ("  ("  
M("  ("  (&5L<V4 :68H87)G(#T]("(M+69O<F-E(BD*("  ("  ("  ("  
M("  ("  ("!S:VEP(#T 9F]R8V4 /2!T<G5E.PH ("  ("  ("  ("  ("  
M96QS90H ("  ("  ("  ("  ("  >PH ("  ("  ("  ("  ("  ("  (&-O
M;G-T(&-H87);72!C<R ]("(M+6-O;7!I;&5R/2(["B  ("  ("  ("  ("  
M("  ("  :68H87)G+FQE;F=T:" ^(&-S+FQE;F=T:" F)B!A<F=;,"XN8W,N
M;&5N9W1H72 ]/2!C<RD*("  ("  ("  ("  ("  ("  ("!["B  ("  ("  
M("  ("  ("  ("  ("  (&-O;7!I;&5R(#T <W!L:70H87)G+"(](BE;,5T[
M"B  ("  ("  ("  ("  ("  ("  ("  ('-K:7  /2!T<G5E.PH ("  ("  
M("  ("  ("  ("  ('T*("  ("  ("  ("  ("  ("  ("!C;VYS="!C:&%R
M6UT =&0 /2 B+2UT;7!D:7(](CL*("  ("  ("  ("  ("  ("  ("!I9BAA
M<F<N;&5N9W1H(#X =&0N;&5N9W1H("8F(&%R9ULP+BYT9"YL96YG=&A=(#T]
M('1D*0H ("  ("  ("  ("  ("  ("  ('L*("  ("  ("  ("  ("  ("  
M("  ("  =&UP9&ER(#T <W!L:70H87)G+"(](BE;,5T["B  ("  ("  ("  
M("  ("  ("  ("  ('-K:7  /2!T<G5E.PH ("  ("  ("  ("  ("  ("  
M('T*("  ("  ("  ("  ("  ('T*"B  ("  ("  ("  ("  ("!I9B A<VMI
M<"D*("  ("  ("  ("  ("  ("  ("!C;7!V('X](&%R9SL*("  ("  ("  
M("  ?0H ("  ("  ("  ("!E;'-E"B  ("  ("  ("  ("  ("!A<F=V('X]
M(&%R9SL*("  ("  ("!]"B  ("!]" H ("  :68H(6AA=F5F:6QE*0H ("  
M("  (&5R<F]R*")#;W5L9&XG="!F:6YD(&%N>2!$('-O=7)C92!C;V1E(&9I
M;&4 =&\ 8V]M<&EL92!O<B!E>&5C=71E+B(L(')E='9A;"D[" H ("  :68H
M8V]M<&EL92AT;7!D:7(L8V]M<&EL97(L9F]R8V4L9&9I;&5P871H+&-M<'8L
M97AE<&%T:"DI"B  ("!["B  ("  ("  8VAA<EM=6UT 97AE87)G=CL*("  
M("  ("!E>&5A<F=V('X](&5X97!A=& ["B  ("  ("  9F]R96%C:"AC:&%R
M6UT 87)G.R!A<F=V*2!E>&5A<F=V('X](&%R9SL*("  ("  ("!R971V86P 
M/2!S<&%W;F%P<"AE>&5P871H+&5X96%R9W8I.R O+R!E>&5C=71E"B  ("!]
M"B  ("!E;'-E"B  ("!["B  ("  ("  =')Y('L <W1D+F9I;&4N<F5M;W9E
M*&5X97!A=& I.R!](&-A=&-H('M]"B  ("  ("  97)R;W(H(D-O=6QD;B=T
M(&-O;7!I;&4 ;W( 97AE8W5T92 B('X 9&9I;&5P871H('X (BXB+"!R971V
M86PI.PH ("  ?0H*("  (')E='5R;B!R971V86P["GT*"F-H87);72!M>6YA
M;64["G9O:60 97)R;W(H8VAA<EM=(&5R<FUS9RP :6YT(&5R<FYO*0I["B  
M("!F=W)I=&5F;&XH<W1D97)R+&UY;F%M92PB.B B+&5R<FUS9RD["B  ("!E
M>&ET*&5R<FYO*3L*?0H*=F]I9"!U<V%G92 I"GL*("  (&9W<FET969L;BAS
M=&1E<G(L(E5S86=E.B(I.PH ("  9G=R:71E9FQN*'-T9&5R<BPB7'0B+&UY
M;F%M92PB(%M$(&-O;7!I;&5R(&%R9W5M96YT<UT 6R(L;7EN86UE+"( 87)G
M=6UE;G1S72!P<F]G9FEL92YD(%MP<F]G<F%M(&%R9W5M96YT<UTB*3L*("  
M(&9W<FET969L;BAS=&1E<G(I.PH ("  9G=R:71E9FQN*'-T9&5R<BQM>6YA
M;64L(B!A<F=U;65N=',Z(BD["B  ("!F=W)I=&5F;&XH<W1D97)R+")<="TM
M:&5L<%QT7'1<=%1H:7, ;65S<V%G92(I.PH ("  9G=R:71E9FQN*'-T9&5R
M<BPB7'0M+69O<F-E7'1<=%QT1F]R8V4 <F4M8V]M<&EL871I;VX ;V8 <V]U
M<F-E(&-O9&4 6V1E9F%U;'0 /2!D;R!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&5S=&%T*3L*"B  ("!C
M:&%R6UU;72!P871H8V]M<', /2!S<&QI="AD9FEL97!A=& L(B\B*3L*("  
M(&-H87);72!E>&5F:6QE(#T <W!L:70H<&%T:&-O;7!S6R0M,5TL(BXB*5LP
M73L*"B  ("!C:&%R6UT 8VUD;&EN92 ](&-O;7!I;&5R('X (B M<75I970B
M.PH ("  9F]R96%C:"AC:&%R6UT <W1R.R!C;7!V*0H ("  ("  (&EF*'-T
M<B A/2 B(BD*("  ("  ("  ("  8VUD;&EN92!^/2 B("( ?B!S='([" H 
M("  +R\ 340U('-U;2!O9B!C;VUP:6QE<B!A<F=U;65N=',*("  ('5B>71E
M6S$V72!D:6=E<W0["B  ("!S=6TH9&EG97-T+&-A<W0H=F]I9%M=*6-M9&QI
M;F4I.PH*("  ("\O(&1I<F5C=&]R>2!F;W( =&5M<"X 9FEL97,*("  (&EF
M*"%T;7!D:7(N;&5N9W1H*0H ("  ("  ('1M<&1I<B ]("(O=&UP+R(["B  
M("!E;'-E"B  ("  ("  :68H=&UP9&ER6R0M,5T (3T )R\G*0H ("  ("  
M("  ("!T;7!D:7( ?CT (B\B.PH*("  ("\O(&5X92!F:6QE;F%M92!F;W)M
M870 :7, 8F%S96YA;64M=6ED+69I;&5S>7-D978M:6YO9&4M340U"B  (" O
M+R!A<'!E;F0 340U('-U;2!O9B!T:&4 8V]M<&EL97( 87)G=6UE;G1S(&]N
M=&\ =&AE(&9I;&4 ;F%M92!T;R!F;W)C92!R96-O;7!I;&4 :68 =&AE>2!H
M879E(&-H86YG960*("  (&5X97!A=&  /2!T;7!D:7( ?B!E>&5F:6QE('X 
M(BTB('X =&]3=')I;F<H9V5T=6ED*2!^("(M(B!^('1O4W1R:6YG*&1F:6QE
M<W1A="YS=%]D978I('X (BTB('X =&]3=')I;F<H9&9I;&5S=&%T+G-T7VEN
M;RD ?B B+2( ?B!D:6=E<W14;U-T<FEN9RAD:6=E<W0I.PH*("  ('-T<G5C
M=%]S=&%T(&5X97-T870[("  ("\O('1E;7 N(&5X96-U=&%B;&4 <W1A='5S
M(&EN9F\N"B  ("!I;G0 97AE<G8 /2!S=&%T*&5X97!A=& L)F5X97-T870I
M.PH ("  :68H9F]R8V4 ?'P ("  ("  ("  ("  ("  ("  ("  ("  ("  
M("  (" O+R!F;W)C92!C;VUP:6QA=&EO; H ("  ("  97AE<G8 ?'P ("  
M("  ("  ("  ("  ("  ("  ("  ("  ("  (" O+R!S=&%T(')E='5R;F5D
M(&%N(&5R<F]R("AE+F<N.B!N;R!E>&5F:6QE*0H ("  ("  9&9I;&5S=&%T
M+G-T7VUT:6UE(#X 97AE<W1A="YS=%]M=&EM92!\?" O+R!S;W5R8V4 8V]D
M92!F:6QE(&ES(&YE=V5R('1H86X 97AE8W5T86)L90H ("  ("  <')O9W-T
M870H+FUY;F%M92DN<W1?;71I;64 /B!E>&5S=&%T+G-T7VUT:6UE('Q\("\O
M('1H:7, <')O9W)A;2!I<R!N97=E<B!T:&%N(&5X96-U=&%B;&4*("  ("  
M('!R;V=S=&%T*&-O;7!I;&5R*2YS=%]M=&EM92 ^(&5X97-T870N<W1?;71I
M;64I(" O+R!C;VUP:6QE<B!I<R!N97=E<B!T:&%N(&5X96-U=&%B;&4*("  
M('L*("  ("  ("!C;61L:6YE('X]("( (B!^(&1F:6QE<&%T:"!^("( +6]F
M(B!^(&5X97!A=&  ?B B("UO9"( ?B!T;7!D:7(["B  ("  ("  <F5T=F%L
M(#T <WES=&5M*&-M9&QI;F4I.R  ("\O(&-O;7!I;&4*("  ("  ("!C:&UO
M9"AE>&5P871H+# W,# I.PH ("  ?0H*("  ("\O(')E;6]V92!O8FIE8W0 
M9FEL90H ("  =')Y('L <W1D+F9I;&4N<F5M;W9E*'1M<&1I<B!^(&5X969I
M;&4 ?B B+F\B*3L ?2!C871C:"![?0H*("  (')E='5R;B!C87-T*&)O;VPI
M*')E='9A;" ]/2 P*3L*?0H*<W1R=6-T7W-T870 <')O9W-T870H8VAA<EM=
M('!R;V=R86TI"GL*("  ('-T<G5C=%]S=&%T('!R;V=S=&%T.R  +R\ 1"!S
M;W5R8V4 8V]D92!F:6QE('-T871U<R!I;F9O+ H*("  ('1R>0H ("  >PH 
M("  ("  (&EN="!P<F=R=CL*("  ("  ("!I9BAF:6YD*'!R;V=R86TL(B\B
M*2 ^/2 P*0H ("  ("  ("  ("!P<F=R=B ]('-T870H<')O9W)A;2P )G!R
M;V=S=&%T*3L*("  ("  ("!E;'-E"B  ("  ("  >PH ("  ("  ("  (" O
M+R!4:&5R92=S(&=O="!T;R!B92!A(&)E='1E<B!W87DN+BX*("  ("  ("  
M("  8VAA<EM=6UT <&%T:&1I<G, /2!S<&QI="AT;U-T<FEN9RAG971E;G8H
M(E!!5$ B*2DL(CHB*3L*("  ("  ("  ("  9F]R96%C:"AC:&%R6UT 9&ER
M.R!P871H9&ER<RD*("  ("  ("  ("  ("  ('!R9W)V(#T <W1A="AD:7( 
M?B B+R( ?B!P<F]G<F%M+" F<')O9W-T870I.PH ("  ("  ('T*("  ('T*
M("  (&-A=&-H('M]" H ("  <F5T=7)N('!R;V=S=&%T.PI]" II;G0 <W!A
M=VYA<' H8VAA<EM=('!A=&AN86UE+"!C:&%R6UU;72!A<F=V*0I["B  ("!I
M;G0 <F5T=F%L(#T ,#L*("  ('!I9%]T('!I9" ](&9O<FL[" H ("  :68H
M<&ED("$]("TQ*0H ("  >PH ("  ("  (&EF*'!I9" ]/2 P*0H ("  ("  
M('L*("  ("  ("  ("  97AE8W8H<&%T:&YA;64L87)G=BD["B  ("  ("  
M("  (&=O=&\ 3&5R<F]R.PH ("  ("  ('T*"B  ("  ("  =VAI;&4H,2D*
M("  ("  ("!["B  ("  ("  ("  (&EN="!S=&%T=7,["B  ("  ("  ("  
M('!I9%]T('=P:60 /2!W86ET<&ED*'!I9"P )G-T871U<RP ,"D["B  ("  
M("  ("  (&EF*&5X:71E9"AS=&%T=7,I*0H ("  ("  ("  ("!["B  ("  
M("  ("  ("  ("!R971V86P /2!E>&ET<W1A='5S*'-T871U<RD["B  ("  
M("  ("  ("  ("!B<F5A:SL*("  ("  ("  ("  ?0H ("  ("  ("  ("!E
M;'-E(&EF*'-I9VYA;&5D*'-T871U<RDI"B  ("  ("  ("  ('L*("  ("  
M("  ("  ("  (')E='9A;" ]("UT97)M<VEG*'-T871U<RD["B  ("  ("  
M("  ("  ("!B<F5A:SL*("  ("  ("  ("  ?0H ("  ("  ("  ("!E;'-E
M(&EF*'-T;W!P960H<W1A='5S*2D +R\ <'1R86-E('-U<'!O<G0*("  ("  
M("  ("  ("  (&-O;G1I;G5E.PH ("  ("  ("  ("!E;'-E"B  ("  ("  
M("  ("  ("!G;W1O($QE<G)O<CL*("  ("  ("!]" H ("  ("  (')E='5R
M;B!R971V86P["B  ("!]" I,97)R;W(Z"B  ("!R971V86P /2!G971%<G)N
M;SL*("  (&5R<F]R*")#86YN;W0 <W!A=VX (B!^('1O4W1R:6YG*'!A=&AN
M86UE*2!^("([("( ?B!T;U-T<FEN9RAS=')E<G)O<BAR971V86PI*2!^("( 
M6V5R<FYO("( ?B!T;U-T<FEN9RAR971V86PI('X (ETB+"!R971V86PI.PH 
M("  <F5T=7)N(')E='9A;#L*?0H*97AT97)N*$,I"GL*("  (&-H87(J('-T
M<F5R<F]R*&EN="D["B  ("!U<VAO<G0 9V5T=6ED*"D["GT*8F]O;"!S=&]P
M<&5D*&EN="!S=&%T=7,I("  ('L <F5T=7)N(&-A<W0H8F]O;"DH*'-T871U
M<R F(#!X9F8I(#T](#!X-V8I.R!]"F)O;VP <VEG;F%L960H:6YT('-T871U
M<RD ("![(')E='5R;B!C87-T*&)O;VPI*"AC87-T*&-H87(I*"AS=&%T=7, 
M)B P>#=F*2 K(#$I(#X^(#$I(#X ,"D[('T*:6YT("!T97)M<VEG*&EN="!S
M=&%T=7,I("  ('L <F5T=7)N('-T871U<R F(#!X-V8[('T*8F]O;"!E>&ET
M960H:6YT('-T871U<RD ("  ('L <F5T=7)N(&-A<W0H8F]O;"DH*'-T871U
M<R F(#!X-V8I(#T](# I.R!]"FEN="  97AI='-T871U<RAI;G0 <W1A='5S
E*2![(')E='5R;B H<W1A='5S("8 ,'AF9C P*2 ^/B X.R!]" ``
`
end
Feb 13 2006