Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
vdelachaux committed Oct 2, 2024
1 parent e43256a commit 9b4998b
Show file tree
Hide file tree
Showing 19 changed files with 313 additions and 348 deletions.
42 changes: 42 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# ====================================================================
# Basic .gitattributes for a 4D repo.
# ====================================================================

* text=auto

# ====================================================================
# The above will handle all files NOT found below
# ====================================================================

# These files are text and should be normalized (Convert crlf => lf)
#.gitattributes text linguist-language=gitattributes
#.gitignore text
*.md text
*.ini text
*.xlf linguist-language=xml diff=xml

# SVG treated as text.
# If you want to treat it as binary,comment the next line.
*.svg text diff=xml

# Source files
*.4DProject text linguist-language=4d diff=json
*.4DCatalog text linguist-language=4d diff=xml
*.4DSettings text linguist-language=4d diff=xml
*.4DForm text linguist-language=4d diff=json
*.4dm text linguist-language=4d
*.4lbp text linguist-language=4d diff=xml
*.4df text linguist-language=4d diff=json

# ====================================================================
# Binary
# ====================================================================
*.4DZ binary linguist-language=4d
*.4DD binary linguist-language=4d
*.4DIndy binary linguist-language=4d
*.Match binary linguist-language=4d
*.4DIndx binary linguist-language=4d
*.4[dD][bB] binary linguist-language=4d
*.[dD][aA][tT][aA] binary linguist-language=4d
*.4lb binary linguist-language=4d
*.4qr binary linguist-language=4d
Binary file modified Build/4DPop-Bookmarks.dmg
Binary file not shown.
Binary file modified Build/4DPop-Bookmarks.zip
Binary file not shown.
Binary file modified Build/Components/4DPop Bookmarks.4dbase/4DPop Bookmarks.4DZ
Binary file not shown.
4 changes: 2 additions & 2 deletions Build/Components/4DPop Bookmarks.4dbase/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

<dict>
<key>CFBundleVersion</key>
<string>103</string>
<string>104</string>
<key>NSHumanReadableCopyright</key>
<string>©vdl 2009-2024</string>
<key>CFBundleGetInfoString</key>
<string>20R7</string>
<key>CFBundleLongVersionString</key>
<string>20R7 (102)</string>
<string>20R7 (103)</string>
<key>CFBundleName</key>
<string>4DPop Bookmarks</string>
<key>CFBundleShortVersionString</key>
Expand Down
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

<dict>
<key>CFBundleVersion</key>
<string>103</string>
<string>104</string>
<key>NSHumanReadableCopyright</key>
<string>©vdl 2009-2024</string>
<key>CFBundleGetInfoString</key>
<string>20R7</string>
<key>CFBundleLongVersionString</key>
<string>20R7 (102)</string>
<string>20R7 (103)</string>
<key>CFBundleName</key>
<string>4DPop Bookmarks</string>
<key>CFBundleShortVersionString</key>
Expand Down
Binary file added Libraries/lib4d-arm64.dylib
Binary file not shown.
4 changes: 0 additions & 4 deletions Project/Sources/Methods/COMPILER _4DPop.4dm

This file was deleted.

29 changes: 0 additions & 29 deletions Project/Sources/Methods/COMPILER_main.4dm

This file was deleted.

142 changes: 72 additions & 70 deletions Project/Sources/Methods/POSIX_Path.4dm
Original file line number Diff line number Diff line change
@@ -1,86 +1,88 @@
//%attributes = {"invisible":true}
// ----------------------------------------------------
// Method : POSIX_Path
// Created 06/10/06 by vdl
// ----------------------------------------------------
// Description
// A POSIX path is the location of an object specified with a POSIX (slash)-style pathname.
// This is the method commonly used in UNIX to refer to a location within a series of directories, as opposed to the (colon) pathnames often used in AppleScript and on the Classic Mac OS.
// The POSIX path is used to get the POSIX path from of an object.
// Example: POSIX path of file "HD:Users:me:Documents:Welcome.txt" is "/Users/me/Documents/Welcome.txt"
// $1 = path to convert
// $0 = converted (posix) path
// The first / is omited if $2 is true
// ----------------------------------------------------
C_TEXT:C284($0)
C_TEXT:C284($1)
C_BOOLEAN:C305($2)
// ----------------------------------------------------
// Method : POSIX_Path
// Created 06/10/06 by vdl
// ----------------------------------------------------
// Description
// A POSIX path is the location of an object specified with a POSIX (slash)-style pathname.
// This is the method commonly used in UNIX to refer to a location within a series of directories, as opposed to the (colon) pathnames often used in AppleScript and on the Classic Mac OS.
// The POSIX path is used to get the POSIX path from of an object.
// Example: POSIX path of file "HD:Users:me:Documents:Welcome.txt" is "/Users/me/Documents/Welcome.txt"
// $1 = path to convert
// $0 = converted (posix) path
// The first / is omited if $2 is true
// ----------------------------------------------------
#DECLARE($pathname : Text; $skipFirst : Boolean) : Text

