mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 00:48:38 +00:00
genbindings/headers: more detailed include guards, use pragma once
This commit is contained in:
parent
2d665dd840
commit
d07996d2ed
@ -609,7 +609,7 @@ func cabiPreventStructDeclaration(className string) bool {
|
|||||||
func emitBindingHeader(src *CppParsedHeader, filename string, packageName string) (string, error) {
|
func emitBindingHeader(src *CppParsedHeader, filename string, packageName string) (string, error) {
|
||||||
ret := strings.Builder{}
|
ret := strings.Builder{}
|
||||||
|
|
||||||
includeGuard := "GEN_" + strings.ToUpper(strings.Replace(strings.Replace(filename, `.`, `_`, -1), `-`, `_`, -1))
|
includeGuard := "MIQT_" + strings.ToUpper(strings.Replace(strings.Replace(packageName, `/`, `_`, -1), `-`, `_`, -1)) + "_GEN_" + strings.ToUpper(strings.Replace(strings.Replace(filename, `.`, `_`, -1), `-`, `_`, -1))
|
||||||
|
|
||||||
bindingInclude := "../libmiqt/libmiqt.h"
|
bindingInclude := "../libmiqt/libmiqt.h"
|
||||||
|
|
||||||
@ -617,7 +617,8 @@ func emitBindingHeader(src *CppParsedHeader, filename string, packageName string
|
|||||||
bindingInclude = "../" + bindingInclude
|
bindingInclude = "../" + bindingInclude
|
||||||
}
|
}
|
||||||
|
|
||||||
ret.WriteString(`#ifndef ` + includeGuard + `
|
ret.WriteString(`#pragma once
|
||||||
|
#ifndef ` + includeGuard + `
|
||||||
#define ` + includeGuard + `
|
#define ` + includeGuard + `
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#ifndef MIQT_BINDING_H
|
#pragma once
|
||||||
#define MIQT_BINDING_H
|
#ifndef MIQT_LIBMIQT_LIBMIQT_H
|
||||||
|
#define MIQT_LIBMIQT_LIBMIQT_H
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user