bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CC Mode 5.27 (Java); indentation bug in java mode


From: Francesco Potorti`
Subject: CC Mode 5.27 (Java); indentation bug in java mode
Date: Fri, 23 Feb 2001 13:12:31 +0100

Small bug when indenting comments.

emacs -q --no-site-init StationCallSignalling.java
M-x goto-line RET 412 RET
C-SPC
M-x goto-line RET 420 RET
M-C-\


Emacs  : GNU Emacs 21.0.99.2 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2001-02-22 on pot
Package: CC Mode 5.27 (Java)
Buffer Style: java

c-emacs-features: (1-bit)

current state:
==============
(setq
 c-basic-offset 2
 c-comment-only-line-offset '(0 . 0)
 c-block-comment-prefix "* "
 c-comment-prefix-regexp "//+\\|\\**"
 c-cleanup-list '(scope-operator)
 c-hanging-braces-alist '((brace-list-open) (brace-entry-open) 
(substatement-open after)
                          (block-close . c-snug-do-while) (extern-lang-open 
after) (inexpr-class-open after)
                          (inexpr-class-close before))
 c-hanging-colons-alist nil
 c-hanging-semi&comma-criteria '(c-semi&comma-inside-parenlist)
 c-backslash-column 48
 c-label-minimum-indentation 1
 c-offsets-alist '((string . c-lineup-dont-change)
                   (c . c-lineup-C-comments)
                   (defun-open . 0)
                   (defun-close . 0)
                   (defun-block-intro . +)
                   (class-open . 0)
                   (class-close . 0)
                   (inline-close . 0)
                   (knr-argdecl . 0)
                   (topmost-intro . 0)
                   (member-init-intro . +)
                   (member-init-cont . c-lineup-multi-inher)
                   (inher-intro . +)
                   (block-open . 0)
                   (block-close . 0)
                   (brace-list-open . 0)
                   (brace-list-close . 0)
                   (brace-list-intro . +)
                   (brace-list-entry . 0)
                   (brace-entry-open . 0)
                   (statement . 0)
                   (statement-case-intro . +)
                   (substatement . +)
                   (case-label . 0)
                   (do-while-closure . 0)
                   (else-clause . 0)
                   (catch-clause . 0)
                   (comment-intro . c-lineup-comment)
                   (arglist-cont . 0)
                   (arglist-cont-nonempty . c-lineup-arglist)
                   (stream-op . c-lineup-streamop)
                   (inclass . +)
                   (cpp-macro . -1000)
                   (cpp-macro-cont . c-lineup-dont-change)
                   (friend . 0)
                   (objc-method-intro . -1000)
                   (objc-method-args-cont . c-lineup-ObjC-method-args)
                   (objc-method-call-cont . c-lineup-ObjC-method-call)
                   (extern-lang-open . 0)
                   (extern-lang-close . 0)
                   (inextern-lang . +)
                   (namespace-open . 0)
                   (namespace-close . 0)
                   (innamespace . +)
                   (template-args-cont c-lineup-template-args +)
                   (inlambda . c-lineup-inexpr-block)
                   (lambda-intro-cont . +)
                   (inexpr-statement . 0)
                   (inexpr-class . +)
                   (inline-open . 0)
                   (topmost-intro-cont . +)
                   (statement-block-intro . +)
                   (knr-argdecl-intro . 5)
                   (substatement-open . +)
                   (label . +)
                   (statement-case-open . +)
                   (statement-cont . +)
                   (arglist-intro . c-lineup-arglist-intro-after-paren)
                   (arglist-close . c-lineup-arglist)
                   (access-label . 0)
                   (inher-cont . c-lineup-java-inher)
                   (func-decl-cont . c-lineup-java-throws)
                   )
 c-delete-function 'delete-char
 c-electric-pound-behavior nil
 c-indent-comments-syntactically-p nil
 c-tab-always-indent t
 defun-prompt-regexp nil
 tab-width 8
 comment-column 32
 parse-sexp-ignore-comments t
 auto-fill-function nil
 comment-multi-line t
 comment-start-skip "/\\*+ *\\|//+ *"
 fill-prefix nil
 paragraph-start "[     ]*\\(//+\\|\\**\\)?[    
]*\\(@\\(author\\|deprecated\\|exception\\|param\\|return\\|s\\(e\\(e\\|rial\\(\\|Data\\|Field\\)\\)\\|ince\\)\\|throws\\|version\\)\\|$\\)\\|^\f"
 adaptive-fill-mode t
 adaptive-fill-regexp "[        ]*\\(//+\\|\\**\\)?[    ]*\\([  ]*\\([-|#;>*]+ 
*\\|(?[0-9]+[.)] *\\)*\\)"
 )

===File ~/tmp/StationCallSignalling.java====================
/*
 * This is part of the GaliLEO package.
 * Copyright (C) 2000 Laurent Franck and Francesco Potortì
 * See file COPYING for copying conditions.
 */

// Last revision is $Id$
// made on $Date$ by $Author$
//

package GaliLEO.Station;

import GaliLEO.Node.*;
import GaliLEO.Connection.*;
import GaliLEO.Satellite.*;
import GaliLEO.Tools.*;

/**
 * This class implements call signalling for a station.
 *
 * Since the call signalling is not going to be customised, it a
 * standard class, not even a component.
 */
public class StationCallSignalling implements CallSignalling
{
  /**
   * The containing station.
   */
  public Station station;

  public void startComponent()
  {
  }

  public void postInitialisation(Object params[])
  {
    station=(Station)params[0];
  }

  public Object duplicate()
  {
    Debug.assert(false);
    return(null);                               // make the compiler happy
  }

  
    /*************************************************************************
     *************************************************************************
     * Connection creation:
     *   setupConnection
     *   setupUniConnection
     *   setupUniConnectionAllocate
     *************************************************************************
     *************************************************************************/

   /**
     * Perform call admission control in order to setup a new connection.  Do
     * that by calling by calling <code>setupUniConnection</code> on each
     * uniconnection.  Only called by {@link GaliLEO.Connection#setup} on the
     * source station.
     *
     * @param connection the connection that is set up
     */
  public void setupConnection(Connection connection)
  {
    UniConnection forward = connection.forward;
    UniConnection backward = connection.backward;
    UniConnection uc;

    // Copies requested to granted, initialises number of hops
    // and signalling delay.
    connection.state.setupInProgress(true);

    /*
     * Do it twice: one for uc=forward, one for uc=backward.
     * Exit from the loop on error.
     */
    for (uc = forward;
         uc != null;
         uc = (uc == forward) ? backward : null)
      {
        uc.first_hop = station.satellite_selection.firstSatellite(uc);
        if (uc.first_hop == null)
          {
            uc.state.setupSatelliteSelectionFailure(true);
            break;
          }
        uc.uplink = uc.first_hop.udl_selection.selectUplink(uc);
        if (uc.uplink == null)
          {
            uc.state.setupUdlSelectionFailure(true);
            break;
          }
        uc.last_hop = station.satellite_selection.lastSatellite(uc);
        if (uc.last_hop == null)
          {
            uc.state.setupSatelliteSelectionFailure(true);
            break;
          }
        uc.downlink = uc.last_hop.udl_selection.selectDownlink(uc);
        if (uc.downlink == null)
          {
            uc.state.setupUdlSelectionFailure(true);
            break;
          }

        // Do the call signalling for uni-connection
        setupUniConnection(uc);
        if (!uc.state.setupInProgress())
          {
            forward.requested_resources=null;
            backward.requested_resources=null;
            forward.granted_resources=null;
            backward.granted_resources=null;
            connection.state.copyFrom(uc.state);
            break;
          }

        // Allocate the resources: never fails
        uc.number_of_hops=0;
        if (uc == forward)
          setupUniConnectionAllocate(uc);
        else
          connection.destination.call_signalling.
            setupUniConnectionAllocate(uc);
        uc.allocated_resources = uc.granted_resources;
      }

    // Compute connection signalling delay
    connection.signalling_delay = Math.max(forward.signalling_delay,
                                           backward.signalling_delay);

    if (uc == forward)
      // Failure of setup for the forward connection
      {
        ;
      }

    else if (uc == backward)
      // Failure of setup for the backward connection
      {
        // Undo forward connection setup
        forward.number_of_hops=0;
        releaseUniConnectionAllocate(forward);
      }

    else
      connection.state.setupSuccessful(true);
  } // setupConnection


   /**
     * Perform call admission control in this station and on the first
     * satellite in order to set up a new uniconnection.  Called by
     * {@link #setupConnection}, by itself, and by {@link
     * GaliLEO.Satellite.SatelliteCallSignalling#setupUniConnection}
     *
     * @param uc the uniconnection that is set up
     */
  public void setupUniConnection(UniConnection uc)
  {
    if(Debug.on) Debug.print(Debug.STATION_CALL_SIGNALING,
                             Debug.METHOD_CALL,
                             "Station","setupUniConnection in station " +
                             station.identifier+"\n");

    uc.number_of_hops++;
    uc.signalling_delay+=0.010;

    // First check for available resources in the station
    if(Debug.on) Debug.print(Debug.STATION_CALL_SIGNALING,
                             Debug.METHOD_BODY,
                             "Station","CAC in station " +
                             station.identifier+"\n");

    station.qos_manager.callAdmissionControl(uc);

    if(uc.granted_resources!=null) {

      if(Debug.on) Debug.print(Debug.STATION_CALL_SIGNALING,
                               Debug.METHOD_BODY,
                               "Station","accepted\n");

      if(uc.number_of_hops==1) {

        // Invoke the call setup of the first satellite if this
        // station is the first hop station
        uc.first_hop.call_signalling.setupUniConnection(uc);
      }

    }
    else {
      if(Debug.on) Debug.print(Debug.STATION_CALL_SIGNALING,
                               Debug.METHOD_BODY,
                               "Station","rejected\n");

      uc.state.setupCacFailure(true);
    }
  } // setupUniConnection


   /**
     * Allocate resources for a uni-connection in this station and in the
     * destination station.  Calls {@link
     * GaliLEO.Satellite.SatelliteCallSignalling#setupUniConnectionAllocate} on
     * the source satellite.  Only called on the source station.
     *
     * @param uc the uniconnection to which resources are allocated.
     */
  public void setupUniConnectionAllocate(UniConnection uc)
  {
    if(Debug.on) Debug.print(Debug.STATION_CALL_SIGNALING,
                             Debug.METHOD_CALL,
                             "Station","setupUniConnectionAllocate in station " 
+
                             station.identifier+"\n");

    // Add the connection to the forwarding table
    station.forwarding_table.add(uc);

    if(Debug.on) Debug.print(Debug.STATION_CALL_SIGNALING,
                             Debug.DATA_STRUCT,
                             "Station","Forwarding table of station " +
                             station.identifier+"\n"+
                             station.forwarding_table);

    station.qos_manager.allocateResource(uc);

    uc.number_of_hops++;
    uc.signalling_delay+=0.010;

    if(uc.number_of_hops==1) {
      // Invoke the call setup allocate of the first satellite
      uc.route.firstSatellite().
        call_signalling.setupUniConnectionAllocate(uc);
    }
  } // setupUniConnectionAllocate

  
     /*************************************************************************
     *************************************************************************
     * Connection change:
     *   modifyConnection
     *   modifyUniConnection
     *   modifyUniConnectionAllocate
     *************************************************************************
     *************************************************************************/


    /**
     * Perform call admission control in this station and on the
     * route in order to prepare a connection requirements
     * modification. This method is invoked by an event.
     *
     * @param connection the connection that will be setup
     */
  public void modifyConnection(Connection connection)
  {
    UniConnection forward = connection.forward;
    UniConnection backward = connection.backward;
    UniConnection uc;

    // Copies requested to granted, initialises number of hops
    // and signalling delay.
    connection.state.modificationInProgress(true);

    /*
     * Do it twice: one for uc=forward, one for uc=backward.
     * Exit from the loop on error.
     */
    for (uc = forward;
         uc != null;
         uc = (uc == forward) ? backward : null)
      {
        if (uc == forward)
          modifyUniConnection(uc);
        else
          connection.destination.call_signalling.modifyUniConnection(uc);

        if (!uc.state.modificationInProgress())
          break;

        // Allocate the resources: never fails
        uc.number_of_hops=0;
        if (uc == forward)
          modifyUniConnectionAllocate(uc);
        else
          
connection.destination.call_signalling.modifyUniConnectionAllocate(uc);
        uc.allocated_resources = uc.granted_resources;
      }

    // Compute connection signalling delay
    connection.signalling_delay = Math.max(forward.signalling_delay,
                                           backward.signalling_delay);

    // Should distinguish between partial or total failure.  Currently,
    // any failure invalidates the modification and the connection
    // resources stay the same.
    if (uc == forward || uc == backward)
      // Failure of modification for the forward connection
      // or for the backward connection
      {
        connection.state.modificationFailed(true);
      }

    else
      connection.state.modificationSuccessful(true);
  } // modifyConnection


    /**
     * Perform call admission control in this station and on the
     * route in order to prepare a uni-connection requirements
     * modification.
     *
     * @param uc the uni-connection that will be setup
     */
  public void modifyUniConnection(UniConnection uc)
  {
    uc.number_of_hops++;
    uc.signalling_delay+=0.010;

    if(Debug.on) Debug.print(Debug.STATION_CALL_SIGNALING,
                             Debug.METHOD_CALL,
                             "Station","modifyUniConnection in station " +
                             station.identifier+"\n");

    // First check for available resources in the station
    if(Debug.on) Debug.print(Debug.STATION_CALL_SIGNALING,
                             Debug.METHOD_BODY,
                             "Station","CAC in station " +
                             station.identifier+"\n");

    station.qos_manager.callAdmissionControl(uc);

    if(uc.granted_resources!=null)
      {
        if(Debug.on) Debug.print(Debug.STATION_CALL_SIGNALING,
                                 Debug.METHOD_BODY,
                                 "Station","accepted\n");

        if(uc.number_of_hops==1)
          // Invoke the call modification of the first satellite
          uc.route.firstSatellite().call_signalling.modifyUniConnection(uc);
      }
    else
      {
        if(Debug.on) Debug.print(Debug.STATION_CALL_SIGNALING,
                                 Debug.METHOD_BODY,
                                 "Station","rejected\n");

        uc.state.modificationCacFailure(true);
      }
  } // modifyUniConnection


    /**
     * Modify the resources in the source station, in the destination
     * station. Then invoke modifyUniConnectionAllocate of the source
     * satellite.
     *
     * @param uc the uni-connection with modified requirements
     */
  public void modifyUniConnectionAllocate(UniConnection uc)
  {
    station.qos_manager.modifyResource(uc);

    uc.number_of_hops++;
    uc.signalling_delay+=0.010;

    if(Debug.on) Debug.print(Debug.STATION_CALL_SIGNALING,
                             Debug.METHOD_CALL,
                             "Station",
                             "modifyUniConnectionAllocate in station " +
                             station.identifier+"\n");

    if(uc.number_of_hops==1)
      // Invoke the call modification allocate of the first satellite
      uc.route.firstSatellite().call_signalling.modifyUniConnectionAllocate(uc);
  } // modifyUniConnectionAllocate

  
    /*************************************************************************
     *************************************************************************
     * Connection destruction:
     *   releaseConnection
     *   releaseUniConnectionAllocate
     *************************************************************************
     *************************************************************************/


    /**
     * Release an existing connection. This method is invoked by an
     * event
     *
     * @param connection the connection to release
     */
  public void releaseConnection(Connection connection)
  {
    UniConnection forward = connection.forward;
    UniConnection backward = connection.backward;;

    forward.number_of_hops = 0;
    releaseUniConnectionAllocate(forward);
    backward.number_of_hops = 0;
    connection.destination.call_signalling.
      releaseUniConnectionAllocate(backward);

    connection.state.released(true);
  } // releaseConnection


   /**
     * Release resources in the node and in the other
     * nodes of the route for this uni-connection. This method
     * is called for connection issued from a station and from the
     * constellation.
     *
     * @param uc the uni-connection that will be released
     */
  public void releaseUniConnectionAllocate(UniConnection uc)
  {
    if(Debug.on) Debug.print(Debug.STATION_CALL_SIGNALING,
                             Debug.METHOD_CALL,
                             "Station","releaseUniConnectionAllocate in station 
" +
                             station.identifier+"\n");

    // Remove the connection from the forwarding table
    station.forwarding_table.remove(uc);

    if(Debug.on) Debug.print(Debug.STATION_CALL_SIGNALING,
                             Debug.DATA_STRUCT,
                             "Station","Forwarding table of station " +
                             station.identifier+"\n"+
                             station.forwarding_table);

    // Release the resources in the station
    station.qos_manager.deallocateResource(uc);

    uc.number_of_hops++;
    uc.signalling_delay+=0.010;

    if(uc.number_of_hops==1)
      // Invoke the call modification allocate of the first satellite
      uc.route.firstSatellite().call_signalling.
        releaseUniConnectionAllocate(uc);
  } // releaseUniConnectionAllocate
}

/****
     Local variables:
     c-basic-offset: 2
     compile-command: "make -C .. -k"
     tags-file-name: "../TAGS"
     change-log-default-name: "../ChangeLog"
     End:
****/
============================================================



reply via email to

[Prev in Thread] Current Thread [Next in Thread]