Sharing a .h include file between a C project and Java

I'm writing a newtowrk utility in Java that uses a lot of constants that are available in a .h file in a C project. In fact, the .h file is the authority as to what the values actually are.
Is there a standard way or has anyone written a utility that will pull in a C include file to generate constants for Java objects to use?
In C I have in protocols.h:
#define ETHERTYPE_IPV4 0x800
#define ETHERTYPE_FOO 0xF00to turn into
public class ProtocolsDotH {
public static final int ETHERTYPE_IPV4 = 0x800;
public static final int ETHERTYPE_FOO = 0xF00;
}Or something like that. I could invoke the utility in the make file that compiles and jars my Java app. Any guidance?

You could use SWIG, the Simple Wrapper Interface Generator (http://www.swig.org). But if you just have a few simple constants this seems a bit heavyweight.
I can't seem to get SWIG to put the literal values right into the Java file. Here's how you might invoke it with a header file called stuff.h:
[cdb@merlin forum]$ cat stuff.h
#define FROB 0x1234
#define MEAT 0xdeadbeef
[cdb@merlin forum]$ swig -java -module JStuff stuff.hThis will create some files:
JStuff.java  JStuffJNI.java  stuff.h  stuff_wrap.cwith JStuff.FROB and JStuff.MEAT, but I don't know how to get swig to put the values right in the Java file. It actually calls a JNI method that it generates in stuff_wrap.c to set the constant values.
Too bad, but there might be a way, probably via a ".i" file to swig, to put literal constants in the source.
I guess the bottom line is:
Probably a simple one-line grep/sed command or perl script would do the trick though.

Similar Messages

  • I want to share files between my MacBook Pro and G5, I am using an AirPort

    I want to share files between my MacBook Pro and G5, I am using an AirPort Extreme Base Station. I can see the MacBook Pro on the G5 and vice versa, I have file sharing turned on both, as well as Screen Sharing. I currently am sharing using Target Disk Mode, I want to know what other wireless options are available to me?
    I want to have the 2 computers able to see each other and be able to share files be drag and dropping, I also have another G4 on using Tiger I want to be a part of this happy Apple sharing family. Can someone please tell me how to accomplish my goal?
    Thanks in advance for reading and replying to my post,
    Sebastian

    The mac help is: Finder window/Help/Mac Help. It provides answers to a lot of common questions, including file sharing.
    As for the ethernet cable, you can either buy another one (inexpensive and available in many places including Walmart), or just unplug it from your modem temporarily and plug it back in when you're done.
    As for Target disk mode, take a look at this Apple article:
    http://docs.info.apple.com/article.html?artnum=58583
    Apple online support pages are also a great way to find out how to do things.
    As I mentioned, I prefer using the ethernet/file sharing method if I need to copy a lot of files; however, there is another way around if you have an external drive and just want to copy one or two files. Just plug the external into one computer, copy the file onto it, unplug, plug into the other computer and copy.

  • Leopard / Bootcamp / Vista / Copy Files Between Mac OS X and Windows

    On the apple page it says I can copy files from mac to windows?
    "Copy Files Between Mac OS X and Windows
    Copy, open, modify, or delete files in Mac OS X that you saved to your Windows partition. Leopard understands the Windows FAT32 disk format."
    I tried installing Vista in bootcamp, but it says I cannot install in FAT32? So i format it to NTFS.
    So here's my question, Can i still copy files between mac and pc, if I format into NTFS or am using vista?
    Thanks

    I am quite a simple soul really and very easily pleased.
    All I seek is a partition of some sort that I can save all my created work to - whether in XP Pro or OS X 10.5. But it has to be a large partition - probably a single partition on a large drive.
    It would be sweeter still for Spotlight to do what it does (and it does on a FAT partition) and sweeter still for Time Machine to be very user friendly and do what it presently does not do and include created files into the TM.
    Now that really would be very pleasant. Very pleasant indeed.

  • How do I transfer files between my iPad 2 and my iMac?

    How do I transfer files between my iPad 2 and my iMac? I can't seem to make file sharing work following the iPad 2 instructions. Thanks. Bob

    You may want to post your own thread on this. this one is well over a year old.
    This might help you: http://support.apple.com/kb/HT1848

  • How do I share files between my iPhone 5 and MacBook Pro?

    I need to transfer files between my iPhone 5 and my MacBook Pro. The latter is running Mavericks. I have enabled AirDrop on both devices (I chose "AirDrop for Everyone" on my iPhone), but when I click the AirDrop file in Finder on my Mac, my iPhone doesn't appear. 
    Thoughts?

    Sorry; I've got Yosemite installed on my MacBook Pro, not Mavericks anymore.

  • Sync my files between my pc phone and tablet

    how can i use my 2gb free creativ cloud to sync my files between my pc phone and tablet

    Mylenium,
    It works fine between my iPhone 4s PS touch and my Samsung galaxy note 10.1 with PS touch But not with my computer Windows 8 Adobe Photoshop  elements 11
    I dont see the cloud files on my computer
    Verstuurd vanaf mijn iPhone
    Op 18 aug. 2013 om 08:58 heeft Mylenium <[email protected]> het volgende geschreven:
    Re: sync my files between my pc phone and tablet
    created by Mylenium in Adobe Creative Cloud - View the full discussion
    What phone? What tablet? What files? You will have to explain better.
    Mylenium
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5604082#5604082
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5604082#5604082
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5604082#5604082. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Adobe Creative Cloud by email or at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • What is the diffrence between package javax.sql and java.sql

    Is javax designed for J2EE?
    And when to use package javax?

    Hi,
    What is the diffrence between package javax.sql and java.sql?The JDBC 2.0 & above API is comprised of two packages:
    1.The java.sql package and
    2.The javax.sql package.
    java.sql provides features mostly related to client
    side database functionalities where as the javax.sql
    package, which adds server-side capabilities.
    You automatically get both packages when you download the JavaTM 2 Platform, Standard Edition, Version 1.4 (J2SETM) or the JavaTM 2, Platform Enterprise Edition, Version 1.3 (J2EETM).
    For further information on this please visit our website at http://java.sun.com/j2se/1.3/docs/guide/jdbc/index.html
    Hope this helps.
    Good Luck.
    Gayam.Srinivasa Reddy
    Developer Technical Support
    Sun Micro Systems
    http://www.sun.com/developers/support/

  • What is the diffrence between My Runnable Interface and Java Runnable

    Hi folks
    all we know that interfaces in java just a decleration for methods and variables.
    so my Question is why when i create an interface its name is "Runnable" and i declared a method called "run" inside it.then when i implements this interface with any class don't do the thread operation but when i implement the java.lang.Runnable the thread is going fine.
    so what is the diffrence between My Runnable Interface and Java Runnable?
    thnx

    Hi folks
    all we know that interfaces in java just a decleration
    for methods and variables.
    so my Question is why when i create an interface its
    name is "Runnable" and i declared a method called
    "run" inside it.then when i implements this interface
    with any class don't do the thread operation but when
    i implement the java.lang.Runnable the thread is going
    fine.
    so what is the diffrence between My Runnable Interface
    and Java Runnable?
    thnxClasses and interfaces are not identified by just their "name", like Runnable. The actual "name" the compiler uses is java.lang.Runnable. So even if you duplicate the Runnable interface in your own package, it's not the same as far as the compiler is concerned, because it's in a different package.
    Try importing both java.util.* and java.awt.* (which both have a class or interface named List), and then try to compile List myList = new ArrayList();

  • Share files between PC Windows XP and Mac

    I'm trying to share files between my mac and my spouse's PC.
    I read the instructions at http://macs.about.com/od/macwindows/ss/sharemacfilesxp.htm . The instructions say that the Mac and PC need to be in the same ‘workgroup’ for file sharing to work.
    My spouse's work PC does not have a workgroup selection. It only has a domain selection.
    How can we share files over our network if no using a 'domain'?
    I can enable filesharing from mac to mac but not from mac to pc.

    Welcome to discussions
    I've tried to connect MAc/OS9 with Windows XP(home)-didn't work.
    I've used DAVE from thursby.com(three weeks free trial)- works
    fine bought it on wednesday.
    For info about connection you may look here:
    List of info connecting PC to Mac:
    http://docs.info.apple.com/article.html?artnum=19652
    http://docs.info.apple.com/article.html?artnum=31318
    http://docs.info.apple.com/article.html?artnum=43070
    http://macwindows.com/netbasic.html
    http://macwindows.com/netbasc2.html
    http://www.kan.org/networking/quicknet.html
    http://www.everythingcomputers.com/home_network.htm
    XP OSX
    http://www.ifelix.co.uk/tech/3000.html
    http://www.joelshoemaker.com/computer/mac/wxpfs.html
    http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/s agadd_appletalkport.mspx?mfr=true
    MACWINDOWSFILESHARING
    http://homepage.mac.com/william_white/smbdoc.html
    Good luck

  • How to share files between Mac booK pro and iMac?

    Hi
    I dont know how to transfr files between the two. HELP?

    It is done with File Sharing. System Preferences, Sharing.

  • Can you ethernet and transfer files between a iMac G3 and a intel iMac

    Looking for a little assistance and suggestions.
    I'm trying to transfer files (jpegs and Word documents) from an older iMac G3 running OS 9.2 to a new iMac (intel) running Tiger (10.4). What use to be a pretty easy process of plugging in an ethernet cable between iMacs and turning on file sharing isn't working this time around. I called Apple support and they couldn't locate anyone who was available this past weekend who knew OS 9.2. So I'm hoping someone in the discussion group might have an idea. Thanks.

    Thanks very much Jan, I'll give that a try. It's a great resource, too. The info provided under http://homepage.mac.com/car1son/os9xnet_nfilesharing.html
    is very helpful. I actually had most of it in place with what's shown but missed a couple of things with the IP address. But I was close. I won't be able to try it again for a few more days but if it works I'll post back to this discussion and let you know how it went.
    And Duane, good suggestion, too. I don't have access to another external hard drive but I expect it would be a lot easier, as you suggest, to simply plug in the drive and download files between machines.
    Thanks again.
    Dennis
    Message was edited by: homeden

  • Include files from a different project ...

    Hi,
    I have projects A and B.
    Project A contains "includes": a directory with several include files.
    Project A gets deployed as a JAR file (ProjectA.jar). Example content:
      /includes/menu.jspfThe target directory for Project A's deployment JAR file is set to: /
    Project A has the following HTML Root Directory: ...AppA\ProjectA\public_html
    Project B has the following HTML Root Directory: ...AppB\ProjectB\public_html
    Project B needs the include files from Project A.
    Project B has Project A as a dependency.
    Project B has ProjectA.jar within its WEB-INF\lib directory.
    The problems are:
    1. Project B does not see the "includes" directory within its "Web Content" folder from Project A. How do you make Project B see Project A's includes directory?
    2. Project B cannot compile the following code:
    <jsp:directive.include file="/includes/menu.jspf" />
      ...The error message: Include file not found: /includes/menu.jspf
    The error message is to be expected as Project B cannot currently see the files located within WEB-INF\lib\ProjectA.jar. How can this be fixed?
    3. I have tried changing the HTML Root Directory to the "public_html" directories from both Project A and Project B. JDeveloper then displays an error indicating that it cannot find <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>.
    There should be a way to do this, as the images and styles for ADF are successfully deployed and used within WEB-INF\temp\adf.
    Any ideas are greatly appreciated.
    Thanks!

    Hi,
    I used a program called "Junction" to resolve this issue. It is a temporary solution.
    http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx
    The program makes a true symbolic link. This allowed me to link the includes directory from ProjectA into ProjectB. Linking this way will not work when we go to deploy a suite of applications. We would prefer to package the includes in a single JAR file, then redeploy the JAR file everywhere.
    Any other ideas?

  • DES Encryption compatibility between Microsoft dot Net and Java

    Hi,
    I have a situation that a Secret key is shared between two components like Core and the Customer. The customer encrypts a particular data using DES algorithm using the shared secret key. The customer uses Microsoft dot Net framework to do this. The encrypted data comes to core part which has been developed in Java. I want to know whether it is possible to decrypt the data value using DES algorithm which is coming from Dot Net platform. By the way I am getting different values. I want to know whether the byte[] in Java and Dot Net are same. Please provide me relevent answers to this question. Is it possible to make interaction with the cryptography between two differnet environments like Java and Microsoft Dot Net. I mean only DES algorithm.

    DebadattaMishra wrote:
    Hi,
    I have a situation that a Secret key is shared between two components like Core and the Customer. The customer encrypts a particular data using DES algorithm using the shared secret key.Yuk! That is what SSL is for.
    The customer uses Microsoft dot Net framework to do this. The encrypted data comes to core part which has been developed in Java. I want to know whether it is possible to decrypt the data value using DES algorithm which is coming from Dot Net platform. Yes though there are many pitfalls. The devil is in the detail of the .NET code. I would not tackle this without access to the full .NET encryption code.
    By the way I am getting different values.This is not surprising since, as I said above, there are many pitfalls. The.NET documentation is poor at best and in some cases is very very misleading. Some of the .NET methods involved in key generation have obscure semantics and only after a very careful reading of lots of MS documentation did I start to understand the semantics.
    I want to know whether the byte[] in Java and Dot Net are same. You should compare the 'bits' of each byte and not the numeric values since Java uses signed bytes.
    Please provide me relevent answers to this question.This is not your call. Anyone is free to post answers as long as they follow the forum code of conduct.
    Is it possible to make interaction with the cryptography between two differnet environments like Java and Microsoft Dot Net. I mean only DES algorithm.Of course!

  • Errror in RFC connection between SCM ABAP stack and JAVA Stack

    Hi All
    we have installed SCM Abap stack and SCM java stack on same system within single database.when i create rfc connection AI_RUNTIME_JCOSERVER from SCM Java stack to SCM Abap Stack its working fine,but when i am configuring same from SCM Abap to SCM Java using SM59 its giving error.
    Error Details     Error when opening an RFC connection
    Error Details     ERROR: failed to open file G:\usr\sap\SCD\DVEBMGS00\data\sideinfo.DAT
    Error Details     LOCATION: SAP-Gateway on host OPS20SCD1.Octal.pet / sapgw00
    Error Details     CALL: fopen
    Error Details     COMPONENT: SAP-GW-LIB (ReadSideInfo)
    Error Details     COUNTER: 1854
    Error Details     ERROR NUMBER: 2
    Error Details     ERROR TEXT: ENOENT: No such file or directory OR: The system cannot find the fi*
    Error Details     MODULE: gwxxside.c
    Error Details     LINE: 274
    Error Details     RETURN CODE: 451
    Error Details     SUBRC: 0
    Error Details     RELEASE: 701
    Is it compulsory to create RFC connection between abap and java installed on the same system.
    plese suggest.
    Regards

    to configure acceptance of the ABAP (integrated ITS / WebGUI) saplogonticket on the java stack, just log into the java stack (http://FQDN:50xxx/nwa) and select configuration  THe last item in the list is Trusted System... click.
    on the ensuing page, click on the add trusted system button --> by querying trusted sytem.
    Enter the required data on the page:
    system type: ABAP
    host name: FQDN
    System Nr: your instance number
    client (of the productive client)
    and a username and pw with superuser priveliges in the system (SAP_ALL/SAP_NEW, etc).
    the click next
    On the final screen, click finish.
    You have now SSO setup between the ABAP and Java stacks. To configure SSO to accept java saplogontickets on ABAP see:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/2b0310d6-0801-0010-3185-b2371a280372
    This should resolve your question.

  • Icon file for windows, of Duke and java cup, etc.

    Hi Folks,
    I'm looking for a file that contains icons of Duke, the Java steaming cup, and other generic Java icons.
    I want to associate these icons with my *.java, *.class, and *.jar files on my windows platform.
    I found Duke in
    C:/WINNT/system32/plugincpl131_01.cpl
    but I'd like others, too.
    Thanks,
    Jeremy |-)
    [email protected]

    Hi Folks,
    I'm looking for a file that contains icons of Duke,
    the Java steaming cup, and other generic Javaicons.
    I want to associate these icons with my *.java,
    *.class, and *.jar files on my windows platform.
    I found Duke in
    C:/WINNT/system32/plugincpl131_01.cpl
    but I'd like others, too.
    Thanks,
    Jeremy |-)
    [email protected]
    Hi Folks,
    Me again. I used iconRipper in my Java installation
    (at the suggestion of another poster in this forum)
    and found the steaming cuppa Joe in:
    .../jdk1.3.1_01/jre/bin/awt.dll
    and a thumbs up Duke and arms akimbo Duke in:
    .../jdk1.3.1_01/jre/bin/jpishare.dll
    What icons do others use (if any) for their various
    Java files on windows?
    Thanks,
    Jeremy |-)
    [email protected]
    Hi Folks,
    Me again. Looks like I'm talking to myself. Well, that's ok. Us English are known to do that (but only after years of acquaintance).
    I guess we're out of luck. In Java 1.4, all the Duke icons disappeared from the files mentioned above. The steaming java ones are mostly still there, but sligtly modified. And the one file (jpishare.dll) has fuzzy low-res cups in place of the Dukes!
    Ah well,
    Jeremy |-)

Maybe you are looking for