Skip to content

Commit

Permalink
bf beautifier
Browse files Browse the repository at this point in the history
  • Loading branch information
vdelachaux committed Nov 22, 2024
1 parent d257f8e commit 2fd46d3
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 122 deletions.
Binary file modified Build/4DPop-Macros.zip
Binary file not shown.
Binary file modified Build/Components/4DPop Macros.4dbase/Contents/4DPop Macros.4DZ
Binary file not shown.
19 changes: 7 additions & 12 deletions Build/Components/4DPop Macros.4dbase/Contents/Info.plist
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<plist>

<dict>
<key>CFBundleName</key>
<string>4DPop Macros</string>
<key>CFBundleVersion</key>
<string>295</string>
<key>NSHumanReadableCopyright</key>
<string>©vdl 2009-2024</string>
<key>CFBundleGetInfoString</key>
<string>20R8</string>
<key>CFBundleLongVersionString</key>
<string>20R8 (294)</string>
<key>CFBundleShortVersionString</key>
<string>20R8</string>
<key>CFBundleDisplayName</key>
<string>4DPop Macros</string>
<key>CFBundleShortVersionString</key>
<string></string>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>CFBundleVersion</key>
<string></string>
</dict>

</plist>
Binary file not shown.
2 changes: 1 addition & 1 deletion Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<key>CFBundleGetInfoString</key>
<string>20R8</string>
<key>CFBundleLongVersionString</key>
<string>20R8 (294)</string>
<string>20R8 (295)</string>
<key>CFBundleShortVersionString</key>
<string>20R8</string>
<key>CFBundleDisplayName</key>
Expand Down
3 changes: 2 additions & 1 deletion Project/Sources/Classes/beautifier.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,8 @@ A comment line is preceded by an empty line if:
This:C1470._ouput.push(This:C1470.line)

If ((This:C1470.lineIndex>0)\
&& This:C1470.isNotEmpty(This:C1470.nextLine))
&& This:C1470.isNotEmpty(This:C1470.nextLine)\
&& This:C1470.isNotMultiline($line))

This:C1470._ouput.push("")

Expand Down
26 changes: 0 additions & 26 deletions Project/Sources/Classes/macro.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ property _ouput : Collection:=[]

property decimalSeparator : Text

property windowRef : Integer

// MARK: Delegate
property rgx : cs:C1710.regex:=cs:C1710.regex.new()

Expand Down Expand Up @@ -686,28 +684,4 @@ Function _comment() : Text
return "/*\r"+$c.join("\r")+"\r*/"+("\r"*Num:C11(v1=v2))

End if

// === === === === === === === === === === === === === === === === === === === === === === === === === ===
Function dialog($form : Text; $title : Text; $type : Integer) : Boolean

var $i : Integer

ARRAY LONGINT:C221($_winRefs; 0)

$type:=Count parameters:C259>=3 ? $type : Movable form dialog box:K39:8

WINDOW LIST:C442($_winRefs)

For ($i; 1; Size of array:C274($_winRefs); 1)

If (Get window title:C450($_winRefs{$i})=$title)

return

End if
End for

This:C1470.windowRef:=Open form window:C675($form; $type; Horizontally centered:K39:1; Vertically centered:K39:4; *)

return True:C214

117 changes: 57 additions & 60 deletions Project/Sources/Classes/specialPaste.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,76 +9,73 @@ property columns : Integer:=80 // Default text column number

property target : Collection:=[]

property windowRef : Integer:=Open form window:C675("SPECIAL_PASTE"; Movable form dialog box:K39:8; Horizontally centered:K39:1; Vertically centered:K39:4; *)

Class constructor()

Super:C1705()

//This.windowRef:=Open form window("SPECIAL_PASTE"; Plain form window; Horizontally centered; Vertically centered; *)
If (This:C1470.dialog("SPECIAL_PASTE"; Localized string:C991("specialPaste")))

var $t : Text
var $o : Object
For each ($t; [\
"string"; \
"comments"; \
"tokenized"; \
"patternRegex"; \
"pathname"; \
"insertInText"; \
"htmlExpression"; \
"htmlCode"; \
"jsonCode"; \
"toUTF8"; \
"fromUTF8"])

$o:={\
label: " "+Localized string:C991($t); \
transform: $t}

Case of

//______________________________________________________
: (New collection:C1472(\
"string"; \
"comments"; \
"htmlCode").indexOf($t)#-1)

$o.options:=New object:C1471
$o.options["1"]:="deleteIndentation"
$o.options["2"]:="ignoreBlankLines"

//______________________________________________________
: ($t="pathname")

$o.options:=New object:C1471
$o.options["1"]:="relative"
$o.options["2"]:="posix"

//______________________________________________________
End case

This:C1470.target.push($o)

End for each
var $t : Text
var $o : Object
For each ($t; [\
"string"; \
"comments"; \
"tokenized"; \
"patternRegex"; \
"pathname"; \
"insertInText"; \
"htmlExpression"; \
"htmlCode"; \
"jsonCode"; \
"toUTF8"; \
"fromUTF8"])

$o:={\
label: " "+Localized string:C991($t); \
transform: $t}

Case of

//______________________________________________________
: (New collection:C1472(\
"string"; \
"comments"; \
"htmlCode").indexOf($t)#-1)

$o.options:=New object:C1471
$o.options["1"]:="deleteIndentation"
$o.options["2"]:="ignoreBlankLines"

//______________________________________________________
: ($t="pathname")

$o.options:=New object:C1471
$o.options["1"]:="relative"
$o.options["2"]:="posix"

//______________________________________________________
End case

DIALOG:C40("SPECIAL_PASTE"; This:C1470)
This:C1470.target.push($o)

If (Bool:C1537(OK))

var $selected : Integer:=This:C1470.currentTargetIndex
_o_Preferences("Set_Value"; "specialPasteChoice"; ->$selected)

var $options : Integer:=This:C1470.options
_o_Preferences("Set_Value"; "specialPasteOptions"; ->$options)

This:C1470.setHighlightedText(This:C1470.preview+kCaret)

End if
End for each

DIALOG:C40("SPECIAL_PASTE"; This:C1470)

If (Bool:C1537(OK))

CLOSE WINDOW:C154(This:C1470.windowRef)
var $selected : Integer:=This:C1470.currentTargetIndex
_o_Preferences("Set_Value"; "specialPasteChoice"; ->$selected)

var $options : Integer:=This:C1470.options
_o_Preferences("Set_Value"; "specialPasteOptions"; ->$options)

This:C1470.setHighlightedText(This:C1470.preview+kCaret)

End if

CLOSE WINDOW:C154(This:C1470.windowRef)

//=========================================================================
Function refresh()

Expand Down
44 changes: 22 additions & 22 deletions Project/Sources/Methods/str_gLon_Hex_To_Long.4dm
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
//%attributes = {"invisible":true,"preemptive":"capable"}
// ----------------------------------------------------
// Méthode : str_gLon_Hex_To_Long
// Alias zRes_Hex_en_décimal
// Created 3/09/98 par Vincent
// ----------------------------------------------------
// Description
//
// ----------------------------------------------------
C_LONGINT:C283($0)
C_TEXT:C284($1)
// ----------------------------------------------------
// Méthode : str_gLon_Hex_To_Long
// Alias zRes_Hex_en_décimal
// Created 3/09/98 par Vincent
// ----------------------------------------------------
// Description
//
// ----------------------------------------------------
var $0 : Integer
var $1 : Text

C_LONGINT:C283($Lon_ASCII;$Lon_End_i;$Lon_i)
C_REAL:C285($Num_Result)
C_TEXT:C284($a80_Hexa)
var $Lon_ASCII; $Lon_End_i; $Lon_i : Integer
var $Num_Result : Real
var $a80_Hexa : Text

If (False:C215)
C_LONGINT:C283(str_gLon_Hex_To_Long ;$0)
C_TEXT:C284(str_gLon_Hex_To_Long ;$1)
C_LONGINT:C283(str_gLon_Hex_To_Long; $0)
C_TEXT:C284(str_gLon_Hex_To_Long; $1)
End if

$a80_Hexa:=Uppercase:C13($1)
$Lon_End_i:=Length:C16($a80_Hexa)

For ($Lon_i;$Lon_End_i;1;-1)
For ($Lon_i; $Lon_End_i; 1; -1)

$Lon_ASCII:=Character code:C91($a80_Hexa[[$Lon_i]])

Case of

//……………………………………………………………
//……………………………………………………………
: (($Lon_ASCII>47)\
& ($Lon_ASCII<58)) //0..9

$Num_Result:=$Num_Result+(($Lon_ASCII-48)*(16^($Lon_End_i-$Lon_i)))

//……………………………………………………………
//……………………………………………………………
: (($Lon_ASCII>64)\
& ($Lon_ASCII<71)) //A..F

$Num_Result:=$Num_Result+(($Lon_ASCII-55)*(16^($Lon_End_i-$Lon_i)))

//……………………………………………………………
//……………………………………………………………
Else //x de Ox de 4D ou autre bidule…

//…Arrêt de la conversion
//…Arrêt de la conversion
$Lon_i:=0

//……………………………………………………………
//……………………………………………………………
End case
End for

$0:=Int:C8($Num_Result)
$0:=Int:C8($Num_Result)

0 comments on commit 2fd46d3

Please sign in to comment.