Created
December 21, 2021 13:10
-
-
Save jbratu/626f8fcfde48b7832138c7c76583bbbb to your computer and use it in GitHub Desktop.
Code from Revelation Software provided as a Works support request when asking how to programatically create an RDK.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
subroutine t_Refresh_blank_rdk(void) | |
/* | |
** Build rdks identical to what comes from RDK window, so can be installed with RDKINSTALL | |
** But, uses a list of items stored in SYSLISTS. | |
** | |
** Creates RDK as a subfolder In the base folder | |
** rdk_LIST_ID_yyyymmdd contains all source And executables | |
*/ | |
$insert Logical | |
Declare Function retstack, Repository | |
/* SysList contining object ids | |
* entries should look like table/row | |
* You want the list to contain the row and the corresponding SYSREPOS rows | |
* If you mak a normal RDK with the RDK window, then attach the rdk folder and list SYSUPGRADE you will see the id of the rows it puts in there | |
* You list should look the same, for example. | |
* You can put dictionary and data rows in your list too, this tool will deploy them, RDKINSTALL will install them | |
* But you will need to your the [CREATE_TABLE] instruction in the %PROCESS% recrod is you are making a new table ( see below ) | |
SYSENV/SYS_TABLE_TYPES | |
SYSLISTS/CBBFS_COMPONENTS | |
SYSOBJ/$BASE64DECODE | |
SYSOBJ/$BASE64ENCODE | |
SYSOBJ/@BASE64DECODE | |
SYSOBJ/@BASE64ENCODE | |
SYSPROCS/BASE64DECODE | |
SYSPROCS/BASE64ENCODE | |
SYSREPOS/SYSPROG*STPROCEXE**BASE64DECODE | |
SYSREPOS/SYSPROG*STPROCEXE**BASE64ENCODE | |
SYSREPOS/SYSPROG*STPROCDBG**BASE64DECODE | |
SYSREPOS/SYSPROG*STPROCDBG**BASE64ENCODE | |
SYSREPOS/SYSPROG*STPROC**BASE64DECODE | |
SYSREPOS/SYSPROG*STPROC**BASE64ENCODE | |
MYDATAFILE/MYROW | |
*/ | |
LIST_ID = 'MY_COMPONENTS' | |
ids = Xlate('SYSLISTS', list_id, '', 'X') | |
If ids = '' Then | |
debug | |
end | |
atself = retstack()<1> | |
* Write to base\rdk_LIST_ID_yyyymmdd | |
* Change base to what you want, not the trailing slash | |
base ='c:\TEMP\' | |
If base[-1,1] = '\' Else | |
base := '\' | |
End | |
today = Oconv(date(), 'D4/') | |
suffix = today[-4,4]:today[1,2]:today[4,2] | |
rdkpath = base:'RDK_':list_id:'_':suffix | |
* Make Sysupgrade table | |
Call Set_Status(0) | |
call Detach_Table('SYSUPGRADE') | |
call attach_table(rdkpath,'SYSUPGRADE','GLOBAL') | |
If Get_Status(err) then | |
attribs = '1000,500,5,2048,80' | |
If dir(rdkpath)<2> else | |
Call Utility('MAKEDIR', rdkpath) | |
end | |
Call Create_table(rdkpath, 'SYSUPGRADE', 0, 'GLOBAL', attribs, 0) | |
call attach_table(rdkpath,'SYSUPGRADE','GLOBAL') | |
End else | |
Call clear_Table('SYSUPGRADE') | |
end | |
IF tableExists('SYSUPGRADE') else | |
debug | |
err = 'What no upgrade' | |
return | |
end | |
/* Headers - these are rows injected into SYSUPGRADE by the rdkdeploy routines | |
* | |
* Normally you leave these as-is. The one exception is the %PROCESS% record. | |
* %PROCESS% is where you put in any script with [CREATE_TABLES] or [DELETE_ROWS] or other special instructions. | |
* It is like an ini file with sections and then rows which fit that section | |
* See RDKDEPLOY_EQUATES and read the source for RDKMODUDULEINSTALL to see how these sections work. | |
* By default %PROCESS% is blank and can be left blank if you just need to copy in rows | |
* I've assumed you will make a record named <list_id>_PROCESS if you have special handling, else the Xlate will return null | |
* | |
* | |
EQU CREATEAPP$ TO "[CREATE APPLICATION]" | |
EQU CREATEFILE$ TO "[CREATE TABLES]" | |
EQU COPYFILE$ TO "[COPY TABLES]" | |
EQU DELETEFILE$ TO "[DELETE TABLES]" | |
EQU ATTACHFILE$ TO "[ATTACH TABLES]" | |
EQU DETACHFILE$ TO "[DETACH TABLES]" | |
EQU ALIASFILE$ TO "[ALIAS TABLES]" | |
EQU COPYOSFILE$ TO "[COPY OSFILE]" | |
Equ COPYOSFOLDER$ To "[COPY OSFOLDER]" | |
EQU UPDATEROW$ TO "[UPDATE ROWS]" | |
EQU DELETEROW$ TO "[DELETE ROWS]" | |
EQU EXECPROC$ TO "[EXECUTE PROCEDURES]" | |
EQU LINKPROCESS$ TO "[CHAIN PROCESS]" | |
EQU DECLAREDLL$ TO "[DECLARE DLL]" | |
EQU EXECPROCPOST$ TO "[EXECUTE PROCEDURES POST]" | |
*/ | |
process_template = Xlate('SYSLISTS', list_id:'_PROCESS', '','X') | |
Call Write_row('SYSUPGRADE', '%PROCESS%', process_template, 0) | |
Call Write_row('SYSUPGRADE', '%MODULE%', 'MVBFS', 0) | |
installer = Xlate('SYSOBJ', '$RDKMODULEINSTALL', '', 'X') | |
Call Write_row('SYSUPGRADE', '%RUN%', installer, 0) | |
Call Write_row('SYSUPGRADE', '%REQLO%', '0', 0) | |
is_sysprog = ( @appid<1> eq 'SYSPROG' ) | |
icol = '' | |
loop | |
Remove id From ids at icol Setting imark | |
If id # '' Then | |
If Index(id, '/',1) Then | |
target_id = id | |
table = Field(id, '/',1) | |
id = Field(id, '/',2,999) | |
End else | |
table = 'SYSREPOS' | |
target_id = table:'/':id | |
end | |
rec = xlate(table, id, '', 'X') | |
if len(rec) Then | |
call Write_row('SYSUPGRADE', target_id, rec, 1) | |
Call send_info(id) | |
Call Set_Status(0) | |
class = Field(id, '*', 2) | |
name = id[-1,'B':'*'] | |
source_Table = '' | |
source_rec = '' | |
Begin Case | |
*Case table # 'SYSREPOS' | |
Case class = 'STPROC' | |
source_table = 'SYSPROCS' | |
If is_sysprog Then | |
source_id = name | |
End else | |
source_id = name:'*':@appid<1> | |
End | |
rec = xlate(source_table, source_id, '', 'X') | |
target_id = source_table:'/':source_id | |
Case class = 'STPROCINS' | |
source_table = 'SYSPROCS' | |
If is_sysprog Then | |
source_id = name | |
End else | |
source_id = name:'*':@appid<1> | |
End | |
rec = xlate(source_table, source_id, '', 'X') | |
target_id = source_table:'/':source_id | |
Case class = 'STPROCEXE' | |
source_table = 'SYSOBJ' | |
If is_sysprog Then | |
source_id = '$':name | |
End else | |
source_id = '$':name:'*':@appid<1> | |
end | |
rec = xlate(source_table, source_id, '', 'X') | |
target_id = source_table:'/':source_id | |
Case class = 'STPROCDBG' | |
source_table = 'SYSOBJ' | |
If is_sysprog Then | |
source_id = '@':name | |
End else | |
source_id = '@':name:'*':@appid<1> | |
end | |
rec = xlate(source_table, source_id, '', 'X') | |
target_id = source_table:'/':source_id | |
Case class = 'OIWIN' | |
source_table = 'SYSREPOSWINS' | |
source_id = @appid<1>:'**':name | |
rec = xlate(source_table, source_id, '', 'X') | |
target_id = source_table:'/':source_id | |
Case class = 'OIWINEXE' | |
source_table = 'SYSREPOSWINEXES' | |
source_id = @appid<1>:'**':name | |
rec = xlate(source_table, source_id, '', 'X') | |
target_id = source_table:'/':source_id | |
Case class = 'OIEVENT' | |
type = Field(id, '*', '3') | |
source_table = 'SYSREPOSEVENTS' | |
source_id = @appid<1>:'*':TYPE:'*':name | |
rec = xlate(source_table, source_id, '', 'X') | |
target_id = source_table:'/':source_id | |
Case class = 'OIEVENTEXE' | |
type = Field(id, '*', '3') | |
source_table = 'SYSREPOSEVENTEXES' | |
source_id = @appid<1>:'*':TYPE:'*':name | |
rec = xlate(source_table, source_id, '', 'X') | |
target_id = source_table:'/':source_id | |
Case 1 | |
source_table = '' | |
source_id = '' | |
End Case | |
If source_table Then | |
target_rec = Xlate(SOURCE_TABLE, source_id, '', 'X') | |
If rec # '' then | |
call Write_row('SYSUPGRADE', target_id, target_rec, 0) | |
end | |
End | |
End | |
end | |
While imark | |
repeat | |
Call Set_Status(0) | |
Call detach_Table('SYSUPGRADE') | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment