User talk:ConradPino/White Space Problem
Contents
Proposed Solution
Conrad T. Pino 17:50, 1 February 2010 (UTC):
- IMO it's worthwhile reviewing current JEditUnit Revision 879 which adds:
- dynamic persistent project root path
- dynamic persistent relative path exclusions
- The next Revision could include:
- dynamic persistent relative path inclusions
- dynamic persistent file extensions
- Upon completing the above we should:
- reimplement the presistent configuration data store to improve user comprehension
- reconsider mapping command line arguments as configuration changes and choose the best user experience.
Conrad T. Pino 19:11, 1 February 2010 (UTC):
unit JEditUnit
Revision 881 removes all static elements other than as initial defaults.
- If we add the user's default tab spacing to the configuration
JEDIedit
could move from tab reporting to tab replacement.
Conrad T. Pino 20:05, 2 February 2010 (UTC):
unit JEditUnit
Revision 883 implements:- files to process configuration is persisted in
JEDIedit.ini
file, - optional tab replacement added while keeping tab location reporting.
- files to process configuration is persisted in
ChristianWimmer 20:57, 2 February 2010 (UTC):
- Still I think the application is not really usable. I'm missing documentation how to use it.
- At the moment if I execute it it doesn't seem to do nothing. No output, no help, no nothing.
Conrad T. Pino 21:22, 2 February 2010 (UTC):
- While you were editing, documentation was growing. Please revisit again.
- ChristianWimmer 22:28, 2 February 2010 (UTC) What about integrating it into the app itself? And some output on the processing would be fine.
- ChristianWimmer 22:28, 2 February 2010 (UTC) What about loading this ini file? The target should be a batch file that can be called and it does the job. Be aware that the folder JWSCL and JWA don't necessarily be in the same folder. So I think one ini file per project should do the job. The project should load a given ini file from command line.
Conrad T. Pino 23:36, 2 February 2010 (UTC):
- Documentation within the program is hard to balance as too little and too much are equally bad. IMO better alternatives are:
- have program point to "ReadMe.txt" and Wiki Documentation Page
- create "ReadMe.txt" with Wiki Documentation Page summary with pointer to same
- create an OFFICIAL Wiki Documentation Page when this becomes an OFFICIAL Project JEDI Tool.
- ChristianWimmer 10:33, 3 February 2010 (UTC) It is common that links go nirwana. Wiki is fine as long as the doc is also provided with the application. So it is best to stick docs together with its binary. Of course, it can be done using a readme.txt. But I also prefer an integrated (minimum) help because people don't read such files. Instead they just call this binary..."but nothing happens? WTH?"
- Conrad T. Pino 19:25, 3 February 2010 (UTC): Agreed.
- The program generates output to
stdout
but only when:- White Space Removeal Feature changes a file
- Tab Replacement Feature changes a file
- Tab Reporting Feature finds a tab
- There is no output when no files change, no tabs exist, or File Selection Configuration results in empty
FileList
.- ChristianWimmer 10:33, 3 February 2010 (UTC) Output is always necessary even if nothing is changed. So output is not about changes but about the current status of the application. And this includes thath nothing has changed, the app is processing files and the app has ended. Also copyright notice and such should always be shown.
- Conrad T. Pino 19:25, 3 February 2010 (UTC): Agreed.
- ChristianWimmer 10:33, 3 February 2010 (UTC) Output is always necessary even if nothing is changed. So output is not about changes but about the current status of the application. And this includes thath nothing has changed, the app is processing files and the app has ended. Also copyright notice and such should always be shown.
- I don't understand what you mean by, "What about loading this ini file?"
- ChristianWimmer 10:33, 3 February 2010 (UTC) It should be possible to use an arbitrary ini file. E.g.
JEDIedit myini.ini
- Conrad T. Pino 19:25, 3 February 2010 (UTC): Thank you.
- ChristianWimmer 10:33, 3 February 2010 (UTC) It should be possible to use an arbitrary ini file. E.g.
- I don't understand what you mean by, "The target should be a batch file that can be called and it does the job."
- ChristianWimmer 10:33, 3 February 2010 (UTC)
JEDIedit JWSCL.ini
JEDIedit JWA.ini
- Conrad T. Pino 19:25, 3 February 2010 (UTC): Thank you.
- ChristianWimmer 10:33, 3 February 2010 (UTC)
- File Selection Configuration makes NO assumptions about Project JEDI whatsoever. The actual assumptions are:
- ChristianWimmer 10:33, 3 February 2010 (UTC) Does this include that there are no folder names in the source?
- Conrad T. Pino 19:25, 3 February 2010 (UTC): I shall create new topic for this question shortly.
- each
JEDIedit
run applies enabled features to a single project - the chosen project is the first found in
RootPaths
list
- ChristianWimmer 10:33, 3 February 2010 (UTC) I don't get this. Is it just a convention to talk about project? I thought this is about paths? Why call the first one (only) a project? And if it is not?
- Conrad T. Pino 19:25, 3 February 2010 (UTC): I shall create new topic for this question shortly.
- projects have a single root
- projects have one or more subdirectories that should be included
- projects may or may not have subdirectories that should be excluded
- enabled features should be applied to specific file extensions
- ChristianWimmer 10:33, 3 February 2010 (UTC) Does this include that there are no folder names in the source?
- All the the above were taken from conventional Subversion repositoriy structure
- Hmm, I shall add ".svn" and "CVS" directory exclusion support.
- ChristianWimmer 10:33, 3 February 2010 (UTC)Good idea.
- Conrad T. Pino 19:25, 3 February 2010 (UTC): Thank you.
- ChristianWimmer 10:33, 3 February 2010 (UTC)Good idea.
- Dynamic INI File selection has the same effect as Dynamic INI File Section selection. I suppose we can do both and leave it to the user's tastes.
- ChristianWimmer 10:33, 3 February 2010 (UTC) I'm not sure: what is the difference between Dynamic INI and Dynamic INI File Section selection? Do we really both? People usually don't like to make choices. They want it to be working.
- Conrad T. Pino 19:25, 3 February 2010 (UTC): I shall create new topic for this question shortly.
- ChristianWimmer 10:33, 3 February 2010 (UTC) I'm not sure: what is the difference between Dynamic INI and Dynamic INI File Section selection? Do we really both? People usually don't like to make choices. They want it to be working.
Command Line File Selection
File selection from the INI File shall be discussed as another topic.
Add Comments Here
ChristianWimmer 10:33, 3 February 2010 (UTC) Does this include that there are no folder names in the source?
Conrad T. Pino 21:51, 3 February 2010 (UTC):
- I assume the "source" you mentioned are command line arguments.
ChristianWimmer 22:06, 3 February 2010 (UTC) No, I meant the application source code.
- I proposed File Selection From Command Line on the subject page; I repeat that content here: (this table is obsolete, see the subject page)
The following File Selection Command Line Options are proposed:
Option Aliases Description --ini-file Custom.ini
-i /i
Default JEDIedit.ini
file is replaced byCustom.ini
file.--ini-section CustomSection
-j /j
The default or specified INI File section read shall be [Custom Section]
instead of[Default]
.--root-paths jwapi\trunk
-r /r
Shall replace the INI FIle RootPaths
value.--extensions dpr,pas,txt
-e /e
Shall replace the INI FIle Extensions
value.Unit1.pas Unit2.pas ReadMe.txt
Shall be the FileList
; INI File valuesRootPaths Includes Excludes
shall be ignored. The default or specified file extensions shall be ignored.Directory1 Directory2 Directory3
Specified directories shall be enumerated to build FileList
; INI File valuesRootPaths Includes Excludes
shall be ignored. The default or specified file extensions shall apply.Directory1 File1 DirectoryN FileN
FileList
shall be the union of the specified files and enumerated directories. The file and directory rules specified above shall apply respectively.--subdirectories
-s /s
Specifies recursive directory enumeration i.e. all subdirectories.
- My thoughts here are not complete so far include:
- When no files nor directories appear on the command line then INI File Semantics selects files. ChristianWimmer 22:07, 3 February 2010 (UTC) Think so.
- When one or more files or directories appear on the command line then INI File Semantics file selection is ignored. ChristianWimmer 22:07, 3 February 2010 (UTC) Think so, too.
- Can you comment on the above?
Conrad T. Pino 22:27, 3 February 2010 (UTC):
- The "application source code" of what (module, program, project, projects)?
- Is my understanding of "application source code" needed for futher discusion?
- Other than "application source code" it seems this topic discussion is complete.
RootPaths Semantics
Add Comments Here
ChristianWimmer 10:33, 3 February 2010 (UTC) I don't get this.
- Is it just a convention to talk about project?
- I thought this is about paths?
- Why call the first one (only) a project?
- And if it is not?
Conrad T. Pino 20:54, 3 February 2010 (UTC):
- Yes. I'm using this tool to process selected subdirectories within
https://jedi-apilib.svn.sourceforge.net/svnroot/jedi-apilib/
. - It is about paths; in my case, a specific project's root path.
- What else should we call for example "
jedi-apilib
"? - Then it is not; the code requires an existing directory; no more.
ChristianWimmer 22:09, 3 February 2010 (UTC) This is fine as long as will work with arbitrary source code folders.
Conrad T. Pino 22:47, 3 February 2010 (UTC): Arbitrary source code folders is in the goal set. Speak up if we fail to get there.
RootPaths Use Cases
Nobody has asked why RootPaths
is a multiple entry list.
ChristianWimmer 22:12, 3 February 2010 (UTC) No idea. A single root path would be more logical. Several root paths can be simulated by calling the app as many times.
Conrad T. Pino 22:47, 3 February 2010 (UTC): Then you're not as lazy as I am; see Case Lazy Developer below;
Case Run In Place
program JEDIedit
resides well within the project tree https://jedi-apilib.svn.sourceforge.net/svnroot/jedi-apilib/jwapi/trunk/Tools/JEDIedit/
.
When:
Z:\Projects\jedi-apilib
is working copy ofhttps://jedi-apilib.svn.sourceforge.net/svnroot/jedi-apilib/
RootPaths="..\jedi-apilib","..\..\..\..\..\jedi-apilib"
- current directory is
Z:\Projects\jedi-apilib\jwapi\trunk\Tools\JEDIedit
JEDIedit.exe
is run from the current directory
Then:
RootPaths
entry"..\jedi-apilib"
failsRootPaths
entry"..\..\..\..\..\jedi-apilib"
suceeds"..\..\..\..\..\jedi-apilib"
isZ:\Projects\jedi-apilib
Case Lazy Developer
I'm lazy about avoidable path typing so I use a flat projects model:
Z:\Projects\jedi-apilib
is working copy ofhttps://jedi-apilib.svn.sourceforge.net/svnroot/jedi-apilib/
Z:\Projects\JEDIedit
is working copy ofhttps://jedi-apilib.svn.sourceforge.net/svnroot/jedi-apilib/jwapi/trunk/Tools/JEDIedit/
When:
RootPaths="..\jedi-apilib","..\..\..\..\..\jedi-apilib"
- current directory is
Z:\Projects\JEDIedit
JEDIedit.exe
is run from the current directory
Then:
RootPaths
entry"..\jedi-apilib"
suceedsRootPaths
entry"..\..\..\..\..\jedi-apilib"
is ignored"..\jedi-apilib"
isZ:\Projects\jedi-apilib
Relevant Code
Perhaps the code will speak better for itself than I do:
var RootPathList, ExcludesList, IncludesList, ExtensonList: TStringList; FileExtn, FileName, RootPath, TabLines: string; Compare, Index, Jadex, TabSpacing: Integer; IniFile: TMemIniFile; procedure InitializeStringList( StringList: TStringList ); begin StringList.Duplicates := dupIgnore; StringList.CaseSensitive := False; StringList.Sorted := True; end;
Read INI File Values:
// Prepare FileList InitializeStringList( FileList ); // Prepare RootPathList RootPathList.DelimitedText := IniFile.ReadString( IniSectionDefault, IniKeyRootPathList, IniKeyRootPathListDefault ); // Prepare ExcludesList InitializeStringList( ExcludesList ); ExcludesList.DelimitedText := IniFile.ReadString( IniSectionDefault, IniKeyExcludesList, IniKeyExcludesListDefault ); // Prepare IncludesList InitializeStringList( IncludesList ); IncludesList.DelimitedText := IniFile.ReadString( IniSectionDefault, IniKeyIncludesList, IniKeyIncludesListDefault ); // Prepare ExtensonList InitializeStringList( ExtensonList ); ExtensonList.DelimitedText := IniFile.ReadString( IniSectionDefault, IniKeyExtensonList, IniKeyExtensonListDefault );
Use INI File Values:
// Locate first valid RootPathList entry RootPath := ''; Index := 0; while ( Length( RootPath ) <= 0 ) and ( Index < RootPathList.Count ) do begin FileName := RootPathList.Strings[ Index ]; if DirectoryExists( FileName ) then begin RootPath := FileName; end; Inc( Index ); end; // Enumerate valid RootPathList entry if DirectoryExists( RootPath ) then begin RootPath := IncludeTrailingPathDelimiter( RootPath ); // Enumerate IncludesList entries for Index := 0 to IncludesList.Count - 1 do begin FileList.AddFiles( RootPath + IncludesList.Strings[ Index ], True ); end; // Remove ExcludesList entries Index := 0; Jadex := 0; while ( Index < ExcludesList.Count ) and ( Jadex < FileList.Count ) do begin FileName := IncludeTrailingPathDelimiter( RootPath + ExcludesList.Strings[ Index ] ); Compare := CompareText( FileName, Copy( FileList.Strings[ Jadex ], 1, Length( FileName ) ) ); if Compare < 0 then begin // ExcludesList < FileList Inc( Index ); end else if Compare > 0 then begin // ExcludesList > FileList Inc( Jadex ); end else begin // ExcludesList = FileList FileList.Delete( Jadex ); end; end; // Keep ExtensonList entries Index := 0; while Index < FileList.Count do begin FileExtn := Copy( ExtractFileExt( FileList.Strings[ Index ] ), 2, MaxInt ); if ExtensonList.IndexOf( FileExtn ) >= 0 then begin // FileExtn present, retain Inc( Index ); end else begin // FileExtn absent, discard FileList.Delete( Index ); end; end; end;
INI File Semantics
File selection from the command line shall be discussed as another topic.
Currently file selection is performed using the following set of INI File Section Values:
RootPaths
Extensions
Includes
Excludes
Whenever the above four (4) values are identical then the resultant FileList
lists are identical assuming no file changes.
Currently Tab Operations are selected using the following set of INI File Section Values:
TabReplace
TabSpacing
Whenever the above two (2) values are identical then the resultant operations are identical assuming no file changes.
Predicates
Assume Z:\Projects\jedi-apilib
is working copy of https://jedi-apilib.svn.sourceforge.net/svnroot/jedi-apilib
.
Assume JEDIedit.ini
contains:
[JWAPI] RootPaths="Z:\Projects\jedi-apilib" Extensions="dpr","inc","pas" Includes="jwapi\trunk" Excludes="jwapi\trunk\Examples" TabReplace=1 TabSpacing=2 [JWSCL] RootPaths="Z:\Projects\jedi-apilib" Extensions="dpr","inc","pas" Includes="jwscl\trunk" Excludes="jwscl\trunk\examples","jwscl\trunk\unittests" TabReplace=1 TabSpacing=2
Assume JWAPIedit.ini
contains:
[Default] RootPaths="Z:\Projects\jedi-apilib" Extensions="dpr","inc","pas" Includes="jwapi\trunk" Excludes="jwapi\trunk\Examples" TabReplace=1 TabSpacing=2
Assume JWSCLedit.ini
contains:
[Default] RootPaths="Z:\Projects\jedi-apilib" Extensions="dpr","inc","pas" Includes="jwscl\trunk" Excludes="jwscl\trunk\examples","jwscl\trunk\unittests" TabReplace=1 TabSpacing=2
Assume Custom.ini
contains:
[JWAPI] RootPaths="Z:\Projects\jedi-apilib" Extensions="dpr","inc","pas" Includes="jwapi\trunk" Excludes="jwapi\trunk\Examples" TabReplace=1 TabSpacing=2 [JWSCL] RootPaths="Z:\Projects\jedi-apilib" Extensions="dpr","inc","pas" Includes="jwscl\trunk" Excludes="jwscl\trunk\examples","jwscl\trunk\unittests" TabReplace=1 TabSpacing=2
Equivalent Operations
Given the above, I shall illustrate two (2) examples for JWAPI and JWSCL.
Each of the following command lines performs the same operation becuase the selected INF File Section Values are identical.
Equivalent JWAPI Examples
JEDIedit --ini-section JWAPI JEDIedit --ini-file JWAPIedit.ini JEDIedit --ini-file Custom.ini --ini-section JWAPI
which choose the following INF File Sections respectively:
INI File | INI File Section |
---|---|
JEDIedit.ini (default)
|
JWAPI (specified)
|
JWAPIedit.ini (specified)
|
Default (default)
|
Custom.ini (specified)
|
JWAPI (specified)
|
Equivalent JWSCL Examples
JEDIedit --ini-section JWSCL JEDIedit --ini-file JWSCLedit.ini JEDIedit --ini-file Custom.ini --ini-section JWSCL
which choose the following INF File Sections respectively:
INI File | INI File Section |
---|---|
JEDIedit.ini (default)
|
JWSCL (specified)
|
JWSCLedit.ini (specified)
|
Default (default)
|
Custom.ini (specified)
|
JWSCL (specified)
|
Add Comments Here
Conrad T. Pino 20:13, 3 February 2010 (UTC): Add real content.
ChristianWimmer 22:15, 3 February 2010 (UTC) This fine I think.
Conrad T. Pino 22:49, 3 February 2010 (UTC): Thank you. I shall use it but I may be alone. :)
Greetings Earthling!
Conrad T. Pino 19:11, 6 February 2010 (UTC)
Christian, I added an intial message as you suggestec when program runs, currently:
Greetings Earthling! Take me to your Leader.
an obviously silly choice and place holder until I learned what is appropriate.
Can you make a suggestion what message is best for this use?
ChristianWimmer 01:34, 7 February 2010 (UTC) On this topic I also thought about a new name. JEDIedit doesn't seem to be that describing to me.
JEDI XXXX - Removes whitspaces and tabs. Copyright JEDI 2010 written by Conrad Pino Version 1.0, compile date xx. February 2010
ChristianWimmer 01:34, 7 February 2010 (UTC) I still need to look up the format of the other console tools and adapt it. Don't use this right now.
Conrad T. Pino 02:28, 7 February 2010 (UTC)
Wikipedia cannot substitute for legal counsel however I quote from it's Copyright article:
Under the U.S. Copyright Act, a transfer of ownership in copyright must be memorialized in a writing signed by the transferor. For that purpose, ownership in copyright includes exclusive licenses of rights. Thus exclusive licenses, to be effective, must be granted in a written instrument signed by the grantor. No special form of transfer or grant is required. A simple document that identifies the work involved and the rights being granted is sufficient. Non-exclusive grants (often called non-exclusive licenses) need not be in writing under U.S. law. They can be oral or even implied by the behavior of the parties. Transfers of copyright ownership, including exclusive licenses, may and should be recorded in the U.S. Copyright Office. (Information on recording transfers is available on the Office's web site.) While recording is not required to make the grant effective, it offers important benefits, much like those obtained by recording a deed in a real estate transaction.
Given the simplicity of non-exclusive grants I have retained the copyright and attempted liberal licensing, for example:
{==============================================================================} { JEDIedit command line text file editing program, file "JEDIedit.dpr" } { } { Copyright (C) 2010 Conrad T. Pino. All rights reserved. } {------------------------------------------------------------------------------} { The contents of this file are subject to the Mozilla Public License } { Version 1.1 (the "License"); you may not use this file except in } { compliance with the License. You may obtain a copy of the License } { at http://www.mozilla.org/MPL/ } { } { Software distributed under the License is distributed on an "AS IS" } { basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See } { the License for the specific language governing rights and limitations } { under the License. } { } { The Original Code is "JEDIedit.dpr". } { } { The Initial Developer of the Original Code is Conrad T. Pino. } { } { Contributor(s): (none). } { } { Alternatively, the contents of this file may be used under the terms of } { the GPL license (the "GNU General Public License"), in which case the } { provisions of the GPL are applicable instead of those above. If you wish } { to allow use of your version of this file only under the terms of the GPL } { and not to allow others to use your version of this file under the MPL, } { indicate your decision by deleting the provisions above and replace them } { with the notice and other provisions required by the GPL. If you do not } { delete the provisions above, a recipient may use your version of this } { file under either the MPL or the GPL. } {------------------------------------------------------------------------------} { This program is free software: you can redistribute it and/or modify it } { under the terms of the GNU General Public License as published by the } { Free Software Foundation, either version 3 of the License, or (at your } { option) any later version. } { } { This program is distributed in the hope that it will be useful, but } { WITHOUT ANY WARRANTY; without even the implied warranty of } { MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU } { General Public License for more details. } { } { You should have received a copy of the GNU General Public License along } { with this program. If not, see <http://www.gnu.org/licenses/>. } { } { Alternatively, the contents of this file may be used under the terms of } { the MPL license (the "Mozilla Public License"), in which case the } { provisions of the MPL are applicable instead of those above. If you wish } { to allow use of your version of this file only under the terms of the MPL } { and not to allow others to use your version of this file under the GPL, } { indicate your decision by deleting the provisions above and replace them } { with the notice and other provisions required by the MPL. If you do not } { delete the provisions above, a recipient may use your version of this } { file under either the GPL or the MPL. } {==============================================================================}
The above is a work in progress open to further amendment. Any suggestions?
ChristianWimmer 16:40, 7 February 2010 (UTC)
Usually we do not transfer creatorship from the original author. In Germany (and other European countries) creatorship cannot be transfered at all. Only the author can grant rights to the licensee. In this situation the author chooses a license (usually GPL and/or MPL) and JEDI executive agrees to it. In this way we can publish the source code. Users need then to accept this license so they can use the application source code.
Conrad T. Pino 17:51, 7 February 2010 (UTC)
Thank you. I await your further suggestions regarding initial message, copyright or licensing.
ChristianWimmer 14:47, 8 February 2010 (UTC)
You can stick to the given source copyright comment. It is fine. Just copy it to all source files. Also make sure that you remove all unnecessary project files that are not necessary or contain your absolute project paths.
Can't you use the message I already posted? We can still change it later.
Names
- JEDIedit
- (need to think) ChristianWimmer 01:34, 7 February 2010 (UTC)