Changeset 4790


Ignore:
Timestamp:
Nov 21, 2021, 11:30:24 AM (3 years ago)
Author:
Andreas Schnellbacher
Message:
  • Cosmetic changes.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/netlabs/macros/file.e

    r4789 r4790  
    172172
    173173; ---------------------------------------------------------------------------
    174 ; Handle special NEPMD dirs: don't overwrite files of the NETLABS, EPMBBS or
     174; Handles special NEPMD dirs: don't overwrite files of the NETLABS, EPMBBS or
    175175; NETLABS src tree
    176 --defproc SaveProcessNetlabsFile( var Filename, var fNameChanged)
    177176defproc SaveProcessNetlabsFile( Filename)
    178177   rc = 0
     
    281280
    282281; ---------------------------------------------------------------------------
    283 ; This can be executed after a file with Filename is created. Is has to be
    284 ; on top.
     282; This can be executed after a file with Filename is created. The file to
     283; quit must be on top.
    285284; This is used to keep virtual filenames unique.
    286285defc QuitSameFile
     
    320319
    321320; ---------------------------------------------------------------------------
     321; Saves current file.
     322; If a filename is specified, the current file is saved to the specified
     323; filename and the current file isn't changed. To achieve that, Name should
     324; be executed before.
     325; If, for a temp. file, no filename is specified, the Save-as dialog is
     326; opened to enter a filename.
     327; Instead of a filename a longname may be specified. The longname is then
     328; converted to a filename and after save, the longname is added, if
     329; different from filename.
     330; If a <filename> equal to current file is specified, the check for an
     331; existing file to overwrite is bypassed.
    322332; Syntax:
    323333;    Save                               save
     
    326336;    Name <filename> followed by Save   save, change to new filename
    327337;    call Save( <filename>, 1)          used by SaveAs
    328 ; If <filename> is specified, the check for an existing file to overwrite is
    329 ; bypassed.
    330338defc Save, s
    331339   Filename = StripQuotesFileSpec( arg( 1))
     
    782790
    783791; ---------------------------------------------------------------------------
    784 ; Returns a unique filename on non-FAT file systems for a passed filename.
     792; Returns a unique filename on OS/2 file systems for a passed filename.
    785793; Syntax:
    786794;    UniqueFilename = MakeUniqueFilename( [Filename])
     
    869877
    870878; ---------------------------------------------------------------------------
    871 ; Returns a name valid for OS/2 file systems, similar to how OS/2 would
    872 ; convert it. It accepts a filename or a drive as arg( 2) to determine the
    873 ; filesystem first. It defaults to the current filename.
     879; Converts a longname to a filename. Returns a name valid for OS/2 file
     880; systems, similar to how OS/2 would convert it. It accepts a filename or a
     881; drive as arg( 2) to determine the filesystem first. It defaults to the
     882; current filename.
    874883; Syntax:
    875884;    ShortName = MakeFilename( [Longname [, FileSpec]])
     
    953962
    954963; ---------------------------------------------------------------------------
    955 ; Enquote FileSpec if required.
     964; Enquotes FileSpec if required.
    956965defproc EnquoteFileSpec( FileSpec)
    957966   if (not (leftstr( FileSpec, 1) = '"' & rightstr( FileSpec, 1) = '"')) &
     
    963972
    964973; ---------------------------------------------------------------------------
    965 ; Remove double quotes from enquoted strings.
     974; Removes double quotes from enquoted strings.
    966975defproc StripQuotesFileSpec( FileSpec)
    967976   if leftstr( FileSpec, 1) = '"' & rightstr( FileSpec, 1) = '"' &
     
    10081017; ---------------------------------------------------------------------------
    10091018; Syntax: SaveAll
    1010 ; Save all files of the ring. Discard non-modified and temp files. Reset
    1011 ; .modify for temp files. Bring unnamed files to the top.
     1019; Saves all files of the ring. Discards non-modified and temp files. Resets
     1020; .modify for temp files. Brings unnamed files to the top.
    10121021defc SaveAll
    10131022   do once = 1 to 1
     
    12251234
    12261235; ---------------------------------------------------------------------------
     1236; Checks if a Longname exists in a Dir. If yes, the file dialog is opened to
     1237; enter another longname. Sets rc. Returns NewFilename. Loops until a
     1238; non-existant longname is entered or on Cancel.
     1239;    rc = -5   NewLongFilename = ''      Cancel or error
     1240;    rc =  0   NewLongFilename = ''      Yes pressed or not found, overwrite
     1241;    rc =  1   NewLongFilename = '...'   No pressed and NewLongFilename selected
     1242; LongFilename means here: Longname with a prepended path, similar to a
     1243; fully-qualified filename.
    12271244defproc SaveAsCheckLongnameExist( Longname, Dir)
    12281245   NewLongFilename = ''
     
    12911308
    12921309; ---------------------------------------------------------------------------
    1293 -- TODO: Add arg( 2) = fCheckLongname
    12941310; Checks if a file exists. If yes, the file dialog is opened to enter another
    12951311; filename. Sets rc. Returns NewFilename. Loops until a non-existant filename
     
    18001816
    18011817; ---------------------------------------------------------------------------
    1802 ; Lock file only if modified, unlock if .modify = 0
     1818; Locks file only if modified, unlocks if .modify = 0
    18031819; Todo: disable this if it failed once and for slow drives.
    18041820defmodify
     
    18141830      endif
    18151831   endif
    1816    --sayerror '.modify = '.modify', .lockhandle = '.lockhandle', .readonly = '.readonly
    1817 
    1818 ; ---------------------------------------------------------------------------
    1819 ; Can be used to toggle the lock state
     1832   --dprintf( '.modify = '.modify', .lockhandle = '.lockhandle', .readonly = '.readonly)
     1833
     1834; ---------------------------------------------------------------------------
     1835; Can be used to toggle the lock state.
    18201836defc lock_on_modify
    18211837   if wordpos( upcase( arg( 1)), '0 OFF') then
     
    19111927   if result then
    19121928      if result = 32 then
    1913          sayerror ACCESS_DENIED__MSG '-' MAYBE_LOCKED__MSG' rc = ERROR_SHARING_VIOLATION.'
     1929         'SayError 'ACCESS_DENIED__MSG '-' MAYBE_LOCKED__MSG' rc = ERROR_SHARING_VIOLATION.'
    19141930         return result
    19151931      elseif result = 206 then  -- 206 = ERROR_FILENAME_EXCED_RANGE
     
    19461962      getfileid fileid, file
    19471963      if fileid == '' then
    1948          sayerror '"'file'"' DOES_NOT_EXIST__MSG
     1964         'SayError "'file'"' DOES_NOT_EXIST__MSG
    19491965         return 1
    19501966      endif
     
    19551971defproc Unlock( fileid)
    19561972   if fileid.lockhandle = 0 then
    1957       sayerror fileid.filename NOT_LOCKED__MSG
     1973      'SayError 'fileid.filename NOT_LOCKED__MSG
    19581974      return 1
    19591975   endif
    19601976   result = dynalink32( 'DOSCALLS',    -- Free the original handle
    1961                         '#257',                    -- dos32close
     1977                        '#257',                    -- Dos32Close
    19621978                        atol( fileid.lockhandle), 2)
    19631979   if result then
    1964       sayerror 'DOSCLOSE' ERROR_NUMBER__MSG result
     1980      'SayError DosClose 'ERROR_NUMBER__MSG result
    19651981   else
    19661982      fileid.lockhandle = 0
     
    19781994      'xcom e /c 'EnquoteFileSpec( Name)
    19791995      if rc <> -282 then  -- -282 = sayerror( "New file")
    1980          sayerror ERROR__MSG rc BAD_TMP_FILE__MSG sayerrortext( rc)
     1996         'SayError 'ERROR__MSG rc BAD_TMP_FILE__MSG sayerrortext( rc)
    19811997         leave
    19821998      endif
     
    22282244
    22292245; ---------------------------------------------------------------------------
    2230 ; Determine .readonly field from file attribute, if enabled
     2246; Determines .readonly field from file attribute, if enabled.
    22312247defc ReadonlyFromAttrib
    22322248   KeyPath = '\NEPMD\User\Readonly'
     
    22912307
    22922308; ---------------------------------------------------------------------------
    2293 ; Change drive. Release previous directory first (change to root dir).
    2294 ; Accept drives and dirs as arg.
     2309; Changes drive. Releases previous directory first (changes to root dir).
     2310; Accepts drives and dirs as arg.
    22952311defproc ChDrive
    22962312   NewDir = arg( 1)
     
    23212337
    23222338; ---------------------------------------------------------------------------
    2323 ; Change drive and directory. Release previous directory first (change to
     2339; Changes drive and directory. Releases previous directory first (changes to
    23242340; root dir).
    23252341; This should be used e.g. to change the directory on every defselect.
     
    23392355
    23402356; ---------------------------------------------------------------------------
    2341 ; Change drive and directory. Release previous directory first (change to
     2357; Changes drive and directory. Releases previous directory first (changes to
    23422358; root dir). This should be used e.g. to change the directory on every
    23432359; defselect. Compared to Directory2, the 'cd' command is used to display
     
    23622378
    23632379; ---------------------------------------------------------------------------
    2364 ; Change drive and directory. If a filename was specified, the directory of
     2380; Changes drive and directory. If a filename was specified, the directory of
    23652381; that file is used instead.
    23662382defc xcd
     
    23862402
    23872403; ---------------------------------------------------------------------------
    2388 ; Change drive and directory. Release previous directory first (change to
    2389 ; root dir). Give a message.
     2404; Changes drive and directory. Releases previous directory first (changes to
     2405; root dir). Gives a message.
    23902406defc CDDlg
    23912407   CurDir = directory()
     
    24122428
    24132429; ---------------------------------------------------------------------------
    2414 ; Helper to set startup dir for WPS objects.
     2430; Helper to set startup dir for EPM program objects.
    24152431defc StartupDirDlg
    24162432   KeyPath = '\NEPMD\User\ProgramObjects\StartupDir'
     
    24472463   Filename = Filename\0
    24482464   rc = dynalink32( 'DOSCALLS',          -- dynamic link library name
    2449                     '#259',              -- ordinal value for DOSDELETE
     2465                    '#259',              -- ordinal value for Dos32Delete
    24502466                    address( Filename))
    24512467   return
     
    26962712                       address( BytesReadL), 2)       -- Bytes read
    26972713      if rc then
    2698          sayerror 'DosRead' ERROR__MSG rc
     2714         'SayError DosRead' ERROR__MSG rc
    26992715         return
    27002716      endif
     
    28402856
    28412857; ---------------------------------------------------------------------------
    2842 ; For compatibilty
     2858; For compatibilty.
    28432859defproc Get_File_Date( Filename)
    28442860   return GetFileDateHex( Filename)
Note: See TracChangeset for help on using the changeset viewer.