Skip to content

Commit

Permalink
api adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
surban committed Sep 19, 2017
1 parent ca61523 commit 3fba08a
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 162 deletions.
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
{
"taskName": "generate",
"command": "cd PLplotNet; dotnet run -p ../Generator ../../plplot/doc/docbook/src",
"command": "cd PLplotNet; dotnet run -p ../Generator ../../PLplot/doc/docbook/src",
"type": "shell",
"group": "build",
"problemMatcher": "$msCompile"
Expand Down
2 changes: 1 addition & 1 deletion Generator/Gen.fs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ open Microsoft.CodeAnalysis.Editing


let skipStreamMethods =
["end"; "end1"; "gstrm"; "mkstrm"; "sstrm"; "cpstrm"]
["end"; "end1"; "mkstrm"; "sstrm"; "cpstrm"]
|> Set.ofList


Expand Down
49 changes: 1 addition & 48 deletions PLplotNet/NativeGenerated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2329,24 +2329,6 @@ public static void gDevs(out string[] p_menustr, out string[] p_devname)
[DllImport(DllName, EntryPoint = "pltr2f")]
public static extern void tr2f(PLFLT x, PLFLT y, out PLFLT tx, out PLFLT ty, PLPointer pltr_data);

/// <summary>plClearOpts: Clear internal option table info structure.</summary>
/// <remarks>Clear the internal options table info structure. This removes any option added with plMergeOpts as well as all default entries.</remarks>
[DllImport(DllName, EntryPoint = "plClearOpts")]
public static extern void ClearOpts();

/// <summary>plResetOpts: Reset internal option table info structure.</summary>
/// <remarks>Resets the internal command line options table to the default built in value. Any user options added with plMergeOpts will be cleared. See plparseopts for details of how to parse these options in a program.</remarks>
[DllImport(DllName, EntryPoint = "plResetOpts")]
public static extern void ResetOpts();

/// <summary>plSetUsage: Set the ascii character strings used in usage and syntax messages.</summary>
/// <param name="program_string">An ascii character string to appear as the name of program.</param>
/// <param name="usage_string">An ascii character string to appear as the usage text.</param>
/// <remarks>Sets the program string and usage string displayed by the command line help option (-h) and by plOptUsage.</remarks>
[DllImport(DllName, EntryPoint = "plSetUsage")]
public static extern void SetUsage([MarshalAs(UnmanagedType.LPStr)] string program_string,
[MarshalAs(UnmanagedType.LPStr)] string usage_string);

/// <summary>plsetopt: Set any command-line option</summary>
/// <param name="opt">An ascii character string containing the command-line option.</param>
/// <param name="optarg">An ascii character string containing the argument of the command-line option.</param>
Expand Down Expand Up @@ -2397,17 +2379,6 @@ public static PLINT parseopts(ref string[] argv, ParseOpts mode)
[DllImport(DllName, EntryPoint = "plOptUsage")]
public static extern void OptUsage();

/// <summary>plgfile: Get output file handle</summary>
/// <remarks>Gets the current output file handle, if applicable.</remarks>
[DllImport(DllName, EntryPoint = "plgfile")]
public static extern void gfile(out FILE p_file);

/// <summary>plsfile: Set output file handle</summary>
/// <param name="file">File pointer. The type (i.e. text or binary) doesn't matter on *ix systems. On systems where it might matter it should match the type of file that the output driver would produce, i.e. text for the postscript driver.</param>
/// <remarks>Sets the current output file handle, if applicable. If the file has has not been previously opened and is required by the driver, the user will be prompted for the file name. This routine, if used, must be called before initializing PLplot.</remarks>
[DllImport(DllName, EntryPoint = "plsfile")]
public static extern void sfile(FILE file);

/// <summary>Get the escape character for text strings.</summary>
[DllImport(DllName, EntryPoint = "plgesc")]
public static extern void gesc(out PLCHAR p_esc);
Expand All @@ -2416,24 +2387,6 @@ public static PLINT parseopts(ref string[] argv, ParseOpts mode)
[DllImport(DllName, EntryPoint = "pl_cmd")]
public static extern void cmd(PLINT op, PLPointer ptr);

/// <summary>plAlloc2dGrid: Allocate a block of memory for use as a matrix of type PLFLT_MATRIX.</summary>
/// <param name="f">If the allocation is a success, a pointer to a matrix (organized as an Iliffe column vector of pointers to row vectors) is returned. If the allocation is a failure, then the returned value of f will be NULL.</param>
/// <remarks>Allocates the memory for a matrix of type PLFLT_MATRIX (organized as an Iliffe column vector of pointers to row vectors). As a result the matrix can be accessed using C/C++ syntax like *f[i][j]. The memory associated with this matrix must be freed by calling plFree2dGrid once it is no longer required.</remarks>
[DllImport(DllName, EntryPoint = "plAlloc2dGrid")]
public static extern void Alloc2dGrid(out PLFLT_NC_MATRIX f, PLINT nx, PLINT ny);

/// <summary>plFree2dGrid: Free the memory associated with a PLFLT matrix allocated using plAlloc2dGrid.</summary>
/// <param name="f">A matrix to be freed after allocation by plAlloc2dGrid and all use of the matrix has been completed.</param>
/// <remarks>Frees a block of memory allocated using plAlloc2dGrid.</remarks>
[DllImport(DllName, EntryPoint = "plFree2dGrid")]
public static extern void Free2dGrid(PLFLT_NC_MATRIX f, PLINT nx, PLINT ny);

/// <summary>plMinMax2dGrid: Find the minimum and maximum of a PLFLT matrix of type PLFLT_MATRIX allocated using plAlloc2dGrid.</summary>
/// <param name="f">A matrix to find the maximum / minimum of.</param>
/// <remarks>Find the minimum and maximum of a PLFLT matrix of type PLFLT_MATRIX allocated using plAlloc2dGrid.</remarks>
[DllImport(DllName, EntryPoint = "plMinMax2dGrid")]
public static extern void MinMax2dGrid(PLFLT_MATRIX f, PLINT nx, PLINT ny, out PLFLT fmax, out PLFLT fmin);

/// <summary>plGetCursor: Wait for graphics input event and translate to world coordinates.</summary>
/// <param name="gin">Pointer to PLGraphicsIn structure which will contain the output. The structure is not allocated by the routine and must exist before the function is called.</param>
/// <remarks>Wait for graphics input event and translate to world coordinates. Returns 0 if no translation to world coordinates is possible.</remarks>
Expand All @@ -2444,7 +2397,7 @@ public static PLINT parseopts(ref string[] argv, ParseOpts mode)
/// <param name="gin">Pointer to a PLGraphicsIn structure to hold the input and output coordinates.</param>
/// <remarks>Convert from device to world coordinates. The variable gin must have members dX and dY set before the call.These represent the coordinates of the point as a fraction of the total drawing area. If the point passed in is on a window then the function returns 1, members wX and wY will be filled with the world coordinates of that point and the subwindow member will be filled with the index of the window on which the point falls. If the point falls on more than one window (because they overlap) then the window with the lowest index is used. If the point does not fall on a window then the function returns 0, wX and wY are set to 0 and subwindow remains unchanged.</remarks>
[DllImport(DllName, EntryPoint = "plTranslateCursor")]
public static extern PLINT TranslateCursor(out GraphicsIn gin);
public static extern PLINT TranslateCursor(ref GraphicsIn gin);

/// <summary>Set the pointer to the data used in driver initialisation</summary>
[DllImport(DllName, EntryPoint = "plsdevdata")]
Expand Down
12 changes: 8 additions & 4 deletions PLplotNet/NativeTmpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1555,24 +1555,24 @@ public static void gDevs(out string[] p_menustr, out string[] p_devname)

/* Command line parsing utilities */

/*
// Clear internal option table info structure.
[DllImport(DllName, EntryPoint = "plClearOpts")]
public static extern void ClearOpts();
// Reset internal option table info structure.
[DllImport(DllName, EntryPoint = "plResetOpts")]
public static extern void ResetOpts();

/*
// Merge user option table into internal info structure.
[DllImport(DllName, EntryPoint="plMergeOpts")]
public static extern PLINT MergeOpts( PLOptionTable *options, [MarshalAs(UnmanagedType.LPStr)] string name, [MarshalAs(UnmanagedType.LPStr)] string *notes );
*/
// Set the strings used in usage and syntax messages.
[DllImport(DllName, EntryPoint = "plSetUsage")]
public static extern void SetUsage([MarshalAs(UnmanagedType.LPStr)] string program_string,
[MarshalAs(UnmanagedType.LPStr)] string usage_string);
*/

// Process input strings, treating them as an option and argument pair.
// The first is for the external API, the second the work routine declared
Expand Down Expand Up @@ -1620,13 +1620,15 @@ public static PLINT parseopts(ref string[] argv, ParseOpts mode)

/* Miscellaneous */

/*
// Get the output file pointer
[DllImport(DllName, EntryPoint = "plgfile")]
public static extern void gfile(out FILE p_file);
// Set the output file pointer
[DllImport(DllName, EntryPoint = "plsfile")]
public static extern void sfile(FILE file);
*/

// Get the escape character for text strings.
[DllImport(DllName, EntryPoint = "plgesc")]
Expand Down Expand Up @@ -1665,6 +1667,7 @@ public static extern void GetName([MarshalAs(UnmanagedType.LPStr)] string dir,

/* Nice way to allocate space for a vectored 2d grid */

/*
// Allocates a block of memory for use as a 2-d grid of PLFLT's.
[DllImport(DllName, EntryPoint = "plAlloc2dGrid")]
public static extern void Alloc2dGrid(out PLFLT_NC_MATRIX f, PLINT nx, PLINT ny);
Expand All @@ -1676,14 +1679,15 @@ public static extern void GetName([MarshalAs(UnmanagedType.LPStr)] string dir,
// Find the maximum and minimum of a 2d matrix allocated with plAllc2dGrid().
[DllImport(DllName, EntryPoint = "plMinMax2dGrid")]
public static extern void MinMax2dGrid(PLFLT_MATRIX f, PLINT nx, PLINT ny, out PLFLT fmax, out PLFLT fmin);
*/

// Wait for graphics input event and translate to world coordinates
[DllImport(DllName, EntryPoint = "plGetCursor")]
public static extern PLINT GetCursor(out GraphicsIn gin);

// Translates relative device coordinates to world coordinates.
[DllImport(DllName, EntryPoint = "plTranslateCursor")]
public static extern PLINT TranslateCursor(out GraphicsIn gin);
public static extern PLINT TranslateCursor(ref GraphicsIn gin);

// Set the pointer to the data used in driver initialisation
[DllImport(DllName, EntryPoint = "plsdevdata")]
Expand Down
8 changes: 5 additions & 3 deletions PLplotNet/PLStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public PLStream()
throw new SystemException("cannot create PLplot stream");
}

/// <summary>Ends the PLplot stream.</summary>
~PLStream()
{
if (!disposed)
Expand All @@ -39,7 +40,7 @@ void IDisposable.Dispose()
}

/// <summary>The stream id of this stream as returned by plgstrm().</summary>
int Id
public int Id
{
get
{
Expand All @@ -56,12 +57,12 @@ public override string ToString()
return String.Format("PLplot stream {0}", streamId);
}

protected void ActivateStream()
private void ActivateStream()
{
Native.sstrm(Id);
}

protected void EndStream()
private void EndStream()
{
lock (libLock)
{
Expand Down Expand Up @@ -93,6 +94,7 @@ public void cpstrm(PLStream iplsr, bool flags)
Native.cpstrm(iplsr.Id, flags);
}
}

}

}
Loading

0 comments on commit 3fba08a

Please sign in to comment.