uestudio y ctag

uestudio y ctag

Postby fgondi » Mon Mar 17, 2014 11:46 pm

He visto este tema:
http://forums.fivetechsupport.com/viewtopic.php?f=3&t=28213
En el que parece que se puede llamar a la definición de una función que se encuentra en otro prg.

He intentado hacer pruebas, pero no consigo que "ctags" cargue las funciones de todos los prgs del proyecto.

¿Alguien me puede guiar un poco, sobre como conseguirlo?

Gracias.
Un saludo
Fernando González Diez
ALSIS Sistemas Informáticos
User avatar
fgondi
 
Posts: 694
Joined: Fri Oct 07, 2005 6:58 am
Location: Palencia, España

Re: uestudio y ctag

Postby Maurizio » Tue Mar 18, 2014 8:56 am

Hello,

F11 SearchFindSymbol seek a Function in file CTAG
You have to set the path of the file CTAG in Projet -> Option CTAG
The problem is how to create the file
This is a sample of the CTAG file

Code: Select all  Expand view
!_TAG_FILE_FORMAT   1   /extended format; --format=1 will not append ; to lines/
!_TAG_FILE_SORTED   1   /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR    Darren Hiebert  /dhiebert@users.sourceforge.net/
!_TAG_PROGRAM_NAME  Exuberant Ctags //
!_TAG_PROGRAM_URL   http://ctags.sourceforge.net    /official site/
!_TAG_PROGRAM_VERSION   5.6 
//--------------------------------------------------------------------------------------------------
//CCODICE=CODICEDARICERCARE
//NCORTO=CORTODELL'ARTICOLOATTUALE
VEDISECODICELIBERO  d:\prgwin\Mastro\cl_ArBrw.prg   363
RICALCOLALISTINIARTICOLI    d:\prgwin\Mastro\cl_ArBrw.prg   453
::OBRW:UPSTABLE d:\prgwin\Mastro\cl_ArBrw.prg   57
 

instead
F12 IntellitipFindSymbolDef automatically seek the functions in the project file

Regards Maurizio
www.nipeservice.com
User avatar
Maurizio
 
Posts: 796
Joined: Mon Oct 10, 2005 1:29 pm

Re: uestudio y ctag

Postby fgondi » Tue Mar 18, 2014 9:15 am

Hello,

thanks for replying,

How do I file ctag?

Do I have to create the file manually every time?
UEStudio indicates that the file can be automatically created.
Un saludo
Fernando González Diez
ALSIS Sistemas Informáticos
User avatar
fgondi
 
Posts: 694
Joined: Fri Oct 07, 2005 6:58 am
Location: Palencia, España

Re: uestudio y ctag

Postby Maurizio » Tue Mar 18, 2014 9:49 am

I create the file

I use DIRE.DBF where I put the list of the directory to Scan

Regards MAurizio
http://www.nipeservice.com

Code: Select all  Expand view
#include "FiveWin.ch"
static oMeter2
Static lAuto
static aKey ,aDatiW

//-----------------------------------------------------------------------------------------
function Main(cStart)
LOcal bAction := { | oMeter, oText, oDlg, lEnd |  CreaTag( oMeter, oText, oDlg, @lEnd ) }
   lAuto := .F.
   IF cStart # nil .AND. upper(cStart) == 'AUTO'
        lAuto := .T.
    endif
   
  MyMsgMeter( bAction,,"Wait" )

return nil

Static function CreaTag(oMeter, oText, oDlg, lEnd)
   Local aDir := {}
   Local aFile := {}
   Local cSubDir := ""
   Local cFile := ""
   Local cString := ""
   Local nX ,nY := 1
   local nT := 1
   Local aDAti := {}
   Local lOk := .F.
   Local cFileExt := ""
   Local cRiga := ""
   Local cText := + ;
                           '!_TAG_FILE_FORMAT   1   /extended format; --format=1 will not append ; to lines/' + CRLF + ;
                        '!_TAG_FILE_SORTED  1   /0=unsorted, 1=sorted, 2=foldcase/' + CRLF + ;
                        '!_TAG_PROGRAM_AUTHOR   Darren Hiebert  /dhiebert@users.sourceforge.net/'+ CRLF + ;
                        '!_TAG_PROGRAM_NAME Exuberant Ctags //'+ CRLF + ;
                        '!_TAG_PROGRAM_URL  http://ctags.sourceforge.net    /official site/'+ CRLF + ;
                        '!_TAG_PROGRAM_VERSION  5.6 //' + CRLF
   Local cDati := cText
   Local cFileDat :=  "c:\FWMY\prova.tag"
   Local cDir := "d:\prgwin\" + space(20)

  * Local cFileDat :=  "
c:\temp\list.tag"
  * Local cDir := "
c:\fwh\"
   
   Local nOutFile := 0
   Local nTot := 0    
   Local aDbf := {}
   Local lNew := .f.
   Local cChiave := "
"
   lOCAL nKey := 1

   aKey := {}
   aDatiW := {}
   
   
   
   REQUEST DBFCDX
   rddsetdefault( "
dbfcdx" )
 
   IF ! lAuto
    MsgGet("
", "Name file cTags ", @cFileDat )
   
    MsgGet("
", "Folder to scan (include subdirectoris) ", @cDir )
    
    
    IF MsgNoYes( "
Re-read the directory ?", ""  )
       ferase("
DIRE.DBF")
       lNew := .T.
      ENDIF
   endif
   
   
  if ! file("
DIRE.DBF")                            
     AADD (aDbf, {"
RIGA",    "C",  50, 0 })
     dbcreate("
DIRE", aDbf , "DBFCDX")
  ENDIF
  USE ("
DIRE") VIA "DBFCDX"
   
   
   cDir := trim(cDir)
   aDir :=  DIRECTORY(cDir,"
D")
   IF lNew
    ZAP
    FOR nX := 1 to len(aDir)
         IF aDir[nX,5] == "
D"
              cSubDir := cDir + aDir[nX,1] + "
\"  
            dbappend()
             field->RIGA := cSubDir    
         ENDIF
      NEXT
   ENDIF
   IF ! lAuto
      BROWSE()  
   ENDIF
   dbgotop()
   
   nOutfile := FCREATE(cFileDat, 0)

   FWRITE(nOutfile, cText, len(cText))

   do while ! eof()
       aFile := DIRECTORY((trim(field->RIGA)))
           FOR nY := 1 to len(aFile)
              cFile :=  aFile[nY,1]
              IF cFileExt(cFile) == "
PRG"
                  nTot++   
              ENDIF 
           NEXT  
     dbskip()
   enddo
   
   oMeter2:nTotal:= nTot  
   nTot := 1
       
   *For nX := 1 to len(aDir)
   dbgotop()
   nX := 0
   do while ! eof()
    nX++   
           cSubdir := trim(field->RIGA)
           aFile := DIRECTORY(cSubDir)
       
           for nY := 1 to len(aFile)
             cFile :=  aFile[nY,1]
             IF cFileExt(cFile) == "
PRG"
                oMeter:cText :=  cSubDir + "
\" + cFile + "   " + str(nX)  +   str(len(aDir))
               cDati :=  ScriviFile(cSubdir + cFile,oMeter,@cChiave)
               IF ! empty(cDAti)
                    nKey++
               ENDIF  
               nTot++
               oMeter2:Set(nTot )
               oMeter2:cText := str(nTot)+ "
/" + str(oMeter2:nTotal)
              endif    
              IF lEnd
                  exit
              endIF
           NEXT
          
     dbskip()     
    enddo  
   
  ASort( aKey ,,, {|x,y| x[1] > y[1] } )
  ASort(aDatiW)
  FOR nX := 1 to len(aDatiW)   
       FWRITE(nOutfile, aDAtiW[nX], len(aDAtiW[nX]))
  NEXT  
 
 
 
  FCLOSE(nOutfile)

   
return .t.
//---------------------------------------------------------------------------------------------
Static function ScriviFile(cFileExt,oMeter,cChiave)
Local cFile := "
"
Local nX := 0
Local nT := 1
Local cString := "
"
Local lOk := .F.
Local cDati := "
"  

   cChiave := "
"
   cString := MEMOREAD(cFileExt)
   nT :=  MLCOUNT(cString,254)
   oMeter:nTotal := nT  // CARICAVERIFICHe

   for nX := 1 TO nT
     lOk := .F.
       cFile :=  UPPER(memoline(cString,254,nX))
     
       IF at("
FUNCTION",cFile) > 0
         cFile := STRTRAN(cFile, "
FUNCTION", "")
          cFile := STRTRAN(cFile, "
STATIC", "")
          lOk := .T.    
       ENDIF   
       if Lok ==.f.
        
        IF at("
METHOD",cFile) > 0
           IF at("
CLASS",cFile) > 0
               cFile := STRTRAN(cFile, "
METHOD", "")
               lOk := .T.    
               
            endIF  
        ENDIF   
       ENDIF   // RECNO
       IF lOk
         cFile := STRTRAN(cFile, "
", "")
          cFile := SUBSTR(cFile,1,AT("
(",cFile)-1)
          cFile := trim(cFile)
          IF substr(cFile,1,1) == "
*"
             cFile := "
"
          ENDIF 
          IF ! empty(cFile)
             cChiave := alltrim(cFile)
             cFile += chr(9) +  cFileExt     + chr(9) + alltrim(str(nX))
             cDati += cFile + CRLF  
             aadd(aDAtiW,cFile + CRLF)
             
          ENDIF
         endif
       oMeter:Set(nX )
       
    next

Return cDati
//======================================================================================================
function MyMsgMeter( bAction, cMsg, cTitle )

   local oDlg, oMeter, oText, oBtn, oFont
   local lEnd := .f., lCancel := .f.
   local nVal,nVal2 := 0

   DEFAULT bAction := { || nil },;
           cMsg := "
Processing...", cTitle := "Please, wait"

   DEFINE FONT oFont NAME GetSysFont() SIZE 0, -8

   DEFINE DIALOG oDlg FROM 5, 5 TO 13, 45 TITLE cTitle FONT oFont

   @ 0.2, 0.5  SAY oText VAR cMsg SIZE 130, 10 OF oDlg

   @ 1,   0.5  METER oMeter  VAR nVal TOTAL 10 SIZE 150, 10 OF oDlg
   
   @ 2,   0.5  METER oMeter2 VAR nVal2 TOTAL 10 SIZE 150, 10 OF oDlg
   
   

   @  2.2,  10.4  BUTTON oBtn PROMPT "
&Cancel" OF oDlg ;
      ACTION ( lEnd:= .t., lCancel:= .t. ) SIZE 32, 11

   oDlg:bStart = { || Eval( bAction, oMeter, oText, oDlg, @lEnd, oBtn ),;
                      lEnd := .t., oDlg:End() }

   ACTIVATE DIALOG oDlg CENTERED ;
      VALID lEnd

   oFont:End()

return lCancel


User avatar
Maurizio
 
Posts: 796
Joined: Mon Oct 10, 2005 1:29 pm

Re: uestudio y ctag

Postby fgondi » Tue Mar 18, 2014 10:15 am

Ok,

thank you very much for your help

I will use that code.

On this website, as I found ctags to include new programming languages​​.
http://ctags.sourceforge.net/EXTENDING.html
I will investigate.
Un saludo
Fernando González Diez
ALSIS Sistemas Informáticos
User avatar
fgondi
 
Posts: 694
Joined: Fri Oct 07, 2005 6:58 am
Location: Palencia, España

Re: uestudio y ctag

Postby fgondi » Tue Mar 18, 2014 5:11 pm

He conseguido que uEstudio cree el fichero tags con todas las funciones del proyecto.

1º He creado un fichero (con nombre Harbour.ctags) con el siguiente código:
Code: Select all  Expand view
--langdef=Harbour
--langmap=Harbour:.prg.ch

--regex-Harbour=/^FUNCTION [\t]*([a-zA-Z0-9_]+)/\1/f,function/
--regex-Harbour=/^[Ff]unction [\t]*([a-zA-Z0-9_]+)/\1/f,function/

--regex-Harbour=/^FUNC [\t]*([a-zA-Z0-9_]+)/\1/f,function/
--regex-Harbour=/^[Ff]unc [\t]*([a-zA-Z0-9_]+)/\1/f,function/

--regex-Harbour=/^PROCEDURE [\t]*([a-zA-Z0-9_]+)/\1/p,procedure/
--regex-Harbour=/^[Pp]rocedure [\t]*([a-zA-Z0-9_]+)/\1/p,procedure/

--regex-Harbour=/^PROC [\t]*([a-zA-Z0-9_]+)/\1/p,procedure/
--regex-Harbour=/^[Pp]roc [\t]*([a-zA-Z0-9_]+)/\1/p,procedure/

--regex-Harbour=/^#DEFINE [\t]*([a-zA-Z0-9_]+)/\1/d,define/
--regex-Harbour=/^#[Dd]efine [\t]*([a-zA-Z0-9_]+)/\1/d,define/

--regex-Harbour=/CLASS [\t]*([a-zA-Z0-9_]+)/\1/c,class/
--regex-Harbour=/[Cc]lass [\t]*([a-zA-Z0-9_]+)/\1/c,class/

--regex-Harbour=/DATA [\t]*([a-zA-Z0-9_]+)/\1/m,data/
--regex-Harbour=/[Dd]ata [\t]*([a-zA-Z0-9_]+)/\1/m,data/

--regex-Harbour=/METHOD [\t]*([a-zA-Z0-9_]+)/\1/m,method/
--regex-Harbour=/[Mm]ethod [\t]*([a-zA-Z0-9_]+)/\1/m,method/

--regex-Harbour=/MESSAGE [\t]*([a-zA-Z0-9_]+)/\1/m,method/
--regex-Harbour=/[Mm]essage [\t]*([a-zA-Z0-9_]+)/\1/m,method/
 


2º "Parametros del CTAG" que se encuentra en Proyecto -> Configurar opciones de CTAG lo he cambiado con lo siguiente:
Code: Select all  Expand view
--options="D:\Google_Drive\Descargas\Uestudio\Instalacion FWH\ctags\Harbour.ctags" --language-force=Harbour -L %fi -f %fo

Siendo "D:\Google_Drive\Descargas\Uestudio\Instalacion FWH\ctags" la ruta donde esta almacenado el fichero del punto 1 (Harbour.ctags)

3º En la configuración del proyecto, pestaña opciones lo he cambiado a:
He activado "Soporte CTAG heredado"
He introducido la ruta del archivo ctag que quiero que se cree en el proyecto
He activado "Crear archivo CTAG al cargar el proyecto"

Listo.
Con esto cada vez que entro en el proyecto, se crea el archivo ctag del proyecto y puedo pulsar F11 para acceder a la definición de la función
Un saludo
Fernando González Diez
ALSIS Sistemas Informáticos
User avatar
fgondi
 
Posts: 694
Joined: Fri Oct 07, 2005 6:58 am
Location: Palencia, España


Return to Off Topic / Otros temas

Who is online

Users browsing this forum: Google [Bot] and 6 guests