/* ** $VER: revision 0.011 (07 Aug 1995) *** ** ** (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 ** GOAWAY - Set TRUE to leave Editor after (successfull) revision ** AUTO - Set TRUE for automatic history processing ** ** HISTORY - TRUE pour la génération de l'historique ** GOAWAY - TRUE pour quitter l'Editeur après une révision (réussie) ** AUTO - TRUE pour la génération automatique de l'historique ** ** Set switches to 'TRUE' if you want to turn them on. ** Définissez ces switches sur 'TRUE' si vous voulez les activer. ** ** $HISTORY: ** ** 07 Aug 1995 : 000.011 : make it work for my robodoc (Kössi) ** 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' /* lock GUI, gain access */ 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: vversion processing ----------------- */ /* 'FOLD ALL OPEN=TRUE' open folds */ /* 'FIND FIRST CASE=TRUE QUIET STRING="$VER:"' */ 'FIND PREV CASE=TRUE QUIET STRING="NAME"' /* search top of header */ 'FIND CASE=TRUE QUIET STRING="$VER:"' /* search vversion id */ IF (RC = 0) THEN DO /* found ?? */ 'SET NAME="SPC" VALUE=" "' /* 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 vversion = 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 = vversion || '.' || revision 'DELETE WORD' /* delete old revision string */ 'TEXT T="' || ver || '"' /* insert new into the text */ 'RIGHT' /* move over "(" of date string */ 'MARK SET COLUMN EXCLUDE=FALSE' '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:"' */ 'FIND CASE=TRUE QUIET STRING="HISTORY"' IF (RC = 0) THEN DO /* found ? */ 'DOWN' /* skip $HISTORY and empty line */ /* 'DOWN' */ 'LINES DOUBLE' /* double last comment */ 'GOTO INDENT' 'NEXT' 'DELETE EOL' /* delete rest of line */ 'TEXT T="'||RIGHT(date(),11,' ')||' : '||right(vversion,3,'0')||'.'||right(revision,3,'0')||' : "' /* changed = 1 we have something TO save */ 'REQUEST STRING TITLE=' || comment || vversion || '.' || 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 NAME="SPC" VALUE="' || 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