Compile adonix source from a program

We all know the main way to compile an adonix source:
in Sage X3 version 6.x and earlier, in fact, there is a special editor (ADOTRT function) available,
from where you can compile with the F7 function key or with the appropriate menu.

From 7.x, in the web interface there is still the ADOTRT function available, with the “Compile” button available,
but the F7 key is no longer available, and ESC-F7 escape sequence can not be used.

From version 7.x we also have Eclipse available through the pluging Safe X3.

But if for some reason we needed to compile a source from a program?
Or if we wanted to recompile all the sources starting with Y?

(By the way, you know that the changes made by the end customer should they start with the Z?
The Y would be reserved for consultant developments…)

To do this, the following call is helpful:

Call VALID(FOLDER,SOURCE, DOSSIER, OK) From VALMSKSUB

Where:

  • FOLDER is the folder where the file to be compiled is contained
  • SOURCE is the name of the file, which must have extension src, to be compiled (but the name must be indicated without extension, for example “SPESOH”)
  • DOSSIER is the name and dossier in which the folder is located: put nomap and it’s ok, except for special uses
  • OK is a variable of integer type to indicated if the compilation was successful

To compile all customized sources, we can do:

Local Char DIR(GDIMFIC), FILELIST(GDIMFIC)(1..100)
Local Integer LENG
DIR="C:\SAGE\"+nomap+"\TRT\Y*.src"
Call SYSTEME2 (adxmac(0),"dir /b "-DIR,"",LENG,FILELIST) From ORDSYS
Local Integer OK
For I=1 To LENG
  Call VALID("TRT",seg$(FILELIST(I),1, instr(1,FILELIST(I),".src")-1), nomap, OK) From VALMSKSUB
  Next
End

Some comments:

  1. nomap o nomap(0), it’s the same, returns the name of the current dossier
  2. seg$(STR, start, end) returns a substring of STR that starts from the character in start position, up to index character end
  3. instr(start, STR, find) search the string find in STR from index start and returns the position

Summing up

seg$(FILELIST(I),1, instr(1,FILELIST(I),".src")-1)

need to remove “.src” from the file name.

You could use other dos commands to already have just the name directly, but it was less fun!

 

I hope you find it useful!

You may also like...

Leave a Reply