Jshint flags preprocessor directives

Hi,
I'm trying to be good and lint my scripts, but I can't get jshint to ignore preprocessor directives, eg
#target indesign
#include "externalFile.jsx"
After a bit of digging I found that you can tell jshint to ignore warnings by placing your code between:
/* jshint ignore:start */
code goes here
/* jshint ignore:end */
Unfortunately, this only works for warnings (W### warning code) but not for errors (E### error code), which preprocessor directives fall under.
So if you're using jshint, are you able to get it to ignore error codes?
Any advice greatly appreciated.
John

http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

Similar Messages

  • How to use preprocessor directives as in C?

    I have a list of id's and corresponding names associated with them,i want to map the id's to the names during the first time program runs and to use the names after that instead of id's during run time(but not mapping the id to the name again and again during runtime,only once during the start of the program, something like preprocessor directives in c ) can this be done in labview.

    Hi Amit,
          A G implementation of "#define" seems to imply pre-compile graphical substitutions - that would be interesting.  Of course it's not supported and a work-around seems necessary.  I began reading this thread with the same enthusiasm for Enums as tst, and Falkpl, but at this point Enums seem unsatisfactory, expecially in light of your criteria of "not mapping the id to the name again and again during runtime,only once during the start of the program" (that seems to rule-out falkpl's #define VI, but what about tst's idea of parsing the enum's string-representation?)
          In "C", instead of the #define, one might accomplish the very same effect (maintaing values in one place) with [global] constants.  LabVIEW has constants too - they can be defined in one place and wired to wherever they're used - why not do that?  Are you trying to achieve a specific "look" or "effect" on the diagram?
    Cheers.
    const int a = 50;
    const int b = 10;
    int main()
       int ch;
      while(1)
       scanf("%d",&ch);
       switch(ch)
         case a: printf("Hiiiii");
         break;
         case b: printf("Hello");
         break;
         default:
    Message Edited by tbd on 01-28-2008 01:10 AM
    "Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)

  • C++ preprocessor directive to identify OSX

    I'm writing a cross platform console application. It already runs on Windows, Linux (all distros), Unix, and OSX. There is one system call in the code to clear the screen. Linux, Unix, and OSX use "clear" to clear the screen, while Windows (at the console level) uses "cls".
    While it is a trivial problem to change a macro each time I compile for a different platform, it would be nice to have a preprocessor directive do this for me. Can anyone help out here? What preprocessor directive would I use to identify that I'm compiling on/for OSX?
    Thanks.

    It depends. WIN32 is probably going to be defined. MSC_VER is probably going to be defined too. Check for your documentation for your Windows compiler. I am hedging my answer a bit because the answer depends on what compiler you are using. If you are using GCC, then you may not have those symbols defined. But, if you are using GCC on Windows then you probably have this problem to begin with.
    A better approach would be to write a "clear()" function for Windows that calls "cls". Then, your application doesn't need any OS identification. You would put the "clear()" function and all other Windows-specific code into a glue.c source file that is only linked into the Windows version.
    A good goal to aim for is to make your core application logic independent of any operating system. Each build system for each OS would have a set of ancillary files (like the glue.c source) that enables it to build for that OS. You want to keep that ancillary set of files as small as possible. If you have a console application, that should be easy. Code to the curses library and install some Windows curses port.

  • Preprocessor Directives

    We need preprocessor directives. Differentiation between
    Debug & Release builds would make life a lot easier.
    #define
    #ifdef
    #ifndef
    etc...

    http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

  • Flex 3 vs Flex 4 Preprocessor directives and code behind (External Actionscript file)

    I have a framework that I've built that I want to use on Flex3 and Flex4.
    I've added pre-processor directives as per this link (http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_21.html) and got my Flex 4 code to compile nicely.
    I then went to flex 3 and discovered my sub-class of Application wouldn't compile because it was based off of spark. No problem, I'll add in a directive.
    Except now my overridden class has duplicate code, specific to which SDK it is using.
    No problem, I'll put all of the application class code in an Actionscript file and include it in both Application class declarations for each directive.
    It works nicely in Flex 3, so I went to Flex 4, tried to compile and now I'm getting compiler errors saying things such as "The (private|public|protected) attribute may only be used on class property definitions." and "The (private|public|protected) attribute can only be used inside a package.
    This same file works in Flex 3, but not in Flex 4.
    What can I do to make the code compile in both places?
    I'll work on a simple case so I can upload some code.

    Nevermind.
    I got around this issue by renaming my sub-classed Application to "...Application".
    Now I can use a directive to specify an import statement for the extends Application portion rather than specifiing the fully qualified spark.components.Application or mx.core.Application.
    Lame - but done.

  • Beside preprocessor directives, what does # mean in C?

    I'm looking through the FFmpeg source code, and here's an example of what they're doing:
    #define REGISTER_MUXER(X,x) { \
        extern AVOutputFormat x##_muxer; \
        if(CONFIG_##X##_MUXER) av_register_output_format(&x##_muxer); }
    #define REGISTER_DEMUXER(X,x) { \
        extern AVInputFormat x##_demuxer; \
        if(CONFIG_##X##_DEMUXER) av_register_input_format(&x##_demuxer); }
    #define REGISTER_MUXDEMUX(X,x)  REGISTER_MUXER(X,x); REGISTER_DEMUXER(X,x)
    #define REGISTER_PROTOCOL(X,x) { \
        extern URLProtocol x##_protocol; \
        if(CONFIG_##X##_PROTOCOL) av_register_protocol2(&x##_protocol, sizeof(x##_protocol)); }
    x##_muxer, x##_demuxer, and x##_protocol don't look like they should be valid variable names. So why are they allowed here?

    It's valid preprocessor. the ## operator does concatenation.
    http://www.iso-9899.info/wiki/Snippets#Preprocessor

  • How to use preprocess​or directives (#define) in C++ header file with LabVIEW 8.2

    I have a C++ header file that contains around 2000 preprocessor directives:
    #define MEM_1   0xC
    #define MEM_2   0xD
    #define MEM_3   0x18
    I want to be able to "access" these memory offsets by identifier name (MEM_1) in my LabVIEW program like I would in a C++ program.  I do not want the overhead of parsing through the header file and storing all the offsets into an array or similar structure. 
    I've written a simple Win32 console program to return the memory offset given the identifier (see code below), and created a DLL to use with my LabVIEW program.  In the console program, you notice that I can call a function and pass in the identifer name, and get the offset back correctly:
    getOffset(MEM_1);
    In LabVIEW, I was hoping to be able to pass in the identifier (MEM_1) but was unsure what datatype to use.  In my C++ code, I defined the parameter as an int.  But in LabVIEW, I can't enter in MEM_1 as an int.   Can someone advise on how to do this?  Or if there is an alternate way to use #define's from external code inside LabVIEW?
    #include "stdafx.h"
    #include "scrmem.h"
    #include "stdio.h"
    void getOffset (int var);
    int _tmain(int argc, _TCHAR* argv[])
     getOffset(MEM_1);
    canf("%d");
     return 0;
    void getOffset (int var)
     printf("The address of MEM_1 is %x", var); 

    kaycea114 wrote:
    Hi,
    Where do you think I should use the string? 
    The way that getOffset is currently defined in the DLL, I have to connect an integer input into the LabVIEW function.  This prevents me from entering in: MEM_1 as the input to the LabVIEW function.
    Are you suggesting that I change getOffset to receive a String parameter ("MEM_1")?  Does that mean I need to do a string compare (line by line) through the header file to get the offset?  It seems like doing this search through the header file would degrade performance, but if that's the only work around, then I'll do it.
    Please advise.
    Well, what you want to do is indeed entering a string and getting back the assigned integer. That is what the C preprocessor is doing too although there it is done only once at the preprocessor stage of course and not at runtime anymore. But LabVIEW is not a C preprocessor.
    What you did so far seems to be to define getOffset() that accepts an enum that needs to be created from the C source code to then return the assigned constant. That's of course not very helpful.
    And writing a VI that could parse the C header file and create a name/constant array is really a lot easier than doing the same in C. You don't even need to parse the file each time again, but can instead cache them in an uninitialized shift register (LV2 style global).
    Even more easy would be to create from that data a ring control using property nodes and save it as custom control and voila you have the most direct lookup you can get in LabVIEW and it works just as comfortable as using the define in C code. It would mean that you need to seperate your header file possibly into several different files to only get related constants into the same ring control, but that is easily done.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • YahooMail in FireFox Only is not loading completely. Icons, Flags, Scrollbars etc not showing up

    This does not happen in IE, only FireFox. When Yahoo Mail loads it does not "Load" completely. Icons, Flags, Scrollbars, direction arrows, etc. do NOT load. The functions still exist and work, but if I didn't already know where some of them are located it would be impossible to use them because the "visual icons" do not show up.

    See:
    *[[Images or animations do not show]]
    *http://kb.mozillazine.org/Images_or_animations_do_not_load
    See also http://kb.mozillazine.org/Websites_look_wrong

  • Configuring Direct/Drop Shipment in APO

    We have a situation where the normal physical flow of goods as A>B>C can sometimes occur as A-->C, based on certain business conditions. Direct Shipment can be configured as a distribution channel in R/3. In R/3 world Drop and Direct shipment may be semantically different based on how billing is done. I wanted to know how the drop/direct shipment situation can be configured in APO, particularly in context of Heuristics and CTM. We want system to propose direct shipment, say based on cost to meet a demand. Is this possible at all with CTM or Heuristics? Is Optimizer the only tool to meet the requirement ? Will be great if someone can help me understand the implications/configurations of Drop/Direct Shipment in APO.

    Have you you tried this: -
    In transportation lanes there is a flag for direct delivery
    "In order that the system can plan direct deliveries via flagged transportation lanes, you must specify the value Consider Direct Delivery via Transportation Lanes in the Heu: Direct Delivery field in Customizing for SNP under Basic Settings -> Maintain Global SNP Settings.
    This parameter is valid for the SNP heuristic. It specifies whether the SNP heuristic considers direct deliveries from one location to another (such as from a production location to a customer location) via a transportation lane flagged for direct delivery. There is thus no detour via a distribution center.
    If you choose Consider Direct Delivery via Transportation Lanes, the system first checks if product quantities can be delivered via flagged transportation lanes. Then the system covers any remaining quantities using the standard source determination.
    The default value is No Direct Delivery."

  • Quick C preprocessor format question

    Really 2 questions. I want to use the same macro name to generate a list of fields, a list of method declarations and the code for the needed methods. What I am not sure about is (1) how to enclose a parameter to the macro so it will appear in a string in one definition, and (2) as part of a concatenated method name.
    My example#define name(par1,par2) -(void)par1:(int)par2;
    name(Name,myPoint)Gives me:-(void)Name:myPoint;No problem. Simple.
    For (1) will:#define name(par1,par2) NSString par1 = @"par2";
    name(myName,myPoint)give meNSString myName = @"myPoint";
    or
    NSString Name = @"par2";
    From my understanding I think that will do what I want and give me @"myPoint".
    For (2) What I want is:#define name(par1,par2) -(void)makeSome'par1:(int)par2;
    name(Name,myPoint)and get
    -(void)makeSomeName:(int)myPoint;
    I haven't been defining macros in C for a long long time, and I know this is possible, just not what syntax to use to make it work. I used the quote character to show concatenation, which some other macro processors I have used use. Someone with experience here, point me to a reference on C preprocessor macros formatting would be good.
    A correct example on how to define the 2nd macro would also help
    There's really not much in my K&R C Programming language, circa 1978 2nd printing...

    There's a section on the preprocessor in the book Beginning Mac OS X Programming by Wrox, but it's all based around C, not Objective-C like the code in your examples, so I don't know if that would be helpful to you or not.
    I'm not a very experienced programmer, so I was hesitant to even reply, and I'll warn you now that I don't think this post will be of any help to you, but since you haven't gotten any other replies yet, I figured I'd try. Hopefully someone else around here will come along and actually help you.
    Anyways, let's say you had two functions defined in your program -- their declarations are:
    void PrintAddresses( );
    void PrintPhoneNumbers( );
    you could ideally use a macro as a way of calling the desired function. In C, the basic syntax for writing a macro like the one you wrote often uses the ternary operator. I don't know enough about Objective-C to know how that would fit in, but in C it would be simple enough:
    #define Macro(param1, param2) (condition ? PrintAddresses : PrintPhoneNumbers)
    the condition could be anything (param1 > param2 for example). Then, later, if you need to choose a method name based on the criteria passed to the macro, you would pass the appropriate arguments to the macro to get the ternary operator to return the desired value. The function call would be something like this:
    Macro(arg1, arg2)( );
    The compiler never sees the preprocessor directives. The preprocessor simply runs over your code before the compiler gets to it, replacing any macros with the values specified for them. So, if the arguments passed to the macro resulted in the condition in the ternary operator in the #define directive to be true, then the words "Macro(arg1, arg2)" would be replaced with "PrintAddresses" and your function call would now look like "PrintAddresses( );" and thus the function PrintAddresses( ) would be called. If the arguments passed to the macro resulted in the condition being false, then the words "Macro(arg1, arg2)" would be replaced with "PrintPhoneNumbers" and your function call would now look like "PrintPhoneNumbers( );" and thus the function PrintPhoneNumbers( ) would be called.
    Note that if you take out the word "Print" from the macro values and try to define the macro like this:
    #define Macro(param1, param2) (condition ? Addresses : PhoneNumbers)
    and call the function like this:
    PrintMacro(arg1,arg2)();
    it will not work like this (or at least I could not get it to work like this) -- I don't know why.
    Anyways, you probably already knew everything I just wrote, in which case maybe it can help someone else down the line searching through this thread. Or maybe I should just stick to asking questions on this forum. Anyways, hope the post wasn't a complete waste of time. Best of luck in solving your problem.
    Message was edited by: Tron55555

  • Preprocessing Directives

    How can I implement the following PreProcessor Directives using the Sun WorkShop (CC) compiler? The code below works with the Visual Studio Compiler, the Sun compiler doesn't generate any messages.
    #ifdef MQCLIENT
    #pragma message ("Project is setup for an MQ Client Build")
    #else
    #pragma message ("Project is setup for an MQ SERVER Build")
    #endif

    Compiler pragmas are vendor specific. There is no assurance that a pragma that exists on one compiler exists on a different compiler. Furthermore, even if a pragma with the same name exists across the two compilers, you can have no expectation that it performs the same task.
    As a result, the only requirement regarding pragma is that every compiler (silently?) ignore any pragma directive it does not understand.
    I do not believe that the Sun compiler offers a documented pragma to accomplish what you want.

  • Precompiler directives?

    I just figure out that java does not support preprocessor directives such as #define, #ifdef, #ifndef, #if and so on.
    Is there any possibility or replacment in java for them in case I want to have different code for DEBUG and RELEASE version? How the next code could be realized in java:
    #define _DEBUG
    #ifdef _DEBUG
    System.out.println("some not importent for release but interesting for debugging information");
    #endif
    Thanks in advance!
    Vladimir

    I tend to have static methods in the same class as main() that does debug output, and control what they do with a static variable:
    static private boolean m_debugging=false;
    /* print a debug char */
    public static void dbg(char ch)
    if(m_debugging)
    System.out.print(ch);
    /* print a debug char */
    public static void dbg(String string)
    if(m_debugging)
    System.out.println(string);
    /** query debug state */
    public static boolean isDebugging()
    return m_debugging;
    these can be called from anywhere in the program because they are static:
    MainClass.debug("Some output");
    This has a similar effect to #ifdef _DEBUG                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Is there a 'compile time' if/else statement in LabVIEW

    I have some LabVIEW software that includes subVIs to read from and write to digital IO lines. However, I need to also be able to run this software on systems which don't have an IO card (or associated drivers) installed and so I want to be able to allow the software to be on PCs that do or don't have the drivers installed.
    Optimally, I would like to modify the software so that at runtime, by reading the settings in a configuration file, a boolean is set to determine whether the IO functions are called. I tried this but, unfortunately, am getting error messages when I try and start up the software due to the lack of the 'nidaq32.dll' file on the target PC. I'm guessing this is because the subVIs are only within case structures and so must be loaded into memory regardless of whether they are to be used.
    Is there any way around this problem? If I were writing this in C I guess I would use '#if' statements to include/exclude the IO functions at compile time. Is there an equivalent in LabVIEW? I guess my options are:
    1. Finding some way of allowing the IO functions to be included at runtime though I'm thinking this might not be possible.
    2. Include/exclude the IO functions at compile time with some LabVIEW equivalent of the C '#if' preprocessor directive.
    3. Give in and install the nidaq32.dll file with the software.
    Just to complicate matters, I'm currently running LabVIEW 5.0.1 (I do plan to upgrade soon) so am limited to the functions available in this version.
    Thanks.

    CAS wrote:
    Just to complicate matters, I'm currently running LabVIEW 5.0.1 (I do plan to upgrade soon) so am limited to the functions available in this version.
    That's the main problem.
    On newer versions you can:
    define simulated devices (http://zone.ni.com/devzone/cda/tut/p/id/3698)
    use the conditional disable structure (see e.g.: http://zone.ni.com/devzone/cda/tut/p/id/3046, (see section 6))
    Time to upgrade!
    Message Edited by altenbach on 06-21-2007 07:32 AM
    LabVIEW Champion . Do more with less code and in less time .

  • Creating PL/SQL web services from PL/SQL records

    Hello
    Jdeveloper does not allow to create web services from pl/sql packages that use PL/SQL records.to do this,we have to use the jpublisher ?without using the jpublisher,if we create a webservice then the following error is displayed in the web service xml output file.
    <faultstring>Internal Server Error (Caught exception while handling request: java.rmi.RemoteException: java.sql.SQLException: ORA-06550: line 1, column 49: PLS-00181: unsupported preprocessor directive '$WS_SP_EVEN' )</faultstring>
    </env:Fault>
    Could any one suggest me, how to solve the above issue..?
    Regards
    Malathi

    Thank you, with db adapter it was working and also
    pl/sql web-services working successfully with object types.If we want to send the web-services to the client, do we need to send the entire folder that is created in the web-services folder of the external oc4j..?
    Creating the client process:
    we are using the wsdl file that is generated in the web-services and adding to the partner link to Invoke the operations of web-services. Is there any other way to invoke the webservices?Could any one please suggest me?
    Thanking you
    Malathi

  • How to use one variable for 2 datatype inside class

    Dear all
    i have create 2 class GDI and OGL need use use in M_VIEW as per condition
    in the class M_VIEW (example below)
    #define M_FLAG 1
    class GDI {public: int z;};
    class OGL{public: double z;};
    // in class M_VIEWi need to use GDI or OGL as per user condition
    class M_VIEW{
    public:
    #if (M_FLAG == 1)
    GID UseThis;
    #else
    OGL UseThis;
    #endif
    this is work but it always it take OGL. of if i change condition it take GDI only. but i need to use it runtime as per user choice.
    how to switch GDI to OGL, and OGL to GDI on runtime ;
    is that possible to change M_FLAG  value on run time or is there any other way to achieve it.
    i have try with polymorphism also. switch is ok but all function does not work with dll. when call function on mouse move or some other event it take base class virtual function. it doesn't goes to derived class function. don't know why?
    base class function like this and does not have any variable. all function are virtual.
    virtual void MoveLine(POINT pt1, POINT pt2){};
    virtual void DrawLine(POINT pt1, POINT pt2){};
    please help.
    Thanks in Advance.

    Well, #define, and #if are compile time only constructs.  Technically they are processed before you program is compiled (that is why they are called preprocessor directives).  If you need to support both flavors at runtime you will need a different
    approach.
    Inheritance/polymorphism could be a good approach here, but I don't really understand what you are trying to do well enough to say for sure.  Based on guesses about what you want, here are some thoughts.
    class GDI {public: int z;};
    class OGL{public: double z;};
    class M_VIEW_BASE {
    virtual void MoveLine(POINT pt1, POINT pt2) = 0;
    virtual void DrawLine(POINT pt1, POINT pt2) = 0;
    class M_VIEW_GDI {
    GDI UseThis;
    void MoveLine(POINT pt1, POINT pt2) override {}
    void DrawLine(POINT pt1, POINT pt2) override {}
    class M_VIEW_OGL {
    OGL UseThis;
    void MoveLine(POINT pt1, POINT pt2) override {}
    void DrawLine(POINT pt1, POINT pt2) override {}
    std::unique_ptr<M_VIEW_BASE> drawBase;
    enum DrawMode { DrawGdi, DrawOgl };
    extern "C" __declspec(dllexport) void Init(DrawMode whichMode) {
    if (drawMode == DragGdi) {
    drawBase.reset(new M_VIEW_GDI);
    } else if (drawMode == DrawOgl) {
    drawBase.reset(new M_VIEW_OGL);
    } else {
    throw std::runtime_exception("whoops");
    extern "C" __declspec(dllexport) void MoveLine(POINT pt1, POINT pt2) {
    drawBase->MoveLine(pt1, pt2);
    extern "C" __declspec(dllexport) void DrawLine(POINT pt1, POINT pt2) {
    drawBase->DrawLine(pt1, pt2);

Maybe you are looking for

  • How to export csv without doublequote

    I ran the following comand ls |export-csv "d:\a.csv" The result is like the following, every field is double quoted, is there any way to not export double quote. Currently the silly approach I used is to first export-csv, and then read the file in an

  • Exception during commit of transaction in wli when using oracle database

    I have configured oracle Database instead of pointbase in wli 9.2 While getting the response through callback in wli process (from Worklist console)this errror is coming "Exception occurred during commit of transaction ". What should I do to remove t

  • I have latest Yosemite Developer Preview installed, do I have to reinstall OS after its release?

    Or should I continue using installed version and receive all the updates?

  • Local currency/document currency

    Hi I have a situation where local currency in GR=1000 & when IR is posted, the local currency changed to something else. Pls explain. Also what is the difference between local currency & document currency? thanks.

  • Live Clock

    I found a live clock script that I like. The problem I am having is pasting the script to where it needs to go. I have tried paste is various locations with no luck. Check it out and let me know what you think. Below is the link for my web page and t