Zur Übersicht - INFO - Neueste 50 Beiträge - Neuer Beitrag - Suchen - FAQ - Zum CC1-Forum - Zum CC-Pro-Forum

Re: C2 Compiler Commandline Kategorie: Programmierung (von m??oe - 9.10.2005 0:28)
Als Antwort auf Re: C2 Compiler Commandline von André H. - 8.10.2005 18:02

.
> Du könntest höchstens die Compiler-DLL benutzen. Wie man diese jedoch
> in eigene Anwendungen einbinden kann, habe ich noch nicht geprüft.
>
> MfG André H.
>


Hi André,
auf meiner Festplatte, gaaaaanz weit unten, habe ich die DLL-Schnittstelle gefunden.
Damit kann, wer will und kann, ein Komandozeilen-Tool basteln

cc2comp.def


LIBRARY CC2Comp

DESCRIPTION 'C-Control II Compiler Library for Win32 IDE'

EXPORTS  

openProject
closeProject
renameProject
isValidModuleName
addModule
replaceModuleSource
removeAll
removeModule
setMessageBuffer
compileModule
beginBuild
finishBuild
getModuleLineInfos
getIdentDefPos
getIdentCompletions
getIdentFullName
writeOutputFile
getRequiredVMCBufferSize
fillVMCBuffer



cc2comp.h


/********************************************************************************

    project C-Control II

    cc2comp.h

    compiler DLL interface

*********************************************************************************/


#ifndef _cc2comp_h
#define _cc2comp_h

#ifndef STRICT
  #define STRICT
#endif

#define WIN32_LEAN_AND_MEAN
#include <windows.h>  
 

 
#define CC2COMP_API FAR PASCAL


#define C2_MODULE_HANDLE DWORD
#define PROJECT LPVOID

extern "C" {

// note: if not stated otherwise, all LPSTR mean pointer to a null-terminated
// string of 8-bit Windows (ANSI) characters.


PROJECT CC2COMP_API openProject ( LPSTR name );
/*
  create a new project object with a name;

  returns a PROJECT pointer after the object has been sucessfully created (else NULL),
  provide this pointer to subsequent calls of those functions below
*/



BOOL CC2COMP_API closeProject ( PROJECT project );
/*
  close and destroy a project object

  returns FALSE for bad project pointer
*/



BOOL CC2COMP_API renameProject ( PROJECT project, LPSTR name );
/*
  rename a project;

  returns FALSE for bad project pointer
*/



BOOL CC2COMP_API isValidModuleName( LPCSTR name );
/*
  check if a given name fulfills the C2 identifier name specifications

  returns TRUE if good, returns FALSE on bad name
*/



C2_MODULE_HANDLE CC2COMP_API addModule ( PROJECT project, LPSTR name, LPSTR source, DWORD options );
/*
  add a C2 source module to an open project;
  this module is appended to the end of the project's modules list


  project - pointer to project

  name    - module name, must be a valid C2-identifier (alphanumeric chars only, no whitespaces)

  source  - full path of file, e.g. "c:/projects/c2/test1.c2",
            or pointer to data stream in memory
 
  options - 0 - source is pointer to memory stream
            1 - source is path of file


  returns a handle value if the module has been successfully added to the project;

  returns 0xFFFF.FFFE if the given name is no valid C2 identifier

  returns 0xFFFF.FFFF if a module with the given name is already existing in the project;

  returns 0 if the module does not exist or any other fatal  exception was caught,
  then the project should be closed
*/



BOOL CC2COMP_API replaceModuleSource ( PROJECT project, C2_MODULE_HANDLE module, LPSTR source, DWORD options );
/*
  replace a module's C2 source; the function invalidates all previous translation results for every module
  from this modul downto the end of the list


  project - pointer to project

  module  - module handle

  source  - full path of file, e.g. "c:/projects/c2/test1.c2",
            or pointer to data stream in memory
 
  options - 0 - source is pointer to memory stream
            1 - source is path of file
 
 
  returns FALSE if the module does not exist or any other fatal exception was caught,
  then the project should be closed
*/



BOOL CC2COMP_API removeAll ( PROJECT project );
/*
  removes all modules from the list

  project - pointer to project

  returns FALSE if any fatal exception was caught, else TRUE
*/



BOOL CC2COMP_API removeModule ( PROJECT project, C2_MODULE_HANDLE module );  
/*
  remove a module from the project's modules list; the function invalidates
  all previous translation results for every remaining module beyond this one downto
  the end of the list


  project - pointer to project

  module  - module handle


  returns FALSE if the module does not exist or any other fatal exception was caught,
  then the project should be closed
*/



BOOL CC2COMP_API setMessageBuffer ( PROJECT project, LPSTR output, DWORD length );
/*
  set a project's compiler message output destination


  project - pointer to project

  output  - full path of file, e.g. "c:/projects/c2/testproject.log",
            or pointer to data stream in memory
            or NULL for standard console output

  length  - 0           -> disable any output
            0xFFFF.FFFF -> write output to file
            else        -> write max. length output bytes to memory
                          (including null-terminator)
       
 
  returns FALSE if the function failed, then the project should be closed
*/



DWORD CC2COMP_API compileModule ( PROJECT project, C2_MODULE_HANDLE module );
/*
  compile every invalidated (see above) or previously untranslated module,
  starting from the first module in the project's modules list downto the
  specified module, at least the specified module will be translated because
  it's declared invalid automatically;
  all compiled modules with errors remain or become invalid, the good ones become
  "clean" (means translated and valid);
  the function delcares every module beyond the specified one to be invalid;


  project - pointer to project

  module  - module handle


  returns following status result:

  0x0000.0000 - function call failed (fatal exception) -> close project

  0xFFFF.FFFF - success, no errors; call "getModuleLineInfos" for
                context information of every source line
 
  0x0???.???? - n (=0x???.????) compiler errors read and parse the compiler logs
                (see "setMessageBuffer") for error status and messages;
                call "getModuleLineInfos" for context information of
                every source line
*/



BOOL CC2COMP_API beginBuild ( PROJECT project );
BOOL CC2COMP_API finishBuild ( PROJECT project );



BOOL CC2COMP_API getModuleLineInfos ( PROJECT project, C2_MODULE_HANDLE module, LPSTR infos, DWORD linecount );
/*
  retrieve syntax context information for every single line of a compiled module

  project - pointer to project

  module  - module handle

  infos   - pointer to an array of bytes, without null-terminator, this array must
            be capable to take one byte for each line - check the number of lines
            when compiling the module before! don't call this function for uncompiled
            modules!


  each byte value is a combination of following states

    0 - LINE_EMPTY
    1 - LINE_EXECUTABLE        
  128 - LINE_ERROR


  returns FALSE if the function failed, then the project should be closed
*/



BOOL CC2COMP_API getIdentDefPos ( PROJECT project, LPSTR ident,
                                  C2_MODULE_HANDLE* module_ptr, DWORD* lino_ptr );
/*
  retrieve module and line number of an identifier's definition position

  project    - pointer to project

  ident      - identifer, e.g. "A.fx" for function fx of module A

  module_ptr - pointer to module handle

  lino_ptr   - pointer to line number


  before calling getIdentDefPos, values at module_ptr and lino_ptr must
  contain current context information;
  getIdentDefPos will replace both values at module_ptr and lino_ptr
  by identifier's definition position

  returns FALSE if ident could not be found from given context view, else TRUE
*/



BOOL CC2COMP_API getIdentCompletions ( PROJECT project, LPSTR ident,
                                       C2_MODULE_HANDLE module, DWORD lino,
                                       LPSTR completions, DWORD length );
/*
  get all valid completions for a given identifier

  project    - pointer to project

  ident      - identifer, e.g. "A" for a module A

  module      - context module handle

  lino        - context line number

  completions - pointer to buffer, where completions get listed as text
 
  length      - maximum length of buffer


  if module "A" had two functions "fx1", "fx2" and a variable "x",
  getIdentCompletions will fill completions with
  "fx1 (function)
   fx2 (function)
   x (variable)" , separeted by line feeds.

  returns FALSE if ident could not be found from given context view, else TRUE
*/




BOOL CC2COMP_API getIdentFullName ( PROJECT project, LPSTR ident,
                                    C2_MODULE_HANDLE module, DWORD lino,
                                    LPSTR fullname, DWORD length );
/*
  get the full name for a given identifier, the full name includes the whole
  identifier path, beginning from the module name,
  the full name is required when asking for a variable's mapcode during simulation run

  project    - pointer to project

  ident      - identifer

  module      - context module handle

  lino        - context line number

  fullname    - pointer to buffer, where the fullname shall be stored in
 
  length      - maximum length of buffer


  returns FALSE if something went wrong, you cannot use the fullname then
*/




BOOL CC2COMP_API writeOutputFile ( PROJECT project, LPSTR output );
/*
  write VM codes to an outputfile, to be called after successful build;
  full debug information is automatically stored in a separate file (*.dbg),
  provide this debug file to later simulator runs


  project - pointer to project

  output  - full path of file, e.g. "c:/projects/c2/testproject.out",
 
  returns FALSE if the function failed, then the project should be closed
*/



DWORD CC2COMP_API getRequiredVMCBufferSize ( PROJECT project );
/*
  ask for the required buffer size (see fillVMCBuffer below);
  call this function after successful writeOutputFile only

  project - pointer to project

  returns 0 on error, then the project should be closed
*/



BOOL CC2COMP_API fillVMCBuffer ( PROJECT project, LPSTR buffer );
/*
  write VM codes into a memory buffer;

  project - pointer to project
  buffer  - buffer of enough size (see getRequiredVMCBufferSize above)
 
  returns FALSE if the function failed, then the project should be closed
*/



}

#endif



viele Grü�e
m.


    Antwort schreiben


Antworten: