Page 2 of 3

Re: issue-#92 Office Automation

Posted: Tue Jan 05, 2016 4:47 pm
by Ivan Denisov
Ctl subsystem size is 17 mb. The problem is that we put some ancient trash in hard disks of users.

I am suggesting to keep last versions of bindings.

CtlAccess9
CtlADODB
CtlC
CtlDAO36
CtlExcel9
CtlGraph9
CtlMSForms
CtlOffice
CtlOfficeBinder
CtlOutlook9
CtlPowerPoint9
CtlStdType
CtlT
CtlVBIDE
CtlWord9

Total installation will be 25 versus 35 MB now.

Also the Odf subsystem exists for Open Office binding.
https://bitbucket.org/oberoncore/odf
So the idea for Ctl as separate component is debatable.

Re: issue-#92 Office Automation

Posted: Thu Jan 07, 2016 9:19 am
by Josef Templ
Excel5 can be removed. It is the only version 5 component and
thereby stands out as an exception.

- Josef

Re: issue-#92 Office Automation

Posted: Thu Jan 07, 2016 10:02 am
by Robert
I would suggest only keeping the latest versions as part of the Center-supported & maintained distribution.

To keep the old versions available they could be published as a separate un-maintained library. CPC is the obvious place.

Robert

Re: issue-#92 Office Automation

Posted: Fri Jan 08, 2016 11:42 am
by Josef Templ
Rene has proposed a fix for the bugs in DevComInterfaceGen half a year ago.
Rene, is the fix ready by now?

Most bugs are related to the naming conventions being used for parameters.
It seems to me that most of the bugs can be fixed if we
always start parameter names with a lowercase letter.
This avoids name clashes with identical type names,
which (typically?) start with an uppercase letter.
A more sophisticated rule may be required, though, I don't know yet.
There is also a name clash for auxiliary arrays (arg) declared as local variables.

If DevComInterfaceGen works as expected, it should be added to
the menu COM and then everybody can generate interface modules
for whatever automation servers are installed in Windows.

Regarding the office versions: I can also live with version 9.

Subsystem Ctl should remain as it is but version 5 and 8 office modules could
be moved to a CPC package.

In general, it is not quite trivial to generate interface modules because of dependencies on other modules.
They may need to be renamed in the import list (e.g. IMPORT ..., CtlOffice := CtlOffice15, ... )
for CtlExcel15.

- Josef

Re: issue-#92 Office Automation

Posted: Sat Jan 09, 2016 10:42 am
by luowy
Josef Templ wrote:Most bugs are related to the naming conventions being used for parameters.
It seems to me that most of the bugs can be fixed if we
always start parameter names with a lowercase letter.
This avoids name clashes with identical type names,
which (typically?) start with an uppercase letter.
A more sophisticated rule may be required, though, I don't know yet.
There is also a name clash for auxiliary arrays (arg) declared as local variables.
I did a fixup depending on your tips:
1,DevTypeLibs.ShowFunc :change first letter of parName to lower

Code: Select all

  ....
                      i := 0;
			WHILE i < func.cParams DO                              
				IF i > 0 THEN out.WriteSString("; ") END;
				(*+++   *)
				IF names[i+1, 0] < "a" THEN  <<<add
					names[i+1, 0] := CHR(ORD(names[i+1, 0]) + 32); 
				END; 
				(* +++*)
				IF i = func.cParams - ABS(func.cParamsOpt) THEN out.WriteSString("(* optional *) ") END;
				ShowParam(func.lprgelemdescParam[i], names[i + 1], tinfo, opts, out);
				INC(i)
			END;
...
2,DevTypeLibs.ShowWrapper : change alll "arg" to "argv"

