How to find dynamically the current line number in the source file

Is there a mechanism like __LINE__ and __FILE__ macro in C to get dynamically
the current line number and file name of a source file?

Don't know - but others have asked too. Have you searched the forum? For example:
http://forum.java.sun.com/thread.jsp?forum=31&thread=210496

Similar Messages

  • SapScript, How do I read the current line number?

    I have sections of text - each in it's own element with an 'include' of the standard text.
    These sections are variable in size.
    All elements are in the MAIN window.
    I do not want a paragraph to split over two pages.
    How do I read the current line number within the sapscript before the section prints so I can issue a new-page command at the beginning of the paragraph?
    Thanks!

    Yes, that does work for paragraphs.
    If I have multiple elements to print from within a loop where "at first, at each and at last" each call the Sapscript funtcion write_form - how can I keep the whole section together.  protect/endprotect will keep each element together but not the group of elements.
    There must be a way to find the current line number.

  • How do I get the line number of the sales order and how do I save info?

    I am trying to create a form that is able to be called from a right click on the sales order matrix and will display some of the user defined fields associated with the line.
    I've managed to create a form and add a menu option to the right click but I'm now stuck because of the following:
    1. How to I know which line the user selected? I need the REAL Line Number from the RDR1 table because I need to use it on the data filter of the form.
    2. I hard coded a line to just to see if I can load a form and it appears to load and bind the data to the controls, but how do I save changes made? There are several text fields, combo boxes, and a picture control.

    Hi Coleman,
    1. The pVal returned form a menu event does no provide the LineId, but a pVal from a Item Event does. I suggest you use a DoubleClick or Control + Click on the Line to trigger an event that you can catch and use to launch your form.
    2. Please note that if the Sales Order line is closed you'll not be able to update the values. If it's not, then you need to instantiate a Sales Order document, get the correct document with the GetByKey method and update whatever fields you need.
                    Dim oSalesOrder As SAPbobsCOM.Documents = oCompany.GetBusinessObject(BoObjectTypes.oOrders)
                    If oSalesOrder.GetByKey(docentry) = True Then
                        oSalesOrder.Lines.SetCurrentLine(pVal.Row - 1)
                        oSalesOrder.Lines.UserFields.Fields.Item("U_MyUDF").Value = ""
                        oSalesOrder.Update()
                    End If
    Regards,
    Vítor Vieira

  • How to report current page number to the browser...

    I need to dynamicaly attach a script in a bunch of PDF files. The script will be attached when the user requests the document and the document will be embeded in the page like this:
    <embed id="PDFObj" src="test.pdf" width="100%" height="100%">
    I have a JavaScript in my webpage with a message handler:
    var PDFObject = document.getElementById("PDFObj");
    PDFObject.messageHandler =
      onMessage: function(aMessage)
        switch (aMessage[0])
          case "_pdf_PageOpened":
            alert("!_pdf_PageOpened!\n" + aMessage[1]);
            break;
    I'm using hostContainer.postMessage on Page/Open event and it works just fine when the event(action) is manualy attached.
    My question is:
    How to attach the Page/Open event on every page in the PDF file using script that runs on Acrobat Reader?
    In Acrobat Pro I can use Doc.setPageAction() but it doesn't work in Acrobat Reader that is embeded in the browser window.
    OR
    Is there any other way to report the current page number to the webbrowser for an embeded PDF?

    Hi,
    to get the current page, you can use the index of your master page ("Restricted").
    $ = $.parent.index +1
    and for the total pages use
    $ = $layout.pageCount()

  • Can the current line be highlighted using a background color or have the cursor flash?

    I use the split screen and left click in the Design pane to jump to where I want to be in the Code pane in Dreamweaver CS6. The problem is that it can be very hard to tell where the cursor is in the Code pane since the cursor doesn't flash.
    Is there a way to force Dreamweaver CS6 to change the background color of the currently selected line or at least have the cursor flash in both panes? There must be some way to make it easier to find the current line of code.
    Thanks.

    John Waller wrote:
    The cursor does not flash in Code View only when Code View is not in focus i.e. you're working in the Design View window in Split View.
    In those caases, I just highlight a word or two in Design View and the corresponding words are highlighted by DW in Code View (even when Code view is not in focus).
    Thanks. I've been doing that, but sometimes there is no text to highlight. I hoped Dreamweaver might have a hidden setting that I could enable. That's a lot of extra sliding of the hand/wrist for no good reason when it would be easy for the Dreamweaver programmers to change the background color of the current line or make the cursor flash or do something else to indicate where you are in the code besides making the user constantly make a smearing action with the mouse. All of those extra movements add up the wear and tear when you're trying to avoid getting a repetitive stress injury, especially if you already use mouse gestures in a browser.

  • Current line number in smartform

    Hi All,
              I need to know is there anyway that i can know the current line number in smartforms.
    My requirement is:
       I have 1 header item and its 3 line items, if there is no space in main area to display all the header and its line items , then it sould be printed in next page,
    Eg:                          PAGE 1
    HD       Line
    A           01
                 02
                 03
    B           01
                 02
                 03                       PAGE 2.
              if this is the case then whole B 01-03 should be printed in next page.

    Hi,
    Please search SDN for Page Protection in Smartform Table
    You will get lot of info.
    Regards,
    Vishal
    Edited by: Vishal Jadhav on Nov 5, 2008 12:36 PM

  • How to find the current line in the table control in module pool ?

    How to find the current line in the table control in module pool ?
    This is an urgent requirement? please do help me.

    refer to this example
    REPORT demo_dynpro_tabcont_loop_at.
    CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
    DATA: cols LIKE LINE OF flights-cols,
    lines TYPE i.
    DATA: ok_code TYPE sy-ucomm,
          save_ok TYPE sy-ucomm.
    DATA: itab TYPE TABLE OF demo_conn.
          TABLES demo_conn.
    SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE itab.
    LOOP AT flights-cols INTO cols WHERE index GT 2.
      cols-screen-input = '0'.
      MODIFY flights-cols FROM cols INDEX sy-tabix.
    ENDLOOP.
    CALL SCREEN 100.
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'SCREEN_100'.
    DESCRIBE TABLE itab LINES lines.
    flights-lines = lines.
    ENDMODULE.
    MODULE cancel INPUT.
      LEAVE PROGRAM.
    ENDMODULE.
    MODULE read_table_control INPUT.
      MODIFY itab FROM demo_conn INDEX<b> flights-current_line.</b>
    ENDMODULE.
    MODULE user_command_0100 INPUT.
      save_ok = ok_code.
      CLEAR ok_code.
      CASE save_ok.
        WHEN 'TOGGLE'.
          LOOP AT flights-cols INTO cols WHERE index GT 2.
            IF  cols-screen-input = '0'.
              cols-screen-input = '1'.
            ELSEIF  cols-screen-input = '1'.
              cols-screen-input = '0'.
          ENDIF.
      MODIFY flights-cols FROM cols INDEX sy-tabix.
    ENDLOOP.
        WHEN 'SORT_UP'.
          READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
          IF sy-subrc = 0.
            SORT itab STABLE BY (cols-screen-name+10) ASCENDING.
            cols-selected = ' '.
      MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDIF.
        WHEN 'SORT_DOWN'.
          READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
          IF sy-subrc = 0.
            SORT itab STABLE BY (cols-screen-name+10) DESCENDING.
            cols-selected = ' '.
      MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDIF.
        WHEN 'DELETE'.
          READ TABLE flights-cols INTO cols
                                  WITH KEY screen-input = '1'.
          IF sy-subrc = 0.
            LOOP AT itab INTO demo_conn WHERE mark = 'X'.
              DELETE itab.
    ENDLOOP.
          ENDIF.
    ENDCASE.
    ENDMODULE.

  • How to read current line number in function module sourrce code?

    Hi All,
    How to read current line number in function module sourrce code?
    regards,
    Anuj

    If you have new editor you would be able to see the line number. 
    Or in the Dump screen - there is a button called Debugger - click that you would be able to see the code where dump has occured..  you would be able to find the line number from there.
    To get the new editor with line number , you need to change the settingsin SE38.
    Regards
    Vivek

  • How to get the current month number

    Hi everyone,
    Does anybody know how to get the current month number in Oracle Discoverer Worksheet calculation?
    I try to use EUL_DATE_TRUNC(CURRENT_DATE, 'MM'), but instead I got 01-AUG-00.
    If I change the data display format to MM, it will give me "08" but if I use TO_NUMBER function to convert it to number I get error "invalid number"
    Is there anyway to get the current month value in number? Thanks

    Scott,
    Thank you so much! It works perfectly! :)
    Hope you have a great day ahead!
    Cheers,
    Angeline

  • I dont have any Applecare registration number. I bought my Mac a year before and is still under the warranty. I dnt how to find or purchase applecare registration number. Please help

    I dont have any Applecare registration number. I bought my Mac a year before and is still under the warranty. I dnt how to find or purchase applecare registration number. Please help

    Enter your MBP serial number here and you will then be able to determine the warranty status.
    https://selfsolve.apple.com/agreementWarrantyDynamic.do
    Ciao.

  • How to read a file and save the line number of  the last line read?

    Hi,
    I am using RandomAccessFile and file as my class. I am trying to read a log file as it gets updated and print it out to a java window. i so far have the framework setup but dont know how to save the last line number so.
    i need this variable so i dont reprint out the same line numbers to the java window. please advise.
    thanks!

    hi,
    i now have the line number of the last line read, but now when i reopen the file, how can i skip that number of lines?
    thanks,

  • How can we get the selected line number from JTextArea ?

    how can we get the selected line number from JTextArea ? and want to insert line/string given line number into JTextArea??? is it possible ?

    Praitheesh wrote:
    how can we get the selected line number from JTextArea ?
    textArea.getLineOfOffset(textArea.getCaretPosition());
    and want to insert line/string given line number into JTextArea??? is it possible ?
    int lineToInsertAt = 5; // Whatever you want.
    int offs = textArea.getLineStartOffset(lineToInsertAt);
    textArea.insert("Text to insert", offs);

  • HT1338 Can anyone tell me how to find what OS I'm using on the Mac? Tiger or Leopard? Also, how do I update from 10.6.8 to the latest version?

    Can anyone tell me how to find what OS I'm using on the Mac?
    Tiger or Leopard?
    Also, how do I update from 10.6.8 to the latest version?

    Go to the Apple menu and select "About This Mac". You will get a window similar to this one -
    You current OS X version number will be shown as I've marked.
    OS X 10.4.x is Tiger, 10.5.x is Leopard, 10.6.x is Snow Leopard, 10.7.x is Lion, and 10.8.x is Mountain Lion.
    Whether or not you can go to the latest OS X version depends upon your hardware -
    You will need to purchase the retail set for the OS X version you want; there is no pint in getting and installing any intermediate versions. Once the retail version has been installed, you can update it to the latest release for that version via download updater.

  • Statusbar displaying current line number?

    Hi,
    I am building a swing application where I have one text editor and one status bar. I want to display current line no in status bar. I tried with getCaretPosition() but it does not returns line number, is there any other way to get current line number to display it on status bar? Thanks.

    is there any other way to get current line number Did you search the forum?
    How about the keywords "current line number", taken directly from your question. So you can see its really not that hard to think of keywords to use in a search.

  • What is the command line equivalent of the *compress* tool in *Finder*

    I have an automatic build setup for our iPhone Apps. The one issue i face everytime is that the zip file that i create in the build using zip command is always rejected by iTunesConnect server as invalid binary. When i compress the .APP folder manually using Compress from the *Finder menu*, that archive is always accepted. The size of the zip files generated is slightly different.
    Does anyone know what would be the command line equivalent of the Compress used by the Finder ? I want to automate this process so that someone does not have to do a manual compress before uploading it to iTunesConnect.
    Thanks in advance,
    -TRS

    a Mac user wrote:
    That is odd, are you sure you are using the command line correctly then? Because zip-ing from the command line should be the exact same one as from the utility in OS X.
    It's not the same, though. As someone else pointed out, the Finder uses a program called "Archive Utility.app", found in "/System/Library/CoreServices". A quick look at the binary shows that it uses the following Unix command line apps:
    /usr/bin/macbinary
    /usr/bin/file
    /usr/bin/tar
    /usr/bin/applesingle
    /usr/bin/binhex
    /usr/bin/ditto
    /usr/bin/gunzip
    /usr/bin/bunzip2
    /usr/bin/uudecode
    /usr/bin/atos
    I would have to look into how iTunesConnect accepts files.
    iPhone apps are signed binaries, so if one byte is different when they arrive at the app store, they won't be accepted. The command line zip leaves out some information and so the package appears to have been tampered with and they're rejected.
    charlie

Maybe you are looking for