Skip to content

Soup v3 (libsoup) giddy package.#12

Merged
elementgreen merged 8 commits intoKymorphia:mainfrom
dejlek:dejan/libsoup
Mar 1, 2025
Merged

Soup v3 (libsoup) giddy package.#12
elementgreen merged 8 commits intoKymorphia:mainfrom
dejlek:dejan/libsoup

Conversation

@dejlek
Copy link
Copy Markdown
Contributor

@dejlek dejlek commented Feb 28, 2025

This PR adds gid:soup3 package to giD. More about the libsoup here: https://libsoup.gnome.org/libsoup-3.0/index.html

@dejlek
Copy link
Copy Markdown
Contributor Author

dejlek commented Feb 28, 2025

NOTE: this PR is not ready to merge yet. The following generated function is not compiling

string formEncodeDatalist(Data formDataSet)
{
  char* _cretval;
  _cretval = soup_form_encode_datalist(formDataSet);
  string _retval = _cretval.fromCString(Yes.Free);
  return _retval;
}

Error:

packages/soup3/soup/global.d:234:39: error: function pointer ‘c_soup_form_encode_datalist(GData** formDataSet)’ is not callable using argument types ‘(GData*)’
  234 |   _cretval = soup_form_encode_datalist(formDataSet);
      |                                       ^
packages/soup3/soup/global.d:234:39: note: cannot pass argument `formDataSet` of type `GData*` to parameter `GData** formDataSet`
  234 |   _cretval = soup_form_encode_datalist(formDataSet);
      |    

I am currently trying to figure out why, but if you know the reason please let me know so I do not wast time. :)

@elementgreen
Copy link
Copy Markdown
Contributor

This function isn't very useful. There is the alternative soup_form_encode_hash which takes a hash table and probably works with D associative arrays already. So we should just mark soup_form_encode_datalist as ignore. You should be able to do this with this command:

//!set function[form_encode_datalist][ignore] 1

@elementgreen
Copy link
Copy Markdown
Contributor

I also consider it a bug if gidgen generates code that doesn't build. The extra pointer in this type is what is causing the issue. There is already some verification of an unexpected number of pointers in types, depending on parameter directions and the data type. It seems it isn't extensive though, so this particular case is getting through. I also think disabling GData makes sense, which in turn would cause any API using it to be marked as unsupported.

@elementgreen
Copy link
Copy Markdown
Contributor

I'm not seeing a file in the defs/ directory for this library. Also, I just pushed changes to make it to where definition files are now lowercase using the package name (including it's version). This should allow multiple versions of a library. Going to test that now with Gtk3!

@dejlek
Copy link
Copy Markdown
Contributor Author

dejlek commented Mar 1, 2025

I wanted to do the same (to disable that function generation) but I used method name, which was wrong:

//!set function[formEncodeDatalist][ignore] 1

Btw, RSvg def file is still upper-case. I will fix it in this PR as it should soon be OK to merge.

@dejlek
Copy link
Copy Markdown
Contributor Author

dejlek commented Mar 1, 2025

Looks like it did not help. Even with that ignore line you suggested it is still trying to generate it. How do I disable GData?

@elementgreen
Copy link
Copy Markdown
Contributor

elementgreen commented Mar 1, 2025

I just had a look at your PR. The ignore works if you remove the "." between the function name in brackets and the [ignore]. It should be:

//!set function[form_encode_datalist][ignore] 1

Also, make sure to update gidgen and build it, since I made some recent changes and thought I pushed them last night, but just noticed that they might not have been on master yet. This includes using lowercase package names (including version) for the defs file names.

@dejlek
Copy link
Copy Markdown
Contributor Author

dejlek commented Mar 1, 2025

Thanks! It all works now. This PR is now ready to be merged.

@elementgreen elementgreen merged commit c34a5b7 into Kymorphia:main Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants