langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
11
Task/Here-document/NewLISP/here-document.newlisp
Normal file
11
Task/Here-document/NewLISP/here-document.newlisp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
; here-document.lsp
|
||||
; oofoe 2012-01-19
|
||||
; http://rosettacode.org/wiki/Here_document
|
||||
|
||||
(print (format [text]
|
||||
Blast it %s! I'm a %s,
|
||||
not a %s!
|
||||
--- %s
|
||||
[/text] "James" "magician" "doctor" "L. McCoy"))
|
||||
|
||||
(exit)
|
||||
6
Task/Here-document/Perl-6/here-document-1.pl6
Normal file
6
Task/Here-document/Perl-6/here-document-1.pl6
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
my $color = 'green';
|
||||
my $text = qq :to 'EOT';
|
||||
some line
|
||||
color: $color
|
||||
last line
|
||||
EOT
|
||||
11
Task/Here-document/Perl-6/here-document-2.pl6
Normal file
11
Task/Here-document/Perl-6/here-document-2.pl6
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
my $contrived_example = 'Dylan';
|
||||
sub freewheelin() {
|
||||
print q :to 'QUOTE', '-- ', qq :to 'AUTHOR';
|
||||
I'll let you be in my dream,
|
||||
if I can be in yours.
|
||||
QUOTE
|
||||
Bob $contrived_example
|
||||
AUTHOR
|
||||
}
|
||||
|
||||
freewheelin;
|
||||
17
Task/Here-document/PowerShell/here-document.psh
Normal file
17
Task/Here-document/PowerShell/here-document.psh
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
$XMLdata=@"
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<unattend xmlns="urn:schemas-microsoft-com:unattend">
|
||||
<servicing>
|
||||
<package action="configure">
|
||||
<assemblyIdentity name="Microsoft-Windows-Foundation-Package" version="${strFullVersion}" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="" />
|
||||
<selection name="RemoteServerAdministrationTools" state="true" />
|
||||
<selection name="RemoteServerAdministrationTools-Roles-AD" state="true" />
|
||||
<selection name="RemoteServerAdministrationTools-Roles-AD-DS" state="true" />
|
||||
<selection name="RemoteServerAdministrationTools-Roles-AD-DS-SnapIns" state="true" />
|
||||
<selection name="RemoteServerAdministrationTools-Features-StorageManager" state="true" />
|
||||
<selection name="RemoteServerAdministrationTools-Features-Wsrm" state="true" />
|
||||
</package>
|
||||
</servicing>
|
||||
<cpi:offlineImage cpi:source="wim:d:/2008r2wim/install.wim#Windows Server 2008 R2 SERVERSTANDARD" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
|
||||
</unattend>
|
||||
"@
|
||||
4
Task/Here-document/Retro/here-document-1.retro
Normal file
4
Task/Here-document/Retro/here-document-1.retro
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
"This is
|
||||
a multi-line string
|
||||
with indention
|
||||
and such"
|
||||
19
Task/Here-document/Retro/here-document-2.retro
Normal file
19
Task/Here-document/Retro/here-document-2.retro
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{{
|
||||
: getDelimiter ( "-$ )
|
||||
getToken keepString cr ;
|
||||
: prepare ( -$ )
|
||||
remapping off "" tempString ;
|
||||
: readLine ( "-$ )
|
||||
10 accept tib ;
|
||||
: append? ( $$-$$f )
|
||||
[ over ] dip compare [ 0 ] [ tib ^strings'append 10 ^strings'appendChar -1 ] if ;
|
||||
---reveal---
|
||||
: heredoc ( "-$ )
|
||||
heap [ remapping [ getDelimiter prepare [ readLine append? ] while nip ] preserve ] preserve ;
|
||||
}}
|
||||
|
||||
heredoc [END]
|
||||
1 2 3
|
||||
4 5 6
|
||||
7 8 9
|
||||
[END]
|
||||
11
Task/Here-document/Run-BASIC/here-document.run
Normal file
11
Task/Here-document/Run-BASIC/here-document.run
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
text$ ="
|
||||
<<'FOO'
|
||||
Now
|
||||
is
|
||||
the
|
||||
time
|
||||
for
|
||||
all
|
||||
good mem
|
||||
to come to the aid of their country."
|
||||
print text$
|
||||
13
Task/Here-document/TXR/here-document.txr
Normal file
13
Task/Here-document/TXR/here-document.txr
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/txr -f
|
||||
@(maybe)
|
||||
@(bind USER "Unknown User")
|
||||
@(or)
|
||||
@(bind MB "???")
|
||||
@(end)
|
||||
@(output)
|
||||
Dear @USER
|
||||
|
||||
Your are over your disk quota by @MB megabytes.
|
||||
|
||||
The Computer
|
||||
@(end)
|
||||
8
Task/Here-document/UNIX-Shell/here-document-1.sh
Normal file
8
Task/Here-document/UNIX-Shell/here-document-1.sh
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
cat << ANARBITRARYTOKEN
|
||||
The river was deep but I swam it, Janet.
|
||||
The future is ours so let's plan it, Janet.
|
||||
So please don't tell me to can it, Janet.
|
||||
I've one thing to say and that's ...
|
||||
Dammit. Janet, I love you.
|
||||
ANARBITRARYTOKEN
|
||||
6
Task/Here-document/UNIX-Shell/here-document-2.sh
Normal file
6
Task/Here-document/UNIX-Shell/here-document-2.sh
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
cat << EOF
|
||||
Here documents do parameter and command substitution:
|
||||
* Your HOME is $HOME
|
||||
* 2 + 2 is `expr 2 + 2`
|
||||
* Backslash quotes a literal \$, \` or \\
|
||||
EOF
|
||||
5
Task/Here-document/UNIX-Shell/here-document-3.sh
Normal file
5
Task/Here-document/UNIX-Shell/here-document-3.sh
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
if true; then
|
||||
cat <<- EOF
|
||||
The <<- variant deletes any tabs from start of each line.
|
||||
EOF
|
||||
fi
|
||||
6
Task/Here-document/UNIX-Shell/here-document-4.sh
Normal file
6
Task/Here-document/UNIX-Shell/here-document-4.sh
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
cat << 'TOKEN'
|
||||
If TOKEN has any quoted characters (like 'TOKEN', "TOKEN" or \TOKEN),
|
||||
then all $ ` \ in the here document are literal characters.
|
||||
|
||||
$PATH \$PATH `shutdown now`
|
||||
TOKEN
|
||||
9
Task/Here-document/UNIX-Shell/here-document-5.sh
Normal file
9
Task/Here-document/UNIX-Shell/here-document-5.sh
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/csh -f
|
||||
cat << ANARBITRARYTOKEN
|
||||
* Your HOME is $HOME
|
||||
* 2 + 2 is `@ n = 2 + 2; echo \$n`
|
||||
ANARBITRARYTOKEN
|
||||
|
||||
cat << 'ANARBITRARYTOKEN'
|
||||
$PATH \$PATH `shutdown now`
|
||||
'ANARBITRARYTOKEN'
|
||||
50
Task/Here-document/Ursala/here-document.ursala
Normal file
50
Task/Here-document/Ursala/here-document.ursala
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
hd =
|
||||
|
||||
-[
|
||||
The text enclosed within the so called dash-brackets shown above
|
||||
and below will be interpreted as a list of character strings. It
|
||||
can contain anything except uninterpreted dash-brackets, and can
|
||||
be used in any declaration or expression. The dash-brackets don't
|
||||
have to be on a line by themselves.
|
||||
]-
|
||||
|
||||
|
||||
example =
|
||||
|
||||
-[Some additional facilities allow here-documents to be nested and
|
||||
combined. Writing something like -[ hd ]- within a nested pair of
|
||||
dash-brackets will cause the text declared above (having the
|
||||
identifer hd) to be inserted at that point. The enclosed item can
|
||||
be any expression that evaluates to a list of character strings.
|
||||
We could therefore "escape" a literal dash-bracket within a
|
||||
here-document by writing -[ <'-['> ]-. Dash-brackets can be nested
|
||||
to any depth, alternating between literal text and compiled code
|
||||
on each level.]-
|
||||
|
||||
template "x" =
|
||||
|
||||
-[A further use of this notation involves defining a text-valued
|
||||
function. The output of this function will be this text, with
|
||||
the argument inserted here -["x"]- and again here -["x"]-. The
|
||||
argument type should be a list of character strings.]-
|
||||
|
||||
formletter ("x","y") =
|
||||
|
||||
-[Other calling conventions are possible. The left argument
|
||||
comes out here -["x"]- and the right one here -["y"]-.]-
|
||||
|
||||
designpattern =
|
||||
|
||||
-[A point-free style of function declaration is also supported.
|
||||
The argument comes out here -[. ~& ]-, after being fed through
|
||||
the function appearing within the nested dash-brackets (in this
|
||||
case the identity function). This usage is indicated by a period
|
||||
after the left inner dash-bracket. Nesting is also allowed in
|
||||
point free dash-bracket function specifications.]-
|
||||
|
||||
abstractionastronaut =
|
||||
|
||||
-[Higher order functions to any level are specified by piling on
|
||||
the periods like this -[.. ~&]-. This one is a second order function
|
||||
that needs to be applied to another function in order to get a
|
||||
first order function such as the previous three examples.]-
|
||||
83
Task/Here-document/VBScript/here-document.vbscript
Normal file
83
Task/Here-document/VBScript/here-document.vbscript
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
'Purpose: Converts TXT files into VBS code with a function that returns a text string with the contents of the TXT file
|
||||
' The TXT file can even be another VBS file.
|
||||
|
||||
'History:
|
||||
' 1.0 8may2009 Initial release
|
||||
'
|
||||
'
|
||||
Const ForReading = 1
|
||||
Const ForWriting = 2
|
||||
Const ForAppending = 8
|
||||
Const TristateUseDefault = -2
|
||||
|
||||
set WshShell = CreateObject("WSCript.shell")
|
||||
|
||||
'File browse dialog box
|
||||
Set objDialog = CreateObject("UserAccounts.CommonDialog")
|
||||
objDialog.Filter = "All Files|*.*"
|
||||
objDialog.InitialDir = WshShell.CurrentDirectory
|
||||
intResult = objDialog.ShowOpen
|
||||
|
||||
If intResult = 0 Then
|
||||
WshShell.Popup "No file selected.", 2, " ", 64
|
||||
Wscript.Quit
|
||||
Else
|
||||
strFileNameIN = objDialog.FileName
|
||||
End If
|
||||
|
||||
strFileNameOUT= strFileNameIN & "_CONVERTED.Vbs"
|
||||
|
||||
'Check if strFileNameOUT exists already
|
||||
Set objFSO = CreateObject("Scripting.FileSystemObject")
|
||||
If objFSO.FileExists(strFileNameOUT) then 'does the file EXIST?
|
||||
' WScript.Echo "found"
|
||||
OVRWT=MSGBOX(strFileNameOUT & " exists already"&vbCRLF&"Overwrite?",vbYesNoCancel,"Overwrite?")
|
||||
if OVRWT = 6 then
|
||||
'proceed
|
||||
objFSO.DeleteFile(strFileNameOUT)
|
||||
else
|
||||
WshShell.Popup "Exiting as requested.", 1, " ", 64
|
||||
Wscript.Quit
|
||||
End If
|
||||
Else
|
||||
' WScript.Echo "not found" 'strFileNameOUT does NOT exists already
|
||||
|
||||
END if
|
||||
|
||||
strBaseName=objFSO.GetBaseName(strFileNameIN)
|
||||
|
||||
|
||||
'open strFileNameANSI file, and put entire file into a variable ****SIZE LIMIT ??*****
|
||||
Set objFile = objFSO.OpenTextFile(strFileNameIN, ForReading)
|
||||
strText = objFile.ReadAll
|
||||
objFile.Close
|
||||
|
||||
'Start converting
|
||||
|
||||
'Convert " to ""
|
||||
strOldText = Chr(34)
|
||||
strNewText = Chr(34)&Chr(34)
|
||||
strText = Replace(strText, strOldText, strNewText)
|
||||
|
||||
'Add objTXTFile.writeline ("
|
||||
strOldText = VBCRLF
|
||||
strNewText = """) &vbCrLf"&VBCRLF&" strText=strText& ("""
|
||||
strText = Replace(strText, strOldText, strNewText)
|
||||
'Converting done
|
||||
|
||||
strFileName=objFSO.GetFileName(strFileNameIN)
|
||||
|
||||
'Write to file
|
||||
Set objFile = objFSO.OpenTextFile(strFileNameOUT, ForAppending, True)
|
||||
objFile.WriteLine "'this Function will return a string containing the contents of the file called "&strFileName
|
||||
objFile.WriteLine "msgbox "&strBaseName &"()"
|
||||
objFile.WriteLine vbCrLf
|
||||
objFile.WriteLine "Function "&strBaseName&"()"
|
||||
objFile.WriteLine " 'returns a string containing the contents of the file called "&strFileName
|
||||
objFile.WriteLine " Dim strText"
|
||||
objFile.WriteLine " strText= ("""&strText&""") &vbCrLf"
|
||||
objFile.WriteLine " "&strBaseName&"=strText"
|
||||
objFile.WriteLine "End Function"
|
||||
objFile.Close
|
||||
|
||||
WshShell.Popup "created " & strFileNameOUT, 3, "Completed", 64
|
||||
4
Task/Here-document/XPL0/here-document.xpl0
Normal file
4
Task/Here-document/XPL0/here-document.xpl0
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
code Text=12;
|
||||
Text(0, " ^"Heredocs^" are pretty much automatic. Multiple lines and
|
||||
whitespace, such as indentations, are output exactly as written. Quote
|
||||
marks (^") and any carets (^^) within the string must be escaped.")
|
||||
Loading…
Add table
Add a link
Reference in a new issue