home *** CD-ROM | disk | FTP | other *** search
- /*
- ** $VER: revision 0.010 (02 Feb 1994) ***
- **
- ** (c) 1993 Marius Gröger
- **
- ** NAME
- ** revision
- **
- ** FUNCTION
- ** Arexx-Script for GoldEd.
- **
- ** Revision a Source-Code/Script/...-File in our new style.
- ** Process a History.
- **
- ** SYNOPSIS
- ** revision HISTORY/K,GOAWAY/K,AUTO/S
- **
- ** INPUTS
- ** HISTORY - Set TRUE for history processing
- ** AUTO - Set TRUE for automatic history processing
- ** GOAWAY - Set TRUE to leave Editor after (successfull) revision
- **
- ** HISTORY - TRUE pour la génération de l'historique
- ** AUTO - TRUE pour la génération automatique de l'historique
- ** GOAWAY - TRUE pour quitter l'Editeur après une révision (réussie)
- **
- ** Set switches to 'TRUE' if you want to turn them on.
- ** Définissez ces switches sur 'TRUE' si vous voulez les activer.
- **
- ** $HISTORY:
- **
- ** 02 Feb 1994 : 000.010 : considers white space settings
- ** 17 Sep 1993 : 000.009 : now keeps rest of line untouched (Kössi)
- ** 21 Jul 1993 : 000.008 : some small enhancements (D.Eilert)
- ** 19 Jul 1993 : 000.007 : fixed bug which appeared with special header-layouts
- ** 19 Jul 1993 : 000.006 : now saves search pattern and case-flag
- ** 19 Jul 1993 : 000.005 : wrong example in Error requester fixed
- ** 18 Jul 1993 : 000.004 : localized title-text
- ** 18 Jul 1993 : 000.003 : added commandline args
- ** 18 Jul 1993 : 000.002 : added history handling
- ** 16 Jul 1993 : 000.001 : initial release
- */
-
- OPTIONS RESULTS /* enable return codes */
- arg doHistory goAway autoHistory
-
- if (LEFT(ADDRESS(), 6) ~= "GOLDED") then /* not started by GoldEd ? */
- address 'GOLDED.1'
-
- 'LOCK CURRENT RELEASE=4' /* lock GUI, gain access */
- if (RC ~= 0) then
- exit
-
- OPTIONS FAILAT 6 /* ignore warnings */
- SIGNAL ON SYNTAX /* ensure clean exit */
-
- /* ----------------------- INSERT YOUR CODE HERE: -------------------- */
-
- changed = 0 /* something to save ? */
-
- 'QUERY CAT' /* query language */
-
- if (result = "deutsch") then do
-
- noText = '"Es ist kein Text im Editor ?!"'
- noHistory = '"Text hat keine History-Kennung*nFormat: $HISTORY:"'
- noVersion = '"Text hat keine Standard-Versionskennung!*nBeispiel: $VER: Name 40.1 (9 Feb 93)"'
- comment = '"Kommentar zur Version '
- end
- else if (result = "français") then do
-
- noText = '"Pas de texte dans le tampon ?!"'
- noHistory = '"Mot-clé de l''Historique manquant|Format: $HISTORY:"'
- noVersion = '"Mot-clé de la version manquant|Exemple: $VER: Nom 40.1 (9 Fev 93)"'
- comment = '"Commentaire sur la version '
- end
- else do
-
- noText = '"No text in buffer ?!"'
- noHistory = '"History keyword missing*nFormat: $HISTORY:"'
- noVersion = '"Version keyword missing*nExample: $VER: Name 40.1 (9 Feb 93)"'
- comment = '"Comment about version '
- end
-
- 'QUERY ANYTEXT'
-
- if (result = 'TRUE') then do /* Only if there is any text */
-
- 'PING SLOT=0' /* save cursor position */
- 'MARK HIDE' /* no blocks, please */
- 'QUERY FIND VAR SPAT' /* remember settings */
- 'QUERY USECASE VAR USECASE'
- 'QUERY SPC VAR SPACE'
-
- /* ------------------ Part I: Version processing ----------------- */
-
- 'FOLD ALL OPEN=TRUE' /* open folds */
- 'FIND FIRST CASE=TRUE QUIET STRING="$VER:"' /* search version id */
-
- if (RC = 0) then do /* found ?? */
-
- 'SET SPC 32' /* set word separator */
-
- 'NEXT' /* skip id and name */
- 'NEXT'
-
- 'QUERY WORD VAR VER' /* what is the word we are over now ? */
-
- /* we must make shure that this is a version.revision number */
- /* we do this by checking the existance of a full stop ('.') */
-
- if (pos('.',ver) ~= 0) then do
-
- version = left(ver, pos('.', ver) - 1)
- revision = right(ver, length(ver) - pos('.', ver)) + 1
-
- if (revision < 10) then
- revision = '00' || revision
- else if (revision < 100) then
- revision = '0' || revision
-
- ver = version || '.' || revision
-
- 'DELETE WORD' /* delete old revision string */
- 'TEXT T="' || ver || '"' /* insert new into the text */
-
- 'RIGHT' /* move over "(" of date string */
-
- 'SET EXCLUDE FALSE'
-
- 'MARK SET COLUMN'
-
- 'BRACKET MATCH' /* find end of date */
-
- 'MARK SET COLUMN EXCLUDE=FALSE' /* delete old date */
-
- 'DELETE BLOCK'
-
- ver = '(' || date() || ')' /* new date */
- 'TEXT T="' || ver || '"' /* insert it into the text */
-
- changed = 1 /* we have something to save */
-
- /* ----------------- Part II: History processing ------------- */
-
- if ((doHistory = 'TRUE') | (autoHistory = 'TRUE')) then do
-
- 'FIND FIRST CASE=TRUE QUIET STRING="$HISTORY:"'
-
- if (RC = 0) then do /* found ? */
-
- 'DOWN' /* skip $HISTORY and empty line */
- 'DOWN'
- 'LINES DOUBLE' /* double last comment */
- 'DELETE EOL' /* delete rest of line */
-
- 'TEXT T="' || RIGHT(date(), 11, ' ') || ' : ' || right(version, 3 ,'0') || '.' || right(revision, 3, '0') || ' : "'
-
- changed = 1 /* we have something to save */
-
- 'REQUEST STRING TITLE=' || comment || version || '.' || revision || '"'
-
- comment = RESULT
-
- if ((RC = 5) | (comment = '')) then /* lazy today ? */
- comment = '- no comment -'
-
- 'FIX VAR=COMMENT'
-
- 'TEXT T="' || comment '"' /* insert log entry */
-
- end
- else if (autoHistory ~= 'TRUE') then /* complain ? */
-
- 'REQUEST PROBLEM=' || noHistory
-
- end /* of 'if doHistory' */
- end
- else
- 'REQUEST PROBLEM=' || noVersion
- end
- else
- 'REQUEST PROBLEM=' || noVersion
-
- /* restore several settings (cursor position, find string, ... */
-
- 'FIX VAR=SPACE' /* replace * by ** */
- 'SET SPC="' || SPACE || '"'
- 'PONG SLOT=0'
- 'FIND STRING="' || spat || '" CASE=' || usecase
-
- /* something to save? */
-
- if (changed) then do
-
- if (goAway = 'TRUE') then
- 'SAVE ALL EXIT'
- else
- 'SAVE ALL'
- end
- end
- else /* no text in buffer */
- 'REQUEST PROBLEM=' || noText
-
- /* -------------------------- END OF YOUR CODE ------------------------ */
-
- 'UNLOCK' /* VERY important: unlock GUI */
- EXIT
-
- SYNTAX:
-
- SAY "Sorry, error line" SIGL ":" ERRORTEXT(RC) ":-("
- 'UNLOCK'
- EXIT
-