Code: Select all

	PROCEDURE ShowWrapper (VAR [nil] param: ARRAY [untagged] OF WinOleAut.ELEMDESC;
										VAR retTyp: WinOleAut.TYPEDESC;
										VAR names: ARRAY OF WinOle.BSTR;
										par, id, invoke: INTEGER; hasRet: BOOLEAN; opts: SET;
										tinfo: WinOleAut.ITypeInfo; VAR out: TextMappers.Formatter);
		VAR i: INTEGER; type: WinOleAut.TYPEDESC; kind: SHORTINT; hasVar: BOOLEAN;
	BEGIN
		IF (invoke = WinOleAut.INVOKE_PROPERTYPUT) & ~hasRet & (par = 1) THEN
			out.WriteTab; out.WriteSString("BEGIN"); out.WriteLn;
			out.WriteTab; out.WriteTab; out.WriteSString("CtlC.Put");
			WriteShortType(param[0].tdesc, tinfo, out); out.WriteSString("(this, ");
			out.WriteInt(id); out.WriteSString(", ");
			WriteBSTR(names[1], out); out.WriteChar(")"); out.WriteLn
		ELSIF (invoke = WinOleAut.INVOKE_PROPERTYGET) & hasRet & (par = 0) THEN
			out.WriteTab; out.WriteSString("BEGIN"); out.WriteLn;
			out.WriteTab; out.WriteTab; out.WriteSString("RETURN ");
			WriteTypeConv(retTyp, tinfo, get, id, out); out.WriteLn
		ELSE
			hasVar := FALSE;
			IF par > 0 THEN
				IF ~hasVar THEN out.WriteTab; out.WriteTab; out.WriteSString("VAR"); hasVar := TRUE END;
				out.WriteString(" argv: ARRAY "); out.WriteInt(par);
				out.WriteString(" OF CtlT.Variant;")
			END;
			IF hasRet THEN
				IF ~hasVar THEN out.WriteTab; out.WriteTab; out.WriteSString("VAR"); hasVar := TRUE END;
				out.WriteString(" ret: CtlT.Variant;")
			END;
			i := 0;
			WHILE i < par DO
				GetParamType(param[i], tinfo, opts, type, kind);
				IF (kind # value) & IsSpecial(type, tinfo) THEN
					IF ~hasVar THEN out.WriteTab; out.WriteTab; out.WriteSString("VAR"); hasVar := TRUE END;
					out.WriteChar(" "); WriteBSTR(names[i + 1], out); out.WriteString("_TEMP: CtlT.Variant;")
				END;
				INC(i)
			END;
			IF hasVar THEN out.WriteLn END;
			out.WriteTab; out.WriteSString("BEGIN"); out.WriteLn;
			i := 0;
			WHILE i < par DO
				GetParamType(param[i], tinfo, opts, type, kind);
				IF (kind IN {var, varin}) & IsSpecial(type, tinfo) THEN
					out.WriteTab; out.WriteTab; out.WriteSString("CtlC.");
					WriteShortType(type, tinfo, out);
					out.WriteString("Var("); WriteBSTR(names[i + 1], out);
					out.WriteString(", "); WriteBSTR(names[i + 1], out);
					out.WriteString("_TEMP);"); out.WriteLn
				END;
				out.WriteTab; out.WriteTab; out.WriteSString("CtlC.");
				IF kind # value THEN out.WriteSString("Ref") END;
				WriteShortType(type, tinfo, out);
				out.WriteSString("Var("); WriteBSTR(names[i + 1], out);
				IF (kind # value) & IsSpecial(type, tinfo) THEN out.WriteString("_TEMP") END;
				out.WriteSString(", argv["); out.WriteInt(par - i - 1);
				out.WriteSString("]);"); out.WriteLn;
				INC(i)
			END;
			out.WriteTab; out.WriteTab;
			IF par = 0 THEN out.WriteSString("CtlC.CallMethod(this, ")
			ELSIF ODD(invoke DIV WinOleAut.INVOKE_PROPERTYGET) THEN
				out.WriteSString("CtlC.CallGetMethod(this, ")
			ELSIF ODD(invoke DIV WinOleAut.INVOKE_PROPERTYPUT) THEN
				out.WriteSString("CtlC.CallPutMethod(this, ")
			ELSIF ODD(invoke DIV WinOleAut.INVOKE_PROPERTYPUTREF) THEN
				out.WriteSString("CtlC.CallPutRefMethod(this, ")
			ELSE out.WriteSString("CtlC.CallParMethod(this, ")
			END;
			out.WriteInt(id);
			IF par > 0 THEN out.WriteSString(", argv") END;
			IF hasRet THEN out.WriteSString(", ret") ELSE out.WriteSString(", NIL") END;
			out.WriteSString(");"); out.WriteLn;
			i := 0;
			WHILE i < par DO
				GetParamType(param[i], tinfo, opts, type, kind);
				IF (kind IN {var, varout}) & IsSpecial(type, tinfo) THEN
					out.WriteTab; out.WriteTab; WriteBSTR(names[i + 1], out);
					out.WriteSString(" := "); retName := names[i + 1]$ + "_TEMP";
					WriteTypeConv(type, tinfo, ret, 0, out);
					out.WriteChar(";"); out.WriteLn
				END;
				INC(i)
			END;
			IF hasRet THEN
				out.WriteTab; out.WriteTab; out.WriteSString("RETURN ");
				retName := "ret";
				WriteTypeConv(retTyp, tinfo, ret, 0, out); out.WriteLn
			END
		END 
	END ShowWrapper;
test ok with Excel 12.0 (office 2007), but need CtlOffice := CtlOffice12

luowy

Re: issue-#92 Office Automation

Posted: Sun Jan 10, 2016 8:53 pm
by Josef Templ
issue-#92 contains the fixes as proposed by luowy.
I added another fix for Word 15.
It defined the constant 'emptyenum* = 0' for many enumeration types.
This constant is now only defined once.

For the changes see http://redmine.blackboxframework.org/pr ... 827f266d6e.

- Josef

Re: issue-#92 Office Automation

Posted: Mon Jan 11, 2016 3:33 am
by Ivan Denisov
in topic branch I removed old office automation interfaces
Ctl/Docu/Access8.odc
Ctl/Docu/DAO35.odc
Ctl/Docu/Excel5.odc
Ctl/Docu/Excel8.odc
Ctl/Docu/Graph8.odc
Ctl/Docu/Outlook8.odc
Ctl/Docu/PowerPoint8.odc
Ctl/Docu/Word8.odc
Ctl/Mod/Access8.odc
Ctl/Mod/DAO35.odc
Ctl/Mod/Excel5.odc
Ctl/Mod/Excel8.odc
Ctl/Mod/Graph8.odc
Ctl/Mod/Outlook8.odc
Ctl/Mod/PowerPoint8.odc
Ctl/Mod/Word8.odc

Test version: http://blackboxframework.org/unstable/i ... a1.358.zip
New size 6,6 MB vs 8,3 MB old size.

Re: issue-#92 Office Automation

Posted: Mon Jan 11, 2016 3:43 am
by DGDanforth
Ivan Denisov wrote:New size 6,6 MB vs 8,3 MB old size.
Very nice. Better than the 300 MB for Microsoft's SDK.

Re: issue-#92 Office Automation

Posted: Mon Jan 11, 2016 9:32 am
by Josef Templ
I have adapted 2 docu files that still mentioned the old office modules.

@Ivan: I cannot use redmine because of memory issues as happened before.
Redmine seems to need a cleanup or reboot.

Here is the error message produced when clicking on 'Repository':
An error occurred when trying to access the repository: Cannot allocate memory - 'git' '--git-dir' '/var/www/git/blackbox.git' '-c' 'core.quotepath=false' '-c' 'log.decorate=no' 'ls-tree' '-l' 'HEAD:'

- Josef

Re: issue-#92 Office Automation

Posted: Mon Jan 11, 2016 1:58 pm
by Ivan Denisov
Josef Templ wrote:@Ivan: I cannot use redmine because of memory issues as happened before.
Redmine seems to need a cleanup or reboot.

Here is the error message produced when clicking on 'Repository':
An error occurred when trying to access the repository: Cannot allocate memory - 'git' '--git-dir' '/var/www/git/blackbox.git' '-c' 'core.quotepath=false' '-c' 'log.decorate=no' 'ls-tree' '-l' 'HEAD:'
Memory issue is fixed now. Redmine works well.