Author | Topic: C code to xBase++ | |
---|---|---|
![]() | Itai Ben-Artzi | C code to xBase++ on Tue, 03 Nov 2020 23:58:18 -0800 How the following C code translate to xBase++? dpcbs.size = sizeof(DPcbs); dpcbs.connectedCB = ConnectedEvent; dpcbs.disconnectedCB = DisconnectedEvent; dpcbs.docCompleteCB = DocCompleteEvent; Thanks, -Itai |
![]() | Jim Lee | Re: C code to xBase++ on Wed, 04 Nov 2020 18:50:55 +0100 hi, > How the following C code translate to xBase++? > dpcbs.size = sizeof(DPcbs); you need the Structure of dpcbs else you cant "calculate" SizeOf() |
![]() | Itai Ben-Artzi | Re: C code to xBase++ on Wed, 04 Nov 2020 10:58:52 -0800 dpcbs an array? String? Something else? |
![]() | Jim Lee | Re: C code to xBase++ on Thu, 05 Nov 2020 01:29:54 +0100 hi, > dpcbs an array? String? Something else? No, as i say Structure ... like a DBF Member ( like Field ) are connectedCB disconnectedCB docCompleteCB i recommend to use Ot4xb to build your own Structure |
![]() | Itai Ben-Artzi | Re: C code to xBase++ on Thu, 05 Nov 2020 00:26:32 -0800 Jim, Xbase++ recognizes Number, String, Date, Array, Codeblock, object, etc. But not Structure. What variable is Structure (I need to pass it as a parameter to a DLL call)? |
![]() | Carlos A Beling | Re: C code to xBase++ on Thu, 05 Nov 2020 09:33:34 -0300 Hi. Good day. In Xbase++ it has C:\Users\Beling\Documents\Xbase++\source\samples\bap\basics that may to help you. Fraternally Beling On 05/11/2020 05:26, Itai Ben-Artzi wrote: > Jim, > Xbase++ recognizes Number, String, Date, Array, Codeblock, object, > etc. But not Structure. What variable is Structure (I need to pass > it as a parameter to a DLL call)? > |
![]() | Itai Ben-Artzi | Re: C code to xBase++ on Thu, 05 Nov 2020 12:53:34 -0800 Thank you, Carlos! I understand it now. BTW, is seems a structure is just a multi-dimential array. Agian, thank you for leading me to this sample. -Itai |
![]() | Jim Lee | Re: C code to xBase++ on Fri, 06 Nov 2020 00:54:27 +0100 hi, > I understand it now. > BTW, is seems a structure is just a multi-dimential array. Carlos have point to BAP. it does work with"simple" Structure but if you have more complicate Structure you got stuck with BAP thats why i point to Ot4xb while it have a lot of Structure already in winapi_CommonStructures.cpp |
![]() | Andreas Gehrs-Pahl | Re: C code to xBase++ on Thu, 05 Nov 2020 20:37:47 -0500 Itai, >I understand it now. >BTW, is seems a structure is just a multi-dimential array. Actually, a Structure is more like an Object rather than an Array, and in Xbase++ you will have to treat it basically like a binary string, when using it (as aa parameter) in DLL calls. BAP is a simple way to handle structures in Xbase++ and OT4Xb has a more comprehensive way to do the same. Actually, Alaska recently added some additional Structure and Union functionality in the "XppRt2.ch" file. This is mainly used in several of the Assets: SecSigner API, Swissbit TSE API, and Telephony API (TAPI). You need to know the structure definition of the "DPcbs" structure to assign the right values to its properties. Based on the names of those properties, it seems that they may be callback addresses for event-processing functions in your Xbase++ code. Hope that helps, Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas@AbsoluteSoftwareLLC.com web: http://www.AbsoluteSoftwareLLC.com [L]: https://www.LinkedIn.com/in/AndreasGehrsPahl [F]: https://www.FaceBook.com/AbsoluteSoftwareLLC |
![]() | Itai Ben-Artzi | Re: C code to xBase++ on Fri, 06 Nov 2020 10:23:19 -0800 Andreas, Back to my original question: How to create the following (c) structure is xBase? dpcbs.connectedCB = ConnectedEvent; dpcbs.disconnectedCB = DisconnectedEvent; dpcbs.docCompleteCB = DocCompleteEvent; -Itai |
![]() | Andreas Gehrs-Pahl | Re: C code to xBase++ on Fri, 06 Nov 2020 14:42:24 -0500 Itai, >Back to my original question: >How to create the following (c) structure is xBase? >dpcbs.connectedCB = ConnectedEvent; >dpcbs.disconnectedCB = DisconnectedEvent; >dpcbs.docCompleteCB = DocCompleteEvent; Without documentation as to the layout of this structure, that can't be answered. Show us the documentation (or at least the entire source code) that describes this structure. Specifically, your original post included: dpcbs.size = sizeof(DPcbs); Are there other properties that you haven't mentioned? Also, what variable type(s) are the three *CB properties? That basically determines what values you assign (and how) and what the "dpcbs.size" value should be. Without that information, nobody can tell you (for sure). Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas@AbsoluteSoftwareLLC.com web: http://www.AbsoluteSoftwareLLC.com [L]: https://www.LinkedIn.com/in/AndreasGehrsPahl [F]: https://www.FaceBook.com/AbsoluteSoftwareLLC |
![]() | Itai Ben-Artzi | Re: C code to xBase++ (0/1) on Sat, 07 Nov 2020 11:07:30 -0800 Andreas, Attached is the C source code and the documentation from Digital Check API. |
![]() | Andreas Gehrs-Pahl | Re: C code to xBase++ (0/1) on Sat, 07 Nov 2020 18:40:09 -0500 Itai, Thanks for the documentation. I have attached some example code for using this structure with BAP. You could also use OT4Xb to do something similar. Of course, I have no idea if this will actually work, as I can't test it here without the required software and hardware environment. Hope that helps anyway, Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas@AbsoluteSoftwareLLC.com web: http://www.AbsoluteSoftwareLLC.com [L]: https://www.LinkedIn.com/in/AndreasGehrsPahl [F]: https://www.FaceBook.com/AbsoluteSoftwareLLC ![]() |
![]() | Itai Ben-Artzi | Re: C code to xBase++ (0/1) on Sun, 08 Nov 2020 16:15:42 -0800 Thank you, Andreas! I'll look at this sample. -Itai |
![]() | Itai Ben-Artzi | Re: C code to xBase++ (0/1) on Sun, 08 Nov 2020 16:20:37 -0800 Where is the BAP documentation? |
![]() | Andreas Gehrs-Pahl | Re: C code to xBase++ (0/1) on Sun, 08 Nov 2020 20:08:55 -0500 Itai, >Where is the BAP documentation? I don't think there is any documentation besides a little text file that was on the 1.90.331 CD. I have just read it, and at the very end, it basically says that you can't use BAP for your particular structure, as BAP only supports a single callback per thread, while your structure requires 21 of them. I was worried that this would be case, as the return value for the BaCallback() functions were all the same. That leaves you (possibly) with OT4Xb. I suggest you asked Pablo if he can help you with this. You could either post in the ot4xb newsgroups or email him directly. The newsgroups are available here: * http://news.Xb2.net (web interface) * nntp://news.Xb2.net (news reader) * nntp://news.xbwin.com (news reader) Be prepared that what you want to do might actually not be possibly with Xbase++, though. Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas@AbsoluteSoftwareLLC.com web: http://www.AbsoluteSoftwareLLC.com [L]: https://www.LinkedIn.com/in/AndreasGehrsPahl [F]: https://www.FaceBook.com/AbsoluteSoftwareLLC |
![]() | Itai Ben-Artzi | Re: C code to xBase++ (0/1) on Thu, 12 Nov 2020 13:10:38 -0800 Andreas, Is STRUCTURE a type of var not supported by xBase++? |
![]() | Andreas Gehrs-Pahl | Re: C code to xBase++ (0/1) on Thu, 12 Nov 2020 17:29:27 -0500 Itai, >Is STRUCTURE a type of var not supported by xBase++? You can deal with structures in Xbase++ in several different ways, including BAP and OT4Xb, but your specific issue aren't structures per se, but the function pointers for callbacks that your structure requires. With BAP, Xbase++ can handle only one function pointer per thread, and I don't know if OT4Xb can handle more than one, but your particular structure requires 21 function pointers for 21 different callback functions. So, if Pablo can do some of his C magic to allow you to manage 21 different function pointers for your callbacks in that structure using Xbase++ with OT4Xb, then you shouldn't have a problem. But if he can't, then I don't think that you can use this particular API with Xbase++. Hope that helps, Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas@AbsoluteSoftwareLLC.com web: http://www.AbsoluteSoftwareLLC.com [L]: https://www.LinkedIn.com/in/AndreasGehrsPahl [F]: https://www.FaceBook.com/AbsoluteSoftwareLLC |
![]() | Itai Ben-Artzi | Re: C code to xBase++ (0/1) on Fri, 13 Nov 2020 14:51:50 -0800 Andreas, While the sample program uses a single structure as reference to all callbacks, each function API call requires a single callback. Thus, either BAP or OT4xb can be used. I still like to know what type of var is this "structure" and whether or not it can be referenced by xBase++. Thanks, -Itai |
![]() | Boris Borzic | Re: C code to xBase++ (0/1) on Sat, 14 Nov 2020 00:22:20 +0100 Itai Ben-Artzi wrote in news:3e3uqf1nd7fsr9h6f5vt0do7gtkasmavv8@4ax.com: > While the sample program uses a single structure as reference to all > callbacks, each function API call requires a single callback. Thus, > either BAP or OT4xb can be used. I still like to know what type of > var is this "structure" and whether or not it can be referenced by > xBase++ A C structure is basically a string of binary characters. For example a simple structure consisting of 2 32-bit integers would be string 8 bytes log. The first 4 bytes would be the 1'st INT and the next 4 bytes would be the 2'nd INT. Structures can become quite complex when you consider that some of the elements may be pointers to other memory locations. Although in theory, you can create the C structures in Xbase++ by assembling the individual elemets (eg. using i2bin / l2bin,...), you would need to 'lock' the string when passed to a C lib so that the Xbase++ garbage collector does not touch it while in use by the external lib. Best regards, Boris Borzic http://xb2.net http://sqlexpress.net industrial strength Xbase++ development tools |
![]() | Andreas Gehrs-Pahl | Re: C code to xBase++ (0/1) on Fri, 13 Nov 2020 19:58:42 -0500 Itai, >While the sample program uses a single structure as reference to all >callbacks, each function API call requires a single callback. Thus, >either BAP or OT4xb can be used. The problem is that it isn't that simple to call Xbase++ functions from outside an Xbase++ program. Your structure needs 21 function pointers -- basically the memory addresses of the corresponding Xbase++ functions -- and that isn't something that is available in basic Xbase++. With BAP, Alaska added a way to create a single function pointer per thread that can be called from outside the Xbase++ program, and with OT4Xb you can create apparently something similar with the CallBack Compiler, using specially created obj files. I have never used OT4Xb for that purpose, so I don't know if it is possible to create those 21 callbacks for your structure using this method. >I still like to know what type of var is this "structure" and whether or >not it can be referenced by xBase++. C Structures are user-defined data types, very similar to Classes, which basically describe a section of memory and how its content should be interpreted by a program. Structures are binary data -- a binary string if you will -- whose parts can be interpreted in many different ways. Structures contain fields or members (just like Classes or Objects have Properties or Instance Variables), each of which has a data type as well as a name. The data type describes the length of the binary data -- how many bits or bytes it comprises -- and how its value should be interpreted. For example as individual or multiple characters or bytes, containing integers, floats or even pointers to other values, like strings or other variables in other memory locations, including pointers to functions. That binary data can be passed around and possibly manipulated by different parts of an application or even external applications or DLLs. The main problem is that Xbase++ is a high-level programming language with little support for low-level memory access, which other languages, like C, C++, C#, or even Python have. So, even though you can create and manipulate C structures in Xbase++, it isn't straight forward or easy, and some of the low-level access to things like the memory address -- or entry point -- of functions and their corresponding calling convention format -- so called Function Pointers -- are just not available directly. You might want to google "C Structures" and/or "Function Pointers" for more technical details and also download Pablo's CallBack Compiler from here: https://drive.google.com/drive/folders/0B9dUp4e-Y5DvaFcxMFpWSktQNXc Hope that helps, Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas@AbsoluteSoftwareLLC.com web: http://www.AbsoluteSoftwareLLC.com [L]: https://www.LinkedIn.com/in/AndreasGehrsPahl [F]: https://www.FaceBook.com/AbsoluteSoftwareLLC |
![]() | Itai Ben-Artzi | Re: C code to xBase++ (0/1) on Tue, 17 Nov 2020 10:51:29 -0800 Andreas, Where can I find this OT4XB? |
![]() | Andreas Gehrs-Pahl | Re: C code to xBase++ (0/1) on Thu, 19 Nov 2020 00:51:31 -0500 Itai, >Where can I find this OT4XB? You can download the latest version of OT4Xb (1.6.4.96) from here: https://drive.google.com/drive/folders/1rbBWb-ivDZFEnZ4urZDgmWZDVLqNHJpf But you really need Pablo's CallBack Compiler, too, from here: https://drive.google.com/drive/folders/0B9dUp4e-Y5DvaFcxMFpWSktQNXc Hope that helps, Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas@AbsoluteSoftwareLLC.com web: http://www.AbsoluteSoftwareLLC.com [L]: https://www.LinkedIn.com/in/AndreasGehrsPahl [F]: https://www.FaceBook.com/AbsoluteSoftwareLLC |
![]() | Itai Ben-Artzi | Re: C code to xBase++ (1/1) on Sat, 07 Nov 2020 11:07:31 -0800 |