C_BOOLEAN:C305($Boo_Without_First)
C_LONGINT:C283($Lon_i;$Lon_Length;$Lon_Platform)
C_TEXT:C284($Txt_Path;$Txt_Posix_Path;$Txt_Volume)

If (False:C215)
C_TEXT:C284(POSIX_Path ;$0)
C_TEXT:C284(POSIX_Path ;$1)
C_BOOLEAN:C305(POSIX_Path ;$2)
End if

_O_PLATFORM PROPERTIES:C365($Lon_Platform)

If (Count parameters:C259>=1)
$Txt_Path:=$1
If (Count parameters:C259>=2)
$Boo_Without_First:=$2
End if
End if
var $posix; $volume : Text
var $i; $length : Integer

Case of
//------------------------------------------
: (Length:C16($Txt_Path)=0)
$Txt_Posix_Path:=""
//------------------------------------------
: ($Lon_Platform=Windows:K25:3)
$Txt_Posix_Path:=Replace string:C233($Txt_Path;"\\";"/")
//------------------------------------------

//------------------------------------------
: (Length:C16($pathname)=0)

// <NOTHING MORE TO DO>

//------------------------------------------
: (Is Windows:C1573)

$posix:=Replace string:C233($pathname; "\\"; "/")

//------------------------------------------
Else
// ":" is remplaced by "/"
$Txt_Path:=Replace string:C233($Txt_Path;":";"/")
//Space character must be escaped
$Txt_Path:=Replace string:C233($Txt_Path;" ";"\\ ")

// Get the boot volume
$Txt_Volume:=System folder:C487 //"Macintosh_HD:System:"
$Lon_Length:=Length:C16($Txt_Volume)
For ($Lon_i;1;$Lon_Length;1)
If ($Txt_Volume[[$Lon_i]]=":")
$Txt_Volume:=Substring:C12($Txt_Volume;1;$Lon_i-1)
$Lon_i:=$Lon_Length+1
// ":" is remplaced by "/"
$pathname:=Replace string:C233($pathname; ":"; "/")

// Space character must be escaped
$pathname:=Replace string:C233($pathname; " "; "\\ ")

// Get the boot volume
$volume:=System folder:C487 // "Macintosh_HD:System:"
$length:=Length:C16($volume)

For ($i; 1; $length; 1)

If ($volume[[$i]]=":")

$volume:=Substring:C12($volume; 1; $i-1)

break

End if
End for

If ($Txt_Path=($Txt_Volume+"/@"))
// The path is on the boot disk
// Macintosh_HD/Library/..." will be converted to "/Library/..."
$Txt_Posix_Path:=Substring:C12($Txt_Path;Length:C16($Txt_Volume)+1)
If ($pathname=($volume+"/@"))

// The path is on the boot disk
// Macintosh_HD/Library/..." will be converted to "/Library/..."
$posix:=Substring:C12($pathname; Length:C16($volume)+1)

Else
// The path is not on the boot disk
// Disk/work/..." will be converted to "/Volumes/Disk/work/..."
$Txt_Posix_Path:="/Volumes/"+$Txt_Path

// The path is not on the boot disk
// Disk/work/..." will be converted to "/Volumes/Disk/work/..."
$posix:="/Volumes/"+$pathname

End if
//------------------------------------------

//------------------------------------------
End case

Case of
//-------------------------------
: (Not:C34($Boo_Without_First))
//-------------------------------
: (Length:C16($Txt_Posix_Path)=0)
//-------------------------------
: (Character code:C91($Txt_Posix_Path[[1]])=47) // /
$Txt_Posix_Path:=Substring:C12($Txt_Posix_Path;2)
//-------------------------------

//-------------------------------
: (Not:C34($skipFirst))\
|| (Length:C16($posix)=0)

// <NOTHING MORE TO DO>
//-------------------------------
: (Character code:C91($posix[[1]])=47)

$posix:=Substring:C12($posix; 2)

//-------------------------------
End case

$0:=$Txt_Posix_Path

return $posix
Loading

0 comments on commit 9b4998b

Please sign in to comment.