[R-pkg-devel] tinyfiledialogs - The bindings are ready, but I need help to make of package of it

ti@yiiiedi@iogs m@iii@g oii yse@gri@@com ti@yiiiedi@iogs m@iii@g oii yse@gri@@com
Fri Sep 22 07:33:22 CEST 2023


Hi,

There are no dependencies and everything is considered/treated as UTF-8.
On windows, I internally do all the conversions between UTF-8 and UTF-16.
I also offer functions to convert between UTF-8 , UTF-16 and MBCS.
I don't know what UCRT is, but tinyfiledialogs is compatible with all 
versions of windows from XP to 11,
all the versions of mac since osx 10.2 and all the unix versions I have 
ever came accross.


I was hoping to find a tldr version of the "how to write an extension".
The source code is just one C file (+ header) and one R file for the 
interface.
What files are supposed to be in my package ? the C file or the compiled 
shared libraries ?
What else ? a documentation file ? is there a model to follow ?

thanks for your help

guillaume



On 9/21/23 11:33, Ivan Krylov wrote:
> Dear Guillaume Vareille,
>
> В Wed, 20 Sep 2023 12:30:53 +0200
> tinyfiledialogs using ysengrin.com  пишет:
>
>> I've been pointed to the documentation link on how to write a package,
>> but it would really help if someone who knows what to do could direct
>> me.
> There's potentially a lot to tell. Converting the entire Writing R
> Extensions [*] into e-mails is a poor use of one's time. Do you have
> more specific questions? If you don't know where to start, try
> utils::package.skeleton or the pkgKitten package (which aims to pass R
> CMD check right from the start). There's also books like R Packages by
> Hadley Wickham and Jennifer Bryan, but they mention a lot of techniques
> and third-party dependencies that you don't have to use.
>
>>       # first load the included library (it could easily be compiled
>> on the target machine)
>>       dyn.load("tinyfiledialogsLinux64.so")
> You will need to put your source files into the src/ subdirectory of
> the package and arrange for them to get compiled (see WRE 1.1.5 and
> 1.2.1). It's best to write a special entry point in order to let R know
> about the functions you intend to call (see WRE 5.4).
>
> Does your code have third-party dependencies? If you'd like to put the
> package on CRAN, you will need to bundle your own code with the package
> (since it's probably not available yet in major GNU/Linux
> distributions, macOS recipes and MXE) but set up a ./configure script
> to locate the third-party dependencies while the package is being
> installed:https://cran.r-project.org/web/packages/external_libs.html
>
>>         result <- .C("tfd_openFileDialog",
>>               charToRaw(aTitle),
> In R, strings have encodings. A string can be stored in UTF-8, Latin-1,
> the native locale encoding (which may include anything from
> Windows-936 to KOI8-R) or even as arbitrary bytes, which admittedly
> makes it less of a string (see ?Encoding).
>
> x1 <- `Encoding<-`('fran\xe7ais', 'latin1')
> x2 <- `Encoding<-`('fran\xc3\xa7ais', 'UTF-8')
> x1 == x2 # TRUE, they encode the same characters
> identical(charToRaw(x1), charToRaw(x2)) # not even the same length
>
> Which encoding does tfd_openFileDialog() use for the file names and
> paths? Does it work with UCRT on Windows in UTF-8 locale mode? (Can you
> return a filename that is not representable in the ANSI codepage?) You
> will probably need to convert the strings into a certain encoding before
> passing them to tfd_openFileDialog(...) (e.g. enc2utf8(.)).
>
>>         if ( result$lOpenFile == "NULL" ) return()
> What happens if I create a file named NULL on my system and try to open
> it?
>
> Good luck, and I hope that your effort results in a good R package!
>

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list