Search is not available for this dataset
content
stringlengths 0
376M
|
---|
' Stack Definition - VBScript
Option Explicit
Dim stack, i, x
Set stack = CreateObject("System.Collections.ArrayList")
If Not empty_(stack) Then Wscript.Echo stack.Count
push stack, "Banana"
push stack, "Apple"
push stack, "Pear"
push stack, "Strawberry"
Wscript.Echo "Count=" & stack.Count ' --> Count=4
Wscript.Echo pop(stack) & " - Count=" & stack.Count ' --> Strawberry - Count=3
Wscript.Echo "Tail=" & stack.Item(0) ' --> Tail=Banana
Wscript.Echo "Head=" & stack.Item(stack.Count-1) ' --> Head=Pear
Wscript.Echo stack.IndexOf("Apple", 0) ' --> 1
For i=1 To stack.Count
Wscript.Echo join(stack.ToArray(), ", ")
x = pop(stack)
Next 'i
Sub push(s, what)
s.Add what
End Sub 'push
Function pop(s)
Dim what
If s.Count > 0 Then
what = s(s.Count-1)
s.RemoveAt s.Count-1
Else
what = ""
End If
pop = what
End Function 'pop
Function empty_(s)
empty_ = s.Count = 0
End Function 'empty_
|
<gh_stars>10-100
Option Explicit
Main
Sub Main
Dim oCluster
Dim oNetInterfaces
Dim nCount
Dim e
Dim sCluster
Set oCluster = CreateObject("MSCluster.Cluster")
sCluster = InputBox( "Cluster to open?" )
oCluster.Open( sCluster )
Set oNetInterfaces = oCluster.NetInterfaces
nCount = oNetInterfaces.Count
MsgBox "Net Interfaces count is " & nCount
for e = 1 to nCount
MsgBox "Net Interface name is '" & oNetInterfaces.Item(e).Name & "'"
next
End Sub
|
<reponame>LaudateCorpus1/RosettaCodeData
'Knapsack problem/0-1 - 12/02/2017
Option Explicit
Const maxWeight = 400
Dim DataList As Variant
Dim xList(64, 3) As Variant
Dim nItems As Integer
Dim s As String, xss As String
Dim xwei As Integer, xval As Integer, nn As Integer
Sub Main()
Dim i As Integer, j As Integer
DataList = Array("map", 9, 150, "compass", 13, 35, "water", 153, 200, "sandwich", 50, 160, _
"glucose", 15, 60, "tin", 68, 45, "banana", 27, 60, "apple", 39, 40, _
"cheese", 23, 30, "beer", 52, 10, "suntan cream", 11, 70, "camera", 32, 30, _
"T-shirt", 24, 15, "trousers", 48, 10, "umbrella", 73, 40, "book", 30, 10, _
"waterproof trousers", 42, 70, "waterproof overclothes", 43, 75, _
"note-case", 22, 80, "sunglasses", 7, 20, "towel", 18, 12, "socks", 4, 50)
nItems = (UBound(DataList) + 1) / 3
j = 0
For i = 1 To nItems
xList(i, 1) = DataList(j)
xList(i, 2) = DataList(j + 1)
xList(i, 3) = DataList(j + 2)
j = j + 3
Next i
s = ""
For i = 1 To nItems
s = s & Chr(i)
Next
nn = 0
Call ChoiceBin(1, "")
For i = 1 To Len(xss)
j = Asc(Mid(xss, i, 1))
Debug.Print xList(j, 1)
Next i
Debug.Print "count=" & Len(xss), "weight=" & xwei, "value=" & xval
End Sub 'Main
Private Sub ChoiceBin(n As String, ss As String)
Dim r As String
Dim i As Integer, j As Integer, iwei As Integer, ival As Integer
Dim ipct As Integer
If n = Len(s) + 1 Then
iwei = 0: ival = 0
For i = 1 To Len(ss)
j = Asc(Mid(ss, i, 1))
iwei = iwei + xList(j, 2)
ival = ival + xList(j, 3)
Next
If iwei <= maxWeight And ival > xval Then
xss = ss: xwei = iwei: xval = ival
End If
Else
r = Mid(s, n, 1)
Call ChoiceBin(n + 1, ss & r)
Call ChoiceBin(n + 1, ss)
End If
End Sub 'ChoiceBin
|
Do
WScript.StdOut.Write "1. fee fie" & vbCrLf
WScript.StdOut.Write "2. huff puff" & vbCrLf
WScript.StdOut.Write "3. mirror mirror" & vbCrLf
WScript.StdOut.Write "4. tick tock" & vbCrLf
WScript.StdOut.Write "Please Enter Your Choice: " & vbCrLf
choice = WScript.StdIn.ReadLine
Select Case choice
Case "1"
WScript.StdOut.Write "fee fie" & vbCrLf
Exit Do
Case "2"
WScript.StdOut.Write "huff puff" & vbCrLf
Exit Do
Case "3"
WScript.StdOut.Write "mirror mirror" & vbCrLf
Exit Do
Case "4"
WScript.StdOut.Write "tick tock" & vbCrLf
Exit Do
Case Else
WScript.StdOut.Write choice & " is an invalid choice. Please try again..." &_
vbCrLf & vbCrLf
End Select
Loop
|
'Binary Integer overflow - vb6 - 28/02/2017
Dim i As Long '32-bit signed integer
i = -(-2147483647 - 1) '=-2147483648 ?! bug
i = -Int(-2147483647 - 1) '=-2147483648 ?! bug
i = 0 - (-2147483647 - 1) 'Run-time error '6' : Overflow
i = -2147483647: i = -(i - 1) 'Run-time error '6' : Overflow
i = -(-2147483647 - 2) 'Run-time error '6' : Overflow
i = 2147483647 + 1 'Run-time error '6' : Overflow
i = 2000000000 + 2000000000 'Run-time error '6' : Overflow
i = -2147483647 - 2147483647 'Run-time error '6' : Overflow
i = 46341 * 46341 'Run-time error '6' : Overflow
i = (-2147483647 - 1) / -1 'Run-time error '6' : Overflow
|
<reponame>LaudateCorpus1/RosettaCodeData<filename>Task/Exponentiation-operator/VBA/exponentiation-operator.vba
Public Function exp(ByVal base As Variant, ByVal exponent As Long) As Variant
Dim result As Variant
If TypeName(base) = "Integer" Or TypeName(base) = "Long" Then
'integer exponentiation
result = 1
If exponent < 0 Then
result = IIf(Abs(base) <> 1, CVErr(2019), IIf(exponent Mod 2 = -1, base, 1))
End If
Do While exponent > 0
If exponent Mod 2 = 1 Then result = result * base
base = base * base
exponent = exponent \ 2
Loop
Else
Debug.Assert IsNumeric(base)
'float exponentiation
If base = 0 Then
If exponent < 0 Then result = CVErr(11)
Else
If exponent < 0 Then
base = 1# / base
exponent = -exponent
End If
result = 1
Do While exponent > 0
If exponent Mod 2 = 1 Then result = result * base
base = base * base
exponent = exponent \ 2
Loop
End If
End If
exp = result
End Function
Public Sub main()
Debug.Print "Integer exponentiation"
Debug.Print "10^7=", exp(10, 7)
Debug.Print "10^4=", exp(10, 4)
Debug.Print "(-3)^3=", exp(-3, 3)
Debug.Print "(-1)^(-5)=", exp(-1, -5)
Debug.Print "10^(-1)=", exp(10, -1)
Debug.Print "0^2=", exp(0, 2)
Debug.Print "Float exponentiation"
Debug.Print "10.0^(-3)=", exp(10#, -3)
Debug.Print "10.0^(-4)=", exp(10#, -4)
Debug.Print "(-3.0)^(-5)=", exp(-3#, -5)
Debug.Print "(-3.0)^(-4)=", exp(-3#, -4)
Debug.Print "0.0^(-4)=", exp(0#, -4)
End Sub
|
Sub mersenne()
Dim q As Long, k As Long, p As Long, d As Long
Dim factor As Long, i As Long, y As Long, z As Long
Dim prime As Boolean
q = 929 'input value
For k = 1 To 1048576 '2**20
p = 2 * k * q + 1
If (p And 7) = 1 Or (p And 7) = 7 Then 'p=*001 or p=*111
'p is prime?
prime = False
If p Mod 2 = 0 Then GoTo notprime
If p Mod 3 = 0 Then GoTo notprime
d = 5
Do While d * d <= p
If p Mod d = 0 Then GoTo notprime
d = d + 2
If p Mod d = 0 Then GoTo notprime
d = d + 4
Loop
prime = True
notprime: 'modpow
i = q: y = 1: z = 2
Do While i 'i <> 0
On Error GoTo okfactor
If i And 1 Then y = (y * z) Mod p 'test first bit
z = (z * z) Mod p
On Error GoTo 0
i = i \ 2
Loop
If prime And y = 1 Then factor = p: GoTo okfactor
End If
Next k
factor = 0
okfactor:
Debug.Print "M" & q, "factor=" & factor
End Sub
|
<filename>Task/Count-occurrences-of-a-substring/VBScript/count-occurrences-of-a-substring.vb
Function CountSubstring(str,substr)
CountSubstring = 0
For i = 1 To Len(str)
If Len(str) >= Len(substr) Then
If InStr(i,str,substr) Then
CountSubstring = CountSubstring + 1
i = InStr(i,str,substr) + Len(substr) - 1
End If
Else
Exit For
End If
Next
End Function
WScript.StdOut.Write CountSubstring("the three truths","th") & vbCrLf
WScript.StdOut.Write CountSubstring("ababababab","abab") & vbCrLf
|
<gh_stars>1-10
Option Explicit
Sub Main_Lower_Case_Ascii_Alphabet()
Dim Alpha() As String
Alpha = Alphabet(97, 122)
Debug.Print Join(Alpha, ", ")
End Sub
Function Alphabet(FirstAscii As Byte, LastAscii As Byte) As String()
Dim strarrTemp() As String, i&
ReDim strarrTemp(0 To LastAscii - FirstAscii)
For i = FirstAscii To LastAscii
strarrTemp(i - FirstAscii) = Chr(i)
Next
Alphabet = strarrTemp
Erase strarrTemp
End Function
|
On Error Resume Next
while true
Set Class = GetObject("winmgmts:root/cimv2:win32_service")
'Test the collection properties of IWbemMethodSet
For each Method in Class.Methods_
WScript.Echo "***************************"
WScript.Echo "METHOD:", Method.Name, "from class", Method.Origin
WScript.Echo
WScript.Echo " Qualifiers:"
for each Qualifier in Method.Qualifiers_
WScript.Echo " ", Qualifier.Name, "=", Qualifier
Next
WScript.Echo
WScript.Echo " In Parameters:"
if (Method.InParameters <> NULL) Then
for each InParameter in Method.InParameters.Properties_
WScript.Echo " ", InParameter.Name, "<", InParameter.CIMType, ">"
Next
End If
WScript.Echo
WScript.Echo " Out Parameters"
if (Method.OutParameters <> NULL) Then
for each OutParameter in Method.OutParameters.Properties_
WScript.Echo " ", OutParameter.Name, "<", OutParameter.CIMType, ">"
Next
End If
WScript.Echo
WScript.Echo
Next
'Test the Item and Count properties of IWbemMethodSet
WScript.Echo Class.Methods_("Create").Name
WScript.Echo Class.Methods_.Count
wend
|
'Copyright (c)<2000>Microsoft Corporation. All rights reserved.
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
On Error Resume Next
WshShell.RegDelete "HKLM\SOFTWARE\Microsoft\ServerAppliance\DeviceMonitor\"
'END
|
WScript.StdOut.Write "Enter the temperature in Kelvin:"
tmp = WScript.StdIn.ReadLine
WScript.StdOut.WriteLine "Kelvin: " & tmp
WScript.StdOut.WriteLine "Fahrenheit: " & fahrenheit(CInt(tmp))
WScript.StdOut.WriteLine "Celsius: " & celsius(CInt(tmp))
WScript.StdOut.WriteLine "Rankine: " & rankine(CInt(tmp))
Function fahrenheit(k)
fahrenheit = (k*1.8)-459.67
End Function
Function celsius(k)
celsius = k-273.15
End Function
Function rankine(k)
rankine = (k-273.15)*1.8+491.67
End Function
|
<reponame>npocmaka/Windows-Server-2003
on error resume next
set path = CreateObject("WbemScripting.SWbemObjectPath")
WScript.Echo
set disk = GetObject("winmgmts:win32_logicaldisk='C:'")
set path = disk.Path_
WScript.Echo path.Path
WScript.Echo path.Namespace
WScript.Echo path.ParentNamespace
|
<reponame>LaudateCorpus1/RosettaCodeData<filename>Task/Guess-the-number/VBA/guess-the-number.vba
Sub GuessTheNumber()
Dim NbComputer As Integer, NbPlayer As Integer
Randomize Timer
NbComputer = Int((Rnd * 10) + 1)
Do
NbPlayer = Application.InputBox("Choose a number between 1 and 10 : ", "Enter your guess", Type:=1)
Loop While NbComputer <> NbPlayer
MsgBox "Well guessed!"
End Sub
|
'-- Does not work for primes above 97, which is actually beyond the original task anyway.
'-- Translated from the C version, just about everything is (working) out-by-1, what fun.
'-- This updated VBA version utilizes the Decimal datatype to handle numbers requiring
'-- more than 32 bits.
Const MAX = 99
Dim c(MAX + 1) As Variant
Private Sub coef(n As Integer)
'-- out-by-1, ie coef(1)==^0, coef(2)==^1, coef(3)==^2 etc.
c(n) = CDec(1) 'converts c(n) from Variant to Decimal, a 12 byte data type
For i = n - 1 To 2 Step -1
c(i) = c(i) + c(i - 1)
Next i
End Sub
Private Function is_prime(fn As Variant) As Boolean
fn = CDec(fn)
Call coef(fn + 1) '-- (I said it was out-by-1)
For i = 2 To fn - 1 '-- (technically "to n" is more correct)
If c(i) - fn * Int(c(i) / fn) <> 0 Then 'c(i) Mod fn <> 0 Then --Mod works upto 32 bit numbers
is_prime = False: Exit Function
End If
Next i
is_prime = True
End Function
Private Sub show(n As Integer)
'-- (As per coef, this is (working) out-by-1)
Dim ci As Variant
For i = n To 1 Step -1
ci = c(i)
If ci = 1 Then
If (n - i) Mod 2 = 0 Then
If i = 1 Then
If n = 1 Then
ci = "1"
Else
ci = "+1"
End If
Else
ci = ""
End If
Else
ci = "-1"
End If
Else
If (n - i) Mod 2 = 0 Then
ci = "+" & ci
Else
ci = "-" & ci
End If
End If
If i = 1 Then '-- ie ^0
Debug.Print ci
Else
If i = 2 Then '-- ie ^1
Debug.Print ci & "x";
Else
Debug.Print ci & "x^" & i - 1;
End If
End If
Next i
End Sub
Public Sub AKS_test_for_primes()
Dim n As Integer
For n = 1 To 10 '-- (0 to 9 really)
coef n
Debug.Print "(x-1)^" & n - 1 & " = ";
show n
Next n
Debug.Print "primes (<="; MAX; "):"
coef 2 '-- (needed to reset c, if we want to avoid saying 1 is prime...)
For n = 2 To MAX
If is_prime(n) Then
Debug.Print n;
End If
Next n
End Sub
|
on error resume next
' Step 1 - this should work if default impersonation level set correctly
set disk = GetObject("winmgmts:Win32_LogicalDisk=""C:""")
WScript.Echo "Free space is: " & Disk.FreeSpace
' Step 2 - should now be able to quiz locator for default imp
Set Locator = CreateObject ("WbemScripting.SWbemLocator")
WScript.Echo "Impersonation level is: " & Locator.Security_.impersonationLevel
' Step 3 - should be able to connect to cimv2 from locator
Set Services = Locator.ConnectServer()
set disk2 = Services.Get ("Win32_LogicalDisk=""D:""")
WScript.Echo "Free space is: " & Disk2.FreeSpace
if err <> 0 then
WScript.Echo "0x" & Hex(Err.Number), Err.Description, Err.Source
end if
|
<gh_stars>10-100
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0"; "shdocvw.dll"
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Begin VB.Form frmHscSearchTester
BorderStyle = 1 'Fixed Single
Caption = "HSC Search Tester"
ClientHeight = 9705
ClientLeft = 3240
ClientTop = 1215
ClientWidth = 8940
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 9705
ScaleWidth = 8940
Begin VB.CommandButton cmdClose
Caption = "&Close"
Height = 390
Left = 7875
TabIndex = 15
Top = 9120
Width = 1035
End
Begin VB.Timer Timer1
Left = 3360
Top = 0
End
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 195
Left = 0
TabIndex = 2
Top = 9510
Width = 8940
_ExtentX = 15769
_ExtentY = 344
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 1
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
EndProperty
EndProperty
End
Begin VB.Frame Frame1
Height = 9150
Left = 30
TabIndex = 0
Top = -60
Width = 8880
Begin TabDlg.SSTab SSTab1
Height = 7830
Left = 105
TabIndex = 7
Top = 1230
Width = 8655
_ExtentX = 15266
_ExtentY = 13811
_Version = 393216
TabHeight = 520
TabCaption(0) = "Basic Query Information"
TabPicture(0) = "HSCSearchTester.frx":0000
Tab(0).ControlEnabled= -1 'True
Tab(0).Control(0)= "Label6"
Tab(0).Control(0).Enabled= 0 'False
Tab(0).Control(1)= "wb"
Tab(0).Control(1).Enabled= 0 'False
Tab(0).Control(2)= "Frame2"
Tab(0).Control(2).Enabled= 0 'False
Tab(0).Control(3)= "Frame3"
Tab(0).Control(3).Enabled= 0 'False
Tab(0).ControlCount= 4
TabCaption(1) = "Advanced Query Information"
TabPicture(1) = "HSCSearchTester.frx":001C
Tab(1).ControlEnabled= 0 'False
Tab(1).Control(0)= "Label2"
Tab(1).Control(0).Enabled= 0 'False
Tab(1).Control(1)= "Label1"
Tab(1).Control(1).Enabled= 0 'False
Tab(1).Control(2)= "txtQuery"
Tab(1).Control(2).Enabled= 0 'False
Tab(1).Control(3)= "cmdOpenTpl"
Tab(1).Control(3).Enabled= 0 'False
Tab(1).Control(4)= "txtQTpl"
Tab(1).Control(4).Enabled= 0 'False
Tab(1).ControlCount= 5
TabCaption(2) = "Summary Results"
TabPicture(2) = "HSCSearchTester.frx":0038
Tab(2).ControlEnabled= 0 'False
Tab(2).Control(0)= "Label11"
Tab(2).Control(0).Enabled= 0 'False
Tab(2).Control(1)= "Label12"
Tab(2).Control(1).Enabled= 0 'False
Tab(2).Control(2)= "wb2"
Tab(2).Control(2).Enabled= 0 'False
Tab(2).Control(3)= "lstAllMatches"
Tab(2).Control(3).Enabled= 0 'False
Tab(2).ControlCount= 4
Begin VB.ListBox lstAllMatches
Height = 2985
ItemData = "HSCSearchTester.frx":0054
Left = -74850
List = "HSCSearchTester.frx":005B
TabIndex = 31
Top = 645
Width = 8280
End
Begin VB.Frame Frame3
Caption = "AutoStringified Query"
Height = 2010
Left = 150
TabIndex = 26
Top = 360
Width = 8370
Begin VB.TextBox txtASQ
Enabled = 0 'False
Height = 315
Left = 105
TabIndex = 29
Top = 255
Width = 8115
End
Begin VB.ListBox lstAutoStringifiableQResults
Height = 1035
ItemData = "HSCSearchTester.frx":006B
Left = 105
List = "HSCSearchTester.frx":0072
TabIndex = 27
Top = 855
Width = 8115
End
Begin VB.Label lblAutoStringifiable
Height = 255
Left = 105
TabIndex = 30
Top = 240
Width = 2370
End
Begin VB.Label Label9
Caption = "AutoStringified Query Results"
Height = 255
Left = 105
TabIndex = 28
Top = 615
Width = 2370
End
End
Begin VB.Frame Frame2
Caption = "Keyword Query [executed always]"
Height = 2850
Left = 150
TabIndex = 16
Top = 2385
Width = 8370
Begin VB.TextBox txtCanonicalQuery
Enabled = 0 'False
Height = 315
Left = 1125
TabIndex = 20
Top = 540
Width = 7095
End
Begin VB.ListBox lstStw
Height = 1035
Left = 105
TabIndex = 19
Top = 525
Width = 855
End
Begin VB.ListBox lstSS
Height = 840
Left = 120
TabIndex = 18
Top = 1890
Width = 855
End
Begin VB.ListBox lstMatches
Height = 1620
ItemData = "HSCSearchTester.frx":0082
Left = 1095
List = "HSCSearchTester.frx":0089
TabIndex = 17
Top = 1125
Width = 7125
End
Begin VB.Label Label5
Caption = "Stop Signs"
Height = 255
Left = 120
TabIndex = 24
Top = 1650
Width = 855
End
Begin VB.Label Label4
Caption = "Stop Words"
Height = 255
Left = 105
TabIndex = 23
Top = 285
Width = 855
End
Begin VB.Label Label3
Caption = "Keyword Query Results"
Height = 255
Left = 1095
TabIndex = 22
Top = 900
Width = 1845
End
Begin VB.Label Label7
Caption = "Keywords Submitted to HSC"
Height = 255
Left = 1095
TabIndex = 21
Top = 300
Width = 3075
End
End
Begin VB.TextBox txtQTpl
Height = 1815
Left = -74910
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 13
Top = 825
Width = 8295
End
Begin VB.CommandButton cmdOpenTpl
Caption = "Load Template"
Height = 315
Left = -73590
TabIndex = 12
Top = 435
Width = 1275
End
Begin VB.TextBox txtQuery
Height = 2070
Left = -74895
MultiLine = -1 'True
TabIndex = 11
Top = 2970
Width = 8250
End
Begin SHDocVwCtl.WebBrowser wb
Height = 2415
Left = 150
TabIndex = 8
Top = 5280
Width = 8370
ExtentX = 14764
ExtentY = 4260
ViewMode = 0
Offline = 0
Silent = 0
RegisterAsBrowser= 0
RegisterAsDropTarget= 1
AutoArrange = 0 'False
NoClientEdge = 0 'False
AlignLeft = 0 'False
NoWebView = 0 'False
HideFileNames = 0 'False
SingleClick = 0 'False
SingleSelection = 0 'False
NoFolders = 0 'False
Transparent = 0 'False
ViewID = "{0057D0E0-3573-11CF-AE69-08002B2E1262}"
Location = "http:///"
End
Begin SHDocVwCtl.WebBrowser wb2
Height = 3135
Left = -74850
TabIndex = 35
Top = 3915
Width = 8280
ExtentX = 14605
ExtentY = 5530
ViewMode = 0
Offline = 0
Silent = 0
RegisterAsBrowser= 0
RegisterAsDropTarget= 1
AutoArrange = 0 'False
NoClientEdge = 0 'False
AlignLeft = 0 'False
NoWebView = 0 'False
HideFileNames = 0 'False
SingleClick = 0 'False
SingleSelection = 0 'False
NoFolders = 0 'False
Transparent = 0 'False
ViewID = "{0057D0E0-3573-11CF-AE69-08002B2E1262}"
Location = "http:///"
End
Begin VB.Label Label12
Caption = "Taxonomy Entry XML Dump"
Height = 195
Left = -74790
TabIndex = 34
Top = 3705
Width = 2550
End
Begin VB.Label Label11
Caption = "All Query Results"
Height = 255
Left = -74835
TabIndex = 33
Top = 450
Width = 1845
End
Begin VB.Label Label6
Caption = "Taxonomy Entry XML Dump"
Height = 195
Left = 135
TabIndex = 25
Top = 6015
Width = 2550
End
Begin VB.Label Label1
Caption = "Query Template"
Height = 255
Left = -74910
TabIndex = 14
Top = 495
Width = 1215
End
Begin VB.Label Label2
Caption = "Resulting XPATH Query:"
Height = 255
Left = -74880
TabIndex = 10
Top = 2715
Width = 2490
End
End
Begin VB.TextBox txtHht
Height = 330
Left = 135
TabIndex = 6
Top = 315
Width = 7620
End
Begin VB.CommandButton cmdBrowse
Caption = "..."
Height = 360
Left = 7800
TabIndex = 5
Top = 285
Width = 375
End
Begin VB.CommandButton cmdOpen
Caption = "Open"
Height = 360
Left = 8205
TabIndex = 4
Top = 285
Width = 555
End
Begin VB.CommandButton cmdNewQuery
Caption = "New Query"
Height = 330
Left = 7800
TabIndex = 3
Top = 825
Width = 975
End
Begin VB.TextBox txtInput
Enabled = 0 'False
Height = 315
Left = 120
TabIndex = 1
Top = 840
Width = 7635
End
Begin VB.Label Label10
Caption = "HHT File"
Height = 255
Left = 135
TabIndex = 32
Top = 120
Width = 3075
End
Begin VB.Label Label8
Caption = "User Typed Query"
Height = 255
Left = 120
TabIndex = 9
Top = 645
Width = 3075
End
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 7350
Top = 9150
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
End
Attribute VB_Name = "frmHscSearchTester"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private WithEvents m_HssQt As HssSimSearch
Attribute m_HssQt.VB_VarHelpID = -1
Private m_dblTimeLastKey As Double
Private m_strHht As String ' The Hht File used as base.
Private m_strTempXMLFile As String ' Temporary File for XML Rendering
Private m_bBatchMode As Boolean ' Tells parts of the app whether
' we are running Batch or interactive
Private Function GetFile(ByVal strURI As String) As String
GetFile = ""
Dim oFs As Scripting.FileSystemObject: Set oFs = New FileSystemObject
Dim oTs As TextStream: Set oTs = oFs.OpenTextFile(strURI)
GetFile = oTs.ReadAll
End Function
Private Sub cmdBrowse_Click()
CommonDialog1.ShowOpen
txtHht.Text = CommonDialog1.FileName
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub cmdNewQuery_Click()
Me.txtInput = ""
End Sub
Private Sub cmdOpenTpl_Click()
CommonDialog1.ShowOpen
If (Len(CommonDialog1.FileName) > 0) Then
Me.txtQTpl.Text = GetFile(CommonDialog1.FileName)
m_HssQt.XpathQueryTplXml = txtQTpl
ProcessQuery
End If
End Sub
Private Sub cmdOpen_Click()
' OpenHht CommonDialog1.FileName
m_HssQt.TestedHht = CommonDialog1.FileName
Me.Frame1.Enabled = True
Me.txtInput.Enabled = True
Me.cmdOpenTpl.Enabled = True
Common_Exit:
End Sub
Private Sub Form_Load()
Set m_HssQt = New HssSimSearch
m_HssQt.Init
' Initialize the XPath Query Generator
txtQTpl = GetFile(App.Path + "\HSCQuery_Exact_Match.xml")
m_HssQt.XpathQueryTplXml = txtQTpl
' Let's Get a Temporary File Name
Dim oFs As Scripting.FileSystemObject: Set oFs = New Scripting.FileSystemObject
m_strTempXMLFile = Environ$("TEMP") + "\" + oFs.GetTempName + ".xml"
Dim oFh As Scripting.TextStream
Set oFh = oFs.CreateTextFile(m_strTempXMLFile)
oFh.WriteLine "<Note>When you click on a Match, the Taxonomy Entry will show up here</Note>"
oFh.Close
wb.Navigate m_strTempXMLFile
StatusBar1.Style = sbrSimple
Me.AutoRedraw = False
' == Disable all controls which should not have User Input
Me.cmdOpenTpl.Enabled = False
If (Len(Command$) > 0) Then
doWork Command$
Unload Me
Else
Timer1.Interval = 400
End If
End Sub
Private Sub Form_Terminate()
Dim oFs As Scripting.FileSystemObject: Set oFs = New Scripting.FileSystemObject
If oFs.FileExists(m_strTempXMLFile) Then oFs.DeleteFile m_strTempXMLFile
End Sub
Private Sub lstAllMatches_Click()
DisplayTaxonomyEntry lstAllMatches, m_HssQt.MergedResults, wb2
End Sub
Private Sub lstAutoStringifiableQResults_Click()
DisplayTaxonomyEntry lstAutoStringifiableQResults, m_HssQt.AutoStringResults, wb
End Sub
Private Sub lstMatches_Click()
DisplayTaxonomyEntry lstMatches, m_HssQt.KwQResults, wb
End Sub
Sub DisplayTaxonomyEntry(oList As ListBox, oResultsList As IXMLDOMNodeList, wBrowser As WebBrowser)
If (oList.ListIndex < oResultsList.length) Then
Dim oDom As DOMDocument: Set oDom = New DOMDocument
oDom.loadXML oResultsList.Item(oList.ListIndex).xml
oDom.save m_strTempXMLFile
wBrowser.Navigate m_strTempXMLFile
End If
End Sub
Private Sub m_HssQt_QueryComplete(bCancel As Variant)
Debug.Print "Here"
' Now let's show everything we've gathered on the UI
If (m_HssQt.QueryIsAutoStringifiable) Then
Me.lblAutoStringifiable = "[ Query is AutoStringifiable ]"
Else
Me.lblAutoStringifiable = "[ Query is NOT AutoStringifiable ]"
End If
Me.txtASQ = m_HssQt.AutoStringyQuery
Me.txtCanonicalQuery = m_HssQt.CanonicalQuery
' Populate the Resulting Stopwords and StopSigns Lists
lstStw.Clear
Dim strKey As Variant
For Each strKey In m_HssQt.StopWords.Keys ' m_odStw.Keys
lstStw.AddItem strKey
Next
lstSS.Clear
For Each strKey In m_HssQt.StopSigns.Keys ' m_odSs.Keys
lstSS.AddItem strKey
Next
DoEvents
' BUGBUG: Need to add stats for AutoString Query.
If (Not m_HssQt.KwQResults Is Nothing) Then
StatusBar1.SimpleText = "Time: " & _
Format(m_HssQt.QueryTiming, "##0.000000") & _
" Records = " & m_HssQt.KwQResults.length
End If
' BUGBUG: Need to prop back from Query Object the Query Errors.
Dim bKwqError As Boolean, bAsqError As Boolean
bKwqError = False: bAsqError = False
DisplayResultsList m_HssQt.AutoStringResults, Me.lstAutoStringifiableQResults, bAsqError
DisplayResultsList m_HssQt.KwQResults, lstMatches, bKwqError
DisplayResultsList m_HssQt.MergedResults, Me.lstAllMatches, False
End Sub
Private Sub Timer1_Timer()
Static s_strPrevInput As String
Static s_bqueryInProgress As Boolean
If (Len(Me.txtInput) > 0) Then
If (Timer - m_dblTimeLastKey > 0.2) Then
If (Me.txtInput <> s_strPrevInput) Then
If (Not s_bqueryInProgress) Then
s_bqueryInProgress = True
s_strPrevInput = Me.txtInput
ProcessQuery
s_bqueryInProgress = False
End If
End If
End If
End If
End Sub
Private Sub txtInput_Change()
' Debug.Print "txtInput_Change: Query = " & txtInput.Text
m_dblTimeLastKey = Timer
End Sub
Sub ProcessQuery()
m_HssQt.ProcessQuery Me.txtInput
Common_Exit:
Exit Sub
End Sub
Sub DisplayResultsList(oDomList As IXMLDOMNodeList, oListBox As ListBox, bError As Boolean)
Dim i As Long
oListBox.Clear
If (Not oDomList Is Nothing) Then
If oDomList.length = 0 Then oListBox.AddItem "No matching elements"
For i = 0 To oDomList.length - 1
oListBox.AddItem "[" + CStr(i + 1) + "]" + oDomList.Item(i).Attributes.getNamedItem("TITLE").Text
Next
Else
oListBox.AddItem "No matching elements - N"
End If
End Sub
' ================ Batch Procssing Routines ======================
' ============= Command Line Interface ====================
' Function: Parseopts
' Objective : Supplies a Command Line arguments interface parsing
Function ParseOpts(ByVal strCmd As String) As Boolean
' Dim strErrMsg As String: strErrMsg = "": If (g_bOnErrorHandling) Then On Error GoTo Error_Handler
Dim lProgOpt As Long
Dim iError As Long
Dim lFileCounter As Long: lFileCounter = 0
Const INP_FILE1 As Long = 2 ^ 0
Const INP_FILE2 As Long = 2 ^ 1
' Const OPT_SSDB As Long = 2 ^ 0
Dim strArg As String
Do While (Len(strCmd) > 0 And iError = 0)
strCmd = Trim$(strCmd)
If Left$(strCmd, 1) = Chr(34) Then
strCmd = Right$(strCmd, Len(strCmd) - 1)
strArg = vntGetTok(strCmd, sTokSepIN:=Chr(34))
Else
strArg = vntGetTok(strCmd, sTokSepIN:=" ")
End If
If (Left$(strArg, 1) = "/" Or Left$(strArg, 1) = "-") Then
' strArg = Mid$(strArg, 2)
'
' Select Case UCase$(strArg)
' ' All the Cases are in alphabetical order to make your life
' ' easier to go through them. There are a couple of exceptions.
' ' The first one is that every NOXXX option goes after the
' ' pairing OPTION.
' Case "EXPANDONLY"
' lProgOpt = (lProgOpt Or OPT_EXPANDONLY)
' Me.chkExpandOnly = vbChecked
'
'
' Case "INC"
' lProgOpt = (lProgOpt Or OPT_INC)
' Me.chkInc = vbChecked
'
' Case "SSDB"
' strArg = LCase$(vntGetTok(strCmd, sTokSepIN:=" "))
' If ("\\" = Left$(strArg, 2)) Then
' lProgOpt = lProgOpt Or OPT_SSDB
' Me.txtSSDB = strArg
' Else
' MsgBox ("A source safe database must be specified using UNC '\\' style notation")
' iError = 1
' End If
'
' Case "SSPROJ"
' strArg = LCase$(vntGetTok(strCmd, sTokSepIN:=" "))
' If ("$/" = Left$(strArg, 2)) Then
' lProgOpt = lProgOpt Or OPT_SSPROJ
' Me.txtSSProject = strArg
' Else
' MsgBox ("A source safe project must be specified using '$/' style notation")
' iError = 1
' End If
'
' Case "LVIDIR"
' strArg = LCase$(vntGetTok(strCmd, sTokSepIN:=" "))
' If ("\\" = Left$(strArg, 2)) Then
' lProgOpt = lProgOpt Or OPT_LVIDIR
' Me.txtLiveImageDir = strArg
' Else
' MsgBox ("Live Image Directory must be specified using UNC '\\' style notation")
' iError = 1
' End If
'
' Case "WORKDIR"
' strArg = LCase$(vntGetTok(strCmd, sTokSepIN:=" "))
' If ("\\" = Left$(strArg, 2)) Then
' lProgOpt = lProgOpt Or OPT_WORKDIR
' Me.txtWorkDir = strArg
' Else
' MsgBox ("Working Directory must be specified using UNC '\\' style notation")
' iError = 1
' End If
'
' Case "RENLIST"
' strArg = vntGetTok(strCmd, sTokSepIN:=" ")
' If (Not (FileExists(strArg))) Then
' MsgBox ("Cannot open Renames file " & strArg & ". Make sure you type a Full Pathname")
' iError = 1
' lProgOpt = (lProgOpt And (Not OPT_RENLIST))
' Else
' Me.txtRenamesFile = strArg
' lProgOpt = (lProgOpt Or OPT_RENLIST)
' End If
'
'
' Case Else
' MsgBox "Program Option: " & "/" & strArg & " is not supported", vbOKOnly, "Program Arguments Error"
' lProgOpt = 0
' iError = 1
'
' End Select
Else
lFileCounter = lFileCounter + 1
' strArg = vntGetTok(strCmd, sTokSepIN:=" ")
If (Not (FileExists(strArg))) Then
MsgBox ("Cannot open input file " & strArg & ". Make sure you type a Full Pathname")
iError = 1
Select Case lFileCounter
Case 1
lProgOpt = (lProgOpt And (Not INP_FILE1))
Case 2
lProgOpt = (lProgOpt And (Not INP_FILE2))
End Select
Else
Select Case lFileCounter
Case 1
' m_strInputBatch = Rel2AbsPathName(strArg)
m_HssQt.TestBatch = Rel2AbsPathName(strArg)
lProgOpt = (lProgOpt Or INP_FILE1)
Case 2
' Me.txtHht = Rel2AbsPathName(strArg)
m_HssQt.TestedHht = Rel2AbsPathName(strArg)
Me.txtHht = m_HssQt.TestedHht
lProgOpt = (lProgOpt Or INP_FILE2)
End Select
End If
End If
Loop
' Now we check for a complete and <coherent> list of files / options.
' As all options are
' mandatory then we check for ALL options being set.
If ((lProgOpt And (INP_FILE1 Or INP_FILE2)) <> (INP_FILE1 Or INP_FILE2)) Then
UseageMsg
iError = 1
End If
ParseOpts = (0 = iError)
Exit Function
'Error_Handler:
' g_XErr.SetInfo "frmLiveHelpFileImage::ParseOpts", strErrMsg
' Err.Raise Err.Number
End Function
Sub doWork(ByVal strCmd As String)
' Dim strErrMsg As String: strErrMsg = "": If (g_bOnErrorHandling) Then On Error GoTo Error_Handler
If Not ParseOpts(strCmd) Then
GoTo Common_Exit
End If
Me.Show vbModeless
m_HssQt.ProcessBatch
Common_Exit:
Exit Sub
'Error_Handler:
'
' g_XErr.SetInfo "frmLiveHelpFileImage::doWork", strErrMsg
' Err.Raise Err.Number
'
End Sub
Sub UseageMsg()
MsgBox "HSCSearchTester TestFile.xml HHTFile", _
vbOKOnly, "HSCSearchTester Program Usage"
End Sub
|
Private Function mean(v() As Double, ByVal leng As Integer) As Variant
Dim sum As Double, i As Integer
sum = 0: i = 0
For i = 0 To leng - 1
sum = sum + vv
Next i
If leng = 0 Then
mean = CVErr(xlErrDiv0)
Else
mean = sum / leng
End If
End Function
Public Sub main()
Dim v(4) As Double
Dim i As Integer, leng As Integer
v(0) = 1#
v(1) = 2#
v(2) = 2.178
v(3) = 3#
v(4) = 3.142
For leng = 5 To 0 Step -1
Debug.Print "mean[";
For i = 0 To leng - 1
Debug.Print IIf(i, "; " & v(i), "" & v(i));
Next i
Debug.Print "] = "; mean(v, leng)
Next leng
End Sub
|
Option Explicit
Const strXml As String = "" & _
"<Students>" & _
"<Student Name=""April"" Gender=""F"" DateOfBirth=""1989-01-02"" />" & _
"<Student Name=""Bob"" Gender=""M"" DateOfBirth=""1990-03-04"" />" & _
"<Student Name=""Chad"" Gender=""M"" DateOfBirth=""1991-05-06"" />" & _
"<Student Name=""Dave"" Gender=""M"" DateOfBirth=""1992-07-08"">" & _
"<Pet Type=""dog"" Name=""Rover"" />" & _
"</Student>" & _
"<Student DateOfBirth=""1993-09-10"" Gender=""F"" Name=""Émily"" />" & _
"</Students>"
Sub Main_Xml()
Dim MyXml As Object
Dim myNodes, myNode
With CreateObject("MSXML2.DOMDocument")
.LoadXML strXml
Set myNodes = .getElementsByTagName("Student")
End With
If Not myNodes Is Nothing Then
For Each myNode In myNodes
Debug.Print myNode.getAttribute("Name")
Next
End If
Set myNodes = Nothing
End Sub
|
<reponame>lihaokang/riscv_pulpino
/*
----------------------------------------------------------------------------------
- -
- Copyright Mentor Graphics Corporation -
- All Rights Reserved -
- -
- THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY -
- INFORMATION WHICH IS THE PROPERTY OF MENTOR GRAPHICS -
- CORPORATION OR ITS LICENSORS AND IS SUBJECT -
- TO LICENSE TERMS. -
- -
----------------------------------------------------------------------------------
- File created by: membistipGenerate -
- Version: 2017.1 -
- Created on: Fri Feb 22 16:55:45 CST 2019 -
----------------------------------------------------------------------------------
*/
module SMARCHCHKB_LVISION_MBISTPG_ASSEMBLY (
BIST_CLK,
MEM0_CSB,
MEM0_OE,
MEM0_WEB3,
MEM0_WEB2,
MEM0_WEB1,
MEM0_WEB0,
MEM0_DVS3,
MEM0_DVS2,
MEM0_DVS1,
MEM0_DVS0,
MEM0_DVSE,
MEM0_A11,
MEM0_A10,
MEM0_A9,
MEM0_A8,
MEM0_A7,
MEM0_A6,
MEM0_A5,
MEM0_A4,
MEM0_A3,
MEM0_A2,
MEM0_A1,
MEM0_A0,
MEM0_DI31,
MEM0_DI30,
MEM0_DI29,
MEM0_DI28,
MEM0_DI27,
MEM0_DI26,
MEM0_DI25,
MEM0_DI24,
MEM0_DI23,
MEM0_DI22,
MEM0_DI21,
MEM0_DI20,
MEM0_DI19,
MEM0_DI18,
MEM0_DI17,
MEM0_DI16,
MEM0_DI15,
MEM0_DI14,
MEM0_DI13,
MEM0_DI12,
MEM0_DI11,
MEM0_DI10,
MEM0_DI9,
MEM0_DI8,
MEM0_DI7,
MEM0_DI6,
MEM0_DI5,
MEM0_DI4,
MEM0_DI3,
MEM0_DI2,
MEM0_DI1,
MEM0_DI0,
MEM0_DO31,
MEM0_DO30,
MEM0_DO29,
MEM0_DO28,
MEM0_DO27,
MEM0_DO26,
MEM0_DO25,
MEM0_DO24,
MEM0_DO23,
MEM0_DO22,
MEM0_DO21,
MEM0_DO20,
MEM0_DO19,
MEM0_DO18,
MEM0_DO17,
MEM0_DO16,
MEM0_DO15,
MEM0_DO14,
MEM0_DO13,
MEM0_DO12,
MEM0_DO11,
MEM0_DO10,
MEM0_DO9,
MEM0_DO8,
MEM0_DO7,
MEM0_DO6,
MEM0_DO5,
MEM0_DO4,
MEM0_DO3,
MEM0_DO2,
MEM0_DO1,
MEM0_DO0,
MEM1_CSB,
MEM1_OE,
MEM1_WEB3,
MEM1_WEB2,
MEM1_WEB1,
MEM1_WEB0,
MEM1_DVS3,
MEM1_DVS2,
MEM1_DVS1,
MEM1_DVS0,
MEM1_DVSE,
MEM1_A12,
MEM1_A11,
MEM1_A10,
MEM1_A9,
MEM1_A8,
MEM1_A7,
MEM1_A6,
MEM1_A5,
MEM1_A4,
MEM1_A3,
MEM1_A2,
MEM1_A1,
MEM1_A0,
MEM1_DI31,
MEM1_DI30,
MEM1_DI29,
MEM1_DI28,
MEM1_DI27,
MEM1_DI26,
MEM1_DI25,
MEM1_DI24,
MEM1_DI23,
MEM1_DI22,
MEM1_DI21,
MEM1_DI20,
MEM1_DI19,
MEM1_DI18,
MEM1_DI17,
MEM1_DI16,
MEM1_DI15,
MEM1_DI14,
MEM1_DI13,
MEM1_DI12,
MEM1_DI11,
MEM1_DI10,
MEM1_DI9,
MEM1_DI8,
MEM1_DI7,
MEM1_DI6,
MEM1_DI5,
MEM1_DI4,
MEM1_DI3,
MEM1_DI2,
MEM1_DI1,
MEM1_DI0,
MEM1_DO31,
MEM1_DO30,
MEM1_DO29,
MEM1_DO28,
MEM1_DO27,
MEM1_DO26,
MEM1_DO25,
MEM1_DO24,
MEM1_DO23,
MEM1_DO22,
MEM1_DO21,
MEM1_DO20,
MEM1_DO19,
MEM1_DO18,
MEM1_DO17,
MEM1_DO16,
MEM1_DO15,
MEM1_DO14,
MEM1_DO13,
MEM1_DO12,
MEM1_DO11,
MEM1_DO10,
MEM1_DO9,
MEM1_DO8,
MEM1_DO7,
MEM1_DO6,
MEM1_DO5,
MEM1_DO4,
MEM1_DO3,
MEM1_DO2,
MEM1_DO1,
MEM1_DO0
, BIST_SHIFT , BIST_HOLD , BIST_SETUP2 , BIST_SETUP , MBISTPG_TESTDATA_SELECT
, TCK_MODE
, TCK , LV_TM , MBISTPG_ALGO_MODE , MBISTPG_MEM_RST
, MBISTPG_REDUCED_ADDR_CNT_EN
, MBISTPG_ASYNC_RESETN , BIST_SI , MBISTPG_SO , MBISTPG_EN , MBISTPG_DONE
, MBISTPG_GO
, MBISTPG_DIAG_EN , FL_CNT_MODE , MBISTPG_CMP_STAT_ID_SEL );
input[5:0] MBISTPG_CMP_STAT_ID_SEL;
input[1:0] FL_CNT_MODE;
wire[1:0] FL_CNT_MODE;
input MBISTPG_DIAG_EN;
output MBISTPG_GO;
output MBISTPG_DONE;
input MBISTPG_EN;
output MBISTPG_SO;
input BIST_SI;
input MBISTPG_ASYNC_RESETN;
input MBISTPG_REDUCED_ADDR_CNT_EN;
input MBISTPG_MEM_RST;
input[1:0] MBISTPG_ALGO_MODE;
input LV_TM;
input TCK;
input TCK_MODE;
input MBISTPG_TESTDATA_SELECT;
input[1:0] BIST_SETUP;
wire[1:0] BIST_SETUP;
input BIST_SETUP2;
input BIST_HOLD;
input BIST_SHIFT;
input BIST_CLK;
input MEM0_CSB;
input MEM0_OE;
input MEM0_WEB3;
input MEM0_WEB2;
input MEM0_WEB1;
input MEM0_WEB0;
input MEM0_DVS3;
input MEM0_DVS2;
input MEM0_DVS1;
input MEM0_DVS0;
input MEM0_DVSE;
input MEM0_A11;
input MEM0_A10;
input MEM0_A9;
input MEM0_A8;
input MEM0_A7;
input MEM0_A6;
input MEM0_A5;
input MEM0_A4;
input MEM0_A3;
input MEM0_A2;
input MEM0_A1;
input MEM0_A0;
input MEM0_DI31;
input MEM0_DI30;
input MEM0_DI29;
input MEM0_DI28;
input MEM0_DI27;
input MEM0_DI26;
input MEM0_DI25;
input MEM0_DI24;
input MEM0_DI23;
input MEM0_DI22;
input MEM0_DI21;
input MEM0_DI20;
input MEM0_DI19;
input MEM0_DI18;
input MEM0_DI17;
input MEM0_DI16;
input MEM0_DI15;
input MEM0_DI14;
input MEM0_DI13;
input MEM0_DI12;
input MEM0_DI11;
input MEM0_DI10;
input MEM0_DI9;
input MEM0_DI8;
input MEM0_DI7;
input MEM0_DI6;
input MEM0_DI5;
input MEM0_DI4;
input MEM0_DI3;
input MEM0_DI2;
input MEM0_DI1;
input MEM0_DI0;
output MEM0_DO31;
output MEM0_DO30;
output MEM0_DO29;
output MEM0_DO28;
output MEM0_DO27;
output MEM0_DO26;
output MEM0_DO25;
output MEM0_DO24;
output MEM0_DO23;
output MEM0_DO22;
output MEM0_DO21;
output MEM0_DO20;
output MEM0_DO19;
output MEM0_DO18;
output MEM0_DO17;
output MEM0_DO16;
output MEM0_DO15;
output MEM0_DO14;
output MEM0_DO13;
output MEM0_DO12;
output MEM0_DO11;
output MEM0_DO10;
output MEM0_DO9;
output MEM0_DO8;
output MEM0_DO7;
output MEM0_DO6;
output MEM0_DO5;
output MEM0_DO4;
output MEM0_DO3;
output MEM0_DO2;
output MEM0_DO1;
output MEM0_DO0;
input MEM1_CSB;
input MEM1_OE;
input MEM1_WEB3;
input MEM1_WEB2;
input MEM1_WEB1;
input MEM1_WEB0;
input MEM1_DVS3;
input MEM1_DVS2;
input MEM1_DVS1;
input MEM1_DVS0;
input MEM1_DVSE;
input MEM1_A12;
input MEM1_A11;
input MEM1_A10;
input MEM1_A9;
input MEM1_A8;
input MEM1_A7;
input MEM1_A6;
input MEM1_A5;
input MEM1_A4;
input MEM1_A3;
input MEM1_A2;
input MEM1_A1;
input MEM1_A0;
input MEM1_DI31;
input MEM1_DI30;
input MEM1_DI29;
input MEM1_DI28;
input MEM1_DI27;
input MEM1_DI26;
input MEM1_DI25;
input MEM1_DI24;
input MEM1_DI23;
input MEM1_DI22;
input MEM1_DI21;
input MEM1_DI20;
input MEM1_DI19;
input MEM1_DI18;
input MEM1_DI17;
input MEM1_DI16;
input MEM1_DI15;
input MEM1_DI14;
input MEM1_DI13;
input MEM1_DI12;
input MEM1_DI11;
input MEM1_DI10;
input MEM1_DI9;
input MEM1_DI8;
input MEM1_DI7;
input MEM1_DI6;
input MEM1_DI5;
input MEM1_DI4;
input MEM1_DI3;
input MEM1_DI2;
input MEM1_DI1;
input MEM1_DI0;
output MEM1_DO31;
output MEM1_DO30;
output MEM1_DO29;
output MEM1_DO28;
output MEM1_DO27;
output MEM1_DO26;
output MEM1_DO25;
output MEM1_DO24;
output MEM1_DO23;
output MEM1_DO22;
output MEM1_DO21;
output MEM1_DO20;
output MEM1_DO19;
output MEM1_DO18;
output MEM1_DO17;
output MEM1_DO16;
output MEM1_DO15;
output MEM1_DO14;
output MEM1_DO13;
output MEM1_DO12;
output MEM1_DO11;
output MEM1_DO10;
output MEM1_DO9;
output MEM1_DO8;
output MEM1_DO7;
output MEM1_DO6;
output MEM1_DO5;
output MEM1_DO4;
output MEM1_DO3;
output MEM1_DO2;
output MEM1_DO1;
output MEM1_DO0;
// [start] : AUT Instance
SMARCHCHKB_LVISION_MBISTPG_ASSEMBLY_UNDER_TEST SMARCHCHKB_LVISION_MBISTPG_ASSEMBLY_UNDER_TEST_INST (
.MEM0_CK ( BIST_CLK ),
.MEM0_CSB ( MEM0_CSB ),
.MEM0_OE ( MEM0_OE ),
.MEM0_WEB3 ( MEM0_WEB3 ),
.MEM0_WEB2 ( MEM0_WEB2 ),
.MEM0_WEB1 ( MEM0_WEB1 ),
.MEM0_WEB0 ( MEM0_WEB0 ),
.MEM0_DVS3 ( MEM0_DVS3 ),
.MEM0_DVS2 ( MEM0_DVS2 ),
.MEM0_DVS1 ( MEM0_DVS1 ),
.MEM0_DVS0 ( MEM0_DVS0 ),
.MEM0_DVSE ( MEM0_DVSE ),
.MEM0_A11 ( MEM0_A11 ),
.MEM0_A10 ( MEM0_A10 ),
.MEM0_A9 ( MEM0_A9 ),
.MEM0_A8 ( MEM0_A8 ),
.MEM0_A7 ( MEM0_A7 ),
.MEM0_A6 ( MEM0_A6 ),
.MEM0_A5 ( MEM0_A5 ),
.MEM0_A4 ( MEM0_A4 ),
.MEM0_A3 ( MEM0_A3 ),
.MEM0_A2 ( MEM0_A2 ),
.MEM0_A1 ( MEM0_A1 ),
.MEM0_A0 ( MEM0_A0 ),
.MEM0_DI31 ( MEM0_DI31 ),
.MEM0_DI30 ( MEM0_DI30 ),
.MEM0_DI29 ( MEM0_DI29 ),
.MEM0_DI28 ( MEM0_DI28 ),
.MEM0_DI27 ( MEM0_DI27 ),
.MEM0_DI26 ( MEM0_DI26 ),
.MEM0_DI25 ( MEM0_DI25 ),
.MEM0_DI24 ( MEM0_DI24 ),
.MEM0_DI23 ( MEM0_DI23 ),
.MEM0_DI22 ( MEM0_DI22 ),
.MEM0_DI21 ( MEM0_DI21 ),
.MEM0_DI20 ( MEM0_DI20 ),
.MEM0_DI19 ( MEM0_DI19 ),
.MEM0_DI18 ( MEM0_DI18 ),
.MEM0_DI17 ( MEM0_DI17 ),
.MEM0_DI16 ( MEM0_DI16 ),
.MEM0_DI15 ( MEM0_DI15 ),
.MEM0_DI14 ( MEM0_DI14 ),
.MEM0_DI13 ( MEM0_DI13 ),
.MEM0_DI12 ( MEM0_DI12 ),
.MEM0_DI11 ( MEM0_DI11 ),
.MEM0_DI10 ( MEM0_DI10 ),
.MEM0_DI9 ( MEM0_DI9 ),
.MEM0_DI8 ( MEM0_DI8 ),
.MEM0_DI7 ( MEM0_DI7 ),
.MEM0_DI6 ( MEM0_DI6 ),
.MEM0_DI5 ( MEM0_DI5 ),
.MEM0_DI4 ( MEM0_DI4 ),
.MEM0_DI3 ( MEM0_DI3 ),
.MEM0_DI2 ( MEM0_DI2 ),
.MEM0_DI1 ( MEM0_DI1 ),
.MEM0_DI0 ( MEM0_DI0 ),
.MEM0_DO31 ( MEM0_DO31 ),
.MEM0_DO30 ( MEM0_DO30 ),
.MEM0_DO29 ( MEM0_DO29 ),
.MEM0_DO28 ( MEM0_DO28 ),
.MEM0_DO27 ( MEM0_DO27 ),
.MEM0_DO26 ( MEM0_DO26 ),
.MEM0_DO25 ( MEM0_DO25 ),
.MEM0_DO24 ( MEM0_DO24 ),
.MEM0_DO23 ( MEM0_DO23 ),
.MEM0_DO22 ( MEM0_DO22 ),
.MEM0_DO21 ( MEM0_DO21 ),
.MEM0_DO20 ( MEM0_DO20 ),
.MEM0_DO19 ( MEM0_DO19 ),
.MEM0_DO18 ( MEM0_DO18 ),
.MEM0_DO17 ( MEM0_DO17 ),
.MEM0_DO16 ( MEM0_DO16 ),
.MEM0_DO15 ( MEM0_DO15 ),
.MEM0_DO14 ( MEM0_DO14 ),
.MEM0_DO13 ( MEM0_DO13 ),
.MEM0_DO12 ( MEM0_DO12 ),
.MEM0_DO11 ( MEM0_DO11 ),
.MEM0_DO10 ( MEM0_DO10 ),
.MEM0_DO9 ( MEM0_DO9 ),
.MEM0_DO8 ( MEM0_DO8 ),
.MEM0_DO7 ( MEM0_DO7 ),
.MEM0_DO6 ( MEM0_DO6 ),
.MEM0_DO5 ( MEM0_DO5 ),
.MEM0_DO4 ( MEM0_DO4 ),
.MEM0_DO3 ( MEM0_DO3 ),
.MEM0_DO2 ( MEM0_DO2 ),
.MEM0_DO1 ( MEM0_DO1 ),
.MEM0_DO0 ( MEM0_DO0 ),
.MEM1_CK ( BIST_CLK ),
.MEM1_CSB ( MEM1_CSB ),
.MEM1_OE ( MEM1_OE ),
.MEM1_WEB3 ( MEM1_WEB3 ),
.MEM1_WEB2 ( MEM1_WEB2 ),
.MEM1_WEB1 ( MEM1_WEB1 ),
.MEM1_WEB0 ( MEM1_WEB0 ),
.MEM1_DVS3 ( MEM1_DVS3 ),
.MEM1_DVS2 ( MEM1_DVS2 ),
.MEM1_DVS1 ( MEM1_DVS1 ),
.MEM1_DVS0 ( MEM1_DVS0 ),
.MEM1_DVSE ( MEM1_DVSE ),
.MEM1_A12 ( MEM1_A12 ),
.MEM1_A11 ( MEM1_A11 ),
.MEM1_A10 ( MEM1_A10 ),
.MEM1_A9 ( MEM1_A9 ),
.MEM1_A8 ( MEM1_A8 ),
.MEM1_A7 ( MEM1_A7 ),
.MEM1_A6 ( MEM1_A6 ),
.MEM1_A5 ( MEM1_A5 ),
.MEM1_A4 ( MEM1_A4 ),
.MEM1_A3 ( MEM1_A3 ),
.MEM1_A2 ( MEM1_A2 ),
.MEM1_A1 ( MEM1_A1 ),
.MEM1_A0 ( MEM1_A0 ),
.MEM1_DI31 ( MEM1_DI31 ),
.MEM1_DI30 ( MEM1_DI30 ),
.MEM1_DI29 ( MEM1_DI29 ),
.MEM1_DI28 ( MEM1_DI28 ),
.MEM1_DI27 ( MEM1_DI27 ),
.MEM1_DI26 ( MEM1_DI26 ),
.MEM1_DI25 ( MEM1_DI25 ),
.MEM1_DI24 ( MEM1_DI24 ),
.MEM1_DI23 ( MEM1_DI23 ),
.MEM1_DI22 ( MEM1_DI22 ),
.MEM1_DI21 ( MEM1_DI21 ),
.MEM1_DI20 ( MEM1_DI20 ),
.MEM1_DI19 ( MEM1_DI19 ),
.MEM1_DI18 ( MEM1_DI18 ),
.MEM1_DI17 ( MEM1_DI17 ),
.MEM1_DI16 ( MEM1_DI16 ),
.MEM1_DI15 ( MEM1_DI15 ),
.MEM1_DI14 ( MEM1_DI14 ),
.MEM1_DI13 ( MEM1_DI13 ),
.MEM1_DI12 ( MEM1_DI12 ),
.MEM1_DI11 ( MEM1_DI11 ),
.MEM1_DI10 ( MEM1_DI10 ),
.MEM1_DI9 ( MEM1_DI9 ),
.MEM1_DI8 ( MEM1_DI8 ),
.MEM1_DI7 ( MEM1_DI7 ),
.MEM1_DI6 ( MEM1_DI6 ),
.MEM1_DI5 ( MEM1_DI5 ),
.MEM1_DI4 ( MEM1_DI4 ),
.MEM1_DI3 ( MEM1_DI3 ),
.MEM1_DI2 ( MEM1_DI2 ),
.MEM1_DI1 ( MEM1_DI1 ),
.MEM1_DI0 ( MEM1_DI0 ),
.MEM1_DO31 ( MEM1_DO31 ),
.MEM1_DO30 ( MEM1_DO30 ),
.MEM1_DO29 ( MEM1_DO29 ),
.MEM1_DO28 ( MEM1_DO28 ),
.MEM1_DO27 ( MEM1_DO27 ),
.MEM1_DO26 ( MEM1_DO26 ),
.MEM1_DO25 ( MEM1_DO25 ),
.MEM1_DO24 ( MEM1_DO24 ),
.MEM1_DO23 ( MEM1_DO23 ),
.MEM1_DO22 ( MEM1_DO22 ),
.MEM1_DO21 ( MEM1_DO21 ),
.MEM1_DO20 ( MEM1_DO20 ),
.MEM1_DO19 ( MEM1_DO19 ),
.MEM1_DO18 ( MEM1_DO18 ),
.MEM1_DO17 ( MEM1_DO17 ),
.MEM1_DO16 ( MEM1_DO16 ),
.MEM1_DO15 ( MEM1_DO15 ),
.MEM1_DO14 ( MEM1_DO14 ),
.MEM1_DO13 ( MEM1_DO13 ),
.MEM1_DO12 ( MEM1_DO12 ),
.MEM1_DO11 ( MEM1_DO11 ),
.MEM1_DO10 ( MEM1_DO10 ),
.MEM1_DO9 ( MEM1_DO9 ),
.MEM1_DO8 ( MEM1_DO8 ),
.MEM1_DO7 ( MEM1_DO7 ),
.MEM1_DO6 ( MEM1_DO6 ),
.MEM1_DO5 ( MEM1_DO5 ),
.MEM1_DO4 ( MEM1_DO4 ),
.MEM1_DO3 ( MEM1_DO3 ),
.MEM1_DO2 ( MEM1_DO2 ),
.MEM1_DO1 ( MEM1_DO1 ),
.MEM1_DO0 ( MEM1_DO0 )
,
.BIST_CLK(BIST_CLK),
.BIST_SHIFT(BIST_SHIFT),
.BIST_HOLD(BIST_HOLD),
.BIST_SETUP2(BIST_SETUP2),
.BIST_SETUP({
BIST_SETUP[1],
BIST_SETUP[0]
}),
.MBISTPG_TESTDATA_SELECT(MBISTPG_TESTDATA_SELECT),
.TCK_MODE(TCK_MODE),
.TCK(TCK),
.LV_TM(LV_TM),
.MBISTPG_ALGO_MODE({
MBISTPG_ALGO_MODE[1],
MBISTPG_ALGO_MODE[0]
}),
.MBISTPG_MEM_RST(MBISTPG_MEM_RST),
.MBISTPG_REDUCED_ADDR_CNT_EN(MBISTPG_REDUCED_ADDR_CNT_EN),
.MBISTPG_ASYNC_RESETN(MBISTPG_ASYNC_RESETN),
.BIST_SI(BIST_SI),
.MBISTPG_SO(MBISTPG_SO),
.MBISTPG_EN(MBISTPG_EN),
.MBISTPG_DONE(MBISTPG_DONE),
.MBISTPG_GO(MBISTPG_GO),
.MBISTPG_DIAG_EN(MBISTPG_DIAG_EN),
.FL_CNT_MODE({
FL_CNT_MODE[1],
FL_CNT_MODE[0]
}),
.MBISTPG_CMP_STAT_ID_SEL({
MBISTPG_CMP_STAT_ID_SEL[5],
MBISTPG_CMP_STAT_ID_SEL[4],
MBISTPG_CMP_STAT_ID_SEL[3],
MBISTPG_CMP_STAT_ID_SEL[2],
MBISTPG_CMP_STAT_ID_SEL[1],
MBISTPG_CMP_STAT_ID_SEL[0]
}));
// [end] : AUT Instance
// [start] : monitor module
`ifdef LVISION_MBIST_DUMP_MEM_SIGNAL
//synopsys translate_off
// Instances
`define controllerInstPath SMARCHCHKB_LVISION_MBISTPG_ASSEMBLY_UNDER_TEST_INST.SMARCHCHKB_MBIST_CTRL
`define mem0InstPathStp0 SMARCHCHKB_LVISION_MBISTPG_ASSEMBLY_UNDER_TEST_INST.MEM0_MEM_INST
`define mem0InstPath SMARCHCHKB_LVISION_MBISTPG_ASSEMBLY_UNDER_TEST_INST.MEM0_MEM_INST
`define mem1InstPathStp1 SMARCHCHKB_LVISION_MBISTPG_ASSEMBLY_UNDER_TEST_INST.MEM1_MEM_INST
`define mem1InstPath SMARCHCHKB_LVISION_MBISTPG_ASSEMBLY_UNDER_TEST_INST.MEM1_MEM_INST
// Instances
// Controller signals
`define BIST_CLK `controllerInstPath.BIST_CLK
`define BIST_DONE `controllerInstPath.BIST_DONE
`define BIST_EN `controllerInstPath.MBISTPG_EN
`define BIST_COL_ADD `controllerInstPath.BIST_COL_ADD
`define BIST_ROW_ADD `controllerInstPath.BIST_ROW_ADD
`define BIST_WRITEENABLE `controllerInstPath.BIST_WRITEENABLE
`define LAST_STATE_DONE `controllerInstPath.LAST_STATE_DONE
`define SETUP_PULSE1 `controllerInstPath.MBISTPG_FSM.SETUP_PULSE1
`define SETUP_PULSE2 `controllerInstPath.MBISTPG_FSM.SETUP_PULSE2
`define NEXT_ALGO `controllerInstPath.MBISTPG_FSM.NEXT_ALGO
`define ALGO_DONE `controllerInstPath.ALGO_DONE
`define STEP_COUNTER `controllerInstPath.MBISTPG_STEP_COUNTER.STEP_COUNTER
`define LAST_STEP `controllerInstPath.MBISTPG_STEP_COUNTER.LAST_STEP
`define NEXT_STEP `controllerInstPath.MBISTPG_STEP_COUNTER.NEXT_STEP
`define LAST_PORT 1'b1
`define INST_POINTER `controllerInstPath.MBISTPG_POINTER_CNTRL.INST_POINTER
`define LOOP_A_CNTR `controllerInstPath.MBISTPG_REPEAT_LOOP_CNTRL.LOOP_A_CNTR
`define LOOP_B_CNTR `controllerInstPath.MBISTPG_REPEAT_LOOP_CNTRL.LOOP_B_CNTR
`define CNTR_A_MAX `controllerInstPath.MBISTPG_REPEAT_LOOP_CNTRL.CNTR_A_MAX
`define CNTR_B_MAX `controllerInstPath.MBISTPG_REPEAT_LOOP_CNTRL.CNTR_B_MAX
`define BIST_COLLAR_EN0 `controllerInstPath.BIST_COLLAR_EN0
`define CMP_EN0 `controllerInstPath.BIST_CMP
`define BIST_COLLAR_EN1 `controllerInstPath.BIST_COLLAR_EN1
`define CMP_EN1 `controllerInstPath.BIST_CMP
// Controller signals
// Internal signals
integer addMapFile; // Address mapping output file
integer stepEnable0; // Step 0 started flag
integer algoCycleCount0; // Step 0 algorithm cycle count
integer compareCount0; // Step 0 compare count
integer algoCycleCount0_subtotal; // Step 0 algorithm cycle count after adjustment
integer compareCount0_subtotal; // Step 0 compare count after adjustment
integer stepEnable1; // Step 1 started flag
integer algoCycleCount1; // Step 1 algorithm cycle count
integer compareCount1; // Step 1 compare count
integer algoCycleCount1_subtotal; // Step 1 algorithm cycle count after adjustment
integer compareCount1_subtotal; // Step 1 compare count after adjustment
integer algoCycleCount_total; // Overall algorithm cycle count
integer compareCount_total; // Overall compare count after
reg [4:0] PHASE_SMARCHCHKB;
reg [2:0] SUB_PHASE_SMARCHCHKB;
// Internal signals
// Initialize variables
initial
begin
stepEnable0 = 0;
algoCycleCount0 = 0;
compareCount0 = 0;
algoCycleCount0_subtotal = 0;
compareCount0_subtotal = 0;
stepEnable1 = 0;
algoCycleCount1 = 0;
compareCount1 = 0;
algoCycleCount1_subtotal = 0;
compareCount1_subtotal = 0;
algoCycleCount_total = 0;
compareCount_total = 0;
PHASE_SMARCHCHKB = 1;
SUB_PHASE_SMARCHCHKB = 0;
addMapFile = $fopen("SMARCHCHKB_physical_logical_address.txt","w");
end
// Initialize variables
//------------------------------
//-- SMarchCHKB --
//------------------------------
// [start] : SMarchCHKB
always @ (`INST_POINTER or `CNTR_A_MAX or `CNTR_B_MAX) begin
case(`INST_POINTER)
5'b00000 : begin
PHASE_SMARCHCHKB=1 ;
SUB_PHASE_SMARCHCHKB=0;
end
5'b00001 : PHASE_SMARCHCHKB=2 ;
5'b00010 : PHASE_SMARCHCHKB=2 ;
5'b00011 : PHASE_SMARCHCHKB=3 ;
5'b00100 : PHASE_SMARCHCHKB=3 ;
5'b00101 : PHASE_SMARCHCHKB=4 ;
5'b00110 : PHASE_SMARCHCHKB=5 ;
5'b00111 : PHASE_SMARCHCHKB=6 ;
5'b01000 : PHASE_SMARCHCHKB=7 ;
5'b01001 : PHASE_SMARCHCHKB=8 ;
5'b01010: PHASE_SMARCHCHKB=9 ;
5'b01011: PHASE_SMARCHCHKB=9 ;
5'b01100: PHASE_SMARCHCHKB=10;
5'b01101:
case(`CNTR_A_MAX )
1'b0: begin
PHASE_SMARCHCHKB=11;
end
1'b1: begin
PHASE_SMARCHCHKB=12;
end
endcase
5'b01110:
case(`CNTR_A_MAX )
1'b0: begin
PHASE_SMARCHCHKB=11;
end
1'b1: begin
PHASE_SMARCHCHKB=12;
end
endcase
5'b01111:
case(`CNTR_B_MAX )
1'b0: begin
PHASE_SMARCHCHKB=13;
end
1'b1: begin
PHASE_SMARCHCHKB=14;
end
endcase
5'b10000:
case(`CNTR_B_MAX )
1'b0: begin
PHASE_SMARCHCHKB=13;
end
1'b1: begin
PHASE_SMARCHCHKB=14;
end
endcase
5'b10001: PHASE_SMARCHCHKB=15;
5'b10010: PHASE_SMARCHCHKB=15;
endcase
end
// [end] : SMarchCHKB
//--------------------
//-- Step 0 --
//--------------------
// Step 0
always @ (posedge `BIST_CLK) begin
if (`BIST_EN) begin
if (stepEnable0 == 0) begin
if (`BIST_COLLAR_EN0 && `SETUP_PULSE2) begin // Next cycle is RUN state
stepEnable0 = 1;
$display("[[");
$display("[[ Starting memory signal dump for Step 0 Test Port 0 of Controller SMARCHCHKB");
$display("[[");
$fwrite(addMapFile,"//\n");
$fwrite(addMapFile,"// Starting address signal dump for Step 0 Test Port 0 of Controller SMARCHCHKB\n");
$fwrite(addMapFile,"//\n");
$fwrite(addMapFile,"// MemoryID : %s\n", "MEM0 (SHAA110_4096X8X4CM8)");
$fwrite(addMapFile,"// MemoryType : %s\n", "SRAM");
$fwrite(addMapFile,"// Address : %s\n", "A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0");
$fwrite(addMapFile,"// Data : %s\n", "DI31 DI30 DI29 DI28 DI27 DI26 DI25 DI24 DI23 DI22 DI21 DI20 DI19 DI18 DI17 DI16 DI15 DI14 DI13 DI12 DI11 DI10 DI9 DI8 DI7 DI6 DI5 DI4 DI3 DI2 DI1 DI0");
$fwrite(addMapFile,"// Algorithm : %s\n", "SMARCHCHKB");
$fwrite(addMapFile,"// Phase : %s\n", "5.0");
$fwrite(addMapFile,"//\n");
$fwrite(addMapFile,"// Bank Row Column | Address | Data \n");
$fwrite(addMapFile,"//\n");
end
end else begin
if (`ALGO_DONE && `LAST_PORT) begin // Step 0 algorithm done
stepEnable0 = 0;
// Adjust step total
algoCycleCount0_subtotal = algoCycleCount0;
compareCount0_subtotal = compareCount0;
// Update overall total
algoCycleCount_total = algoCycleCount_total + algoCycleCount0_subtotal;
compareCount_total = compareCount_total + compareCount0_subtotal;
end
end // stepEnable0
end // BIST_EN
end
always @ (negedge `BIST_CLK) begin
if (stepEnable0 == 1) begin
if (`CMP_EN0) begin
compareCount0 = compareCount0 + 1;
end
end
end
always @ (negedge `BIST_CLK) begin
if (stepEnable0 == 1) begin
algoCycleCount0 = algoCycleCount0 + 1;
end
end
// Display signals
always @ (posedge `BIST_CLK) begin
if (stepEnable0 == 1) begin
$display(
"[[",
//"%d", $time,
//" %d", algoCycleCount0,
" %s", "SMARCHCHKB",
" PHASE=%d.%d ;", PHASE_SMARCHCHKB, SUB_PHASE_SMARCHCHKB,
" INST=%d ;", `INST_POINTER,
" LOOPA=%d ;", `LOOP_A_CNTR,
" LOOPB=%d ;", `LOOP_B_CNTR,
" %s", "MEM0",
" A11=%h", `mem0InstPath.A11,
" A10=%h", `mem0InstPath.A10,
" A9=%h", `mem0InstPath.A9,
" A8=%h", `mem0InstPath.A8,
" A7=%h", `mem0InstPath.A7,
" A6=%h", `mem0InstPath.A6,
" A5=%h", `mem0InstPath.A5,
" A4=%h", `mem0InstPath.A4,
" A3=%h", `mem0InstPath.A3,
" A2=%h", `mem0InstPath.A2,
" A1=%h", `mem0InstPath.A1,
" A0=%h", `mem0InstPath.A0,
" DI31=%h", `mem0InstPath.DI31,
" DI30=%h", `mem0InstPath.DI30,
" DI29=%h", `mem0InstPath.DI29,
" DI28=%h", `mem0InstPath.DI28,
" DI27=%h", `mem0InstPath.DI27,
" DI26=%h", `mem0InstPath.DI26,
" DI25=%h", `mem0InstPath.DI25,
" DI24=%h", `mem0InstPath.DI24,
" DI23=%h", `mem0InstPath.DI23,
" DI22=%h", `mem0InstPath.DI22,
" DI21=%h", `mem0InstPath.DI21,
" DI20=%h", `mem0InstPath.DI20,
" DI19=%h", `mem0InstPath.DI19,
" DI18=%h", `mem0InstPath.DI18,
" DI17=%h", `mem0InstPath.DI17,
" DI16=%h", `mem0InstPath.DI16,
" DI15=%h", `mem0InstPath.DI15,
" DI14=%h", `mem0InstPath.DI14,
" DI13=%h", `mem0InstPath.DI13,
" DI12=%h", `mem0InstPath.DI12,
" DI11=%h", `mem0InstPath.DI11,
" DI10=%h", `mem0InstPath.DI10,
" DI9=%h", `mem0InstPath.DI9,
" DI8=%h", `mem0InstPath.DI8,
" DI7=%h", `mem0InstPath.DI7,
" DI6=%h", `mem0InstPath.DI6,
" DI5=%h", `mem0InstPath.DI5,
" DI4=%h", `mem0InstPath.DI4,
" DI3=%h", `mem0InstPath.DI3,
" DI2=%h", `mem0InstPath.DI2,
" DI1=%h", `mem0InstPath.DI1,
" DI0=%h", `mem0InstPath.DI0,
" DO31=%h", `mem0InstPath.DO31,
" DO30=%h", `mem0InstPath.DO30,
" DO29=%h", `mem0InstPath.DO29,
" DO28=%h", `mem0InstPath.DO28,
" DO27=%h", `mem0InstPath.DO27,
" DO26=%h", `mem0InstPath.DO26,
" DO25=%h", `mem0InstPath.DO25,
" DO24=%h", `mem0InstPath.DO24,
" DO23=%h", `mem0InstPath.DO23,
" DO22=%h", `mem0InstPath.DO22,
" DO21=%h", `mem0InstPath.DO21,
" DO20=%h", `mem0InstPath.DO20,
" DO19=%h", `mem0InstPath.DO19,
" DO18=%h", `mem0InstPath.DO18,
" DO17=%h", `mem0InstPath.DO17,
" DO16=%h", `mem0InstPath.DO16,
" DO15=%h", `mem0InstPath.DO15,
" DO14=%h", `mem0InstPath.DO14,
" DO13=%h", `mem0InstPath.DO13,
" DO12=%h", `mem0InstPath.DO12,
" DO11=%h", `mem0InstPath.DO11,
" DO10=%h", `mem0InstPath.DO10,
" DO9=%h", `mem0InstPath.DO9,
" DO8=%h", `mem0InstPath.DO8,
" DO7=%h", `mem0InstPath.DO7,
" DO6=%h", `mem0InstPath.DO6,
" DO5=%h", `mem0InstPath.DO5,
" DO4=%h", `mem0InstPath.DO4,
" DO3=%h", `mem0InstPath.DO3,
" DO2=%h", `mem0InstPath.DO2,
" DO1=%h", `mem0InstPath.DO1,
" DO0=%h", `mem0InstPath.DO0,
" CSB=%h", `mem0InstPath.CSB,
" OE=%h", `mem0InstPath.OE,
" WEB3=%h", `mem0InstPath.WEB3,
" WEB2=%h", `mem0InstPath.WEB2,
" WEB1=%h", `mem0InstPath.WEB1,
" WEB0=%h", `mem0InstPath.WEB0,
" DVS3=%h", `mem0InstPath.DVS3,
" DVS2=%h", `mem0InstPath.DVS2,
" DVS1=%h", `mem0InstPath.DVS1,
" DVS0=%h", `mem0InstPath.DVS0,
" DVSE=%h", `mem0InstPath.DVSE,
" %s", ";",
" "
); // $display
end
end
// Display signals
// Address map file
always @ (posedge `BIST_CLK) begin
// Note:
// The map file only contains the address and data
// values for the first memory in each controller step.
if (stepEnable0 == 1 &&
`BIST_WRITEENABLE &&
PHASE_SMARCHCHKB == 5 && SUB_PHASE_SMARCHCHKB == 0) begin
$fwrite(addMapFile,
" %s", "-",
" %b", `BIST_ROW_ADD,
" %b", `BIST_COL_ADD,
" ",
"%b", `mem0InstPath.A11,
"%b", `mem0InstPath.A10,
"%b", `mem0InstPath.A9,
"%b", `mem0InstPath.A8,
"%b", `mem0InstPath.A7,
"%b", `mem0InstPath.A6,
"%b", `mem0InstPath.A5,
"%b", `mem0InstPath.A4,
"%b", `mem0InstPath.A3,
"%b", `mem0InstPath.A2,
"%b", `mem0InstPath.A1,
"%b", `mem0InstPath.A0,
" ",
"%b", `mem0InstPath.DI31,
"%b", `mem0InstPath.DI30,
"%b", `mem0InstPath.DI29,
"%b", `mem0InstPath.DI28,
"%b", `mem0InstPath.DI27,
"%b", `mem0InstPath.DI26,
"%b", `mem0InstPath.DI25,
"%b", `mem0InstPath.DI24,
"%b", `mem0InstPath.DI23,
"%b", `mem0InstPath.DI22,
"%b", `mem0InstPath.DI21,
"%b", `mem0InstPath.DI20,
"%b", `mem0InstPath.DI19,
"%b", `mem0InstPath.DI18,
"%b", `mem0InstPath.DI17,
"%b", `mem0InstPath.DI16,
"%b", `mem0InstPath.DI15,
"%b", `mem0InstPath.DI14,
"%b", `mem0InstPath.DI13,
"%b", `mem0InstPath.DI12,
"%b", `mem0InstPath.DI11,
"%b", `mem0InstPath.DI10,
"%b", `mem0InstPath.DI9,
"%b", `mem0InstPath.DI8,
"%b", `mem0InstPath.DI7,
"%b", `mem0InstPath.DI6,
"%b", `mem0InstPath.DI5,
"%b", `mem0InstPath.DI4,
"%b", `mem0InstPath.DI3,
"%b", `mem0InstPath.DI2,
"%b", `mem0InstPath.DI1,
"%b", `mem0InstPath.DI0,
" \n"
); // $fwrite
end
end
// Address map file
// Step 0
//--------------------
//-- Step 1 --
//--------------------
// Step 1
always @ (posedge `BIST_CLK) begin
if (`BIST_EN) begin
if (stepEnable1 == 0) begin
if (`BIST_COLLAR_EN1 && `SETUP_PULSE2) begin // Next cycle is RUN state
stepEnable1 = 1;
$display("[[");
$display("[[ Starting memory signal dump for Step 1 Test Port 0 of Controller SMARCHCHKB");
$display("[[");
$fwrite(addMapFile,"//\n");
$fwrite(addMapFile,"// Starting address signal dump for Step 1 Test Port 0 of Controller SMARCHCHKB\n");
$fwrite(addMapFile,"//\n");
$fwrite(addMapFile,"// MemoryID : %s\n", "MEM1 (SHAA110_8192X8X4CM8)");
$fwrite(addMapFile,"// MemoryType : %s\n", "SRAM");
$fwrite(addMapFile,"// Address : %s\n", "A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0");
$fwrite(addMapFile,"// Data : %s\n", "DI31 DI30 DI29 DI28 DI27 DI26 DI25 DI24 DI23 DI22 DI21 DI20 DI19 DI18 DI17 DI16 DI15 DI14 DI13 DI12 DI11 DI10 DI9 DI8 DI7 DI6 DI5 DI4 DI3 DI2 DI1 DI0");
$fwrite(addMapFile,"// Algorithm : %s\n", "SMARCHCHKB");
$fwrite(addMapFile,"// Phase : %s\n", "5.0");
$fwrite(addMapFile,"//\n");
$fwrite(addMapFile,"// Bank Row Column | Address | Data \n");
$fwrite(addMapFile,"//\n");
end
end else begin
if (`ALGO_DONE && `LAST_PORT) begin // Step 1 algorithm done
stepEnable1 = 0;
// Adjust step total
algoCycleCount1_subtotal = algoCycleCount1;
compareCount1_subtotal = compareCount1;
// Update overall total
algoCycleCount_total = algoCycleCount_total + algoCycleCount1_subtotal;
compareCount_total = compareCount_total + compareCount1_subtotal;
$display("[[");
$display("[[ Summary for Controller SMARCHCHKB");
$display("[[");
$display("[[ Step 0 Number of Algorithm Cycles = %d", algoCycleCount0_subtotal);
$display("[[ Step 0 Number of Compares = %d", compareCount0_subtotal);
$display("[[ Step 1 Number of Algorithm Cycles = %d", algoCycleCount1_subtotal);
$display("[[ Step 1 Number of Compares = %d", compareCount1_subtotal);
$display("[[");
$display("[[ Total Number of Algorithm Cycles = %d", algoCycleCount_total);
$display("[[ Total Number of Compares = %d", compareCount_total);
$display("[[");
end
end // stepEnable1
end // BIST_EN
end
always @ (negedge `BIST_CLK) begin
if (stepEnable1 == 1) begin
if (`CMP_EN1) begin
compareCount1 = compareCount1 + 1;
end
end
end
always @ (negedge `BIST_CLK) begin
if (stepEnable1 == 1) begin
algoCycleCount1 = algoCycleCount1 + 1;
end
end
// Display signals
always @ (posedge `BIST_CLK) begin
if (stepEnable1 == 1) begin
$display(
"[[",
//"%d", $time,
//" %d", algoCycleCount1,
" %s", "SMARCHCHKB",
" PHASE=%d.%d ;", PHASE_SMARCHCHKB, SUB_PHASE_SMARCHCHKB,
" INST=%d ;", `INST_POINTER,
" LOOPA=%d ;", `LOOP_A_CNTR,
" LOOPB=%d ;", `LOOP_B_CNTR,
" %s", "MEM1",
" A12=%h", `mem1InstPath.A12,
" A11=%h", `mem1InstPath.A11,
" A10=%h", `mem1InstPath.A10,
" A9=%h", `mem1InstPath.A9,
" A8=%h", `mem1InstPath.A8,
" A7=%h", `mem1InstPath.A7,
" A6=%h", `mem1InstPath.A6,
" A5=%h", `mem1InstPath.A5,
" A4=%h", `mem1InstPath.A4,
" A3=%h", `mem1InstPath.A3,
" A2=%h", `mem1InstPath.A2,
" A1=%h", `mem1InstPath.A1,
" A0=%h", `mem1InstPath.A0,
" DI31=%h", `mem1InstPath.DI31,
" DI30=%h", `mem1InstPath.DI30,
" DI29=%h", `mem1InstPath.DI29,
" DI28=%h", `mem1InstPath.DI28,
" DI27=%h", `mem1InstPath.DI27,
" DI26=%h", `mem1InstPath.DI26,
" DI25=%h", `mem1InstPath.DI25,
" DI24=%h", `mem1InstPath.DI24,
" DI23=%h", `mem1InstPath.DI23,
" DI22=%h", `mem1InstPath.DI22,
" DI21=%h", `mem1InstPath.DI21,
" DI20=%h", `mem1InstPath.DI20,
" DI19=%h", `mem1InstPath.DI19,
" DI18=%h", `mem1InstPath.DI18,
" DI17=%h", `mem1InstPath.DI17,
" DI16=%h", `mem1InstPath.DI16,
" DI15=%h", `mem1InstPath.DI15,
" DI14=%h", `mem1InstPath.DI14,
" DI13=%h", `mem1InstPath.DI13,
" DI12=%h", `mem1InstPath.DI12,
" DI11=%h", `mem1InstPath.DI11,
" DI10=%h", `mem1InstPath.DI10,
" DI9=%h", `mem1InstPath.DI9,
" DI8=%h", `mem1InstPath.DI8,
" DI7=%h", `mem1InstPath.DI7,
" DI6=%h", `mem1InstPath.DI6,
" DI5=%h", `mem1InstPath.DI5,
" DI4=%h", `mem1InstPath.DI4,
" DI3=%h", `mem1InstPath.DI3,
" DI2=%h", `mem1InstPath.DI2,
" DI1=%h", `mem1InstPath.DI1,
" DI0=%h", `mem1InstPath.DI0,
" DO31=%h", `mem1InstPath.DO31,
" DO30=%h", `mem1InstPath.DO30,
" DO29=%h", `mem1InstPath.DO29,
" DO28=%h", `mem1InstPath.DO28,
" DO27=%h", `mem1InstPath.DO27,
" DO26=%h", `mem1InstPath.DO26,
" DO25=%h", `mem1InstPath.DO25,
" DO24=%h", `mem1InstPath.DO24,
" DO23=%h", `mem1InstPath.DO23,
" DO22=%h", `mem1InstPath.DO22,
" DO21=%h", `mem1InstPath.DO21,
" DO20=%h", `mem1InstPath.DO20,
" DO19=%h", `mem1InstPath.DO19,
" DO18=%h", `mem1InstPath.DO18,
" DO17=%h", `mem1InstPath.DO17,
" DO16=%h", `mem1InstPath.DO16,
" DO15=%h", `mem1InstPath.DO15,
" DO14=%h", `mem1InstPath.DO14,
" DO13=%h", `mem1InstPath.DO13,
" DO12=%h", `mem1InstPath.DO12,
" DO11=%h", `mem1InstPath.DO11,
" DO10=%h", `mem1InstPath.DO10,
" DO9=%h", `mem1InstPath.DO9,
" DO8=%h", `mem1InstPath.DO8,
" DO7=%h", `mem1InstPath.DO7,
" DO6=%h", `mem1InstPath.DO6,
" DO5=%h", `mem1InstPath.DO5,
" DO4=%h", `mem1InstPath.DO4,
" DO3=%h", `mem1InstPath.DO3,
" DO2=%h", `mem1InstPath.DO2,
" DO1=%h", `mem1InstPath.DO1,
" DO0=%h", `mem1InstPath.DO0,
" CSB=%h", `mem1InstPath.CSB,
" OE=%h", `mem1InstPath.OE,
" WEB3=%h", `mem1InstPath.WEB3,
" WEB2=%h", `mem1InstPath.WEB2,
" WEB1=%h", `mem1InstPath.WEB1,
" WEB0=%h", `mem1InstPath.WEB0,
" DVS3=%h", `mem1InstPath.DVS3,
" DVS2=%h", `mem1InstPath.DVS2,
" DVS1=%h", `mem1InstPath.DVS1,
" DVS0=%h", `mem1InstPath.DVS0,
" DVSE=%h", `mem1InstPath.DVSE,
" %s", ";",
" "
); // $display
end
end
// Display signals
// Address map file
always @ (posedge `BIST_CLK) begin
// Note:
// The map file only contains the address and data
// values for the first memory in each controller step.
if (stepEnable1 == 1 &&
`BIST_WRITEENABLE &&
PHASE_SMARCHCHKB == 5 && SUB_PHASE_SMARCHCHKB == 0) begin
$fwrite(addMapFile,
" %s", "-",
" %b", `BIST_ROW_ADD,
" %b", `BIST_COL_ADD,
" ",
"%b", `mem1InstPath.A12,
"%b", `mem1InstPath.A11,
"%b", `mem1InstPath.A10,
"%b", `mem1InstPath.A9,
"%b", `mem1InstPath.A8,
"%b", `mem1InstPath.A7,
"%b", `mem1InstPath.A6,
"%b", `mem1InstPath.A5,
"%b", `mem1InstPath.A4,
"%b", `mem1InstPath.A3,
"%b", `mem1InstPath.A2,
"%b", `mem1InstPath.A1,
"%b", `mem1InstPath.A0,
" ",
"%b", `mem1InstPath.DI31,
"%b", `mem1InstPath.DI30,
"%b", `mem1InstPath.DI29,
"%b", `mem1InstPath.DI28,
"%b", `mem1InstPath.DI27,
"%b", `mem1InstPath.DI26,
"%b", `mem1InstPath.DI25,
"%b", `mem1InstPath.DI24,
"%b", `mem1InstPath.DI23,
"%b", `mem1InstPath.DI22,
"%b", `mem1InstPath.DI21,
"%b", `mem1InstPath.DI20,
"%b", `mem1InstPath.DI19,
"%b", `mem1InstPath.DI18,
"%b", `mem1InstPath.DI17,
"%b", `mem1InstPath.DI16,
"%b", `mem1InstPath.DI15,
"%b", `mem1InstPath.DI14,
"%b", `mem1InstPath.DI13,
"%b", `mem1InstPath.DI12,
"%b", `mem1InstPath.DI11,
"%b", `mem1InstPath.DI10,
"%b", `mem1InstPath.DI9,
"%b", `mem1InstPath.DI8,
"%b", `mem1InstPath.DI7,
"%b", `mem1InstPath.DI6,
"%b", `mem1InstPath.DI5,
"%b", `mem1InstPath.DI4,
"%b", `mem1InstPath.DI3,
"%b", `mem1InstPath.DI2,
"%b", `mem1InstPath.DI1,
"%b", `mem1InstPath.DI0,
" \n"
); // $fwrite
end
end
// Address map file
// Step 1
//synopsys translate_on
`endif
// [end] : monitor module
endmodule // SMARCHCHKB_LVISION_MBISTPG_ASSEMBLY_ASSEMBLY
// [start] : AUT module
module SMARCHCHKB_LVISION_MBISTPG_ASSEMBLY_UNDER_TEST (
MEM0_CK,
MEM0_CSB,
MEM0_OE,
MEM0_WEB3,
MEM0_WEB2,
MEM0_WEB1,
MEM0_WEB0,
MEM0_DVS3,
MEM0_DVS2,
MEM0_DVS1,
MEM0_DVS0,
MEM0_DVSE,
MEM0_A11,
MEM0_A10,
MEM0_A9,
MEM0_A8,
MEM0_A7,
MEM0_A6,
MEM0_A5,
MEM0_A4,
MEM0_A3,
MEM0_A2,
MEM0_A1,
MEM0_A0,
MEM0_DI31,
MEM0_DI30,
MEM0_DI29,
MEM0_DI28,
MEM0_DI27,
MEM0_DI26,
MEM0_DI25,
MEM0_DI24,
MEM0_DI23,
MEM0_DI22,
MEM0_DI21,
MEM0_DI20,
MEM0_DI19,
MEM0_DI18,
MEM0_DI17,
MEM0_DI16,
MEM0_DI15,
MEM0_DI14,
MEM0_DI13,
MEM0_DI12,
MEM0_DI11,
MEM0_DI10,
MEM0_DI9,
MEM0_DI8,
MEM0_DI7,
MEM0_DI6,
MEM0_DI5,
MEM0_DI4,
MEM0_DI3,
MEM0_DI2,
MEM0_DI1,
MEM0_DI0,
MEM0_DO31,
MEM0_DO30,
MEM0_DO29,
MEM0_DO28,
MEM0_DO27,
MEM0_DO26,
MEM0_DO25,
MEM0_DO24,
MEM0_DO23,
MEM0_DO22,
MEM0_DO21,
MEM0_DO20,
MEM0_DO19,
MEM0_DO18,
MEM0_DO17,
MEM0_DO16,
MEM0_DO15,
MEM0_DO14,
MEM0_DO13,
MEM0_DO12,
MEM0_DO11,
MEM0_DO10,
MEM0_DO9,
MEM0_DO8,
MEM0_DO7,
MEM0_DO6,
MEM0_DO5,
MEM0_DO4,
MEM0_DO3,
MEM0_DO2,
MEM0_DO1,
MEM0_DO0,
MEM1_CK,
MEM1_CSB,
MEM1_OE,
MEM1_WEB3,
MEM1_WEB2,
MEM1_WEB1,
MEM1_WEB0,
MEM1_DVS3,
MEM1_DVS2,
MEM1_DVS1,
MEM1_DVS0,
MEM1_DVSE,
MEM1_A12,
MEM1_A11,
MEM1_A10,
MEM1_A9,
MEM1_A8,
MEM1_A7,
MEM1_A6,
MEM1_A5,
MEM1_A4,
MEM1_A3,
MEM1_A2,
MEM1_A1,
MEM1_A0,
MEM1_DI31,
MEM1_DI30,
MEM1_DI29,
MEM1_DI28,
MEM1_DI27,
MEM1_DI26,
MEM1_DI25,
MEM1_DI24,
MEM1_DI23,
MEM1_DI22,
MEM1_DI21,
MEM1_DI20,
MEM1_DI19,
MEM1_DI18,
MEM1_DI17,
MEM1_DI16,
MEM1_DI15,
MEM1_DI14,
MEM1_DI13,
MEM1_DI12,
MEM1_DI11,
MEM1_DI10,
MEM1_DI9,
MEM1_DI8,
MEM1_DI7,
MEM1_DI6,
MEM1_DI5,
MEM1_DI4,
MEM1_DI3,
MEM1_DI2,
MEM1_DI1,
MEM1_DI0,
MEM1_DO31,
MEM1_DO30,
MEM1_DO29,
MEM1_DO28,
MEM1_DO27,
MEM1_DO26,
MEM1_DO25,
MEM1_DO24,
MEM1_DO23,
MEM1_DO22,
MEM1_DO21,
MEM1_DO20,
MEM1_DO19,
MEM1_DO18,
MEM1_DO17,
MEM1_DO16,
MEM1_DO15,
MEM1_DO14,
MEM1_DO13,
MEM1_DO12,
MEM1_DO11,
MEM1_DO10,
MEM1_DO9,
MEM1_DO8,
MEM1_DO7,
MEM1_DO6,
MEM1_DO5,
MEM1_DO4,
MEM1_DO3,
MEM1_DO2,
MEM1_DO1,
MEM1_DO0
, BIST_CLK , BIST_SHIFT , BIST_HOLD , BIST_SETUP2 , BIST_SETUP
, MBISTPG_TESTDATA_SELECT
, TCK_MODE , TCK , LV_TM , MBISTPG_ALGO_MODE , MBISTPG_MEM_RST
, MBISTPG_REDUCED_ADDR_CNT_EN
, MBISTPG_ASYNC_RESETN , BIST_SI , MBISTPG_SO , MBISTPG_EN , MBISTPG_DONE
, MBISTPG_GO
, MBISTPG_DIAG_EN , FL_CNT_MODE , MBISTPG_CMP_STAT_ID_SEL );
wire DI0_LV_1;
wire DI1_LV_1;
wire DI2_LV_1;
wire DI3_LV_1;
wire DI4_LV_1;
wire DI5_LV_1;
wire DI6_LV_1;
wire DI7_LV_1;
wire DI8_LV_1;
wire DI9_LV_1;
wire DI10_LV_1;
wire DI11_LV_1;
wire DI12_LV_1;
wire DI13_LV_1;
wire DI14_LV_1;
wire DI15_LV_1;
wire DI16_LV_1;
wire DI17_LV_1;
wire DI18_LV_1;
wire DI19_LV_1;
wire DI20_LV_1;
wire DI21_LV_1;
wire DI22_LV_1;
wire DI23_LV_1;
wire DI24_LV_1;
wire DI25_LV_1;
wire DI26_LV_1;
wire DI27_LV_1;
wire DI28_LV_1;
wire DI29_LV_1;
wire DI30_LV_1;
wire DI31_LV_1;
wire MEM1_INTERF_INST_A0;
wire MEM1_INTERF_INST_A1;
wire MEM1_INTERF_INST_A2;
wire MEM1_INTERF_INST_A3;
wire MEM1_INTERF_INST_A4;
wire MEM1_INTERF_INST_A5;
wire MEM1_INTERF_INST_A6;
wire MEM1_INTERF_INST_A7;
wire MEM1_INTERF_INST_A8;
wire MEM1_INTERF_INST_A9;
wire A10_LV_1;
wire A11_LV_1;
wire A12;
wire WEB0_LV_1;
wire WEB1_LV_1;
wire WEB2_LV_1;
wire WEB3_LV_1;
wire MEM1_INTERF_INST_OE;
wire CSB_LV_1;
wire DI0;
wire DI1;
wire DI2;
wire DI3;
wire DI4;
wire DI5;
wire DI6;
wire DI7;
wire DI8;
wire DI9;
wire DI10;
wire DI11;
wire DI12;
wire DI13;
wire DI14;
wire DI15;
wire DI16;
wire DI17;
wire DI18;
wire DI19;
wire DI20;
wire DI21;
wire DI22;
wire DI23;
wire DI24;
wire DI25;
wire DI26;
wire DI27;
wire DI28;
wire DI29;
wire DI30;
wire DI31;
wire MEM0_INTERF_INST_A0;
wire MEM0_INTERF_INST_A1;
wire MEM0_INTERF_INST_A2;
wire MEM0_INTERF_INST_A3;
wire MEM0_INTERF_INST_A4;
wire MEM0_INTERF_INST_A5;
wire MEM0_INTERF_INST_A6;
wire MEM0_INTERF_INST_A7;
wire MEM0_INTERF_INST_A8;
wire MEM0_INTERF_INST_A9;
wire A10;
wire A11;
wire WEB0;
wire WEB1;
wire WEB2;
wire WEB3;
wire MEM0_INTERF_INST_OE;
wire CSB;
wire[31:0] BIST_DATA_FROM_MEM1;
wire BIST_COLLAR_EN_LV_1;
wire RESET_REG_SETUP2;
wire[31:0] BIST_DATA_FROM_MEM0;
wire BIST_COLLAR_HOLD;
wire BIST_CLEAR;
wire BIST_CLEAR_DEFAULT;
wire BIST_COLLAR_SETUP;
wire BIST_SHIFT_COLLAR;
wire CHKBCI_PHASE;
wire[1:0] BIST_WRITE_DATA;
wire BIST_COLLAR_EN;
wire[9:0] BIST_ROW_ADD_LV_1;
wire[8:0] BIST_ROW_ADD;
wire[2:0] BIST_COL_ADD;
wire BIST_WRITEENABLE;
wire BIST_OUTPUTENABLE;
wire BIST_SELECT;
input[5:0] MBISTPG_CMP_STAT_ID_SEL;
wire[5:0] MBISTPG_CMP_STAT_ID_SEL;
input[1:0] FL_CNT_MODE;
wire[1:0] FL_CNT_MODE;
input MBISTPG_DIAG_EN;
wire MBISTPG_DIAG_EN;
output MBISTPG_GO;
wire MBISTPG_GO;
output MBISTPG_DONE;
wire MBISTPG_DONE;
input MBISTPG_EN;
wire MBISTPG_EN;
output MBISTPG_SO;
wire MBISTPG_SO;
input BIST_SI;
wire BIST_SI;
input MBISTPG_ASYNC_RESETN;
wire MBISTPG_ASYNC_RESETN;
input MBISTPG_REDUCED_ADDR_CNT_EN;
wire MBISTPG_REDUCED_ADDR_CNT_EN;
input MBISTPG_MEM_RST;
wire MBISTPG_MEM_RST;
input[1:0] MBISTPG_ALGO_MODE;
wire[1:0] MBISTPG_ALGO_MODE;
input LV_TM;
wire LV_TM;
input TCK;
wire TCK;
input TCK_MODE;
wire TCK_MODE;
input MBISTPG_TESTDATA_SELECT;
wire MBISTPG_TESTDATA_SELECT;
input[1:0] BIST_SETUP;
wire[1:0] BIST_SETUP;
input BIST_SETUP2;
wire BIST_SETUP2;
input BIST_HOLD;
wire BIST_HOLD;
input BIST_SHIFT;
wire BIST_SHIFT;
input BIST_CLK;
wire BIST_CLK;
input MEM0_CK;
input MEM0_CSB;
input MEM0_OE;
input MEM0_WEB3;
input MEM0_WEB2;
input MEM0_WEB1;
input MEM0_WEB0;
input MEM0_DVS3;
input MEM0_DVS2;
input MEM0_DVS1;
input MEM0_DVS0;
input MEM0_DVSE;
input MEM0_A11;
input MEM0_A10;
input MEM0_A9;
input MEM0_A8;
input MEM0_A7;
input MEM0_A6;
input MEM0_A5;
input MEM0_A4;
input MEM0_A3;
input MEM0_A2;
input MEM0_A1;
input MEM0_A0;
input MEM0_DI31;
input MEM0_DI30;
input MEM0_DI29;
input MEM0_DI28;
input MEM0_DI27;
input MEM0_DI26;
input MEM0_DI25;
input MEM0_DI24;
input MEM0_DI23;
input MEM0_DI22;
input MEM0_DI21;
input MEM0_DI20;
input MEM0_DI19;
input MEM0_DI18;
input MEM0_DI17;
input MEM0_DI16;
input MEM0_DI15;
input MEM0_DI14;
input MEM0_DI13;
input MEM0_DI12;
input MEM0_DI11;
input MEM0_DI10;
input MEM0_DI9;
input MEM0_DI8;
input MEM0_DI7;
input MEM0_DI6;
input MEM0_DI5;
input MEM0_DI4;
input MEM0_DI3;
input MEM0_DI2;
input MEM0_DI1;
input MEM0_DI0;
output MEM0_DO31;
output MEM0_DO30;
output MEM0_DO29;
output MEM0_DO28;
output MEM0_DO27;
output MEM0_DO26;
output MEM0_DO25;
output MEM0_DO24;
output MEM0_DO23;
output MEM0_DO22;
output MEM0_DO21;
output MEM0_DO20;
output MEM0_DO19;
output MEM0_DO18;
output MEM0_DO17;
output MEM0_DO16;
output MEM0_DO15;
output MEM0_DO14;
output MEM0_DO13;
output MEM0_DO12;
output MEM0_DO11;
output MEM0_DO10;
output MEM0_DO9;
output MEM0_DO8;
output MEM0_DO7;
output MEM0_DO6;
output MEM0_DO5;
output MEM0_DO4;
output MEM0_DO3;
output MEM0_DO2;
output MEM0_DO1;
output MEM0_DO0;
input MEM1_CK;
input MEM1_CSB;
input MEM1_OE;
input MEM1_WEB3;
input MEM1_WEB2;
input MEM1_WEB1;
input MEM1_WEB0;
input MEM1_DVS3;
input MEM1_DVS2;
input MEM1_DVS1;
input MEM1_DVS0;
input MEM1_DVSE;
input MEM1_A12;
input MEM1_A11;
input MEM1_A10;
input MEM1_A9;
input MEM1_A8;
input MEM1_A7;
input MEM1_A6;
input MEM1_A5;
input MEM1_A4;
input MEM1_A3;
input MEM1_A2;
input MEM1_A1;
input MEM1_A0;
input MEM1_DI31;
input MEM1_DI30;
input MEM1_DI29;
input MEM1_DI28;
input MEM1_DI27;
input MEM1_DI26;
input MEM1_DI25;
input MEM1_DI24;
input MEM1_DI23;
input MEM1_DI22;
input MEM1_DI21;
input MEM1_DI20;
input MEM1_DI19;
input MEM1_DI18;
input MEM1_DI17;
input MEM1_DI16;
input MEM1_DI15;
input MEM1_DI14;
input MEM1_DI13;
input MEM1_DI12;
input MEM1_DI11;
input MEM1_DI10;
input MEM1_DI9;
input MEM1_DI8;
input MEM1_DI7;
input MEM1_DI6;
input MEM1_DI5;
input MEM1_DI4;
input MEM1_DI3;
input MEM1_DI2;
input MEM1_DI1;
input MEM1_DI0;
output MEM1_DO31;
output MEM1_DO30;
output MEM1_DO29;
output MEM1_DO28;
output MEM1_DO27;
output MEM1_DO26;
output MEM1_DO25;
output MEM1_DO24;
output MEM1_DO23;
output MEM1_DO22;
output MEM1_DO21;
output MEM1_DO20;
output MEM1_DO19;
output MEM1_DO18;
output MEM1_DO17;
output MEM1_DO16;
output MEM1_DO15;
output MEM1_DO14;
output MEM1_DO13;
output MEM1_DO12;
output MEM1_DO11;
output MEM1_DO10;
output MEM1_DO9;
output MEM1_DO8;
output MEM1_DO7;
output MEM1_DO6;
output MEM1_DO5;
output MEM1_DO4;
output MEM1_DO3;
output MEM1_DO2;
output MEM1_DO1;
output MEM1_DO0;
SHAA110_4096X8X4CM8 MEM0_MEM_INST ( //
// Clock ports
.CK ( MEM0_CK ),
.CSB(CSB),
.OE(MEM0_INTERF_INST_OE),
.WEB3(WEB3),
.WEB2(WEB2),
.WEB1(WEB1),
.WEB0(WEB0), // i
// Functional ports
.DVS3 ( MEM0_DVS3 ), // i
.DVS2 ( MEM0_DVS2 ), // i
.DVS1 ( MEM0_DVS1 ), // i
.DVS0 ( MEM0_DVS0 ), // i
.DVSE ( MEM0_DVSE ),
.A11(A11),
.A10(A10),
.A9(MEM0_INTERF_INST_A9),
.A8(MEM0_INTERF_INST_A8),
.A7(MEM0_INTERF_INST_A7),
.A6(MEM0_INTERF_INST_A6),
.A5(MEM0_INTERF_INST_A5),
.A4(MEM0_INTERF_INST_A4),
.A3(MEM0_INTERF_INST_A3),
.A2(MEM0_INTERF_INST_A2),
.A1(MEM0_INTERF_INST_A1),
.A0(MEM0_INTERF_INST_A0),
.DI31(DI31),
.DI30(DI30),
.DI29(DI29),
.DI28(DI28),
.DI27(DI27),
.DI26(DI26),
.DI25(DI25),
.DI24(DI24),
.DI23(DI23),
.DI22(DI22),
.DI21(DI21),
.DI20(DI20),
.DI19(DI19),
.DI18(DI18),
.DI17(DI17),
.DI16(DI16),
.DI15(DI15),
.DI14(DI14),
.DI13(DI13),
.DI12(DI12),
.DI11(DI11),
.DI10(DI10),
.DI9(DI9),
.DI8(DI8),
.DI7(DI7),
.DI6(DI6),
.DI5(DI5),
.DI4(DI4),
.DI3(DI3),
.DI2(DI2),
.DI1(DI1),
.DI0(DI0), // i
.DO31 ( MEM0_DO31 ), // o
.DO30 ( MEM0_DO30 ), // o
.DO29 ( MEM0_DO29 ), // o
.DO28 ( MEM0_DO28 ), // o
.DO27 ( MEM0_DO27 ), // o
.DO26 ( MEM0_DO26 ), // o
.DO25 ( MEM0_DO25 ), // o
.DO24 ( MEM0_DO24 ), // o
.DO23 ( MEM0_DO23 ), // o
.DO22 ( MEM0_DO22 ), // o
.DO21 ( MEM0_DO21 ), // o
.DO20 ( MEM0_DO20 ), // o
.DO19 ( MEM0_DO19 ), // o
.DO18 ( MEM0_DO18 ), // o
.DO17 ( MEM0_DO17 ), // o
.DO16 ( MEM0_DO16 ), // o
.DO15 ( MEM0_DO15 ), // o
.DO14 ( MEM0_DO14 ), // o
.DO13 ( MEM0_DO13 ), // o
.DO12 ( MEM0_DO12 ), // o
.DO11 ( MEM0_DO11 ), // o
.DO10 ( MEM0_DO10 ), // o
.DO9 ( MEM0_DO9 ), // o
.DO8 ( MEM0_DO8 ), // o
.DO7 ( MEM0_DO7 ), // o
.DO6 ( MEM0_DO6 ), // o
.DO5 ( MEM0_DO5 ), // o
.DO4 ( MEM0_DO4 ), // o
.DO3 ( MEM0_DO3 ), // o
.DO2 ( MEM0_DO2 ), // o
.DO1 ( MEM0_DO1 ), // o
.DO0 ( MEM0_DO0 ) // o
); //
SHAA110_8192X8X4CM8 MEM1_MEM_INST ( //
// Clock ports
.CK ( MEM1_CK ),
.CSB(CSB_LV_1),
.OE(MEM1_INTERF_INST_OE),
.WEB3(WEB3_LV_1),
.WEB2(WEB2_LV_1),
.WEB1(WEB1_LV_1),
.WEB0(WEB0_LV_1), // i
// Functional ports
.DVS3 ( MEM1_DVS3 ), // i
.DVS2 ( MEM1_DVS2 ), // i
.DVS1 ( MEM1_DVS1 ), // i
.DVS0 ( MEM1_DVS0 ), // i
.DVSE ( MEM1_DVSE ),
.A12(A12),
.A11(A11_LV_1),
.A10(A10_LV_1),
.A9(MEM1_INTERF_INST_A9),
.A8(MEM1_INTERF_INST_A8),
.A7(MEM1_INTERF_INST_A7),
.A6(MEM1_INTERF_INST_A6),
.A5(MEM1_INTERF_INST_A5),
.A4(MEM1_INTERF_INST_A4),
.A3(MEM1_INTERF_INST_A3),
.A2(MEM1_INTERF_INST_A2),
.A1(MEM1_INTERF_INST_A1),
.A0(MEM1_INTERF_INST_A0),
.DI31(DI31_LV_1),
.DI30(DI30_LV_1),
.DI29(DI29_LV_1),
.DI28(DI28_LV_1),
.DI27(DI27_LV_1),
.DI26(DI26_LV_1),
.DI25(DI25_LV_1),
.DI24(DI24_LV_1),
.DI23(DI23_LV_1),
.DI22(DI22_LV_1),
.DI21(DI21_LV_1),
.DI20(DI20_LV_1),
.DI19(DI19_LV_1),
.DI18(DI18_LV_1),
.DI17(DI17_LV_1),
.DI16(DI16_LV_1),
.DI15(DI15_LV_1),
.DI14(DI14_LV_1),
.DI13(DI13_LV_1),
.DI12(DI12_LV_1),
.DI11(DI11_LV_1),
.DI10(DI10_LV_1),
.DI9(DI9_LV_1),
.DI8(DI8_LV_1),
.DI7(DI7_LV_1),
.DI6(DI6_LV_1),
.DI5(DI5_LV_1),
.DI4(DI4_LV_1),
.DI3(DI3_LV_1),
.DI2(DI2_LV_1),
.DI1(DI1_LV_1),
.DI0(DI0_LV_1), // i
.DO31 ( MEM1_DO31 ), // o
.DO30 ( MEM1_DO30 ), // o
.DO29 ( MEM1_DO29 ), // o
.DO28 ( MEM1_DO28 ), // o
.DO27 ( MEM1_DO27 ), // o
.DO26 ( MEM1_DO26 ), // o
.DO25 ( MEM1_DO25 ), // o
.DO24 ( MEM1_DO24 ), // o
.DO23 ( MEM1_DO23 ), // o
.DO22 ( MEM1_DO22 ), // o
.DO21 ( MEM1_DO21 ), // o
.DO20 ( MEM1_DO20 ), // o
.DO19 ( MEM1_DO19 ), // o
.DO18 ( MEM1_DO18 ), // o
.DO17 ( MEM1_DO17 ), // o
.DO16 ( MEM1_DO16 ), // o
.DO15 ( MEM1_DO15 ), // o
.DO14 ( MEM1_DO14 ), // o
.DO13 ( MEM1_DO13 ), // o
.DO12 ( MEM1_DO12 ), // o
.DO11 ( MEM1_DO11 ), // o
.DO10 ( MEM1_DO10 ), // o
.DO9 ( MEM1_DO9 ), // o
.DO8 ( MEM1_DO8 ), // o
.DO7 ( MEM1_DO7 ), // o
.DO6 ( MEM1_DO6 ), // o
.DO5 ( MEM1_DO5 ), // o
.DO4 ( MEM1_DO4 ), // o
.DO3 ( MEM1_DO3 ), // o
.DO2 ( MEM1_DO2 ), // o
.DO1 ( MEM1_DO1 ), // o
.DO0 ( MEM1_DO0 ) // o
); //
SMARCHCHKB_LVISION_MBISTPG_CTRL SMARCHCHKB_MBIST_CTRL
(
.BIST_CLK(BIST_CLK),
.BIST_SHIFT(BIST_SHIFT),
.BIST_HOLD(BIST_HOLD),
.BIST_SETUP2(BIST_SETUP2),
.BIST_SETUP({
BIST_SETUP[1],
BIST_SETUP[0]
}),
.MBISTPG_TESTDATA_SELECT(MBISTPG_TESTDATA_SELECT),
.TCK_MODE(TCK_MODE),
.TCK(TCK),
.LV_TM(LV_TM),
.MBISTPG_ALGO_MODE({
MBISTPG_ALGO_MODE[1],
MBISTPG_ALGO_MODE[0]
}),
.MBISTPG_MEM_RST(MBISTPG_MEM_RST),
.MBISTPG_REDUCED_ADDR_CNT_EN(MBISTPG_REDUCED_ADDR_CNT_EN),
.MBISTPG_ASYNC_RESETN(MBISTPG_ASYNC_RESETN),
.BIST_SI(BIST_SI),
.MBISTPG_SO(MBISTPG_SO),
.MBISTPG_EN(MBISTPG_EN),
.MBISTPG_DONE(MBISTPG_DONE),
.MBISTPG_GO(MBISTPG_GO),
.MBISTPG_DIAG_EN(MBISTPG_DIAG_EN),
.FL_CNT_MODE({
FL_CNT_MODE[1],
FL_CNT_MODE[0]
}),
.MBISTPG_CMP_STAT_ID_SEL({
MBISTPG_CMP_STAT_ID_SEL[5],
MBISTPG_CMP_STAT_ID_SEL[4],
MBISTPG_CMP_STAT_ID_SEL[3],
MBISTPG_CMP_STAT_ID_SEL[2],
MBISTPG_CMP_STAT_ID_SEL[1],
MBISTPG_CMP_STAT_ID_SEL[0]
}),
.BIST_SELECT(BIST_SELECT),
.BIST_OUTPUTENABLE(BIST_OUTPUTENABLE),
.BIST_WRITEENABLE(BIST_WRITEENABLE),
.BIST_COL_ADD(BIST_COL_ADD),
.BIST_ROW_ADD({
BIST_ROW_ADD_LV_1[9],
BIST_ROW_ADD[8],
BIST_ROW_ADD[7],
BIST_ROW_ADD[6],
BIST_ROW_ADD[5],
BIST_ROW_ADD[4],
BIST_ROW_ADD[3],
BIST_ROW_ADD[2],
BIST_ROW_ADD[1],
BIST_ROW_ADD[0]
}),
.BIST_COLLAR_EN0(BIST_COLLAR_EN),
.BIST_WRITE_DATA(BIST_WRITE_DATA),
.CHKBCI_PHASE(CHKBCI_PHASE),
.BIST_SHIFT_COLLAR(BIST_SHIFT_COLLAR),
.BIST_COLLAR_SETUP(BIST_COLLAR_SETUP),
.BIST_CLEAR_DEFAULT(BIST_CLEAR_DEFAULT),
.BIST_CLEAR(BIST_CLEAR),
.BIST_COLLAR_HOLD(BIST_COLLAR_HOLD),
.BIST_DATA_FROM_MEM0(BIST_DATA_FROM_MEM0),
.MBISTPG_RESET_REG_SETUP2(RESET_REG_SETUP2),
.BIST_COLLAR_EN1(BIST_COLLAR_EN_LV_1),
.BIST_DATA_FROM_MEM1(BIST_DATA_FROM_MEM1));
SMARCHCHKB_LVISION_MEM0_INTERFACE MEM0_INTERF_INST
( .SCAN_OBS_FLOPS(),
.CSB_IN(MEM0_CSB),
.OE_IN(MEM0_OE),
.WEB3_IN(MEM0_WEB3),
.WEB2_IN(MEM0_WEB2),
.WEB1_IN(MEM0_WEB1),
.WEB0_IN(MEM0_WEB0),
.A11_IN(MEM0_A11),
.A10_IN(MEM0_A10),
.A9_IN(MEM0_A9),
.A8_IN(MEM0_A8),
.A7_IN(MEM0_A7),
.A6_IN(MEM0_A6),
.A5_IN(MEM0_A5),
.A4_IN(MEM0_A4),
.A3_IN(MEM0_A3),
.A2_IN(MEM0_A2),
.A1_IN(MEM0_A1),
.A0_IN(MEM0_A0),
.DI31_IN(MEM0_DI31),
.DI30_IN(MEM0_DI30),
.DI29_IN(MEM0_DI29),
.DI28_IN(MEM0_DI28),
.DI27_IN(MEM0_DI27),
.DI26_IN(MEM0_DI26),
.DI25_IN(MEM0_DI25),
.DI24_IN(MEM0_DI24),
.DI23_IN(MEM0_DI23),
.DI22_IN(MEM0_DI22),
.DI21_IN(MEM0_DI21),
.DI20_IN(MEM0_DI20),
.DI19_IN(MEM0_DI19),
.DI18_IN(MEM0_DI18),
.DI17_IN(MEM0_DI17),
.DI16_IN(MEM0_DI16),
.DI15_IN(MEM0_DI15),
.DI14_IN(MEM0_DI14),
.DI13_IN(MEM0_DI13),
.DI12_IN(MEM0_DI12),
.DI11_IN(MEM0_DI11),
.DI10_IN(MEM0_DI10),
.DI9_IN(MEM0_DI9),
.DI8_IN(MEM0_DI8),
.DI7_IN(MEM0_DI7),
.DI6_IN(MEM0_DI6),
.DI5_IN(MEM0_DI5),
.DI4_IN(MEM0_DI4),
.DI3_IN(MEM0_DI3),
.DI2_IN(MEM0_DI2),
.DI1_IN(MEM0_DI1),
.DI0_IN(MEM0_DI0),
.BIST_CLK(BIST_CLK),
.TCK_MODE(TCK_MODE),
.LV_TM(LV_TM),
.BIST_SELECT(BIST_SELECT),
.BIST_OUTPUTENABLE(BIST_OUTPUTENABLE),
.BIST_WRITEENABLE(BIST_WRITEENABLE),
.BIST_COL_ADD(BIST_COL_ADD),
.BIST_ROW_ADD({
BIST_ROW_ADD[8],
BIST_ROW_ADD[7],
BIST_ROW_ADD[6],
BIST_ROW_ADD[5],
BIST_ROW_ADD[4],
BIST_ROW_ADD[3],
BIST_ROW_ADD[2],
BIST_ROW_ADD[1],
BIST_ROW_ADD[0]
}),
.BIST_EN(MBISTPG_EN),
.BIST_COLLAR_EN(BIST_COLLAR_EN),
.BIST_ASYNC_RESETN(MBISTPG_ASYNC_RESETN),
.BIST_TESTDATA_SELECT_TO_COLLAR(MBISTPG_TESTDATA_SELECT),
.BIST_WRITE_DATA(BIST_WRITE_DATA),
.CHKBCI_PHASE(CHKBCI_PHASE),
.BIST_SHIFT_COLLAR(BIST_SHIFT_COLLAR),
.BIST_COLLAR_SETUP(BIST_COLLAR_SETUP),
.BIST_CLEAR_DEFAULT(BIST_CLEAR_DEFAULT),
.BIST_CLEAR(BIST_CLEAR),
.BIST_SETUP0(BIST_SETUP[0]),
.BIST_COLLAR_HOLD(BIST_COLLAR_HOLD),
.BIST_DATA_FROM_MEM(BIST_DATA_FROM_MEM0),
.RESET_REG_SETUP2(RESET_REG_SETUP2),
.CSB(CSB),
.OE(MEM0_INTERF_INST_OE),
.WEB3(WEB3),
.WEB2(WEB2),
.WEB1(WEB1),
.WEB0(WEB0),
.A11(A11),
.A10(A10),
.A9(MEM0_INTERF_INST_A9),
.A8(MEM0_INTERF_INST_A8),
.A7(MEM0_INTERF_INST_A7),
.A6(MEM0_INTERF_INST_A6),
.A5(MEM0_INTERF_INST_A5),
.A4(MEM0_INTERF_INST_A4),
.A3(MEM0_INTERF_INST_A3),
.A2(MEM0_INTERF_INST_A2),
.A1(MEM0_INTERF_INST_A1),
.A0(MEM0_INTERF_INST_A0),
.DI31(DI31),
.DI30(DI30),
.DI29(DI29),
.DI28(DI28),
.DI27(DI27),
.DI26(DI26),
.DI25(DI25),
.DI24(DI24),
.DI23(DI23),
.DI22(DI22),
.DI21(DI21),
.DI20(DI20),
.DI19(DI19),
.DI18(DI18),
.DI17(DI17),
.DI16(DI16),
.DI15(DI15),
.DI14(DI14),
.DI13(DI13),
.DI12(DI12),
.DI11(DI11),
.DI10(DI10),
.DI9(DI9),
.DI8(DI8),
.DI7(DI7),
.DI6(DI6),
.DI5(DI5),
.DI4(DI4),
.DI3(DI3),
.DI2(DI2),
.DI1(DI1),
.DI0(DI0),
.DO31(MEM0_DO31),
.DO30(MEM0_DO30),
.DO29(MEM0_DO29),
.DO28(MEM0_DO28),
.DO27(MEM0_DO27),
.DO26(MEM0_DO26),
.DO25(MEM0_DO25),
.DO24(MEM0_DO24),
.DO23(MEM0_DO23),
.DO22(MEM0_DO22),
.DO21(MEM0_DO21),
.DO20(MEM0_DO20),
.DO19(MEM0_DO19),
.DO18(MEM0_DO18),
.DO17(MEM0_DO17),
.DO16(MEM0_DO16),
.DO15(MEM0_DO15),
.DO14(MEM0_DO14),
.DO13(MEM0_DO13),
.DO12(MEM0_DO12),
.DO11(MEM0_DO11),
.DO10(MEM0_DO10),
.DO9(MEM0_DO9),
.DO8(MEM0_DO8),
.DO7(MEM0_DO7),
.DO6(MEM0_DO6),
.DO5(MEM0_DO5),
.DO4(MEM0_DO4),
.DO3(MEM0_DO3),
.DO2(MEM0_DO2),
.DO1(MEM0_DO1),
.DO0(MEM0_DO0));
SMARCHCHKB_LVISION_MEM1_INTERFACE MEM1_INTERF_INST
( .SCAN_OBS_FLOPS(),
.CSB_IN(MEM1_CSB),
.OE_IN(MEM1_OE),
.WEB3_IN(MEM1_WEB3),
.WEB2_IN(MEM1_WEB2),
.WEB1_IN(MEM1_WEB1),
.WEB0_IN(MEM1_WEB0),
.A12_IN(MEM1_A12),
.A11_IN(MEM1_A11),
.A10_IN(MEM1_A10),
.A9_IN(MEM1_A9),
.A8_IN(MEM1_A8),
.A7_IN(MEM1_A7),
.A6_IN(MEM1_A6),
.A5_IN(MEM1_A5),
.A4_IN(MEM1_A4),
.A3_IN(MEM1_A3),
.A2_IN(MEM1_A2),
.A1_IN(MEM1_A1),
.A0_IN(MEM1_A0),
.DI31_IN(MEM1_DI31),
.DI30_IN(MEM1_DI30),
.DI29_IN(MEM1_DI29),
.DI28_IN(MEM1_DI28),
.DI27_IN(MEM1_DI27),
.DI26_IN(MEM1_DI26),
.DI25_IN(MEM1_DI25),
.DI24_IN(MEM1_DI24),
.DI23_IN(MEM1_DI23),
.DI22_IN(MEM1_DI22),
.DI21_IN(MEM1_DI21),
.DI20_IN(MEM1_DI20),
.DI19_IN(MEM1_DI19),
.DI18_IN(MEM1_DI18),
.DI17_IN(MEM1_DI17),
.DI16_IN(MEM1_DI16),
.DI15_IN(MEM1_DI15),
.DI14_IN(MEM1_DI14),
.DI13_IN(MEM1_DI13),
.DI12_IN(MEM1_DI12),
.DI11_IN(MEM1_DI11),
.DI10_IN(MEM1_DI10),
.DI9_IN(MEM1_DI9),
.DI8_IN(MEM1_DI8),
.DI7_IN(MEM1_DI7),
.DI6_IN(MEM1_DI6),
.DI5_IN(MEM1_DI5),
.DI4_IN(MEM1_DI4),
.DI3_IN(MEM1_DI3),
.DI2_IN(MEM1_DI2),
.DI1_IN(MEM1_DI1),
.DI0_IN(MEM1_DI0),
.BIST_CLK(BIST_CLK),
.TCK_MODE(TCK_MODE),
.LV_TM(LV_TM),
.BIST_SELECT(BIST_SELECT),
.BIST_OUTPUTENABLE(BIST_OUTPUTENABLE),
.BIST_WRITEENABLE(BIST_WRITEENABLE),
.BIST_COL_ADD(BIST_COL_ADD),
.BIST_ROW_ADD({
BIST_ROW_ADD_LV_1[9],
BIST_ROW_ADD[8],
BIST_ROW_ADD[7],
BIST_ROW_ADD[6],
BIST_ROW_ADD[5],
BIST_ROW_ADD[4],
BIST_ROW_ADD[3],
BIST_ROW_ADD[2],
BIST_ROW_ADD[1],
BIST_ROW_ADD[0]
}),
.BIST_EN(MBISTPG_EN),
.BIST_COLLAR_EN(BIST_COLLAR_EN_LV_1),
.BIST_ASYNC_RESETN(MBISTPG_ASYNC_RESETN),
.BIST_TESTDATA_SELECT_TO_COLLAR(MBISTPG_TESTDATA_SELECT),
.BIST_WRITE_DATA(BIST_WRITE_DATA),
.CHKBCI_PHASE(CHKBCI_PHASE),
.BIST_SHIFT_COLLAR(BIST_SHIFT_COLLAR),
.BIST_COLLAR_SETUP(BIST_COLLAR_SETUP),
.BIST_CLEAR_DEFAULT(BIST_CLEAR_DEFAULT),
.BIST_CLEAR(BIST_CLEAR),
.BIST_SETUP0(BIST_SETUP[0]),
.BIST_COLLAR_HOLD(BIST_COLLAR_HOLD),
.BIST_DATA_FROM_MEM(BIST_DATA_FROM_MEM1),
.RESET_REG_SETUP2(RESET_REG_SETUP2),
.CSB(CSB_LV_1),
.OE(MEM1_INTERF_INST_OE),
.WEB3(WEB3_LV_1),
.WEB2(WEB2_LV_1),
.WEB1(WEB1_LV_1),
.WEB0(WEB0_LV_1),
.A12(A12),
.A11(A11_LV_1),
.A10(A10_LV_1),
.A9(MEM1_INTERF_INST_A9),
.A8(MEM1_INTERF_INST_A8),
.A7(MEM1_INTERF_INST_A7),
.A6(MEM1_INTERF_INST_A6),
.A5(MEM1_INTERF_INST_A5),
.A4(MEM1_INTERF_INST_A4),
.A3(MEM1_INTERF_INST_A3),
.A2(MEM1_INTERF_INST_A2),
.A1(MEM1_INTERF_INST_A1),
.A0(MEM1_INTERF_INST_A0),
.DI31(DI31_LV_1),
.DI30(DI30_LV_1),
.DI29(DI29_LV_1),
.DI28(DI28_LV_1),
.DI27(DI27_LV_1),
.DI26(DI26_LV_1),
.DI25(DI25_LV_1),
.DI24(DI24_LV_1),
.DI23(DI23_LV_1),
.DI22(DI22_LV_1),
.DI21(DI21_LV_1),
.DI20(DI20_LV_1),
.DI19(DI19_LV_1),
.DI18(DI18_LV_1),
.DI17(DI17_LV_1),
.DI16(DI16_LV_1),
.DI15(DI15_LV_1),
.DI14(DI14_LV_1),
.DI13(DI13_LV_1),
.DI12(DI12_LV_1),
.DI11(DI11_LV_1),
.DI10(DI10_LV_1),
.DI9(DI9_LV_1),
.DI8(DI8_LV_1),
.DI7(DI7_LV_1),
.DI6(DI6_LV_1),
.DI5(DI5_LV_1),
.DI4(DI4_LV_1),
.DI3(DI3_LV_1),
.DI2(DI2_LV_1),
.DI1(DI1_LV_1),
.DI0(DI0_LV_1),
.DO31(MEM1_DO31),
.DO30(MEM1_DO30),
.DO29(MEM1_DO29),
.DO28(MEM1_DO28),
.DO27(MEM1_DO27),
.DO26(MEM1_DO26),
.DO25(MEM1_DO25),
.DO24(MEM1_DO24),
.DO23(MEM1_DO23),
.DO22(MEM1_DO22),
.DO21(MEM1_DO21),
.DO20(MEM1_DO20),
.DO19(MEM1_DO19),
.DO18(MEM1_DO18),
.DO17(MEM1_DO17),
.DO16(MEM1_DO16),
.DO15(MEM1_DO15),
.DO14(MEM1_DO14),
.DO13(MEM1_DO13),
.DO12(MEM1_DO12),
.DO11(MEM1_DO11),
.DO10(MEM1_DO10),
.DO9(MEM1_DO9),
.DO8(MEM1_DO8),
.DO7(MEM1_DO7),
.DO6(MEM1_DO6),
.DO5(MEM1_DO5),
.DO4(MEM1_DO4),
.DO3(MEM1_DO3),
.DO2(MEM1_DO2),
.DO1(MEM1_DO1),
.DO0(MEM1_DO0));
endmodule // SMARCHCHKB_LVISION_MBISTPG_ASSEMBLY_UNDER_TEST
// [end] : AUT module
|
Switch(expr-1, value-1[, expr-2, value-2 … [, expr-n,value-n]])
|
<filename>Task/Integer-overflow/VBScript/integer-overflow.vb<gh_stars>1-10
'Binary Integer overflow - vbs
i=(-2147483647-1)/-1
wscript.echo i
i0=32767 '=32767 Integer (Fixed) type=2
i1=2147483647 '=2147483647 Long (Fixed) type=3
i2=-(-2147483647-1) '=2147483648 Double (Float) type=5
wscript.echo Cstr(i0) & " : " & typename(i0) & " , " & vartype(i0) & vbcrlf _
& Cstr(i1) & " : " & typename(i1) & " , " & vartype(i1) & vbcrlf _
& Cstr(i2) & " : " & typename(i2) & " , " & vartype(i2)
ii=2147483648-2147483647
if vartype(ii)<>3 or vartype(ii)<>2 then wscript.echo "Integer overflow type=" & typename(ii)
i1=1000000000000000-1 '1E+15-1
i2=i1+1 '1E+15
wscript.echo Cstr(i1) & " , " & Cstr(i2)
|
' Windows Installer utility to generate file cabinets from MSI database
' For use with Windows Scripting Host, CScript.exe or WScript.exe
' Copyright (c) 1999, Microsoft Corporation
' Demonstrates the access to install engine and actions
' Modified on Sept 12, 2000 by <NAME> to save the new cab as *.cab rather than *.CAB and also use the
' SourcePath argument and FileKey for where to find the file to compress into the cab.
'
Option Explicit
' FileSystemObject.CreateTextFile and FileSystemObject.OpenTextFile
Const OpenAsASCII = 0
Const OpenAsUnicode = -1
' FileSystemObject.CreateTextFile
Const OverwriteIfExist = -1
Const FailIfExist = 0
' FileSystemObject.OpenTextFile
Const OpenAsDefault = -2
Const CreateIfNotExist = -1
Const FailIfNotExist = 0
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Const msiOpenDatabaseModeReadOnly = 0
Const msiOpenDatabaseModeTransact = 1
Const msiViewModifyInsert = 1
Const msiViewModifyUpdate = 2
Const msiViewModifyAssign = 3
Const msiViewModifyReplace = 4
Const msiViewModifyDelete = 6
Const msiUILevelNone = 2
Const msiRunModeSourceShortNames = 9
Const msidbFileAttributesNoncompressed = &h00002000
Dim argCount:argCount = Wscript.Arguments.Count
Dim iArg:iArg = 0
If argCount > 0 Then If InStr(1, Wscript.Arguments(0), "?", vbTextCompare) > 0 Then argCount = 0
If (argCount < 2) Then
Wscript.Echo "Windows Installer utility to generate compressed file cabinets from MSI database" &_
vbNewLine & " The 1st argument is the path to MSI database, at the source file root" &_
vbNewLine & " The 2nd argument is the base name used for the generated files (DDF, INF, RPT)" &_
vbNewLine & " The 3rd argument can optionally specify separate source location from the MSI" &_
vbNewLine & " The following options may be specified at any point on the command line" &_
vbNewLine & " /L to use LZX compression instead of MSZIP" &_
vbNewLine & " /F to limit cabinet size to 1.44 MB floppy size rather than CD" &_
vbNewLine & " /C to run compression, else only generates the .DDF file" &_
vbNewLine & " /U to update the MSI database to reference the generated cabinet" &_
vbNewLine & " /E to embed the cabinet file in the installer package as a stream" &_
vbNewLine & " /S to sequence number file table, ordered by directories" &_
vbNewLine & " /R to revert to non-cabinet install, removes cabinet if /E specified" &_
vbNewLine & " Notes:" &_
vbNewLine & " In order to generate a cabinet, MAKECAB.EXE must be on the PATH" &_
vbNewLine & " base name used for files and cabinet stream is case-sensitive" &_
vbNewLine & " If source type set to compressed, all files will be opened at the root" &_
vbNewLine & " (The /R option removes the compressed bit - SummaryInfo property 15 & 2)" &_
vbNewLine & " To replace an embedded cabinet, include the options: /R /C /U /E" &_
vbNewLine & " Does not handle updating of Media table to handle multiple cabinets"
Wscript.Quit 1
End If
' Get argument values, processing any option flags
Dim compressType : compressType = "MSZIP"
Dim cabSize : cabSize = "CDROM"
Dim makeCab : makeCab = False
Dim embedCab : embedCab = False
Dim updateMsi : updateMsi = False
Dim sequenceFile : sequenceFile = False
Dim removeCab : removeCab = False
Dim databasePath : databasePath = NextArgument
Dim baseName : baseName = NextArgument
Dim sourceFolder : sourceFolder = NextArgument
If Not IsEmpty(NextArgument) Then Fail "More than 3 arguments supplied" ' process any trailing options
If Len(baseName) < 1 Or Len(baseName) > 8 Then Fail "Base file name must be from 1 to 8 characters"
If Not IsEmpty(sourceFolder) And Right(sourceFolder, 1) <> "\" Then sourceFolder = sourceFolder & "\"
Dim cabFile : cabFile = baseName & ".cab"
Dim cabName : cabName = cabFile : If embedCab Then cabName = "#" & cabName
' Connect to Windows Installer object
On Error Resume Next
Dim installer : Set installer = Nothing
Set installer = Wscript.CreateObject("WindowsInstaller.Installer") : CheckError
' Open database
Dim database, openMode, view, record, updateMode, sumInfo, sequence, lastSequence
If updateMsi Or sequenceFile Or removeCab Then openMode = msiOpenDatabaseModeTransact Else openMode = msiOpenDatabaseModeReadOnly
Set database = installer.OpenDatabase(databasePath, openMode) : CheckError
' Remove existing cabinet(s) and revert to source tree install if options specified
If removeCab Then
Set view = database.OpenView("SELECT DiskId, LastSequence, Cabinet FROM Media ORDER BY DiskId") : CheckError
view.Execute : CheckError
updateMode = msiViewModifyUpdate
Set record = view.Fetch : CheckError
If Not record Is Nothing Then ' Media table not empty
If Not record.IsNull(3) Then
If record.StringData(3) <> cabName Then Wscript.Echo "Warning, cabinet name in media table, " & record.StringData(3) & " does not match " & cabName
record.StringData(3) = Empty
End If
record.IntegerData(2) = 9999 ' in case of multiple cabinets, force all files from 1st media
view.Modify msiViewModifyUpdate, record : CheckError
Do
Set record = view.Fetch : CheckError
If record Is Nothing Then Exit Do
view.Modify msiViewModifyDelete, record : CheckError 'remove other cabinet records
Loop
End If
Set sumInfo = database.SummaryInformation(3) : CheckError
sumInfo.Property(11) = Now
sumInfo.Property(13) = Now
sumInfo.Property(15) = sumInfo.Property(15) And Not 2
sumInfo.Persist
Set view = database.OpenView("SELECT `Name`,`Data` FROM _Streams WHERE `Name`= '" & cabFile & "'") : CheckError
view.Execute : CheckError
Set record = view.Fetch
If record Is Nothing Then
Wscript.Echo "Warning, cabinet stream not found in package: " & cabFile
Else
view.Modify msiViewModifyDelete, record : CheckError
End If
Set sumInfo = Nothing ' must release stream
database.Commit : CheckError
If Not updateMsi Then Wscript.Quit 0
End If
' Create an install session and execute actions in order to perform directory resolution
installer.UILevel = msiUILevelNone
Dim session : Set session = installer.OpenPackage(database,1) : If Err <> 0 Then Fail "Database: " & databasePath & ". Invalid installer package format"
Dim shortNames : shortNames = session.Mode(msiRunModeSourceShortNames) : CheckError
If Not IsEmpty(sourceFolder) Then session.Property("OriginalDatabase") = sourceFolder : CheckError
Dim stat : stat = session.DoAction("CostInitialize") : CheckError
If stat <> 1 Then Fail "CostInitialize failed, returned " & stat
' Check for non-cabinet files to avoid sequence number collisions
lastSequence = 0
If sequenceFile Then
Set view = database.OpenView("SELECT Sequence,Attributes FROM File") : CheckError
view.Execute : CheckError
Do
Set record = view.Fetch : CheckError
If record Is Nothing Then Exit Do
sequence = record.IntegerData(1)
If (record.IntegerData(2) And msidbFileAttributesNoncompressed) <> 0 And sequence > lastSequence Then lastSequence = sequence
Loop
End If
' Join File table to Component table in order to find directories
Dim orderBy : If sequenceFile Then orderBy = "Directory_" Else orderBy = "Sequence"
Set view = database.OpenView("SELECT File,FileName,Directory_,Sequence,File.Attributes FROM File,Component WHERE Component_=Component ORDER BY " & orderBy) : CheckError
view.Execute : CheckError
' Create DDF file and write header properties
Dim FileSys : Set FileSys = CreateObject("Scripting.FileSystemObject") : CheckError
Dim outStream : Set outStream = FileSys.CreateTextFile(baseName & ".DDF", OverwriteIfExist, OpenAsASCII) : CheckError
outStream.WriteLine "; Generated from " & databasePath & " on " & Now
outStream.WriteLine ".Set CabinetNameTemplate=" & baseName & "*.cab"
outStream.WriteLine ".Set CabinetName1=" & cabFile
outStream.WriteLine ".Set ReservePerCabinetSize=8"
outStream.WriteLine ".Set MaxDiskSize=" & cabSize
outStream.WriteLine ".Set CompressionType=" & compressType
outStream.WriteLine ".Set InfFileLineFormat=(*disk#*) *file#*: *file* = *Size*"
outStream.WriteLine ".Set InfFileName=" & baseName & ".INF"
outStream.WriteLine ".Set RptFileName=" & baseName & ".RPT"
outStream.WriteLine ".Set InfHeader="
outStream.WriteLine ".Set InfFooter="
outStream.WriteLine ".Set DiskDirectoryTemplate=."
outStream.WriteLine ".Set Compress=ON"
outStream.WriteLine ".Set Cabinet=ON"
' Fetch each file and request the source path, then verify the source path
Dim fileKey, fileName, folder, sourcePath, delim, message, attributes
Do
Set record = view.Fetch : CheckError
If record Is Nothing Then Exit Do
fileKey = record.StringData(1)
fileName = record.StringData(2)
folder = record.StringData(3)
sequence = record.IntegerData(4)
attributes = record.IntegerData(5)
If (attributes And msidbFileAttributesNoncompressed) = 0 Then
If sequence <= lastSequence Then
If Not sequenceFile Then Fail "Duplicate sequence numbers in File table, use /S option"
sequence = lastSequence + 1
record.IntegerData(4) = sequence
view.Modify msiViewModifyUpdate, record
End If
lastSequence = sequence
delim = InStr(1, fileName, "|", vbTextCompare)
If delim <> 0 Then
If shortNames Then fileName = Left(fileName, delim-1) Else fileName = Right(fileName, Len(fileName) - delim)
End If
REM sourcePath = session.SourcePath(folder) & fileName
sourcePath = sourceFolder & fileKey
outStream.WriteLine sourcePath & " " & fileKey
If installer.FileAttributes(sourcePath) = -1 Then message = message & vbNewLine & sourcePath
End If
Loop
outStream.Close
REM Wscript.Echo "SourceDir = " & session.Property("SourceDir")
If Not IsEmpty(message) Then Fail "The following files were not available:" & message
' Generate compressed file cabinet
If makeCab Then
Dim WshShell : Set WshShell = Wscript.CreateObject("Wscript.Shell") : CheckError
Dim cabStat : cabStat = WshShell.Run("MakeCab.exe /f " & baseName & ".DDF", 7, True) : CheckError
If cabStat <> 0 Then Fail "MAKECAB.EXE failed, possibly could not find source files, or invalid DDF format"
End If
' Update Media table and SummaryInformation if requested
If updateMsi Then
Set view = database.OpenView("SELECT DiskId, LastSequence, Cabinet FROM Media ORDER BY DiskId") : CheckError
view.Execute : CheckError
updateMode = msiViewModifyUpdate
Set record = view.Fetch : CheckError
If record Is Nothing Then ' Media table empty
Set record = Installer.CreateRecord(3)
record.IntegerData(1) = 1
updateMode = msiViewModifyInsert
End If
record.IntegerData(2) = lastSequence
record.StringData(3) = cabName
view.Modify updateMode, record
Set sumInfo = database.SummaryInformation(3) : CheckError
sumInfo.Property(11) = Now
sumInfo.Property(13) = Now
sumInfo.Property(15) = (shortNames And 1) + 2
sumInfo.Persist
End If
' Embed cabinet if requested
If embedCab Then
Set view = database.OpenView("SELECT `Name`,`Data` FROM _Streams") : CheckError
view.Execute : CheckError
Set record = Installer.CreateRecord(2)
record.StringData(1) = cabFile
record.SetStream 2, cabFile : CheckError
view.Modify msiViewModifyAssign, record : CheckError 'replace any existing stream of that name
End If
' Commit database in case updates performed
database.Commit : CheckError
Wscript.Quit 0
' Extract argument value from command line, processing any option flags
Function NextArgument
Dim arg
Do ' loop to pull in option flags until an argument value is found
If iArg >= argCount Then Exit Function
arg = Wscript.Arguments(iArg)
iArg = iArg + 1
If (AscW(arg) <> AscW("/")) And (AscW(arg) <> AscW("-")) Then Exit Do
Select Case UCase(Right(arg, Len(arg)-1))
Case "C" : makeCab = True
Case "E" : embedCab = True
Case "F" : cabSize = "1.44M"
Case "L" : compressType = "LZX"
Case "R" : removeCab = True
Case "S" : sequenceFile = True
Case "U" : updateMsi = True
Case Else: Wscript.Echo "Invalid option flag:", arg : Wscript.Quit 1
End Select
Loop
NextArgument = arg
End Function
Sub CheckError
Dim message, errRec
If Err = 0 Then Exit Sub
message = Err.Source & " " & Hex(Err) & ": " & Err.Description
If Not installer Is Nothing Then
Set errRec = installer.LastErrorRecord
If Not errRec Is Nothing Then message = message & vbNewLine & errRec.FormatText
End If
Fail message
End Sub
Sub Fail(message)
Wscript.Echo message
Wscript.Quit 2
End Sub
|
<filename>admin/wmi/wbem/xmltransport/samples/hairdryer/reboot.vbs
On Error Resume Next
' Create the Locator
Dim theLocator
Set theLocator = CreateObject("WbemScripting.SWbemLocator")
If Err <> 0 Then
Wscript.Echo "CreateObject Error : " & Err.Description
End if
Dim theService
Set theService = theLocator.ConnectServer( "outsoft9", "root\cimv2", "redmond\stevm", "wmidemo_2000")
If Err <> 0 Then
Wscript.Echo theEventsWindow.value & "ConnectServer Error : " & Err.Description
End if
theService.Security_.impersonationLevel = 3
for each machine in theService.InstancesOf ("Win32_OperatingSystem")
machine.Win32ShutDown(6)
If Err <> 0 Then
Wscript.Echo "CreateObject Error : " & Err.Description
End if
next
|
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
'X and Y are in pixels, with (0,0) being the top left corner of the primary display
X As Long
Y As Long
End Type
Private Pt As POINTAPI
Private Sub Timer1_Timer()
GetCursorPos Pt
Me.Cls
Me.Print "X:" & Pt.X
Me.Print "Y:" & Pt.Y
End Sub
|
<reponame>npocmaka/Windows-Server-2003<gh_stars>10-100
Attribute VB_Name = "HtmFileInfo"
Option Explicit
Private Const TITLE_START_C As String = "<TITLE>"
Private Const TITLE_END_C As String = "</TITLE>"
Private Const TITLE_LENGTH_C As Long = 7
Private Const LOCCONTENT_START_C As String = "<META NAME=""DESCRIPTION"" LOCCONTENT="""
Private Const LOCCONTENT_END_C As String = """>"
Private Const LOCCONTENT_LENGTH_C As Long = 37
Public Function GetHtmTitle( _
ByVal i_strFileName As String _
) As String
Dim FSO As Scripting.FileSystemObject
Dim TS As Scripting.TextStream
Dim strContents As String
Dim strTitle As String
Dim intTitleStart As Long
Dim intTitleEnd As Long
Set FSO = New Scripting.FileSystemObject
Set TS = FSO.OpenTextFile(i_strFileName, ForReading)
strContents = TS.ReadAll
intTitleStart = InStr(1, strContents, TITLE_START_C, vbTextCompare)
intTitleStart = intTitleStart + TITLE_LENGTH_C ' Skip the Title tag
intTitleEnd = InStr(1, strContents, TITLE_END_C, vbTextCompare)
If (intTitleEnd - intTitleStart > 0) Then
strTitle = Mid$(strContents, intTitleStart, intTitleEnd - intTitleStart)
GetHtmTitle = RemoveExtraSpaces(RemoveCRLF(strTitle))
End If
End Function
Public Function GetHtmDescription( _
ByVal i_strFileName As String _
) As String
Dim FSO As Scripting.FileSystemObject
Dim TS As Scripting.TextStream
Dim strDesc As String
Dim strContents As String
Dim intDescStart As Long
Dim intDescEnd As Long
Set FSO = New Scripting.FileSystemObject
Set TS = FSO.OpenTextFile(i_strFileName, ForReading)
strContents = TS.ReadAll
intDescStart = InStr(1, strContents, LOCCONTENT_START_C, vbTextCompare)
If (intDescStart = 0) Then
Exit Function
End If
intDescStart = intDescStart + LOCCONTENT_LENGTH_C ' Skip the tag
intDescEnd = InStr(intDescStart, strContents, LOCCONTENT_END_C, vbTextCompare)
If (intDescEnd - intDescStart > 0) Then
strDesc = Mid$(strContents, intDescStart, intDescEnd - intDescStart)
GetHtmDescription = RemoveExtraSpaces(RemoveCRLF(strDesc))
End If
End Function
|
<gh_stars>0
PRINT "Fuck You Github"
|
<filename>Task/Function-composition/VBScript/function-composition-2.vb
dim c
set c = new closure
c.compose "ucase", "lcase"
wscript.echo c.formula
wscript.echo c("dog")
c.compose "log", "exp"
wscript.echo c.formula
wscript.echo c(12.3)
function inc( n )
inc = n + 1
end function
c.compose "inc", "inc"
wscript.echo c.formula
wscript.echo c(12.3)
function twice( n )
twice = n * 2
end function
c.compose "twice", "inc"
wscript.echo c.formula
wscript.echo c(12.3)
|
Sub MyLoop()
For i = 2 To 8 Step 2
Debug.Print i;
Next i
Debug.Print
End Sub
|
<gh_stars>10-100
VERSION 5.00
Begin VB.Form MultiEditForm
BorderStyle = 3 'Fixed Dialog
Caption = "Edit Metabase Data"
ClientHeight = 4905
ClientLeft = 45
ClientTop = 330
ClientWidth = 5355
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4905
ScaleWidth = 5355
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton DeleteDataButton
Caption = "Delete"
Height = 345
Left = 120
TabIndex = 20
Top = 3720
Width = 1020
End
Begin VB.CommandButton InsertDataButton
Caption = "Insert"
Height = 345
Left = 120
TabIndex = 19
Top = 3120
Width = 1020
End
Begin VB.ListBox DataList
Height = 1230
Left = 1320
TabIndex = 18
Top = 3000
Width = 3855
End
Begin VB.TextBox DataText
Height = 285
Left = 1320
TabIndex = 12
Top = 2640
Width = 3855
End
Begin VB.ComboBox UserTypeCombo
Height = 315
Left = 1320
Sorted = -1 'True
Style = 2 'Dropdown List
TabIndex = 11
Top = 1680
Width = 2535
End
Begin VB.TextBox UserTypeText
Enabled = 0 'False
Height = 285
Left = 3960
TabIndex = 10
Top = 1680
Width = 1215
End
Begin VB.ComboBox DataTypeCombo
Enabled = 0 'False
Height = 315
Left = 1320
Style = 2 'Dropdown List
TabIndex = 9
Top = 2160
Width = 2535
End
Begin VB.CheckBox InheritCheck
Caption = "Inherit"
Height = 255
Left = 1320
TabIndex = 8
Top = 720
Width = 1215
End
Begin VB.CheckBox SecureCheck
Caption = "Secure"
Height = 255
Left = 2640
TabIndex = 7
Top = 720
Width = 1215
End
Begin VB.CheckBox ReferenceCheck
Caption = "Reference"
Height = 255
Left = 3960
TabIndex = 6
Top = 720
Width = 1215
End
Begin VB.CheckBox VolatileCheck
Caption = "Volatile"
Height = 255
Left = 1320
TabIndex = 5
Top = 1200
Width = 1215
End
Begin VB.CheckBox InsertPathCheck
Caption = "Insert Path"
Height = 255
Left = 2640
TabIndex = 4
Top = 1200
Width = 1215
End
Begin VB.CommandButton CancelButton
Caption = "Cancel"
Height = 345
Left = 3960
TabIndex = 3
Top = 4440
Width = 1260
End
Begin VB.CommandButton OkButton
Caption = "OK"
Default = -1 'True
Height = 345
Left = 2520
TabIndex = 2
Top = 4440
Width = 1260
End
Begin VB.TextBox IdText
Height = 285
Left = 3960
TabIndex = 1
Top = 240
Width = 1215
End
Begin VB.ComboBox NameCombo
Height = 315
Left = 1320
Sorted = -1 'True
Style = 2 'Dropdown List
TabIndex = 0
Top = 240
Width = 2535
End
Begin VB.Label Label1
Caption = "Id:"
Height = 255
Left = 120
TabIndex = 17
Top = 240
Width = 975
End
Begin VB.Label Label2
Caption = "Atributes:"
Height = 255
Left = 120
TabIndex = 16
Top = 720
Width = 975
End
Begin VB.Label Label3
Caption = "User Type:"
Height = 255
Left = 120
TabIndex = 15
Top = 1680
Width = 975
End
Begin VB.Label Label4
Caption = "Data Type:"
Height = 255
Left = 120
TabIndex = 14
Top = 2160
Width = 975
End
Begin VB.Label Label5
Caption = "Data:"
Height = 255
Left = 120
TabIndex = 13
Top = 2640
Width = 975
End
End
Attribute VB_Name = "MultiEditForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
DefInt A-Z
'Form parameters
Public Machine As String
Public Key As String
Public Id As Long '0 = New
Public NewDataType As String 'New only
'Metabase Constants
Const METADATA_NO_ATTRIBUTES = &H0
Const METADATA_INHERIT = &H1
Const METADATA_PARTIAL_PATH = &H2
Const METADATA_SECURE = &H4
Const METADATA_REFERENCE = &H8
Const METADATA_VOLATILE = &H10
Const METADATA_ISINHERITED = &H20
Const METADATA_INSERT_PATH = &H40
Const IIS_MD_UT_SERVER = 1
Const IIS_MD_UT_FILE = 2
Const IIS_MD_UT_WAM = 100
Const ASP_MD_UT_APP = 101
Const ALL_METADATA = 0
Const DWORD_METADATA = 1
Const STRING_METADATA = 2
Const BINARY_METADATA = 3
Const EXPANDSZ_METADATA = 4
Const MULTISZ_METADATA = 5
Private Sub Form_Load()
'Init UserTypeCombo
UserTypeCombo.Clear
UserTypeCombo.AddItem "Server"
UserTypeCombo.AddItem "File"
UserTypeCombo.AddItem "WAM"
UserTypeCombo.AddItem "ASP App"
UserTypeCombo.AddItem "Other"
UserTypeCombo.Text = "Server"
'Init DataTypeCombo
DataTypeCombo.Clear
DataTypeCombo.AddItem "Multi-String"
DataTypeCombo.Text = "Multi-String"
DataTypeCombo.Enabled = False
End Sub
Private Sub LoadPropertyNames()
On Error GoTo LError
Dim NameProperty As Variant
For Each NameProperty In MainForm.MetaUtilObj.EnumProperties(Machine + "\Schema\Properties\Names")
NameCombo.AddItem NameProperty.Data
Next
LError:
End Sub
Public Sub Init()
Dim Property As Object
Dim Attributes As Long
Dim UserType As Long
Dim DataType As Long
If Id = 0 Then
'New data
'Load the Names
NameCombo.Clear
LoadPropertyNames
NameCombo.AddItem "Other"
NameCombo.Text = "Other"
'Set Id to 0
IdText.Enabled = True
IdText.Text = "0"
'Clear all flags
InheritCheck.Value = vbUnchecked
SecureCheck.Value = vbUnchecked
ReferenceCheck.Value = vbUnchecked
VolatileCheck.Value = vbUnchecked
InsertPathCheck.Value = vbUnchecked
'Set UserType to Server
UserTypeCombo.Text = "Server"
'Set DataType (not needed)
'Set Data to empty
DataList.Clear
DataText.Text = ""
DataText.Enabled = False
Else
'Edit existing
Set Property = MainForm.MetaUtilObj.GetProperty(Key, Id)
'Set the Name
NameCombo.Clear
If Property.Name <> "" Then
NameCombo.AddItem Property.Name
NameCombo.Text = Property.Name
Else
NameCombo.AddItem "Other"
NameCombo.Text = "Other"
End If
NameCombo.Enabled = False
'Set Id
IdText.Enabled = False
IdText.Text = Str(Property.Id)
'Set attributes
Attributes = Property.Attributes
If (Attributes And METADATA_INHERIT) = METADATA_INHERIT Then
InheritCheck.Value = vbChecked
Else
InheritCheck.Value = vbUnchecked
End If
If (Attributes And METADATA_SECURE) = METADATA_SECURE Then
SecureCheck.Value = vbChecked
Else
SecureCheck.Value = vbUnchecked
End If
If (Attributes And METADATA_REFERENCE) = METADATA_REFERENCE Then
ReferenceCheck.Value = vbChecked
Else
ReferenceCheck.Value = vbUnchecked
End If
If (Attributes And METADATA_VOLATILE) = METADATA_VOLATILE Then
VolatileCheck.Value = vbChecked
Else
VolatileCheck.Value = vbUnchecked
End If
If (Attributes And METADATA_INSERT_PATH) = METADATA_INSERT_PATH Then
InsertPathCheck.Value = vbChecked
Else
InsertPathCheck.Value = vbUnchecked
End If
'Set UserType
UserType = Property.UserType
If UserType = IIS_MD_UT_SERVER Then
UserTypeCombo.Text = "Server"
ElseIf UserType = IIS_MD_UT_FILE Then
UserTypeCombo.Text = "File"
ElseIf UserType = IIS_MD_UT_WAM Then
UserTypeCombo.Text = "WAM"
ElseIf UserType = ASP_MD_UT_APP Then
UserTypeCombo.Text = "ASP App"
Else
UserTypeCombo.Text = "Other"
UserTypeText.Text = Str(UserType)
End If
'Set DataType (not needed)
'Set Data
LoadData Property
End If
End Sub
Private Sub LoadData(Property As Object)
Dim DataArray As Variant
Dim i As Long
DataText.Text = ""
DataList.Clear
DataArray = Property.Data
For i = LBound(DataArray) To UBound(DataArray)
DataList.AddItem DataArray(i)
Next
If DataList.ListCount > 0 Then
DataList.ListIndex = 0
DataText.Text = DataList.List(0)
End If
End Sub
Private Sub SaveData(Property As Object)
Dim i As Long
Dim DataArray() As Variant
ReDim DataArray(DataList.ListCount) As Variant
For i = 0 To DataList.ListCount - 1
DataArray(i) = DataList.List(i)
Next
Property.Data = DataArray
End Sub
Private Sub InsertDataButton_Click()
DataList.AddItem "", DataList.ListIndex + 1
DataText.Enabled = True
DataList.ListIndex = DataList.ListIndex + 1
End Sub
Private Sub DeleteDataButton_Click()
Dim DelItem As Long
If DataList.ListIndex >= 0 Then
DelItem = DataList.ListIndex
DataList.RemoveItem DelItem
If DataList.ListCount = 0 Then
DataText.Enabled = False
ElseIf DataList.ListCount > DelItem Then
DataList.ListIndex = DelItem
Else
DataList.ListIndex = DataList.ListCount - 1
End If
Else
DataText.Enabled = False
End If
End Sub
Private Sub DataList_Click()
If DataList.ListIndex >= 0 Then
DataText.Text = DataList.List(DataList.ListIndex)
DataText.Enabled = True
End If
End Sub
Private Sub DataText_Change()
If DataList.ListIndex >= 0 Then
DataList.List(DataList.ListIndex) = DataText.Text
End If
End Sub
Private Sub NameCombo_Click()
If NameCombo.Text <> "Other" Then
IdText.Enabled = False
IdText.Text = Str(MainForm.MetaUtilObj.PropNameToId(Key, NameCombo.Text))
Else
IdText.Enabled = True
End If
End Sub
Private Sub UserTypeCombo_Click()
If UserTypeCombo.Text = "Other" Then
UserTypeText.Enabled = True
UserTypeText.Text = ""
UserTypeText.SetFocus
Else
UserTypeText.Enabled = False
If UserTypeCombo.Text = "Server" Then
UserTypeText.Text = Str(IIS_MD_UT_SERVER)
ElseIf UserTypeCombo.Text = "File" Then
UserTypeText.Text = Str(IIS_MD_UT_FILE)
ElseIf UserTypeCombo.Text = "WAM" Then
UserTypeText.Text = Str(IIS_MD_UT_WAM)
ElseIf UserTypeCombo.Text = "ASP App" Then
UserTypeText.Text = Str(ASP_MD_UT_APP)
Else
UserTypeText = "0"
End If
End If
End Sub
Private Sub OkButton_Click()
'On Error GoTo LError:
Dim Property As Object
Dim Attributes As Long
'Check fields
If CLng(IdText.Text) = 0 Then
MsgBox "Id must be nonzero", _
vbExclamation + vbOKOnly, "Edit Metabase Data"
Exit Sub
End If
'Write data
If Id = 0 Then
Set Property = MainForm.MetaUtilObj.CreateProperty(Key, CLng(IdText.Text))
Else
Set Property = MainForm.MetaUtilObj.GetProperty(Key, CLng(IdText.Text))
End If
Attributes = METADATA_NO_ATTRIBUTES
If InheritCheck.Value = vbChecked Then
Attributes = Attributes + METADATA_INHERIT
ElseIf SecureCheck.Value = vbChecked Then
Attributes = Attributes + METADATA_SECURE
ElseIf ReferenceCheck.Value = vbChecked Then
Attributes = Attributes + METADATA_REFERENCE
ElseIf VolatileCheck.Value = vbChecked Then
Attributes = Attributes + METADATA_VOLATILE
ElseIf InsertPathCheck.Value = vbChecked Then
Attributes = Attributes + METADATA_INSERT_PATH
End If
Property.Attributes = Attributes
Property.UserType = CLng(UserTypeText.Text)
Property.DataType = MULTISZ_METADATA
SaveData Property
Property.Write
'Clean up
Me.Hide
Exit Sub
LError:
MsgBox "Failure to write property: " & Err.Description, _
vbExclamation + vbOKOnly, "Edit Metabase Data"
End Sub
Private Sub CancelButton_Click()
Me.Hide
End Sub
|
Sub magicsquare()
'Magic squares of odd order
Const n = 9
Dim i As Integer, j As Integer, v As Integer
Debug.Print "The square order is: " & n
For i = 1 To n
For j = 1 To n
v = ((i * 2 - j + n - 1) Mod n) * n + ((i * 2 + j - 2) Mod n) + 1
Debug.Print Right(Space(5) & v, 5);
Next j
Debug.Print
Next i
Debug.Print "The magic number is: " & n * (n * n + 1) \ 2
End Sub 'magicsquare
|
'Copyright (c)<2000>Microsoft Corporation. All rights reserved.
Function MofcompAlertEmail
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "mofcomp %SYSTEMROOT%\system32\serverappliance\setup\saalertemaileventconsumer.mof", 0, TRUE
End Function
Function MofcompAppMgr
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "mofcomp %SYSTEMROOT%\system32\serverappliance\setup\appmgr.mof", 0, TRUE
End Function
Function MofcompDateTime
Dim WshShell
Dim dt
Set WshShell = CreateObject("WScript.Shell")
On Error Resume Next
dt = WshShell.RegRead("HKLM\Software\Classes\CLSID\{F0229EA0-D1D8-11D2-84FC-0080C7227EA1}\ProgID\")
if dt="SetDateTime.DateTime.1" then
WshShell.Run "mofcomp %SYSTEMROOT%\system32\serverappliance\setup\datetimereg.mof", 0, TRUE
end if
End Function
Function MofcompEventFilter
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "mofcomp %SYSTEMROOT%\system32\serverappliance\setup\saevfltr.mof", 0, TRUE
End Function
Function MofcompLocalUI
Dim WshShell, dt
Set WshShell = CreateObject("WScript.Shell")
On Error Resume Next
WshShell.Run "mofcomp %SYSTEMROOT%\system32\serverappliance\setup\sadiskmonitor.mof", 0, TRUE
WshShell.Run "mofcomp %SYSTEMROOT%\system32\serverappliance\setup\sanetworkmonitor.mof", 0, TRUE
End Function
|
Function stripchars(s1,s2)
For i = 1 To Len(s1)
If InStr(s2,Mid(s1,i,1)) Then
s1 = Replace(s1,Mid(s1,i,1),"")
End If
Next
stripchars = s1
End Function
WScript.StdOut.Write stripchars("She was a soul stripper. She took my heart!","aei")
|
<reponame>LaudateCorpus1/RosettaCodeData
Deficient = 0
Perfect = 0
Abundant = 0
For i = 1 To 20000
sum = 0
For n = 1 To 20000
If n < i Then
If i Mod n = 0 Then
sum = sum + n
End If
End If
Next
If sum < i Then
Deficient = Deficient + 1
ElseIf sum = i Then
Perfect = Perfect + 1
ElseIf sum > i Then
Abundant = Abundant + 1
End If
Next
WScript.Echo "Deficient = " & Deficient & vbCrLf &_
"Perfect = " & Perfect & vbCrLf &_
"Abundant = " & Abundant
|
'---------------------------------------
' makeg.vbs
' ~~~~~~~~~
' This is a simple vb script for testing msclus.dll.
' The script uses bugtool.exe to allow vbscript to do
' OutputDebugString. Make sure that dbmon is running
' to see output.
'
'------------------------------------------
Dim Log
Set Log = CreateObject( "BugTool.Logger" )
'----------------------------------------
' Create cluster object and open it.
'----------------------------------------
Dim oCluster
Set oCluster = CreateObject( "MSCluster.Cluster" )
oCluster.Open( "worfpack" )
Log.Write "Cluster Name = " & oCluster.Name & vbCRLF
'----------------------------------------
' Get the first node in the cluster
'----------------------------------------
Dim oNode
Set oNode = oCluster.Nodes(1)
Log.Write "Node Name = " & oNode.Name & vbCRLF
Log.Write "Node ID = " & oNode.NodeID & vbCRLF
'----------------------------------------
' Get the list of resource groups in the node
'----------------------------------------
Dim oGroups
Set oGroups = oNode.ResourceGroups
'----------------------------------------
' Add a new resource group to the node
'----------------------------------------
Dim oGroup
Set oGroup = oGroups.Add( "My New Group" )
'Set oGroup = oGroups("My New Group" ) ' or just get the existing one...
'----------------------------------------
' Get the new nodes resource list.
'----------------------------------------
Dim oResources
Set oResources = oGroup.Resources
'----------------------------------------
' Add a new resource to the group
'----------------------------------------
Dim oResource
Set oResource = oResources.Add( "SomeApp", "Generic Application", 0 )
'Set oResource = oResources( "SomeApp" )
'----------------------------------------
' Set some properties on the resource
'----------------------------------------
oResource.PrivateProperties.Add "CommandLine", "c:\winnt\system32\calc.exe"
oResource.PrivateProperties.Add "CurrentDirectory", "c:\"
oResource.PrivateProperties.Add "InteractWithDesktop", 1
'----------------------------------------
' Bring the resource on line
'----------------------------------------
oResource.OnLine
'----------------------------------------
' A good script writer would close everthing
' at this point, but why bother...
'----------------------------------------
|
option explicit
dim CoCreateClsContexts, CoInitializeParams, i, j, doactivate, otherthread, paramstring, j2
CoCreateClsContexts = Array(1, 2, 3, 4, 5, 6, 7)
CoInitializeParams = Array(0, 2, 4, 8)
for i = LBound(CoCreateClsContexts) to UBound(CoCreateClsContexts)
for j = LBound(CoInitializeParams) to UBound(CoInitializeParams)
for j2 = LBound(CoInitializeParams) to UBound(CoInitializeParams)
for doactivate = 1 to 2
for otherthread = 1 to 2
paramstring = "famp.exe -clsidtocreate {B3F2B6A5-A79A-4202-AF40-8339DF42CAE4} "
if (doactivate = 1) then paramstring = paramstring & " -activatebeforecreate "
if (otherthread = 1) then paramstring = paramstring & " -createotherthread "
paramstring = paramstring _
& " -coinitparamformainthread " & CoInitializeParams(j) _
& " -coinitparamforcreatedthread " & CoInitializeParams(j2) _
& " -clsctx " & CoCreateClsContexts(i)
WScript.Echo(paramstring)
next
next
next
next
next
|
'//+----------------------------------------------------------------------------
'//
'// File: about.frm
'//
'// Module: pbadmin.exe
'//
'// Synopsis: The about dialog for PBA
'//
'// Copyright (c) 1997-1999 Microsoft Corporation
'//
'// Author: quintinb Created Header 09/02/99
'//
'//+----------------------------------------------------------------------------
VERSION 5.00
Begin VB.Form frmabout
BorderStyle = 3 'Fixed Dialog
ClientHeight = 2760
ClientLeft = 1830
ClientTop = 1725
ClientWidth = 6930
Icon = "about.frx":0000
KeyPreview = -1 'True
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
PaletteMode = 1 'UseZOrder
ScaleHeight = 2760
ScaleWidth = 6930
ShowInTaskbar = 0 'False
Begin VB.Frame Frame1
Appearance = 0 'Flat
ForeColor = &H80000008&
Height = 1395
Left = 165
TabIndex = 5
Top = 1260
Width = 6585
Begin VB.Label WarningLabel
Caption = "Warning: "
Height = 1155
Left = 120
TabIndex = 6
Top = 165
Width = 6345
End
End
Begin VB.PictureBox Picture1
BorderStyle = 0 'None
Height = 615
Left = 150
Picture = "about.frx":000C
ScaleHeight = 615
ScaleWidth = 735
TabIndex = 2
Top = 120
Width = 735
End
Begin VB.CommandButton Command1
Cancel = -1 'True
Caption = "ok"
Default = -1 'True
Height = 330
Left = 5760
TabIndex = 0
Top = 300
Width = 975
End
Begin VB.Label CopyrightLabel
Height = 255
Left = 1080
TabIndex = 4
Top = 855
Width = 4425
End
Begin VB.Label VersionLabel
Height = 255
Left = 1080
TabIndex = 3
Top = 465
Width = 2145
End
Begin VB.Label AppLabel
Height = 255
Left = 1080
TabIndex = 1
Top = 225
Width = 4335
End
End
Attribute VB_Name = "frmabout"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Function LoadAboutRes()
Dim cRef As Integer
On Error GoTo LoadErr
cRef = 6000
Me.Caption = LoadResString(cRef + 4) & " " & frmMain.Caption
VersionLabel.Caption = LoadResString(cRef + 1)
CopyrightLabel.Caption = LoadResString(cRef + 2)
WarningLabel.Caption = LoadResString(cRef + 3)
Command1.Caption = LoadResString(1002)
' Set Fonts
SetFonts Me
On Error GoTo 0
Exit Function
LoadErr:
Exit Function
End Function
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_Load()
On Error GoTo LoadErr
CenterForm Me, Screen
AppLabel.Caption = App.title
LoadAboutRes
VersionLabel.Caption = VersionLabel.Caption & " " & App.Major & "." & _
App.Minor & " (" & "6.0." & App.Revision & ".0)"
On Error GoTo 0
Exit Sub
LoadErr:
Exit Sub
End Sub
|
Option Explicit
const SKU_SRV = 4
const SKU_ADS = 8
const SKU_DTC = 16
const SKU_ADS64 = 64
const SKU_DTC64 = 128
const SERVER_MDB = "d:\temp\Server.mdb"
const DESKTOP_MDB = "c:\temp\Desktop.mdb"
const WINME_MDB = "c:\temp\WinMe.mdb"
Dim clsAuthDatabase
Set clsAuthDatabase = CreateObject("AuthDatabase.Main")
TestImportHHK
Sub TestKeywordifyTitles
Dim clsTaxonomy
clsAuthDatabase.SetDatabase SERVER_MDB
Set clsTaxonomy = clsAuthDatabase.Taxonomy
clsTaxonomy.KeywordifyTitles 1
End Sub
Sub TestImportHHK
Dim clsImporter
Dim FSO
Dim Folder
Dim File
clsAuthDatabase.SetDatabase SERVER_MDB
Set clsImporter = clsAuthDatabase.Importer
Set FSO = CreateObject("Scripting.FileSystemObject")
Set Folder = FSO.GetFolder("\\srvua\Latest\HelpDirs\SRV\Help\HHK")
For Each File in Folder.Files
clsImporter.ImportHHK File.Path, _
"\\srvua\Latest\HelpDirs\SRV\Help", SKU_SRV, 0, "", 2
Next
End Sub
Sub TestImportHHC
Dim clsImporter
clsAuthDatabase.SetDatabase SERVER_MDB
Set clsImporter = clsAuthDatabase.Importer
clsImporter.ImportHHC "\\srvua\Latest\HelpDirs\SRV\Help\HHC\windows.hhc", _
"\\srvua\Latest\HelpDirs\SRV\Help", SKU_SRV, 0, ""
End Sub
Sub TestImportHHT
Dim clsHHT
clsAuthDatabase.SetDatabase DESKTOP_MDB
Set clsHHT = clsAuthDatabase.HHT
clsHHT.ImportHHT "c:\temp\foo.xml", 1234
End Sub
Sub UpdateChqAndHhk
Dim clsChqsAndHhks
clsAuthDatabase.SetDatabase SERVER_MDB
Set clsChqsAndHhks = clsAuthDatabase.ChqsAndHhks
clsChqsAndHhks.UpdateTable 4, "\\pietrino\HSCExpChms\Srv\winnt", _
"\\pietrino\HlpImages\Srv\winnt"
End Sub
Sub TestChqAndHhk
Dim clsChqsAndHhks
Dim dictFilesAdded
Dim dictFilesRemoved
Dim dtmT0
Dim dtmT1
Dim vnt
clsAuthDatabase.SetDatabase SERVER_MDB
Set clsChqsAndHhks = clsAuthDatabase.ChqsAndHhks
clsChqsAndHhks.UpdateTable 4, "c:\temp\CHQ\1"
Sleep 2000
clsChqsAndHhks.UpdateTable 8, "c:\temp\CHQ\1"
dtmT0 = Now
Sleep 5000
clsChqsAndHhks.UpdateTable 4, "c:\temp\CHQ\2"
Sleep 2000
clsChqsAndHhks.UpdateTable 8, "c:\temp\CHQ\2"
Sleep 5000
clsChqsAndHhks.UpdateTable 4, "c:\temp\CHQ\3"
dtmT1 = Now
Set dictFilesAdded = CreateObject("Scripting.Dictionary")
Set dictFilesRemoved = CreateObject("Scripting.Dictionary")
clsChqsAndHhks.GetFileListDelta 4, dtmT0, dtmT1, dictFilesAdded, dictFilesRemoved
WScript.Echo "Files added for SRV:"
For Each vnt in dictFilesAdded.Keys
WScript.Echo vnt
Next
WScript.Echo "Files removed for SRV:"
For Each vnt in dictFilesRemoved.Keys
WScript.Echo vnt
Next
dictFilesAdded.RemoveAll
dictFilesRemoved.RemoveAll
clsChqsAndHhks.GetFileListDelta 8, dtmT0, dtmT1, dictFilesAdded, dictFilesRemoved
WScript.Echo "Files added for ADV:"
For Each vnt in dictFilesAdded.Keys
WScript.Echo vnt
Next
WScript.Echo "Files removed for ADV:"
For Each vnt in dictFilesRemoved.Keys
WScript.Echo vnt
Next
End Sub
Sub TestDatabaseBackup
clsAuthDatabase.CopyAndCompactDatabase SERVER_MDB, "c:\temp\ServerBack.mdb"
clsAuthDatabase.CopyAndCompactDatabase DESKTOP_MDB, "c:\temp\DesktopBack.mdb"
End Sub
Sub TestServerCAB
Dim clsHHT
clsAuthDatabase.SetDatabase SERVER_MDB
Set clsHHT = clsAuthDatabase.HHT
clsHHT.GenerateCAB "c:\temp\SRV.cab", 4
rem clsHHT.GenerateCAB "c:\temp\ADV.cab", 8
rem clsHHT.GenerateCAB "c:\temp\DAT.cab", 16
rem clsHHT.GenerateCAB "c:\temp\ADV64.cab", 64
rem clsHHT.GenerateCAB "c:\temp\DAT64.cab", 128
End Sub
Sub TestDesktopCAB
Dim clsHHT
clsAuthDatabase.SetDatabase DESKTOP_MDB
Set clsHHT = clsAuthDatabase.HHT
clsHHT.GenerateCAB "c:\temp\STD.cab", 1
clsHHT.GenerateCAB "c:\temp\PRO.cab", 2
clsHHT.GenerateCAB "c:\temp\PRO64.cab", 32
End Sub
Sub TestWinMeCAB
Dim clsHHT
clsAuthDatabase.SetDatabase WINME_MDB
Set clsHHT = clsAuthDatabase.HHT
clsHHT.GenerateHHT "c:\temp\WINME.cab", 256, "Windows Me Update", False
End Sub
Sub TestSynonymSets()
Dim clsSynonymSets
Dim arrKeywords(3)
Dim v
clsAuthDatabase.SetDatabase WINME_MDB
Set clsSynonymSets = clsAuthDatabase.SynonymSets
arrKeywords(0) = 0
arrKeywords(1) = 1
arrKeywords(2) = 2
arrKeywords(3) = 3
v = arrKeywords
clsSynonymSets.Create ".aaaaaaaaaahhhhhhh", v, 0, 0, "Test"
End Sub
Sub TestParameters()
Dim clsParameters
clsAuthDatabase.SetDatabase WINME_MDB
Set clsParameters = clsAuthDatabase.Parameters
clsParameters.Value("Foo") = 134
Wscript.Echo clsParameters.Value("Foo") * 2
End Sub
Sub Sleep(intMilliSeconds)
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Sleep intMilliSeconds
End Sub
|
<filename>Task/Polynomial-regression/VBA/polynomial-regression.vba<gh_stars>1-10
Option Base 1
Private Function polynomial_regression(y As Variant, x As Variant, degree As Integer) As Variant
Dim a() As Double
ReDim a(UBound(x), 2)
For i = 1 To UBound(x)
For j = 1 To degree
a(i, j) = x(i) ^ j
Next j
Next i
polynomial_regression = WorksheetFunction.LinEst(WorksheetFunction.Transpose(y), a, True, True)
End Function
Public Sub main()
x = [{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}]
y = [{1, 6, 17, 34, 57, 86, 121, 162, 209, 262, 321}]
result = polynomial_regression(y, x, 2)
Debug.Print "coefficients : ";
For i = UBound(result, 2) To 1 Step -1
Debug.Print Format(result(1, i), "0.#####"),
Next i
Debug.Print
Debug.Print "standard errors: ";
For i = UBound(result, 2) To 1 Step -1
Debug.Print Format(result(2, i), "0.#####"),
Next i
Debug.Print vbCrLf
Debug.Print "R^2 ="; result(3, 1)
Debug.Print "F ="; result(4, 1)
Debug.Print "Degrees of freedom:"; result(4, 2)
Debug.Print "Standard error of y estimate:"; result(3, 2)
End Sub
|
Public Sub Main()
Dim v As Variant
' initial state: Empty
Debug.Assert IsEmpty(v)
Debug.Assert VarType(v) = vbEmpty
v = 1&
Debug.Assert VarType(v) = vbLong
' assigning the Null state
v = Null
' checking for Null state
Debug.Assert IsNull(v)
Debug.Assert VarType(v) = vbNull
End Sub
|
<gh_stars>1-10
Option Explicit
Sub Main()
Dim arr, i
'init
arr = Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
'Loop and apply a function (Fibonacci) to each element
For i = LBound(arr) To UBound(arr): arr(i) = Fibonacci(arr(i)): Next
'return
Debug.Print Join(arr, ", ")
End Sub
Private Function Fibonacci(N) As Variant
If N <= 1 Then
Fibonacci = N
Else
Fibonacci = Fibonacci(N - 1) + Fibonacci(N - 2)
End If
End Function
|
<reponame>btashton/pygments
rem VBScript examples
' Various constants of different types
const someText = "some " & """text"""
const someInt = 123
const someHex = &h3110c0d3
const someFloat = 123.45e-67
const someDate = #1/2/2016#
const someTime = #12:34:56 AM#
const someBool = vbTrue ' -1
' Do some math.
radius = 1.e2
area = radius ^ 2 * 3.1315
a = 17 : b = 23
c = sqr(a ^2 + b ^ 2)
' Write 10 files.
For i = 1 to 10
createFile( i )
Next
Public Sub createFile(a)
Dim fso, TargetFile
TargetPath = "C:\some_" & a & ".tmp"
Set fso = CreateObject("Scripting.FileSystemObject")
Set TargetFile = fso.CreateTextFile(TargetPath)
TargetFile.WriteLine("Hello " & vbCrLf & "world!")
TargetFile.Close
End Sub
' Define a class with a property.
Class Customer
Private m_CustomerName
Private Sub Class_Initialize
m_CustomerName = ""
End Sub
' CustomerName property.
Public Property Get CustomerName
CustomerName = m_CustomerName
End Property
Public Property Let CustomerName(custname)
m_CustomerName = custname
End Property
End Class
' Special constructs
Option Explicit
On Error Resume Next
On Error Goto 0
' Comment without terminating CR/LF.
|
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
Dim Service As SWbemServices
Set Service = GetObject("winmgmts:")
Debug.Print Service.Security_.AuthenticationLevel & ":" & _
Service.Security_.ImpersonationLevel
Dim Service2 As SWbemServices
Set Service2 = GetObject("winmgmts:{impersonationLevel=impersonate}")
Debug.Print Service2.Security_.AuthenticationLevel & ":" & _
Service2.Security_.ImpersonationLevel
Dim Class As SWbemObject
Set Class = GetObject("winmgmts:win32_logicaldisk")
Debug.Print Class.Security_.AuthenticationLevel & ":" & _
Class.Security_.ImpersonationLevel
Dim Class2 As SWbemObject
Set Class2 = GetObject("winmgmts:{impersonationLevel=impersonate}!win32_logicaldisk")
Debug.Print Class2.Security_.AuthenticationLevel & ":" & _
Class2.Security_.ImpersonationLevel
'Dim Class3 As SWbemObject
'Set Class3 = GetObject("winmgmts:{impersoationLevel=impersonate}!win32_logicaldisk")
Dim Class4 As SWbemObject
Set Class4 = GetObject("winmgmts:{ impersonationLevel = impersonate }!win32_logicaldisk")
Debug.Print Class4.Security_.AuthenticationLevel & ":" & _
Class4.Security_.ImpersonationLevel
Dim Class5 As SWbemObject
Set Class5 = GetObject("winmgmts:{ impersonationLevel = impersonate }!root/default:__cimomidentification=@")
Debug.Print Class5.Security_.AuthenticationLevel & ":" & _
Class5.Security_.ImpersonationLevel
Debug.Print Class5.Path_.DisplayName
End Sub
|
Public Sub main()
x = [{1, 2, 3, 1e11}]
y = [{1, 1.4142135623730951, 1.7320508075688772, 316227.76601683791}]
Dim TextFile As Integer
TextFile = FreeFile
Open "filename" For Output As TextFile
For i = 1 To UBound(x)
Print #TextFile, Format(x(i), "0.000E-000"), Format(y(i), "0.00000E-000")
Next i
Close TextFile
End Sub
|
Sub bar1()
'by convention, a simple handler
On Error Goto Catch
fooX
Exit Sub
Catch:
'handle all exceptions
Exit Sub
Sub bar2()
'a more complex handler, illustrating some of the flexibility of VBA exception handling
on error goto catch
100 fooX
200 fooY
'finally block may be placed anywhere: this is complexity for it's own sake:
goto finally
catch:
if erl= 100 then
' handle exception at first line: in this case, by ignoring it:
resume next
else
select case err.nummber
case vbObjectError + 1050
' handle exceptions of type 1050
case vbObjectError + 1051
' handle exceptions of type 1051
case else
' handle any type of exception not handled by above catches or line numbers
resume finally
finally:
'code here occurs whether or not there was an exception
'block may be placed anywhere
'by convention, often just a drop through to an Exit Sub, rather tnan a code block
Goto end_try:
end_try:
'by convention, often just a drop through from the catch block
exit sub
|
<gh_stars>10-100
'
' Copyright (c) Microsoft Corporation. All rights reserved.
'
' VBScript Source File
'
' Script Name: IIsApp.vbs
'
Option Explicit
On Error Resume Next
' Error codes
Const ERR_OK = 0
Const ERR_GENERAL_FAILURE = 1
'''''''''''''''''''''
' Messages
Const L_Gen_ErrorMessage = "%1 : %2"
Const L_CmdLib_ErrorMessage = "Could not create an instance of the CmdLib object."
Const L_ChkCmdLibReg_ErrorMessage = "Please register the Microsoft.CmdLib component."
Const L_ScriptHelper_ErrorMessage = "Could not create an instance of the IIsScriptHelper object."
Const L_ChkScpHelperReg_ErrorMessage = "Please, check if the Microsoft.IIsScriptHelper is registered."
Const L_InvalidSwitch_ErrorMessage = "Invalid switch: %1"
Const L_NotEnoughParams_ErrorMessage = "Not enough parameters."
Const L_Query_ErrorMessage = "Error executing query"
Const L_Serving_Message = "The following W3WP.exe processes are serving AppPool: %1"
Const L_NoW3_ErrorMessage = "Error - no w3wp.exe processes are running at this time"
Const L_PID_Message = "W3WP.exe PID: %1"
Const L_NoResults_ErrorMessage = "Error - no results"
Const L_APID_Message = "W3WP.exe PID: %1 AppPoolId: %2"
Const L_NotW3_ErrorMessage = "ERROR: ProcessId specified is NOT an instance of W3WP.exe - EXITING"
Const L_PIDNotValid_ErrorMessage = "ERROR: PID is not valid"
'''''''''''''''''''''
' Help
Const L_Empty_Text = ""
' General help messages
Const L_SeeHelp_Message = "Type IIsApp /? for help."
Const L_Help_HELP_General01_Text = "Description: list IIS worker processes."
Const L_Help_HELP_General02_Text = "Syntax: IIsApp.vbs [/a <app_pool_id> | /p <pid>]"
Const L_Help_HELP_General04_Text = "Parameters:"
Const L_Help_HELP_General05_Text = ""
Const L_Help_HELP_General06_Text = "Value Description"
Const L_Help_HELP_General07_Text = "/a <app_pool_id> report PIDs of currently running"
Const L_Help_HELP_General08_Text = " w3wp.exe processes serving pool"
Const L_Help_HELP_General09_Text = " <app_pool_id>. Surround <app_pool_id>"
Const L_Help_HELP_General10_Text = " with quotes if it contains spaces."
Const L_Help_HELP_General11_Text = " not specified by default and exclusive"
Const L_Help_HELP_General12_Text = " to /p switch."
Const L_Help_HELP_General13_Text = "/p <pid> report AppPoolId of w3wp specified by <pid>"
Const L_Help_HELP_General14_Text = "DEFAULT: no switches will print out the PID and AppPoolId"
Const L_Help_HELP_General15_Text = " for each w3wp.exe"
''''''''''''''''''''''''
' Operation codes
Const OPER_BY_NAME = 1
Const OPER_BY_PID = 2
Const OPER_ALL = 3
'
' Main block
'
Dim oScriptHelper, oCmdLib
Dim intOperation, intResult
Dim strCmdLineOptions
Dim oError
Dim aArgs
Dim apoolID, PID
Dim oProviderObj
' Default
intOperation = OPER_ALL
Const wmiConnect = "winmgmts:{(debug)}:/root/cimv2"
Const queryString = "select * from Win32_Process where Name='w3wp.exe'"
Const pidQuery = "select * from Win32_Process where ProcessId="
' get NT WMI provider
Set oProviderObj = GetObject(wmiConnect)
' Instantiate the CmdLib for output string formatting
Set oCmdLib = CreateObject("Microsoft.CmdLib")
If Err.Number <> 0 Then
WScript.Echo L_CmdLib_ErrorMessage
WScript.Echo L_ChkCmdLibReg_ErrorMessage
WScript.Quit(ERR_GENERAL_FAILURE)
End If
Set oCmdLib.ScriptingHost = WScript.Application
' Instantiate script helper object
Set oScriptHelper = CreateObject("Microsoft.IIsScriptHelper")
If Err.Number <> 0 Then
WScript.Echo L_ScriptHelper_ErrorMessage
WScript.Echo L_ChkScpHelperReg_ErrorMessage
WScript.Quit(ERR_GENERAL_FAILURE)
End If
Set oScriptHelper.ScriptHost = WScript
' Check if we are being run with cscript.exe instead of wscript.exe
oScriptHelper.CheckScriptEngine
' Command Line parsing
Dim argObj, arg
Set argObj = WScript.Arguments
strCmdLineOptions = "a:a:1;p:p:1"
If argObj.Named.Count > 0 Then
Set oError = oScriptHelper.ParseCmdLineOptions(strCmdLineOptions)
If Not oError Is Nothing Then
If oError.ErrorCode = oScriptHelper.ERROR_NOT_ENOUGH_ARGS Then
' Not enough arguments for a specified switch
WScript.Echo L_NotEnoughParams_ErrorMessage
WScript.Echo L_SeeHelp_Message
Else
' Invalid switch
oCmdLib.vbPrintf L_InvalidSwitch_ErrorMessage, Array(oError.SwitchName)
WScript.Echo L_SeeHelp_Message
End If
WScript.Quit(ERR_GENERAL_FAILURE)
End If
If oScriptHelper.GlobalHelpRequested Then
DisplayHelpMessage
WScript.Quit(ERR_OK)
End If
For Each arg In oScriptHelper.Switches
Select Case arg
Case "a"
apoolID = oScriptHelper.GetSwitch(arg)
intOperation = OPER_BY_NAME
Case "p"
PID = oScriptHelper.GetSwitch(arg)
intOperation = OPER_BY_PID
End Select
Next
End If
' Choose operation
Select Case intOperation
Case OPER_BY_NAME
intResult = GetByPool(apoolID)
Case OPER_BY_PID
intResult = GetByPid(PID)
Case OPER_ALL
intResult = GetAllW3WP()
End Select
' Return value to command processor
WScript.Quit(intResult)
'''''''''''''''''''''''''
' End Of Main Block
'''''''''''''''''''''
'''''''''''''''''''''''''''
' DisplayHelpMessage
'''''''''''''''''''''''''''
Sub DisplayHelpMessage()
WScript.Echo L_Help_HELP_General01_Text
WScript.Echo L_Empty_Text
WScript.Echo L_Help_HELP_General02_Text
WScript.Echo L_Empty_Text
WScript.Echo L_Help_HELP_General04_Text
WScript.Echo L_Help_HELP_General05_Text
WScript.Echo L_Help_HELP_General06_Text
WScript.Echo L_Help_HELP_General07_Text
WScript.Echo L_Help_HELP_General08_Text
WScript.Echo L_Help_HELP_General09_Text
WScript.Echo L_Help_HELP_General10_Text
WScript.Echo L_Help_HELP_General11_Text
WScript.Echo L_Help_HELP_General12_Text
WScript.Echo L_Help_HELP_General13_Text
WScript.Echo L_Empty_Text
WScript.Echo L_Help_HELP_General14_Text
WScript.Echo L_Help_HELP_General15_Text
End Sub
Function GetAppPoolId(strArg)
Dim Submatches
Dim strPoolId
Dim re
Dim Matches
On Error Resume Next
Set re = New RegExp
re.Pattern = "-ap ""(.+)"""
re.IgnoreCase = True
Set Matches = re.Execute(strArg)
Set SubMatches = Matches(0).Submatches
strPoolId = Submatches(0)
GetAppPoolId = strPoolId
End Function
Function GetByPool(strPoolName)
Dim W3WPList
Dim strQuery
Dim W3WP
On Error Resume Next
strQuery = queryString
Set W3WPList = oProviderObj.ExecQuery(strQuery)
If (Err.Number <> 0) Then
WScript.Echo L_Query_ErrorMessage
oCmdLib.vbPrintf L_Gen_ErrorMessage, Array(Hex(Err.Number), Err.Description)
GetByPid = 2
Else
oCmdLib.vbPrintf L_Serving_Message, Array(strPoolName)
If (W3WPList.Count < 1) Then
WScript.Echo L_NoW3_ErrorMessage
GetByPool = 1
Else
For Each W3WP In W3WPList
If (UCase(GetAppPoolId(W3WP.CommandLine)) = UCase(strPoolName)) Then
oCmdLib.vbPrintf L_PID_Message, Array(W3WP.ProcessId)
End If
Next
GetByPool = 0
End If
End If
End Function
Function GetByPid(pid)
Dim W3WPList
Dim strQuery
Dim W3WP
On Error Resume Next
If (IsNumeric(pid)) Then
strQuery = pidQuery & pid
Set W3WPList = oProviderObj.ExecQuery(strQuery)
If (Err.Number <> 0) Then
WScript.Echo L_Query_ErrorMessage
oCmdLib.vbPrintf L_Gen_ErrorMessage, Array(Hex(Err.Number), Err.Description)
GetByPid = 2
Else
If (W3WPList.Count < 1) Then
WScript.Echo L_NoResults_ErrorMessage
GetByPid = 2
Else
For Each W3WP In W3WPList
If (W3WP.Name = "w3wp.exe") Then
oCmdLib.vbPrintf L_APID_Message, Array(pid, GetAppPoolId(W3WP.CommandLine))
GetByPid = 0
Else
WScript.Echo(L_NotW3_ErrorMessage)
GetByPid = 2
End If
Next
End If
End If
Else
WScript.Echo(L_PIDNotValid_ErrorMessage)
GetByPid = 2
End If
End Function
Function GetAllW3WP()
Dim W3WPList
Dim strQuery
Dim W3WP
On Error Resume Next
strQuery = queryString
Set W3WPList = oProviderObj.ExecQuery(strQuery)
If (Err.Number <> 0) Then
WScript.Echo L_Query_ErrorMessage
oCmdLib.vbPrintf L_Gen_ErrorMessage, Array(Hex(Err.Number), Err.Description)
GetByPid = 2
Else
If (W3WPList.Count < 1) Then
WScript.Echo L_NoResults_ErrorMessage
GetAllW3WP = 2
Else
For Each W3WP In W3WPList
oCmdLib.vbPrintf L_APID_Message, Array(W3WP.ProcessId, GetAppPoolId(W3WP.CommandLine))
Next
GetAllW3WP = 0
End If
End If
End Function
|
When using the SCOMMS option these are the shortened representations
of the commands.
----------------
abs abs
and an.
append ap.
as as
asc asc
atan at.
auto a.
base b.
bye by.
chain ch.
chr$ chr.
clear c.
close clo.
cls cls
cont co.
cos cos
data da.
date$ date.
def def
delete d.
dim di.
dump du.
edit ed.
else el.
end e.
eof eo.
erl erl
ermsg$ erm.
err err
error er.
eval ev.
exit ex.
exp exp
fn fn
for f.
get$ ge.
gosub gos.
goto g.
if if
input i.
instr ins.
int int
left$ le.
len len
let le.
linput lin.
list l.
load lo.
log log
merge m.
mid$ mi.
mkds$ mkd.
mkis$ mk.
mksd mksd
mksi mks.
mod mod
new n.
next nex.
not not
old o.
on on
open op.
or or
output ou.
peek pe.
pi pi
poke po.
posn pos.
print p.
quit q.
random ra.
read rea.
rem re.
renumber ren.
repeat rep.
restore rest.
resume res.
return ret.
right$ ri.
rnd rn.
run r.
save sa.
seek se.
sgn sg.
shell sh.
sin sin
space$ sp.
sqrt sq.
step ste.
stop s.
str$ str.
string$ st.
tab ta.
terminal ter.
then th.
tim t.
to to
until u.
val v.
wend we.
while w.
xor xo.
|
<gh_stars>10-100
Attribute VB_Name = "HHTAdder"
Option Explicit
Private Const HHT_FULL_ELEMENT_METADATA_C As String = "HELPCENTERPACKAGE/METADATA"
Private Const HHT_ELEMENT_HHT_C As String = "HHT"
Private Const HHT_ATTR_FILE_C As String = "FILE"
Public Sub AddHHT( _
ByVal i_strFolder As String, _
ByVal i_strHHT As String _
)
Dim FSO As Scripting.FileSystemObject
Dim strFileName As String
Dim DOMDocPkgDesc As MSXML2.DOMDocument
Dim DOMNodeMetaData As MSXML2.IXMLDOMNode
Dim DOMNodeHHT As MSXML2.IXMLDOMNode
Dim Element As MSXML2.IXMLDOMElement
Dim strQuery As String
frmMain.Output "Adding HHT...", LOGGING_TYPE_NORMAL_E
Set FSO = New Scripting.FileSystemObject
If (Not FSO.FileExists(i_strHHT)) Then
Err.Raise E_FAIL, , "File " & i_strHHT & " doesn't exist."
End If
strFileName = FSO.GetFileName(i_strHHT)
If (FSO.FileExists(i_strFolder & "\" & strFileName)) Then
strFileName = FSO.GetBaseName(FSO.GetTempName) & strFileName
End If
FSO.CopyFile i_strHHT, i_strFolder & "\" & strFileName
Set DOMDocPkgDesc = GetPackageDescription(i_strFolder)
Set DOMNodeMetaData = DOMDocPkgDesc.selectSingleNode(HHT_FULL_ELEMENT_METADATA_C)
strQuery = HHT_ELEMENT_HHT_C & "[@" & HHT_ATTR_FILE_C & "=""" & strFileName & """]"
Set DOMNodeHHT = DOMNodeMetaData.selectSingleNode(strQuery)
If (Not DOMNodeHHT Is Nothing) Then
Err.Raise E_FAIL, , "File " & strFileName & " is already listed in " & PKG_DESC_FILE_C
End If
Set Element = DOMDocPkgDesc.createElement(HHT_ELEMENT_HHT_C)
XMLSetAttribute Element, HHT_ATTR_FILE_C, strFileName
DOMNodeMetaData.appendChild Element
DOMDocPkgDesc.save i_strFolder & "\" & PKG_DESC_FILE_C
End Sub
|
<gh_stars>1-10
Const Order = 4
Function InCarpet(ByVal x As Integer, ByVal y As Integer)
Do While x <> 0 And y <> 0
If x Mod 3 = 1 And y Mod 3 = 1 Then
InCarpet = " "
Exit Function
End If
x = x \ 3
y = y \ 3
Loop
InCarpet = "#"
End Function
Public Sub sierpinski_carpet()
Dim i As Integer, j As Integer
For i = 0 To 3 ^ Order - 1
For j = 0 To 3 ^ Order - 1
Debug.Print InCarpet(i, j);
Next j
Debug.Print
Next i
End Sub
|
dim a
a = array(11, 1, 2, 3, 4, 4, 6, 7, 8)
dim t
t = timer
while not inorder( a )
shuffle a
wend
wscript.echo timer-t, "seconds"
wscript.echo join( a, ", " )
|
VERSION 5.00
Begin VB.Form DocProperty
Caption = "Document Properties"
ClientHeight = 9105
ClientLeft = 4650
ClientTop = 825
ClientWidth = 9375
LinkTopic = "Form1"
ScaleHeight = 9105
ScaleWidth = 9375
Begin VB.TextBox SenderAddress
Height = 405
Left = 6480
TabIndex = 61
Top = 6720
Width = 2415
End
Begin VB.Frame Frame1
Caption = "File Name for transmission"
Height = 1455
Left = 4800
TabIndex = 57
Top = 5040
Width = 4215
Begin VB.TextBox DisplayName
Height = 375
Left = 240
TabIndex = 59
Text = "Display Name"
Top = 960
Width = 3615
End
Begin VB.TextBox FileName
Height = 375
Left = 240
TabIndex = 58
Top = 360
Width = 3615
End
End
Begin VB.TextBox CoverpageNote
Height = 405
Left = 4080
TabIndex = 54
Top = 1800
Width = 4815
End
Begin VB.TextBox CoverpageSubject
Height = 405
Left = 1200
TabIndex = 53
Top = 1800
Width = 1935
End
Begin VB.TextBox EmailAddress
Height = 495
Left = 6480
TabIndex = 48
Top = 11880
Width = 2415
End
Begin VB.TextBox SenderOfficePhone
Height = 495
Left = 6480
TabIndex = 47
Top = 11160
Width = 2415
End
Begin VB.TextBox SenderHomePhone
Height = 405
Left = 6480
TabIndex = 46
Top = 7680
Width = 2415
End
Begin VB.TextBox SenderOffice
Height = 375
Left = 6480
TabIndex = 45
Top = 7200
Width = 2415
End
Begin VB.CommandButton Cancel
Caption = "Cancel"
BeginProperty Font
Name = "Palatino Linotype"
Size = 11.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4320
TabIndex = 44
Top = 8400
Width = 4695
End
Begin VB.CommandButton OK
Caption = "OK"
BeginProperty Font
Name = "Palatino Linotype"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 120
TabIndex = 43
Top = 8400
Width = 3975
End
Begin VB.TextBox SenderTitle
Height = 495
Left = 1800
TabIndex = 37
Top = 11880
Width = 2535
End
Begin VB.TextBox SenderCompany
Height = 495
Left = 1800
TabIndex = 36
Top = 11160
Width = 2535
End
Begin VB.TextBox SenderDepartment
Height = 405
Left = 1800
TabIndex = 35
Top = 7680
Width = 2535
End
Begin VB.TextBox SenderNumber
Height = 375
Left = 1800
TabIndex = 34
Top = 7200
Width = 2535
End
Begin VB.TextBox SenderName
Height = 405
Left = 1800
TabIndex = 33
Top = 6720
Width = 2535
End
Begin VB.TextBox RecipientCountry
Height = 405
Left = 6480
TabIndex = 27
Top = 4440
Width = 2415
End
Begin VB.TextBox RecipientZip
Height = 405
Left = 6480
TabIndex = 26
Top = 3960
Width = 2415
End
Begin VB.TextBox RecipientState
Height = 405
Left = 6480
TabIndex = 25
Top = 3480
Width = 2415
End
Begin VB.TextBox RecipientCity
Height = 405
Left = 6480
TabIndex = 24
Top = 3000
Width = 2415
End
Begin VB.TextBox RecipientAddress
Height = 405
Left = 6480
TabIndex = 23
Top = 2520
Width = 2415
End
Begin VB.TextBox RecipientOffice
Height = 405
Left = 1800
TabIndex = 15
Top = 4440
Width = 2535
End
Begin VB.TextBox RecipientOfficePhone
Height = 405
Left = 1800
TabIndex = 14
Top = 5400
Width = 2535
End
Begin VB.TextBox RecipientHomePhone
Height = 405
Left = 1800
TabIndex = 13
Top = 4920
Width = 2535
End
Begin VB.TextBox RecipientTitle
Height = 405
Left = 1800
TabIndex = 12
Top = 3960
Width = 2535
End
Begin VB.TextBox RecipientCompany
Height = 405
Left = 1800
TabIndex = 11
Top = 3480
Width = 2535
End
Begin VB.TextBox RecipientDepartment
Height = 405
Left = 1800
TabIndex = 10
Top = 3000
Width = 2535
End
Begin VB.TextBox RecipientName
Height = 405
Left = 1800
TabIndex = 9
Top = 2520
Width = 2535
End
Begin VB.TextBox BillingCode
Height = 375
Left = 6720
TabIndex = 7
Top = 960
Width = 2175
End
Begin VB.OptionButton SendNow
Caption = "Send Immediately"
Height = 375
Left = 6960
TabIndex = 6
Top = 240
Width = 1695
End
Begin VB.OptionButton DiscountRate
Caption = "Discount Rate"
Height = 375
Left = 5400
TabIndex = 5
Top = 240
Width = 1455
End
Begin VB.TextBox FaxNumber
Height = 375
Left = 1800
TabIndex = 3
Top = 240
Width = 3015
End
Begin VB.Frame coverpage
Caption = "Coverpage"
Height = 975
Left = 120
TabIndex = 0
Top = 720
Width = 5055
Begin VB.TextBox CoverpageName
Height = 375
Left = 1680
TabIndex = 2
Top = 360
Width = 3015
End
Begin VB.CheckBox SendCoverpage
Caption = "Cover Page?"
Height = 375
Left = 240
TabIndex = 1
Top = 360
Width = 1335
End
End
Begin VB.Label Label26
Caption = "Email Address :"
Height = 375
Left = 5040
TabIndex = 60
Top = 12000
Width = 1215
End
Begin VB.Label Label25
Caption = "Note :"
Height = 255
Left = 3360
TabIndex = 56
Top = 1920
Width = 615
End
Begin VB.Label Label24
Caption = "Subject :"
Height = 375
Left = 240
TabIndex = 55
Top = 1920
Width = 855
End
Begin VB.Label Label23
Caption = "Sender Office Phone:"
Height = 495
Left = 5040
TabIndex = 52
Top = 11160
Width = 1215
End
Begin VB.Label Label22
Caption = "Sender Home Phone :"
Height = 375
Left = 4800
TabIndex = 51
Top = 7800
Width = 1575
End
Begin VB.Label Label21
Caption = "Sender Office :"
Height = 255
Left = 4800
TabIndex = 50
Top = 7320
Width = 1575
End
Begin VB.Label Label20
Caption = "Sender Address :"
Height = 255
Left = 4800
TabIndex = 49
Top = 6840
Width = 1695
End
Begin VB.Label Label19
Caption = "Sender Title :"
Height = 255
Left = 240
TabIndex = 42
Top = 12000
Width = 1335
End
Begin VB.Label Label18
Caption = "Sender Company :"
Height = 375
Left = 240
TabIndex = 41
Top = 11280
Width = 1455
End
Begin VB.Label Label17
Caption = "Sender Department :"
Height = 375
Left = 240
TabIndex = 40
Top = 7800
Width = 1575
End
Begin VB.Label Label16
Caption = "Sender Fax Number :"
Height = 375
Left = 240
TabIndex = 39
Top = 7320
Width = 1455
End
Begin VB.Label Label15
Caption = "Sender Name :"
Height = 255
Left = 240
TabIndex = 38
Top = 6840
Width = 1455
End
Begin VB.Line Line3
BorderWidth = 5
X1 = 120
X2 = 8880
Y1 = 2400
Y2 = 2400
End
Begin VB.Line Line2
BorderWidth = 5
X1 = 0
X2 = 9120
Y1 = 0
Y2 = 0
End
Begin VB.Line Line1
BorderWidth = 5
X1 = 360
X2 = 9000
Y1 = 6600
Y2 = 6600
End
Begin VB.Label Label14
Caption = "Recipient Country :"
Height = 255
Left = 4920
TabIndex = 32
Top = 4560
Width = 1455
End
Begin VB.Label Label13
Caption = "Recipient Zip Code :"
Height = 375
Left = 4920
TabIndex = 31
Top = 4080
Width = 1455
End
Begin VB.Label Label12
Caption = "Recipient State :"
Height = 255
Left = 4920
TabIndex = 30
Top = 3600
Width = 1215
End
Begin VB.Label Label11
Caption = "Recipient City :"
Height = 255
Left = 4920
TabIndex = 29
Top = 3120
Width = 1455
End
Begin VB.Label Label10
Caption = "Recipient Address :"
Height = 255
Left = 4920
TabIndex = 28
Top = 2640
Width = 1575
End
Begin VB.Label Label9
Caption = "Recipient Office Phone :"
Height = 495
Left = 240
TabIndex = 22
Top = 5520
Width = 1575
End
Begin VB.Label Label8
Caption = "Recipient Home Phone :"
Height = 495
Left = 240
TabIndex = 21
Top = 5040
Width = 1335
End
Begin VB.Label Label7
Caption = "Recipient Office :"
Height = 375
Left = 240
TabIndex = 20
Top = 4560
Width = 1575
End
Begin VB.Label Label6
Caption = "Recipient Title: "
Height = 255
Left = 240
TabIndex = 19
Top = 4080
Width = 1335
End
Begin VB.Label Label5
Caption = "Recipient Company:"
Height = 375
Left = 240
TabIndex = 18
Top = 3600
Width = 1455
End
Begin VB.Label Label4
Caption = "Recipient Dept:"
Height = 255
Left = 240
TabIndex = 17
Top = 3120
Width = 1215
End
Begin VB.Label Label3
Caption = "Recipient Name :"
Height = 375
Left = 240
TabIndex = 16
Top = 2640
Width = 1335
End
Begin VB.Label Label2
Caption = "Billing Code :"
Height = 255
Left = 5520
TabIndex = 8
Top = 1080
Width = 1095
End
Begin VB.Label Label1
Caption = "Fax Number"
Height = 375
Left = 360
TabIndex = 4
Top = 240
Width = 1335
End
End
Attribute VB_Name = "DocProperty"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Cancel_Click()
Unload DocProperty
End Sub
Private Sub Form_Load()
FileName.Text = FaxDocument.FileName
DisplayName.Text = FaxDocument.DisplayName
FaxNumber.Text = FaxDocument.FaxNumber
CoverpageName.Text = FaxDocument.CoverpageName
BillingCode.Text = FaxDocument.BillingCode
If (FaxDocument.DiscountSend <> False) Then
DiscountRate.Value = True
SendNow.Value = False
Else
DiscountRate.Value = False
SendNow.Value = True
End If
If (FaxDocument.SendCoverpage <> False) Then
SendCoverpage.Value = 1
Else
SendCoverpage.Value = 0
End If
EmailAddress.Text = FaxDocument.EmailAddress
RecipientName.Text = FaxDocument.RecipientName
RecipientCompany.Text = FaxDocument.RecipientCompany
RecipientAddress.Text = FaxDocument.RecipientAddress
RecipientCity.Text = FaxDocument.RecipientCity
RecipientState.Text = FaxDocument.RecipientState
RecipientCountry.Text = FaxDocument.RecipientCountry
RecipientTitle.Text = FaxDocument.RecipientTitle
RecipientZip.Text = FaxDocument.RecipientZip
RecipientDepartment.Text = FaxDocument.RecipientDepartment
RecipientOffice.Text = FaxDocument.RecipientOffice
RecipientHomePhone.Text = FaxDocument.RecipientHomePhone
RecipientOfficePhone.Text = FaxDocument.RecipientOfficePhone
SenderName.Text = FaxDocument.SenderName
SenderCompany.Text = FaxDocument.SenderCompany
SenderAddress.Text = FaxDocument.SenderAddress
SenderTitle.Text = FaxDocument.SenderTitle
SenderDepartment.Text = FaxDocument.SenderDepartment
SenderOffice.Text = FaxDocument.SenderOffice
SenderHomePhone.Text = FaxDocument.SenderHomePhone
SenderOfficePhone.Text = FaxDocument.SenderOfficePhone
SenderNumber.Text = FaxDocument.Tsid
CoverpageNote.Text = FaxDocument.CoverpageNote
CoverpageSubject.Text = FaxDocument.CoverpageSubject
End Sub
Private Sub OK_Click()
FaxDocument.FileName = FileName.Text
FaxDocument.DisplayName = DisplayName.Text
FaxDocument.SendCoverpage = SendCoverpage.Value
FaxDocument.FaxNumber = FaxNumber.Text
FaxDocument.CoverpageName = CoverpageName.Text
FaxDocument.BillingCode = BillingCode.Text
FaxDocument.DiscountSend = DiscountRate.Value
FaxDocument.EmailAddress = EmailAddress.Text
FaxDocument.RecipientName = RecipientName.Text
FaxDocument.RecipientCompany = RecipientCompany.Text
FaxDocument.RecipientAddress = RecipientAddress.Text
FaxDocument.RecipientCity = RecipientCity.Text
FaxDocument.RecipientState = RecipientState.Text
FaxDocument.RecipientCountry = RecipientCountry.Text
FaxDocument.RecipientTitle = RecipientTitle.Text
FaxDocument.RecipientZip = RecipientZip.Text
FaxDocument.RecipientDepartment = RecipientDepartment.Text
FaxDocument.RecipientOffice = RecipientOffice.Text
FaxDocument.RecipientHomePhone = RecipientHomePhone.Text
FaxDocument.RecipientOfficePhone = RecipientOfficePhone.Text
FaxDocument.SenderName = SenderName.Text
FaxDocument.SenderCompany = SenderCompany.Text
FaxDocument.SenderAddress = SenderAddress.Text
FaxDocument.SenderTitle = SenderTitle.Text
FaxDocument.SenderDepartment = SenderDepartment.Text
FaxDocument.SenderOffice = SenderOffice.Text
FaxDocument.SenderHomePhone = SenderHomePhone.Text
FaxDocument.SenderOfficePhone = SenderOfficePhone.Text
FaxDocument.Tsid = SenderNumber.Text
FaxDocument.CoverpageNote = CoverpageNote.Text
FaxDocument.CoverpageSubject = CoverpageSubject.Text
Unload DocProperty
End Sub
|
<reponame>mullikine/RosettaCodeData
' Read lines from a file
'
' (c) Copyright 1993 - 2011 <NAME>
'
' This code was ported from an application program written in Microsoft Quickbasic
'
' This code can be redistributed or modified under the terms of version 1.2 of
' the GNU Free Documentation Licence as published by the Free Software Foundation.
Sub readlinesfromafile()
var.filename = "foobar.txt"
var.filebuffersize = ini.inimaxlinelength
Call openfileread
If flg.error = "Y" Then
flg.abort = "Y"
Exit Sub
End If
If flg.exists <> "Y" Then
flg.abort = "Y"
Exit Sub
End If
readfilelabela:
Call readlinefromfile
If flg.error = "Y" Then
flg.abort = "Y"
Call closestream
flg.error = "Y"
Exit Sub
End If
If flg.endoffile <> "Y" Then
' We have a line from the file
Print message$
GoTo readfilelabela
End If
' End of file reached
' Close the file and exit
Call closestream
Exit Sub
End Sub
Sub openfileread()
flg.streamopen = "N"
Call checkfileexists
If flg.error = "Y" Then Exit Sub
If flg.exists <> "Y" Then Exit Sub
Call getfreestream
If flg.error = "Y" Then Exit Sub
var.errorsection = "Opening File"
var.errordevice = var.filename
If ini.errortrap = "Y" Then
On Local Error GoTo openfilereaderror
End If
flg.endoffile = "N"
Open var.filename For Input As #var.stream Len = var.filebuffersize
flg.streamopen = "Y"
Exit Sub
openfilereaderror:
var.errorcode = Err
Call errorhandler
resume '!!
End Sub
Public Sub checkfileexists()
var.errorsection = "Checking File Exists"
var.errordevice = var.filename
If ini.errortrap = "Y" Then
On Local Error GoTo checkfileexistserror
End If
flg.exists = "N"
If Dir$(var.filename, 0) <> "" Then
flg.exists = "Y"
End If
Exit Sub
checkfileexistserror:
var.errorcode = Err
Call errorhandler
End Sub
Public Sub getfreestream()
var.errorsection = "Opening Free Data Stream"
var.errordevice = ""
If ini.errortrap = "Y" Then
On Local Error GoTo getfreestreamerror
End If
var.stream = FreeFile
Exit Sub
getfreestreamerror:
var.errorcode = Err
Call errorhandler
resume '!!
End Sub
Sub closestream()
If ini.errortrap = "Y" Then
On Local Error GoTo closestreamerror
End If
var.errorsection = "Closing Stream"
var.errordevice = ""
flg.resumenext = "Y"
Close #var.stream
If flg.error = "Y" Then
flg.error = "N"
'!! Call unexpectederror
End If
flg.streamopen = "N"
Exit Sub
closestreamerror:
var.errorcode = Err
Call errorhandler
resume next
End Sub
Public Sub errorhandler()
tmp$ = btrim$(var.errorsection)
tmp2$ = btrim$(var.errordevice)
If tmp2$ <> "" Then
tmp$ = tmp$ + " (" + tmp2$ + ")"
End If
tmp$ = tmp$ + " : " + Str$(var.errorcode)
tmp1% = MsgBox(tmp$, 0, "Error!")
flg.error = "Y"
If flg.resumenext = "Y" Then
flg.resumenext = "N"
' Resume Next
Else
flg.error = "N"
' Resume
End If
End Sub
Public Function btrim$(arg$)
btrim$ = LTrim$(RTrim$(arg$))
End Function
|
#COMPILE EXE
#DIM ALL
FUNCTION PBMAIN () AS LONG
MSGBOX "Fuck You Github"
END FUNCTION
|
' This file contains generally useful functions for the XSP
' envrionment.
'
' We don't want this file to become a dumping ground of random
' stuff. Add functions to this file only if the function needs
' to be available everywhere that XSPTool is available.
' Consider using XSPTool's LoadScript function instead of adding
' functions to this file.
Sub VBScriptHelp()
' This is a very useful command for interactive users.
Shell.Run "http://msdn.microsoft.com/scripting/vbscript/doc/vbstoc.htm"
End Sub
' An insertion sort.
Private Sub SimpleSort(a, byval lo, byval hi)
dim swap, max, i
while hi > lo
max = lo
for i = lo + 1 to hi
if StrComp(a(i), a(max), 1) = 1 then
max = i
end if
next
swap = a(max)
a(max) = a(hi)
a(hi) = swap
hi = hi - 1
wend
End Sub
private Function NameOfValue(Value)
Select Case Value
Case 0 NameOfValue = " (Disabled)"
Case 1 NameOfValue = " (Print)"
Case 2 NameOfValue = " (Print and Break)"
End Select
End Function
Sub ListDebug()
' List current debug settings.
dim names, name, value, a(), c, i, s
dim assert, internal, external, star
star = true
assert = true
internal = true
external = true
c = 0
names = Null
On Error Resume Next
set names = Host.GetRegValueCollection("HKLM\Software\Microsoft\ASP.NET\Debug")
if IsNull(names) then
redim a(2)
else
redim a(names.Count + 2)
for each name in names
value = Shell.RegRead("HKLM\Software\Microsoft\ASP.NET\Debug\" & name)
s = name & " = " & value & NameOfValue(value)
a(c) = s
c = c + 1
Select Case name
Case "Assert" assert = false
Case "Internal" internal = false
Case "External" external = false
Case "*" star = false
End Select
next
end if
if star = true then
s = "* = 0" & NameOfValue(0)
a(c) = s
c = c + 1
end if
if assert = true then
s = "Assert = 2" & NameOfValue(2)
a(c) = s
c = c + 1
end if
if internal = true then
s = "Internal = 1" & NameOfValue(1)
a(c) = s
c = c + 1
end if
if external = true then
s = "External = 1" & NameOfValue(1)
a(c) = s
c = c + 1
end if
SimpleSort a, 0, c - 1
for i = 0 to c - 1
Host.Echo a(i)
next
End Sub
Sub ResetDebug()
On Error Resume Next
Shell.RegDelete "HKLM\Software\Microsoft\ASP.NET\Debug\"
Shell.RegWrite "HKLM\Software\Microsoft\ASP.NET\Debug\*", 0, "REG_DWORD"
Shell.RegWrite "HKLM\Software\Microsoft\ASP.NET\Debug\Assert", 2, "REG_DWORD"
Shell.RegWrite "HKLM\Software\Microsoft\ASP.NET\Debug\Internal", 1, "REG_DWORD"
Shell.RegWrite "HKLM\Software\Microsoft\ASP.NET\Debug\External", 1, "REG_DWORD"
ListDebug
End Sub
Sub DelDebug(Name)
On Error Resume Next
Shell.RegDelete "HKLM\Software\Microsoft\ASP.NET\Debug\" & Name
ListDebug
End Sub
Sub GetDebug(Name)
' Get debug value.
dim Value
Value = -1
On Error Resume Next
Value = Shell.RegRead("HKLM\Software\Microsoft\ASP.NET\Debug\" & Name)
If Value = -1 Then
Echo "Tag " & Name & " not set."
Else
Echo Name & "=" & Value & NameOfValue(Value)
End If
End Sub
Sub SetDebug(Name, Value)
' Set debug value.
If Value > 2 Then
Echo "Invalid value: " & Value & ". Value must be between 0 and 2"
Else
Shell.RegWrite "HKLM\Software\Microsoft\ASP.NET\Debug\" & Name, Value, "REG_DWORD"
End If
GetDebug(Name)
End Sub
'Shell.Run takes too long to launch IE with a file assocation, so
' get the path to the exectuable from the registry
Const TemporaryFolder = 2
const TempFilePrefix = "xsptool"
dim IExplorePathName
IExplorePathName = Shell.RegRead("HKCR\htmlfile\shell\open\command\")
Private Sub CreateTempFile(stream, filename)
Dim fso, tfolder, tname
set fso = FileSystem
Set tfolder = fso.GetSpecialFolder(TemporaryFolder)
tname = fso.GetTempName
' Create temp files with a known prefix so we can delete them
' later, and with an ".htm" suffix in case we need to run them
' via file assocation instead of directly with iexplore
tname = TempFilePrefix & fso.GetBaseName(tname) & ".htm"
filename = tfolder.Path & "\" & tname
set stream = tfolder.CreateTextFile(tname)
End Sub
Private Sub DeleteOldTempFiles
Dim fso, tfolder, tname
Set fso = FileSystem
Set tfolder = fso.GetSpecialFolder(TemporaryFolder)
tname = tfolder.Path & "\" & TempFilePrefix & "*.*"
'DeleteFile returns an error if it does not delete a file,
'and we don't want to abort the script in that case
On Error Resume Next
fso.DeleteFile tname
End Sub
' Evaluate the script and send the results to IE
Public Sub RedirectToIE(string)
dim stream, filename
DeleteOldTempFiles
CreateTempFile stream, filename
stream.Write string
stream.Close
' Some systems don't have iexplore.exe registered. In that case,
' open by file association, which may be a lot slower.
if IExplorePathName <> "" then
Shell.Run IExplorePathName & " " & filename
else
Shell.Run filename
end if
End Sub
' Send the results of a GET to IE
Public Sub IEGet(File, QueryString, Headers)
RedirectToIE EcbHost.Get(File, QueryString, Headers)
End Sub
' Send the results of a POST to IE
Public Sub IEPost(File, QueryString, Headers, Data)
RedirectToIE EcbHost.Post(File, QueryString, Headers, Data)
End Sub
Private Function ContainsCorFiles(root)
dim result
dim fileCollection, file
dim fname
result = false
set fileCollection = root.Files
for each file in fileCollection
fname = file.Name
if Right(fname, 3) = ".cs" or Right(fname, 5) = ".cool" or Right(fname, 4) = ".cls" then
result = true
exit for
end if
next
ContainsCorFiles = result
End Function
' Recursively build a path list of folders containing COR files
Private Function GetDbgPath(root, dbgpath)
dim sourcePath, sourePathRest
dim fileCollection, file
dim folderCollection, folder
dim hasCorFiles
sourcePath = ""
set fileCollection = root.Files
if ContainsCorFiles(root) then
dbgpath = dbgpath & root.Path & ";"
end if
set folderCollection = root.SubFolders
for each folder in folderCollection
GetDbgPath folder, dbgpath
next
GetDbgPath = sourcePath
End Function
' Register a path list of COR files for cordbg
Public Sub RegDbgPath(srcpath)
const CorDbgKeyName="HKCU\Software\Microsoft\COMPlus\Samples\CorDbg\CorDbgSourceFilePath"
dim folder, dir, semi, dbgpath
stop
semi = 1
dbgpath = ""
do
semi = InStr(srcpath, ";")
if semi = 0 then
dir = srcpath
else
dir = Left(srcpath, semi - 1)
srcpath = Mid(srcpath, semi + 1)
end if
if FileSystem.FolderExists(dir) = false then
Host.Echo "Path " & srcpath & " does not exist."
Host.Echo "CorDbg sources path not registered"
exit sub
else
set folder = FileSystem.GetFolder(dir)
GetDbgPath folder, dbgpath
end if
loop while semi <> 0
Shell.RegWrite CorDbgKeyName, dbgpath, "REG_SZ"
Host.Echo "Cordbg sources path is: " & Shell.RegRead(CorDbgKeyName)
End Sub
private Sub CheckThroughputInternal(class_name, file_name, expected_response)
cr = chr(13)
lf = chr(10)
crlf = cr & lf
expected_response = expected_response & lf
contents = "<%@ class=" + class_name + " %>"
'
' make sure file_name exists
'
if not FileSystem.FileExists(file_name) then
set myFile = FileSystem.CreateTextFile(file_name)
myFile.WriteLine(contents + crlf)
myFile.Close
else
set myFile = FileSystem.OpenTextFile(file_name)
l = myFile.ReadLine
if l <> contents then
echo "file " & FileSystem.GetFolder(".") & "\" & file_name & " contains: "
echo l
echo "instead of:"
echo class_name
echo " "
echo "Please, delete this file and it will be re-created correctly next time you run CheckThroughput"
Exit Sub
end if
end if
'
' verify the file_name response
'
call ecbhost.use("/", FileSystem.GetFolder("."))
response = ecbhost.get(file_name)
if response <> expected_response then
if InStr(response, "(debug)") <> 0 then
echo "WARNING: Running on a debug build."
else
echo "Unexpected response: " & response
echo "instead of: " & expected_response:
Exit Sub
end if
end if
'
' measure and report the throughput
'
echo "Please wait for 10 seconds..."
echo "Your idealized XSP throughput is " & ecbhost.throughput(file_name) & " requests/sec"
end sub
' Measure hello.xsp throughput and report result
Sub CheckThroughput
CheckThroughputInternal "System.Web.InternalSamples.HelloWorldHandler", "hello.asph", "<p>Hello World</p><p>COOL!</p>"
End sub
Sub CheckSessionThroughput
CheckThroughputInternal "System.Web.InternalSamples.HelloWorldSessionHandler", "hellosession.asph", "<p>Hello World, Session</p>"
End sub
Sub CheckSessionWriteThroughput
CheckThroughputInternal "System.Web.InternalSamples.HelloWorldSessionWriteHandler", "hellosessionwrite.asph", "<p>Hello World, Session Write</p>"
End sub
|
<gh_stars>1-10
strUserIn = InputBox("Enter Data")
Wscript.Echo strUserIn
|
<reponame>npocmaka/Windows-Server-2003<filename>sdktools/debuggers/oca/activex/cerupload/tests.frm
VERSION 5.00
Begin VB.Form Form1
Caption = "CER Upload Client Component Testing"
ClientHeight = 6675
ClientLeft = 60
ClientTop = 450
ClientWidth = 8865
LinkTopic = "Form1"
ScaleHeight = 6675
ScaleWidth = 8865
StartUpPosition = 3 'Windows Default
Begin VB.TextBox Text9
Height = 285
Left = 1800
TabIndex = 17
Text = "Text9"
Top = 6000
Width = 3735
End
Begin VB.CommandButton Command1
Caption = "GetSuccessCount"
Height = 615
Left = 480
TabIndex = 16
Top = 5880
Width = 1215
End
Begin VB.TextBox Text8
Height = 285
Left = 1800
TabIndex = 15
Text = "Text8"
Top = 5160
Width = 3735
End
Begin VB.CommandButton Retry
Caption = "Retry"
Height = 615
Left = 480
TabIndex = 14
Top = 5040
Width = 1215
End
Begin VB.TextBox Text7
Height = 285
Left = 1800
TabIndex = 13
Text = "Text7"
Top = 4440
Width = 4815
End
Begin VB.CommandButton GetComNames
Caption = "Get Computer Names"
Height = 615
Left = 480
TabIndex = 12
Top = 4320
Width = 1215
End
Begin VB.TextBox Text6
Height = 285
Left = 1800
TabIndex = 11
Text = "Text6"
Top = 3600
Width = 4815
End
Begin VB.TextBox Text5
Height = 285
Left = 1800
TabIndex = 10
Text = "Text5"
Top = 2880
Width = 2535
End
Begin VB.TextBox Text4
Height = 285
Left = 1800
TabIndex = 9
Text = "Text4"
Top = 2160
Width = 2655
End
Begin VB.TextBox Text3
Height = 285
Left = 1800
TabIndex = 8
Text = "Text3"
Top = 1440
Width = 2655
End
Begin VB.CommandButton Browse
Caption = "Browse"
Height = 495
Index = 3
Left = 480
TabIndex = 7
Top = 3480
Width = 1215
End
Begin VB.CommandButton GetFileName
Caption = "Get File Names"
Height = 495
Index = 2
Left = 480
TabIndex = 6
Top = 2760
Width = 1215
End
Begin VB.CommandButton GetFileCount
Caption = "Get File Count"
Height = 495
Index = 1
Left = 480
TabIndex = 5
Top = 2040
Width = 1215
End
Begin VB.CommandButton Upload
Caption = "Upload"
Height = 495
Index = 0
Left = 480
TabIndex = 4
Top = 1320
Width = 1215
End
Begin VB.TextBox Text2
Height = 285
Left = 1560
TabIndex = 3
Text = "Text2"
Top = 840
Width = 3015
End
Begin VB.TextBox Text1
Height = 285
Left = 1560
TabIndex = 1
Text = "E:\CerRoot\Cabs\Blue"
Top = 360
Width = 3015
End
Begin VB.Label Label2
Caption = "File Name:"
Height = 255
Left = 600
TabIndex = 2
Top = 840
Width = 855
End
Begin VB.Label Label1
Caption = "CER Share Path:"
Height = 255
Left = 240
TabIndex = 0
Top = 360
Width = 1215
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Browse_Click(Index As Integer)
Dim CER As CERUPLOADLib.CerClient
Set CER = New CERUPLOADLib.CerClient
Text6.Text = CER.Browse("test")
Set CER = Nothing
End Sub
Private Sub Command1_Click()
Dim CER As CERUPLOADLib.CerClient
Set CER = New CERUPLOADLib.CerClient
Dim temp As String
Text9.Text = CER.GetSuccessCount(Text1.Text, "12323")
Set CER = Nothing
End Sub
Private Sub GetComNames_Click()
Dim CER As CERUPLOADLib.CerClient
Set CER = New CERUPLOADLib.CerClient
Dim temp As String
Text7.Text = CER.GetAllComputerNames(Text1.Text, "12323", Text2.Text)
Set CER = Nothing
End Sub
Private Sub GetFileCount_Click(Index As Integer)
Dim CER As CERUPLOADLib.CerClient
Dim Count As Variant
Count = 100
Set CER = New CERUPLOADLib.CerClient
Text4.Text = CER.GetFileCount(Text1.Text, "12323", Count)
Set CER = Nothing
End Sub
Private Sub GetFileName_Click(Index As Integer)
Dim CER As CERUPLOADLib.CerClient
Dim Count As Variant
Count = 32
Set CER = New CERUPLOADLib.CerClient
Text5.Text = CER.GetFileNames(Text1.Text, "12323", Count)
Set CER = Nothing
End Sub
Private Sub Retry_Click()
Dim CER As CERUPLOADLib.CerClient
Set CER = New CERUPLOADLib.CerClient
Dim IncidentID As String
Dim TransID As String
Dim RedirParam As String
IncidentID = "FF"
RedirParam = "909"
TransID = "12323"
Text8.Text = CER.RetryFile1(Text1.Text, TransID, Text2.Text, IncidentID, RedirParam)
Set CER = Nothing
End Sub
Private Sub Upload_Click(Index As Integer)
Dim CER As CERUPLOADLib.CerClient
Dim IncidentID As String
Dim TransID As String
Dim RedirParam As String
Set CER = New CERUPLOADLib.CerClient
IncidentID = "12C"
RedirParam = "909"
TransID = "12323"
Dim TransType As String
TransType = "Bluescreen"
Text3.Text = CER.Upload1(Text1.Text, TransID, Text2.Text, IncidentID, RedirParam, TransType)
Set CER = Nothing
End Sub
|
<gh_stars>1-10
Private Function sum(i As String, ByVal lo As Integer, ByVal hi As Integer, term As String) As Double
Dim temp As Double
For k = lo To hi
temp = temp + Evaluate(Replace(term, i, k))
Next k
sum = temp
End Function
Sub Jensen_Device()
Debug.Print sum("i", 1, 100, "1/i")
Debug.Print sum("i", 1, 100, "i*i")
Debug.Print sum("j", 1, 100, "sin(j)")
End Sub
|
<reponame>LaudateCorpus1/RosettaCodeData<filename>Task/Sorting-algorithms-Cocktail-sort/VBScript/sorting-algorithms-cocktail-sort-1.vb
function cocktailSort( a )
dim swapped
dim i
do
swapped = false
for i = 0 to ubound( a ) - 1
if a(i) > a(i+1) then
swap a(i), a(i+1)
swapped = true
end if
next
if not swapped then exit do
swapped = false
for i = ubound( a ) - 1 to 0 step -1
if a(i) > a( i+1) then
swap a(i), a(i+1)
swapped = true
end if
next
if not swapped then exit do
loop
cocktailSort = a
end function
sub swap( byref a, byref b)
dim tmp
tmp = a
a = b
b = tmp
end sub
|
<gh_stars>1-10
For y = 1900 To 2100
For m = 1 To 12
d = DateSerial(y, m + 1, 1) - 1
If Day(d) = 31 And Weekday(d) = vbSunday Then
WScript.Echo y & ", " & MonthName(m)
i = i + 1
End If
Next
Next
WScript.Echo vbCrLf & "Total = " & i & " months"
|
<gh_stars>1-10
Function mean(arr)
size = UBound(arr) + 1
mean = 0
For i = 0 To UBound(arr)
mean = mean + arr(i)
Next
mean = mean/size
End Function
'Example
WScript.Echo mean(Array(3,1,4,1,5,9))
|
Sub Creation_String_FirstWay()
Dim myString As String
'Here, myString is created and equal ""
End Sub '==> Here the string is destructed !
|
<reponame>npocmaka/Windows-Server-2003
On Error Resume Next
Set Service = GetObject("winmgmts://./root/default")
Set aClass = Service.Get
aClass.Path_.Class = "SINGLETONTEST00"
aClass.Qualifiers_.Add "singleton", false
aClass.Qualifiers_("singleton").Value = true
aClass.Put_ ()
if Err <> 0 Then
WScript.Echo Err.Description
End if
|
Function ICE08()
On Error Resume Next
Set recInfo=Installer.CreateRecord(1)
If Err <> 0 Then
ICE08=1
Exit Function
End If
'Give description of test
recInfo.StringData(0)="ICE08" & Chr(9) & "3" & Chr(9) & "ICE08 - Checks for duplicate GUIDs in Component table"
Message &h03000000, recInfo
'Give creation data
recInfo.StringData(0)="ICE08" & Chr(9) & "3" & Chr(9) & "Created 05/21/98. Last Modified 10/08/98."
Message &h03000000, recInfo
'Is there a Component table in the database?
iStat = Database.TablePersistent("Component")
If 1 <> iStat Then
recInfo.StringData(0)="ICE08" & Chr(9) & "3" & Chr(9) & "'Component' table missing. ICE08 cannot continue its validation."
Message &h03000000, recInfo
ICE08 = 1
Exit Function
End If
'process table
Set view=Database.OpenView("SELECT `Component`,`ComponentId` FROM `Component` WHERE `ComponentId` IS NOT NULL ORDER BY `ComponentId`")
view.Execute
If Err <> 0 Then
recInfo.StringData(0)="ICE08" & Chr(9) & "0" & Chr(9) & "view.Execute API Error"
Message &h03000000, recInfo
ICE08=1
Exit Function
End If
Do
Set rec=view.Fetch
If rec Is Nothing Then Exit Do
'compare for duplicate
If lastGuid=rec.StringData(2) Then
rec.StringData(0)="ICE08" & Chr(9) & "1" & Chr(9) & "Component: [1] has a duplicate GUID: [2]" & Chr(9) & "" & Chr(9) & "Component" & Chr(9) & "ComponentId" & Chr(9) & "[1]"
Message &h03000000,rec
End If
'set for next compare
lastGuid=rec.StringData(2)
Loop
'Return iesSuccess
ICE08 = 1
Exit Function
End Function
|
<filename>Task/Create-an-HTML-table/VBScript/create-an-html-table.vb
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Open the input csv file for reading. The file is in the same folder as the script.
Set objInFile = objFSO.OpenTextFile(objFSO.GetParentFolderName(WScript.ScriptFullName) &_
"\in.csv",1)
'Create the output html file.
Set objOutHTML = objFSO.OpenTextFile(objFSO.GetParentFolderName(WScript.ScriptFullName) &_
"\out.html",2,True)
'Write the html opening tags.
objOutHTML.Write "<html><head></head><body>" & vbCrLf
'Declare table properties.
objOutHTML.Write "<table border=1 cellpadding=10 cellspacing=0>" & vbCrLf
'Write column headers.
objOutHTML.Write "<tr><th></th><th>X</th><th>Y</th><th>Z</th></tr>" & vbCrLf
'Go through each line of the input csv file and write to the html output file.
n = 1
Do Until objInFile.AtEndOfStream
line = objInFile.ReadLine
If Len(line) > 0 Then
token = Split(line,",")
objOutHTML.Write "<tr align=""right""><td>" & n & "</td>"
For i = 0 To UBound(token)
objOutHTML.Write "<td>" & token(i) & "</td>"
Next
objOutHTML.Write "</tr>" & vbCrLf
End If
n = n + 1
Loop
'Write the html closing tags.
objOutHTML.Write "</table></body></html>"
objInFile.Close
objOutHTML.Close
Set objFSO = Nothing
|
Private Function chinese_remainder(n As Variant, a As Variant) As Variant
Dim p As Long, prod As Long, tot As Long
prod = 1: tot = 0
For i = 1 To UBound(n)
prod = prod * n(i)
Next i
Dim m As Variant
For i = 1 To UBound(n)
p = prod / n(i)
m = mul_inv(p, n(i))
If WorksheetFunction.IsText(m) Then
chinese_remainder = "fail"
Exit Function
End If
tot = tot + a(i) * m * p
Next i
chinese_remainder = tot Mod prod
End Function
Public Sub re()
Debug.Print chinese_remainder([{3,5,7}], [{2,3,2}])
Debug.Print chinese_remainder([{11,12,13}], [{10,4,12}])
Debug.Print chinese_remainder([{11,22,19}], [{10,4,9}])
Debug.Print chinese_remainder([{100,23}], [{19,0}])
End Sub
|
5 lines
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
14 lines
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 32 33 34 35 36
37 38 39 40 41 42 43 44 45
46 47 48 49 50 51 52 53 54 55
56 57 58 59 60 61 62 63 64 65 66
67 68 69 70 71 72 73 74 75 76 77 78
79 80 81 82 83 84 85 86 87 88 89 90 91
92 93 94 95 96 97 98 99 100 101 102 103 104 105
|
<reponame>LaudateCorpus1/RosettaCodeData
wscript.echo ack( 1, 10 )
'~ depth = 0
wscript.echo ack( 2, 1 )
'~ depth = 0
wscript.echo ack( 4, 4 )
|
dim objSWbemLocator
dim objSWbemServices
dim objSWbemObjectSet
dim objSWbemObject
dim objSWbemObject2
dim objSWbemObject3
dim objSWbemObjectPath
dim objSWbemProperty
dim objSWbemPropertySet
dim objSWbemMethod
dim objSWbemMethodSet
dim objSWbemLastError
dim objSWbemNamedValueSet
dim objSWbemSink
dim InParameters
dim NewParameters
dim rc
dim Temp
dim CRLF
dim Keys
dim Names
dim value
dim NTEvent
const WBEM_NO_ERROR = 0
const wbemErrFailed = -2147217407
const wbemErrNotFound = -2147217406
const wbemErrAccessDenied = -2147217405
const wbemErrProviderFailure = -2147217404
const wbemErrTypeMismatch = -2147217403
const wbemErrOutOfMemory = -2147217402
const wbemErrInvalidContext = -2147217401
const wbemErrInvalidParameter = -2147217400
const wbemErrNotAvailable = -2147217399
const wbemErrCriticalError = -2147217398
const wbemErrInvalidStream = -2147217397
const wbemErrNotSupported = -2147217396
const wbemErrInvalidSuperclass = -2147217395
const wbemErrInvalidNamespace = -2147217394
const wbemErrInvalidObject = -2147217393
const wbemErrInvalidClass = -2147217392
const wbemErrProviderNotFound = -2147217391
const wbemErrInvalidProviderRegistration = -2147217390
const wbemErrProviderLoadFailure = -2147217389
const wbemErrInitializationFailure = -2147217388
const wbemErrTransportFailure = -2147217387
const wbemErrInvalidOperation = -2147217386
const wbemErrInvalidQuery = -2147217385
const wbemErrInvalidQueryType = -2147217384
const wbemErrAlreadyExists = -2147217383
const wbemErrOverrideNotAllowed = -2147217382
const wbemErrPropagatedQualifier = -2147217381
const wbemErrPropagatedProperty = -2147217380
const wbemErrUnexpected = -2147217379
const wbemErrIllegalOperation = -2147217378
const wbemErrCannotBeKey = -2147217377
const wbemErrIncompleteClass = -2147217376
const wbemErrInvalidSyntax = -2147217375
const wbemErrNondecoratedObject = -2147217374
const wbemErrReadOnly = -2147217373
const wbemErrProviderNotCapable = -2147217372
const wbemErrClassHasChildren = -2147217371
const wbemErrClassHasInstances = -2147217370
const wbemErrQueryNotImplemented = -2147217369
const wbemErrIllegalNull = -2147217368
const wbemErrInvalidQualifierType = -2147217367
const wbemErrInvalidPropertyType = -2147217366
const wbemErrValueOutOfRange = -2147217365
const wbemErrCannotBeSingleton = -2147217364
const wbemErrInvalidCimType = -2147217363
const wbemErrInvalidMethod = -2147217362
const wbemErrInvalidMethodParameters = -2147217361
const wbemErrSystemProperty = -2147217360
const wbemErrInvalidProperty = -2147217359
const wbemErrCallCancelled = -2147217358
const wbemErrShuttingDown = -2147217357
const wbemErrPropagatedMethod = -2147217356
const wbemErrUnsupportedParameter = -2147217355
const wbemErrMissingParameter = -2147217354
const wbemErrInvalidParameterId = -2147217353
const wbemErrNonConsecutiveParameterIds = -2147217352
const wbemErrParameterIdOnRetval = -2147217351
const wbemErrInvalidObjectPath = -2147217350
const wbemErrOutOfDiskSpace = -2147217349
const wbemErrRegistrationTooBroad = -2147213311
const wbemErrRegistrationTooPrecise = -2147213310
const wbemErrTimedout = -2147209215
const wbemFlagReturnImmediately = 16
const wbemFlagReturnWhenComplete = 0
const wbemFlagBidirectional = 0
const wbemFlagForwardOnly = 14
const wbemFlagNoErrorObject = 28
const wbemFlagReturnErrorObject = 0
const wbemFlagSendStatus = 128
const wbemFlagDontSendStatus = 0
const wbemCimtypeSint8 = 16
const wbemCimtypeUint8 = 17
const wbemCimtypeSint16 = 2
const wbemCimtypeUint16 = 18
const wbemCimtypeSint32 = 3
const wbemCimtypeUint32 = 19
const wbemCimtypeSint64 = 20
const wbemCimtypeUint64 = 21
const wbemCimtypeReal32 = 4
const wbemCimtypeReal64 = 5
const wbemCimtypeBoolean = 11
const wbemCimtypeString = 8
const wbemCimtypeDatetime = 101
const wbemCimtypeReference = 102
const wbemCimtypeChar16 = 103
const wbemCimtypeObject = 13
const wbemAuthenticationLevelDefault = 0
const wbemAuthenticationLevelNone = 1
const wbemAuthenticationLevelConnect = 2
const wbemAuthenticationLevelCall = 3
const wbemAuthenticationLevelPkt = 4
const wbemAuthenticationLevelPktIntegrity = 5
const wbemAuthenticationLevelPktPrivacy = 6
const wbemImpersonationLevelAnonymous = 1
const wbemImpersonationLevelIdentify = 2
const wbemImpersonationLevelImpersonate = 3
const wbemImpersonationLevelDelegate = 4
on error resume next
CRLF = Chr(13) & Chr(10)
WScript.Echo "WBEM Script Started"
'***********************************************************************
'*
'* WbemSink_OnObjectPut
'*
'***********************************************************************
sub WbemSink_OnObjectPut(pObject, pAsyncContext)
dim context
WScript.Echo "OnObjectPut CallBack Called"
end sub
'***********************************************************************
'*
'* WbemSink_OnProgress
'*
'***********************************************************************
sub WbemSink_OnProgress(liUpperBound, liCurrent, sMessage, pAsyncContext)
dim context
WScript.Echo "OnProgress CallBack Called"
end sub
'***********************************************************************
'*
'* WbemSink_OnCompleted
'*
'***********************************************************************
sub WbemSink_OnCompleted(hResult, pErrorObject, pAsyncContext)
WScript.Echo "OnCompleted CallBack Called [", hResult, "]"
end sub
'***********************************************************************
'*
'* WbemSink_OnObjectReady
'*
'***********************************************************************
sub WbemSink_OnObjectReady(pObject, pAsyncContext)
WScript.Echo "OnObjectReady CallBack Called: ", pObject.Path_.RelPath
end sub
'***********************************************************************
'*
'*
'*
'***********************************************************************
Set objSWbemLocator = nothing
Set objSWbemLocator = WScript.CreateObject("WbemScripting.SWbemLocator")
if err.number <> 0 then
ErrorString err.number, "Set objSWbemLocator = WScript.CreateObject('WbemScripting.SWbemLocator')","create a locator"
end if
'***********************************************************************
'*
'*
'*
'***********************************************************************
Set objSWbemServices = nothing
Set objSWbemServices = objSWbemLocator.ConnectServer(,"root\cimv2")
if err.number <> 0 then
ErrorString err.number, "Set objSWbemServices = objSWbemLocator.ConnectServer(,'root\cimv2')","connect to server"
end if
'***********************************************************************
'*
'*
'*
'***********************************************************************
Set objSWbemSink = WScript.CreateObject("WbemScripting.SWbemSink","WbemSink_")
if err.number <> 0 then
ErrorString err.number, "Set objSWbemSink = WScript.CreateObject('WbemScripting.SWbemSink','WbemSink_')","create a sink"
end if
'***********************************************************************
'*
'*
'*
'***********************************************************************
objSWbemServices.Security_.ImpersonationLevel = wbemImpersonationLevelImpersonate
WScript.Echo objSWbemServices.Security_.ImpersonationLevel
'***********************************************************************
'*
'*
'*
'***********************************************************************
'AssociatorsOfAsync(objAsyncNotify As Object, strObjectPath As String, [strAssocClass As String], [strResultClass As String], [strResultRole As String], [strRole As String], [bClassesOnly As Boolean = False], [bSchemaOnly As Boolean = False], [strRequiredAssocQualifier As String], [strRequiredQualifier As String], [iFlags As Long], [objNamedValueSet As Object], [objAsyncContext As Object])
objSWbemServices.AssociatorsOfAsync objSWbemSink, "Win32_service.Name=""NetDDE""", ,,,,,,,,wbemFlagSendStatus
if err.number <> 0 then
WScript.Echo err.number, "objSWbemServices.AssociatorsOfAsync 'Win32_service.Name=''NetDDE''', objSWbemSink","create a sink"
end if
WScript.Echo "WBEM Script Hanging"
WScript.Quit
|
Gosub start
Const one = 1
Common a As Integer
Dim b As Integer
DIM AS STRING str
Type test
a As Integer
b As Integer
End Type
Function f()
a = 3
End Function
start:
f()
Return
|
<filename>admin/darwin/src/msitools/scripts/wifilver.vbs
' Windows Installer utility to report or update file versions, sizes, languages
' For use with Windows Scripting Host, CScript.exe or WScript.exe
' Copyright (c) Microsoft Corporation. All rights reserved.
' Demonstrates the access to install engine and actions
'
Option Explicit
' FileSystemObject.CreateTextFile and FileSystemObject.OpenTextFile
Const OpenAsASCII = 0
Const OpenAsUnicode = -1
' FileSystemObject.CreateTextFile
Const OverwriteIfExist = -1
Const FailIfExist = 0
' FileSystemObject.OpenTextFile
Const OpenAsDefault = -2
Const CreateIfNotExist = -1
Const FailIfNotExist = 0
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Const msiOpenDatabaseModeReadOnly = 0
Const msiOpenDatabaseModeTransact = 1
Const msiViewModifyInsert = 1
Const msiViewModifyUpdate = 2
Const msiViewModifyAssign = 3
Const msiViewModifyReplace = 4
Const msiViewModifyDelete = 6
Const msiUILevelNone = 2
Const msiRunModeSourceShortNames = 9
Const msidbFileAttributesNoncompressed = &h00002000
Dim argCount:argCount = Wscript.Arguments.Count
Dim iArg:iArg = 0
If argCount > 0 Then If InStr(1, Wscript.Arguments(0), "?", vbTextCompare) > 0 Then argCount = 0
If (argCount < 1) Then
Wscript.Echo "Windows Installer utility to updata File table sizes and versions" &_
vbNewLine & " The 1st argument is the path to MSI database, at the source file root" &_
vbNewLine & " The 2nd argument can optionally specify separate source location from the MSI" &_
vbNewLine & " The following options may be specified at any point on the command line" &_
vbNewLine & " /U to update the MSI database with the file sizes, versions, and languages" &_
vbNewLine & " /H to populate the MsiFileHash table (and create if it doesn't exist)" &_
vbNewLine & " Notes:" &_
vbNewLine & " If source type set to compressed, all files will be opened at the root" &_
vbNewLine & " Using CSCRIPT.EXE without the /U option, the file info will be displayed" &_
vbNewLine & " Using the /H option requires Windows Installer version 2.0 or greater" &_
vbNewLine & " Using the /H option also requires the /U option" &_
vbNewLine &_
vbNewLine & "Copyright (C) Microsoft Corporation. All rights reserved."
Wscript.Quit 1
End If
' Get argument values, processing any option flags
Dim updateMsi : updateMsi = False
Dim populateHash : populateHash = False
Dim sequenceFile : sequenceFile = False
Dim databasePath : databasePath = NextArgument
Dim sourceFolder : sourceFolder = NextArgument
If Not IsEmpty(NextArgument) Then Fail "More than 2 arguments supplied" ' process any trailing options
If Not IsEmpty(sourceFolder) And Right(sourceFolder, 1) <> "\" Then sourceFolder = sourceFolder & "\"
Dim console : If UCase(Mid(Wscript.FullName, Len(Wscript.Path) + 2, 1)) = "C" Then console = True
' Connect to Windows Installer object
On Error Resume Next
Dim installer : Set installer = Nothing
Set installer = Wscript.CreateObject("WindowsInstaller.Installer") : CheckError
Dim errMsg
' Check Installer version to see if MsiFileHash table population is supported
Dim supportHash : supportHash = False
Dim verInstaller : verInstaller = installer.Version
If CInt(Left(verInstaller, 1)) >= 2 Then supportHash = True
If populateHash And NOT supportHash Then
errMsg = "The version of Windows Installer on the machine does not support populating the MsiFileHash table."
errMsg = errMsg & " Windows Installer version 2.0 is the mininum required version. The version on the machine is " & verInstaller & vbNewLine
Fail errMsg
End If
' Check if multiple language package, and force use of primary language
REM Set sumInfo = database.SummaryInformation(3) : CheckError
' Open database
Dim database, openMode, view, record, updateMode, sumInfo
If updateMsi Then openMode = msiOpenDatabaseModeTransact Else openMode = msiOpenDatabaseModeReadOnly
Set database = installer.OpenDatabase(databasePath, openMode) : CheckError
' Create MsiFileHash table if we will be populating it and it is not already present
Dim hashView, iTableStat, fileHash, hashUpdateRec
iTableStat = Database.TablePersistent("MsiFileHash")
If populateHash Then
If NOT updateMsi Then
errMsg = "Populating the MsiFileHash table requires that the database be open for writing. Please include the /U option"
Fail errMsg
End If
If iTableStat <> 1 Then
Set hashView = database.OpenView("CREATE TABLE `MsiFileHash` ( `File_` CHAR(72) NOT NULL, `Options` INTEGER NOT NULL, `HashPart1` LONG NOT NULL, `HashPart2` LONG NOT NULL, `HashPart3` LONG NOT NULL, `HashPart4` LONG NOT NULL PRIMARY KEY `File_` )") : CheckError
hashView.Execute : CheckError
End If
Set hashView = database.OpenView("SELECT `File_`, `Options`, `HashPart1`, `HashPart2`, `HashPart3`, `HashPart4` FROM `MsiFileHash`") : CheckError
hashView.Execute : CheckError
Set hashUpdateRec = installer.CreateRecord(6)
End If
' Create an install session and execute actions in order to perform directory resolution
installer.UILevel = msiUILevelNone
Dim session : Set session = installer.OpenPackage(database,1) : If Err <> 0 Then Fail "Database: " & databasePath & ". Invalid installer package format"
Dim shortNames : shortNames = session.Mode(msiRunModeSourceShortNames) : CheckError
If Not IsEmpty(sourceFolder) Then session.Property("OriginalDatabase") = sourceFolder : CheckError
Dim stat : stat = session.DoAction("CostInitialize") : CheckError
If stat <> 1 Then Fail "CostInitialize failed, returned " & stat
' Join File table to Component table in order to find directories
Dim orderBy : If sequenceFile Then orderBy = "Directory_" Else orderBy = "Sequence"
Set view = database.OpenView("SELECT File,FileName,Directory_,FileSize,Version,Language FROM File,Component WHERE Component_=Component ORDER BY " & orderBy) : CheckError
view.Execute : CheckError
' Create view on File table to check for companion file version syntax so that we don't overwrite them
Dim companionView
set companionView = database.OpenView("SELECT File FROM File WHERE File=?") : CheckError
' Fetch each file and request the source path, then verify the source path, and get the file info if present
Dim fileKey, fileName, folder, sourcePath, fileSize, version, language, delim, message, info
Do
Set record = view.Fetch : CheckError
If record Is Nothing Then Exit Do
fileKey = record.StringData(1)
fileName = record.StringData(2)
folder = record.StringData(3)
REM fileSize = record.IntegerData(4)
REM companion = record.StringData(5)
version = record.StringData(5)
REM language = record.StringData(6)
' Check to see if this is a companion file
Dim companionRec
Set companionRec = installer.CreateRecord(1) : CheckError
companionRec.StringData(1) = version
companionView.Close : CheckError
companionView.Execute companionRec : CheckError
Dim companionFetch
Set companionFetch = companionView.Fetch : CheckError
Dim companionFile : companionFile = True
If companionFetch Is Nothing Then
companionFile = False
End If
delim = InStr(1, fileName, "|", vbTextCompare)
If delim <> 0 Then
If shortNames Then fileName = Left(fileName, delim-1) Else fileName = Right(fileName, Len(fileName) - delim)
End If
sourcePath = session.SourcePath(folder) & fileName
If installer.FileAttributes(sourcePath) = -1 Then
message = message & vbNewLine & sourcePath
Else
fileSize = installer.FileSize(sourcePath) : CheckError
version = Empty : version = installer.FileVersion(sourcePath, False) : Err.Clear ' early MSI implementation fails if no version
language = Empty : language = installer.FileVersion(sourcePath, True) : Err.Clear ' early MSI implementation doesn't support language
If language = version Then language = Empty ' Temp check for MSI.DLL version without language support
If Err <> 0 Then version = Empty : Err.Clear
If updateMsi Then
' update File table info
record.IntegerData(4) = fileSize
If Len(version) > 0 Then record.StringData(5) = version
If Len(language) > 0 Then record.StringData(6) = language
view.Modify msiViewModifyUpdate, record : CheckError
' update MsiFileHash table info if this is an unversioned file
If populateHash And Len(version) = 0 Then
Set fileHash = installer.FileHash(sourcePath, 0) : CheckError
hashUpdateRec.StringData(1) = fileKey
hashUpdateRec.IntegerData(2) = 0
hashUpdateRec.IntegerData(3) = fileHash.IntegerData(1)
hashUpdateRec.IntegerData(4) = fileHash.IntegerData(2)
hashUpdateRec.IntegerData(5) = fileHash.IntegerData(3)
hashUpdateRec.IntegerData(6) = fileHash.IntegerData(4)
hashView.Modify msiViewModifyAssign, hashUpdateRec : CheckError
End If
ElseIf console Then
If companionFile Then
info = "* "
info = info & fileName : If Len(info) < 12 Then info = info & Space(12 - Len(info))
info = info & " skipped (version is a reference to a companion file)"
Else
info = fileName : If Len(info) < 12 Then info = info & Space(12 - Len(info))
info = info & " size=" & fileSize : If Len(info) < 26 Then info = info & Space(26 - Len(info))
If Len(version) > 0 Then info = info & " vers=" & version : If Len(info) < 45 Then info = info & Space(45 - Len(info))
If Len(language) > 0 Then info = info & " lang=" & language
End If
Wscript.Echo info
End If
End If
Loop
REM Wscript.Echo "SourceDir = " & session.Property("SourceDir")
If Not IsEmpty(message) Then Fail "Error, the following files were not available:" & message
' Update SummaryInformation
If updateMsi Then
Set sumInfo = database.SummaryInformation(3) : CheckError
sumInfo.Property(11) = Now
sumInfo.Property(13) = Now
sumInfo.Persist
End If
' Commit database in case updates performed
database.Commit : CheckError
Wscript.Quit 0
' Extract argument value from command line, processing any option flags
Function NextArgument
Dim arg
Do ' loop to pull in option flags until an argument value is found
If iArg >= argCount Then Exit Function
arg = Wscript.Arguments(iArg)
iArg = iArg + 1
If (AscW(arg) <> AscW("/")) And (AscW(arg) <> AscW("-")) Then Exit Do
Select Case UCase(Right(arg, Len(arg)-1))
Case "U" : updateMsi = True
Case "H" : populateHash = True
Case Else: Wscript.Echo "Invalid option flag:", arg : Wscript.Quit 1
End Select
Loop
NextArgument = arg
End Function
Sub CheckError
Dim message, errRec
If Err = 0 Then Exit Sub
message = Err.Source & " " & Hex(Err) & ": " & Err.Description
If Not installer Is Nothing Then
Set errRec = installer.LastErrorRecord
If Not errRec Is Nothing Then message = message & vbNewLine & errRec.FormatText
End If
Fail message
End Sub
Sub Fail(message)
Wscript.Echo message
Wscript.Quit 2
End Sub
|
On Error Resume Next
'Create a class in CIMOM to generate events
Set t_Service = GetObject("winmgmts:root/default")
Set t_Class = t_Service.Get
t_Class.Path_.Class = "EXECNQUERYTEST00"
Set Property = t_Class.Properties_.Add ("p", 19)
Property.Qualifiers_.Add "key", true
t_Class.Put_
Set t_Events = t_Service.ExecNotificationQuery _
("select * from __instancecreationevent where targetinstance isa 'EXECNQUERYTEST00'")
if Err <> 0 then
WScript.Echo Err.Number, Err.Description, Err.Source
end if
Do
WScript.Echo "Waiting for instance creation events...\n"
set t_Event = t_Events.NextEvent (1000)
if Err <> 0 then
WScript.Echo Err.Number, Err.Description, Err.Source
end if
WScript.Echo "Got an event"
exit Do
Loop
Wscript.Echo "Finished"
|
Sub ReadCSV()
Workbooks.Open Filename:="L:\a\input.csv"
Range("F1").Value = "Sum"
Range("F2:F5").Formula = "=SUM(A2:E2)"
ActiveWorkbook.SaveAs Filename:="L:\a\output.csv", FileFormat:=xlCSV
ActiveWindow.Close
End Sub
|
Public Sub create_file()
Dim FileNumber As Integer
FileNumber = FreeFile
MkDir "docs"
Open "docs\output.txt" For Output As #FreeFile
Close #FreeFile
MkDir "C:\docs"
Open "C:\docs\output.txt" For Output As #FreeFile
Close #FreeFile
End Sub
|
Option Base 1
Private Function Identity(n As Integer) As Variant
Dim I() As Variant
ReDim I(n, n)
For j = 1 To n
For k = 1 To n
I(j, k) = 0
Next k
Next j
For j = 1 To n
I(j, j) = 1
Next j
Identity = I
End Function
Function MatrixExponentiation(ByVal x As Variant, ByVal n As Integer) As Variant
If n < 0 Then
x = WorksheetFunction.MInverse(x)
n = -n
End If
If n = 0 Then
MatrixExponentiation = Identity(UBound(x))
Exit Function
End If
Dim y() As Variant
y = Identity(UBound(x))
Do While n > 1
If n Mod 2 = 0 Then
x = WorksheetFunction.MMult(x, x)
n = n / 2
Else
y = WorksheetFunction.MMult(x, y)
x = WorksheetFunction.MMult(x, x)
n = (n - 1) / 2
End If
Loop
MatrixExponentiation = WorksheetFunction.MMult(x, y)
End Function
Public Sub pp(x As Variant)
For i_ = 1 To UBound(x)
For j_ = 1 To UBound(x)
Debug.Print x(i_, j_),
Next j_
Debug.Print
Next i_
End Sub
Public Sub main()
M2 = [{3,2;2,1}]
M3 = [{1,2,0;0,3,1;1,0,0}]
pp MatrixExponentiation(M2, -1)
Debug.Print
pp MatrixExponentiation(M2, 0)
Debug.Print
pp MatrixExponentiation(M2, 10)
Debug.Print
pp MatrixExponentiation(M3, 10)
End Sub
|
<reponame>LaudateCorpus1/RosettaCodeData
Function IsInArray(stringToBeFound As Variant, arr As Variant, _
Optional start As Integer = 1, Optional reverse As Boolean = False) As Long
'Adapted from https://stackoverflow.com/questions/12414168/use-of-custom-data-types-in-vba
Dim i As Long, lo As Long, hi As Long, stp As Long
' default return value if value not found in array
IsInArray = -1
If reverse Then
lo = UBound(arr): hi = start: stp = -1
Else
lo = start: hi = UBound(arr): stp = 1
End If
For i = lo To hi Step stp 'start in stead of LBound(arr)
If StrComp(stringToBeFound, arr(i), vbTextCompare) = 0 Then
IsInArray = i
Exit For
End If
Next i
End Function
Public Sub search_a_list()
Dim haystack() As Variant, needles() As Variant
haystack = [{"Zig","Zag","Wally","Ronald","Bush","Krusty","Charlie","Bush","Bozo"}]
needles = [{"Washington","Bush"}]
For i = 1 To 2
If IsInArray(needles(i), haystack) = -1 Then
Debug.Print needles(i); " not found in haystack."
Else
Debug.Print needles(i); " is at position "; CStr(IsInArray(needles(i), haystack)); ".";
Debug.Print " And last position is ";
Debug.Print CStr(IsInArray(needles(i), haystack, 1, True)); "."
End If
Next i
End Sub
|
<filename>tools/x86/updateos.vbs
'
' Script to update OS install MSI package
' Syntax: cscript OsPack.vbs package_path platform build_number language_number
'
'
Sub Usage
Wscript.echo "Script to update OS install MSI package. Syntax:"
Wscript.echo " cscript OsPack.vbs package_path platform build_number language_number"
Wscript.echo " package_path - path to package to update. requires read/write access"
Wscript.echo " platform - must be either 'Alpha' or 'Intel'"
Wscript.echo " build_number - 4 digit build number of the current build, i.e 1877"
Wscript.echo " language_number - Language Id of the desired language, i.e. 1033 = US English, 0=Neutral"
Wscript.Quit -1
End Sub
' takes a string of the form 0x409 and converts it to an int
Function IntFromHex( szInHexString )
szHexString = szInHexString
IntFromHex = 0
multiplier = 1
While( Ucase(Right( szHexString, 1 )) <> "X" )
Ch = Ucase(Right( szHexString, 1 ))
Select Case Ch
Case "A" Ch = 10
Case "B" Ch = 11
Case "C" Ch = 12
Case "D" Ch = 13
Case "E" Ch = 14
Case "F" Ch = 15
End Select
IntFromHex = IntFromHex + multiplier * Ch
multiplier = multiplier * 16
szHexString = Left( szHexString, Len (szHexString) -1 )
Wend
Exit Function
End Function
'
' Uses uuidgen.exe to generate a GUID, then formats it to be
' a MSI acceptable string guid
'
' This makes use of a temporary file %temp%\MakeTempGUID.txt
'
Function MakeGuid()
Dim WSHShell, FileSystem, File, ret, TempFileName
Set WSHShell = CreateObject("WScript.Shell")
Set FileSystem = CreateObject("Scripting.FileSystemObject")
TempFileName = WshShell.ExpandEnvironmentStrings( "%temp%\MakeTempGUID.txt" )
if FileSystem.fileExists ( TempFileName ) Then
FileSystem.DeleteFile TempFileName
End If
ret = WSHShell.Run("uuidgen -o" & TempFileName, 2, True)
if FileSystem.fileExists ( TempFileName ) Then
Set File = FileSystem.OpenTextFile(TempFileName, 1, True)
MakeGuid = "{" & UCase(File.ReadLine) & "}"
File.Close
FileSystem.DeleteFile TempFileName
Wscript.echo " Generated GUID: " & MakeGuid
Else
MakeGuid = "{00000000-0000-0000-0000-000000000000}"
Wscript.echo " ERROR: Failed to generate GUID"
End If
Exit Function
End Function
'
' Updates the OS install MSI package using the following paramaters
' szPackage - path to package to update. requires read/write access
' szPlatform - must be either "Alpha" or "Intel"
' dwBuildNumber - 4 digit build number of the current build, i.e 1877
' dwLanguage - Language Id of the desired language, i.e. 1033 = US English, 0=Neutral
'
Function UpdateOsPackage(szPackage, szPlatform, dwBuildNumber, dwLanguage )
Dim WSHShell, Installer, Database, SummaryInfo, Record, View, SQL
Wscript.echo "Updating OS install package: " & szPackage
Wscript.echo " For: " & szPlatform
Wscript.echo " Build: " & dwBuildNumber
Wscript.echo " Lang: " & dwLanguage
UpdateOsPackage = 0
On Error Resume Next
'Create the MSI API object
Set Installer = CreateObject("WindowsInstaller.Installer")
If Err <> 0 Then
Set Installer = CreateObject("WindowsInstaller.Application")
End If
If Err <> 0 Then
Set Installer = CreateObject("Msi.ApiAutomation")
End if
If Err <> 0 Then
Wscript.echo "ERROR: Error creating Installer object"
UpdateOsPackage = -1
End if
'Create the WSH shell object
Set WSHShell = CreateObject("WScript.Shell")
If Err <> 0 Then
Wscript.echo "ERROR: Error creating WSHShell object"
UpdateOsPackage = -1
End if
'Open the package
Set Database = Installer.OpenDatabase(szPackage, 1)
If Err <> 0 Then
Wscript.echo "ERROR: Error opening database"
UpdateOsPackage = -1
End if
Wscript.echo " Database opened for update"
'Generate and set a new package code
Set SummaryInfo = Database.SummaryInformation( 3 )
If Err <> 0 Then
Wscript.echo "ERROR: Creating Summary Info Object"
UpdateOsPackage = -1
End if
SummaryInfo.Property(9) = MakeGuid()
If Err <> 0 Then
Wscript.echo "ERROR: Error setting package code"
UpdateOsPackage = -1
End if
Wscript.echo " Updated package Code"
'Update Platform and Language list
SummaryInfo.Property(7) = szPlatform & ";" & dwLanguage
If Err <> 0 Then
Wscript.echo "ERROR: Error setting platform and langusge list"
UpdateOsPackage = -1
End if
Wscript.echo " Updated Language and platform list to: " & szPlatform & ";" & dwLanguage
SummaryInfo.Persist
If Err <> 0 Then
Wscript.echo "ERROR: Error persisting summary info"
UpdateOsPackage = -1
End if
Wscript.echo " persisted summary stream"
'Generate and set a new product code
SQL = "UPDATE Property SET Property.Value = '" & MakeGuid() & "' WHERE Property.Property= 'ProductCode'"
set View = Database.OpenView( SQL )
If Err <> 0 Then
Wscript.echo "ERROR: Error opening view: " & SQL
UpdateOsPackage = -1
End if
View.Execute
If Err <> 0 Then
Wscript.echo "ERROR: Error executing view: " & SQL
UpdateOsPackage = -1
End if
Wscript.echo " ProductCode Property updated"
'set package Build
SQL = "UPDATE Property SET Property.Value = '" & dwBuildNumber & "' WHERE Property.Property= 'PackageBuild'"
Set View = Database.OpenView( SQL )
If Err <> 0 Then
Wscript.echo "ERROR: Error opening view: " & SQL
UpdateOsPackage = -1
End if
View.Execute
If Err <> 0 Then
Wscript.echo "ERROR: Error executing view: " & SQL
UpdateOsPackage = -1
End if
Wscript.echo " PackageBuild Property updated"
'Set the product language property
SQL = "UPDATE Property SET Property.Value = '" & dwLanguage & "' WHERE Property.Property= 'ProductLanguage'"
Set View = Database.OpenView( SQL )
If Err <> 0 Then
Wscript.echo "ERROR: Error opening view: " & SQL
UpdateOsPackage = -1
End if
View.Execute
If Err <> 0 Then
Wscript.echo "ERROR: Error executing view: " & SQL
UpdateOsPackage = -1
End if
Wscript.echo " Product Language Property updated"
'Set the product version property
SQL = "UPDATE Property SET Property.Value = '5.0." & dwBuildNumber & ".0' WHERE Property.Property= 'ProductVersion'"
Set View = Database.OpenView( SQL )
If Err <> 0 Then
Wscript.echo "ERROR: Error opening view: " & SQL
UpdateOsPackage = -1
End if
View.Execute
If Err <> 0 Then
Wscript.echo "ERROR: Error executing view: " & SQL
UpdateOsPackage = -1
End if
Wscript.echo " ProductVersion Property updated"
'Commit changes
Database.Commit
If Err <> 0 Then
Wscript.echo "ERROR: Error commiting changes: " & SQL
UpdateOsPackage = -1
End if
Wscript.echo " Changes commited"
End Function
' main()
Set Args = Wscript.Arguments
Set FileSystem = CreateObject("Scripting.FileSystemObject")
If Args.Count <> 4 Then
Usage
End If
szPathToPackage = Args(0)
If not FileSystem.fileExists ( szPathToPackage ) Then
Wscript.echo " invalid path: " & szPathToPackage
Usage
End If
szPlatform = Args(1)
If (UCase( szPlatform ) = "INTEL") or (UCase( szPlatform ) = "X86") or (UCase( szPlatform ) = "I386") or (UCase( szPlatform ) = "IA64") Then
szPlatform = "Intel"
ElseIf (UCase( szPlatform ) = "ALPHA") or (UCase( szPlatform ) = "AXP64") Then
szPlatform = "Alpha"
Else
Wscript.echo " invalid pltform: " & szPlatform
Usage
End If
dwBuild = Args(2)
If not isNumeric( dwBuild ) Then
Wscript.echo " invalid build number: " & dwBuild
Usage
End If
dwLang = Args(3)
If not isNumeric( dwLang ) Then
If not isNumeric( IntFromHex( dwlang ) ) Then
Wscript.echo " invalid Language: " & dwLang
Usage
Else
dwLang = IntFromHex( dwlang )
End If
End If
wscript.echo szPathToPackage, szPlatform, Int( dwBuild ), dwLang
status = UpdateOsPackage( szPathToPackage, szPlatform, Int( dwBuild ), dwLang )
Wscript.Quit status
|
Function InCarpet(i,j)
If i > 0 And j > 0 Then
Do While i > 0 And j > 0
If i Mod 3 = 1 And j Mod 3 = 1 Then
InCarpet = " "
Exit Do
Else
InCarpet = "#"
End If
i = Int(i / 3)
j = Int(j / 3)
Loop
Else
InCarpet = "#"
End If
End Function
Function Carpet(n)
k = 3^n - 1
x2 = 0
y2 = 0
For y = 0 To k
For x = 0 To k
x2 = x
y2 = y
WScript.StdOut.Write InCarpet(x2,y2)
Next
WScript.StdOut.WriteBlankLines(1)
Next
End Function
Carpet(WScript.Arguments(0))
|
Set objShell = CreateObject("WScript.Shell")
objShell.Run "%comspec% /K dir",3,True
|
on error resume next
Set t_Service = GetObject("winmgmts://./root/default")
Set t_Class = t_Service.Get("__SystemClass")
Set t_SubClass = t_Class.SpawnDerivedClass_
t_Subclass.Path_.Class = "SPAWNCLASSTEST00"
t_Subclass.Put_
if err <> 0 then
WScript.Echo Err.Number, Err.Description, Err.Source
end if
|
<reponame>npocmaka/Windows-Server-2003<filename>admin/pchealth/upload/client/uploadmanager/unittest/test3_deletejob.vbs
'Stop
Set oArguments = wscript.Arguments
Id = oArguments.Item(0)
Set obj = CreateObject( "UploadManager.MPCUpload" )
For Each job In obj
If Id = job.jobID Then
wscript.echo job.jobID
job.Delete
Exit For
End If
Next
|
<reponame>npocmaka/Windows-Server-2003<gh_stars>10-100
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 6615
ClientLeft = 60
ClientTop = 345
ClientWidth = 5550
LinkTopic = "Form1"
ScaleHeight = 6615
ScaleWidth = 5550
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command1
Caption = "Refresh"
Height = 855
Left = 360
TabIndex = 1
Top = 4200
Width = 1935
End
Begin VB.ListBox List1
Height = 3375
ItemData = "Form1.frx":0000
Left = 360
List = "Form1.frx":0002
TabIndex = 0
Top = 480
Width = 2775
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim WithEvents sink As SWbemSink
Attribute sink.VB_VarHelpID = -1
Dim services As SWbemServices
Private Sub Command1_Click()
List1.Clear
Set rc = services.InstancesOfAsync("Win32_process", sink)
End Sub
Private Sub Form_Load()
Set sink = New SWbemSink
Set services = GetObject("winmgmts:")
services.Security_.ImpersonationLevel = wbemImpersonationLevelImpersonate
End Sub
Private Sub sink_OnObjectReady(ByVal objWbemObject As WbemScripting.ISWbemObject, ByVal objWbemAsyncContext As WbemScripting.ISWbemNamedValueSet)
List1.AddItem (objWbemObject.Name & " " & objWbemObject.Handle)
End Sub
|
Public Sub WriteACommaSeparatedList()
Dim i As Integer
Dim a(1 To 10) As String
For i = 1 To 10
a(i) = CStr(i)
Next i
Debug.Print Join(a, ", ")
End Sub
|
buffer = ""
For i = 2 To 8 Step 2
buffer = buffer & i & " "
Next
WScript.Echo buffer
|
<gh_stars>10-100
'//+----------------------------------------------------------------------------
'//
'// File: copypb.frm
'//
'// Module: pbadmin.exe
'//
'// Synopsis: The dialog to copy a phonebook
'//
'// Copyright (c) 1997-1999 Microsoft Corporation
'//
'// Author: quintinb Created Header 09/02/99
'//
'//+----------------------------------------------------------------------------
VERSION 5.00
Begin VB.Form frmCopyPB
BorderStyle = 3 'Fixed Dialog
ClientHeight = 2895
ClientLeft = 3675
ClientTop = 1620
ClientWidth = 3285
Icon = "copyPB.frx":0000
KeyPreview = -1 'True
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
PaletteMode = 1 'UseZOrder
ScaleHeight = 2895
ScaleWidth = 3285
ShowInTaskbar = 0 'False
WhatsThisButton = -1 'True
WhatsThisHelp = -1 'True
Begin VB.TextBox NewPBText
Height = 315
Left = 405
MaxLength = 8
TabIndex = 1
Top = 1995
WhatsThisHelpID = 13020
Width = 2250
End
Begin VB.CommandButton cmbCancel
Cancel = -1 'True
Caption = "cancel"
Height = 375
Left = 1635
TabIndex = 3
Top = 2415
WhatsThisHelpID = 10040
Width = 1005
End
Begin VB.CommandButton cmbOK
Caption = "ok"
Default = -1 'True
Enabled = 0 'False
Height = 375
Left = 420
TabIndex = 2
Top = 2415
WhatsThisHelpID = 10030
Width = 1065
End
Begin VB.Label OriginalPBLabel
BackStyle = 0 'Transparent
BorderStyle = 1 'Fixed Single
Height = 285
Left = 390
TabIndex = 6
Top = 1440
WhatsThisHelpID = 13010
Width = 2250
End
Begin VB.Label OrigLabel
BackStyle = 0 'Transparent
Caption = "orig"
Height = 240
Left = 405
TabIndex = 5
Top = 1215
WhatsThisHelpID = 13010
Width = 2385
End
Begin VB.Label NewLabel
BackStyle = 0 'Transparent
Caption = "new"
Height = 240
Left = 420
TabIndex = 0
Top = 1755
WhatsThisHelpID = 13020
Width = 2340
End
Begin VB.Label DescLabel
BackStyle = 0 'Transparent
Caption = "enter a new ..."
Height = 930
Left = 90
TabIndex = 4
Top = 105
Width = 2955
End
End
Attribute VB_Name = "frmCopyPB"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public strPB As String
Function LoadCopyRes()
On Error GoTo LoadErr
Me.Caption = LoadResString(4070)
DescLabel.Caption = LoadResString(4068)
OrigLabel.Caption = LoadResString(4071)
NewLabel.Caption = LoadResString(4069)
cmbOK.Caption = LoadResString(1002)
cmbCancel.Caption = LoadResString(1003)
' set fonts
SetFonts Me
On Error GoTo 0
Exit Function
LoadErr:
Exit Function
End Function
Private Sub cmbCancel_Click()
Me.Hide
End Sub
Private Sub cmbOK_Click()
' mainly make sure that they've entered
' a unique pb name and then just do it.
Dim strNewPB, strOrigPB As String
Dim varRegKeys As Variant
Dim intX As Integer
Dim rsNewPB As Recordset
Dim dblFreeSpace As Double
On Error GoTo ErrTrap
Screen.MousePointer = 11
dblFreeSpace = GetDriveSpace(locPath, filelen(gsCurrentPBPath) + 10000)
If dblFreeSpace = -2 Then
Screen.MousePointer = 0
Exit Sub
End If
strNewPB = Trim(NewPBText.Text)
strOrigPB = Trim(OriginalPBLabel.Caption)
If TestNewPBName(strNewPB) = 0 Then
'ok
Me.Enabled = False
DBEngine.Idle
GsysPb.Close
Set GsysPb = Nothing
MakeFullINF strNewPB
MakeLogFile strNewPB
FileCopy locPath & strOrigPB & ".mdb", locPath & strNewPB & ".mdb"
OSWritePrivateProfileString "Phonebooks", strNewPB, strNewPB & ".mdb", locPath & gsRegAppTitle & ".ini"
OSWritePrivateProfileString vbNullString, vbNullString, vbNullString, locPath & gsRegAppTitle & ".ini"
'edit the mdb - options
frmMain.SetCurrentPB strNewPB
Set rsNewPB = GsysPb.OpenRecordset("Configuration")
DBEngine.Idle
rsNewPB.MoveLast
rsNewPB.Edit
rsNewPB!ServiceName = strNewPB
rsNewPB.Update
GsysPb.Execute "UPDATE Delta set DeltaNum = 1 where DeltaNum <> 1", dbFailOnError
GsysPb.Execute "UPDATE Delta set NewVersion = 0", dbFailOnError
GsysPb.Execute "DELETE * from PhoneBookVersions", dbFailOnError
DBEngine.Idle
rsNewPB.Close
Set rsNewPB = Nothing
strPB = strNewPB
Me.Enabled = True
Me.Hide
Else
NewPBText.SetFocus
NewPBText.SelStart = 0
NewPBText.SelLength = Len(NewPBText.Text)
End If
Screen.MousePointer = 0
Exit Sub
ErrTrap:
Screen.MousePointer = 0
Me.Enabled = True
Exit Sub
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
CheckChar KeyAscii
End Sub
Private Sub Form_Load()
strPB = ""
OriginalPBLabel.Caption = " " & gsCurrentPB
CenterForm Me, Screen
LoadCopyRes
End Sub
Private Sub NewPBText_Change()
If Trim$(NewPBText.Text) <> "" Then
cmbOK.Enabled = True
Else
cmbOK.Enabled = False
End If
End Sub
Private Sub NewPBText_KeyPress(KeyAscii As Integer)
KeyAscii = FilterPBKey(KeyAscii, NewPBText)
End Sub
|
VERSION 5.00
Begin VB.Form LogForm
BackColor = &H80000005&
Caption = "MqForeign Log"
ClientHeight = 6900
ClientLeft = 60
ClientTop = 345
ClientWidth = 8325
LinkTopic = "Form1"
ScaleHeight = 6900
ScaleWidth = 8325
StartUpPosition = 3 'Windows Default
Begin VB.TextBox LogText
BeginProperty Font
Name = "Courier New"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 5895
Left = 360
MultiLine = -1 'True
TabIndex = 0
Top = 240
Width = 7335
End
End
Attribute VB_Name = "LogForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Resize()
LogText.Move 0, 0, Width, Height
End Sub
|
<gh_stars>1-10
s = "Hello,How,Are,You,Today"
WScript.StdOut.Write Join(Split(s,","),".")
|
Sub Main()
Debug.Print F(-10)
Debug.Print F(10)
End Sub
Private Function F(N As Long) As Variant
If N < 0 Then
F = "Error. Negative argument"
ElseIf N <= 1 Then
F = N
Else
F = F(N - 1) + F(N - 2)
End If
End Function
|
<reponame>LaudateCorpus1/RosettaCodeData
Function StripCtrlCodes(s)
tmp = ""
For i = 1 To Len(s)
n = Asc(Mid(s,i,1))
If (n >= 32 And n <= 126) Or n >=128 Then
tmp = tmp & Mid(s,i,1)
End If
Next
StripCtrlCodes = tmp
End Function
Function StripCtrlCodesExtChrs(s)
tmp = ""
For i = 1 To Len(s)
n = Asc(Mid(s,i,1))
If n >= 32 And n <= 126 Then
tmp = tmp & Mid(s,i,1)
End If
Next
StripCtrlCodesExtChrs = tmp
End Function
WScript.StdOut.Write "ab�cd�ef�gh€" & " = " & StripCtrlCodes("ab�cd�ef�gh€")
WScript.StdOut.WriteLine
WScript.StdOut.Write "ab�cd�ef�ghij†klð€" & " = " & StripCtrlCodesExtChrs("ab�cd�ef�ghij†klð€")
WScript.StdOut.WriteLine
|
class accumulator
dim A
public default function acc(x)
A = A + x
acc = A
end function
public property get accum
accum = A
end property
end class
|
Private Function population_count(ByVal number As Long) As Integer
Dim result As Integer
Dim digit As Integer
Do While number > 0
If number Mod 2 = 1 Then
result = result + 1
End If
number = number \ 2
Loop
population_count = result
End Function
Function is_prime(n As Integer) As Boolean
If n < 2 Then
is_prime = False
Exit Function
End If
For i = 2 To Sqr(n)
If n Mod i = 0 Then
is_prime = False
Exit Function
End If
Next i
is_prime = True
End Function
Function pernicious(n As Long)
Dim tmp As Integer
tmp = population_count(n)
pernicious = is_prime(tmp)
End Function
Public Sub main()
Dim count As Integer
Dim n As Long: n = 1
Do While count < 25
If pernicious(n) Then
Debug.Print n;
count = count + 1
End If
n = n + 1
Loop
Debug.Print
For n = 888888877 To 888888888
If pernicious(n) Then
Debug.Print n;
End If
Next n
End Sub
|
Public Sub Catalan1(n As Integer)
'Computes the first n Catalan numbers according to the first recursion given
Dim Cat() As Long
Dim sum As Long
ReDim Cat(n)
Cat(0) = 1
For i = 0 To n - 1
sum = 0
For j = 0 To i
sum = sum + Cat(j) * Cat(i - j)
Next j
Cat(i + 1) = sum
Next i
Debug.Print
For i = 0 To n
Debug.Print i, Cat(i)
Next
End Sub
Public Sub Catalan2(n As Integer)
'Computes the first n Catalan numbers according to the second recursion given
Dim Cat() As Long
ReDim Cat(n)
Cat(0) = 1
For i = 1 To n
Cat(i) = 2 * Cat(i - 1) * (2 * i - 1) / (i + 1)
Next i
Debug.Print
For i = 0 To n
Debug.Print i, Cat(i)
Next
End Sub
|
Attribute VB_Name = "Module1"
Public Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Public Const MF_BYPOSITION = &H400&
Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Public Sub DisableCloseWindow(hwnd As Long)
Dim hSystemMenu As Long
hSystemMenu = GetSystemMenu(hwnd, 0)
Call RemoveMenu(hSystemMenu, 6, MF_BYPOSITION)
End Sub
|
10 GOTO 30
20 PRINT "bad"
30 PRINT "good"
|
<gh_stars>1-10
Private Sub Enjoy()
Debug.Print "Enjoy"
End Sub
Private Sub Rosetta()
Debug.Print "Rosetta"
End Sub
Private Sub Code()
Debug.Print "Code"
End Sub
Public Sub concurrent()
when = Now + TimeValue("00:00:01")
Application.OnTime when, "Enjoy"
Application.OnTime when, "Rosetta"
Application.OnTime when, "Code"
End Sub
|
<gh_stars>1-10
Function binomial(n,k)
binomial = factorial(n)/(factorial(n-k)*factorial(k))
End Function
Function factorial(n)
If n = 0 Then
factorial = 1
Else
For i = n To 1 Step -1
If i = n Then
factorial = n
Else
factorial = factorial * i
End If
Next
End If
End Function
'calling the function
WScript.StdOut.Write "the binomial coefficient of 5 and 3 = " & binomial(5,3)
WScript.StdOut.WriteLine
|
strNamespace = "winmgmts://./root/cimv2"
MaxDiffSpace = 200000000
'// Pick a target volume
set VolumeSet = GetObject(strNamespace).ExecQuery(_
"select * from Win32_Volume where Name='C:\\'")
for each obj in VolumeSet
set Volume = obj
exit for
next
wscript.echo "Volume Name: " & Volume.Name
set DiffVolumeSet = GetObject(strNamespace).ExecQuery(_
"select * from Win32_Volume where Name='C:\\'")
for each obj in DiffVolumeSet
set DiffVolume = obj
exit for
next
wscript.echo "DiffVolume Name: " & DiffVolume.Name
set Storage = GetObject(strNamespace & ":Win32_ShadowStorage")
Result = Storage.Create(Volume.Name, DiffVolume.Name)
strMessage = MapErrorCode("Win32_ShadowStorage", "Create", Result)
wscript.echo "Storage.Create returned: " & Result & " : " & strMessage
Function MapErrorCode(ByRef strClass, ByRef strMethod, ByRef intCode)
set objClass = GetObject("winmgmts:").Get(strClass, &h20000)
set objMethod = objClass.methods_(strMethod)
values = objMethod.qualifiers_("values")
if ubound(values) < intCode then
wscript.echo " FAILURE - no error message found for " & intCode & " : " & strClass & "." & strMethod
f.writeline ("FAILURE - no error message found for " & intCode & " : " & strClass & "." & strMethod)
MapErrorCode = ""
else
MapErrorCode = values(intCode)
end if
End Function
|
VERSION 5.00
Begin VB.Form frmFind
Caption = "Find"
ClientHeight = 8265
ClientLeft = 360
ClientTop = 540
ClientWidth = 6015
LinkTopic = "Form1"
ScaleHeight = 8265
ScaleWidth = 6015
Begin VB.ListBox lstConditions
Height = 960
Left = 120
Style = 1 'Checkbox
TabIndex = 5
Top = 2400
Width = 5775
End
Begin VB.CommandButton cmdClose
Caption = "Close"
Height = 375
Left = 4680
TabIndex = 7
Top = 3480
Width = 1215
End
Begin VB.CommandButton cmdFind
Caption = "Find"
Height = 375
Left = 3360
TabIndex = 6
Top = 3480
Width = 1215
End
Begin VB.ListBox lstEntries
Height = 4155
ItemData = "frmFind.frx":0000
Left = 120
List = "frmFind.frx":0007
TabIndex = 9
Tag = "1"
Top = 3960
Width = 5775
End
Begin VB.Frame fraString
Caption = "String"
Height = 1935
Left = 120
TabIndex = 0
Top = 120
Width = 5775
Begin VB.ListBox lstFields
Height = 960
Left = 120
Style = 1 'Checkbox
TabIndex = 3
Top = 840
Width = 5535
End
Begin VB.ComboBox cboString
Height = 315
Left = 120
TabIndex = 1
Tag = "1"
Top = 240
Width = 5535
End
Begin VB.Label lblFields
Caption = "Find in:"
Height = 255
Left = 120
TabIndex = 2
Top = 600
Width = 4095
End
End
Begin VB.Label lblConditions
Caption = "Which conditions do you want to check?"
Height = 255
Left = 120
TabIndex = 4
Top = 2160
Width = 4935
End
Begin VB.Label lblEntries
Caption = "Click on an entry:"
Height = 255
Left = 120
TabIndex = 8
Top = 3720
Width = 2775
End
End
Attribute VB_Name = "frmFind"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private p_clsSizer As Sizer
Private Sub Form_Load()
On Error GoTo LErrorHandler
cmdClose.Cancel = True
cmdFind.Default = True
lstEntries.Clear
p_InitializeFields
p_InitializeConditions
p_SetToolTips
Set p_clsSizer = New Sizer
SetFontInternal Me
LEnd:
Exit Sub
LErrorHandler:
GoTo LEnd
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set p_clsSizer = Nothing
End Sub
Private Sub Form_Activate()
On Error GoTo LErrorHandler
p_SetSizingInfo
LEnd:
Exit Sub
LErrorHandler:
GoTo LEnd
End Sub
Private Sub Form_Resize()
On Error GoTo LErrorHandler
p_clsSizer.Resize
LEnd:
Exit Sub
LErrorHandler:
GoTo LEnd
End Sub
Private Sub cmdFind_Click()
On Error GoTo LErrorHandler
Dim DOMNodeList As MSXML2.IXMLDOMNodeList
Dim DOMNode As MSXML2.IXMLDOMNode
Dim enumSearchTargets As SEARCH_TARGET_E
Dim intIndex As Long
Dim strText As String
enumSearchTargets = p_GetSearchTargets
If (enumSearchTargets = 0) Then
MsgBox "Please select some search options", vbOKOnly
Exit Sub
End If
lstEntries.Clear
strText = cboString.Text
p_AddStringIfRequired strText
Set DOMNodeList = frmMain.Find(strText, enumSearchTargets)
If (DOMNodeList.length = 0) Then
MsgBox "No matching entry found", vbOKOnly
Exit Sub
End If
For intIndex = 0 To DOMNodeList.length - 1
Set DOMNode = DOMNodeList(intIndex)
lstEntries.AddItem "[" & (intIndex + 1) & "] " & _
XMLGetAttribute(DOMNode, HHT_TITLE_C)
lstEntries.ItemData(lstEntries.NewIndex) = XMLGetAttribute(DOMNode, HHT_tid_C)
Next
LEnd:
Exit Sub
LErrorHandler:
GoTo LEnd
End Sub
Private Sub cmdClose_Click()
lstEntries.Clear
Hide
End Sub
Private Sub lstEntries_DblClick()
lstEntries_Click
End Sub
Private Sub lstEntries_Click()
frmMain.Highlight lstEntries.ItemData(lstEntries.ListIndex)
End Sub
Private Sub p_AddStringIfRequired(i_str As String)
Dim intIndex As Long
Dim str As String
str = LCase$(i_str)
For intIndex = 0 To cboString.ListCount - 1
If (str = LCase$(cboString.List(intIndex))) Then
Exit Sub
End If
Next
cboString.AddItem i_str, 0
End Sub
Private Function p_GetSearchTargets() As SEARCH_TARGET_E
Dim enumSearchTargets As SEARCH_TARGET_E
Dim intIndex As Long
For intIndex = 0 To lstFields.ListCount - 1
If (lstFields.Selected(intIndex)) Then
enumSearchTargets = enumSearchTargets Or lstFields.ItemData(intIndex)
End If
Next
For intIndex = 0 To lstConditions.ListCount - 1
If (lstConditions.Selected(intIndex)) Then
enumSearchTargets = enumSearchTargets Or lstConditions.ItemData(intIndex)
End If
Next
p_GetSearchTargets = enumSearchTargets
End Function
Private Sub p_InitializeFields()
lstFields.AddItem "Title"
lstFields.ItemData(lstFields.NewIndex) = ST_TITLE_E
lstFields.AddItem "URI"
lstFields.ItemData(lstFields.NewIndex) = ST_URI_E
lstFields.AddItem "Description"
lstFields.ItemData(lstFields.NewIndex) = ST_DESCRIPTION_E
lstFields.AddItem "Comments"
lstFields.ItemData(lstFields.NewIndex) = ST_COMMENTS_E
lstFields.AddItem "Imported File"
lstFields.ItemData(lstFields.NewIndex) = ST_BASE_FILE_E
End Sub
Private Sub p_InitializeConditions()
lstConditions.AddItem "Topics without associated keywords"
lstConditions.ItemData(lstConditions.NewIndex) = ST_TOPICS_WITHOUT_KEYWORDS_E
lstConditions.AddItem "Nodes without associated keywords"
lstConditions.ItemData(lstConditions.NewIndex) = ST_NODES_WITHOUT_KEYWORDS_E
lstConditions.AddItem "In my Authoring Group"
lstConditions.ItemData(lstConditions.NewIndex) = ST_SELF_AUTHORING_GROUP_E
lstConditions.AddItem "Windows Me broken links"
lstConditions.ItemData(lstConditions.NewIndex) = ST_BROKEN_LINK_WINME_E
lstConditions.AddItem "Windows XP Personal broken links"
lstConditions.ItemData(lstConditions.NewIndex) = ST_BROKEN_LINK_STD_E
lstConditions.AddItem "Windows XP Professional broken links"
lstConditions.ItemData(lstConditions.NewIndex) = ST_BROKEN_LINK_PRO_E
lstConditions.AddItem "Windows XP 64-bit Professional broken links"
lstConditions.ItemData(lstConditions.NewIndex) = ST_BROKEN_LINK_PRO64_E
lstConditions.AddItem "Windows XP Server broken links"
lstConditions.ItemData(lstConditions.NewIndex) = ST_BROKEN_LINK_SRV_E
lstConditions.AddItem "Windows XP Advanced Server broken links"
lstConditions.ItemData(lstConditions.NewIndex) = ST_BROKEN_LINK_ADV_E
lstConditions.AddItem "Windows XP 64-bit Advanced Server broken links"
lstConditions.ItemData(lstConditions.NewIndex) = ST_BROKEN_LINK_ADV64_E
lstConditions.AddItem "Windows XP Datacenter Server broken links"
lstConditions.ItemData(lstConditions.NewIndex) = ST_BROKEN_LINK_DAT_E
lstConditions.AddItem "Windows XP 64-bit Datacenter Server broken links"
lstConditions.ItemData(lstConditions.NewIndex) = ST_BROKEN_LINK_DAT64_E
' lstConditions.AddItem "Marked for Indexer"
' lstConditions.ItemData(lstConditions.NewIndex) = ST_MARK1_E
End Sub
Private Sub p_SetSizingInfo()
Static blnInfoSet As Boolean
' If (blnInfoSet) Then
' Exit Sub
' End If
p_clsSizer.AddControl fraString
Set p_clsSizer.ReferenceControl(DIM_WIDTH_E) = Me
p_clsSizer.AddControl cboString
Set p_clsSizer.ReferenceControl(DIM_WIDTH_E) = fraString
p_clsSizer.AddControl lstFields
Set p_clsSizer.ReferenceControl(DIM_WIDTH_E) = fraString
p_clsSizer.AddControl lstConditions
Set p_clsSizer.ReferenceControl(DIM_WIDTH_E) = Me
p_clsSizer.AddControl cmdFind
Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = Me
p_clsSizer.ReferenceDimension(DIM_LEFT_E) = DIM_WIDTH_E
p_clsSizer.AddControl cmdClose
Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = Me
p_clsSizer.ReferenceDimension(DIM_LEFT_E) = DIM_WIDTH_E
p_clsSizer.AddControl lstEntries
Set p_clsSizer.ReferenceControl(DIM_WIDTH_E) = Me
Set p_clsSizer.ReferenceControl(DIM_HEIGHT_E) = Me
' blnInfoSet = True
End Sub
Private Sub p_SetToolTips()
cboString.ToolTipText = "Type the word or words you want to search for."
lblFields.ToolTipText = "Select which fields you want to search within."
lstFields.ToolTipText = lblFields.ToolTipText
lblConditions.ToolTipText = "Select other conditions that the search must meet."
lstConditions.ToolTipText = lblConditions.ToolTipText
lblEntries.ToolTipText = "Click on an entry to display it in the taxonomy."
lstEntries.ToolTipText = lblEntries.ToolTipText
End Sub
|
<filename>base/pnp/tools/devcon2/scripts/test7.vbs<gh_stars>10-100
'
' test7.vbs
'
' query device registry
'
Dim WshShell
Dim DevCon
Dim Devs
Dim Dev
Dim Reg
Dim Str
Dim StrStr
SET WshShell = WScript.CreateObject("WScript.Shell")
SET DevCon = WScript.CreateObject("DevCon.DeviceConsole")
SET Devs = DevCon.DevicesBySetupClasses("NET")
Count = Devs.Count
Wscript.Echo "net: Count="+CStr(Count)
'on error resume next
FOR EACH Dev IN Devs
WScript.Echo Dev + ": " + Dev.Description
Reg = Dev.RegRead("SW\DriverVersion")
WScript.Echo "Driver Version = " + CStr(Reg)
SET Reg = Dev.RegRead("SW\Linkage\UpperBind")
StrStr = ""
FOR EACH Str IN Reg
StrStr = StrStr + " " + Str
NEXT
WScript.Echo "SW\Linkage\UpperBind =" + StrStr
Reg = Dev.RegRead("HW\InstanceIndex")
WScript.Echo "Instance Index = " + CStr(Reg)
Reg = Dev.RegRead("SW\DriverDesc")
WScript.Echo "Driver Description = " + CStr(Reg)
Dev.RegWrite "SW\DriverDesc2",Reg
Reg = Dev.RegRead("SW\DriverDesc2")
WScript.Echo "Driver Description (copy) = " + CStr(Reg)
Dev.RegDelete "SW\DriverDesc2"
NEXT
|
Option Explicit
Option Base 1
Function Quad(ByVal f As String, ByVal a As Double, _
ByVal b As Double, ByVal n As Long, _
ByVal u As Variant, ByVal v As Variant) As Double
Dim m As Long, h As Double, x As Double, s As Double, i As Long, j As Long
m = UBound(u)
h = (b - a) / n
s = 0#
For i = 1 To n
x = a + (i - 1) * h
For j = 1 To m
s = s + v(j) * Application.Run(f, x + h * u(j))
Next
Next
Quad = s * h
End Function
Function f1fun(x As Double) As Double
f1fun = x ^ 3
End Function
Function f2fun(x As Double) As Double
f2fun = 1 / x
End Function
Function f3fun(x As Double) As Double
f3fun = x
End Function
Sub Test()
Dim fun, f, coef, c
Dim i As Long, j As Long, s As Double
fun = Array(Array("f1fun", 0, 1, 100, 1 / 4), _
Array("f2fun", 1, 100, 1000, Log(100)), _
Array("f3fun", 0, 5000, 50000, 5000 ^ 2 / 2), _
Array("f3fun", 0, 6000, 60000, 6000 ^ 2 / 2))
coef = Array(Array("Left rect. ", Array(0, 1), Array(1, 0)), _
Array("Right rect. ", Array(0, 1), Array(0, 1)), _
Array("Midpoint ", Array(0.5), Array(1)), _
Array("Trapez. ", Array(0, 1), Array(0.5, 0.5)), _
Array("Simpson ", Array(0, 0.5, 1), Array(1 / 6, 4 / 6, 1 / 6)))
For i = 1 To UBound(fun)
f = fun(i)
Debug.Print f(1)
For j = 1 To UBound(coef)
c = coef(j)
s = Quad(f(1), f(2), f(3), f(4), c(2), c(3))
Debug.Print " " + c(1) + ": ", s, (s - f(5)) / f(5)
Next j
Next i
End Sub
|
<filename>Task/Call-a-function-in-a-shared-library/VBA/call-a-function-in-a-shared-library-1.vba<gh_stars>1-10
function ffun(x, y)
implicit none
!DEC$ ATTRIBUTES DLLEXPORT, STDCALL, REFERENCE :: ffun
double precision :: x, y, ffun
ffun = x + y * y
end function
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.