diff options
author | Karl Berry <karl@freefriends.org> | 2007-08-15 18:46:08 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2007-08-15 18:46:08 +0000 |
commit | b129936adac7b9712df9a011becb010d111ec61f (patch) | |
tree | f3eb76c81457520915a2fa06dcf0f36c2e0c08ba /Master/texmf-dist/tex/latex/upmethodology/upmethodology-code.sty | |
parent | a3e65cf58603aec6b27742b833f880c0f3372020 (diff) |
new package upmethodology (12aug07)
git-svn-id: svn://tug.org/texlive/trunk@4732 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/upmethodology/upmethodology-code.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/upmethodology/upmethodology-code.sty | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/upmethodology/upmethodology-code.sty b/Master/texmf-dist/tex/latex/upmethodology/upmethodology-code.sty new file mode 100644 index 00000000000..548d402c973 --- /dev/null +++ b/Master/texmf-dist/tex/latex/upmethodology/upmethodology-code.sty @@ -0,0 +1,143 @@ +% Source Code Description for Unified Process Methodology +% +% Copyright (c) 2006-2007 Stephane GALLAND <galland@arakhne.org> +% +% This program is free library; you can redistribute it and/or modify +% it under the terms of the GNU Lesser General Public License as +% published by the Free Software Foundation; either version 3 of the +% License, or any later version. +% +% This library is distributed in the hope that it will be useful, but +% WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +% Lesser General Public License for more details. +% +% You should have received a copy of the GNU Lesser General Public +% License along with this library; see the file COPYING. If not, +% write to the Free Software Foundation, Inc., 59 Temple Place - Suite +% 330, Boston, MA 02111-1307, USA. +% +% Creation date: 2006-04-27 +% Modifications: +% + +\global\edef\upm@package@code@ver{2006/04/27} + +\NeedsTeXFormat{LaTeX2e}[1995/12/01] +\ProvidesPackage{upmethodology-code}[\upm@package@code@ver] + +\RequirePackage{ifthen} +\RequirePackage{xspace} + +\def\upm@code@eat@spaces#1{#1} +\def\upm@code@makemul#1{\upm@code@eat@spaces{#1}\bgroup\textbf{s}\egroup\xspace} + +%----- +%Language +%0: UML +%1: java +%2: C++ +\newcount\upm@code@current@lang + +\DeclareOption{uml}{\upm@code@current@lang=0} +\DeclareOption{java}{\upm@code@current@lang=1} +\DeclareOption{cpp}{\upm@code@current@lang=2} + +\ExecuteOptions{uml} +\ProcessOptions + +%----- +%Language changes +\newcommand{\upmcodelang}[1]{% + \ifthenelse{\equal{#1}{java}}{% + \upm@code@current@lang=1% + }{% + \ifthenelse{\equal{#1}{cpp}}{% + \upm@code@current@lang=2% + }{% + \upm@code@current@lang=0% + }% + }% + \upm@code@declarations% +} + +\def\upm@code@declarations { +%----- +%PROTOTYPES +\gdef\jclass##1{\mbox{\textsc{##1}}\xspace} +\gdef\jinterface##1{\mbox{\textit{##1}}\xspace} +\gdef\jpackage##1{\mbox{\textsc{##1}}\xspace} +\gdef\jfunc##1{\texttt{##1}\xspace} + +%----- +%TYPES +\if\the\upm@code@current@lang 1 + %Java + \gdef\jclazz{\textbf{Class}\xspace} + \gdef\jvoid{\textbf{void}\xspace} + \gdef\jint{\textbf{int}\xspace} + \gdef\jlong{\textbf{long}\xspace} + \gdef\jfloat{\textbf{float}\xspace} + \gdef\jboolean{\textbf{boolean}\xspace} + \gdef\jdouble{\textbf{double}\xspace} + \gdef\jchar{\textbf{char}\xspace} + \gdef\jstring{\jclass{String}\xspace} + \gdef\jarray##1{{{##1}\bgroup\textbf{\string[\string]}\egroup}\xspace} + \gdef\jcollection##1{{\jclass{Collection}\textless{##1}\bgroup\textgreater\egroup}\xspace} + \gdef\jset##1{{\jclass{Set}\textless{##1}\bgroup\textgreater\egroup}\xspace} +\else\if\the\upm@code@current@lang 2 + %C++ + \gdef\jclazz{\textbf{class}\xspace} + \gdef\jvoid{\textbf{void}\xspace} + \gdef\jint{\textbf{int}\xspace} + \gdef\jlong{\textbf{long}\xspace} + \gdef\jfloat{\textbf{float}\xspace} + \gdef\jboolean{\textbf{bool}\xspace} + \gdef\jdouble{\textbf{double}\xspace} + \gdef\jchar{\textbf{char}\xspace} + \gdef\jstring{\jclass{std\string:\string:string}\xspace} + \gdef\jarray##1{{{##1}\bgroup\textbf{\string[\string]}\egroup}\xspace} + \gdef\jcollection##1{{\jclass{std\string:\string:vector}\textless{##1}\bgroup\textgreater\egroup}\xspace} + \gdef\jset##1{{\jclass{std\string:\string:set}\textless{##1}\bgroup\textgreater\egroup}\xspace} +\else + %UML + \gdef\jclazz{\textbf{class}\xspace} + \gdef\jvoid{\textbf{void}\xspace} + \gdef\jint{\textbf{integer}\xspace} + \gdef\jlong{\textbf{long integer}\xspace} + \gdef\jfloat{\textbf{float}\xspace} + \gdef\jboolean{\textbf{boolean}\xspace} + \gdef\jdouble{\textbf{double}\xspace} + \gdef\jchar{\textbf{character}\xspace} + \gdef\jstring{\textbf{string}\xspace} + \gdef\jcollection##1{{\textbf{collection of} \upm@code@makemul{##1}\bgroup\egroup}\xspace} + \gdef\jarray##1{{\textbf{array of} \upm@code@makemul{##1}\bgroup\egroup}\xspace} + \gdef\jset##1{{\textbf{set of} \upm@code@makemul{##1}\bgroup\egroup}\xspace} +\fi\fi + +%----- +%CONSTANTS +\if\the\upm@code@current@lang 1 + %Java + \gdef\jtrue{\textsc{true}\xspace} + \gdef\jfalse{\textsc{false}\xspace} +\else\if\upm@code@current@lang 2 + %C++ + \gdef\jtrue{\textsc{true}\xspace} + \gdef\jfalse{\textsc{false}\xspace} +\else + \gdef\jtrue{\textsc{true}\xspace} + \gdef\jfalse{\textsc{false}\xspace} +\fi\fi + +%----- +%OPERATIONS +\gdef\jop##1{\bgroup\jcode{##1}\egroup} +\gdef\jcall##1##2{\mbox{\jfunc{##1}\bgroup\texttt{\string({##2}\string)}\egroup}\xspace} +\gdef\jcode##1{\texttt{##1}\xspace} + +} + +\upm@code@declarations + +\endinput |