#50618 - 2000-07-22 02:38 AM
KIXTART-TOOL: create a cross reference map of your kixtart source code
|
MCA
KiX Supporter
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,The problems we have were
- how can we found typing errors.
- which variables, functions, commands and other keys I am using.
- what were the linenumbers of above names.
- which variables look like different, but internally it are the
same variable. only the first 12 characters of a variable are significant.
- which block structures are incomplete.
- how is the block structures.
- what are the specified labels.
Solution: create a cross reference map of your kixtart source code Program: Kixref.exe Located at: http://home.wanadoo.nl/scripting Help information: An example of kixtart source code:
code:
IF setconsole("hide") ENDIF ; ; NT/95 logging - Kixtart 3.62 ; ; (c) scripting@wanadoo.nl - 2000 ; ; vs 1.00 - program (easily use notepad to open unknown file) ; ; 1.00 (20000715) original version ; $prgm_version="1.00" IF (ExistKey("HKEY_CLASSES_ROOT\unknown") = 0) $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell") $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell\open") $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell\open\command") ENDIF ; $ikey="HKEY_CLASSES_ROOT\unknown\Shell\open" $ikey_ex=ENUMVALUE($ikey, 0) $default_notepad="Quickview with Notepad" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $result_data_type=ReadType($ikey, $ikey_ex) ELSE $result_data_type="REG_SZ" ENDIF IF (writevalue($ikey, $ikey_ex, $default_notepad, $result_data_type) = 0) IF (writevalue($ikey, $ikey_ex, $default_notepad, "REG_SZ") = 0) ENDIF ENDIF ; $ikey="HKEY_CLASSES_ROOT\unknown\Shell\open\command" $ikey_ex=ENUMVALUE($ikey, 0) $default_notepad_exe="notepad.exe %1" IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $result_data_type=ReadType($ikey, $ikey_ex) ELSE $result_data_type="REG_SZ" ENDIF IF (writevalue($ikey, $ikey_ex, $default_notepad_exe, $result_data_type) = 0) IF (writevalue($ikey, $ikey_ex, $default_notepad_exe, "REG_SZ") = 0) ENDIF ENDIF break on flushkb :end
Output of kixref notepad.kix notepad.txt run with default options:
code:
Kixref NOTEPAD.KIX 22-jul-2000 01:06:12 page 1 1 1 IF setconsole("hide") 2 1 ENDIF 3 ; 4 ; NT/95 logging - Kixtart 3.62 5 ; 6 ; (c) scripting@wanadoo.nl - 2000 7 ; 8 ; vs 1.00 - program (easily use notepad to open unknown file) 9 ; 10 ; 1.00 (20000715) original version 11 ; 12 $prgm_version="1.00" 13 14 1 IF (ExistKey("HKEY_CLASSES_ROOT\unknown") = 0) 15 $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell") 16 $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell\open") 17 $result=AddKey("HKEY_CLASSES_ROOT\unknown\Shell\open\command") 18 1 ENDIF 19 ; 20 $ikey="HKEY_CLASSES_ROOT\unknown\Shell\open" 21 $ikey_ex=ENUMVALUE($ikey, 0) 22 $default_notepad="Quickview with Notepad" 23 1 IF (ExistKey($ikey+"\"+$ikey_ex) = 0) 24 $result_data_type=ReadType($ikey, $ikey_ex) 25 1 ELSE 26 $result_data_type="REG_SZ" 27 1 ENDIF 28 1 IF (writevalue($ikey, $ikey_ex, $default_notepad, $result_data_type) = 0) 29 2 IF (writevalue($ikey, $ikey_ex, $default_notepad, "REG_SZ") = 0) 30 2 ENDIF 31 1 ENDIF 32 ; 33 $ikey="HKEY_CLASSES_ROOT\unknown\Shell\open\command" 34 $ikey_ex=ENUMVALUE($ikey, 0) 35 $default_notepad_exe="notepad.exe %1" 36 1 IF (ExistKey($ikey+"\"+$ikey_ex) = 0) 37 $result_data_type=ReadType($ikey, $ikey_ex) 38 1 ELSE 39 $result_data_type="REG_SZ" 40 1 ENDIF 41 1 IF (writevalue($ikey, $ikey_ex, $default_notepad_exe, $result_data_type) = 0) 42 2 IF (writevalue($ikey, $ikey_ex, $default_notepad_exe, "REG_SZ") = 0) 43 2 ENDIF 44 1 ENDIF 45 break on 46 flushkb 47 :endKixref NOTEPAD.KIX 22-jul-2000 01:06:12 page 2 ADDKEY f 15 16 17 BREAK c 45 $default_notepad v 22 28 29 $default_notepad_exe v 35 41 42 ELSE c 25 38 :end l 47 ENDIF c 2 18 27 30 31 40 43 44 ENUMVALUE f 21 34 EXISTKEY f 14 23 36 FLUSHKB c 46 IF c 1 14 23 28 29 36 41 42 $ikey v 20 21 23 24 28 29 33 34 36 37 41 42 $ikey_ex v 21 23 24 28 29 34 36 37 41 42 on 45 $prgm_version v 12 READTYPE f 24 37 $result v 15 16 17 $result_data_type v 24 26 28 37 39 41 SETCONSOLE f 1 WRITEVALUE f 28 29 41 42 Kixref NOTEPAD.KIX 22-jul-2000 01:06:12 page 3 Summary boldsymbols 0 commands 5 functions 6 labels 1 macros 0 variables 7 ? 1 20 Block Structure
do/until [0:0] if/else/endif [8:2:8] select/case/endselect [0:0:0] while/loop [0:0] Kixref NOTEPAD.KIX 22-jul-2000 01:06:12 page 4 addkey 3 break 1 $default_notepad 3 $default_notepad_exe 3 else 2 :end 1 endif 8 enumvalue 2 existkey 3 flushkb 1 if 8 $ikey 12 $ikey_ex 10 on 1 $prgm_version 1 readtype 2 $result 3 $result_data_type 6 setconsole 1 writevalue 4
Output of kixref screen output with /NoMsg:
code:
kixref (vs 1.29e) notepad.kix -> notepad.txt (pl=55 pw=150 (default)) 0.01 (sec) (47 BOLD=[20:75] SOURCE=46) (count 20 b=0 c=5 f=6 l=1 m=0 v=7 ?=1) (blocks do=[0:0] if=[8:2:8] select=[0:0:0] while=[0:0])
Output of kixref screen output with /Msg:
code:
kixref (c) 2000 - MCA lines read 47 (vs 1.29e) lines print 46 (sec) 0.01 number of pages 4 PageLength 55 (default) PageWidth 150 (default) BoldSymbol yes=[20:75] Source yes SUP numbers From: notepad.kix To: notepad.txt Date.Time 22-jul-2000 01:06:12 Sub_Title Kixref Title NOTEPAD.KIX counters 20:75 b=0 c=5 f=6 l=1 m=0 v=7 ?=1 blocks do/until=[0:0] if/else/endif=[8:2:8] select/case/endselect=[0:0:0] while/loop=[0:0]
Explanation of some output lines:
- BoldSymbol yes=[20:75]
20 = number of different bold-symbol you are using. 75 = number of bold-symbol specified.
- counters 20:75 b=0 c=5 f=6 l=1 m=0 v=7 ?=1
b=0 number of kixtart boldsymbols. c=5 number of kixtart commands. f=6 number of kixtart functions. l=1 number of kixtart labels. m=0 number of kixtart macros. v=7 number of specified variables. ?=1 number of unknown variables/keywords.
- blocks do/until=[0:0]
- blocks if/else/endif=[8:2:8]
- blocks select/case/endselect=[0:0:0]
- blocks while/loop=[0:0]
Output of kixref screen output with /Msg for benchmarking:
code:
kixref (c) 2000 - MCA lines read 8726 (vs 1.29e) lines print 8730 (sec) 1.53 number of pages 186 PageLength 55 (default) PageWidth 150 (default) BoldSymbol yes=[228:14991] Source yes SUP numbers From: kix-vb.kix To: kix-vb.txt Date.Time 22-jul-2000 02:23:26 Sub_Title Kixref Title KIX-VB.KIX counters 228:14991 b=2 c=22 f=25 l=1 m=35 v=136 ?=7 blocks do/until=[113:113] if/else/endif=[1745:371:1745] select/case/endselect=[10:66:10] while/loop=[5:5]
Same run with default options:
code:
kixref (vs 1.29e) kix-vb.kix -> kix-vb.txt (pl=55 pw=150 (default)) 1.54 (sec) (8726 BOLD=[228:14991] SOURCE=8730) (count 228 b=2 c=22 f=25 l=1 m=35 v=136 ?=7) (blocks do=[113:113] if=[1745:371:1745] select=[10:66:10] while=[5:5])
So you see there are hardly no limits and it looks like to be fast. Additional information are added at this moment. Your email address can be added to a list, so we can inform you about a new release. Use Feedback at [url]http://home.wanadoo.nl/scripting[/b] for your email address and other questions, suggestionsm ideas and requests. important remarks:
- use only filenames of 8.3 format.
- variables/keywords in string are not analyzed. use f.e. "time "+@time instead of "time @time".
Greetings.
[This message has been edited by MCA (edited 22 July 2000).]
|
Top
|
|
|
|
#50619 - 2000-07-26 04:41 PM
Re: KIXTART-TOOL: create a cross reference map of your kixtart source code
|
Shawn
Administrator
Registered: 1999-08-13
Posts: 8611
|
MCA:I like it - I like it alot ! Very cool - and that's quite the web site you got yourself(s) there. Who (What) are you ? Some kind of KiX Scripters Guild or a consulting firm or something ? Anyway - you do nice work ! Shawn. p.s. I was particulary interested in that script compression discussion going on awhile back ! The one where you can strip out all the comments and "fluff" from your script in the effort to get execution time down to the "bare" minimum ! Done anything more on that ? Shawn..
[This message has been edited by Shawn (edited 26 July 2000).]
|
Top
|
|
|
|
#50620 - 2000-07-26 05:06 PM
Re: KIXTART-TOOL: create a cross reference map of your kixtart source code
|
Anonymous
Anonymous
Unregistered
|
*Fuentez is speechless, and so gives MCA a well-deserved and respecfull silence*
|
Top
|
|
|
|
#50624 - 2000-07-29 05:39 AM
Re: KIXTART-TOOL: create a cross reference map of your kixtart source code
|
MCA
KiX Supporter
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear fellows,We are also a person from this world. We are also a person who travel around in Europe. Mine duty is to advise great companies in what changes they can make and how migration of applications is possible. Important to do this is to get fast and easily information about infra-structure, client/server configurations, security settings and all kind of other stuff which are available. An assumption a clients are PC with a Pentium III 800 MHz does not work always. The amount of time completion of collecting information on very slow systems will take can be unacceptable but is at least undesirable. For this task we develop a lot of programs which can create a SHIT (= software historical information tracking) system, which can monitorring all kind of changes within your network. The best benefits of Kixtart is reading a great amount of re- gistry keys. An amount which is enough to get all the infor- mation you want in a very short time. Also we are using kixtart for the creation of
- WIP (= workstation independent profiles) technology.
means: an user gets his applications only when he has right for it and all dependencies for files, settings and rights are correct. mostly general software must be available at the local workstation, but this software is useless with- out his specific additional icons and rights.
- WIS (= workstation independent software) technology.
means: the same as WIP technology, but there is not local software necessary.
The amount of code is big. At this moment about 40.000 lines, which can be run within 30 sec on a Pentium 200 MHz system. The data after one month can be 100 MBytes for 1000 clients and one file delivers the first complete structure. Other data can be used for more details and for the creation of a configuration database. We setup the http://home.wanadoo.nl/scripting site for publishing some programs, because the other site http://kixtart.org doesn't have the capabilities of attachments of programs and sometimes kixtart code has been deformed. A mistake must be trace at the beginning and not during the execution. kixref and kixstrip help by detection of it. A requirement when scripts are running on a lot of versions of operating systems and it is the first task, which are running for an user. Problems with it can reduce production of them. Most of the time we see code which haven't always a good structure. f.e.
- to must goto statements. everybody tries to read a
book sequential and not random.
- presentation of blockstructures aren't always consistent
f.e. - IF .... .... ELSE .... ENDIF - IF .... .... ELSE .... ENDIF - IF .... .... ELSE .... ENDIF
- statements which aren't executed may contain errors. after
putting them on a server you get problems you don't expect. f.e. it is very easily to create a deadlock situation for windows 9x systems.
- variable significant only for the first twelve characters.
To speed up a program is running them on a old client, which will show you the time-consumming parts of your code. The original code was created for mainframe and the first genera- tion of PC's. A time when graphical systems aren't a general tool. For that reason are kixref, kixstrip, compress, and codec very fast. A little list of language we are using:
- algol
- c
- cobol
- cybil
- delphi
- fortran
- pascal
A little list of job control language (at this moment people call it scripting) are:
- bat, btm
- ccl
- cli
- dcl
- kixtart
- scl
- windows scripting
A little amount of information you are asking for. Greetings. btw: by manipulation of registry you can almost any system. it is the only part which is language independent.
[This message has been edited by MCA (edited 29 July 2000).]
|
Top
|
|
|
|
#50626 - 2000-07-31 11:08 PM
Re: KIXTART-TOOL: create a cross reference map of your kixtart source code
|
kholm
Korg Regular
Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
|
Dear, Dear (MCA)Keep up the good work with XREF.exe (B.T.W. Have you visited http://ctyme.com/rbrown.htm (A lot of good stuff for interrupt programming)) Your XREF.exe is a lot faster than Transform.kix (XREF.exe: 3 sec. Transform.kix: 2 min.) Never the less i stil find more errors with Transform.kix TRANSFORM.KIX This script can be used to syntax-check, format, 'encrypt' or compress other scripts. The main purpose of the script is syntax-checking. It is not fast but if you, like I, have to maintain large scripts, sometimes when you get 'good' ideas you can mis a string-delimitor or mis-spell a variable-name when you change a script. Finding these errors can take hours, so one minute spend checking it with Transform.kix, will be well spend. Syntax-check The script will check that strings are correctly terminated, and check that loops and conditions are correctly terminated. (No missing If, EndIf, Select, EndSelect, While, Loop, Do and Until statements). Labels are checked for GoTo and GoSub statements, if a label is not used by a GoTo/GoSub statement, it is reported as a possible error. GoTo/GoSub statement are checked for a corresponding label, if the label dos not exist it is reported as an error. Variables are checked. If a variable is used only once, it is reported as a possible error. Could be a mis-spelling, otherwise it indicates that the variable is defined but not used in current script, it could also be a variable you use as output to a called or calling script, that is why it is only reported as possible error. Transform.kix requires some coding diciplin in the script you want to check.
Requirements: Reserved words: - DO
- ELSE
- ENDIF
- SELECT
- ENDSELECT
- LOOP
Must be the only word in the line. (Can be followed by a remark)Only exception: EndIf can end a line that starts with a corresponding If. Strings must end in the line where they start. Meaning, if you have " as the first stringdelimitor " must be present later in this line, the same go's for the delimitor ' Use only alphanumerics and underscore in variable-names. Best results are achieved if you have only one statement in each line, but it is not required. FORMATTING The script can be used to format scripts you have made by cut and paste from this or other sites, same indent in entire script. If indents dos not exist, this script will create them.
COMPRESSING Transform.kix can can be used to compress scripts, it can remove blank lines and comments, and remove indents (Indent = 0). When you choose Indent = 0, and KeepRemarks=N and KeepEmptyLines=N Transform.kix will enter pseudo-encryptionmode, lines can be over 500 characters long, each linefeed from original script is replaced by a random white space: Space, tab, or new line character. In pseudo-encryptionmode the transformed script will be nearly impossible to read. You can still read the script, but average users will not be able to understand the script, and it will take a lot of effort to recreate it witout the original source. The advantage of this form of 'encryption' is that it is time-costless when executing the script.
The script allways creates a new file with extention .kix, so if your original script is named Logon.kix, Transform.kix will create the transformed script Logon.kix.kix If the original script has extention .org, i.e. Logon.org, Transform.kix will create Logon.kix !!! ALWAYS keep the original script. If you choose to remove remarks and/or empty lines, it is NOT possible to regenerate them with Transform.kix !!! CLEANING Lines will allways be stripped for leading and trailing spaces and tabs.
The script Transform.kix in this post is transformed (by itself) Logfile for this transform:
T R A N S F O R M L O G Inputfile : Transform.org Outputfile: Transform.kix OPTIONS USED: Indent : 3 spaces Remarks kept Empty lines kept Transform.kix successfully created, no errors found.
Statistics: Number of Variables = 75 Number of GoSub Statements = 21 Number of GoTo Statements = 0 Number of Labels = 12
code:
; Script : Transform.kix ; Purpose: Check other scripts ; 'CHECK' (Syntakschecking: Strings, labels, variables loops and conditions are checked) ; 'CLEANUP' (Remove leading and trailing spaces and tabs) ; Options: ; 'TRANSFORM' (Same indent in entire script) ; 'COMPRESS' (Remove remarks and blank lines) ; Version 2.2 Juli 30, 2000 Erik KærholmBreak On $Err = SetConsole("Maximize") ; Constants $CRLF = Chr(13) + Chr(10) $True = -1 $False = 0 $ValidChars = "_01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" ; Chars valid in variable-names $StrSep1 = "'" $StrSep2 = '"' $LogFile = %TEMP% + "\Transform.log" ; Statistic-vars Dim $LabUsed[100] $LabUsedNum = 0 Dim $LabDefined[100] $LabDefinedNum = 0 Dim $SubCalled[100] $SubCalledNum = 0 Dim $Vars[200] Dim $VarsNumTab[200] $VarsNum = 0 ; Initialize Color W+/b $IndentNbr = 0 $LineNum = 0 $ErrorsFound = $False $PosErrorsHead = $True $Compress = $False $LongLine = "" $ErrorNum = 0 $TotErr = 0 $TotPosErr = 0 $Do = 0 ;If $Do is greater than 0 when transform completes, $Do indicates missing Until(s) ;If Until-statements are met when $Do is 0, it indicates a missing Do-Statement $If = 0 ;If $If is greater than 0 when transform completes, $If indicates missing EndIf(s) ;If EndIf-statements are met when $If is 0, it indicates a missing If-Statement $Select = 0 ;If $Select is greater than 0 when transform completes, $Select indicates missing EndSelect(s) ;If EndSelect-statements are met when $Select is 0, it indicates a missing Select-Statement $While = 0 ;If $While is greater than 0 when transform completes, $While indicates missing Loop(s) ;If Loop-statements are met when $While is 0, it indicates a missing While-Statement ; *********************** Get user input ************************** Do CLS Box (1,1,3,78,"SINGLE") AT (2,21) "T R A N S F O R M S C R I P T" AT (5,5) "Script to transform : " GetS $File $Err = Open(1,"$File") Until $Err = 0 If UCase(SubStr($File, Len($File) - 3, 4)) = ".ORG" $OutFile = SubStr($File, 1, Len($File) - 4) + ".kix" Else $OutFile = $File + ".kix" EndIf $Err = SetFileAttr($OutFile, 128) If $Err = 0 AT (7,5) "Overwrite " + $OutFile + " Y/N " Do Get $x If UCase($x) = "N" Return EndIf Until Ucase($x) = "Y" "Y" EndIf $Indent = "" AT (9,5) "Indent (T = Tabulator, 0..9 = number of spaces) : " Do Get $IndentIn $IndentIn = UCase($IndentIn) If $IndentIn = "T" $Indent = Chr(9) Else $Test = Val($IndentIn) If $Test > 0 $i = 0 While $i < $Test $Indent = $Indent + " " $i = $i + 1 Loop EndIf EndIf Until $Indent <> "" Or $IndentIn = 0 $IndentIn AT (11,5) "Keep remarks Y/N " Do Get $x $x = UCase($x) Until ($x = "Y") Or ($x = "N") $x If $x = "Y" $KeepRemarks = $True Else $KeepRemarks = $False EndIf AT (13,5) "Keep empty lines Y/N " Do Get $x $x = UCase($x) Until ($x = "Y") Or ($x = "N") $x If $x = "Y" $KeepEmptyLines = $True Else $KeepEmptyLines = $False EndIf If $IndentIn = 0 And $KeepRemarks = $False And $KeepEmptyLines = $False $Compress = $True $Seed = Val(SubStr("@Time",7,2)) $Seed=$Seed+1 Do $x = Rnd(1) $Seed = $Seed - 1 Until $Seed=0 EndIf AT (17,5) "Checking line ......" Del "$OutFile" $Err = Open(2,"$OutFile",5) ; ******************** Initiate logfile ************************* $Err = SetFileAttr($LogFile, 128) Del "$LogFile" $Err = Open(3,"$LogFile",5) $Err = WriteLine(3," T R A N S F O R M L O G" + $CRLF + $CRLF) $Err = WriteLine(3,"Inputfile : " + $File + $CRLF) $Err = WriteLine(3,"Outputfile: " + $OutFile + $CRLF + $CRLF) $Err = WriteLine(3,"OPTIONS USED:" + $CRLF) $Err = WriteLine(3," Indent : ") $IndentIn = "" + $IndentIn Select Case $IndentIn = "T" $Err = WriteLine(3,"Tabulator" + $CRLF) Case $IndentIn = "0" $Err = WriteLine(3,"NONE" + $CRLF) Case 1 $Err = WriteLine(3,$IndentIn + " spaces" + $CRLF) EndSelect If $KeepRemarks $Err = WriteLine(3," Remarks kept" + $CRLF) Else $Err = WriteLine(3," Remarks removed" + $CRLF) EndIf If $KeepEmptyLines $Err = WriteLine(3," Empty lines kept" + $CRLF) Else $Err = WriteLine(3," Empty lines removed" + $CRLF) EndIf If $Compress $Err = WriteLine(3," File: " + $OutFile + " is compressed, using long lines" + $CRLF) EndIf $Err = WriteLine(3, $CRLF) ; ************************ Main loop **************************** $Line = ReadLine(1) While @Error = 0 $LineNum = $LineNum + 1 AT(17, 26) $LineNum GoSub WriteOutLine $Line = ReadLine(1) Loop If $Compress $Err = WriteLine(2, "$LongLine") EndIf ; ****************** Complete and show log ********************** If $IndentNbr > 0 If $Do > 0 $TotErr = $TotErr + $Do $ErrorNum = $Do $ErrorType = "Until" GoSub ErrorHandler EndIf If $If > 0 $TotErr = $TotErr + $If $ErrorNum = $If $ErrorType = "EndIf" GoSub ErrorHandler EndIf If $Select > 0 $TotErr = $TotErr + $Select $ErrorNum = $Select $ErrorType = "EndSelect" GoSub ErrorHandler EndIf If $While > 0 $TotErr = $TotErr + $While $ErrorNum = $While $ErrorType = "Loop" GoSub ErrorHandler EndIf EndIf AT (19,5) "Checking labels and variables ......" GoSub CheckGoSub GoSub CheckGoTo GoSub CheckLabels GoSub CheckVars $Err = WriteLine(3,$CRLF) If $ErrorsFound $OutLine = $OutFile + " created with " If $TotErr > 0 $OutLine = $OutLine + $TotErr + " Error(s)" If $TotPosErr > 0 $OutLine = $OutLine + " and " + $TotPosErr + " possible error(s)" EndIf Else $OutLine = $OutLine + $TotPosErr + " possible error(s)" EndIf $Err = WriteLine(3,$OutLine + $CRLF) $Err = WriteLine(3,"Correct errors in " + UCase($File) + " and transform again" + $CRLF + $CRLF) Else $Err = WriteLine(3,$OutFile + " successfully created, no errors found." + $CRLF + $CRLF) EndIf $Err = WriteLine(3,"Statistics:" + $CRLF) $Err = WriteLine(3," Number of Variables = " + $VarsNum + $CRLF) $Err = WriteLine(3," Number of GoSub Statements = " + $SubCalledNum + $CRLF) $Err = WriteLine(3," Number of GoTo Statements = " + $LabUsedNum + $CRLF) $Err = WriteLine(3," Number of Labels = " + $LabDefinedNum) $Err = Close(1) $Err = Close(2) $Err = Close(3) Run "NotePad.exe $LogFile" If @Error AT(21,5) "Check logfile: " + $LogFile + " for errors" AT(23,5) "Press any key to exit" Get $x EndIf Return ; END SCRIPT ;*************** :WriteOutLine ;***************
; Remove leading spaces and tabs While (SubStr($Line,1,1) = " ") Or (SubStr($Line,1,1) = Chr(9)) $Line = SubStr($Line, 2, Len($Line) - 1) Loop ; Remove trailing spaces and tabs While (SubStr($Line,Len($Line),1) = " ") Or (SubStr($Line,Len($Line),1) = Chr(9)) $Line = SubStr($Line, 1, Len($Line) - 1) Loop ; Split code and remarks $TmpLine = $Line $PosRem = 0 GoSub GetPosRem If $PosRem = 0 $TmpLine = $Line GoSub TestStrings EndIf $FrontRem = "" If $PosRem > 0 If $PosRem > 1 $FrontRem = $Indent EndIf $Remark = SubStr($Line, $PosRem , Len($Line) - $PosRem + 1) $Code = SubStr($Line, 1, $PosRem - 1) Else $Remark = "" $Code = $Line EndIf ; Remove trailing spaces and tabs from code While (SubStr($Code,Len($Code),1) = " ") Or (SubStr($Code,Len($Code),1) = Chr(9)) $Code = SubStr($Code, 1, Len($Code) - 1) Loop ; Check if line is empty If $Code = "" And $Remark = "" $LineEmpty = $True Else $LineEmpty = $False EndIf $PendingIndent = 0 If $Code <> "" ; Code = Line stripped for remarks and leading/trailing spaces and tabs ; Check for reserved, words expected to be entire code $NotChecked = $False $Test = UCase($Code) Select Case $Test = "DO" $PendingIndent = 1 $Do = $Do + 1 Case $Test = "ELSE" $PendingIndent = 1 $IndentNbr = $IndentNbr - 1 Case $Test = "ENDIF" If $If > 0 $IndentNbr = $IndentNbr - 1 $If = $If - 1 Else $ErrorType = "If" GoSub ErrorHandler EndIf Case $Test = "SELECT" $Select = $Select + 1 $PendingIndent = 1 $CasePrev = $False Case $Test = "ENDSELECT" If $Select > 0 $IndentNbr = $IndentNbr - 2 $Select = $Select - 1 Else $ErrorType = "Select" GoSub ErrorHandler EndIf Case $Test = "LOOP" If $While > 0 $IndentNbr = $IndentNbr - 1 $While = $While - 1 Else $ErrorType = "While" GoSub ErrorHandler EndIf Case 1 $NotChecked = $True EndSelect If $NotChecked ; Check for reserved words expected to be part of code If SubStr($Test, 1, 3) = "IF " If SubStr($Test, Len($Test) - 5, 6) <> " ENDIF" $PendingIndent = 1 $If = $If + 1 EndIf Else If SubStr($Test, 1, 5) = "CASE " $PendingIndent = 1 If $CasePrev $IndentNbr = $IndentNbr - 1 Else $CasePrev = $True EndIf Else If SubStr($Test, 1, 6) = "UNTIL " If $Do > 0 $IndentNbr = $IndentNbr - 1 $Do = $Do - 1 Else $ErrorType = "Do" GoSub ErrorHandler EndIf Else If SubStr($Test, 1, 6) = "WHILE " $PendingIndent = 1 $While = $While + 1 Else If SubStr($Test, 1, 6) = "GOSUB " $LabName = Ltrim(RTrim(SubStr($Test, 7, Len($Test) - 6))) GoSub SubInfo Else If SubStr($Test, 1, 5) = "GOTO " $LabName = Ltrim(RTrim(SubStr($Test, 6, Len($Test) - 5))) GoSub LabInfo Else If SubStr($Test, 1, 1) = ":" $LabName = SubStr($Test, 2, Len($Test) - 1) GoSub LabDefined EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf GoSub CountVars EndIf ; *********************** Create line *************************** ; ********* Compile Line from indents, code and remarks ********* If $Code <> "" $i = 0 $Front = "" While $i < $IndentNbr $Front = $Front + $Indent $i = $i + 1 Loop $Line = $Front + $Code Else $Line = "" EndIf If ($Remark <> "") And $KeepRemarks If $Line <> "" $Line = $Line + $FrontRem EndIf $Line = $Line + $Remark EndIf If $Line <> "" If $Compress If $LongLine = "" $LongLine = $Line Else $Rnd = Rnd(34) Select Case $Rnd < 20 $Del = Chr(9) Case $Rnd < 33 $Del = " " Case 1 $Del = Chr(10) EndSelect $LongLine = $LongLine + $Del + $Line EndIf If Len($LongLine) > 500 $LineShift = $True $Line = $LongLine $LongLine = "" Else $LineShift = $False EndIf Else $LineShift = $True EndIf EndIf If $LineShift If $Line <> "" $Line = $Line + $CRLF Else If $KeepEmptyLines And $LineEmpty $Line = $CRLF EndIf EndIf $Err = WriteLine(2, "$Line") EndIf $IndentNbr = $IndentNbr + $PendingIndent Return ; *END SUB* WriteOutLine ;************** :GetPosRem ;************** $TestRem = InStr($TmpLine, ";") If $TestRem > 0 $TstStr1 = InStr($TmpLine, $StrSep1) If $TstStr1 = 0 $TstStr1 = 100000 EndIf $TstStr2 = InStr($TmpLine, $StrSep2) If $TstStr2 = 0 $TstStr2 = 100000 EndIf If $TstStr1 < $TstStr2 $StrSep = $StrSep1 $StartStr = $TstStr1 Else $StrSep = $StrSep2 $StartStr = $TstStr2 EndIf If $StartStr = 100000 $StartStr = 0 EndIf If $StartStr < $TestRem And $StartStr > 0 $PosRem = $PosRem + $StartStr $TmpLine = SubStr($TmpLine, $StartStr + 1, Len($TmpLine) - $StartStr) $TestRem = InStr($TmpLine, ";") $TestEnd = InStr($TmpLine, $StrSep) If $TestEnd > 0 If $TestEnd > $TestRem $PosRem = $PosRem + $TestEnd $TmpLine = SubStr($TmpLine, $TestEnd + 1, Len($TmpLine) - $TestEnd) GoSub GetPosRem Else $PosRem = $PosRem + $TestRem EndIf Else If $ErrorsFound = $False $Err = WriteLine(3,"Error(s):" + $CRLF) EndIf $TotErr = $TotErr + 1 $ErrorsFound = $True $Err = WriteLine(3," Mismatching stringdelimitors in line " + $LineNum + $CRLF) $PosRem = 0 $TmpLine = "" EndIf Else $PosRem = $PosRem + InStr($TmpLine, ";") Endif Else $PosRem = 0 EndIf
Return ;*END SUB* GetPosRem ;************** :TestStrings ;************** $TstStr1 = InStr($TmpLine, $StrSep1) If $TstStr1 = 0 $TstStr1 = 100000 EndIf $TstStr2 = InStr($TmpLine, $StrSep2) If $TstStr2 = 0 $TstStr2 = 100000 EndIf If $TstStr1 < $TstStr2 $StrSep = $StrSep1 $StartStr = $TstStr1 Else $StrSep = $StrSep2 $StartStr = $TstStr2 EndIf If $StartStr = 100000 $StartStr = 0 EndIf If $StartStr > 0 $TmpLine = SubStr($TmpLine, $StartStr + 1, Len($TmpLine) - $StartStr) $TestEnd = InStr($TmpLine, $StrSep) If $TestEnd > 0 $TmpLine = SubStr($TmpLine, $TestEnd + 1, Len($TmpLine) - $TestEnd) GoSub TestStrings Else If $ErrorsFound = $False $Err = WriteLine(3,"Error(s):" + $CRLF) EndIf $TotErr = $TotErr + 1 $ErrorsFound = $True $Err = WriteLine(3," Mismatching stringdelimitors in line " + $LineNum + $CRLF) $TmpLine = "" EndIf EndIf
Return ; *END SUB* TestStrings ;************** :ErrorHandler ;************** If $ErrorsFound = $False $Err = WriteLine(3,"Error(s):" + $CRLF) EndIf If $ErrorNum > 0 $Err = WriteLine(3," Missing " + $ErrorNum + " " + $ErrorType + " statement(s)" + $CRLF) Else $TotErr = $TotErr + 1 $Err = WriteLine(3," Missing " + $ErrorType + " statement before line " + $LineNum + $CRLF) EndIf $ErrorsFound = $True
Return ; *END SUB* ErrorHandler ;************** :SubInfo ;************** If SubStr($LabName, 1, 1) = $StrSep1 Or SubStr($LabName, 1, 1) = $StrSep2 $LabName = SubStr($LabName, 2, Len($LabName) - 2) EndIf $SubCalledNum = $SubCalledNum + 1 $SubCalled[$SubCalledNum] = $LabName + "," + $LineNum
Return ; *END SUB* SubInfo ;************** :LabInfo ;************** If SubStr($LabName, 1, 1) = $StrSep1 Or SubStr($LabName, 1, 1) = $StrSep2 $LabName = SubStr($LabName, 2, Len($LabName) - 2) EndIf $LabUsedNum = $LabUsedNum + 1 $LabUsed[$LabUsedNum] = $LabName + "," + $LineNum
Return ; *END SUB* LabInfo ;************** :LabDefined ;************** Dim $i, $NotFound $i = 1 $NotFound = $True While $i <= $LabDefinedNum And $NotFound If $LabName = $LabDefined[$i] $NotFound = $False Else $i = $i + 1 EndIf Loop If $NotFound $LabDefinedNum = $LabDefinedNum + 1 $LabDefined[$LabDefinedNum] = $LabName Else If $ErrorsFound = $False $Err = WriteLine(3,"Error(s):" + $CRLF) EndIf $TotErr = $TotErr + 1 $Err = WriteLine(3," Label " + $LabName + " defined more than once" + $CRLF) $ErrorsFound = $True EndIf
Return ; *END SUB* LabDefined ;************** :CountVars ;************** Dim $i, $Var, $ChkLine, $Pos, $Len, $ChkChar, $NotFound, $DoubleDollar
$ChkLine = $Code While Instr($ChkLine, "$") $Pos = Instr($ChkLine, "$") $ChkLine = SubStr($ChkLine, $Pos + 1, Len($ChkLine) - $Pos) $Len = Len($ChkLine) If $Len > 0 $ChkChar = SubStr($ChkLine, 1, 1) If $ChkChar = "$" ; Use of $$ to output variable-name, NOT a variable If $Len > 1 $ChkLine = SubStr($ChkLine, 2, $Len - 1) Else $ChkLine = "" EndIf $DoubleDollar = $True Else $DoubleDollar = $False EndIf EndIf If $DoubleDollar = $False $Var = "$" While InStr($ValidChars, $ChkChar) And ($Len > 0) $Var = $Var + $ChkChar If $Len > 1 $ChkLine = SubStr($ChkLine, 2, $Len - 1) EndIf $ChkChar = SubStr($ChkLine, 1, 1) $Len = $Len - 1 Loop $i = 1 $NotFound = $True While $i <= $VarsNum And $NotFound If $Vars[$i] = $Var $NotFound = $False $VarsNumTab[$i] = $VarsNumTab[$i] + 1 Else $i = $i + 1 EndIf Loop If $NotFound And $Var <> "$" ; $Var = "$" idicates word ending with $ i.e. a hidden share $VarsNum = $VarsNum + 1 $Vars[$VarsNum] = $Var $VarsNumTab[$VarsNum] = 1 EndIf EndIf Loop Return ; *END SUB* CountVars ;************** :CheckGoTo ;************** Dim $i, $j, $Pos, $Len, $NotFound, $TestName, $LineNum, $LabU $i = 1 While $i <= $LabUsedNum $LabU = $LabUsed[$i] $Pos = InStr($LabU, ",") $TestName = SubStr($LabU, 1, $Pos - 1) $NotFound = $True $j = 1 While $j <= $LabDefinedNum And $NotFound If $TestName = $LabDefined[$j] $NotFound = $False EndIf $j = $j + 1 Loop If $NotFound If $ErrorsFound = $False $Err = WriteLine(3,"Error(s):" + $CRLF) EndIf $TotErr = $TotErr + 1 $Len = Len($LabU) $LineNum = SubStr($LabU, $Pos + 1, $Len - $Pos) $Err = WriteLine(3," Label missing for GoTo " + $TestName + " in line " + $LineNum + $CRLF) $ErrorsFound = $True EndIf $i = $i + 1 Loop
Return ; *END SUB* CheckGoTo ;************** :CheckGoSub ;************** Dim $i, $j, $Pos, $Len, $NotFound, $TestName, $LineNum, $SubC $i = 1 While $i <= $SubCalledNum $SubC = $SubCalled[$i] $Pos = InStr($SubC, ",") $TestName = SubStr($SubC, 1, $Pos - 1) $NotFound = $True $j = 1 While $j <= $LabDefinedNum And $NotFound If $TestName = $LabDefined[$j] $NotFound = $False EndIf $j = $j + 1 Loop If $NotFound If $ErrorsFound = $False $Err = WriteLine(3,"Error(s):" + $CRLF) EndIf $TotErr = $TotErr + 1 $Len = Len($SubCalled[$i]) $LineNum = SubStr($SubCalled[$i], $Pos + 1, $Len - $Pos) $Err = WriteLine(3," Subroutine (label) missing for GoSub " + $TestName + " in line " + $LineNum + $CRLF) $ErrorsFound = $True EndIf $i = $i + 1 Loop
Return ; *END SUB* CheckGoSub ;************** :CheckVars ;************** Dim $i $i = 1 While $i <= $VarsNum If $VarsNumTab[$i] = 1 If $PosErrorsHead $Err = WriteLine(3,$CRLF + "Possible Error(s):" + $CRLF) $PosErrorsHead = $False EndIf $TotPosErr = $TotPosErr + 1 $Err = WriteLine(3," Variable: " + $Vars[$i] + " only used once! (maybe defined but not used)" + $CRLF) $ErrorsFound = $True EndIf $i = $i + 1 Loop
Return ; *END SUB* CheckVars ;************** :CheckLabels ;************** Dim $i, $j, $Pos, $NotFound, $TestName, $Label $i = 1 While $i <= $LabDefinedNum $Label = $LabDefined[$i] $NotFound = $True $j = 1 While $j <= $SubCalledNum And $NotFound $TestName = $SubCalled[$j] $Pos = InStr($TestName, ",") $TestName = SubStr($TestName, 1, $Pos - 1) If $TestName = $Label $NotFound = $False EndIf $j = $j + 1 Loop If $NotFound $j = 1 While $j <= $LabUsedNum And $NotFound $TestName = $LabUsed[$j] $Pos = InStr($TestName, ",") $TestName = SubStr($TestName, 1, $Pos - 1) If $TestName = $Label $NotFound = $False EndIf $j = $j + 1 Loop EndIf If $NotFound If $PosErrorsHead $Err = WriteLine(3,$CRLF + "Possible Error(s):" + $CRLF) $PosErrorsHead = $False EndIf $TotPosErr = $TotPosErr + 1 $Err = WriteLine(3," Label: " + $Label + " defined but not used" + $CRLF) $ErrorsFound = $True EndIf $i = $i + 1 Loop
Return ; *END SUB* CheckLabels
Thank's to MCA for pointing out that Transforms.kix executes slowly, and for doing the effort of testing it. Transforms.kix is NOT meant to be part of a login-script, but to cleanup and check scripts.Originaly this started out with a small script, checking strings. By adding extra checks the script takes longer to execute, but it wil find more errors! Transforming my own main script (1400 lines) took 3 minutes, but what is 3 minutes (where you could go out to get a cup of coffee) compared to spending hours finding the new bug you just created. Indents are important to me when i read a script, so if one of my colleges has edited a script using a different editor than mine, he/she might have substituted tabs with spaces, looking OK in he's/her editor, but not in mine, i can transform it to meet my requirements using Transform.kix. When uploading a script to KiXtart bulletin board i use indent 3 spaces instead of tab, this makes it easier to read (and downlod, via cut and paste) When downloading a script KiXtart bulletin board (cut and paste). If the script was uploaded using tabs, the indents will be missing in most cases. You can recreate them with Transform.kix Examle log for a script containing errors T R A N S F O R M L O G Inputfile : TestError.org Outputfile: TestError.kix OPTIONS USED: Indent : Tabulator Remarks kept Empty lines kept Error(s): Mismatching stringdelimitors in line 57 Missing If statement before line 121 Missing 1 EndIf statement(s) Subroutine (label) missing for GoSub SubMis in line 311 Possible Error(s): Label: LabelMis defined but not used Variable: $NotUsed only used once! (maybe defined but not used) TestError.kix created with 4 Error(s) and 2 possible error(s) Correct errors in TESTERROR.ORG and transform again Statistics: Number of Variables = 61 Number of GoSub Statements = 15 Number of GoTo Statements = 3 Number of Labels = 26 I hope someone will find this script usefull (It has grown to be a hobby for me, to improve it) If you have suggestions for improvements, please answer this post (No hard feelings if you point out that i should have used a select-endselect instead of an if-endif), suggestions for checking of other syntax-errors will also be apreciated. MCA, please incorporate the checks from transform.kix in XREF.exe I have tested XREF.exe, in some situations the level of indent never increases 1 (Bug ?) Erik [This message has been edited by kholm (edited 31 July 2000).]
|
Top
|
|
|
|
#50627 - 2000-08-01 01:33 AM
Re: KIXTART-TOOL: create a cross reference map of your kixtart source code
|
MCA
KiX Supporter
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear Erik,Thanks for your reaction. Earlier we saw some developments of your transform.kix script. We know additional things can be checked, but at this moment we create a cross reference map to see of something is going wrong. We use other tools to complete the check of changes we have made. Of course a lot of things are things for the furture. Your remark about the speed is right, but normally no problem. The most important things is it does his work. Our remark will only remark: file-handling by a line-interpreter is slow. Another thing is KIXREF.EXE doesn't transform the source code. It creates a table of variables and checks some part of code. Our programs kixstrip.exe, compress.exe and codec.exe encrypt, compress and cleanup the source code. It is also available to recreate the indents parts. This program is publiced at http://kixtart.org/board/Forum2/HTML/000642.html . At the site http://home.wanadoo.nl/scripting you will find the program. Greetings. btw: please mail me the script code where the level of ident never increases 1. We suppose some unvisible characters at the begin of the line are be using.
[This message has been edited by MCA (edited 01 August 2000).]
|
Top
|
|
|
|
#50629 - 2000-08-08 01:07 AM
Re: KIXTART-TOOL: create a cross reference map of your kixtart source code
|
MCA
KiX Supporter
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,The have make some extension to the kixstrip.exe program for checking and debugging your kixtart code. See for full description of the newoptions: http://kixtart.org/board/Forum2/HTML/000642.html or program: kixstrip.exe version 1.44 site: http://home.wanadoo.nl/scripting Greetings. btw: a lot of things of kixtart user kholm has been added. Erik thanks for your reaction.
[This message has been edited by MCA (edited 08 August 2000).]
|
Top
|
|
|
|
#50630 - 2000-08-08 11:42 PM
Re: KIXTART-TOOL: create a cross reference map of your kixtart source code
|
MCA
KiX Supporter
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,An update of kixref.exe has coming. Two things are included:
- new: translate boldsymbols.
- kixtart commands will be uppercase. - kixtart functions will be a mix of upper- and lower-case. - kixtart macro's will be lowercase. - kixtart labels will be lowercase. - kixtart variables will be lowercase call of program: kixref input output /translate
- fix: minor problem by string handling.
Actual help information (short edition: kixref): code:
Kixref 3.62 (vs 1.37e) MCA - scripting@wanadoo.nl - 2000 ------------------------------------------------------------------------------ Kixref [input] [output] [options] ? show options: /Block_Check or /BC /Bold /Ref /Source /NoBlock_Check or /NoBC /NoBold /NoRef /NoSource /DATE_TIME or /DT /DATE_TIME=$date /DATE_TIME=none /DATE_TIME=[var] /Header /Number /NoHeader /NoNumber /Landscape /Portrait /PL=[number] /PW=[number] /Sub_Title or /ST /Title or /T /Translate /NoTranslate /NoMSG default: /Block_Check /Bold /NoMsg /Ref /Source
Actual help information (long edition: kixref ?): code:
Kixref 3.62 (vs 1.37e) MCA - scripting@wanadoo.nl - 2000 ------------------------------------------------------------------------------ Kixref [input] [output] [options] ? show options: /BLOCK_CHECK or /BC /BOLD <-> /NOBOLD /NOBLOCK_CHECK <-> /BLOCK_CHECK /NOBOLD <-> /BOLD /NOREF <-> /REF /NOSOURCE <-> /SOURCE /REF <-> /NOREF /SOURCE <-> /NOSOURCE /TRANSLATE <-> /NOTRANSLATE /DATE_TIME or /DT /DATE_TIME=$date /DATE_TIME=none /DATE_TIME=[var] /HEADER <-> /NOHEADER /LANDSCAPE /NOHEADER <-> /HEADER /NOMSG <-> /MSG /NONUMBER or /SUP <-> /NUMBER /NUMBER <-> /NONUMBER or /SUP /PORTRAIT /PL=[number] /PW=[number] /SUB_TITLE or /ST or /SUB_TITLE=[var] /TITLE or /T or /TITLE=[var] /MSG <-> /NOMSG /SHOW
Translation table of kixtart commands, functions + macro's: code:
functions = AddKey functions = AddPrinterConnection functions = AddProgramGroup functions = AddProgramItem macro's = address boolean = AND functions = Asc functions = At functions = BackupEventLog commands = BEEP commands = BIG functions = Box commands = BREAK commands = CALL commands = CASE commands = CD functions = Chr functions = ClearEventLog functions = Close commands = CLS commands = COLOR macro's = comment functions = CompareFileTimes commands = COOKIE1 commands = COPY macro's = curdir macro's = date macro's = day functions = DecToHex commands = DEL functions = DelKey functions = DelPrinterConnection functions = DelProgramGroup functions = DelProgramItem functions = DelTree functions = DelValue commands = DIM functions = Dir commands = DISPLAY commands = DO macro's = domain macro's = dos commands = ELSE commands = ENDIF commands = ENDSELECT functions = EnumGroup functions = EnumKey functions = EnumLocalGroup functions = EnumValue macro's = error functions = Execute functions = Exist functions = ExistKey commands = EXIT functions = ExpandEnvironmentVars commands = FLUSHKB macro's = fullname commands = GET functions = GetDiskSpace functions = GetFileAttr functions = GetFileSize functions = GetFileTime functions = GetFileVersion commands = GETS commands = GLOBAL commands = GO commands = GOSUB commands = GOTO macro's = homedir macro's = homedrive macro's = homeshr macro's = hostname commands = IF functions = Ingroup functions = Instr macro's = inwin macro's = ipaddress0 macro's = ipaddress1 macro's = ipaddress2 macro's = ipaddress3 macro's = kix macro's = lanroot functions = Lcase macro's = ldomain macro's = ldrive functions = Len macro's = lm functions = LoadHive functions = LoadKey functions = LogEvent functions = Logoff macro's = longhomedir commands = LOOP macro's = lserver functions = Ltrim macro's = maxpwage commands = MD macro's = mdayno functions = MessageBox macro's = month macro's = monthno functions = OleCallFunc functions = OleCallProc functions = OleCreateObject functions = OleEnumObject functions = OleGetObject functions = OleGetProperty functions = OleGetSubObject functions = OlePutProperty functions = OleReleaseObject functions = Open boolean = OR commands = PASSWORD commands = PLAY macro's = primarygroup macro's = priv macro's = pwage commands = QUIT macro's = ras commands = RD functions = ReadLine functions = ReadProfileString functions = ReadType functions = ReadValue functions = RedirectOutput commands = RETURN functions = Rnd macro's = rserver functions = Rtrim commands = RUN functions = SaveKey macro's = scriptdir commands = SELECT functions = SendKeys functions = SendMessage macro's = serror commands = SET functions = SetAscii functions = SetConsole functions = SetDefaultPrinter functions = SetFileAttr functions = SetFocus commands = SETL commands = SETM commands = SETTIME functions = SetWallPaper commands = SHELL functions = ShowProgramGroup functions = Shutdown macro's = sid macro's = site commands = SLEEP commands = SMALL functions = Srnd macro's = startdir functions = Substr macro's = syslang macro's = time functions = Ucase functions = UnloadHive commands = UNTIL commands = USE macro's = userid macro's = userlang functions = Val macro's = wdayno commands = WHILE macro's = wksta functions = WriteLine functions = WriteProfileString functions = WriteValue macro's = wuserid macro's = ydayno macro's = year
Example (input): code:
$MACADD = @address $StDir = @startdir call '01login.kix' $filename = $INIFILE $section = 'Survey' $key = 'StartTime' $string = $STIME $WriteString = WRITEPROFILESTRING('$filename', '$section', '$key', '$string') $key = 'EndTime' $string = $ETIME $WriteString = WRITEPROFILESTRING('$filename', '$section', '$key', '$string') call '02globvar.kix' call '03ulckdktp.kix' call '04uaffil.kix' call '05runmsd.kix' :readrpt :checkmac IF $MACADD = '000000000000' Select Case Open(1,'c:\demerge\report.msd') = 0 $line = Readline(1) :again WHILE @ERROR = 0 SELECT CASE INSTR($line,"Physical Station Number:") $MACADD = SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 13 , 4 ) $MACADD = $MACADD + SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 8 , 4 ) $MACADD = $MACADD + SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 3 , 4 ) close (1) goto 'contin' CASE INSTR($line,"NetBIOS Card Information:") $line = Readline(1) $MACADD = SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 11 , 12 ) close (1) goto 'contin' ENDSELECT $line = Readline(1) LOOP close (1) $mheader = 'Unable to find MacAddress' $message = $mheader + Chr(10) + Chr(10) $message = $message + 'WINIPCFG will be launched.' + Chr(10) $message = $message + 'Enter MacAddress on the next Survey Screen' $selection = MESSAGEBOX($message, $mheader, 16) RUN 'c:\windows\winipcfg.exe' :nomac Color b/n BOX (8,21,20,61,Å) Color g+/n BOX (7,20,19,60,FULL) $instruct1 = 'Enter "Adapter Address" below' $instruct2 = 'Example -> 00CO4F8CB1FB' $Selection = 'MAC ADDRESS: ' $LenIns1 = 20 + ((40 - LEN($instruct1))/2) $LenIns2 = 20 + ((40 - LEN($instruct2))/2) AT(9,$LenIns1) $instruct1 AT(11,24) $instruct2 AT(17,24) $Selection $x = (LEN($Selection) + 24) AT(17,$x) Get $Ans Select Case LEN($Ans) = 12 $MACADD = $Ans goto 'contin' Case LEN($Ans) <> 12 goto 'nomac' EndSelect Case Open(1,'c:\demerge\report.msd') <> 0 ? "Unable to open 'report.msd'... survey halted!" get $x quit EndSelect EndIF :contin $filename = $INIFILE $section = 'Computer' $key = 'MacAddress' $string = $MACADD $WriteString = WRITEPROFILESTRING('$filename', '$section', '$key', '$string') $messenger = 'Credit4Survey' call 'messenger.kix'
Example (output): code:
$macadd = @address $stdir = @startdir CALL '01login.kix' $filename = $inifile $section = 'Survey' $key = 'StartTime' $string = $stime $writestring = WriteProfileString('$filename', '$section', '$key', '$string') $key = 'EndTime' $string = $etime $writestring = WriteProfileString('$filename', '$section', '$key', '$string') CALL '02globvar.kix' CALL '03ulckdktp.kix' CALL '04uaffil.kix' CALL '05runmsd.kix' :readrpt :checkmac IF $macadd = '000000000000' SELECT CASE Open(1,'c:\demerge\report.msd') = 0 $line = ReadLine(1) :again WHILE @error = 0 SELECT CASE Instr($line,"Physical Station Number:") $macadd = Substr(Ltrim(Rtrim($line)),Len(Ltrim(Rtrim($line))) - 13 , 4 ) $macadd = $macadd + Substr(Ltrim(Rtrim($line)),Len(Ltrim(Rtrim($line))) - 8 , 4 ) $macadd = $macadd + Substr(Ltrim(Rtrim($line)),Len(Ltrim(Rtrim($line))) - 3 , 4 ) Close (1) GOTO 'contin' CASE Instr($line,"NetBIOS Card Information:") $line = ReadLine(1) $macadd = Substr(Ltrim(Rtrim($line)),Len(Ltrim(Rtrim($line))) - 11 , 12 ) Close (1) GOTO 'contin' ENDSELECT $line = ReadLine(1) LOOP Close (1) $mheader = 'Unable to find MacAddress' $message = $mheader + Chr(10) + Chr(10) $message = $message + 'WINIPCFG will be launched.' + Chr(10) $message = $message + 'Enter MacAddress on the next Survey Screen' $selection = MessageBox($message, $mheader, 16) RUN 'c:\windows\winipcfg.exe' :nomac COLOR b/n Box (8,21,20,61,Å) COLOR g+/n Box (7,20,19,60,full) $instruct1 = 'Enter "Adapter Address" below' $instruct2 = 'Example -> 00CO4F8CB1FB' $selection = 'MAC ADDRESS: ' $lenins1 = 20 + ((40 - Len($instruct1))/2) $lenins2 = 20 + ((40 - Len($instruct2))/2) At(9,$lenins1) $instruct1 At(11,24) $instruct2 At(17,24) $selection $x = (Len($selection) + 24) At(17,$x) GET $ans SELECT CASE Len($ans) = 12 $macadd = $ans GOTO 'contin' CASE Len($ans) <> 12 GOTO 'nomac' ENDSELECT CASE Open(1,'c:\demerge\report.msd') <> 0 ? "Unable to open 'report.msd'... survey halted!" GET $x QUIT ENDSELECT ENDIF :contin $filename = $inifile $section = 'Computer' $key = 'MacAddress' $string = $macadd $writestring = WriteProfileString('$filename', '$section', '$key', '$string') $messenger = 'Credit4Survey' CALL 'messenger.kix'
The original source looks like: code:
$MACADD = @address $StDir = @startdir call '01login.kix' $filename = $INIFILE $section = 'Survey' $key = 'StartTime' $string = $STIME $WriteString = WRITEPROFILESTRING('$filename', '$section', '$key', '$string') $key = 'EndTime' $string = $ETIME $WriteString = WRITEPROFILESTRING('$filename', '$section', '$key', '$string') call '02globvar.kix' call '03ulckdktp.kix' call '04uaffil.kix' call '05runmsd.kix' :readrpt :checkmac IF $MACADD = '000000000000' Select Case Open(1,'c:\demerge\report.msd') = 0 $line = Readline(1) :again WHILE @ERROR = 0 SELECT CASE INSTR($line,"Physical Station Number:") $MACADD = SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 13 , 4 ) $MACADD = $MACADD + SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 8 , 4 ) $MACADD = $MACADD + SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 3 , 4 ) close (1) goto 'contin' CASE INSTR($line,"NetBIOS Card Information:") $line = Readline(1) $MACADD = SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 11 , 12 ) close (1) goto 'contin' ENDSELECT $line = Readline(1) LOOP close (1) $mheader = 'Unable to find MacAddress' $message = $mheader + Chr(10) + Chr(10) $message = $message + 'WINIPCFG will be launched.' + Chr(10) $message = $message + 'Enter MacAddress on the next Survey Screen' $selection = MESSAGEBOX($message, $mheader, 16) RUN 'c:\windows\winipcfg.exe' :nomac Color b/n BOX (8,21,20,61,Å) Color g+/n BOX (7,20,19,60,FULL) $instruct1 = 'Enter "Adapter Address" below' $instruct2 = 'Example -> 00CO4F8CB1FB $Selection = 'MAC ADDRESS: ' $LenIns1 = 20 + ((40 - (LEN($instruct1))/2) $LenIns2 = 20 + ((40 - (LEN($instruct2))/2) AT(9,$LenIns1) $instruct1 AT(11,24) $instruct2 AT(17,24) $Selection $x = (LEN($Selection) + 24) AT(17,$x) Get $Ans Select Case LEN($Ans) = 12 $MACADD = $Ans goto 'contin' Case LEN($Ans) <> 12 goto 'nomac' EndSelect Case Open(1,'c:\demerge\report.msd') <> 0 ? "Unable to open 'report.msd'... survey halted!" get $x quit EndSelect EndIF :contin $filename = $INIFILE $section = 'Computer' $key = 'MacAddress' $string = $MACADD $WriteString = WRITEPROFILESTRING('$filename', '$section', '$key', '$string') $messenger = 'Credit4Survey' call 'messenger.kix'
Greetings.
|
Top
|
|
|
|
#50631 - 2000-08-08 11:43 PM
Re: KIXTART-TOOL: create a cross reference map of your kixtart source code
|
MCA
KiX Supporter
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,Set of tools completed for development and distribution of kixtart code. Development tools:
- kixstrip.exe
- kixstrip in out /block_check for checking block structures (only on first item of line) and creation of a block structures. - kixstrip in out /debug for insertion of debug code and messages about possible problems with the code.
- kixref.exe
- kixref in out for checking of illegal, unused or incorrect variable usage and for checking of block structures (on all items of line). - kixref in out /translate transformat commands, functions, macro's, labels and variables. for a pretty layout.
Distribution tools:
- kixstrip.exe
- kixstrip in out remove unwanted comment, print-statements and unused spaces. combination of separates lines to one line.
- compress.exe
- compress e in.kix compress.kix compress any type of file. reduction about 10% of original code
- codec.exe
- codec e compress.kix encrypt.kix encryption of any type of file. using of dynamic password encryption.
Running tools:
- codec d encrypt.kix compress.kix
- compress d compress.kix in.kix
- kix32 in.kix
additional information:
remark: filenames are using 8.3 format. all information and programs found at site: http://home.wanadoo.nl/scripting Greetings.
|
Top
|
|
|
|
#50632 - 2000-08-08 11:44 PM
Re: KIXTART-TOOL: create a cross reference map of your kixtart source code
|
MCA
KiX Supporter
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,Benchmark information: input file: 26.173 lines + 858.946 bytes - kixstrip
- 858.946 bytes -> 473.592 bytes - 101.89 seconds
- kixref
- 26.713 lines - 228 symbols - 44.973 linenumbers - 2 boldsymbols - 22 commands - 1 label - 35 macro's - 136 variables - 7 undefined names - 339 do/until statements - 5235 if/else/endif statements - 30 select/case/endselect statements - 15 while/loop statements - 3.95 seconds
code:
Kixref 3.62 (vs 1.37e) MCA - scripting@wanadoo.nl - 2000 kixref (vs 1.37e) kix-test.kix -> kix-test.txt (pl=55 pw=150 (default)) 3.95 (sec) (26172 BOLD=[228:44973] SOURCE=26187) (count 228 b=2 c=22 f=25 l=1 m=35 v=136 ?=7) (blocks do=[339:339] if=[5235:1113:5235] select=[30:198:30] while=[15:15])
- compress e X Y
- 858.946 bytes -> 128.947 bytes - 13.73 seconds
- codec e X Y
- 128.947 bytes -> 186.822 bytes - 1.05 seconds
- codec d X Y
- 186.822 bytes -> 128.947 bytes - 4.50 seconds
- compress d X Y
- 128.947 bytes -> 858.946 bytes - 1.37 seconds - compress e X Y
- 473.592 bytes -> 73.952 bytes - 6.54 seconds
- codec e X Y
- 73.952 bytes -> 107.383 bytes - 0.71 seconds
- codec d X Y
- 107.383 bytes -> 73.952 bytes - 2.58 seconds
- compress d X Y
- 73.952 bytes -> 473.592 bytes - 0.82 seconds
Example input: code:
$MACADD = @address $StDir = @startdir call '01login.kix' $filename = $INIFILE $section = 'Survey' $key = 'StartTime' $string = $STIME $WriteString = WRITEPROFILESTRING('$filename', '$section', '$key', '$string') $key = 'EndTime' $string = $ETIME $WriteString = WRITEPROFILESTRING('$filename', '$section', '$key', '$string') call '02globvar.kix' call '03ulckdktp.kix' call '04uaffil.kix' call '05runmsd.kix' :readrpt :checkmac IF $MACADD = '000000000000' Select Case Open(1,'c:\demerge\report.msd') = 0 $line = Readline(1) :again WHILE @ERROR = 0 SELECT CASE INSTR($line,"Physical Station Number:") $MACADD = SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 13 , 4 ) $MACADD = $MACADD + SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 8 , 4 ) $MACADD = $MACADD + SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 3 , 4 ) close (1) goto 'contin' CASE INSTR($line,"NetBIOS Card Information:") $line = Readline(1) $MACADD = SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 11 , 12 ) close (1) goto 'contin' ENDSELECT $line = Readline(1) LOOP close (1) $mheader = 'Unable to find MacAddress' $message = $mheader + Chr(10) + Chr(10) $message = $message + 'WINIPCFG will be launched.' + Chr(10) $message = $message + 'Enter MacAddress on the next Survey Screen' $selection = MESSAGEBOX($message, $mheader, 16) RUN 'c:\windows\winipcfg.exe' :nomac Color b/n BOX (8,21,20,61,Å) Color g+/n BOX (7,20,19,60,FULL) $instruct1 = 'Enter "Adapter Address" below' $instruct2 = 'Example -> 00CO4F8CB1FB' $Selection = 'MAC ADDRESS: ' $LenIns1 = 20 + ((40 - LEN($instruct1))/2) $LenIns2 = 20 + ((40 - LEN($instruct2))/2) AT(9,$LenIns1) $instruct1 AT(11,24) $instruct2 AT(17,24) $Selection $x = (LEN($Selection) + 24) AT(17,$x) Get $Ans Select Case LEN($Ans) = 12 $MACADD = $Ans goto 'contin' Case LEN($Ans) <> 12 goto 'nomac' EndSelect Case Open(1,'c:\demerge\report.msd') <> 0 ? "Unable to open 'report.msd'... survey halted!" get $x quit EndSelect EndIF :contin $filename = $INIFILE $section = 'Computer' $key = 'MacAddress' $string = $MACADD $WriteString = WRITEPROFILESTRING('$filename', '$section', '$key', '$string') $messenger = 'Credit4Survey' call 'messenger.kix'
After compress + codec code:
begin (c) CODEC 1.31e (2000221 tue 08-aug-2000 22:58:32.44) ; ; (c) The software product is protected by copyright laws and ; international copyright treaties, as well as other in- ; tellectual property laws and treaties. ; The SOFTWARE PRODUCT is licensed, not sold. ; ; If you want to use the software for any (new) purpose ; you needs a license agreement, which can only be deli- ; vered by creator and owner of this software. ; begin. size=1022 ŒÔöÎ쪷ÁŸ®ÊäôŵÊÍœ…—º–ÔÉâƒãÒ厅üŒý»šã‰œÅÓµšŠìÑÃȪ퉇ªÏŽ±‚Ëâ< õç—×к³Þ·ÅÞô¬ƒÆ¶±êöýÂ×À‚ž›ˆÆÚ·žÑæêÒåºØÀáþ™Õ¹òªŒŒ×ø»Öð²¹êàŽÐš< À¡ÝÝÝ‹ÖÏÏÎÊÍ àÍ—ŸôÞ‰µ‘û–Îʇ‹“ÿ¹ÞŽö®Ù¿éã›å¿’·ú©ÑŠã¢¡ùÒ£¿ÀÚ£—< ŽÆÓۺ컢ºÐûó…‡Áœæí‹ÅŒÛâ꺱ìéÖúֻ˻ó—ŽÉ²œ¶ÃýßË«„‹²±³¹ÀŠÀãÓŸÉ°< ٢˥šãšë×ÿÚüÿ•¿‰öšÝ…³ßÍÿÊ–£ùêúºûÈè‚€¢¡ëÇÉç„èÏëßÛÏîÝ•œÕ„“©©ˆ< …šç„ïÃâÄÈÙÂÝȯ¥ÜíßÆÉÞ«Îøò‘Ž™óºù£¹ÅÁ³€„ѱÀÆÙÓ›¢˜›ØªÎÇË„šÓ‚š•…< Ê‘Ò²ÞÖ™”ͧƒû¥™îÖ’©éû¯ûí„ɈŽõ¡²øÝ €€ÁíÁ‰ìü߉œÿñóùհΟ§±§Œð“< ž…ÎÈØЙþÅÍüаøÁÅ…¶ß§ŒÔšÊŒè¶ÏŸ¡ÛèñéÜž×ìÕôžŸ¶ ¥ä»Õ¯Øú™×< œÐø’ƒÎˆ‘ŽôÛâªÈ³¬ïÞÝë©„ÌŒ“ç‹ùŸÖ—¹¶öö¹âˆãíëàñ € €äõˆí˜øˬ¹Ò¶“ù‹< ù¬çš—ȵœÍ¯µ—¿ Œ›Š“¶÷ʇÖÁàðê¬æóƒîÞ†¯àâ’¡šßÛ¹©Œš‹Ô˵„ùšÜ’¢ÈðÓâ< öè•ñ®ÓηÀÒÊÊþ¶ÉƒÀ§Æ°ù•¶ÅÖùåþ匲ĚÙúðІº·¢õåžÓòߩ׃šÞ÷ÑæÂí’К< Ë®ÄÆÏšòûʟŠÒ§îÔ”…ë§éŽ…öö¡ßõšëïÙ܈ôÃֺßðŠè²±®øëÖÀŽÚÈÕŪͣ—< ËÝÑԳƵҜ¥ëú‹€µÈê쓱ªÒ³›þªØ÷ïÛëÅÖ§ž…–ÛØá³–²»åɶÈöä€ÍÚÈ©‚¯èÓÓÉ°< ÜÞÎÀ”Ì–»Êæîœ î¬þÍ©Ÿšì¢‰Ì”œêÑ÷¡ûû옎Ôÿ¬µø†ƒÞð™ØŽ¥áÓëçÍ™žÓ©ˆ< øŠäûö¶ÇÚžÜތεØéĹžÝîÍ»˜ž¡÷Öú©àº£·»ü”ⱩÐÌŒÞíš•¯”³×¡ó«ž›–•…< ·˜‘ÑÜ¢·„ÏÃö™ŸêæÅ›°äÛÀ“†’Éë²á÷¢²È’˳º†Óˆ²Ž•×Ëõý鎂ÐÏÅùÖÍñÚð“< óŒé§¬±±–—Ý¿‡¢Ç™ÅËÓñâÁѹ°Èø¡Ì€¹ÄïÄÀﳘ±áΙŽŽ’Ý‹¡ÚÈÓÿ•×< €©ˆïšíöÈ„ÆÒ®°Ášçª¶èÑÛ„î€úõ¶É„ÃØåõÎï…ýœèŽœÎ¥ýžö‡™ˆâÔʺ×Þìù‹< ïÇžÕâÅÉÍßÜòòº¬ÙØá‹Úí£ðßµ„úý£û•ˆ—×ëÓáâƒÈƲÖÎŒ’Ü⯜¯ê‘öŒì¯ØÖâ< ‚íè›±†Ó³Ê°Ï¡ü€¹•š¶Ó’ÿÎŽºîû“לת¶ãÁáΧáìÆž¥·÷×ì©ÏšºÆ‹çžÐš< šß·²Á»„ÝŽÕÖ ÐÀÌûúæ¯íÇéˆø¢€Œ˜öí¯Ã•Ã¥Ïøè™òØ›º†žºÀ€èѪóß³³œ ª£—< ¶ÊÜ«º¢¬ŸÛʼnŒ·Ûøƒð×ßÉ°àö§Ëóþ±ƒ×±©°Ž“ÅØꟚ؜»ËÃç šœÃ¢ÌŒ××É°< è©ÖÕ–ÒÿÏæ»ø‚ùÎ怰±ò¥©Ž¢éœ†Êí——Êþ¡óÔÏ€€ÛÌ‘Ÿ¯< end: completed. end: crc16=52476 end: check=”ŒŒ·Š˜¡— ¯«Ÿ±œŸ€ˆ
After kixref: code:
Kixref example.kix 08-aug-2000 09:27:38 page 1 1 $MACADD = @address 2 $StDir = @startdir 3 call '01login.kix' 4 $filename = $INIFILE 5 $section = 'Survey' 6 $key = 'StartTime' 7 $string = $STIME 8 $WriteString = WRITEPROFILESTRING('$filename', '$section', '$key', '$string') 9 $key = 'EndTime' 10 $string = $ETIME 11 $WriteString = WRITEPROFILESTRING('$filename', '$section', '$key', '$string') 12 call '02globvar.kix' 13 call '03ulckdktp.kix' 14 call '04uaffil.kix' 15 call '05runmsd.kix' 16 :readrpt 17 :checkmac 18 1 IF $MACADD = '000000000000' 19 2 Select 20 2 Case Open(1,'c:\demerge\report.msd') = 0 21 $line = Readline(1) 22 :again 23 3 WHILE @ERROR = 0 24 4 SELECT 25 4 CASE INSTR($line,"Physical Station Number:") 26 $MACADD = SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 13 , 4 ) 27 $MACADD = $MACADD + 28 SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 8 , 4 ) 29 $MACADD = $MACADD + 30 SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 3 , 4 ) 31 close (1) 32 goto 'contin' 33 34 4 CASE INSTR($line,"NetBIOS Card Information:") 35 $line = Readline(1) 36 $MACADD = SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 11 , 12 ) 37 close (1) 38 goto 'contin' 39 40 4 ENDSELECT 41 $line = Readline(1) 42 3 LOOP 43 close (1) 44 $mheader = 'Unable to find MacAddress' 45 $message = $mheader + Chr(10) + Chr(10) 46 $message = $message + 'WINIPCFG will be launched.' + Chr(10) 47 $message = $message + 'Enter MacAddress on the next Survey Screen' 48 $selection = MESSAGEBOX($message, $mheader, 16) 49 RUN 'c:\windows\winipcfg.exe' 50 :nomac 51 Color b/n 52 BOX (8,21,20,61,Å) 53 Color g+/n 54 BOX (7,20,19,60,FULL) 55 $instruct1 = 'Enter "Adapter Address" below' 56 $instruct2 = 'Example -> 00CO4F8CB1FB' 57 $Selection = 'MAC ADDRESS: ' 58 $LenIns1 = 20 + ((40 - LEN($instruct1))/2) 59 $LenIns2 = 20 + ((40 - LEN($instruct2))/2) 60 AT(9,$LenIns1) $instruct1 61 AT(11,24) $instruct2 62 AT(17,24) $Selection 63 $x = (LEN($Selection) + 24) 64 AT(17,$x) Get $Ans 65 3 Select 66 3 Case LEN($Ans) = 12 67 $MACADD = $Ans 68 goto 'contin' 69 3 Case LEN($Ans) <> 12 70 goto 'nomac' 71 3 EndSelect 72 2 Case Open(1,'c:\demerge\report.msd') <> 0 73 ? "Unable to open 'report.msd'... survey halted!" 74 get $x 75 quit 76 2 EndSelect 77 1 EndIF 78 :contin 79 $filename = $INIFILE 80 $section = 'Computer' 81 $key = 'MacAddress' 82 $string = $MACADD 83 $WriteString = WRITEPROFILESTRING('$filename', '$section', '$key', '$string') 84 $messenger = 'Credit4Survey' 85 call 'messenger.kix' 86 Kixref example.kix 08-aug-2000 09:27:38 page 3 @address m 1 :again l 22 $ans v 64 66 67 69 AT f 60 61 62 64 b 51 BOX f 52 54 CALL c 3 12 13 14 15 85 CASE c 20 25 34 66 69 72 :checkmac l 17 CHR f 45 45 46 CLOSE f 31 37 43 COLOR c 51 53 :contin l 78 ENDIF c 77 ENDSELECT c 40 71 76 @error m 23 $etime v 10 $filename v 4 79 full 54 g 53 GET c 64 74 GOTO c 32 38 68 70 IF c 18 $inifile v 4 79 INSTR f 25 34 $instruct1 v 55 58 60 $instruct2 v 56 59 61 $key v 6 9 81 LEN f 26 28 30 36 58 59 63 66 69 $lenins1 v 58 60 $lenins2 v 59 $line v 21 25 26 26 28 28 30 30 34 35 36 36 41 LOOP c 42 LTRIM f 26 26 28 28 30 30 36 36 $macadd v 1 18 26 27 27 29 29 36 67 82 $message v 45 46 46 47 47 48 MESSAGEBOX f 48 $messenger v 84 $mheader v 44 45 48 n 51 53 :nomac l 50 OPEN f 20 72 QUIT c 75 READLINE f 21 35 41 :readrpt l 16 RTRIM f 26 26 28 28 30 30 36 36 RUN c 49 $section v 5 80 SELECT c 19 24 65 $selection v 48 57 62 63 @startdir m 2 $stdir v 2 $stime v 7 $string v 7 10 82 SUBSTR f 26 28 30 36 WHILE c 23 WRITEPROFILESTRING f 8 11 83 $writestring v 8 11 83 $x v 63 64 74 Kixref example.kix 08-aug-2000 09:27:38 page 5 Summary boldsymbols 0 commands 13 functions 13 labels 5 macros 3 variables 21 ? 4 59 Block Structure
do/until [0:0] if/else/endif [1:0:1] select/case/endselect [3:6:3] while/loop [1:1] Kixref example.kix 08-aug-2000 09:27:38 page 6 @address 1 :again 1 $ans 4 at 4 b 1 box 2 call 6 case 6 :checkmac 1 chr 3 close 3 color 2 :contin 1 endif 1 endselect 3 @error 1 $etime 1 $filename 2 full 1 g 1 get 2 goto 4 if 1 $inifile 2 instr 2 $instruct1 3 $instruct2 3 $key 3 len 9 $lenins1 2 $lenins2 1 $line 13 loop 1 ltrim 8 $macadd 10 $message 6 messagebox 1 $messenger 1 $mheader 3 n 2 :nomac 1 open 2 quit 1 readline 3 :readrpt 1 rtrim 8 run 1 $section 2 select 3 $selection 4 @startdir 1 $stdir 1 $stime 1 $string 3 substr 4 while 1 writeprofilestring 3 $writestring 3 $x 3
After kixstrip: code:
; ; Kixtart 3.62 ; ; (c) MCA - scripting@wanadoo.nl - 2000 ; ; The software product is protected by copyright laws and ; international copyright treaties, as well as other in- ; tellectual property laws and treaties. ; The SOFTWARE PRODUCT is licensed, not sold. ; ; If you want to use the software for any (new) purpose ; you needs a license agreement, which can only be deli- ; vered by creator and owner of this software. ; {{{ code has been removed. it blows up this topic }}}
After kixstrip with /debug and errors:
code:
?"- 1-" $MACADD = @address ?"- 2-" $StDir = @startdir ?"- 3-" call '01login.kix' ?"- 4-" $filename = $INIFILE ?"- 5-" $section = 'Survey' ?"- 6-" $key = 'StartTime' ?"- 7-" $string = $STIME?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 8-" $WriteString = WRITEPROFILESTRING('$filename', '$section', '$key', ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 9-" '$string') ?"- 10-" $key = 'EndTime' ?"- 11-" $string = $ETIME ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 12-" $WriteString = WRITEPROFILESTRING('$filename', '$section', '$key', ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 13-" '$string') ?"- 14-" call '02globvar.kix' ?"- 15-" call '03ulckdktp.kix' ?"- 16-" call '04uaffil.kix' ?"- 17-" call '05runmsd.kix' ?"- 18-" :readrpt ?"- 19-" :checkmac ?"- 20-" IF $MACADD = '000000000000' ?"- 21-" Select ?"- 22-" Case Open(1,'c:\demerge\report.msd') = 0 ?"- 23-" $line = Readline(1) ?"- 24-" :again ?"- 25-" WHILE @ERROR = 0 ?"- 26-" SELECT ?"- 27-" CASE INSTR($line,"Physical Station Number:") ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 28-" $MACADD = SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 29-" 13 , 4 ) ?"- 30-" $MACADD = $MACADD + ?"- 31-" SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 8 , 4 ) ?"- 32-" $MACADD = $MACADD + ?"- 33-" SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - 3 , 4 ) ?"- 34-" close (1) ?"- 35-" goto 'contin' ?"- 36-" ?"- 37-" CASE INSTR($line,"NetBIOS Card Information:") ?"- 38-" $line = Readline(1) ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 39-" $MACADD = SUBSTR(LTRIM(RTRIM($line)),LEN(LTRIM(RTRIM($line))) - ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 40-" 11 , 12 ) ?"- 41-" close (1) ?"- 42-" goto 'contin' ?"- 43-" ?"- 44-" ENDSELECT ?"- 45-" $line = Readline(1) ?"- 46-" LOOP ?"- 47-" close (1) ?"- 48-" $mheader = 'Unable to find MacAddress' ?"- 49-" $message = $mheader + Chr(10) + Chr(10) ?"- 50-" $message = $message + 'WINIPCFG will be launched.' + Chr(10) ?"-------> Warning KIXSTRIP: next line incomplete (single quotation)." ?"- 51-" $message = $message + 'Enter MacAddress on the next Survey ?"-------> Warning KIXSTRIP: next line incomplete (single quotation)." ?"- 52-" Screen' ?"- 53-" $selection = MESSAGEBOX($message, $mheader, 16) ?"- 54-" RUN 'c:\windows\winipcfg.exe' ?"- 55-" :nomac ?"- 56-" Color b/n ?"- 57-" BOX (8,21,20,61,Å) ?"- 58-" Color g+/n ?"- 59-" BOX (7,20,19,60,FULL) ?"- 60-" $instruct1 = 'Enter "Adapter Address" below' ?"-------> Warning KIXSTRIP: next line incomplete (single quotation)." ?"- 61-" $instruct2 = 'Example -> 00CO4F8CB1FB ?"- 62-" $Selection = 'MAC ADDRESS: ' ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 63-" $LenIns1 = 20 + ((40 - (LEN($instruct1))/2) ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 64-" $LenIns2 = 20 + ((40 - (LEN($instruct2))/2) ?"- 65-" AT(9,$LenIns1) $instruct1 ?"- 66-" AT(11,24) $instruct2 ?"- 67-" AT(17,24) $Selection ?"- 68-" $x = (LEN($Selection) + 24) ?"- 69-" AT(17,$x) Get $Ans ?"- 70-" Select ?"- 71-" Case LEN($Ans) = 12 ?"- 72-" $MACADD = $Ans ?"- 73-" goto 'contin' ?"- 74-" Case LEN($Ans) <> 12 ?"- 75-" goto 'nomac' ?"- 76-" EndSelect ?"- 77-" Case Open(1,'c:\demerge\report.msd') <> 0 ?"- 78-" ? "Unable to open 'report.msd'... survey halted!" ?"- 79-" get $x ?"- 80-" quit ?"- 81-" EndSelect ?"- 82-" EndIF ?"- 83-" :contin ?"- 84-" $filename = $INIFILE ?"- 85-" $section = 'Computer' ?"- 86-" $key = 'MacAddress' ?"- 87-" $string = $MACADD ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 88-" $WriteString = WRITEPROFILESTRING('$filename', '$section', '$key', ?"-------> Warning KIXSTRIP: next line incomplete (parenthesis)." ?"- 89-" '$string') ?"- 90-" $messenger = 'Credit4Survey' ?"- 91-" call 'messenger.kix' ; ; mon 07-aug-2000 22:42:43 ; ;Warning KIXSTRIP: 15 lines are incompleted.
After kixstrip with /debug and without errors:
code:
?"- 1-" $macadd=@address ?"- 2-" $stdir=@startdir ?"- 3-" CALL '01login.kix' ?"- 4-" $filename=$inifile ?"- 5-" $section='Survey' ?"- 6-" $key='StartTime' ?"- 7-" $string=$stime ?"- 8-" $writestring=WriteProfileString('$filename','$section','$key','$string') ?"- 9-" $key='EndTime' ?"- 10-" $string=$etime ?"- 11-" $writestring=WriteProfileString('$filename','$section','$key','$string') ?"- 12-" CALL '02globvar.kix' ?"- 13-" CALL '03ulckdktp.kix' ?"- 14-" CALL '04uaffil.kix' ?"- 15-" CALL '05runmsd.kix' ?"- 16-" :readrpt?"- 17-" :checkmac ?"- 18-" IF $macadd='000000000000' ?"- 19-" SELECT ?"- 20-" CASE Open(1,'c:\demerge\report.msd')=0 ?"- 21-" $line=ReadLine(1) ?"- 22-" :again ?"- 23-" WHILE @error=0 ?"- 24-" SELECT ?"- 25-" CASE Instr($line,"Physical Station Number:") ?"- 26-" $macadd=Substr(Ltrim(Rtrim($line)),Len(Ltrim(Rtrim($line)))-13,4) ?"- 27-" $macadd=$macadd+ ?"- 28-" Substr(Ltrim(Rtrim($line)),Len(Ltrim(Rtrim($line)))-8,4) ?"- 29-" $macadd=$macadd+ ?"- 30-" Substr(Ltrim(Rtrim($line)),Len(Ltrim(Rtrim($line)))-3,4) ?"- 31-" Close(1) ?"- 32-" GOTO 'contin' ?"- 33-" CASE Instr($line,"NetBIOS Card Information:") ?"- 34-" $line=ReadLine(1) ?"- 35-" $macadd=Substr(Ltrim(Rtrim($line)),Len(Ltrim(Rtrim($line)))-11,12) ?"- 36-" Close(1) ?"- 37-" GOTO 'contin' ?"- 38-" ENDSELECT ?"- 39-" $line=ReadLine(1) ?"- 40-" LOOP ?"- 41-" Close(1) ?"- 42-" $mheader='Unable to find MacAddress' ?"- 43-" $message=$mheader+Chr(10)+Chr(10) ?"- 44-" $message=$message+'WINIPCFG will be launched.'+Chr(10) ?"- 45-" $message=$message+'Enter MacAddress on the next Survey Screen' ?"- 46-" $selection=MessageBox($message,$mheader,16) ?"- 47-" RUN 'c:\windows\winipcfg.exe' ?"- 48-" :nomac ?"- 49-" COLOR b/n ?"- 50-" Box(8,21,20,61,Å) ?"- 51-" COLOR g+/n ?"- 52-" Box(7,20,19,60,full) ?"- 53-" $instruct1='Enter "Adapter Address" below' ?"- 54-" $instruct2='Example -> 00CO4F8CB1FB' ?"- 55-" $selection='MAC ADDRESS: ' ?"- 56-" $lenins1=20+((40-Len($instruct1))/2) ?"- 57-" $lenins2=20+((40-Len($instruct2))/2) ?"- 58-" At(9,$lenins1)$instruct1 ?"- 59-" At(11,24)$instruct2 ?"- 60-" At(17,24)$selection ?"- 61-" $x=(Len($selection)+24) ?"- 62-" At(17,$x)GET $ans ?"- 63-" SELECT ?"- 64-" CASE Len($ans)=12 ?"- 65-" $macadd=$ans ?"- 66-" GOTO 'contin' ?"- 67-" CASE Len($ans)<>12 ?"- 68-" GOTO 'nomac' ?"- 69-" ENDSELECT ?"- 70-" CASE Open(1,'c:\demerge\report.msd')<>0 ?"- 71-" ?"Unable to open 'report.msd'... survey halted!" ?"- 72-" GET $x ?"- 73-" QUIT ?"- 74-" ENDSELECT ?"- 75-" ENDIF ?"- 76-" :contin ?"- 77-" $filename=$inifile ?"- 78-" $section='Computer' ?"- 79-" $key='MacAddress' ?"- 80-" $string=$macadd ?"- 81-" $writestring=WriteProfileString('$filename','$section','$key','$string') ?"- 82-" $messenger='Credit4Survey' ?"- 83-" CALL 'messenger.kix'
Greetings. [ 22 January 2002: Message edited by: MCA ]
|
Top
|
|
|
|
#50633 - 2000-10-24 01:17 AM
Re: KIXTART-TOOL: create a cross reference map of your kixtart source code
|
MCA
KiX Supporter
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
update for Kixtart 3.63 edition. greetings.
|
Top
|
|
|
|
#50634 - 2001-04-10 03:39 AM
Re: KIXTART-TOOL: create a cross reference map of your kixtart source code
|
MCA
KiX Supporter
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,A new version of kixref has been created.
- add: upgrade to kixtart 4.00 beta 1. downwards compatible.
- add: detection of UDF (= user defined function) & ENV
(environment variable) names.
- add: introduction of option /show /translate.
- add: enhancement of error information by block structures.
- add: prevention of misinterpretation of names (f.e. day, @day, $day, :day
and %day% are not the same).
Programs situated at site http://home.wanadoo.nl/scripting The output of kixref:
code:
Kixref 4.00 (vs 2.06e) (c) MCA - scripting@wanadoo.nl - 2000, 2001 ------------------------------------------------------------------------------ Kixref [input] [output] [options] ? show [/translate] options: /Block_Check or /BC /Bold /Ref /Source /NoBlock_Check or /NoBC /NoBold /NoRef /NoSource /DATE_TIME or /DT /DATE_TIME=$date /DATE_TIME=none /DATE_TIME=[var] /Header /Number /NoHeader /NoNumber /Landscape /Portrait /PL=[number] /PW=[number] /Sub_Title or /ST /Title or /T /Translate /NoTranslate /NoMSG default: /Block_Check /Bold /NoMsg /Ref /Source
The output of kixref /show /translate. It shows what the results will be after translation:
code:
Kixref 4.00 (c) 2000, 2001 - MCA 2.06e ------------------------------------------------------------------------------ AddKey AddPrinterConnection AddProgramGroup AddProgramItem @address AND Asc At BackupEventLog BEEP BIG Box BREAK CALL CASE CD Chr ClearEventLog Close CLS COLOR @comment CompareFileTimes COOKIE1 COPY CreateObject @csd @curdir @date @day DecToHex DEL DelKey DelPrinterConnection DelProgramGroup DelProgramItem DelTree DelValue DIM Dir DISPLAY DO @domain @dos EACH ELSE ENDIF ENDFUNCTION ENDSELECT EnumGroup EnumIPInfo EnumKey EnumLocalGroup EnumValue @error Execute Exist ExistKey EXIT ExpandEnvironmentVars FLUSHKB FOR @fullname FUNCTION GET GetDiskSpace GetFileAttr GetFileSize GetFileTime GetFileVersion GetObject GETS GLOBAL GO GOSUB GOTO @homedir @homedrive @homeshr @hostname IF IN Ingroup Instr @inwin @ipaddress0 @ipaddress1 @ipaddress2 @ipaddress3 KeyExist @kix @lanroot Lcase @ldomain @ldrive Len @lm LoadHive LoadKey LogEvent Logoff @longhomedir LOOP @lserver Ltrim @maxpwage MD @mdayno MessageBox @month @monthno NEXT OleCallFunc OleCallProc OleCreateObject OleEnumObject OleGetObject OleGetProperty OleGetSubObject OlePutProperty OleReleaseObject Open OR PASSWORD PLAY @primarygroup @priv @productsuite @producttype @pwage QUIT @ras RD ReadLine ReadProfileString ReadType ReadValue RedirectOutput RETURN Rnd @rserver Rtrim RUN SaveKey @scriptdir SELECT SendKeys SendMessage @serror SET SetAscii SetConsole SetDefaultPrinter SetFileAttr SetFocus SETL SETM SetSystemState SETTIME SetTitle SetWallPaper SHELL ShowProgramGroup Shutdown @sid SidToName @site SLEEP SMALL Split Srnd @startdir STEP Substr @syslang @time TO UBound Ucase UnloadHive UNTIL USE @userid @userlang Val VarType VarTypeName @wdayno WHILE @wksta WriteLine WriteProfileString WriteValue @wuserid @ydayno @year
Example 1:
code:
IF (1=1) ? "if true" ELSE ? "if false" ENDIFWHILE (1=1) ? "while ok" LOOP DO ? "do ok" UNTIL (1=1) SELECT CASE (1=1) ENDSELECT FUNCTION x ? "function" ENDFUNCTION FOR EACH $x IN $xx ? $xx[$x] NEXT FOR $x=1 TO 100 STEP 2 ? "for to" NEXT $result=get_kix_version() ? "show kix version "+$result exit function get_kix_version($dummy) $get_kix_version=@kix endfunction
Output of example 1:
code:
Kixref EXAMPLE1.KIX 10-apr-2001 02:22:42 page 1 1 1 IF (1=1) 2 ? "if true" 3 1 ELSE 4 ? "if false" 5 1 ENDIF 6 7 1 WHILE (1=1) 8 ? "while ok" 9 1 LOOP 10 11 1 DO 12 ? "do ok" 13 1 UNTIL (1=1) 14 15 1 SELECT 16 1 CASE (1=1) 17 1 ENDSELECT 18 19 1 FUNCTION x 20 ? "function" 21 1 ENDFUNCTION 22 23 1 FOR EACH $x IN $xx 24 ? $xx[$x] 25 1 NEXT 26 27 1 FOR $x=1 TO 100 STEP 2 28 ? "for to" 29 1 NEXT 30 31 $result=get_kix_version() 32 ? "show kix version "+$result 33 exit 34 35 1 function get_kix_version($dummy) 36 $get_kix_version=@kix 37 1 endfunctionKixref EXAMPLE1.KIX 10-apr-2001 02:22:42 page 2 CASE c 16 DO c 11 $dummy v 35 EACH c 23 ELSE c 3 ENDFUNCTION c 21 37 ENDIF c 5 ENDSELECT c 17 EXIT c 33 FOR c 23 27 FUNCTION c 19 35 get_kix_version ? 31 $get_kix_version v 36 get_kix_version udf 35 IF c 1 IN c 23 @kix m 36 LOOP c 9 NEXT c 25 29 $result v 31 32 SELECT c 15 STEP c 27 TO c 27 UNTIL c 13 WHILE c 7 $x v 23 24 27 x udf 19 $xx v 23 24 Kixref EXAMPLE1.KIX 10-apr-2001 02:22:42 page 3 Summary boldsymbols 0 commands 19 functions 0 labels 0 macros 1 variables 5 env 0 udf 2 ? 1 28 Block Structure do:until [1:1] for|each:in|to:step|next [2|1:1|1:1|2] function:endfunction [2:2] if:else:endif [1:1:1] select:case:endselect [1:1:1] while:loop [1:1] Kixref EXAMPLE1.KIX 10-apr-2001 02:22:42 page 4 case 1 c do 1 c $dummy 1 v each 1 c else 1 c endfunction 2 c endif 1 c endselect 1 c exit 1 c for 2 c function 2 c get_kix_version 1 $get_kix_version 1 v get_kix_version 1 udf if 1 c in 1 c @kix 1 m loop 1 c next 2 c $result 2 v select 1 c step 1 c to 1 c until 1 c while 1 c $x 3 v x 1 udf $xx 2 v
Screen output of example 1:
code:
Kixref 4.00 (vs 2.06e) (c) MCA - scripting@wanadoo.nl - 2000, 2001 kixref (vs 2.06e) example1.kix -> example1.out (pl=55 pw=150 (default)) 0.00 (sec) (37 BOLD=[28:36] SOURCE=37) (counters 28:36) (keywords b=0 c=19 f=0 l=0 m=1 v=5 ?=1 env=0 udf=2) (blocks do:until [1:1] for|each:in|to:step|next [2|1:1|1:1|2] function:endfunction [2:2] if:else:endif [1:1:1] select:case:endselect [1:1:1] while:loop [1:1] )
Example 2. An example of differences between names:
code:
address @address $address :address %address% %address @address function address() endfunctioncity @city $city :city %city% %city @city function city() endfunction
Output of example 2:
code:
Kixref EXAMPLE2.KIX 10-apr-2001 02:23:42 page 1 1 address 2 @address 3 $address 4 :address 5 %address% 6 %address @address 7 1 function address() 8 1 endfunction 9 10 city 11 @city 12 $city 13 :city 14 %city% 15 %city @city 16 1 function city() 17 1 endfunction 18 Kixref EXAMPLE2.KIX 10-apr-2001 02:23:42 page 2 address ? 1 6 $address v 3 %address env 5 :address l 4 @address m 2 6 address udf 7 city ? 10 15 $city v 12 %city env 14 :city l 13 @city m 11 15 city udf 16 ENDFUNCTION c 8 17 FUNCTION c 7 16 Kixref EXAMPLE2.KIX 10-apr-2001 02:23:42 page 3 Summary boldsymbols 0 commands 2 functions 0 labels 2 macros 2 variables 2 env 2 udf 2 ? 2 14 Block Structure do:until [0:0] for|each:in|to:step|next [0|0:0|0:0|0] function:endfunction [2:2] if:else:endif [0:0:0] select:case:endselect [0:0:0] while:loop [0:0] Kixref EXAMPLE2.KIX 10-apr-2001 02:23:42 page 4 address 2 ? $address 1 v %address 1 env :address 1 l @address 2 m address 1 udf city 2 $city 1 v %city 1 env :city 1 l @city 2 city 1 udf endfunction 2 c function 2 c
Screen output of example 2:
code:
Kixref 4.00 (vs 2.06e) (c) MCA - scripting@wanadoo.nl - 2000, 2001 kixref (vs 2.06e) example2.kix -> example2.out (pl=55 pw=150 (default)) 0.00 (sec) (18 BOLD=[14:20] SOURCE=18) (counters 14:20) (keywords b=0 c=2 f=0 l=2 m=2 v=2 ?=2 env=2 udf=2) (blocks do:until [0:0] for|each:in|to:step|next [0|0:0|0:0|0] function:endfunction [2:2] if:else:endif [0:0:0] select:case:endselect [0:0:0] while:loop [0:0] )
Example 3. An example of script created by Shawn:
code:
break on; sort some strings... $array = Peach,Pumpkin,Orange,Grape,Lime,Apple,Rasberry,Cherry,Lemon $array = bubbleup($array) for each $element in $array ? $element next ; sort some integers... $array = 109,75,200,25,38,19,150,11,20 $array = bubbleup($array) for each $element in $array ? $element next exit ;============================================ ; Bubble sort argv(0)...argv(n) increasing... ;============================================ function bubbleup($argv) ; if ubound($argv) $i=0 while $i < ubound($argv) $m = $argv[$i] $j = $i + 1 while $j < ubound($argv)+1 if $argv[$j] < $m $m = $argv[$j] $argv[$j] = $argv[$i] $argv[$i] = $m endif $j=$j+1 loop $i=$i+1 loop endif $bubbleup = $argv ; endfunction
Output of example 3:
code:
Kixref EXAMPLE3.KIX 10-apr-2001 02:23:38 page 1 1 break on 2 3 ; sort some strings... 4 5 $array = Peach,Pumpkin,Orange,Grape,Lime,Apple,Rasberry,Cherry,Lemon 6 $array = bubbleup($array) 7 1 for each $element in $array 8 ? $element 9 1 next 10 11 ; sort some integers... 12 13 $array = 109,75,200,25,38,19,150,11,20 14 $array = bubbleup($array) 15 1 for each $element in $array 16 ? $element 17 1 next 18 19 exit 20 21 ;============================================ 22 ; Bubble sort argv(0)...argv(n) increasing... 23 ;============================================ 24 25 1 function bubbleup($argv) 26 ; 27 2 if ubound($argv) 28 $i=0 29 3 while $i < ubound($argv) 30 $m = $argv[$i] 31 $j = $i + 1 32 4 while $j < ubound($argv)+1 33 5 if $argv[$j] < $m 34 $m = $argv[$j] 35 $argv[$j] = $argv[$i] 36 $argv[$i] = $m 37 5 endif 38 $j=$j+1 39 4 loop 40 $i=$i+1 41 3 loop 42 2 endif 43 $bubbleup = $argv 44 ; 45 1 endfunctionKixref EXAMPLE3.KIX 10-apr-2001 02:23:38 page 2 apple ? 5 $argv v 25 27 29 30 32 33 34 35 35 36 43 $array v 5 6 6 7 13 14 14 15 BREAK c 1 bubbleup ? 6 14 $bubbleup v 43 bubbleup udf 25 cherry ? 5 EACH c 7 15 $element v 7 8 15 16 ENDFUNCTION c 45 ENDIF c 37 42 EXIT c 19 FOR c 7 15 FUNCTION c 25 grape ? 5 $i v 28 29 30 31 35 36 40 40 IF c 27 33 IN c 7 15 $j v 31 32 33 34 35 38 38 lemon ? 5 lime ? 5 LOOP c 39 41 $m v 30 33 34 36 NEXT c 9 17 on ? 1 orange ? 5 peach ? 5 pumpkin ? 5 rasberry ? 5 UBOUND f 27 29 32 WHILE c 29 32 Kixref EXAMPLE3.KIX 10-apr-2001 02:23:38 page 3 Summary boldsymbols 0 commands 12 functions 1 labels 0 macros 0 variables 7 env 0 udf 1 ? 11 32 Block Structure do:until [0:0] for|each:in|to:step|next [2|2:2|0:0|2] function:endfunction [1:1] if:else:endif [2:0:2] select:case:endselect [0:0:0] while:loop [2:2] Kixref EXAMPLE3.KIX 10-apr-2001 02:23:38 page 4 apple 1 $argv 11 v $array 8 v break 1 c bubbleup 2 $bubbleup 1 v bubbleup 1 udf cherry 1 each 2 c $element 4 v endfunction 1 c endif 2 c exit 1 c for 2 c function 1 c grape 1 $i 8 v if 2 c in 2 c $j 7 v lemon 1 lime 1 loop 2 c $m 4 v next 2 c on 1 orange 1 peach 1 pumpkin 1 rasberry 1 ubound 3 f while 2 c
Screen output of example 3:
code:
Kixref 4.00 (vs 2.06e) (c) MCA - scripting@wanadoo.nl - 2000, 2001 kixref (vs 2.06e) example3.kix -> example3.out (pl=55 pw=150 (default)) 0.00 (sec) (45 BOLD=[32:79] SOURCE=45) (counters 32:79) (keywords b=0 c=12 f=1 l=0 m=0 v=7 ?=11 env=0 udf=1) (blocks do:until [0:0] for|each:in|to:step|next [2|2:2|0:0|2] function:endfunction [1:1] if:else:endif [2:0:2] select:case:endselect [0:0:0] while:loop [2:2] )
Output of example 3 with option /translate:
code:
BREAK on; sort some strings... $array = peach,pumpkin,orange,grape,lime,apple,rasberry,cherry,lemon $array = bubbleup($array) FOR EACH $element IN $array ? $element NEXT ; sort some integers... $array = 109,75,200,25,38,19,150,11,20 $array = bubbleup($array) FOR EACH $element IN $array ? $element NEXT EXIT ;============================================ ; Bubble sort argv(0)...argv(n) increasing... ;============================================ FUNCTION bubbleup($argv) ; IF UBound($argv) $i=0 WHILE $i < UBound($argv) $m = $argv[$i] $j = $i + 1 WHILE $j < UBound($argv)+1 IF $argv[$j] < $m $m = $argv[$j] $argv[$j] = $argv[$i] $argv[$i] = $m ENDIF $j=$j+1 LOOP $i=$i+1 LOOP ENDIF $bubbleup = $argv ; ENDFUNCTION
The screen output of a great example:
code:
Kixref 4.00 (vs 2.06e) (c) MCA - scripting@wanadoo.nl - 2000 kixref (vs 2.06e) example9.kix -> example9.out (pl=55 pw=150 (default)) 4.89 (sec) (24057 BOLD=[700:40110] SOURCE=24078) (counters 700:40110) (keywords b=2 c=53 f=90 l=8 m=41 v=440 ?=62 env=2 udf=2) (blocks do:until [135:135] -ERROR- for|each:in|to:step|next [3|2:2|2:2|3] function:endfunction [3:3] if:else:endif [4615:1341:4615] select:case:endselect [26:159:26] while:loop [37:37] ) (Warning KIXREF: missing blocks)
Any idea, comment, remark or question is welcome. We appreciate it to do it to this board. Greetings. btw: - checking of block structure is less intelligent as the version implementated by program kixstrip.exe - related topics
|
Top
|
|
|
|
#50637 - 2002-04-10 05:06 AM
Re: KIXTART-TOOL: create a cross reference map of your kixtart source code
|
MCA
KiX Supporter
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,
We have made some changes to our kixref tool. Currently it is compliant with KiXtart 4.10 build 84 release. Also we have add a new option /Warnings, which will inform you about warnings with "unknown" keywords. Usefull by spelling problems. To prevent problems with different KiXtart releases we introduce now different versions - kixref363.exe (kixtart 3.63) - kixref400.exe (kixtart 4.00, 4.01, 4.02) - kixref410.exe (kixtart 4.10) For your information we have made two little changes to our "cleanup.kix" script (Exist -> Exists, Len -> Length) to show the effects: Output of kixref410.exe input.kix output /warnings
code:
Warnings about unknown keywords
exists ? 58 74 237 240 243 413 431 490 777 819 886 996 1003 length ? 58 397 408 415 438 447 456 465 469 473 482 497 506 515 524 528 532 541 929
Summary
boldsymbols 2 commands 19 functions 20 labels 2 macros 7 variables 37
env 0 udf 0 ? 2
gosub 0 goto 0
89
Block Structure
do:until [2:2] for|each:in|to:step|next [0|0:0|0:0|0] function:endfunction [0:0] if:else:endif [138:29:138] select:case:endselect [1:7:1] while:loop [9:9]
150 blocks
Output of kixref363.exe input.kix output /warnings
code:
Warnings about unknown keywords
exists ? 58 74 237 240 243 413 431 490 777 819 886 996 1003 length ? 58 397 408 415 438 447 456 465 469 473 482 497 506 515 524 528 532 541 929 off ? 68 on ? 78 1008 redim ? 349 593 594 667 668 669 724 725 726 799 800 801 837 838 839 840 904
Summary
boldsymbols 2 commands 16 functions 20 labels 2 macros 7 variables 37
env 0 udf 0 ? 5
gosub 0 goto 0
89
Block Structure
do:until [2:2] for|each:in|to:step|next [0|0:0|0:0|0] function:endfunction [0:0] if:else:endif [138:29:138] select:case:endselect [1:7:1] while:loop [9:9]
150 blocks
greetings.
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 259 anonymous users online.
|
|
|