Update implicit-convert.uc

Update implicit-convert.uc

rvalue expressions passed to a ByRef arg now use lvalue template (defined in pbmisc.h)

# implicit-convert.uc - uCalc Transformation file
# This file was saved with uCalc Transform 2.96 on 5/29/2014 4:02:47 PM
# Comment: Handles implicit data type conversions

ExternalKeywords: Exclude, Comment, Selected, ParentChild, FindMode, InputFile, OutputFile, BatchAction, SEND
ExternalKeywords: Highlight, ForeColor, BackColor, FontName, FontSize, FontStyle
ExternalKeywords: FilterEndText, FilterSeparator, FilterSort, FilterSortFunc, FilterStartText, FilterUnique, FilterTally

FindMode: Replace

# Definitions

# Search Criteria

Criteria: 0
Enabled: False
Exclude: False
Comment: Handles implicit data type conversions
Selected: False
Highlight: True
ForeColor: ControlText
BackColor: Aqua
FontName:
FontSize:
FontStyle:
CaseSensitive: False
QuoteSensitive: False
CodeBlockSensitive: True
FilterEndText:
FilterSeparator: {#10}
FilterSort: False
FilterSortFunc:
FilterStartText:
FilterUnique: False
FilterTally: False
Min: 0
Max: -1
MinSoft: 0
MaxSoft: -1
BatchAction: Transform
InputFile:
OutputFile:
SEND:
StartAfter: 0
StopAfter: -1
SkipOver: False
ParentChild: 0
Pass: 0
PassOnce: True
Precedence: 0
RightToLeft: False

Criteria: 1
Enabled: True
Highlight: False
Find:
Replace: {@Eval:
            Dim Size As Table = {
               "Byte", 1, "Word", 2, "Integer", 2, "Long", 4, "Dword", 4,
               "Single", 4, "Double", 8, "Extended", 10
            }
         }
         {@Define:
            Var: Def As String
            Var: Args As String
            Var: Before As String
            Var: After As String
            Var: UDT As Table
            Var: Size
            Var: Final
            Var: Variables As Table
            SyntaxArgL: {number} = {number:"([0-9]*\.)?[0-9]+(e[-+]?[0-9]+)?"}
         }
         {@Define:: Token: _.*\n ~~ Properties: ucWhitespace }

Criteria: 2
Comment: Inserts data type names in front of variabls and functions
Pass: 1

Criteria: 3
Enabled: True
Highlight: False
Find: {nl}[Declare] { Function | Sub } {name~:1} [Alias {alias}] ([{args%}]) [As {ftype:1=void}]
Replace: {@Exec:
            Args = Remove("{args}", "{ Optional | ByVal | Ptr | () | {' *_.*\n *'} }")
            Before = Replace(Args, "[ByRef] {arg:1} As {type:1}", "{{arg}%}")
            After = Replace(Args, "ByRef {arg:1} As {type:1}", "ByRef({arg} As {type})")
            After = Replace(After, "{arg:1} As {type:1}", "##{type}({{arg}})")

            Def  = "Pass: 1 ~~ Syntax: {name}("+Before+")"
            Def += " ::= `{ftype}({name}(" + After + "))"
         }{@Define:: {@Eval: Def}}{Self}

Criteria: 4
Enabled: True
Highlight: False
Find: { Global | Local | Static | Dim | , | { ByVal | ByRef } } {var:1}[([{size}])] As {type:1}
Replace: {Self}{@Execute: Insert(Variables, {var})
         }{@Define:: Pass: 1 ~~ Syntax: {var} ::= `{type}({var})
         }{@Define:: Pass: 1 ~~ Syntax: {var}([{i%}]) ::= `{type}({var}({i}))}

Criteria: 5
Enabled: True
Highlight: False
Find: {number}
Replace: {@Eval: IIf(Int({number})=={number}, "`Long({number})", "`Extended({number})")}

Criteria: 6
Enabled: True
Highlight: False
BackColor: RoyalBlue
Find: {q}{text}{q}
Replace: `StringLit({Self})

Criteria: 7
Enabled: True
Highlight: False
BackColor: Pink
Find: {func: Asc|InStr|Len|UBound|VarPtr|StrPtr|Ceil|Int } ({args%})
Replace: `Long({func}({args}))

Criteria: 8
Enabled: True
Find: {func: Sin|Cos|Tan|Atn|Exp|Exp2|Exp10|Log|Log2|Log10|Abs } ({args%})
Replace: `Extended({func}({args}))

Criteria: 9
Enabled: True
Highlight: False
BackColor: SlateBlue
Find: {func:
         Mid|Left|Right|Remove|Extract|Space|Hex|Oct|Bin|Dir|Min|Max|
         Remain|UCase|LCase|Trim|LTrim|RTrim|Choose|Repeat|Dir|CurDir
      }$({args%})
Replace: `String({func}$({args}))

Criteria: 10
Enabled: True
Find: {nl}${equate:1}
Replace: {Self}{@Define:: Pass: 1 ~~ Syntax: ${equate} ::= `String(${equate})}

Criteria: 11
Enabled: True
Find: {nl}$${equate:1}
Replace: {Self}{@Define:: Pass: 1 ~~ Syntax: $${equate} ::= `WString($${equate})}

Criteria: 12
Enabled: True
Find: {nl}%{equate:1}
Replace: {Self}{@Define:: Pass: 1 ~~ Syntax: %{equate} ::= `Long(%{equate})}

Criteria: 13
Enabled: True
Highlight: False
BackColor: Purple
SkipOver: True
Find: {nl} { Type | Union }
         {members+}
      End {TypeOrUnion}
Replace: [Skip over]

Criteria: 14
Enabled: True
BackColor: Khaki
SkipOver: True
Find: {nl}{ # | ! | ASM } {etc} {@Note: Skips metastatements, ASM}
Replace: [Skip over]

Criteria: 15
Enabled: True
SkipOver: True
Find: ' {Comment:".*"}
Replace: [Skip over]

Criteria: 16
Comment: Convert
Pass: 2

Criteria: 17
Enabled: True
BackColor: Violet
PassOnce: False
Find: ##Asciiz(string({arg}))
Replace: `Asciiz({arg}.c_str())

Criteria: 18
Enabled: True
Find: `StringLit({arg})
Replace: `String({arg})

Criteria: 19
Enabled: True
PassOnce: False
Find: `StringLit({arg})+`StringLit({arg})
Replace: `String(string({arg})+{arg})

Criteria: 20
Enabled: True
BackColor: CornflowerBlue
PassOnce: False
Find: `WString({arg}) + `String({arg})
Replace: `WString({arg}) + `WString(string({arg}))

Criteria: 21
Enabled: True
Find: Len({other})
Replace: sizeof({other})

Criteria: 22
Enabled: True
BackColor: SandyBrown
PassOnce: False
Find: Len(`String({arg}))
Replace: string({arg}).length()

Criteria: 23
Enabled: True
BackColor: Gold
PassOnce: False
Find: Len(`LPCSTR({arg}))
Replace: `Long(strlen({arg}))

Criteria: 24
Enabled: True
PassOnce: False
Find: `{ Extended | Ext }
Replace: `Double

Criteria: 25
Enabled: True
SkipOver: True
Find: ' {Comment:".*"}
Replace: [Skip over]

Criteria: 26
Comment: Highlights the inserted data type names
Pass: 3

Criteria: 27
Enabled: True
Find: {@Start}
      {@Note:
         The use of Final is due to a limitation where immediate expansion in
         {arg%} expands all passes causing the undesirable change in pass 3
         before it is needed.
      }
Replace: {@Exec: Final = True}

Criteria: 28
Enabled: True
PassOnce: False
Find: ByRef(##{RequiredType}({arg}))  {@If: Final}
Replace: lvalue({RequiredType}({arg}))

Criteria: 29
Enabled: True
Selected: True
PassOnce: False
Find: ByRef(##{RequiredType}(`{ActualType}({scalar:1}[()])))
      {@If: Final == True And Index(Variables, {scalar}) <> 0}
Replace: {scalar}

Criteria: 30
Enabled: True
PassOnce: False
Find: ByRef(##{RequiredType}(`{ActualType}({array:1}({index}))))
      {@If: Final == True And Index(Variables, {array}) <> 0}
Replace: {array}({index})

Criteria: 31
Enabled: True
PassOnce: False
Find: { ` | ## }{type:1}({arg}) {@If: Final}
Replace: {arg}

Criteria: 32
Enabled: False
BackColor: Red
Find: ##{type:1}
Replace: {Self}

Criteria: 33
Enabled: False
Comment: This line is there to provide highlighting for clarity
Find: `{type:1}
Replace: {Self}

# End Search

# implicit-convert.uc - uCalc Transformation file
# This file was saved with uCalc Transform 2.96 on 5/28/2014 8:18:23 AM
# Comment: Handles implicit data type conversions

ExternalKeywords: Exclude, Comment, Selected, ParentChild, FindMode, InputFile, OutputFile, BatchAction, SEND
ExternalKeywords: Highlight, ForeColor, BackColor, FontName, FontSize, FontStyle
ExternalKeywords: FilterEndText, FilterSeparator, FilterSort, FilterSortFunc, FilterStartText, FilterUnique, FilterTally

FindMode: Replace

# Definitions

# Search Criteria

Criteria: 0
Enabled: False
Exclude: False
Comment: Handles implicit data type conversions
Selected: False
Highlight: True
ForeColor: ControlText
BackColor: Aqua
FontName:
FontSize:
FontStyle:
CaseSensitive: False
QuoteSensitive: False
CodeBlockSensitive: True
FilterEndText:
FilterSeparator: {#10}
FilterSort: False
FilterSortFunc:
FilterStartText:
FilterUnique: False
FilterTally: False
Min: 0
Max: -1
MinSoft: 0
MaxSoft: -1
BatchAction: Transform
InputFile:
OutputFile:
SEND:
StartAfter: 0
StopAfter: -1
SkipOver: False
ParentChild: 0
Pass: 0
PassOnce: True
Precedence: 0
RightToLeft: False

Criteria: 1
Enabled: True
Highlight: False
Find:
Replace: {@Eval:
            Dim Size As Table = {
               "Byte", 1, "Word", 2, "Integer", 2, "Long", 4, "Dword", 4,
               "Single", 4, "Double", 8, "Extended", 10
            }
         }
         {@Define:
            Var: Def As String
            Var: Args As String
            Var: Before As String
            Var: After As String
            Var: UDT As Table
            Var: Size
            Var: Final
            SyntaxArgL: {number} = {number:"([0-9]*\.)?[0-9]+(e[-+]?[0-9]+)?"}
         }
         {@Define:: Token: _.*\n ~~ Properties: ucWhitespace }

Criteria: 2
Comment: Inserts data type names in front of variabls and functions
Pass: 1

Criteria: 3
Enabled: True
Highlight: False
Find: {nl}[Declare] { Function | Sub } {name~:1} [Alias {alias}] ([{args%}]) [As {ftype:1=void}]
Replace: {@Exec:
            Args = Remove("{args}", "{ Optional | ByVal | ByRef | Ptr | () | {' *_.*\n *'} }")
            Before = Replace(Args, "{arg:1} As {type:1}", "{{arg}%}")
            After = Replace(Args, "{arg:1} As {type:1}", "##{type}({{arg}})")

            Def  = "Pass: 1 ~~ Syntax: {name}("+Before+")"
            Def += " ::= `{ftype}({name}(" + After + "))"
         }{@Define:: {@Eval: Def}}{Self}

Criteria: 4
Enabled: True
Selected: True
Highlight: False
Find: { Global | Local | Static | Dim | , | { ByVal | ByRef } } {var:1}[([{size}])] As {type:1}
Replace: {Self}{@Define:: Pass: 1 ~~ Syntax: {var}[({i%})] ::= `{type}({var}{i:({i})})}

Criteria: 5
Enabled: True
Highlight: False
Find: {number}
Replace: `Double({number})

Criteria: 6
Enabled: True
Highlight: False
BackColor: RoyalBlue
Find: {q}{text}{q}
Replace: `StringLit({Self})

Criteria: 7
Enabled: True
Highlight: False
BackColor: Pink
Find: {func: Asc|InStr|Len|UBound|VarPtr|StrPtr|Dir|CurDir } ({args%})
Replace: `Long({func}({args}))

Criteria: 8
Enabled: True
Highlight: False
BackColor: SlateBlue
Find: {func:
         Mid|Left|Right|Remove|Extract|Space|Hex|Oct|Bin|Dir|Min|Max|
         Remain|UCase|LCase|Trim|LTrim|RTrim|Choose|Repeat
      }$({args%})
Replace: `String({func}$({args}))

Criteria: 9
Enabled: True
Find: {nl}${equate:1}
Replace: {Self}{@Define:: Pass: 1 ~~ Syntax: ${equate} ::= `String(${equate})}

Criteria: 10
Enabled: True
Find: {nl}$${equate:1}
Replace: {Self}{@Define:: Pass: 1 ~~ Syntax: $${equate} ::= `WString($${equate})}

Criteria: 11
Enabled: True
Find: {nl}%{equate:1}
Replace: {Self}{@Define:: Pass: 1 ~~ Syntax: %{equate} ::= `Long(%{equate})}

Criteria: 12
Enabled: True
Highlight: False
BackColor: Purple
SkipOver: True
Find: {nl} { Type | Union }
         {members+}
      End {TypeOrUnion}
Replace: [Skip over]

Criteria: 13
Enabled: True
BackColor: Khaki
SkipOver: True
Find: {nl}{ # | ! | ASM } {etc} {@Note: Skips metastatements, ASM}
Replace: [Skip over]

Criteria: 14
Enabled: True
SkipOver: True
Find: ' {Comment:".*"}
Replace: [Skip over]

Criteria: 15
Comment: Convert
Pass: 2

Criteria: 16
Enabled: True
BackColor: Violet
PassOnce: False
Find: ##Asciiz(string({arg}))
Replace: `Asciiz({arg}.c_str())

Criteria: 17
Enabled: True
Find: `StringLit({arg})
Replace: `String({arg})

Criteria: 18
Enabled: True
PassOnce: False
Find: `StringLit({arg})+`StringLit({arg})
Replace: `String(string({arg})+{arg})

Criteria: 19
Enabled: True
BackColor: CornflowerBlue
PassOnce: False
Find: `WString({arg}) + `String({arg})
Replace: `WString({arg}) + `WString(string({arg}))

Criteria: 20
Enabled: True
Find: Len({other})
Replace: sizeof({other})

Criteria: 21
Enabled: True
BackColor: SandyBrown
PassOnce: False
Find: Len(`String({arg}))
Replace: string({arg}).length()

Criteria: 22
Enabled: True
BackColor: Gold
PassOnce: False
Find: Len(`LPCSTR({arg}))
Replace: `Long(strlen({arg}))

Criteria: 23
Enabled: True
PassOnce: False
Find: `{ Extended | Ext }
Replace: `Double

Criteria: 24
Enabled: True
SkipOver: True
Find: ' {Comment:".*"}
Replace: [Skip over]

Criteria: 25
Comment: Highlights the inserted data type names
Pass: 3

Criteria: 26
Enabled: True
Find: {@Start}
      {@Note:
         The use of Final is due to a limitation where immediate expansion in
         {arg%} expands with all passes causing the undesirable change in pass 3
         before it is needed.
      }
Replace: {@Exec: Final = True}

Criteria: 27
Enabled: False
BackColor: Red
Find: ##{type:1}
Replace: {Self}

Criteria: 28
Enabled: False
Comment: This line is there to provide highlighting for clarity
Find: `{type:1}
Replace: {Self}

Criteria: 29
Enabled: True
PassOnce: False
Find: { ` | ## }{type:1}({arg}) {@If: Final}
Replace: {arg}

# End Search


Update pb-to-cpp.uc

Update pb-to-cpp.uc

Updated PRINT (still more work on this to do)

# pb-to-cpp.uc - uCalc Transformation file
# This file was saved with uCalc Transform 2.95 on 4/7/2014 6:58:30 PM
# Comment: Converts PB source code to C++; modified by Daniel Corbier

ExternalKeywords: Exclude, Comment, Selected, ParentChild, FindMode, InputFile, OutputFile, BatchAction, SEND
ExternalKeywords: Highlight, ForeColor, BackColor, FontName, FontSize, FontStyle
ExternalKeywords: FilterEndText, FilterSeparator, FilterSort, FilterSortFunc, FilterStartText, FilterUnique, FilterTally

FindMode: Replace

# Definitions

# Search Criteria

Criteria: 0
Enabled: True
Exclude: False
Comment: Converts PB source code to C++; modified by Daniel Corbier
Selected: False
Highlight: False
ForeColor: ControlText
BackColor: Aqua
FontName:
FontSize:
FontStyle:
CaseSensitive: False
QuoteSensitive: True
CodeBlockSensitive: True
FilterEndText:
FilterSeparator: {#10}
FilterSort: False
FilterSortFunc:
FilterStartText:
FilterUnique: False
FilterTally: False
Min: 0
Max: -1
MinSoft: 0
MaxSoft: -1
BatchAction: Transform
InputFile:
OutputFile:
SEND:
StartAfter: 0
StopAfter: -1
SkipOver: False
ParentChild: 0
Pass: 0
PassOnce: True
Precedence: 0
RightToLeft: False

Criteria: 1
Highlight: True
Find: {@Start}
Replace: // This file ({@Eval: Extract(ShortName(InputFile), ".")}.cpp) was converted from {@Eval: Extract(ShortName(InputFile), ".")}.Bas
         // with {@Eval: AppName} on {@Eval: TimeStamp()} using the Open Source
         // PowerBASIC to C++ converter found at https://github.com/uCalc/powerbasic-to-cpp

         #include "pbOS.h"
         #include "pbMisc.h"
         #include <cstdarg>
         {@Define:
            Var: BitType As String
         }{@Define::
            Token: \xFF[^\xFF]*\xFF\n ~~ Properties: ucWhiteSpace
         }

Criteria: 2
Comment: Handles long line break (underscore _)
Pass: 1

Criteria: 3
Highlight: True
PassOnce: False
Find: {nl}{line} _ [{" +"}] [{comment:".+"}]{nl}

Replace: {nl}{line} {#255}{comment}{#255}{nl}

Criteria: 4
Highlight: True
SkipOver: True
Find: {"[\(\)]"} {@Note: These are ( and ); must be skipped}
Replace: [Skip over]

Criteria: 5
Highlight: True
SkipOver: True
Find: ' [{comment:".*"}]
Replace: [Skip over]

Criteria: 6
Comment: Functions, Subs, =
Pass: 2

Criteria: 7
Highlight: True
Find: =
Replace: ==

Criteria: 8
SkipOver: True
Find: { + | - | * | / | % | & | ^ | ! }=
Replace: [Skip over]

Criteria: 9
Highlight: True
SkipOver: True
Find: { {nl}[{ %|$ }]|Then|Else|For|: } {var:" *[a-z\@\.\_]+"}[({index})] =
Replace: [Skip over]

Criteria: 10
Highlight: True
SkipOver: True
Find: { { #If | #ElseIf } Not | ' [{comment:".*"}] }
Replace: [Skip over]

Criteria: 11
Highlight: True
SkipOver: True
Find: Macro {name}[({params})] =
Replace: [Skip over]

Criteria: 12
Highlight: True
PassOnce: False
Find: Sub {name:1} [Alias {alias}]([{args}])[{exp: Export}] [{comment:" *'.*"}] {nl}
         {code+}
      End Sub
Replace: {exp:extern "C" __declspec(dllexport)} void {exp:__stdcall} {name}({args}) { {comment}
            {code}
         }

Criteria: 13
Highlight: True
BackColor: DarkKhaki
PassOnce: False
Find: Function {name:1} [Alias {alias}]([{args}])[{exp: Export}] As {type}[{comment:" *'.*"}]{nl}
         {code+}
      End Function
Replace: {exp:extern "C" __declspec(dllexport)} {type} {exp:__stdcall} {name}({args}) { {comment}
            {code}
         }

Criteria: 14
Highlight: True
PassOnce: False
Find: Function PBMain [()] [As Long]
Replace: Function main() As Long

Criteria: 15
Highlight: True
PassOnce: False
Find: Declare Function {name:1} [Lib {lib}] [Alias {alias}]
      [([{args}])] As {type}
Replace: {lib: extern __declspec(dllimport)} {type} {name}({args})

Criteria: 16
Highlight: True
Find: Declare Sub {name:1} [Lib {lib}] [Alias {alias}]
      [([{args}])]
Replace: {lib: extern __declspec(dllimport)} void {name}({args})

Criteria: 17
Highlight: True
Find: Static
Replace: static dim

Criteria: 18
Comment: Misc
Pass: 3

Criteria: 19
Highlight: True
SkipOver: True
Find: // [{comment:".*"}]
Replace: [Skip over]

Criteria: 20
Highlight: True
Find: ' [{comment:".*"}]
Replace: //{comment}

Criteria: 21
Highlight: True
BackColor: Green
PassOnce: False
Find: {nl}{ {num: %} | {str: $} }{equate} = {value}
Replace: {nl}const{num: int}{str: string} {equate} = {value};

Criteria: 22
Highlight: True
BackColor: Green
Find: { % | $ }{equate:"[a-z]+"}
Replace: {equate}

Criteria: 23
Highlight: True
BackColor: SandyBrown
Find: {"&h"}
Replace: 0x

Criteria: 24
Highlight: True
BackColor: Green
PassOnce: False
Find: If {cond} Then {statement} [Else {else}]{nl}
Replace: if ({cond}) {{statement}{nl}}{else: else {{else}{nl}}}{nl}

Criteria: 25
Highlight: True
PassOnce: False
Find: If {cond} Then [{comment:" *'.*"}] {nl}
         {code+}
      End If
Replace: if ({cond}) { {comment}
            {code}
         }

Criteria: 26
Find: {nl}Else
Replace: {nl} } else {

Criteria: 27
Find: {nl}ElseIf {cond} Then
Replace: {nl} } else if ({cond}) {

Criteria: 28
Highlight: True
PassOnce: False
Find: For {x} = {start} To {stop} [Step {inc=1}]{nl}
         {code+}
      Next
Replace: for ({x}={start}; {x}{@Eval: IIF(sgn({inc})>0, '<', '>')}={stop}; {x} += {inc}) {
            {code}
         }

Criteria: 29
Highlight: True
PassOnce: False
Find: While {cond} {nl}
         {code+}
      Wend
Replace: while ({cond}) {
            {code}
         }

Criteria: 30
Highlight: True
PassOnce: False
Find: Do { {while: While} | {until: Until} } {cond} {nl}
         {code+}
      Loop
Replace: while ({while: {cond}}{until:!({cond})}) {
            {code}
         }

Criteria: 31
Highlight: True
PassOnce: False
Find: Do{nl}
         {code+}
      Loop { {while: While} | {until: Until} } {cond}
Replace: do {
            {code}
         } while ({while: {cond}}{until:!({cond})})

Criteria: 32
Highlight: True
BackColor: Orange
PassOnce: False
Find: { Dim | {member: {nl}}} {var:1} As {type} [{ptr: Ptr}]
Replace: {member: {nl}}{type} {ptr:*}{var};

Criteria: 33
Highlight: True
PassOnce: False
Find: {nl} {bitfield:1} As Bit * {size} [{in: In {type}}]
Replace: {nl}{@Eval:
            IIf("{type}" <> "", SetVar(BitType, "{type}"))
            BitType
         } {bitfield} : {size};

Criteria: 34
Highlight: True
PassOnce: False
Find: Dim {array}([{size}]) As {type}
Replace: std::vector<{type}> {array}{size: ({size}+1)};{@Define::
             Syntax: {array}([{sz}]) ::= {array}[{sz}]}

Criteria: 35
Find: Erase {array:1}[()]
Replace: {array}.clear();

Criteria: 36
PassOnce: False
Find: ReDim {array}({size}) [As {type}] [{more: , {etc}}]
Replace: {array}.clear();
         {array}.resize({size}+1); {more: {nl} ReDim {etc}}

Criteria: 37
PassOnce: False
Find: ReDim Preserve {array}({size}) [As {type}] [{more: , {etc}}]
Replace: {array}.resize({size}+1); {more: {nl} ReDim Preserve {etc}}

Criteria: 38
Find: UBound({array})
Replace: ({array}.size()-1)

Criteria: 39
Highlight: True
BackColor: SandyBrown
PassOnce: False
Find: Dim {var1}, {more}
Replace: Dim {var1}
         Dim {more}

Criteria: 40
Highlight: True
BackColor: Gold
PassOnce: False
Find: { Local | Global | Register }
Replace: Dim

Criteria: 41
Highlight: True
Find: @
Replace: *

Criteria: 42
Highlight: True
BackColor: Silver
Find: VarPtr({var})
Replace: &{var}

Criteria: 43
Highlight: True
BackColor: DeepSkyBlue
PassOnce: False
Find: Function = {value}
Replace: return {value}

Criteria: 44
Find: Iterate
Replace: continue

Criteria: 45
Find: Exit
Replace: break

Criteria: 46
Highlight: True
Find: Exit Sub
Replace: return

Criteria: 47
Highlight: True
BackColor: Lime
Find: Long
Replace: int

Criteria: 48
Highlight: True
BackColor: Red
Find: Single
Replace: float

Criteria: 49
Find: Double
Replace: double

Criteria: 50
Highlight: True
Find: Byte
Replace: unsigned char

Criteria: 51
Highlight: True
Find: Integer
Replace: short

Criteria: 52
Highlight: True
Find: Word
Replace: unsigned short

Criteria: 53
Highlight: True
Find: Dword
Replace: unsigned int

Criteria: 54
Find: AsciiZ
Replace: LPCSTR

Criteria: 55
Highlight: True
Find: Quad
Replace: __int64

Criteria: 56
SkipOver: True
Find: long double
Replace: [Skip over]

Criteria: 57
Highlight: True
Find: { Extended | Ext }
Replace: long double

Criteria: 58
Highlight: True
BackColor: SlateBlue
PassOnce: False
Find: ByRef {arg} As {type:1}
Replace: {type}& {arg}

Criteria: 59
PassOnce: False
Find: ByRef {array}() As {type:1}
Replace: {type} {array}[]{@Define::
            Syntax: {array}([{index}]) ::= {array}[{index}]
         }

Criteria: 60
Highlight: True
BackColor: Pink
PassOnce: False
Find: ByVal {arg} As {type:1} [{ptr: Ptr}]
Replace: {type} {ptr:*}{arg}

Criteria: 61
Highlight: True
PassOnce: False
Find: Type {name:1}
         {members+}
      End Type
Replace: struct {name} {
            {members}
         }

Criteria: 62
Highlight: True
Find: Macro {name} [{params: ({paramlist})}] = {replacement}
Replace: #define {name}{params} {replacement}

Criteria: 63
Highlight: True
Find: #ElseIf
Replace: #elif

Criteria: 64
Find: #{directive: If | Else | EndIf }
Replace: #{@Eval: LCase("{directive}", "{'.*'}")}

Criteria: 65
Highlight: True
PassOnce: False
Find: [{NOT: Not }] %Def({const})
Replace: {NOT:!}defined {const}

Criteria: 66
Find: Choose[&]({index}, {choice})
Replace: IIf({index}, {choice}, 0)

Criteria: 67
Find: Choose$({index}, {choice})
Replace: IIf({index}, {choice}, "")

Criteria: 68
PassOnce: False
Find: Choose[{type: $ | & }]({index}, {choice1}, {more})
Replace: IIf({index}, {choice1}, Choose{type}({index}, {more}))

Criteria: 69
Find: StdOut {text} { {sameline: ;} | {NewLine: } }
Replace: cout << {text} {NewLine: << endl;}

Criteria: 70
Find: Sleep {milliseconds}
Replace: PB_SLEEP({milliseconds})

Criteria: 71
Find: {keyword:"CV(BYT|DWD|D|E|I|L|Q|S|WRD)"}({string} [, {offset=1}])
Replace: PB_{@Eval:UCase("{keyword}", "{'.*'}")}({string}, {offset})

Criteria: 72
PassOnce: False
Find: Line Input [{prompt: {q}{str}{q} | ${equate:1}}][,] {StrVariable:1}
Replace: {prompt: cout << {prompt};}getline(cin, {StrVariable});

Criteria: 73
PassOnce: False
Find: cout << {data}, [{more}]
Replace: cout << PZONE << {data}{more: {nl}cout << {more}}

Criteria: 74
Find: cout << { {nl} | : }
Replace: cout << endl;

Criteria: 75
PassOnce: False
Find: Print
Replace: cout <<

Criteria: 76
Comment: Adds semi-colons to statements
Pass: 4

Criteria: 77
Highlight: True
SkipOver: True
Find: { "{" | "}" | ; | //[{".*"}] | #{".*"} } {nl} [{"[ \n]+"}]
Replace: [Skip over]

Criteria: 78
Comment: Skips over so that colons in bit fields are not affected
Highlight: True
SkipOver: True
Find: struct {name:1} "{" {members+} "}"
Replace: [Skip over]

Criteria: 79
SkipOver: True
Find: ({cond} ? {this} :
Replace: [Skip over]

Criteria: 80
Highlight: True
Find: :
Replace: ;

Criteria: 81
SkipOver: True
Find: ::
Replace: [Skip over]

Criteria: 82
Highlight: True
PassOnce: False
Find: {nl}
Replace: ;{nl}

Criteria: 83
PassOnce: False
Find: IIf[$]({cond}, {this}, {that})
Replace: ({cond} ? {this} : {that})

Criteria: 84
Find: _char([{char= }])
Replace: '{char}'

Criteria: 85
Find: {" \xFF\xFF\n"}
Replace: {nl}

Criteria: 86
Find: {" \xFF"}{comment:"[^\xFF]+"}{"\xFF\n"}
Replace:  /* {comment} */{nl}

# End Search

# pb-to-cpp.uc - uCalc Transformation file
# This file was saved with uCalc Transform 2.95 on 4/4/2014 6:00:07 PM
# Comment: Converts PB source code to C++; modified by Daniel Corbier

ExternalKeywords: Exclude, Comment, Selected, ParentChild, FindMode, InputFile, OutputFile, BatchAction, SEND
ExternalKeywords: Highlight, ForeColor, BackColor, FontName, FontSize, FontStyle
ExternalKeywords: FilterEndText, FilterSeparator, FilterSort, FilterSortFunc, FilterStartText, FilterUnique, FilterTally

FindMode: Replace

# Definitions

# Search Criteria

Criteria: 0
Enabled: True
Exclude: False
Comment: Converts PB source code to C++; modified by Daniel Corbier
Selected: False
Highlight: False
ForeColor: ControlText
BackColor: Aqua
FontName:
FontSize:
FontStyle:
CaseSensitive: False
QuoteSensitive: True
CodeBlockSensitive: True
FilterEndText:
FilterSeparator: {#10}
FilterSort: False
FilterSortFunc:
FilterStartText:
FilterUnique: False
FilterTally: False
Min: 0
Max: -1
MinSoft: 0
MaxSoft: -1
BatchAction: Transform
InputFile:
OutputFile:
SEND:
StartAfter: 0
StopAfter: -1
SkipOver: False
ParentChild: 0
Pass: 0
PassOnce: True
Precedence: 0
RightToLeft: False

Criteria: 1
Highlight: True
PassOnce: False
Find: {@Start}
Replace: // This file ({@Eval: Extract(ShortName(InputFile), ".")}.cpp) was converted from {@Eval: Extract(ShortName(InputFile), ".")}.Bas
         // with {@Eval: AppName} on {@Eval: TimeStamp()} using the Open Source
         // PowerBASIC to C++ converter found at https://github.com/uCalc/powerbasic-to-cpp

         #include "pbOS.h"
         #include "pbMisc.h"
         #include <cstdarg>
         {@Define:
            Var: BitType As String
         }{@Define::
            Token: \xFF[^\xFF]*\xFF\n ~~ Properties: ucWhiteSpace
         }

Criteria: 2
Comment: Handles long line break (underscore _)
Pass: 1

Criteria: 3
Highlight: True
PassOnce: False
Find: {nl}{line} _ [{" +"}] [{comment:".+"}]{nl}

Replace: {nl}{line} {#255}{comment}{#255}{nl}

Criteria: 4
Highlight: True
SkipOver: True
Find: {"[\(\)]"} {@Note: These are ( and ); must be skipped}
Replace: [Skip over]

Criteria: 5
Highlight: True
SkipOver: True
Find: ' [{comment:".*"}]
Replace: [Skip over]

Criteria: 6
Comment: Functions, Subs, =
Pass: 2

Criteria: 7
Highlight: True
Find: =
Replace: ==

Criteria: 8
SkipOver: True
Find: { + | - | * | / | % | & | ^ | ! }=
Replace: [Skip over]

Criteria: 9
Highlight: True
SkipOver: True
Find: { {nl}[{ %|$ }]|Then|Else|For|: } {var:" *[a-z\@\.\_]+"}[({index})] =
Replace: [Skip over]

Criteria: 10
Highlight: True
SkipOver: True
Find: { { #If | #ElseIf } Not | ' [{comment:".*"}] }
Replace: [Skip over]

Criteria: 11
Highlight: True
SkipOver: True
Find: Macro {name}[({params})] =
Replace: [Skip over]

Criteria: 12
Highlight: True
PassOnce: False
Find: Sub {name:1} [Alias {alias}]([{args}])[{exp: Export}] [{comment:" *'.*"}] {nl}
         {code+}
      End Sub
Replace: {exp:extern "C" __declspec(dllexport)} void {exp:__stdcall} {name}({args}) { {comment}
            {code}
         }

Criteria: 13
Highlight: True
BackColor: DarkKhaki
PassOnce: False
Find: Function {name:1} [Alias {alias}]([{args}])[{exp: Export}] As {type}[{comment:" *'.*"}]{nl}
         {code+}
      End Function
Replace: {exp:extern "C" __declspec(dllexport)} {type} {exp:__stdcall} {name}({args}) { {comment}
            {code}
         }

Criteria: 14
Highlight: True
PassOnce: False
Find: Function PBMain [()] [As Long]
Replace: Function main() As Long

Criteria: 15
Highlight: True
PassOnce: False
Find: Declare Function {name:1} [Lib {lib}] [Alias {alias}]
      [([{args}])] As {type}
Replace: {lib: extern __declspec(dllimport)} {type} {name}({args})

Criteria: 16
Highlight: True
Find: Declare Sub {name:1} [Lib {lib}] [Alias {alias}]
      [([{args}])]
Replace: {lib: extern __declspec(dllimport)} void {name}({args})

Criteria: 17
Highlight: True
Find: Static
Replace: static dim

Criteria: 18
Comment: Misc
Pass: 3

Criteria: 19
Highlight: True
SkipOver: True
Find: // [{comment:".*"}]
Replace: [Skip over]

Criteria: 20
Highlight: True
Find: ' [{comment:".*"}]
Replace: //{comment}

Criteria: 21
Highlight: True
BackColor: Green
PassOnce: False
Find: {nl}{ {num: %} | {str: $} }{equate} = {value}
Replace: {nl}const{num: int}{str: string} {equate} = {value};

Criteria: 22
Highlight: True
BackColor: Green
Find: { % | $ }{equate:"[a-z]+"}
Replace: {equate}

Criteria: 23
Highlight: True
BackColor: SandyBrown
Find: {"&h"}
Replace: 0x

Criteria: 24
Highlight: True
BackColor: Green
PassOnce: False
Find: If {cond} Then {statement} [Else {else}]{nl}
Replace: if ({cond}) {{statement}{nl}}{else: else {{else}{nl}}}{nl}

Criteria: 25
Highlight: True
PassOnce: False
Find: If {cond} Then [{comment:" *'.*"}] {nl}
         {code+}
      End If
Replace: if ({cond}) { {comment}
            {code}
         }

Criteria: 26
Find: {nl}Else
Replace: {nl} } else {

Criteria: 27
Find: {nl}ElseIf {cond} Then
Replace: {nl} } else if ({cond}) {

Criteria: 28
Highlight: True
PassOnce: False
Find: For {x} = {start} To {stop} [Step {inc=1}]{nl}
         {code+}
      Next
Replace: for ({x}={start}; {x}{@Eval: IIF(sgn({inc})>0, '<', '>')}={stop}; {x} += {inc}) {
            {code}
         }

Criteria: 29
Highlight: True
PassOnce: False
Find: While {cond} {nl}
         {code+}
      Wend
Replace: while ({cond}) {
            {code}
         }

Criteria: 30
Highlight: True
PassOnce: False
Find: Do { {while: While} | {until: Until} } {cond} {nl}
         {code+}
      Loop
Replace: while ({while: {cond}}{until:!({cond})}) {
            {code}
         }

Criteria: 31
Highlight: True
PassOnce: False
Find: Do{nl}
         {code+}
      Loop { {while: While} | {until: Until} } {cond}
Replace: do {
            {code}
         } while ({while: {cond}}{until:!({cond})})

Criteria: 32
Highlight: True
BackColor: Orange
PassOnce: False
Find: { Dim | {member: {nl}}} {var:1} As {type} [{ptr: Ptr}]
Replace: {member: {nl}}{type} {ptr:*}{var};

Criteria: 33
Highlight: True
PassOnce: False
Find: {nl} {bitfield:1} As Bit * {size} [{in: In {type}}]
Replace: {nl}{@Eval:
            IIf("{type}" <> "", SetVar(BitType, "{type}"))
            BitType
         } {bitfield} : {size};

Criteria: 34
Highlight: True
PassOnce: False
Find: Dim {array}([{size}]) As {type}
Replace: std::vector<{type}> {array}{size: ({size}+1)};{@Define::
             Syntax: {array}([{sz}]) ::= {array}[{sz}]}

Criteria: 35
Find: Erase {array:1}[()]
Replace: {array}.clear();

Criteria: 36
PassOnce: False
Find: ReDim {array}({size}) [As {type}] [{more: , {etc}}]
Replace: {array}.clear();
         {array}.resize({size}+1); {more: {nl} ReDim {etc}}

Criteria: 37
PassOnce: False
Find: ReDim Preserve {array}({size}) [As {type}] [{more: , {etc}}]
Replace: {array}.resize({size}+1); {more: {nl} ReDim Preserve {etc}}

Criteria: 38
Find: UBound({array})
Replace: ({array}.size()-1)

Criteria: 39
Highlight: True
BackColor: SandyBrown
PassOnce: False
Find: Dim {var1}, {more}
Replace: Dim {var1}
         Dim {more}

Criteria: 40
Highlight: True
BackColor: Gold
PassOnce: False
Find: { Local | Global | Register }
Replace: Dim

Criteria: 41
Highlight: True
Find: @
Replace: *

Criteria: 42
Highlight: True
BackColor: Silver
Find: VarPtr({var})
Replace: &{var}

Criteria: 43
Highlight: True
BackColor: DeepSkyBlue
PassOnce: False
Find: Function = {value}
Replace: return {value}

Criteria: 44
Find: Iterate
Replace: continue

Criteria: 45
Find: Exit
Replace: break

Criteria: 46
Highlight: True
Find: Exit Sub
Replace: return

Criteria: 47
Highlight: True
BackColor: Lime
Find: Long
Replace: int

Criteria: 48
Highlight: True
BackColor: Red
Find: Single
Replace: float

Criteria: 49
Find: Double
Replace: double

Criteria: 50
Highlight: True
Find: Byte
Replace: unsigned char

Criteria: 51
Highlight: True
Find: Integer
Replace: short

Criteria: 52
Highlight: True
Find: Word
Replace: unsigned short

Criteria: 53
Highlight: True
Find: Dword
Replace: unsigned int

Criteria: 54
Find: AsciiZ
Replace: LPCSTR

Criteria: 55
Highlight: True
Find: Quad
Replace: __int64

Criteria: 56
SkipOver: True
Find: long double
Replace: [Skip over]

Criteria: 57
Highlight: True
Find: { Extended | Ext }
Replace: long double

Criteria: 58
Highlight: True
BackColor: SlateBlue
PassOnce: False
Find: ByRef {arg} As {type:1}
Replace: {type}& {arg}

Criteria: 59
PassOnce: False
Find: ByRef {array}() As {type:1}
Replace: {type} {array}[]{@Define::
            Syntax: {array}([{index}]) ::= {array}[{index}]
         }

Criteria: 60
Highlight: True
BackColor: Pink
PassOnce: False
Find: ByVal {arg} As {type:1} [{ptr: Ptr}]
Replace: {type} {ptr:*}{arg}

Criteria: 61
Highlight: True
PassOnce: False
Find: Type {name:1}
         {members+}
      End Type
Replace: struct {name} {
            {members}
         }

Criteria: 62
Highlight: True
Find: Macro {name} [{params: ({paramlist})}] = {replacement}
Replace: #define {name}{params} {replacement}

Criteria: 63
Highlight: True
Find: #ElseIf
Replace: #elif

Criteria: 64
Find: #{directive: If | Else | EndIf }
Replace: #{@Eval: LCase("{directive}", "{'.*'}")}

Criteria: 65
Highlight: True
PassOnce: False
Find: [{NOT: Not }] %Def({const})
Replace: {NOT:!}defined {const}

Criteria: 66
Find: Choose[&]({index}, {choice})
Replace: IIf({index}, {choice}, 0)

Criteria: 67
Find: Choose$({index}, {choice})
Replace: IIf({index}, {choice}, "")

Criteria: 68
PassOnce: False
Find: Choose[{type: $ | & }]({index}, {choice1}, {more})
Replace: IIf({index}, {choice1}, Choose{type}({index}, {more}))

Criteria: 69
Find: StdOut {text} { {sameline: ;} | {NewLine: } }
Replace: cout << {text} {NewLine: << endl;}

Criteria: 70
Find: Sleep {milliseconds}
Replace: PB_SLEEP({milliseconds})

Criteria: 71
Find: {keyword:"CV(BYT|DWD|D|E|I|L|Q|S|WRD)"}({string} [, {offset=1}])
Replace: PB_{@Eval:UCase("{keyword}", "{'.*'}")}({string}, {offset})

Criteria: 72
PassOnce: False
Find: Line Input [{prompt: {q}{str}{q} | ${equate:1}}][,] {StrVariable:1}
Replace: {prompt: cout << {prompt};}getline(cin, {StrVariable});

Criteria: 73
PassOnce: False
Find: cout << {data},
Replace: cout << left << setw(14) << {data}

Criteria: 74
PassOnce: False
Find: cout << { {nl} | : }
Replace: cout << endl;

Criteria: 75
Selected: True
Find: Print
Replace: cout <<

Criteria: 76
Comment: Adds semi-colons to statements
Pass: 4

Criteria: 77
Highlight: True
SkipOver: True
Find: { "{" | "}" | ; | //[{".*"}] | #{".*"} } {nl} [{"[ \n]+"}]
Replace: [Skip over]

Criteria: 78
Comment: Skips over so that colons in bit fields are not affected
Highlight: True
SkipOver: True
Find: struct {name:1} "{" {members+} "}"
Replace: [Skip over]

Criteria: 79
SkipOver: True
Find: ({cond} ? {this} :
Replace: [Skip over]

Criteria: 80
Highlight: True
Find: :
Replace: ;

Criteria: 81
SkipOver: True
Find: ::
Replace: [Skip over]

Criteria: 82
Highlight: True
PassOnce: False
Find: {nl}
Replace: ;{nl}

Criteria: 83
PassOnce: False
Find: IIf[$]({cond}, {this}, {that})
Replace: ({cond} ? {this} : {that})

Criteria: 84
Find: _char([{char= }])
Replace: '{char}'

Criteria: 85
Find: {" \xFF\xFF\n"}
Replace: {nl}

Criteria: 86
Find: {" \xFF"}{comment:"[^\xFF]+"}{"\xFF\n"}
Replace:  /* {comment} */{nl}

# End Search


Fix small compile error

Fix small compile error

//---------------------------------------------------------------------------------------
//  FILE:    CHXComGameVersion.uc
//  AUTHOR:  X2CommunityCore
//  PURPOSE: Version information for the Community Highlander.
//
//  Issue #1
//
//  Creates a template to hold the version number info for the Community Highlander
//  XComGame replacement. This version is incremented separately to the Long War
//  Game Version to express our own releases to mods depending on them.
//
//---------------------------------------------------------------------------------------
class CHXComGameVersion extends X2StrategyElement;

static function array<X2DataTemplate> CreateTemplates()
{
	local array<X2DataTemplate> Templates;
	local CHXComGameVersionTemplate XComGameVersion;
	class'X2TacticalGameRuleset'.static.ReleaseScriptLog("X2WOTCCommunityHighlander: Creating CHXCOMGameVersionTemplate...");
	`CREATE_X2TEMPLATE(class'CHXComGameVersionTemplate', XComGameVersion, 'CHXComGameVersion');
	class'X2TacticalGameRuleset'.static.ReleaseScriptLog("X2WOTCCommunityHighlander: Created CHXCOMGameVersionTemplate with version" @ XComGameVersion.MajorVersion $ "." $ XComGameVersion.MinorVersion $ "." $ XComGameVersion.PatchVersion);
	Templates.AddItem(XComGameVersion);

	return Templates;
}

//---------------------------------------------------------------------------------------
//  FILE:    CHXComGameVersion.uc
//  AUTHOR:  X2CommunityCore
//  PURPOSE: Version information for the Community Highlander.
//
//  Issue #1
//
//  Creates a template to hold the version number info for the Community Highlander
//  XComGame replacement. This version is incremented separately to the Long War
//  Game Version to express our own releases to mods depending on them.
//
//---------------------------------------------------------------------------------------
class CHXComGameVersion extends X2StrategyElement;

static function array<X2DataTemplate> CreateTemplates()
{
	local array<X2DataTemplate> Templates;
	local CHXComGameVersionTemplate XComGameVersion;
	class'X2TacticalGameRuleset'.static.ReleaseScriptLog("X2WOTCCommunityHighlander: Creating CHXCOMGameVersionTemplate...");
	`CREATE_X2TEMPLATE(class'CHXComGameVersionTemplate', XComGameVersion, 'CHXComGameVersion');
	class'X2TacticalGameRuleset'.static.ReleaseScriptLog("X2WOTCCommunityHighlander: "Created CHXCOMGameVersionTemplate with version" @ XComGameVersion.MajorVersion $ "." $ XComGameVersion.MinorVersion $ "." $ XComGameVersion.PatchVersion");
	Templates.AddItem(XComGameVersion);

	return Templates;
}


Update pb-to-cpp.uc

Update pb-to-cpp.uc

Vector elements are now initialized with a default value

# pb-to-cpp.uc - uCalc Transformation file
# This file was saved with uCalc Transform 2.96 on 6/10/2014 7:16:26 PM
# Comment: Converts PB source code to C++; modified by Daniel Corbier

ExternalKeywords: Exclude, Comment, Selected, ParentChild, FindMode, InputFile, OutputFile, BatchAction, SEND
ExternalKeywords: Highlight, ForeColor, BackColor, FontName, FontSize, FontStyle
ExternalKeywords: FilterEndText, FilterSeparator, FilterSort, FilterSortFunc, FilterStartText, FilterUnique, FilterTally

FindMode: Replace

# Definitions

# Search Criteria

Criteria: 0
Enabled: True
Exclude: False
Comment: Converts PB source code to C++; modified by Daniel Corbier
Selected: False
Highlight: False
ForeColor: ControlText
BackColor: Aqua
FontName:
FontSize:
FontStyle:
CaseSensitive: False
QuoteSensitive: True
CodeBlockSensitive: True
FilterEndText:
FilterSeparator: {#10}
FilterSort: False
FilterSortFunc:
FilterStartText:
FilterUnique: False
FilterTally: False
Min: 0
Max: -1
MinSoft: 0
MaxSoft: -1
BatchAction: Transform
InputFile:
OutputFile:
SEND:
StartAfter: 0
StopAfter: -1
SkipOver: False
ParentChild: 0
Pass: 0
PassOnce: True
Precedence: 0
RightToLeft: False

Criteria: 1
PassOnce: False
Find:
Replace: {@Exec: Dim IsPrototype = 1, Case1, UDT, BitType As String }
         {@Define:: Token: \xFF[^\xFF]*\xFF\n ~~ Properties: ucWhiteSpace }

Criteria: 2
Highlight: True
Find: {@Start}
Replace: ' This file ({@Eval: Extract(ShortName(InputFile), ".")}.cpp) was converted from {@Eval: Extract(ShortName(InputFile), ".")}.Bas
         ' with {@Eval: AppName} on {@Eval: TimeStamp("MM/dd/yy")} using the Open Source
         ' PowerBASIC to C++ converter found at https://github.com/uCalc/powerbasic-to-cpp

         ' Standard lib headers used by PB to C++ are in sdtafx.h & pre-compiled
         #include "stdafx.h"

         using namespace std;{nl}{nl}

         #include "pbOS.h"
         #include "pbMisc.h"
         #include "pbstrings.h"

Criteria: 3
Comment: Renames words that conflict w/ C++ keywords
Pass: 1

Criteria: 4
Find: { auto|bitand|bitor|bool|break|char|compl|constexpr|
      continue|default|delete|explicit|extern|false|float|
      friend|inline|mutable|new|nullptr|operator|private|
      protected|public|short|signed|struct|template|this|
      throw|true|typename|unsigned|virtual|void|volatile }
      {@If: {@Self} == LCase({@Self})}
Replace: {Self}_Renamed

Criteria: 5
SkipOver: True
Find: { { ' | _ } {Comment:".*"} | %TRUE | %FALSE }
Replace: [Skip over]

Criteria: 6
Comment: Handles long line break (underscore _)
Pass: 2

Criteria: 7
Highlight: True
PassOnce: False
Find: {nl}{line} _ [{" +"}] [{comment:".+"}]{nl}

Replace: {nl}{line} {#255}{comment}{#255}{nl}

Criteria: 8
Highlight: True
SkipOver: True
Find: {"[\(\)]"} {@Note: These are ( and ); must be skipped}
Replace: [Skip over]

Criteria: 9
Highlight: True
SkipOver: True
Find: ' [{comment:".*"}]
Replace: [Skip over]

Criteria: 10
Comment: Functions, Subs, =
Pass: 3

Criteria: 11
Highlight: True
Find: =
Replace: ==

Criteria: 12
SkipOver: True
Find: { + | - | * | / | % | & | ^ | ! | _ReturnValue }=
Replace: [Skip over]

Criteria: 13
Highlight: True
SkipOver: True
Find: { {nl} [{ %|$[$] }]|Then|Else|For|: }{var:" *[a-z0-9\@\.\_]+"}[({index})] =
Replace: [Skip over]

Criteria: 14
Highlight: True
SkipOver: True
Find: { { #If | #ElseIf } Not | ' [{comment:".*"}] }
Replace: [Skip over]

Criteria: 15
Highlight: True
SkipOver: True
Find: Macro {name}[({params})] =
Replace: [Skip over]

Criteria: 16
Highlight: True
PassOnce: False
Find: Sub {name:1} [Alias {alias}]([{args}])[{exp: Export}] [{comment:" *'.*"}] {nl}
Replace: {exp:extern "C" __declspec(dllexport)} void {exp:__stdcall }{name}({args}) { {comment}

Criteria: 17
Highlight: True
BackColor: DarkKhaki
PassOnce: False
Find: Function {name:1} [Alias {alias}]([{args}])[{exp: Export}] As {type}[{comment:" *'.*"}]{nl}
Replace: {exp:extern "C" __declspec(dllexport)} {type} {exp:__stdcall }{name}({args}) { {comment}
         {type} _ReturnValue = {type}()
         {@Define:: Syntax: {name} = ::= _ReturnValue =}

Criteria: 18
Highlight: True
PassOnce: False
Find: Function PBMain [()] [As Long]
Replace: Function main() As Long

Criteria: 19
Highlight: True
PassOnce: False
Find: Declare Function {name:1} [Lib {lib}] [Alias {alias}]
      [([{args}])] [{exp: Export}] As {type}
Replace: {exp:extern "C" __declspec(dllexport)}{lib: extern __declspec(dllimport)} {type} {exp:__stdcall }{name}({args})

Criteria: 20
Highlight: True
Find: Declare Sub {name:1} [Lib {lib}] [Alias {alias}]
      [([{args}])] [{exp: Export}]
Replace: {exp:extern "C" __declspec(dllexport)}{lib: extern __declspec(dllimport)} void {exp:__stdcall }{name}({args})

Criteria: 21
Find: {nl}End Function
Replace: {nl}{nl}return _ReturnValue
         End Function

Criteria: 22
Highlight: True
Find: Static
Replace: static dim

Criteria: 23
Comment: For type member access (temp stage)
Find: {typevar:"@*[a-z_][a-z_0-9@]+\.[a-z_0-9@\.]+"}
Replace: `{typevar}`

Criteria: 24
Comment: Misc
Pass: 4

Criteria: 25
Highlight: True
SkipOver: True
Find: // [{comment:".*"}]
Replace: [Skip over]

Criteria: 26
Highlight: True
Find: ' [{comment:".*"}]
Replace: //{comment}

Criteria: 27
Highlight: True
BackColor: Green
PassOnce: False
Find: {nl}{ {num: %}|{wstr: $$}|{str: $} }{equate} = {value}
Replace: {nl}const{num: int}{str: string}{wstr: wstring} {equate} = {value}

Criteria: 28
Highlight: True
BackColor: Green
Find: { % | $[$] }{equate:"[a-z]+"}
Replace: {equate}

Criteria: 29
Highlight: True
BackColor: SandyBrown
Find: {"&h"}
Replace: 0x

Criteria: 30
Comment: Single-line IF
Highlight: True
BackColor: Green
PassOnce: False
Find: If {cond} Then {statement} [Else {else}]{nl}
Replace: if ({cond}) {{statement}{nl}}{else: else {{else}{nl}}}{nl}

Criteria: 31
Comment: Multi-line IF
Highlight: True
PassOnce: False
Find: If {cond} Then [{comment:" *'.*"}] {nl}
Replace: if ({cond}) { {comment}{nl}

Criteria: 32
Find: {nl}Else
Replace: {nl} } else {

Criteria: 33
Find: {nl}ElseIf {cond} Then
Replace: {nl} } else if ({cond}) {

Criteria: 34
Highlight: True
PassOnce: False
Find: For {x} = {start} To {stop} [Step {inc=1}][{comment:" *'.*"}]
Replace: for ({x}={start}; {x}{@Eval: IIF(sgn({inc})>0, '<', '>')}={stop}; {x} += {inc}) { {comment}

Criteria: 35
Highlight: True
PassOnce: False
Find: {nl}While {cond} [{comment:" *'.*"}] {nl}
Replace: {nl}while ({cond}) { {comment} {nl}

Criteria: 36
Highlight: True
PassOnce: False
Find: Do { {while: While} | {until: Until} } {cond} [{comment:" *'.*"}]{nl}
Replace: while ({while: {cond}}{until:!({cond})}) { {comment}

Criteria: 37
Find: { End { Sub|Function|If } | Wend | Next | Loop }
Replace: }

Criteria: 38
Find: Do{nl}
Replace: do {

Criteria: 39
Highlight: True
PassOnce: False
Find: Loop { {while: While} | {until: Until} } {cond} [{comment:" *'.*"}]
Replace: } while ({while: {cond}}{until:!({cond})}) {comment}

Criteria: 40
Find: Select Case [As] [Long | Const | Const$] {expr} {nl}
Replace: { auto CASE_VAR = {expr}
         {@Execute: Case1 = 1}

Criteria: 41
Find: Case [IS] {test%} [:] [' {comment:".*"}]
Replace: {@Evaluate:
            IIf(Case1==1, Case1=0; "", "} else")
         } if (CASE_VAR == {test}) {{comment: // {comment}}

Criteria: 42
PassOnce: False
Find: Case [IS] {item}, {more}
Replace: Case {item} || CASE_VAR = {more}

Criteria: 43
Find: Case Else
Replace: } else {

Criteria: 44
Find: End Select
Replace: }}

Criteria: 45
Find: Type {name:1}
Replace: struct {name} {

Criteria: 46
Find: Union {name:1}
Replace: union {name} {

Criteria: 47
Find: End { Type | Union }
Replace: };

Criteria: 48
Highlight: True
BackColor: Orange
PassOnce: False
Find: { Dim | {member: {nl}}} {var:1} As {type:1} [{ptr: Ptr}]
Replace: {member: {nl}}{type} {ptr:*}{var}{@Eval:
         IIf("{member}{ptr}" == "", " = {type}()")};

Criteria: 49
Highlight: True
Find: {nl} {bitfield:1} As Bit * {size:1} [In {type%:1}]
Replace: {nl}{@Eval:
            IIf("{type}" <> "", SetVar(BitType, "{type}"))
            BitType
         } {bitfield} : {size};

Criteria: 50
Selected: True
Highlight: True
PassOnce: False
Find: Dim {array}([{size}]) As {type}
Replace: std::vector<{type}> {array}{size: ({size}+1, {type}())};{@Define::Pass: 6 ~~ Syntax: {array}({sz}) ::= {array}[{sz}]}{@Define::Pass: 6 ~~ Syntax: {array}() ::= {array}}

Criteria: 51
Find: Erase {array:1}[()]
Replace: {array}.clear();

Criteria: 52
PassOnce: False
Find: ReDim {array}({size}) [As {type}] [{more: , {etc}}]
Replace: {array}.clear();
         {array}.resize({size}+1); {more: {nl} ReDim {etc}}

Criteria: 53
PassOnce: False
Find: ReDim Preserve {array}({size}) [As {type}] [{more: , {etc}}]
Replace: {array}.resize({size}+1); {more: {nl} ReDim Preserve {etc}}

Criteria: 54
Find: UBound({array})
Replace: ({array}.size()-1)

Criteria: 55
Highlight: True
BackColor: SandyBrown
PassOnce: False
Find: Dim {var1}, {more}
Replace: Dim {var1}
         Dim {more}

Criteria: 56
Highlight: True
BackColor: Gold
PassOnce: False
Find: { Local | Global | Register }
Replace: Dim

Criteria: 57
Find: `{typevar}.@{last:1}`
Replace: *`{typevar}.{last}`

Criteria: 58
Highlight: True
BackColor: Silver
Find: VarPtr({var})
Replace: &{var}

Criteria: 59
Find: Iterate
Replace: continue

Criteria: 60
Find: Exit
Replace: break

Criteria: 61
Highlight: True
Find: Exit Sub
Replace: return

Criteria: 62
Find: Exit Function
Replace: return _ReturnValue

Criteria: 63
Highlight: True
BackColor: DeepSkyBlue
PassOnce: False
Find: Function =
Replace: _ReturnValue =

Criteria: 64
Highlight: True
BackColor: Lime
Find: Long
Replace: int

Criteria: 65
Highlight: True
BackColor: Red
Find: Single
Replace: float

Criteria: 66
Find: Double
Replace: double

Criteria: 67
Highlight: True
Find: Byte
Replace: UCHAR

Criteria: 68
Highlight: True
Find: Integer
Replace: short

Criteria: 69
Highlight: True
Find: Word
Replace: USHORT

Criteria: 70
Highlight: True
Find: Dword
Replace: unsigned

Criteria: 71
Find: AsciiZ
Replace: LPCSTR

Criteria: 72
Highlight: True
Find: Quad
Replace: __int64

Criteria: 73
SkipOver: True
Find: EXTENDED
Replace: [Skip over]

Criteria: 74
Highlight: True
Find: { Extended | Ext }
Replace: EXTENDED

Criteria: 75
Highlight: True
BackColor: SlateBlue
PassOnce: False
Find: ByRef {arg} As {type:1}
Replace: {type}& {arg}

Criteria: 76
PassOnce: False
Find: ByRef {array}() As {type:1}
Replace: std::vector<{type}>& {array}{@Define::
            Syntax: {array}({index}) ::= {array}[{index}]
            Syntax: {array}() ::= {array}
         }

Criteria: 77
Highlight: True
BackColor: Pink
PassOnce: False
Find: ByVal {arg} As {type:1} [{ptr: Ptr}]
Replace: {type} {ptr:*}{arg}

Criteria: 78
Highlight: True
Find: Macro {name} [{params: ({paramlist})}] = {replacement%}
Replace: #define {name}{params} {replacement}

Criteria: 79
Highlight: True
Find: #ElseIf
Replace: #elif

Criteria: 80
Find: #{directive: If | Else | EndIf }
Replace: #{@Eval: LCase("{directive}", "{'.*'}")}

Criteria: 81
Highlight: True
PassOnce: False
Find: [{NOT: Not }] %Def({const})
Replace: {NOT:!}defined {const}

Criteria: 82
PassOnce: False
Find: Choose[&]({index}, {choice})
Replace: IIf({index}, {choice}, 0)

Criteria: 83
PassOnce: False
Find: Choose$({index}, {choice})
Replace: IIf({index}, {choice}, "")

Criteria: 84
PassOnce: False
Find: Choose[{type: $ | & }]({index}, {choice1}, {more})
Replace: IIf({index}, {choice1}, Choose{type}({index}, {more}))

Criteria: 85
Find: StdOut {text} { {sameline: ;} | {NewLine: } }
Replace: cout << {text} {NewLine: << endl;}

Criteria: 86
Find: Sleep {milliseconds}
Replace: PB_SLEEP({milliseconds})

Criteria: 87
Find: {keyword:"CV(BYT|DWD|D|E|I|L|Q|S|WRD)"}({string} [, {offset=1}])
Replace: PB_{@Eval:UCase("{keyword}", "{'.*'}")}({string}, {offset})

Criteria: 88
PassOnce: False
Find: Line Input [{prompt: {q}{str}{q} | ${equate:1}}][,] {StrVariable:1}
Replace: {prompt: cout << {prompt};}getline(cin, {StrVariable});

Criteria: 89
Find: IIf[$]({cond%}, {this%}, {that%})
Replace: ({cond} ? {this} : {that})

Criteria: 90
Find: PB_ASC({q}{char}{q}, {n:" *[0-9]+"})
Replace: '{@Eval:Mid("{char}", {n}, 1, ucChar)}'

Criteria: 91
Find: _char([{char= }])
Replace: '{char}'

Criteria: 92
Highlight: True
Find: :
Replace: ;{nl}

Criteria: 93
SkipOver: True
Find: ::
Replace: [Skip over]

Criteria: 94
Find: Swap {a}, {b}
Replace: swap({a}, {b})

Criteria: 95
Comment: Adds semi-colons to statements, etc
Pass: 5

Criteria: 96
Find: {@Start}
Replace: {@Define:: Token: [\x7b\x7d\;]}

Criteria: 97
Find: {nl} {code} [{comment:" *//.*"}] {delim-: {nl}}
Replace: {nl}{code};{comment}

Criteria: 98
SkipOver: True
Find: {nl} [{code}] { ; | "{" | "}" } [// {".*"}] {delim-: {nl}}
Replace: [Skip over]

Criteria: 99
SkipOver: True
Find: {nl} { # | // } [{".*"}]
Replace: [Skip over]

Criteria: 100
Comment: Nested UDTs - 1st pass (gather members)
Pass: 6

Criteria: 101
Find: {nl} struct {name} "{" {members+} "}";
Replace: {Self}{@Eval: Dim {name} As String = {Q}{members}{Q}}

Criteria: 102
Find: {nl} union {name} "{" {members+} "}";
Replace: {Self}{@Eval: Dim {name} As String = {Q}union{{members}};{Q}}

Criteria: 103
Comment: Nested UDTs - 2nd pass (insert members)
Pass: 7

Criteria: 104
Find: {nl} { struct | union }
Replace: {Self}{@Eval: UDT = True}

Criteria: 105
PassOnce: False
Find: {nl}{nested:1}; {@If: UDT}
Replace: {@Eval: {nested}}

Criteria: 106
SkipOver: True
Find: {nl}{type:1} {member};
Replace: [Skip over]

Criteria: 107
Find: {nl} "}";
Replace: {Self}{@Eval: UDT = False}

Criteria: 108
Comment: Adds default values in function prototypes for optional parameters
Pass: 8

Criteria: 109
PassOnce: False
Find: Optional {type:1}[{ptr: *}]{arg:1} [{more: , [Optional] {etc}}]
Replace: {type} {ptr}{arg} = {@Eval:
            IIf("{ptr}" <> "", "NULL",
            IIf(InStr("{type}", "{ float|double|EXTENDED }"), "0.0",
            IIf(InStr("{type}", "{ UCHAR|short|USHORT|int|unsigned }"), "0",
            Chr(34, 34))))
         }{more: , Optional {etc}}

Criteria: 110
Find: Optional {@If: IsPrototype==0}
Replace: {Nothing}

Criteria: 111
SkipOver: True
Find: // {Comment:".*"}
Replace: [Skip over]

Criteria: 112
Find: {nl}// End of prototypes
Replace: {Self}{@Exec: IsPrototype = 0}

Criteria: 113
Comment: Misc
Pass: 9

Criteria: 114
SkipOver: True
Find: { // {comment:".*"} | /* {commentB~} */ }
Replace: [Skip over]

Criteria: 115
Find: {" \xFF\xFF\n"}
Replace: {nl}

Criteria: 116
Find: {" \xFF"}{comment:"[^\xFF]+"}{"\xFF\n"}
Replace:  /* {comment} */{nl}

Criteria: 117
Find: @
Replace: *

Criteria: 118
Highlight: True
Find: @{pointer:1}.
Replace: {pointer}->

Criteria: 119
Find: `{@Comment: removes temp char for type member access}
Replace: {Nothing}

Criteria: 120
Find: std::vector<{type}> {name:1} "["{size}"]"
Replace: std::vector<{type}>{name}({size})

Criteria: 121
Find: #IncludeStart {file}.inc
         {code+}
      #IncludeEnd {etc}
Replace: // #Include "{file}.inc"

# End Search

# pb-to-cpp.uc - uCalc Transformation file
# This file was saved with uCalc Transform 2.96 on 6/9/2014 6:01:05 PM
# Comment: Converts PB source code to C++; modified by Daniel Corbier

ExternalKeywords: Exclude, Comment, Selected, ParentChild, FindMode, InputFile, OutputFile, BatchAction, SEND
ExternalKeywords: Highlight, ForeColor, BackColor, FontName, FontSize, FontStyle
ExternalKeywords: FilterEndText, FilterSeparator, FilterSort, FilterSortFunc, FilterStartText, FilterUnique, FilterTally

FindMode: Replace

# Definitions

# Search Criteria

Criteria: 0
Enabled: True
Exclude: False
Comment: Converts PB source code to C++; modified by Daniel Corbier
Selected: False
Highlight: False
ForeColor: ControlText
BackColor: Aqua
FontName:
FontSize:
FontStyle:
CaseSensitive: False
QuoteSensitive: True
CodeBlockSensitive: True
FilterEndText:
FilterSeparator: {#10}
FilterSort: False
FilterSortFunc:
FilterStartText:
FilterUnique: False
FilterTally: False
Min: 0
Max: -1
MinSoft: 0
MaxSoft: -1
BatchAction: Transform
InputFile:
OutputFile:
SEND:
StartAfter: 0
StopAfter: -1
SkipOver: False
ParentChild: 0
Pass: 0
PassOnce: True
Precedence: 0
RightToLeft: False

Criteria: 1
PassOnce: False
Find:
Replace: {@Exec: Dim IsPrototype = 1, Case1, UDT, BitType As String }
         {@Define:: Token: \xFF[^\xFF]*\xFF\n ~~ Properties: ucWhiteSpace }

Criteria: 2
Highlight: True
Find: {@Start}
Replace: ' This file ({@Eval: Extract(ShortName(InputFile), ".")}.cpp) was converted from {@Eval: Extract(ShortName(InputFile), ".")}.Bas
         ' with {@Eval: AppName} on {@Eval: TimeStamp("MM/dd/yy")} using the Open Source
         ' PowerBASIC to C++ converter found at https://github.com/uCalc/powerbasic-to-cpp

         ' Standard lib headers used by PB to C++ are in sdtafx.h & pre-compiled
         #include "stdafx.h"

         using namespace std;{nl}{nl}

         #include "pbOS.h"
         #include "pbMisc.h"
         #include "pbstrings.h"

Criteria: 3
Comment: Renames words that conflict w/ C++ keywords
Pass: 1

Criteria: 4
Find: { auto|bitand|bitor|bool|break|char|compl|constexpr|
      continue|default|delete|explicit|extern|false|float|
      friend|inline|mutable|new|nullptr|operator|private|
      protected|public|short|signed|struct|template|this|
      throw|true|typename|unsigned|virtual|void|volatile }
      {@If: {@Self} == LCase({@Self})}
Replace: {Self}_Renamed

Criteria: 5
SkipOver: True
Find: { { ' | _ } {Comment:".*"} | %TRUE | %FALSE }
Replace: [Skip over]

Criteria: 6
Comment: Handles long line break (underscore _)
Pass: 2

Criteria: 7
Highlight: True
PassOnce: False
Find: {nl}{line} _ [{" +"}] [{comment:".+"}]{nl}

Replace: {nl}{line} {#255}{comment}{#255}{nl}

Criteria: 8
Highlight: True
SkipOver: True
Find: {"[\(\)]"} {@Note: These are ( and ); must be skipped}
Replace: [Skip over]

Criteria: 9
Highlight: True
SkipOver: True
Find: ' [{comment:".*"}]
Replace: [Skip over]

Criteria: 10
Comment: Functions, Subs, =
Pass: 3

Criteria: 11
Highlight: True
Find: =
Replace: ==

Criteria: 12
SkipOver: True
Find: { + | - | * | / | % | & | ^ | ! | _ReturnValue }=
Replace: [Skip over]

Criteria: 13
Highlight: True
SkipOver: True
Find: { {nl} [{ %|$[$] }]|Then|Else|For|: }{var:" *[a-z0-9\@\.\_]+"}[({index})] =
Replace: [Skip over]

Criteria: 14
Highlight: True
SkipOver: True
Find: { { #If | #ElseIf } Not | ' [{comment:".*"}] }
Replace: [Skip over]

Criteria: 15
Highlight: True
SkipOver: True
Find: Macro {name}[({params})] =
Replace: [Skip over]

Criteria: 16
Highlight: True
PassOnce: False
Find: Sub {name:1} [Alias {alias}]([{args}])[{exp: Export}] [{comment:" *'.*"}] {nl}
Replace: {exp:extern "C" __declspec(dllexport)} void {exp:__stdcall }{name}({args}) { {comment}

Criteria: 17
Highlight: True
BackColor: DarkKhaki
PassOnce: False
Find: Function {name:1} [Alias {alias}]([{args}])[{exp: Export}] As {type}[{comment:" *'.*"}]{nl}
Replace: {exp:extern "C" __declspec(dllexport)} {type} {exp:__stdcall }{name}({args}) { {comment}
         {type} _ReturnValue = {type}()
         {@Define:: Syntax: {name} = ::= _ReturnValue =}

Criteria: 18
Highlight: True
PassOnce: False
Find: Function PBMain [()] [As Long]
Replace: Function main() As Long

Criteria: 19
Highlight: True
PassOnce: False
Find: Declare Function {name:1} [Lib {lib}] [Alias {alias}]
      [([{args}])] [{exp: Export}] As {type}
Replace: {exp:extern "C" __declspec(dllexport)}{lib: extern __declspec(dllimport)} {type} {exp:__stdcall }{name}({args})

Criteria: 20
Highlight: True
Find: Declare Sub {name:1} [Lib {lib}] [Alias {alias}]
      [([{args}])] [{exp: Export}]
Replace: {exp:extern "C" __declspec(dllexport)}{lib: extern __declspec(dllimport)} void {exp:__stdcall }{name}({args})

Criteria: 21
Find: {nl}End Function
Replace: {nl}{nl}return _ReturnValue
         End Function

Criteria: 22
Highlight: True
Find: Static
Replace: static dim

Criteria: 23
Comment: For type member access (temp stage)
Find: {typevar:"@*[a-z_][a-z_0-9@]+\.[a-z_0-9@\.]+"}
Replace: `{typevar}`

Criteria: 24
Comment: Misc
Pass: 4

Criteria: 25
Highlight: True
SkipOver: True
Find: // [{comment:".*"}]
Replace: [Skip over]

Criteria: 26
Highlight: True
Find: ' [{comment:".*"}]
Replace: //{comment}

Criteria: 27
Highlight: True
BackColor: Green
PassOnce: False
Find: {nl}{ {num: %}|{wstr: $$}|{str: $} }{equate} = {value}
Replace: {nl}const{num: int}{str: string}{wstr: wstring} {equate} = {value}

Criteria: 28
Highlight: True
BackColor: Green
Find: { % | $[$] }{equate:"[a-z]+"}
Replace: {equate}

Criteria: 29
Highlight: True
BackColor: SandyBrown
Find: {"&h"}
Replace: 0x

Criteria: 30
Comment: Single-line IF
Highlight: True
BackColor: Green
PassOnce: False
Find: If {cond} Then {statement} [Else {else}]{nl}
Replace: if ({cond}) {{statement}{nl}}{else: else {{else}{nl}}}{nl}

Criteria: 31
Comment: Multi-line IF
Highlight: True
PassOnce: False
Find: If {cond} Then [{comment:" *'.*"}] {nl}
Replace: if ({cond}) { {comment}{nl}

Criteria: 32
Find: {nl}Else
Replace: {nl} } else {

Criteria: 33
Find: {nl}ElseIf {cond} Then
Replace: {nl} } else if ({cond}) {

Criteria: 34
Highlight: True
PassOnce: False
Find: For {x} = {start} To {stop} [Step {inc=1}][{comment:" *'.*"}]
Replace: for ({x}={start}; {x}{@Eval: IIF(sgn({inc})>0, '<', '>')}={stop}; {x} += {inc}) { {comment}

Criteria: 35
Highlight: True
PassOnce: False
Find: {nl}While {cond} [{comment:" *'.*"}] {nl}
Replace: {nl}while ({cond}) { {comment} {nl}

Criteria: 36
Highlight: True
PassOnce: False
Find: Do { {while: While} | {until: Until} } {cond} [{comment:" *'.*"}]{nl}
Replace: while ({while: {cond}}{until:!({cond})}) { {comment}

Criteria: 37
Find: { End { Sub|Function|If } | Wend | Next | Loop }
Replace: }

Criteria: 38
Find: Do{nl}
Replace: do {

Criteria: 39
Highlight: True
PassOnce: False
Find: Loop { {while: While} | {until: Until} } {cond} [{comment:" *'.*"}]
Replace: } while ({while: {cond}}{until:!({cond})}) {comment}

Criteria: 40
Find: Select Case [As] [Long | Const | Const$] {expr} {nl}
Replace: { auto CASE_VAR = {expr}
         {@Execute: Case1 = 1}

Criteria: 41
Find: Case [IS] {test%} [:] [' {comment:".*"}]
Replace: {@Evaluate:
            IIf(Case1==1, Case1=0; "", "} else")
         } if (CASE_VAR == {test}) {{comment: // {comment}}

Criteria: 42
PassOnce: False
Find: Case [IS] {item}, {more}
Replace: Case {item} || CASE_VAR = {more}

Criteria: 43
Find: Case Else
Replace: } else {

Criteria: 44
Find: End Select
Replace: }}

Criteria: 45
Find: Type {name:1}
Replace: struct {name} {

Criteria: 46
Find: Union {name:1}
Replace: union {name} {

Criteria: 47
Find: End { Type | Union }
Replace: };

Criteria: 48
Selected: True
Highlight: True
BackColor: Orange
PassOnce: False
Find: { Dim | {member: {nl}}} {var:1} As {type:1} [{ptr: Ptr}]
Replace: {member: {nl}}{type} {ptr:*}{var}{@Eval:
         IIf("{member}{ptr}" == "", " = {type}()")};

Criteria: 49
Highlight: True
Find: {nl} {bitfield:1} As Bit * {size:1} [In {type%:1}]
Replace: {nl}{@Eval:
            IIf("{type}" <> "", SetVar(BitType, "{type}"))
            BitType
         } {bitfield} : {size};

Criteria: 50
Highlight: True
PassOnce: False
Find: Dim {array}([{size}]) As {type}
Replace: std::vector<{type}> {array}{size: ({size}+1)};{@Define::Pass: 6 ~~ Syntax: {array}({sz}) ::= {array}[{sz}]}{@Define::Pass: 6 ~~ Syntax: {array}() ::= {array}}

Criteria: 51
Find: Erase {array:1}[()]
Replace: {array}.clear();

Criteria: 52
PassOnce: False
Find: ReDim {array}({size}) [As {type}] [{more: , {etc}}]
Replace: {array}.clear();
         {array}.resize({size}+1); {more: {nl} ReDim {etc}}

Criteria: 53
PassOnce: False
Find: ReDim Preserve {array}({size}) [As {type}] [{more: , {etc}}]
Replace: {array}.resize({size}+1); {more: {nl} ReDim Preserve {etc}}

Criteria: 54
Find: UBound({array})
Replace: ({array}.size()-1)

Criteria: 55
Highlight: True
BackColor: SandyBrown
PassOnce: False
Find: Dim {var1}, {more}
Replace: Dim {var1}
         Dim {more}

Criteria: 56
Highlight: True
BackColor: Gold
PassOnce: False
Find: { Local | Global | Register }
Replace: Dim

Criteria: 57
Find: `{typevar}.@{last:1}`
Replace: *`{typevar}.{last}`

Criteria: 58
Highlight: True
BackColor: Silver
Find: VarPtr({var})
Replace: &{var}

Criteria: 59
Find: Iterate
Replace: continue

Criteria: 60
Find: Exit
Replace: break

Criteria: 61
Highlight: True
Find: Exit Sub
Replace: return

Criteria: 62
Find: Exit Function
Replace: return _ReturnValue

Criteria: 63
Highlight: True
BackColor: DeepSkyBlue
PassOnce: False
Find: Function =
Replace: _ReturnValue =

Criteria: 64
Highlight: True
BackColor: Lime
Find: Long
Replace: int

Criteria: 65
Highlight: True
BackColor: Red
Find: Single
Replace: float

Criteria: 66
Find: Double
Replace: double

Criteria: 67
Highlight: True
Find: Byte
Replace: UCHAR

Criteria: 68
Highlight: True
Find: Integer
Replace: short

Criteria: 69
Highlight: True
Find: Word
Replace: USHORT

Criteria: 70
Highlight: True
Find: Dword
Replace: unsigned

Criteria: 71
Find: AsciiZ
Replace: LPCSTR

Criteria: 72
Highlight: True
Find: Quad
Replace: __int64

Criteria: 73
SkipOver: True
Find: EXTENDED
Replace: [Skip over]

Criteria: 74
Highlight: True
Find: { Extended | Ext }
Replace: EXTENDED

Criteria: 75
Highlight: True
BackColor: SlateBlue
PassOnce: False
Find: ByRef {arg} As {type:1}
Replace: {type}& {arg}

Criteria: 76
PassOnce: False
Find: ByRef {array}() As {type:1}
Replace: std::vector<{type}>& {array}{@Define::
            Syntax: {array}({index}) ::= {array}[{index}]
            Syntax: {array}() ::= {array}
         }

Criteria: 77
Highlight: True
BackColor: Pink
PassOnce: False
Find: ByVal {arg} As {type:1} [{ptr: Ptr}]
Replace: {type} {ptr:*}{arg}

Criteria: 78
Highlight: True
Find: Macro {name} [{params: ({paramlist})}] = {replacement%}
Replace: #define {name}{params} {replacement}

Criteria: 79
Highlight: True
Find: #ElseIf
Replace: #elif

Criteria: 80
Find: #{directive: If | Else | EndIf }
Replace: #{@Eval: LCase("{directive}", "{'.*'}")}

Criteria: 81
Highlight: True
PassOnce: False
Find: [{NOT: Not }] %Def({const})
Replace: {NOT:!}defined {const}

Criteria: 82
PassOnce: False
Find: Choose[&]({index}, {choice})
Replace: IIf({index}, {choice}, 0)

Criteria: 83
PassOnce: False
Find: Choose$({index}, {choice})
Replace: IIf({index}, {choice}, "")

Criteria: 84
PassOnce: False
Find: Choose[{type: $ | & }]({index}, {choice1}, {more})
Replace: IIf({index}, {choice1}, Choose{type}({index}, {more}))

Criteria: 85
Find: StdOut {text} { {sameline: ;} | {NewLine: } }
Replace: cout << {text} {NewLine: << endl;}

Criteria: 86
Find: Sleep {milliseconds}
Replace: PB_SLEEP({milliseconds})

Criteria: 87
Find: {keyword:"CV(BYT|DWD|D|E|I|L|Q|S|WRD)"}({string} [, {offset=1}])
Replace: PB_{@Eval:UCase("{keyword}", "{'.*'}")}({string}, {offset})

Criteria: 88
PassOnce: False
Find: Line Input [{prompt: {q}{str}{q} | ${equate:1}}][,] {StrVariable:1}
Replace: {prompt: cout << {prompt};}getline(cin, {StrVariable});

Criteria: 89
Find: IIf[$]({cond%}, {this%}, {that%})
Replace: ({cond} ? {this} : {that})

Criteria: 90
Find: PB_ASC({q}{char}{q}, {n:" *[0-9]+"})
Replace: '{@Eval:Mid("{char}", {n}, 1, ucChar)}'

Criteria: 91
Find: _char([{char= }])
Replace: '{char}'

Criteria: 92
Highlight: True
Find: :
Replace: ;{nl}

Criteria: 93
SkipOver: True
Find: ::
Replace: [Skip over]

Criteria: 94
Find: Swap {a}, {b}
Replace: swap({a}, {b})

Criteria: 95
Comment: Adds semi-colons to statements, etc
Pass: 5

Criteria: 96
Find: {@Start}
Replace: {@Define:: Token: [\x7b\x7d\;]}

Criteria: 97
Find: {nl} {code} [{comment:" *//.*"}] {delim-: {nl}}
Replace: {nl}{code};{comment}

Criteria: 98
SkipOver: True
Find: {nl} [{code}] { ; | "{" | "}" } [// {".*"}] {delim-: {nl}}
Replace: [Skip over]

Criteria: 99
SkipOver: True
Find: {nl} { # | // } [{".*"}]
Replace: [Skip over]

Criteria: 100
Comment: Nested UDTs - 1st pass (gather members)
Pass: 6

Criteria: 101
Find: {nl} struct {name} "{" {members+} "}";
Replace: {Self}{@Eval: Dim {name} As String = {Q}{members}{Q}}

Criteria: 102
Find: {nl} union {name} "{" {members+} "}";
Replace: {Self}{@Eval: Dim {name} As String = {Q}union{{members}};{Q}}

Criteria: 103
Comment: Nested UDTs - 2nd pass (insert members)
Pass: 7

Criteria: 104
Find: {nl} { struct | union }
Replace: {Self}{@Eval: UDT = True}

Criteria: 105
PassOnce: False
Find: {nl}{nested:1}; {@If: UDT}
Replace: {@Eval: {nested}}

Criteria: 106
SkipOver: True
Find: {nl}{type:1} {member};
Replace: [Skip over]

Criteria: 107
Find: {nl} "}";
Replace: {Self}{@Eval: UDT = False}

Criteria: 108
Comment: Adds default values in function prototypes for optional parameters
Pass: 8

Criteria: 109
PassOnce: False
Find: Optional {type:1}[{ptr: *}]{arg:1} [{more: , [Optional] {etc}}]
Replace: {type} {ptr}{arg} = {@Eval:
            IIf("{ptr}" <> "", "NULL",
            IIf(InStr("{type}", "{ float|double|EXTENDED }"), "0.0",
            IIf(InStr("{type}", "{ UCHAR|short|USHORT|int|unsigned }"), "0",
            Chr(34, 34))))
         }{more: , Optional {etc}}

Criteria: 110
Find: Optional {@If: IsPrototype==0}
Replace: {Nothing}

Criteria: 111
SkipOver: True
Find: // {Comment:".*"}
Replace: [Skip over]

Criteria: 112
Find: {nl}// End of prototypes
Replace: {Self}{@Exec: IsPrototype = 0}

Criteria: 113
Comment: Misc
Pass: 9

Criteria: 114
SkipOver: True
Find: { // {comment:".*"} | /* {commentB~} */ }
Replace: [Skip over]

Criteria: 115
Find: {" \xFF\xFF\n"}
Replace: {nl}

Criteria: 116
Find: {" \xFF"}{comment:"[^\xFF]+"}{"\xFF\n"}
Replace:  /* {comment} */{nl}

Criteria: 117
Find: @
Replace: *

Criteria: 118
Highlight: True
Find: @{pointer:1}.
Replace: {pointer}->

Criteria: 119
Find: `{@Comment: removes temp char for type member access}
Replace: {Nothing}

Criteria: 120
Find: std::vector<{type}> {name:1} "["{size}"]"
Replace: std::vector<{type}>{name}({size})

Criteria: 121
Find: #IncludeStart {file}.inc
         {code+}
      #IncludeEnd {etc}
Replace: // #Include "{file}.inc"

# End Search


Update pb-to-cpp.uc

Update pb-to-cpp.uc

Bit fields in User Defined Types

# pb-to-cpp.uc - uCalc Transformation file
# This file was saved with uCalc Transform 2.0 on 12/25/2013 12:13:02 PM
# Comment: Converts PB source code to C++; modified by Daniel Corbier

ExternalKeywords: Exclude, Comment, Selected, ParentChild, FindMode, OutputFile, BatchAction, SEND
ExternalKeywords: Highlight, ForeColor, BackColor, FontName, FontSize, FontStyle
ExternalKeywords: FilterEndText, FilterSeparator, FilterSort, FilterSortFunc, FilterStartText, FilterUnique

FindMode: Replace

# Definitions

# Search Criteria

Criteria: 0
Enabled: True
Exclude: False
Comment: Converts PB source code to C++; modified by Daniel Corbier
Selected: False
Highlight: True
ForeColor: ControlText
BackColor: Aqua
FontName:
FontSize:
FontStyle:
CaseSensitive: False
QuoteSensitive: True
CodeBlockSensitive: True
FilterEndText:
FilterSeparator: {#10}
FilterSort: False
FilterSortFunc:
FilterStartText:
FilterUnique: False
Min: 0
Max: -1
MinSoft: 0
MaxSoft: -1
BatchAction: Transform
OutputFile:
SEND:
StartAfter: 0
StopAfter: -1
SkipOver: False
ParentChild: 0
Pass: 0
PassOnce: True
Precedence: 0
RightToLeft: False

Criteria: 1
Find:
Replace: {@Define:
            Var: Array As String
            Var: ArrayNames As Table
            Var: CleanUp As String
            Var: BitType As String
         }

Criteria: 2
Comment: Handles long line break (underscore _)
Pass: 1

Criteria: 3
PassOnce: False
Find: {nl}{line} _ [{comment:".*"}] {nl}

Replace: {comment: ' {comment}{nl}}{nl}{line}{sp}

Criteria: 4
SkipOver: True
Find: {"[\(\)]"} {@Note: These are ( and ); must be skipped}
Replace: [Skip over]

Criteria: 5
SkipOver: True
Find: ' {comment:".*"}
Replace: [Skip over]

Criteria: 6
Comment: Processes some operators
Pass: 2

Criteria: 7
Comment: Bitwise AND and OR
Find: ({expr%})
Replace: ({@Eval: Replace(Replace(Replace("{expr}", "And", "&"), "Or", "|"), "=", "==")})

Criteria: 8
Comment: Logical (short-circuit) AND
Find: And
Replace: &&

Criteria: 9
Comment: Logical (short-circuit) OR
Find: Or
Replace: ||

Criteria: 10
Find: Xor
Replace: ^

Criteria: 11
Find: Not
Replace: ~

Criteria: 12
Find: IsFalse
Replace: !

Criteria: 13
Find: <>
Replace: !=

Criteria: 14
Find: =
Replace: ==

Criteria: 15
SkipOver: True
Find: { {nl}[%]|Then|Else|For|: } {var:" *[a-z\@\.]+"}[({index})] =
Replace: [Skip over]

Criteria: 16
SkipOver: True
Find: { #If | #ElseIf } Not
Replace: [Skip over]

Criteria: 17
Comment:
Pass: 3

Criteria: 18
SkipOver: True
Find: // {comment~}
Replace: [Skip over]

Criteria: 19
Find: ' {comment~}
Replace: // {comment}

Criteria: 20
BackColor: Green
PassOnce: False
Find: {nl}%{equate} = {value}
Replace: {nl}const int {equate} = {value};

Criteria: 21
BackColor: Green
Find: %{equate}
Replace: {equate}

Criteria: 22
BackColor: SandyBrown
Find: {"&h"}
Replace: 0x

Criteria: 23
BackColor: Green
PassOnce: False
Find: If {cond} Then {statement} [Else {else}]{nl}
Replace: if ({cond}) { {statement} }{else: else {{else}}}{nl}

Criteria: 24
PassOnce: False
Find: If {cond} Then {nl}
         {code+}
      End If
Replace: if ({cond}) {
            {code}
         }

Criteria: 25
BackColor: DarkKhaki
PassOnce: False
Find: Function {name} ([{args}]) As {type}{nl}
         {code+}
      End Function
Replace: {type} {name}({args}) {
            {code}
         !!ReleaseDynamicArrays!!}

Criteria: 26
PassOnce: False
Find: Sub {name} ([{args}]){nl}
         {code+}
      End Sub
Replace: void {name}({args}) {
            {code}
         !!ReleaseDynamicArrays!!}

Criteria: 27
PassOnce: False
Find: For {x} = {start} To {stop} [Step {inc=1}]{nl}
         {code+}
      Next
Replace: for ({x}={start}; {x}{@Eval: IIF(sgn({inc})>0, '<', '>')}={stop}; {x} += {inc}) {
            {code}
         }

Criteria: 28
PassOnce: False
Find: While {cond} {nl}
         {code+}
      Wend
Replace: while ({cond}) {
            {code}
         }

Criteria: 29
Find: !!ReleaseDynamicArrays!!
Replace: {@Eval:
            CleanUp = ""
            Array = ReadKey(ArrayNames, x)
            uc_For(x, 1, Count(ArrayNames), 1,
               CleanUp=CleanUp+"delete[] "+Array+";{nl}"
               Delete(ArrayNames, Array)
            )
            CleanUp
         }

Criteria: 30
BackColor: Orange
PassOnce: False
Find: { Dim | {member: {nl}}} {var:1} As {type} [{ptr: Ptr}]
Replace: {member: {nl}}{type} {ptr:*}{var};

Criteria: 31
PassOnce: False
Find: {nl} {bitfield:1} As Bit * {size} [{in: In {type}}]
Replace: {nl}unsigned {@Eval:
            IIf("{type}" <> "", SetVar(BitType, "{type}"))
            BitType
         } {bitfield} : {size};

Criteria: 32
PassOnce: False
Find: Dim {array}({subscript}) As {type}
Replace: {type} *{array} = new {type} [{subscript}+1];{@Eval:
            Insert(ArrayNames, "{array}")
         }{@Define:: Syntax: {array}({index}) ::= {array}[{index}]}

Criteria: 33
BackColor: SandyBrown
PassOnce: False
Find: Dim {var1}, {more}
Replace: Dim {var1}
         Dim {more}

Criteria: 34
BackColor: Gold
PassOnce: False
Find: { Local | Global | Register }
Replace: Dim

Criteria: 35
Find: @
Replace: *

Criteria: 36
BackColor: Silver
Find: VarPtr({var})
Replace: &{var}

Criteria: 37
BackColor: DeepSkyBlue
PassOnce: False
Find: Function = {value}
Replace: return {value};

Criteria: 38
BackColor: Lime
Find: Long
Replace: long

Criteria: 39
BackColor: Red
Find: Single
Replace: float

Criteria: 40
Find: Double
Replace: double

Criteria: 41
Selected: True
Find: Byte
Replace: char

Criteria: 42
BackColor: SlateBlue
PassOnce: False
Find: ByRef {arg} As {type:1}
Replace: {type}& {arg}

Criteria: 43
BackColor: Pink
PassOnce: False
Find: ByVal {arg} As {type:1} [{ptr: Ptr}]
Replace: {type} {ptr:*}{arg}

Criteria: 44
PassOnce: False
Find: Type {name:1}
         {members+}
      End Type
Replace: struct {name} {
            {members}
         }

Criteria: 45
Find: #If
Replace: #if

Criteria: 46
Find: #Else
Replace: #else

Criteria: 47
Find: #ElseIf
Replace: #elif

Criteria: 48
Find: #EndIf
Replace: #endif

Criteria: 49
PassOnce: False
Find: [{NOT: Not }] %Def({const})
Replace: {NOT:!}defined {const}

Criteria: 50
Comment: Adds semi-colons to statements
Pass: 4

Criteria: 51
SkipOver: True
Find: { "{" | "}" | ; | //{".*"} | #{".*"} } {nl} [{"[ \n]+"}]
Replace: [Skip over]

Criteria: 52
Comment: Skips over so that colons in bit fields are not affected
SkipOver: True
Find: struct {name:1} "{" {members+} "}"
Replace: [Skip over]

Criteria: 53
Find: :
Replace: ;

Criteria: 54
PassOnce: False
Find: {nl}
Replace: ;{nl}

# End Search

# pb-to-cpp.uc - uCalc Transformation file
# This file was saved with uCalc Transform 2.0 on 12/24/2013 3:36:28 PM
# Comment: Converts PB source code to C++; modified by Daniel Corbier

ExternalKeywords: Exclude, Comment, Selected, ParentChild, FindMode, OutputFile, BatchAction, SEND
ExternalKeywords: Highlight, ForeColor, BackColor, FontName, FontSize, FontStyle
ExternalKeywords: FilterEndText, FilterSeparator, FilterSort, FilterSortFunc, FilterStartText, FilterUnique

FindMode: Replace

# Definitions

# Search Criteria

Criteria: 0
Enabled: True
Exclude: False
Comment: Converts PB source code to C++; modified by Daniel Corbier
Selected: False
Highlight: True
ForeColor: ControlText
BackColor: Aqua
FontName:
FontSize:
FontStyle:
CaseSensitive: False
QuoteSensitive: True
CodeBlockSensitive: True
FilterEndText:
FilterSeparator: {#10}
FilterSort: False
FilterSortFunc:
FilterStartText:
FilterUnique: False
Min: 0
Max: -1
MinSoft: 0
MaxSoft: -1
BatchAction: Transform
OutputFile:
SEND:
StartAfter: 0
StopAfter: -1
SkipOver: False
ParentChild: 0
Pass: 0
PassOnce: True
Precedence: 0
RightToLeft: False

Criteria: 1
Find:
Replace: {@Define:
            Var: Array As String
            Var: ArrayNames As Table
            Var: CleanUp As String
         }

Criteria: 2
Comment: Handles long line break (underscore _)
Pass: 1

Criteria: 3
PassOnce: False
Find: {nl}{line} _ [{comment:".*"}] {nl}

Replace: {comment: ' {comment}{nl}}{nl}{line}{sp}

Criteria: 4
SkipOver: True
Find: {"[\(\)]"} {@Note: These are ( and ); must be skipped}
Replace: [Skip over]

Criteria: 5
SkipOver: True
Find: ' {comment:".*"}
Replace: [Skip over]

Criteria: 6
Comment: Processes some operators
Pass: 2

Criteria: 7
Comment: Bitwise AND and OR
Find: ({expr%})
Replace: ({@Eval: Replace(Replace(Replace("{expr}", "And", "&"), "Or", "|"), "=", "==")})

Criteria: 8
Comment: Logical (short-circuit) AND
Find: And
Replace: &&

Criteria: 9
Comment: Logical (short-circuit) OR
Find: Or
Replace: ||

Criteria: 10
Find: Xor
Replace: ^

Criteria: 11
Find: Not
Replace: ~

Criteria: 12
Find: IsFalse
Replace: !

Criteria: 13
Find: <>
Replace: !=

Criteria: 14
Find: =
Replace: ==

Criteria: 15
SkipOver: True
Find: { {nl}[%]|Then|Else|For|: } {var:" *[a-z\@\.]+"}[({index})] =
Replace: [Skip over]

Criteria: 16
SkipOver: True
Find: { #If | #ElseIf } Not
Replace: [Skip over]

Criteria: 17
Comment:
Pass: 3

Criteria: 18
SkipOver: True
Find: // {comment~}
Replace: [Skip over]

Criteria: 19
Find: ' {comment~}
Replace: // {comment}

Criteria: 20
BackColor: Green
PassOnce: False
Find: {nl}%{equate} = {value}
Replace: {nl}const int {equate} = {value};

Criteria: 21
BackColor: Green
Find: %{equate}
Replace: {equate}

Criteria: 22
BackColor: SandyBrown
Find: {"&h"}
Replace: 0x

Criteria: 23
BackColor: Green
PassOnce: False
Find: If {cond} Then {statement} [Else {else}]{nl}
Replace: if ({cond}) { {statement} }{else: else {{else}}}{nl}

Criteria: 24
PassOnce: False
Find: If {cond} Then {nl}
         {code+}
      End If
Replace: if ({cond}) {
            {code}
         }

Criteria: 25
BackColor: DarkKhaki
PassOnce: False
Find: Function {name} ([{args}]) As {type}{nl}
         {code+}
      End Function
Replace: {type} {name}({args}) {
            {code}
         !!ReleaseDynamicArrays!!}

Criteria: 26
PassOnce: False
Find: Sub {name} ([{args}]){nl}
         {code+}
      End Sub
Replace: void {name}({args}) {
            {code}
         !!ReleaseDynamicArrays!!}

Criteria: 27
PassOnce: False
Find: For {x} = {start} To {stop} [Step {inc=1}]{nl}
         {code+}
      Next
Replace: for ({x}={start}; {x}{@Eval: IIF(sgn({inc})>0, '<', '>')}={stop}; {x} += {inc}) {
            {code}
         }

Criteria: 28
PassOnce: False
Find: While {cond} {nl}
         {code+}
      Wend
Replace: while ({cond}) {
            {code}
         }

Criteria: 29
Find: !!ReleaseDynamicArrays!!
Replace: {@Eval:
            CleanUp = ""
            Array = ReadKey(ArrayNames, x)
            uc_For(x, 1, Count(ArrayNames), 1,
               CleanUp=CleanUp+"delete[] "+Array+";{nl}"
               Delete(ArrayNames, Array)
            )
            CleanUp
         }

Criteria: 30
BackColor: Orange
PassOnce: False
Find: { Dim | {member: {nl}}} {var:1} As {type} [{ptr: Ptr}]
Replace: {member: {nl}}{type} {ptr:*}{var};

Criteria: 31
PassOnce: False
Find: Dim {array}({subscript}) As {type}
Replace: {type} *{array} = new {type} [{subscript}+1];{@Eval:
            Insert(ArrayNames, "{array}")
         }{@Define:: Syntax: {array}({index}) ::= {array}[{index}]}

Criteria: 32
BackColor: SandyBrown
PassOnce: False
Find: Dim {var1}, {more}
Replace: Dim {var1}
         Dim {more}

Criteria: 33
BackColor: Gold
PassOnce: False
Find: { Local | Global | Register }
Replace: Dim

Criteria: 34
Find: @
Replace: *

Criteria: 35
BackColor: Silver
Find: VarPtr({var})
Replace: &{var}

Criteria: 36
BackColor: DeepSkyBlue
PassOnce: False
Find: Function = {value}
Replace: return {value};

Criteria: 37
BackColor: Lime
Find: Long
Replace: long

Criteria: 38
BackColor: Red
Find: Single
Replace: float

Criteria: 39
Find: Double
Replace: double

Criteria: 40
BackColor: SlateBlue
PassOnce: False
Find: ByRef {arg} As {type:1}
Replace: {type}& {arg}

Criteria: 41
Selected: True
BackColor: Pink
PassOnce: False
Find: ByVal {arg} As {type:1} [{ptr: Ptr}]
Replace: {type} {ptr:*}{arg}

Criteria: 42
PassOnce: False
Find: Type {name:1}
         {members+}
      End Type
Replace: struct {name} {
            {members}
         }

Criteria: 43
Find: #If
Replace: #if

Criteria: 44
Find: #Else
Replace: #else

Criteria: 45
Find: #ElseIf
Replace: #elif

Criteria: 46
Find: #EndIf
Replace: #endif

Criteria: 47
PassOnce: False
Find: [{NOT: Not }] %Def({const})
Replace: {NOT:!}defined {const}

Criteria: 48
Comment: Adds semi-colons to statements
Pass: 4

Criteria: 49
SkipOver: True
Find: { "{" | "}" | ; | //{".*"} | #{".*"} } {nl} [{"[ \n]+"}]
Replace: [Skip over]

Criteria: 50
Find: :
Replace: ;

Criteria: 51
PassOnce: False
Find: {nl}
Replace: ;{nl}

# End Search


#982 - allow runtime modification of loc in X2EncyclopediaTemplate

//---------------------------------------------------------------------------------------
//  FILE:    X2EncyclopediaTemplate.uc
//  AUTHOR:  Dan Kaplan - 10/1/2015
//  PURPOSE: Template defining an Encyclopedia entry in X-Com 2.
//
//---------------------------------------------------------------------------------------
//  Copyright (c) 2016 Firaxis Games, Inc. All rights reserved.
//---------------------------------------------------------------------------------------

class X2EncyclopediaTemplate extends X2DataTemplate
	native(Core)
	config(Encyclopedia);

// Start Issue #982 - allow runtime modification of loc
var config Name					ListCategory;		// Internal name of the category to which this header/entry belong to
var /*private*/ localized string	ListTitle;			// Player facing name of this entry/header.
var config string				ListImagePath;		// The URL to the image that should be displayed as part of the list entry if this is a header.

var /*private*/ localized string    DescriptionTitle;   // Player facing description title that appears when selected.
var /*private*/ localized string    DescriptionEntry;   // Player facing description body that appears when selected.
var config string				DescriptionImagePath;		// The URL to the image that should be displayed as part of the list entry if this is a header.
// End Issue #982

var config bool					bCategoryHeader;	// If true, this entry functions as a category header; if false, this entry functions as a regular entry.
var config int					SortingPriority;	// The priority of this entry relative to others in the same category (lower priority sorts higher in the list).
var config StrategyRequirement  Requirements;		// Requirements to show up in the archive

function string GetListTitle()
{
	return ListTitle;
}

function string GetDescriptionTitle()
{
	return DescriptionTitle;
}

function string GetDescriptionEntry()
{
	return `XEXPAND.ExpandString(DescriptionEntry);
}

defaultproperties
{
}

//---------------------------------------------------------------------------------------
//  FILE:    X2EncyclopediaTemplate.uc
//  AUTHOR:  Dan Kaplan - 10/1/2015
//  PURPOSE: Template defining an Encyclopedia entry in X-Com 2.
//
//---------------------------------------------------------------------------------------
//  Copyright (c) 2016 Firaxis Games, Inc. All rights reserved.
//---------------------------------------------------------------------------------------

class X2EncyclopediaTemplate extends X2DataTemplate
	native(Core)
	config(Encyclopedia);

var config Name					ListCategory;		// Internal name of the category to which this header/entry belong to
var private localized string	ListTitle;			// Player facing name of this entry/header.
var config string				ListImagePath;		// The URL to the image that should be displayed as part of the list entry if this is a header.

var private localized string    DescriptionTitle;   // Player facing description title that appears when selected.
var private localized string    DescriptionEntry;   // Player facing description body that appears when selected.
var config string				DescriptionImagePath;		// The URL to the image that should be displayed as part of the list entry if this is a header.

var config bool					bCategoryHeader;	// If true, this entry functions as a category header; if false, this entry functions as a regular entry.
var config int					SortingPriority;	// The priority of this entry relative to others in the same category (lower priority sorts higher in the list).
var config StrategyRequirement  Requirements;		// Requirements to show up in the archive

function string GetListTitle()
{
	return ListTitle;
}

function string GetDescriptionTitle()
{
	return DescriptionTitle;
}

function string GetDescriptionEntry()
{
	return `XEXPAND.ExpandString(DescriptionEntry);
}

defaultproperties
{
}