Re: [fpc-pascal] ENoWideStringSupport
> On Aug 11, 2019, at 4:55 PM, Jeppe Johansen wrote: > > Are you on a Unix platform? If so, adding cwstring as the first unit in your > program should fix it, I think Thanks that fixed it. Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] USB Human Interface Devices
Thank you for the help. I made most of the changes you recommend and I was able to get it to compile, the only one I had trouble with was If I take out the ^ from: if (EP^.bmAttributes and LIBUSB_TRANSFER_TYPE_MASK = LIBUSB_TRANSFER_TYPE_INTERRUPT) and (EP^.bEndpointAddress and LIBUSB_ENDPOINT_DIR_MASK <> 0) then So it looks like this: if (EP.bmAttributes and LIBUSB_TRANSFER_TYPE_MASK = LIBUSB_TRANSFER_TYPE_INTERRUPT) and (EP.bEndpointAddress and LIBUSB_ENDPOINT_DIR_MASK <> 0) then I get a compiler error: libusboop.pas(1168,14) Error: Illegal qualifier libusboop.pas(1168,14) Fatal: Syntax error, ")" expected but "identifier BMATTRIBUTES" found libusboop.pas(0) Fatal: Compilation aborted With the ^ in it compiles anyway... I don't know how to adjust the format to not have the ^ I have not tried to do anything with TLibUsbPseudoHIDInterface yet, I was just trying to get libusboop.pas to compile, and be able to still run the previous examples. I've updated my repository at https://github.com/Zaaphod/pas-libusb/tree/Test Let me know if I should do something different with the ^ above, or if you see anything else I missed. James -Original Message- From: fpc-pascal On Behalf Of Johann Glaser Sent: Sunday, August 11, 2019 4:16 PM To: fpc-pascal@lists.freepascal.org Subject: Re: [fpc-pascal] USB Human Interface Devices Hi! Am Samstag, den 10.08.2019, 17:50 -0400 schrieb James Richters: > I'm making an attempt to copy TUSBPseudoHIDInterface into > libusboop.pas. I've made the recomended name changes and then tried > to compile it. Some things I found like the names changing from > things like > > PUSBInterfaceDescriptop to Plibusb_interface_descriptor OK, there are two things. Names directly from libusb-1.0 (as used in libusb.pas) should be identical to the original C code, i.e., Plibusb_interface_descriptor as you've written. The second thing are the classes in the OOP wrapper in libusboop.pas. Please use CamelCase for them, e.g., TLibusbPseudoHIDInterface. > are pretty obvious, but just taking a guess on other things like: > > changing: > if (EP.bmAttributes and USB_ENDPOINT_TYPE_MASK = > USB_ENDPOINT_TYPE_INTERRUPT) and > (EP.bEndpointAddress and USB_ENDPOINT_DIR_MASK <> 0) then > > To: > if (EP^.bmAttributes and LIBUSB_TRANSFER_TYPE_MASK = > LIBUSB_TRANSFER_TYPE_INTERRUPT) and > (EP^.bEndpointAddress and LIBUSB_ENDPOINT_DIR_MASK <> 0) then Yes, very good, thanks! Whether EP is a pointer (--> EP^.bmAttributes) or a record (EP.bmAttributs) just depends on the usage in the code. As I see in usb.pas in line 846, in TUSBPseudoHIDInterface.Create, it is actually the record, so you should stay without the '^'. > Based on looking at something similar in libusbutil... but I'm not > sure it's right at all I'm not sure if USB_ENDPOINT_TYPE_MASK was > really changed to LIBUSB_TRANSFER_TYPE_MASK or if something else > happened. But at least it compiles... You translated it correctly. > but now I've hit a few items that I just don't know what to do > with.I can't find anything similar to get a reference from: > > libusboop.pas(1198,28) Error: Identifier not found "USB_TYPE_CLASS" Use LIBUSB_REQUEST_TYPE_CLASS. > libusboop.pas(1199,5) Error: Identifier not found > "USB_REQ_HID_SET_REPORT" > libusboop.pas(1216,27) Error: Identifier not found "USB_TYPE_CLASS" > libusboop.pas(1217,5) Error: Identifier not found > "USB_REQ_HID_GET_REPORT" > libusboop.pas(1227,23) Error: Identifier not found > "HID_REPORT_TYPE_OUTPUT" Please copy the constants USB_REQ_HID_* and HID_REPORT_* from libusb.pas (branch master) lines 248-257 to the interface section of libusboop.pas (branch libusb-1.0) directly above the class declaration of TLibusbPseudoHIDInterface. Then please rename USB_REQ_HID_* to LIBUSB_REQUEST_HID_* and HID_REPORT_* to LIBUSB_HID_REPORT_*. > I've tried things that seem to be in line with other changes, like > changing USB_Type_Class to LIBUSB_TYPE_CLASS or spelling out REQUEST > instead of REQ which also seems to be done in other places, but still > the identifiers are not found... the problem is I have no idea where > these identifiers were/are defined. > > I made a fork in github and a branch called "test" here: > https://github.com/Zaaphod/pas-libusb/tree/Test Great approach, thanks, then we can use pull requests. Thanks Hansi > > Actually you could copy the class TUSBPseudoHIDInterface (plus the > > types THIDReport and TIntrReportFunc) from usb.pas to libusboop.pas > > and change everything necessary. > > At least one difference is that all names change from TUSB* to > > TLibUsb*. I'm sure there are more, but I don't know by heart. > > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fp
Re: [fpc-pascal] ENoWideStringSupport
On 8/12/19 12:37 AM, Ryan Joseph wrote: Dump question that I can’t find an answer to for some reason. I’m getting this error: ENoWideStringSupport: Widestring manager not available. Recompile program with appropriate manager. How do I resolve it? Not sure what’s even triggering it. Regards, Ryan Joseph Are you on a Unix platform? If so, adding cwstring as the first unit in your program should fix it, I think ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] ENoWideStringSupport
Dump question that I can’t find an answer to for some reason. I’m getting this error: ENoWideStringSupport: Widestring manager not available. Recompile program with appropriate manager. How do I resolve it? Not sure what’s even triggering it. Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] += property bug?
> On Aug 11, 2019, at 3:59 PM, Alexander Grotewohl wrote: > > d.x += 10; // makes even more sense Ok, you win. Here’s more or less the full snippet. type TRectHelper = record helper for TVec4 private procedure SetAxisX(newValue: TScalar); inline; public function MinX: TScalar; inline; function MinX: TScalar; inline; property AxisX: TScalar read MinX write SetAxisX; end; function TRectHelper.MinX: TScalar; begin result := v[0]; end; function TRectHelper.MaxX: TScalar; begin result := v[2]; end; procedure TRectHelper.SetAxisX(newValue: TScalar); begin v[0] += newValue; v[2] += newValue; end; == rect.axisX += 10 is a compound statement. See it makes perfect sense. :) I still don’t understand why the compiler and Delphi apparently thinks this is such a crazy idea. It's just normal stuff imo. Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] += property bug?
d.x += 10; // makes even more sense On 8/11/2019 2:21 PM, Ryan Joseph wrote: On Aug 11, 2019, at 11:41 AM, Sven Barth via fpc-pascal wrote: This is forbidden by design. Why? It makes sense it should resolve to: d.setter(d.getter + 10) but maybe there’s a problem? Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] += property bug?
On Sonntag, 11. August 2019 12:21:18 CEST Ryan Joseph wrote: > > On Aug 11, 2019, at 11:41 AM, Sven Barth via fpc-pascal > > wrote: > > > > This is forbidden by design. > > Why? It makes sense it should resolve to: d.setter(d.getter + 10) but maybe > there’s a problem? For me it seems that you can solve the issue easily with existing technologies. Moreover the code will be better to read and to handle in my opinion. Otherwise your code will be likewise C code with much information in the smallest place. That is not good to handle in my opinion. I have some experience with C code. It is not my preferred language. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] USB Human Interface Devices
Hi! Am Samstag, den 10.08.2019, 17:50 -0400 schrieb James Richters: > I'm making an attempt to copy TUSBPseudoHIDInterface into > libusboop.pas. I've made the recomended name changes and then tried > to compile it. Some things I found like the names changing from > things like > > PUSBInterfaceDescriptop to Plibusb_interface_descriptor OK, there are two things. Names directly from libusb-1.0 (as used in libusb.pas) should be identical to the original C code, i.e., Plibusb_interface_descriptor as you've written. The second thing are the classes in the OOP wrapper in libusboop.pas. Please use CamelCase for them, e.g., TLibusbPseudoHIDInterface. > are pretty obvious, but just taking a guess on other things like: > > changing: > if (EP.bmAttributes and USB_ENDPOINT_TYPE_MASK = > USB_ENDPOINT_TYPE_INTERRUPT) and > (EP.bEndpointAddress and USB_ENDPOINT_DIR_MASK <> 0) then > > To: > if (EP^.bmAttributes and LIBUSB_TRANSFER_TYPE_MASK = > LIBUSB_TRANSFER_TYPE_INTERRUPT) and > (EP^.bEndpointAddress and LIBUSB_ENDPOINT_DIR_MASK <> 0) > then Yes, very good, thanks! Whether EP is a pointer (--> EP^.bmAttributes) or a record (EP.bmAttributs) just depends on the usage in the code. As I see in usb.pas in line 846, in TUSBPseudoHIDInterface.Create, it is actually the record, so you should stay without the '^'. > Based on looking at something similar in libusbutil... but I'm not > sure it's right at all I'm not sure if USB_ENDPOINT_TYPE_MASK was > really changed to LIBUSB_TRANSFER_TYPE_MASK or if something else > happened. But at least it compiles... You translated it correctly. > but now I've hit a few items that I just don't know what to do > with.I can't find anything similar to get a reference from: > > libusboop.pas(1198,28) Error: Identifier not found "USB_TYPE_CLASS" Use LIBUSB_REQUEST_TYPE_CLASS. > libusboop.pas(1199,5) Error: Identifier not found > "USB_REQ_HID_SET_REPORT" > libusboop.pas(1216,27) Error: Identifier not found "USB_TYPE_CLASS" > libusboop.pas(1217,5) Error: Identifier not found > "USB_REQ_HID_GET_REPORT" > libusboop.pas(1227,23) Error: Identifier not found > "HID_REPORT_TYPE_OUTPUT" Please copy the constants USB_REQ_HID_* and HID_REPORT_* from libusb.pas (branch master) lines 248-257 to the interface section of libusboop.pas (branch libusb-1.0) directly above the class declaration of TLibusbPseudoHIDInterface. Then please rename USB_REQ_HID_* to LIBUSB_REQUEST_HID_* and HID_REPORT_* to LIBUSB_HID_REPORT_*. > I've tried things that seem to be in line with other changes, like > changing USB_Type_Class to LIBUSB_TYPE_CLASS or spelling out REQUEST > instead of REQ which also seems to be done in other places, but still > the identifiers are not found... the problem is I have no idea where > these identifiers were/are defined. > > I made a fork in github and a branch called "test" here: > https://github.com/Zaaphod/pas-libusb/tree/Test Great approach, thanks, then we can use pull requests. Thanks Hansi > > Actually you could copy the class TUSBPseudoHIDInterface (plus the > > types THIDReport and TIntrReportFunc) from usb.pas to libusboop.pas > > and change everything necessary. > > At least one difference is that all names change from TUSB* to > > TLibUsb*. I'm sure there are more, but I don't know by heart. > > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] += property bug?
> On Aug 11, 2019, at 11:41 AM, Sven Barth via fpc-pascal > wrote: > > This is forbidden by design. Why? It makes sense it should resolve to: d.setter(d.getter + 10) but maybe there’s a problem? Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] += property bug?
Am 11.08.2019 um 18:33 schrieb Ryan Joseph: Is this a bug? It should resolve to: d.setter(d.getter + 10) but it doesn’t seem to be working. {$mode objfpc} {$modeswitch advancedrecords} program test; type TData = record x: integer; end; type TVec2Helper = record helper for TData function Getter: integer; procedure Setter(newValue: integer); property Get: integer read Getter write Setter; end; function TVec2Helper.Getter: integer; begin result := x; end; procedure TVec2Helper.Setter(newValue: integer); begin x := newValue; end; var d: TData; begin d.get += 10; // ERROR: Variable identifier expected end. This is forbidden by design. Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] += property bug?
On Sun, Aug 11, 2019 at 6:33 PM Ryan Joseph wrote: > begin > d.get += 10; // ERROR: Variable identifier expected > end. AFAIK you cannot do that to a property (not even if it maps to a field). Delphi does not allow it either IIRC. -- Bart ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] += property bug?
Is this a bug? It should resolve to: d.setter(d.getter + 10) but it doesn’t seem to be working. {$mode objfpc} {$modeswitch advancedrecords} program test; type TData = record x: integer; end; type TVec2Helper = record helper for TData function Getter: integer; procedure Setter(newValue: integer); property Get: integer read Getter write Setter; end; function TVec2Helper.Getter: integer; begin result := x; end; procedure TVec2Helper.Setter(newValue: integer); begin x := newValue; end; var d: TData; begin d.get += 10; // ERROR: Variable identifier expected end. Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Pandroid bundle some useful information about it
Project build resulting Android app by using obfuscation. This create much smaller .dex file. And application decompilation is harder. Sure, very advanced programmer can easily decompile even apps which have been produced by Free Pascal compiler, but I think, that obfuscated code is really not so easy to decode for average user. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Pandroid bundle some useful information about it
Pandroid is bundle, which have been prepared so Linux user can program Android apps with no need to manually install Android SSDK, required platform tools or build tools. Pandroid contain all required versions which have been tested, so developer must only install a few dependencies and everything will work. When you will download and and prepare The project, you will be able to develop Android apps while using Free Pascal compiler which will be preconfigured to compile Android apps by using its JVM mode Android target. Why this project? I think, that it is The only one bundle, which can produce applications for so many Android different versions. If you do not like projects, which combines Java coding with native code, this project is for you. https://github.com/zeljkoc/pandroid Bundle contain example how to use canvas to draw by using 2D dimension. It is also possible to draw in 3D mode and there is also example for Open GL. Possibilities are really vide. Produced applications are compatible with Android 7 and I think, that also with never version. I think, that this project have a hydden big potential. Sure. Advanced of us can try to generate Pascal units for newest Android APIS, you can even experiment with other than provided versions of BUild tools. May be, that it would be even possible to create some Lazarus package to create GUI so project will be more attractive for developers, who want to design by using IDE not by using his memory or paste and copy Clipboard operations. It is even possible to develop for Windows. I Am testing Windows variant of Pandroid. It looks very promisingly. So Linux is not The limitation. Because also 2 and 3D graphics is supported, it is possible to develop various psychological tests for clients, who would had to touch a center of rectangle, circle, or square. It is possible to add multiple activities to one app. It is possible to detect incoming phone calls and react on them, such as pause Android Media player or stop it. And everythink without crashes and stability issues. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Challenge accepted
On Sun, 11 Aug 2019, Joost van der Sluis wrote: Op 10-08-19 om 18:37 schreef Michael Van Canneyt: On Sat, 10 Aug 2019, Marco van de Voort wrote: Op 2019-08-10 om 17:30 schreef Joost van der Sluis: And who else wanna help? Why not simply port superobject? 2 reasons: 1. Interface based. Really bad idea. There can be a really good use for interfaces regarding streaming. Like you saw earlier in the fppkg-repository code. I think the only case when interfaces are truly needed is in IPC/RPC. For the rest it just complicates otherwise simple things. I will use them when useful, which I think is far less than commonly assumed. As such I'm violently opposed to the 'you must always program an interface' attitude. 2. JSON only. 3. I didn't really know it. You don't miss out on that. It's better than the mess Embarcadero produced, but still needlessly complicated IMHO. And if you need more reasons: the jsonrtti has just this. I still need to add some functionality to it from the restbase unit (dynamic arrays) but other than that I've been using it since ages. I use jsonrtti now, and with some additions it works like I want. But the goal is somewhat more generic, yes. I understood that, I just compared it to superobject, not to your eventual goal. What additions are you talking about ? Can we incorporate it ? Improvements are always welcome. Note that the SQLDB rest bridge has dataset result streaming in various formats. It's somewhat similar to your goal, but is limited to datasets. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Challenge accepted
Op 10-08-19 om 18:37 schreef Michael Van Canneyt: On Sat, 10 Aug 2019, Marco van de Voort wrote: Op 2019-08-10 om 17:30 schreef Joost van der Sluis: And who else wanna help? Why not simply port superobject? 2 reasons: 1. Interface based. Really bad idea. There can be a really good use for interfaces regarding streaming. Like you saw earlier in the fppkg-repository code. 2. JSON only. 3. I didn't really know it. And if you need more reasons: the jsonrtti has just this. I still need to add some functionality to it from the restbase unit (dynamic arrays) but other than that I've been using it since ages. I use jsonrtti now, and with some additions it works like I want. But the goal is somewhat more generic, yes. Regards, Joost. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] PPCJVM Android target and bass library function call issue
Dear MR Maebe, You are always ready to help Me efficiently. I have special .jar file with compiled java .class files, inc and .pas file and bass.so is build inside .jar file. So I think, that it should work. Line bass:= CUBBASS.create(); bass.BASS_Init(-1, 44100, 0); Cause no problems. Since compiler generate classes and dex converter create .dex file with no issues. App also do not produce crash after compiling it and after run it on Android devices. The question is if bass:= CUBBASS.create(); bass.BASS_Init(-1, 44100, 0); Can really call data from .so library, or it is code which actually do not do useful thinks. The positive of Pandroid bundle is that Mr Cvijanovic and his cooperator have included special rjava.pas module and other stuff, so all Android API functions can be used. It is even possible to call .jar libraryes, which have been previously compiled by Javac. He had used many examples. The issue is, that Jlobject parameter is abstract and I do not know, what it can mean. I have spent many many time to find The cause of The issue. The reason, why I work with Pandroid is The fact, that it is really The only one solution, which fully support PPCJVM Android target, all API calls are working including Mediaplayer interface, it is even possible to call .jar libraries which do not include .so library and call methods in it such as mysql.jar. I think, that Pandroid is revolutionary project, because it contain also many useful units, Jar libraries support, Android API calls support and calling .so native libraryes inside .ajar files support. I have used FreeVCL, but I have got in serious troubles, because Android API calls did not work at all. Dalvik creator could not generate classes, if I have wanted to call APi function from AndroidR15.inc or from other units. And my main reason, why I do not simple use Lamw and Lamwplayer is, that only when I use Pandroid units, I can create GUI really myself with no need to be sad, that I must specify object position values for every object. Sure, some people could tell Me, that GUI is not attractive. But for Me as visually impaired with no sight at all, it is revolutionary approach. Because I could never create even complex GUI with many elements. And compiled apps which do not depend on WEBview will always allocate much less RAM than apps, which uses Webview. Or if Javascript run inside browser process. This is The reason why I do not want to switch to Pas2js. But I Am not so clever to deeply understand how to call some functions. Even Java example for Bass library did not helped Me too much. Net radio example build inside bass for ANdroid official .zip archive. Except line bass.BASS_Init(-1, 44100, 0); But it can not play live stream it is too few for now. Thank you very much for yours patience. The reason why I want to use my own little Internet radio player is The fact, that GUI is simple, many other radio apps are full of functions and of many buttons. I want to simple pause, play or stop. If I want to record, I can use Audials for this purpose. But The freedom to do something which containing simple GUI is really very positive feeling for Me. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] PPCJVM Android target and bass library function call issue
On 10/08/2019 22:26, Mgr. Janusz Chmiel wrote: > I Am very sad, that I do not know, how to correctly call The following > function from bass.so when running apps produced by FPCJVM Android > target mode. > class function BASS_StreamCreateURL(para1: JLString; para2: jint; > para3: jint; para4: CUBBASS.InnerDOWNLOADPROC; para5: JLObject): jint; > static; overload; Where does this declaration come from? Do you have an existing Java wrapper for libbass, and then generated the headers for it using javapp? Or are you trying to directly call functions in libbass.so using manually created signatures? The latter will never work, because FPC does not know the "native" modifier for Java methods. Additionally, such an existing Java wrapper would also ensure that all your parameter types are correct. Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal