Example #1
0
  public void ID()
      throws RAWException, IrregularWriteOperationException, IrregularStringOfBitsException {
    // if source registers are valid passing their own values into temporary registers
    Register rs = cpu.getRegister(params.get(RS_FIELD));
    Register rt = cpu.getRegister(params.get(RT_FIELD));
    if (rs.getWriteSemaphore() > 0 || rt.getWriteSemaphore() > 0) throw new RAWException();
    TR[RS_FIELD] = rs;
    TR[RT_FIELD] = rt;
    // locking the destination register

    cpu.getLO().incrWriteSemaphore();
    cpu.getHI().incrWriteSemaphore();
  }
Example #2
0
 public void doWB() throws IrregularStringOfBitsException {
   // passing results from temporary registers to destination registers and unlocking them
   Register lo = cpu.getLO();
   Register hi = cpu.getHI();
   lo.setBits(TR[LO_REG].getBinString(), 0);
   hi.setBits(TR[HI_REG].getBinString(), 0);
   lo.decrWriteSemaphore();
   hi.decrWriteSemaphore();
 }
Example #3
0
  public void _jspService(
      final javax.servlet.http.HttpServletRequest request,
      final javax.servlet.http.HttpServletResponse response)
      throws java.io.IOException, javax.servlet.ServletException {

    final java.lang.String _jspx_method = request.getMethod();
    if (!"GET".equals(_jspx_method)
        && !"POST".equals(_jspx_method)
        && !"HEAD".equals(_jspx_method)
        && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) {
      response.sendError(
          HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET POST or HEAD");
      return;
    }

    final javax.servlet.jsp.PageContext pageContext;
    javax.servlet.http.HttpSession session = null;
    final javax.servlet.ServletContext application;
    final javax.servlet.ServletConfig config;
    javax.servlet.jsp.JspWriter out = null;
    final java.lang.Object page = this;
    javax.servlet.jsp.JspWriter _jspx_out = null;
    javax.servlet.jsp.PageContext _jspx_page_context = null;

    try {
      response.setContentType("text/html; charset=UTF-8");
      pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");
      out.write("\r\n");
      out.write(
          "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
      out.write("<html>\r\n");
      out.write("<head>\r\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\r\n");
      out.write("<title>공지사항</title>\r\n");
      out.write(
          "<link href=\"http://netdna.bootstrapcdn.com/bootstrap/2.3.2/css/bootstrap.min.css\" rel=\"stylesheet\">\r\n");
      out.write("<style>\r\n");
      out.write("\t thead tr { background: #eee; }\r\n");
      out.write("\t tbody tr:hover { background-color: #DAD9FF; cursor: pointer; }\r\n");
      out.write("</style>\r\n");
      out.write("\r\n");
      out.write(
          "<script src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js\"></script>\r\n");
      out.write("<script>\r\n");
      out.write("\t$(function(){\r\n");
      out.write("\t\t $(\"tbody tr\").click(function(){\r\n");
      out.write("\t\t\t location.href=\"adminContent.jsp?idx=\"+$(this).attr(\"data-id\");\r\n");
      out.write("\t\t });\r\n");
      out.write("\t});\r\n");
      out.write("</script>\r\n");
      out.write("</head>\r\n");

      int id;
      id = (int) session.getAttribute("id");

      System.out.println(id);
      // 해당 학번=id(세션) 값으로 정보를 불러온다.
      User user = Register.selectDetail(id);

      ArrayList<Admin> list = AdminPage.selectAll();

      String cmd = request.getParameter("cmd");
      if (request.getMethod().equals("POST")) {
        if (cmd.equals("logout")) {
          session.invalidate();

          out.write("\r\n");
          out.write("\t\t\t\t<script>\r\n");
          out.write("\t\t\t\t\talert(\"로그아웃 되었습니다\");\r\n");
          out.write("\t\t\t\t\tlocation.href=\"login.jsp\";\r\n");
          out.write("\t\t\t\t</script>\r\n");
          out.write("\t\t\t");
        }
      }

      out.write("\r\n");
      out.write("\r\n");
      out.write("<body>\r\n");
      out.write("<div>\r\n");
      out.write("\t<form method=\"post\">\r\n");
      out.write(
          "\t\t<button class=\"btn btn-small\" name=\"cmd\" value=\"logout\">로그 아웃</button>\r\n");
      out.write("\t</form>\r\n");
      out.write("</div>\r\n");
      out.write("<div class=\"container\">\r\n");
      out.write("\t<h2>공지사항 게시판</h2><hr/>\r\n");
      out.write("\t<form>\r\n");
      out.write("\t\t<table class=\"table table-condensed table-bordered\">\r\n");
      out.write("\t\t\t<thead>\r\n");
      out.write("      \t\t<tr>\r\n");
      out.write("      \t\t\t<th>번호</th>\r\n");
      out.write("      \t\t\t<th>제목</th>\r\n");
      out.write("      \t\t\t<th>작성자</th>\r\n");
      out.write("      \t\t</tr>\r\n");
      out.write("      \t</thead>\r\n");
      out.write("      \t<tbody>\r\n");
      out.write("\t\t\t");
      for (Admin admin : list) {
        out.write("\r\n");
        out.write("\t\t\t<tr data-id=\"");
        out.print(admin.getIdx());
        out.write("\">\r\n");
        out.write("      \t\t\t<td>");
        out.print(admin.getIdx());
        out.write("</td>\r\n");
        out.write("      \t\t\t<td>");
        out.print(admin.getTitle());
        out.write("</td>\r\n");
        out.write("      \t\t\t<td>");
        out.print(admin.getName());
        out.write("</td>\r\n");
        out.write("    \t\t</tr>\r\n");
        out.write("    \t\t");
      }
      out.write("\r\n");
      out.write("     \t</tbody>\r\n");
      out.write("\t\t</table>\r\n");
      out.write("\t\t\r\n");
      out.write("\t\t");
      if (user.getLevel() == 2 || user.getLevel() == 3) {
        out.write("\r\n");
        out.write("\t\t<div>\r\n");
        out.write("\t\t\t<a href=\"adminWrite.jsp\" class=\"btn btn-small\">글쓰기</a>\r\n");
        out.write("\t\t</div>\r\n");
        out.write("\t\t");
      }
      out.write("\r\n");
      out.write("\t</form>\r\n");
      out.write("\t</div>\r\n");
      out.write("</body>\r\n");
      out.write("</html>");
    } catch (java.lang.Throwable t) {
      if (!(t instanceof javax.servlet.jsp.SkipPageException)) {
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try {
            if (response.isCommitted()) {
              out.flush();
            } else {
              out.clearBuffer();
            }
          } catch (java.io.IOException e) {
          }
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
        else throw new ServletException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }