openoffice-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brick Ma <brickman...@gmail.com>
Subject Re: ruby uno to control openoffice
Date Fri, 03 Apr 2015 14:26:12 GMT
10 files in  C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include
has #define OPTIONAL.
I don't know how to do with these files,then i replaced all the OPTIONAL to
XOPTIONAL.Compile is OK,but the script shows the same error .Maybe
something else wrong?

-Brick

On Fri, Apr 3, 2015 at 2:52 AM, Dennis E. Hamilton <dennis.hamilton@acm.org>
wrote:

> Yes, the (#define OPTIONAL OPTIONAL) will break many things, even if it
> removes a parser error message.
>
> Where the error occurred the first time, there are many lines the same.
> See if you can find either declarations or #define statements for any of
> those capitalized names that do not fail.
>
> There may be clues there.
>
>  - Dennis
>
> -----Original Message-----
> From: Brick Ma [mailto:brickman889@gmail.com]
> Sent: Thursday, April 2, 2015 08:47
> To: dev; Dennis Hamilton
> Subject: Re: ruby uno to control openoffice
>
> I wrote a line(#define OPTIONAL OPTIONAL) in PropertyAttribute.hdl.
> It seems works.
>
> E:\RUNO-master\include\com/sun/star/beans/PropertyAttribute.hdl(3) :
> warning C40
> 05: 'OPTIONAL' : macro redefinition
>         C:\Program Files (x86)\Microsoft
> SDKs\Windows\v7.0A\include\windef.h(84)  //got u
>  : see previous definition of 'OPTIONAL'
>
> There is another error shows as follows.
>
> C:\OpenOffice\Basis\sdk\include\systools/win32/snprintf.h(85) : error
> C2375: 'ru
> by_snprintf' : redefinition; different linkage
>         c:\ruby-2.2\include\ruby-2.2.0\ruby/ruby.h(1809) : see declaration
> of 'r
> uby_snprintf'
>
> Rename snprintf in snprintf.h or ruby_snprintf in ruby.h compiles.
> But when i try to open a document,error comes out.
>
> code:
> require 'uno'
> data = {'type' => 'socket', 'host' => 'localhost',
>         'port' => 2083, 'protocol' => 'urp'}
> ctx = Uno::Connector.connect(data)     //runo can connect to openoffice,if
> openoffice is not ready,runo will say no connection.
> smgr = ctx.getServiceManager
> desktop = smgr.createInstanceWithContext(
>                    "com.sun.star.frame.Desktop",ctx)     //error comes
> doc = desktop.loadComponentFromURL("private:factory/swriter", "_blank", 0,
> [])
> doc.getText.setString("Hello Ruby!")
>
> error:
> runo_exception_exception, 0
> #<Uno::Com::Sun::Star::Uno::RuntimeException:
> Uno::Com::Sun::Star::Uno::RuntimeE
> xception>
> t.rb:6:in `method_missing': Uno::Com::Sun::Star::Uno::RuntimeException
> (Uno::Com
> ::Sun::Star::Uno::RuntimeException)
>         from t.rb:6:in `<main>'
> shell returned 1
> :in `method_missing': Uno::Com::Sun::Star::Uno::RuntimeException (Uno::Com
> ::Sun::Star::Uno::RuntimeException)
>         from t.rb:6:in `<main>'
> shell returned 1
>
> The same error as  i met before.
> Oh,what should i do?
>
> -Brick
>
>
> On Thu, Apr 2, 2015 at 2:08 AM, Brick Ma <brickman889@gmail.com> wrote:
>
> > Thanks for your patient and detailed reply,Dennis.
> >
> > You are right.OPTIONAL was replaced by preprocessor.
> > cl /P yields module.i
> > OPTIONAL was disappeard in module.i
> > But i have not found where is #define OPTIONAL .
> > I will search again tomorrow.
> > -brick
> >
> > On Wed, Apr 1, 2015 at 10:56 AM, Dennis E. Hamilton <
> > dennis.hamilton@acm.org> wrote:
> >
> >> You cannot disable the preprocessor.  That will cause *everything* to
> >> fail.
> >>
> >> Some place, there is a
> >>
> >>         #define OPTIONAL <value>
> >>
> >> That you want to work.  It might be in an #include file.  Ideally, it is
> >> in the same file where it is being used, but that may be unlikely.
> >>
> >> You need to find all of the places in the code that uses that header and
> >> uses OPTIONAL and it is not in anything like #ifdef OPTIONAL but some
> usage
> >> where it is clear that a variable or expression form is expected in
> regular
> >> code.  That is likely the one place where you are seeing the failure.
> >>
> >> The clean fix is to change the name in both places.  Most programs are
> >> careful to do this in the first place, to avoid conflicts with other
> usage
> >> of a similar term.
> >>
> >> Because this is an .hdl, it may be more complicated than that.  There
> may
> >> also be failures elsewhere that are undetected because they do not
> cause a
> >> syntax error.
> >>
> >> I am not where I can look right now.  Nose around.  There should be some
> >> related definitions in the same part of the source tree.
> >>
> >>  - Dennis
> >>
> >> -----Original Message-----
> >> From: Brick Ma [mailto:brickman889@gmail.com]
> >> Sent: Monday, March 30, 2015 08:06
> >> To: dev; dennis.hamilton@acm.org
> >> Subject: Re: ruby uno to control openoffice
> >>
> >> But with the same PropertyAttribute.hdl i had built c++ sample
> >> DocumentLoader.cxx,and it works .
> >> How can i disable this feature of pre-processor
> >>
> >> -Brick
> >>
> >> On Sun, Mar 29, 2015 at 11:56 PM, Dennis E. Hamilton <
> >> dennis.hamilton@acm.org> wrote:
> >>
> >> > It appears that OPTIONAL is defined to empty string in a pre-processor
> >> > definition.
> >> >
> >> > This is probably a conflict with use of OPTIONAL as a way of
> controlling
> >> > code inclusion and not as name of a feature in a bit flag [;<).
> >> >
> >> >  - Dennis
> >> >
> >> > -----Original Message-----
> >> > From: Brick Ma [mailto:brickman889@gmail.com]
> >> > Sent: Sunday, March 29, 2015 07:09
> >> > To: dev
> >> > Subject: ruby uno to control openoffice
> >> >
> >> > Hi,All
> >> > There is a runo on github developed by hanya.
> >> >  Ruby-UNO (Ruby-OpenOffice) native bridge.
> >> >
> >> > http://wiki.github.com/hanya/RUNO/
> >> >
> >> > I spend days to build the runo on window 7
> >> >
> >> > with ActiveScriptRuby2.2, openoffice 3.4 and vs2010.
> >> >
> >> > i got this error which i dont understand why .
> >> >
> >> > E:\RUNO-master\include\com/sun/star/beans/PropertyAttribute.hdl(20) :
> >> error
> >> > C2513: 'const short' : no variable declared before '='
> >> >
> >> > but  in PropertyAttribute.hdl the line 20 is as the same style as
> other
> >> > line
> >> >
> >> > static const ::sal_Int16 MAYBEVOID = (sal_Int16)1;
> >> > static const ::sal_Int16 BOUND = (sal_Int16)2;
> >> > static const ::sal_Int16 CONSTRAINED = (sal_Int16)4;
> >> > static const ::sal_Int16 TRANSIENT = (sal_Int16)8;
> >> > static const ::sal_Int16 READONLY = (sal_Int16)16;
> >> > static const ::sal_Int16 MAYBEAMBIGUOUS = (sal_Int16)32;
> >> > static const ::sal_Int16 MAYBEDEFAULT = (sal_Int16)64;
> >> > static const ::sal_Int16 REMOVEABLE = (sal_Int16)128;
> >> > static const ::sal_Int16 REMOVABLE = (sal_Int16)128;
> >> > static const ::sal_Int16 OPTIONAL = (sal_Int16)256;//line 20 error1
> >> >
> >> > I commented line 20 ,build is OK.Then i try to open a docment.But
> error
> >> > comes.
> >> >
> >> > require 'uno'
> >> > data = {'type' => 'socket', 'host' => 'localhost',
> >> >         'port' => 2083, 'protocol' => 'urp'}
> >> > ctx = Uno::Connector.connect(data)
> >> > smgr = ctx.getServiceManager
> >> > desktop = smgr.createInstanceWithContext(
> >> >                    "com.sun.star.frame.Desktop",ctx)//here error2
> comes
> >> out
> >> > doc = desktop.loadComponentFromURL("private:factory/swriter",
> "_blank",
> >> 0,
> >> > [])
> >> > doc.getText.setString("Hello Ruby!")
> >> >
> >> > I really want to make it work.Buy it seems kind of hard for me now.
> >> >
> >> > Did error1 yield error2 or something else wrong.
> >> >
> >> > Any help would be appreciated.
> >> >
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: dev-unsubscribe@openoffice.apache.org
> >> > For additional commands, e-mail: dev-help@openoffice.apache.org
> >> >
> >> >
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscribe@openoffice.apache.org
> >> For additional commands, e-mail: dev-help@openoffice.apache.org
> >>
> >>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@openoffice.apache.org
> For additional commands, e-mail: dev-help@openoffice.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message