Jump to content

Search the Community

Showing results for tags 'autoit c converter'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $stri=0 Dim $ParseVar[0][2] func addParser($Pattern,$output) $lastIndex=UBound($ParseVar) ReDim $ParseVar[$lastIndex+1][2] $ParseVar[$lastIndex][0]=$Pattern $ParseVar[$lastIndex][1]=$output EndFunc $Pattern='for\s*[$](\w+)(\s+|\s?)(=)(\s+|\s?)(\d+)\s*to\s*(\d+)\s*step\s*(\d+)' ;for $i = 0 to 123 step 1 $output ='for (int $1 $3 $5; $1 < $6; $1 += $7) {' addParser($Pattern,$output) $Pattern='if\s+[$](\w+)\s+=\s+(\d+)\s+then' ; if $i = 0 then $output ='if ( $1 == $2 ){' addParser($Pattern,$output) $pattern='[$](\w+)\s*=\s*(\d+[.]\d+)([\S+ ]*)' ; $i = 0.5 $output='float $1 = $2$3;'&@CRLF addParser($Pattern,$output) $pattern='[$](\w+)\s*=\s*(\d+)([\S+ ]*)' ; $i = 123 $output='int $1 = $2$3;'&@CRLF addParser($Pattern,$output) $pattern='[$](\w+)\s*=\s*(("|'&"'"&')([\w+\s+\W+])+("|'&"'"&'))' ; $i = "Occhio lol" $output='char $1[] = $2;'&@CRLF addParser($Pattern,$output) $pattern='(next|endif)' ; $i = "Occhio lol" $output='};' addParser($Pattern,$output) $pattern='[$]([\w+_]*\s*=[\S+ ]+)' $output='$1;' addParser($Pattern,$output) $pattern='[$]([\w+_]*)' ;$varname $output='$1' addParser($Pattern,$output) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 802, 400, 192, 124) $Edit1 = GUICtrlCreateEdit("", 8, 8, 385, 185) GUICtrlSetData(-1, "Edit1") $Edit2 = GUICtrlCreateEdit("", 400, 8, 385, 185) GUICtrlSetData(-1, "Edit2") $list1 = GUICtrlCreateList("nhgbfdvds",1,200, 800,200) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "My_WM_COMMAND") #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WinSetTitle($Form1,"",$nMsg) WEnd for $i=0 to 123 Next func varDeclared($str) $st=StringRegExpReplace($str,$ParseVar[UBound($ParseVar)-1][0],$ParseVar[UBound($ParseVar)-1][1]) if not @error Then GUICtrlSetData($list1,$st&"|") EndIf EndFunc func varParse($str) GUICtrlSetData($list1,"") varDeclared($str) local $stri=$str for $i = 0 to ubound($ParseVar,1)-1 $stri = StringRegExpReplace($stri,$ParseVar[$i][0],$ParseVar[$i][1]) Next $stre = 'int main (void) {'&@crlf&@crlf $stru=@crlf &'return 0;'&@crlf&'}' Return $stre&$stri&$stru EndFunc func parse($string) $stri=StringReplace($string,"func","Function") $expForInt='for\s*[$](\w+)(\s+|\s?)(=)(\s+|\s?)(\d+)\s*to\s*(\d+)\s*step\s*(\d+)'; for $i = 0 to 123 step 1 $exp1='[$](\w+)(\s+|\s?)(=)(\s+|\s?)(\d+[.]\d+)' ;$i = 0.54 $expIfVarEqInt='if\s+[$](\w+)\s+=\s+(\d+)\s+then' ; if $i = 0 then $expIfNotVarEqInt='if\s+not\s+[$](\w+)\s+=\s+(\d+)\s+then' ; if not $i = 0 then $expIfVarOpInt='if\s+[$](\w+)\s+(<|>|>=|<=)\s+(\d+)\s+then' ;if $i <= 0 then $stri=StringRegExpReplace($string,$expIfVarEqInt,'if ( $1 == $2 ){') $stri=StringRegExpReplace($stri,$expIfVarOpInt,'if ( $1 $2 $3 ){') $stri=StringRegExpReplace($stri,$expIfNotVarEqInt,'if ( $1 != $2 ){') $stri=StringRegExpReplace($stri,$expForInt,'for (int $1 $3 $5; $1 < $6; $1 += $7) {') $stri=StringRegExpReplace($stri,$exp1,'float $1 $3 $5;') $stri=StringRegExpReplace($stri,'[$](\w+)(\s+|\s?)(=)(\s+|\s?)(\d+)','int $1 $3 $5;') $stri=StringReplace($stri,'next','};');Forloopend $stri=StringReplace($stri,'endif','};');Endif return $stri EndFunc Func My_WM_COMMAND($hWnd, $imsg, $iwParam, $ilParam) Local $setHK = False $nNotifyCode = BitShift($iwParam, 16) $nID = BitAND($iwParam, 0x0000FFFF) $hCtrl = $ilParam If $nNotifyCode = $EN_CHANGE Then If $hCtrl = GUICtrlGetHandle($edit1) Then If GUICtrlRead($edit1) <> "" Then GUICtrlSetData($edit2, varParse(GUICtrlRead($edit1))) EndIf EndIf EndIf Return $GUI_RUNDEFMSG EndFunc ;==>My_WM_COMMAND this is a really bad scratch but essentially it turn actually basic autoit code to c syntax i really want to improve that remember that c "mustdeclarevar" working example: $io = 0 --> int io = 0; $string="Hola" ---> char string[]= "Hola"; $flo = 0.5 --> float flo = 0.5; if $i = 10 then --> if ( i == 10 ){ endif or Next --> }; for $i = 0 to 100 step 1 --> for (int i = 0; i < 100; i += 1) {
×
×
  • Create New...