content
stringlengths
4
1.04M
lang
stringclasses
358 values
score
int64
0
5
repo_name
stringlengths
5
114
repo_path
stringlengths
4
229
repo_licenses
listlengths
1
8
plugins { kotlin("jvm") } publishJarsForIde(listOf(":plugins:parcelize:parcelize-compiler"))
Kotlin
2
Mu-L/kotlin
prepare/ide-plugin-dependencies/parcelize-compiler-plugin-for-ide/build.gradle.kts
[ "ECL-2.0", "Apache-2.0" ]
module samples.SwingHelloWorld import javax.swing import javax.swing.WindowConstants function main = |args| { let frame = JFrame("Hello world") frame: setDefaultCloseOperation(EXIT_ON_CLOSE()) let label = JLabel("Hello world") label: setFont(label: getFont(): deriveFont(128.0_F)) frame: getContentPane(): add(label) frame: pack() frame: setVisible(true) }
Golo
4
polyrabbit/polyglot
corpus/Golo/swing-helloworld.golo
[ "BSD-3-Clause" ]
#!/bin/sh /usr/share/dpatch/dpatch-run ## 08-cdrkit-doc.dpatch by Daniel Baumann <daniel@debian.org> ## ## DP: Update any cdrtools related information in the documentation to cdrkit. @DPATCH@ diff -Naurp dvd+rw-tools-7.1.orig/growisofs.1 dvd+rw-tools-7.1/growisofs.1 --- dvd+rw-tools-7.1.orig/growisofs.1 2008-04-01 09:04:48.000000000 +0000 +++ dvd+rw-tools-7.1/growisofs.1 2008-04-01 09:16:16.000000000 +0000 @@ -1,6 +1,6 @@ .TH GROWISOFS 1 "1 Mar 2008" "growisofs 7.1" .SH NAME -growisofs \- combined mkisofs frontend/DVD recording program. +growisofs \- combined genisoimage frontend/DVD recording program. .SH SYNOPSIS .B growisofs [\fB\-dry\-run\fP] @@ -9,10 +9,10 @@ growisofs \- combined mkisofs frontend/D [\fB\-speed=1\fP] \-[\fBZ|M\fP] .I /dev/dvd -.I <mkisofs-options> +.I <genisoimage-options> .SH DESCRIPTION -\fBgrowisofs\fP was originally designed as a frontend to \fBmkisofs\fP +\fBgrowisofs\fP was originally designed as a frontend to \fBgenisoimage\fP to facilitate appending of data to ISO9660 volumes residing on random-access media such as DVD+RW, DVD\-RAM, plain files, hard disk partitions. In the course of development general purpose DVD recording @@ -35,7 +35,7 @@ EXAMPLES section for further details. Merge a new session to an existing one. .TP .BI \-version -Print version information and invoke \fBmkisofs\fP, also with \-version +Print version information and invoke \fBgenisoimage\fP, also with \-version option. .TP .BI \-dvd\-compat @@ -47,7 +47,7 @@ explicitly burn [otherwise optional] lea .BI \-dry\-run At dry\-run \fBgrowisofs\fP performs all the steps till, but not including the first write operation. Most notably check for "overburn" -condition is performed, which implies that mkisofs is invoked and +condition is performed, which implies that genisoimage is invoked and terminated prematurely. .TP .BI \-overburn @@ -68,8 +68,8 @@ be found in \fBdvd+rw\-mediainfo\fP outp recordings are commonly performed at ~1/2 of advertised speed, because of defect management being in effect. .TP -.BI <mkisofs-options> -More options can be found in the manpage for \fBmkisofs\fP. +.BI <genisoimage-options> +More options can be found in the manpage for \fBgenisoimage\fP. .P There are several undocumented options commonly denoted with @@ -82,7 +82,7 @@ these options undocumented is that those need to use them directly can as well consult the source code or obtain specific instructions elsewhere. -.SH DIFFERENCES WITH RUNNING MKISOFS DIRECTLY +.SH DIFFERENCES WITH RUNNING GENISOIMAGE DIRECTLY .P When using growisofs you may not use the .B \-o @@ -99,7 +99,7 @@ will construct one for you; Otherwise everything that applies to .I [multisession] mastering with -.B mkisofs +.B genisoimage applies to .B growisofs as well. @@ -107,7 +107,8 @@ as well. needs at least .B mkisofs version 1.14, version 2.0 is required for multisession write-once -recordings. +recordings or +.B genisoimage. .SH EXAMPLES Actual device names vary from one operating system to another. We use @@ -146,12 +147,12 @@ command name is not intuitive in this co .SH NOTES If executed under sudo(8) growisofs refuses to start. This is done for the following reason. Naturally growisofs has to access the data set to -be recorded to optical media, either indirectly by letting mkisofs +be recorded to optical media, either indirectly by letting genisoimage generate ISO9660 layout on-the-fly or directly if a pre-mastered image is to be recorded. Being executed under sudo(8), growisofs effectively grants sudoers read access to \fIany\fP file in the file system. The -situation is intensified by the fact that growisofs parses MKISOFS -environment variable in order to determine alternative path to mkisofs +situation is intensified by the fact that growisofs parses GENISOIMAGE +environment variable in order to determine alternative path to genisoimage executable image. This means that being executed under sudo(8), growisofs effectively grants sudoers right to execute program of their choice with elevated privileges. If you for any reason still find the @@ -162,13 +163,13 @@ real growisofs binary. .nf #!/bin/ksh unset SUDO_COMMAND - export MKISOFS=/path/to/trusted/mkisofs + export GENISOIMAGE=/path/to/trusted/genisoimage exec growisofs "$@" .fi But note that the recommended alternative to the above "workaround" is actually to install growisofs set\-root\-uid, in which case it will drop -privileges prior accessing data or executing mkisofs in order to +privileges prior accessing data or executing genisoimage in order to preclude unauthorized access to the data. If the media already carries isofs and \fBgrowisofs\fP is invoked with @@ -214,7 +215,7 @@ it gets pre-formatted with minimal spare Most up-to-date information on dvd+rw\-tools is available at http://fy.chalmers.se/~appro/linux/DVD+RW/. .PP -The manpage for \fBmkisofs\fP. +The manpage for \fBgenisoimage\fP. .SH AUTHORS Andy Polyakov <appro@fy.chalmers.se> stands for programming and on-line diff -Naurp dvd+rw-tools-7.1.orig/index.html dvd+rw-tools-7.1/index.html --- dvd+rw-tools-7.1.orig/index.html 2008-03-04 09:03:21.000000000 +0000 +++ dvd+rw-tools-7.1/index.html 2008-04-01 09:20:57.000000000 +0000 @@ -137,7 +137,9 @@ SRC="japanese.gif" WIDTH=48 HEIGHT=19 BO front-end to mkisofs,</B> i.e. invokes mkisofs to perform the actual ISO9660 file system layout. Secondly, the DVD burners available on the market can burn even CD-R[W] media and - cdrecord is the tool for this job.</TR> + cdrecord is the tool for this job [and this job only]. + Note that mkisofs is replaced with its successor genisoimage from + <A HREF="http://www.cdrkit.org/">cdrkit</a>.</TR> </TABLE> <!-- @@ -480,13 +482,13 @@ are not capable of burning DVD+R is need <A NAME="growisofs"><P></A><LI><P ALIGN="JUSTIFY"><B>Burning with <A HREF="tools/growisofs.c">growisofs</A>.</B> There is hardly a need for manual for growisofs. In a nutshell growisofs just passes all command -line arguments to mkisofs and dumps its output directly onto the media. +line arguments to genisoimage and dumps its output directly onto the media. The first part means that you basically can [well, <I>should</I>] -consult <A HREF="mkisofs.8.html">mkisofs manual page</A> and +consult <A HREF="genisoimage.8.html">genisoimage manual page</A> and accompanying reference documentation (including multisession related section[s]) and the second part means that you shouldn't expect an ISO-image on the standard output (nor make sure you have enough free -temporary storage<TT>:-)</TT>. Differences from mkisofs command line +temporary storage<TT>:-)</TT>. Differences from genisoimage command line are: <P><UL> @@ -494,12 +496,12 @@ are: <LI>you don't have to specify -C option, growisofs will construct one for you; <LI>there is internal -Z option for initial session recording, this -substitutes for originally suggested 'mkisofs | dd of=/dev/scd0'; +substitutes for originally suggested 'genisoimage | dd of=/dev/scd0'; </UL> <P ALIGN="JUSTIFY">Otherwise <I>everything</I> that applies to -[multisession] mastering with mkisofs applies to growisofs as well. For -example just like with mkisofs you should make a note on which options +[multisession] mastering with genisoimage applies to growisofs as well. For +example just like with genisoimage you should make a note on which options you used to master the initial &quot;session&quot; with and stick to them, e.g.: @@ -508,9 +510,10 @@ growisofs -Z /dev/scd0 <FONT COLOR="red" growisofs -M /dev/scd0 <FONT COLOR="red">-R -J</FONT> /more/files </PRE></BLOCKQUOTE> -<P ALIGN="JUSTIFY">Oh! Do make sure you have at least mkisofs <FONT -COLOR="red">1.14</FONT> on your $PATH (mkisofs 1.14 is part of cdrtools -1.10). If you consider passing <TT>/same/files</TT> as argument, or in +<P ALIGN="JUSTIFY">Oh! Do make sure you have genisoimage on your $PATH +(genisoimage is part of <A HREF="http://www.cdrkit.org/">cdrkit</A>, +or at least mkisofs <FONT COLOR="red">1.14</FONT> (mkisofs 1.14 is part of +cdrtools 1.10). If you consider passing <TT>/same/files</TT> as argument, or in other words consider deploying growisofs for <I>incremental</I> multisession backups, then you shall find <A HREF="mkisofs-2.01a16-root.diff">this '-old-root' extension</A> to @@ -586,7 +589,8 @@ through ide-scsi, the way it was under 2 unsupported it actually still works in 2.6 (I for one still use it). <LI>If you go for BD-R/DVD&plusmn;R multisessioning, you have to use -mkisofs from <A HREF="ftp://ftp.berlios.de/pub/cdrecord/">cdrtools-2.0 +genisoimage from <A HREF="http://www.cdrkit.org/">cdrkit-1.0 or later</A>, +or mkisofs from <A HREF="ftp://ftp.berlios.de/pub/cdrecord/">cdrtools-2.0 or later</A> or apply <A HREF="multi.diff">this patch</A>. <LI>And when it comes to <B>DVD+R Double Layer and <NOBR>DVD-R</NOBR> @@ -630,7 +634,7 @@ working. To see it in action, insert for access it, '<TT>dd if=/dev/scd<FONT COLOR="red">N</FONT> count=0</TT>' would do. Then verify that kernel logs &quot;<TT>sr<FONT COLOR="red">N</FONT>: mmc-3 profile: 1Ah</TT>&quot. You should now be -able to '<TT>mkisofs -pad . | dd of=/dev/scd<FONT COLOR="red">N</FONT> +able to '<TT>genisoimage -pad . | dd of=/dev/scd<FONT COLOR="red">N</FONT> obs=32k</TT>' or even '<TT>mke2fs -b 2048 /dev/scd<FONT COLOR="red">N</FONT></TT>' and observe kernel logging &quot;<TT>sr<FONT COLOR="red">N</FONT>: dirty DVD+RW media</TT>.&quot @@ -802,7 +806,7 @@ huge*.void</TT>'. Otherwise you might ha <TR VALIGN="TOP" ALIGN="JUSTIFY"> <TD><FONT SIZE="-1"><SUP>(***)</SUP></FONT> <TD><FONT SIZE="-1">E.g. when mastering DVD-Video disc:-) Note that -<TT>-dvd-video</TT> option [passed to mkisofs] engages +<TT>-dvd-video</TT> option [passed to genisoimage] engages <TT>-dvd-compat</TT> automatically.</FONT></TR> </TABLE> @@ -908,7 +912,7 @@ Now, the problem is that isofs i-nodes<S entries (light-greens), byte offsets from the beginning of media. This means that no directory (green areas) may cross 4GB boundary without being effectively corrupted<TT>:-(</TT> It should be noted that in -reality it's a bit better than it looks on the picture, as mkisofs +reality it's a bit better than it looks on the picture, as genisoimage collects all the directories in the beginning of any particular session (there normally are no blues between greens). The <I>first</I> session is therefore never subject to i-node wrap-around, but not the
Darcs Patch
3
mtdcr/opendreambox
meta-opendreambox/recipes-multimedia/dvd+rw-tools/files/09-cdrkit-doc.dpatch
[ "MIT" ]
"""Constants used by multiple Tasmota modules.""" from homeassistant.const import Platform CONF_DISCOVERY_PREFIX = "discovery_prefix" DATA_REMOVE_DISCOVER_COMPONENT = "tasmota_discover_{}" DATA_UNSUB = "tasmota_subscriptions" DEFAULT_PREFIX = "tasmota/discovery" DOMAIN = "tasmota" PLATFORMS = [ Platform.BINARY_SENSOR, Platform.COVER, Platform.FAN, Platform.LIGHT, Platform.SENSOR, Platform.SWITCH, ] TASMOTA_EVENT = "tasmota_event"
Python
4
MrDelik/core
homeassistant/components/tasmota/const.py
[ "Apache-2.0" ]
# mes 2,EM_WSIZE,EM_PSIZE exp $pipe pro $pipe,0 loc 42 mon zeq *1 ste errno loc -1 ret EM_WSIZE 1 lal 0 loi EM_PSIZE stf EM_WSIZE sil 0 loc 0 ret EM_WSIZE end
Eiffel
1
wyan/ack
plat/em/libsys/pipe.e
[ "BSD-3-Clause" ]
{if !isset($isInterface)}{$isInterface = false}{/if} {if !isset($isClass)}{$isClass = false}{/if} <tr id="_{$method->getName()}" n:class="$method->isDeprecated() ? deprecated"> {var $annotations = $method->getAnnotations()} <td class="attributes col-md-1"> <code class="keyword"> {if $isInterface === true} {ifset $annotations['return']}{$annotations['return'][0]|annotation:$method|noescape}{/ifset} public {else} {if $method->isAbstract()}abstract{elseif $method->isFinal()}final{/if} {if $method->isProtected()}protected{elseif $method->isPrivate()}private{else}public{/if} {if $method->isStatic()}static{/if} {ifset $annotations['return']}{$annotations['return'][0]|annotation:$method|noescape}{/ifset} {if $method->returnsReference()}&amp;{/if} {/if} </code> </td> <td class="name"> <div> <a class="anchor pull-right" href="#_{$method->getName()}">#</a> <code>{block|strip} <a href="{$method|linkSource}">{$method->getName()}</a>( {foreach $method->getParameters() as $parameter} <span> {$parameter->getTypeHint()|buildLinkIfReflectionFound} <span class="property-name">{if $parameter->isPassedByReference()}&amp; {/if}${$parameter->getName()}</span> {if $parameter->isDefaultValueAvailable()} = {$parameter->getDefaultValue()|dumpDefaultValue|phpHighlight|noescape}{elseif $parameter->isVariadic()},…{/if}</span>{sep}, {/sep} {/foreach} ) {/block}</code> <div class="description"> {$method|description} {if $method->getAnnotation('deprecated')} <h2>Deprecated</h2> {foreach $method->getAnnotation('deprecated') as $annotation} {$annotation|annotation:$method|noescape}<br> {/foreach} {/if} {if $method->getParameters() && isset($annotations['param'])} <h2>Parameters</h2> <div class="list"> <dl> {foreach $method->getParameters() as $parameter} <dt><span class="property-name">${$parameter->getName()}</span>{if $parameter->isVariadic()},…{/if}</dt> <dd>{$parameter|description}</dd> {/foreach} </dl> </div> {/if} {* @note: is not neccessary if return typehtint is already there *} {if isset($annotations['return']) && 'void' !== $annotations['return'][0]} <h2>Returns</h2> <div class="list"> {foreach $annotations['return'] as $description} {$description|annotation:$method|noescape}{sep}<br>{/} {/foreach} </div> {/if} {ifset $annotations['throws']} <h2>Throws</h2> <div class="list"> {foreach $annotations['throws'] as $description} {$description|annotation:$method|noescape}{sep}<br>{/} {/foreach} </div> {/ifset} {var $filteredAnnotations = ($method->getAnnotations()|annotationFilter: ['deprecated', 'param', 'return', 'throws'])} {foreach $filteredAnnotations as $annotation} <h2>{$annotation->getName()}</h2> <div class="list"> {$annotation|annotation:$method|noescape}<br> </div> {/foreach} {if $isClass === true} {if $method->getOverriddenMethod()} <h2>Overrides</h2> <div> <code> <a href="{$method->getOverriddenMethod()|linkReflection}"> {$method->getOverriddenMethod()|prettyMethodName} </a> </code> </div> {/if} {if $method->getImplementedMethod()} <h2>Implementation of</h2> <div> <code> <a href="{$method->getImplementedMethod()|linkReflection}"> {$method->getImplementedMethod()|prettyMethodName} </a> </code> </div> {/if} {/if} </div> </div> </td> </tr>
Latte
4
pujak17/tets
packages/ThemeDefault/src/partial/method.latte
[ "MIT" ]
Red [ Title: "Red pair test script" Author: "Peter W A Wood" File: %pair-test.red Tabs: 4 Rights: "Copyright (C) 2011-2016 Red Foundation. All rights reserved." License: "BSD-3 - https://github.com/red/red/blob/origin/BSD-3-License.txt" ] #include %../../../quick-test/quick-test.red ~~~start-file~~~ "pair" ===start-group=== "pair - basic" --test-- "pb-1" pb1-p: 1x1 --assert equal? pb1-p/x 1 --assert equal? pb1-p/y 1 --assert equal? first pb1-p 1 --assert equal? second pb1-p 1 --assert equal? pb1-p 1x1 --assert equal? pick pb1-p 1 1 --assert equal? pick pb1-p 2 1 --test-- "pb-2" pb2-p: 0x0 --assert equal? pb2-p/x 0 --assert equal? pb2-p/y 0 --assert equal? first pb2-p 0 --assert equal? second pb2-p 0 --assert equal? pb2-p 0x0 --assert equal? pick pb2-p 1 0 --assert equal? pick pb2-p 2 0 --test-- "pb-3" pb3-p: 2147483647x2147483647 --assert equal? pb3-p/x 2147483647 --assert equal? pb3-p/y 2147483647 --assert equal? first pb3-p 2147483647 --assert equal? second pb3-p 2147483647 --assert equal? pb3-p 2147483647x2147483647 --assert equal? pick pb3-p 1 2147483647 --assert equal? pick pb3-p 2 2147483647 --test-- "pb-4" pb4-p: -2147483648x-2147483648 --assert equal? pb4-p/x -2147483648 --assert equal? pb4-p/y -2147483648 --assert equal? first pb4-p -2147483648 --assert equal? second pb4-p -2147483648 --assert equal? pb4-p -2147483648x-2147483648 --assert equal? pick pb4-p 1 -2147483648 --assert equal? pick pb4-p 2 -2147483648 --test-- "pb-5" pb5-p: 2147483647x-2147483648 --assert equal? pb5-p/x 2147483647 --assert equal? pb5-p/y -2147483648 --assert equal? first pb5-p 2147483647 --assert equal? second pb5-p -2147483648 --assert equal? pb5-p 2147483647x-2147483648 --assert equal? pick pb5-p 1 2147483647 --assert equal? pick pb5-p 2 -2147483648 --test-- "pb-6" --assert equal? 3x4 as-pair 3 4 --test-- "pb-7" --assert equal? 4x5 make pair! [4 5] --test-- "pb-8" --assert equal? none attempt [as-pair 10] --test-- "pb-9" --assert equal? 10x10 make pair! 10 --test-- "pb-10" --assert error? try [as-pair 1 -1.#inf] --test-- "pb-11" --assert error? try [as-pair 1 1.#inf] --test-- "pb-12" --assert error? try [as-pair 1 1.#nan] --test-- "pb-13" --assert error? try [as-pair -1.#inf 1] ===end-group=== ===start-group=== "pair - assignment" --test-- "pa-1" pa1-p: 1x1 --assert equal? pa1-p 1x1 pa1-p/x: 0 --assert equal? pa1-p 0x1 pa1-p/y: 0 --assert equal? pa1-p 0x0 ===end-group=== ===start-group=== "pair - add" --test-- "padd-1" padd1-p: 1x1 --assert equal? padd1-p + 2 3x3 --test-- "padd-2" padd2-p: 1x1 --assert equal? padd2-p + 2x1 3x2 --test-- "padd-3" padd3-p: 1x1 --assert equal? padd3-p + 2147483646x2147483646 2147483647x2147483647 --test-- "padd-4" padd4-p: 1x1 --assert equal? padd4-p + 2147483646 2147483647x2147483647 ===end-group=== ===start-group=== "pair - subtract" --test-- "psub-1" psub1-p: 1x1 --assert equal? psub1-p - 2 -1x-1 --test-- "psub-2" psub2-p: 1x1 --assert equal? psub2-p - 2x1 -1x0 --test-- "psub-3" psub3-p: 1x1 --assert equal? psub3-p - 2147483647x2147483647 -2147483646x-2147483646 --test-- "psub-4" psub4-p: -1x-1 --assert equal? psub4-p - 2147483647 -2147483648x-2147483648 ===end-group=== ===start-group=== "pair - multiply" --test-- "pmul-1" pmul1-p: 1x1 --assert equal? pmul1-p * 2 2x2 --test-- "pmul-2" pmul2-p: 1x1 --assert equal? pmul2-p * 2x1 2x1 ; awaiting integer! to float! promotion --test-- "pmul-3" pmul3-p: 2x2 ;--assert equal? attempt [pmul3-p * 2147483647x2147483647] none --test-- "pmul-4" pmul4-p: -3x-3 ;--assert equal? attempt [pmul4-p * -2147483648] none ===end-group=== ===start-group=== "pair - divide" --test-- "pdiv-1" pdiv1-p: 4x4 --assert equal? pdiv1-p / 2 2x2 --test-- "pdiv-2" pdiv2-p: 16x15 --assert equal? pdiv2-p / 2x1 8x15 --test-- "pdiv-3" pdiv3-p: 2147483647x2147483647 --assert equal? pdiv3-p / 2 1073741823x1073741823 --test-- "pdiv-4" pdiv4-p: -2147483648x-2147483648 --assert equal? pdiv4-p / -2147483648 1x1 ===end-group=== ===start-group=== "pair - remainder" --test-- "prem-1" prem1-p: 4x4 --assert equal? prem1-p % 2 0x0 --test-- "prem-2" prem2-p: 16x15 --assert equal? prem2-p % 2x3 0x0 --test-- "prem-3" prem3-p: 2147483647x2147483647 --assert equal? prem3-p % 2 1x1 --test-- "prem-4" prem4-p: -2147483648x-2147483648 --assert equal? prem4-p % -2147483648 0x0 ===end-group=== ===start-group=== "pair - negate" --test-- "pneg-1" pneg1-p: 4x4 --assert equal? negate pneg1-p -4x-4 --test-- "pneg-2" pneg2-p: -16x-15 --assert equal? negate pneg2-p 16x15 --test-- "pneg-3" pneg3-p: 2147483647x2147483647 --assert equal? negate pneg3-p -2147483647x-2147483647 ; awaiting integer! to float! promotion --test-- "pneg-4" pneg4-p: -2147483648x-2147483648 ; --assert equal? attempt [negate pneg4-p] none ===end-group=== ===start-group=== "pair - and" --test-- "pand-1" --assert equal? 0x0 (1x1 and 0x0) --test-- "pand-2" --assert equal? 1x1 (1x1 and 1x1) --test-- "pand-3" --assert equal? 1x0 (1x1 and 1x0) --test-- "pand-4" --assert equal? 16x0 (16x16 and 16x4) --test-- "pand-5" --assert equal? 7x4 (7x7 and 7x4) ===end-group=== ===start-group=== "pair - and" --test-- "pand-1" --assert equal? 0x0 (1x1 and 0x0) --test-- "pand-2" --assert equal? 1x1 (1x1 and 1x1) --test-- "pand-3" --assert equal? 1x0 (1x1 and 1x0) --test-- "pand-4" --assert equal? 16x0 (16x16 and 16x4) --test-- "pand-5" --assert equal? 7x4 (7x7 and 7x4) ===end-group=== ===start-group=== "pair - or" --test-- "por-1" --assert equal? 1x1 (1x1 or 0x0) --test-- "por-2" --assert equal? 1x1 (1x1 or 1x1) --test-- "por-3" --assert equal? 1x1 (1x1 or 1x0) --test-- "por-4" --assert equal? 16x20 (16x16 or 16x4) --test-- "por-5" --assert equal? 7x7 (7x7 or 7x4) ===end-group=== ===start-group=== "pair - xor" --test-- "pxor-1" --assert equal? 1x1 (1x1 xor 0x0) --test-- "pxor-2" --assert equal? 0x0 (1x1 xor 1x1) --test-- "pxor-3" --assert equal? 0x1 (1x1 xor 1x0) --test-- "pxor-4" --assert equal? 0x20 (16x16 xor 16x4) --test-- "pxor-5" --assert equal? 0x3 (7x7 xor 7x4) ===end-group=== ===start-group=== "pair - reverse" --test-- "prev-1" --assert equal? reverse 1x2 2x1 ===end-group=== ===start-group=== "pair - comparison" --test-- "pcomp-1" --assert equal? 1x1 1x1 --test-- "pcomp-2" --assert not-equal? 1x1 1x0 --test-- "pcomp-3" --assert not-equal? 1x1 0x1 --test-- "pcomp-4" --assert not-equal? 1x1 0x0 ===end-group=== ===start-group=== "pair - round" --test-- "pround-1" --assert 15x10 = round/to 17x8 5 --test-- "pround-3" --assert 15x10 = round/to 15x10 1 --test-- "pround-3" --assert 15x10 = round/to 15x10 0 ===end-group=== ===start-group=== "pair - issues" --test-- "#4753" --assert error? try [1x1 * 1.#nan] --assert error? try [1x1 * 1.#inf] --assert error? try [1.#nan + 1x1] --assert error? try [1.#inf + 1x1] ===end-group=== ~~~end-file~~~
Red
5
GalenIvanov/red
tests/source/units/pair-test.red
[ "BSL-1.0", "BSD-3-Clause" ]
;;; ;;; Some common tools for file based sources, such as CSV and FIXED ;;; (in-package #:pgloader.sources) (defclass md-connection (fd-connection) ((spec :initarg :spec :accessor md-spec) (strm :initarg :strm :accessor md-strm)) (:documentation "pgloader connection parameters for a multi-files source.")) (defmethod print-object ((c md-connection) stream) (print-unreadable-object (c stream :type t :identity t) (with-slots (type spec) c (let ((path (when (slot-boundp c 'path) (slot-value c 'path)))) (etypecase path (string (format stream "~a://~a:~a" type (first spec) path)) (list (format stream "~a://~a:~{~a~^,~}" type (first spec) path))))))) (defmethod expand :after ((md md-connection)) "Expand the archive for the MD connection." (when (and (slot-boundp md 'pgloader.connection::path) (slot-value md 'pgloader.connection::path) (uiop:file-pathname-p (fd-path md))) (setf (md-spec md) `(:filename ,(fd-path md))))) (defmethod fetch-file :after ((md md-connection)) "When the fd-connection has an URI slot, download its file." (when (and (slot-boundp md 'pgloader.connection::path) (slot-value md 'pgloader.connection::path)) (setf (md-spec md) `(:filename ,(fd-path md))))) (defgeneric expand-spec (md-connection) (:documentation "Expand specification for an FD source.")) (defmethod expand-spec ((md md-connection)) "Given fd spec as a CONS of a source type and a tagged object, expand the tagged object depending on the source type and return a list of pathnames." (destructuring-bind (type &rest part) (md-spec md) (ecase type (:inline (list (md-spec md))) (:stdin (list *standard-input*)) (:regex (destructuring-bind (keep regex root) part (filter-directory regex :keep keep :root (or *fd-path-root* root)))) (:filename (let* ((filename (first part)) (realname (if (fad:pathname-absolute-p filename) filename (merge-pathnames filename *fd-path-root*)))) (if (probe-file realname) (list realname) (error "File does not exists: '~a'." realname))))))) (defmethod open-connection ((md md-connection) &rest args &key &allow-other-keys) "We know how to open several kinds of specs here, all that target a single file as input. The multi-file specs must have been expanded before trying to open the connection." (when (fd-path md) (log-message :notice "Opening ~s" (fd-path md)) ; info (cond ;; inline ((and (listp (fd-path md)) (eq :inline (first (fd-path md)))) (destructuring-bind (filename . position) (second (fd-path md)) ;; open the filename with given extra args (setf (md-strm md) (apply #'open filename args)) ;; and position the stream as expected (file-position (md-strm md) position))) ;; stdin ((streamp (fd-path md)) (setf (md-strm md) (fd-path md))) ;; other cases should be filenames (t (setf (md-strm md) (apply #'open (fd-path md) args))))) md) (defmethod close-connection ((md md-connection)) "Reset." (when (and (slot-boundp md 'strm) (md-strm md)) (close (md-strm md))) (setf (md-strm md) nil)) (defun get-pathname (dbname table-name &key (fd-path-root *fd-path-root*)) "Return a pathname where to read or write the file data" (make-pathname :directory (pathname-directory (merge-pathnames (format nil "~a/" dbname) fd-path-root)) :name table-name :type "csv")) (defun filter-directory (regex &key (keep :first) ; or :all (root *fd-path-root*)) "Walk the ROOT directory and KEEP either the :first or :all the matches against the given regexp." (let* ((candidates (pgloader.archive:get-matching-filenames root regex)) (candidates (ecase keep (:first (when candidates (list (first candidates)))) (:all candidates)))) (unless candidates (error "No file matching '~a' in expanded archive in '~a'" regex root)) (loop for candidate in candidates do (if (probe-file candidate) candidate (error "File does not exists: '~a'." candidate)) finally (return candidates))))
Common Lisp
5
micaelle/pgloader
src/sources/common/files-and-pathnames.lisp
[ "PostgreSQL" ]
>gi|5690369|gb|AF158246.1|AF158246 Cricetulus griseus glucose phosphate isomerase (GPI) gene, partial intron sequence GGCTCTTAAGTCATGTCTAGGCAGGTGTGCACAAGTTTAGGTCTTGTTCCGCCAGCATCTGAGGAGATTG GGTTGGGAACTGGTATGCATGTCACCATCTGAGTTTAGCCCAGATCGGGAGTCCTCTTCATCAGCATTGA GAAAGTAGAGACTGGCACAGGTCATAATGAGGTGGGTCAAGCATGGATATGAGGCCCTGGTTCTGCCATC ACCGAGACGGCAAAGGCTAGCATAGGTATGAGACTTCCTTCCTGCCAGTGCTGAGGAACTGGGAGCCTAC AGAGGTTTGAGGCCTTGGGTCTGCCAGAAGAAAGGCCAGCTGCGGTAACATCTTTGACCGTCCCTCACGT AGTCTGCCTTGCTGGCCAGCATGAAGAGTCACTAGTTCCTGGATCTGCTGTCTGAACTGGGAAGAGTCGG GTTGGGTCCACCCTCCAGGCTGTTACCTGTGGAAGATTGGCTTTCTGGGGACAGGTGTGGCAGGAGGGAG GGGGGTAGGGTGTGCCTGCCCTCCTCCAGTGCCGTTTCCTTCTCTCCTAGTGGGTAGGTG
Nu
0
lukasz-kozlowski/biopython
Tests/Fasta/lavender.nu
[ "BSD-3-Clause" ]
#!/usr/bin/perl -wT use strict; use CGI; my $cgi = new CGI; print "Content-Type: text/html\n"; print "\n"; print <<"END"; <form method="POST" enctype="application/x-www-form-urlencoded" action="#foo"> <input type="text" name="f"> <input type="submit" value="Submit"> </form> <div id="result"></div> <script> onunload = function() { // no page cache } onload = function() { alert("stage: " + sessionStorage.stage); switch (sessionStorage.stage++) { case 1: // Submit form in a timeout to make sure that we create a new back/forward list item. setTimeout(function() {document.forms[0].submit();}, 0); break; case 2: history.back(); break; case 3: document.getElementById("result").innerText = "PASS"; if (window.testRunner) testRunner.notifyDone(); break; } } </script> END
Perl
3
zealoussnow/chromium
third_party/blink/web_tests/http/tests/navigation/resources/submit-to-fragment.pl
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
_ = require 'underscore' {NylasAPI, NylasAPIRequest, Event, Actions, APIError, EventRSVPTask, DatabaseStore, DatabaseWriter, AccountStore} = require 'nylas-exports' xdescribe "EventRSVPTask", -> beforeEach -> spyOn(DatabaseStore, 'find').andCallFake => Promise.resolve(@event) spyOn(DatabaseWriter.prototype, 'persistModel').andCallFake -> Promise.resolve() @myName = "Ben Tester" @myEmail = "tester@nylas.com" @event = new Event id: '12233AEDF5' accountId: TEST_ACCOUNT_ID title: 'Meeting with Ben Bitdiddle' description: '' location: '' when: end_time: 1408123800 start_time: 1408120200 start: 1408120200 end: 1408123800 participants: [ {"name": "Ben Bitdiddle", "email": "ben@bitdiddle.com", "status": "yes"}, {"name": @myName, "email": @myEmail, "status": 'noreply'} ] @task = new EventRSVPTask(@event, @myEmail, "no") describe "performLocal", -> it "should mark our status as no", -> @task.performLocal() advanceClock() expect(@event.participants[1].status).toBe "no" it "should trigger an action to persist the change", -> @task.performLocal() advanceClock() expect(DatabaseWriter.prototype.persistModel).toHaveBeenCalled() describe "performRemote", -> it "should make the POST request to the message endpoint", -> spyOn(NylasAPIRequest.prototype, 'run').andCallFake => new Promise (resolve,reject) -> @task.performRemote() options = NylasAPIRequest.prototype.run.mostRecentCall.object.options expect(options.path).toBe("/send-rsvp") expect(options.method).toBe('POST') expect(options.accountId).toBe(@event.accountId) expect(options.body.event_id).toBe(@event.id) expect(options.body.status).toBe("no") describe "when the remote API request fails", -> beforeEach -> spyOn(NylasAPIRequest.prototype, 'run').andCallFake -> Promise.reject(new APIError(body: '', statusCode: 400)) it "should not be marked with the status", -> @event = new Event id: '12233AEDF5' title: 'Meeting with Ben Bitdiddle' description: '' location: '' when: end_time: 1408123800 start_time: 1408120200 start: 1408120200 end: 1408123800 participants: [ {"name": "Ben Bitdiddle", "email": "ben@bitdiddle.com", "status": "yes"}, {"name": @myName, "email": @myEmail, "status": 'noreply'} ] @task = new EventRSVPTask(@event, @myEmail, "no") @task.performLocal() @task.performRemote() advanceClock() expect(@event.participants[1].status).toBe "noreply" it "should trigger an action to persist the change", -> @task.performLocal() @task.performRemote() advanceClock() expect(DatabaseWriter.prototype.persistModel).toHaveBeenCalled()
CoffeeScript
4
cnheider/nylas-mail
packages/client-app/spec/tasks/event-rsvp-task-spec.coffee
[ "MIT" ]
def mynumerator(x): if parent(x) == R: return x return numerator(x) class fastfrac: def __init__(self,top,bot=1): if parent(top) == ZZ or parent(top) == R: self.top = R(top) self.bot = R(bot) elif top.__class__ == fastfrac: self.top = top.top self.bot = top.bot * bot else: self.top = R(numerator(top)) self.bot = R(denominator(top)) * bot def reduce(self): return fastfrac(self.top / self.bot) def sreduce(self): return fastfrac(I.reduce(self.top),I.reduce(self.bot)) def iszero(self): return self.top in I and not (self.bot in I) def isdoublingzero(self): return self.top in J and not (self.bot in J) def __add__(self,other): if parent(other) == ZZ: return fastfrac(self.top + self.bot * other,self.bot) if other.__class__ == fastfrac: return fastfrac(self.top * other.bot + self.bot * other.top,self.bot * other.bot) return NotImplemented def __sub__(self,other): if parent(other) == ZZ: return fastfrac(self.top - self.bot * other,self.bot) if other.__class__ == fastfrac: return fastfrac(self.top * other.bot - self.bot * other.top,self.bot * other.bot) return NotImplemented def __neg__(self): return fastfrac(-self.top,self.bot) def __mul__(self,other): if parent(other) == ZZ: return fastfrac(self.top * other,self.bot) if other.__class__ == fastfrac: return fastfrac(self.top * other.top,self.bot * other.bot) return NotImplemented def __rmul__(self,other): return self.__mul__(other) def __div__(self,other): if parent(other) == ZZ: return fastfrac(self.top,self.bot * other) if other.__class__ == fastfrac: return fastfrac(self.top * other.bot,self.bot * other.top) return NotImplemented def __pow__(self,other): if parent(other) == ZZ: return fastfrac(self.top ^ other,self.bot ^ other) return NotImplemented def isidentity(x): return x.iszero() def isdoublingidentity(x): return x.isdoublingzero() R.<ua,ud,ux1,uy1,ux2,uy2> = PolynomialRing(QQ,6,order='invlex') I = R.ideal([ mynumerator((ua*ux1^2+uy1^2)-(1+ud*ux1^2*uy1^2)) , mynumerator((ua*ux2^2+uy2^2)-(1+ud*ux2^2*uy2^2)) ]) J = I + R.ideal([0 , ux1-ux2 , uy1-uy2 ]) ua = fastfrac(ua) ud = fastfrac(ud) ux1 = fastfrac(ux1) uy1 = fastfrac(uy1) ux2 = fastfrac(ux2) uy2 = fastfrac(uy2) ux3 = (((ux1*uy2+uy1*ux2)/(fastfrac(1)+ud*ux1*ux2*uy1*uy2))).reduce() uy3 = (((uy1*uy2-ua*ux1*ux2)/(fastfrac(1)-ud*ux1*ux2*uy1*uy2))).reduce() ux4 = (((ux1*uy1+uy1*ux1)/(fastfrac(1)+ud*ux1*ux1*uy1*uy1))).reduce() uy4 = (((uy1*uy1-ua*ux1*ux1)/(fastfrac(1)-ud*ux1*ux1*uy1*uy1))).reduce() a0 = fastfrac((fastfrac(1)/(ua-ud))) a1 = fastfrac((fastfrac(0))) a2 = fastfrac((fastfrac(4)*ua/(ua-ud)-fastfrac(2))) a3 = fastfrac((fastfrac(0))) a4 = fastfrac((fastfrac(1))) a6 = fastfrac((fastfrac(0))) wu1 = (((fastfrac(1)+uy1)/(fastfrac(1)-uy1))).reduce().sreduce() wv1 = ((fastfrac(2)*(fastfrac(1)+uy1)/(ux1*(fastfrac(1)-uy1)))).reduce().sreduce() print isidentity(a0*(wv1^2)+a1*(wu1*wv1)+a3*wv1-(((wu1+a2)*wu1+a4)*wu1+a6)) print isidentity(ux1-(fastfrac(2)*wu1/wv1)) print isidentity(uy1-((wu1-fastfrac(1))/(wu1+fastfrac(1)))) wu2 = (((fastfrac(1)+uy2)/(fastfrac(1)-uy2))).reduce().sreduce() wv2 = ((fastfrac(2)*(fastfrac(1)+uy2)/(ux2*(fastfrac(1)-uy2)))).reduce().sreduce() wu3 = (((fastfrac(1)+uy3)/(fastfrac(1)-uy3))).reduce().sreduce() wv3 = ((fastfrac(2)*(fastfrac(1)+uy3)/(ux3*(fastfrac(1)-uy3)))).reduce().sreduce() wu4 = (((fastfrac(1)+uy4)/(fastfrac(1)-uy4))).reduce().sreduce() wv4 = ((fastfrac(2)*(fastfrac(1)+uy4)/(ux4*(fastfrac(1)-uy4)))).reduce().sreduce() slope = ((wv2-wv1)/(wu2-wu1)).reduce().sreduce() print isidentity(a0*slope^2+a1*slope-a2-wu1-wu2-wu3) print isidentity(slope*(wu1-wu3)-wv1-a1*wu3-a3-wv3) slope = ((fastfrac(3)*wu1^2+fastfrac(2)*a2*wu1+a4-a1*wv1)/(fastfrac(2)*a0*wv1+a1*wu1+a3)).reduce().sreduce() print isidentity(a0*slope^2+a1*slope-a2-wu1-wu1-wu4) print isidentity(slope*(wu1-wu4)-wv1-a1*wu4-a3-wv4)
Sage
3
ShipChain/baseline
lib/circuits/ecc/bernstein-edwards.sage
[ "CC0-1.0" ]
pragma solidity ^0.5.0; import "./LeafA.sol"; import "./LeafB.sol"; contract Branch is LeafA, LeafB { uint branch; }
Solidity
3
wbt/truffle
packages/truffle/test/sources/inheritance/contracts/Branch.sol
[ "MIT" ]
redo version/clean rm -f python py *.pyc */*.pyc
Stata
1
moonglum/redo
redo/clean.do
[ "Apache-2.0" ]
{-#LANGUAGE ForeignFunctionInterface, ScopedTypeVariables#-} #include "cvWrapLEO.h" module CV.HighGUI where import Foreign.C.Types import Foreign.C.String import Foreign.ForeignPtr import Foreign.Ptr import CV.Image {#import CV.Image#} import CV.ImageOp -- Functions for easy operation -- TODO: "__TMP__" should be a gensym display image = do makeWindow "__TMP__" showImage "__TMP__" image --threadDelay 2000000 waitKey 0 destroyWindow "__TMP__" --- Lower level interface {#fun cvNamedWindow as mkWin {withCString* `String', `Int' } -> `()' #} makeWindow name = mkWin name 1 destroyWindow n = withCString n $ \name -> do {#call cvDestroyWindow#} name foreign import ccall "wrapper" trackbarCallback :: (CInt -> IO ()) -> IO (FunPtr (CInt -> IO ())) mkTrackbar mx initial name window callback = do cb <- trackbarCallback callback withCString name $ \cname -> withCString window $ \cwindow -> {#call cvCreateTrackbar#} cname cwindow nullPtr (fromIntegral mx) cb waitKey delay = {#call cvWaitKey#} delay {#fun cvShowImage as showImage {`String', withGenImage* `Image c d'} -> `()'#}
C2hs Haskell
5
maaleske/CV
CV/HighGUI.chs
[ "BSD-3-Clause" ]
resource SimpleLexEng = open SyntaxEng, GrammarEng, ParadigmsEng, ResEng, MorphoEng in { oper DictionaryItem09 : Str = "serve" ; DictionaryItem12 : Str = "place" ; }
Grammatical Framework
2
Site-Command/accelerated-text
core/test/resources/syntax/SimpleLexEng.gf
[ "Apache-2.0" ]
/****************************************************************************** * Copyright 2018 The Apollo Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *****************************************************************************/ #include "modules/canbus/vehicle/gem/protocol/global_rpt_6a.h" #include "glog/logging.h" #include "modules/drivers/canbus/common/byte.h" #include "modules/drivers/canbus/common/canbus_consts.h" namespace apollo { namespace canbus { namespace gem { using ::apollo::drivers::canbus::Byte; Globalrpt6a::Globalrpt6a() {} const int32_t Globalrpt6a::ID = 0x6A; void Globalrpt6a::Parse(const std::uint8_t* bytes, int32_t length, ChassisDetail* chassis) const { chassis->mutable_gem()->mutable_global_rpt_6a()->set_pacmod_status( pacmod_status(bytes, length)); chassis->mutable_gem()->mutable_global_rpt_6a()->set_override_status( override_status(bytes, length)); chassis->mutable_gem()->mutable_global_rpt_6a()->set_veh_can_timeout( veh_can_timeout(bytes, length)); chassis->mutable_gem()->mutable_global_rpt_6a()->set_str_can_timeout( str_can_timeout(bytes, length)); chassis->mutable_gem()->mutable_global_rpt_6a()->set_brk_can_timeout( brk_can_timeout(bytes, length)); chassis->mutable_gem()->mutable_global_rpt_6a()->set_usr_can_timeout( usr_can_timeout(bytes, length)); chassis->mutable_gem()->mutable_global_rpt_6a()->set_usr_can_read_errors( usr_can_read_errors(bytes, length)); } // config detail: {'name': 'pacmod_status', 'enum': {0: // 'PACMOD_STATUS_CONTROL_DISABLED', 1: 'PACMOD_STATUS_CONTROL_ENABLED'}, // 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'offset': 0.0, // 'physical_range': '[0|1]', 'bit': 0, 'type': 'enum', 'order': 'motorola', // 'physical_unit': ''} Global_rpt_6a::Pacmod_statusType Globalrpt6a::pacmod_status( const std::uint8_t* bytes, int32_t length) const { Byte t0(bytes + 0); int32_t x = t0.get_byte(0, 1); Global_rpt_6a::Pacmod_statusType ret = static_cast<Global_rpt_6a::Pacmod_statusType>(x); return ret; } // config detail: {'name': 'override_status', 'enum': {0: // 'OVERRIDE_STATUS_NOT_OVERRIDDEN', 1: 'OVERRIDE_STATUS_OVERRIDDEN'}, // 'precision': 1.0, 'len': 1, 'is_signed_var': False, 'offset': 0.0, // 'physical_range': '[0|1]', 'bit': 1, 'type': 'enum', 'order': 'motorola', // 'physical_unit': ''} Global_rpt_6a::Override_statusType Globalrpt6a::override_status( const std::uint8_t* bytes, int32_t length) const { Byte t0(bytes + 0); int32_t x = t0.get_byte(1, 1); Global_rpt_6a::Override_statusType ret = static_cast<Global_rpt_6a::Override_statusType>(x); return ret; } // config detail: {'name': 'veh_can_timeout', 'offset': 0.0, 'precision': 1.0, // 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2, // 'type': 'bool', 'order': 'motorola', 'physical_unit': ''} bool Globalrpt6a::veh_can_timeout(const std::uint8_t* bytes, int32_t length) const { Byte t0(bytes + 0); int32_t x = t0.get_byte(2, 1); bool ret = x; return ret; } // config detail: {'name': 'str_can_timeout', 'offset': 0.0, 'precision': 1.0, // 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3, // 'type': 'bool', 'order': 'motorola', 'physical_unit': ''} bool Globalrpt6a::str_can_timeout(const std::uint8_t* bytes, int32_t length) const { Byte t0(bytes + 0); int32_t x = t0.get_byte(3, 1); bool ret = x; return ret; } // config detail: {'name': 'brk_can_timeout', 'enum': {0: // 'BRK_CAN_TIMEOUT_NO_ACTIVE_CAN_TIMEOUT', 1: // 'BRK_CAN_TIMEOUT_ACTIVE_CAN_TIMEOUT'}, 'precision': 1.0, 'len': 1, // 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|1]', 'bit': 4, // 'type': 'enum', 'order': 'motorola', 'physical_unit': ''} Global_rpt_6a::Brk_can_timeoutType Globalrpt6a::brk_can_timeout( const std::uint8_t* bytes, int32_t length) const { Byte t0(bytes + 0); int32_t x = t0.get_byte(4, 1); Global_rpt_6a::Brk_can_timeoutType ret = static_cast<Global_rpt_6a::Brk_can_timeoutType>(x); return ret; } // config detail: {'name': 'usr_can_timeout', 'offset': 0.0, 'precision': 1.0, // 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 5, // 'type': 'bool', 'order': 'motorola', 'physical_unit': ''} bool Globalrpt6a::usr_can_timeout(const std::uint8_t* bytes, int32_t length) const { Byte t0(bytes + 0); int32_t x = t0.get_byte(5, 1); bool ret = x; return ret; } // config detail: {'name': 'usr_can_read_errors', 'offset': 0.0, // 'precision': 1.0, 'len': 16, 'is_signed_var': False, 'physical_range': // '[0|65535]', 'bit': 55, 'type': 'int', 'order': 'motorola', 'physical_unit': // ''} int Globalrpt6a::usr_can_read_errors(const std::uint8_t* bytes, int32_t length) const { Byte t0(bytes + 6); int32_t x = t0.get_byte(0, 8); Byte t1(bytes + 7); int32_t t = t1.get_byte(0, 8); x <<= 8; x |= t; int ret = x; return ret; } } // namespace gem } // namespace canbus } // namespace apollo
C++
5
seeclong/apollo
modules/canbus/vehicle/gem/protocol/global_rpt_6a.cc
[ "Apache-2.0" ]
switch a 1 :1 2 console.log 1 console.log 2 else a switch 3 3 :3 else :else switch true (> a 1) :1 (> 2 3) :2 else console.log 2 console.log 2 set a 4 switch true (> a 2) :large else :small
Cirru
2
Cirru/cirru-script
examples/switch.cirru
[ "Xnet", "X11" ]
forward OnRconCommand(cmd[]); public OnRconCommand(cmd[]) { return 0; }
PAWN
0
Cheaterman/PySAMP
docker/scripts/empty_filterscript.pwn
[ "Apache-2.0" ]
%%% %%% Authors: %%% Martin Henz (henz@iscs.nus.edu.sg) %%% Christian Schulte <schulte@ps.uni-sb.de> %%% %%% Copyright: %%% Martin Henz, 1997 %%% Christian Schulte, 1997 %%% %%% Last change: %%% $Date$ by $Author$ %%% $Revision$ %%% %%% This file is part of Mozart, an implementation %%% of Oz 3 %%% http://www.mozart-oz.org %%% %%% See the file "LICENSE" or %%% http://www.mozart-oz.org/LICENSE.html %%% for information on usage and redistribution %%% of this file, and for a DISCLAIMER OF ALL %%% WARRANTIES. %%% %% %% Module %% Bool = bool(is: IsBool and: And 'or': Or 'not': Not 'true': true 'false': false)
Oz
4
Ahzed11/mozart2
lib/main/base/Bool.oz
[ "BSD-2-Clause" ]
<script> function show_wake_result(data) { BootstrapDialog.show({ type: data.status == 'OK' ? BootstrapDialog.TYPE_SUCCESS : BootstrapDialog.TYPE_DANGER, title: "{{ lang._('Result') }}", message: (data.status == 'OK' ? '{{ lang._('Magic packet was sent successfully.') }}' : '{{ lang._('The packet was not sent due to an error. Please consult the logs.') }}<br />' + $('<pre>').text(data.error_msg).html() ), buttons: [{ label: '{{ lang._('Close') }}', action: function(dialog){ dialog.close(); } }] }); } $( document ).ready(function() { // delete host action $("#act_wake_all").click(function(event){ event.preventDefault(); $.post('/api/wol/wol/wakeall', {}, function(data) { BootstrapDialog.show({ type: BootstrapDialog.TYPE_INFO, title: "{{ lang._('Result') }}", message: '<ul>' + (data['results'].map(function(element) { return `<li>${element.mac}: ${element.status}</li>` }).join('')) + '</ul>', buttons: [{ label: '{{ lang._('Close') }}', action: function(dialog){ dialog.close(); } }] }); }); }); var grid = $("#grid-wol-settings").UIBootgrid( { 'search':'/api/wol/wol/searchHost', 'get':'/api/wol/wol/getHost/', 'set':'/api/wol/wol/setHost/', 'add':'/api/wol/wol/addHost/', 'del':'/api/wol/wol/delHost/', 'options':{ selection:false, multiSelect:false, formatters: { "commandswithwake": function (column, row) { return "<button type=\"button\" class=\"btn btn-xs btn-default command-wake\" data-row-id=\"" + row.uuid + "\"><span class=\"fa fa-clock-o\"></span></button> " + "<button type=\"button\" class=\"btn btn-xs btn-default command-edit\" data-row-id=\"" + row.uuid + "\"><span class=\"fa fa-pencil\"></span></button> " + "<button type=\"button\" class=\"btn btn-xs btn-default command-copy\" data-row-id=\"" + row.uuid + "\"><span class=\"fa fa-clone\"></span></button>" + "<button type=\"button\" class=\"btn btn-xs btn-default command-delete\" data-row-id=\"" + row.uuid + "\"><span class=\"fa fa-trash-o\"></span></button>"; } } } } ); grid.on("loaded.rs.jquery.bootgrid", function(){ grid.find('.command-wake').click(function(event) { event.preventDefault(); $.post('/api/wol/wol/set', {'uuid': this.dataset['rowId']}, function(data) { show_wake_result(data); }); }); }); }); function msg_not_successful(wolent) { return '{{ lang._('Please check the %ssystem log%s, the wol command for %s (%s) did not complete successfully.') | format( '<a href="/ui/diagnostics/log/core/system">', '</a>', '%s', '%s') }}' .replace('%s', wolent['descr']).replace('%s',$('<pre>').text(wolent['mac']).html()); } function msg_successful(wolent) { return 'Sent magic packet to %s (%s).'.replace('%s', wolent['descr']).replace('%s',$('<pre>').text(wolent['mac']).html()); } $( document ).ready(function() { var data_get_map = {'frm_wol_wake':"/api/wol/wol/getwake"}; mapDataToFormUI(data_get_map).done(function(data){ formatTokenizersUI(); $('.selectpicker').selectpicker('refresh'); }); // link save button to API set action $("#wakeAct").click(function(){ ajaxCall(url="/api/wol/wol/set", data=getFormData('frm_wol_wake'),callback=function(data, status){ show_wake_result(data); }, true); }); }); </script> <div class="content-box" style="padding-bottom: 1.5em;"> {{ partial("layout_partials/base_form",['fields':wakeForm,'id':'frm_wol_wake'])}} <div class="col-md-12"> <hr /> <button class="btn btn-primary" id="wakeAct" type="button"><b>{{ lang._('Wake up') }}</b> <i id="wakeAct_progress"></i></button> </div> </div> <div class="content-box" style="padding-bottom: 1.5em;"> <table id="grid-wol-settings" class="table table-responsive" data-editDialog="frm_wol_settings"> <thead> <tr> <th data-column-id="interface" data-type="string" data-visible="true">{{ lang._('Interface') }}</th> <th data-column-id="mac" data-type="string" data-visible="true">{{ lang._('MAC') }}</th> <th data-column-id="descr" data-type="string" data-identifier="true">{{ lang._('Description') }}</th> <th data-column-id="commands" data-formatter="commandswithwake" data-sortable="false">{{ lang._('Commands') }}</th> </tr> </thead> <tbody> </tbody> <tfoot> <tr> <td colspan="3"></td> <td> <button data-action="add" type="button" class="btn btn-xs btn-default"><span class="fa fa-plus"></span></button> <button type="button" class="btn btn-xs reload_btn btn-primary" id="act_wake_all"><span class="fa wakeallAct_progress"></span> {{ lang._('Wake All') }}</button> </td> </tr> </tfoot> </table> </div> {{ partial("layout_partials/base_dialog",['fields': hostForm,'id':'frm_wol_settings', 'label':lang._('Edit WOL Host')]) }}
Volt
5
marcquark/plugins
net/wol/src/opnsense/mvc/app/views/OPNsense/Wol/index.volt
[ "BSD-2-Clause" ]
%% %% %CopyrightBegin% %% %% Copyright Ericsson AB 2000-2020. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. %% You may obtain a copy of the License at %% %% http://www.apache.org/licenses/LICENSE-2.0 %% %% Unless required by applicable law or agreed to in writing, software %% distributed under the License is distributed on an "AS IS" BASIS, %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %% See the License for the specific language governing permissions and %% limitations under the License. %% %% %CopyrightEnd% %% %% %%---------------------------------------------------------------------- %%% Purpose: Encode PRETTY Megaco/H.248 text messages from internal form %%---------------------------------------------------------------------- -module(megaco_pretty_text_encoder). -behaviour(megaco_encoder). -export([encode_message/3, decode_message/3, decode_mini_message/3, version_of/2, encode_transaction/3, encode_action_requests/3, encode_action_request/3, encode_command_request/3, encode_action_reply/3]). %% Backward compatible funcs: -export([encode_message/2, decode_message/2, encode_transaction/1, encode_command_request/1, encode_action_reply/1]). %% Do we need these here? -export([trim_quoted_string/1, term_to_compact_string/1, term_to_pretty_string/1]). -export([token_tag2string/1, token_tag2string/2]). -include("megaco_text_tokens.hrl"). -include_lib("megaco/src/engine/megaco_message_internal.hrl"). -define(V1_PARSE_MOD, megaco_text_parser_v1). -define(V2_PARSE_MOD, megaco_text_parser_v2). -define(V3_PARSE_MOD, megaco_text_parser_v3). %%---------------------------------------------------------------------- %% Convert a 'MegacoMessage' record into a binary %% Return {ok, DeepIoList} | {error, Reason} %%---------------------------------------------------------------------- encode_message(EncodingConfig, #'MegacoMessage'{mess = #'Message'{version = V}} = MegaMsg) -> encode_message(EncodingConfig, V, MegaMsg). %% <BACKWARD-COMPAT-CLAUSE> encode_message([{version3,_}|EC], 1, MegaMsg) -> megaco_pretty_text_encoder_v1:encode_message(EC, MegaMsg); %% </BACKWARD-COMPAT-CLAUSE> encode_message(EC, 1, MegaMsg) -> megaco_pretty_text_encoder_v1:encode_message(EC, MegaMsg); %% <BACKWARD-COMPAT-CLAUSE> encode_message([{version3,_}|EC], 2, MegaMsg) -> megaco_pretty_text_encoder_v2:encode_message(EC, MegaMsg); %% </BACKWARD-COMPAT-CLAUSE> encode_message(EC, 2, MegaMsg) -> megaco_pretty_text_encoder_v2:encode_message(EC, MegaMsg); %% <BACKWARD-COMPAT-CLAUSE> encode_message([{version3,v3}|EC], 3, MegaMsg) -> megaco_pretty_text_encoder_v3:encode_message(EC, MegaMsg); %% </BACKWARD-COMPAT-CLAUSE> encode_message(EC, 3, MegaMsg) -> megaco_pretty_text_encoder_v3:encode_message(EC, MegaMsg); encode_message(_EC, V, _MegaMsg) -> {error, {bad_version, V}}. %%---------------------------------------------------------------------- %% Convert a binary into a 'MegacoMessage' record %% Return {ok, MegacoMessageRecord} | {error, Reason} %%---------------------------------------------------------------------- version_of(_EC, Bin) -> case megaco_text_scanner:scan(Bin) of {ok, _Tokens, V, _LastLine} -> {ok, V}; {error, Reason, Line} -> {error, {decode_failed, Reason, Line}} end. decode_message(EC, Bin) -> decode_message(EC, dynamic, Bin). decode_message([], _, Bin) when is_binary(Bin) -> case megaco_text_scanner:scan(Bin) of {ok, Tokens, 1, _LastLine} -> do_decode_message(?V1_PARSE_MOD, Tokens, Bin); {ok, Tokens, 2, _LastLine} -> do_decode_message(?V2_PARSE_MOD, Tokens, Bin); {ok, Tokens, 3, _LastLine} -> do_decode_message(?V3_PARSE_MOD, Tokens, Bin); {ok, _Tokens, V, _LastLine} -> {error, {unsupported_version, V}}; %% {error, Reason, Tokens, Line} -> %% scan_error(Reason, Line, Tokens, Bin); {error, Reason, Line} -> %% OTP-4007 scan_error(Reason, Line, Bin) %% OTP-4007 end; %% <BACKWARD-COMPAT-CLAUSE> decode_message([{version3,v3}], _, Bin) when is_binary(Bin) -> case megaco_text_scanner:scan(Bin) of {ok, Tokens, 1, _LastLine} -> do_decode_message(?V1_PARSE_MOD, Tokens, Bin); {ok, Tokens, 2, _LastLine} -> do_decode_message(?V2_PARSE_MOD, Tokens, Bin); {ok, Tokens, 3, _LastLine} -> do_decode_message(?V3_PARSE_MOD, Tokens, Bin); {ok, _Tokens, V, _LastLine} -> {error, {unsupported_version, V}}; {error, Reason, Tokens, Line} -> scan_error(Reason, Line, Tokens, Bin); {error, Reason, Line} -> %% OTP-4007 scan_error(Reason, Line, Bin) %% OTP-4007 end; %% </BACKWARD-COMPAT-CLAUSE> decode_message([{flex, Port}], _, Bin) when is_binary(Bin) -> case megaco_flex_scanner:scan(Bin, Port) of {ok, Tokens, 1, _LastLine} -> do_decode_message(?V1_PARSE_MOD, Tokens, Bin); {ok, Tokens, 2, _LastLine} -> do_decode_message(?V2_PARSE_MOD, Tokens, Bin); {ok, Tokens, 3, _LastLine} -> do_decode_message(?V3_PARSE_MOD, Tokens, Bin); {ok, _Tokens, V, _LastLine} -> {error, {unsupported_version, V}}; %% {error, Reason, Tokens, Line} -> %% scan_error(Reason, Line, Tokens, Bin); {error, Reason, Line} -> %% OTP-4007 scan_error(Reason, Line, Bin) %% OTP-4007 end; %% <BACKWARD-COMPAT-CLAUSE> decode_message([{version3,v3},{flex, Port}], _, Bin) when is_binary(Bin) -> case megaco_flex_scanner:scan(Bin, Port) of {ok, Tokens, 1, _LastLine} -> do_decode_message(?V1_PARSE_MOD, Tokens, Bin); {ok, Tokens, 2, _LastLine} -> do_decode_message(?V2_PARSE_MOD, Tokens, Bin); {ok, Tokens, 3, _LastLine} -> do_decode_message(?V3_PARSE_MOD, Tokens, Bin); {ok, _Tokens, V, _LastLine} -> {error, {unsupported_version, V}}; %% {error, Reason, Tokens, Line} -> %% scan_error(Reason, Line, Tokens, Bin); {error, Reason, Line} -> %% OTP-4007 scan_error(Reason, Line, Bin) %% OTP-4007 end; %% </BACKWARD-COMPAT-CLAUSE> decode_message(EC, _, Bin) when is_binary(Bin) -> {error, {bad_encoding_config, EC}}; decode_message(_EC, _, _BadBin) -> {error, bad_binary}. do_decode_message(ParseMod, Tokens, Bin) -> case (catch ParseMod:parse(Tokens)) of {ok, MegacoMessage} -> {ok, MegacoMessage}; {error, Reason} -> parse_error(Reason, Tokens, Bin); %% OTP-4007 {'EXIT', Reason} -> parse_error(Reason, Tokens, Bin) end. decode_mini_message(EC, _, Bin) when is_binary(Bin) -> megaco_text_mini_decoder:decode_message(EC, Bin). scan_error(Reason, Line, Bin) -> scan_error(Reason, Line, [], Bin). scan_error("bad_property_parm: " ++ Reason, _Line, _Tokens, _Bin) -> {error, {bad_property_parm, Reason}}; scan_error(Reason, Line, Tokens, Bin) -> %% io:format("scanner error: " %% "~n Reason: ~p" %% "~n Line: ~p" %% "~n Tokens: ~p" %% "~n Bin: ~p" %% "~n", [Reason, Line, Tokens, Bin]), {error, [{reason, Reason, Line}, {token, Tokens}, {chars, Bin}]}. parse_error(Reason, Tokens, Chars) -> %% io:format("parse_error -> entry with" %% "~n Reason: ~p" %% "~n Tokens: ~p" %% "~n Chars: ~p" %% "~n", [Reason, Tokens, Chars]), case Reason of {Line, Mod, [Prefix, [$[, TokenStringRaw, $]]]} when is_integer(Line) andalso is_atom(Mod) andalso is_list(Prefix) andalso is_list(TokenStringRaw) -> TokenString = [l2i(X) || X <- TokenStringRaw, is_list(X)], ReasonStr = Prefix ++ TokenString, {error, [{reason, ReasonStr, Line}, {tokens, Tokens}, {chars, Chars}, {module, Mod}]}; _ -> {error, [{reason, Reason}, {token, Tokens}, {chars, Chars}]} end. l2i(L) when is_list(L) -> case (catch list_to_integer(L)) of I when is_integer(I) -> I; _ -> L end. %%---------------------------------------------------------------------- %% Convert a transaction record into a binary %% Return {ok, Bin} | {error, Reason} %%---------------------------------------------------------------------- encode_transaction(Trans) -> encode_transaction([], 1, Trans). %% <BACKWARD-COMPAT-CLAUSE> encode_transaction([{version3,_}|EC], 1, Trans) -> megaco_pretty_text_encoder_v1:encode_transaction(EC, Trans); %% </BACKWARD-COMPAT-CLAUSE> encode_transaction(EC, 1, Trans) -> megaco_pretty_text_encoder_v1:encode_transaction(EC, Trans); %% <BACKWARD-COMPAT-CLAUSE> encode_transaction([{version3,_}|EC], 2, Trans) -> megaco_pretty_text_encoder_v2:encode_transaction(EC, Trans); %% </BACKWARD-COMPAT-CLAUSE> encode_transaction(EC, 2, Trans) -> megaco_pretty_text_encoder_v2:encode_transaction(EC, Trans); %% <BACKWARD-COMPAT-CLAUSE> encode_transaction([{version3,v3}|EC], 3, Trans) -> megaco_pretty_text_encoder_v3:encode_transaction(EC, Trans); %% </BACKWARD-COMPAT-CLAUSE> encode_transaction(EC, 3, Trans) -> megaco_pretty_text_encoder_v3:encode_transaction(EC, Trans); encode_transaction(_EC, V, _Trans) -> {error, {bad_version, V}}. %%---------------------------------------------------------------------- %% Convert a list of ActionRequest record's into a binary %% Return {ok, DeepIoList} | {error, Reason} %%---------------------------------------------------------------------- %% <BACKWARD-COMPAT-CLAUSE> encode_action_requests([{version3,_}|EC], 1, ActReqs) when is_list(ActReqs) -> megaco_pretty_text_encoder_v1:encode_action_requests(EC, ActReqs); %% </BACKWARD-COMPAT-CLAUSE> encode_action_requests(EC, 1, ActReqs) when is_list(ActReqs) -> megaco_pretty_text_encoder_v1:encode_action_requests(EC, ActReqs); %% <BACKWARD-COMPAT-CLAUSE> encode_action_requests([{version3,_}|EC], 2, ActReqs) when is_list(ActReqs) -> megaco_pretty_text_encoder_v2:encode_action_requests(EC, ActReqs); %% </BACKWARD-COMPAT-CLAUSE> encode_action_requests(EC, 2, ActReqs) when is_list(ActReqs) -> megaco_pretty_text_encoder_v2:encode_action_requests(EC, ActReqs); %% <BACKWARD-COMPAT-CLAUSE> encode_action_requests([{version3,v3}|EC], 3, ActReqs) when is_list(ActReqs) -> megaco_pretty_text_encoder_v3:encode_action_requests(EC, ActReqs); %% </BACKWARD-COMPAT-CLAUSE> encode_action_requests(EC, 3, ActReqs) when is_list(ActReqs) -> megaco_pretty_text_encoder_v3:encode_action_requests(EC, ActReqs); encode_action_requests(_EC, V, _ActReqs) -> {error, {bad_version, V}}. %%---------------------------------------------------------------------- %% Convert a ActionRequest record into a binary %% Return {ok, DeepIoList} | {error, Reason} %%---------------------------------------------------------------------- %% <BACKWARD-COMPAT-CLAUSE> encode_action_request([{version3,_}|EC], 1, ActReq) -> megaco_pretty_text_encoder_v1:encode_action_request(EC, ActReq); %% </BACKWARD-COMPAT-CLAUSE> encode_action_request(EC, 1, ActReq) -> megaco_pretty_text_encoder_v1:encode_action_request(EC, ActReq); %% <BACKWARD-COMPAT-CLAUSE> encode_action_request([{version3,_}|EC], 2, ActReq) -> megaco_pretty_text_encoder_v2:encode_action_request(EC, ActReq); %% </BACKWARD-COMPAT-CLAUSE> encode_action_request(EC, 2, ActReq) -> megaco_pretty_text_encoder_v2:encode_action_request(EC, ActReq); %% <BACKWARD-COMPAT-CLAUSE> encode_action_request([{version3,v3}|EC], 3, ActReq) -> megaco_pretty_text_encoder_v3:encode_action_request(EC, ActReq); %% </BACKWARD-COMPAT-CLAUSE> encode_action_request(EC, 3, ActReq) -> megaco_pretty_text_encoder_v3:encode_action_request(EC, ActReq); encode_action_request(_EC, V, _ActReq) -> {error, {bad_version, V}}. %%---------------------------------------------------------------------- %% Convert a CommandRequest record into a binary %% Return {ok, DeepIoList} | {error, Reason} %%---------------------------------------------------------------------- encode_command_request(CmdReq) -> encode_command_request([], 1, CmdReq). %% <BACKWARD-COMPAT-CLAUSE> encode_command_request([{version3,_}|EC], 1, CmdReq) -> megaco_pretty_text_encoder_v1:encode_command_request(EC, CmdReq); %% </BACKWARD-COMPAT-CLAUSE> encode_command_request(EC, 1, CmdReq) -> megaco_pretty_text_encoder_v1:encode_command_request(EC, CmdReq); %% <BACKWARD-COMPAT-CLAUSE> encode_command_request([{version3,_}|EC], 2, CmdReq) -> megaco_pretty_text_encoder_v2:encode_command_request(EC, CmdReq); %% </BACKWARD-COMPAT-CLAUSE> encode_command_request(EC, 2, CmdReq) -> megaco_pretty_text_encoder_v2:encode_command_request(EC, CmdReq); %% <BACKWARD-COMPAT-CLAUSE> encode_command_request([{version3,v3}|EC], 3, CmdReq) -> megaco_pretty_text_encoder_v3:encode_command_request(EC, CmdReq); %% </BACKWARD-COMPAT-CLAUSE> encode_command_request(EC, 3, CmdReq) -> megaco_pretty_text_encoder_v3:encode_command_request(EC, CmdReq); encode_command_request(_EC, V, _CmdReq) -> {error, {bad_version, V}}. %%---------------------------------------------------------------------- %% Convert a action reply into a deep io list %% Return {ok, DeepIoList} | {error, Reason} %%---------------------------------------------------------------------- encode_action_reply(ActRep) -> %% io:format("~p:encode_action_reply -> entry with" %% "~n ActRep: ~p" %% "~n", [?MODULE, ActRep]), encode_action_reply([], 1, ActRep). %% <BACKWARD-COMPAT-CLAUSE> encode_action_reply([{version3,_}|EC], 1, ActRep) -> megaco_pretty_text_encoder_v1:encode_action_reply(EC, ActRep); %% </BACKWARD-COMPAT-CLAUSE> encode_action_reply(EC, 1, ActRep) -> megaco_pretty_text_encoder_v1:encode_action_reply(EC, ActRep); %% <BACKWARD-COMPAT-CLAUSE> encode_action_reply([{version3,_}|EC], 2, ActRep) -> megaco_pretty_text_encoder_v2:encode_action_reply(EC, ActRep); %% </BACKWARD-COMPAT-CLAUSE> encode_action_reply(EC, 2, ActRep) -> megaco_pretty_text_encoder_v2:encode_action_reply(EC, ActRep); %% <BACKWARD-COMPAT-CLAUSE> encode_action_reply([{version3,v3}|EC], 3, ActRep) -> megaco_pretty_text_encoder_v3:encode_action_reply(EC, ActRep); %% </BACKWARD-COMPAT-CLAUSE> encode_action_reply(EC, 3, ActRep) -> megaco_pretty_text_encoder_v3:encode_action_reply(EC, ActRep); encode_action_reply(_EC, V, _ActRep) -> {error, {bad_version, V}}. %%---------------------------------------------------------------------- term_to_compact_string(Term) -> case catch io_lib:format("~s", [Term]) of {'EXIT', _} -> lists:flatten(io_lib:format("~w", [Term])); GoodString -> lists:flatten(GoodString) end. %%---------------------------------------------------------------------- term_to_pretty_string(Term) -> case catch io_lib:format("~s", [Term]) of {'EXIT', _} -> lists:flatten(io_lib:format("~p", [Term])); GoodString -> lists:flatten(GoodString) end. %%---------------------------------------------------------------------- trim_quoted_string([H | T]) -> case ?classify_char(H) of safe_char -> [H | trim_quoted_string(T)]; rest_char -> [H | trim_quoted_string(T)]; white_space -> [H | trim_quoted_string(T)]; _BadChar -> [$? | trim_quoted_string(T)] end; trim_quoted_string([]) -> []. %%---------------------------------------------------------------------- %% A utility function to pretty print the tags found in a megaco message %%---------------------------------------------------------------------- -define(TT2S_BEST_VERSION, v3). token_tag2string(Tag) -> token_tag2string(Tag, ?TT2S_BEST_VERSION). token_tag2string(Tag, 1) -> token_tag2string(Tag, v1); token_tag2string(Tag, v1) -> megaco_pretty_text_encoder_v1:token_tag2string(Tag); token_tag2string(Tag, 2) -> token_tag2string(Tag, v2); token_tag2string(Tag, v2) -> megaco_pretty_text_encoder_v2:token_tag2string(Tag); token_tag2string(Tag, 3) -> token_tag2string(Tag, v3); token_tag2string(Tag, v3) -> megaco_pretty_text_encoder_v3:token_tag2string(Tag); token_tag2string(Tag, _Vsn) -> token_tag2string(Tag, ?TT2S_BEST_VERSION).
Erlang
5
jjhoo/otp
lib/megaco/src/text/megaco_pretty_text_encoder.erl
[ "Apache-2.0" ]
{ "cells": [ { "cell_type": "markdown", "id": "8c60a9ea", "metadata": {}, "source": [ "#### DS requests results via request/response cycle\n", "\n", "A user can send a request to the domain owner to access a resource.\n", "\n", "- The user can send a request by calling the `.request` method on the pointer. \n", "- A `reason` needs to be passed on a parameter while requesting access to the data." ] }, { "cell_type": "markdown", "id": "3eb0fda9", "metadata": {}, "source": [ "#### The user selects a dataset and perform some query\n", "\n", "- The user selects a network and domain\n", "- The logs into the domain and selects a dataset\n", "- The user perform a query on the selected dataset pointer" ] }, { "cell_type": "code", "execution_count": null, "id": "b2e79ed9", "metadata": {}, "outputs": [], "source": [ "import syft as sy" ] }, { "cell_type": "code", "execution_count": 5, "id": "b8a5a27c", "metadata": {}, "outputs": [ { "data": { "text/html": [ "<div>\n", "<style scoped>\n", " .dataframe tbody tr th:only-of-type {\n", " vertical-align: middle;\n", " }\n", "\n", " .dataframe tbody tr th {\n", " vertical-align: top;\n", " }\n", "\n", " .dataframe thead th {\n", " text-align: right;\n", " }\n", "</style>\n", "<table border=\"1\" class=\"dataframe\">\n", " <thead>\n", " <tr style=\"text-align: right;\">\n", " <th></th>\n", " <th>Id</th>\n", " <th>Name</th>\n", " <th>Tags</th>\n", " <th>Assets</th>\n", " <th>Description</th>\n", " <th>Domain</th>\n", " <th>Network</th>\n", " <th>Usage</th>\n", " <th>Added On</th>\n", " </tr>\n", " </thead>\n", " <tbody>\n", " <tr>\n", " <th>0</th>\n", " <td>b5b04506a0a0405f93ea0e2c0263ced6</td>\n", " <td>Diabetes Dataset</td>\n", " <td>[Health, Classification, Dicom]</td>\n", " <td>[\"Images\"] -&gt; Tensor; [\"Labels\"] -&gt; Tensor</td>\n", " <td>A large set of high-resolution retina images</td>\n", " <td>California Healthcare Foundation</td>\n", " <td>WHO</td>\n", " <td>102</td>\n", " <td>Jan 20 2021</td>\n", " </tr>\n", " <tr>\n", " <th>1</th>\n", " <td>246a5e7835324a08b2883037257612dd</td>\n", " <td>Canada Commodities Dataset</td>\n", " <td>[Commodities, Canada, Trade]</td>\n", " <td>[\"ca-feb2021\"] -&gt; DataFrame</td>\n", " <td>Commodity Trade Dataset</td>\n", " <td>Canada Domain</td>\n", " <td>United Nations</td>\n", " <td>40</td>\n", " <td>Mar 11 2021</td>\n", " </tr>\n", " <tr>\n", " <th>2</th>\n", " <td>92c0719f990d4bcf85ccd039e2e034ba</td>\n", " <td>Italy Commodities Dataset</td>\n", " <td>[Commodities, Italy, Trade]</td>\n", " <td>[\"it-feb2021\"] -&gt; DataFrame</td>\n", " <td>Commodity Trade Dataset</td>\n", " <td>Italy Domain</td>\n", " <td>United Nations</td>\n", " <td>23</td>\n", " <td>Mar 20 2021</td>\n", " </tr>\n", " <tr>\n", " <th>3</th>\n", " <td>20b93adea1504538a7d03d7c3f248c20</td>\n", " <td>Netherlands Commodities Dataset</td>\n", " <td>[Commodities, Netherlands, Trade]</td>\n", " <td>[\"ne-feb2021\"] -&gt; DataFrame</td>\n", " <td>Commodity Trade Dataset</td>\n", " <td>Netherland Domain</td>\n", " <td>United Nations</td>\n", " <td>20</td>\n", " <td>Apr 12 2021</td>\n", " </tr>\n", " <tr>\n", " <th>4</th>\n", " <td>fc650f14f6f7454b87d3ccd345c437b5</td>\n", " <td>Pnuemonia Dataset</td>\n", " <td>[Health, Pneumonia, X-Ray]</td>\n", " <td>[\"X-Ray-Images\"] -&gt; Tensor; [\"labels\"] -&gt; Tensor</td>\n", " <td>Chest X-Ray images. All provided images are in...</td>\n", " <td>RSNA</td>\n", " <td>WHO</td>\n", " <td>334</td>\n", " <td>Jan 20 2021</td>\n", " </tr>\n", " </tbody>\n", "</table>\n", "</div>" ], "text/plain": [ " Id Name \\\n", "0 b5b04506a0a0405f93ea0e2c0263ced6 Diabetes Dataset \n", "1 246a5e7835324a08b2883037257612dd Canada Commodities Dataset \n", "2 92c0719f990d4bcf85ccd039e2e034ba Italy Commodities Dataset \n", "3 20b93adea1504538a7d03d7c3f248c20 Netherlands Commodities Dataset \n", "4 fc650f14f6f7454b87d3ccd345c437b5 Pnuemonia Dataset \n", "\n", " Tags \\\n", "0 [Health, Classification, Dicom] \n", "1 [Commodities, Canada, Trade] \n", "2 [Commodities, Italy, Trade] \n", "3 [Commodities, Netherlands, Trade] \n", "4 [Health, Pneumonia, X-Ray] \n", "\n", " Assets \\\n", "0 [\"Images\"] -> Tensor; [\"Labels\"] -> Tensor \n", "1 [\"ca-feb2021\"] -> DataFrame \n", "2 [\"it-feb2021\"] -> DataFrame \n", "3 [\"ne-feb2021\"] -> DataFrame \n", "4 [\"X-Ray-Images\"] -> Tensor; [\"labels\"] -> Tensor \n", "\n", " Description \\\n", "0 A large set of high-resolution retina images \n", "1 Commodity Trade Dataset \n", "2 Commodity Trade Dataset \n", "3 Commodity Trade Dataset \n", "4 Chest X-Ray images. All provided images are in... \n", "\n", " Domain Network Usage Added On \n", "0 California Healthcare Foundation WHO 102 Jan 20 2021 \n", "1 Canada Domain United Nations 40 Mar 11 2021 \n", "2 Italy Domain United Nations 23 Mar 20 2021 \n", "3 Netherland Domain United Nations 20 Apr 12 2021 \n", "4 RSNA WHO 334 Jan 20 2021 " ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Let's list the available dataset\n", "sy.datasets" ] }, { "cell_type": "code", "execution_count": 7, "id": "5f3bda65", "metadata": {}, "outputs": [ { "data": { "text/html": [ "<div>\n", "<style scoped>\n", " .dataframe tbody tr th:only-of-type {\n", " vertical-align: middle;\n", " }\n", "\n", " .dataframe tbody tr th {\n", " vertical-align: top;\n", " }\n", "\n", " .dataframe thead th {\n", " text-align: right;\n", " }\n", "</style>\n", "<table border=\"1\" class=\"dataframe\">\n", " <thead>\n", " <tr style=\"text-align: right;\">\n", " <th></th>\n", " <th>Id</th>\n", " <th>Name</th>\n", " <th>Hosted Domains</th>\n", " <th>Hosted Datasets</th>\n", " <th>Description</th>\n", " <th>Tags</th>\n", " <th>Url</th>\n", " </tr>\n", " </thead>\n", " <tbody>\n", " <tr>\n", " <th>0</th>\n", " <td>33c077db2e6249b49713bf7f53708524</td>\n", " <td>United Nations</td>\n", " <td>4</td>\n", " <td>6</td>\n", " <td>The UN hosts data related to the commodity and...</td>\n", " <td>[Commodities, Census, Health]</td>\n", " <td>https://un.openmined.org</td>\n", " </tr>\n", " <tr>\n", " <th>1</th>\n", " <td>cc2044861d534a6c98f0a669175af9bf</td>\n", " <td>World Health Organisation</td>\n", " <td>3</td>\n", " <td>5</td>\n", " <td>WHO hosts data related to health sector of dif...</td>\n", " <td>[Virology, Cancer, Health]</td>\n", " <td>https://who.openmined.org</td>\n", " </tr>\n", " <tr>\n", " <th>2</th>\n", " <td>3981dfa140c445cf90e23e6ef4b8fe9c</td>\n", " <td>International Space Station</td>\n", " <td>2</td>\n", " <td>4</td>\n", " <td>ISS hosts data related to the topography of di...</td>\n", " <td>[Exoplanets, Extra-Terrestrial]</td>\n", " <td>https://iss.openmined.org</td>\n", " </tr>\n", " </tbody>\n", "</table>\n", "</div>" ], "text/plain": [ " Id Name \\\n", "0 33c077db2e6249b49713bf7f53708524 United Nations \n", "1 cc2044861d534a6c98f0a669175af9bf World Health Organisation \n", "2 3981dfa140c445cf90e23e6ef4b8fe9c International Space Station \n", "\n", " Hosted Domains Hosted Datasets \\\n", "0 4 6 \n", "1 3 5 \n", "2 2 4 \n", "\n", " Description \\\n", "0 The UN hosts data related to the commodity and... \n", "1 WHO hosts data related to health sector of dif... \n", "2 ISS hosts data related to the topography of di... \n", "\n", " Tags Url \n", "0 [Commodities, Census, Health] https://un.openmined.org \n", "1 [Virology, Cancer, Health] https://who.openmined.org \n", "2 [Exoplanets, Extra-Terrestrial] https://iss.openmined.org " ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# We want to access the `Pneumonia Dataset`, let's connect to the RSNA domain\n", "# Let's list the RSNA available networks\n", "sy.networks" ] }, { "cell_type": "code", "execution_count": 14, "id": "eae6797a", "metadata": {}, "outputs": [ { "data": { "text/html": [ "<div>\n", "<style scoped>\n", " .dataframe tbody tr th:only-of-type {\n", " vertical-align: middle;\n", " }\n", "\n", " .dataframe tbody tr th {\n", " vertical-align: top;\n", " }\n", "\n", " .dataframe thead th {\n", " text-align: right;\n", " }\n", "</style>\n", "<table border=\"1\" class=\"dataframe\">\n", " <thead>\n", " <tr style=\"text-align: right;\">\n", " <th></th>\n", " <th>Id</th>\n", " <th>Name</th>\n", " <th>Hosted Datasets</th>\n", " <th>Description</th>\n", " <th>Tags</th>\n", " </tr>\n", " </thead>\n", " <tbody>\n", " <tr>\n", " <th>0</th>\n", " <td>02631a42192942e08ea0ab10598f2c79</td>\n", " <td>California Healthcare Foundation</td>\n", " <td>1</td>\n", " <td>Health care systems</td>\n", " <td>[Clinical Data, Healthcare]</td>\n", " </tr>\n", " <tr>\n", " <th>1</th>\n", " <td>e1640cc4af70422da1d60300724b1ee3</td>\n", " <td>RSNA</td>\n", " <td>1</td>\n", " <td>Radiological Image Datasets</td>\n", " <td>[Dicom, Radiology, Health]</td>\n", " </tr>\n", " </tbody>\n", "</table>\n", "</div>" ], "text/plain": [ " Id Name \\\n", "0 02631a42192942e08ea0ab10598f2c79 California Healthcare Foundation \n", "1 e1640cc4af70422da1d60300724b1ee3 RSNA \n", "\n", " Hosted Datasets Description Tags \n", "0 1 Health care systems [Clinical Data, Healthcare] \n", "1 1 Radiological Image Datasets [Dicom, Radiology, Health] " ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Let's select the `WHO` network and list the available domains on the `WHO Network`.\n", "who_network = sy.networks[1]\n", "who_network.domains" ] }, { "cell_type": "code", "execution_count": null, "id": "fb8b1a30", "metadata": {}, "outputs": [], "source": [ "# Let's select the `RSNA domain`\n", "rsna_domain = who_network[\"e1640cc4af70422da1d60300724b1ee3\"]\n", "\n", "# Let's login into the rsna domain\n", "rsna_domain_client = rsna_domain.login(email=\"sheldon@caltech.edu\", password=\"bazinga\")\n", "\n", "# Let's select the pnuemonia dataset\n", "pnuemonia_dataset = rsna_domain_client[\"fc650f14f6f7454b87d3ccd345c437b5\"]" ] }, { "cell_type": "code", "execution_count": 19, "id": "1c5e94fb", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Name: Pnuemonia Detection and Locationzation Dataset\n", "Description: Chest X-Ray images. All provided images are in DICOM format.\n", "\n" ] }, { "data": { "text/html": [ "<div>\n", "<style scoped>\n", " .dataframe tbody tr th:only-of-type {\n", " vertical-align: middle;\n", " }\n", "\n", " .dataframe tbody tr th {\n", " vertical-align: top;\n", " }\n", "\n", " .dataframe thead th {\n", " text-align: right;\n", " }\n", "</style>\n", "<table border=\"1\" class=\"dataframe\">\n", " <thead>\n", " <tr style=\"text-align: right;\">\n", " <th></th>\n", " <th>Asset Key</th>\n", " <th>Type</th>\n", " <th>Shape</th>\n", " </tr>\n", " </thead>\n", " <tbody>\n", " <tr>\n", " <th>0</th>\n", " <td>[X-Ray-Images]</td>\n", " <td>Tensor</td>\n", " <td>(40000, 7)</td>\n", " </tr>\n", " <tr>\n", " <th>1</th>\n", " <td>[labels]</td>\n", " <td>Tensor</td>\n", " <td>(40000, 5)</td>\n", " </tr>\n", " </tbody>\n", "</table>\n", "</div>" ], "text/plain": [ " Asset Key Type Shape\n", "0 [X-Ray-Images] Tensor (40000, 7)\n", "1 [labels] Tensor (40000, 5)" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Let's see the dataset\n", "pnuemonia_dataset" ] }, { "cell_type": "code", "execution_count": null, "id": "cb40ca8b", "metadata": {}, "outputs": [], "source": [ "# Let's select the lable tensors\n", "label_ptr = pnuemonia_dataset[\"labels\"]\n", "\n", "# Let's calculate the unique labels in the dataset\n", "unique_labels = label_ptr[:,0].unique()" ] }, { "cell_type": "markdown", "id": "7e577955", "metadata": {}, "source": [ "#### The user fetches the results of their query\n", "\n", "- The user can perform a `.get` operation to download the data of the variable locally.\n", "- If a user tries to access a variable without publishing its results or without requesting it, then they receive a 403.\n", "- If a user has requested a resource, then its denied by the DO, then the user receives a 403 on performing a get operation on the resource." ] }, { "cell_type": "code", "execution_count": 43, "id": "08fb8150", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " \u001b[91mPermissionDenied:\u001b[0m\n", " You don't have authorization to perform the `.get` operation.\n", " You need to either `request` the results or `publish` the results.\n", "\n" ] } ], "source": [ "number_of_unique_labels = unique_labels.shape\n", "# Let's access the labels\n", "number_of_unique_labels.get()" ] }, { "cell_type": "code", "execution_count": 16, "id": "f77643ab", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " Your request has been submitted to the domain. Your request id is: \u001b[1ma825a64be418430da8869a1f4542a6c0\n", " \u001b[0mYou can check the status of your requests via `.requests`.\n", "\n" ] } ], "source": [ "# Let's request the results from the Domain Owner\n", "number_of_unique_labels.request(reason=\"Know the number of unique labels in the dataset.\")" ] }, { "cell_type": "markdown", "id": "03e9874f", "metadata": {}, "source": [ "#### The user views the request logs\n", "\n", "- The user can list all the logs of all the requests send by them to a domain. **[P1]**\n", "\n", " Following properties are visible to the user w.r.t to the logs (for data requests):\n", "\n", " - Request Id (Unique id of the request)\n", " - Request Date (Datetime on which the request was submitted. The datetime/timestamp are shown in UTC)\n", " - Reason (The reason submitted to access the resource by requester)\n", " - Result Id (The unique id of the reasource being requested)\n", " - State (State of the request - Approved/Declined/Pending)\n", " - Reviewer Comments (Comment provided by the reqeuest reviewer (DO) during request approval/deny)\n", "\n", "- The user can filter through the logs via ID and Status. **[P2]**" ] }, { "cell_type": "code", "execution_count": 12, "id": "b3a882cc", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "You have 1 pending request\n" ] }, { "data": { "text/html": [ "<div>\n", "<style scoped>\n", " .dataframe tbody tr th:only-of-type {\n", " vertical-align: middle;\n", " }\n", "\n", " .dataframe tbody tr th {\n", " vertical-align: top;\n", " }\n", "\n", " .dataframe thead th {\n", " text-align: right;\n", " }\n", "</style>\n", "<table border=\"1\" class=\"dataframe\">\n", " <thead>\n", " <tr style=\"text-align: right;\">\n", " <th></th>\n", " <th>Request Id</th>\n", " <th>Request Date</th>\n", " <th>Reason</th>\n", " <th>Result Id</th>\n", " <th>State</th>\n", " <th>Reviewer Comments</th>\n", " </tr>\n", " </thead>\n", " <tbody>\n", " <tr>\n", " <th>0</th>\n", " <td>3ca9694c8e5d4214a1ed8025a1391c8c</td>\n", " <td>Sep 29 2021 11:31AM</td>\n", " <td>Know the number of unique labels in the dataset.</td>\n", " <td>315411ed283042ee81c78737d2010ca5</td>\n", " <td>Pending</td>\n", " <td>-</td>\n", " </tr>\n", " </tbody>\n", "</table>\n", "</div>" ], "text/plain": [ " Request Id Request Date \\\n", "0 3ca9694c8e5d4214a1ed8025a1391c8c Sep 29 2021 11:31AM \n", "\n", " Reason \\\n", "0 Know the number of unique labels in the dataset. \n", "\n", " Result Id State Reviewer Comments \n", "0 315411ed283042ee81c78737d2010ca5 Pending - " ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Let's check the status of our request logs\n", "# A user can see only the request logs with state == `Pending`.\n", "rsna_domain.requests" ] }, { "cell_type": "code", "execution_count": 13, "id": "b1136edc", "metadata": {}, "outputs": [ { "data": { "text/html": [ "<div>\n", "<style scoped>\n", " .dataframe tbody tr th:only-of-type {\n", " vertical-align: middle;\n", " }\n", "\n", " .dataframe tbody tr th {\n", " vertical-align: top;\n", " }\n", "\n", " .dataframe thead th {\n", " text-align: right;\n", " }\n", "</style>\n", "<table border=\"1\" class=\"dataframe\">\n", " <thead>\n", " <tr style=\"text-align: right;\">\n", " <th></th>\n", " <th>Request Id</th>\n", " <th>Request Date</th>\n", " <th>Reason</th>\n", " <th>Result Id</th>\n", " <th>State</th>\n", " <th>Reviewer Comments</th>\n", " </tr>\n", " </thead>\n", " <tbody>\n", " <tr>\n", " <th>0</th>\n", " <td>3ca9694c8e5d4214a1ed8025a1391c8c</td>\n", " <td>Sep 29 2021 11:31AM</td>\n", " <td>Know the number of unique labels in the dataset.</td>\n", " <td>315411ed283042ee81c78737d2010ca5</td>\n", " <td>Pending</td>\n", " <td>-</td>\n", " </tr>\n", " <tr>\n", " <th>1</th>\n", " <td>6ee8bbea539e4088ad4c23a7a123cfbb</td>\n", " <td>Sep 19 2021 01:31AM</td>\n", " <td>Get the labels in the dataset.</td>\n", " <td>c1498711dd5f4a1682bfe2c8bba8830f</td>\n", " <td>Denied</td>\n", " <td>Access to raw labels is not allowed</td>\n", " </tr>\n", " </tbody>\n", "</table>\n", "</div>" ], "text/plain": [ " Request Id Request Date \\\n", "0 3ca9694c8e5d4214a1ed8025a1391c8c Sep 29 2021 11:31AM \n", "1 6ee8bbea539e4088ad4c23a7a123cfbb Sep 19 2021 01:31AM \n", "\n", " Reason \\\n", "0 Know the number of unique labels in the dataset. \n", "1 Get the labels in the dataset. \n", "\n", " Result Id State \\\n", "0 315411ed283042ee81c78737d2010ca5 Pending \n", "1 c1498711dd5f4a1682bfe2c8bba8830f Denied \n", "\n", " Reviewer Comments \n", "0 - \n", "1 Access to raw labels is not allowed " ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# If we want to see all the requests that are submitted to the domain,\n", "rsna_domain.requests.all()" ] }, { "cell_type": "markdown", "id": "16d28a30", "metadata": {}, "source": [ "```\n", "Some time has passed, let' check if our requests are approved or not.\n", "```" ] }, { "cell_type": "code", "execution_count": 18, "id": "2b4aa83e", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "There are no pending reqeuests.\n" ] } ], "source": [ "# Let's check again for pending requests first....\n", "rsna_domain.requests" ] }, { "cell_type": "code", "execution_count": 14, "id": "60bc54eb", "metadata": {}, "outputs": [ { "data": { "text/html": [ "<div>\n", "<style scoped>\n", " .dataframe tbody tr th:only-of-type {\n", " vertical-align: middle;\n", " }\n", "\n", " .dataframe tbody tr th {\n", " vertical-align: top;\n", " }\n", "\n", " .dataframe thead th {\n", " text-align: right;\n", " }\n", "</style>\n", "<table border=\"1\" class=\"dataframe\">\n", " <thead>\n", " <tr style=\"text-align: right;\">\n", " <th></th>\n", " <th>Request Id</th>\n", " <th>Request Date</th>\n", " <th>Reason</th>\n", " <th>Result Id</th>\n", " <th>State</th>\n", " <th>Reviewer Comments</th>\n", " </tr>\n", " </thead>\n", " <tbody>\n", " <tr>\n", " <th>0</th>\n", " <td>3ca9694c8e5d4214a1ed8025a1391c8c</td>\n", " <td>Sep 29 2021 11:31AM</td>\n", " <td>Know the number of unique labels in the dataset.</td>\n", " <td>315411ed283042ee81c78737d2010ca5</td>\n", " <td>Approved</td>\n", " <td>Looks good.</td>\n", " </tr>\n", " <tr>\n", " <th>1</th>\n", " <td>6ee8bbea539e4088ad4c23a7a123cfbb</td>\n", " <td>Sep 19 2021 01:31AM</td>\n", " <td>Get the labels in the dataset.</td>\n", " <td>c1498711dd5f4a1682bfe2c8bba8830f</td>\n", " <td>Denied</td>\n", " <td>Access to raw labels is not allowed</td>\n", " </tr>\n", " </tbody>\n", "</table>\n", "</div>" ], "text/plain": [ " Request Id Request Date \\\n", "0 3ca9694c8e5d4214a1ed8025a1391c8c Sep 29 2021 11:31AM \n", "1 6ee8bbea539e4088ad4c23a7a123cfbb Sep 19 2021 01:31AM \n", "\n", " Reason \\\n", "0 Know the number of unique labels in the dataset. \n", "1 Get the labels in the dataset. \n", "\n", " Result Id State \\\n", "0 315411ed283042ee81c78737d2010ca5 Approved \n", "1 c1498711dd5f4a1682bfe2c8bba8830f Denied \n", "\n", " Reviewer Comments \n", "0 Looks good. \n", "1 Access to raw labels is not allowed " ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Let's check all the submitted requests\n", "rsna_domain.requests.all()" ] }, { "cell_type": "code", "execution_count": 90, "id": "37615397", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Unique Labels: 2\n" ] } ], "source": [ "# Great our requests are approved, let's get the information\n", "unique_labels = number_of_unique_labels.get()\n", "print(f\"Unique Labels: {len(unique_labels)}\")" ] }, { "cell_type": "code", "execution_count": 16, "id": "a1cdbc17", "metadata": {}, "outputs": [ { "data": { "text/html": [ "<div>\n", "<style scoped>\n", " .dataframe tbody tr th:only-of-type {\n", " vertical-align: middle;\n", " }\n", "\n", " .dataframe tbody tr th {\n", " vertical-align: top;\n", " }\n", "\n", " .dataframe thead th {\n", " text-align: right;\n", " }\n", "</style>\n", "<table border=\"1\" class=\"dataframe\">\n", " <thead>\n", " <tr style=\"text-align: right;\">\n", " <th></th>\n", " <th>Request Id</th>\n", " <th>Request Date</th>\n", " <th>Reason</th>\n", " <th>Result Id</th>\n", " <th>State</th>\n", " <th>Reviewer Comments</th>\n", " </tr>\n", " </thead>\n", " <tbody>\n", " <tr>\n", " <th>0</th>\n", " <td>3ca9694c8e5d4214a1ed8025a1391c8c</td>\n", " <td>Sep 29 2021 11:31AM</td>\n", " <td>Know the number of unique labels in the dataset.</td>\n", " <td>315411ed283042ee81c78737d2010ca5</td>\n", " <td>Approved</td>\n", " <td>Looks good.</td>\n", " </tr>\n", " </tbody>\n", "</table>\n", "</div>" ], "text/plain": [ " Request Id Request Date \\\n", "0 3ca9694c8e5d4214a1ed8025a1391c8c Sep 29 2021 11:31AM \n", "\n", " Reason \\\n", "0 Know the number of unique labels in the dataset. \n", "\n", " Result Id State Reviewer Comments \n", "0 315411ed283042ee81c78737d2010ca5 Approved Looks good. " ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Filtering requests logs\n", "\n", "# via Id (Get the request with the given request id)\n", "rsna_domain.requests.filter(id=\"3ca9694c8e5d4214a1ed8025a1391c8c\")\n", "\n", "# or via Status (List all the logs with given status)\n", "rsna_domain.requests.filter(status=\"Approved\")" ] }, { "cell_type": "code", "execution_count": null, "id": "6b607f93", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "8ae17a8b", "metadata": { "heading_collapsed": true }, "source": [ "#### Dummy Data" ] }, { "cell_type": "code", "execution_count": 1, "id": "b2a3da1d", "metadata": { "hidden": true }, "outputs": [], "source": [ "import pandas as pd\n", "from enum import Enum\n", "import uuid\n", "import torch\n", "import datetime\n", "import json\n", "import numpy as np\n", "\n", "\n", "class bcolors(Enum):\n", " HEADER = \"\\033[95m\"\n", " OKBLUE = \"\\033[94m\"\n", " OKCYAN = \"\\033[96m\"\n", " OKGREEN = \"\\033[92m\"\n", " WARNING = \"\\033[93m\"\n", " FAIL = \"\\033[91m\"\n", " ENDC = \"\\033[0m\"\n", " BOLD = \"\\033[1m\"\n", " UNDERLINE = \"\\033[4m\"" ] }, { "cell_type": "code", "execution_count": 2, "id": "1e92be60", "metadata": { "hidden": true }, "outputs": [], "source": [ "all_datasets = [\n", " {\n", " \"Id\": uuid.uuid4().hex,\n", " \"Name\": \"Diabetes Dataset\",\n", " \"Tags\": [\"Health\", \"Classification\", \"Dicom\"],\n", " \"Assets\": '''[\"Images\"] -> Tensor; [\"Labels\"] -> Tensor''',\n", " \"Description\": \"A large set of high-resolution retina images\",\n", " \"Domain\": \"California Healthcare Foundation\",\n", " \"Network\": \"WHO\",\n", " \"Usage\": 102,\n", " \"Added On\": datetime.datetime.now().replace(month=1).strftime(\"%b %d %Y\")\n", " },\n", " {\n", " \"Id\": uuid.uuid4().hex,\n", " \"Name\": \"Canada Commodities Dataset\",\n", " \"Tags\": [\"Commodities\", \"Canada\", \"Trade\"],\n", " \"Assets\": '''[\"ca-feb2021\"] -> DataFrame''',\n", " \"Description\": \"Commodity Trade Dataset\",\n", " \"Domain\": \"Canada Domain\",\n", " \"Network\": \"United Nations\",\n", " \"Usage\": 40,\n", " \"Added On\": datetime.datetime.now().replace(month=3, day=11).strftime(\"%b %d %Y\")\n", " },\n", " {\n", " \"Id\": uuid.uuid4().hex,\n", " \"Name\": \"Italy Commodities Dataset\",\n", " \"Tags\": [\"Commodities\", \"Italy\", \"Trade\"],\n", " \"Assets\": '''[\"it-feb2021\"] -> DataFrame''',\n", " \"Description\": \"Commodity Trade Dataset\",\n", " \"Domain\": \"Italy Domain\",\n", " \"Network\": \"United Nations\",\n", " \"Usage\": 23,\n", " \"Added On\": datetime.datetime.now().replace(month=3).strftime(\"%b %d %Y\")\n", " },\n", " {\n", " \"Id\": uuid.uuid4().hex,\n", " \"Name\": \"Netherlands Commodities Dataset\",\n", " \"Tags\": [\"Commodities\", \"Netherlands\", \"Trade\"],\n", " \"Assets\": '''[\"ne-feb2021\"] -> DataFrame''',\n", " \"Description\": \"Commodity Trade Dataset\",\n", " \"Domain\": \"Netherland Domain\",\n", " \"Network\": \"United Nations\",\n", " \"Usage\": 20,\n", " \"Added On\": datetime.datetime.now().replace(month=4, day=12).strftime(\"%b %d %Y\")\n", " },\n", " {\n", " \"Id\": uuid.uuid4().hex,\n", " \"Name\": \"Pnuemonia Dataset\",\n", " \"Tags\": [\"Health\", \"Pneumonia\", \"X-Ray\"],\n", " \"Assets\": '''[\"X-Ray-Images\"] -> Tensor; [\"labels\"] -> Tensor''',\n", " \"Description\": \"Chest X-Ray images. All provided images are in DICOM format.\",\n", " \"Domain\": \"RSNA\",\n", " \"Network\": \"WHO\",\n", " \"Usage\": 334,\n", " \"Added On\": datetime.datetime.now().replace(month=1).strftime(\"%b %d %Y\")\n", " },\n", "]\n", "\n", "\n", "all_datasets_df = pd.DataFrame(all_datasets)" ] }, { "cell_type": "code", "execution_count": 3, "id": "c14a689d", "metadata": { "hidden": true }, "outputs": [], "source": [ "# Print available networks\n", "\n", "available_networks = [\n", " {\n", " \"Id\": f\"{uuid.uuid4().hex}\",\n", " \"Name\": \"United Nations\",\n", " \"Hosted Domains\": 4,\n", " \"Hosted Datasets\": 6,\n", " \"Description\": \"The UN hosts data related to the commodity and Census data.\",\n", " \"Tags\": [\"Commodities\", \"Census\", \"Health\"],\n", " \"Url\": \"https://un.openmined.org\",\n", " },\n", " {\n", " \"Id\": f\"{uuid.uuid4().hex}\",\n", " \"Name\": \"World Health Organisation\",\n", " \"Hosted Domains\": 3,\n", " \"Hosted Datasets\": 5,\n", " \"Description\": \"WHO hosts data related to health sector of different parts of the worlds.\",\n", " \"Tags\": [\"Virology\", \"Cancer\", \"Health\"],\n", " \"Url\": \"https://who.openmined.org\",\n", " },\n", " {\n", " \"Id\": f\"{uuid.uuid4().hex}\",\n", " \"Name\": \"International Space Station\",\n", " \"Hosted Domains\": 2,\n", " \"Hosted Datasets\": 4,\n", " \"Description\": \"ISS hosts data related to the topography of different exoplanets.\",\n", " \"Tags\": [\"Exoplanets\", \"Extra-Terrestrial\"],\n", " \"Url\": \"https://iss.openmined.org\",\n", " },\n", "]\n", "networks_df = pd.DataFrame(available_networks)" ] }, { "cell_type": "code", "execution_count": 4, "id": "4dd3caf7", "metadata": { "hidden": true }, "outputs": [], "source": [ "who_domains = [\n", " {\n", " \"Id\": f\"{uuid.uuid4().hex}\",\n", " \"Name\": \"California Healthcare Foundation\",\n", " \"Hosted Datasets\": 1,\n", " \"Description\": \"Health care systems\",\n", " \"Tags\": [\"Clinical Data\", \"Healthcare\"],\n", " },\n", " {\n", " \"Id\": f\"{uuid.uuid4().hex}\",\n", " \"Name\": \"RSNA\",\n", " \"Hosted Datasets\": 1,\n", " \"Description\": \"Radiological Image Datasets\",\n", " \"Tags\": [\"Dicom\", \"Radiology\", \"Health\"],\n", " },\n", "]\n", "who_domains_df = pd.DataFrame(who_domains)" ] }, { "cell_type": "code", "execution_count": 5, "id": "0f3ad262", "metadata": { "hidden": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Name: Pnuemonia Detection and Locationzation Dataset\n", "Description: Chest X-Ray images. All provided images are in DICOM format.\n", "\n" ] } ], "source": [ "pneumonia_dataset = [\n", " {\n", " \"Asset Key\": \"[X-Ray-Images]\",\n", " \"Type\": \"Tensor\",\n", " \"Shape\": \"(40000, 7)\"\n", " },\n", " {\n", " \"Asset Key\": '[labels]',\n", " \"Type\": \"Tensor\",\n", " \"Shape\": \"(40000, 5)\"\n", " },\n", "]\n", "print(\"\"\"\n", "Name: Pnuemonia Detection and Locationzation Dataset\n", "Description: Chest X-Ray images. All provided images are in DICOM format.\n", "\"\"\")\n", "pneumonia_dataset_df = pd.DataFrame(pneumonia_dataset)" ] }, { "cell_type": "code", "execution_count": 6, "id": "704b5ecb", "metadata": { "hidden": true }, "outputs": [], "source": [ "labels_data = np.random.randint(0, 2, size=(40000, 5))[:, 0]\n", "label_tensors = torch.Tensor(labels_data)" ] }, { "cell_type": "code", "execution_count": 7, "id": "ec40fb16", "metadata": { "hidden": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " \u001b[91mPermissionDenied:\u001b[0m\n", " You don't have authorization to perform the `.get` operation.\n", " You need to either `request` the results or `publish` the results.\n", "\n" ] } ], "source": [ "authorization_error = f\"\"\"\n", " {bcolors.FAIL.value}PermissionDenied:{bcolors.ENDC.value}\n", " You don't have authorization to perform the `.get` operation.\n", " You need to either `request` the results or `publish` the results.\n", "\"\"\"\n", "\n", "print(authorization_error)" ] }, { "cell_type": "code", "execution_count": 8, "id": "62fc38bc", "metadata": { "hidden": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " Your request has been submitted to the domain. Your request id is: \u001b[1m8b0f17f8ef284e09b1afb75443b1f4a7\n", " \u001b[0mYou can check the status of your requests via `.requests`.\n", "\n" ] } ], "source": [ "request_uuid = uuid.uuid4().hex\n", "request_submission = f\"\"\"\n", " Your request has been submitted to the domain. Your request id is: {bcolors.BOLD.value}{request_uuid}\n", " {bcolors.ENDC.value}You can check the status of your requests via `.requests`.\n", "\"\"\"\n", "print(request_submission)" ] }, { "cell_type": "code", "execution_count": 9, "id": "1b8908a2", "metadata": { "hidden": true }, "outputs": [], "source": [ "requests_data = [\n", " {\n", " \"Request Id\": uuid.uuid4().hex,\n", " \"Request Date\": datetime.datetime.now().strftime(\"%b %d %Y %I:%M%p\"),\n", " \"Reason\": \"Know the number of unique labels in the dataset.\",\n", " \"Result Id\": uuid.uuid4().hex,\n", " \"State\": \"Pending\",\n", " \"Reviewer Comments\": \"-\",\n", " },\n", " {\n", " \"Request Id\": uuid.uuid4().hex,\n", " \"Request Date\": datetime.datetime.now().replace(day=19, hour=1).strftime(\"%b %d %Y %I:%M%p\"),\n", " \"Reason\": \"Get the labels in the dataset.\",\n", " \"Result Id\": uuid.uuid4().hex,\n", " \"State\": \"Denied\",\n", " \"Reviewer Comments\": \"Access to raw labels is not allowed\",\n", " }\n", "]\n", "\n", "requests_data_df = pd.DataFrame(requests_data)" ] }, { "cell_type": "code", "execution_count": 10, "id": "e284764b", "metadata": { "hidden": true }, "outputs": [], "source": [ "approved_requests_data_df = requests_data_df.copy()\n", "approved_requests_data_df[\"State\"][0] = \"Approved\"\n", "approved_requests_data_df[\"Reviewer Comments\"][0] = \"Looks good.\"" ] }, { "cell_type": "code", "execution_count": 11, "id": "cf6a05fa", "metadata": { "hidden": true }, "outputs": [], "source": [ "filtered_request_logs = approved_requests_data_df[:1]" ] }, { "cell_type": "code", "execution_count": null, "id": "e4938128", "metadata": { "hidden": true }, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "aba31672", "metadata": { "hidden": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.7" } }, "nbformat": 4, "nbformat_minor": 5 }
Jupyter Notebook
4
vishalbelsare/PySyft
notebooks/course3/Request Results (Without AutoDP).ipynb
[ "Apache-1.1" ]
Environment { getCommandLineArgs() { argc := 0 argv := cast(null, pointer) get_argc_argv(ref argc, ref argv) cstrArray := Array<cstring> { dataPtr: argv, count: argc } result := new Array<string>(argc) for it, i in cstrArray { result[i] = string.from_cstring(it) } return result } }
mupad
4
jturner/muon
lib/environment.mu
[ "MIT" ]
package com.baeldung.javers.web; import com.baeldung.javers.domain.Product; import com.baeldung.javers.domain.Store; import com.baeldung.javers.service.StoreService; import org.javers.core.Changes; import org.javers.core.Javers; import org.javers.core.metamodel.object.CdoSnapshot; import org.javers.repository.jql.JqlQuery; import org.javers.repository.jql.QueryBuilder; import org.javers.shadow.Shadow; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController public class StoreController { private final StoreService storeService; private final Javers javers; public StoreController(StoreService customerService, Javers javers) { this.storeService = customerService; this.javers = javers; } @PostMapping("/stores/{storeId}/products/random") public void createRandomProduct(@PathVariable final Integer storeId) { storeService.createRandomProduct(storeId); } @PostMapping("/stores/{storeId}/rebrand") public void rebrandStore(@PathVariable final Integer storeId, @RequestBody RebrandStoreDto rebrandStoreDto) { storeService.rebrandStore(storeId, rebrandStoreDto.name); } @PostMapping(value = "/stores/{storeId}/products/{productId}/price", consumes = MediaType.APPLICATION_JSON_VALUE) public void updateProductPrice(@PathVariable final Integer productId, @PathVariable String storeId, @RequestBody UpdatePriceDto priceDto) { storeService.updateProductPrice(productId, priceDto.price); } @GetMapping("/products/{productId}/changes") public String getProductChanges(@PathVariable int productId) { Product product = storeService.findProductById(productId); QueryBuilder jqlQuery = QueryBuilder.byInstance(product); Changes changes = javers.findChanges(jqlQuery.build()); return javers.getJsonConverter().toJson(changes); } @GetMapping("/products/snapshots") public String getProductSnapshots() { QueryBuilder jqlQuery = QueryBuilder.byClass(Product.class); List<CdoSnapshot> snapshots = javers.findSnapshots(jqlQuery.build()); return javers.getJsonConverter().toJson(snapshots); } @GetMapping("/stores/{storeId}/shadows") public String getStoreShadows(@PathVariable int storeId) { Store store = storeService.findStoreById(storeId); JqlQuery jqlQuery = QueryBuilder.byInstance(store) .withChildValueObjects().build(); List<Shadow<Store>> shadows = javers.findShadows(jqlQuery); return javers.getJsonConverter().toJson(shadows.get(0)); } @GetMapping("/stores/snapshots") public String getStoresSnapshots() { QueryBuilder jqlQuery = QueryBuilder.byClass(Store.class); List<CdoSnapshot> snapshots = javers.findSnapshots(jqlQuery.build()); return javers.getJsonConverter().toJson(snapshots); } }
Java
4
DBatOWL/tutorials
spring-boot-modules/spring-boot-data/src/main/java/com/baeldung/javers/web/StoreController.java
[ "MIT" ]
/** * This file is part of the Phalcon Framework. * * (c) Phalcon Team <team@phalcon.io> * * For the full copyright and license information, please view the LICENSE.txt * file that was distributed with this source code. */ namespace Phalcon\Config\Adapter; use Phalcon\Config; use Phalcon\Config\Exception; /** * Reads YAML files and converts them to Phalcon\Config objects. * * Given the following configuration file: * *```yaml * phalcon: * baseuri: /phalcon/ * controllersDir: !approot /app/controllers/ * models: * metadata: memory *``` * * You can read it as follows: * *```php * define( * "APPROOT", * dirname(__DIR__) * ); * * use Phalcon\Config\Adapter\Yaml; * * $config = new Yaml( * "path/config.yaml", * [ * "!approot" => function($value) { * return APPROOT . $value; * }, * ] * ); * * echo $config->phalcon->controllersDir; * echo $config->phalcon->baseuri; * echo $config->models->metadata; *``` */ class Yaml extends Config { /** * Phalcon\Config\Adapter\Yaml constructor */ public function __construct(string! filePath, array! callbacks = null) { var yamlConfig; int ndocs = 0; if unlikely !extension_loaded("yaml") { throw new Exception("Yaml extension not loaded"); } if empty(callbacks) { let yamlConfig = yaml_parse_file(filePath); } else { let yamlConfig = yaml_parse_file(filePath, 0, ndocs, callbacks); } if unlikely yamlConfig === false { throw new Exception( "Configuration file " . basename(filePath) . " can't be loaded" ); } parent::__construct(yamlConfig); } }
Zephir
5
zsilbi/cphalcon
phalcon/Config/Adapter/Yaml.zep
[ "BSD-3-Clause" ]
%% %unicode 8.0 %public %class UnicodeScripts_8_0_extensions_5 %type int %standalone %include ../../resources/common-unicode-all-enumerated-property-defined-values-only-java %% <<EOF>> { printOutput(); return 1; } \p{Script_Extensions:Gurmukhi} { setCurCharPropertyValue("Script_Extensions:Gurmukhi"); } \p{Script_Extensions:Katakana} { setCurCharPropertyValue("Script_Extensions:Katakana"); } \p{Script_Extensions:Syriac} { setCurCharPropertyValue("Script_Extensions:Syriac"); } [^] { }
JFlex
3
Mivik/jflex
testsuite/testcases/src/test/cases/unicode-scripts/UnicodeScripts_8_0_extensions_5.flex
[ "BSD-3-Clause" ]
<%@ page contentType="text/html; charset=utf-8" %> <%@ taglib prefix="a" uri="/WEB-INF/app.tld"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ taglib prefix="res" uri="http://www.unidal.org/webres"%> <%@ taglib prefix="w" uri="http://www.unidal.org/web/core"%> <a:config> <script src="${model.webapp}/assets/js/bootstrap-tag.min.js"></script> <table class="table table-striped table-condensed table-bordered table-hover" id="contents"> <thead> <tr > <th width="67%">url (http监控)</th> <th width="5%">类型</th> <th width="20%">项目组</th> <th width="8%">操作 <a href="?op=thirdPartyRuleUpdate&type=http" class="btn btn-primary btn-xs" > <i class="ace-icon glyphicon glyphicon-plus bigger-120"></i></a></th> </tr></thead> <tbody> <c:forEach var="item" items="${model.thirdPartyConfig.https}" varStatus="status"> <tr class=""> <td>${item.url}</td> <td>${item.type}</td> <td>${item.domain}</td> <td><a href="?op=thirdPartyRuleUpdate&ruleId=${item.url}&type=http" class="btn btn-primary btn-xs"> <i class="ace-icon fa fa-pencil-square-o bigger-120"></i></a> <a href="?op=thirdPartyRuleDelete&ruleId=${item.url}&type=http" class="btn btn-danger btn-xs delete" > <i class="ace-icon fa fa-trash-o bigger-120"></i></a></td> </tr> </c:forEach></tbody> </table> <table class="table table-striped table-condensed table-bordered table-hover" id="contents"> <thead> <tr > <th width="67%">Ip (socket监控)</th> <th width="5%">端口</th> <th width="20%">项目组</th> <th width="8%">操作 <a href="?op=thirdPartyRuleUpdate&type=socket" class="btn btn-primary btn-xs" > <i class="ace-icon glyphicon glyphicon-plus bigger-120"></i></a></th> </tr></thead> <tbody> <c:forEach var="item" items="${model.thirdPartyConfig.sockets}" varStatus="status"> <tr class=""> <td>${item.ip}</td> <td>${item.port}</td> <td>${item.domain}</td> <td><a href="?op=thirdPartyRuleUpdate&ruleId=${item.ip}-${item.port}&type=socket" class="btn btn-primary btn-xs"> <i class="ace-icon fa fa-pencil-square-o bigger-120"></i></a> <a href="?op=thirdPartyRuleDelete&ruleId=${item.ip}-${item.port}&type=socket" class="btn btn-danger btn-xs delete" > <i class="ace-icon fa fa-trash-o bigger-120"></i></a></td> </tr> </c:forEach> </tbody> </table> </a:config> <script type="text/javascript"> $(document).ready(function() { $('#alert_config').addClass('active open'); $('#thirdPartyConfigUpdate').addClass('active'); }); </script>
Java Server Pages
3
woozhijun/cat
cat-home/src/main/webapp/jsp/system/thirdParty/thirdPartyConfig.jsp
[ "Apache-2.0" ]
{% assign colors = include.colors | default: site.colors %} {% assign light = include.light %} <div class="example"> <div class="mb-n3"> {% for color in colors %} <div class="row g-2 mb-3 align-items-center"> <div class="col-auto"> <div class="avatar bg-{{ color[0] }}{% if light %}-lt{% else %} text-white{% endif %}">{{ color[0] | capitalize | first_letter }}</div> </div> <div class="col"> <span class="font-weight-semibold">{{ color[1].title }}</span><br/> <code>bg-{{ color[0] }}{% if light %}-lt{% endif %}</code> </div> </div> {% endfor %} </div> </div>
HTML
4
muhginanjar/tabler
src/pages/_includes/example/colors-table.html
[ "MIT" ]
-- -- Higher order application -- %handles: IntTerm = Get Put Close %cohandles: Console = Get Put Close %destructors: Exp = App 1 %run ( | console => intTerm1) : hput intTerm1 IntTerm.Get get intTerm1 store x rec of Exp.App(y): cInt 2 load y add fret store y load y Exp.App (x) store ans load ans hput intTerm1 IntTerm.Put put intTerm1 hput intTerm1 IntTerm.Close close intTerm1 hput console Console.Close halt console {- (([],[(0,IN,0),(-1,OUT,-1)],[], AMC_HPUT (-1) 1 AMC_GET (-1) AMC_STORE AMC_REC [[AMC_INT 2 ,AMC_LOAD 1 ,AMC_ADD ,AMC_RET ]] AMC_STORE AMC_LOAD 2 AMC_LOAD 1 AMC_DEST 1 1 AMC_STORE AMC_LOAD 1 AMC_HPUT (-1) 2 AMC_PUT (-1) AMC_HPUT (-1) 3 AMC_CLOSE (-1) AMC_HPUT 0 3 AMC_HALT 0 (([],[(0,IN,0),(-1,OUT,-1)],[], [AMC_HPUT (-1) 1 ,AMC_GET (-1) ,AMC_STORE ,AMC_REC [[AMC_INT 2 ,AMC_LOAD 1 ,AMC_ADD ,AMC_FRET]] ,AMC_STORE ,AMC_LOAD 1 ,AMC_LOAD 2 ,AMC_DEST 1 1 ,AMC_STORE ,AMC_LOAD 1 ,AMC_HPUT (-1) 2 ,AMC_PUT (-1) ,AMC_HPUT (-1) 3 ,AMC_CLOSE (-1) ,AMC_HPUT 0 3 ,AMC_HALT 0] ),([0,-1],[(0,Q_EMPTY,Q_EMPTY),(-1,Q_EMPTY,Q_EMPTY)]),[]) ),([0,-1],[(0,Q_EMPTY,Q_EMPTY),(-1,Q_EMPTY,Q_EMPTY)]),[]) ([([V_INT 7,V_REC ([[AMC_INT 2,AMC_LOAD 1,AMC_ADD,AMC_FRET]],[V_INT 7]),V_INT 7], [(0,IN,0),(-1,OUT,-1)], [V_REC ([[AMC_INT 2,AMC_LOAD 1,AMC_ADD,AMC_FRET]],[V_INT 7]),V_INT 7], [AMC_DEST 1 1,AMC_STORE,AMC_LOAD 1,AMC_HPUT (-1) 2,AMC_PUT (-1),AMC_HPUT (-1) 3,AMC_CLOSE (-1),AMC_HPUT 0 3,AMC_HALT 0])], ([0,-1],[(0,Q_EMPTY,Q_EMPTY),(-1,Q_EMPTY,Q_EMPTY)]),[]) -}
AMPL
3
prashant007/AMPL
myAMPL/src/Examples/test6.ampl
[ "MIT" ]
<?xml version='1.0'?> <Project Type="Project" LVVersion="8208000"> <Item Name="My Computer" Type="My Computer"> <Property Name="server.app.propertiesEnabled" Type="Bool">true</Property> <Property Name="server.control.propertiesEnabled" Type="Bool">true</Property> <Property Name="server.tcp.enabled" Type="Bool">false</Property> <Property Name="server.tcp.port" Type="Int">0</Property> <Property Name="server.tcp.serviceName" Type="Str">My Computer/VI Server</Property> <Property Name="server.tcp.serviceName.default" Type="Str">My Computer/VI Server</Property> <Property Name="server.vi.callsEnabled" Type="Bool">true</Property> <Property Name="server.vi.propertiesEnabled" Type="Bool">true</Property> <Property Name="specify.custom.address" Type="Bool">false</Property> <Item Name="README - How to Run Tests.html" Type="Document" URL="README - How to Run Tests.html"/> <Item Name="Merge Errors TestCase.lvclass" Type="LVClass" URL="Merge Errors TestCase/Merge Errors TestCase.lvclass"> <Item Name="Merge Errors TestCase.ctl" Type="Class Private Data" URL="Merge Errors TestCase/Merge Errors TestCase.lvclass/Merge Errors TestCase.ctl"/> <Item Name="private" Type="Folder"/> <Item Name="protected" Type="Folder"/> <Item Name="test error in 1.vi" Type="VI" URL="Merge Errors TestCase/test error in 1.vi"/> <Item Name="test error in 2.vi" Type="VI" URL="Merge Errors TestCase/test error in 2.vi"/> <Item Name="test error array in.vi" Type="VI" URL="Merge Errors TestCase/test error array in.vi"/> <Item Name="test no error in.vi" Type="VI" URL="Merge Errors TestCase/test no error in.vi"/> <Item Name="test error raised.vi" Type="VI" URL="Merge Errors TestCase/test error raised.vi"/> </Item> <Item Name="Queue TestCase.lvclass" Type="LVClass" URL="Queue TestCase/Queue TestCase.lvclass"> <Item Name="Queue TestCase.ctl" Type="Class Private Data" URL="Queue TestCase/Queue TestCase.lvclass/Queue TestCase.ctl"/> <Item Name="private" Type="Folder"/> <Item Name="protected" Type="Folder"/> <Item Name="setUp.vi" Type="VI" URL="Queue TestCase/setUp.vi"/> <Item Name="tearDown.vi" Type="VI" URL="Queue TestCase/tearDown.vi"/> <Item Name="test Queue Size is Zero.vi" Type="VI" URL="Queue TestCase/test Queue Size is Zero.vi"/> <Item Name="test Queue Reference is Valid.vi" Type="VI" URL="Queue TestCase/test Queue Reference is Valid.vi"/> </Item> <Item Name="Dependencies" Type="Dependencies"/> <Item Name="Build Specifications" Type="Build"/> </Item> </Project>
LabVIEW
1
samsharp99/JKI-VI-Tester
source/Examples/VI Tester Example.lvproj
[ "BSD-3-Clause" ]
# distutils: language = c++ # cython: language_level = 3 from posix.time cimport clock_gettime, timespec, CLOCK_MONOTONIC_RAW, clockid_t IF UNAME_SYSNAME == "Darwin": # Darwin doesn't have a CLOCK_BOOTTIME CLOCK_BOOTTIME = CLOCK_MONOTONIC_RAW ELSE: from posix.time cimport CLOCK_BOOTTIME cdef double readclock(clockid_t clock_id): cdef timespec ts cdef double current clock_gettime(clock_id, &ts) current = ts.tv_sec + (ts.tv_nsec / 1000000000.) return current def monotonic_time(): return readclock(CLOCK_MONOTONIC_RAW) def sec_since_boot(): return readclock(CLOCK_BOOTTIME)
Cython
4
wolterhv/openpilot
common/clock.pyx
[ "MIT" ]
const std = @import("std"); const other_file = @import("655_other_file.zig"); test "function with *const parameter with type dereferenced by namespace" { const x: other_file.Integer = 1234; comptime try std.testing.expect(@TypeOf(&x) == *const other_file.Integer); try foo(&x); } fn foo(x: *const other_file.Integer) !void { try std.testing.expect(x.* == 1234); }
Zig
4
lukekras/zig
test/behavior/bugs/655.zig
[ "MIT" ]
Mozilla/5.0 (compatible; MSEDGE 12.0; Windows 10 Mobile; EdgeHTML/12.0; EdgeMobile/12.0; ARM; Touch; Microsoft; Lumia 645 LTE)
Text
0
5tr1x/SecLists
Fuzzing/User-Agents/operating-platform/lumia-645.txt
[ "MIT" ]
<UserGreeting @name="Ricardo" @greeting="Olá" /> {{@greeting}}, {{@name}}! <div> <UserGreeting @aVeryLongArgumentNameThatIsStillGoing={{@alsoAVeryLongArgument}} /> </div> <Form as |f|> <f.input @title="hello" /> <f.input>hello</f.input> </Form> <this.label @title="hello" /> <button onclick={{action next}}>Next</button> <button disabled class="disabled"></button> <button disabled=disabled class="disabled"></button> <img alt="" /> <div ...attributes>Hello</div> <ul class="list-unstyled one-tab"> </ul>
Handlebars
3
jdelStrother/prettier
tests/handlebars-basics/component.hbs
[ "MIT" ]
<html> <head> <title>frame1-2</title> </head> <body> <h1>index > frame1 > frame1-2</h1> </body> </html>
HTML
3
ant0ine/phantomjs
test/webpage-spec-frames/frame1-2.html
[ "BSD-3-Clause" ]
@import '../../../styles/variables'; #release-notes { max-height: 450px; .dialog-content { // we'll own the layout inside here padding: 0; } .dialog-header { height: 100px; position: relative; .release-notes-header { display: flex; position: absolute; top: 0; right: 0; bottom: 0; left: 0; padding: 0 var(--spacing-double); } .release-note-graphic-left { margin-right: 20px; } .release-note-graphic-right { margin-left: 20px; } .title { display: flex; flex-direction: column; flex-grow: 1; justify-content: center; text-align: center; p { margin: 0; } .version { font-size: 14px; font-weight: var(--font-weight-semibold); margin-bottom: 0; } .date { font-size: 11px; color: var(--text-secondary-color); } } } .dialog-footer { flex-direction: row; justify-content: space-between; } ul { list-style: none; padding-left: 0; li { padding-left: 0; } } a.close { align-self: flex-start; z-index: 1; } .container { width: 600px; max-height: 200px; display: flex; flex-direction: row; padding-left: var(--spacing-triple); padding-right: var(--spacing-triple); overflow-x: hidden; overflow-y: auto; justify-content: space-around; .column { flex: 1 1 275px; max-width: 75%; margin: 0 calc(var(--spacing) * 1.5); height: 100%; .section { margin: var(--spacing-double) 0; .header { font-size: 12px; font-weight: var(--font-weight-semibold); } } } } }
SCSS
4
testtas9812/desktop
app/styles/ui/dialogs/_release-notes.scss
[ "MIT" ]
#!/usr/bin/osascript # Assumption: Evernote running (launching and waiting not great UX) # # Required parameters: # @raycast.schemaVersion 1 # @raycast.title Create Evernote Paste Clipboard # @raycast.mode silent # # Optional parameters: # @raycast.icon ./images/evernote.png # @raycast.packageName Evernote # # Documentation: # @raycast.description Creates a new Evernote, pastes in the contents of the clipboard, and positions the cursor in the title area. # @raycast.author Aaron Miller # @raycast.authorURL https://github.com/aaronhmiller tell application "System Events" tell process "Evernote" set frontmost to true click menu item "New Note" of menu "File" of menu bar 1 delay 2 --needed b/c Electron apps slow click menu item "Paste" of menu "Edit" of menu bar 1 delay 1 tell application "System Events" to key code 48 using shift down -- shift-tab (move cursor to Title area) end tell end tell do shell script "echo New Evernote created"
AppleScript
4
daviddzhou/script-commands
commands/apps/evernote/create-note-paste-clipboard.applescript
[ "MIT" ]
.baz .bar {} .foo {} .bar {} .foo .bar .baz {} .baz {} .baz .foo {} .foo .baz {}
CartoCSS
3
nimix/carto
test/specificity/classes.mss
[ "Apache-2.0" ]
package beer import static extension beer.BottleSupport.* import org.junit.Test class BottleSong { @Test def void singIt() { println(singTheSong(99)) } def singTheSong(int all) ''' «FOR i : all .. 1» «i.Bottles» of beer on the wall, «i.bottles» of beer. Take one down and pass it around, «(i - 1).bottles» of beer on the wall. «ENDFOR» No more bottles of beer on the wall, no more bottles of beer. Go to the store and buy some more, «all.bottles» of beer on the wall. ''' def private java.lang.String bottles(int i) { switch i { case 0 : 'no more bottles' case 1 : 'one bottle' default : '''«i» bottles''' }.toString } def String Bottles(int i) { bottles(i).toFirstUpper } }
Xtend
4
JordonPhillips/pygments
tests/examplefiles/xtend/example.xtend
[ "BSD-2-Clause" ]
nextInstanceId = 1 module.exports = class Model @resetNextInstanceId: -> nextInstanceId = 1 alive: true constructor: (params) -> @assignId(params?.id) assignId: (id) -> @id ?= id ? nextInstanceId++ nextInstanceId = id + 1 if id >= nextInstanceId destroy: -> return unless @isAlive() @alive = false @destroyed?() isAlive: -> @alive isDestroyed: -> not @isAlive()
CoffeeScript
4
pyrolabs/atom
src/model.coffee
[ "MIT" ]
<?xml version='1.0' encoding='UTF-8'?> <Project Type="Project" LVVersion="15008000"> <Item Name="My Computer" Type="My Computer"> <Property Name="NI.SortType" Type="Int">3</Property> <Property Name="server.app.propertiesEnabled" Type="Bool">true</Property> <Property Name="server.control.propertiesEnabled" Type="Bool">true</Property> <Property Name="server.tcp.enabled" Type="Bool">false</Property> <Property Name="server.tcp.port" Type="Int">0</Property> <Property Name="server.tcp.serviceName" Type="Str">My Computer/VI Server</Property> <Property Name="server.tcp.serviceName.default" Type="Str">My Computer/VI Server</Property> <Property Name="server.vi.callsEnabled" Type="Bool">true</Property> <Property Name="server.vi.propertiesEnabled" Type="Bool">true</Property> <Property Name="specify.custom.address" Type="Bool">false</Property> <Item Name="Clusters" Type="Folder"> <Item Name="Circle Library.lvlib" Type="Library" URL="../../Circle Library.lvlib"/> <Item Name="square cluster.ctl" Type="VI" URL="../../square cluster.ctl"/> <Item Name="Shape.ctl" Type="VI" URL="../Shape.ctl"/> <Item Name="colors.ctl" Type="VI" URL="../../colors.ctl"/> </Item> <Item Name="Classes" Type="Folder"> <Item Name="Square.lvclass" Type="LVClass" URL="../../Square/Square.lvclass"/> <Item Name="Circle.lvclass" Type="LVClass" URL="../../Circle/Circle.lvclass"/> <Item Name="Shape.lvclass" Type="LVClass" URL="../Shape.lvclass"/> <Item Name="Solution Triangle.lvclass" Type="LVClass" URL="../../Solution Triangle/Solution Triangle.lvclass"/> </Item> <Item Name="Demo" Type="Folder"> <Item Name="Triangle Demo Init.vi" Type="VI" URL="../../Triangle Demo Init.vi"/> <Item Name="Triangle Top Level VI.vi" Type="VI" URL="../../Triangle Top Level VI.vi"/> </Item> <Item Name="Solution" Type="Folder"> <Item Name="Triangle Demo Init Solution.vi" Type="VI" URL="../../Triangle Demo Init Solution.vi"/> <Item Name="Triangle Top Level VI Solution.vi" Type="VI" URL="../../Triangle Top Level VI Solution.vi"/> </Item> <Item Name="Other" Type="Folder"> <Item Name="Screen Caps VI.vi" Type="VI" URL="../../Screen Caps VI.vi"/> <Item Name="Not in the library.vi" Type="VI" URL="../../Not in the library.vi"/> <Item Name="Top Level Vi.vi" Type="VI" URL="../../Top Level Vi.vi"/> </Item> <Item Name="Dependencies" Type="Dependencies"/> <Item Name="Build Specifications" Type="Build"/> </Item> </Project>
LabVIEW
2
LabVIEW-DCAF/Documentation
Trunk/Getting Started Material/DCAF Training/Demystifing LabVIEW Objects Files/Shape/Demystifying LabVIEW Objects.lvproj
[ "Apache-2.0" ]
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #include <vector> #include "tensorflow/core/framework/op_kernel.h" #include "tensorflow/core/framework/register_types.h" #include "tensorflow/core/framework/tensor_shape.h" #include "tensorflow/core/framework/tensor_types.h" #include "tensorflow/core/framework/types.h" #include "tensorflow/core/kernels/reshape_op.h" namespace tensorflow { class QuantizedReshapeOp : public ReshapeOp { public: explicit QuantizedReshapeOp(OpKernelConstruction* c) : ReshapeOp(c) {} void Compute(OpKernelContext* ctx) override { // This call processes inputs 1 and 2 to write output 0. ReshapeOp::Compute(ctx); if (!ctx->status().ok()) { return; } const auto& input_min_float_tensor = ctx->input(2); const auto& input_min_float_shape = input_min_float_tensor.shape(); OP_REQUIRES(ctx, TensorShapeUtils::IsScalar(input_min_float_shape) || (TensorShapeUtils::IsVector(input_min_float_shape) && (input_min_float_shape.dim_size(0) == 1)), errors::InvalidArgument( "input_min must be a scalar or a vector of 1 element")); const float input_min_float = input_min_float_tensor.flat<float>()(0); const auto& input_max_float_tensor = ctx->input(3); const auto& input_max_float_shape = input_max_float_tensor.shape(); OP_REQUIRES(ctx, TensorShapeUtils::IsScalar(input_max_float_shape) || (TensorShapeUtils::IsVector(input_max_float_shape) && (input_max_float_shape.dim_size(0) == 1)), errors::InvalidArgument( "input_max must be a scalar or a vector of 1 element")); const float input_max_float = input_max_float_tensor.flat<float>()(0); Tensor* output_min = nullptr; OP_REQUIRES_OK(ctx, ctx->allocate_output(1, TensorShape({}), &output_min)); output_min->flat<float>()(0) = input_min_float; Tensor* output_max = nullptr; OP_REQUIRES_OK(ctx, ctx->allocate_output(2, TensorShape({}), &output_max)); output_max->flat<float>()(0) = input_max_float; } }; #define REGISTER_CPU_KERNEL(type) \ REGISTER_KERNEL_BUILDER(Name("QuantizedReshape") \ .Device(DEVICE_CPU) \ .HostMemory("shape") \ .TypeConstraint<type>("T"), \ QuantizedReshapeOp) REGISTER_CPU_KERNEL(::tensorflow::quint8); REGISTER_CPU_KERNEL(::tensorflow::qint32); #undef REGISTER_CPU_KERNEL } // namespace tensorflow
C++
5
EricRemmerswaal/tensorflow
tensorflow/core/kernels/quantized_reshape_op.cc
[ "Apache-2.0" ]
#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=C:\Program Files (x86)\AutoIt3\Icons\au3.ico #AutoIt3Wrapper_Outfile=ExtractUsnJrnl.exe #AutoIt3Wrapper_Outfile_x64=ExtractUsnJrnl64.exe #AutoIt3Wrapper_UseUpx=y #AutoIt3Wrapper_Compile_Both=y #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_Change2CUI=y #AutoIt3Wrapper_Res_Comment=Quickly extract $UsnJrnl from an NTFS volume #AutoIt3Wrapper_Res_Description=Quickly extract $UsnJrnl from an NTFS volume #AutoIt3Wrapper_Res_Fileversion=1.0.0.5 #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #AutoIt3Wrapper_AU3Check_Parameters=-w 3 -w 5 #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/sf /sv /rm /pe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #Include <WinAPIEx.au3> #include <Array.au3> #Include <String.au3> #Include <FileConstants.au3> #Include <APIConstants.au3> Global Const $RecordSignature = '46494C45' ; FILE signature Global $IsPhysicalDrive=False,$IsImage=False Global $GlobUsnJrnlFileSize, $GlobUsnJrnlSparseBytes, $LogicalClusterNumberforthefileMFT, $NonResidentFlag, $InitState = False, $IsCompressed, $Data_Clusters, $ClustersPerFileRecordSegment,$OutputName="$UsnJrnl_$J.bin" Global $RUN_VCN[1],$RUN_Clusters[1],$MFT_RUN_Clusters[1],$MFT_RUN_VCN[1],$DataQ[1],$sBuffer,$AttrQ[1],$NameQ[5],$AttributesArr[18][4],$Entries,$TargetDrive,$OutPutPath=@ScriptDir,$TargetImageFile,$ImageOffset=0 Global $SectorsPerCluster,$BytesPerSector,$DATA_Name,$_COMMON_KERNEL32DLL=DllOpen("kernel32.dll"),$INDX_Record_Size=4096,$HEADER_MFTREcordNumber,$FN_ParentReferenceNo,$RawTestOffsetArray Global $IndxEntryNumberArr[1],$IndxMFTReferenceArr[1],$IndxMFTRefSeqNoArr[1],$IndxMFTReferenceOfParentArr[1],$IndxMFTParentRefSeqNoArr[1],$IndxCTimeArr[1],$IndxATimeArr[1],$IndxMTimeArr[1],$IndxRTimeArr[1],$IndxFileNameArr[1] Global $DATA_RealSize,$FN_FileName,$DataRun,$MFT_Record_Size,$MFT_Offset,$SkipFixups=0,$IsRawShadowCopy=0,$DoIndxOffsetArray=0,$IsFirstRun=1,$IsCurrentIndxOfParent=0,$ResidentIndx Global $InfoArrShadowMainTarget[3],$InfoArrShadowParent[3],$IndxFileNameFromParentArr[1],$IndxMFTReferenceFromParentArr[1],$IndxMFTReferenceOfParentFromParentArr[1],$IndxCTimeFromParentArr[1],$IndxATimeFromParentArr[1],$IndxMTimeFromParentArr[1],$IndxRTimeFromParentArr[1] Global Const $STANDARD_INFORMATION = '10000000' Global Const $ATTRIBUTE_LIST = '20000000' Global Const $FILE_NAME = '30000000' Global Const $OBJECT_ID = '40000000' Global Const $SECURITY_DESCRIPTOR = '50000000' Global Const $VOLUME_NAME = '60000000' Global Const $VOLUME_INFORMATION = '70000000' Global Const $DATA = '80000000' Global Const $INDEX_ROOT = '90000000' Global Const $INDEX_ALLOCATION = 'A0000000' Global Const $BITMAP = 'B0000000' Global Const $REPARSE_POINT = 'C0000000' Global Const $EA_INFORMATION = 'D0000000' Global Const $EA = 'E0000000' Global Const $PROPERTY_SET = 'F0000000' Global Const $LOGGED_UTILITY_STREAM = '00010000' Global Const $ATTRIBUTE_END_MARKER = 'FFFFFFFF' Global $DateTimeFormat = 6 ; YYYY-MM-DD HH:MM:SS:MSMSMS:NSNSNSNS = 2007-08-18 08:15:37:733:1234 Global $tDelta = _WinTime_GetUTCToLocalFileTimeDelta(), $TimestampPrecision Global $VolumesArray[1][3] $VolumesArray[0][0] = "Type" $VolumesArray[0][1] = "ByteOffset" $VolumesArray[0][2] = "Sectors" $DoRead=1 ConsoleWrite("ExtractUsnJrnl v1.0.0.5" & @CRLF & @CRLF) _GetInputParams() ;_ArrayDisplay($VolumesArray,"$VolumesArray") $TargetFileName = "x:\$Extend\$UsnJrnl" $IndexNumber="" $begin = TimerInit() _ReadBootSector($TargetDrive) If @error Then ConsoleWrite("Error: Filesystem not NTFS" & @CRLF) Exit EndIf $BytesPerCluster = $SectorsPerCluster*$BytesPerSector $MFTEntry = _FindMFT($TargetDrive,0) $MFT = _DecodeMFTRecord0($MFTEntry, 0) ;produces DataQ for $MFT, record 0 If $MFT = "" Then ConsoleWrite("Error: Parsing the MFT record 0" & @CRLF) Exit EndIf _GetRunsFromAttributeListMFT0() $MFTSize = $DATA_RealSize $MFT_RUN_VCN = $RUN_VCN $MFT_RUN_Clusters = $RUN_Clusters If Not _Prep($TargetDrive,$IndexNumber,$TargetFileName) Then ConsoleWrite("Error initializing structs and arrays" & @crlf) Exit EndIf $RetRec = _FindFileMFTRecord($TargetDrive,$InfoArrShadowMainTarget[0]) $NewRecord = $RetRec[1] If _DecodeMFTRecord($TargetDrive,$NewRecord,1) < 1 Then ConsoleWrite("Could not verify MFT record at offset: 0x" & $RetRec[0] & @CRLF) Exit EndIf $RetRec = _FindFileMFTRecord($TargetDrive,$InfoArrShadowMainTarget[0]) $NewRecord = $RetRec[1] If _DecodeMFTRecord($TargetDrive,$NewRecord,3) < 1 Then ConsoleWrite("Could not verify MFT record at offset: 0x" & $RetRec[0] & @CRLF) Exit EndIf ;_ArrayDisplay($RawTestOffsetArray,"$RawTestOffsetArray") If Ubound($RawTestOffsetArray) > 1 Then Dim $nBytes $OutUsnJrnlFile = $OutPutPath & "\" & $OutputName $hVol = _WinAPI_CreateFile($TargetDrive,2,2,7) If $hVol = 0 Then ConsoleWrite("Error: Creating handle on " & $TargetDrive & @CRLF) Exit EndIf If FileExists($OutUsnJrnlFile) Then $CurrentTimestamp = @YEAR & @MON & @MDAY & @HOUR & @MIN & @SEC FileMove($OutUsnJrnlFile,$OutUsnJrnlFile&".renamed_"&$CurrentTimestamp) ConsoleWrite("Previous output file renamed to prevent overwrite: " & $OutUsnJrnlFile&".renamed_"&$CurrentTimestamp & @CRLF) EndIf $hOutFile = _WinAPI_CreateFile("\\.\" & $OutUsnJrnlFile, 1, 6, 6) If $hOutFile = 0 Then ConsoleWrite("Error in function CreateFile on " & $OutUsnJrnlFile & " : " & _WinAPI_GetLastErrorMessage() & @CRLF) Exit EndIf For $i = 1 To UBound($RawTestOffsetArray)-1 If $RawTestOffsetArray[$i][0] = 0 Then ContinueLoop ConsoleWrite(@CRLF & "Trying volume offset 0x" & Hex(Int($RawTestOffsetArray[$i][0])) & @CRLF) _WinAPI_SetFilePointerEx($hVol, $RawTestOffsetArray[$i][0], $FILE_BEGIN) $End=0 If Mod($RawTestOffsetArray[$i][2],512) Then ; ConsoleWrite("Corrected chunk size" & @crlf) Do $End += 1 until Mod($RawTestOffsetArray[$i][2]+$End,512)=1 $End -= 1 EndIf $tBuffer = DllStructCreate("byte[" & $RawTestOffsetArray[$i][2]+$End & "]") If Not _WinAPI_ReadFile($hVol, DllStructGetPtr($tBuffer), $RawTestOffsetArray[$i][2]+$End, $nBytes) Then ConsoleWrite("Error in function ReadFile: " & _WinAPI_GetLastErrorMessage() & @CRLF) EndIf If Not _WinAPI_WriteFile($hOutFile, DllStructGetPtr($tBuffer), $RawTestOffsetArray[$i][2], $nBytes) Then ConsoleWrite("Error in function WriteFile: " & _WinAPI_GetLastErrorMessage() & @CRLF) EndIf Next _WinAPI_CloseHandle($hVol) _WinAPI_CloseHandle($hOutFile) EndIf ConsoleWrite("Extract took " & _WinAPI_StrFromTimeInterval(TimerDiff($begin)) & @CRLF) Func _DecodeDataQEntry($attr) ;processes data attribute $NonResidentFlag = StringMid($attr,17,2) $NameLength = Dec(StringMid($attr,19,2)) $NameOffset = Dec(_SwapEndian(StringMid($attr,21,4))) If $NameLength > 0 Then ;must be ADS $ADS_Name = _UnicodeHexToStr(StringMid($attr,$NameOffset*2 + 1,$NameLength*4)) $ADS_Name = $FN_FileName & "[ADS_" & $ADS_Name & "]" Else $ADS_Name = $FN_FileName ;need to preserve $FN_FileName EndIf $Flags = StringMid($attr,25,4) If BitAND($Flags,"0100") Then $IsCompressed = 1 ;If BitAND($Flags,"0080") Then $IsSparse = 1 If $NonResidentFlag = '01' Then $DATA_Clusters = Dec(_SwapEndian(StringMid($attr,49,16)),2) - Dec(_SwapEndian(StringMid($attr,33,16)),2) + 1 $DATA_RealSize = Dec(_SwapEndian(StringMid($attr,97,16)),2) ;$DATA_InitSize = Dec(_SwapEndian(StringMid($attr,113,16)),2) $Offset = Dec(_SwapEndian(StringMid($attr,65,4))) $DataRun = StringMid($attr,$Offset*2+1,(StringLen($attr)-$Offset)*2) ElseIf $NonResidentFlag = '00' Then $DATA_LengthOfAttribute = Dec(_SwapEndian(StringMid($attr,33,8)),2) $Offset = Dec(_SwapEndian(StringMid($attr,41,4))) $DataRun = StringMid($attr,$Offset*2+1,$DATA_LengthOfAttribute*2) EndIf EndFunc Func _SwapEndian($iHex) Return StringMid(Binary(Dec($iHex,2)),3, StringLen($iHex)) EndFunc Func _ExtractDataRuns() $r=UBound($RUN_Clusters) $i=1 $RUN_VCN[0] = 0 $BaseVCN = $RUN_VCN[0] If $DataRun = "" Then $DataRun = "00" Do $RunListID = StringMid($DataRun,$i,2) If $RunListID = "00" Then ExitLoop $i += 2 $RunListClustersLength = Dec(StringMid($RunListID,2,1)) $RunListVCNLength = Dec(StringMid($RunListID,1,1)) $RunListClusters = Dec(_SwapEndian(StringMid($DataRun,$i,$RunListClustersLength*2)),2) $i += $RunListClustersLength*2 $RunListVCN = _SwapEndian(StringMid($DataRun, $i, $RunListVCNLength*2)) ;next line handles positive or negative move $BaseVCN += Dec($RunListVCN,2)-(($r>1) And (Dec(StringMid($RunListVCN,1,1))>7))*Dec(StringMid("10000000000000000",1,$RunListVCNLength*2+1),2) If $RunListVCN <> "" Then $RunListVCN = $BaseVCN Else $RunListVCN = 0 ;$RUN_VCN[$r-1] ;0 EndIf If (($RunListVCN=0) And ($RunListClusters>16) And (Mod($RunListClusters,16)>0)) Then ;may be sparse section at end of Compression Signature _ArrayAdd($RUN_Clusters,Mod($RunListClusters,16)) _ArrayAdd($RUN_VCN,$RunListVCN) $RunListClusters -= Mod($RunListClusters,16) $r += 1 ElseIf (($RunListClusters>16) And (Mod($RunListClusters,16)>0)) Then ;may be compressed data section at start of Compression Signature _ArrayAdd($RUN_Clusters,$RunListClusters-Mod($RunListClusters,16)) _ArrayAdd($RUN_VCN,$RunListVCN) $RunListVCN += $RUN_Clusters[$r] $RunListClusters = Mod($RunListClusters,16) $r += 1 EndIf ;just normal or sparse data _ArrayAdd($RUN_Clusters,$RunListClusters) _ArrayAdd($RUN_VCN,$RunListVCN) $r += 1 $i += $RunListVCNLength*2 Until $i > StringLen($DataRun) EndFunc Func _FindMFT($TargetDevice,$TargetFile) Local $nBytes;, $MFT_Record_Size=1024 $tBuffer = DllStructCreate("byte[" & $MFT_Record_Size & "]") $hFile = _WinAPI_CreateFile($TargetDevice, 2, 2, 7) If $hFile = 0 Then ConsoleWrite("Error CreateFile in function _FindMFT(): " & _WinAPI_GetLastErrorMessage() & " for " & $TargetDevice & @CRLF) Return SetError(1,0,0) EndIf _WinAPI_SetFilePointerEx($hFile, $ImageOffset+$MFT_Offset, $FILE_BEGIN) _WinAPI_ReadFile($hFile, DllStructGetPtr($tBuffer), $MFT_Record_Size, $nBytes) _WinAPI_CloseHandle($hFile) $record = DllStructGetData($tBuffer, 1) If NOT StringMid($record,1,8) = '46494C45' Then ConsoleWrite("MFT record signature not found. "& @crlf) Return "" EndIf If StringMid($record,47,4) = "0100" AND Dec(_SwapEndian(StringMid($record,91,8))) = $TargetFile Then ; ConsoleWrite("MFT record found" & @CRLF) Return $record ;returns record for MFT EndIf ConsoleWrite("MFT record not found" & @CRLF) Return "" EndFunc Func _ReadBootSector($TargetDevice) Local $nbytes $tBuffer=DllStructCreate("byte[512]") $hFile = _WinAPI_CreateFile($TargetDevice,2,2,7) If $hFile = 0 then ConsoleWrite("Error CreateFile in function _ReadBootSector(): " & _WinAPI_GetLastErrorMessage() & " for: " & $TargetDevice & @crlf) Return SetError(1,0,0) EndIf _WinAPI_SetFilePointerEx($hFile, $ImageOffset, $FILE_BEGIN) $read = _WinAPI_ReadFile($hFile, DllStructGetPtr($tBuffer), 512, $nBytes) If $read = 0 then ConsoleWrite("Error in function ReadFile: " & _WinAPI_GetLastErrorMessage() & " for: " & "\\.\" & $TargetDevice & @crlf) Return SetError(1,0,0) EndIf _WinAPI_CloseHandle($hFile) ; Good starting point from KaFu & trancexx at the AutoIt forum $tBootSectorSections = DllStructCreate("align 1;" & _ "byte Jump[3];" & _ "char SystemName[8];" & _ "ushort BytesPerSector;" & _ "ubyte SectorsPerCluster;" & _ "ushort ReservedSectors;" & _ "ubyte[3];" & _ "ushort;" & _ "ubyte MediaDescriptor;" & _ "ushort;" & _ "ushort SectorsPerTrack;" & _ "ushort NumberOfHeads;" & _ "dword HiddenSectors;" & _ "dword;" & _ "dword;" & _ "int64 TotalSectors;" & _ "int64 LogicalClusterNumberforthefileMFT;" & _ "int64 LogicalClusterNumberforthefileMFTMirr;" & _ "dword ClustersPerFileRecordSegment;" & _ "dword ClustersPerIndexBlock;" & _ "int64 NTFSVolumeSerialNumber;" & _ "dword Checksum", DllStructGetPtr($tBuffer)) If Not DllStructGetData($tBootSectorSections, "SystemName") = "NTFS" Then Return SetError(1,0,0) $BytesPerSector = DllStructGetData($tBootSectorSections, "BytesPerSector") $SectorsPerCluster = DllStructGetData($tBootSectorSections, "SectorsPerCluster") $BytesPerCluster = $BytesPerSector * $SectorsPerCluster $ClustersPerFileRecordSegment = DllStructGetData($tBootSectorSections, "ClustersPerFileRecordSegment") $LogicalClusterNumberforthefileMFT = DllStructGetData($tBootSectorSections, "LogicalClusterNumberforthefileMFT") $MFT_Offset = $BytesPerCluster * $LogicalClusterNumberforthefileMFT If $ClustersPerFileRecordSegment > 127 Then $MFT_Record_Size = 2 ^ (256 - $ClustersPerFileRecordSegment) Else $MFT_Record_Size = $BytesPerCluster * $ClustersPerFileRecordSegment EndIf $MFT_Record_Size=Int($MFT_Record_Size) $ClustersPerFileRecordSegment = Ceiling($MFT_Record_Size/$BytesPerCluster) EndFunc Func _HexEncode($bInput) Local $tInput = DllStructCreate("byte[" & BinaryLen($bInput) & "]") DllStructSetData($tInput, 1, $bInput) Local $a_iCall = DllCall("crypt32.dll", "int", "CryptBinaryToString", _ "ptr", DllStructGetPtr($tInput), _ "dword", DllStructGetSize($tInput), _ "dword", 11, _ "ptr", 0, _ "dword*", 0) If @error Or Not $a_iCall[0] Then Return SetError(1, 0, "") EndIf Local $iSize = $a_iCall[5] Local $tOut = DllStructCreate("char[" & $iSize & "]") $a_iCall = DllCall("crypt32.dll", "int", "CryptBinaryToString", _ "ptr", DllStructGetPtr($tInput), _ "dword", DllStructGetSize($tInput), _ "dword", 11, _ "ptr", DllStructGetPtr($tOut), _ "dword*", $iSize) If @error Or Not $a_iCall[0] Then Return SetError(2, 0, "") EndIf Return SetError(0, 0, DllStructGetData($tOut, 1)) EndFunc Func _DecodeMFTRecord($TargetDevice,$MFTEntry,$MFTMode) ;Global $IndxEntryNumberArr[1],$IndxMFTReferenceArr[1],$IndxIndexFlagsArr[1],$IndxMFTReferenceOfParentArr[1],$IndxCTimeArr[1],$IndxATimeArr[1],$IndxMTimeArr[1],$IndxRTimeArr[1],$IndxAllocSizeArr[1],$IndxRealSizeArr[1],$IndxFileFlagsArr[1],$IndxFileNameArr[1],$IndxSubNodeVCNArr[1],$IndxNameSpaceArr[1] Global $IndxEntryNumberArr[1],$IndxMFTReferenceArr[1],$IndxMFTReferenceOfParentArr[1],$IndxCTimeArr[1],$IndxATimeArr[1],$IndxMTimeArr[1],$IndxRTimeArr[1],$IndxFileNameArr[1] Global $SIArrValue[13][1], $SIArrOffset[13][1], $SIArrSize[13][1], $FNArrValue[14][1], $FNArrOffset[14][1], $FN_Number=0, $Header_SequenceNo='', $Header_HardLinkCount='' Local $SI_Number, $INDEXROOT_Number Local $INDEX_ROOT_ON="FALSE",$INDEX_ALLOCATION_ON="FALSE",$CoreData[2],$CoreDataChunk,$CoreIndexAllocation,$CoreIndexAllocationChunk,$CoreIndexAllocationName Local $UpdSeqArrPart0, $UpdSeqArrPart1, $UpdSeqArrPart2, $RecordEnd1, $RecordEnd2 Global $DataQ[1],$Mode2Data="" Global $IRArr[12][2],$IndxArr[20][2] _SetArrays() $HEADER_RecordRealSize = "" $HEADER_MFTREcordNumber = "" $UpdSeqArrOffset = Dec(_SwapEndian(StringMid($MFTEntry,11,4))) $UpdSeqArrSize = Dec(_SwapEndian(StringMid($MFTEntry,15,4))) $UpdSeqArr = StringMid($MFTEntry,3+($UpdSeqArrOffset*2),$UpdSeqArrSize*2*2) If Not $SkipFixups Then If $MFT_Record_Size = 1024 Then $UpdSeqArrPart0 = StringMid($UpdSeqArr,1,4) $UpdSeqArrPart1 = StringMid($UpdSeqArr,5,4) $UpdSeqArrPart2 = StringMid($UpdSeqArr,9,4) $RecordEnd1 = StringMid($MFTEntry,1023,4) $RecordEnd2 = StringMid($MFTEntry,2047,4) If $UpdSeqArrPart0 <> $RecordEnd1 OR $UpdSeqArrPart0 <> $RecordEnd2 Then ; _DebugOut("The record failed Fixup", $MFTEntry) ConsoleWrite("The record failed Fixup:" & @CRLF) ConsoleWrite(_HexEncode($MFTEntry) & @CRLF) Return -1 EndIf $MFTEntry = StringMid($MFTEntry,1,1022) & $UpdSeqArrPart1 & StringMid($MFTEntry,1027,1020) & $UpdSeqArrPart2 ElseIf $MFT_Record_Size = 4096 Then $UpdSeqArrPart0 = StringMid($UpdSeqArr,1,4) $UpdSeqArrPart1 = StringMid($UpdSeqArr,5,4) $UpdSeqArrPart2 = StringMid($UpdSeqArr,9,4) Local $UpdSeqArrPart3 = StringMid($UpdSeqArr,13,4) Local $UpdSeqArrPart4 = StringMid($UpdSeqArr,17,4) Local $UpdSeqArrPart5 = StringMid($UpdSeqArr,21,4) Local $UpdSeqArrPart6 = StringMid($UpdSeqArr,25,4) Local $UpdSeqArrPart7 = StringMid($UpdSeqArr,29,4) Local $UpdSeqArrPart8 = StringMid($UpdSeqArr,33,4) $RecordEnd1 = StringMid($MFTEntry,1023,4) $RecordEnd2 = StringMid($MFTEntry,2047,4) Local $RecordEnd3 = StringMid($MFTEntry,3071,4) Local $RecordEnd4 = StringMid($MFTEntry,4095,4) Local $RecordEnd5 = StringMid($MFTEntry,5119,4) Local $RecordEnd6 = StringMid($MFTEntry,6143,4) Local $RecordEnd7 = StringMid($MFTEntry,7167,4) Local $RecordEnd8 = StringMid($MFTEntry,8191,4) If $UpdSeqArrPart0 <> $RecordEnd1 OR $UpdSeqArrPart0 <> $RecordEnd2 OR $UpdSeqArrPart0 <> $RecordEnd3 OR $UpdSeqArrPart0 <> $RecordEnd4 OR $UpdSeqArrPart0 <> $RecordEnd5 OR $UpdSeqArrPart0 <> $RecordEnd6 OR $UpdSeqArrPart0 <> $RecordEnd7 OR $UpdSeqArrPart0 <> $RecordEnd8 Then ; _DebugOut("The record failed Fixup", $MFTEntry) ConsoleWrite("The record failed Fixup:" & @CRLF) ConsoleWrite(_HexEncode($MFTEntry) & @CRLF) Return -1 Else $MFTEntry = StringMid($MFTEntry,1,1022) & $UpdSeqArrPart1 & StringMid($MFTEntry,1027,1020) & $UpdSeqArrPart2 & StringMid($MFTEntry,2051,1020) & $UpdSeqArrPart3 & StringMid($MFTEntry,3075,1020) & $UpdSeqArrPart4 & StringMid($MFTEntry,4099,1020) & $UpdSeqArrPart5 & StringMid($MFTEntry,5123,1020) & $UpdSeqArrPart6 & StringMid($MFTEntry,6147,1020) & $UpdSeqArrPart7 & StringMid($MFTEntry,7171,1020) & $UpdSeqArrPart8 EndIf EndIf EndIf ;If $SkipFixups Then ; $record_tmp = _DoFixup($record, $FileRef) ; If Not $record_tmp = "" Then $record = $record_tmp ;EndIf ;If $record = "" then Return "" ;corrupt, failed fixup ;------------If Not $SkipFixups Then $record = _DoFixup($record, $ref) $HEADER_RecordRealSize = Dec(_SwapEndian(StringMid($MFTEntry,51,8)),2) If $UpdSeqArrOffset = 48 Then $HEADER_MFTREcordNumber = Dec(_SwapEndian(StringMid($MFTEntry,91,8)),2) Else $HEADER_MFTREcordNumber = "NT style" EndIf $Header_SequenceNo = Dec(_SwapEndian(StringMid($MFTEntry,35,4))) $Header_HardLinkCount = Dec(_SwapEndian(StringMid($MFTEntry,39,4))) $AttributeOffset = (Dec(StringMid($MFTEntry,43,2))*2)+3 While 1 $AttributeType = StringMid($MFTEntry,$AttributeOffset,8) $AttributeSize = StringMid($MFTEntry,$AttributeOffset+8,8) $AttributeSize = Dec(_SwapEndian($AttributeSize),2) ; ConsoleWrite("$AttributeType: " & $AttributeType & @CRLF) Select Case $AttributeType = $STANDARD_INFORMATION ; $STANDARD_INFORMATION_ON = "TRUE" $SI_Number += 1 _Get_StandardInformation($MFTEntry,$AttributeOffset,$SI_Number) Case $AttributeType = $ATTRIBUTE_LIST ; $ATTRIBUTE_LIST_ON = "TRUE" ;$ATTRIBLIST_Number += 1 ;$MFTEntryOrig = $MFTEntry $AttrList = StringMid($MFTEntry,$AttributeOffset,$AttributeSize*2) _DecodeAttrList($HEADER_MFTRecordNumber, $AttrList) ;produces $AttrQ - extra record list $str = "" For $i = 1 To $AttrQ[0] $RetRec = _FindFileMFTRecord($TargetDevice,$AttrQ[$i]) $record = $RetRec[1] $str &= _StripMftRecord($record) ;no header or end marker Next $str &= "FFFFFFFF" ;add end marker $MFTEntry = StringMid($MFTEntry,1,($HEADER_RecordRealSize-8)*2+2) & $str ;strip "FFFFFFFF..." first Case $AttributeType = $FILE_NAME ; $FILE_NAME_ON = "TRUE" $FN_Number += 1 $attr = StringMid($MFTEntry,$AttributeOffset,$AttributeSize*2) $NameSpace = StringMid($attr,179,2) Select Case $NameSpace = "00" ;POSIX $NameQ[2] = $attr Case $NameSpace = "01" ;WIN32 $NameQ[4] = $attr Case $NameSpace = "02" ;DOS $NameQ[1] = $attr Case $NameSpace = "03" ;DOS+WIN32 $NameQ[3] = $attr EndSelect _Get_FileName($MFTEntry,$AttributeOffset,$FN_Number) Case $AttributeType = $OBJECT_ID If $IsRawShadowCopy Then Return 1 ;We are only interested in ref and name for comparison. ; $OBJECT_ID_ON = "TRUE" ;$OBJID_Number += 1 Case $AttributeType = $SECURITY_DESCRIPTOR If $IsRawShadowCopy Then Return 1 ;We are only interested in ref and name for comparison. ; $SECURITY_DESCRIPTOR_ON = "TRUE" ;$SECURITY_Number += 1 Case $AttributeType = $VOLUME_NAME If $IsRawShadowCopy Then Return 1 ;We are only interested in ref and name for comparison. ; $VOLUME_NAME_ON = "TRUE" ;$VOLNAME_Number += 1 Case $AttributeType = $VOLUME_INFORMATION If $IsRawShadowCopy Then Return 1 ;We are only interested in ref and name for comparison. ; $VOLUME_INFORMATION_ON = "TRUE" ;$VOLINFO_Number += 1 Case $AttributeType = $DATA If $IsRawShadowCopy Then Return 1 ;We are only interested in ref and name for comparison. ; $DATA_ON = "TRUE" ;$DATA_Number += 1 ; ConsoleWrite("$DATA_Number: " & $DATA_Number & @CRLF) _ArrayAdd($DataQ, StringMid($MFTEntry,$AttributeOffset,$AttributeSize*2)) If $MFTMode = 2 Then ;For files that we need the content of, like the shadow copy master file. It is a small file so load it to memory $CoreData = _GetAttributeEntry($TargetDevice,StringMid($MFTEntry,$AttributeOffset,$AttributeSize*2)) $CoreDataChunk = $CoreData[0] ;$CoreDataName = $CoreData[1] ;ConsoleWrite("Retrieved data:" & @CRLF) ;ConsoleWrite(_HexEncode("0x"&$CoreDataChunk) & @CRLF) $Mode2Data = $CoreDataChunk ElseIf $MFTMode = 3 Then ;For the actual shadow copy files we only want to locate the clusters $CoreData = _GetAttributeEntryNoRead($TargetDevice,StringMid($MFTEntry,$AttributeOffset,$AttributeSize*2)) ; ConsoleWrite("$CoreData[1]: " & $CoreData[1] & @CRLF) ; If $CoreData[1] = "$J" Then Return 2 EndIf Case $AttributeType = $INDEX_ROOT If $IsRawShadowCopy Then Return 1 ;We are only interested in ref and name for comparison. $INDEX_ROOT_ON = "TRUE" $INDEXROOT_Number += 1 ReDim $IRArr[12][$INDEXROOT_Number+1] ;INDEX_ROOT is ok to process for shadows copy data as it is resident ; If Not $IsRawShadowCopy Then $CoreIndexRoot = _GetAttributeEntry($TargetDevice,StringMid($MFTEntry,$AttributeOffset,$AttributeSize*2)) $CoreIndexRootChunk = $CoreIndexRoot[0] $CoreIndexRootName = $CoreIndexRoot[1] If $CoreIndexRootName = "$I30" Then _Get_IndexRoot($CoreIndexRootChunk,$INDEXROOT_Number,$CoreIndexRootName) ; EndIf Case $AttributeType = $INDEX_ALLOCATION If $IsRawShadowCopy Then Return 1 ;We are only interested in ref and name for comparison. $INDEX_ALLOCATION_ON = "TRUE" ;$INDEXALLOC_Number += 1 If $DoIndxOffsetArray Then $IsCurrentIndxOfParent=1 ; ConsoleWrite("IsShadowCopy: " & $IsRawShadowCopy & @CRLF) ; If Not $IsRawShadowCopy Then ;INDX may point to somewhere on the volume, and not within the shadow copy file If $MFTMode = 1 Then ;Regular mode, only parse $CoreIndexAllocation = _GetAttributeEntry($TargetDevice,StringMid($MFTEntry,$AttributeOffset,$AttributeSize*2)) $CoreIndexAllocationChunk = $CoreIndexAllocation[0] $CoreIndexAllocationName = $CoreIndexAllocation[1] ; _Arrayadd($HexDumpIndxRecord,$CoreIndexAllocationChunk) If $CoreIndexAllocationName = "$I30" Then _Get_IndexAllocation($CoreIndexAllocationChunk) EndIf Case $AttributeType = $BITMAP If $IsRawShadowCopy Then Return 1 ;We are only interested in ref and name for comparison. ; $BITMAP_ON = "TRUE" ;$BITMAP_Number += 1 Case $AttributeType = $REPARSE_POINT If $IsRawShadowCopy Then Return 1 ;We are only interested in ref and name for comparison. ; $REPARSE_POINT_ON = "TRUE" ;$REPARSEPOINT_Number += 1 Case $AttributeType = $EA_INFORMATION If $IsRawShadowCopy Then Return 1 ;We are only interested in ref and name for comparison. ; $EA_INFORMATION_ON = "TRUE" ;$EAINFO_Number += 1 Case $AttributeType = $EA If $IsRawShadowCopy Then Return 1 ;We are only interested in ref and name for comparison. ; $EA_ON = "TRUE" ;$EA_Number += 1 Case $AttributeType = $PROPERTY_SET If $IsRawShadowCopy Then Return 1 ;We are only interested in ref and name for comparison. ; $PROPERTY_SET_ON = "TRUE" ;$PROPERTYSET_Number += 1 Case $AttributeType = $LOGGED_UTILITY_STREAM If $IsRawShadowCopy Then Return 1 ;We are only interested in ref and name for comparison. ; $LOGGED_UTILITY_STREAM_ON = "TRUE" ;$LOGGEDUTILSTREAM_Number += 1 Case $AttributeType = $ATTRIBUTE_END_MARKER ExitLoop EndSelect $AttributeOffset += $AttributeSize*2 WEnd $AttributesArr[9][2] = $INDEX_ROOT_ON $AttributesArr[10][2] = $INDEX_ALLOCATION_ON Return 2 EndFunc Func _UnicodeHexToStr($FileName) $str = "" For $i = 1 To StringLen($FileName) Step 4 $str &= ChrW(Dec(_SwapEndian(StringMid($FileName, $i, 4)))) Next Return $str EndFunc Func _SetArrays() $SIArrValue[0][0] = "Field name:" $SIArrValue[1][0] = "HEADER_Flags" $SIArrValue[2][0] = "CTime" $SIArrValue[3][0] = "ATime" $SIArrValue[4][0] = "MTime" $SIArrValue[5][0] = "RTime" $SIArrValue[6][0] = "DOS File Permissions" $SIArrValue[7][0] = "Max Versions" $SIArrValue[8][0] = "Version Number" $SIArrValue[9][0] = "Class ID" $SIArrValue[10][0] = "Owner ID" $SIArrValue[11][0] = "Security ID" $SIArrValue[12][0] = "USN" $FNArrValue[0][0] = "Field name" $FNArrValue[1][0] = "ParentReferenceNo" $FNArrValue[2][0] = "ParentSequenceNo" $FNArrValue[3][0] = "CTime" $FNArrValue[4][0] = "ATime" $FNArrValue[5][0] = "MTime" $FNArrValue[6][0] = "RTime" $FNArrValue[7][0] = "AllocSize" $FNArrValue[8][0] = "RealSize" $FNArrValue[9][0] = "Flags" $FNArrValue[10][0] = "NameLength" $FNArrValue[11][0] = "NameType" $FNArrValue[12][0] = "NameSpace" $FNArrValue[13][0] = "FileName" $IndxEntryNumberArr[0] = "Entry number" $IndxMFTReferenceArr[0] = "MFTReference" $IndxMFTRefSeqNoArr[0] = "MFTReference SeqNo" ; $IndxIndexFlagsArr[0] = "IndexFlags" $IndxMFTReferenceOfParentArr[0] = "Parent MFTReference" $IndxMFTParentRefSeqNoArr[0] = "Parent MFTReference SeqNo" $IndxCTimeArr[0] = "CTime" $IndxATimeArr[0] = "ATime" $IndxMTimeArr[0] = "MTime" $IndxRTimeArr[0] = "RTime" ; $IndxAllocSizeArr[0] = "AllocSize" ; $IndxRealSizeArr[0] = "RealSize" ; $IndxFileFlagsArr[0] = "File flags" $IndxFileNameArr[0] = "FileName" ; $IndxNameSpaceArr[0] = "NameSpace" ; $IndxSubNodeVCNArr[0] = "SubNodeVCN" EndFunc Func _Get_StandardInformation($MFTEntry,$SI_Offset,$SI_Number) Redim $SIArrValue[13][$SI_Number+1] Redim $SIArrOffset[13][$SI_Number+1] Redim $SIArrSize[13][$SI_Number+1] $SI_HEADER_Flags = StringMid($MFTEntry,$SI_Offset+24,4) $SI_HEADER_Flags = _SwapEndian($SI_HEADER_Flags) $SI_HEADER_Flags = _AttribHeaderFlags("0x" & $SI_HEADER_Flags) ; $SI_CTime = StringMid($MFTEntry,$SI_Offset+48,16) $SI_CTime = _SwapEndian($SI_CTime) $SI_CTime_tmp = _WinTime_UTCFileTimeToLocalFileTime("0x" & $SI_CTime) $SI_CTime = _WinTime_UTCFileTimeFormat(Dec($SI_CTime)-$tDelta,$DateTimeFormat,2) $SI_CTime = $SI_CTime & ":" & _FillZero(StringRight($SI_CTime_tmp,4)) ; $SI_ATime = StringMid($MFTEntry,$SI_Offset+64,16) $SI_ATime = _SwapEndian($SI_ATime) $SI_ATime_tmp = _WinTime_UTCFileTimeToLocalFileTime("0x" & $SI_ATime) $SI_ATime = _WinTime_UTCFileTimeFormat(Dec($SI_ATime)-$tDelta,$DateTimeFormat,2) $SI_ATime = $SI_ATime & ":" & _FillZero(StringRight($SI_ATime_tmp,4)) ; $SI_MTime = StringMid($MFTEntry,$SI_Offset+80,16) $SI_MTime = _SwapEndian($SI_MTime) $SI_MTime_tmp = _WinTime_UTCFileTimeToLocalFileTime("0x" & $SI_MTime) $SI_MTime = _WinTime_UTCFileTimeFormat(Dec($SI_MTime)-$tDelta,$DateTimeFormat,2) $SI_MTime = $SI_MTime & ":" & _FillZero(StringRight($SI_MTime_tmp,4)) ; $SI_RTime = StringMid($MFTEntry,$SI_Offset+96,16) $SI_RTime = _SwapEndian($SI_RTime) $SI_RTime_tmp = _WinTime_UTCFileTimeToLocalFileTime("0x" & $SI_RTime) $SI_RTime = _WinTime_UTCFileTimeFormat(Dec($SI_RTime)-$tDelta,$DateTimeFormat,2) $SI_RTime = $SI_RTime & ":" & _FillZero(StringRight($SI_RTime_tmp,4)) ; $SI_FilePermission = StringMid($MFTEntry,$SI_Offset+112,8) ;ConsoleWrite("$SI_FilePermission: " & $SI_FilePermission & @CRLF) $SI_FilePermission = _SwapEndian($SI_FilePermission) $SI_FilePermission = _File_Permissions("0x" & $SI_FilePermission) ;ConsoleWrite("$SI_FilePermission: " & $SI_FilePermission & @CRLF) $SI_MaxVersions = StringMid($MFTEntry,$SI_Offset+120,8) $SI_MaxVersions = Dec(_SwapEndian($SI_MaxVersions)) $SI_VersionNumber = StringMid($MFTEntry,$SI_Offset+128,8) $SI_VersionNumber = Dec(_SwapEndian($SI_VersionNumber)) $SI_ClassID = StringMid($MFTEntry,$SI_Offset+136,8) $SI_ClassID = Dec(_SwapEndian($SI_ClassID)) $SI_OwnerID = StringMid($MFTEntry,$SI_Offset+144,8) $SI_OwnerID = Dec(_SwapEndian($SI_OwnerID)) $SI_SecurityID = StringMid($MFTEntry,$SI_Offset+152,8) $SI_SecurityID = Dec(_SwapEndian($SI_SecurityID)) $SI_USN = StringMid($MFTEntry,$SI_Offset+176,16) $SI_USN = Dec(_SwapEndian($SI_USN)) If Not $IsFirstRun Then $SIArrValue[1][$SI_Number] = $SI_HEADER_Flags $SIArrValue[2][$SI_Number] = $SI_CTime $SIArrValue[3][$SI_Number] = $SI_ATime $SIArrValue[4][$SI_Number] = $SI_MTime $SIArrValue[5][$SI_Number] = $SI_RTime $SIArrValue[6][$SI_Number] = $SI_FilePermission $SIArrValue[7][$SI_Number] = $SI_MaxVersions $SIArrValue[8][$SI_Number] = $SI_VersionNumber $SIArrValue[9][$SI_Number] = $SI_ClassID $SIArrValue[10][$SI_Number] = $SI_OwnerID $SIArrValue[11][$SI_Number] = $SI_SecurityID $SIArrValue[12][$SI_Number] = $SI_USN ; _ArrayDisplay($SIArrValue,"$SIArrValue") ; $SIArrOffset[1][$SI_Number] = $SI_Offset+24 $SIArrOffset[2][$SI_Number] = $SI_Offset+48 $SIArrOffset[3][$SI_Number] = $SI_Offset+64 $SIArrOffset[4][$SI_Number] = $SI_Offset+80 $SIArrOffset[5][$SI_Number] = $SI_Offset+96 $SIArrOffset[6][$SI_Number] = $SI_Offset+112 $SIArrOffset[7][$SI_Number] = $SI_Offset+120 $SIArrOffset[8][$SI_Number] = $SI_Offset+128 $SIArrOffset[9][$SI_Number] = $SI_Offset+136 $SIArrOffset[10][$SI_Number] = $SI_Offset+144 $SIArrOffset[11][$SI_Number] = $SI_Offset+152 $SIArrOffset[12][$SI_Number] = $SI_Offset+176 ; $SIArrSize[1][$SI_Number] = 2 $SIArrSize[2][$SI_Number] = 8 $SIArrSize[3][$SI_Number] = 8 $SIArrSize[4][$SI_Number] = 8 $SIArrSize[5][$SI_Number] = 8 $SIArrSize[6][$SI_Number] = 4 $SIArrSize[7][$SI_Number] = 4 $SIArrSize[8][$SI_Number] = 4 $SIArrSize[9][$SI_Number] = 4 $SIArrSize[10][$SI_Number] = 4 $SIArrSize[11][$SI_Number] = 4 $SIArrSize[12][$SI_Number] = 8 EndIf EndFunc Func _Get_FileName($MFTEntry,$FN_Offset,$FN_Number) Redim $FNArrValue[14][$FN_Number+1] Redim $FNArrOffset[14][$FN_Number+1] $FN_ParentReferenceNo = StringMid($MFTEntry,$FN_Offset+48,12) $FN_ParentReferenceNo = Dec(_SwapEndian($FN_ParentReferenceNo)) $FN_ParentSequenceNo = StringMid($MFTEntry,$FN_Offset+60,4) $FN_ParentSequenceNo = Dec(_SwapEndian($FN_ParentSequenceNo)) ; $FN_CTime = StringMid($MFTEntry,$FN_Offset+64,16) $FN_CTime = _SwapEndian($FN_CTime) $FN_CTime_tmp = _WinTime_UTCFileTimeToLocalFileTime("0x" & $FN_CTime) $FN_CTime = _WinTime_UTCFileTimeFormat(Dec($FN_CTime)-$tDelta,$DateTimeFormat,2) $FN_CTime = $FN_CTime & ":" & _FillZero(StringRight($FN_CTime_tmp,4)) ; $FN_ATime = StringMid($MFTEntry,$FN_Offset+80,16) $FN_ATime = _SwapEndian($FN_ATime) $FN_ATime_tmp = _WinTime_UTCFileTimeToLocalFileTime("0x" & $FN_ATime) $FN_ATime = _WinTime_UTCFileTimeFormat(Dec($FN_ATime)-$tDelta,$DateTimeFormat,2) $FN_ATime = $FN_ATime & ":" & _FillZero(StringRight($FN_ATime_tmp,4)) ; $FN_MTime = StringMid($MFTEntry,$FN_Offset+96,16) $FN_MTime = _SwapEndian($FN_MTime) $FN_MTime_tmp = _WinTime_UTCFileTimeToLocalFileTime("0x" & $FN_MTime) $FN_MTime = _WinTime_UTCFileTimeFormat(Dec($FN_MTime)-$tDelta,$DateTimeFormat,2) $FN_MTime = $FN_MTime & ":" & _FillZero(StringRight($FN_MTime_tmp,4)) ; $FN_RTime = StringMid($MFTEntry,$FN_Offset+112,16) $FN_RTime = _SwapEndian($FN_RTime) $FN_RTime_tmp = _WinTime_UTCFileTimeToLocalFileTime("0x" & $FN_RTime) $FN_RTime = _WinTime_UTCFileTimeFormat(Dec($FN_RTime)-$tDelta,$DateTimeFormat,2) $FN_RTime = $FN_RTime & ":" & _FillZero(StringRight($FN_RTime_tmp,4)) ; $FN_AllocSize = StringMid($MFTEntry,$FN_Offset+128,16) $FN_AllocSize = Dec(_SwapEndian($FN_AllocSize)) $FN_RealSize = StringMid($MFTEntry,$FN_Offset+144,16) $FN_RealSize = Dec(_SwapEndian($FN_RealSize)) $FN_Flags = StringMid($MFTEntry,$FN_Offset+160,8) ;ConsoleWrite("$FN_Flags: " & $FN_Flags & @CRLF) $FN_Flags = _SwapEndian($FN_Flags) $FN_Flags = _File_Permissions("0x" & $FN_Flags) ;ConsoleWrite("$FN_Flags: " & $FN_Flags & @CRLF) $FN_NameLength = StringMid($MFTEntry,$FN_Offset+176,2) $FN_NameLength = Dec($FN_NameLength) $FN_NameType = StringMid($MFTEntry,$FN_Offset+178,2) Select Case $FN_NameType = '00' $FN_NameType = 'POSIX' Case $FN_NameType = '01' $FN_NameType = 'WIN32' Case $FN_NameType = '02' $FN_NameType = 'DOS' Case $FN_NameType = '03' $FN_NameType = 'DOS+WIN32' Case $FN_NameType <> '00' AND $FN_NameType <> '01' AND $FN_NameType <> '02' AND $FN_NameType <> '03' $FN_NameType = 'UNKNOWN' EndSelect $FN_NameSpace = $FN_NameLength-1 $FN_FileName = StringMid($MFTEntry,$FN_Offset+180,($FN_NameLength+$FN_NameSpace)*2) $FN_FileName = _UnicodeHexToStr($FN_FileName) ;If StringLen($FN_FileName) <> $FN_NameLength Then $INVALID_FILENAME = 1 If Not $IsFirstRun Then $FNArrValue[0][$FN_Number] = "FN Number " & $FN_Number $FNArrValue[1][$FN_Number] = $FN_ParentReferenceNo $FNArrValue[2][$FN_Number] = $FN_ParentSequenceNo $FNArrValue[3][$FN_Number] = $FN_CTime $FNArrValue[4][$FN_Number] = $FN_ATime $FNArrValue[5][$FN_Number] = $FN_MTime $FNArrValue[6][$FN_Number] = $FN_RTime $FNArrValue[7][$FN_Number] = $FN_AllocSize $FNArrValue[8][$FN_Number] = $FN_RealSize $FNArrValue[9][$FN_Number] = $FN_Flags $FNArrValue[10][$FN_Number] = $FN_NameLength $FNArrValue[11][$FN_Number] = $FN_NameType $FNArrValue[12][$FN_Number] = $FN_NameSpace $FNArrValue[13][$FN_Number] = $FN_FileName ; _ArrayDisplay($FNArrValue,"$FNArrValue") $FNArrOffset[0][$FN_Number] = "Internal offset" $FNArrOffset[1][$FN_Number] = $FN_Offset+48 $FNArrOffset[2][$FN_Number] = $FN_Offset+60 $FNArrOffset[3][$FN_Number] = $FN_Offset+64 $FNArrOffset[4][$FN_Number] = $FN_Offset+80 $FNArrOffset[5][$FN_Number] = $FN_Offset+96 $FNArrOffset[6][$FN_Number] = $FN_Offset+112 $FNArrOffset[7][$FN_Number] = $FN_Offset+128 $FNArrOffset[8][$FN_Number] = $FN_Offset+144 $FNArrOffset[9][$FN_Number] = $FN_Offset+160 $FNArrOffset[10][$FN_Number] = $FN_Offset+176 $FNArrOffset[11][$FN_Number] = $FN_Offset+178 $FNArrOffset[12][$FN_Number] = "" $FNArrOffset[13][$FN_Number] = $FN_Offset+180 EndIf EndFunc Func _DecodeAttrList($TargetFile, $AttrList) Local $offset, $nBytes, $hFile, $LocalName, $ALNameLength If StringMid($AttrList, 17, 2) = "00" Then ;attribute list is in $AttrList $offset = Dec(_SwapEndian(StringMid($AttrList, 41, 4))) $List = StringMid($AttrList, $offset*2+1) ; $IsolatedAttributeList = $list Else ;attribute list is found from data run in $AttrList $size = Dec(_SwapEndian(StringMid($AttrList, $offset*2 + 97, 16))) $offset = ($offset + Dec(_SwapEndian(StringMid($AttrList, $offset*2 + 65, 4))))*2 $DataRun = StringMid($AttrList, $offset+1, StringLen($AttrList)-$offset) ; ConsoleWrite("Attribute_List DataRun is " & $DataRun & @CRLF) Global $RUN_VCN[1], $RUN_Clusters[1] _ExtractDataRuns() $tBuffer = DllStructCreate("byte[" & $BytesPerCluster & "]") $hFile = _WinAPI_CreateFile($TargetDrive, 2, 6, 6) If $hFile = 0 Then ConsoleWrite("Error in function CreateFile when trying to locate Attribute List." & @CRLF) _WinAPI_CloseHandle($hFile) Return SetError(1,0,0) EndIf $List = "" For $r = 1 To Ubound($RUN_VCN)-1 _WinAPI_SetFilePointerEx($hFile, $ImageOffset+($RUN_VCN[$r]*$BytesPerCluster), $FILE_BEGIN) For $i = 1 To $RUN_Clusters[$r] _WinAPI_ReadFile($hFile, DllStructGetPtr($tBuffer), $BytesPerCluster, $nBytes) $List &= StringTrimLeft(DllStructGetData($tBuffer, 1),2) Next Next ; _DebugOut("***AttrList New:",$List) _WinAPI_CloseHandle($hFile) $List = StringMid($List, 1, $size*2) EndIf ;$IsolatedAttributeList = $list $offset=0 $str="" While StringLen($list) > $offset*2 $type=StringMid($List, ($offset*2)+1, 8) ;$ALRecordLength = Dec(_SwapEndian(StringMid($List, $offset*2 + 9, 4))) $ALNameLength = Dec(_SwapEndian(StringMid($List, $offset*2 + 13, 2))) ;$ALNameOffset = Dec(_SwapEndian(StringMid($List, $offset*2 + 15, 2))) ;$TestVCN = Dec(_SwapEndian(StringMid($List, $offset*2 + 17, 16))) $ref=Dec(_SwapEndian(StringMid($List, $offset*2 + 33, 8))) ;$LocalAttribID = "0x" & StringMid($List, $offset*2 + 49, 2) & StringMid($List, $offset*2 + 51, 2) If $ALNameLength > 0 Then $LocalName = StringMid($List, $offset*2 + 53, $ALNameLength*2*2) $LocalName = _UnicodeHexToStr($LocalName) Else $LocalName = "" EndIf If $ref <> $TargetFile Then ;new attribute If Not StringInStr($str, $ref) Then $str &= $ref & "-" EndIf If $type=$DATA Then ;$DataInAttrlist=1 ;$IsolatedData=StringMid($List, ($offset*2)+1, $ALRecordLength*2) ;If $TestVCN=0 Then $DataIsResident=1 EndIf $offset += Dec(_SwapEndian(StringMid($List, $offset*2 + 9, 4))) WEnd If $str = "" Then ConsoleWrite("No extra MFT records found" & @CRLF) Else $AttrQ = StringSplit(StringTrimRight($str,1), "-") ; ConsoleWrite("Decode of $ATTRIBUTE_LIST reveiled extra MFT Records to be examined = " & _ArrayToString($AttrQ, @CRLF) & @CRLF) EndIf EndFunc Func _FindFileMFTRecord($TargetDevice,$TargetFile) Local $nBytes, $TmpOffset, $Counter, $Counter2, $RecordJumper, $TargetFileDec, $RecordsTooMuch, $RetVal[2], $Final, $i=0 $tBuffer = DllStructCreate("byte[" & $MFT_Record_Size & "]") $hFile = _WinAPI_CreateFile($TargetDevice, 2, 6, 6) If $hFile = 0 Then ConsoleWrite("Error CreateFile in function _FindFileMFTRecord(): " & _WinAPI_GetLastErrorMessage() & " for " & $TargetDevice & @CRLF) _WinAPI_CloseHandle($hFile) Return SetError(1,0,0) EndIf $TargetFile = _DecToLittleEndian($TargetFile) $TargetFileDec = Dec(_SwapEndian($TargetFile),2) ; ConsoleWrite("$TargetFileDec: " & $TargetFileDec & @CRLF) ; ConsoleWrite("$SectorsPerCluster: " & $SectorsPerCluster & @CRLF) ; ConsoleWrite("UBound($MFT_RUN_Clusters): " & UBound($MFT_RUN_Clusters) & @CRLF) Local $RecordsDivisor = $MFT_Record_Size/512 ; ConsoleWrite("$RecordsDivisor: " & $RecordsDivisor & @CRLF) For $i = 1 To UBound($MFT_RUN_Clusters)-1 $CurrentClusters = $MFT_RUN_Clusters[$i] $RecordsInCurrentRun = ($CurrentClusters*$SectorsPerCluster)/$RecordsDivisor ; ConsoleWrite("$CurrentClusters: " & $CurrentClusters & @CRLF) ; ConsoleWrite("$RecordsInCurrentRun: " & $RecordsInCurrentRun & @CRLF) $Counter+=$RecordsInCurrentRun ; ConsoleWrite("$Counter: " & $Counter & @CRLF) If $Counter>$TargetFileDec Then ExitLoop EndIf Next ; ConsoleWrite("$i: " & $i & @CRLF) $TryAt = $Counter-$RecordsInCurrentRun ; ConsoleWrite("$TryAt: " & $TryAt & @CRLF) ;$TryAtArrIndex = $i $RecordsPerCluster = $SectorsPerCluster/$RecordsDivisor Do $RecordJumper+=$RecordsPerCluster $Counter2+=1 $Final = $TryAt+$RecordJumper Until $Final>=$TargetFileDec $RecordsTooMuch = $Final-$TargetFileDec ; ConsoleWrite("$RecordsTooMuch: " & $RecordsTooMuch & @CRLF) _WinAPI_SetFilePointerEx($hFile, $ImageOffset+($MFT_RUN_VCN[$i]*$BytesPerCluster)+($Counter2*$BytesPerCluster)-($RecordsTooMuch*$MFT_Record_Size), $FILE_BEGIN) _WinAPI_ReadFile($hFile, DllStructGetPtr($tBuffer), $MFT_Record_Size, $nBytes) $record = DllStructGetData($tBuffer, 1) ; ConsoleWrite("Record:" & @CRLF) ; ConsoleWrite(_HexEncode($record) & @CRLF) If StringMid($record,91,8) = $TargetFile Then $TmpOffset = DllCall('kernel32.dll', 'int', 'SetFilePointerEx', 'ptr', $hFile, 'int64', 0, 'int64*', 0, 'dword', 1) $FoundOffset = Int($TmpOffset[3])-Int($MFT_Record_Size) ; ConsoleWrite("Record number: " & Dec(_SwapEndian($TargetFile),2) & " found at volume offset: 0x" & Hex($FoundOffset) & @CRLF) _WinAPI_CloseHandle($hFile) $RetVal[0] = $FoundOffset $RetVal[1] = $record Return $RetVal Else _WinAPI_CloseHandle($hFile) Return "" EndIf EndFunc Func _StripMftRecord($MFTEntry) Local $UpdSeqArrPart0, $UpdSeqArrPart1, $UpdSeqArrPart2, $RecordEnd1, $RecordEnd2 $UpdSeqArrOffset = Dec(_SwapEndian(StringMid($MFTEntry,11,4))) $UpdSeqArrSize = Dec(_SwapEndian(StringMid($MFTEntry,15,4))) $UpdSeqArr = StringMid($MFTEntry,3+($UpdSeqArrOffset*2),$UpdSeqArrSize*2*2) If $MFT_Record_Size = 1024 Then $UpdSeqArrPart0 = StringMid($UpdSeqArr,1,4) $UpdSeqArrPart1 = StringMid($UpdSeqArr,5,4) $UpdSeqArrPart2 = StringMid($UpdSeqArr,9,4) $RecordEnd1 = StringMid($MFTEntry,1023,4) $RecordEnd2 = StringMid($MFTEntry,2047,4) If $UpdSeqArrPart0 <> $RecordEnd1 OR $UpdSeqArrPart0 <> $RecordEnd2 Then ; _DebugOut("The record failed Fixup", $MFTEntry) ConsoleWrite("The record failed Fixup:" & @CRLF) ConsoleWrite(_HexEncode($MFTEntry) & @CRLF) Return "" EndIf $MFTEntry = StringMid($MFTEntry,1,1022) & $UpdSeqArrPart1 & StringMid($MFTEntry,1027,1020) & $UpdSeqArrPart2 ElseIf $MFT_Record_Size = 4096 Then $UpdSeqArrPart0 = StringMid($UpdSeqArr,1,4) $UpdSeqArrPart1 = StringMid($UpdSeqArr,5,4) $UpdSeqArrPart2 = StringMid($UpdSeqArr,9,4) Local $UpdSeqArrPart3 = StringMid($UpdSeqArr,13,4) Local $UpdSeqArrPart4 = StringMid($UpdSeqArr,17,4) Local $UpdSeqArrPart5 = StringMid($UpdSeqArr,21,4) Local $UpdSeqArrPart6 = StringMid($UpdSeqArr,25,4) Local $UpdSeqArrPart7 = StringMid($UpdSeqArr,29,4) Local $UpdSeqArrPart8 = StringMid($UpdSeqArr,33,4) $RecordEnd1 = StringMid($MFTEntry,1023,4) $RecordEnd2 = StringMid($MFTEntry,2047,4) Local $RecordEnd3 = StringMid($MFTEntry,3071,4) Local $RecordEnd4 = StringMid($MFTEntry,4095,4) Local $RecordEnd5 = StringMid($MFTEntry,5119,4) Local $RecordEnd6 = StringMid($MFTEntry,6143,4) Local $RecordEnd7 = StringMid($MFTEntry,7167,4) Local $RecordEnd8 = StringMid($MFTEntry,8191,4) If $UpdSeqArrPart0 <> $RecordEnd1 OR $UpdSeqArrPart0 <> $RecordEnd2 OR $UpdSeqArrPart0 <> $RecordEnd3 OR $UpdSeqArrPart0 <> $RecordEnd4 OR $UpdSeqArrPart0 <> $RecordEnd5 OR $UpdSeqArrPart0 <> $RecordEnd6 OR $UpdSeqArrPart0 <> $RecordEnd7 OR $UpdSeqArrPart0 <> $RecordEnd8 Then ; _DebugOut("The record failed Fixup", $MFTEntry) ConsoleWrite("The record failed Fixup:" & @CRLF) ConsoleWrite(_HexEncode($MFTEntry) & @CRLF) Return "" Else $MFTEntry = StringMid($MFTEntry,1,1022) & $UpdSeqArrPart1 & StringMid($MFTEntry,1027,1020) & $UpdSeqArrPart2 & StringMid($MFTEntry,2051,1020) & $UpdSeqArrPart3 & StringMid($MFTEntry,3075,1020) & $UpdSeqArrPart4 & StringMid($MFTEntry,4099,1020) & $UpdSeqArrPart5 & StringMid($MFTEntry,5123,1020) & $UpdSeqArrPart6 & StringMid($MFTEntry,6147,1020) & $UpdSeqArrPart7 & StringMid($MFTEntry,7171,1020) & $UpdSeqArrPart8 EndIf EndIf $RecordSize = Dec(_SwapEndian(StringMid($MFTEntry,51,8)),2) $HeaderSize = Dec(_SwapEndian(StringMid($MFTEntry,43,4)),2) $MFTEntry = StringMid($MFTEntry,$HeaderSize*2+3,($RecordSize-$HeaderSize-8)*2) ;strip "0x..." and "FFFFFFFF..." Return $MFTEntry EndFunc Func _GetAttributeEntry($TargetDevice,$Entry) Local $CoreAttribute,$CoreAttributeTmp,$CoreAttributeArr[2],$TestArray,$Bytes Local $ATTRIBUTE_HEADER_Length,$ATTRIBUTE_HEADER_NonResidentFlag,$ATTRIBUTE_HEADER_NameLength,$ATTRIBUTE_HEADER_NameRelativeOffset,$ATTRIBUTE_HEADER_Name,$ATTRIBUTE_HEADER_Flags,$ATTRIBUTE_HEADER_AttributeID,$ATTRIBUTE_HEADER_StartVCN,$ATTRIBUTE_HEADER_LastVCN Local $ATTRIBUTE_HEADER_OffsetToDataRuns,$ATTRIBUTE_HEADER_CompressionUnitSize,$ATTRIBUTE_HEADER_Padding,$ATTRIBUTE_HEADER_AllocatedSize,$ATTRIBUTE_HEADER_RealSize,$ATTRIBUTE_HEADER_InitializedStreamSize,$RunListOffset Local $ATTRIBUTE_HEADER_LengthOfAttribute,$ATTRIBUTE_HEADER_OffsetToAttribute If $IsCurrentIndxOfParent Then Global $RawOffsetIndxArray $ATTRIBUTE_HEADER_Length = StringMid($Entry,9,8) $ATTRIBUTE_HEADER_Length = Dec(StringMid($ATTRIBUTE_HEADER_Length,7,2) & StringMid($ATTRIBUTE_HEADER_Length,5,2) & StringMid($ATTRIBUTE_HEADER_Length,3,2) & StringMid($ATTRIBUTE_HEADER_Length,1,2)) $ATTRIBUTE_HEADER_NonResidentFlag = StringMid($Entry,17,2) ; ConsoleWrite("$ATTRIBUTE_HEADER_NonResidentFlag = " & $ATTRIBUTE_HEADER_NonResidentFlag & @crlf) $ATTRIBUTE_HEADER_NameLength = Dec(StringMid($Entry,19,2)) ; ConsoleWrite("$ATTRIBUTE_HEADER_NameLength = " & $ATTRIBUTE_HEADER_NameLength & @crlf) $ATTRIBUTE_HEADER_NameRelativeOffset = StringMid($Entry,21,4) ; ConsoleWrite("$ATTRIBUTE_HEADER_NameRelativeOffset = " & $ATTRIBUTE_HEADER_NameRelativeOffset & @crlf) $ATTRIBUTE_HEADER_NameRelativeOffset = Dec(_SwapEndian($ATTRIBUTE_HEADER_NameRelativeOffset)) ; ConsoleWrite("$ATTRIBUTE_HEADER_NameRelativeOffset = " & $ATTRIBUTE_HEADER_NameRelativeOffset & @crlf) If $ATTRIBUTE_HEADER_NameLength > 0 Then $ATTRIBUTE_HEADER_Name = _UnicodeHexToStr(StringMid($Entry,$ATTRIBUTE_HEADER_NameRelativeOffset*2 + 1,$ATTRIBUTE_HEADER_NameLength*4)) Else $ATTRIBUTE_HEADER_Name = "" EndIf $ATTRIBUTE_HEADER_Flags = _SwapEndian(StringMid($Entry,25,4)) ; ConsoleWrite("$ATTRIBUTE_HEADER_Flags = " & $ATTRIBUTE_HEADER_Flags & @crlf) $Flags = "" If $ATTRIBUTE_HEADER_Flags = "0000" Then $Flags = "NORMAL" Else If BitAND($ATTRIBUTE_HEADER_Flags,"0001") Then $IsCompressed = 1 $Flags &= "COMPRESSED+" EndIf If BitAND($ATTRIBUTE_HEADER_Flags,"4000") Then ;$IsEncrypted = 1 $Flags &= "ENCRYPTED+" EndIf If BitAND($ATTRIBUTE_HEADER_Flags,"8000") Then ;$IsSparse = 1 $Flags &= "SPARSE+" EndIf $Flags = StringTrimRight($Flags,1) EndIf ; ConsoleWrite("File is " & $Flags & @CRLF) $ATTRIBUTE_HEADER_AttributeID = StringMid($Entry,29,4) $ATTRIBUTE_HEADER_AttributeID = StringMid($ATTRIBUTE_HEADER_AttributeID,3,2) & StringMid($ATTRIBUTE_HEADER_AttributeID,1,2) If $ATTRIBUTE_HEADER_NonResidentFlag = '01' Then $ATTRIBUTE_HEADER_StartVCN = StringMid($Entry,33,16) ; ConsoleWrite("$ATTRIBUTE_HEADER_StartVCN = " & $ATTRIBUTE_HEADER_StartVCN & @crlf) $ATTRIBUTE_HEADER_StartVCN = Dec(_SwapEndian($ATTRIBUTE_HEADER_StartVCN),2) ; ConsoleWrite("$ATTRIBUTE_HEADER_StartVCN = " & $ATTRIBUTE_HEADER_StartVCN & @crlf) $ATTRIBUTE_HEADER_LastVCN = StringMid($Entry,49,16) ; ConsoleWrite("$ATTRIBUTE_HEADER_LastVCN = " & $ATTRIBUTE_HEADER_LastVCN & @crlf) $ATTRIBUTE_HEADER_LastVCN = Dec(_SwapEndian($ATTRIBUTE_HEADER_LastVCN),2) ; ConsoleWrite("$ATTRIBUTE_HEADER_LastVCN = " & $ATTRIBUTE_HEADER_LastVCN & @crlf) ;$ATTRIBUTE_HEADER_VCNs = $ATTRIBUTE_HEADER_LastVCN - $ATTRIBUTE_HEADER_StartVCN ; ConsoleWrite("$ATTRIBUTE_HEADER_VCNs = " & $ATTRIBUTE_HEADER_VCNs & @crlf) $ATTRIBUTE_HEADER_OffsetToDataRuns = StringMid($Entry,65,4) $ATTRIBUTE_HEADER_OffsetToDataRuns = Dec(StringMid($ATTRIBUTE_HEADER_OffsetToDataRuns,3,1) & StringMid($ATTRIBUTE_HEADER_OffsetToDataRuns,3,1)) $ATTRIBUTE_HEADER_CompressionUnitSize = Dec(_SwapEndian(StringMid($Entry,69,4))) ; ConsoleWrite("$ATTRIBUTE_HEADER_CompressionUnitSize = " & $ATTRIBUTE_HEADER_CompressionUnitSize & @crlf) $IsCompressed = 0 If $ATTRIBUTE_HEADER_CompressionUnitSize = 4 Then $IsCompressed = 1 $ATTRIBUTE_HEADER_Padding = StringMid($Entry,73,8) $ATTRIBUTE_HEADER_Padding = StringMid($ATTRIBUTE_HEADER_Padding,7,2) & StringMid($ATTRIBUTE_HEADER_Padding,5,2) & StringMid($ATTRIBUTE_HEADER_Padding,3,2) & StringMid($ATTRIBUTE_HEADER_Padding,1,2) $ATTRIBUTE_HEADER_AllocatedSize = StringMid($Entry,81,16) ; ConsoleWrite("$ATTRIBUTE_HEADER_AllocatedSize = " & $ATTRIBUTE_HEADER_AllocatedSize & @crlf) $ATTRIBUTE_HEADER_AllocatedSize = Dec(_SwapEndian($ATTRIBUTE_HEADER_AllocatedSize),2) ; ConsoleWrite("$ATTRIBUTE_HEADER_AllocatedSize = " & $ATTRIBUTE_HEADER_AllocatedSize & @crlf) $ATTRIBUTE_HEADER_RealSize = StringMid($Entry,97,16) ; ConsoleWrite("$ATTRIBUTE_HEADER_RealSize = " & $ATTRIBUTE_HEADER_RealSize & @crlf) $ATTRIBUTE_HEADER_RealSize = Dec(_SwapEndian($ATTRIBUTE_HEADER_RealSize),2) ; ConsoleWrite("$ATTRIBUTE_HEADER_RealSize = " & $ATTRIBUTE_HEADER_RealSize & @crlf) $ATTRIBUTE_HEADER_InitializedStreamSize = StringMid($Entry,113,16) ; ConsoleWrite("$ATTRIBUTE_HEADER_InitializedStreamSize = " & $ATTRIBUTE_HEADER_InitializedStreamSize & @crlf) $ATTRIBUTE_HEADER_InitializedStreamSize = Dec(_SwapEndian($ATTRIBUTE_HEADER_InitializedStreamSize),2) ; ConsoleWrite("$ATTRIBUTE_HEADER_InitializedStreamSize = " & $ATTRIBUTE_HEADER_InitializedStreamSize & @crlf) $RunListOffset = StringMid($Entry,65,4) ; ConsoleWrite("$RunListOffset = " & $RunListOffset & @crlf) $RunListOffset = Dec(_SwapEndian($RunListOffset)) ; ConsoleWrite("$RunListOffset = " & $RunListOffset & @crlf) If $IsCompressed AND $RunListOffset = 72 Then $ATTRIBUTE_HEADER_CompressedSize = StringMid($Entry,129,16) $ATTRIBUTE_HEADER_CompressedSize = Dec(_SwapEndian($ATTRIBUTE_HEADER_CompressedSize),2) EndIf $DataRun = StringMid($Entry,$RunListOffset*2+1,(StringLen($Entry)-$RunListOffset)*2) ; ConsoleWrite("$DataRun = " & $DataRun & @crlf) ElseIf $ATTRIBUTE_HEADER_NonResidentFlag = '00' Then $ATTRIBUTE_HEADER_LengthOfAttribute = StringMid($Entry,33,8) ; ConsoleWrite("$ATTRIBUTE_HEADER_LengthOfAttribute = " & $ATTRIBUTE_HEADER_LengthOfAttribute & @crlf) $ATTRIBUTE_HEADER_LengthOfAttribute = Dec(_SwapEndian($ATTRIBUTE_HEADER_LengthOfAttribute),2) ; ConsoleWrite("$ATTRIBUTE_HEADER_LengthOfAttribute = " & $ATTRIBUTE_HEADER_LengthOfAttribute & @crlf) ; $ATTRIBUTE_HEADER_OffsetToAttribute = StringMid($Entry,41,4) ; $ATTRIBUTE_HEADER_OffsetToAttribute = Dec(StringMid($ATTRIBUTE_HEADER_OffsetToAttribute,3,2) & StringMid($ATTRIBUTE_HEADER_OffsetToAttribute,1,2)) $ATTRIBUTE_HEADER_OffsetToAttribute = Dec(_SwapEndian(StringMid($Entry,41,4))) ; ConsoleWrite("$ATTRIBUTE_HEADER_OffsetToAttribute = " & $ATTRIBUTE_HEADER_OffsetToAttribute & @crlf) ;$ATTRIBUTE_HEADER_IndexedFlag = Dec(StringMid($Entry,45,2)) $ATTRIBUTE_HEADER_Padding = StringMid($Entry,47,2) $DataRun = StringMid($Entry,$ATTRIBUTE_HEADER_OffsetToAttribute*2+1,$ATTRIBUTE_HEADER_LengthOfAttribute*2) ; ConsoleWrite("$DataRun = " & $DataRun & @crlf) EndIf ; Possible continuation ; For $i = 1 To UBound($DataQ) - 1 For $i = 1 To 1 ; _DecodeDataQEntry($DataQ[$i]) If $ATTRIBUTE_HEADER_NonResidentFlag = '00' Then ;_ExtractResidentFile($DATA_Name, $DATA_LengthOfAttribute) $CoreAttribute = $DataRun Else Global $RUN_VCN[1], $RUN_Clusters[1] $TotalClusters = $ATTRIBUTE_HEADER_LastVCN - $ATTRIBUTE_HEADER_StartVCN + 1 $Size = $ATTRIBUTE_HEADER_RealSize ;_ExtractDataRuns() $r=UBound($RUN_Clusters) $i=1 $RUN_VCN[0] = 0 $BaseVCN = $RUN_VCN[0] If $DataRun = "" Then $DataRun = "00" Do $RunListID = StringMid($DataRun,$i,2) If $RunListID = "00" Then ExitLoop ; ConsoleWrite("$RunListID = " & $RunListID & @crlf) $i += 2 $RunListClustersLength = Dec(StringMid($RunListID,2,1)) ; ConsoleWrite("$RunListClustersLength = " & $RunListClustersLength & @crlf) $RunListVCNLength = Dec(StringMid($RunListID,1,1)) ; ConsoleWrite("$RunListVCNLength = " & $RunListVCNLength & @crlf) $RunListClusters = Dec(_SwapEndian(StringMid($DataRun,$i,$RunListClustersLength*2)),2) ; ConsoleWrite("$RunListClusters = " & $RunListClusters & @crlf) $i += $RunListClustersLength*2 $RunListVCN = _SwapEndian(StringMid($DataRun, $i, $RunListVCNLength*2)) ;next line handles positive or negative move $BaseVCN += Dec($RunListVCN,2)-(($r>1) And (Dec(StringMid($RunListVCN,1,1))>7))*Dec(StringMid("10000000000000000",1,$RunListVCNLength*2+1),2) If $RunListVCN <> "" Then $RunListVCN = $BaseVCN Else $RunListVCN = 0 ;$RUN_VCN[$r-1] ;0 EndIf ; ConsoleWrite("$RunListVCN = " & $RunListVCN & @crlf) If (($RunListVCN=0) And ($RunListClusters>16) And (Mod($RunListClusters,16)>0)) Then ;If (($RunListVCN=$RUN_VCN[$r-1]) And ($RunListClusters>16) And (Mod($RunListClusters,16)>0)) Then ;may be sparse section at end of Compression Signature _ArrayAdd($RUN_Clusters,Mod($RunListClusters,16)) _ArrayAdd($RUN_VCN,$RunListVCN) $RunListClusters -= Mod($RunListClusters,16) $r += 1 ElseIf (($RunListClusters>16) And (Mod($RunListClusters,16)>0)) Then ;may be compressed data section at start of Compression Signature _ArrayAdd($RUN_Clusters,$RunListClusters-Mod($RunListClusters,16)) _ArrayAdd($RUN_VCN,$RunListVCN) $RunListVCN += $RUN_Clusters[$r] $RunListClusters = Mod($RunListClusters,16) $r += 1 EndIf ;just normal or sparse data _ArrayAdd($RUN_Clusters,$RunListClusters) _ArrayAdd($RUN_VCN,$RunListVCN) $r += 1 $i += $RunListVCNLength*2 Until $i > StringLen($DataRun) ;--------------------------------_ExtractDataRuns() ; _ArrayDisplay($RUN_Clusters,"$RUN_Clusters") ; _ArrayDisplay($RUN_VCN,"$RUN_VCN") If $TotalClusters * $BytesPerCluster >= $Size Then ; ConsoleWrite(_ArrayToString($RUN_VCN) & @CRLF) ; ConsoleWrite(_ArrayToString($RUN_Clusters) & @CRLF) ;ExtractFile Local $nBytes $hFile = _WinAPI_CreateFile($TargetDevice, 2, 6, 6) If $hFile = 0 Then ConsoleWrite("Error CreateFile in function _GetAttributeEntry()." & @CRLF) _WinAPI_CloseHandle($hFile) Return EndIf $tBuffer = DllStructCreate("byte[" & $BytesPerCluster * 16 & "]") Select Case UBound($RUN_VCN) = 1 ;no data, do nothing Case (UBound($RUN_VCN) = 2) Or (Not $IsCompressed) ;may be normal or sparse If $RUN_VCN[1] = $RUN_VCN[0] And $DATA_Name <> "$Boot" Then ;sparse, unless $Boot ; _DoSparse($htest) ConsoleWrite("Error: Sparse attributes not supported!!!" & @CRLF) Else ;normal ; _DoNormalAttribute($hFile, $tBuffer) ; Local $nBytes $FileSize = $ATTRIBUTE_HEADER_RealSize Local $TestArray[UBound($RUN_VCN)][4] $TestArray[0][0] = "Offset" $TestArray[0][1] = "Bytes Accumulated" $TestArray[0][2] = "Bytes per Run" $TestArray[0][3] = "Sectors per Run" For $s = 1 To UBound($RUN_VCN)-1 ;An attempt at preparing for INDX modification $TestArray[$s][0] = $RUN_VCN[$s]*$BytesPerCluster _WinAPI_SetFilePointerEx($hFile, $ImageOffset+($RUN_VCN[$s]*$BytesPerCluster), $FILE_BEGIN) $g = $RUN_Clusters[$s] While $g > 16 And $FileSize > $BytesPerCluster * 16 $Bytes += $BytesPerCluster * 16 ;Did this impact negatively?? _WinAPI_ReadFile($hFile, DllStructGetPtr($tBuffer), $BytesPerCluster * 16, $nBytes) ; _WinAPI_WriteFile($htest, DllStructGetPtr($tBuffer), $BytesPerCluster * 16, $nBytes) $g -= 16 $FileSize -= $BytesPerCluster * 16 $CoreAttributeTmp = StringMid(DllStructGetData($tBuffer,1),3,$BytesPerCluster*16*2) $CoreAttribute &= $CoreAttributeTmp WEnd If $g <> 0 Then $Bytes += $BytesPerCluster * $g ;Did this impact negatively?? _WinAPI_ReadFile($hFile, DllStructGetPtr($tBuffer), $BytesPerCluster * $g, $nBytes) ; $CoreAttributeTmp = StringMid(DllStructGetData($tBuffer,1),3) ; $CoreAttribute &= $CoreAttributeTmp If $FileSize > $BytesPerCluster * $g Then ; _WinAPI_WriteFile($htest, DllStructGetPtr($tBuffer), $BytesPerCluster * $g, $nBytes) $FileSize -= $BytesPerCluster * $g $CoreAttributeTmp = StringMid(DllStructGetData($tBuffer,1),3,$BytesPerCluster*$g*2) $CoreAttribute &= $CoreAttributeTmp Else ; _WinAPI_WriteFile($htest, DllStructGetPtr($tBuffer), $FileSize, $nBytes) ; Return $CoreAttributeTmp = StringMid(DllStructGetData($tBuffer,1),3,$FileSize*2) $CoreAttribute &= $CoreAttributeTmp EndIf EndIf ;An attempt at preparing for INDX modification $TestArray[$s][1] = $Bytes Next ;------------------_DoNormalAttribute() EndIf Case Else ;may be compressed ; _DoCompressed($hFile, $htest, $tBuffer) ConsoleWrite("Error: Compressed attributes not supported!!!" & @CRLF) EndSelect ;------------------------ExtractFile EndIf ;------------------------- EndIf Next $CoreAttributeArr[0] = $CoreAttribute $CoreAttributeArr[1] = $ATTRIBUTE_HEADER_Name If $IsCurrentIndxOfParent And $ATTRIBUTE_HEADER_Name = "$I30" Then ;Generate the offset array for the INDX of the parent, if required $RawOffsetIndxArray = $TestArray For $i = 1 To UBound($RawOffsetIndxArray)-1 If $i = 1 Then $RawOffsetIndxArray[$i][2] = $RawOffsetIndxArray[$i][1] Else $RawOffsetIndxArray[$i][2] = $RawOffsetIndxArray[$i][1] - $RawOffsetIndxArray[$i-1][1] EndIf $RawOffsetIndxArray[$i][3] = $RawOffsetIndxArray[$i][2]/512 Next ; _ArrayDisplay($RawOffsetIndxArray,"$RawOffsetIndxArray") $IsCurrentIndxOfParent=0 $DoIndxOffsetArray=0 EndIf Return $CoreAttributeArr EndFunc Func _GetAttributeEntryNoRead($TargetDevice,$Entry) ; ConsoleWrite("_GetAttributeEntryNoRead()" & @crlf) Local $CoreAttribute,$CoreAttributeArr[2],$TestArray,$Bytes Local $ATTRIBUTE_HEADER_Length,$ATTRIBUTE_HEADER_NonResidentFlag,$ATTRIBUTE_HEADER_NameLength,$ATTRIBUTE_HEADER_NameRelativeOffset,$ATTRIBUTE_HEADER_Name,$ATTRIBUTE_HEADER_Flags,$ATTRIBUTE_HEADER_AttributeID,$ATTRIBUTE_HEADER_StartVCN,$ATTRIBUTE_HEADER_LastVCN Local $ATTRIBUTE_HEADER_OffsetToDataRuns,$ATTRIBUTE_HEADER_Padding,$ATTRIBUTE_HEADER_AllocatedSize,$ATTRIBUTE_HEADER_RealSize,$ATTRIBUTE_HEADER_InitializedStreamSize,$RunListOffset Local $ATTRIBUTE_HEADER_LengthOfAttribute,$ATTRIBUTE_HEADER_OffsetToAttribute ;Global $RawTestOffsetArray $ATTRIBUTE_HEADER_Length = StringMid($Entry,9,8) $ATTRIBUTE_HEADER_Length = Dec(StringMid($ATTRIBUTE_HEADER_Length,7,2) & StringMid($ATTRIBUTE_HEADER_Length,5,2) & StringMid($ATTRIBUTE_HEADER_Length,3,2) & StringMid($ATTRIBUTE_HEADER_Length,1,2)) $ATTRIBUTE_HEADER_NonResidentFlag = StringMid($Entry,17,2) ; ConsoleWrite("$ATTRIBUTE_HEADER_NonResidentFlag = " & $ATTRIBUTE_HEADER_NonResidentFlag & @crlf) $ATTRIBUTE_HEADER_NameLength = Dec(StringMid($Entry,19,2)) ; ConsoleWrite("$ATTRIBUTE_HEADER_NameLength = " & $ATTRIBUTE_HEADER_NameLength & @crlf) $ATTRIBUTE_HEADER_NameRelativeOffset = StringMid($Entry,21,4) ; ConsoleWrite("$ATTRIBUTE_HEADER_NameRelativeOffset = " & $ATTRIBUTE_HEADER_NameRelativeOffset & @crlf) $ATTRIBUTE_HEADER_NameRelativeOffset = Dec(_SwapEndian($ATTRIBUTE_HEADER_NameRelativeOffset)) ; ConsoleWrite("$ATTRIBUTE_HEADER_NameRelativeOffset = " & $ATTRIBUTE_HEADER_NameRelativeOffset & @crlf) If $ATTRIBUTE_HEADER_NameLength > 0 Then $ATTRIBUTE_HEADER_Name = _UnicodeHexToStr(StringMid($Entry,$ATTRIBUTE_HEADER_NameRelativeOffset*2 + 1,$ATTRIBUTE_HEADER_NameLength*4)) Else $ATTRIBUTE_HEADER_Name = "" EndIf $ATTRIBUTE_HEADER_Flags = _SwapEndian(StringMid($Entry,25,4)) ; ConsoleWrite("$ATTRIBUTE_HEADER_Flags = " & $ATTRIBUTE_HEADER_Flags & @crlf) $Flags = "" If $ATTRIBUTE_HEADER_Flags = "0000" Then $Flags = "NORMAL" Else If BitAND($ATTRIBUTE_HEADER_Flags,"0001") Then $IsCompressed = 1 $Flags &= "COMPRESSED+" EndIf If BitAND($ATTRIBUTE_HEADER_Flags,"4000") Then ;$IsEncrypted = 1 $Flags &= "ENCRYPTED+" EndIf If BitAND($ATTRIBUTE_HEADER_Flags,"8000") Then ;$IsSparse = 1 $Flags &= "SPARSE+" EndIf $Flags = StringTrimRight($Flags,1) EndIf ; ConsoleWrite("File is " & $Flags & @CRLF) $ATTRIBUTE_HEADER_AttributeID = StringMid($Entry,29,4) $ATTRIBUTE_HEADER_AttributeID = StringMid($ATTRIBUTE_HEADER_AttributeID,3,2) & StringMid($ATTRIBUTE_HEADER_AttributeID,1,2) If $ATTRIBUTE_HEADER_NonResidentFlag = '01' Then $ATTRIBUTE_HEADER_StartVCN = StringMid($Entry,33,16) ; ConsoleWrite("$ATTRIBUTE_HEADER_StartVCN = " & $ATTRIBUTE_HEADER_StartVCN & @crlf) $ATTRIBUTE_HEADER_StartVCN = Dec(_SwapEndian($ATTRIBUTE_HEADER_StartVCN),2) ; ConsoleWrite("$ATTRIBUTE_HEADER_StartVCN = " & $ATTRIBUTE_HEADER_StartVCN & @crlf) $ATTRIBUTE_HEADER_LastVCN = StringMid($Entry,49,16) ; ConsoleWrite("$ATTRIBUTE_HEADER_LastVCN = " & $ATTRIBUTE_HEADER_LastVCN & @crlf) $ATTRIBUTE_HEADER_LastVCN = Dec(_SwapEndian($ATTRIBUTE_HEADER_LastVCN),2) ; ConsoleWrite("$ATTRIBUTE_HEADER_LastVCN = " & $ATTRIBUTE_HEADER_LastVCN & @crlf) ;$ATTRIBUTE_HEADER_VCNs = $ATTRIBUTE_HEADER_LastVCN - $ATTRIBUTE_HEADER_StartVCN ; ConsoleWrite("$ATTRIBUTE_HEADER_VCNs = " & $ATTRIBUTE_HEADER_VCNs & @crlf) $ATTRIBUTE_HEADER_OffsetToDataRuns = StringMid($Entry,65,4) $ATTRIBUTE_HEADER_OffsetToDataRuns = Dec(StringMid($ATTRIBUTE_HEADER_OffsetToDataRuns,3,1) & StringMid($ATTRIBUTE_HEADER_OffsetToDataRuns,3,1)) ;$ATTRIBUTE_HEADER_CompressionUnitSize = Dec(_SwapEndian(StringMid($Entry,69,4))) ; ConsoleWrite("$ATTRIBUTE_HEADER_CompressionUnitSize = " & $ATTRIBUTE_HEADER_CompressionUnitSize & @crlf) $IsCompressed = 0 ; If $ATTRIBUTE_HEADER_CompressionUnitSize = 4 Then $IsCompressed = 1 $ATTRIBUTE_HEADER_Padding = StringMid($Entry,73,8) $ATTRIBUTE_HEADER_Padding = StringMid($ATTRIBUTE_HEADER_Padding,7,2) & StringMid($ATTRIBUTE_HEADER_Padding,5,2) & StringMid($ATTRIBUTE_HEADER_Padding,3,2) & StringMid($ATTRIBUTE_HEADER_Padding,1,2) $ATTRIBUTE_HEADER_AllocatedSize = StringMid($Entry,81,16) ; ConsoleWrite("$ATTRIBUTE_HEADER_AllocatedSize = " & $ATTRIBUTE_HEADER_AllocatedSize & @crlf) $ATTRIBUTE_HEADER_AllocatedSize = Dec(_SwapEndian($ATTRIBUTE_HEADER_AllocatedSize),2) ; ConsoleWrite("$ATTRIBUTE_HEADER_AllocatedSize = " & $ATTRIBUTE_HEADER_AllocatedSize & @crlf) $ATTRIBUTE_HEADER_RealSize = StringMid($Entry,97,16) ; ConsoleWrite("$ATTRIBUTE_HEADER_RealSize = " & $ATTRIBUTE_HEADER_RealSize & @crlf) $ATTRIBUTE_HEADER_RealSize = Dec(_SwapEndian($ATTRIBUTE_HEADER_RealSize),2) ; ConsoleWrite("$ATTRIBUTE_HEADER_RealSize = " & $ATTRIBUTE_HEADER_RealSize & @crlf) $ATTRIBUTE_HEADER_InitializedStreamSize = StringMid($Entry,113,16) ; ConsoleWrite("$ATTRIBUTE_HEADER_InitializedStreamSize = " & $ATTRIBUTE_HEADER_InitializedStreamSize & @crlf) $ATTRIBUTE_HEADER_InitializedStreamSize = Dec(_SwapEndian($ATTRIBUTE_HEADER_InitializedStreamSize),2) ; ConsoleWrite("$ATTRIBUTE_HEADER_InitializedStreamSize = " & $ATTRIBUTE_HEADER_InitializedStreamSize & @crlf) $RunListOffset = StringMid($Entry,65,4) ; ConsoleWrite("$RunListOffset = " & $RunListOffset & @crlf) $RunListOffset = Dec(_SwapEndian($RunListOffset)) ; ConsoleWrite("$RunListOffset = " & $RunListOffset & @crlf) If $IsCompressed AND $RunListOffset = 72 Then $ATTRIBUTE_HEADER_CompressedSize = StringMid($Entry,129,16) $ATTRIBUTE_HEADER_CompressedSize = Dec(_SwapEndian($ATTRIBUTE_HEADER_CompressedSize),2) EndIf $DataRun = StringMid($Entry,$RunListOffset*2+1,(StringLen($Entry)-$RunListOffset)*2) ; ConsoleWrite("$DataRun = " & $DataRun & @crlf) ElseIf $ATTRIBUTE_HEADER_NonResidentFlag = '00' Then $ATTRIBUTE_HEADER_LengthOfAttribute = StringMid($Entry,33,8) ; ConsoleWrite("$ATTRIBUTE_HEADER_LengthOfAttribute = " & $ATTRIBUTE_HEADER_LengthOfAttribute & @crlf) $ATTRIBUTE_HEADER_LengthOfAttribute = Dec(_SwapEndian($ATTRIBUTE_HEADER_LengthOfAttribute),2) ; ConsoleWrite("$ATTRIBUTE_HEADER_LengthOfAttribute = " & $ATTRIBUTE_HEADER_LengthOfAttribute & @crlf) ; $ATTRIBUTE_HEADER_OffsetToAttribute = StringMid($Entry,41,4) ; $ATTRIBUTE_HEADER_OffsetToAttribute = Dec(StringMid($ATTRIBUTE_HEADER_OffsetToAttribute,3,2) & StringMid($ATTRIBUTE_HEADER_OffsetToAttribute,1,2)) $ATTRIBUTE_HEADER_OffsetToAttribute = Dec(_SwapEndian(StringMid($Entry,41,4))) ; ConsoleWrite("$ATTRIBUTE_HEADER_OffsetToAttribute = " & $ATTRIBUTE_HEADER_OffsetToAttribute & @crlf) ;$ATTRIBUTE_HEADER_IndexedFlag = Dec(StringMid($Entry,45,2)) $ATTRIBUTE_HEADER_Padding = StringMid($Entry,47,2) $DataRun = StringMid($Entry,$ATTRIBUTE_HEADER_OffsetToAttribute*2+1,$ATTRIBUTE_HEADER_LengthOfAttribute*2) ; ConsoleWrite("$DataRun = " & $DataRun & @crlf) EndIf $CoreAttributeArr[1] = $ATTRIBUTE_HEADER_Name If $ATTRIBUTE_HEADER_Name <> "$J" Then Return $CoreAttributeArr If $ATTRIBUTE_HEADER_RealSize <> 0 Then $GlobUsnJrnlFileSize = $ATTRIBUTE_HEADER_RealSize ; Possible continuation ; For $i = 1 To UBound($DataQ) - 1 For $i = 1 To 1 ; _DecodeDataQEntry($DataQ[$i]) If $ATTRIBUTE_HEADER_NonResidentFlag = '00' Then ;_ExtractResidentFile($DATA_Name, $DATA_LengthOfAttribute) $CoreAttribute = $DataRun Else Global $RUN_VCN[1], $RUN_Clusters[1] $TotalClusters = $ATTRIBUTE_HEADER_LastVCN - $ATTRIBUTE_HEADER_StartVCN + 1 $Size = $ATTRIBUTE_HEADER_RealSize ;_ExtractDataRuns() $r=UBound($RUN_Clusters) $i=1 $RUN_VCN[0] = 0 $BaseVCN = $RUN_VCN[0] If $DataRun = "" Then $DataRun = "00" Do $RunListID = StringMid($DataRun,$i,2) If $RunListID = "00" Then ExitLoop ; ConsoleWrite("$RunListID = " & $RunListID & @crlf) $i += 2 $RunListClustersLength = Dec(StringMid($RunListID,2,1)) ; ConsoleWrite("$RunListClustersLength = " & $RunListClustersLength & @crlf) $RunListVCNLength = Dec(StringMid($RunListID,1,1)) ; ConsoleWrite("$RunListVCNLength = " & $RunListVCNLength & @crlf) $RunListClusters = Dec(_SwapEndian(StringMid($DataRun,$i,$RunListClustersLength*2)),2) ; ConsoleWrite("$RunListClusters = " & $RunListClusters & @crlf) $i += $RunListClustersLength*2 $RunListVCN = _SwapEndian(StringMid($DataRun, $i, $RunListVCNLength*2)) ;next line handles positive or negative move $BaseVCN += Dec($RunListVCN,2)-(($r>1) And (Dec(StringMid($RunListVCN,1,1))>7))*Dec(StringMid("10000000000000000",1,$RunListVCNLength*2+1),2) If $RunListVCN <> "" Then $RunListVCN = $BaseVCN Else $RunListVCN = 0 ;$RUN_VCN[$r-1] ;0 EndIf ; ConsoleWrite("$RunListVCN = " & $RunListVCN & @crlf) If (($RunListVCN=0) And ($RunListClusters>16) And (Mod($RunListClusters,16)>0)) Then ;If (($RunListVCN=$RUN_VCN[$r-1]) And ($RunListClusters>16) And (Mod($RunListClusters,16)>0)) Then ;may be sparse section at end of Compression Signature _ArrayAdd($RUN_Clusters,Mod($RunListClusters,16)) _ArrayAdd($RUN_VCN,$RunListVCN) $RunListClusters -= Mod($RunListClusters,16) $r += 1 ElseIf (($RunListClusters>16) And (Mod($RunListClusters,16)>0)) Then ;may be compressed data section at start of Compression Signature _ArrayAdd($RUN_Clusters,$RunListClusters-Mod($RunListClusters,16)) _ArrayAdd($RUN_VCN,$RunListVCN) $RunListVCN += $RUN_Clusters[$r] $RunListClusters = Mod($RunListClusters,16) $r += 1 EndIf ;just normal or sparse data _ArrayAdd($RUN_Clusters,$RunListClusters) _ArrayAdd($RUN_VCN,$RunListVCN) $r += 1 $i += $RunListVCNLength*2 Until $i > StringLen($DataRun) ;--------------------------------_ExtractDataRuns() ; _ArrayDisplay($RUN_Clusters,"$RUN_Clusters") ; _ArrayDisplay($RUN_VCN,"$RUN_VCN") ; ConsoleWrite("$Size: " & $Size & @CRLF) ; ConsoleWrite("$TotalClusters * $BytesPerCluster: " & $TotalClusters * $BytesPerCluster & @CRLF) ; ConsoleWrite("$GlobUsnJrnlFileSize 1: " & $GlobUsnJrnlFileSize & @CRLF) If $TotalClusters * $BytesPerCluster >= $Size Then ; ConsoleWrite(_ArrayToString($RUN_VCN) & @CRLF) ; ConsoleWrite(_ArrayToString($RUN_Clusters) & @CRLF) ;ExtractFile ;Local $nBytes $hFile = _WinAPI_CreateFile($TargetDevice, 2, 6, 6) If $hFile = 0 Then ConsoleWrite("Error CreateFile in function _GetAttributeEntryNoRead()" & @CRLF) _WinAPI_CloseHandle($hFile) Return EndIf $tBuffer = DllStructCreate("byte[" & $BytesPerCluster * 16 & "]") Select Case UBound($RUN_VCN) = 1 ;no data, do nothing Case (UBound($RUN_VCN) = 2) Or (Not $IsCompressed) ;may be normal or sparse If $ATTRIBUTE_HEADER_RealSize <> 0 Then $FileSize = $ATTRIBUTE_HEADER_RealSize Else $FileSize = $GlobUsnJrnlFileSize EndIf Local $TestArray[UBound($RUN_VCN)][4] $TestArray[0][0] = "Offset" $TestArray[0][1] = "Bytes Accumulated" $TestArray[0][2] = "Bytes per Run" $TestArray[0][3] = "Sectors per Run" For $s = 1 To UBound($RUN_VCN)-1 If $RUN_VCN[$s] = 0 Then $TestArray[$s][0] = 0 $GlobUsnJrnlSparseBytes += $BytesPerCluster * $RUN_Clusters[$s] ; $Bytes += $BytesPerCluster * $RUN_Clusters[$s] $TestArray[$s][1] = $BytesPerCluster * $RUN_Clusters[$s] $FileSize -= $BytesPerCluster * $RUN_Clusters[$s] Continueloop EndIf $TestArray[$s][0] = $RUN_VCN[$s]*$BytesPerCluster $g = $RUN_Clusters[$s] While $g > 16 And $FileSize > $BytesPerCluster * 16 $Bytes += $BytesPerCluster * 16 $g -= 16 $FileSize -= $BytesPerCluster * 16 WEnd ; If $g = 0 Or $FileSize = 0 Then ExitLoop ;Return $FileSize ; If $g > 16 Then $g = 16 If $g <> 0 Then If $FileSize > $BytesPerCluster * $g Then $Bytes += $BytesPerCluster * $g $FileSize -= $BytesPerCluster * $g Else $Bytes += $FileSize EndIf ; $Bytes += $BytesPerCluster * $g EndIf $TestArray[$s][1] = $Bytes Next $GlobUsnJrnlFileSize = $FileSize Case Else ;may be compressed ; _DoCompressed($hFile, $htest, $tBuffer) ConsoleWrite("Error: Compressed attributes not supported!!!" & @CRLF) EndSelect ;------------------------ExtractFile Else $GlobUsnJrnlFileSize -= $TotalClusters * $BytesPerCluster $GlobUsnJrnlSparseBytes += $TotalClusters * $BytesPerCluster EndIf ;------------------------- EndIf Next ; ConsoleWrite("$GlobUsnJrnlFileSize 2: " & $GlobUsnJrnlFileSize & @CRLF) ; ConsoleWrite("$GlobUsnJrnlSparseBytes: " & $GlobUsnJrnlSparseBytes & @CRLF) $CoreAttributeArr[0] = $CoreAttribute $CoreAttributeArr[1] = $ATTRIBUTE_HEADER_Name $RawTestOffsetArray = $TestArray ; _ArrayDisplay($TestArray,"$TestArray") For $i = 1 To UBound($RawTestOffsetArray)-1 If $RawTestOffsetArray[$i][0] = 0 Then ContinueLoop ; $RawTestOffsetArray[$i-1][0] = 0 Then $FirstRealRun = $i ; If $i = 1 Then If $RawTestOffsetArray[$i-1][0] = 0 Then $RawTestOffsetArray[$i][2] = $RawTestOffsetArray[$i][1] Else $RawTestOffsetArray[$i][2] = $RawTestOffsetArray[$i][1] - $RawTestOffsetArray[$i-1][1] EndIf $RawTestOffsetArray[$i][3] = $RawTestOffsetArray[$i][2]/512 Next ; _ArrayDisplay($RawTestOffsetArray,"$RawTestOffsetArray") Return $CoreAttributeArr EndFunc Func _Get_IndexRoot($Entry,$Current_Attrib_Number,$CurrentAttributeName) Local $LocalAttributeOffset = 1,$AttributeType,$CollationRule,$SizeOfIndexAllocationEntry,$ClustersPerIndexRoot $AttributeType = StringMid($Entry,$LocalAttributeOffset,8) ; $AttributeType = _SwapEndian($AttributeType) $CollationRule = StringMid($Entry,$LocalAttributeOffset+8,8) $CollationRule = _SwapEndian($CollationRule) $SizeOfIndexAllocationEntry = StringMid($Entry,$LocalAttributeOffset+16,8) $SizeOfIndexAllocationEntry = Dec(_SwapEndian($SizeOfIndexAllocationEntry),2) $ClustersPerIndexRoot = Dec(StringMid($Entry,$LocalAttributeOffset+24,2)) ; $IRPadding = StringMid($Entry,$LocalAttributeOffset+26,6) $OffsetToFirstEntry = StringMid($Entry,$LocalAttributeOffset+32,8) $OffsetToFirstEntry = Dec(_SwapEndian($OffsetToFirstEntry),2) $TotalSizeOfEntries = StringMid($Entry,$LocalAttributeOffset+40,8) $TotalSizeOfEntries = Dec(_SwapEndian($TotalSizeOfEntries),2) $AllocatedSizeOfEntries = StringMid($Entry,$LocalAttributeOffset+48,8) $AllocatedSizeOfEntries = Dec(_SwapEndian($AllocatedSizeOfEntries),2) $Flags = StringMid($Entry,$LocalAttributeOffset+56,2) If $Flags = "01" Then $Flags = "01 (Index Allocation needed)" $ResidentIndx = 0 Else $Flags = "00 (Fits in Index Root)" $ResidentIndx = 1 EndIf ; $IRPadding2 = StringMid($Entry,$LocalAttributeOffset+58,6) $IRArr[0][$Current_Attrib_Number] = "IndexRoot Number " & $Current_Attrib_Number $IRArr[1][$Current_Attrib_Number] = $CurrentAttributeName $IRArr[2][$Current_Attrib_Number] = $AttributeType $IRArr[3][$Current_Attrib_Number] = $CollationRule $IRArr[4][$Current_Attrib_Number] = $SizeOfIndexAllocationEntry $IRArr[5][$Current_Attrib_Number] = $ClustersPerIndexRoot ; $IRArr[6][$Current_Attrib_Number] = $IRPadding $IRArr[7][$Current_Attrib_Number] = $OffsetToFirstEntry $IRArr[8][$Current_Attrib_Number] = $TotalSizeOfEntries $IRArr[9][$Current_Attrib_Number] = $AllocatedSizeOfEntries $IRArr[10][$Current_Attrib_Number] = $Flags ; $IRArr[11][$Current_Attrib_Number] = $IRPadding2 If $ResidentIndx And $AttributeType=$FILE_NAME Then $TheResidentIndexEntry = StringMid($Entry,$LocalAttributeOffset+64) _DecodeIndxEntries($TheResidentIndexEntry) EndIf EndFunc ; start: by Ascend4nt ----------------------------- Func _WinTime_GetUTCToLocalFileTimeDelta() Local $iUTCFileTime=864000000000 ; exactly 24 hours from the origin (although 12 hours would be more appropriate (max variance = 12)) $iLocalFileTime=_WinTime_UTCFileTimeToLocalFileTime($iUTCFileTime) If @error Then Return SetError(@error,@extended,-1) Return $iLocalFileTime-$iUTCFileTime ; /36000000000 = # hours delta (effectively giving the offset in hours from UTC/GMT) EndFunc Func _WinTime_UTCFileTimeToLocalFileTime($iUTCFileTime) If $iUTCFileTime<0 Then Return SetError(1,0,-1) Local $aRet=DllCall($_COMMON_KERNEL32DLL,"bool","FileTimeToLocalFileTime","uint64*",$iUTCFileTime,"uint64*",0) If @error Then Return SetError(2,@error,-1) If Not $aRet[0] Then Return SetError(3,0,-1) Return $aRet[2] EndFunc Func _WinTime_UTCFileTimeFormat($iUTCFileTime,$iFormat=4,$iPrecision=0,$bAMPMConversion=False) ;~ If $iUTCFileTime<0 Then Return SetError(1,0,"") ; checked in below call ; First convert file time (UTC-based file time) to 'local file time' Local $iLocalFileTime=_WinTime_UTCFileTimeToLocalFileTime($iUTCFileTime) If @error Then Return SetError(@error,@extended,"") ; Rare occassion: a filetime near the origin (January 1, 1601!!) is used, ; causing a negative result (for some timezones). Return as invalid param. If $iLocalFileTime<0 Then Return SetError(1,0,"") ; Then convert file time to a system time array & format & return it Local $vReturn=_WinTime_LocalFileTimeFormat($iLocalFileTime,$iFormat,$iPrecision,$bAMPMConversion) Return SetError(@error,@extended,$vReturn) EndFunc Func _WinTime_LocalFileTimeFormat($iLocalFileTime,$iFormat=4,$iPrecision=0,$bAMPMConversion=False) ;~ If $iLocalFileTime<0 Then Return SetError(1,0,"") ; checked in below call ; Convert file time to a system time array & return result Local $aSysTime=_WinTime_LocalFileTimeToSystemTime($iLocalFileTime) If @error Then Return SetError(@error,@extended,"") ; Return only the SystemTime array? If $iFormat=0 Then Return $aSysTime Local $vReturn=_WinTime_FormatTime($aSysTime[0],$aSysTime[1],$aSysTime[2],$aSysTime[3], _ $aSysTime[4],$aSysTime[5],$aSysTime[6],$aSysTime[7],$iFormat,$iPrecision,$bAMPMConversion) Return SetError(@error,@extended,$vReturn) EndFunc Func _WinTime_LocalFileTimeToSystemTime($iLocalFileTime) Local $aRet,$stSysTime,$aSysTime[8]=[-1,-1,-1,-1,-1,-1,-1,-1] ; Negative values unacceptable If $iLocalFileTime<0 Then Return SetError(1,0,$aSysTime) ; SYSTEMTIME structure [Year,Month,DayOfWeek,Day,Hour,Min,Sec,Milliseconds] $stSysTime=DllStructCreate("ushort[8]") $aRet=DllCall($_COMMON_KERNEL32DLL,"bool","FileTimeToSystemTime","uint64*",$iLocalFileTime,"ptr",DllStructGetPtr($stSysTime)) If @error Then Return SetError(2,@error,$aSysTime) If Not $aRet[0] Then Return SetError(3,0,$aSysTime) Dim $aSysTime[8]=[DllStructGetData($stSysTime,1,1),DllStructGetData($stSysTime,1,2),DllStructGetData($stSysTime,1,4),DllStructGetData($stSysTime,1,5), _ DllStructGetData($stSysTime,1,6),DllStructGetData($stSysTime,1,7),DllStructGetData($stSysTime,1,8),DllStructGetData($stSysTime,1,3)] Return $aSysTime EndFunc Func _WinTime_FormatTime($iYear,$iMonth,$iDay,$iHour,$iMin,$iSec,$iMilSec,$iDayOfWeek,$iFormat=4,$iPrecision=0,$bAMPMConversion=False) Local Static $_WT_aMonths[12]=["January","February","March","April","May","June","July","August","September","October","November","December"] Local Static $_WT_aDays[7]=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"] If Not $iFormat Or $iMonth<1 Or $iMonth>12 Or $iDayOfWeek>6 Then Return SetError(1,0,"") ; Pad MM,DD,HH,MM,SS,MSMSMSMS as necessary Local $sMM=StringRight(0&$iMonth,2),$sDD=StringRight(0&$iDay,2),$sMin=StringRight(0&$iMin,2) ; $sYY = $iYear ; (no padding) ; [technically Year can be 1-x chars - but this is generally used for 4-digit years. And SystemTime only goes up to 30827/30828] Local $sHH,$sSS,$sMS,$sAMPM ; 'Extra precision 1': +SS (Seconds) If $iPrecision Then $sSS=StringRight(0&$iSec,2) ; 'Extra precision 2': +MSMSMSMS (Milliseconds) If $iPrecision>1 Then ; $sMS=StringRight('000'&$iMilSec,4) $sMS=StringRight('000'&$iMilSec,3);Fixed an erronous 0 in front of the milliseconds Else $sMS="" EndIf Else $sSS="" $sMS="" EndIf If $bAMPMConversion Then If $iHour>11 Then $sAMPM=" PM" ; 12 PM will cause 12-12 to equal 0, so avoid the calculation: If $iHour=12 Then $sHH="12" Else $sHH=StringRight(0&($iHour-12),2) EndIf Else $sAMPM=" AM" If $iHour Then $sHH=StringRight(0&$iHour,2) Else ; 00 military = 12 AM $sHH="12" EndIf EndIf Else $sAMPM="" $sHH=StringRight(0 & $iHour,2) EndIf Local $sDateTimeStr,$aReturnArray[3] ; Return an array? [formatted string + "Month" + "DayOfWeek"] If BitAND($iFormat,0x10) Then $aReturnArray[1]=$_WT_aMonths[$iMonth-1] If $iDayOfWeek>=0 Then $aReturnArray[2]=$_WT_aDays[$iDayOfWeek] Else $aReturnArray[2]="" EndIf ; Strip the 'array' bit off (array[1] will now indicate if an array is to be returned) $iFormat=BitAND($iFormat,0xF) Else ; Signal to below that the array isn't to be returned $aReturnArray[1]="" EndIf ; Prefix with "DayOfWeek "? If BitAND($iFormat,8) Then If $iDayOfWeek<0 Then Return SetError(1,0,"") ; invalid $sDateTimeStr=$_WT_aDays[$iDayOfWeek]&', ' ; Strip the 'DayOfWeek' bit off $iFormat=BitAND($iFormat,0x7) Else $sDateTimeStr="" EndIf If $iFormat<2 Then ; Basic String format: YYYYMMDDHHMM[SS[MSMSMSMS[ AM/PM]]] $sDateTimeStr&=$iYear&$sMM&$sDD&$sHH&$sMin&$sSS&$sMS&$sAMPM Else ; one of 4 formats which ends with " HH:MM[:SS[:MSMSMSMS[ AM/PM]]]" Switch $iFormat ; /, : Format - MM/DD/YYYY Case 2 $sDateTimeStr&=$sMM&'/'&$sDD&'/' ; /, : alt. Format - DD/MM/YYYY Case 3 $sDateTimeStr&=$sDD&'/'&$sMM&'/' ; "Month DD, YYYY" format Case 4 $sDateTimeStr&=$_WT_aMonths[$iMonth-1]&' '&$sDD&', ' ; "DD Month YYYY" format Case 5 $sDateTimeStr&=$sDD&' '&$_WT_aMonths[$iMonth-1]&' ' Case 6 $sDateTimeStr&=$iYear&'-'&$sMM&'-'&$sDD $iYear='' Case Else Return SetError(1,0,"") EndSwitch $sDateTimeStr&=$iYear&' '&$sHH&':'&$sMin If $iPrecision Then $sDateTimeStr&=':'&$sSS If $iPrecision>1 Then $sDateTimeStr&=':'&$sMS EndIf $sDateTimeStr&=$sAMPM EndIf If $aReturnArray[1]<>"" Then $aReturnArray[0]=$sDateTimeStr Return $aReturnArray EndIf Return $sDateTimeStr EndFunc Func _WinTime_SystemTimeToLocalFileTime($iYear,$iMonth,$iDay,$iHour,$iMin,$iSec,$iMilSec,$iDayOfWeek=-1) ; Least\Greatest year check If $iYear<1601 Or $iYear>30827 Then Return SetError(1,0,-1) ; SYSTEMTIME structure [Year,Month,DayOfWeek,Day,Hour,Min,Sec,Milliseconds] Local $stSysTime=DllStructCreate("ushort[8]") DllStructSetData($stSysTime,1,$iYear,1) DllStructSetData($stSysTime,1,$iMonth,2) DllStructSetData($stSysTime,1,$iDayOfWeek,3) DllStructSetData($stSysTime,1,$iDay,4) DllStructSetData($stSysTime,1,$iHour,5) DllStructSetData($stSysTime,1,$iMin,6) DllStructSetData($stSysTime,1,$iSec,7) DllStructSetData($stSysTime,1,$iMilSec,8) Local $aRet=DllCall($_COMMON_KERNEL32DLL,"bool","SystemTimeToFileTime","ptr",DllStructGetPtr($stSysTime),"int64*",0) If @error Then Return SetError(2,@error,-1) If Not $aRet[0] Then Return SetError(3,0,-1) Return $aRet[2] EndFunc ; end: by Ascend4nt ---------------------------- Func _Get_IndexAllocation(ByRef $Entry) ; ConsoleWrite("Starting function _Get_IndexAllocation()" & @crlf) Local $NextPosition = 1,$IndxHdrMagic,$IndxEntries,$TotalIndxEntries ; ConsoleWrite("INDX record:" & @crlf) ; ConsoleWrite(_HexEncode("0x"& StringMid($Entry,1)) & @crlf) ; ConsoleWrite("StringLen of chunk = " & StringLen($Entry) & @crlf) ; ConsoleWrite("Expected records = " & StringLen($Entry)/8192 & @crlf) $NextPosition = 1 Do $IndxHdrMagic = StringMid($Entry,$NextPosition,8) ; ConsoleWrite("$IndxHdrMagic = " & $IndxHdrMagic & @crlf) $IndxHdrMagic = _HexToString($IndxHdrMagic) ; ConsoleWrite("$IndxHdrMagic = " & $IndxHdrMagic & @crlf) If $IndxHdrMagic <> "INDX" Then ; ConsoleWrite("$IndxHdrMagic: " & $IndxHdrMagic & @crlf) ; ConsoleWrite("Error: Record is not of type INDX, and this was not expected.." & @crlf) $NextPosition += 8192 ContinueLoop EndIf $IndxEntries = _StripIndxRecord(StringMid($Entry,$NextPosition,8192)) $TotalIndxEntries &= $IndxEntries $NextPosition += 8192 ; ConsoleWrite("$NextPosition: " & $NextPosition & @crlf) Until $NextPosition >= StringLen($Entry)+32 ; ConsoleWrite("INDX record:" & @crlf) ; ConsoleWrite(_HexEncode("0x"& StringMid($Entry,1)) & @crlf) ; ConsoleWrite("Total chunk of stripped INDX entries:" & @crlf) ; ConsoleWrite(_HexEncode("0x"& StringMid($TotalIndxEntries,1)) & @crlf) _DecodeIndxEntries($TotalIndxEntries) EndFunc Func _DecodeIndxEntries(ByRef $Entry) ; ConsoleWrite("Starting function _DecodeIndxEntries()" & @crlf) ;Local $LocalAttributeOffset = 1,$NewLocalAttributeOffset,$IndxHdrMagic,$IndxHdrUpdateSeqArrOffset,$IndxHdrUpdateSeqArrSize,$IndxHdrLogFileSequenceNo,$IndxHdrVCNOfIndx,$IndxHdrOffsetToIndexEntries,$IndxHdrSizeOfIndexEntries,$IndxHdrAllocatedSizeOfIndexEntries ;Local $IndxHdrFlag,$IndxHdrPadding,$IndxHdrUpdateSequence,$IndxHdrUpdSeqArr,$IndxHdrUpdSeqArrPart0,$IndxHdrUpdSeqArrPart1,$IndxHdrUpdSeqArrPart2,$IndxHdrUpdSeqArrPart3,$IndxRecordEnd4,$IndxRecordEnd1,$IndxRecordEnd2,$IndxRecordEnd3,$IndxRecordEnd4 Local $tmp1=0,$EntryCounter=1,$NextEntryOffset Local $NewLocalAttributeOffset = 1 $MFTReference = StringMid($Entry,$NewLocalAttributeOffset,12) $MFTReference = _SwapEndian($MFTReference) $MFTReference = Dec($MFTReference,2) $IndexFlags = StringMid($Entry,$NewLocalAttributeOffset+24,4) #cs $MFTReferenceSeqNo = StringMid($Entry,$NewLocalAttributeOffset+12,4) $MFTReferenceSeqNo = Dec(StringMid($MFTReferenceSeqNo,3,2)&StringMid($MFTReferenceSeqNo,1,2)) $IndexEntryLength = StringMid($Entry,$NewLocalAttributeOffset+16,4) $IndexEntryLength = Dec(StringMid($IndexEntryLength,3,2)&StringMid($IndexEntryLength,3,2)) $OffsetToFileName = StringMid($Entry,$NewLocalAttributeOffset+20,4) $OffsetToFileName = Dec(StringMid($OffsetToFileName,3,2)&StringMid($OffsetToFileName,3,2)) $IndexFlags = StringMid($Entry,$NewLocalAttributeOffset+24,4) ; $Padding = StringMid($Entry,$NewLocalAttributeOffset+28,4) $MFTReferenceOfParent = StringMid($Entry,$NewLocalAttributeOffset+32,12) $MFTReferenceOfParent = StringMid($MFTReferenceOfParent,7,2)&StringMid($MFTReferenceOfParent,5,2)&StringMid($MFTReferenceOfParent,3,2)&StringMid($MFTReferenceOfParent,1,2) $MFTReferenceOfParent = Dec($MFTReferenceOfParent) $MFTReferenceOfParentSeqNo = StringMid($Entry,$NewLocalAttributeOffset+44,4) $MFTReferenceOfParentSeqNo = Dec(StringMid($MFTReferenceOfParentSeqNo,3,2) & StringMid($MFTReferenceOfParentSeqNo,3,2)) $Indx_CTime = StringMid($Entry,$NewLocalAttributeOffset+48,16) $Indx_CTime = StringMid($Indx_CTime,15,2) & StringMid($Indx_CTime,13,2) & StringMid($Indx_CTime,11,2) & StringMid($Indx_CTime,9,2) & StringMid($Indx_CTime,7,2) & StringMid($Indx_CTime,5,2) & StringMid($Indx_CTime,3,2) & StringMid($Indx_CTime,1,2) $Indx_CTime_tmp = _WinTime_UTCFileTimeToLocalFileTime("0x" & $Indx_CTime) $Indx_CTime = _WinTime_UTCFileTimeFormat(Dec($Indx_CTime)-$tDelta,$DateTimeFormat,2) If @error Then $Indx_CTime = "-" Else $Indx_CTime = $Indx_CTime & ":" & _FillZero(StringRight($Indx_CTime_tmp,4)) EndIf $Indx_ATime = StringMid($Entry,$NewLocalAttributeOffset+64,16) $Indx_ATime = StringMid($Indx_ATime,15,2) & StringMid($Indx_ATime,13,2) & StringMid($Indx_ATime,11,2) & StringMid($Indx_ATime,9,2) & StringMid($Indx_ATime,7,2) & StringMid($Indx_ATime,5,2) & StringMid($Indx_ATime,3,2) & StringMid($Indx_ATime,1,2) $Indx_ATime_tmp = _WinTime_UTCFileTimeToLocalFileTime("0x" & $Indx_ATime) $Indx_ATime = _WinTime_UTCFileTimeFormat(Dec($Indx_ATime)-$tDelta,$DateTimeFormat,2) If @error Then $Indx_ATime = "-" Else $Indx_ATime = $Indx_ATime & ":" & _FillZero(StringRight($Indx_ATime_tmp,4)) EndIf $Indx_MTime = StringMid($Entry,$NewLocalAttributeOffset+80,16) $Indx_MTime = StringMid($Indx_MTime,15,2) & StringMid($Indx_MTime,13,2) & StringMid($Indx_MTime,11,2) & StringMid($Indx_MTime,9,2) & StringMid($Indx_MTime,7,2) & StringMid($Indx_MTime,5,2) & StringMid($Indx_MTime,3,2) & StringMid($Indx_MTime,1,2) $Indx_MTime_tmp = _WinTime_UTCFileTimeToLocalFileTime("0x" & $Indx_MTime) $Indx_MTime = _WinTime_UTCFileTimeFormat(Dec($Indx_MTime)-$tDelta,$DateTimeFormat,2) If @error Then $Indx_MTime = "-" Else $Indx_MTime = $Indx_MTime & ":" & _FillZero(StringRight($Indx_MTime_tmp,4)) EndIf $Indx_RTime = StringMid($Entry,$NewLocalAttributeOffset+96,16) $Indx_RTime = StringMid($Indx_RTime,15,2) & StringMid($Indx_RTime,13,2) & StringMid($Indx_RTime,11,2) & StringMid($Indx_RTime,9,2) & StringMid($Indx_RTime,7,2) & StringMid($Indx_RTime,5,2) & StringMid($Indx_RTime,3,2) & StringMid($Indx_RTime,1,2) $Indx_RTime_tmp = _WinTime_UTCFileTimeToLocalFileTime("0x" & $Indx_RTime) $Indx_RTime = _WinTime_UTCFileTimeFormat(Dec($Indx_RTime)-$tDelta,$DateTimeFormat,2) If @error Then $Indx_RTime = "-" Else $Indx_RTime = $Indx_RTime & ":" & _FillZero(StringRight($Indx_RTime_tmp,4)) EndIf #ce #cs $Indx_AllocSize = StringMid($Entry,$NewLocalAttributeOffset+112,16) $Indx_AllocSize = Dec(StringMid($Indx_AllocSize,15,2) & StringMid($Indx_AllocSize,13,2) & StringMid($Indx_AllocSize,11,2) & StringMid($Indx_AllocSize,9,2) & StringMid($Indx_AllocSize,7,2) & StringMid($Indx_AllocSize,5,2) & StringMid($Indx_AllocSize,3,2) & StringMid($Indx_AllocSize,1,2)) $Indx_RealSize = StringMid($Entry,$NewLocalAttributeOffset+128,16) $Indx_RealSize = Dec(StringMid($Indx_RealSize,15,2) & StringMid($Indx_RealSize,13,2) & StringMid($Indx_RealSize,11,2) & StringMid($Indx_RealSize,9,2) & StringMid($Indx_RealSize,7,2) & StringMid($Indx_RealSize,5,2) & StringMid($Indx_RealSize,3,2) & StringMid($Indx_RealSize,1,2)) $Indx_File_Flags = StringMid($Entry,$NewLocalAttributeOffset+144,16) $Indx_File_Flags = StringMid($Indx_File_Flags,15,2) & StringMid($Indx_File_Flags,13,2) & StringMid($Indx_File_Flags,11,2) & StringMid($Indx_File_Flags,9,2)&StringMid($Indx_File_Flags,7,2) & StringMid($Indx_File_Flags,5,2) & StringMid($Indx_File_Flags,3,2) & StringMid($Indx_File_Flags,1,2) $Indx_File_Flags = StringMid($Indx_File_Flags,13,8) $Indx_File_Flags = _File_Attributes("0x" & $Indx_File_Flags) #ce $Indx_NameLength = StringMid($Entry,$NewLocalAttributeOffset+160,2) $Indx_NameLength = Dec($Indx_NameLength) $Indx_NameSpace = StringMid($Entry,$NewLocalAttributeOffset+162,2) Select Case $Indx_NameSpace = "00" ;POSIX $Indx_NameSpace = "POSIX" Case $Indx_NameSpace = "01" ;WIN32 $Indx_NameSpace = "WIN32" Case $Indx_NameSpace = "02" ;DOS $Indx_NameSpace = "DOS" Case $Indx_NameSpace = "03" ;DOS+WIN32 $Indx_NameSpace = "DOS+WIN32" EndSelect $Indx_FileName = StringMid($Entry,$NewLocalAttributeOffset+164,$Indx_NameLength*4) ; $Indx_FileName = _UnicodeHexToStr($Indx_FileName) $Indx_FileName = BinaryToString("0x"&$Indx_FileName,2) ; ConsoleWrite("$Indx_FileName: " & $Indx_FileName & @crlf) $tmp1 = 164+($Indx_NameLength*4) #cs Do ; Calculate the length of the padding - 8 byte aligned $tmp2 = $tmp1/16 If Not IsInt($tmp2) Then $tmp0 = 2 $tmp1 += $tmp0 $tmp3 += $tmp0 EndIf Until IsInt($tmp2) $PaddingLength = $tmp3 #ce $PaddingLength = 0 If Mod($tmp1,16) Then While 1 $PaddingLength+=1 $tmp1 += 1 If Mod($tmp1,16) = 0 Then ExitLoop WEnd EndIf ; $Padding2 = StringMid($Entry,$NewLocalAttributeOffset+164+($Indx_NameLength*2*2),$PaddingLength) If $IndexFlags <> "0000" Then ; $SubNodeVCN = StringMid($Entry,$NewLocalAttributeOffset+164+($Indx_NameLength*2*2)+$PaddingLength,16) $SubNodeVCNLength = 16 Else ; $SubNodeVCN = "" $SubNodeVCNLength = 0 EndIf ReDim $IndxEntryNumberArr[1+$EntryCounter] ReDim $IndxMFTReferenceArr[1+$EntryCounter] ; ReDim $IndxMFTRefSeqNoArr[1+$EntryCounter] ; ReDim $IndxIndexFlagsArr[1+$EntryCounter] ; ReDim $IndxMFTReferenceOfParentArr[1+$EntryCounter] ; ReDim $IndxMFTParentRefSeqNoArr[1+$EntryCounter] ; ReDim $IndxCTimeArr[1+$EntryCounter] ; ReDim $IndxATimeArr[1+$EntryCounter] ; ReDim $IndxMTimeArr[1+$EntryCounter] ; ReDim $IndxRTimeArr[1+$EntryCounter] ; ReDim $IndxAllocSizeArr[1+$EntryCounter] ; ReDim $IndxRealSizeArr[1+$EntryCounter] ; ReDim $IndxFileFlagsArr[1+$EntryCounter] ReDim $IndxFileNameArr[1+$EntryCounter] ; ReDim $IndxNameSpaceArr[1+$EntryCounter] ; ReDim $IndxSubNodeVCNArr[1+$EntryCounter] $IndxEntryNumberArr[$EntryCounter] = $EntryCounter $IndxMFTReferenceArr[$EntryCounter] = $MFTReference ; $IndxMFTRefSeqNoArr[$EntryCounter] = $MFTReferenceSeqNo ; $IndxIndexFlagsArr[$EntryCounter] = $IndexFlags ; $IndxMFTReferenceOfParentArr[$EntryCounter] = $MFTReferenceOfParent ; $IndxMFTParentRefSeqNoArr[$EntryCounter] = $MFTReferenceOfParentSeqNo ; $IndxCTimeArr[$EntryCounter] = $Indx_CTime ; $IndxATimeArr[$EntryCounter] = $Indx_ATime ; $IndxMTimeArr[$EntryCounter] = $Indx_MTime ; $IndxRTimeArr[$EntryCounter] = $Indx_RTime ; $IndxAllocSizeArr[$EntryCounter] = $Indx_AllocSize ; $IndxRealSizeArr[$EntryCounter] = $Indx_RealSize ; $IndxFileFlagsArr[$EntryCounter] = $Indx_File_Flags $IndxFileNameArr[$EntryCounter] = $Indx_FileName ; $IndxNameSpaceArr[$EntryCounter] = $Indx_NameSpace ; $IndxSubNodeVCNArr[$EntryCounter] = $SubNodeVCN ; Work through the rest of the index entries $NextEntryOffset = $NewLocalAttributeOffset+164+($Indx_NameLength*2*2)+$PaddingLength+$SubNodeVCNLength If $NextEntryOffset+64 >= StringLen($Entry) Then Return Do $EntryCounter += 1 ; If Mod($EntryCounter,1000) = 0 Then ConsoleWrite($EntryCounter & @crlf) ; ConsoleWrite("$EntryCounter = " & $EntryCounter & @crlf) $MFTReference = StringMid($Entry,$NextEntryOffset,12) ; ConsoleWrite("$MFTReference = " & $MFTReference & @crlf) ; $MFTReference = StringMid($MFTReference,7,2)&StringMid($MFTReference,5,2)&StringMid($MFTReference,3,2)&StringMid($MFTReference,1,2) $MFTReference = _SwapEndian($MFTReference) ; $MFTReference = StringMid($MFTReference,15,2)&StringMid($MFTReference,13,2)&StringMid($MFTReference,11,2)&StringMid($MFTReference,9,2)&StringMid($MFTReference,7,2)&StringMid($MFTReference,5,2)&StringMid($MFTReference,3,2)&StringMid($MFTReference,1,2) ; ConsoleWrite("$MFTReference = " & $MFTReference & @crlf) $MFTReference = Dec($MFTReference,2) $IndexFlags = StringMid($Entry,$NextEntryOffset+24,4) #cs $MFTReferenceSeqNo = StringMid($Entry,$NextEntryOffset+12,4) $MFTReferenceSeqNo = Dec(StringMid($MFTReferenceSeqNo,3,2)&StringMid($MFTReferenceSeqNo,1,2)) $IndexEntryLength = StringMid($Entry,$NextEntryOffset+16,4) ; ConsoleWrite("$IndexEntryLength = " & $IndexEntryLength & @crlf) $IndexEntryLength = Dec(StringMid($IndexEntryLength,3,2)&StringMid($IndexEntryLength,3,2)) ; ConsoleWrite("$IndexEntryLength = " & $IndexEntryLength & @crlf) $OffsetToFileName = StringMid($Entry,$NextEntryOffset+20,4) ; ConsoleWrite("$OffsetToFileName = " & $OffsetToFileName & @crlf) $OffsetToFileName = Dec(StringMid($OffsetToFileName,3,2)&StringMid($OffsetToFileName,3,2)) ; ConsoleWrite("$OffsetToFileName = " & $OffsetToFileName & @crlf) $IndexFlags = StringMid($Entry,$NextEntryOffset+24,4) ; ConsoleWrite("$IndexFlags = " & $IndexFlags & @crlf) ; $Padding = StringMid($Entry,$NextEntryOffset+28,4) ; ConsoleWrite("$Padding = " & $Padding & @crlf) $MFTReferenceOfParent = StringMid($Entry,$NextEntryOffset+32,12) ; ConsoleWrite("$MFTReferenceOfParent = " & $MFTReferenceOfParent & @crlf) $MFTReferenceOfParent = StringMid($MFTReferenceOfParent,7,2)&StringMid($MFTReferenceOfParent,5,2)&StringMid($MFTReferenceOfParent,3,2)&StringMid($MFTReferenceOfParent,1,2) ; $MFTReferenceOfParent = StringMid($MFTReferenceOfParent,15,2)&StringMid($MFTReferenceOfParent,13,2)&StringMid($MFTReferenceOfParent,11,2)&StringMid($MFTReferenceOfParent,9,2)&StringMid($MFTReferenceOfParent,7,2)&StringMid($MFTReferenceOfParent,5,2)&StringMid($MFTReferenceOfParent,3,2)&StringMid($MFTReferenceOfParent,1,2) ; ConsoleWrite("$MFTReferenceOfParent = " & $MFTReferenceOfParent & @crlf) $MFTReferenceOfParent = Dec($MFTReferenceOfParent) $MFTReferenceOfParentSeqNo = StringMid($Entry,$NextEntryOffset+44,4) $MFTReferenceOfParentSeqNo = Dec(StringMid($MFTReferenceOfParentSeqNo,3,2) & StringMid($MFTReferenceOfParentSeqNo,3,2)) $Indx_CTime = StringMid($Entry,$NextEntryOffset+48,16) $Indx_CTime = StringMid($Indx_CTime,15,2) & StringMid($Indx_CTime,13,2) & StringMid($Indx_CTime,11,2) & StringMid($Indx_CTime,9,2) & StringMid($Indx_CTime,7,2) & StringMid($Indx_CTime,5,2) & StringMid($Indx_CTime,3,2) & StringMid($Indx_CTime,1,2) $Indx_CTime_tmp = _WinTime_UTCFileTimeToLocalFileTime("0x" & $Indx_CTime) $Indx_CTime = _WinTime_UTCFileTimeFormat(Dec($Indx_CTime)-$tDelta,$DateTimeFormat,2) $Indx_CTime = $Indx_CTime & ":" & _FillZero(StringRight($Indx_CTime_tmp,4)) ; ConsoleWrite("$Indx_CTime = " & $Indx_CTime & @crlf) ; $Indx_ATime = StringMid($Entry,$NextEntryOffset+64,16) $Indx_ATime = StringMid($Indx_ATime,15,2) & StringMid($Indx_ATime,13,2) & StringMid($Indx_ATime,11,2) & StringMid($Indx_ATime,9,2) & StringMid($Indx_ATime,7,2) & StringMid($Indx_ATime,5,2) & StringMid($Indx_ATime,3,2) & StringMid($Indx_ATime,1,2) $Indx_ATime_tmp = _WinTime_UTCFileTimeToLocalFileTime("0x" & $Indx_ATime) $Indx_ATime = _WinTime_UTCFileTimeFormat(Dec($Indx_ATime)-$tDelta,$DateTimeFormat,2) $Indx_ATime = $Indx_ATime & ":" & _FillZero(StringRight($Indx_ATime_tmp,4)) ; ConsoleWrite("$Indx_ATime = " & $Indx_ATime & @crlf) ; $Indx_MTime = StringMid($Entry,$NextEntryOffset+80,16) $Indx_MTime = StringMid($Indx_MTime,15,2) & StringMid($Indx_MTime,13,2) & StringMid($Indx_MTime,11,2) & StringMid($Indx_MTime,9,2) & StringMid($Indx_MTime,7,2) & StringMid($Indx_MTime,5,2) & StringMid($Indx_MTime,3,2) & StringMid($Indx_MTime,1,2) $Indx_MTime_tmp = _WinTime_UTCFileTimeToLocalFileTime("0x" & $Indx_MTime) $Indx_MTime = _WinTime_UTCFileTimeFormat(Dec($Indx_MTime)-$tDelta,$DateTimeFormat,2) $Indx_MTime = $Indx_MTime & ":" & _FillZero(StringRight($Indx_MTime_tmp,4)) ; ConsoleWrite("$Indx_MTime = " & $Indx_MTime & @crlf) ; $Indx_RTime = StringMid($Entry,$NextEntryOffset+96,16) $Indx_RTime = StringMid($Indx_RTime,15,2) & StringMid($Indx_RTime,13,2) & StringMid($Indx_RTime,11,2) & StringMid($Indx_RTime,9,2) & StringMid($Indx_RTime,7,2) & StringMid($Indx_RTime,5,2) & StringMid($Indx_RTime,3,2) & StringMid($Indx_RTime,1,2) $Indx_RTime_tmp = _WinTime_UTCFileTimeToLocalFileTime("0x" & $Indx_RTime) $Indx_RTime = _WinTime_UTCFileTimeFormat(Dec($Indx_RTime)-$tDelta,$DateTimeFormat,2) $Indx_RTime = $Indx_RTime & ":" & _FillZero(StringRight($Indx_RTime_tmp,4)) ; ConsoleWrite("$Indx_RTime = " & $Indx_RTime & @crlf) ; #ce #cs $Indx_AllocSize = StringMid($Entry,$NextEntryOffset+112,16) $Indx_AllocSize = Dec(StringMid($Indx_AllocSize,15,2) & StringMid($Indx_AllocSize,13,2) & StringMid($Indx_AllocSize,11,2) & StringMid($Indx_AllocSize,9,2) & StringMid($Indx_AllocSize,7,2) & StringMid($Indx_AllocSize,5,2) & StringMid($Indx_AllocSize,3,2) & StringMid($Indx_AllocSize,1,2)) ; ConsoleWrite("$Indx_AllocSize = " & $Indx_AllocSize & @crlf) $Indx_RealSize = StringMid($Entry,$NextEntryOffset+128,16) $Indx_RealSize = Dec(StringMid($Indx_RealSize,15,2) & StringMid($Indx_RealSize,13,2) & StringMid($Indx_RealSize,11,2) & StringMid($Indx_RealSize,9,2) & StringMid($Indx_RealSize,7,2) & StringMid($Indx_RealSize,5,2) & StringMid($Indx_RealSize,3,2) & StringMid($Indx_RealSize,1,2)) ; ConsoleWrite("$Indx_RealSize = " & $Indx_RealSize & @crlf) $Indx_File_Flags = StringMid($Entry,$NextEntryOffset+144,16) ; ConsoleWrite("$Indx_File_Flags = " & $Indx_File_Flags & @crlf) $Indx_File_Flags = StringMid($Indx_File_Flags,15,2) & StringMid($Indx_File_Flags,13,2) & StringMid($Indx_File_Flags,11,2) & StringMid($Indx_File_Flags,9,2)&StringMid($Indx_File_Flags,7,2) & StringMid($Indx_File_Flags,5,2) & StringMid($Indx_File_Flags,3,2) & StringMid($Indx_File_Flags,1,2) ; ConsoleWrite("$Indx_File_Flags = " & $Indx_File_Flags & @crlf) $Indx_File_Flags = StringMid($Indx_File_Flags,13,8) $Indx_File_Flags = _File_Attributes("0x" & $Indx_File_Flags) ; ConsoleWrite("$Indx_File_Flags = " & $Indx_File_Flags & @crlf) #ce $Indx_NameLength = StringMid($Entry,$NextEntryOffset+160,2) $Indx_NameLength = Dec($Indx_NameLength) ; ConsoleWrite("$Indx_NameLength = " & $Indx_NameLength & @crlf) $Indx_NameSpace = StringMid($Entry,$NextEntryOffset+162,2) ; ConsoleWrite("$Indx_NameSpace = " & $Indx_NameSpace & @crlf) Select Case $Indx_NameSpace = "00" ;POSIX $Indx_NameSpace = "POSIX" Case $Indx_NameSpace = "01" ;WIN32 $Indx_NameSpace = "WIN32" Case $Indx_NameSpace = "02" ;DOS $Indx_NameSpace = "DOS" Case $Indx_NameSpace = "03" ;DOS+WIN32 $Indx_NameSpace = "DOS+WIN32" EndSelect $Indx_FileName = StringMid($Entry,$NextEntryOffset+164,$Indx_NameLength*4) ; ConsoleWrite("$Indx_FileName = " & $Indx_FileName & @crlf) ; $Indx_FileName = _UnicodeHexToStr($Indx_FileName) $Indx_FileName = BinaryToString("0x"&$Indx_FileName,2) ; ConsoleWrite("$Indx_FileName: " & $Indx_FileName & @crlf) #cs $tmp0 = 0 $tmp2 = 0 $tmp3 = 0 $tmp1 = 164+($Indx_NameLength*2*2) Do ; Calculate the length of the padding - 8 byte aligned $tmp2 = $tmp1/16 If Not IsInt($tmp2) Then $tmp0 = 2 $tmp1 += $tmp0 $tmp3 += $tmp0 EndIf Until IsInt($tmp2) $PaddingLength = $tmp3 ; ConsoleWrite("$PaddingLength = " & $PaddingLength & @crlf) $Padding = StringMid($Entry,$NextEntryOffset+164+($Indx_NameLength*2*2),$PaddingLength) #ce $tmp1 = 164+($Indx_NameLength*2*2) $PaddingLength = 0 If Mod($tmp1,16) Then While 1 $PaddingLength+=1 $tmp1 += 1 If Mod($tmp1,16) = 0 Then ExitLoop WEnd EndIf ; ConsoleWrite("$Padding = " & $Padding & @crlf) If $IndexFlags <> "0000" Then ; $SubNodeVCN = StringMid($Entry,$NextEntryOffset+164+($Indx_NameLength*2*2)+$PaddingLength,16) $SubNodeVCNLength = 16 Else ; $SubNodeVCN = "" $SubNodeVCNLength = 0 EndIf ; ConsoleWrite("$SubNodeVCN = " & $SubNodeVCN & @crlf) $NextEntryOffset = $NextEntryOffset+164+($Indx_NameLength*2*2)+$PaddingLength+$SubNodeVCNLength ReDim $IndxEntryNumberArr[1+$EntryCounter] ReDim $IndxMFTReferenceArr[1+$EntryCounter] ; Redim $IndxMFTRefSeqNoArr[1+$EntryCounter] ; ReDim $IndxIndexFlagsArr[1+$EntryCounter] ; ReDim $IndxMFTReferenceOfParentArr[1+$EntryCounter] ; ReDim $IndxMFTParentRefSeqNoArr[1+$EntryCounter] ; ReDim $IndxCTimeArr[1+$EntryCounter] ; ReDim $IndxATimeArr[1+$EntryCounter] ; ReDim $IndxMTimeArr[1+$EntryCounter] ; ReDim $IndxRTimeArr[1+$EntryCounter] ; ReDim $IndxAllocSizeArr[1+$EntryCounter] ; ReDim $IndxRealSizeArr[1+$EntryCounter] ; ReDim $IndxFileFlagsArr[1+$EntryCounter] ReDim $IndxFileNameArr[1+$EntryCounter] ; ReDim $IndxNameSpaceArr[1+$EntryCounter] ; ReDim $IndxSubNodeVCNArr[1+$EntryCounter] $IndxEntryNumberArr[$EntryCounter] = $EntryCounter $IndxMFTReferenceArr[$EntryCounter] = $MFTReference ; $IndxMFTRefSeqNoArr[$EntryCounter] = $MFTReferenceSeqNo ; $IndxIndexFlagsArr[$EntryCounter] = $IndexFlags ; $IndxMFTReferenceOfParentArr[$EntryCounter] = $MFTReferenceOfParent ; $IndxMFTParentRefSeqNoArr[$EntryCounter] = $MFTReferenceOfParentSeqNo ; $IndxCTimeArr[$EntryCounter] = $Indx_CTime ; $IndxATimeArr[$EntryCounter] = $Indx_ATime ; $IndxMTimeArr[$EntryCounter] = $Indx_MTime ; $IndxRTimeArr[$EntryCounter] = $Indx_RTime ; $IndxAllocSizeArr[$EntryCounter] = $Indx_AllocSize ; $IndxRealSizeArr[$EntryCounter] = $Indx_RealSize ; $IndxFileFlagsArr[$EntryCounter] = $Indx_File_Flags $IndxFileNameArr[$EntryCounter] = $Indx_FileName ; $IndxNameSpaceArr[$EntryCounter] = $Indx_NameSpace ; $IndxSubNodeVCNArr[$EntryCounter] = $SubNodeVCN ; _ArrayDisplay($IndxFileNameArr,"$IndxFileNameArr") Until $NextEntryOffset+32 >= StringLen($Entry) ; If $DummyVar Then _ArrayDisplay($IndxFileNameArr,"$IndxFileNameArr") EndFunc Func _AttribHeaderFlags($AHinput) Local $AHoutput = "" If BitAND($AHinput,0x0001) Then $AHoutput &= 'COMPRESSED+' If BitAND($AHinput,0x4000) Then $AHoutput &= 'ENCRYPTED+' If BitAND($AHinput,0x8000) Then $AHoutput &= 'SPARSE+' $AHoutput = StringTrimRight($AHoutput,1) Return $AHoutput EndFunc Func _File_Permissions($FPinput) Local $FPoutput = "" If BitAND($FPinput,0x0001) Then $FPoutput &= 'read_only+' If BitAND($FPinput,0x0002) Then $FPoutput &= 'hidden+' If BitAND($FPinput,0x0004) Then $FPoutput &= 'system+' If BitAND($FPinput,0x0020) Then $FPoutput &= 'archive+' If BitAND($FPinput,0x0040) Then $FPoutput &= 'device+' If BitAND($FPinput,0x0080) Then $FPoutput &= 'normal+' If BitAND($FPinput,0x0100) Then $FPoutput &= 'temporary+' If BitAND($FPinput,0x0200) Then $FPoutput &= 'sparse_file+' If BitAND($FPinput,0x0400) Then $FPoutput &= 'reparse_point+' If BitAND($FPinput,0x0800) Then $FPoutput &= 'compressed+' If BitAND($FPinput,0x1000) Then $FPoutput &= 'offline+' If BitAND($FPinput,0x2000) Then $FPoutput &= 'not_indexed+' If BitAND($FPinput,0x4000) Then $FPoutput &= 'encrypted+' If BitAND($FPinput,0x10000000) Then $FPoutput &= 'directory+' If BitAND($FPinput,0x20000000) Then $FPoutput &= 'index_view+' $FPoutput = StringTrimRight($FPoutput,1) Return $FPoutput EndFunc Func _FillZero($inp) Local $inplen, $out, $tmp = "" $inplen = StringLen($inp) For $i = 1 To 4-$inplen $tmp &= "0" Next $out = $tmp & $inp Return $out EndFunc Func _DecToLittleEndian($DecimalInput) Return _SwapEndian(Hex($DecimalInput,8)) EndFunc Func _StripIndxRecord($Entry) ; ConsoleWrite("Starting function _StripIndxRecord()" & @crlf) Local $LocalAttributeOffset = 1,$IndxHdrUpdateSeqArrOffset,$IndxHdrUpdateSeqArrSize,$IndxHdrUpdSeqArr,$IndxHdrUpdSeqArrPart0,$IndxHdrUpdSeqArrPart1,$IndxHdrUpdSeqArrPart2,$IndxHdrUpdSeqArrPart3,$IndxHdrUpdSeqArrPart4,$IndxHdrUpdSeqArrPart5,$IndxHdrUpdSeqArrPart6,$IndxHdrUpdSeqArrPart7,$IndxHdrUpdSeqArrPart8 Local $IndxRecordEnd1,$IndxRecordEnd2,$IndxRecordEnd3,$IndxRecordEnd4,$IndxRecordEnd5,$IndxRecordEnd6,$IndxRecordEnd7,$IndxRecordEnd8,$IndxRecordSize,$IndxHeaderSize,$IsNotLeafNode ; ConsoleWrite("Unfixed INDX record:" & @crlf) ; ConsoleWrite(_HexEncode("0x"&$Entry) & @crlf) ; ConsoleWrite(_HexEncode("0x" & StringMid($Entry,1,4096)) & @crlf) $IndxHdrUpdateSeqArrOffset = Dec(_SwapEndian(StringMid($Entry,$LocalAttributeOffset+8,4))) ; ConsoleWrite("$IndxHdrUpdateSeqArrOffset = " & $IndxHdrUpdateSeqArrOffset & @crlf) $IndxHdrUpdateSeqArrSize = Dec(_SwapEndian(StringMid($Entry,$LocalAttributeOffset+12,4))) ; ConsoleWrite("$IndxHdrUpdateSeqArrSize = " & $IndxHdrUpdateSeqArrSize & @crlf) $IndxHdrUpdSeqArr = StringMid($Entry,1+($IndxHdrUpdateSeqArrOffset*2),$IndxHdrUpdateSeqArrSize*2*2) ; ConsoleWrite("$IndxHdrUpdSeqArr = " & $IndxHdrUpdSeqArr & @crlf) $IndxHdrUpdSeqArrPart0 = StringMid($IndxHdrUpdSeqArr,1,4) $IndxHdrUpdSeqArrPart1 = StringMid($IndxHdrUpdSeqArr,5,4) $IndxHdrUpdSeqArrPart2 = StringMid($IndxHdrUpdSeqArr,9,4) $IndxHdrUpdSeqArrPart3 = StringMid($IndxHdrUpdSeqArr,13,4) $IndxHdrUpdSeqArrPart4 = StringMid($IndxHdrUpdSeqArr,17,4) $IndxHdrUpdSeqArrPart5 = StringMid($IndxHdrUpdSeqArr,21,4) $IndxHdrUpdSeqArrPart6 = StringMid($IndxHdrUpdSeqArr,25,4) $IndxHdrUpdSeqArrPart7 = StringMid($IndxHdrUpdSeqArr,29,4) $IndxHdrUpdSeqArrPart8 = StringMid($IndxHdrUpdSeqArr,33,4) $IndxRecordEnd1 = StringMid($Entry,1021,4) $IndxRecordEnd2 = StringMid($Entry,2045,4) $IndxRecordEnd3 = StringMid($Entry,3069,4) $IndxRecordEnd4 = StringMid($Entry,4093,4) $IndxRecordEnd5 = StringMid($Entry,5117,4) $IndxRecordEnd6 = StringMid($Entry,6141,4) $IndxRecordEnd7 = StringMid($Entry,7165,4) $IndxRecordEnd8 = StringMid($Entry,8189,4) If $IndxHdrUpdSeqArrPart0 <> $IndxRecordEnd1 OR $IndxHdrUpdSeqArrPart0 <> $IndxRecordEnd2 OR $IndxHdrUpdSeqArrPart0 <> $IndxRecordEnd3 OR $IndxHdrUpdSeqArrPart0 <> $IndxRecordEnd4 OR $IndxHdrUpdSeqArrPart0 <> $IndxRecordEnd5 OR $IndxHdrUpdSeqArrPart0 <> $IndxRecordEnd6 OR $IndxHdrUpdSeqArrPart0 <> $IndxRecordEnd7 OR $IndxHdrUpdSeqArrPart0 <> $IndxRecordEnd8 Then ConsoleWrite("Error the INDX record is corrupt" & @CRLF) Return ; Not really correct because I think in theory chunks of 1024 bytes can be invalid and not just everything or nothing for the given INDX record. Else $Entry = StringMid($Entry,1,1020) & $IndxHdrUpdSeqArrPart1 & StringMid($Entry,1025,1020) & $IndxHdrUpdSeqArrPart2 & StringMid($Entry,2049,1020) & $IndxHdrUpdSeqArrPart3 & StringMid($Entry,3073,1020) & $IndxHdrUpdSeqArrPart4 & StringMid($Entry,4097,1020) & $IndxHdrUpdSeqArrPart5 & StringMid($Entry,5121,1020) & $IndxHdrUpdSeqArrPart6 & StringMid($Entry,6145,1020) & $IndxHdrUpdSeqArrPart7 & StringMid($Entry,7169,1020) & $IndxHdrUpdSeqArrPart8 EndIf $IndxRecordSize = Dec(_SwapEndian(StringMid($Entry,$LocalAttributeOffset+56,8)),2) ; ConsoleWrite("$IndxRecordSize = " & $IndxRecordSize & @crlf) $IndxHeaderSize = Dec(_SwapEndian(StringMid($Entry,$LocalAttributeOffset+48,8)),2) ; ConsoleWrite("$IndxHeaderSize = " & $IndxHeaderSize & @crlf) $IsNotLeafNode = StringMid($Entry,$LocalAttributeOffset+72,2) ;1 if not leaf node $Entry = StringMid($Entry,$LocalAttributeOffset+48+($IndxHeaderSize*2),($IndxRecordSize-$IndxHeaderSize-16)*2) If $IsNotLeafNode = "01" Then ; This flag leads to the entry being 8 bytes of 00's longer than the others. Can be stripped I think. $Entry = StringTrimRight($Entry,16) ; ConsoleWrite("Is not leaf node..." & @crlf) EndIf Return $Entry EndFunc Func _Prep($TargetDevice,$IndexNumber,$TargetFileName) Local $RetRec[2],$PathTmp,$NewRecord,$TmpOffsetTarget If StringIsDigit($IndexNumber) Then ;Target specified by IndexNumber Global $DataQ[1] ;Target ; ConsoleWrite("Target specified by IndexNumber" & @CRLF) $RetRec = _FindFileMFTRecord($TargetDevice,$IndexNumber) $TmpOffsetTarget = $RetRec[0] $NewRecord = $RetRec[1] If _DecodeMFTRecord($TargetDevice,$NewRecord,1) < 1 Then ConsoleWrite("Could not verify MFT record at offset: 0x" & Hex($TmpOffsetTarget) & @CRLF) Return 0 EndIf _DecodeNameQ($NameQ) $InfoArrShadowMainTarget[0] = $HEADER_MFTREcordNumber $InfoArrShadowMainTarget[1] = $FN_FileName $InfoArrShadowMainTarget[2] = $TmpOffsetTarget $InfoArrShadowParent[0] = $FN_ParentReferenceNo ;If StringInStr($SIArrValue[8][1],"directory") Then If StringInStr($FNArrValue[9][1],"directory") Then ;$IsDirectory = 1 Else ;$IsDirectory = 0 EndIf If $HEADER_MFTREcordNumber = $FN_ParentReferenceNo = 5 Then ;$ParentMode=0 Else ;$ParentMode=1 EndIf ;Parent of target $RetRec = _FindFileMFTRecord($TargetDevice,$FN_ParentReferenceNo) $TmpOffsetTarget = $RetRec[0] $NewRecord = $RetRec[1] $DoIndxOffsetArray=1 If _DecodeMFTRecord($TargetDevice,$NewRecord,1) < 1 Then ConsoleWrite("Could not verify MFT record at offset: 0x" & Hex($TmpOffsetTarget) & @CRLF) Return 0 EndIf $DoIndxOffsetArray=0 $IsCurrentIndxOfParent=0 If $InfoArrShadowParent[0] <> $HEADER_MFTREcordNumber Then ConsoleWrite("Error: Validating ref of target record" & @CRLF) Return 0 EndIf $InfoArrShadowParent[1] = $FN_FileName $InfoArrShadowParent[2] = $TmpOffsetTarget ; If Not _PopulateIndxTimestamps($InfoArrShadowMainTarget[1],$InfoArrShadowMainTarget[0]) Then ; ConsoleWrite("Error: Retrieving INDX timestamps failed" & @CRLF) ; Return 0 ; EndIf Else ; $TargetFileNameTmp = $TargetFileName ; If StringInStr($TargetFileNameTmp,"GLOBALROOT\Device\HarddiskVolumeShadowCopy") Then $TargetFileNameTmp = StringReplace($TargetFileNameTmp,"GLOBALROOT\Device\HarddiskVolumeShadowCopy","GLOBALROOTDeviceHarddiskVolumeShadowCopy") ;Target specified by full path $PathTmp = _SplitPath($TargetFileName) If @error Then ConsoleWrite("Error in _SplitPath() resolving path to: " & $TargetFileName & @CRLF) Return 0 EndIf ; _ArrayDisplay($PathTmp,"$PathTmp") ; If StringInStr($PathTmp[0],"GLOBALROOTDeviceHarddiskVolumeShadowCopy") Then $PathTmp[0] = StringReplace($PathTmp[0],"GLOBALROOTDeviceHarddiskVolumeShadowCopy","GLOBALROOT\Device\HarddiskVolumeShadowCopy") Select Case $PathTmp[2] = "" And $PathTmp[1] = "" ;Root directory ; ConsoleWrite("Case 1" & @CRLF) ;Target $RetRec = _FindFileMFTRecord($TargetDevice,5) $TmpOffsetTarget = $RetRec[0] $NewRecord = $RetRec[1] If _DecodeMFTRecord($TargetDevice,$NewRecord,1) < 1 Then ConsoleWrite("Could not verify MFT record at offset: 0x" & Hex($RetRec[0]) & @CRLF) Return 0 EndIf If 5 <> $HEADER_MFTREcordNumber Then ConsoleWrite("Error: Validating ref of target record" & @CRLF) Return 0 EndIf If StringInStr($FNArrValue[9][1],"directory") Then ;$IsDirectory = 1 Else ;$IsDirectory = 0 EndIf $InfoArrShadowMainTarget[0] = $HEADER_MFTREcordNumber $InfoArrShadowMainTarget[1] = $FN_FileName $InfoArrShadowMainTarget[2] = $TmpOffsetTarget $InfoArrShadowParent[0] = "" ;$ParentMode=0 Case $PathTmp[2] = "" And $PathTmp[1] <> "" ;1 level down from root ; ConsoleWrite("Case 2" & @CRLF) ;Parent of target $RetRec = _FindFileMFTRecord($TargetDevice,5) $TmpOffsetTarget = $RetRec[0] $NewRecord = $RetRec[1] $DoIndxOffsetArray=1 If _DecodeMFTRecord($TargetDevice,$NewRecord,1) < 1 Then ConsoleWrite("Could not verify MFT record at offset: 0x" & Hex($RetRec[0]) & @CRLF) Return 0 EndIf $DoIndxOffsetArray=0 $IsCurrentIndxOfParent=0 If 5 <> $HEADER_MFTREcordNumber Then ConsoleWrite("Error: Validating ref of target record" & @CRLF) Return 0 EndIf $InfoArrShadowParent[0] = $HEADER_MFTREcordNumber $InfoArrShadowParent[1] = $FN_FileName $InfoArrShadowParent[2] = $TmpOffsetTarget ; ConsoleWrite("$InfoArrShadowParent[0]: " & $InfoArrShadowParent[0] & @CRLF) ; ConsoleWrite("$InfoArrShadowParent[1]: " & $InfoArrShadowParent[1] & @CRLF) ; ConsoleWrite("$InfoArrShadowParent[2]: " & $InfoArrShadowParent[2] & @CRLF) ;Target ; $TmpRef = _RawResolveRef($TargetDevice,$PathTmp[0], $PathTmp[1]) $TmpRef = _RawResolveRef2($TargetDevice,$PathTmp[0], $PathTmp[1], 0) If $TmpRef Then ; ConsoleWrite("$TmpRef: " & $TmpRef & @CRLF) Else ConsoleWrite("Error resolving: " & $PathTmp[0] & "\" & $PathTmp[1] & @CRLF) Return 0 EndIf $RetRec = _FindFileMFTRecord($TargetDevice,$TmpRef) $TmpOffsetTarget = $RetRec[0] $NewRecord = $RetRec[1] ; If Not _PopulateIndxTimestamps($PathTmp[1],$TmpRef) Then ; ConsoleWrite("Error: Retrieving INDX timestamps failed" & @CRLF) ; Return 0 ; EndIf If _DecodeMFTRecord($TargetDevice,$NewRecord,1) < 1 Then ConsoleWrite("Could not verify MFT record at offset: 0x" & Hex($RetRec[0]) & @CRLF) Return 0 EndIf If $TmpRef <> $HEADER_MFTREcordNumber And 5 <> $FN_ParentReferenceNo Then ConsoleWrite("Error: Validating refs of target record" & @CRLF) Return 0 EndIf If StringInStr($FNArrValue[9][1],"directory") Then ;$IsDirectory = 1 Else ;$IsDirectory = 0 EndIf $InfoArrShadowMainTarget[0] = $HEADER_MFTREcordNumber $InfoArrShadowMainTarget[1] = $FN_FileName $InfoArrShadowMainTarget[2] = $TmpOffsetTarget ; ConsoleWrite("$InfoArrShadowMainTarget[0]: " & $InfoArrShadowMainTarget[0] & @CRLF) ; ConsoleWrite("$InfoArrShadowMainTarget[1]: " & $InfoArrShadowMainTarget[1] & @CRLF) ; ConsoleWrite("$InfoArrShadowMainTarget[2]: " & $InfoArrShadowMainTarget[2] & @CRLF) ;$ParentMode=1 Case $PathTmp[2] <> "" And $PathTmp[1] <> "" ;Anything from 2 or more levels down from root ; ConsoleWrite("Case 3" & @CRLF) ;Parent of target ; $TmpRef = _RawResolveRef($TargetDevice,$PathTmp[0], $PathTmp[1]) $TmpRef = _RawResolveRef2($TargetDevice,$PathTmp[0], $PathTmp[1], 0) If $TmpRef Then ; ConsoleWrite("$TmpRef: " & $TmpRef & @CRLF) Else ConsoleWrite("Error resolving: " & $PathTmp[0] & "\" & $PathTmp[1] & @CRLF) Return 0 EndIf $RetRec = _FindFileMFTRecord($TargetDevice,$TmpRef) $TmpOffsetTarget = $RetRec[0] $NewRecord = $RetRec[1] $DoIndxOffsetArray=1 If _DecodeMFTRecord($TargetDevice,$NewRecord,1) < 1 Then ConsoleWrite("Could not verify MFT record at offset: 0x" & Hex($RetRec[0]) & @CRLF) Return 0 EndIf $DoIndxOffsetArray=0 $IsCurrentIndxOfParent=0 If $TmpRef <> $HEADER_MFTREcordNumber Then ConsoleWrite("Error: Validating ref of target record" & @CRLF) return 0 EndIf $InfoArrShadowParent[0] = $HEADER_MFTREcordNumber $InfoArrShadowParent[1] = $FN_FileName $InfoArrShadowParent[2] = $TmpOffsetTarget ;Target ; $TmpRef = _RawResolveRef($TargetDevice,$PathTmp[0] & "\" & $PathTmp[1], $PathTmp[2]) $TmpRef = _RawResolveRef2($TargetDevice,$PathTmp[0] & "\" & $PathTmp[1], $PathTmp[2], 0) If $TmpRef Then ; ConsoleWrite("$TmpRef: " & $TmpRef & @CRLF) Else ConsoleWrite("Error resolving: " & $PathTmp[0] & "\" & $PathTmp[1] & "\" & $PathTmp[2] & @CRLF) Return 0 EndIf $RetRec = _FindFileMFTRecord($TargetDevice,$TmpRef) $TmpOffsetTarget = $RetRec[0] $NewRecord = $RetRec[1] ; If Not _PopulateIndxTimestamps($PathTmp[2],$TmpRef) Then ; ConsoleWrite("Error: Retrieving INDX timestamps failed" & @CRLF) ; Return 0 ; EndIf If _DecodeMFTRecord($TargetDevice,$NewRecord,1) < 1 Then ConsoleWrite("Could not verify MFT record at offset: 0x" & Hex($RetRec[0]) & @CRLF) Return 0 EndIf If $TmpRef <> $HEADER_MFTREcordNumber And 5 <> $FN_ParentReferenceNo Then ConsoleWrite("Error: Validating refs of target record" & @CRLF) Return 0 EndIf ;If StringInStr($SIArrValue[8][1],"directory") Then If StringInStr($FNArrValue[9][1],"directory") Then ;$IsDirectory = 1 Else ;$IsDirectory = 0 EndIf $InfoArrShadowMainTarget[0] = $HEADER_MFTREcordNumber $InfoArrShadowMainTarget[1] = $FN_FileName $InfoArrShadowMainTarget[2] = $TmpOffsetTarget ;$ParentMode=1 EndSelect EndIf ConsoleWrite("Target filename: " & $InfoArrShadowMainTarget[1] & @CRLF) ConsoleWrite("Target fileref: " & $InfoArrShadowMainTarget[0] & @CRLF) ConsoleWrite("Target MFT record offset: 0x" & Hex($InfoArrShadowMainTarget[2]) & @CRLF) ConsoleWrite("Parent filename: " & $InfoArrShadowParent[1] & @CRLF) ConsoleWrite("Parent fileref: " & $InfoArrShadowParent[0] & @CRLF) ConsoleWrite("Parent MFT record offset: 0x" & Hex($InfoArrShadowParent[2]) & @CRLF & @CRLF) Global $IndxFileNameFromParentCurrentArr = $IndxFileNameFromParentArr Global $IndxMFTReferenceFromParentCurrentArr = $IndxMFTReferenceFromParentArr Global $IndxMFTReferenceOfParentFromParentCurrentArr = $IndxMFTReferenceOfParentFromParentArr Global $IndxCTimeFromParentCurrentArr = $IndxCTimeFromParentArr Global $IndxATimeFromParentCurrentArr = $IndxATimeFromParentArr Global $IndxMTimeFromParentCurrentArr = $IndxMTimeFromParentArr Global $IndxRTimeFromParentCurrentArr = $IndxRTimeFromParentArr Return 1 EndFunc Func _SplitPath($InPath) Local $Reconstruct,$FilePathSplit[3], $DirArray ; ConsoleWrite("_SplitPath()" & @CRLF) ; ConsoleWrite("$InPath: " & $InPath & @CRLF) If StringRight($InPath,1) = "\" Then $InPath = StringTrimRight($InPath,1) $DirArray = StringSplit($InPath,"\") ; ConsoleWrite("$DirArray[0]: " & $DirArray[0] & @CRLF) If StringLen($InPath) = 2 Then $FilePathSplit[0] = $InPath $FilePathSplit[1] = "" $FilePathSplit[2] = "" Return $FilePathSplit EndIf If $DirArray[0] = 2 Then $FilePathSplit[0] = $DirArray[1] $FilePathSplit[1] = $DirArray[2] $FilePathSplit[2] = "" Return $FilePathSplit EndIf For $i = 1 To $DirArray[0]-2 ; ConsoleWrite("$DirArray[$i]: " & $DirArray[$i] & @CRLF) $Reconstruct &= $DirArray[$i]&"\" Next $Reconstruct = StringTrimRight($Reconstruct,1) $FilePathSplit[0] = $Reconstruct $FilePathSplit[1] = $DirArray[Ubound($DirArray)-2] $FilePathSplit[2] = $DirArray[Ubound($DirArray)-1] Return $FilePathSplit EndFunc Func _GenDirArray($InPath) Local $Reconstruct ; ConsoleWrite("_GenDirArray()" & @CRLF) ; ConsoleWrite("$InPath: " & $InPath & @CRLF) Global $DirArray = StringSplit($InPath,"\") ;$LockedFileName = $DirArray[$DirArray[0]] For $i = 1 To $DirArray[0]-1 $Reconstruct &= $DirArray[$i]&"\" Next $Reconstruct = StringTrimRight($Reconstruct,1) Return $Reconstruct EndFunc Func _RawResolveRef($TargetDevice,$ParentPath, $FileName) Local $NextRef,$RetRec[2],$NewRecord Local $ResolvedRef=0 ;We don't use this function for resolving $MFT itself anyway ; ConsoleWrite("_RawResolveRef()" & @CRLF) ; ConsoleWrite("$ParentPath: " & $ParentPath & @CRLF) ; ConsoleWrite("$FileName: " & $FileName & @CRLF) If StringLen($ParentPath)=2 Then $ParentPath&="\" ;$ParentDir = _GenDirArray($ParentPath) _GenDirArray($ParentPath) ; ConsoleWrite("$ParentDir: " & $ParentDir & @CRLF) Global $MftRefArray[$DirArray[0]+1] _ReadBootSector($TargetDevice) $BytesPerCluster = $SectorsPerCluster*$BytesPerSector $MFTEntry = _FindMFT($TargetDevice,0) If _DecodeMFTRecord($TargetDrive,$MFTEntry,0) < 1 Then ConsoleWrite("Could not verify MFT record of MFT itself (volume corrupt)" & @CRLF) Return 0 EndIf _DecodeDataQEntry($DataQ[1]) $MFTSize = $DATA_RealSize Global $RUN_VCN[1], $RUN_Clusters[1] _ExtractDataRuns() $MFT_RUN_VCN = $RUN_VCN $MFT_RUN_Clusters = $RUN_Clusters $NextRef = 5 $MftRefArray[1]=$NextRef ;$ResolvedPath = $DirArray[1] For $i = 2 To $DirArray[0] Global $DataQ[1] $RetRec = _FindFileMFTRecord($TargetDevice,$NextRef) $NewRecord = $RetRec[1] If _DecodeMFTRecord($TargetDevice,$NewRecord,1) < 1 Then ConsoleWrite("Could not verify MFT record at offset: 0x" & $RetRec[0] & @CRLF) Return 0 EndIf $NextRef = _ParseIndex($DirArray[$i]) $MftRefArray[$i]=$NextRef ; ConsoleWrite("$MftRefArray[$i]: " & $MftRefArray[$i] & @CRLF) If @error Then Global $DataQ[1] $RetRec = _FindFileMFTRecord($TargetDevice,$MftRefArray[$i-1]) $NewRecord = $RetRec[1] If _DecodeMFTRecord($TargetDevice,$NewRecord,1) < 1 Then ConsoleWrite("Could not verify MFT record at offset: 0x" & $RetRec[0] & @CRLF) Return 0 EndIf $ResolvedRef = _GetMftRefFromIndex($FileName) ElseIf $i=$DirArray[0] Then Global $DataQ[1] ; ConsoleWrite("$MftRefArray[$i]: " & $MftRefArray[$i] & @CRLF) $RetRec = _FindFileMFTRecord($TargetDevice,$MftRefArray[$i]) $NewRecord = $RetRec[1] If _DecodeMFTRecord($TargetDevice,$NewRecord,1) < 1 Then ConsoleWrite("Could not verify MFT record at offset: 0x" & $RetRec[0] & @CRLF) Return 0 EndIf ;$LastCheck = _DisplayList($ResolvedPath & "\" & $DirArray[$i]) ; ConsoleWrite("$FileName: " & $FileName & @CRLF) $ResolvedRef = _GetMftRefFromIndex($FileName) If @error Then ; In case last part was a file and not a directory Global $DataQ[1] $RetRec = _FindFileMFTRecord($TargetDevice,$MftRefArray[$i-1]) $NewRecord = $RetRec[1] If _DecodeMFTRecord($TargetDevice,$NewRecord,1) < 1 Then ConsoleWrite("Could not verify MFT record at offset: 0x" & $RetRec[0] & @CRLF) Return 0 EndIf ;$LastCheck = _DisplayList($ResolvedPath) $ResolvedRef = _GetMftRefFromIndex($FileName) EndIf ElseIf StringIsDigit($NextRef) Then ;$ResolvedPath &= "\" & $DirArray[$i] ContinueLoop Else ConsoleWrite("Error: Something went wrong" & @CRLF) ExitLoop EndIf Next ; If StringRight($ParentPath,1) = "\" Then $ParentPath = StringTrimRight($ParentPath,1) ; If $FileName <> "$MFT" And $ResolvedRef <> 0 Then ConsoleWrite("MFT Ref of " & $ParentPath & "\" & $FileName & ": " & $ResolvedRef & @CRLF) Return $ResolvedRef EndFunc Func _RawResolveRef2($TargetDevice,$ParentPath, $FileName, $ReParseNtfs) Local $NextRef,$RetRec[2],$NewRecord Local $ResolvedRef=0 ;We don't use this function for resolving $MFT itself anyway ; ConsoleWrite("$ParentPath: " & $ParentPath & @CRLF) ; ConsoleWrite("$FileName: " & $FileName & @CRLF) If StringLen($ParentPath)=2 Then $ParentPath&="\" ;$ParentDir = _GenDirArray($ParentPath) _GenDirArray($ParentPath) ; ConsoleWrite("$ParentDir: " & $ParentDir & @CRLF) Global $MftRefArray[$DirArray[0]+1] If $ReParseNtfs Then _ReadBootSector($TargetDevice) If @error Then ConsoleWrite("Error: Filesystem not NTFS" & @CRLF) Exit EndIf $hDisk = _WinAPI_CreateFile($TargetDevice,2,2,7) If $hDisk = 0 Then ConsoleWrite("CreateFile: " & _WinAPI_GetLastErrorMessage() & @CRLF) Exit EndIf $MFTEntry = _FindMFT($TargetDevice,0) If $MFTEntry = "" Then ;something wrong with record for $MFT ConsoleWrite("Error: Getting MFT record 0" & @CRLF) Exit EndIf $MFT = _DecodeMFTRecord0($MFTEntry, 0) ;produces DataQ for $MFT, record 0 If $MFT = "" Then ConsoleWrite("Error: Parsing the MFT record 0" & @CRLF) Exit EndIf _GetRunsFromAttributeListMFT0() ;produces datarun for $MFT and converts datarun to RUN_VCN[] and RUN_Clusters[] _WinAPI_CloseHandle($hDisk) $MFTSize = $DATA_RealSize $MFT_RUN_VCN = $RUN_VCN $MFT_RUN_Clusters = $RUN_Clusters _GenRefArray() EndIf $NextRef = 5 $MftRefArray[1]=$NextRef ;$ResolvedPath = $DirArray[1] For $i = 2 To $DirArray[0] Global $DataQ[1] ; ConsoleWrite("Test A: " & $i & @CRLF) $RetRec = _FindFileMFTRecord($TargetDevice,$NextRef) If Not IsArray($RetRec) Then Return SetError(1,0,0) $NewRecord = $RetRec[1] ; ConsoleWrite("Test B: " & $i & @CRLF) If _DecodeMFTRecord($TargetDevice,$NewRecord,1) < 1 Then ConsoleWrite("Could not verify MFT record at offset: 0x" & $RetRec[0] & @CRLF) Return 0 EndIf ; ConsoleWrite("Test C: " & $i & @CRLF) $NextRef = _ParseIndex($DirArray[$i]) ; ConsoleWrite("Test D: " & $i & @CRLF) $MftRefArray[$i]=$NextRef If @error Then Global $DataQ[1] $RetRec = _FindFileMFTRecord($TargetDevice,$MftRefArray[$i-1]) If Not IsArray($RetRec) Then Return SetError(1,0,0) $NewRecord = $RetRec[1] If _DecodeMFTRecord($TargetDevice,$NewRecord,1) < 1 Then ConsoleWrite("Could not verify MFT record at offset: 0x" & $RetRec[0] & @CRLF) Return 0 EndIf $ResolvedRef = _GetMftRefFromIndex($FileName) ElseIf $i=$DirArray[0] Then Global $DataQ[1] $RetRec = _FindFileMFTRecord($TargetDevice,$MftRefArray[$i]) If Not IsArray($RetRec) Then Return SetError(1,0,0) $NewRecord = $RetRec[1] If _DecodeMFTRecord($TargetDevice,$NewRecord,1) < 1 Then ConsoleWrite("Could not verify MFT record at offset: 0x" & $RetRec[0] & @CRLF) Return 0 EndIf $ResolvedRef = _GetMftRefFromIndex($FileName) If @error Then ; In case last part was a file and not a directory Global $DataQ[1] $RetRec = _FindFileMFTRecord($TargetDevice,$MftRefArray[$i-1]) If Not IsArray($RetRec) Then Return SetError(1,0,0) $NewRecord = $RetRec[1] If _DecodeMFTRecord($TargetDevice,$NewRecord,1) < 1 Then ConsoleWrite("Could not verify MFT record at offset: 0x" & $RetRec[0] & @CRLF) Return 0 EndIf $ResolvedRef = _GetMftRefFromIndex($FileName) EndIf ElseIf StringIsDigit($NextRef) Then ;$ResolvedPath &= "\" & $DirArray[$i] ContinueLoop Else ConsoleWrite("Error: Something went wrong" & @CRLF) ExitLoop EndIf Next ; If StringRight($ParentPath,1) = "\" Then $ParentPath = StringTrimRight($ParentPath,1) ; If $FileName <> "$MFT" And $ResolvedRef <> 0 Then ConsoleWrite("MFT Ref of " & $ParentPath & "\" & $FileName & ": " & $ResolvedRef & @CRLF) Return $ResolvedRef EndFunc Func _DecodeNameQ($NameQ) For $name = 1 To UBound($NameQ) - 1 $NameString = $NameQ[$name] If $NameString = "" Then ContinueLoop ;$FN_AllocSize = Dec(_SwapEndian(StringMid($NameString,129,16)),2) ;$FN_RealSize = Dec(_SwapEndian(StringMid($NameString,145,16)),2) $FN_NameLength = Dec(StringMid($NameString,177,2)) $FN_NameSpace = StringMid($NameString,179,2) Select Case $FN_NameSpace = '00' $FN_NameSpace = 'POSIX' Case $FN_NameSpace = '01' $FN_NameSpace = 'WIN32' Case $FN_NameSpace = '02' $FN_NameSpace = 'DOS' Case $FN_NameSpace = '03' $FN_NameSpace = 'DOS+WIN32' Case Else $FN_NameSpace = 'UNKNOWN' EndSelect $FN_FileName = StringMid($NameString,181,$FN_NameLength*4) $FN_FileName = _UnicodeHexToStr($FN_FileName) ;If StringLen($FN_FileName) <> $FN_NameLength Then $INVALID_FILENAME = 1 Next Return EndFunc Func _ParseIndex($TestName) If $AttributesArr[10][2] = "TRUE" Then; $INDEX_ALLOCATION For $j = 1 To Ubound($IndxFileNameArr)-1 If $IndxFileNameArr[$j] = $TestName Then Return $IndxMFTReferenceArr[$j] Else ; Return SetError(1,0,0) EndIf Next ElseIf $AttributesArr[9][2] = "TRUE" Then ;And $ResidentIndx Then ; $INDEX_ROOT For $j = 1 To Ubound($IndxFileNameArr)-1 If $IndxFileNameArr[$j] = $TestName Then Return $IndxMFTReferenceArr[$j] Else ; Return SetError(1,0,0) EndIf Next Else ; ConsoleWrite("Error: No index found for: " & $TestName & @CRLF) Return SetError(1,0,0) EndIf EndFunc Func _GetMftRefFromIndex($TargetName) If $AttributesArr[10][2] = "TRUE" Then ;ConsoleWrite("Directory listing for: " & $DirListPath & @CRLF & @CRLF) For $j = 1 To Ubound($IndxFileNameArr)-1 If $IndxFileNameArr[$j] = $TargetName Then $ResolvedMftRef = $IndxMFTReferenceArr[$j] Return $ResolvedMftRef EndIf Next ElseIf $AttributesArr[9][2] = "TRUE" Then ;ConsoleWrite("Directory listing for: " & $DirListPath & @CRLF & @CRLF) For $j = 1 To Ubound($IndxFileNameArr)-1 If $IndxFileNameArr[$j] = $TargetName Then $ResolvedMftRef = $IndxMFTReferenceArr[$j] Return $ResolvedMftRef EndIf Next Else ; ConsoleWrite("Error: There was no index found for the parent folder." & @CRLF) Return SetError(1,0,0) EndIf EndFunc #cs Func _PopulateIndxTimestamps($InputFileName,$InputIndexNumber) Local $Counter=0 ; ConsoleWrite("$InputFileName: " & $InputFileName & @CRLF & @CRLF) ; ConsoleWrite("$InputIndexNumber: " & $InputIndexNumber & @CRLF & @CRLF) Global $IndxCTimeFromParent,$IndxATimeFromParent,$IndxMTimeFromParent,$IndxRTimeFromParent Global $IndxFileNameFromParentArr[1],$IndxMFTReferenceFromParentArr[1],$IndxMFTReferenceOfParentFromParentArr[1],$IndxCTimeFromParentArr[1],$IndxATimeFromParentArr[1],$IndxMTimeFromParentArr[1],$IndxRTimeFromParentArr[1] If $AttributesArr[10][2] = "TRUE" Then; $INDEX_ALLOCATION ;_ArrayDisplay($IndxATimeArr,"$IndxATimeArr") ;_ArrayDisplay($IndxFileNameArr,"$IndxFileNameArr") ;_ArrayDisplay($IndxMFTReferenceArr,"$IndxMFTReferenceArr") For $j = 1 To Ubound($IndxFileNameArr)-1 If $IndxMFTReferenceArr[$j] = $InputIndexNumber Then ;If $IndxFileNameArr[$j] = $InputFileName And $IndxMFTReferenceArr[$j] = $InputIndexNumber Then ;Comparing against the shortname will not always work as the GetShortPathName api will throw Acess Denied on certain files $Counter+=1 Redim $IndxFileNameFromParentArr[$Counter] Redim $IndxMFTReferenceFromParentArr[$Counter] Redim $IndxMFTReferenceOfParentFromParentArr[$Counter] Redim $IndxCTimeFromParentArr[$Counter] Redim $IndxATimeFromParentArr[$Counter] Redim $IndxMTimeFromParentArr[$Counter] Redim $IndxRTimeFromParentArr[$Counter] $IndxFileNameFromParentArr[$Counter-1] = $IndxFileNameArr[$j] $IndxMFTReferenceFromParentArr[$Counter-1] = $IndxMFTReferenceArr[$j] $IndxMFTReferenceOfParentFromParentArr[$Counter-1] = $IndxMFTReferenceOfParentArr[$j] $IndxCTimeFromParentArr[$Counter-1] = $IndxCTimeArr[$j] $IndxATimeFromParentArr[$Counter-1] = $IndxATimeArr[$j] $IndxMTimeFromParentArr[$Counter-1] = $IndxMTimeArr[$j] $IndxRTimeFromParentArr[$Counter-1] = $IndxRTimeArr[$j] ; Return 1 EndIf Next If $Counter Then Return 1 ElseIf $AttributesArr[9][2] = "TRUE" And $ResidentIndx Then ; $INDEX_ROOT ;_ArrayDisplay($IndxFileNameArr,"$IndxFileNameArr") ;_ArrayDisplay($IndxMFTReferenceArr,"$IndxMFTReferenceArr") For $j = 1 To Ubound($IndxFileNameArr)-1 ; If $DummyVar Then ConsoleWrite("$IndxFileNameArr[$j]: " & $IndxFileNameArr[$j] & @crlf) If $IndxMFTReferenceArr[$j] = $InputIndexNumber Then ;If $IndxFileNameArr[$j] = $InputFileName And $IndxMFTReferenceArr[$j] = $InputIndexNumber Then $Counter+=1 Redim $IndxFileNameFromParentArr[$Counter] Redim $IndxMFTReferenceFromParentArr[$Counter] Redim $IndxMFTReferenceOfParentFromParentArr[$Counter] Redim $IndxCTimeFromParentArr[$Counter] Redim $IndxATimeFromParentArr[$Counter] Redim $IndxMTimeFromParentArr[$Counter] Redim $IndxRTimeFromParentArr[$Counter] $IndxFileNameFromParentArr[$Counter-1] = $IndxFileNameArr[$j] $IndxMFTReferenceFromParentArr[$Counter-1] = $IndxMFTReferenceArr[$j] $IndxMFTReferenceOfParentFromParentArr[$Counter-1] = $IndxMFTReferenceOfParentArr[$j] $IndxCTimeFromParentArr[$Counter-1] = $IndxCTimeArr[$j] $IndxATimeFromParentArr[$Counter-1] = $IndxATimeArr[$j] $IndxMTimeFromParentArr[$Counter-1] = $IndxMTimeArr[$j] $IndxRTimeFromParentArr[$Counter-1] = $IndxRTimeArr[$j] ; Return 1 EndIf Next If $Counter Then Return 1 EndIf Return 0 EndFunc #ce Func _DoSparse($r,$hFile,$FileSize) Local $nBytes If Not IsDllStruct($sBuffer) Then _CreateSparseBuffer() $i = $RUN_Clusters[$r] While $i > 16 And $FileSize > $BytesPerCluster * 16 _WinAPI_WriteFile($hFile, DllStructGetPtr($sBuffer), $BytesPerCluster * 16, $nBytes) $i -= 16 $FileSize -= $BytesPerCluster * 16 ;$ProgressSize = $FileSize WEnd If $i <> 0 Then If $FileSize > $BytesPerCluster * $i Then _WinAPI_WriteFile($hFile, DllStructGetPtr($sBuffer), $BytesPerCluster * $i, $nBytes) $FileSize -= $BytesPerCluster * $i ;$ProgressSize = $FileSize Else _WinAPI_WriteFile($hFile, DllStructGetPtr($sBuffer), $FileSize, $nBytes) ;$ProgressSize = 0 Return 0 EndIf EndIf Return $FileSize EndFunc Func _CreateSparseBuffer() $sBuffer = DllStructCreate("byte[" & $BytesPerCluster * 16 & "]") For $i = 1 To $BytesPerCluster * 16 DllStructSetData ($sBuffer, $i, 0) Next EndFunc Func _DecodeMFTRecord0($record, $FileRef) ;produces DataQ ;$MftAttrListString="," ; ConsoleWrite(_HexEncode($record)&@CRLF) $record = _DoFixup($record) If $record = "" then Return "" ;corrupt, failed fixup $RecordSize = Dec(_SwapEndian(StringMid($record,51,8)),2) $AttributeOffset = (Dec(StringMid($record,43,2))*2)+3 While 1 ;only want Attribute List and Data Attributes $Type = Dec(_SwapEndian(StringMid($record,$AttributeOffset,8)),2) If $Type > 256 Then ExitLoop ;attributes may not be in numerical order $AttributeSize = Dec(_SwapEndian(StringMid($record,$AttributeOffset+8,8)),2) If $Type = 32 Then $AttrList = StringMid($record,$AttributeOffset,$AttributeSize*2) ;whole attribute $AttrList = _DecodeAttrList2($FileRef, $AttrList) ;produces $AttrQ - extra record list ; ConsoleWrite("$AttrList: " & $AttrList & @CRLF) If $AttrList = "" Then ; _DebugOut($FileRef & " Bad Attribute List signature", $record) ConsoleWrite($FileRef & " Bad Attribute List signature" & @CRLF) Return "" Else If $AttrQ[0] = "" Then ContinueLoop ;no new records $str = "" For $i = 1 To $AttrQ[0] ;$MftAttrListString &= $AttrQ[$i] & "," ; ConsoleWrite("$AttrQ[$i]: " & $AttrQ[$i] & @CRLF) If Not IsNumber(Int($AttrQ[$i])) Then ; _DebugOut($FileRef & " Overwritten extra record (" & $AttrQ[$i] & ")", $record) Return "" EndIf ; ConsoleWrite("$AttrQ[$i]: " & $AttrQ[$i] & @CRLF) $rec = _GetAttrListMFTRecord(($AttrQ[$i]*$MFT_Record_Size)+($LogicalClusterNumberforthefileMFT*$BytesPerCluster)) If StringMid($rec,3,8) <> $RecordSignature Then ; _DebugOut($FileRef & " Bad signature for extra record", $record) ; _DebugOut($FileRef & " Bad signature for extra record", $rec) Return "" EndIf If Dec(_SwapEndian(StringMid($rec,67,8)),2) <> $FileRef Then ; _DebugOut($FileRef & " Bad extra record", $record) Return "" EndIf ; $rec = _StripMftRecord($rec, $FileRef) $rec = _StripMftRecord($rec) If $rec = "" Then ; _DebugOut($FileRef & " Extra record failed Fixup", $record) Return "" EndIf $str &= $rec ;no header or end marker Next $record = StringMid($record,1,($RecordSize-8)*2+2) & $str & "FFFFFFFF" ;strip end first then add EndIf ElseIf $Type = 128 Then ReDim $DataQ[UBound($DataQ) + 1] $DataQ[UBound($DataQ) - 1] = StringMid($record,$AttributeOffset,$AttributeSize*2) ;whole data attribute EndIf $AttributeOffset += $AttributeSize*2 WEnd Return $record EndFunc Func _GetRunsFromAttributeListMFT0() For $i = 1 To UBound($DataQ) - 1 _DecodeDataQEntry($DataQ[$i]) If $NonResidentFlag = '00' Then ; ConsoleWrite("Resident" & @CRLF) Else Global $RUN_VCN[1], $RUN_Clusters[1] $TotalClusters = $Data_Clusters $RealSize = $DATA_RealSize ;preserve file sizes If Not $InitState Then $DATA_InitSize = $DATA_RealSize $InitSize = $DATA_InitSize _ExtractDataRuns() If $TotalClusters * $BytesPerCluster >= $RealSize Then ; _ExtractFile($MFTRecord) Else ;code to handle attribute list $Flag = $IsCompressed ;preserve compression state For $j = $i + 1 To UBound($DataQ) -1 _DecodeDataQEntry($DataQ[$j]) $TotalClusters += $Data_Clusters _ExtractDataRuns() If $TotalClusters * $BytesPerCluster >= $RealSize Then $DATA_RealSize = $RealSize ;restore file sizes $DATA_InitSize = $InitSize $IsCompressed = $Flag ;recover compression state ExitLoop EndIf Next $i = $j EndIf EndIf Next EndFunc Func _GetAttrListMFTRecord($Pos) Local $nBytes Local $rBuffer = DllStructCreate("byte["&$MFT_Record_Size&"]") Local $hFile = _WinAPI_CreateFile($TargetDrive,2,2,7) If $hFile = 0 then ConsoleWrite("Error CreateFile: " & _WinAPI_GetLastErrorMessage() & " for: " & $TargetDrive & @crlf) Return SetError(1,0,0) EndIf _WinAPI_SetFilePointerEx($hFile, $ImageOffset+$Pos, $FILE_BEGIN) _WinAPI_ReadFile($hFile, DllStructGetPtr($rBuffer), $MFT_Record_Size, $nBytes) $record = DllStructGetData($rBuffer, 1) _WinAPI_CloseHandle($hFile) Return $record ;returns MFT record for file EndFunc Func _DecodeAttrList2($FileRef, $AttrList) Local $offset, $nBytes, $List = "", $str = "" Local $hFile = _WinAPI_CreateFile($TargetDrive,2,2,7) If $hFile = 0 then ConsoleWrite("Error CreateFile: " & _WinAPI_GetLastErrorMessage() & " for: " & $TargetDrive & @crlf) Return SetError(1,0,0) EndIf If StringMid($AttrList, 17, 2) = "00" Then ;attribute list is resident in AttrList $offset = Dec(_SwapEndian(StringMid($AttrList, 41, 4))) $List = StringMid($AttrList, $offset*2+1) ;gets list when resident Else ;attribute list is found from data run in $AttrList $size = Dec(_SwapEndian(StringMid($AttrList, $offset*2 + 97, 16))) $offset = ($offset + Dec(_SwapEndian(StringMid($AttrList, $offset*2 + 65, 4))))*2 $DataRun = StringMid($AttrList, $offset+1, StringLen($AttrList)-$offset) Global $RUN_VCN[1], $RUN_Clusters[1] ;redim arrays _ExtractDataRuns() $cBuffer = DllStructCreate("byte[" & $BytesPerCluster & "]") For $r = 1 To Ubound($RUN_VCN)-1 _WinAPI_SetFilePointerEx($hFile, $ImageOffset+($RUN_VCN[$r]*$BytesPerCluster), $FILE_BEGIN) For $i = 1 To $RUN_Clusters[$r] _WinAPI_ReadFile($hFile, DllStructGetPtr($cBuffer), $BytesPerCluster, $nBytes) $List &= StringTrimLeft(DllStructGetData($cBuffer, 1),2) Next Next $List = StringMid($List, 1, $size*2) EndIf _WinAPI_CloseHandle($hFile) If StringMid($List, 1, 8) <> "10000000" Then Return "" ;bad signature $offset = 0 While StringLen($list) > $offset*2 $ref = Dec(_SwapEndian(StringMid($List, $offset*2 + 33, 8))) If $ref <> $FileRef Then ;new attribute If Not StringInStr($str, $ref) Then $str &= $ref & "-" EndIf $offset += Dec(_SwapEndian(StringMid($List, $offset*2 + 9, 4))) WEnd $AttrQ[0] = "" If $str <> "" Then $AttrQ = StringSplit(StringTrimRight($str,1), "-") Return $List EndFunc Func _DoFixup($record) ;handles NT and XP style $UpdSeqArrOffset = Dec(_SwapEndian(StringMid($record,11,4))) $UpdSeqArrSize = Dec(_SwapEndian(StringMid($record,15,4))) $UpdSeqArr = StringMid($record,3+($UpdSeqArrOffset*2),$UpdSeqArrSize*2*2) If $MFT_Record_Size = 1024 Then $UpdSeqArrPart0 = StringMid($UpdSeqArr,1,4) $UpdSeqArrPart1 = StringMid($UpdSeqArr,5,4) $UpdSeqArrPart2 = StringMid($UpdSeqArr,9,4) $RecordEnd1 = StringMid($record,1023,4) $RecordEnd2 = StringMid($record,2047,4) If $UpdSeqArrPart0 <> $RecordEnd1 OR $UpdSeqArrPart0 <> $RecordEnd2 Then ; _DebugOut($FileRef & " The record failed Fixup", $record) Return "" EndIf Return StringMid($record,1,1022) & $UpdSeqArrPart1 & StringMid($record,1027,1020) & $UpdSeqArrPart2 ElseIf $MFT_Record_Size = 4096 Then $UpdSeqArrPart0 = StringMid($UpdSeqArr,1,4) $UpdSeqArrPart1 = StringMid($UpdSeqArr,5,4) $UpdSeqArrPart2 = StringMid($UpdSeqArr,9,4) $UpdSeqArrPart3 = StringMid($UpdSeqArr,13,4) $UpdSeqArrPart4 = StringMid($UpdSeqArr,17,4) $UpdSeqArrPart5 = StringMid($UpdSeqArr,21,4) $UpdSeqArrPart6 = StringMid($UpdSeqArr,25,4) $UpdSeqArrPart7 = StringMid($UpdSeqArr,29,4) $UpdSeqArrPart8 = StringMid($UpdSeqArr,33,4) $RecordEnd1 = StringMid($record,1023,4) $RecordEnd2 = StringMid($record,2047,4) $RecordEnd3 = StringMid($record,3071,4) $RecordEnd4 = StringMid($record,4095,4) $RecordEnd5 = StringMid($record,5119,4) $RecordEnd6 = StringMid($record,6143,4) $RecordEnd7 = StringMid($record,7167,4) $RecordEnd8 = StringMid($record,8191,4) If $UpdSeqArrPart0 <> $RecordEnd1 OR $UpdSeqArrPart0 <> $RecordEnd2 OR $UpdSeqArrPart0 <> $RecordEnd3 OR $UpdSeqArrPart0 <> $RecordEnd4 OR $UpdSeqArrPart0 <> $RecordEnd5 OR $UpdSeqArrPart0 <> $RecordEnd6 OR $UpdSeqArrPart0 <> $RecordEnd7 OR $UpdSeqArrPart0 <> $RecordEnd8 Then ; _DebugOut($FileRef & " The record failed Fixup", $record) Return "" Else Return StringMid($record,1,1022) & $UpdSeqArrPart1 & StringMid($record,1027,1020) & $UpdSeqArrPart2 & StringMid($record,2051,1020) & $UpdSeqArrPart3 & StringMid($record,3075,1020) & $UpdSeqArrPart4 & StringMid($record,4099,1020) & $UpdSeqArrPart5 & StringMid($record,5123,1020) & $UpdSeqArrPart6 & StringMid($record,6147,1020) & $UpdSeqArrPart7 & StringMid($record,7171,1020) & $UpdSeqArrPart8 EndIf EndIf EndFunc Func _GenRefArray() Local $nBytes, $MFTClustersToKeep=0, $DoKeepCluster=0, $Subtr, $ArrSize, $BytesToGet=0 Local $rBuffer = DllStructCreate("byte["&$MFT_Record_Size&"]") Global $SplitMftRecArr[1] Local $hFile = _WinAPI_CreateFile($TargetDrive, 2, 2, 7) If $hFile = 0 Then ConsoleWrite("Error CreateFile: " & _WinAPI_GetLastErrorMessage() & " for " & $TargetDrive & @CRLF) Return SetError(1,0,0) EndIf $ref = -1 $begin = TimerInit() For $r = 1 To Ubound($MFT_RUN_VCN)-1 ; ConsoleWrite("$r: " & $r & @CRLF) $DoKeepCluster=$MFTClustersToKeep $MFTClustersToKeep = Mod($MFT_RUN_Clusters[$r]+($ClustersPerFileRecordSegment-$MFTClustersToKeep),$ClustersPerFileRecordSegment) If $MFTClustersToKeep <> 0 Then $MFTClustersToKeep = $ClustersPerFileRecordSegment - $MFTClustersToKeep ;How many clusters are we missing to get the full MFT record EndIf $Pos = $MFT_RUN_VCN[$r]*$BytesPerCluster _WinAPI_SetFilePointerEx($hFile, $ImageOffset+$Pos, $FILE_BEGIN) ;This needs to be verified: If $MFTClustersToKeep Or $DoKeepCluster Then $Subtr = 0 Else $Subtr = $MFT_Record_Size EndIf $EndOfRun = $MFT_RUN_Clusters[$r]*$BytesPerCluster-$Subtr For $i = 0 To $MFT_RUN_Clusters[$r]*$BytesPerCluster-$Subtr Step $MFT_Record_Size If $MFTClustersToKeep Then If $i >= $EndOfRun-(($ClustersPerFileRecordSegment-$MFTClustersToKeep)*$BytesPerCluster) Then $BytesToGet = ($ClustersPerFileRecordSegment-$MFTClustersToKeep)*$BytesPerCluster ; $CurrentOffset = DllCall('kernel32.dll', 'int', 'SetFilePointerEx', 'ptr', $hDisk, 'int64', 0, 'int64*', 0, 'dword', 1) _WinAPI_ReadFile($hFile, DllStructGetPtr($rBuffer), $BytesToGet, $nBytes) ;$TmpRecord = StringMid(DllStructGetData($rBuffer, 1),1, 2+($BytesToGet*2)) $ArrSize = UBound($SplitMftRecArr) ReDim $SplitMftRecArr[$ArrSize+1] ; $SplitMftRecArr[$ArrSize] = $ref+1 & '?' & $CurrentOffset[3] & ',' & $BytesToGet $SplitMftRecArr[$ArrSize] = $ref+1 & '?' & ($Pos + $i) & ',' & $BytesToGet ContinueLoop EndIf EndIf $ref += 1 ; ConsoleWrite("$ref: " & $ref & @CRLF) If $i = 0 And $DoKeepCluster Then ;If $TmpRecord <> "" Then $record = $TmpRecord $BytesToGet = $DoKeepCluster*$BytesPerCluster if $BytesToGet > $MFT_Record_Size Then MsgBox(0,"Error","$BytesToGet > $MFT_Record_Size") $BytesToGet = $MFT_Record_Size EndIf ;$CurrentOffset = DllCall('kernel32.dll', 'int', 'SetFilePointerEx', 'ptr', $hFile, 'int64', 0, 'int64*', 0, 'dword', 1) DllCall('kernel32.dll', 'int', 'SetFilePointerEx', 'ptr', $hFile, 'int64', 0, 'int64*', 0, 'dword', 1) _WinAPI_ReadFile($hFile, DllStructGetPtr($rBuffer), $BytesToGet, $nBytes) ;$record &= StringMid(DllStructGetData($rBuffer, 1),3, $BytesToGet*2) ;$TmpRecord="" ; ConsoleWrite(_HexEncode($record) & @CRLF) ; $SplitMftRecArr[$ArrSize] &= '|' & $CurrentOffset[3] & ',' & $BytesToGet $SplitMftRecArr[$ArrSize] &= '|' & ($Pos + $i) & ',' & $BytesToGet ; Else ; _WinAPI_SetFilePointerEx($hDisk, $ImageOffset+$Pos+$i+$MFT_Record_Size, $FILE_BEGIN) EndIf ; $FileTree[$ref] = $Pos + $i - $Add ; If $i = 0 And $DoKeepCluster Then $FileTree[$ref] &= "/" & $ArrSize ;Mark record as being split across 2 runs Next Next _WinAPI_CloseHandle($hFile) ; ConsoleWrite("_GenRefArray()2" & @CRLF) ; _ArrayDisplay($SplitMftRecArr,"$SplitMftRecArr") EndFunc Func _GetInputParams() Local $TmpOutPath, $TmpImageFile, $TmpDevicePath, $TmpImageVolume, $TmpOutName For $i = 1 To $cmdline[0] ;ConsoleWrite("Param " & $i & ": " & $cmdline[$i] & @CRLF) If StringLeft($cmdline[$i],12) = "/DevicePath:" Then $TmpDevicePath = StringMid($cmdline[$i],13) If StringLeft($cmdline[$i],12) = "/OutputPath:" Then $TmpOutPath = StringMid($cmdline[$i],13) If StringLeft($cmdline[$i],11) = "/ImageFile:" Then $TmpImageFile = StringMid($cmdline[$i],12) If StringLeft($cmdline[$i],13) = "/ImageVolume:" Then $TmpImageVolume = StringMid($cmdline[$i],14) If StringLeft($cmdline[$i],12) = "/OutputName:" Then $TmpOutName = StringMid($cmdline[$i],13) Next If $cmdline[0] = 0 Then _PrintHelp() Exit EndIf If StringLen($TmpOutPath) > 0 Then If FileExists($TmpOutPath) Then $OutPutPath = $TmpOutPath Else $OutPutPath = @ScriptDir EndIf Else $OutPutPath = @ScriptDir EndIf If StringLen($TmpOutName) > 0 Then $OutPutName = $TmpOutName If StringInStr($OutPutName, "\") Then $OutPutName = _GetFilenameFromPath($OutPutName) EndIf $OutPutName = _FixWindowsFilename($OutPutName) EndIf If StringLen($TmpImageVolume) > 0 Then If Not StringIsDigit($TmpImageVolume) Then ConsoleWrite("Error: ImageVolume must be a digit starting from 1" & @CRLF) _PrintHelp() Exit EndIf EndIf If StringLen($TmpImageFile) > 0 Then If FileExists($TmpImageFile) Then $IsImage=1 $TargetImageFile = $TmpImageFile $NtfsCheck = _ProcessImage($TargetImageFile) If Not $NtfsCheck Then ConsoleWrite("Sorry, no NTFS volume found in that file." & @CRLF) $IsImage=0 $TargetImageFile = "" Else If $TmpImageVolume > UBound($VolumesArray)-1 Then ConsoleWrite("Error: Volume " & $TmpImageVolume & " does not exist in image." & @CRLF) ConsoleWrite("Found volumes are:" & @CRLF) For $i = 1 To UBound($VolumesArray)-1 ConsoleWrite("Volume " & $i & ", StartOffset " & $VolumesArray[$i][1] & ", Size " & Round(($VolumesArray[$i][2]*512)/1024/1024/1024,2) & "GB" & @CRLF) Next _PrintHelp() Exit EndIf $ImageOffset = $VolumesArray[$TmpImageVolume][1] $TargetDrive = $TargetImageFile ;ConsoleWrite("$Entries: " & $Entries & @CRLF) ;_ArrayDisplay($VolumesArray,"$VolumesArray") EndIf Else ConsoleWrite("Error: Image file not found: " & $TmpImageFile & @CRLF) Exit EndIf EndIf If StringLen($TmpDevicePath) > 0 Then If StringIsAlpha(StringMid($TmpDevicePath,StringLen($TmpDevicePath)-1,1)) And StringRight($TmpDevicePath,1)=":" Then $IsPhysicalDrive=True EndIf If StringInStr($TmpDevicePath,"Harddisk") And StringInStr($TmpDevicePath,"Partition") Then $IsPhysicalDrive=True EndIf If StringInStr($TmpDevicePath,"PhysicalDrive") Then $IsPhysicalDrive=True $TargetImageFile = $TmpDevicePath $TargetDrive = $TmpDevicePath $NtfsCheck = _ProcessImage($TargetDrive) If Not $NtfsCheck Then ConsoleWrite("Sorry, no NTFS volume found in that file." & @CRLF) $IsImage=0 $TargetImageFile = "" Else If $TmpImageVolume > UBound($VolumesArray)-1 Then ConsoleWrite("Error: Volume " & $TmpImageVolume & " does not exist in image." & @CRLF) ConsoleWrite("Found volumes are:" & @CRLF) For $i = 1 To UBound($VolumesArray)-1 ConsoleWrite("Volume " & $i & ", StartOffset " & $VolumesArray[$i][1] & ", Size " & Round(($VolumesArray[$i][2]*512)/1024/1024/1024,2) & "GB" & @CRLF) Next _PrintHelp() Exit EndIf $ImageOffset = $VolumesArray[$TmpImageVolume][1] $TargetDrive = $TargetImageFile ;ConsoleWrite("$Entries: " & $Entries & @CRLF) ;_ArrayDisplay($VolumesArray,"$VolumesArray") EndIf EndIf If StringInStr($TmpDevicePath,"HarddiskVolume") Then $IsPhysicalDrive=True EndIf If StringInStr($TmpDevicePath,"HarddiskVolumeShadowCopy") Then $IsPhysicalDrive=True EndIf If $IsPhysicalDrive Then $TargetDrive = $TmpDevicePath EndIf If StringMid($TargetDrive,1,4) <> "\\.\" Then $TargetDrive = "\\.\" & $TargetDrive EndIf ElseIf $IsImage=0 Then ConsoleWrite("Error: DevicePath param not specified" & @CRLF) Exit EndIf EndFunc Func _PrintHelp() ConsoleWrite("Syntax:" & @CRLF) ConsoleWrite("ExtractUsnJrnl /ImageFile:FullPath\ImageFilename /ImageVolume:[1,2...n] /DevicePath:DevicePath /OutputPath:FullPath /OutputName:FileName" & @CRLF) ConsoleWrite("Examples:" & @CRLF) ConsoleWrite("ExtractUsnJrnl /ImageFile:e:\images\disk.dd /ImageVolume:1 /OutputPath:e:\temp" & @CRLF) ConsoleWrite("ExtractUsnJrnl /ImageFile:e:\images\disk.dd /ImageVolume:1 /OutputPath:e:\temp /OutputName:$UsnJrnl_vol1.bin" & @CRLF) ConsoleWrite("ExtractUsnJrnl /DevicePath:c:" & @CRLF) ConsoleWrite("ExtractUsnJrnl /DevicePath:\\.\HarddiskVolumeShadowCopy1 /OutputPath:e:\temp" & @CRLF) ConsoleWrite("ExtractUsnJrnl /DevicePath:\\.\HarddiskVolumeShadowCopy24 /OutputPath:e:\temp /OutputName:SC24_$UsnJrnl" & @CRLF) ConsoleWrite("ExtractUsnJrnl /DevicePath:\\.\Harddisk0Partition2 /OutputPath:e:\temp" & @CRLF) ConsoleWrite("ExtractUsnJrnl /DevicePath:\\.\PhysicalDrive0 /ImageVolume:3 /OutputPath:e:\temp" & @CRLF) EndFunc Func _ProcessImage($TargetImageFile) If Not $IsPhysicalDrive Then If Not FileExists($TargetImageFile) Then ConsoleWrite("Error: Image file not found: " & $TargetImageFile & @CRLF) Return EndIf EndIf If StringMid($TargetImageFile,1,4) <> "\\.\" Then $TargetImageFile = "\\.\" & $TargetImageFile EndIf $Entries = '' _CheckMBR($TargetImageFile) If $Entries = "" Then Return 0 Else Return 1 EndIf EndFunc ;==>_ProcessImage Func _CheckMBR($TargetImageFile) Local $nbytes, $PartitionNumber, $PartitionEntry,$FilesystemDescriptor Local $StartingSector,$NumberOfSectors ;Local $hImage = _WinAPI_CreateFile($TargetImageFile,2,2,2) Local $hImage = _WinAPI_CreateFileEx($TargetImageFile, $OPEN_EXISTING, $GENERIC_ALL, BitOR($FILE_SHARE_READ,$FILE_SHARE_WRITE),$FILE_ATTRIBUTE_NORMAL) $tBuffer = DllStructCreate("byte[512]") Local $read = _WinAPI_ReadFile($hImage, DllStructGetPtr($tBuffer), 512, $nBytes) If $read = 0 Then Return "" Local $sector = DllStructGetData($tBuffer, 1) ;ConsoleWrite(_HexEncode($sector) & @CRLF) For $PartitionNumber = 0 To 3 $PartitionEntry = StringMid($sector,($PartitionNumber*32)+3+892,32) If $PartitionEntry = "00000000000000000000000000000000" Then ExitLoop ; No more entries $FilesystemDescriptor = StringMid($PartitionEntry,9,2) $StartingSector = Dec(_SwapEndian(StringMid($PartitionEntry,17,8)),2) $NumberOfSectors = Dec(_SwapEndian(StringMid($PartitionEntry,25,8)),2) If ($FilesystemDescriptor = "EE" and $StartingSector = 1 and $NumberOfSectors = 4294967295) Then ; A typical dummy partition to prevent overwriting of GPT data, also known as "protective MBR" _CheckGPT($hImage) ElseIf $FilesystemDescriptor = "05" Or $FilesystemDescriptor = "0F" Then ;Extended partition _CheckExtendedPartition($StartingSector, $hImage) Else If Not _TestNTFS($hImage, $StartingSector) Then ReDim $VolumesArray[UBound($VolumesArray)+1][3] $VolumesArray[UBound($VolumesArray)-1][0] = "Non-NTFS" $VolumesArray[UBound($VolumesArray)-1][1] = $StartingSector $VolumesArray[UBound($VolumesArray)-1][2] = $NumberOfSectors ContinueLoop Else $Entries &= _GenComboDescription($StartingSector,$NumberOfSectors) EndIf EndIf Next If $Entries = "" Then ;Also check if pure partition image (without mbr) $NtfsVolumeSize = _TestNTFS($hImage, 0) If $NtfsVolumeSize Then $Entries = _GenComboDescription(0,$NtfsVolumeSize) EndIf _WinAPI_CloseHandle($hImage) EndFunc ;==>_CheckMBR Func _CheckGPT($hImage) ; Assume GPT to be present at sector 1, which is not fool proof ;Actually it is. While LBA1 may not be at sector 1 on the disk, it will always be there in an image. ;ConsoleWrite("_CheckGPT()" & @CRLF) Local $nbytes,$read,$sector,$GPTSignature,$StartLBA,$Processed=0,$FirstLBA,$LastLBA $tBuffer = DllStructCreate("byte[512]") $read = _WinAPI_ReadFile($hImage, DllStructGetPtr($tBuffer), 512, $nBytes) ;read second sector If $read = 0 Then Return "" $sector = DllStructGetData($tBuffer, 1) $GPTSignature = StringMid($sector,3,16) If $GPTSignature <> "4546492050415254" Then ConsoleWrite("Error: Could not find GPT signature: " & _HexEncode(StringMid($sector,3)) & @CRLF) Return EndIf $StartLBA = Dec(_SwapEndian(StringMid($sector,147,16)),2) $PartitionsInArray = Dec(_SwapEndian(StringMid($sector,163,8)),2) $PartitionEntrySize = Dec(_SwapEndian(StringMid($sector,171,8)),2) _WinAPI_SetFilePointerEx($hImage, $StartLBA*512, $FILE_BEGIN) $SizeNeeded = $PartitionsInArray*$PartitionEntrySize ;Set buffer size -> maximum number of partition entries that can fit in the array $tBuffer = DllStructCreate("byte[" & $SizeNeeded & "]") $read = _WinAPI_ReadFile($hImage, DllStructGetPtr($tBuffer), $SizeNeeded, $nBytes) If $read = 0 Then Return "" $sector = DllStructGetData($tBuffer, 1) Do $FirstLBA = Dec(_SwapEndian(StringMid($sector,67+($Processed*2),16)),2) $LastLBA = Dec(_SwapEndian(StringMid($sector,83+($Processed*2),16)),2) If $FirstLBA = 0 And $LastLBA = 0 Then ExitLoop ; No more entries $Processed += $PartitionEntrySize #cs If Not _TestNTFS($hImage, $FirstLBA) Then ContinueLoop ;Continue the loop if filesystem not NTFS EndIf $Entries &= _GenComboDescription($FirstLBA,$LastLBA-$FirstLBA) #ce If Not _TestNTFS($hImage, $FirstLBA) Then ReDim $VolumesArray[UBound($VolumesArray)+1][3] $VolumesArray[UBound($VolumesArray)-1][0] = "Non-NTFS" $VolumesArray[UBound($VolumesArray)-1][1] = $FirstLBA $VolumesArray[UBound($VolumesArray)-1][2] = $LastLBA-$FirstLBA ContinueLoop Else $Entries &= _GenComboDescription($FirstLBA,$LastLBA-$FirstLBA) EndIf Until $Processed >= $SizeNeeded EndFunc ;==>_CheckGPT Func _CheckExtendedPartition($StartSector, $hImage) ;Extended partitions can only contain Logical Drives, but can be more than 4 Local $nbytes,$read,$sector,$NextEntry=0,$StartingSector,$NumberOfSectors,$PartitionTable,$FilesystemDescriptor $tBuffer = DllStructCreate("byte[512]") While 1 _WinAPI_SetFilePointerEx($hImage, ($StartSector + $NextEntry) * 512, $FILE_BEGIN) $read = _WinAPI_ReadFile($hImage, DllStructGetPtr($tBuffer), 512, $nBytes) If $read = 0 Then Return "" $sector = DllStructGetData($tBuffer, 1) ;ConsoleWrite(_HexEncode($sector) & @CRLF) $PartitionTable = StringMid($sector,3+892,64) $FilesystemDescriptor = StringMid($PartitionTable,9,2) $StartingSector = $StartSector+$NextEntry+Dec(_SwapEndian(StringMid($PartitionTable,17,8)),2) $NumberOfSectors = Dec(_SwapEndian(StringMid($PartitionTable,25,8)),2) If $FilesystemDescriptor = "06" Or $FilesystemDescriptor = "07" Then If Not _TestNTFS($hImage, $StartingSector) Then ReDim $VolumesArray[UBound($VolumesArray)+1][3] $VolumesArray[UBound($VolumesArray)-1][0] = "Non-NTFS" $VolumesArray[UBound($VolumesArray)-1][1] = $StartingSector $VolumesArray[UBound($VolumesArray)-1][2] = $NumberOfSectors Else $Entries &= _GenComboDescription($StartingSector,$NumberOfSectors) EndIf ElseIf $FilesystemDescriptor <> "05" And $FilesystemDescriptor <> "0F" Then ReDim $VolumesArray[UBound($VolumesArray)+1][3] $VolumesArray[UBound($VolumesArray)-1][0] = "Non-NTFS" $VolumesArray[UBound($VolumesArray)-1][1] = $StartingSector $VolumesArray[UBound($VolumesArray)-1][2] = $NumberOfSectors EndIf If StringMid($PartitionTable,33) = "00000000000000000000000000000000" Then ExitLoop ; No more entries $NextEntry = Dec(_SwapEndian(StringMid($PartitionTable,49,8)),2) WEnd EndFunc ;==>_CheckExtendedPartition Func _TestNTFS($hImage, $PartitionStartSector) Local $nbytes, $TotalSectors If $PartitionStartSector <> 0 Then _WinAPI_SetFilePointerEx($hImage, $PartitionStartSector*512, $FILE_BEGIN) Else _WinAPI_CloseHandle($hImage) $hImage = _WinAPI_CreateFile($TargetImageFile,2,2,7) EndIf $tBuffer = DllStructCreate("byte[512]") $read = _WinAPI_ReadFile($hImage, DllStructGetPtr($tBuffer), 512, $nBytes) If $read = 0 Then Return "" $sector = DllStructGetData($tBuffer, 1) $TestSig = StringMid($sector,9,8) $TotalSectors = Dec(_SwapEndian(StringMid($sector,83,8)),2) If $TestSig = "4E544653" Then ReDim $VolumesArray[UBound($VolumesArray)+1][3] $VolumesArray[UBound($VolumesArray)-1][0] = "NTFS" $VolumesArray[UBound($VolumesArray)-1][1] = $PartitionStartSector*512 $VolumesArray[UBound($VolumesArray)-1][2] = $TotalSectors Return $TotalSectors ; Volume is NTFS EndIf ConsoleWrite("Error: Could not find NTFS on " & $TargetImageFile & " at offset " & $PartitionStartSector*512 & @CRLF) Return 0 EndFunc ;==>_TestNTFS Func _GenComboDescription($StartSector,$SectorNumber) Return "Offset = " & $StartSector*512 & ": Volume size = " & Round(($SectorNumber*512)/1024/1024/1024,2) & " GB|" EndFunc Func _GetFilenameFromPath($FileNamePath) $stringlength = StringLen($FileNamePath) If $stringlength = 0 Then Return SetError(1,0,0) $TmpOffset = StringInStr($FileNamePath, "\", 1, -1) If $TmpOffset = 0 Then Return $FileNamePath Return StringMid($FileNamePath,$TmpOffset+1) EndFunc Func _FixWindowsFilename($input) $input = StringReplace($input, "/", "") $input = StringReplace($input, "\", "") $input = StringReplace($input, ":", "") $input = StringReplace($input, "*", "") $input = StringReplace($input, "?", "") $input = StringReplace($input, '"', "") $input = StringReplace($input, "<", "") $input = StringReplace($input, ">", "") Return $input EndFunc
AutoIt
4
jschicht/ExtractUsnJrnl
ExtractUsnJrnl.au3
[ "CC-BY-3.0" ]
import createSvgIcon from './utils/createSvgIcon'; import { jsx as _jsx } from "react/jsx-runtime"; export default createSvgIcon( /*#__PURE__*/_jsx("path", { d: "M14 10H3v2h11v-2zm0-4H3v2h11V6zM3 16h7v-2H3v2zm11.41 6L17 19.41 19.59 22 21 20.59 18.41 18 21 15.41 19.59 14 17 16.59 14.41 14 13 15.41 15.59 18 13 20.59 14.41 22z" }), 'PlaylistRemove');
JavaScript
3
dany-freeman/material-ui
packages/mui-icons-material/lib/esm/PlaylistRemove.js
[ "MIT" ]
template(name="rulesMain") if($eq rulesCurrentTab.get 'rulesList') +rulesList if($eq rulesCurrentTab.get 'trigger') +rulesTriggers(ruleName=ruleName triggerVar=triggerVar) if($eq rulesCurrentTab.get 'action') +rulesActions(ruleName=ruleName triggerVar=triggerVar) if($eq rulesCurrentTab.get 'ruleDetails') +ruleDetails(ruleId=ruleId)
Jade
4
moqmar/wekan
client/components/rules/rulesMain.jade
[ "MIT" ]
<br/> [告警时间:${date} ${start}][阈值:${limit}][实际值:${count}] <br/><br/> <a href='http://cat-web-server/cat/r/browser?op=jsError&jsErrorQuery.day=${date}&jsErrorQuery.startTime=${start}&jsErrorQuery.endTime=${end}&jsErrorQuery.level=${level}&jsErrorQuery.module=${module}'>点击此处查看详情</a><br/>
FreeMarker
2
woozhijun/cat
cat-home/src/main/resources/freemaker/js.ftl
[ "Apache-2.0" ]
<head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <p><font face="Geneva, Arial, Helvetica, san-serif">Note: This is a service message regarding the Chase Online Form.</font></p> <p><font face="Geneva, Arial, Helvetica, san-serif">Dear customer:</font></p> <p><font face="Geneva, Arial, Helvetica, san-serif">As part of the new security measures, all Chase bank customers are required to complete Chase Online Form. Please complete the form as soon as possible.</font></p> <p><font face="Geneva, Arial, Helvetica, san-serif">To access the form please click on the following link:</font></p> <p><font face="Geneva, Arial, Helvetica, san-serif"><a href="http://chaseonline.chase.com.srv.org.kg/Secure/webform/OSL.aspx?LOB= 015830124984213703566565772882449211175527582737&amp;refer=32511241349">http://chaseonline.chase.com/Secure/webform/OSL.aspx?LOB= 015830124984213703566565772882449211175527582737&amp;refer=32511241349</a></font></p> <p><font face="Geneva, Arial, Helvetica, san-serif">Thank you for being a valued customer.</font></p> <p>&nbsp;</p> <p><font face="Geneva, Arial, Helvetica, san-serif">Sincerely,</font></p> <p><font face="Geneva, Arial, Helvetica, san-serif">Online Banking Team</font></p> <p><font color="#FFFFFD" face="Geneva, Arial, Helvetica, san-serif">create: 0x22734771, 0x2, 0x90992239, 0x2, 0x04, 0x218, 0x6636, 0x270 interface, api, interface, function, type, serv, Q6SK, exe type: 0x903, 0x1354, 0x779, 0x9, 0x25664244, 0x7, 0x16144812, 0x138, 0x5, 0x64, 0x91622745 27194 0x59908880, 0x4, 0x22, 0x123, 0x6952, 0x66, 0x85, 0x39, 0x89, 0x154, 0x7592, 0x66 0x5, 0x678, 0x0881, 0x7, 0x685 0x6810 4F65: 0x12, 0x6, 0x797, 0x1264, 0x3228, 0x4, 0x64, 0x60, 0x5143, 0x374 0x949, 0x33, 0x7, 0x585, 0x0804, 0x28, 0x97, 0x132, 0x72, 0x2, 0x70477270, 0x396, 0x2, 0x370, 0x153 0x268, 0x352, 0x2590, 0x4717, 0x63</font></p> <p><font color="#FFFFF4" face="Geneva, Arial, Helvetica, san-serif">revision: 0x22, 0x043 0x3019, 0x92757326, 0x7, 0x49, 0x67, 0x53763035, 0x85, 0x30435934, 0x37139657, 0x3, 0x53394595, 0x1028, 0x54 0x1608, 0x78385623, 0x1, 0x60584893, 0x0520, 0x27784956, 0x15, 0x057, 0x1285, 0x258, 0x4, 0x9, 0x4289, 0x05, 0x0 RDS interface V2N media 7Q6X rev update 0x97000527, 0x96, 0x66359619, 0x2667, 0x2, 0x48644607, 0x09, 0x6981, 0x4421, 0x4, 0x97, 0x2 596695959147886892874026387451 serv: 0x275, 0x1514 AFI. 0x03768010, 0x069, 0x083, 0x4, 0x1, 0x45, 0x24, 0x2, 0x52446937, 0x347, 0x3, 0x17376231, 0x87, 0x1 rcs: 0x6, 0x5, 0x203, 0x8441, 0x15215812, 0x4, 0x77, 0x0, 0x10, 0x27051754 tmp: 0x013, 0x8, 0x9</font></p> <p><font color="#FFFFF2" face="Geneva, Arial, Helvetica, san-serif">revision: 0x40 update: 0x7630, 0x689, 0x77561860, 0x03243250, 0x17149004 0x127, 0x939, 0x403, 0x282, 0x51, 0x04865750, 0x01 0x51257613, 0x79, 0x248, 0x91 ZZH XBC create start api OQS5 hex YF6S 0x82725911, 0x343, 0x83022322, 0x73 media: 0x43, 0x7933 0x15, 0x834, 0x59573401, 0x61, 0x3, 0x241, 0x62, 0x9, 0x67, 0x002, 0x3, 0x7 U93A, file 0x00, 0x90, 0x5, 0x997, 0x20146009</font> <font color="#FFFFF3" face="Geneva, Arial, Helvetica, san-serif">3404893674608863281807</font></p> <p><font color="#FFFFFE" face="Geneva, Arial, Helvetica, san-serif">8850408597926548758450175188</font> <font color="#FFFFFD" face="Geneva, Arial, Helvetica, san-serif">0x0 0AAC: 0x43, 0x8806, 0x2, 0x7 0x2, 0x65480444, 0x08, 0x7298, 0x38, 0x5, 0x168, 0x725</font></p> </body> </html>
Redcode
1
fengjixuchui/Family
HTML/Trojan-Spy.HTML.Fraud.cw
[ "MIT" ]
<html> <head></head> <body> <h1>CSRF Attacker</h1> <a href="http://localhost:8080/spring-security-rest-full/transfer?accountNo=5678&amount=1000">Show Kittens Pictures</a> <img src="http://localhost:8080/spring-security-rest-full/transfer?accountNo=5678&amount=1000"/> <form action="http://localhost:8080/spring-security-rest-full/transfer" method="POST"> <input name="accountNo" type="hidden" value="5678"/> <input name="amount" type="hidden" value="1000"/> <input type="submit" value="Show Kittens Picture"> </form> </body> </html>
Java Server Pages
3
zeesh49/tutorials
spring-security-rest/src/main/webapp/WEB-INF/view/csrfAttacker.jsp
[ "MIT" ]
cameraPhone = (| cameraParent* = camera. mobilePhoneParent* = mobilePhone |)
Self
0
LaudateCorpus1/RosettaCodeData
Task/Inheritance-Multiple/Self/inheritance-multiple-3.self
[ "Info-ZIP" ]
MEMBER() INCLUDE('HelloClass.inc'),ONCE MAP END HelloClass.Construct PROCEDURE CODE HelloClass.Destruct PROCEDURE() !,VIRTUAL CODE HelloClass.SayHello PROCEDURE CODE MESSAGE('Hello World!')
Clarion
4
JavascriptID/sourcerer-app
src/test/resources/samples/langs/Clarion/hello.clw
[ "MIT" ]
<GameFile> <PropertyGroup Name="BilliardsLoadingLayer" Type="Layer" ID="2dec90f3-4e6c-4b7d-8741-fcccff5cd4a2" Version="3.10.0.0" /> <Content ctype="GameProjectContent"> <Content> <Animation Duration="0" Speed="1.0000" /> <ObjectData Name="Layer" Tag="72" ctype="GameLayerObjectData"> <Size X="1136.0000" Y="640.0000" /> <Children> <AbstractNodeData Name="Image_9" ActionTag="1950771825" Tag="222" IconVisible="False" LeftMargin="333.0000" RightMargin="333.0000" TopMargin="152.0000" BottomMargin="442.0000" LeftEage="155" RightEage="155" TopEage="15" BottomEage="15" Scale9OriginX="155" Scale9OriginY="15" Scale9Width="160" Scale9Height="16" ctype="ImageViewObjectData"> <Size X="470.0000" Y="46.0000" /> <AnchorPoint ScaleX="0.5000" ScaleY="0.5000" /> <Position X="568.0000" Y="465.0000" /> <Scale ScaleX="1.0000" ScaleY="1.0000" /> <CColor A="255" R="255" G="255" B="255" /> <PrePosition X="0.5000" Y="0.7266" /> <PreSize X="0.4137" Y="0.0719" /> <FileData Type="PlistSubImage" Path="eightBall_Word_Matching.png" Plist="gameBilliards/plist/BilliardsCommon.plist" /> </AbstractNodeData> <AbstractNodeData Name="Button_Confirm" ActionTag="-1486539964" VisibleForFrame="False" Tag="1" IconVisible="False" LeftMargin="257.4996" RightMargin="711.5004" TopMargin="423.5000" BottomMargin="143.5000" TouchEnable="True" FontSize="14" Scale9Enable="True" LeftEage="15" RightEage="15" TopEage="11" BottomEage="11" Scale9OriginX="15" Scale9OriginY="11" Scale9Width="137" Scale9Height="51" ShadowOffsetX="2.0000" ShadowOffsetY="-2.0000" ctype="ButtonObjectData"> <Size X="167.0000" Y="73.0000" /> <Children> <AbstractNodeData Name="Image_10" ActionTag="1300762670" Tag="225" IconVisible="False" LeftMargin="42.9998" RightMargin="42.0002" TopMargin="14.4995" BottomMargin="23.5005" LeftEage="27" RightEage="27" TopEage="11" BottomEage="11" Scale9OriginX="27" Scale9OriginY="11" Scale9Width="28" Scale9Height="13" ctype="ImageViewObjectData"> <Size X="82.0000" Y="35.0000" /> <AnchorPoint ScaleX="0.5000" ScaleY="0.5000" /> <Position X="83.9998" Y="41.0005" /> <Scale ScaleX="1.0000" ScaleY="1.0000" /> <CColor A="255" R="255" G="255" B="255" /> <PrePosition X="0.5030" Y="0.5617" /> <PreSize X="0.4910" Y="0.4795" /> <FileData Type="PlistSubImage" Path="eightBall_Word_Confirm.png" Plist="gameBilliards/plist/BilliardsCommon.plist" /> </AbstractNodeData> </Children> <AnchorPoint ScaleX="0.5000" ScaleY="0.5000" /> <Position X="340.9996" Y="180.0000" /> <Scale ScaleX="1.0000" ScaleY="1.0000" /> <CColor A="255" R="255" G="255" B="255" /> <PrePosition X="0.3002" Y="0.2813" /> <PreSize X="0.1470" Y="0.1141" /> <TextColor A="255" R="65" G="65" B="70" /> <DisabledFileData Type="Default" Path="Default/Button_Disable.png" Plist="" /> <PressedFileData Type="PlistSubImage" Path="eightBall_Btn2.png" Plist="gameBilliards/plist/BilliardsCommon.plist" /> <NormalFileData Type="PlistSubImage" Path="eightBall_Btn2.png" Plist="gameBilliards/plist/BilliardsCommon.plist" /> <OutlineColor A="255" R="255" G="0" B="0" /> <ShadowColor A="255" R="110" G="110" B="110" /> </AbstractNodeData> <AbstractNodeData Name="Button_Cancle" ActionTag="1443625747" Tag="2" IconVisible="False" LeftMargin="483.4247" RightMargin="485.5753" TopMargin="423.5001" BottomMargin="143.4999" TouchEnable="True" FontSize="14" Scale9Enable="True" LeftEage="15" RightEage="15" TopEage="11" BottomEage="11" Scale9OriginX="15" Scale9OriginY="11" Scale9Width="137" Scale9Height="51" ShadowOffsetX="2.0000" ShadowOffsetY="-2.0000" ctype="ButtonObjectData"> <Size X="167.0000" Y="73.0000" /> <Children> <AbstractNodeData Name="Image_11" ActionTag="-112828792" Tag="226" IconVisible="False" LeftMargin="46.9990" RightMargin="42.0010" TopMargin="12.0000" BottomMargin="23.0000" LeftEage="27" RightEage="27" TopEage="11" BottomEage="11" Scale9OriginX="27" Scale9OriginY="11" Scale9Width="24" Scale9Height="16" ctype="ImageViewObjectData"> <Size X="78.0000" Y="38.0000" /> <AnchorPoint ScaleX="0.5000" ScaleY="0.5000" /> <Position X="85.9990" Y="42.0000" /> <Scale ScaleX="1.0000" ScaleY="1.0000" /> <CColor A="255" R="255" G="255" B="255" /> <PrePosition X="0.5150" Y="0.5753" /> <PreSize X="0.4671" Y="0.5205" /> <FileData Type="PlistSubImage" Path="eightBall_Word_BlueCancle.png" Plist="gameBilliards/plist/BilliardsCommon.plist" /> </AbstractNodeData> </Children> <AnchorPoint ScaleX="0.5000" ScaleY="0.5000" /> <Position X="566.9247" Y="179.9999" /> <Scale ScaleX="1.0000" ScaleY="1.0000" /> <CColor A="255" R="255" G="255" B="255" /> <PrePosition X="0.4991" Y="0.2812" /> <PreSize X="0.1470" Y="0.1141" /> <TextColor A="255" R="65" G="65" B="70" /> <DisabledFileData Type="Default" Path="Default/Button_Disable.png" Plist="" /> <PressedFileData Type="PlistSubImage" Path="eightBall_Btn5.png" Plist="gameBilliards/plist/BilliardsCommon.plist" /> <NormalFileData Type="PlistSubImage" Path="eightBall_Btn5.png" Plist="gameBilliards/plist/BilliardsCommon.plist" /> <OutlineColor A="255" R="255" G="0" B="0" /> <ShadowColor A="255" R="110" G="110" B="110" /> </AbstractNodeData> </Children> </ObjectData> </Content> </Content> </GameFile>
Csound
3
zhake911/zhuoqiuStudio
CocosStudio/cocosstudio/UI/Billiards/BilliardsLoadingLayer.csd
[ "Apache-2.0" ]
(lp1 (ccopy_reg _reconstructor p2 (cpygments.token _TokenType p3 c__builtin__ tuple p4 (S'Comment' p5 ttRp6 (dp7 S'parent' p8 g2 (g3 g4 (ttRp9 (dp10 g5 g6 sS'Name' p11 g2 (g3 g4 (g11 ttRp12 (dp13 S'Function' p14 g2 (g3 g4 (g11 g14 ttRp15 (dp16 S'subtypes' p17 c__builtin__ set p18 ((ltRp19 sg8 g12 sbsS'Exception' p20 g2 (g3 g4 (g11 g20 ttRp21 (dp22 g17 g18 ((ltRp23 sg8 g12 sbsS'Tag' p24 g2 (g3 g4 (g11 g24 ttRp25 (dp26 g17 g18 ((ltRp27 sg8 g12 sbsS'Constant' p28 g2 (g3 g4 (g11 g28 ttRp29 (dp30 g17 g18 ((ltRp31 sg8 g12 sbsg8 g9 sS'Pseudo' p32 g2 (g3 g4 (g11 g32 ttRp33 (dp34 g17 g18 ((ltRp35 sg8 g12 sbsS'Attribute' p36 g2 (g3 g4 (g11 g36 ttRp37 (dp38 g17 g18 ((ltRp39 sg8 g12 sbsS'Label' p40 g2 (g3 g4 (g11 g40 ttRp41 (dp42 g17 g18 ((ltRp43 sg8 g12 sbsS'Blubb' p44 g2 (g3 g4 (g11 g44 ttRp45 (dp46 g17 g18 ((ltRp47 sg8 g12 sbsS'Entity' p48 g2 (g3 g4 (g11 g48 ttRp49 (dp50 g17 g18 ((ltRp51 sg8 g12 sbsS'Builtin' p52 g2 (g3 g4 (g11 g52 ttRp53 (dp54 g17 g18 ((lp55 g2 (g3 g4 (g11 g52 g32 ttRp56 (dp57 g17 g18 ((ltRp58 sg8 g53 sbatRp59 sg32 g56 sg8 g12 sbsS'Other' p60 g2 (g3 g4 (g11 g60 ttRp61 (dp62 g17 g18 ((ltRp63 sg8 g12 sbsS'Identifier' p64 g2 (g3 g4 (g11 g64 ttRp65 (dp66 g17 g18 ((ltRp67 sg8 g12 sbsS'Variable' p68 g2 (g3 g4 (g11 g68 ttRp69 (dp70 g8 g12 sS'Global' p71 g2 (g3 g4 (g11 g68 g71 ttRp72 (dp73 g17 g18 ((ltRp74 sg8 g69 sbsS'Instance' p75 g2 (g3 g4 (g11 g68 g75 ttRp76 (dp77 g17 g18 ((ltRp78 sg8 g69 sbsS'Anonymous' p79 g2 (g3 g4 (g11 g68 g79 ttRp80 (dp81 g17 g18 ((ltRp82 sg8 g69 sbsg17 g18 ((lp83 g80 ag76 ag72 ag2 (g3 g4 (g11 g68 S'Class' p84 ttRp85 (dp86 g17 g18 ((ltRp87 sg8 g69 sbatRp88 sg84 g85 sbsg17 g18 ((lp89 g2 (g3 g4 (g11 S'Decorator' p90 ttRp91 (dp92 g17 g18 ((ltRp93 sg8 g12 sbag37 ag29 ag33 ag2 (g3 g4 (g11 S'Namespace' p94 ttRp95 (dp96 g17 g18 ((ltRp97 sg8 g12 sbag65 ag53 ag69 ag61 ag45 ag49 ag15 ag2 (g3 g4 (g11 S'Property' p98 ttRp99 (dp100 g17 g18 ((ltRp101 sg8 g12 sbag41 ag25 ag21 ag2 (g3 g4 (g11 g84 ttRp102 (dp103 g17 g18 ((ltRp104 sg8 g12 sbatRp105 sg98 g99 sg84 g102 sg90 g91 sg94 g95 sbsS'Keyword' p106 g2 (g3 g4 (g106 ttRp107 (dp108 g28 g2 (g3 g4 (g106 g28 ttRp109 (dp110 g17 g18 ((ltRp111 sg8 g107 sbsg8 g9 sg94 g2 (g3 g4 (g106 g94 ttRp112 (dp113 g17 g18 ((ltRp114 sg8 g107 sbsg32 g2 (g3 g4 (g106 g32 ttRp115 (dp116 g17 g18 ((ltRp117 sg8 g107 sbsS'Reserved' p118 g2 (g3 g4 (g106 g118 ttRp119 (dp120 g17 g18 ((ltRp121 sg8 g107 sbsS'Declaration' p122 g2 (g3 g4 (g106 g122 ttRp123 (dp124 g17 g18 ((ltRp125 sg8 g107 sbsg68 g2 (g3 g4 (g106 g68 ttRp126 (dp127 g17 g18 ((ltRp128 sg8 g107 sbsg17 g18 ((lp129 g109 ag119 ag2 (g3 g4 (g106 S'Type' p130 ttRp131 (dp132 g17 g18 ((ltRp133 sg8 g107 sbag123 ag126 ag112 ag115 atRp134 sg130 g131 sbsS'Generic' p135 g2 (g3 g4 (g135 ttRp136 (dp137 S'Prompt' p138 g2 (g3 g4 (g135 g138 ttRp139 (dp140 g17 g18 ((ltRp141 sg8 g136 sbsg8 g9 sS'Deleted' p142 g2 (g3 g4 (g135 g142 ttRp143 (dp144 g17 g18 ((ltRp145 sg8 g136 sbsS'Traceback' p146 g2 (g3 g4 (g135 g146 ttRp147 (dp148 g17 g18 ((ltRp149 sg8 g136 sbsS'Emph' p150 g2 (g3 g4 (g135 g150 ttRp151 (dp152 g17 g18 ((ltRp153 sg8 g136 sbsS'Output' p154 g2 (g3 g4 (g135 g154 ttRp155 (dp156 g17 g18 ((ltRp157 sg8 g136 sbsS'Subheading' p158 g2 (g3 g4 (g135 g158 ttRp159 (dp160 g17 g18 ((ltRp161 sg8 g136 sbsS'Error' p162 g2 (g3 g4 (g135 g162 ttRp163 (dp164 g17 g18 ((ltRp165 sg8 g136 sbsg17 g18 ((lp166 g155 ag151 ag163 ag159 ag147 ag143 ag2 (g3 g4 (g135 S'Heading' p167 ttRp168 (dp169 g17 g18 ((ltRp170 sg8 g136 sbag2 (g3 g4 (g135 S'Inserted' p171 ttRp172 (dp173 g17 g18 ((ltRp174 sg8 g136 sbag2 (g3 g4 (g135 S'Strong' p175 ttRp176 (dp177 g17 g18 ((ltRp178 sg8 g136 sbag139 atRp179 sg175 g176 sg171 g172 sg167 g168 sbsS'Text' p180 g2 (g3 g4 (g180 ttRp181 (dp182 g17 g18 ((lp183 g2 (g3 g4 (g180 S'Symbol' p184 ttRp185 (dp186 g17 g18 ((ltRp187 sg8 g181 sbag2 (g3 g4 (g180 S'Whitespace' p188 ttRp189 (dp190 g17 g18 ((ltRp191 sg8 g181 sbatRp192 sg184 g185 sg188 g189 sg8 g9 sbsS'Punctuation' p193 g2 (g3 g4 (g193 ttRp194 (dp195 g17 g18 ((lp196 g2 (g3 g4 (g193 S'Indicator' p197 ttRp198 (dp199 g17 g18 ((ltRp200 sg8 g194 sbatRp201 sg197 g198 sg8 g9 sbsS'Token' p202 g9 sS'Number' p203 g2 (g3 g4 (S'Literal' p204 g203 ttRp205 (dp206 S'Bin' p207 g2 (g3 g4 (g204 g203 g207 ttRp208 (dp209 g17 g18 ((ltRp210 sg8 g205 sbsS'Binary' p211 g2 (g3 g4 (g204 g203 g211 ttRp212 (dp213 g17 g18 ((ltRp214 sg8 g205 sbsg8 g2 (g3 g4 (g204 ttRp215 (dp216 S'String' p217 g2 (g3 g4 (g204 g217 ttRp218 (dp219 S'Regex' p220 g2 (g3 g4 (g204 g217 g220 ttRp221 (dp222 g17 g18 ((ltRp223 sg8 g218 sbsS'Interpol' p224 g2 (g3 g4 (g204 g217 g224 ttRp225 (dp226 g17 g18 ((ltRp227 sg8 g218 sbsS'Regexp' p228 g2 (g3 g4 (g204 g217 g228 ttRp229 (dp230 g17 g18 ((ltRp231 sg8 g218 sbsg8 g215 sS'Heredoc' p232 g2 (g3 g4 (g204 g217 g232 ttRp233 (dp234 g17 g18 ((ltRp235 sg8 g218 sbsS'Double' p236 g2 (g3 g4 (g204 g217 g236 ttRp237 (dp238 g17 g18 ((ltRp239 sg8 g218 sbsg184 g2 (g3 g4 (g204 g217 g184 ttRp240 (dp241 g17 g18 ((ltRp242 sg8 g218 sbsS'Escape' p243 g2 (g3 g4 (g204 g217 g243 ttRp244 (dp245 g17 g18 ((ltRp246 sg8 g218 sbsS'Character' p247 g2 (g3 g4 (g204 g217 g247 ttRp248 (dp249 g17 g18 ((ltRp250 sg8 g218 sbsS'Interp' p251 g2 (g3 g4 (g204 g217 g251 ttRp252 (dp253 g17 g18 ((ltRp254 sg8 g218 sbsS'Backtick' p255 g2 (g3 g4 (g204 g217 g255 ttRp256 (dp257 g17 g18 ((ltRp258 sg8 g218 sbsS'Char' p259 g2 (g3 g4 (g204 g217 g259 ttRp260 (dp261 g17 g18 ((ltRp262 sg8 g218 sbsS'Single' p263 g2 (g3 g4 (g204 g217 g263 ttRp264 (dp265 g17 g18 ((ltRp266 sg8 g218 sbsg60 g2 (g3 g4 (g204 g217 g60 ttRp267 (dp268 g17 g18 ((ltRp269 sg8 g218 sbsS'Doc' p270 g2 (g3 g4 (g204 g217 g270 ttRp271 (dp272 g17 g18 ((ltRp273 sg8 g218 sbsg17 g18 ((lp274 g267 ag2 (g3 g4 (g204 g217 S'Atom' p275 ttRp276 (dp277 g17 g18 ((ltRp278 sg8 g218 sbag237 ag260 ag252 ag271 ag233 ag256 ag225 ag240 ag229 ag221 ag264 ag248 ag244 atRp279 sg275 g276 sbsg8 g9 sg203 g205 sS'Scalar' p280 g2 (g3 g4 (g204 g280 ttRp281 (dp282 g17 g18 ((lp283 g2 (g3 g4 (g204 g280 S'Plain' p284 ttRp285 (dp286 g17 g18 ((ltRp287 sg8 g281 sbatRp288 sg8 g215 sg284 g285 sbsg60 g2 (g3 g4 (g204 g60 ttRp289 (dp290 g17 g18 ((ltRp291 sg8 g215 sbsS'Date' p292 g2 (g3 g4 (g204 g292 ttRp293 (dp294 g17 g18 ((ltRp295 sg8 g215 sbsg17 g18 ((lp296 g293 ag218 ag289 ag205 ag281 atRp297 sbsS'Decimal' p298 g2 (g3 g4 (g204 g203 g298 ttRp299 (dp300 g17 g18 ((ltRp301 sg8 g205 sbsS'Float' p302 g2 (g3 g4 (g204 g203 g302 ttRp303 (dp304 g17 g18 ((ltRp305 sg8 g205 sbsS'Hex' p306 g2 (g3 g4 (g204 g203 g306 ttRp307 (dp308 g17 g18 ((ltRp309 sg8 g205 sbsS'Integer' p310 g2 (g3 g4 (g204 g203 g310 ttRp311 (dp312 g17 g18 ((lp313 g2 (g3 g4 (g204 g203 g310 S'Long' p314 ttRp315 (dp316 g17 g18 ((ltRp317 sg8 g311 sbatRp318 sg314 g315 sg8 g205 sbsS'Octal' p319 g2 (g3 g4 (g204 g203 g319 ttRp320 (dp321 g17 g18 ((ltRp322 sg8 g205 sbsg17 g18 ((lp323 g208 ag212 ag320 ag299 ag2 (g3 g4 (g204 g203 S'Oct' p324 ttRp325 (dp326 g17 g18 ((ltRp327 sg8 g205 sbag311 ag303 ag307 atRp328 sg324 g325 sbsg204 g215 sg60 g2 (g3 g4 (g60 ttRp329 (dp330 g17 g18 ((ltRp331 sg8 g9 sbsg162 g2 (g3 g4 (g162 ttRp332 (dp333 g17 g18 ((ltRp334 sg8 g9 sbsS'Operator' p335 g2 (g3 g4 (g335 ttRp336 (dp337 g17 g18 ((lp338 g2 (g3 g4 (g335 S'Word' p339 ttRp340 (dp341 g17 g18 ((ltRp342 sg8 g336 sbatRp343 sg339 g340 sg8 g9 sbsg17 g18 ((lp344 g6 ag332 ag136 ag181 ag12 ag194 ag107 ag215 ag336 ag329 atRp345 sg217 g218 sbsS'Preproc' p346 g2 (g3 g4 (g5 g346 ttRp347 (dp348 g17 g18 ((ltRp349 sg8 g6 sbsg263 g2 (g3 g4 (g5 g263 ttRp350 (dp351 g17 g18 ((ltRp352 sg8 g6 sbsS'Multiline' p353 g2 (g3 g4 (g5 g353 ttRp354 (dp355 g17 g18 ((ltRp356 sg8 g6 sbsg17 g18 ((lp357 g2 (g3 g4 (g5 S'Special' p358 ttRp359 (dp360 g17 g18 ((ltRp361 sg8 g6 sbag347 ag350 ag354 atRp362 sg358 g359 sbV**** Beginning of log 2007 Sep 01 00:23:55 **** p363 tp364 a(g181 V\u000a tp365 a(g347 V2007 Sep 01 00:23:55 p366 tp367 a(g107 V--> p368 tp369 a(g218 Vweechat_user p370 tp371 a(g6 V(weechat@localhost.) ist in den Channel &bitlbee gekommen\u000a p372 tp373 a(g347 V2007 Sep 01 00:23:55 p374 tp375 a(g107 V-=- p376 tp377 a(g218 VModus p378 tp379 a(g6 V&bitlbee [+t] durch localhost.\u000a p380 tp381 a(g347 V2007 Sep 01 00:23:55 p382 tp383 a(g107 V-@- p384 tp385 a(g218 VNicks p386 tp387 a(g6 V&bitlbee: [@root @weechat_user]\u000a p388 tp389 a(g347 V2007 Sep 01 00:23:55 p390 tp391 a(g107 V-=- p392 tp393 a(g218 VChannel p394 tp395 a(g6 V&bitlbee: 2 Nicks (2 Operatoren, 0 Halb-Operator, 0 Gevoiceter, 0 normal)\u000a p396 tp397 a(g347 V2007 Sep 01 00:23:55 p398 tp399 a(g107 V-=- p400 tp401 a(g218 VDas p402 tp403 a(g6 VTopic von &bitlbee lautet: "Welcome to the control channel. Type help for help information."\u000a p404 tp405 a(g347 V2007 Sep 01 00:23:55 p406 tp407 a(g25 V<root> p408 tp409 a(g181 VWelcome to the BitlBee gateway!\u000a p410 tp411 a(g347 V2007 Sep 01 00:23:55 p412 tp413 a(g25 V<root> p414 tp415 a(g181 V\u000a tp416 a(g347 V2007 Sep 01 00:23:55 p417 tp418 a(g25 V<root> p419 tp420 a(g181 VIf you've never used BitlBee before, please do read the help information using the help command. Lots of FAQ's are answered there.\u000a p421 tp422 a.
IRC log
0
mjtamlyn/django-braces
docs/build/Pygments/tests/examplefiles/output/example.weechatlog
[ "BSD-3-Clause" ]
#ifndef __ECONE_EH_ #define __ECONE_EH_ import "ec" static inline Type unwrapPtrType(Type type, int * ptr) { Type t = type; while(t.kind == pointerType && ++(*ptr) < 32) t = t.type; return t; } static inline bool typeIsBool(Type type) { return type.kind == classType && type._class && type._class.registered && !strcmp(type._class.registered.name, "bool"); } static inline bool typeIsBoolOrPtrTo(Type type, int * ptr) { Type t = unwrapPtrType(type, ptr); return typeIsBool(t); } #endif // __ECONE_EH_
eC
4
mingodad/ecere-sdk
bgen/src/econe.eh
[ "BSD-3-Clause" ]
#![feature(fn_traits)] struct ClosureBox<'a> { cl: Box<dyn FnMut() + 'a>, } fn box_it<'r>(x: Box<dyn FnMut() + 'r>) -> ClosureBox<'r> { ClosureBox {cl: x} } fn main() { let mut cl_box = { let mut i = 3; box_it(Box::new(|| i += 1)) //~ ERROR `i` does not live long enough }; cl_box.cl.call_mut(()); }
Rust
3
Eric-Arellano/rust
src/test/ui/regions/regions-steal-closure.rs
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
<cfoutput> <p>Please enter a new password.</p> #startFormTag(action="update", key=params.key)# #passwordField(objectName="user", property="password", label="New Password")# #passwordField(objectName="user", property="passwordConfirmation", label="Confirm Password")# #submitTag(value="Update Password", class="btn btn-primary")# #endFormTag()# </cfoutput>
ColdFusion
3
fintecheando/RoomBooking
views/passwordresets/_change.cfm
[ "Apache-1.1" ]
message(STATUS "Setting up iPhoneSimulator toolchain for IOS_ARCH='${IOS_ARCH}'") set(IPHONESIMULATOR TRUE) include(${CMAKE_CURRENT_LIST_DIR}/common-ios-toolchain.cmake) message(STATUS "iPhoneSimulator toolchain loaded")
CMake
3
thisisgopalmandal/opencv
platforms/ios/cmake/Toolchains/Toolchain-iPhoneSimulator_Xcode.cmake
[ "BSD-3-Clause" ]
#ifndef CV2_NUMPY_HPP #define CV2_NUMPY_HPP #include "cv2.hpp" #include "opencv2/core.hpp" class NumpyAllocator : public cv::MatAllocator { public: NumpyAllocator() { stdAllocator = cv::Mat::getStdAllocator(); } ~NumpyAllocator() {} cv::UMatData* allocate(PyObject* o, int dims, const int* sizes, int type, size_t* step) const; cv::UMatData* allocate(int dims0, const int* sizes, int type, void* data, size_t* step, cv::AccessFlag flags, cv::UMatUsageFlags usageFlags) const CV_OVERRIDE; bool allocate(cv::UMatData* u, cv::AccessFlag accessFlags, cv::UMatUsageFlags usageFlags) const CV_OVERRIDE; void deallocate(cv::UMatData* u) const CV_OVERRIDE; const cv::MatAllocator* stdAllocator; }; extern NumpyAllocator g_numpyAllocator; //====================================================================================================================== // HACK(?): function from cv2_util.hpp extern int failmsg(const char *fmt, ...); namespace { template<class T> NPY_TYPES asNumpyType() { return NPY_OBJECT; } template<> NPY_TYPES asNumpyType<bool>() { return NPY_BOOL; } #define CV_GENERATE_INTEGRAL_TYPE_NPY_CONVERSION(src, dst) \ template<> \ NPY_TYPES asNumpyType<src>() \ { \ return NPY_##dst; \ } \ template<> \ NPY_TYPES asNumpyType<u##src>() \ { \ return NPY_U##dst; \ } CV_GENERATE_INTEGRAL_TYPE_NPY_CONVERSION(int8_t, INT8); CV_GENERATE_INTEGRAL_TYPE_NPY_CONVERSION(int16_t, INT16); CV_GENERATE_INTEGRAL_TYPE_NPY_CONVERSION(int32_t, INT32); CV_GENERATE_INTEGRAL_TYPE_NPY_CONVERSION(int64_t, INT64); #undef CV_GENERATE_INTEGRAL_TYPE_NPY_CONVERSION template<> NPY_TYPES asNumpyType<float>() { return NPY_FLOAT; } template<> NPY_TYPES asNumpyType<double>() { return NPY_DOUBLE; } template <class T> PyArray_Descr* getNumpyTypeDescriptor() { return PyArray_DescrFromType(asNumpyType<T>()); } template <> PyArray_Descr* getNumpyTypeDescriptor<size_t>() { #if SIZE_MAX == ULONG_MAX return PyArray_DescrFromType(NPY_ULONG); #elif SIZE_MAX == ULLONG_MAX return PyArray_DescrFromType(NPY_ULONGLONG); #else return PyArray_DescrFromType(NPY_UINT); #endif } template <class T, class U> bool isRepresentable(U value) { return (std::numeric_limits<T>::min() <= value) && (value <= std::numeric_limits<T>::max()); } template<class T> bool canBeSafelyCasted(PyObject* obj, PyArray_Descr* to) { return PyArray_CanCastTo(PyArray_DescrFromScalar(obj), to) != 0; } template<> bool canBeSafelyCasted<size_t>(PyObject* obj, PyArray_Descr* to) { PyArray_Descr* from = PyArray_DescrFromScalar(obj); if (PyArray_CanCastTo(from, to)) { return true; } else { // False negative scenarios: // - Signed input is positive so it can be safely cast to unsigned output // - Input has wider limits but value is representable within output limits // - All the above if (PyDataType_ISSIGNED(from)) { int64_t input = 0; PyArray_CastScalarToCtype(obj, &input, getNumpyTypeDescriptor<int64_t>()); return (input >= 0) && isRepresentable<size_t>(static_cast<uint64_t>(input)); } else { uint64_t input = 0; PyArray_CastScalarToCtype(obj, &input, getNumpyTypeDescriptor<uint64_t>()); return isRepresentable<size_t>(input); } return false; } } template<class T> bool parseNumpyScalar(PyObject* obj, T& value) { if (PyArray_CheckScalar(obj)) { // According to the numpy documentation: // There are 21 statically-defined PyArray_Descr objects for the built-in data-types // So descriptor pointer is not owning. PyArray_Descr* to = getNumpyTypeDescriptor<T>(); if (canBeSafelyCasted<T>(obj, to)) { PyArray_CastScalarToCtype(obj, &value, to); return true; } } return false; } struct SafeSeqItem { PyObject * item; SafeSeqItem(PyObject *obj, size_t idx) { item = PySequence_GetItem(obj, idx); } ~SafeSeqItem() { Py_XDECREF(item); } private: SafeSeqItem(const SafeSeqItem&); // = delete SafeSeqItem& operator=(const SafeSeqItem&); // = delete }; template <class T> class RefWrapper { public: RefWrapper(T& item) : item_(item) {} T& get() CV_NOEXCEPT { return item_; } private: T& item_; }; // In order to support this conversion on 3.x branch - use custom reference_wrapper // and C-style array instead of std::array<T, N> template <class T, std::size_t N> bool parseSequence(PyObject* obj, RefWrapper<T> (&value)[N], const ArgInfo& info) { if (!obj || obj == Py_None) { return true; } if (!PySequence_Check(obj)) { failmsg("Can't parse '%s'. Input argument doesn't provide sequence " "protocol", info.name); return false; } const std::size_t sequenceSize = PySequence_Size(obj); if (sequenceSize != N) { failmsg("Can't parse '%s'. Expected sequence length %lu, got %lu", info.name, N, sequenceSize); return false; } for (std::size_t i = 0; i < N; ++i) { SafeSeqItem seqItem(obj, i); if (!pyopencv_to(seqItem.item, value[i].get(), info)) { failmsg("Can't parse '%s'. Sequence item with index %lu has a " "wrong type", info.name, i); return false; } } return true; } } // namespace #endif // CV2_NUMPY_HPP
C++
4
nowireless/opencv
modules/python/src2/cv2_numpy.hpp
[ "Apache-2.0" ]
use("foobarius") use("ispec") describe(Foobarius, it("should mimic Origin", Foobarius should mimic(Origin)) describe("Board", describe("yay", it("should return the addition of the two numbers", Foobarius Board yay(2, 40) should == 42 ) ) ) describe("SnowBoard", describe("yay3", it("should return the multiplication of the two numbers", Foobarius SnowBoard yay3(21, 2) should == 42 ) ) ) ) describe(Origin, describe("blah", it("should return 42", blah should == 42 ) ) ) describe(DefaultBehavior, describe("Definitions", describe("mummy", it("should return a mummy", mummy should == :tot ) ) ) )
Ioke
3
olabini/ioke
examples/project/test/foobar_spec.ik
[ "ICU", "MIT" ]
variable "enableEncryption" { default = false }
HCL
0
cpontvieux-systra/trivy
examples/misconf/mixed/configs/variables.tf
[ "Apache-2.0" ]
address { socket_address { protocol: TCP port_value: 80 } } filter_chains { filters { name: "http_connection_manager" } }
PureBasic
3
dcillera/envoy
api/examples/service_envoy/listeners.pb
[ "Apache-2.0" ]
( var ugens_db = Dictionary.new(); var failedclasses=List.new(); var find_rate_from_new = {arg class;var ret;try {ret=class.new().rate; }{ret=\fail};ret}; var ignoring = [ /* abstract */ 'AbstractIn','AbstractOut','AudioControl','BasicOpUGen','BEQSuite','BufInfoUGenBase','ChaosGen','DUGen','Filter','ListDUGen','MultiOutUGen','OutputProxy','PureMultiOutUGen','PureUGen','WidthFirstUGen', /* deprecated */ 'SharedIn','SharedOut', /* composite & derived */ 'Changed','DynKlang','DynKlank','HilbertFIR','InBus','LagControl','Splay','SplayAz','Tap', /* non-user & implicit */ 'Control', /* text label */ 'SendPeakRMS','SendReply', 'FFTTrigger','PackFFT','Unpack1FFT','UnpackFFT', 'MulAdd', /* implicit length input */ 'ClearBuf','SetBuf', /* count input */ 'MaxLocalBufs' ]; var excluded=["Out","MultiOutUGen","OutputProxy","BinaryOpUGen","UnaryOpUGen","MulAdd"]; var losmetodos=['ir','kr','ar']; /* PV_ operates at kr but message is \new. Demand operates at \dr but message is \new. */ var is_demand = { arg o; [Dibrown,Diwhite,Dswitch,Dunique].includes(o) || [ListDUGen,DUGen].includes(o.superclass); }; /* PV_ operates at kr but message is \new. */ var is_PV = {arg o; var nm = o.asString; (nm == "FFT") || (nm.find("PV_") == 0)}; var to_upper = {arg o; o.asString.toUpper.asSymbol}; var find_method_r = { arg o, n; var m = o.findMethod(n); var p = o.superclass; if(m.notNil, {m}, {if(p.notNil, {find_method_r.(p,n)}, {nil})}); }; var supports_rate = {arg o, r; find_method_r.(o.class,r) != nil}; var supported_rates = { arg o; var d = if(is_demand.(o), {[\dr]}, {[]}); var pv = if(is_PV.(o), {[\kr]}, {[]}); [\ar,\kr,\dr,\ir].select({arg r; supports_rate.(o,r)}) ++ d ++ pv; }; var input_names = { arg nm, o, r; var n = find_method_r.(o.class,r).argNames; var x = [ 'this','mul','add', 'selector', // uop & binop ]; var f = {arg e; x.includes(e)}; n.reject(f); }; var input_default = { arg o, r ,nm; var m = find_method_r.(o.class,r); var n = m.argNames; var i = n.detectIndex({arg e; e == nm}); m.prototypeFrame[i]; }; var number_of_outputs = { arg o, r; try {var u = o.perform(r); if(u.isArray,{u.size},{if(u.isFloat,{0},{1})})} {arg err; 1}; }; var ugen_dump = { arg o; var nm = o.name.asString; var rt_all = supported_rates.(o); var rt_def = if(rt_all.isEmpty, {\ir}, {rt_all[0]}); var rt_cons = if(is_demand.(o) || is_PV.(o) || rt_all.isEmpty, {\new}, {rt_def}); var n_a = input_names.(nm,o,rt_cons); var n = n_a; var nn = n.collect({arg e; [e.asString, input_default.(o,rt_cons,e)]}); var no = number_of_outputs.(o, rt_cons); var h_m = SCDoc.documents.at("Classes/"++nm); var h = if(h_m==nil, {"No summary"}, {h_m.summary}); /*var rng = signal_range.(o,rt_cons);*/ [nm,rt_all,rt_def,nn,no,h,rt_cons]; }; /* var one_ugen = Dwrand; ugen_dump.(one_ugen).postln; //find_method_r.(Dwrand.class,\new); find_method_r.(one_ugen.class,\new).postln; one_ugen.class.findRespondingMethodFor(\new).postln; find_rate_from_new.value(one_ugen).postln; //one_ugen.new().postln; )*/ var ugens; //get all sorted ugens except excluded ignoring.do({arg a; excluded=excluded.add(a.asString);}); //excluded.postln; //ignoring.postln; ugens = UGen.allSubclasses.select({|ugen| excluded.detect({arg itexcl;itexcl==ugen.name.asString}).isNil}); //var ugens = UGen.allSubclasses.select({|ugen| excluded.includes(ugen.name.asString).not;}); ugens.sort({|a, b| a.name < b.name}); ugens.do({arg it; var armet,nameclass,defaultval,argnames; var methodfound,dump,res; nameclass=it.name.asString; ugens_db.put(nameclass,Dictionary.new()); ugens_db.at(nameclass).put("methods",Dictionary.new()); if(it.isOutputUGen, {ugens_db.at(nameclass).put("isOut",true);}, {var supcl=it.superclasses.detect({arg it2;it2.name.asString=="MultiOutUGen";}); if(supcl.notNil,{ugens_db.at(nameclass).put("isMultiOut",true);});} ); ugens_db.at(nameclass).put("parent",it.superclass.name.asString.asCompileString;); dump = ugen_dump.(it); ugens_db.at(nameclass).put("nOuts",dump[4]); ugens_db.at(nameclass).put("description",dump[5].asCompileString;); methodfound=false; //try {res=it.perform(dump[6]); }{res=\fail}; //if(res!=\fail && res.isKindOf(it).not && ugens_db.at(nameclass).at("isMultiOut").isNil,{ugens_db.at(nameclass).put("pseudo",true);}); losmetodos.do({arg metod,indmetod; armet=it.class.findRespondingMethodFor(metod); if (armet.notNil, { ugens_db.at(nameclass).at("methods").put(metod,List.new()); methodfound=true; argnames=armet.argNames.copyRange(1,armet.argNames.size); if((argnames.size >0),{ defaultval = armet.prototypeFrame.copyRange(1,armet.prototypeFrame.size); defaultval = defaultval.replace([inf],["inf"]); defaultval = defaultval.collect({arg i; if(i.isKindOf(Symbol),{i=i.asString}); i}); defaultval = defaultval.collect({arg i;if(i.isString,{i=i.asCompileString});i}); defaultval = defaultval.replace([nil],["null"]); }); argnames.do({arg varname,ind; if( (varname!='mul') && (varname!='add'), { ugens_db.at(nameclass).at("methods").at(metod).add([varname,defaultval.at(ind)]); }); }); } );//armet.notnil });//losmetodos.do if(methodfound,{}, { var metodo=it.class.findRespondingMethodFor(\new); var larate=find_rate_from_new.value(it); if(metodo.isNil.not,{ var argnames=metodo.argNames.copyRange(1,metodo.argNames.size); var ratenum=switch (larate, \scalar, { 0 }, \control, { 1 }, \audio, { 2}, \demand,{3} ); if(ratenum.isNil,{ ratenum=switch(dump[2], \ir, { 0 }, \kr, { 1 }, \ar, { 2}, \dr,{3} ); }); if(ratenum.isNil,{failedclasses.add(it.name);}); ugens_db.at(nameclass).put("ratenew",ratenum); ugens_db.at(nameclass).at("methods").put("new",List.new()); if((argnames.size >0),{ //argnames.asString.replace("SymbolArray[",' ').replace("]",' ').post; //argnames.asCompileString.replace("SymbolArray[","{").tr($],$}).post; defaultval = metodo.prototypeFrame.copyRange(1,metodo.prototypeFrame.size); defaultval = defaultval.replace([inf],["inf"]); defaultval = defaultval.collect({arg i; if(i.isKindOf(Symbol),{i=i.asString}); i}); defaultval = defaultval.collect({arg i;if(i.isString,{i=i.asCompileString});i}); defaultval = defaultval.replace([nil],["null"]); //defaultval.asCompileString.tr($[,${).tr($],$}).post; }); argnames.do({arg varname,ind; if( (varname!='mul') && (varname!='add'), { ugens_db.at(nameclass).at("methods").at("new").add([varname,defaultval.at(ind)]); }); }); },{failedclasses.add(it.name);});//la rate not nil no testfail });//not methodfound }); //json printing "{".postln; ugens.do{arg it,itnum; var ugen,uname,comma; uname = it.name.asString; ugen = ugens_db.at(uname); postln('"'++uname++'"' ++": {"); ugen.keysValuesDo{|key,val,ind0| switch( key, "methods", {' "methods":{'.postln; val.keysValuesDo{|met,l,ind| (' "'++met++'" :[').postln; l.do{|argu,ind2| ' '.post; if(((ind2+1)<l.size),{comma=","},{comma=""}); ('["'++argu[0]++'",'++argu[1]++']'++comma).postln;}; if(((ind+1)<val.size),{comma=","},{comma=""}); (' ]'++comma).postln;}; if(((ind0+1)<ugen.size),{comma=","},{comma=""}); (" }"++comma).postln; }, { if(((ind0+1)<ugen.size),{comma=","},{comma=""}); (' "'++key++'" :').post;val.post;comma.postln;} ); }; if(((itnum+1)<ugens.size),{comma=","},{comma=""}); ("}"++comma).postln; }; "}".postln; "failed classes are".postln; failedclasses.do({arg it; it.postln;}); ) ( var col = [nil,1,2,3]; col = col.replace([nil,3],["null",5]); col.postln; \pepe.isKindOf(Symbol).postln; nil.asCompileString.isNil.postln; nil.asCompileString.postln; \pepe.asCompileString.postln; ) ( var find_method_r = { arg o, n; var m = o.findMethod(n); var p = o.superclass; if(m.notNil, {m}, {if(p.notNil, {find_method_r.(p,n)}, {nil})}); }; Dwrand.findMethod(\new); find_method_r.(Dwrand,\new).postln; )Onsets
SuperCollider
4
sonoro1234/Lua2SC
lua2SC/genugens/scugendumpjson.scd
[ "MIT" ]
const std = @import("../std.zig"); const builtin = @import("builtin"); const Loop = std.event.Loop; /// A WaitGroup keeps track and waits for a group of async tasks to finish. /// Call `begin` when creating new tasks, and have tasks call `finish` when done. /// You can provide a count for both operations to perform them in bulk. /// Call `wait` to suspend until all tasks are completed. /// Multiple waiters are supported. /// /// WaitGroup is an instance of WaitGroupGeneric, which takes in a bitsize /// for the internal counter. WaitGroup defaults to a `usize` counter. /// It's also possible to define a max value for the counter so that /// `begin` will return error.Overflow when the limit is reached, even /// if the integer type has not has not overflowed. /// By default `max_value` is set to std.math.maxInt(CounterType). pub const WaitGroup = WaitGroupGeneric(std.meta.bitCount(usize)); pub fn WaitGroupGeneric(comptime counter_size: u16) type { const CounterType = std.meta.Int(.unsigned, counter_size); const global_event_loop = Loop.instance orelse @compileError("std.event.WaitGroup currently only works with event-based I/O"); return struct { counter: CounterType = 0, max_counter: CounterType = std.math.maxInt(CounterType), mutex: std.Thread.Mutex = .{}, waiters: ?*Waiter = null, const Waiter = struct { next: ?*Waiter, tail: *Waiter, node: Loop.NextTickNode, }; const Self = @This(); pub fn begin(self: *Self, count: CounterType) error{Overflow}!void { const held = self.mutex.acquire(); defer held.release(); const new_counter = try std.math.add(CounterType, self.counter, count); if (new_counter > self.max_counter) return error.Overflow; self.counter = new_counter; } pub fn finish(self: *Self, count: CounterType) void { var waiters = blk: { const held = self.mutex.acquire(); defer held.release(); self.counter = std.math.sub(CounterType, self.counter, count) catch unreachable; if (self.counter == 0) { const temp = self.waiters; self.waiters = null; break :blk temp; } break :blk null; }; // We don't need to hold the lock to reschedule any potential waiter. while (waiters) |w| { const temp_w = w; waiters = w.next; global_event_loop.onNextTick(&temp_w.node); } } pub fn wait(self: *Self) void { const held = self.mutex.acquire(); if (self.counter == 0) { held.release(); return; } var self_waiter: Waiter = undefined; self_waiter.node.data = @frame(); if (self.waiters) |head| { head.tail.next = &self_waiter; head.tail = &self_waiter; } else { self.waiters = &self_waiter; self_waiter.tail = &self_waiter; self_waiter.next = null; } suspend { held.release(); } } }; } test "basic WaitGroup usage" { if (!std.io.is_async) return error.SkipZigTest; // TODO https://github.com/ziglang/zig/issues/1908 if (builtin.single_threaded) return error.SkipZigTest; // TODO https://github.com/ziglang/zig/issues/3251 if (builtin.os.tag == .freebsd) return error.SkipZigTest; var initial_wg = WaitGroup{}; var final_wg = WaitGroup{}; try initial_wg.begin(1); try final_wg.begin(1); var task_frame = async task(&initial_wg, &final_wg); initial_wg.finish(1); final_wg.wait(); await task_frame; } fn task(wg_i: *WaitGroup, wg_f: *WaitGroup) void { wg_i.wait(); wg_f.finish(1); }
Zig
5
lukekras/zig
lib/std/event/wait_group.zig
[ "MIT" ]
% File "turtlecl.tu". unit class TurtleCl export SetColor, SetPosition, SetAngle, Move, TurnLeft, TurnRight, ShowTrace, HideTrace % Declare common variables and initialize them. var x : int := maxx div 2 % Set x to center of window. var y : int := maxy div 2 % Set y to center of window. var angle : int := 0 % Set to point to right of window. var clr : int := colorfg % Set to foreground color. var showing : boolean := true % Set to show trace. procedure SetColor (newClr : int) clr := newClr end SetColor procedure SetPosition (newX, newY : int) x := newX y := newY end SetPosition procedure SetAngle (newAngle : int) angle := newAngle end SetAngle procedure TurnLeft (turnAngle : int) angle := angle + turnAngle angle := angle mod 360 % Remove any complete rotation. end TurnLeft procedure TurnRight (turnAngle : int) angle := angle - turnAngle angle := angle mod 360 % Remove any complete rotation. end TurnRight procedure ShowTrace showing := true end ShowTrace procedure HideTrace showing := false end HideTrace procedure Move (distance : int) var newx, newy : int newx := round (x + cosd (angle) * distance) newy := round (y + sind (angle) * distance) if showing then Draw.Line (x, y, newx, newy, clr) end if x := newx y := newy end Move end TurtleCl
Turing
5
null-dev/Hyper
package/Examples/Programming Concepts and Paradigms/chap07/turtlecl.tu
[ "MIT" ]
/home/spinalvm/hdl/riscv-compliance/work//I-DELAY_SLOTS-01.elf: file format elf32-littleriscv Disassembly of section .text.init: 80000000 <_start>: 80000000: 00001097 auipc ra,0x1 80000004: 00008093 mv ra,ra 80000008: 11111137 lui sp,0x11111 8000000c: 11110113 addi sp,sp,273 # 11111111 <_start-0x6eeeeeef> 80000010: 0080006f j 80000018 <_start+0x18> 80000014: 00000113 li sp,0 80000018: 0020a023 sw sp,0(ra) # 80001000 <codasip_signature_start> 8000001c: 00001097 auipc ra,0x1 80000020: fe808093 addi ra,ra,-24 # 80001004 <test_A2_res> 80000024: 22222137 lui sp,0x22222 80000028: 22210113 addi sp,sp,546 # 22222222 <_start-0x5dddddde> 8000002c: 00000217 auipc tp,0x0 80000030: 01020213 addi tp,tp,16 # 8000003c <_start+0x3c> 80000034: 00020067 jr tp 80000038: 00000113 li sp,0 8000003c: 0020a023 sw sp,0(ra) 80000040: 00001097 auipc ra,0x1 80000044: fc808093 addi ra,ra,-56 # 80001008 <test_B1_res> 80000048: 00500293 li t0,5 8000004c: 00600313 li t1,6 80000050: 33333137 lui sp,0x33333 80000054: 33310113 addi sp,sp,819 # 33333333 <_start-0x4ccccccd> 80000058: 00528463 beq t0,t0,80000060 <_start+0x60> 8000005c: 00000113 li sp,0 80000060: 0020a023 sw sp,0(ra) 80000064: 00001097 auipc ra,0x1 80000068: fa808093 addi ra,ra,-88 # 8000100c <test_B2_res> 8000006c: 00500293 li t0,5 80000070: 00600313 li t1,6 80000074: 44444137 lui sp,0x44444 80000078: 44410113 addi sp,sp,1092 # 44444444 <_start-0x3bbbbbbc> 8000007c: 00629463 bne t0,t1,80000084 <_start+0x84> 80000080: 00000113 li sp,0 80000084: 0020a023 sw sp,0(ra) 80000088: 00001097 auipc ra,0x1 8000008c: f8808093 addi ra,ra,-120 # 80001010 <test_B3_res> 80000090: 00500293 li t0,5 80000094: 00600313 li t1,6 80000098: 55555137 lui sp,0x55555 8000009c: 55510113 addi sp,sp,1365 # 55555555 <_start-0x2aaaaaab> 800000a0: 0062c463 blt t0,t1,800000a8 <_start+0xa8> 800000a4: 00000113 li sp,0 800000a8: 0020a023 sw sp,0(ra) 800000ac: 00001097 auipc ra,0x1 800000b0: f6808093 addi ra,ra,-152 # 80001014 <test_B4_res> 800000b4: 00500293 li t0,5 800000b8: 00600313 li t1,6 800000bc: 66666137 lui sp,0x66666 800000c0: 66610113 addi sp,sp,1638 # 66666666 <_start-0x1999999a> 800000c4: 0062e463 bltu t0,t1,800000cc <_start+0xcc> 800000c8: 00000113 li sp,0 800000cc: 0020a023 sw sp,0(ra) 800000d0: 00001097 auipc ra,0x1 800000d4: f4808093 addi ra,ra,-184 # 80001018 <test_B5_res> 800000d8: 00500293 li t0,5 800000dc: 00600313 li t1,6 800000e0: 77777137 lui sp,0x77777 800000e4: 77710113 addi sp,sp,1911 # 77777777 <_start-0x8888889> 800000e8: 00535463 ble t0,t1,800000f0 <_start+0xf0> 800000ec: 00000113 li sp,0 800000f0: 0020a023 sw sp,0(ra) 800000f4: 00001097 auipc ra,0x1 800000f8: f2808093 addi ra,ra,-216 # 8000101c <test_B6_res> 800000fc: 00500293 li t0,5 80000100: 00600313 li t1,6 80000104: 88889137 lui sp,0x88889 80000108: 88810113 addi sp,sp,-1912 # 88888888 <_end+0x8887868> 8000010c: 00537463 bleu t0,t1,80000114 <_start+0x114> 80000110: 00000113 li sp,0 80000114: 0020a023 sw sp,0(ra) 80000118: 00001517 auipc a0,0x1 8000011c: ee850513 addi a0,a0,-280 # 80001000 <codasip_signature_start> 80000120: 00001597 auipc a1,0x1 80000124: f0058593 addi a1,a1,-256 # 80001020 <_end> 80000128: f0100637 lui a2,0xf0100 8000012c: f2c60613 addi a2,a2,-212 # f00fff2c <_end+0x700fef0c> 80000130 <complience_halt_loop>: 80000130: 02b50663 beq a0,a1,8000015c <complience_halt_break> 80000134: 00c52683 lw a3,12(a0) 80000138: 00d62023 sw a3,0(a2) 8000013c: 00852683 lw a3,8(a0) 80000140: 00d62023 sw a3,0(a2) 80000144: 00452683 lw a3,4(a0) 80000148: 00d62023 sw a3,0(a2) 8000014c: 00052683 lw a3,0(a0) 80000150: 00d62023 sw a3,0(a2) 80000154: 01050513 addi a0,a0,16 80000158: fd9ff06f j 80000130 <complience_halt_loop> 8000015c <complience_halt_break>: 8000015c: f0100537 lui a0,0xf0100 80000160: f2050513 addi a0,a0,-224 # f00fff20 <_end+0x700fef00> 80000164: 00052023 sw zero,0(a0) ... Disassembly of section .data: 80001000 <codasip_signature_start>: 80001000: ffff 0xffff 80001002: ffff 0xffff 80001004 <test_A2_res>: 80001004: ffff 0xffff 80001006: ffff 0xffff 80001008 <test_B1_res>: 80001008: ffff 0xffff 8000100a: ffff 0xffff 8000100c <test_B2_res>: 8000100c: ffff 0xffff 8000100e: ffff 0xffff 80001010 <test_B3_res>: 80001010: ffff 0xffff 80001012: ffff 0xffff 80001014 <test_B4_res>: 80001014: ffff 0xffff 80001016: ffff 0xffff 80001018 <test_B5_res>: 80001018: ffff 0xffff 8000101a: ffff 0xffff 8000101c <test_B6_res>: 8000101c: ffff 0xffff 8000101e: ffff 0xffff
ObjDump
3
cbrune/VexRiscv
src/test/resources/asm/I-DELAY_SLOTS-01.elf.objdump
[ "MIT" ]
# -*- test-case-name: twisted.words.test.test_xpath -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # pylint: disable=W9401,W9402 # DO NOT EDIT xpathparser.py! # # It is generated from xpathparser.g using Yapps. Make needed changes there. # This also means that the generated Python may not conform to Twisted's coding # standards, so it is wrapped in exec to prevent automated checkers from # complaining. # HOWTO Generate me: # # 1.) Grab a copy of yapps2: # https://github.com/smurfix/yapps # # Note: Do NOT use the package in debian/ubuntu as it has incompatible # modifications. The original at http://theory.stanford.edu/~amitp/yapps/ # hasn't been touched since 2003 and has not been updated to work with # Python 3. # # 2.) Generate the grammar: # # yapps2 xpathparser.g xpathparser.py.proto # # 3.) Edit the output to depend on the embedded runtime, and remove extraneous # imports: # # sed -e '/^# Begin/,${/^[^ ].*mport/d}' -e 's/runtime\.//g' \ # -e "s/^\(from __future\)/exec(r'''\n\1/" -e"\$a''')" # xpathparser.py.proto > xpathparser.py """ XPath Parser. Besides the parser code produced by Yapps, this module also defines the parse-time exception classes, a scanner class, a base class for parsers produced by Yapps, and a context class that keeps track of the parse stack. These have been copied from the Yapps runtime module. """ from __future__ import print_function import sys, re MIN_WINDOW=4096 # File lookup window class SyntaxError(Exception): """When we run into an unexpected token, this is the exception to use""" def __init__(self, pos=None, msg="Bad Token", context=None): Exception.__init__(self) self.pos = pos self.msg = msg self.context = context def __str__(self): if not self.pos: return 'SyntaxError' else: return 'SyntaxError@%s(%s)' % (repr(self.pos), self.msg) class NoMoreTokens(Exception): """Another exception object, for when we run out of tokens""" pass class Token: """Yapps token. This is a container for a scanned token. """ def __init__(self, type,value, pos=None): """Initialize a token.""" self.type = type self.value = value self.pos = pos def __repr__(self): output = '<%s: %s' % (self.type, repr(self.value)) if self.pos: output += " @ " if self.pos[0]: output += "%s:" % self.pos[0] if self.pos[1]: output += "%d" % self.pos[1] if self.pos[2] is not None: output += ".%d" % self.pos[2] output += ">" return output in_name=0 class Scanner: """Yapps scanner. The Yapps scanner can work in context sensitive or context insensitive modes. The token(i) method is used to retrieve the i-th token. It takes a restrict set that limits the set of tokens it is allowed to return. In context sensitive mode, this restrict set guides the scanner. In context insensitive mode, there is no restriction (the set is always the full set of tokens). """ def __init__(self, patterns, ignore, input="", file=None,filename=None,stacked=False): """Initialize the scanner. Parameters: patterns : [(terminal, uncompiled regex), ...] or None ignore : {terminal:None, ...} input : string If patterns is None, we assume that the subclass has defined self.patterns : [(terminal, compiled regex), ...]. Note that the patterns parameter expects uncompiled regexes, whereas the self.patterns field expects compiled regexes. The 'ignore' value is either None or a callable, which is called with the scanner and the to-be-ignored match object; this can be used for include file or comment handling. """ if not filename: global in_name filename="<f.%d>" % in_name in_name += 1 self.input = input self.ignore = ignore self.file = file self.filename = filename self.pos = 0 self.del_pos = 0 # skipped self.line = 1 self.del_line = 0 # skipped self.col = 0 self.tokens = [] self.stack = None self.stacked = stacked self.last_read_token = None self.last_token = None self.last_types = None if patterns is not None: # Compile the regex strings into regex objects self.patterns = [] for terminal, regex in patterns: self.patterns.append( (terminal, re.compile(regex)) ) def stack_input(self, input="", file=None, filename=None): """Temporarily parse from a second file.""" # Already reading from somewhere else: Go on top of that, please. if self.stack: # autogenerate a recursion-level-identifying filename if not filename: filename = 1 else: try: filename += 1 except TypeError: pass # now pass off to the include file self.stack.stack_input(input,file,filename) else: try: filename += 0 except TypeError: pass else: filename = "<str_%d>" % filename # self.stack = object.__new__(self.__class__) # Scanner.__init__(self.stack,self.patterns,self.ignore,input,file,filename, stacked=True) # Note that the pattern+ignore are added by the generated # scanner code self.stack = self.__class__(input,file,filename, stacked=True) def get_pos(self): """Return a file/line/char tuple.""" if self.stack: return self.stack.get_pos() return (self.filename, self.line+self.del_line, self.col) # def __repr__(self): # """Print the last few tokens that have been scanned in""" # output = '' # for t in self.tokens: # output += '%s\n' % (repr(t),) # return output def print_line_with_pointer(self, pos, length=0, out=sys.stderr): """Print the line of 'text' that includes position 'p', along with a second line with a single caret (^) at position p""" file,line,p = pos if file != self.filename: if self.stack: return self.stack.print_line_with_pointer(pos,length=length,out=out) print >>out, "(%s: not in input buffer)" % file return text = self.input p += length-1 # starts at pos 1 origline=line line -= self.del_line spos=0 if line > 0: while 1: line = line - 1 try: cr = text.index("\n",spos) except ValueError: if line: text = "" break if line == 0: text = text[spos:cr] break spos = cr+1 else: print >>out, "(%s:%d not in input buffer)" % (file,origline) return # Now try printing part of the line text = text[max(p-80, 0):p+80] p = p - max(p-80, 0) # Strip to the left i = text[:p].rfind('\n') j = text[:p].rfind('\r') if i < 0 or (0 <= j < i): i = j if 0 <= i < p: p = p - i - 1 text = text[i+1:] # Strip to the right i = text.find('\n', p) j = text.find('\r', p) if i < 0 or (0 <= j < i): i = j if i >= 0: text = text[:i] # Now shorten the text while len(text) > 70 and p > 60: # Cut off 10 chars text = "..." + text[10:] p = p - 7 # Now print the string, along with an indicator print >>out, '> ',text print >>out, '> ',' '*p + '^' def grab_input(self): """Get more input if possible.""" if not self.file: return if len(self.input) - self.pos >= MIN_WINDOW: return data = self.file.read(MIN_WINDOW) if data is None or data == "": self.file = None # Drop bytes from the start, if necessary. if self.pos > 2*MIN_WINDOW: self.del_pos += MIN_WINDOW self.del_line += self.input[:MIN_WINDOW].count("\n") self.pos -= MIN_WINDOW self.input = self.input[MIN_WINDOW:] + data else: self.input = self.input + data def getchar(self): """Return the next character.""" self.grab_input() c = self.input[self.pos] self.pos += 1 return c def token(self, restrict, context=None): """Scan for another token.""" while 1: if self.stack: try: return self.stack.token(restrict, context) except StopIteration: self.stack = None # Keep looking for a token, ignoring any in self.ignore self.grab_input() # special handling for end-of-file if self.stacked and self.pos==len(self.input): raise StopIteration # Search the patterns for the longest match, with earlier # tokens in the list having preference best_match = -1 best_pat = '(error)' best_m = None for p, regexp in self.patterns: # First check to see if we're ignoring this token if restrict and p not in restrict and p not in self.ignore: continue m = regexp.match(self.input, self.pos) if m and m.end()-m.start() > best_match: # We got a match that's better than the previous one best_pat = p best_match = m.end()-m.start() best_m = m # If we didn't find anything, raise an error if best_pat == '(error)' and best_match < 0: msg = 'Bad Token' if restrict: msg = 'Trying to find one of '+', '.join(restrict) raise SyntaxError(self.get_pos(), msg, context=context) ignore = best_pat in self.ignore value = self.input[self.pos:self.pos+best_match] if not ignore: tok=Token(type=best_pat, value=value, pos=self.get_pos()) self.pos += best_match npos = value.rfind("\n") if npos > -1: self.col = best_match-npos self.line += value.count("\n") else: self.col += best_match # If we found something that isn't to be ignored, return it if not ignore: if len(self.tokens) >= 10: del self.tokens[0] self.tokens.append(tok) self.last_read_token = tok # print repr(tok) return tok else: ignore = self.ignore[best_pat] if ignore: ignore(self, best_m) def peek(self, *types, **kw): """Returns the token type for lookahead; if there are any args then the list of args is the set of token types to allow""" context = kw.get("context",None) if self.last_token is None: self.last_types = types self.last_token = self.token(types,context) elif self.last_types: for t in types: if t not in self.last_types: raise NotImplementedError("Unimplemented: restriction set changed") return self.last_token.type def scan(self, type, **kw): """Returns the matched text, and moves to the next token""" context = kw.get("context",None) if self.last_token is None: tok = self.token([type],context) else: if self.last_types and type not in self.last_types: raise NotImplementedError("Unimplemented: restriction set changed") tok = self.last_token self.last_token = None if tok.type != type: if not self.last_types: self.last_types=[] raise SyntaxError(tok.pos, 'Trying to find '+type+': '+ ', '.join(self.last_types)+", got "+tok.type, context=context) return tok.value class Parser: """Base class for Yapps-generated parsers. """ def __init__(self, scanner): self._scanner = scanner def _stack(self, input="",file=None,filename=None): """Temporarily read from someplace else""" self._scanner.stack_input(input,file,filename) self._tok = None def _peek(self, *types, **kw): """Returns the token type for lookahead; if there are any args then the list of args is the set of token types to allow""" return self._scanner.peek(*types, **kw) def _scan(self, type, **kw): """Returns the matched text, and moves to the next token""" return self._scanner.scan(type, **kw) class Context: """Class to represent the parser's call stack. Every rule creates a Context that links to its parent rule. The contexts can be used for debugging. """ def __init__(self, parent, scanner, rule, args=()): """Create a new context. Args: parent: Context object or None scanner: Scanner object rule: string (name of the rule) args: tuple listing parameters to the rule """ self.parent = parent self.scanner = scanner self.rule = rule self.args = args while scanner.stack: scanner = scanner.stack self.token = scanner.last_read_token def __str__(self): output = '' if self.parent: output = str(self.parent) + ' > ' output += self.rule return output def print_error(err, scanner, max_ctx=None): """Print error messages, the parser stack, and the input text -- for human-readable error messages.""" # NOTE: this function assumes 80 columns :-( # Figure out the line number pos = err.pos if not pos: pos = scanner.get_pos() file_name, line_number, column_number = pos print('%s:%d:%d: %s' % (file_name, line_number, column_number, err.msg), file=sys.stderr) scanner.print_line_with_pointer(pos) context = err.context token = None while context: print('while parsing %s%s:' % (context.rule, tuple(context.args)), file=sys.stderr) if context.token: token = context.token if token: scanner.print_line_with_pointer(token.pos, length=len(token.value)) context = context.parent if max_ctx: max_ctx = max_ctx-1 if not max_ctx: break def wrap_error_reporter(parser, rule, *args,**kw): try: return getattr(parser, rule)(*args,**kw) except SyntaxError as e: print_error(e, parser._scanner) except NoMoreTokens: print('Could not complete parsing; stopped around here:', file=sys.stderr) print(parser._scanner, file=sys.stderr) from twisted.words.xish.xpath import AttribValue, BooleanValue, CompareValue from twisted.words.xish.xpath import Function, IndexValue, LiteralValue from twisted.words.xish.xpath import _AnyLocation, _Location %% parser XPathParser: ignore: "\\s+" token INDEX: "[0-9]+" token WILDCARD: "\*" token IDENTIFIER: "[a-zA-Z][a-zA-Z0-9_\-]*" token ATTRIBUTE: "\@[a-zA-Z][a-zA-Z0-9_\-]*" token FUNCNAME: "[a-zA-Z][a-zA-Z0-9_]*" token CMP_EQ: "\=" token CMP_NE: "\!\=" token STR_DQ: '"([^"]|(\\"))*?"' token STR_SQ: "'([^']|(\\'))*?'" token OP_AND: "and" token OP_OR: "or" token END: "$" rule XPATH: PATH {{ result = PATH; current = result }} ( PATH {{ current.childLocation = PATH; current = current.childLocation }} ) * END {{ return result }} rule PATH: ("/" {{ result = _Location() }} | "//" {{ result = _AnyLocation() }} ) ( IDENTIFIER {{ result.elementName = IDENTIFIER }} | WILDCARD {{ result.elementName = None }} ) ( "\[" PREDICATE {{ result.predicates.append(PREDICATE) }} "\]")* {{ return result }} rule PREDICATE: EXPR {{ return EXPR }} | INDEX {{ return IndexValue(INDEX) }} rule EXPR: FACTOR {{ e = FACTOR }} ( BOOLOP FACTOR {{ e = BooleanValue(e, BOOLOP, FACTOR) }} )* {{ return e }} rule BOOLOP: ( OP_AND {{ return OP_AND }} | OP_OR {{ return OP_OR }} ) rule FACTOR: TERM {{ return TERM }} | "\(" EXPR "\)" {{ return EXPR }} rule TERM: VALUE {{ t = VALUE }} [ CMP VALUE {{ t = CompareValue(t, CMP, VALUE) }} ] {{ return t }} rule VALUE: "@" IDENTIFIER {{ return AttribValue(IDENTIFIER) }} | FUNCNAME {{ f = Function(FUNCNAME); args = [] }} "\(" [ VALUE {{ args.append(VALUE) }} ( "," VALUE {{ args.append(VALUE) }} )* ] "\)" {{ f.setParams(*args); return f }} | STR {{ return LiteralValue(STR[1:len(STR)-1]) }} rule CMP: (CMP_EQ {{ return CMP_EQ }} | CMP_NE {{ return CMP_NE }}) rule STR: (STR_DQ {{ return STR_DQ }} | STR_SQ {{ return STR_SQ }})
G-code
5
giadram/twisted
src/twisted/words/xish/xpathparser.g
[ "MIT", "Unlicense" ]
//===--- ASTSectionImporter.h - Import AST Section Modules ------*- C++ -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// // // This file implements support for loading modules serialized into a // Mach-O AST section into Swift. // //===----------------------------------------------------------------------===// #ifndef SWIFT_ASTSECTION_IMPORTER_H #define SWIFT_ASTSECTION_IMPORTER_H #include "swift/Basic/LLVM.h" #include <string> namespace swift { class MemoryBufferSerializedModuleLoader; /// Provided a memory buffer with an entire Mach-O __swift_ast section, this /// function makes memory buffer copies of all swift modules found in it and /// registers them using registerMemoryBuffer() so they can be found by /// loadModule(). The access path of all modules found in the section is /// appended to the vector foundModules. /// \return true if successful. bool parseASTSection(MemoryBufferSerializedModuleLoader &Loader, StringRef Data, SmallVectorImpl<std::string> &foundModules); } #endif
C
4
lwhsu/swift
include/swift/ASTSectionImporter/ASTSectionImporter.h
[ "Apache-2.0" ]
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <link rel="stylesheet" type="text/css" href="../css/guides.css"> <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700,700italic,600,600italic' rel='stylesheet' type='text/css'><link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.8.0/styles/solarized_light.min.css" /> <script type="text/javascript" src="//use.edgefonts.net/source-code-pro.js"></script> <link rel="canonical" href="https://docs.videojs.com/tutorial-text-tracks.html"> </head> <body> <p class="legacydocsnote">This documentation is for an outdated version of Video.js. See <a href="https://docs.videojs.com/tutorial-text-tracks.html">documentation for the current release</a>. <div id="sidenav" class="sidenav"></div> <div id="main" class="main"> <h1 id="text-tracks">Text Tracks</h1> <p>Text Tracks are a function of HTML5 video for providing time triggered text to the viewer. Video.js makes tracks work across all browsers. There are currently five types of tracks:</p> <ul> <li><strong>Subtitles</strong>: Translations of the dialogue in the video for when audio is available but not understood. Subtitles are shown over the video.</li> <li><strong>Captions</strong>: Transcription of the dialogue, sound effects, musical cues, and other audio information for when the viewer is deaf/hard of hearing, or the video is muted. Captions are also shown over the video.</li> <li><strong>Chapters</strong>: Chapter titles that are used to create navigation within the video. Typically they&#39;re in the form of a list of chapters that the viewer can click on to go to a specific chapter.</li> <li><strong>Descriptions</strong>: Text descriptions of what&#39;s happening in the video for when the video portion isn&#39;t available, because the viewer is blind, not using a screen, or driving and about to crash because they&#39;re trying to enjoy a video while driving. Descriptions are read by a screen reader or turned into a separate audio track.</li> <li><strong>Metadata</strong>: Tracks that have data meant for javascript to parse and do something with. These aren&#39;t shown to the user.</li> </ul> <h2 id="creating-the-text-file">Creating the Text File</h2> <p>Timed text requires a text file in <a href="http://dev.w3.org/html5/webvtt/">WebVTT</a> format. This format defines a list of &quot;cues&quot; that have a start time, and end time, and text to display. <a href="https://dev.modern.ie/testdrive/demos/captionmaker/">Microsoft has a builder</a> that can help you get started on the file.</p> <p>When creating captions, there&#39;s also additional [caption formatting techniques] (<a href="http://www.theneitherworld.com/mcpoodle/SCC_TOOLS/DOCS/SCC_FORMAT.HTML#style">http://www.theneitherworld.com/mcpoodle/SCC_TOOLS/DOCS/SCC_FORMAT.HTML#style</a>) that would be good to use, like brackets around sound effects: [ sound effect ]. If you&#39;d like a more in depth style guide for captioning, you can reference the <a href="http://www.dcmp.org/captioningkey/">Captioning Key</a>, but keep in mind not all features are supported by WebVTT or (more likely) the Video.js WebVTT implementation.</p> <h2 id="adding-to-video-js">Adding to Video.js</h2> <p>Once you have your WebVTT file created, you can add it to Video.js using the track tag. Put your track tag after all the source elements, and before any fallback content.</p> <pre><code class="lang-html">&lt;video id=&quot;example_video_1&quot; class=&quot;video-js&quot; controls preload=&quot;auto&quot; width=&quot;640&quot; height=&quot;264&quot; data-setup=&#39;{&quot;example_option&quot;:true}&#39;&gt; &lt;source src=&quot;http://vjs.zencdn.net/v/oceans.mp4&quot; type=&quot;video/mp4&quot; /&gt; &lt;source src=&quot;http://vjs.zencdn.net/v/oceans.webm&quot; type=&quot;video/webm&quot; /&gt; &lt;source src=&quot;http://vjs.zencdn.net/v/oceans.ogv&quot; type=&quot;video/ogg&quot; /&gt; &lt;track kind=&quot;captions&quot; src=&quot;http://example.com/path/to/captions.vtt&quot; srclang=&quot;en&quot; label=&quot;English&quot; default&gt; &lt;/video&gt; </code></pre> <p>You can also add tracks <a href="#api">programatically</a>.</p> <h2 id="subtitles-from-another-domain">Subtitles from Another Domain</h2> <p>Because we&#39;re pulling in the text track file via Javascript, the <a href="http://en.wikipedia.org/wiki/Same_origin_policy">same-origin policy</a> applies. If you&#39;d like to have a player served from one domain, but the text track served from another, you&#39;ll need to <a href="http://enable-cors.org/">enable CORS</a> in order to do so. In addition to enabling CORS on the server serving the text tracks, you will need to add the <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes"><code>crossorigin</code> attribute</a> to the video element itself. This attribute has two values <code>anonymous</code> and <code>use-credentials</code>. Most users will want to use <code>anonymous</code> with cross-origin tracks. It can be added to the video element like so:</p> <pre><code class="lang-html">&lt;video class=&quot;video-js&quot; crossorigin=&quot;anonymous&quot;&gt; &lt;source src=&quot;http://vjs.zencdn.net/v/oceans.mp4&quot; type=&quot;video/mp4&quot;&gt; &lt;track src=&quot;http://example.com/oceans.vtt&quot; kind=&quot;captions&quot; srclang=&quot;en&quot; label=&quot;English&quot;&gt; &lt;/video&gt; </code></pre> <p>One thing to be aware of is that in this case the video files themselves will <em>also</em> needs CORS headers applied to it. This is because some browsers apply the crossorigin attribute to the video source itself and not just the tracks and is considered a <a href="https://html.spec.whatwg.org/multipage/embedded-content.html#security-and-privacy-considerations">security concern by the spec</a>.</p> <h2 id="track-attributes">Track Attributes</h2> <p>Additional settings for track tags.</p> <h3 id="kind">kind</h3> <p>One of the five track types listed above. Kind defaults to subtitles if no kind is included.</p> <h3 id="label">label</h3> <p>The label for the track that will be show to the user, for example in a menu that list the different languages available for subtitles.</p> <h3 id="default">default</h3> <p>The default attribute can be used to have a track default to showing. Otherwise the viewer would need to select their language from the captions or subtitles menu. NOTE: For chapters, default is required if you want the chapters menu to show.</p> <h3 id="srclang">srclang</h3> <p>The two-letter code (valid BCP 47 language tag) for the language of the text track, for example &quot;en&quot; for English. A list of language codes is <a href="languages.md#language-codes">available here</a>.</p> <h2 id="interacting-with-text-tracks">Interacting with Text Tracks</h2> <h3 id="showing-tracks-programmatically">Showing tracks programmatically</h3> <p>Some of you would want to turn captions on and off programmatically rather than just forcing the user to do so themselves. This can be easily achieved by modifying the <code>mode</code> of the text tracks. The <code>mode</code> can be one of three values <code>disabled</code>, <code>hidden</code>, and <code>showing</code>. When a text track&#39;s <code>mode</code> is <code>disabled</code>, the track does not show on screen as the video is playing. When the <code>mode</code> is set to <code>showing</code>, the track is visible to the viewer and updates while the video is playing. You can change of a particular track like so:</p> <pre><code class="lang-js">let tracks = player.textTracks(); for (let i = 0; i &lt; tracks.length; i++) { let track = tracks[i]; // find the captions track that&#39;s in english if (track.kind === &#39;captions&#39; &amp;&amp; track.language === &#39;en&#39;) { track.mode = &#39;showing&#39;; } } </code></pre> <h3 id="doing-something-when-a-cue-becomes-active">Doing something when a cue becomes active</h3> <p>Above, we mentioned that <code>mode</code> can also be <code>hidden</code>, what this means is that the track will update as the video is playing but it won&#39;t be visible to the viewer. This is most useful for <code>metadata</code> text tracks. One usecase for metadata text tracks is to have something happen when their cues become active, to do so, you listen to the <code>cuechange</code> event on the track. These events fire when the mode is <code>showing</code> as well. Here&#39;s an example:</p> <pre><code class="lang-js">let tracks = player.textTracks(); let metadataTrack; for (let i = 0; i &lt; tracks.length; i++) { let track = tracks[i]; // find the metadata track that&#39;s labeled ads if (track.kind === &#39;captions&#39; &amp;&amp; track.label === &#39;ads&#39;) { track.mode = &#39;hidden&#39;; // store it for usage outside of the loop metadataTrack = track; } } metadataTrack.addEventListener(&#39;cuechange&#39;, function() { player.ads.startLinearAdMode(); }); </code></pre> <h2 id="emulated-text-tracks">Emulated Text Tracks</h2> <p>By default, video.js will try and use native text tracks if possible and fall back to emulated text tracks if the native functionality is broken or incomplete or non-existent. The Flash tech will always use the emulated text track functionality. The video.js API and TextTrack objects were modeled after the w3c&#39;s specification. video.js uses <a href="https://github.com/mozilla/vtt.js">Mozilla&#39;s vtt.js</a> library to parse and display its emulated text tracks.</p> <p>If you wanted to disable native text track functionality and force video.js to use emulated text tracks always, you can supply the <code>nativeTextTracks</code> option to the tech like so:</p> <pre><code class="lang-js">let player = videojs(&#39;myvideo&#39;, { html5: { nativeTextTracks: false } }); </code></pre> <h3 id="text-track-settings">Text Track Settings</h3> <p>When using emulated Text Tracks, captions will have an additional item in the menu called &quot;caption settings&quot;. This allows the viewer of the player to change some styles of how the captions are displayed on screen.</p> <p>If you don&#39;t want that, you can disable it by turning off the text track settings component and hiding the menu item like so:</p> <pre><code class="lang-js">let player = videojs(&#39;myvideo&#39;, { // make the text track settings dialog not initialize textTrackSettings: false }); </code></pre> <pre><code class="lang-css">/* hide the captions settings item from the captions menu */ .vjs-texttrack-settings { display: none; } </code></pre> <h2 id="text-track-precedence">Text Track Precedence</h2> <p>In general, the Descriptions tracks is of lower precedence than captions and subtitles. What this means for you?</p> <ul> <li>If you are using the <code>default</code> attribute, videojs will choose the first track that is marked as <code>default</code> and turn it on. If There are multiple tracks marked <code>default</code>, it will try and turn on the first <code>captions</code> or <code>subtitles</code> track <em>before</em> any <code>descriptions</code> tracks.<ul> <li>This only applied to the emulated captions support, native text tracks behavior will change depending on the browser</li> </ul> </li> <li>If you select a given track from the menu, videojs will turn off all the other tracks of the same kind. This may seem like you can have both subtitles and captions turned on at the same time but unfortuantely, at this time we only support one track being displayed at a time.<ul> <li>This means that for emulated text tracks, we&#39;ll choose the first captions or subtitles track that is enabled to display.</li> <li>When native text tracks are supported, we will still disable the other tracks of the same kind but it is possible that multiple text tracks are shown.</li> <li>If a <code>descriptions</code> track is selected and subsequently a <code>subtitles</code> or <code>captions</code> track is selected, the <code>descriptions</code> track is disabled and its menu button is also disabled.</li> </ul> </li> <li>When enabling a track programmatically, there&#39;s not much checking that videojs does.<ul> <li>For emulated text tracks, when it&#39;s time to display the captions, video.js would choose the first track that&#39;s showing, again choosing <code>subtitles</code> or <code>captions</code> over <code>descriptions</code>, if necessary.</li> <li>For native text tracks, this behavior depends on the browser. Some browsers will let you have multiple text tracks but others will disable all other tracks when a new one is selected.</li> </ul> </li> </ul> <h2 id="api">API</h2> <h3 id="-player-texttracks-texttracklist-"><code>player.textTracks() -&gt; TextTrackList</code></h3> <p>This is the main interface into the text tracks of the player. It return a TextTrackList which lists all the tracks on the player.</p> <h3 id="-player-remotetexttracks-texttracklist-"><code>player.remoteTextTracks() -&gt; TextTrackList</code></h3> <p>This is a helper method to get a list of all the tracks that were created from <code>track</code> elements or that were added to the player by the <code>addRemoteTextTrack</code> method. All these tracks are removeable from the player, where-as not all tracks from <code>player.textTracks()</code> are necessarily removeable.</p> <h3 id="-player-remotetexttrackels-htmltrackelementlist-"><code>player.remoteTextTrackEls() -&gt; HTMLTrackElementList</code></h3> <p>Another helper method, this is a list of all the <code>track</code> elements associated with the player. Both emulated or otherwise.</p> <h3 id="-player-addtexttrack-string-kind-string-label-string-language-texttrack-"><code>player.addTextTrack(String kind, [String label [, String language]]) -&gt; TextTrack</code></h3> <p>This is based on the <a href="http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#dom-media-addtexttrack">w3c spec API</a> and when given a kind and an optional label and language, will create a new text track for you to use. This method is intended for purely programmatic usage of tracks and has one important limitation: tracks created using this method <em>cannot</em> be removed. The native <code>addTextTrack</code> does not have a corresponding <code>removeTextTrack</code>, so, we actually discourage the usage of this method.</p> <h3 id="-player-addremotetexttrack-object-options-htmltrackelement-"><code>player.addRemoteTextTrack(Object options) -&gt; HTMLTrackElement</code></h3> <p>This function takes an options object that looks pretty similar to the track element and returns a HTMLTrackElement. This object has a <code>track</code> property on it which is the actual TextTrack object. This <code>TextTrack</code> object is equivalent to the one that can be returned from <code>player.addTextTrack</code> with the added bonus that it can be removed from the player. Internally, video.js will either add a <code>&lt;track&gt;</code> element for you, or emulate that depending on whether native text tracks are supported or not. The options available are:</p> <ul> <li><code>kind</code></li> <li><code>label</code></li> <li><code>language</code> (also <code>srclang</code>)</li> <li><code>id</code></li> <li><code>src</code></li> </ul> <h3 id="-player-removeremotetexttrack-htmltrackelement-texttrack-"><code>player.removeRemoteTextTrack(HTMLTrackElement|TextTrack)</code></h3> <p>This function takes either an HTMLTrackElement or a TextTrack object and removes it from the player.</p> <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.8.0/highlight.min.js"></script> <script src="../js/guides.js"></script> <script>hljs.initHighlightingOnLoad();</script> </body> </html>
HTML
4
TradeCast/video.js
docs/legacy-docs/guides/text-tracks.html
[ "Apache-2.0" ]
**************************************************************************************** ** ** ** Response file to perform silent install of Oracle Database 10g Express Edition ** ** ** ** Values for the following variables are configurable: ** ** szDir - Provide a valid path ** ** TNSPort - Provide any valid available port number ** ** MTSPort - Provide any valid available port number ** ** HTTPPort - Provide any valid available port number ** ** SYSPassword - Provide a valid password string ** ** bOpt1 - 1 or 0 : 1 launches the Database Homepage at end of install and 0 doesn't ** ** ** **************************************************************************************** [{F0BC0F9E-C4A8-485C-93ED-424DB9EA3F75}-DlgOrder] Dlg0={F0BC0F9E-C4A8-485C-93ED-424DB9EA3F75}-SdWelcome-0 Count=9 Dlg1={F0BC0F9E-C4A8-485C-93ED-424DB9EA3F75}-SdLicense2Rtf-0 Dlg2={F0BC0F9E-C4A8-485C-93ED-424DB9EA3F75}-SdComponentDialog-0 Dlg3={F0BC0F9E-C4A8-485C-93ED-424DB9EA3F75}-AskTNSPort-13013 Dlg4={F0BC0F9E-C4A8-485C-93ED-424DB9EA3F75}-AskMTSPort-13012 Dlg5={F0BC0F9E-C4A8-485C-93ED-424DB9EA3F75}-AskHTTPPort-13014 Dlg3={F0BC0F9E-C4A8-485C-93ED-424DB9EA3F75}-AskSYSPassword-13011 Dlg4={F0BC0F9E-C4A8-485C-93ED-424DB9EA3F75}-SdStartCopy-0 Dlg5={F0BC0F9E-C4A8-485C-93ED-424DB9EA3F75}-SdFinish-0 [{F0BC0F9E-C4A8-485C-93ED-424DB9EA3F75}-SdWelcome-0] Result=1 [{F0BC0F9E-C4A8-485C-93ED-424DB9EA3F75}-SdLicense2Rtf-0] Result=1 [{F0BC0F9E-C4A8-485C-93ED-424DB9EA3F75}-SdComponentDialog-0] szDir=C:\Oracle\OracleXE\ Component-type=string Component-count=1 Component-0=DefaultFeature Result=1 [{F0BC0F9E-C4A8-485C-93ED-424DB9EA3F75}-AskTNSPort-13013] TNSPort=1521 Result=1 [{F0BC0F9E-C4A8-485C-93ED-424DB9EA3F75}-AskMTSPort-13012] MTSPort=2030 Result=1 [{F0BC0F9E-C4A8-485C-93ED-424DB9EA3F75}-AskHTTPPort-13014] HTTPPort=8083 Result=1 [{F0BC0F9E-C4A8-485C-93ED-424DB9EA3F75}-AskSYSPassword-13011] SYSPassword=oracle Result=1 [{F0BC0F9E-C4A8-485C-93ED-424DB9EA3F75}-SdStartCopy-0] Result=1 [{F0BC0F9E-C4A8-485C-93ED-424DB9EA3F75}-SdFinish-0] Result=1 bOpt1=1 bOpt2=0
Inno Setup
2
maketubo/liquibase
liquibase-integration-tests/setup/oracle/OracleXE-install.iss
[ "Apache-2.0" ]
package { import GzOpenGL.OpenGL; import GzOpenGL.OpGpuInfo; import GZ.Gpu.ShaderBase.Evbo; import GZ.Gpu.ShaderBase.ProgramShader; public class OpEvbo overplace Evbo { public function OpEvbo(_oProgram : ProgramShader):Void { } override public function fLoad():Void { nId = OpenGL.fCreateBuffer(); OpenGL.fBindBuffer(ELEMENT_ARRAY_BUFFER, nId); /*if(nId == -1){ Debug.fError("Invalid Buffer "); }*/ } override public function fBind():Void { OpenGL.fBindBuffer(ELEMENT_ARRAY_BUFFER, nId); } /* override public function fGpuDataType():Int{ if(hDataType == eDataType.Float){ } return -1; } */ override public function fSendData():Void { if( aData.nSize != 0){ OpenGL.fBindBuffer(ELEMENT_ARRAY_BUFFER, nId); OpenGL.fBufferData(ELEMENT_ARRAY_BUFFER, aData.nSize, Int8, aData, STATIC_DRAW); } } } }
Redcode
3
VLiance/GZE
src/SubLib_GPU/OpenGL/Lib_GzOpenGL/ShaderBase/OpEvbo.cw
[ "Apache-2.0" ]
new class CircleSort { new classmethod converge(array, a, b) { new bool s = False; for ; a <= b; a++, b-- { if array[a] > array[b] { array[a].swap(array[b]); s = True; } } return s; } new classmethod sorter(array, a, b) { if b - a == 1 { if array[a] > array[b] { array[a].swap(array[b]); return True; } return False; } elif b - a < 1 { return False; } new bool l, r, s; s = this.converge(array, a, b); new int m = a + ((b - a) // 2); l = this.sorter(array, a, m); r = this.sorter(array, m, b); return s or l or r; } new classmethod sort(array, a, b) { while this.sorter(array, a, b - 1) {} } } @Sort( "Exchange Sorts", "Circle Sort", "Circle Sort" ); new function circleSortRun(array) { CircleSort.sort(array, 0, len(array)); }
Opal
3
thatsOven/sorting-visualizer
sorts/CircleSort.opal
[ "MIT" ]
#!/usr/bin/env bash # Font Awesome (version 4.7.0, 675 icons, 111 aliases) # Codepoints: F000-F2E0 with holes test -n "$__i_fa_loaded" && return || __i_fa_loaded=1 i='' i_fa_glass=$i i='' i_fa_music=$i i='' i_fa_search=$i i='' i_fa_envelope_o=$i i='' i_fa_heart=$i i='' i_fa_star=$i i='' i_fa_star_o=$i i='' i_fa_user=$i i='' i_fa_film=$i i='' i_fa_th_large=$i i='' i_fa_th=$i i='' i_fa_th_list=$i i='' i_fa_check=$i i='' i_fa_times=$i i_fa_close=$i_fa_times i_fa_remove=$i_fa_times i='' i_fa_search_plus=$i i='' i_fa_search_minus=$i i='' i_fa_power_off=$i i='' i_fa_signal=$i i='' i_fa_cog=$i i_fa_gear=$i_fa_cog i='' i_fa_trash_o=$i i='' i_fa_home=$i i='' i_fa_file_o=$i i='' i_fa_clock_o=$i i='' i_fa_road=$i i='' i_fa_download=$i i='' i_fa_arrow_circle_o_down=$i i='' i_fa_arrow_circle_o_up=$i i='' i_fa_inbox=$i i='' i_fa_play_circle_o=$i i='' i_fa_repeat=$i i_fa_rotate_right=$i_fa_repeat i='' i_fa_refresh=$i i='' i_fa_list_alt=$i i='' i_fa_lock=$i i='' i_fa_flag=$i i='' i_fa_headphones=$i i='' i_fa_volume_off=$i i='' i_fa_volume_down=$i i='' i_fa_volume_up=$i i='' i_fa_qrcode=$i i='' i_fa_barcode=$i i='' i_fa_tag=$i i='' i_fa_tags=$i i='' i_fa_book=$i i='' i_fa_bookmark=$i i='' i_fa_print=$i i='' i_fa_camera=$i i='' i_fa_font=$i i='' i_fa_bold=$i i='' i_fa_italic=$i i='' i_fa_text_height=$i i='' i_fa_text_width=$i i='' i_fa_align_left=$i i='' i_fa_align_center=$i i='' i_fa_align_right=$i i='' i_fa_align_justify=$i i='' i_fa_list=$i i='' i_fa_outdent=$i i_fa_dedent=$i_fa_outdent i='' i_fa_indent=$i i='' i_fa_video_camera=$i i='' i_fa_picture_o=$i i_fa_image=$i_fa_picture_o i_fa_photo=$i_fa_picture_o i='' i_fa_pencil=$i i='' i_fa_map_marker=$i i='' i_fa_adjust=$i i='' i_fa_tint=$i i='' i_fa_pencil_square_o=$i i_fa_edit=$i_fa_pencil_square_o i='' i_fa_share_square_o=$i i='' i_fa_check_square_o=$i i='' i_fa_arrows=$i i='' i_fa_step_backward=$i i='' i_fa_fast_backward=$i i='' i_fa_backward=$i i='' i_fa_play=$i i='' i_fa_pause=$i i='' i_fa_stop=$i i='' i_fa_forward=$i i='' i_fa_fast_forward=$i i='' i_fa_step_forward=$i i='' i_fa_eject=$i i='' i_fa_chevron_left=$i i='' i_fa_chevron_right=$i i='' i_fa_plus_circle=$i i='' i_fa_minus_circle=$i i='' i_fa_times_circle=$i i='' i_fa_check_circle=$i i='' i_fa_question_circle=$i i='' i_fa_info_circle=$i i='' i_fa_crosshairs=$i i='' i_fa_times_circle_o=$i i='' i_fa_check_circle_o=$i i='' i_fa_ban=$i i='' i_fa_arrow_left=$i i='' i_fa_arrow_right=$i i='' i_fa_arrow_up=$i i='' i_fa_arrow_down=$i i='' i_fa_share=$i i_fa_mail_forward=$i_fa_share i='' i_fa_expand=$i i='' i_fa_compress=$i i='' i_fa_plus=$i i='' i_fa_minus=$i i='' i_fa_asterisk=$i i='' i_fa_exclamation_circle=$i i='' i_fa_gift=$i i='' i_fa_leaf=$i i='' i_fa_fire=$i i='' i_fa_eye=$i i='' i_fa_eye_slash=$i i='' i_fa_exclamation_triangle=$i i_fa_warning=$i_fa_exclamation_triangle i='' i_fa_plane=$i i='' i_fa_calendar=$i i='' i_fa_random=$i i='' i_fa_comment=$i i='' i_fa_magnet=$i i='' i_fa_chevron_up=$i i='' i_fa_chevron_down=$i i='' i_fa_retweet=$i i='' i_fa_shopping_cart=$i i='' i_fa_folder=$i i='' i_fa_folder_open=$i i='' i_fa_arrows_v=$i i='' i_fa_arrows_h=$i i='' i_fa_bar_chart=$i i_fa_bar_chart_o=$i_fa_bar_chart i='' i_fa_twitter_square=$i i='' i_fa_facebook_square=$i i='' i_fa_camera_retro=$i i='' i_fa_key=$i i='' i_fa_cogs=$i i_fa_gears=$i_fa_cogs i='' i_fa_comments=$i i='' i_fa_thumbs_o_up=$i i='' i_fa_thumbs_o_down=$i i='' i_fa_star_half=$i i='' i_fa_heart_o=$i i='' i_fa_sign_out=$i i='' i_fa_linkedin_square=$i i='' i_fa_thumb_tack=$i i='' i_fa_external_link=$i i='' i_fa_sign_in=$i i='' i_fa_trophy=$i i='' i_fa_github_square=$i i='' i_fa_upload=$i i='' i_fa_lemon_o=$i i='' i_fa_phone=$i i='' i_fa_square_o=$i i='' i_fa_bookmark_o=$i i='' i_fa_phone_square=$i i='' i_fa_twitter=$i i='' i_fa_facebook=$i i_fa_facebook_f=$i_fa_facebook i='' i_fa_github=$i i='' i_fa_unlock=$i i='' i_fa_credit_card=$i i='' i_fa_rss=$i i_fa_feed=$i_fa_rss i='' i_fa_hdd_o=$i i='' i_fa_bullhorn=$i i='' i_fa_bell_o=$i i='' i_fa_certificate=$i i='' i_fa_hand_o_right=$i i='' i_fa_hand_o_left=$i i='' i_fa_hand_o_up=$i i='' i_fa_hand_o_down=$i i='' i_fa_arrow_circle_left=$i i='' i_fa_arrow_circle_right=$i i='' i_fa_arrow_circle_up=$i i='' i_fa_arrow_circle_down=$i i='' i_fa_globe=$i i='' i_fa_wrench=$i i='' i_fa_tasks=$i i='' i_fa_filter=$i i='' i_fa_briefcase=$i i='' i_fa_arrows_alt=$i i='' i_fa_users=$i i_fa_group=$i_fa_users i='' i_fa_link=$i i_fa_chain=$i_fa_link i='' i_fa_cloud=$i i='' i_fa_flask=$i i='' i_fa_scissors=$i i_fa_cut=$i_fa_scissors i='' i_fa_files_o=$i i_fa_copy=$i_fa_files_o i='' i_fa_paperclip=$i i='' i_fa_floppy_o=$i i_fa_save=$i_fa_floppy_o i='' i_fa_square=$i i='' i_fa_bars=$i i_fa_navicon=$i_fa_bars i_fa_reorder=$i_fa_bars i='' i_fa_list_ul=$i i='' i_fa_list_ol=$i i='' i_fa_strikethrough=$i i='' i_fa_underline=$i i='' i_fa_table=$i i='' i_fa_magic=$i i='' i_fa_truck=$i i='' i_fa_pinterest=$i i='' i_fa_pinterest_square=$i i='' i_fa_google_plus_square=$i i='' i_fa_google_plus=$i i='' i_fa_money=$i i='' i_fa_caret_down=$i i='' i_fa_caret_up=$i i='' i_fa_caret_left=$i i='' i_fa_caret_right=$i i='' i_fa_columns=$i i='' i_fa_sort=$i i_fa_unsorted=$i_fa_sort i='' i_fa_sort_desc=$i i_fa_sort_down=$i_fa_sort_desc i='' i_fa_sort_asc=$i i_fa_sort_up=$i_fa_sort_asc i='' i_fa_envelope=$i i='' i_fa_linkedin=$i i='' i_fa_undo=$i i_fa_rotate_left=$i_fa_undo i='' i_fa_gavel=$i i_fa_legal=$i_fa_gavel i='' i_fa_tachometer=$i i_fa_dashboard=$i_fa_tachometer i='' i_fa_comment_o=$i i='' i_fa_comments_o=$i i='' i_fa_bolt=$i i_fa_flash=$i_fa_bolt i='' i_fa_sitemap=$i i='' i_fa_umbrella=$i i='' i_fa_clipboard=$i i_fa_paste=$i_fa_clipboard i='' i_fa_lightbulb_o=$i i='' i_fa_exchange=$i i='' i_fa_cloud_download=$i i='' i_fa_cloud_upload=$i i='' i_fa_user_md=$i i='' i_fa_stethoscope=$i i='' i_fa_suitcase=$i i='' i_fa_bell=$i i='' i_fa_coffee=$i i='' i_fa_cutlery=$i i='' i_fa_file_text_o=$i i='' i_fa_building_o=$i i='' i_fa_hospital_o=$i i='' i_fa_ambulance=$i i='' i_fa_medkit=$i i='' i_fa_fighter_jet=$i i='' i_fa_beer=$i i='' i_fa_h_square=$i i='' i_fa_plus_square=$i i='' i_fa_angle_double_left=$i i='' i_fa_angle_double_right=$i i='' i_fa_angle_double_up=$i i='' i_fa_angle_double_down=$i i='' i_fa_angle_left=$i i='' i_fa_angle_right=$i i='' i_fa_angle_up=$i i='' i_fa_angle_down=$i i='' i_fa_desktop=$i i='' i_fa_laptop=$i i='' i_fa_tablet=$i i='' i_fa_mobile=$i i_fa_mobile_phone=$i_fa_mobile i='' i_fa_circle_o=$i i='' i_fa_quote_left=$i i='' i_fa_quote_right=$i i='' i_fa_spinner=$i i='' i_fa_circle=$i i='' i_fa_reply=$i i_fa_mail_reply=$i_fa_reply i='' i_fa_github_alt=$i i='' i_fa_folder_o=$i i='' i_fa_folder_open_o=$i i='' i_fa_smile_o=$i i='' i_fa_frown_o=$i i='' i_fa_meh_o=$i i='' i_fa_gamepad=$i i='' i_fa_keyboard_o=$i i='' i_fa_flag_o=$i i='' i_fa_flag_checkered=$i i='' i_fa_terminal=$i i='' i_fa_code=$i i='' i_fa_reply_all=$i i_fa_mail_reply_all=$i_fa_reply_all i='' i_fa_star_half_o=$i i_fa_star_half_empty=$i_fa_star_half_o i_fa_star_half_full=$i_fa_star_half_o i='' i_fa_location_arrow=$i i='' i_fa_crop=$i i='' i_fa_code_fork=$i i='' i_fa_chain_broken=$i i_fa_unlink=$i_fa_chain_broken i='' i_fa_question=$i i='' i_fa_info=$i i='' i_fa_exclamation=$i i='' i_fa_superscript=$i i='' i_fa_subscript=$i i='' i_fa_eraser=$i i='' i_fa_puzzle_piece=$i i='' i_fa_microphone=$i i='' i_fa_microphone_slash=$i i='' i_fa_shield=$i i='' i_fa_calendar_o=$i i='' i_fa_fire_extinguisher=$i i='' i_fa_rocket=$i i='' i_fa_maxcdn=$i i='' i_fa_chevron_circle_left=$i i='' i_fa_chevron_circle_right=$i i='' i_fa_chevron_circle_up=$i i='' i_fa_chevron_circle_down=$i i='' i_fa_html5=$i i='' i_fa_css3=$i i='' i_fa_anchor=$i i='' i_fa_unlock_alt=$i i='' i_fa_bullseye=$i i='' i_fa_ellipsis_h=$i i='' i_fa_ellipsis_v=$i i='' i_fa_rss_square=$i i='' i_fa_play_circle=$i i='' i_fa_ticket=$i i='' i_fa_minus_square=$i i='' i_fa_minus_square_o=$i i='' i_fa_level_up=$i i='' i_fa_level_down=$i i='' i_fa_check_square=$i i='' i_fa_pencil_square=$i i='' i_fa_external_link_square=$i i='' i_fa_share_square=$i i='' i_fa_compass=$i i='' i_fa_caret_square_o_down=$i i_fa_toggle_down=$i_fa_caret_square_o_down i='' i_fa_caret_square_o_up=$i i_fa_toggle_up=$i_fa_caret_square_o_up i='' i_fa_caret_square_o_right=$i i_fa_toggle_right=$i_fa_caret_square_o_right i='' i_fa_eur=$i i_fa_euro=$i_fa_eur i='' i_fa_gbp=$i i='' i_fa_usd=$i i_fa_dollar=$i_fa_usd i='' i_fa_inr=$i i_fa_rupee=$i_fa_inr i='' i_fa_jpy=$i i_fa_cny=$i_fa_jpy i_fa_rmb=$i_fa_jpy i_fa_yen=$i_fa_jpy i='' i_fa_rub=$i i_fa_rouble=$i_fa_rub i_fa_ruble=$i_fa_rub i='' i_fa_krw=$i i_fa_won=$i_fa_krw i='' i_fa_btc=$i i_fa_bitcoin=$i_fa_btc i='' i_fa_file=$i i='' i_fa_file_text=$i i='' i_fa_sort_alpha_asc=$i i='' i_fa_sort_alpha_desc=$i i='' i_fa_sort_amount_asc=$i i='' i_fa_sort_amount_desc=$i i='' i_fa_sort_numeric_asc=$i i='' i_fa_sort_numeric_desc=$i i='' i_fa_thumbs_up=$i i='' i_fa_thumbs_down=$i i='' i_fa_youtube_square=$i i='' i_fa_youtube=$i i='' i_fa_xing=$i i='' i_fa_xing_square=$i i='' i_fa_youtube_play=$i i='' i_fa_dropbox=$i i='' i_fa_stack_overflow=$i i='' i_fa_instagram=$i i='' i_fa_flickr=$i i='' i_fa_adn=$i i='' i_fa_bitbucket=$i i='' i_fa_bitbucket_square=$i i='' i_fa_tumblr=$i i='' i_fa_tumblr_square=$i i='' i_fa_long_arrow_down=$i i='' i_fa_long_arrow_up=$i i='' i_fa_long_arrow_left=$i i='' i_fa_long_arrow_right=$i i='' i_fa_apple=$i i='' i_fa_windows=$i i='' i_fa_android=$i i='' i_fa_linux=$i i='' i_fa_dribbble=$i i='' i_fa_skype=$i i='' i_fa_foursquare=$i i='' i_fa_trello=$i i='' i_fa_female=$i i='' i_fa_male=$i i='' i_fa_gratipay=$i i_fa_gittip=$i_fa_gratipay i='' i_fa_sun_o=$i i='' i_fa_moon_o=$i i='' i_fa_archive=$i i='' i_fa_bug=$i i='' i_fa_vk=$i i='' i_fa_weibo=$i i='' i_fa_renren=$i i='' i_fa_pagelines=$i i='' i_fa_stack_exchange=$i i='' i_fa_arrow_circle_o_right=$i i='' i_fa_arrow_circle_o_left=$i i='' i_fa_caret_square_o_left=$i i_fa_toggle_left=$i_fa_caret_square_o_left i='' i_fa_dot_circle_o=$i i='' i_fa_wheelchair=$i i='' i_fa_vimeo_square=$i i='' i_fa_try=$i i_fa_turkish_lira=$i_fa_try i='' i_fa_plus_square_o=$i i='' i_fa_space_shuttle=$i i='' i_fa_slack=$i i='' i_fa_envelope_square=$i i='' i_fa_wordpress=$i i='' i_fa_openid=$i i='' i_fa_university=$i i_fa_bank=$i_fa_university i_fa_institution=$i_fa_university i='' i_fa_graduation_cap=$i i_fa_mortar_board=$i_fa_graduation_cap i='' i_fa_yahoo=$i i='' i_fa_google=$i i='' i_fa_reddit=$i i='' i_fa_reddit_square=$i i='' i_fa_stumbleupon_circle=$i i='' i_fa_stumbleupon=$i i='' i_fa_delicious=$i i='' i_fa_digg=$i i='' i_fa_pied_piper_pp=$i i='' i_fa_pied_piper_alt=$i i='' i_fa_drupal=$i i='' i_fa_joomla=$i i='' i_fa_language=$i i='' i_fa_fax=$i i='' i_fa_building=$i i='' i_fa_child=$i i='' i_fa_paw=$i i='' i_fa_spoon=$i i='' i_fa_cube=$i i='' i_fa_cubes=$i i='' i_fa_behance=$i i='' i_fa_behance_square=$i i='' i_fa_steam=$i i='' i_fa_steam_square=$i i='' i_fa_recycle=$i i='' i_fa_car=$i i_fa_automobile=$i_fa_car i='' i_fa_taxi=$i i_fa_cab=$i_fa_taxi i='' i_fa_tree=$i i='' i_fa_spotify=$i i='' i_fa_deviantart=$i i='' i_fa_soundcloud=$i i='' i_fa_database=$i i='' i_fa_file_pdf_o=$i i='' i_fa_file_word_o=$i i='' i_fa_file_excel_o=$i i='' i_fa_file_powerpoint_o=$i i='' i_fa_file_image_o=$i i_fa_file_photo_o=$i_fa_file_image_o i_fa_file_picture_o=$i_fa_file_image_o i='' i_fa_file_archive_o=$i i_fa_file_zip_o=$i_fa_file_archive_o i='' i_fa_file_audio_o=$i i_fa_file_sound_o=$i_fa_file_audio_o i='' i_fa_file_video_o=$i i_fa_file_movie_o=$i_fa_file_video_o i='' i_fa_file_code_o=$i i='' i_fa_vine=$i i='' i_fa_codepen=$i i='' i_fa_jsfiddle=$i i='' i_fa_life_ring=$i i_fa_life_bouy=$i_fa_life_ring i_fa_life_buoy=$i_fa_life_ring i_fa_life_saver=$i_fa_life_ring i_fa_support=$i_fa_life_ring i='' i_fa_circle_o_notch=$i i='' i_fa_rebel=$i i_fa_ra=$i_fa_rebel i_fa_resistance=$i_fa_rebel i='' i_fa_empire=$i i_fa_ge=$i_fa_empire i='' i_fa_git_square=$i i='' i_fa_git=$i i='' i_fa_hacker_news=$i i_fa_y_combinator_square=$i_fa_hacker_news i_fa_yc_square=$i_fa_hacker_news i='' i_fa_tencent_weibo=$i i='' i_fa_qq=$i i='' i_fa_weixin=$i i_fa_wechat=$i_fa_weixin i='' i_fa_paper_plane=$i i_fa_send=$i_fa_paper_plane i='' i_fa_paper_plane_o=$i i_fa_send_o=$i_fa_paper_plane_o i='' i_fa_history=$i i='' i_fa_circle_thin=$i i='' i_fa_header=$i i='' i_fa_paragraph=$i i='' i_fa_sliders=$i i='' i_fa_share_alt=$i i='' i_fa_share_alt_square=$i i='' i_fa_bomb=$i i='' i_fa_futbol_o=$i i_fa_soccer_ball_o=$i_fa_futbol_o i='' i_fa_tty=$i i='' i_fa_binoculars=$i i='' i_fa_plug=$i i='' i_fa_slideshare=$i i='' i_fa_twitch=$i i='' i_fa_yelp=$i i='' i_fa_newspaper_o=$i i='' i_fa_wifi=$i i='' i_fa_calculator=$i i='' i_fa_paypal=$i i='' i_fa_google_wallet=$i i='' i_fa_cc_visa=$i i='' i_fa_cc_mastercard=$i i='' i_fa_cc_discover=$i i='' i_fa_cc_amex=$i i='' i_fa_cc_paypal=$i i='' i_fa_cc_stripe=$i i='' i_fa_bell_slash=$i i='' i_fa_bell_slash_o=$i i='' i_fa_trash=$i i='' i_fa_copyright=$i i='' i_fa_at=$i i='' i_fa_eyedropper=$i i='' i_fa_paint_brush=$i i='' i_fa_birthday_cake=$i i='' i_fa_area_chart=$i i='' i_fa_pie_chart=$i i='' i_fa_line_chart=$i i='' i_fa_lastfm=$i i='' i_fa_lastfm_square=$i i='' i_fa_toggle_off=$i i='' i_fa_toggle_on=$i i='' i_fa_bicycle=$i i='' i_fa_bus=$i i='' i_fa_ioxhost=$i i='' i_fa_angellist=$i i='' i_fa_cc=$i i='' i_fa_ils=$i i_fa_shekel=$i_fa_ils i_fa_sheqel=$i_fa_ils i='' i_fa_meanpath=$i i='' i_fa_buysellads=$i i='' i_fa_connectdevelop=$i i='' i_fa_dashcube=$i i='' i_fa_forumbee=$i i='' i_fa_leanpub=$i i='' i_fa_sellsy=$i i='' i_fa_shirtsinbulk=$i i='' i_fa_simplybuilt=$i i='' i_fa_skyatlas=$i i='' i_fa_cart_plus=$i i='' i_fa_cart_arrow_down=$i i='' i_fa_diamond=$i i='' i_fa_ship=$i i='' i_fa_user_secret=$i i='' i_fa_motorcycle=$i i='' i_fa_street_view=$i i='' i_fa_heartbeat=$i i='' i_fa_venus=$i i='' i_fa_mars=$i i='' i_fa_mercury=$i i='' i_fa_transgender=$i i_fa_intersex=$i_fa_transgender i='' i_fa_transgender_alt=$i i='' i_fa_venus_double=$i i='' i_fa_mars_double=$i i='' i_fa_venus_mars=$i i='' i_fa_mars_stroke=$i i='' i_fa_mars_stroke_v=$i i='' i_fa_mars_stroke_h=$i i='' i_fa_neuter=$i i='' i_fa_genderless=$i i='' i_fa_facebook_official=$i i='' i_fa_pinterest_p=$i i='' i_fa_whatsapp=$i i='' i_fa_server=$i i='' i_fa_user_plus=$i i='' i_fa_user_times=$i i='' i_fa_bed=$i i_fa_hotel=$i_fa_bed i='' i_fa_viacoin=$i i='' i_fa_train=$i i='' i_fa_subway=$i i='' i_fa_medium=$i i='' i_fa_y_combinator=$i i_fa_yc=$i_fa_y_combinator i='' i_fa_optin_monster=$i i='' i_fa_opencart=$i i='' i_fa_expeditedssl=$i i='' i_fa_battery_full=$i i_fa_battery=$i_fa_battery_full i_fa_battery_4=$i_fa_battery_full i='' i_fa_battery_three_quarters=$i i_fa_battery_3=$i_fa_battery_three_quarters i='' i_fa_battery_half=$i i_fa_battery_2=$i_fa_battery_half i='' i_fa_battery_quarter=$i i_fa_battery_1=$i_fa_battery_quarter i='' i_fa_battery_empty=$i i_fa_battery_0=$i_fa_battery_empty i='' i_fa_mouse_pointer=$i i='' i_fa_i_cursor=$i i='' i_fa_object_group=$i i='' i_fa_object_ungroup=$i i='' i_fa_sticky_note=$i i='' i_fa_sticky_note_o=$i i='' i_fa_cc_jcb=$i i='' i_fa_cc_diners_club=$i i='' i_fa_clone=$i i='' i_fa_balance_scale=$i i='' i_fa_hourglass_o=$i i='' i_fa_hourglass_start=$i i_fa_hourglass_1=$i_fa_hourglass_start i='' i_fa_hourglass_half=$i i_fa_hourglass_2=$i_fa_hourglass_half i='' i_fa_hourglass_end=$i i_fa_hourglass_3=$i_fa_hourglass_end i='' i_fa_hourglass=$i i='' i_fa_hand_rock_o=$i i_fa_hand_grab_o=$i_fa_hand_rock_o i='' i_fa_hand_paper_o=$i i_fa_hand_stop_o=$i_fa_hand_paper_o i='' i_fa_hand_scissors_o=$i i='' i_fa_hand_lizard_o=$i i='' i_fa_hand_spock_o=$i i='' i_fa_hand_pointer_o=$i i='' i_fa_hand_peace_o=$i i='' i_fa_trademark=$i i='' i_fa_registered=$i i='' i_fa_creative_commons=$i i='' i_fa_gg=$i i='' i_fa_gg_circle=$i i='' i_fa_tripadvisor=$i i='' i_fa_odnoklassniki=$i i='' i_fa_odnoklassniki_square=$i i='' i_fa_get_pocket=$i i='' i_fa_wikipedia_w=$i i='' i_fa_safari=$i i='' i_fa_chrome=$i i='' i_fa_firefox=$i i='' i_fa_opera=$i i='' i_fa_internet_explorer=$i i='' i_fa_television=$i i_fa_tv=$i_fa_television i='' i_fa_contao=$i i='' i_fa_500px=$i i='' i_fa_amazon=$i i='' i_fa_calendar_plus_o=$i i='' i_fa_calendar_minus_o=$i i='' i_fa_calendar_times_o=$i i='' i_fa_calendar_check_o=$i i='' i_fa_industry=$i i='' i_fa_map_pin=$i i='' i_fa_map_signs=$i i='' i_fa_map_o=$i i='' i_fa_map=$i i='' i_fa_commenting=$i i='' i_fa_commenting_o=$i i='' i_fa_houzz=$i i='' i_fa_vimeo=$i i='' i_fa_black_tie=$i i='' i_fa_fonticons=$i i='' i_fa_reddit_alien=$i i='' i_fa_edge=$i i='' i_fa_credit_card_alt=$i i='' i_fa_codiepie=$i i='' i_fa_modx=$i i='' i_fa_fort_awesome=$i i='' i_fa_usb=$i i='' i_fa_product_hunt=$i i='' i_fa_mixcloud=$i i='' i_fa_scribd=$i i='' i_fa_pause_circle=$i i='' i_fa_pause_circle_o=$i i='' i_fa_stop_circle=$i i='' i_fa_stop_circle_o=$i i='' i_fa_shopping_bag=$i i='' i_fa_shopping_basket=$i i='' i_fa_hashtag=$i i='' i_fa_bluetooth=$i i='' i_fa_bluetooth_b=$i i='' i_fa_percent=$i i='' i_fa_gitlab=$i i='' i_fa_wpbeginner=$i i='' i_fa_wpforms=$i i='' i_fa_envira=$i i='' i_fa_universal_access=$i i='' i_fa_wheelchair_alt=$i i='' i_fa_question_circle_o=$i i='' i_fa_blind=$i i='' i_fa_audio_description=$i i='' i_fa_volume_control_phone=$i i='' i_fa_braille=$i i='' i_fa_assistive_listening_systems=$i i='' i_fa_american_sign_language_interpreting=$i i_fa_asl_interpreting=$i_fa_american_sign_language_interpreting i='' i_fa_deaf=$i i_fa_deafness=$i_fa_deaf i_fa_hard_of_hearing=$i_fa_deaf i='' i_fa_glide=$i i='' i_fa_glide_g=$i i='' i_fa_sign_language=$i i_fa_signing=$i_fa_sign_language i='' i_fa_low_vision=$i i='' i_fa_viadeo=$i i='' i_fa_viadeo_square=$i i='' i_fa_snapchat=$i i='' i_fa_snapchat_ghost=$i i='' i_fa_snapchat_square=$i i='' i_fa_pied_piper=$i i='' i_fa_first_order=$i i='' i_fa_yoast=$i i='' i_fa_themeisle=$i i='' i_fa_google_plus_official=$i i_fa_google_plus_circle=$i_fa_google_plus_official i='' i_fa_font_awesome=$i i_fa_fa=$i_fa_font_awesome i='' i_fa_handshake_o=$i i='' i_fa_envelope_open=$i i='' i_fa_envelope_open_o=$i i='' i_fa_linode=$i i='' i_fa_address_book=$i i='' i_fa_address_book_o=$i i='' i_fa_address_card=$i i_fa_vcard=$i_fa_address_card i='' i_fa_address_card_o=$i i_fa_vcard_o=$i_fa_address_card_o i='' i_fa_user_circle=$i i='' i_fa_user_circle_o=$i i='' i_fa_user_o=$i i='' i_fa_id_badge=$i i='' i_fa_id_card=$i i_fa_drivers_license=$i_fa_id_card i='' i_fa_id_card_o=$i i_fa_drivers_license_o=$i_fa_id_card_o i='' i_fa_quora=$i i='' i_fa_free_code_camp=$i i='' i_fa_telegram=$i i='' i_fa_thermometer_full=$i i_fa_thermometer=$i_fa_thermometer_full i_fa_thermometer_4=$i_fa_thermometer_full i='' i_fa_thermometer_three_quarters=$i i_fa_thermometer_3=$i_fa_thermometer_three_quarters i='' i_fa_thermometer_half=$i i_fa_thermometer_2=$i_fa_thermometer_half i='' i_fa_thermometer_quarter=$i i_fa_thermometer_1=$i_fa_thermometer_quarter i='' i_fa_thermometer_empty=$i i_fa_thermometer_0=$i_fa_thermometer_empty i='' i_fa_shower=$i i='' i_fa_bath=$i i_fa_bathtub=$i_fa_bath i_fa_s15=$i_fa_bath i='' i_fa_podcast=$i i='' i_fa_window_maximize=$i i='' i_fa_window_minimize=$i i='' i_fa_window_restore=$i i='' i_fa_window_close=$i i_fa_times_rectangle=$i_fa_window_close i='' i_fa_window_close_o=$i i_fa_times_rectangle_o=$i_fa_window_close_o i='' i_fa_bandcamp=$i i='' i_fa_grav=$i i='' i_fa_etsy=$i i='' i_fa_imdb=$i i='' i_fa_ravelry=$i i='' i_fa_eercast=$i i='' i_fa_microchip=$i i='' i_fa_snowflake_o=$i i='' i_fa_superpowers=$i i='' i_fa_wpexplorer=$i i='' i_fa_meetup=$i unset i
Shell
4
dhb52/nerd-fonts
bin/scripts/lib/i_fa.sh
[ "MIT" ]
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ module.exports = { resolveExtensions: ['.mjs'], // Note: `@bazel/esbuild` has a bug and does not pass-through the format from Starlark. format: 'esm', banner: { // Workaround for: https://github.com/evanw/esbuild/issues/946 // TODO: Remove this workaround in the future once devmode is ESM as well. js: ` import {createRequire as __cjsCompatRequire} from 'module'; const require = __cjsCompatRequire(import.meta.url); `, }, };
JavaScript
3
John-Cassidy/angular
packages/service-worker/cli/esbuild.config.js
[ "MIT" ]
/* Copyright (c) 2004-2006 Tomas Matousek. Based on PHP5 and PHP6 grammar tokens definition. The use and distribution terms for this software are contained in the file named License.txt, which can be found in the root of the Phalanger distribution. By using this software in any fashion, you are agreeing to be bound by the terms of this license. You must not remove this notice from this software. */ using System; using PHP.Core; using System.Collections.Generic; %% %namespace PHP.Core.Parsers %type Tokens %class Lexer %eofval Tokens.EOF %errorval Tokens.ERROR %attributes public partial %function GetNextToken %ignorecase %charmap Map %char %x INITIAL %x ST_IN_SCRIPTING %x ST_DOUBLE_QUOTES %x ST_SINGLE_QUOTES %x ST_BACKQUOTE %x ST_HEREDOC %x ST_NEWDOC %x ST_LOOKING_FOR_PROPERTY %x ST_LOOKING_FOR_VARNAME %x ST_DOC_COMMENT %x ST_COMMENT %x ST_ONE_LINE_COMMENT HexDigit [0-9A-Fa-f] LNUM [0-9]+ DNUM ([0-9]*[.][0-9]+)|([0-9]+[.][0-9]*) EXPONENT_DNUM (({LNUM}|{DNUM})[eE][+-]?{LNUM}) HNUM "0x"{HexDigit}+ BNUM "0b"[01]+ LABEL [a-zA-Z_][a-zA-Z0-9_]* WHITESPACE [ \n\r\t]+ TABS_AND_SPACES [ \t]* TOKENS [;:,.\[\]()|^&+-/*=%!~$<>?@] ESCAPED_AND_WHITESPACE [\n\t\r #'.:;,()|^&+-/*=%!~<>?@]+ ANY_CHAR (.|[\n\r]) NEWLINE ("\r"|"\n"|"\r\n") NS_SEPARATOR ("\\") SlashedOctalNumber "\\"[0-7][0-7]?[0-7]? SlashedHexNumber "\\"[x]{HexDigit}{HexDigit}? SlashedUnicodeCharCode "\\"[uU]{HexDigit}?{HexDigit}?{HexDigit}?{HexDigit}?{HexDigit}?{HexDigit}? SlashedUnicodeCharName "\\"[C]("{"[A-Z0-9 -]+"}")? SlashedSingleQuote "\\'" SlashedDoubleQuotes "\\\"" SlashedBackQuote "\\`" SlashedSlash "\\\\" SlashedSpecialChar "\\"[ntr\\$] SlashedOpenBrace "\\{" SlashedAnyChar "\\"{ANY_CHAR} NonVariableStart [^a-zA-Z_{] %% <INITIAL>(([^<]|"<"[^?%s<])+)|"<" { return Tokens.T_INLINE_HTML; } <INITIAL>"<?"|"<script"{WHITESPACE}+"language"{WHITESPACE}*"="{WHITESPACE}*("php"|"\"php\""|"\'php\'"){WHITESPACE}*">" { if (AllowShortTags || TokenLength>2) { BEGIN(LexicalStates.ST_IN_SCRIPTING); return Tokens.T_OPEN_TAG; } else { return Tokens.T_INLINE_HTML; } } <INITIAL>("<s"[^< \n\r\t]*) { return Tokens.T_INLINE_HTML; } <INITIAL>"<%="|"<?=" { if (GetTokenChar(1) != '%' || AllowAspTags) { BEGIN(LexicalStates.ST_IN_SCRIPTING); return Tokens.T_OPEN_TAG_WITH_ECHO; } else { return Tokens.T_INLINE_HTML; } } <INITIAL>"<%" { if (AllowAspTags) { BEGIN(LexicalStates.ST_IN_SCRIPTING); return Tokens.T_OPEN_TAG; } else { return Tokens.T_INLINE_HTML; } } <INITIAL>"<?php"([ \t]|{NEWLINE}) { BEGIN(LexicalStates.ST_IN_SCRIPTING); return Tokens.T_OPEN_TAG; } <INITIAL>{ANY_CHAR} { return Tokens.ERROR; } <ST_IN_SCRIPTING>("?>"|"</script"{WHITESPACE}*">"){NEWLINE}? { BEGIN(LexicalStates.INITIAL); return Tokens.T_CLOSE_TAG; } <ST_IN_SCRIPTING>"exit" { return Tokens.T_EXIT; } <ST_IN_SCRIPTING>"die" { return Tokens.T_EXIT; } <ST_IN_SCRIPTING>"function" { return Tokens.T_FUNCTION; } <ST_IN_SCRIPTING>"const" { return Tokens.T_CONST; } <ST_IN_SCRIPTING>"return" { return Tokens.T_RETURN; } <ST_IN_SCRIPTING>"yield" { return Tokens.T_YIELD; } <ST_IN_SCRIPTING>"if" { return Tokens.T_IF; } <ST_IN_SCRIPTING>"elseif" { return Tokens.T_ELSEIF; } <ST_IN_SCRIPTING>"endif" { return Tokens.T_ENDIF; } <ST_IN_SCRIPTING>"else" { return Tokens.T_ELSE; } <ST_IN_SCRIPTING>"while" { return Tokens.T_WHILE; } <ST_IN_SCRIPTING>"endwhile" { return Tokens.T_ENDWHILE; } <ST_IN_SCRIPTING>"do" { return Tokens.T_DO; } <ST_IN_SCRIPTING>"for" { return Tokens.T_FOR; } <ST_IN_SCRIPTING>"endfor" { return Tokens.T_ENDFOR; } <ST_IN_SCRIPTING>"foreach" { return Tokens.T_FOREACH; } <ST_IN_SCRIPTING>"endforeach" { return Tokens.T_ENDFOREACH; } <ST_IN_SCRIPTING>"declare" { return Tokens.T_DECLARE; } <ST_IN_SCRIPTING>"enddeclare" { return Tokens.T_ENDDECLARE; } <ST_IN_SCRIPTING>"as" { return Tokens.T_AS; } <ST_IN_SCRIPTING>"switch" { return Tokens.T_SWITCH; } <ST_IN_SCRIPTING>"endswitch" { return Tokens.T_ENDSWITCH; } <ST_IN_SCRIPTING>"case" { return Tokens.T_CASE; } <ST_IN_SCRIPTING>"default" { return Tokens.T_DEFAULT; } <ST_IN_SCRIPTING>"break" { return Tokens.T_BREAK; } <ST_IN_SCRIPTING>"continue" { return Tokens.T_CONTINUE; } <ST_IN_SCRIPTING>"echo" { return Tokens.T_ECHO; } <ST_IN_SCRIPTING>"print" { return Tokens.T_PRINT; } <ST_IN_SCRIPTING>"class" { return Tokens.T_CLASS; } <ST_IN_SCRIPTING>"trait" { return Tokens.T_TRAIT; } <ST_IN_SCRIPTING>"insteadof" { return Tokens.T_INSTEADOF; } <ST_IN_SCRIPTING>"extends" { return Tokens.T_EXTENDS; } <ST_IN_SCRIPTING>"new" { return Tokens.T_NEW; } <ST_IN_SCRIPTING>"var" { return Tokens.T_VAR; } <ST_IN_SCRIPTING>"eval" { return Tokens.T_EVAL; } <ST_IN_SCRIPTING>"include" { return Tokens.T_INCLUDE; } <ST_IN_SCRIPTING>"include_once" { return Tokens.T_INCLUDE_ONCE; } <ST_IN_SCRIPTING>"require" { return Tokens.T_REQUIRE; } <ST_IN_SCRIPTING>"require_once" { return Tokens.T_REQUIRE_ONCE; } <ST_IN_SCRIPTING>"global" { return Tokens.T_GLOBAL; } <ST_IN_SCRIPTING>"isset" { return Tokens.T_ISSET; } <ST_IN_SCRIPTING>"empty" { return Tokens.T_EMPTY; } <ST_IN_SCRIPTING>"static" { return Tokens.T_STATIC; } <ST_IN_SCRIPTING>"unset" { return Tokens.T_UNSET; } <ST_IN_SCRIPTING>"or" { return Tokens.T_LOGICAL_OR; } <ST_IN_SCRIPTING>"and" { return Tokens.T_LOGICAL_AND; } <ST_IN_SCRIPTING>"xor" { return Tokens.T_LOGICAL_XOR; } <ST_IN_SCRIPTING>"list" { return Tokens.T_LIST; } <ST_IN_SCRIPTING>"array" { return Tokens.T_ARRAY; } <ST_IN_SCRIPTING>"callable" { return Tokens.T_CALLABLE; } <ST_IN_SCRIPTING>"__CLASS__" { return Tokens.T_CLASS_C; } <ST_IN_SCRIPTING>"__TRAIT__" { return Tokens.T_TRAIT_C; } <ST_IN_SCRIPTING>"__FUNCTION__" { return Tokens.T_FUNC_C; } <ST_IN_SCRIPTING>"__METHOD__" { return Tokens.T_METHOD_C; } <ST_IN_SCRIPTING>"__LINE__" { return Tokens.T_LINE; } <ST_IN_SCRIPTING>"__FILE__" { return Tokens.T_FILE; } <ST_IN_SCRIPTING>"__DIR__" { return Tokens.T_DIR; } <ST_IN_SCRIPTING>"try" { return Tokens.T_TRY; } <ST_IN_SCRIPTING>"catch" { return Tokens.T_CATCH; } <ST_IN_SCRIPTING>"finally" { return Tokens.T_FINALLY; } <ST_IN_SCRIPTING>"throw" { return Tokens.T_THROW; } <ST_IN_SCRIPTING>"interface" { return Tokens.T_INTERFACE; } <ST_IN_SCRIPTING>"implements" { return Tokens.T_IMPLEMENTS; } <ST_IN_SCRIPTING>"clone" { return Tokens.T_CLONE; } <ST_IN_SCRIPTING>"abstract" { return Tokens.T_ABSTRACT; } <ST_IN_SCRIPTING>"final" { return Tokens.T_FINAL; } <ST_IN_SCRIPTING>"private" { return Tokens.T_PRIVATE; } <ST_IN_SCRIPTING>"protected" { return Tokens.T_PROTECTED; } <ST_IN_SCRIPTING>"public" { return Tokens.T_PUBLIC; } <ST_IN_SCRIPTING>"instanceof" { return Tokens.T_INSTANCEOF; } <ST_IN_SCRIPTING>"__NAMESPACE__" { return Tokens.T_NAMESPACE_C; } <ST_IN_SCRIPTING>"namespace" { return Tokens.T_NAMESPACE; } <ST_IN_SCRIPTING>"use" { return Tokens.T_USE; } <ST_IN_SCRIPTING>"import" { return Tokens.T_IMPORT; } <ST_IN_SCRIPTING>"goto" { return Tokens.T_GOTO; } <ST_IN_SCRIPTING>"bool" { return Tokens.T_BOOL_TYPE; } <ST_IN_SCRIPTING>"int" { return Tokens.T_INT_TYPE; } <ST_IN_SCRIPTING>"int64" { return Tokens.T_INT64_TYPE; } <ST_IN_SCRIPTING>"double" { return Tokens.T_DOUBLE_TYPE; } <ST_IN_SCRIPTING>"string" { return Tokens.T_STRING_TYPE; } <ST_IN_SCRIPTING>"resource" { return Tokens.T_RESOURCE_TYPE; } <ST_IN_SCRIPTING>"object" { return Tokens.T_OBJECT_TYPE; } <ST_IN_SCRIPTING>"clrtypeof" { return Tokens.T_TYPEOF; } <ST_IN_SCRIPTING>"partial" { return Tokens.T_PARTIAL; } <ST_IN_SCRIPTING>"<:" { return Tokens.T_LGENERIC; } <ST_IN_SCRIPTING>":>" { return Tokens.T_RGENERIC; } <ST_IN_SCRIPTING>"__get" { return Tokens.T_GET; } <ST_IN_SCRIPTING>"__set" { return Tokens.T_SET; } <ST_IN_SCRIPTING>"__call" { return Tokens.T_CALL; } <ST_IN_SCRIPTING>"__callStatic" { return Tokens.T_CALLSTATIC; } <ST_IN_SCRIPTING>"__tostring" { return Tokens.T_TOSTRING; } <ST_IN_SCRIPTING>"__construct" { return Tokens.T_CONSTRUCT; } <ST_IN_SCRIPTING>"__destruct" { return Tokens.T_DESTRUCT; } <ST_IN_SCRIPTING>"__wakeup" { return Tokens.T_WAKEUP; } <ST_IN_SCRIPTING>"__sleep" { return Tokens.T_SLEEP; } <ST_IN_SCRIPTING>"parent" { return Tokens.T_PARENT; } <ST_IN_SCRIPTING>"self" { return Tokens.T_SELF; } <ST_IN_SCRIPTING>"__autoload" { return Tokens.T_AUTOLOAD; } <ST_IN_SCRIPTING>"true" { return Tokens.T_TRUE; } <ST_IN_SCRIPTING>"false" { return Tokens.T_FALSE; } <ST_IN_SCRIPTING>"null" { return Tokens.T_NULL; } <ST_IN_SCRIPTING>"=>" { return Tokens.T_DOUBLE_ARROW; } <ST_IN_SCRIPTING>"++" { return Tokens.T_INC; } <ST_IN_SCRIPTING>"--" { return Tokens.T_DEC; } <ST_IN_SCRIPTING>"===" { return Tokens.T_IS_IDENTICAL; } <ST_IN_SCRIPTING>"!==" { return Tokens.T_IS_NOT_IDENTICAL; } <ST_IN_SCRIPTING>"==" { return Tokens.T_IS_EQUAL; } <ST_IN_SCRIPTING>"!="|"<>" { return Tokens.T_IS_NOT_EQUAL; } <ST_IN_SCRIPTING>"<=" { return Tokens.T_IS_SMALLER_OR_EQUAL; } <ST_IN_SCRIPTING>">=" { return Tokens.T_IS_GREATER_OR_EQUAL; } <ST_IN_SCRIPTING>"+=" { return Tokens.T_PLUS_EQUAL; } <ST_IN_SCRIPTING>"-=" { return Tokens.T_MINUS_EQUAL; } <ST_IN_SCRIPTING>"*=" { return Tokens.T_MUL_EQUAL; } <ST_IN_SCRIPTING>"*\*" { return Tokens.T_POW; } <ST_IN_SCRIPTING>"*\*=" { return Tokens.T_POW_EQUAL; } <ST_IN_SCRIPTING>"/=" { return Tokens.T_DIV_EQUAL; } <ST_IN_SCRIPTING>".=" { return Tokens.T_CONCAT_EQUAL; } <ST_IN_SCRIPTING>"%=" { return Tokens.T_MOD_EQUAL; } <ST_IN_SCRIPTING>"<<=" { return Tokens.T_SL_EQUAL; } <ST_IN_SCRIPTING>">>=" { return Tokens.T_SR_EQUAL; } <ST_IN_SCRIPTING>"&=" { return Tokens.T_AND_EQUAL; } <ST_IN_SCRIPTING>"|=" { return Tokens.T_OR_EQUAL; } <ST_IN_SCRIPTING>"^=" { return Tokens.T_XOR_EQUAL; } <ST_IN_SCRIPTING>"||" { return Tokens.T_BOOLEAN_OR; } <ST_IN_SCRIPTING>"&&" { return Tokens.T_BOOLEAN_AND; } <ST_IN_SCRIPTING>"<<" { return Tokens.T_SL; } <ST_IN_SCRIPTING>">>" { return Tokens.T_SR; } <ST_IN_SCRIPTING>"::" { return Tokens.T_DOUBLE_COLON; } <ST_IN_SCRIPTING>"->" { yy_push_state(LexicalStates.ST_LOOKING_FOR_PROPERTY); return Tokens.T_OBJECT_OPERATOR; } <ST_IN_SCRIPTING>"$"{LABEL} { return Tokens.T_VARIABLE; } <ST_IN_SCRIPTING>{TOKENS} { return (Tokens)GetTokenChar(0); } <ST_IN_SCRIPTING>{LABEL} { return Tokens.T_STRING; } <ST_IN_SCRIPTING>{NS_SEPARATOR} { return Tokens.T_NS_SEPARATOR; } <ST_IN_SCRIPTING>"..." { return Tokens.T_ELLIPSIS; } <ST_IN_SCRIPTING>{WHITESPACE} { return Tokens.T_WHITESPACE; } <ST_IN_SCRIPTING>{LNUM} { return Tokens.ParseDecimalNumber; } <ST_IN_SCRIPTING>{HNUM} { return Tokens.ParseHexadecimalNumber; } <ST_IN_SCRIPTING>{DNUM} { return Tokens.ParseDouble; } <ST_IN_SCRIPTING>{EXPONENT_DNUM} { return Tokens.ParseDouble; } <ST_IN_SCRIPTING>{BNUM} { return Tokens.ParseBinaryNumber; } <ST_IN_SCRIPTING>"#pragma"[ \t]+"line"[ \t]+[-]?{LNUM}[ \t]* { BEGIN(LexicalStates.ST_ONE_LINE_COMMENT); return Tokens.T_PRAGMA_LINE; } <ST_IN_SCRIPTING>"#pragma"[ \t]+"file"[^\n]+ { BEGIN(LexicalStates.ST_ONE_LINE_COMMENT); return Tokens.T_PRAGMA_FILE; } <ST_IN_SCRIPTING>"#pragma"[ \t]+"default"[ \t]+"line"[ \t]* { BEGIN(LexicalStates.ST_ONE_LINE_COMMENT); return Tokens.T_PRAGMA_DEFAULT_LINE; } <ST_IN_SCRIPTING>"#pragma"[ \t]+"default"[ \t]+"file"[ \t]* { BEGIN(LexicalStates.ST_ONE_LINE_COMMENT); return Tokens.T_PRAGMA_DEFAULT_FILE; } <ST_IN_SCRIPTING>"#" { BEGIN(LexicalStates.ST_ONE_LINE_COMMENT); yymore(); break; } <ST_IN_SCRIPTING>"//" { BEGIN(LexicalStates.ST_ONE_LINE_COMMENT); yymore(); break; } <ST_IN_SCRIPTING>"/**"{WHITESPACE} { BEGIN(LexicalStates.ST_DOC_COMMENT); yymore(); break; } <ST_IN_SCRIPTING>"/*" { BEGIN(LexicalStates.ST_COMMENT); yymore(); break; } <ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"int8"{TABS_AND_SPACES}")" { return Tokens.T_INT8_CAST; } <ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"int16"{TABS_AND_SPACES}")" { return Tokens.T_INT16_CAST; } <ST_IN_SCRIPTING>"("{TABS_AND_SPACES}("int"|"int32"|"integer"){TABS_AND_SPACES}")" { return Tokens.T_INT32_CAST; } <ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"int64"{TABS_AND_SPACES}")" { return Tokens.T_INT64_CAST; } <ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"uint8"{TABS_AND_SPACES}")" { return Tokens.T_UINT8_CAST; } <ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"uint16"{TABS_AND_SPACES}")" { return Tokens.T_UINT16_CAST; } <ST_IN_SCRIPTING>"("{TABS_AND_SPACES}("uint"|"uint32"){TABS_AND_SPACES}")" { return Tokens.T_UINT32_CAST; } <ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"uint64"{TABS_AND_SPACES}")" { return Tokens.T_UINT64_CAST; } <ST_IN_SCRIPTING>"("{TABS_AND_SPACES}("real"|"double"){TABS_AND_SPACES}")" { return Tokens.T_DOUBLE_CAST; } <ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"float"{TABS_AND_SPACES}")" { return Tokens.T_FLOAT_CAST; } <ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"string"{TABS_AND_SPACES}")" { return Tokens.T_STRING_CAST; } <ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"binary"{TABS_AND_SPACES}")" { return Tokens.T_BINARY_CAST; } <ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"unicode"{TABS_AND_SPACES}")" { return Tokens.T_UNICODE_CAST; } <ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"array"{TABS_AND_SPACES}")" { return Tokens.T_ARRAY_CAST; } <ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"object"{TABS_AND_SPACES}")" { return Tokens.T_OBJECT_CAST; } <ST_IN_SCRIPTING>"("{TABS_AND_SPACES}("bool"|"boolean"){TABS_AND_SPACES}")" { return Tokens.T_BOOL_CAST; } <ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"unset"{TABS_AND_SPACES}")" { return Tokens.T_UNSET_CAST; } <ST_IN_SCRIPTING>"{" { yy_push_state(LexicalStates.ST_IN_SCRIPTING); return Tokens.T_LBRACE; } <ST_IN_SCRIPTING>"}" { if (!yy_pop_state()) return Tokens.ERROR; return Tokens.T_RBRACE; } <ST_IN_SCRIPTING>"%>"{NEWLINE}? { if (AllowAspTags) { BEGIN(LexicalStates.INITIAL); return Tokens.T_CLOSE_TAG; } else { yyless(1); return Tokens.T_PERCENT; } } <ST_IN_SCRIPTING>(b?["]([^$"\\]|("\\".)|("\\"{NEWLINE}))*["]) { return Tokens.DoubleQuotedString; } <ST_IN_SCRIPTING>(b?[']([^'\\]|("\\".)|("\\"{NEWLINE}))*[']) { return Tokens.SingleQuotedString; } <ST_IN_SCRIPTING>(i[']([^'\\<>`#\r\n]|("\\"[^<>`#\r\n]))+[']) { return Tokens.SingleQuotedIdentifier; } <ST_IN_SCRIPTING>(i[']([^'\\]|("\\".)|("\\"{NEWLINE}))*[']) { return Tokens.ErrorInvalidIdentifier; } <ST_IN_SCRIPTING>b?["] { BEGIN(LexicalStates.ST_DOUBLE_QUOTES); return (GetTokenChar(0) != '"') ? Tokens.T_BINARY_DOUBLE : Tokens.T_DOUBLE_QUOTES; } <ST_IN_SCRIPTING>b?['] { // Gets here only in the case of unterminated singly-quoted string. That leads usually to an error token, // however when the source code is parsed per-line (as in Visual Studio colorizer) it is important to remember // that we are in the singly-quoted string at the end of the line. BEGIN(LexicalStates.ST_SINGLE_QUOTES); yymore(); break; } <ST_IN_SCRIPTING>[`] { BEGIN(LexicalStates.ST_BACKQUOTE); return Tokens.T_BACKQUOTE; } <ST_IN_SCRIPTING>b?"<<<"{TABS_AND_SPACES}({LABEL}|([']{LABEL}['])|(["]{LABEL}["])){NEWLINE} { bool is_binary = GetTokenChar(0) != '<'; hereDocLabel = GetTokenSubstring(is_binary ? 4 : 3).Trim(); var newstate = LexicalStates.ST_HEREDOC; if (hereDocLabel[0] == '"' || hereDocLabel[0] == '\'') { if (hereDocLabel[0] == '\'') newstate = LexicalStates.ST_NEWDOC; // newdoc syntax, continue in ST_NEWDOC lexical state hereDocLabel = hereDocLabel.Substring(1, hereDocLabel.Length - 2); // trim quote characters around } BEGIN(newstate); return is_binary ? Tokens.T_BINARY_HEREDOC : Tokens.T_START_HEREDOC; } <ST_IN_SCRIPTING>{ANY_CHAR} { return Tokens.ERROR; } <ST_LOOKING_FOR_PROPERTY>{LABEL} { if (!yy_pop_state()) return Tokens.ERROR; inString = (CurrentLexicalState != LexicalStates.ST_IN_SCRIPTING); isCode = true; return Tokens.T_STRING; } <ST_LOOKING_FOR_PROPERTY>{ANY_CHAR} { yyless(0); if (!yy_pop_state()) return Tokens.ERROR; break; } <ST_LOOKING_FOR_VARNAME>{LABEL} { if (!yy_pop_state()) return Tokens.ERROR; yy_push_state(LexicalStates.ST_IN_SCRIPTING); return Tokens.T_STRING_VARNAME; } <ST_LOOKING_FOR_VARNAME>{ANY_CHAR} { yyless(0); if (!yy_pop_state()) return Tokens.ERROR; yy_push_state(LexicalStates.ST_IN_SCRIPTING); break; } <ST_ONE_LINE_COMMENT>"?"|"%"|">" { yymore(); break; } <ST_ONE_LINE_COMMENT>[^\n\r?%>]+ { yymore(); break; } <ST_ONE_LINE_COMMENT>{NEWLINE} { BEGIN(LexicalStates.ST_IN_SCRIPTING); return Tokens.T_LINE_COMMENT; } <ST_ONE_LINE_COMMENT>"?>"|"%>" { if (AllowAspTags || GetTokenChar(TokenLength - 2) != '%') { yyless(0); BEGIN(LexicalStates.ST_IN_SCRIPTING); return Tokens.T_LINE_COMMENT; } else { yymore(); break; } } <ST_COMMENT>[^*]+ { yymore(); break; } <ST_COMMENT>"*/" { BEGIN(LexicalStates.ST_IN_SCRIPTING); return Tokens.T_COMMENT; } <ST_COMMENT>"*" { yymore(); break; } <ST_DOC_COMMENT>[^*]+ { yymore(); break; } <ST_DOC_COMMENT>"*/" { BEGIN(LexicalStates.ST_IN_SCRIPTING); return Tokens.T_DOC_COMMENT; } <ST_DOC_COMMENT>"*" { yymore(); break; } <ST_SINGLE_QUOTES>([^'\\]|("\\".)|("\\"{NEWLINE}))+ { yymore(); break; } <ST_SINGLE_QUOTES>"'" { BEGIN(LexicalStates.ST_IN_SCRIPTING); return Tokens.SingleQuotedString; } <ST_HEREDOC,ST_NEWDOC>^{LABEL}(";")?{NEWLINE} { if (IsCurrentHeredocEnd(0)) { yyless(hereDocLabel.Length); hereDocLabel = null; BEGIN(LexicalStates.ST_IN_SCRIPTING); return Tokens.T_END_HEREDOC; } else { inString = true; return Tokens.T_STRING; } } <ST_HEREDOC>{LNUM}|{HNUM} { return Tokens.T_NUM_STRING; } <ST_HEREDOC>{LABEL} { inString = true; return Tokens.T_STRING; } <ST_HEREDOC>{SlashedOctalNumber} { return Tokens.OctalCharCode; } <ST_HEREDOC>{SlashedHexNumber} { return Tokens.HexCharCode; } <ST_HEREDOC>{SlashedUnicodeCharCode} { inString = true; return (inUnicodeString) ? Tokens.UnicodeCharCode : Tokens.T_STRING; } <ST_HEREDOC>{SlashedUnicodeCharName} { inString = true; return (inUnicodeString) ? Tokens.UnicodeCharName : Tokens.T_STRING; } <ST_HEREDOC>{SlashedSpecialChar} { return Tokens.EscapedCharacter; } <ST_HEREDOC>{SlashedOpenBrace} { inString = true; return Tokens.T_STRING; } <ST_HEREDOC>{SlashedAnyChar} { return Tokens.T_BAD_CHARACTER; } <ST_HEREDOC>["'`]+ { return Tokens.T_ENCAPSED_AND_WHITESPACE; } <ST_HEREDOC>"$"{LABEL} { inString = true; return Tokens.T_VARIABLE; } <ST_HEREDOC>"${" { yy_push_state(LexicalStates.ST_LOOKING_FOR_VARNAME); return Tokens.T_DOLLAR_OPEN_CURLY_BRACES; } <ST_HEREDOC>"$"{NonVariableStart} { yyless(1); return Tokens.T_CHARACTER; } <ST_HEREDOC>"->" { yy_push_state(LexicalStates.ST_LOOKING_FOR_PROPERTY); inString = true; return Tokens.T_OBJECT_OPERATOR; } <ST_HEREDOC>("["|"]"|"{"|"}"|"$") { inString = true; return (Tokens)GetTokenChar(0); } <ST_HEREDOC>"{$" { yy_push_state(LexicalStates.ST_IN_SCRIPTING); yyless(1); return Tokens.T_CURLY_OPEN; } <ST_HEREDOC>{ESCAPED_AND_WHITESPACE} { return Tokens.T_ENCAPSED_AND_WHITESPACE; } <ST_HEREDOC,ST_NEWDOC>{ANY_CHAR} { return Tokens.T_CHARACTER; } <ST_DOUBLE_QUOTES>{LNUM}|{HNUM} { return Tokens.T_NUM_STRING; } <ST_DOUBLE_QUOTES>{LABEL} { inString = true; return Tokens.T_STRING; } <ST_DOUBLE_QUOTES>{SlashedOctalNumber} { return Tokens.OctalCharCode; } <ST_DOUBLE_QUOTES>{SlashedHexNumber} { return Tokens.HexCharCode; } <ST_DOUBLE_QUOTES>{SlashedUnicodeCharCode} { inString = true; return (inUnicodeString) ? Tokens.UnicodeCharCode : Tokens.T_STRING; } <ST_DOUBLE_QUOTES>{SlashedUnicodeCharName} { inString = true; return (inUnicodeString) ? Tokens.UnicodeCharName : Tokens.T_STRING; } <ST_DOUBLE_QUOTES>{SlashedDoubleQuotes} { return Tokens.EscapedCharacter; } <ST_DOUBLE_QUOTES>{SlashedSpecialChar} { return Tokens.EscapedCharacter; } <ST_DOUBLE_QUOTES>{SlashedOpenBrace} { inString = true; return Tokens.T_STRING; } <ST_DOUBLE_QUOTES>{SlashedAnyChar} { return Tokens.T_BAD_CHARACTER; } <ST_DOUBLE_QUOTES>[`]+ { return Tokens.T_ENCAPSED_AND_WHITESPACE; } <ST_DOUBLE_QUOTES>["] { BEGIN(LexicalStates.ST_IN_SCRIPTING); return Tokens.T_DOUBLE_QUOTES; } <ST_DOUBLE_QUOTES>"$"{LABEL} { inString = true; return Tokens.T_VARIABLE; } <ST_DOUBLE_QUOTES>"${" { yy_push_state(LexicalStates.ST_LOOKING_FOR_VARNAME); return Tokens.T_DOLLAR_OPEN_CURLY_BRACES; } <ST_DOUBLE_QUOTES>"$"{NonVariableStart} { yyless(1); return Tokens.T_CHARACTER; } <ST_DOUBLE_QUOTES>"->" { yy_push_state(LexicalStates.ST_LOOKING_FOR_PROPERTY); inString = true; return Tokens.T_OBJECT_OPERATOR; } <ST_DOUBLE_QUOTES>"{$" { yy_push_state(LexicalStates.ST_IN_SCRIPTING); yyless(1); return Tokens.T_CURLY_OPEN; } <ST_DOUBLE_QUOTES>("["|"]"|"{"|"}"|"$") { inString = true; return (Tokens)GetTokenChar(0); } <ST_DOUBLE_QUOTES>{ESCAPED_AND_WHITESPACE} { return Tokens.T_ENCAPSED_AND_WHITESPACE; } <ST_DOUBLE_QUOTES>{ANY_CHAR} { return Tokens.T_CHARACTER; } <ST_BACKQUOTE>{LNUM}|{HNUM} { return Tokens.T_NUM_STRING; } <ST_BACKQUOTE>{LABEL} { inString = true; return Tokens.T_STRING; } <ST_BACKQUOTE>{SlashedOctalNumber} { return Tokens.OctalCharCode; } <ST_BACKQUOTE>{SlashedHexNumber} { return Tokens.HexCharCode; } <ST_BACKQUOTE>{SlashedUnicodeCharCode} { inString = true; return (inUnicodeString) ? Tokens.UnicodeCharCode : Tokens.T_STRING; } <ST_BACKQUOTE>{SlashedUnicodeCharName} { inString = true; return (inUnicodeString) ? Tokens.UnicodeCharName : Tokens.T_STRING; } <ST_BACKQUOTE>{SlashedBackQuote} { return Tokens.EscapedCharacter; } <ST_BACKQUOTE>{SlashedSpecialChar} { return Tokens.EscapedCharacter; } <ST_BACKQUOTE>{SlashedOpenBrace} { inString = true; return Tokens.T_STRING; } <ST_BACKQUOTE>{SlashedAnyChar} { return Tokens.T_BAD_CHARACTER; } <ST_BACKQUOTE>["]+ { return Tokens.T_ENCAPSED_AND_WHITESPACE; } <ST_BACKQUOTE>[`] { BEGIN(LexicalStates.ST_IN_SCRIPTING); return Tokens.T_BACKQUOTE; } <ST_BACKQUOTE>"$"{LABEL} { inString = true; return Tokens.T_VARIABLE; } <ST_BACKQUOTE>"${" { yy_push_state(LexicalStates.ST_LOOKING_FOR_VARNAME); return Tokens.T_DOLLAR_OPEN_CURLY_BRACES; } <ST_BACKQUOTE>"$"{NonVariableStart} { yyless(1); return Tokens.T_CHARACTER; } <ST_BACKQUOTE>"->" { yy_push_state(LexicalStates.ST_LOOKING_FOR_PROPERTY); inString = true; return Tokens.T_OBJECT_OPERATOR; } <ST_BACKQUOTE>("["|"]"|"{"|"}"|"$") { inString = true; return (Tokens)GetTokenChar(0); } <ST_BACKQUOTE>"{$" { yy_push_state(LexicalStates.ST_IN_SCRIPTING); yyless(1); return Tokens.T_CURLY_OPEN; } <ST_BACKQUOTE>{ESCAPED_AND_WHITESPACE} { return Tokens.T_ENCAPSED_AND_WHITESPACE; } <ST_BACKQUOTE>{ANY_CHAR} { return Tokens.T_CHARACTER; }
Lex
4
uQr/Phalanger
Source/Core.Parsers/Generators/Lexer.lex
[ "Apache-2.0" ]
\data\ ngram 1=6 ngram 2=9 ngram 3=8 \1-grams: -0.8515802 <unk> 0 0 <s> -0.30103 -0.8515802 </s> 0 -0.8515802 foo -0.30103 -0.44013768 bar -0.30103 -0.6679358 foobar -0.30103 \2-grams: -0.7091413 foo </s> 0 -0.6251838 bar </s> 0 -0.24384303 foobar </s> 0 -0.6251838 <s> foo -0.30103 -0.49434766 foo foo -0.30103 -0.39393726 bar foo -0.30103 -0.4582359 <s> bar -0.30103 -0.51359576 foo bar -0.30103 -0.56213206 <s> foobar -0.30103 \3-grams: -0.45881382 bar foo </s> -0.43354067 foo bar </s> -0.105027884 <s> foobar </s> -0.18033421 <s> foo foo -0.38702002 bar foo foo -0.15375455 <s> bar foo -0.34500393 foo bar foo -0.18492673 foo foo bar \end\
DNS Zone
3
popcornell/audio
test/torchaudio_unittest/assets/decoder/kenlm.arpa
[ "BSD-2-Clause" ]
[[features.external-config]] == Externalized Configuration Spring Boot lets you externalize your configuration so that you can work with the same application code in different environments. You can use a variety of external configuration sources, include Java properties files, YAML files, environment variables, and command-line arguments. Property values can be injected directly into your beans by using the `@Value` annotation, accessed through Spring's `Environment` abstraction, or be <<features#features.external-config.typesafe-configuration-properties,bound to structured objects>> through `@ConfigurationProperties`. Spring Boot uses a very particular `PropertySource` order that is designed to allow sensible overriding of values. Properties are considered in the following order (with values from lower items overriding earlier ones): . Default properties (specified by setting `SpringApplication.setDefaultProperties`). . {spring-framework-api}/context/annotation/PropertySource.html[`@PropertySource`] annotations on your `@Configuration` classes. Please note that such property sources are not added to the `Environment` until the application context is being refreshed. This is too late to configure certain properties such as `+logging.*+` and `+spring.main.*+` which are read before refresh begins. . Config data (such as `application.properties` files). . A `RandomValuePropertySource` that has properties only in `+random.*+`. . OS environment variables. . Java System properties (`System.getProperties()`). . JNDI attributes from `java:comp/env`. . `ServletContext` init parameters. . `ServletConfig` init parameters. . Properties from `SPRING_APPLICATION_JSON` (inline JSON embedded in an environment variable or system property). . Command line arguments. . `properties` attribute on your tests. Available on {spring-boot-test-module-api}/context/SpringBootTest.html[`@SpringBootTest`] and the <<features#features.testing.spring-boot-applications.autoconfigured-tests,test annotations for testing a particular slice of your application>>. . {spring-framework-api}/test/context/TestPropertySource.html[`@TestPropertySource`] annotations on your tests. . <<using#using.devtools.globalsettings,Devtools global settings properties>> in the `$HOME/.config/spring-boot` directory when devtools is active. Config data files are considered in the following order: . <<features#features.external-config.files,Application properties>> packaged inside your jar (`application.properties` and YAML variants). . <<features#features.external-config.files.profile-specific,Profile-specific application properties>> packaged inside your jar (`application-\{profile}.properties` and YAML variants). . <<features#features.external-config.files,Application properties>> outside of your packaged jar (`application.properties` and YAML variants). . <<features#features.external-config.files.profile-specific,Profile-specific application properties>> outside of your packaged jar (`application-\{profile}.properties` and YAML variants). NOTE: It is recommended to stick with one format for your entire application. If you have configuration files with both `.properties` and `.yml` format in the same location, `.properties` takes precedence. To provide a concrete example, suppose you develop a `@Component` that uses a `name` property, as shown in the following example: [source,java,indent=0,subs="verbatim"] ---- include::{docs-java}/features/externalconfig/MyBean.java[] ---- On your application classpath (for example, inside your jar) you can have an `application.properties` file that provides a sensible default property value for `name`. When running in a new environment, an `application.properties` file can be provided outside of your jar that overrides the `name`. For one-off testing, you can launch with a specific command line switch (for example, `java -jar app.jar --name="Spring"`). TIP: The `env` and `configprops` endpoints can be useful in determining why a property has a particular value. You can use these two endpoints to diagnose unexpected property values. See the "<<actuator#actuator.endpoints, Production ready features>>" section for details. [[features.external-config.command-line-args]] === Accessing Command Line Properties By default, `SpringApplication` converts any command line option arguments (that is, arguments starting with `--`, such as `--server.port=9000`) to a `property` and adds them to the Spring `Environment`. As mentioned previously, command line properties always take precedence over file-based property sources. If you do not want command line properties to be added to the `Environment`, you can disable them by using `SpringApplication.setAddCommandLineProperties(false)`. [[features.external-config.application-json]] === JSON Application Properties Environment variables and system properties often have restrictions that mean some property names cannot be used. To help with this, Spring Boot allows you to encode a block of properties into a single JSON structure. When your application starts, any `spring.application.json` or `SPRING_APPLICATION_JSON` properties will be parsed and added to the `Environment`. For example, the `SPRING_APPLICATION_JSON` property can be supplied on the command line in a UN{asterisk}X shell as an environment variable: [source,shell,indent=0,subs="verbatim"] ---- $ SPRING_APPLICATION_JSON='{"my":{"name":"test"}}' java -jar myapp.jar ---- In the preceding example, you end up with `my.name=test` in the Spring `Environment`. The same JSON can also be provided as a system property: [source,shell,indent=0,subs="verbatim"] ---- $ java -Dspring.application.json='{"my":{"name":"test"}}' -jar myapp.jar ---- Or you could supply the JSON by using a command line argument: [source,shell,indent=0,subs="verbatim"] ---- $ java -jar myapp.jar --spring.application.json='{"my":{"name":"test"}}' ---- If you are deploying to a classic Application Server, you could also use a JNDI variable named `java:comp/env/spring.application.json`. NOTE: Although `null` values from the JSON will be added to the resulting property source, the `PropertySourcesPropertyResolver` treats `null` properties as missing values. This means that the JSON cannot override properties from lower order property sources with a `null` value. [[features.external-config.files]] === External Application Properties [[features.external-config.files]] Spring Boot will automatically find and load `application.properties` and `application.yaml` files from the following locations when your application starts: . From the classpath .. The classpath root .. The classpath `/config` package . From the current directory .. The current directory .. The `/config` subdirectory in the current directory .. Immediate child directories of the `/config` subdirectory The list is ordered by precedence (with values from lower items overriding earlier ones). Documents from the loaded files are added as `PropertySources` to the Spring `Environment`. If you do not like `application` as the configuration file name, you can switch to another file name by specifying a configprop:spring.config.name[] environment property. For example, to look for `myproject.properties` and `myproject.yaml` files you can run your application as follows: [source,shell,indent=0,subs="verbatim"] ---- $ java -jar myproject.jar --spring.config.name=myproject ---- You can also refer to an explicit location by using the configprop:spring.config.location[] environment property. This properties accepts a comma-separated list of one or more locations to check. The following example shows how to specify two distinct files: [source,shell,indent=0,subs="verbatim"] ---- $ java -jar myproject.jar --spring.config.location=\ optional:classpath:/default.properties,\ optional:classpath:/override.properties ---- TIP: Use the prefix `optional:` if the <<features#features.external-config.files.optional-prefix,locations are optional>> and you do not mind if they do not exist. WARNING: `spring.config.name`, `spring.config.location`, and `spring.config.additional-location` are used very early to determine which files have to be loaded. They must be defined as an environment property (typically an OS environment variable, a system property, or a command-line argument). If `spring.config.location` contains directories (as opposed to files), they should end in `/`. At runtime they will be appended with the names generated from `spring.config.name` before being loaded. Files specified in `spring.config.location` are imported directly. NOTE: Both directory and file location values are also expanded to check for <<features#features.external-config.files.profile-specific,profile-specific files>>. For example, if you have a `spring.config.location` of `classpath:myconfig.properties`, you will also find appropriate `classpath:myconfig-<profile>.properties` files are loaded. In most situations, each configprop:spring.config.location[] item you add will reference a single file or directory. Locations are processed in the order that they are defined and later ones can override the values of earlier ones. [[features.external-config.files.location-groups]] If you have a complex location setup, and you use profile-specific configuration files, you may need to provide further hints so that Spring Boot knows how they should be grouped. A location group is a collection of locations that are all considered at the same level. For example, you might want to group all classpath locations, then all external locations. Items within a location group should be separated with `;`. See the example in the "`<<features#features.external-config.files.profile-specific>>`" section for more details. Locations configured by using `spring.config.location` replace the default locations. For example, if `spring.config.location` is configured with the value `optional:classpath:/custom-config/,optional:file:./custom-config/`, the complete set of locations considered is: . `optional:classpath:custom-config/` . `optional:file:./custom-config/` If you prefer to add additional locations, rather than replacing them, you can use `spring.config.additional-location`. Properties loaded from additional locations can override those in the default locations. For example, if `spring.config.additional-location` is configured with the value `optional:classpath:/custom-config/,optional:file:./custom-config/`, the complete set of locations considered is: . `optional:classpath:/;optional:classpath:/config/` . `optional:file:./;optional:file:./config/;optional:file:./config/*/` . `optional:classpath:custom-config/` . `optional:file:./custom-config/` This search ordering lets you specify default values in one configuration file and then selectively override those values in another. You can provide default values for your application in `application.properties` (or whatever other basename you choose with `spring.config.name`) in one of the default locations. These default values can then be overridden at runtime with a different file located in one of the custom locations. NOTE: If you use environment variables rather than system properties, most operating systems disallow period-separated key names, but you can use underscores instead (for example, configprop:spring.config.name[format=envvar] instead of configprop:spring.config.name[]). See <<features#features.external-config.typesafe-configuration-properties.relaxed-binding.environment-variables>> for details. NOTE: If your application runs in a servlet container or application server, then JNDI properties (in `java:comp/env`) or servlet context initialization parameters can be used instead of, or as well as, environment variables or system properties. [[features.external-config.files.optional-prefix]] ==== Optional Locations By default, when a specified config data location does not exist, Spring Boot will throw a `ConfigDataLocationNotFoundException` and your application will not start. If you want to specify a location, but you do not mind if it does not always exist, you can use the `optional:` prefix. You can use this prefix with the `spring.config.location` and `spring.config.additional-location` properties, as well as with <<features#features.external-config.files.importing, `spring.config.import`>> declarations. For example, a `spring.config.import` value of `optional:file:./myconfig.properties` allows your application to start, even if the `myconfig.properties` file is missing. If you want to ignore all `ConfigDataLocationNotFoundExceptions` and always continue to start your application, you can use the `spring.config.on-not-found` property. Set the value to `ignore` using `SpringApplication.setDefaultProperties(...)` or with a system/environment variable. [[features.external-config.files.wildcard-locations]] ==== Wildcard Locations If a config file location includes the `{asterisk}` character for the last path segment, it is considered a wildcard location. Wildcards are expanded when the config is loaded so that immediate subdirectories are also checked. Wildcard locations are particularly useful in an environment such as Kubernetes when there are multiple sources of config properties. For example, if you have some Redis configuration and some MySQL configuration, you might want to keep those two pieces of configuration separate, while requiring that both those are present in an `application.properties` file. This might result in two separate `application.properties` files mounted at different locations such as `/config/redis/application.properties` and `/config/mysql/application.properties`. In such a case, having a wildcard location of `config/*/`, will result in both files being processed. By default, Spring Boot includes `config/*/` in the default search locations. It means that all subdirectories of the `/config` directory outside of your jar will be searched. You can use wildcard locations yourself with the `spring.config.location` and `spring.config.additional-location` properties. NOTE: A wildcard location must contain only one `{asterisk}` and end with `{asterisk}/` for search locations that are directories or `*/<filename>` for search locations that are files. Locations with wildcards are sorted alphabetically based on the absolute path of the file names. TIP: Wildcard locations only work with external directories. You cannot use a wildcard in a `classpath:` location. [[features.external-config.files.profile-specific]] ==== Profile Specific Files As well as `application` property files, Spring Boot will also attempt to load profile-specific files using the naming convention `application-\{profile}`. For example, if your application activates a profile named `prod` and uses YAML files, then both `application.yml` and `application-prod.yml` will be considered. Profile-specific properties are loaded from the same locations as standard `application.properties`, with profile-specific files always overriding the non-specific ones. If several profiles are specified, a last-wins strategy applies. For example, if profiles `prod,live` are specified by the configprop:spring.profiles.active[] property, values in `application-prod.properties` can be overridden by those in `application-live.properties`. [NOTE] ==== The last-wins strategy applies at the <<features#features.external-config.files.location-groups,location group>> level. A configprop:spring.config.location[] of `classpath:/cfg/,classpath:/ext/` will not have the same override rules as `classpath:/cfg/;classpath:/ext/`. For example, continuing our `prod,live` example above, we might have the following files: ---- /cfg application-live.properties /ext application-live.properties application-prod.properties ---- When we have a configprop:spring.config.location[] of `classpath:/cfg/,classpath:/ext/` we process all `/cfg` files before all `/ext` files: . `/cfg/application-live.properties` . `/ext/application-prod.properties` . `/ext/application-live.properties` When we have `classpath:/cfg/;classpath:/ext/` instead (with a `;` delimiter) we process `/cfg` and `/ext` at the same level: . `/ext/application-prod.properties` . `/cfg/application-live.properties` . `/ext/application-live.properties` ==== The `Environment` has a set of default profiles (by default, `[default]`) that are used if no active profiles are set. In other words, if no profiles are explicitly activated, then properties from `application-default` are considered. NOTE: Properties files are only ever loaded once. If you have already directly <<features#features.external-config.files.importing,imported>> a profile specific property files then it will not be imported a second time. [[features.external-config.files.importing]] ==== Importing Additional Data Application properties may import further config data from other locations using the `spring.config.import` property. Imports are processed as they are discovered, and are treated as additional documents inserted immediately below the one that declares the import. For example, you might have the following in your classpath `application.properties` file: [source,yaml,indent=0,subs="verbatim",configblocks] ---- spring: application: name: "myapp" config: import: "optional:file:./dev.properties" ---- This will trigger the import of a `dev.properties` file in current directory (if such a file exists). Values from the imported `dev.properties` will take precedence over the file that triggered the import. In the above example, the `dev.properties` could redefine `spring.application.name` to a different value. An import will only be imported once no matter how many times it is declared. The order an import is defined inside a single document within the properties/yaml file does not matter. For instance, the two examples below produce the same result: [source,yaml,indent=0,subs="verbatim",configblocks] ---- spring: config: import: "my.properties" my: property: "value" ---- [source,yaml,indent=0,subs="verbatim",configblocks] ---- my: property: "value" spring: config: import: "my.properties" ---- In both of the above examples, the values from the `my.properties` file will take precedence over the file that triggered its import. Several locations can be specified under a single `spring.config.import` key. Locations will be processed in the order that they are defined, with later imports taking precedence. NOTE: When appropriate, <<features#features.external-config.files.profile-specific, Profile-specific variants>> are also considered for import. The example above would import both `my.properties` as well as any `my-<profile>.properties` variants. [TIP] ==== Spring Boot includes pluggable API that allows various different location addresses to be supported. By default you can import Java Properties, YAML and "`<<features#features.external-config.files.configtree, configuration trees>>`". Third-party jars can offer support for additional technologies (there is no requirement for files to be local). For example, you can imagine config data being from external stores such as Consul, Apache ZooKeeper or Netflix Archaius. If you want to support your own locations, see the `ConfigDataLocationResolver` and `ConfigDataLoader` classes in the `org.springframework.boot.context.config` package. ==== [[features.external-config.files.importing-extensionless]] ==== Importing Extensionless Files Some cloud platforms cannot add a file extension to volume mounted files. To import these extensionless files, you need to give Spring Boot a hint so that it knows how to load them. You can do this by putting an extension hint in square brackets. For example, suppose you have a `/etc/config/myconfig` file that you wish to import as yaml. You can import it from your `application.properties` using the following: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- spring: config: import: "file:/etc/config/myconfig[.yaml]" ---- [[features.external-config.files.configtree]] ==== Using Configuration Trees When running applications on a cloud platform (such as Kubernetes) you often need to read config values that the platform supplies. It is not uncommon to use environment variables for such purposes, but this can have drawbacks, especially if the value is supposed to be kept secret. As an alternative to environment variables, many cloud platforms now allow you to map configuration into mounted data volumes. For example, Kubernetes can volume mount both https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#populate-a-volume-with-data-stored-in-a-configmap[`ConfigMaps`] and https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets-as-files-from-a-pod[`Secrets`]. There are two common volume mount patterns that can be used: . A single file contains a complete set of properties (usually written as YAML). . Multiple files are written to a directory tree, with the filename becoming the '`key`' and the contents becoming the '`value`'. For the first case, you can import the YAML or Properties file directly using `spring.config.import` as described <<features#features.external-config.files.importing,above>>. For the second case, you need to use the `configtree:` prefix so that Spring Boot knows it needs to expose all the files as properties. As an example, let's imagine that Kubernetes has mounted the following volume: [indent=0] ---- etc/ config/ myapp/ username password ---- The contents of the `username` file would be a config value, and the contents of `password` would be a secret. To import these properties, you can add the following to your `application.properties` or `application.yaml` file: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- spring: config: import: "optional:configtree:/etc/config/" ---- You can then access or inject `myapp.username` and `myapp.password` properties from the `Environment` in the usual way. NOTE: Filenames with dot notation are also correctly mapped. For example, in the above example, a file named `myapp.username` in `/etc/config` would result in a `myapp.username` property in the `Environment`. TIP: Configuration tree values can be bound to both string `String` and `byte[]` types depending on the contents expected. If you have multiple config trees to import from the same parent folder you can use a wildcard shortcut. Any `configtree:` location that ends with `/*/` will import all immediate children as config trees. For example, given the following volume: [indent=0] ---- etc/ config/ dbconfig/ db/ username password mqconfig/ mq/ username password ---- You can use `configtree:/etc/config/*/` as the import location: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- spring: config: import: "optional:configtree:/etc/config/*/" ---- This will add `db.username`, `db.password`, `mq.username` and `mq.password` properties. NOTE: Directories loaded using a wildcard are sorted alphabetically. If you need a different order, then you should list each location as a separate import Configuration trees can also be used for Docker secrets. When a Docker swarm service is granted access to a secret, the secret gets mounted into the container. For example, if a secret named `db.password` is mounted at location `/run/secrets/`, you can make `db.password` available to the Spring environment using the following: [source,yaml,indent=0,subs="verbatim",configprops,configblocks] ---- spring: config: import: "optional:configtree:/run/secrets/" ---- [[features.external-config.files.property-placeholders]] ==== Property Placeholders The values in `application.properties` and `application.yml` are filtered through the existing `Environment` when they are used, so you can refer back to previously defined values (for example, from System properties). The standard `$\{name}` property-placeholder syntax can be used anywhere within a value. For example, the following file will set `app.description` to "`MyApp is a Spring Boot application`": [source,yaml,indent=0,subs="verbatim",configblocks] ---- app: name: "MyApp" description: "${app.name} is a Spring Boot application" ---- TIP: You can also use this technique to create "`short`" variants of existing Spring Boot properties. See the _<<howto#howto.properties-and-configuration.short-command-line-arguments>>_ how-to for details. [[features.external-config.files.multi-document]] ==== Working with Multi-Document Files Spring Boot allows you to split a single physical file into multiple logical documents which are each added independently. Documents are processed in order, from top to bottom. Later documents can override the properties defined in earlier ones. For `application.yml` files, the standard YAML multi-document syntax is used. Three consecutive hyphens represent the end of one document, and the start of the next. For example, the following file has two logical documents: [source,yaml,indent=0,subs="verbatim"] ---- spring: application: name: "MyApp" --- spring: application: name: "MyCloudApp" config: activate: on-cloud-platform: "kubernetes" ---- For `application.properties` files a special `#---` comment is used to mark the document splits: [source,properties,indent=0,subs="verbatim"] ---- spring.application.name=MyApp #--- spring.application.name=MyCloudApp spring.config.activate.on-cloud-platform=kubernetes ---- NOTE: Property file separators must not have any leading whitespace and must have exactly three hyphen characters. The lines immediately before and after the separator must not be comments. TIP: Multi-document property files are often used in conjunction with activation properties such as `spring.config.activate.on-profile`. See the <<features#features.external-config.files.activation-properties, next section>> for details. WARNING: Multi-document property files cannot be loaded by using the `@PropertySource` or `@TestPropertySource` annotations. [[features.external-config.files.activation-properties]] ==== Activation Properties It is sometimes useful to only activate a given set of properties when certain conditions are met. For example, you might have properties that are only relevant when a specific profile is active. You can conditionally activate a properties document using `spring.config.activate.*`. The following activation properties are available: .activation properties [cols="1,4"] |=== | Property | Note | `on-profile` | A profile expression that must match for the document to be active. | `on-cloud-platform` | The `CloudPlatform` that must be detected for the document to be active. |=== For example, the following specifies that the second document is only active when running on Kubernetes, and only when either the "`prod`" or "`staging`" profiles are active: [source,yaml,indent=0,subs="verbatim",configblocks] ---- myprop: "always-set" --- spring: config: activate: on-cloud-platform: "kubernetes" on-profile: "prod | staging" myotherprop: "sometimes-set" ---- [[features.external-config.encrypting]] === Encrypting Properties Spring Boot does not provide any built in support for encrypting property values, however, it does provide the hook points necessary to modify values contained in the Spring `Environment`. The `EnvironmentPostProcessor` interface allows you to manipulate the `Environment` before the application starts. See <<howto#howto.application.customize-the-environment-or-application-context>> for details. If you need a secure way to store credentials and passwords, the https://cloud.spring.io/spring-cloud-vault/[Spring Cloud Vault] project provides support for storing externalized configuration in https://www.vaultproject.io/[HashiCorp Vault]. [[features.external-config.yaml]] === Working with YAML https://yaml.org[YAML] is a superset of JSON and, as such, is a convenient format for specifying hierarchical configuration data. The `SpringApplication` class automatically supports YAML as an alternative to properties whenever you have the https://bitbucket.org/asomov/snakeyaml[SnakeYAML] library on your classpath. NOTE: If you use "`Starters`", SnakeYAML is automatically provided by `spring-boot-starter`. [[features.external-config.yaml.mapping-to-properties]] ==== Mapping YAML to Properties YAML documents need to be converted from their hierarchical format to a flat structure that can be used with the Spring `Environment`. For example, consider the following YAML document: [source,yaml,indent=0,subs="verbatim"] ---- environments: dev: url: "https://dev.example.com" name: "Developer Setup" prod: url: "https://another.example.com" name: "My Cool App" ---- In order to access these properties from the `Environment`, they would be flattened as follows: [source,properties,indent=0,subs="verbatim"] ---- environments.dev.url=https://dev.example.com environments.dev.name=Developer Setup environments.prod.url=https://another.example.com environments.prod.name=My Cool App ---- Likewise, YAML lists also need to be flattened. They are represented as property keys with `[index]` dereferencers. For example, consider the following YAML: [source,yaml,indent=0,subs="verbatim"] ---- my: servers: - "dev.example.com" - "another.example.com" ---- The preceding example would be transformed into these properties: [source,properties,indent=0,subs="verbatim"] ---- my.servers[0]=dev.example.com my.servers[1]=another.example.com ---- TIP: Properties that use the `[index]` notation can be bound to Java `List` or `Set` objects using Spring Boot's `Binder` class. For more details see the "`<<features#features.external-config.typesafe-configuration-properties>>`" section below. WARNING: YAML files cannot be loaded by using the `@PropertySource` or `@TestPropertySource` annotations. So, in the case that you need to load values that way, you need to use a properties file. [[features.external-config.yaml.directly-loading]] [[features.external-config.yaml.directly-loading]] ==== Directly Loading YAML Spring Framework provides two convenient classes that can be used to load YAML documents. The `YamlPropertiesFactoryBean` loads YAML as `Properties` and the `YamlMapFactoryBean` loads YAML as a `Map`. You can also use the `YamlPropertySourceLoader` class if you want to load YAML as a Spring `PropertySource`. [[features.external-config.random-values]] === Configuring Random Values The `RandomValuePropertySource` is useful for injecting random values (for example, into secrets or test cases). It can produce integers, longs, uuids, or strings, as shown in the following example: [source,yaml,indent=0,subs="verbatim",configblocks] ---- my: secret: "${random.value}" number: "${random.int}" bignumber: "${random.long}" uuid: "${random.uuid}" number-less-than-ten: "${random.int(10)}" number-in-range: "${random.int[1024,65536]}" ---- The `+random.int*+` syntax is `OPEN value (,max) CLOSE` where the `OPEN,CLOSE` are any character and `value,max` are integers. If `max` is provided, then `value` is the minimum value and `max` is the maximum value (exclusive). [[features.external-config.system-environment]] === Configuring System Environment Properties Spring Boot supports setting a prefix for environment properties. This is useful if the system environment is shared by multiple Spring Boot applications with different configuration requirements. The prefix for system environment properties can be set directly on `SpringApplication`. For example, if you set the prefix to `input`, a property such as `remote.timeout` will also be resolved as `input.remote.timeout` in the system environment. [[features.external-config.typesafe-configuration-properties]] === Type-safe Configuration Properties Using the `@Value("$\{property}")` annotation to inject configuration properties can sometimes be cumbersome, especially if you are working with multiple properties or your data is hierarchical in nature. Spring Boot provides an alternative method of working with properties that lets strongly typed beans govern and validate the configuration of your application. TIP: See also the <<features#features.external-config.typesafe-configuration-properties.vs-value-annotation,differences between `@Value` and type-safe configuration properties>>. [[features.external-config.typesafe-configuration-properties.java-bean-binding]] ==== JavaBean properties binding It is possible to bind a bean declaring standard JavaBean properties as shown in the following example: [source,java,indent=0,subs="verbatim"] ---- include::{docs-java}/features/externalconfig/typesafeconfigurationproperties/javabeanbinding/MyProperties.java[] ---- The preceding POJO defines the following properties: * `my.service.enabled`, with a value of `false` by default. * `my.service.remote-address`, with a type that can be coerced from `String`. * `my.service.security.username`, with a nested "security" object whose name is determined by the name of the property. In particular, the type is not used at all there and could have been `SecurityProperties`. * `my.service.security.password`. * `my.service.security.roles`, with a collection of `String` that defaults to `USER`. NOTE: The properties that map to `@ConfigurationProperties` classes available in Spring Boot, which are configured through properties files, YAML files, environment variables, and other mechanisms, are public API but the accessors (getters/setters) of the class itself are not meant to be used directly. [NOTE] ==== Such arrangement relies on a default empty constructor and getters and setters are usually mandatory, since binding is through standard Java Beans property descriptors, just like in Spring MVC. A setter may be omitted in the following cases: * Maps, as long as they are initialized, need a getter but not necessarily a setter, since they can be mutated by the binder. * Collections and arrays can be accessed either through an index (typically with YAML) or by using a single comma-separated value (properties). In the latter case, a setter is mandatory. We recommend to always add a setter for such types. If you initialize a collection, make sure it is not immutable (as in the preceding example). * If nested POJO properties are initialized (like the `Security` field in the preceding example), a setter is not required. If you want the binder to create the instance on the fly by using its default constructor, you need a setter. Some people use Project Lombok to add getters and setters automatically. Make sure that Lombok does not generate any particular constructor for such a type, as it is used automatically by the container to instantiate the object. Finally, only standard Java Bean properties are considered and binding on static properties is not supported. ==== [[features.external-config.typesafe-configuration-properties.constructor-binding]] ==== Constructor binding The example in the previous section can be rewritten in an immutable fashion as shown in the following example: [source,java,indent=0,subs="verbatim"] ---- include::{docs-java}/features/externalconfig/typesafeconfigurationproperties/constructorbinding/MyProperties.java[] ---- In this setup, the `@ConstructorBinding` annotation is used to indicate that constructor binding should be used. This means that the binder will expect to find a constructor with the parameters that you wish to have bound. If you are using Java 16 or later, constructor binding can be used with records. In this case, unless your record has multiple constructors, there is no need to use `@ConstructorBinding`. Nested members of a `@ConstructorBinding` class (such as `Security` in the example above) will also be bound through their constructor. Default values can be specified using `@DefaultValue` and the same conversion service will be applied to coerce the `String` value to the target type of a missing property. By default, if no properties are bound to `Security`, the `MyProperties` instance will contain a `null` value for `security`. If you wish you return a non-null instance of `Security` even when no properties are bound to it, you can use an empty `@DefaultValue` annotation to do so: [source,java,indent=0,subs="verbatim"] ---- include::{docs-java}/features/externalconfig/typesafeconfigurationproperties/constructorbinding/nonnull/MyProperties.java[tag=*] ---- NOTE: To use constructor binding the class must be enabled using `@EnableConfigurationProperties` or configuration property scanning. You cannot use constructor binding with beans that are created by the regular Spring mechanisms (for example `@Component` beans, beans created by using `@Bean` methods or beans loaded by using `@Import`) TIP: If you have more than one constructor for your class you can also use `@ConstructorBinding` directly on the constructor that should be bound. NOTE: The use of `java.util.Optional` with `@ConfigurationProperties` is not recommended as it is primarily intended for use as a return type. As such, it is not well-suited to configuration property injection. For consistency with properties of other types, if you do declare an `Optional` property and it has no value, `null` rather than an empty `Optional` will be bound. [[features.external-config.typesafe-configuration-properties.enabling-annotated-types]] ==== Enabling @ConfigurationProperties-annotated types Spring Boot provides infrastructure to bind `@ConfigurationProperties` types and register them as beans. You can either enable configuration properties on a class-by-class basis or enable configuration property scanning that works in a similar manner to component scanning. Sometimes, classes annotated with `@ConfigurationProperties` might not be suitable for scanning, for example, if you're developing your own auto-configuration or you want to enable them conditionally. In these cases, specify the list of types to process using the `@EnableConfigurationProperties` annotation. This can be done on any `@Configuration` class, as shown in the following example: [source,java,indent=0,subs="verbatim"] ---- include::{docs-java}/features/externalconfig/typesafeconfigurationproperties/enablingannotatedtypes/MyConfiguration.java[] ---- To use configuration property scanning, add the `@ConfigurationPropertiesScan` annotation to your application. Typically, it is added to the main application class that is annotated with `@SpringBootApplication` but it can be added to any `@Configuration` class. By default, scanning will occur from the package of the class that declares the annotation. If you want to define specific packages to scan, you can do so as shown in the following example: [source,java,indent=0,subs="verbatim"] ---- include::{docs-java}/features/externalconfig/typesafeconfigurationproperties/enablingannotatedtypes/MyApplication.java[] ---- [NOTE] ==== When the `@ConfigurationProperties` bean is registered using configuration property scanning or through `@EnableConfigurationProperties`, the bean has a conventional name: `<prefix>-<fqn>`, where `<prefix>` is the environment key prefix specified in the `@ConfigurationProperties` annotation and `<fqn>` is the fully qualified name of the bean. If the annotation does not provide any prefix, only the fully qualified name of the bean is used. The bean name in the example above is `com.example.app-com.example.app.SomeProperties`. ==== We recommend that `@ConfigurationProperties` only deal with the environment and, in particular, does not inject other beans from the context. For corner cases, setter injection can be used or any of the `*Aware` interfaces provided by the framework (such as `EnvironmentAware` if you need access to the `Environment`). If you still want to inject other beans using the constructor, the configuration properties bean must be annotated with `@Component` and use JavaBean-based property binding. [[features.external-config.typesafe-configuration-properties.using-annotated-types]] ==== Using @ConfigurationProperties-annotated types This style of configuration works particularly well with the `SpringApplication` external YAML configuration, as shown in the following example: [source,yaml,indent=0,subs="verbatim"] ---- my: service: remote-address: 192.168.1.1 security: username: "admin" roles: - "USER" - "ADMIN" ---- To work with `@ConfigurationProperties` beans, you can inject them in the same way as any other bean, as shown in the following example: [source,java,indent=0,subs="verbatim"] ---- include::{docs-java}/features/externalconfig/typesafeconfigurationproperties/usingannotatedtypes/MyService.java[] ---- TIP: Using `@ConfigurationProperties` also lets you generate metadata files that can be used by IDEs to offer auto-completion for your own keys. See the <<configuration-metadata#configuration-metadata,appendix>> for details. [[features.external-config.typesafe-configuration-properties.third-party-configuration]] ==== Third-party Configuration As well as using `@ConfigurationProperties` to annotate a class, you can also use it on public `@Bean` methods. Doing so can be particularly useful when you want to bind properties to third-party components that are outside of your control. To configure a bean from the `Environment` properties, add `@ConfigurationProperties` to its bean registration, as shown in the following example: [source,java,indent=0,subs="verbatim"] ---- include::{docs-java}/features/externalconfig/typesafeconfigurationproperties/thirdpartyconfiguration/ThirdPartyConfiguration.java[] ---- Any JavaBean property defined with the `another` prefix is mapped onto that `AnotherComponent` bean in manner similar to the preceding `SomeProperties` example. [[features.external-config.typesafe-configuration-properties.relaxed-binding]] ==== Relaxed Binding Spring Boot uses some relaxed rules for binding `Environment` properties to `@ConfigurationProperties` beans, so there does not need to be an exact match between the `Environment` property name and the bean property name. Common examples where this is useful include dash-separated environment properties (for example, `context-path` binds to `contextPath`), and capitalized environment properties (for example, `PORT` binds to `port`). As an example, consider the following `@ConfigurationProperties` class: [source,java,indent=0,subs="verbatim"] ---- include::{docs-java}/features/externalconfig/typesafeconfigurationproperties/relaxedbinding/MyPersonProperties.java[] ---- With the preceding code, the following properties names can all be used: .relaxed binding [cols="1,4"] |=== | Property | Note | `my.main-project.person.first-name` | Kebab case, which is recommended for use in `.properties` and `.yml` files. | `my.main-project.person.firstName` | Standard camel case syntax. | `my.main-project.person.first_name` | Underscore notation, which is an alternative format for use in `.properties` and `.yml` files. | `MY_MAINPROJECT_PERSON_FIRSTNAME` | Upper case format, which is recommended when using system environment variables. |=== NOTE: The `prefix` value for the annotation _must_ be in kebab case (lowercase and separated by `-`, such as `my.main-project.person`). .relaxed binding rules per property source [cols="2,4,4"] |=== | Property Source | Simple | List | Properties Files | Camel case, kebab case, or underscore notation | Standard list syntax using `[ ]` or comma-separated values | YAML Files | Camel case, kebab case, or underscore notation | Standard YAML list syntax or comma-separated values | Environment Variables | Upper case format with underscore as the delimiter (see <<features#features.external-config.typesafe-configuration-properties.relaxed-binding.environment-variables>>). | Numeric values surrounded by underscores (see <<features#features.external-config.typesafe-configuration-properties.relaxed-binding.environment-variables>>) | System properties | Camel case, kebab case, or underscore notation | Standard list syntax using `[ ]` or comma-separated values |=== TIP: We recommend that, when possible, properties are stored in lower-case kebab format, such as `my.person.first-name=Rod`. [[features.external-config.typesafe-configuration-properties.relaxed-binding.maps]] ===== Binding Maps When binding to `Map` properties you may need to use a special bracket notation so that the original `key` value is preserved. If the key is not surrounded by `[]`, any characters that are not alpha-numeric, `-` or `.` are removed. For example, consider binding the following properties to a `Map<String,String>`: [source,properties,indent=0,subs="verbatim",role="primary"] .Properties ---- my.map.[/key1]=value1 my.map.[/key2]=value2 my.map./key3=value3 ---- [source,yaml,indent=0,subs="verbatim",role="secondary"] .Yaml ---- my: map: "[/key1]": "value1" "[/key2]": "value2" "/key3": "value3" ---- NOTE: For YAML files, the brackets need to be surrounded by quotes for the keys to be parsed properly. The properties above will bind to a `Map` with `/key1`, `/key2` and `key3` as the keys in the map. The slash has been removed from `key3` because it was not surrounded by square brackets. You may also occasionally need to use the bracket notation if your `key` contains a `.` and you are binding to non-scalar value. For example, binding `a.b=c` to `Map<String, Object>` will return a Map with the entry `{"a"={"b"="c"}}` whereas `[a.b]=c` will return a Map with the entry `{"a.b"="c"}`. [[features.external-config.typesafe-configuration-properties.relaxed-binding.environment-variables]] ===== Binding from Environment Variables Most operating systems impose strict rules around the names that can be used for environment variables. For example, Linux shell variables can contain only letters (`a` to `z` or `A` to `Z`), numbers (`0` to `9`) or the underscore character (`_`). By convention, Unix shell variables will also have their names in UPPERCASE. Spring Boot's relaxed binding rules are, as much as possible, designed to be compatible with these naming restrictions. To convert a property name in the canonical-form to an environment variable name you can follow these rules: * Replace dots (`.`) with underscores (`_`). * Remove any dashes (`-`). * Convert to uppercase. For example, the configuration property `spring.main.log-startup-info` would be an environment variable named `SPRING_MAIN_LOGSTARTUPINFO`. Environment variables can also be used when binding to object lists. To bind to a `List`, the element number should be surrounded with underscores in the variable name. For example, the configuration property `my.service[0].other` would use an environment variable named `MY_SERVICE_0_OTHER`. [[features.external-config.typesafe-configuration-properties.merging-complex-types]] ==== Merging Complex Types When lists are configured in more than one place, overriding works by replacing the entire list. For example, assume a `MyPojo` object with `name` and `description` attributes that are `null` by default. The following example exposes a list of `MyPojo` objects from `MyProperties`: [source,java,indent=0,subs="verbatim"] ---- include::{docs-java}/features/externalconfig/typesafeconfigurationproperties/mergingcomplextypes/list/MyProperties.java[] ---- Consider the following configuration: [source,yaml,indent=0,subs="verbatim",configblocks] ---- my: list: - name: "my name" description: "my description" --- spring: config: activate: on-profile: "dev" my: list: - name: "my another name" ---- If the `dev` profile is not active, `MyProperties.list` contains one `MyPojo` entry, as previously defined. If the `dev` profile is enabled, however, the `list` _still_ contains only one entry (with a name of `my another name` and a description of `null`). This configuration _does not_ add a second `MyPojo` instance to the list, and it does not merge the items. When a `List` is specified in multiple profiles, the one with the highest priority (and only that one) is used. Consider the following example: [source,yaml,indent=0,subs="verbatim",configblocks] ---- my: list: - name: "my name" description: "my description" - name: "another name" description: "another description" --- spring: config: activate: on-profile: "dev" my: list: - name: "my another name" ---- In the preceding example, if the `dev` profile is active, `MyProperties.list` contains _one_ `MyPojo` entry (with a name of `my another name` and a description of `null`). For YAML, both comma-separated lists and YAML lists can be used for completely overriding the contents of the list. For `Map` properties, you can bind with property values drawn from multiple sources. However, for the same property in multiple sources, the one with the highest priority is used. The following example exposes a `Map<String, MyPojo>` from `MyProperties`: [source,java,indent=0,subs="verbatim"] ---- include::{docs-java}/features/externalconfig/typesafeconfigurationproperties/mergingcomplextypes/map/MyProperties.java[] ---- Consider the following configuration: [source,yaml,indent=0,subs="verbatim",configblocks] ---- my: map: key1: name: "my name 1" description: "my description 1" --- spring: config: activate: on-profile: "dev" my: map: key1: name: "dev name 1" key2: name: "dev name 2" description: "dev description 2" ---- If the `dev` profile is not active, `MyProperties.map` contains one entry with key `key1` (with a name of `my name 1` and a description of `my description 1`). If the `dev` profile is enabled, however, `map` contains two entries with keys `key1` (with a name of `dev name 1` and a description of `my description 1`) and `key2` (with a name of `dev name 2` and a description of `dev description 2`). NOTE: The preceding merging rules apply to properties from all property sources, and not just files. [[features.external-config.typesafe-configuration-properties.conversion]] ==== Properties Conversion Spring Boot attempts to coerce the external application properties to the right type when it binds to the `@ConfigurationProperties` beans. If you need custom type conversion, you can provide a `ConversionService` bean (with a bean named `conversionService`) or custom property editors (through a `CustomEditorConfigurer` bean) or custom `Converters` (with bean definitions annotated as `@ConfigurationPropertiesBinding`). NOTE: As this bean is requested very early during the application lifecycle, make sure to limit the dependencies that your `ConversionService` is using. Typically, any dependency that you require may not be fully initialized at creation time. You may want to rename your custom `ConversionService` if it is not required for configuration keys coercion and only rely on custom converters qualified with `@ConfigurationPropertiesBinding`. [[features.external-config.typesafe-configuration-properties.conversion.durations]] ===== Converting Durations Spring Boot has dedicated support for expressing durations. If you expose a `java.time.Duration` property, the following formats in application properties are available: * A regular `long` representation (using milliseconds as the default unit unless a `@DurationUnit` has been specified) * The standard ISO-8601 format {java-api}/java/time/Duration.html#parse-java.lang.CharSequence-[used by `java.time.Duration`] * A more readable format where the value and the unit are coupled (`10s` means 10 seconds) Consider the following example: [source,java,indent=0,subs="verbatim"] ---- include::{docs-java}/features/externalconfig/typesafeconfigurationproperties/conversion/durations/javabeanbinding/MyProperties.java[] ---- To specify a session timeout of 30 seconds, `30`, `PT30S` and `30s` are all equivalent. A read timeout of 500ms can be specified in any of the following form: `500`, `PT0.5S` and `500ms`. You can also use any of the supported units. These are: * `ns` for nanoseconds * `us` for microseconds * `ms` for milliseconds * `s` for seconds * `m` for minutes * `h` for hours * `d` for days The default unit is milliseconds and can be overridden using `@DurationUnit` as illustrated in the sample above. If you prefer to use constructor binding, the same properties can be exposed, as shown in the following example: [source,java,indent=0,subs="verbatim"] ---- include::{docs-java}/features/externalconfig/typesafeconfigurationproperties/conversion/durations/constructorbinding/MyProperties.java[] ---- TIP: If you are upgrading a `Long` property, make sure to define the unit (using `@DurationUnit`) if it is not milliseconds. Doing so gives a transparent upgrade path while supporting a much richer format. [[features.external-config.typesafe-configuration-properties.conversion.periods]] ===== Converting periods In addition to durations, Spring Boot can also work with `java.time.Period` type. The following formats can be used in application properties: * An regular `int` representation (using days as the default unit unless a `@PeriodUnit` has been specified) * The standard ISO-8601 format {java-api}/java/time/Period.html#parse-java.lang.CharSequence-[used by `java.time.Period`] * A simpler format where the value and the unit pairs are coupled (`1y3d` means 1 year and 3 days) The following units are supported with the simple format: * `y` for years * `m` for months * `w` for weeks * `d` for days NOTE: The `java.time.Period` type never actually stores the number of weeks, it is a shortcut that means "`7 days`". [[features.external-config.typesafe-configuration-properties.conversion.data-sizes]] ===== Converting Data Sizes Spring Framework has a `DataSize` value type that expresses a size in bytes. If you expose a `DataSize` property, the following formats in application properties are available: * A regular `long` representation (using bytes as the default unit unless a `@DataSizeUnit` has been specified) * A more readable format where the value and the unit are coupled (`10MB` means 10 megabytes) Consider the following example: [source,java,indent=0,subs="verbatim"] ---- include::{docs-java}/features/externalconfig/typesafeconfigurationproperties/conversion/datasizes/javabeanbinding/MyProperties.java[] ---- To specify a buffer size of 10 megabytes, `10` and `10MB` are equivalent. A size threshold of 256 bytes can be specified as `256` or `256B`. You can also use any of the supported units. These are: * `B` for bytes * `KB` for kilobytes * `MB` for megabytes * `GB` for gigabytes * `TB` for terabytes The default unit is bytes and can be overridden using `@DataSizeUnit` as illustrated in the sample above. If you prefer to use constructor binding, the same properties can be exposed, as shown in the following example: [source,java,indent=0,subs="verbatim"] ---- include::{docs-java}/features/externalconfig/typesafeconfigurationproperties/conversion/datasizes/constructorbinding/MyProperties.java[] ---- TIP: If you are upgrading a `Long` property, make sure to define the unit (using `@DataSizeUnit`) if it is not bytes. Doing so gives a transparent upgrade path while supporting a much richer format. [[features.external-config.typesafe-configuration-properties.validation]] ==== @ConfigurationProperties Validation Spring Boot attempts to validate `@ConfigurationProperties` classes whenever they are annotated with Spring's `@Validated` annotation. You can use JSR-303 `javax.validation` constraint annotations directly on your configuration class. To do so, ensure that a compliant JSR-303 implementation is on your classpath and then add constraint annotations to your fields, as shown in the following example: [source,java,indent=0,subs="verbatim"] ---- include::{docs-java}/features/externalconfig/typesafeconfigurationproperties/validate/MyProperties.java[] ---- TIP: You can also trigger validation by annotating the `@Bean` method that creates the configuration properties with `@Validated`. To ensure that validation is always triggered for nested properties, even when no properties are found, the associated field must be annotated with `@Valid`. The following example builds on the preceding `MyProperties` example: [source,java,indent=0,subs="verbatim"] ---- include::{docs-java}/features/externalconfig/typesafeconfigurationproperties/validate/nested/MyProperties.java[] ---- You can also add a custom Spring `Validator` by creating a bean definition called `configurationPropertiesValidator`. The `@Bean` method should be declared `static`. The configuration properties validator is created very early in the application's lifecycle, and declaring the `@Bean` method as static lets the bean be created without having to instantiate the `@Configuration` class. Doing so avoids any problems that may be caused by early instantiation. TIP: The `spring-boot-actuator` module includes an endpoint that exposes all `@ConfigurationProperties` beans. Point your web browser to `/actuator/configprops` or use the equivalent JMX endpoint. See the "<<actuator#actuator.endpoints, Production ready features>>" section for details. [[features.external-config.typesafe-configuration-properties.vs-value-annotation]] ==== @ConfigurationProperties vs. @Value The `@Value` annotation is a core container feature, and it does not provide the same features as type-safe configuration properties. The following table summarizes the features that are supported by `@ConfigurationProperties` and `@Value`: [cols="4,2,2"] |=== | Feature |`@ConfigurationProperties` |`@Value` | <<features#features.external-config.typesafe-configuration-properties.relaxed-binding,Relaxed binding>> | Yes | Limited (see <<features#features.external-config.typesafe-configuration-properties.vs-value-annotation.note,note below>>) | <<configuration-metadata#configuration-metadata,Meta-data support>> | Yes | No | `SpEL` evaluation | No | Yes |=== [[features.external-config.typesafe-configuration-properties.vs-value-annotation.note]] NOTE: If you do want to use `@Value`, we recommend that you refer to property names using their canonical form (kebab-case using only lowercase letters). This will allow Spring Boot to use the same logic as it does when relaxed binding `@ConfigurationProperties`. For example, `@Value("{demo.item-price}")` will pick up `demo.item-price` and `demo.itemPrice` forms from the `application.properties` file, as well as `DEMO_ITEMPRICE` from the system environment. If you used `@Value("{demo.itemPrice}")` instead, `demo.item-price` and `DEMO_ITEMPRICE` would not be considered. If you define a set of configuration keys for your own components, we recommend you group them in a POJO annotated with `@ConfigurationProperties`. Doing so will provide you with structured, type-safe object that you can inject into your own beans. `SpEL` expressions from <<features#features.external-config.files,application property files>> are not processed at time of parsing these files and populating the environment. However, it is possible to write a `SpEL` expression in `@Value`. If the value of a property from an application property file is a `SpEL` expression, it will be evaluated when consumed through `@Value`.
AsciiDoc
5
techAi007/spring-boot
spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/external-config.adoc
[ "Apache-2.0" ]
/* Copyright 2017-present Palantir Technologies, Inc. All rights reserved. Licensed under the Apache License, Version 2.0. */ @import "font-imports"; @import "icons";
SCSS
0
phungtuanhoang1996/blueprint
packages/icons/src/blueprint-icons.scss
[ "Apache-2.0" ]
#lang scribble/manual @(require (for-label racket/base racket/gui/base racket/contract br br/indent)) @(require scribble/eval) @(define my-eval (make-base-eval)) @(my-eval `(require br racket/stxparam (for-syntax br br/define))) @title[#:style 'toc]{Beautiful Racket} @author[(author+email "Matthew Butterick" "mb@mbtype.com")] @link["http://beautifulracket.com"]{@italic{Beautiful Racket}} is a book about making programming languages with Racket. This library provides the @tt{#lang br} teaching language used in the book, as well as supporting modules that can be used in other programs. This library is designed to smooth over some of the small idiosyncrasies and inconsistencies in Racket, so that those new to Racket are more likely to say ``ah, that makes sense'' rather than ``huh? what?'' @section{Installation} If you want all the code & documentation, install the package @racket[beautiful-racket]. If you just want the code modules (for instance, for use as a dependency in another project) install the package @racket[beautiful-racket-lib]. If you just want the @racketmodname[br/macro] and @racketmodname[br/syntax] modules, install the package @racket[beautiful-racket-macro]. @section{Conditionals} @defmodule[br/cond] @defform[(while cond body ...)]{ Loop over @racket[body] as long as @racket[cond] is not @racket[#f]. If @racket[cond] starts out @racket[#f], @racket[body] is never evaluated. @examples[#:eval my-eval (let ([x 42]) (while (positive? x) (set! x (- x 1))) x) (let ([x 42]) (while (negative? x) (unleash-zombie-army)) x) ] } @defform[(until cond body ...)]{ Loop over @racket[body] until @racket[cond] is not @racket[#f]. If @racket[cond] starts out not @racket[#f], @racket[body] is never evaluated. @examples[#:eval my-eval (let ([x 42]) (until (zero? x) (set! x (- x 1))) x) (let ([x 42]) (until (= 42 x) (destroy-galaxy)) x) ] } @section{Datums} @defmodule[br/datum] A @defterm{datum} is a literal representation of a single unit of Racket code, also known as an @defterm{S-expression}. Unlike a string, a datum preserves the internal structure of the S-expression. Meaning, if the S-expression is a single value, or list-shaped, or tree-shaped, so is its corresponding datum. Datums are made with @racket[quote] or its equivalent notation, the @litchar{'} prefix (see @secref["quote" #:doc '(lib "scribblings/guide/guide.scrbl")]). When I use ``datum'' in its specific Racket sense, I use ``datums'' as its plural rather than ``data'' because that term has an existing, more generic meaning. @defproc[ (format-datum [datum-form datum?] [val any/c?] ...) (or/c datum? void?)]{ Similar to @racket[format], but the template @racket[datum-form] is a datum, rather than a string, and the function returns a datum, rather than a string. Otherwise, the same formatting escapes can be used in the template (see @racket[fprintf]). Two special cases. First, a string that describes a list of datums is parenthesized so the result is a single datum. Second, an empty string returns @racket[void] (not @racket[#f], because that's a legitimate datum). @examples[#:eval my-eval (format-datum '42) (format-datum '~a "foo") (format-datum '(~a ~a) "foo" 42) (format-datum '~a "foo bar zam") (void? (format-datum '~a "")) (format-datum '~a #f) ] } @defproc[ (format-datums [datum-form (or/c list? symbol?)] [vals (listof any/c?)] ...) (listof (or/c list? symbol?))]{ Like @racket[format-datum], but applies @racket[datum-form] to the lists of @racket[vals] in similar way to @racket[map], where values for the format string are taken from the lists of @racket[vals] in parallel. This means that a) @racket[datum-form] must accept as many arguments as there are lists of @racket[vals], and b) the lists of @racket[vals] must all have the same number of items. @examples[#:eval my-eval (format-datums '~a '("foo" "bar" "zam")) (format-datums '(~a 42) '("foo" "bar" "zam")) (format-datums '(~a ~a) '("foo" "bar" "zam") '(42 43 44)) (format-datums '42 '("foo" "bar" "zam")) (format-datums '(~a ~a) '("foo" "bar" "zam") '(42)) ] } @defproc[(datum? [x any/c]) boolean?]{ Return @racket[#t] if @racket[x] is a @racket[list?] or a @racket[symbol?]. @examples[#:eval my-eval (datum? '(a b c d e f)) (datum? 'a) (datum? "a") ] } @section{Debugging} @defmodule[br/debug] @defform*[[ (report expr) (report expr maybe-name) ]]{ Print the name and value of @racket[expr] to @racket[current-error-port], but also return the evaluated result of @racket[expr] as usual. This lets you see the value of an expression or variable at runtime without disrupting any of the surrounding code. Optionally, you can use @racket[maybe-name] to change the name shown in @racket[current-error-port]. For instance, suppose you wanted to see how @racket[first-condition?] was being evaluted in this expression: @racketblock[ (if (and (first-condition? x) (second-condition? x)) (one-thing) (other-thing))] You can wrap it in @racket[report] and find out: @racketblock[ (if (and (report (first-condition? x)) (second-condition? x)) (one-thing) (other-thing))] This code will run the same way as before. But when it reaches @racket[first-condition?], you willl see in @racket[current-error-port]: @racketerror{(first-condition? x) = #t} You can also add standalone calls to @racket[report] as a debugging aid at points where the return value will be irrelevant, for instance: @racketblock[ (report x x-before-function) (if (and (report (first-condition? x)) (second-condition? x)) (one-thing) (other-thing))] @racketerror{x-before-function = 42 @(linebreak)(first-condition? x) = #t} But be careful — in the example below, the result of the @racket[if] expression will be skipped in favor of the last expression, which will be the value of @racket[x]: @racketblock[ (if (and (report (first-condition? x)) (second-condition? x)) (one-thing) (other-thing)) (report x)] @defform[(report* expr ...)] Apply @racket[report] separately to each @racket[expr] in the list. @defform*[((report-datum stx-expr) (report-datum stx-expr maybe-name))] A variant of @racket[report] for use with @secref["stx-obj" #:doc '(lib "scribblings/guide/guide.scrbl")]. Rather than print the whole object (as @racket[report] would), @racket[report-datum] prints only the datum inside the syntax object, but the return value is the whole syntax object. } @section{Define} @defmodule[br/define] @margin-note{This module also exports the bindings from @racketmodname[br/macro].} @defform[ (define-cases id [pat body ...+] ...+) ] Define a function that behaves differently depending on how many arguments are supplied (also known as @seclink["Evaluation_Order_and_Arity" #:doc '(lib "scribblings/guide/guide.scrbl")]{@italic{arity}}). Like @racket[cond], you can have any number of branches. Each branch starts with a @racket[_pat] that accepts a certain number of arguments. If the current invocation of the function matches the number of arguments in @racket[_pat], then the @racket[_body] on the right-hand side is evaluated. If there is no matching case, an arity error arises. (Derived from @racket[case-lambda], whose notation you might prefer.) @examples[#:eval my-eval (define-cases f [(f arg1) (* arg1 arg1)] [(f arg1 arg2) (* arg1 arg2)] [(f arg1 arg2 arg3 arg4) (* arg1 arg2 arg3 arg4)]) (f 4) (f 6 7) (f 1 2 3 4) (f "three" "arguments" "will-trigger-an-error") (define-cases f2 [(f2) "got zero args"] [(f2 . args) (format "got ~a args" (length args))]) (f2) (f2 6 7) (f2 1 2 3 4) (f2 "three" "arguments" "will-not-trigger-an-error-this-time") ] @section{Macro} @defmodule[br/macro #:packages ("beautiful-racket-lib" "beautiful-racket-macro")] @defform*[ #:literals (syntax lambda stx) [ (define-macro (id pat-arg ...) result-expr ...+) (define-macro id (syntax other-id)) (define-macro id (lambda (arg-id) result-expr ...+)) (define-macro id transformer-id) (define-macro id syntax-object) ]] Create a macro using one of the subforms above, which are explained below: @specsubform[#:literals (define-macro) (define-macro (id pat-arg ...) result-expr ...+)]{ If the first argument is a @seclink["stx-patterns" #:doc '(lib "scribblings/reference/reference.scrbl")]{syntax pattern} starting with @racket[id], then create a syntax transformer for this pattern using @racket[result-expr ...] as the return value. As usual, @racket[result-expr ...] needs to return a @seclink["stx-obj" #:doc '(lib "scribblings/guide/guide.scrbl")]{syntax object} or you'll get an error. The syntax-pattern notation is the same as @racket[syntax-case], with one key difference. If a @racket[pat-arg] has a name written in @tt{CAPS}, it's treated as a named wildcard (meaning, it will match any expression in that position, and can be subsequently referred to by that name). Otherwise, @racket[pat-arg] is treated as a literal (meaning, it will only match the same expression). If @racket[pat-arg] is a literal identifier, it will only match another identifier with the same name @italic{and} the same binding (in other words, identifiers are tested with @racket[free-identifier=?]). For instance, the @racket[sandwich] macro below requires three arguments, and the third must be @racket[please], but the other two are wildcards: @examples[#:eval my-eval (define-macro (sandwich TOPPING FILLING please) #'(format "I love ~a with ~a." 'FILLING 'TOPPING)) (sandwich brie ham) (sandwich brie ham now) (sandwich brie ham please) (sandwich banana bacon please) ] The ellipsis @racket[...] can be used with a wildcard to match a list of arguments. Please note: though a wildcard standing alone must match one argument, once you add an ellipsis, it's allowed to match zero: @examples[#:eval my-eval (define-macro (pizza TOPPING ...) #'(string-join (cons "Waiter!" (list (format "More ~a!" 'TOPPING) ...)) " ")) (pizza mushroom) (pizza mushroom pepperoni) (pizza) ] The capitalization requirement for a wildcard @racket[pat-arg] makes it easy to mix literals and wildcards in one pattern. But it also makes it easy to mistype a pattern and not get the wildcard you were expecting. Below, @racket[bad-squarer] doesn't work because @racket[any-number] is meant to be a wildcard. But it's not in caps, so it's considered a literal, and it triggers an error: @examples[#:eval my-eval (define-macro (bad-squarer any-number) #'(* any-number any-number)) (bad-squarer +10i) ] The error is cleared when the argument is in caps, thus making it a wildcard: @examples[#:eval my-eval (define-macro (good-squarer ANY-NUMBER) #'(* ANY-NUMBER ANY-NUMBER)) (good-squarer +10i) ] You can use the special variable @racket[caller-stx] — available only within the body of @racket[define-macro] — to access the original input argument to the macro. @;{todo: fix this example. complains that caller-stx is unbound} @examples[#:eval my-eval (define-macro (inspect ARG ...) (with-pattern ([CALLER-STX (syntax->datum caller-stx)]) #`(displayln (let ([calling-pattern 'CALLER-STX]) (format "Called as ~a with ~a args" calling-pattern (length (cdr calling-pattern))))))) (inspect) (inspect "foo" "bar") (inspect #t #f #f #t) ] } This subform of @racket[define-macro] is useful for macros that have one calling pattern. To make a macro with multiple calling patterns, see @racket[define-macro-cases]. } @specsubform[#:literals (define-macro syntax lambda stx) (define-macro id (syntax other-id))]{ If the first argument is an identifier @racket[id] and the second a syntaxed identifier that looks like @racket[(syntax other-id)], create a rename transformer, which is a fancy term for ``macro that replaces @racket[id] with @racket[other-id].'' (This subform is equivalent to @racket[make-rename-transformer].) Why do we need rename transformers? Because an ordinary macro operates on its whole calling expression (which it receives as input) like @racket[(macro-name this-arg that-arg . and-so-on)]. By contrast, a rename transformer operates only on the identifier itself (regardless of where that identifier appears in the code). It's like making one identifier into an alias for another identifier. Below, notice how the rename transformer, operating in the macro realm, approximates the behavior of a run-time assignment. @examples[#:eval my-eval (define foo 'foo-value) (define bar foo) bar (define-macro zam-macro #'foo) zam-macro (define add +) (add 20 22) (define-macro sum-macro #'+) (sum-macro 20 22) ] } @specsubform[#:literals (define-macro lambda stx) (define-macro id (lambda (arg-id) result-expr ...+))]{ If the first argument is an @racket[id] and the second a single-argument function, create a macro called @racket[id] that uses the function as a syntax transformer. This function must return a @seclink["stx-obj" #:doc '(lib "scribblings/guide/guide.scrbl")]{syntax object}, otherwise you'll trigger an error. Beyond that, the function can do whatever you like. (This subform is equivalent to @racket[define-syntax].) @examples[#:eval my-eval (define-macro nice-sum (lambda (stx) #'(+ 2 2))) nice-sum (define-macro not-nice (lambda (stx) '(+ 2 2))) not-nice ] } @specsubform[#:literals (define-macro lambda stx) (define-macro id transformer-id)]{ Similar to the previous subform, but @racket[transformer-id] holds an existing transformer function. Note that @racket[transformer-id] needs to be visible during compile time (aka @italic{phase 1}), so use @racket[define-for-syntax] or equivalent. @examples[#:eval my-eval (define-for-syntax summer-compile-time (lambda (stx) #'(+ 2 2))) (define-macro nice-summer summer-compile-time) nice-summer (define summer-run-time (lambda (stx) #'(+ 2 2))) (define-macro not-nice-summer summer-run-time) ] } @specsubform[#:literals (define-macro) (define-macro id syntax-object) #:contracts ([syntax-object syntax?])]{ If the first argument is an @racket[id] and the second a @racket[syntax-object], create a syntax transformer that returns @racket[syntax-object]. This is just alternate notation for the previous subform, wrapping @racket[syntax-object] inside a function body. The effect is to create a macro from @racket[id] that always returns @racket[syntax-object], regardless of how it's invoked. Not especially useful within programs. Mostly handy for making quick macros at the REPL. @examples[#:eval my-eval (define-macro bad-listener #'"what?") bad-listener (bad-listener) (bad-listener "hello") (bad-listener 1 2 3 4) ] } @defform[ (define-macro-cases id [pattern result-expr ...+] ...+) ]{ Create a macro called @racket[id] with multiple branches, each with a @racket[pattern] on the left and @racket[result-expr] on the right. The input to the macro is tested against each @racket[pattern]. If it matches, then @racket[result-expr] is evaluated. As with @racket[define-macro], wildcards in each syntax pattern must be in @tt{CAPS}. Everything else is treated as a literal match, except for the ellipsis @racket[...] and the wildcard @racket[_]. @examples[#:eval my-eval (define-macro-cases yogurt [(yogurt) #'(displayln (format "No toppings? Really?"))] [(yogurt TOPPING) #'(displayln (format "Sure, you can have ~a." 'TOPPING))] [(yogurt TOPPING ANOTHER-TOPPING ... please) #'(displayln (format "Since you asked nicely, you can have ~a toppings." (length '(TOPPING ANOTHER-TOPPING ...))))] [(yogurt TOPPING ANOTHER-TOPPING ...) #'(displayln (format "Whoa! Rude people only get one topping."))]) (yogurt) (yogurt granola) (yogurt coconut almonds hot-fudge brownie-bites please) (yogurt coconut almonds) ] } @defthing[caller-stx syntax?]{ A special variable only available inside the body of @racket[define-macro] or @racket[define-macro-cases]. It contains the whole original syntax object that was passed to the macro. } @defform[ (define-unhygienic-macro (id pat-arg ...) result-expr ...+) ]{ Like @racket[define-macro], but moves @racket[result-expr] into the lexical context of the calling site. For demonstration purposes only. If you really need to write an unhygienic macro, this is a rather blunt instrument. } @section{Syntax} @defmodule[br/syntax #:packages ("beautiful-racket-lib" "beautiful-racket-macro")] @defform[(with-pattern ([pattern stx-expr] ...) body ...+)]{ Bind pattern variables within each @racket[pattern] by matching the pattern to its respective @racket[stx-expr]. These pattern variables can be used in later pattern–expression clauses, or in @racket[body]. Uses the same pattern conventions as @racket[define-macro] (i.e., wildcard variables must be in @tt{CAPS}; everything else is treated as a literal). @examples[#:eval my-eval (define-macro (m ARG) (with-pattern ([(1ST 2ND 3RD) #'ARG] [(LEFT RIGHT) #'2ND]) #'LEFT)) (m ((1 2) (3 4) (5 6))) ] } @defform[(pattern-case stx ([pattern result-expr ...+] ...))]{ Like @racket[case], but for syntax patterns. Attempt to match @racket[stx] to each successive syntax @racket[pattern]. If a match is found, evaluate the @racket[result-expr] on the right. Uses the same pattern conventions as @racket[define-macro] (i.e., wildcard variables must be in @tt{CAPS}; everything else is treated as a literal). If no match is found a syntax error is raised. @examples[#:eval my-eval (define (pc stx) (pattern-case stx [(1ST 2ND 3RD) #'2ND] [(LEFT RIGHT) #'LEFT])) (pc #'(a b c)) (pc #'(x y)) (pc #'(f)) ] } @defform[(pattern-case-filter stxs ([pattern result-expr ...+] ...))]{ Attempt to match each element of @racket[stxs] (which is either a list of syntax objects, or a syntaxed list) to each successive syntax @racket[pattern]. Uses the same pattern conventions as @racket[define-macro] (i.e., wildcard variables must be in @tt{CAPS}; everything else is treated as a literal). If a match is found, evaluate the @racket[result-expr] on the right. If @racket[result-expr] is @racket[#f], or no match is found, then the element is skipped. The result is a list of syntax objects. @examples[#:eval my-eval (pattern-case-filter #'((a b c) (x y) (f)) [(1ST 2ND 3RD) #'2ND] [(LEFT RIGHT) #'LEFT]) ] } @defproc[ (prefix-id [prefix (or string? symbol?)] ... [id-or-ids (or/c identifier? (listof identifier?))] [#:source loc-stx syntax? #f] [#:context ctxt-stx syntax? #f]) (or/c identifier? (listof identifier?))]{ Create a new identifier within the lexical context of @racket[id-or-ids] with the same name, but prefixed with @racket[prefix]. If there's more than one @racket[prefix] argument, they are concatenated. If @racket[id-or-ids] is a single identifier, then the function returns a single identifier. Likewise, if it's a list of identifiers, the function returns a list of identifiers, all prefixed. The optional @racket[loc-stx] argument supplies the source location for the resulting identifier (or identifiers). The optional @racket[ctxt-stx] argument supplies the lexical context for the resulting identifier (or identifiers). @examples[#:eval my-eval (define-macro ($-define ID VAL) (with-pattern ([PREFIXED-ID (prefix-id '$ #'ID)]) #'(define PREFIXED-ID VAL))) ($-define foo 42) $foo ] } @defproc[ (suffix-id [id-or-ids (or/c identifier? (listof identifier?))] [suffix (or string? symbol?)] ... [#:source loc-stx syntax? #f] [#:context ctxt-stx syntax? #f]) (or/c identifier? (listof identifier?))]{ Create a new identifier within the lexical context of @racket[id-or-ids] with the same name, but suffixed with @racket[suffix]. If there's more than one @racket[suffix] argument, they are concatenated. If @racket[id-or-ids] is a single identifier, then the function returns a single identifier. Likewise, if it's a list of identifiers, the function returns a list of identifiers, all suffixed. The optional @racket[loc-stx] argument supplies the source location for the resulting identifier (or identifiers). The optional @racket[ctxt-stx] argument supplies the lexical context for the resulting identifier (or identifiers). @examples[#:eval my-eval (define-macro (define-% ID VAL) (with-pattern ([ID-SUFFIXED (suffix-id #'ID '%)]) #'(define ID-SUFFIXED VAL))) (define-% foo 42) foo% ] } @defproc[ (infix-id [prefix (or string? symbol?)] [id-or-ids (or/c identifier? (listof identifier?))] [suffix (or string? symbol?)] ... [#:source loc-stx syntax? #f] [#:context ctxt-stx syntax? #f]) (or/c identifier? (listof identifier?))]{ Create a new identifier within the lexical context of @racket[id-or-ids] with the same name, but prefixed with @racket[prefix] and suffixed with @racket[suffix]. If there's more than one @racket[suffix] argument, they are concatenated. If @racket[id-or-ids] is a single identifier, then the function returns a single identifier. Likewise, if it's a list of identifiers, the function returns a list of identifiers, all suffixed. The optional @racket[loc-stx] argument supplies the source location for the resulting identifier (or identifiers). The optional @racket[ctxt-stx] argument supplies the lexical context for the resulting identifier (or identifiers). @examples[#:eval my-eval (define-macro ($-define-% ID VAL) (with-pattern ([ID-INFIXED (infix-id '$ #'ID '%)]) #'(define ID-INFIXED VAL))) ($-define-% foo 42) $foo% ] } @(require (for-label syntax/strip-context)) @defproc[(strip-bindings [stx syntax?]) syntax?]{ Removes all bindings from @racket[stx], but preserves source-location information and properties. An alias for @racket[strip-context].} @defproc[(replace-bindings [stx-source (or/c syntax? #f)] [stx-target syntax?]) syntax?]{ Uses the bindings from @racket[stx-source] to replace the bindings of all parts of @racket[stx-target], while preserving source-location information and properties. An alias for @racket[replace-context].} @defproc[ (stx-flatten [stx syntax?]) (listof syntax?)]{ Converts a hierarchical syntax object into a flat list of component syntax objects, discarding all the intervening structure. Useful when you need to get at the ``bottommost'' syntax objects. @examples[#:eval my-eval (define my-stx #'(let ([x 42] [y 25]) (define (f z) (* x y z)) (displayln (f 11)))) (map syntax->datum (stx-flatten my-stx)) ] } @section{Indentation} @defmodule[br/indent] Helper functions for DrRacket language indenters. @defproc[(char [textbox (is-a?/c text%)] [position (or/c exact-nonnegative-integer? #f)]) (or/c char? #f)]{ Get the character in @racket[textbox] that lives at @racket[position]. @;{ can't get this example to work without racket/gui/base instantiation error @examples[#:eval my-eval (define tb (new text%)) (send tb insert "foobar") (char tb 4) ] } } @defproc[(line [textbox (is-a?/c text%)] [position (or/c exact-nonnegative-integer? #f)]) exact-nonnegative-integer?]{ Get the line index in @racket[textbox] that contains @racket[position]. } @defproc[(previous-line [textbox (is-a?/c text%)] [position (or/c exact-nonnegative-integer? #f)]) (or/c exact-nonnegative-integer? #f)]{ Get the line index in @racket[textbox] of the line before the one that contains @racket[position]. } @defproc[(next-line [textbox (is-a?/c text%)] [position (or/c exact-nonnegative-integer? #f)]) (or/c exact-nonnegative-integer? #f)]{ Get the line index in @racket[textbox] of the line after the one that contains @racket[position]. } @defproc[(line-chars [textbox (is-a?/c text%)] [line-idx (or/c exact-nonnegative-integer? #f)]) (or/c (listof char?) #f)]{ Get the chars in @racket[textbox] on line @racket[line-idx]. } @defproc[(line-start [textbox (is-a?/c text%)] [line-idx (or/c exact-nonnegative-integer? #f)]) (or/c exact-nonnegative-integer? #f)]{ Get the starting character position in @racket[textbox] of line @racket[line-idx] (or @racket[#f] if there is no such line). To get the actual character, pass the return value to @racket[char]. } @defproc[(line-end [textbox (is-a?/c text%)] [line-idx (or/c exact-nonnegative-integer? #f)]) (or/c exact-nonnegative-integer? #f)]{ Get the ending character position in @racket[textbox] of line @racket[line-idx] (or @racket[#f] if there is no such line). To get the actual character, pass the return value to @racket[char]. } @deftogether[( @defproc[(line-start-visible [textbox (is-a?/c text%)] [line-idx (or/c exact-nonnegative-integer? #f)]) (or/c exact-nonnegative-integer? #f)] @defproc[(line-end-visible [textbox (is-a?/c text%)] [line-idx (or/c exact-nonnegative-integer? #f)]) (or/c exact-nonnegative-integer? #f)] )]{ Like @racket[line-start] and @racket[line-end], but skips whitespace characters. To get the actual character, pass the return value to @racket[char], or use @racket[line-first-visible-char] and @racket[line-last-visible-char]. } @defproc[(line-first-visible-char [textbox (is-a?/c text%)] [line-idx (or/c exact-nonnegative-integer? #f)]) (or/c char? #f)]{ Convenient notation for @racket[(char textbox (line-start-visible textbox line-idx))]. } @defproc[(line-last-visible-char [textbox (is-a?/c text%)] [line-idx (or/c exact-nonnegative-integer? #f)]) (or/c char? #f)]{ Convenient notation for @racket[(char textbox (line-end-visible textbox line-idx))]. } @defproc[(line-indent [textbox (is-a?/c text%)] [line-idx (or/c exact-nonnegative-integer? #f)]) (or/c exact-nonnegative-integer? #f)]{ Get the length of the indent of line @racket[line-idx] in @racket[textbox]. } @defproc[(apply-indenter [indenter-proc procedure?] [textbox-or-str (or/c (is-a?/c text%) string?)]) string?]{ Apply @racket[indenter-proc] to the text in @racket[textbox-or-str] and return an indented string. Useful for unit testing. } @defproc[(string-indents [str string?]) (listof exact-nonnegative-integer?)]{ Lists the indents at the beginning of each line in @racket[str]. Useful for unit testing. } @section{Lists} @defmodule[br/list] @defform[(values->list values)]{ Convert @racket[values] to a simple list. @examples[#:eval my-eval (split-at '(a b c d e f) 3) (values->list (split-at '(a b c d e f) 3)) ] } @defform[(push! list-id val)]{ Mutate @racket[list-id] by putting @racket[val] on top. @examples[#:eval my-eval (define xs '(2 3 4)) (push! xs 1) xs ] } @defform[(pop! list-id)]{ Mutate @racket[list-id] by removing the topmost element, and return this element as the result. @examples[#:eval my-eval (define xs '(1 2 3 4)) (define top (pop! xs)) top xs ] } @section{Reader utilities} @defmodule[br/reader-utils] @defproc[ (apply-reader [read-syntax-proc procedure?] [source-str string?]) datum?]{ Applies @racket[read-syntax-proc] to @racket[source-str] as if it were being read in from a source file. Perhaps helpful for testing & debugging. } @section{The @tt{br} teaching languages} @defmodulelang*[(br br/quicklang)]{ The @racketmodname[br] language is designed to be used for the samples and tutorials in @italic{Beautiful Racket}. The language is a convenience variant of @racketmodname[racket/base] that includes the modules listed above, plus a number of other Racket libraries. The specifics are not hugely relevant. Why not? Because in the future, @racketmodname[br] will grow depending on the needs of the @italic{Beautiful Racket} book. Therefore, it's probably not what you want to use for your own projects. See the @link["http://beautifulracket.com/appendix/from-br-to-racket-base.html"]{appendix of @italic{Beautiful Racket}} for more information. @racketmodname[br/quicklang] is a variant of the @racketmodname[br] language that automatically exports @racket[#%top], @racket[#%app], @racket[#%datum], and @racket[#%top-interaction]. As above, if you're making your own language, you should build on @racketmodname[racket/base], because @racketmodname[br/quicklang] does nothing that you couldn't do yourself in two lines of code. }
Racket
5
mbutterick/beautiful-racket
beautiful-racket/br/scribblings/br.scrbl
[ "MIT" ]
#pragma TextEncoding="UTF-8" #pragma rtGlobals=3 #pragma ModuleName = SIDAMLineProfile #include "SIDAM_Color" #include "SIDAM_Line" #include "SIDAM_Range" #include "SIDAM_Utilities_Bias" #include "SIDAM_Utilities_Control" #include "SIDAM_Utilities_Image" #include "SIDAM_Utilities_Panel" #include "SIDAM_Utilities_WaveDf" #ifndef SIDAMshowProc #pragma hide = 1 #endif Static StrConstant SUFFIX_X = "X" Static StrConstant SUFFIX_Y = "Y" Static StrConstant SUFFIX_SDEV = "Stdv" Static StrConstant PROF_1D_NAME = "W_ImageLineProfile" Static StrConstant PROF_X_NAME = "W_LineProfileX" Static StrConstant PROF_Y_NAME = "W_LineProfileY" Static StrConstant STDV_1D_NAME = "W_LineProfileStdv" Static StrConstant PROF_2D_NAME = "M_ImageLineProfile" Static StrConstant STDV_2D_NAME = "M_LineProfileStdv" Static StrConstant PNL_W = "W_SIDAMLineProfile" Static StrConstant PNL_C = "W_SIDAMLineProfileC" Static StrConstant PNL_B1 = "W_SIDAMLineProfile_b" Static StrConstant PNL_B2 = "W_SIDAMLineProfile_y" Static StrConstant PNL_X = "W_SIDAMLineProfileX" Static StrConstant PNL_Y = "W_SIDAMLineProfileY" Static StrConstant PNL_T = "W_SIDAMLineProfileT" Static StrConstant KEY = "SIDAMLineProfile" //@ // Get a line profile of a wave along a trajectory line. // // ## Parameters // w : wave // The input wave, 2D or 3D. // p1, q1 : variable // The position of the starting point (pixel). // p2, q2 : variable // The position of the ending point (pixel). // width : variable, default 0 // The width (diameter) of the line profile in pixels. // This is the same as the width parameter of `ImageLineProfile`. // output : int, default 0 // Specify waves saved in addition to the profile wave. // - bit 0: save waves of positions. // - bit 1: save wave of standard deviation when the width > 0. // basename : string, default "" // Name of the line profile wave and basename of additional waves // (when the output > 0). If this is specified, output waves are // save in the data folder where the input wave is. // // ## Returns // wave // Line profile. //@ Function/WAVE SIDAMLineProfile(Wave/Z w, Variable p1, Variable q1, Variable p2, Variable q2, [Variable width, int output, String basename]) STRUCT paramStruct s Wave/Z s.w = w s.p1 = p1 s.q1 = q1 s.p2 = p2 s.q2 = q2 s.basename = SelectString(ParamIsDefault(basename), basename, "") s.width = ParamIsDefault(width) ? 0 : width s.output = ParamIsDefault(output) ? 0 : output s.dfr = GetWavesDataFolderDFR(s.w) if (validate(s)) print s.errMsg return $"" endif return getLineProfile(s) End Static Function validate(STRUCT paramStruct &s) s.errMsg = PRESTR_CAUTION + "SIDAMLineProfile gave error: " if (!WaveExists(s.w)) s.errMsg += "wave not found." return 1 elseif (WaveDims(s.w) != 2 && WaveDims(s.w) != 3) s.errMsg += "the dimension of input wave must be 2 or 3." return 1 endif if ((WaveDims(s.w) == 2 && strlen(s.basename) > MAX_OBJ_NAME) || \ (WaveDims(s.w) == 3 && strlen(s.basename) > MAX_OBJ_NAME-3)) s.errMsg += "length of name for output wave exceeds the limit ("\ +num2istr(MAX_OBJ_NAME)+" characters)." return 1 endif if (numtype(s.p1) || numtype(s.q1) || numtype(s.p2) || numtype(s.q2)) s.errMsg += "coordinate must be a normal number." return 1 endif if (s.width < 0) s.errMsg += "width must be positive." return 1 endif if (s.output > 3) s.errMsg += "output must be an integer between 0 and 3." return 1 endif return 0 End Static Structure paramStruct Wave w String errMsg double p1 double p2 double q1 double q2 double width uchar output String basename DFREF dfr EndStructure Static Function menuDo() String grfName = WinName(0,1), imgName = StringFromList(0, ImageNameList(grfName, ";")) pnl(grfName, imgName) End //****************************************************************************** // Line profile //****************************************************************************** Static Function/WAVE getLineProfile(STRUCT paramStruct &s) int i DFREF dfrSav = GetDataFolderDFR(), dfr = s.dfr SetDataFolder NewFreeDataFolder() Variable ox = DimOffset(s.w,0), oy = DimOffset(s.w,1) Variable dx = DimDelta(s.w,0), dy = DimDelta(s.w,1) Make/D/N=2 xw = {ox+dx*s.p1, ox+dx*s.p2}, yw = {oy+dy*s.q1, oy+dy*s.q2} int isComplex = WaveType(s.w) & 0x01 if (isComplex) MatrixOP/FREE realw = real(s.w) MatrixOP/FREE imagw = imag(s.w) Copyscales s.w, realw, imagw endif // 2D & complex if (WaveDims(s.w)==2 && isComplex) // real SetDataFolder NewFreeDataFolder() ImageLineProfile/S/SC xWave=xw, yWave=yw, srcwave=realw, width=s.width Wave linew0 = $PROF_1D_NAME, sdevw0 = $STDV_1D_NAME // imaginary SetDataFolder NewFreeDataFolder() ImageLineProfile/S/SC xWave=xw, yWave=yw, srcwave=imagw, width=s.width Wave linew1 = $PROF_1D_NAME, sdevw1 = $STDV_1D_NAME // combine them in complex MatrixOP/C linew = cmplx(linew0,linew1) MatrixOP/C sdevw = cmplx(sdevw0,sdevw1) scalingLineProfile(s,linew,sdevw) if (strlen(s.basename) > 0) Duplicate/O linew dfr:$s.basename/WAVE=rtnw if (s.output&2) Duplicate/O sdevw dfr:$(s.basename+SUFFIX_SDEV) endif else Wave rtnw = linew endif // 2D & real elseif (WaveDims(s.w)==2) ImageLineProfile/S/SC xWave=xw, yWave=yw, srcwave=s.w, width=s.width scalingLineProfile(s,$PROF_1D_NAME,$STDV_1D_NAME) if (strlen(s.basename) > 0) Duplicate/O $PROF_1D_NAME dfr:$s.basename/WAVE=rtnw if (s.output&2) Duplicate/O $STDV_1D_NAME dfr:$(s.basename+SUFFIX_SDEV) endif else Wave rtnw = linew endif // 3D & complex elseif (WaveDims(s.w)==3 && isComplex) // real SetDataFolder NewFreeDataFolder() ImageLineProfile/S/SC/P=-2 xWave=xw, yWave=yw, srcwave=realw, width=s.width Wave linew0 = $PROF_2D_NAME, sdevw0 = $STDV_2D_NAME // imaginary SetDataFolder NewFreeDataFolder() ImageLineProfile/S/SC/P=-2 xWave=xw, yWave=yw, srcwave=imagw, width=s.width Wave linew1 = $PROF_2D_NAME, sdevw1 = $STDV_2D_NAME // combine them in complex MatrixOP/C linew = cmplx(linew0,linew1) MatrixOP/C sdevw = cmplx(sdevw0,sdevw1) scalingLineProfile(s, linew, sdevw) Wave rtnw = outputLineProfileWaves(s, linew, sdevw) // 3D & real elseif (WaveDims(s.w)==3) ImageLineProfile/S/SC/P=-2 xWave=xw, yWave=yw, srcwave=s.w, width=s.width scalingLineProfile(s, $PROF_2D_NAME, $STDV_2D_NAME) Wave rtnw = outputLineProfileWaves(s, $PROF_2D_NAME, $STDV_2D_NAME) endif // Save waves for sampling points if (s.output&1) Wave posxw = $PROF_X_NAME, posyw = $PROF_Y_NAME SetScale d 0, 0, StringByKey("DUNITS", WaveInfo(s.w,0)), posxw SetScale d 0, 0, StringByKey("DUNITS", WaveInfo(s.w,1)), posyw Duplicate/O posxw dfr:$(s.basename+SUFFIX_X) Duplicate/O posyw dfr:$(s.basename+SUFFIX_Y) endif SetDataFolder dfrSav return rtnw End // scaling and note Static Function scalingLineProfile(STRUCT paramStruct &s, Wave linew, Wave sdevw) if (s.p1 == s.p2) Setscale/I x IndexToScale(s.w,s.q1,1), IndexToScale(s.w,s.q2,1)\ , WaveUnits(s.w,1), linew, sdevw elseif (s.q1 == s.q2) Setscale/I x IndexToScale(s.w,s.p1,0), IndexToScale(s.w,s.p2,0)\ , WaveUnits(s.w,0), linew, sdevw else Variable distance = sqrt((s.p1-s.p2)^2*DimDelta(s.w,0)^2+(s.q1-s.q2)^2*DimDelta(s.w,1)^2) SetScale/I x 0, distance, WaveUnits(s.w,0), linew, sdevw endif SetScale d 0, 0, StringByKey("DUNITS", WaveInfo(s.w,0)), linew, sdevw if (WaveDims(s.w)==3) SetScale/P y DimOffset(s.w,2), DimDelta(s.w,2), WaveUnits(s.w,2), linew, sdevw endif String noteStr Sprintf noteStr, "src@%s;start@p=%.2f,q=%.2f;end@p=%.2f,q=%.2f;width=%.2f"\ , GetWavesDataFolder(s.w, 2), s.p1, s.q1, s.p2, s.q2, s.width Note linew, noteStr Note sdevw, noteStr End Static Function/WAVE outputLineProfileWaves(STRUCT paramStruct &s, Wave linew, Wave sdevw) if (strlen(s.basename) > 0) DFREF dfr = s.dfr Duplicate/O linew dfr:$s.basename/WAVE=rtnw if (SIDAMisUnevenlySpacedBias(s.w)) Duplicate/O SIDAMGetBias(s.w,1) dfr:$(s.basename+"_b") Duplicate/O SIDAMGetBias(s.w,2) dfr:$(s.basename+"_y") endif if (s.output & 2) Duplicate/O $STDV_2D_NAME dfr:$(s.basename+SUFFIX_SDEV) endif return rtnw else return linew endif End //****************************************************************************** // Show the main panel //****************************************************************************** Static Function pnl(String grfName, String imgName) if (SIDAMWindowExists(GetUserData(grfName,"",KEY))) DoWindow/F $GetUserData(grfName,"",KEY) return 0 endif DFREF dfrSav = GetDataFolderDFR() String dfTmp = SIDAMNewDF(grfName,"LineProfile") SetDataFolder $dfTmp Make/N=(1,1)/O $PNL_W Make/N=(1,3)/O $PNL_C Make/T/N=2/O $PNL_T = {"1","2"} Wave w = SIDAMImageWaveRef(grfName) int i Display/K=1/W=(0,0,315*72/screenresolution,340*72/screenresolution) as "Line Profile" String pnlName = S_name AutoPositionWindow/E/M=0/R=$grfName $pnlName SetWindow $grfName hook($KEY)=SIDAMLineProfile#pnlHookParent SetWindow $grfName userData($KEY)=pnlName+"="+dfTmp SetWindow $pnlName hook(self)=SIDAMLine#pnlHook, userData(parent)=grfName SetWindow $pnlName userData(src)=GetWavesDataFolder(w,2) SetWindow $pnlName userData(grid)="1" SetWindow $pnlName userData(key)=KEY SetWindow $pnlName userData(dfTmp)=dfTmp if (WaveDims(w)==3) SetWindow $pnlName userData(dim)="1" SetWindow $pnlName userData(highlight)="1" endif SIDAMLine#pnlCtrls(pnlName) SetVariable widthV title="width", pos={208,4}, size={101,15}, format="%.2f", win=$pnlName SetVariable widthV limits={0,inf,0.1}, value=_NUM:0, bodyWidth=70, win=$pnlName ModifyControlList "p1V;q1V;p2V;q2V;distanceV;angleV;widthV" proc=SIDAMLineProfile#pnlSetVar, win=$pnlName ModifyControlList ControlNameList(pnlName,";","*") focusRing=0, win=$pnlName // Get line profiles for the default values pnlUpdateLineProfile(pnlName) pnlUpdateTextmarker(pnlName) pnlUpdatePos(pnlName) // For the waterfall plot if (WaveDims(w)==2) Display/FG=(FL,KMFT,FR,FB)/HOST=$pnlName/N=line $PNL_W elseif (SIDAMisUnevenlySpacedBias(w)) Newwaterfall/FG=(FL,KMFT,FR,FB)/HOST=$pnlName/N=line $PNL_W vs {*, $PNL_B1} else Newwaterfall/FG=(FL,KMFT,FR,FB)/HOST=$pnlName/N=line $PNL_W endif pnlStyle(pnlName+"#line") pnlUpdateColor(pnlName) // For the image plot if (WaveDims(w)==3) Display/FG=(FL,KMFT,FR,FB)/HOST=$pnlName/N=image/HIDE=1 if (SIDAMisUnevenlySpacedBias(w)) AppendImage/W=$pnlName#image $PNL_W vs {*, $PNL_B2} else AppendImage/W=$pnlName#image $PNL_W endif pnlStyle(pnlName+"#image") endif SetActiveSubWindow $pnlName // Show a line and text markers on the parent window AppendToGraph/W=$grfName $PNL_Y vs $PNL_X ModifyGraph/W=$grfName mode($PNL_Y)=4,msize($PNL_Y)=5 ModifyGraph/W=$grfName textMarker($PNL_Y)={$PNL_T,"default",0,0,1,0,0} SetDataFolder dfrSav End Static Function pnlStyle(String plotArea) ModifyGraph/W=$plotArea margin(top)=8,margin(right)=8,margin(bottom)=36,margin(left)=44 ModifyGraph/W=$plotArea tick=0,btlen=5,mirror=0,lblMargin=2, gfSize=10 ModifyGraph/W=$plotArea rgb=(SIDAM_WINDOW_LINE_R, SIDAM_WINDOW_LINE_G, SIDAM_WINDOW_LINE_B) Label/W=$plotArea bottom "Scaling Distance (\\u\M)" Label/W=$plotArea left "\\u" String pnlName = StringFromList(0,plotArea,"#") int is3D = WaveDims($GetUserData(pnlName,"","src")) == 3 if (!CmpStr(StringFromList(1,plotArea,"#"),"line") && is3D) ModifyWaterfall/W=$plotArea angle=90,axlen=0.5,hidden=0 ModifyGraph/W=$plotArea noLabel(right)=2,axThick(right)=0 ModifyGraph/W=$plotArea mode=0,useNegRGB=1,usePlusRGB=1 GetWindow $plotArea, gbRGB ModifyGraph/W=$plotArea negRGB=(V_Red,V_Green,V_Blue),plusRGB=(V_Red,V_Green,V_Blue) // The default value of the highlight is 1 Wave/SDFR=$GetUserData(pnlName,"","dfTmp") clrw = $PNL_C ModifyGraph/W=$plotArea zColor={clrw,*,*,directRGB,0} endif End Static Function pnlUpdatePos(String pnlName) Wave/SDFR=$GetUserData(pnlName,"","dfTmp") w = $PNL_W String strL = SelectString(DimDelta(w,0)>0, "pos 2", "pos 1") String strR = SelectString(DimDelta(w,0)>0, "pos 1", "pos 2") SetDrawLayer/W=$pnlName ProgBack DrawAction/L=ProgBack/W=$pnlName getgroup=$KEY, delete SetDrawEnv/W=$pnlName gname=$KEY, gstart SetDrawEnv/W=$pnlName textrgb=(SIDAM_WINDOW_NOTE_R, SIDAM_WINDOW_NOTE_G, SIDAM_WINDOW_NOTE_B) SetDrawEnv/W=$pnlName xcoord=rel, ycoord=rel, fstyle=2, fsize=10 DrawText/W=$pnlName 0.03, 0.99, strL SetDrawEnv/W=$pnlName textrgb=(SIDAM_WINDOW_NOTE_R, SIDAM_WINDOW_NOTE_G, SIDAM_WINDOW_NOTE_B) SetDrawEnv/W=$pnlName xcoord=rel, ycoord=rel, textxjust=2, fstyle=2, fsize=10 DrawText/W=$pnlName 0.97, 0.99, strR SetDrawEnv/W=$pnlName gstop SetDrawLayer/W=$pnlName UserFront End // Get line profiles Static Function pnlUpdateLineProfile(String pnlName) STRUCT paramStruct s Wave s.w = $GetUserData(pnlName,"","src") ControlInfo/W=$pnlName p1V ; s.p1 = V_Value ControlInfo/W=$pnlName q1V ; s.q1 = V_Value ControlInfo/W=$pnlName p2V ; s.p2 = V_Value ControlInfo/W=$pnlName q2V ; s.q2 = V_Value ControlInfo/W=$pnlName widthV ; s.width = V_Value s.output = 5 s.basename = PNL_W s.dfr = $GetUserData(pnlName,"","dfTmp") getLineProfile(s) End // Update the text marker // This is called from SIDAMLine#pnlCheck() Static Function pnlUpdateTextmarker(String pnlName) DFREF dfrTmp = $GetUserData(pnlName,"","dfTmp") Wave/T/SDFR=dfrTmp tw = $PNL_T tw[inf] = "" Redimension/N=(numpnts(dfrTmp:$PNL_X)) tw // Use !F_flag to put 1 when this is called for the first time ControlInfo/W=$pnlName p1C; tw[0] = SelectString(V_Value|!V_Flag,"","1") ControlInfo/W=$pnlName p2C; tw[inf] = SelectString(V_Value|!V_Flag,"","2") End // Change the color of line profile corresponding to the displayed // layer when a 3D wave is shown. Static Function pnlUpdateColor(String pnlName) String grfName = StringFromList(0,GetUserData(pnlName,"","parent")) if (WaveDims(SIDAMImageWaveRef(grfName))==2) return 0 elseif (CmpStr(GetUserData(pnlName,"","highlight"),"1")) return 0 endif Wave/SDFR=$GetUserData(pnlName,"","dfTmp") w = $PNL_W, clrw = $PNL_C Redimension/N=(numpnts(w),3) clrw clrw[][0] = SIDAM_WINDOW_LINE_R clrw[][1] = SIDAM_WINDOW_LINE_G clrw[][2] = SIDAM_WINDOW_LINE_B int layer = SIDAMGetLayerIndex(grfName) int p0 = layer*DimSize(w,0) int p1 = (layer+1)*DimSize(w,0)-1 clrw[p0,p1][0] = SIDAM_WINDOW_LINE2_R clrw[p0,p1][1] = SIDAM_WINDOW_LINE2_G clrw[p0,p1][2] = SIDAM_WINDOW_LINE2_B End //****************************************************************************** // Hook functions //****************************************************************************** // Hook function for the main panel Static Function pnlHookArrows(String pnlName) pnlUpdateLineProfile(pnlName) pnlUpdateTextmarker(pnlName) pnlUpdateColor(pnlName) pnlUpdatePos(pnlName) End // Hook function for the parent window Static Function pnlHookParent(STRUCT WMWinHookStruct &s) if (SIDAMLine#pnlHookParentCheckChild(s.winName,KEY,pnlResetParent)) return 0 endif String pnlName = StringFromList(0,GetUserData(s.winName,"",KEY),"=") switch (s.eventCode) case 2: // kill KillWindow/Z $pnlName return 0 case 3: // mousedown case 4: // mousemoved SIDAMLine#pnlHookParentMouse(s, pnlName) if (!strlen(GetUserData(pnlName,"","clicked"))) return 0 endif //*** FALLTHROUGH *** case 8: // modified pnlUpdateLineProfile(pnlName) pnlUpdateTextmarker(pnlName) pnlUpdateColor(pnlName) pnlUpdatePos(pnlName) DoUpdate/W=$pnlName DoUpdate/W=$s.winName return 0 case 13: // renamed SIDAMLine#pnlHookParentRename(s,KEY) return 0 default: return 0 endswitch End Static Function pnlResetParent(String grfName, String dummy) SetWindow $grfName hook($KEY)=$"",userdata($KEY)="" End //****************************************************************************** // Controls for the main panel //****************************************************************************** // SetVariable Static Function pnlSetVar(STRUCT WMSetVariableAction &s) // Handle either mouse up or enter key if (s.eventCode != 1 && s.eventCode != 2) return 1 endif // Change values of the controls SIDAMLine#pnlSetVarUpdateValues(s) // Update the line profiles pnlUpdateLineProfile(s.win) pnlUpdateTextmarker(s.win) pnlUpdateColor(s.win) pnlUpdatePos(s.win) End //****************************************************************************** // Menu for right-clike //****************************************************************************** Menu "SIDAMLineProfileMenu", dynamic, contextualmenu SubMenu "Positions" SIDAMLine#menu(0), SIDAMLineProfile#panelMenuDo(0) End SubMenu "Dimension" SIDAMLine#menu(1), SIDAMLineProfile#panelMenuDo(1) End SubMenu "Complex" SIDAMLine#menu(2), SIDAMLineProfile#panelMenuDo(2) End SubMenu "Style" SIDAMLine#menu(3), SIDAMLineProfile#panelMenuDo(3) SIDAMLine#menu(4), SIDAMLineProfile#panelMenuDo(4) End "Save...", SIDAMLineProfile#outputPnl(WinName(0,1)) "-" SIDAMLine#menu(7),/Q, SIDAMRange(grfName=WinName(0,1)+"#image") SIDAMLine#menu(8),/Q, SIDAMColor(grfName=WinName(0,1)+"#image") End Static Function panelMenuDo(int mode) String pnlName = WinName(0,1) int grid = str2num(GetUserData(pnlName,"","grid")) switch (mode) case 0: // positions // Change values of p1V etc. SIDAMLine#menuPositions(pnlName) // Update the line profiles pnlUpdateLineProfile(pnlName) pnlUpdateTextmarker(pnlName) pnlUpdateColor(pnlName) pnlUpdatePos(pnlName) break case 1: // dim int dim = str2num(GetUserData(pnlName,"","dim")) GetLastUserMenuInfo if (V_value != dim) SIDAMLine#pnlChangeDim(pnlName, V_value) endif break case 2: // complex SIDAMLine#menuComplex(pnlName) break case 3: // Free // Change values of p1V etc. SIDAMLine#menuFree(pnlName) // Update the line profiles pnlUpdateLineProfile(pnlName) pnlUpdateTextmarker(pnlName) pnlUpdateColor(pnlName) pnlUpdatePos(pnlName) break case 4: // Highlight int highlight = str2num(GetUserData(pnlName,"","highlight")) SetWindow $pnlname userData(highlight)=num2istr(!highlight) if (highlight) // on -> off ModifyGraph/W=$(pnlName+"#line") zColor=0 else // off -> on Wave/SDFR=$GetUserData(pnlName,"","dfTmp") clrw = $PNL_C ModifyGraph/W=$(pnlName+"#line") zColor={clrw,*,*,directRGB,0} pnlUpdateColor(pnlName) endif break endswitch End //****************************************************************************** // Sub panel to save a wave //****************************************************************************** Static Function outputPnl(String profileGrfName) if (SIDAMWindowExists(profileGrfName+"#Save")) return 0 endif ControlInfo/W=$profileGrfName widthV Variable width = V_Value NewPanel/HOST=$profileGrfName/EXT=2/W=(0,0,315,125)/N=Save String pnlName = profileGrfName + "#Save" DFREF dfrSav = GetDataFolderDFR() Wave srcw = $GetUserData(profileGrfName,"","src") SetDataFolder GetWavesDataFolderDFR(srcw) SetVariable basenameV title="basename:", pos={10,10}, win=$pnlName SetVariable basenameV size={290,15}, bodyWidth=230, frame=1, win=$pnlName SetVariable basenameV value=_STR:UniqueName("wave",1,0), win=$pnlName SetVariable basenameV proc=SIDAMLineProfile#outputPnlSetVar, win=$pnlName SetDataFolder dfrSav CheckBox positionC title="save waves of sampling points", win=$pnlName CheckBox positionC pos={10,40}, size={88,14}, value=0, win=$pnlName // sdevC can not be selected if width is 0 CheckBox sdevC title="save wave of standard deviation", win=$pnlName CheckBox sdevC pos={10,64}, size={300,14}, value=0, disable=(!width)*2, win=$pnlName Button doB title="Do It", pos={10,95}, win=$pnlName Button closeB title="Close", pos={235,95}, win=$pnlName ModifyControlList "doB;closeB" size={70,20}, proc=SIDAMLineProfile#outputPnlButton, win=$pnlName ModifyControlList ControlNameList(pnlName,";","*") focusRing=0, win=$pnlName End //****************************************************************************** // Controls for the sub panel //****************************************************************************** // Button Static Function outputPnlButton(STRUCT WMButtonAction &s) if (s.eventCode != 2) return 0 endif strswitch (s.ctrlName) case "doB": outputPnlDo(s.win) //*** FALLTHROUGH *** case "closeB": KillWindow $(s.win) break default: endswitch return 0 End // SetVariable Static Function outputPnlSetVar(STRUCT WMSetVariableAction &s) // Handle either enter key or end edit if (s.eventCode != 2 && s.eventCode != 8) return 1 endif String grfName = GetUserData(StringFromList(0, s.win, "#"),"","parent") Wave w = SIDAMImageWaveRef(grfName) int maxlength = (WaveDims(w)==3) ? MAX_OBJ_NAME-3 : MAX_OBJ_NAME int isProperLength = !SIDAMValidateSetVariableString(s.win,s.ctrlName,0,maxlength=maxlength) Button doB disable=(!isProperLength)*2, win=$s.win End Static Function outputPnlDo(String pnlName) STRUCT paramStruct s String prtName = StringFromList(0, pnlName, "#") Wave cvw0 = SIDAMGetCtrlValues(pnlName,"positionC;sdevC") s.output = cvw0[%positionC]+cvw0[%sdevC]*2 ControlInfo/W=$pnlName basenameV s.basename = S_Value Wave cvw1 = SIDAMGetCtrlValues(prtName,"p1V;q1V;p2V;q2V;widthV") Wave s.w = $GetUserData(prtName,"","src") s.p1 = cvw1[%p1V] s.q1 = cvw1[%q1V] s.p2 = cvw1[%p2V] s.q2 = cvw1[%q2V] s.width = cvw1[%widthV] echo(s) SIDAMLineProfile(s.w, s.p1, s.q1, s.p2, s.q2, basename=s.basename,\ width=s.width, output=s.output) End Static Function echo(STRUCT paramStruct &s) String paramStr = GetWavesDataFolder(s.w,2) + "," paramStr += num2str(s.p1) + "," + num2str(s.q1) + "," paramStr += num2str(s.p2) + "," + num2str(s.q2) paramStr += SelectString(strlen(s.basename),"",",basename=\""+s.basename+"\"") paramStr += SelectString(s.width, "",",width="+num2str(s.width)) paramStr += SelectString(s.output, "",",output="+num2str(s.output)) printf "%sSIDAMLineProfile(%s)\r", PRESTR_CMD, paramStr End
IGOR Pro
5
yuksk/SIDAM
src/SIDAM/func/SIDAM_LineProfile.ipf
[ "MIT" ]
[global] checkNewVersion = false sendAnonymousUsage = false [entryPoints] [entryPoints.web] address = ":8000" [entryPoints.traefik] address = ":8080" [api] [providers.file] filename = "{{ .SelfFilename }}" [http.routers.api] rule="PathPrefix(`/secure`)" service="api@internal" middlewares=["strip"] [http.middlewares.strip.stripPrefix] prefixes = [ "/secure" ]
TOML
4
sidharthv96/traefik
integration/fixtures/simple_secure_api.toml
[ "MIT" ]
# Creates a master-slave pair and breaks the link continuously to force # partial resyncs attempts, all this while flooding the master with # write queries. # # You can specify backlog size, ttl, delay before reconnection, test duration # in seconds, and an additional condition to verify at the end. # # If reconnect is > 0, the test actually try to break the connection and # reconnect with the master, otherwise just the initial synchronization is # checked for consistency. proc test_psync {descr duration backlog_size backlog_ttl delay cond mdl sdl reconnect} { start_server {tags {"repl"}} { start_server {} { set master [srv -1 client] set master_host [srv -1 host] set master_port [srv -1 port] set slave [srv 0 client] $master config set repl-backlog-size $backlog_size $master config set repl-backlog-ttl $backlog_ttl $master config set repl-diskless-sync $mdl $master config set repl-diskless-sync-delay 1 $slave config set repl-diskless-load $sdl set load_handle0 [start_bg_complex_data $master_host $master_port 9 100000] set load_handle1 [start_bg_complex_data $master_host $master_port 11 100000] set load_handle2 [start_bg_complex_data $master_host $master_port 12 100000] test {Slave should be able to synchronize with the master} { $slave slaveof $master_host $master_port wait_for_condition 50 100 { [lindex [r role] 0] eq {slave} && [lindex [r role] 3] eq {connected} } else { fail "Replication not started." } } # Check that the background clients are actually writing. test {Detect write load to master} { wait_for_condition 50 1000 { [$master dbsize] > 100 } else { fail "Can't detect write load from background clients." } } test "Test replication partial resync: $descr (diskless: $mdl, $sdl, reconnect: $reconnect)" { # Now while the clients are writing data, break the maste-slave # link multiple times. if ($reconnect) { for {set j 0} {$j < $duration*10} {incr j} { after 100 # catch {puts "MASTER [$master dbsize] keys, REPLICA [$slave dbsize] keys"} if {($j % 20) == 0} { catch { if {$delay} { $slave multi $slave client kill $master_host:$master_port $slave debug sleep $delay $slave exec } else { $slave client kill $master_host:$master_port } } } } } stop_bg_complex_data $load_handle0 stop_bg_complex_data $load_handle1 stop_bg_complex_data $load_handle2 # Wait for the slave to reach the "online" # state from the POV of the master. set retry 5000 while {$retry} { set info [$master info] if {[string match {*slave0:*state=online*} $info]} { break } else { incr retry -1 after 100 } } if {$retry == 0} { error "assertion:Slave not correctly synchronized" } # Wait that slave acknowledge it is online so # we are sure that DBSIZE and DEBUG DIGEST will not # fail because of timing issues. (-LOADING error) wait_for_condition 5000 100 { [lindex [$slave role] 3] eq {connected} } else { fail "Slave still not connected after some time" } wait_for_condition 100 100 { [$master debug digest] == [$slave debug digest] } else { set csv1 [csvdump r] set csv2 [csvdump {r -1}] set fd [open /tmp/repldump1.txt w] puts -nonewline $fd $csv1 close $fd set fd [open /tmp/repldump2.txt w] puts -nonewline $fd $csv2 close $fd fail "Master - Replica inconsistency, Run diff -u against /tmp/repldump*.txt for more info" } assert {[$master dbsize] > 0} eval $cond } } } } tags {"external:skip"} { foreach mdl {no yes} { foreach sdl {disabled swapdb} { test_psync {no reconnection, just sync} 6 1000000 3600 0 { } $mdl $sdl 0 test_psync {ok psync} 6 100000000 3600 0 { assert {[s -1 sync_partial_ok] > 0} } $mdl $sdl 1 test_psync {no backlog} 6 100 3600 0.5 { assert {[s -1 sync_partial_err] > 0} } $mdl $sdl 1 test_psync {ok after delay} 3 100000000 3600 3 { assert {[s -1 sync_partial_ok] > 0} } $mdl $sdl 1 test_psync {backlog expired} 3 100000000 1 3 { assert {[s -1 sync_partial_err] > 0} } $mdl $sdl 1 } } }
Tcl
5
hpdic/redis
tests/integration/replication-psync.tcl
[ "BSD-3-Clause" ]
*** Keywords *** Keyword [Arguments] ${x} ${y} ${z}=zzz Log ${x}-${y}-${z}
RobotFramework
3
phil-davis/robotframework
atest/testdata/standard_libraries/builtin/UseBuiltInResource.robot
[ "ECL-2.0", "Apache-2.0" ]
struct Outer { enum Inner { case east, west static func staticMethod() {} func instanceMethod() {} func test() { Inner. } } func test() { Inner. } } // RUN: %sourcekitd-test \ // RUN: -req=complete -pos=8:13 %s -- %s == \ // RUN: -req=complete -pos=8:13 %s -- %s == \ // RUN: -req=complete -pos=13:11 %s -- %s \ // RUN: > %t.response // RUN: %FileCheck --check-prefix=RESULT %s < %t.response // RESULT-LABEL: key.results: [ // RESULT-DAG: key.description: "east" // RESULT-DAG: key.description: "west" // RESULT-DAG: key.description: "staticMethod()" // RESULT-DAG: key.description: "instanceMethod(self: Outer.Inner)" // RESULT: ] // RESULT-NOT: key.reusingastcontext: 1 // RESULT-LABEL: key.results: [ // RESULT-DAG: key.description: "east" // RESULT-DAG: key.description: "west" // RESULT-DAG: key.description: "staticMethod()" // RESULT-DAG: key.description: "instanceMethod(self: Outer.Inner)" // RESULT: ] // RESULT: key.reusingastcontext: 1 // RESULT-LABEL: key.results: [ // RESULT-DAG: key.description: "east" // RESULT-DAG: key.description: "west" // RESULT-DAG: key.description: "staticMethod()" // RESULT-DAG: key.description: "instanceMethod(self: Inner)" // RESULT: ] // RESULT: key.reusingastcontext: 1
Swift
3
gandhi56/swift
test/SourceKit/CodeComplete/complete_sequence_nestedtype.swift
[ "Apache-2.0" ]
<?php echo "here";
HTML+PHP
0
tidytrax/cphalcon
tests/_data/fixtures/views/currentrender/other.phtml
[ "BSD-3-Clause" ]
MODE(X) ;X is assumed to be a list of numbers separated by "^" ;I is a loop index ;L is the length of X ;Y is a new array ;ML is the list of modes ;LOC is a placeholder to shorten the statement Q:'$DATA(X) "No data" Q:X="" "Empty Set" NEW Y,I,L,LOC SET L=$LENGTH(X,"^"),ML="" FOR I=1:1:L SET LOC=+$P(X,"^",I),Y(LOC)=$S($DATA(Y(LOC)):Y(LOC)+1,1:1) SET I="",I=$O(Y(I)),ML=I ;Prime the pump, rather than test for no data FOR S I=$O(Y(I)) Q:I="" S ML=$SELECT(Y($P(ML,"^"))>Y(I):ML,Y($P(ML,"^"))<Y(I):I,Y($P(ML,"^"))=Y(I):ML_"^"_I) QUIT ML
M
5
LaudateCorpus1/RosettaCodeData
Task/Averages-Mode/MUMPS/averages-mode.mumps
[ "Info-ZIP" ]
/* * Copyright (c) 2004, Technische Universitat Berlin * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - Neither the name of the Technische Universitat Berlin nor the names * of its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - Revision ------------------------------------------------------------- * $Revision: 1.4 $ * $Date: 2006-12-12 18:23:13 $ * ======================================================================== */ /** * Controlling the TDA5250 at the HPL layer. * * @author Kevin Klues (klues@tkn.tu-berlin.de) */ configuration HplTda5250DataC { provides { interface Init; interface HplTda5250Data; interface HplTda5250DataControl; interface ResourceRequested; interface Resource as Resource; } } implementation { components HplTda5250DataP, Tda5250RadioIOC, HplTda5250DataIOC; Init = HplTda5250DataP; Resource = HplTda5250DataP.Resource; ResourceRequested = HplTda5250DataP.ResourceRequested; HplTda5250Data = HplTda5250DataP; HplTda5250DataControl = HplTda5250DataP; HplTda5250DataP.DATA -> Tda5250RadioIOC.Tda5250RadioDATA; HplTda5250DataP.Uart -> HplTda5250DataIOC.UartStream; HplTda5250DataP.UartDataControl -> HplTda5250DataIOC.UartDataControl; HplTda5250DataP.UartResource -> HplTda5250DataIOC.Resource; HplTda5250DataP.UartResourceRequested -> HplTda5250DataIOC.ResourceRequested; }
nesC
3
mtaghiza/tinyos-main-1
tos/chips/tda5250/HplTda5250DataC.nc
[ "BSD-3-Clause" ]
/* * Kubernetes Ingress module */ locals { iname = var.ingress_name == "" ? join("-",["ingress",sha1(uuid())]) : var.ingress_name } resource "kubernetes_ingress" "ingress" { metadata { name = local.iname annotations = map( "nginx.ingress.kubernetes.io/rewrite-target","/" ) } spec { rule { http { path { backend { service_name = "svccustomer" service_port = 80 } path = "/customers" } path { backend { service_name = "svcfeedback" service_port = 80 } path = "/feedback" } } } /* tls { secret_name = "tls-secret" } */ } }
HCL
4
DBatOWL/tutorials
terraform/best-practices/k8s-modules/modules/ingress/www.petshop.com.br/main.tf
[ "MIT" ]
--TEST-- Bug #76803 ftruncate changes file pointer --FILE-- <?php $fn = __DIR__ . DIRECTORY_SEPARATOR . "test76803"; $f = fopen($fn, "w"); fwrite($f, "Hello"); ftruncate($f, 2); fwrite($f, "World"); fclose($f); var_dump(addslashes(file_get_contents($fn))); $f = fopen($fn, "w"); fwrite($f, "Hello"); ftruncate($f, 2); fclose($f); var_dump(addslashes(file_get_contents($fn))); $f = fopen('php://memory', 'w+'); fwrite($f, 'Hello'); ftruncate($f, 2); // in 7.3 changes file pointer to 2 fwrite($f, 'World'); rewind($f); var_dump(addslashes(stream_get_contents($f))); fclose($f); ?> --CLEAN-- <?php $fn = __DIR__ . DIRECTORY_SEPARATOR . "test76803"; unlink($fn); ?> --EXPECT-- string(13) "He\0\0\0World" string(2) "He" string(7) "HeWorld"
PHP
3
thiagooak/php-src
ext/standard/tests/file/ftruncate_bug76803.phpt
[ "PHP-3.01" ]
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {ConsoleLogger, DEBUG, ERROR, WARN} from '../src/console_logger'; import {LogLevel} from '../src/logger'; describe('ConsoleLogger', () => { it('should pass through calls to Console', () => { spyOn(console, 'debug'); spyOn(console, 'info'); spyOn(console, 'warn'); spyOn(console, 'error'); const logger = new ConsoleLogger(LogLevel.debug); logger.debug('debug', 'test'); expect(console.debug).toHaveBeenCalledWith(DEBUG, 'debug', 'test'); logger.info('info', 'test'); expect(console.info).toHaveBeenCalledWith('info', 'test'); logger.warn('warn', 'test'); expect(console.warn).toHaveBeenCalledWith(WARN, 'warn', 'test'); logger.error('error', 'test'); expect(console.error).toHaveBeenCalledWith(ERROR, 'error', 'test'); }); it('should filter out calls below the given log level', () => { spyOn(console, 'debug'); spyOn(console, 'info'); spyOn(console, 'warn'); spyOn(console, 'error'); const logger = new ConsoleLogger(LogLevel.warn); logger.debug('debug', 'test'); expect(console.debug).not.toHaveBeenCalled(); logger.info('info', 'test'); expect(console.info).not.toHaveBeenCalled(); logger.warn('warn', 'test'); expect(console.warn).toHaveBeenCalledWith(WARN, 'warn', 'test'); logger.error('error', 'test'); expect(console.error).toHaveBeenCalledWith(ERROR, 'error', 'test'); }); it('should expose the logging level', () => { expect(new ConsoleLogger(LogLevel.debug).level).toEqual(LogLevel.debug); expect(new ConsoleLogger(LogLevel.info).level).toEqual(LogLevel.info); expect(new ConsoleLogger(LogLevel.warn).level).toEqual(LogLevel.warn); expect(new ConsoleLogger(LogLevel.error).level).toEqual(LogLevel.error); }); });
TypeScript
4
raghavendramohan/angular
packages/compiler-cli/src/ngtsc/logging/test/console_logger_spec.ts
[ "MIT" ]
sub acceptsInteger(t as integer) print "received: " t.toStr() end sub sub acceptsFloat(t as float) print "received: " t.toStr() end sub sub acceptsDouble(t as double) print "received: " t.toStr() end sub sub acceptsLongInt(t as longinteger) print "received: " t.toStr() end sub function main() values = { "integer": 13, "float": 3.14159!, "double": 2.71828#, "longinteger": 2147483647119&, } for each kv in values.items() _type = kv.key value = kv.value for each f in [acceptsInteger, acceptsFloat, acceptsDouble, acceptsLongInt] print "calling '" f "' with argument of type '" _type "' with value: " value.toStr() f(value) end for end for end function
Brightscript
4
DreadPirateJay/brs
test/e2e/resources/type-checking/argument-type-coercion.brs
[ "MIT" ]
#include "script_component.hpp" /* Name: TFAR_antennas_fnc_pluginAddRadioTower Author: Dedmen Tells Teamspeak that there is a new Tower Performancewise it's best to collect towers and pass multiple in one call. Arguments: 0: the Tower <OBJECT> Return Value: None Example: [_tower1, _tower2] call TFAR_antennas_fnc_pluginAddRadioTower; Public: yes */ TRACE_1("TFAR_antennas_fnc_pluginAddRadioTower", _this); for "_y" from 0 to (count _this)-1 step 50 do { //Only 50 per call to not exceed max message length private _towersToProcess = (_this select [_y,50]); private _towerData = _towersToProcess apply { private _range = [GVAR(radioTowerList),_x] call CBA_fnc_hashGet; private _netID = netID _x; ([_netID,_range,position _x] joinString ";") }; #ifdef DEBUG_MODE_FULL diag_log _towerData; systemChat "sendBatch"; #endif "task_force_radio_pipe" callExtension format["RadioTwrAdd %1~", _towerData joinString TF_new_line]; };
SQF
4
MrDj200/task-force-arma-3-radio
addons/antennas/functions/fnc_pluginAddRadioTower.sqf
[ "RSA-MD" ]
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.netbeans.modules.javascript2.lexer; import java.util.LinkedList; import org.netbeans.modules.javascript2.lexer.api.JsTokenId; import org.netbeans.spi.lexer.LexerInput; import org.netbeans.spi.lexer.LexerRestartInfo; @org.netbeans.api.annotations.common.SuppressWarnings({"SF_SWITCH_FALLTHROUGH", "URF_UNREAD_FIELD", "DLS_DEAD_LOCAL_STORE", "DM_DEFAULT_ENCODING"}) %% %public %final %class JsColoringLexer %type JsTokenId %unicode %char %{ private LexerInput input; private boolean embedded; private boolean canFollowLiteral = true; private boolean canFollowKeyword = true; private JsTokenId lastNonWhiteToken = null; private LinkedList<Brace> braceBalances = new LinkedList<>(); private enum Brace { EXP, JSX, TEMPLATE } private LinkedList<Integer> jsxBalances = new LinkedList<Integer>(); public JsColoringLexer(LexerRestartInfo info) { this.input = info.input(); this.embedded = !JsTokenId.JAVASCRIPT_MIME_TYPE.equals(info.languagePath().mimePath()); if(info.state() != null) { //reset state setState((LexerState)info.state()); } else { //initial state zzState = zzLexicalState = YYINITIAL; } } public LexerState getState() { if (zzState == YYINITIAL && zzLexicalState == YYINITIAL && canFollowLiteral && canFollowKeyword) { return null; } return new LexerState(zzState, zzLexicalState, canFollowLiteral, canFollowKeyword, braceBalances, jsxBalances, lastNonWhiteToken); } public void setState(LexerState state) { this.zzState = state.zzState; this.zzLexicalState = state.zzLexicalState; this.canFollowLiteral = state.canFollowLiteral; this.canFollowKeyword = state.canFollowKeyword; this.braceBalances = new LinkedList<>(state.braceBalances); this.jsxBalances = new LinkedList<Integer>(state.jsxBalances); this.lastNonWhiteToken = state.lastNonWhiteToken; } public JsTokenId nextToken() throws java.io.IOException { JsTokenId token = yylex(); if (token != null && !JsTokenId.ERROR.equals(token) && !JsTokenId.UNKNOWN.equals(token) && !JsTokenId.WHITESPACE.equals(token) && !JsTokenId.LINE_COMMENT.equals(token) && !JsTokenId.BLOCK_COMMENT.equals(token) && !JsTokenId.DOC_COMMENT.equals(token)) { canFollowLiteral = canFollowLiteral(token); if (!JsTokenId.EOL.equals(token)) { canFollowKeyword = canFollowKeyword(token); lastNonWhiteToken = token; } } return token; } private JsTokenId getErrorToken() { if (embedded) { return JsTokenId.UNKNOWN; } if (yystate() == JSX) { return JsTokenId.JSX_TEXT; } return JsTokenId.ERROR; } private static boolean canFollowLiteral(JsTokenId token) { switch (token) { case OPERATOR_INCREMENT: case OPERATOR_DECREMENT: return false; case BRACKET_LEFT_CURLY: case BRACKET_LEFT_PAREN: case BRACKET_LEFT_BRACKET: case KEYWORD_RETURN: case KEYWORD_THROW: case KEYWORD_YIELD: // unary operators (keyword) case KEYWORD_TYPEOF: // end of line case EOL: case OPERATOR_SEMICOLON: case OPERATOR_COMMA: case OPERATOR_DOT: case OPERATOR_COLON: return true; } if ("operator".equals(token.primaryCategory())) { return true; } return false; } private static boolean canFollowKeyword(JsTokenId token) { if (JsTokenId.OPERATOR_DOT.equals(token)) { return false; } return true; } public static final class LexerState { /** the current state of the DFA */ final int zzState; /** the current lexical state */ final int zzLexicalState; /** can be the literal used here */ final boolean canFollowLiteral; /** can be the literal used here */ final boolean canFollowKeyword; /** where we are in Brace Type */ final LinkedList<Brace> braceBalances; /** are we in jsx primary expression */ final LinkedList<Integer> jsxBalances; /** remember last non white token */ final JsTokenId lastNonWhiteToken; LexerState (int zzState, int zzLexicalState, boolean canFollowLiteral, boolean canFollowKeyword, LinkedList<Brace> braceBalances, LinkedList<Integer> jsxBalances, JsTokenId lastNonWhiteToken) { this.zzState = zzState; this.zzLexicalState = zzLexicalState; this.canFollowLiteral = canFollowLiteral; this.canFollowKeyword = canFollowKeyword; this.braceBalances = new LinkedList<>(braceBalances); this.jsxBalances = new LinkedList<Integer>(jsxBalances); this.lastNonWhiteToken = lastNonWhiteToken; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final LexerState other = (LexerState) obj; if (this.zzState != other.zzState) { return false; } if (this.zzLexicalState != other.zzLexicalState) { return false; } if (this.canFollowLiteral != other.canFollowLiteral) { return false; } if (this.canFollowKeyword != other.canFollowKeyword) { return false; } if (this.braceBalances.size() != other.braceBalances.size()) { return false; } for (int i = 0; i < this.braceBalances.size(); i++) { if (this.braceBalances.get(i).equals(other.braceBalances.get(i))) { return false; } } if (this.jsxBalances.size() != other.jsxBalances.size()) { return false; } for (int i = 0; i < this.jsxBalances.size(); i++) { if (this.jsxBalances.get(i).equals(other.jsxBalances.get(i))) { return false; } } if (this.lastNonWhiteToken != other.lastNonWhiteToken) { return false; } return true; } @Override public int hashCode() { int hash = 5; hash = 29 * hash + this.zzState; hash = 29 * hash + this.zzLexicalState; hash = 29 * hash + (this.canFollowLiteral ? 1 : 0); hash = 29 * hash + (this.canFollowKeyword ? 1 : 0); for (int i = 0; i < this.braceBalances.size(); i++) { hash = 29 * hash + this.braceBalances.get(i).ordinal(); } for (int i = 0; i < this.jsxBalances.size(); i++) { hash = 29 * hash + this.jsxBalances.get(i); } hash = 29 * hash + this.lastNonWhiteToken.ordinal(); return hash; } @Override public String toString() { return "LexerState{canFollowLiteral=" + canFollowLiteral + ", canFollowKeyword=" + canFollowKeyword + ", braceBalances=" + braceBalances + ", jsxBalances=" + jsxBalances + '}'; } } // End user code %} /* main character classes */ LineTerminator = \r|\n|\r\n InputCharacter = [^\r\n] WhiteSpace = [ \t\f\u00A0\u000B]+ /* comments */ TraditionalComment = "/*" [^*] ~"*/" | "/*" "*"+ "/" ShebangComment = "#!" {InputCharacter}* EndOfLineComment = "//" {InputCharacter}* DocumentationComment = "/*" "*"+ [^/*] ~"*/" /* identifiers */ IdentifierPart = [:jletterdigit:] Identifier = [:jletter:]{IdentifierPart}* /* integer literals */ DecIntegerLiteral = 0 | [1-9][0-9]* DecLongLiteral = {DecIntegerLiteral} [lL] HexIntegerLiteral = 0 [xX] 0* {HexDigit} {1,8} HexLongLiteral = 0 [xX] 0* {HexDigit} {1,16} [lL] HexDigit = [0-9a-fA-F] OctIntegerLiteral = 0 [oO] {OctDigit}+ OctLegacyIntegerLiteral = 0+ [1-3]? {OctDigit} {1,15} OctLegacyLongLiteral = 0+ 1? {OctDigit} {1,21} [lL] OctDigit = [0-7] BinaryIntegerLiteral = 0 [bB] {BinaryDigit}+ BinaryDigit = [0-1] /* floating point literals */ FloatLiteral = ({FLit1}|{FLit2}|{FLit3}) {Exponent}? [fF] DoubleLiteral = ({FLit1}|{FLit2}|{FLit3}) {Exponent}? FLit1 = [0-9]+ \. [0-9]* FLit2 = \. [0-9]+ FLit3 = [0-9]+ Exponent = [eE] [+-]? [0-9]+ /* string and character literals */ TemplateCharacter = [^`$\\] StringCharacter = [^\r\n\"\\] | \\{LineTerminator} SStringCharacter = [^\r\n\'\\] | \\{LineTerminator} JSXCharacter = [^<>/{] RegexpBackslashSequence = \\{InputCharacter} RegexpClass = "["([^\x5d\r\n\\] | {RegexpBackslashSequence})*"]" RegexpCharacter = [^\x5b/\r\n\\] | {RegexpBackslashSequence} | {RegexpClass} RegexpFirstCharacter = [^*\x5b/\r\n\\] | {RegexpBackslashSequence} | {RegexpClass} %state INITIAL %state STRING %state STRINGEND %state SSTRING %state SSTRINGEND %state TEMPLATE %state TEMPLATEEND %state TEMPLATEEXP %state TEMPLATEEXPEND %state REGEXP %state REGEXPEND %state LCOMMENTEND %state JSX %state JSXEXP %state JSXEXPEND %state ERROR %% <YYINITIAL> { {ShebangComment} { yybegin(LCOMMENTEND); return JsTokenId.LINE_COMMENT; } .|\n { yypushback(1); yybegin(INITIAL); } } <INITIAL> { /* keywords 7.6.1.1 */ "break" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_BREAK; } "case" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_CASE; } "catch" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_CATCH; } "continue" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_CONTINUE; } "debugger" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_DEBUGGER; } "default" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_DEFAULT; } "delete" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_DELETE; } "do" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_DO; } "else" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_ELSE; } "finally" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_FINALLY; } "for" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_FOR; } "function" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_FUNCTION; } "if" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_IF; } "in" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_IN; } "instanceof" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_INSTANCEOF; } "new" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_NEW; } "return" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_RETURN; } "switch" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_SWITCH; } "this" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_THIS; } "throw" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_THROW; } "try" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_TRY; } "typeof" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_TYPEOF; } "var" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_VAR; } "void" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_VOID; } "while" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_WHILE; } "with" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_WITH; } "class" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_CLASS; } "const" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_CONST; } "export" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_EXPORT; } "extends" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_EXTENDS; } "import" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_IMPORT; } "super" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_SUPER; } "yield" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.KEYWORD_YIELD; } /* reserved keywords 7.6.1.2 */ "enum" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.RESERVED_ENUM; } "implements" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.RESERVED_IMPLEMENTS; } "interface" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.RESERVED_INTERFACE; } "let" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.RESERVED_LET; } "package" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.RESERVED_PACKAGE; } "private" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.RESERVED_PRIVATE; } "protected" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.RESERVED_PROTECTED; } "public" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.RESERVED_PUBLIC; } "static" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.RESERVED_STATIC; } "await" { if (!canFollowKeyword) { return JsTokenId.IDENTIFIER; } return JsTokenId.RESERVED_AWAIT; } /* boolean literals */ "true" { return JsTokenId.KEYWORD_TRUE; } "false" { return JsTokenId.KEYWORD_FALSE; } /* null literal */ "null" { return JsTokenId.KEYWORD_NULL; } "/"[*] { return getErrorToken(); } "/" { if (canFollowLiteral) { yybegin(REGEXP); return JsTokenId.REGEXP_BEGIN; } else { return JsTokenId.OPERATOR_DIVISION; } } "/=" { if (canFollowLiteral) { yypushback(1); yybegin(REGEXP); return JsTokenId.REGEXP_BEGIN; } else { return JsTokenId.OPERATOR_DIVISION_ASSIGNMENT; } } /* operators */ "(" { return JsTokenId.BRACKET_LEFT_PAREN; } ")" { return JsTokenId.BRACKET_RIGHT_PAREN; } "{" { // we are checking if we are in template expression if (!braceBalances.isEmpty()) { braceBalances.push(Brace.EXP); } return JsTokenId.BRACKET_LEFT_CURLY; } "}" { // we are checking if we are in template expression if (!braceBalances.isEmpty()) { Brace braceType = braceBalances.pop(); if (braceType == Brace.TEMPLATE) { yypushback(1); yybegin(TEMPLATEEXPEND); } else if (braceType == Brace.JSX) { yypushback(1); yybegin(JSXEXPEND); } else { return JsTokenId.BRACKET_RIGHT_CURLY; } } else { return JsTokenId.BRACKET_RIGHT_CURLY; } } "[" { return JsTokenId.BRACKET_LEFT_BRACKET; } "]" { return JsTokenId.BRACKET_RIGHT_BRACKET; } ";" { return JsTokenId.OPERATOR_SEMICOLON; } "," { return JsTokenId.OPERATOR_COMMA; } "." { return JsTokenId.OPERATOR_DOT; } "..." { return JsTokenId.OPERATOR_REST; } "=" { return JsTokenId.OPERATOR_ASSIGNMENT; } ">" { return JsTokenId.OPERATOR_GREATER; } "<" { if (!canFollowLiteral || (lastNonWhiteToken != null && (lastNonWhiteToken == JsTokenId.IDENTIFIER || lastNonWhiteToken == JsTokenId.NUMBER))) { return JsTokenId.OPERATOR_LOWER; } else { jsxBalances.push(0); yypushback(1); yybegin(JSX); } } "!" { return JsTokenId.OPERATOR_NOT; } "~" { return JsTokenId.OPERATOR_BITWISE_NOT; } "?" { return JsTokenId.OPERATOR_TERNARY; } ":" { return JsTokenId.OPERATOR_COLON; } "==" { return JsTokenId.OPERATOR_EQUALS; } "===" { return JsTokenId.OPERATOR_EQUALS_EXACTLY; } "<=" { return JsTokenId.OPERATOR_LOWER_EQUALS; } ">=" { return JsTokenId.OPERATOR_GREATER_EQUALS; } "!=" { return JsTokenId.OPERATOR_NOT_EQUALS; } "!==" { return JsTokenId.OPERATOR_NOT_EQUALS_EXACTLY; } "&&" { return JsTokenId.OPERATOR_AND; } "||" { return JsTokenId.OPERATOR_OR; } "++" { return JsTokenId.OPERATOR_INCREMENT; } "--" { return JsTokenId.OPERATOR_DECREMENT; } "+" { return JsTokenId.OPERATOR_PLUS; } "-" { return JsTokenId.OPERATOR_MINUS; } "**" { return JsTokenId.OPERATOR_EXPONENTIATION; } "*" { return JsTokenId.OPERATOR_MULTIPLICATION; } "&" { return JsTokenId.OPERATOR_BITWISE_AND; } "|" { return JsTokenId.OPERATOR_BITWISE_OR; } "^" { return JsTokenId.OPERATOR_BITWISE_XOR; } "%" { return JsTokenId.OPERATOR_MODULUS; } "<<" { return JsTokenId.OPERATOR_LEFT_SHIFT_ARITHMETIC; } ">>" { return JsTokenId.OPERATOR_RIGHT_SHIFT_ARITHMETIC; } ">>>" { return JsTokenId.OPERATOR_RIGHT_SHIFT; } "+=" { return JsTokenId.OPERATOR_PLUS_ASSIGNMENT; } "-=" { return JsTokenId.OPERATOR_MINUS_ASSIGNMENT; } "**=" { return JsTokenId.OPERATOR_EXPONENTIATION_ASSIGNMENT; } "*=" { return JsTokenId.OPERATOR_MULTIPLICATION_ASSIGNMENT; } "&=" { return JsTokenId.OPERATOR_BITWISE_AND_ASSIGNMENT; } "|=" { return JsTokenId.OPERATOR_BITWISE_OR_ASSIGNMENT; } "^=" { return JsTokenId.OPERATOR_BITWISE_XOR_ASSIGNMENT; } "%=" { return JsTokenId.OPERATOR_MODULUS_ASSIGNMENT; } "<<=" { return JsTokenId.OPERATOR_LEFT_SHIFT_ARITHMETIC_ASSIGNMENT; } ">>=" { return JsTokenId.OPERATOR_RIGHT_SHIFT_ARITHMETIC_ASSIGNMENT; } ">>>=" { return JsTokenId.OPERATOR_RIGHT_SHIFT_ASSIGNMENT; } "=>" { return JsTokenId.OPERATOR_ARROW; } "@" { return JsTokenId.OPERATOR_AT; } /* string literal */ \" { yybegin(STRING); return JsTokenId.STRING_BEGIN; } \' { yybegin(SSTRING); return JsTokenId.STRING_BEGIN; } ` { yybegin(TEMPLATE); return JsTokenId.TEMPLATE_BEGIN; } /* numeric literals */ {DecIntegerLiteral} | {DecLongLiteral} | {BinaryIntegerLiteral} | {HexIntegerLiteral} | {HexLongLiteral} | {OctIntegerLiteral} | {OctLegacyIntegerLiteral} | {OctLegacyLongLiteral} | {FloatLiteral} | {DoubleLiteral} | {DoubleLiteral}[dD] { return JsTokenId.NUMBER; } /* comments */ {DocumentationComment} { return JsTokenId.DOC_COMMENT; } /* comments */ {TraditionalComment} { return JsTokenId.BLOCK_COMMENT; } /* comments */ {EndOfLineComment} { yybegin(LCOMMENTEND); return JsTokenId.LINE_COMMENT; } /* whitespace */ {WhiteSpace} { return JsTokenId.WHITESPACE; } /* whitespace */ {LineTerminator} { return JsTokenId.EOL; } /* identifiers */ {Identifier} { return JsTokenId.IDENTIFIER; } } <STRING> { \" { yypushback(1); yybegin(STRINGEND); if (tokenLength - 1 > 0) { return JsTokenId.STRING; } } {StringCharacter}+ { } \\[0-3]?{OctDigit}?{OctDigit} { } /* escape sequences */ \\. { } {LineTerminator} { yypushback(1); yybegin(INITIAL); if (tokenLength - 1 > 0) { return getErrorToken(); } } } <STRINGEND> { \" { yybegin(INITIAL); return JsTokenId.STRING_END; } } <SSTRING> { \' { yypushback(1); yybegin(SSTRINGEND); if (tokenLength - 1 > 0) { return JsTokenId.STRING; } } {SStringCharacter}+ { } \\[0-3]?{OctDigit}?{OctDigit} { } /* escape sequences */ \\. { } {LineTerminator} { yypushback(1); yybegin(INITIAL); if (tokenLength -1 > 0) { return getErrorToken(); } } } <SSTRINGEND> { \' { yybegin(INITIAL); return JsTokenId.STRING_END; } } <TEMPLATE> { ` { yypushback(1); yybegin(TEMPLATEEND); if (tokenLength - 1 > 0) { return JsTokenId.TEMPLATE; } } "$"\{ { yypushback(2); yybegin(TEMPLATEEXP); if (tokenLength - 2 > 0) { return JsTokenId.TEMPLATE; } } "$" | {TemplateCharacter}+ { } \\. { } } <TEMPLATEEND> { ` { yybegin(INITIAL); return JsTokenId.TEMPLATE_END; } } <TEMPLATEEXP> { "$"\{ { braceBalances.push(Brace.TEMPLATE); yybegin(INITIAL); return JsTokenId.TEMPLATE_EXP_BEGIN; } } <TEMPLATEEXPEND> { "}" { yybegin(TEMPLATE); return JsTokenId.TEMPLATE_EXP_END; } } <REGEXP> { {RegexpFirstCharacter}{RegexpCharacter}*"/" { yypushback(1); yybegin(REGEXPEND); if (tokenLength - 1 > 0) { return JsTokenId.REGEXP; } } . { yypushback(1); yybegin(ERROR); } } <REGEXPEND> { "/"{IdentifierPart}* { yybegin(INITIAL); return JsTokenId.REGEXP_END; } . { yypushback(1); yybegin(ERROR); } } <ERROR> { .*{LineTerminator} { yypushback(1); yybegin(INITIAL); if (tokenLength - 1 > 0) { return getErrorToken(); } } } <LCOMMENTEND> { {LineTerminator}? { yybegin(INITIAL); if (tokenLength > 0) { return JsTokenId.EOL; } } } <JSX> { "/>" | "</"{JSXCharacter}+">" { Integer balance = jsxBalances.isEmpty() ? 0 : jsxBalances.pop() - 1; if (balance <= 0) { yybegin(INITIAL); return JsTokenId.JSX_TEXT; } else { jsxBalances.push(balance); } } "{" { yypushback(1); yybegin(JSXEXP); if (tokenLength - 1 > 0) { return JsTokenId.JSX_TEXT; } } "<" { Integer balance = jsxBalances.isEmpty() ? 0 : jsxBalances.pop(); jsxBalances.push(balance+1); } {JSXCharacter} | ">" | "/" { } \\. { } } <JSXEXP> { "{" { braceBalances.push(Brace.JSX); yybegin(INITIAL); return JsTokenId.JSX_EXP_BEGIN; } } <JSXEXPEND> { "}" { yybegin(JSX); return JsTokenId.JSX_EXP_END; } } /* error fallback */ .|\n { return getErrorToken(); } <<EOF>> { if (input.readLength() > 0) { // backup eof input.backup(1); //and return the text as error token return getErrorToken(); } else { return null; } }
JFlex
5
Antholoj/netbeans
webcommon/javascript2.lexer/tools/JsColoringScanner.flex
[ "Apache-2.0" ]
{ stdenv, lib, fetchurl }: let isCross = stdenv.buildPlatform != stdenv.hostPlatform; cross = "${stdenv.hostPlatform.config}"; static = stdenv.hostPlatform.isStatic; cc = if !isCross then "cc" else "${cross}-cc"; ar = if !isCross then "ar" else "${cross}-ar"; ranlib = if !isCross then "ranlib" else "${cross}-ranlib"; in stdenv.mkDerivation rec { postPatch = '' sed -i 's,set --, set -x; set --,' Makefile ''; pname = "tinycdb"; version = "0.78"; # In general, static library (.a) goes to "dev", shared (.so) to # "lib". In case of static build, there is no .so library, so "lib" # output is useless and empty. outputs = [ "out" "dev" "man" ] ++ lib.optional (!static) "lib"; separateDebugInfo = true; makeFlags = [ "prefix=$(out)" "CC=${cc}" "AR=${ar}" "RANLIB=${ranlib}" "static" ] ++ lib.optional (!static) "shared"; postInstall = '' mkdir -p $dev/lib $out/bin mv $out/lib/libcdb.a $dev/lib rmdir $out/lib '' + (if static then '' cp cdb $out/bin/cdb '' else '' mkdir -p $lib/lib cp libcdb.so* $lib/lib cp cdb-shared $out/bin/cdb ''); src = fetchurl { url = "http://www.corpit.ru/mjt/tinycdb/${pname}-${version}.tar.gz"; sha256 = "0g6n1rr3lvyqc85g6z44lw9ih58f2k1i3v18yxlqvnla5m1qyrsh"; }; meta = with lib; { description = "utility to manipulate constant databases (cdb)"; longDescription = '' tinycdb is a small, fast and reliable utility and subroutine library for creating and reading constant databases. The database structure is tuned for fast reading. ''; homepage = "https://www.corpit.ru/mjt/tinycdb.html"; license = licenses.publicDomain; platforms = platforms.linux; }; }
Nix
5
collinwright/nixpkgs
pkgs/development/libraries/tinycdb/default.nix
[ "MIT" ]
{ fire, delegate getData, $ refreshCSRFTokens, CSRFProtection loadCSPNonce enableElement, disableElement, handleDisabledElement handleConfirm, preventInsignificantClick handleRemote, formSubmitButtonClick, handleMethod } = Rails # For backward compatibility if jQuery? and jQuery.ajax? throw new Error('If you load both jquery_ujs and rails-ujs, use rails-ujs only.') if jQuery.rails jQuery.rails = Rails jQuery.ajaxPrefilter (options, originalOptions, xhr) -> CSRFProtection(xhr) unless options.crossDomain Rails.start = -> # Cut down on the number of issues from people inadvertently including # rails-ujs twice by detecting and raising an error when it happens. throw new Error('rails-ujs has already been loaded!') if window._rails_loaded # This event works the same as the load event, except that it fires every # time the page is loaded. # See https://github.com/rails/jquery-ujs/issues/357 # See https://developer.mozilla.org/en-US/docs/Using_Firefox_1.5_caching window.addEventListener 'pageshow', -> $(Rails.formEnableSelector).forEach (el) -> enableElement(el) if getData(el, 'ujs:disabled') $(Rails.linkDisableSelector).forEach (el) -> enableElement(el) if getData(el, 'ujs:disabled') delegate document, Rails.linkDisableSelector, 'ajax:complete', enableElement delegate document, Rails.linkDisableSelector, 'ajax:stopped', enableElement delegate document, Rails.buttonDisableSelector, 'ajax:complete', enableElement delegate document, Rails.buttonDisableSelector, 'ajax:stopped', enableElement delegate document, Rails.linkClickSelector, 'click', preventInsignificantClick delegate document, Rails.linkClickSelector, 'click', handleDisabledElement delegate document, Rails.linkClickSelector, 'click', handleConfirm delegate document, Rails.linkClickSelector, 'click', disableElement delegate document, Rails.linkClickSelector, 'click', handleRemote delegate document, Rails.linkClickSelector, 'click', handleMethod delegate document, Rails.buttonClickSelector, 'click', preventInsignificantClick delegate document, Rails.buttonClickSelector, 'click', handleDisabledElement delegate document, Rails.buttonClickSelector, 'click', handleConfirm delegate document, Rails.buttonClickSelector, 'click', disableElement delegate document, Rails.buttonClickSelector, 'click', handleRemote delegate document, Rails.inputChangeSelector, 'change', handleDisabledElement delegate document, Rails.inputChangeSelector, 'change', handleConfirm delegate document, Rails.inputChangeSelector, 'change', handleRemote delegate document, Rails.formSubmitSelector, 'submit', handleDisabledElement delegate document, Rails.formSubmitSelector, 'submit', handleConfirm delegate document, Rails.formSubmitSelector, 'submit', handleRemote # Normal mode submit # Slight timeout so that the submit button gets properly serialized delegate document, Rails.formSubmitSelector, 'submit', (e) -> setTimeout((-> disableElement(e)), 13) delegate document, Rails.formSubmitSelector, 'ajax:send', disableElement delegate document, Rails.formSubmitSelector, 'ajax:complete', enableElement delegate document, Rails.formInputClickSelector, 'click', preventInsignificantClick delegate document, Rails.formInputClickSelector, 'click', handleDisabledElement delegate document, Rails.formInputClickSelector, 'click', handleConfirm delegate document, Rails.formInputClickSelector, 'click', formSubmitButtonClick document.addEventListener('DOMContentLoaded', refreshCSRFTokens) document.addEventListener('DOMContentLoaded', loadCSPNonce) window._rails_loaded = true if window.Rails is Rails and fire(document, 'rails:attachBindings') Rails.start()
CoffeeScript
4
Jiwoong/rails
actionview/app/assets/javascripts/rails-ujs/start.coffee
[ "MIT" ]
@import url("missing.css");
CSS
0
jpmallarino/django
tests/staticfiles_tests/project/faulty/faulty.css
[ "BSD-3-Clause", "0BSD" ]
module Issue296 where postulate Unit : Set IO : Set → Set foo : ((A B : Set) → Unit) → IO Unit bar : (A B : Set) → Unit {-# BUILTIN IO IO #-} {-# COMPILE GHC IO = type IO #-} {-# COMPILE GHC Unit = type () #-} {-# COMPILE GHC bar = undefined #-} main : IO Unit main = foo bar
Agda
3
shlevy/agda
test/Succeed/Issue296.agda
[ "BSD-3-Clause" ]
.cm-s-juejin.CodeMirror { background: #f8f9fa; } .cm-s-juejin .cm-header, .cm-s-juejin .cm-def { color: #1ba2f0; } .cm-s-juejin .cm-comment { color: #009e9d; } .cm-s-juejin .cm-quote, .cm-s-juejin .cm-link, .cm-s-juejin .cm-strong, .cm-s-juejin .cm-attribute { color: #fd7741; } .cm-s-juejin .cm-url, .cm-s-juejin .cm-keyword, .cm-s-juejin .cm-builtin { color: #bb51b8; } .cm-s-juejin .cm-hr { color: #909090; } .cm-s-juejin .cm-tag { color: #107000; } .cm-s-juejin .cm-variable-2 { color: #0050a0; }
CSS
2
praniya-tech/AdminLTE
plugins/codemirror/theme/juejin.css
[ "MIT" ]
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {inspect} from 'util'; import {ExpectedError} from './get_compliance_tests'; export function checkErrors( testPath: string, failureMessage: string, expectedErrors: ExpectedError[], actualErrors: string[]): void { for (const expectedError of expectedErrors) { if (!actualErrors.some( actualError => expectedError.message.test(actualError) && expectedError.location.test(actualError))) { throw new Error( `When checking expected errors for test case at "${testPath}"\n` + failureMessage + '\n' + `Expected errors: ${inspect(expectedErrors)}\n` + `Actual errors: ${inspect(actualErrors)}.`); } } } export function checkNoUnexpectedErrors(testPath: string, actualErrors: string[]): void { if (actualErrors.length > 0) { throw new Error( `Unexpected errors occurred for test case at "${testPath}"\n` + `Errors: ${inspect(actualErrors)}.`); } }
TypeScript
5
John-Cassidy/angular
packages/compiler-cli/test/compliance/test_helpers/check_errors.ts
[ "MIT" ]
// Original Author: Sree Kotay http://stereopsis.com/sree/fpu2006.html include "inttypes.h"; union EndianTest { var i: uint32_t; var c: CArray[Char, 4]; } enum Endianness { LITTLE; BIG; OTHER; } var e: EndianTest = union EndianTest {i: 0x01020304}; var endianness: Endianness = Endianness.OTHER; var xs_iexp: Int = 1; var xs_iman: Int = 0; const xs_doublemagic: Float64 = (6755399441055744.0): Float64; // 2^52 * 1.5, uses limited precisicion to floor const xs_doublemagicdelta: Float64 = (1.5 * pow(10, -8)); // almost .5f = .5f + 1e^(number of exp bit) const xs_doublemagicroundeps: Float64 = (0.5 - xs_doublemagicdelta); // almost .5f = .5f - 1e^(number of exp bit) function checkEndianness(): Void { if (e.c[0] == 4) && (e.c[1] == 3) && (e.c[2] == 2) && (e.c[3] == 1) { endianness = Endianness.LITTLE; } else if (e.c[0] == 1) && (e.c[1] == 2) && (e.c[2] == 3) && (e.c[3] == 4) { endianness = Endianness.BIG; } match endianness { LITTLE => { //intel is little endian xs_iexp = 1; xs_iman = 0; } BIG => { xs_iexp = 0; xs_iman = 1; } OTHER => { printf("WARN: Other endianness, behavior not defined. Setting iexp, iman to little endianness values."); xs_iexp = 1; xs_iman = 0; } } } function endiannessString(): CString { match endianness { LITTLE => return "little"; BIG => return "big"; OTHER => return "other"; } return "enum match failed"; } function xs_MinInt(a: Int, b: Int): Int { return (if (a < b) then a else b); } function xs_MaxInt(a: Int, b: Int): Int { return (if (a > b) then a else b); } function xs_ClampInt(a: Int, b: Int, c: Int): Int { return xs_MinInt(xs_MaxInt(a, b), c); } function xs_MinFloat(a: Float, b: Float): Float { return (if (a < b) then a else b); } function xs_MaxFloat(a: Float, b: Float): Float { return (if (a > b) then a else b); } function xs_ClampFloat(a: Float, b: Float, c: Float): Float { return xs_MinFloat(xs_MaxFloat(a, b), c); } function xs_doublecopysgn(a: Int, b: Int) { return ((&a): Ptr[Int32])[xs_iexp] &= ~(((&b): Ptr[Int32])[xs_iexp] & 0x80000000); } function xs_doubleisnegative(a: Int) { return ((((&a): Ptr[Int32])[xs_iexp]) | 0x80000000); } inline function xs_ConvertToFixed(val: Float64, digits: Int): Int32 { return xs_CRoundToInt(val, xs_doublemagic / (1 << digits)); } inline function xs_CRoundToInt(val: Float64, dmr: Float64 = xs_doublemagic): Int32 { val = val + dmr; return ((&val) as Ptr[Int32])[xs_iman]; } static function xs_ToInt(val: Float64, dme: Float64 = -xs_doublemagicroundeps): Int32 { if val < 0 { return xs_CRoundToInt(val - dme); } else { return xs_CRoundToInt(val + dme); } } static function xs_FloorToInt(val: Float64, dme: Float64 = xs_doublemagicroundeps): Int32 { return xs_CRoundToInt(val - dme); } static function xs_CeilToInt(val: Float64, dme: Float64 = xs_doublemagicroundeps): Int32 { return xs_CRoundToInt(val + dme); } inline function xs_RoundToInt(val: Float64): Int32 { return xs_CRoundToInt(val + xs_doublemagicdelta); }
Kit
4
AlexPoulsen/xs_Rounding-Kit-port
src/xs_Rounding.kit
[ "MIT" ]
@0x934efea7f017fff0; struct Person { id @0 :UInt32; name @1 :Text; email @2 :Text; phones @3 :List(PhoneNumber); struct PhoneNumber { number @0 :Text; type @1 :Type; enum Type { mobile @0; home @1; work @2; } } } struct AddressBook { people @0 :List(Person); }
Cap'n Proto
3
p4l1ly/pycapnp
benchmark/addressbook.capnp
[ "BSD-2-Clause" ]