Code folding request: Arbortext Command Language

This forum should be used for all code folding problems, questions or suggestions. You can also use this forum to request folding support for a new language.
Post Reply
kleist
Posts: 22
Joined: Tue Jan 11, 2011 6:20 pm

Code folding request: Arbortext Command Language

Post by kleist »

Hi Jussi,

Would you please add folding support for "Arbortext Command Language" (as used by the SGML/XML editor "Arbortext Editor").

Extensions: .acl
Line Comment: #
Block Comment: [not supported]
Begin: {
End: }
Sample Code:

Code: Select all

function layout::linenum(doc = current_doc(), source = -1)
{

	local line_counter = 1;
	local row_line_base = 0;
	local row_line_counter = 1;
	local errors = 0;
	local i;
	local save_doc = current_doc(doc);
	
	#walk the doc from start to end,
	#modifying each startline attr1 with the value of the line counter
	#and each startpage attr1 with the value of its number attribute
	local oids[];
	oid_find_children(oid_null(), oids, "atipl::*", 0x08);
		
	for(i in oids) {
		local name = oid_name(oids[i]);
	    	layout::clear_attrs(oids[i]);

		if( name == "atipl:startpage" ) {
			if(!oid_modify_attr(oids[i], "attr1", oid_attr(oids[i], "number")) ){
				_composerlog::add_record($_eventlog::SEVERITY_ERROR, 'Unable to modify startpage attr1 for oid: ' . $oids[i]);
				errors++;
			}
			line_counter = 1;
		}
		
		#only set attr1 on startlines that contain something other than gentext
		else if( ( name == "atipl:startline" ) && ( ( oid_attr(oids[$i], "typemask" ) ) & 1 ) ){
		    if( row_line_base == 0 || row_line_counter <= line_counter) {
			if(!oid_modify_attr(oids[i], "attr1", $line_counter)){		
				_composerlog::add_record($_eventlog::SEVERITY_ERROR, 'Unable to modify startline attr1 for oid: ' . $oids[i]);
				errors++;
			}
		    }
		    line_counter++;
		}

		else if( name == "atipl:startrow" ) {
		    row_line_base = line_counter;
		    row_line_counter = 0;
		}

		else if( name == "atipl:endrow" ) {
			if(line_counter <  row_line_counter) {
				line_counter = row_line_counter;
		    }
		    row_line_base = 0;
		}

		else if( name == "atipl:startentry" ) {
		    line_counter = row_line_base;
		}

		else if( name == "atipl:endentry" ) {
		    if (row_line_counter < line_counter) {
			row_line_counter = line_counter;
		    }
		}
	}
	
	# toggle gentext in order to force a redisplay
	if(option("gentext") == "on") {
		set gentext=off;
		set gentext=on;
	}

	# reset the current doc
	current_doc(save_doc);	
	
	return (errors == 0);
}
Thanks!
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

The good news is a folder for this style of code already exists :)

Just locate and edit the xFolder.ini file and then find this line:

Code: Select all

TCL=tcl
and change it to be:

Code: Select all

TCL=tcl;acl

For Vista, Windows 7 the file should be in this fodler location:

Code: Select all

C:\Users\CurrentUser\AppData\Roaming\Xidicone\Zeus\

For other versions of Windows look for the file in this folder location:

Code: Select all

C:\Program Files\Zeus\


Cheers Jussi
kleist
Posts: 22
Joined: Tue Jan 11, 2011 6:20 pm

Post by kleist »

Works beautifully. Thanks!
kleist
Posts: 22
Joined: Tue Jan 11, 2011 6:20 pm

For the posterity: keyword information file

Post by kleist »

I haven't found out how to create an attachment, so here is a "keyword information file" for ACL (Arbortext Command Language). Import it from the "Keywords" tab on the Document Type Properties dialog:

Code: Select all

;
; Zeus Keyword Information File
; =========================================
;
; This is a keyword information file for the Zeus for Windows IDE:
;
;     http://www.zeusedit.com/index.html
;
; This file can be used to create or configure the Keywords section
; of the Zeus document type.
;
; NOTE: To correctly import this file make sure it has a .zki file 
;       extension.
;
[Syntax]
CommentStart01=
CommentEnd01=
NestsComments01=No
LineComment01=#
CommentStart02=
CommentEnd02=
NestsComments02=No
LineComment02=
Delimiters=#~!@$%^&*()[]{}<>=+/?|;:-,.
DelimitKeywords=No
IgnoreCase=No
Literal=
ManageComments=No
Numbers=(0x*[0-9A-Fa-f]+[Hh]*)|([0-9]+(L*))
Preprocessor=
Strings="'
TripleQuotes=No

[ReservedWords]
FileClose
alias
autoload
beep
break
caret
case
cc
cd
change_tag
check_completeness
clear_mark
clm
continue
copy_file
copy_keymap
copy_mark
cpm
default
define_keymap
define_tag
delete_buffer
delete_char
delete_mark
delete_tag
detail
edit
else
eval
exe
exec
execute
find
for
function
global
help
if
insert_string
insert_tag
keymap_destroy
link
local
map
mark
mark_tag_at_caret
mark_word
menu
menu_add
menu_change
menu_delete
menu_load
menu_move
mes
message
mkdir
modify_tag
move_file
mt
newline
options
package
paste
read
readvar
redisplay
require
return
rm
save
save_as
set
sh
show
source
switch
tag_display
td
undefine_keymap
undefine_tag
undo
unmap
unsetvar
while
word_left
write

[ExReservedWords]
Pattern=
IsNested=No

[UserWords1]

[ExUserWords1]
Pattern=
IsNested=No

[UserWords2]

[ExUserWords2]
Pattern=
IsNested=No

[UserWords3]

[ExUserWords3]
Pattern=
IsNested=No

[UserWords4]

[ExUserWords4]
Pattern=
IsNested=No

[UserWords5]

[ExUserWords5]

Pattern=
IsNested=No
Yanka
Posts: 2
Joined: Mon Mar 12, 2012 2:08 pm

Post by Yanka »

Thanks! It works perfectly!
bolivio
Posts: 1
Joined: Wed Mar 14, 2012 1:41 pm

Post by bolivio »

I have just started to work with ArborText Command language. I' using a number variable as a counter and the counter needs to increment by one. How can I do that?
Last edited by bolivio on Sat Apr 28, 2012 5:15 am, edited 1 time in total.
kleist
Posts: 22
Joined: Tue Jan 11, 2011 6:20 pm

Post by kleist »

Bolivio,

This is not a good place for discussing ACL. Try the "adepters" mailing list. You have to sign up as a list member first.

If your company is interested to pay for consulting, feel free to contact me at "karl.johan@kleist-it-consulting.de". I have more than five years full time expericence from ACL development.
Post Reply